blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
e00c33434d3a8795a7f19ff8b0184a14f19a470e
[ "if date1 == date2:\n return 0\ndate1 = date1.split('.')\nday1 = int(date1[0])\nmonth1 = int(date1[1])\ndate2 = date2.split('.')\nday2 = int(date2[0])\nmonth2 = int(date2[1])\nif month1 == month2:\n return day1 - day2\nelse:\n return month1 - month2", "ok = 1\nwhile ok:\n ok = 0\n i = 0\n while ...
<|body_start_0|> if date1 == date2: return 0 date1 = date1.split('.') day1 = int(date1[0]) month1 = int(date1[1]) date2 = date2.split('.') day2 = int(date2[0]) month2 = int(date2[1]) if month1 == month2: return day1 - day2 e...
sort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sort: def datecmp(date1, date2): """Description: Compares date1 and date2 Input: date1, date2 Precondition: date1 and date2 are dates Output: date1 - date2 Postcondition: if date1 > date2, a > 0 number is returned/ 0 is returned if they are equal/ a < 0 number is returned otherwise""" ...
stack_v2_sparse_classes_36k_train_024800
2,170
no_license
[ { "docstring": "Description: Compares date1 and date2 Input: date1, date2 Precondition: date1 and date2 are dates Output: date1 - date2 Postcondition: if date1 > date2, a > 0 number is returned/ 0 is returned if they are equal/ a < 0 number is returned otherwise", "name": "datecmp", "signature": "def da...
3
stack_v2_sparse_classes_30k_train_018935
Implement the Python class `sort` described below. Class description: Implement the sort class. Method signatures and docstrings: - def datecmp(date1, date2): Description: Compares date1 and date2 Input: date1, date2 Precondition: date1 and date2 are dates Output: date1 - date2 Postcondition: if date1 > date2, a > 0 ...
Implement the Python class `sort` described below. Class description: Implement the sort class. Method signatures and docstrings: - def datecmp(date1, date2): Description: Compares date1 and date2 Input: date1, date2 Precondition: date1 and date2 are dates Output: date1 - date2 Postcondition: if date1 > date2, a > 0 ...
7cdf3b2d30829c866718a1aa53692e843930748a
<|skeleton|> class sort: def datecmp(date1, date2): """Description: Compares date1 and date2 Input: date1, date2 Precondition: date1 and date2 are dates Output: date1 - date2 Postcondition: if date1 > date2, a > 0 number is returned/ 0 is returned if they are equal/ a < 0 number is returned otherwise""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sort: def datecmp(date1, date2): """Description: Compares date1 and date2 Input: date1, date2 Precondition: date1 and date2 are dates Output: date1 - date2 Postcondition: if date1 > date2, a > 0 number is returned/ 0 is returned if they are equal/ a < 0 number is returned otherwise""" if date1...
the_stack_v2_python_sparse
fp/lab5-7v2/sort.py
anflorea/courses
train
5
749fbbaa0ff1f05bc68ce82b24c6552db5aeef81
[ "docker_args, docker_container = docker.get_base_docker_run_args(WORKSPACE, SANITIZER, LANGUAGE)\nself.assertEqual(docker_container, CONTAINER_NAME)\nexpected_docker_args = []\nexpected_docker_args = ['-e', 'FUZZING_ENGINE=libfuzzer', '-e', 'CIFUZZ=True', '-e', f'SANITIZER={SANITIZER}', '-e', 'ARCHITECTURE=x86_64',...
<|body_start_0|> docker_args, docker_container = docker.get_base_docker_run_args(WORKSPACE, SANITIZER, LANGUAGE) self.assertEqual(docker_container, CONTAINER_NAME) expected_docker_args = [] expected_docker_args = ['-e', 'FUZZING_ENGINE=libfuzzer', '-e', 'CIFUZZ=True', '-e', f'SANITIZER={...
Tests get_base_docker_run_args.
GetBaseDockerRunArgsTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetBaseDockerRunArgsTest: """Tests get_base_docker_run_args.""" def test_get_base_docker_run_args_container(self, _): """Tests that get_base_docker_run_args works as intended when inside a container.""" <|body_0|> def test_get_base_docker_run_args_no_container(self, _): ...
stack_v2_sparse_classes_36k_train_024801
4,414
permissive
[ { "docstring": "Tests that get_base_docker_run_args works as intended when inside a container.", "name": "test_get_base_docker_run_args_container", "signature": "def test_get_base_docker_run_args_container(self, _)" }, { "docstring": "Tests that get_base_docker_run_args works as intended when no...
2
null
Implement the Python class `GetBaseDockerRunArgsTest` described below. Class description: Tests get_base_docker_run_args. Method signatures and docstrings: - def test_get_base_docker_run_args_container(self, _): Tests that get_base_docker_run_args works as intended when inside a container. - def test_get_base_docker_...
Implement the Python class `GetBaseDockerRunArgsTest` described below. Class description: Tests get_base_docker_run_args. Method signatures and docstrings: - def test_get_base_docker_run_args_container(self, _): Tests that get_base_docker_run_args works as intended when inside a container. - def test_get_base_docker_...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class GetBaseDockerRunArgsTest: """Tests get_base_docker_run_args.""" def test_get_base_docker_run_args_container(self, _): """Tests that get_base_docker_run_args works as intended when inside a container.""" <|body_0|> def test_get_base_docker_run_args_no_container(self, _): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetBaseDockerRunArgsTest: """Tests get_base_docker_run_args.""" def test_get_base_docker_run_args_container(self, _): """Tests that get_base_docker_run_args works as intended when inside a container.""" docker_args, docker_container = docker.get_base_docker_run_args(WORKSPACE, SANITIZER, ...
the_stack_v2_python_sparse
infra/cifuzz/docker_test.py
google/oss-fuzz
train
9,438
360344bffecce399a668c5a77d9d76a15d9dd637
[ "super().__init__(syncthru, name)\nself._name = f'{name} Output Tray {number}'\nself._number = number\nself._id_suffix = f'_output_tray_{number}'", "if self.syncthru.is_online():\n self._attributes = self.syncthru.output_tray_status().get(self._number, {})\n self._state = self._attributes.get('status')\n ...
<|body_start_0|> super().__init__(syncthru, name) self._name = f'{name} Output Tray {number}' self._number = number self._id_suffix = f'_output_tray_{number}' <|end_body_0|> <|body_start_1|> if self.syncthru.is_online(): self._attributes = self.syncthru.output_tray_s...
Implementation of a Samsung Printer input tray sensor platform.
SyncThruOutputTraySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncThruOutputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_36k_train_024802
8,262
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, syncthru, name, number)" }, { "docstring": "Get the latest data from SyncThru and update the state.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_013822
Implement the Python class `SyncThruOutputTraySensor` described below. Class description: Implementation of a Samsung Printer input tray sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, number): Initialize the sensor. - def update(self): Get the latest data from SyncThru and upd...
Implement the Python class `SyncThruOutputTraySensor` described below. Class description: Implementation of a Samsung Printer input tray sensor platform. Method signatures and docstrings: - def __init__(self, syncthru, name, number): Initialize the sensor. - def update(self): Get the latest data from SyncThru and upd...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class SyncThruOutputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" <|body_0|> def update(self): """Get the latest data from SyncThru and update the state.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyncThruOutputTraySensor: """Implementation of a Samsung Printer input tray sensor platform.""" def __init__(self, syncthru, name, number): """Initialize the sensor.""" super().__init__(syncthru, name) self._name = f'{name} Output Tray {number}' self._number = number ...
the_stack_v2_python_sparse
homeassistant/components/syncthru/sensor.py
tchellomello/home-assistant
train
8
500a8ff1467263cf19a037146a292b852fcd2059
[ "self.user = user\nself.product = product\nsuper(RatingForm, self).__init__(*args, **kwargs)", "instance = super(RatingForm, self).save(commit=False)\ninstance.user = self.user\ninstance.product = self.product\nif commit:\n instance.save()\nreturn instance" ]
<|body_start_0|> self.user = user self.product = product super(RatingForm, self).__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> instance = super(RatingForm, self).save(commit=False) instance.user = self.user instance.product = self.product if commit: ...
Form for ratings.
RatingForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RatingForm: """Form for ratings.""" def __init__(self, user, product, *args, **kwargs): """We take a user and product argument and store it in the form instance for later reference.""" <|body_0|> def save(self, commit=True): """Make sure we store the user and pro...
stack_v2_sparse_classes_36k_train_024803
4,784
no_license
[ { "docstring": "We take a user and product argument and store it in the form instance for later reference.", "name": "__init__", "signature": "def __init__(self, user, product, *args, **kwargs)" }, { "docstring": "Make sure we store the user and product on the rating object.", "name": "save"...
2
stack_v2_sparse_classes_30k_test_000532
Implement the Python class `RatingForm` described below. Class description: Form for ratings. Method signatures and docstrings: - def __init__(self, user, product, *args, **kwargs): We take a user and product argument and store it in the form instance for later reference. - def save(self, commit=True): Make sure we s...
Implement the Python class `RatingForm` described below. Class description: Form for ratings. Method signatures and docstrings: - def __init__(self, user, product, *args, **kwargs): We take a user and product argument and store it in the form instance for later reference. - def save(self, commit=True): Make sure we s...
618dee93539ecc4d1ff20aafb138ee85b4d6173b
<|skeleton|> class RatingForm: """Form for ratings.""" def __init__(self, user, product, *args, **kwargs): """We take a user and product argument and store it in the form instance for later reference.""" <|body_0|> def save(self, commit=True): """Make sure we store the user and pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RatingForm: """Form for ratings.""" def __init__(self, user, product, *args, **kwargs): """We take a user and product argument and store it in the form instance for later reference.""" self.user = user self.product = product super(RatingForm, self).__init__(*args, **kwargs...
the_stack_v2_python_sparse
basic_webshop/forms.py
dokterbob/basic-webshop
train
1
b37ab6cdd367b1fa60d12ce33cc234d7a42c1eab
[ "if head == None:\n return False\np = head\nq = head.next\nwhile q != None:\n if p == q:\n return True\n p = p.next\n if q.next != None:\n q = q.next.next\n else:\n return False\nreturn False", "while head:\n if head.val == 'bjfuvth':\n return True\n else:\n ...
<|body_start_0|> if head == None: return False p = head q = head.next while q != None: if p == q: return True p = p.next if q.next != None: q = q.next.next else: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle1(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head == None: return False ...
stack_v2_sparse_classes_36k_train_024804
1,291
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle1", "signature": "def hasCycle1(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_019037
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle1(self, head): :type head: ListNode :rtype: bool - def hasCycle(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle1(self, head): :type head: ListNode :rtype: bool - def hasCycle(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def hasCycle1(self, ...
48b43999fb7e2ed82d922e1f64ac76f8fabe4baa
<|skeleton|> class Solution: def hasCycle1(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasCycle1(self, head): """:type head: ListNode :rtype: bool""" if head == None: return False p = head q = head.next while q != None: if p == q: return True p = p.next if q.next != None: ...
the_stack_v2_python_sparse
141.py
saleed/LeetCode
train
2
1f7a788e2751b98e0259b7d19f3e0c50ea3a2d44
[ "super().__init__()\nself.attn = EPTMultiHeadAttentionWeights(**config)\nself.dropout_p = 0.0\nself.dropout_attn = nn.Dropout(self.dropout_p)\nself.linear_v = nn.Linear(self.attn.hidden_dim, self.attn.hidden_dim)\nself.linear_out = nn.Linear(self.attn.hidden_dim, self.attn.hidden_dim)", "if key_value is None:\n ...
<|body_start_0|> super().__init__() self.attn = EPTMultiHeadAttentionWeights(**config) self.dropout_p = 0.0 self.dropout_attn = nn.Dropout(self.dropout_p) self.linear_v = nn.Linear(self.attn.hidden_dim, self.attn.hidden_dim) self.linear_out = nn.Linear(self.attn.hidden_di...
Class for computing multi-head attention (follows the paper, 'Attention is all you need') This class computes attention over K-V pairs with query Q, i.e.
EPTMultiHeadAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EPTMultiHeadAttention: """Class for computing multi-head attention (follows the paper, 'Attention is all you need') This class computes attention over K-V pairs with query Q, i.e.""" def __init__(self, **config): """Initialize MultiHeadAttention class :keyword int hidden_dim: Vector ...
stack_v2_sparse_classes_36k_train_024805
14,728
permissive
[ { "docstring": "Initialize MultiHeadAttention class :keyword int hidden_dim: Vector dimension of hidden states (H). 768 by default :keyword int num_heads: Number of attention heads (N). 12 by default :keyword float dropout_p: Probability of dropout. 0 by default", "name": "__init__", "signature": "def _...
2
null
Implement the Python class `EPTMultiHeadAttention` described below. Class description: Class for computing multi-head attention (follows the paper, 'Attention is all you need') This class computes attention over K-V pairs with query Q, i.e. Method signatures and docstrings: - def __init__(self, **config): Initialize ...
Implement the Python class `EPTMultiHeadAttention` described below. Class description: Class for computing multi-head attention (follows the paper, 'Attention is all you need') This class computes attention over K-V pairs with query Q, i.e. Method signatures and docstrings: - def __init__(self, **config): Initialize ...
be5595fc5f40f7d281f9318ff26095c0d15ed5da
<|skeleton|> class EPTMultiHeadAttention: """Class for computing multi-head attention (follows the paper, 'Attention is all you need') This class computes attention over K-V pairs with query Q, i.e.""" def __init__(self, **config): """Initialize MultiHeadAttention class :keyword int hidden_dim: Vector ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EPTMultiHeadAttention: """Class for computing multi-head attention (follows the paper, 'Attention is all you need') This class computes attention over K-V pairs with query Q, i.e.""" def __init__(self, **config): """Initialize MultiHeadAttention class :keyword int hidden_dim: Vector dimension of ...
the_stack_v2_python_sparse
mwptoolkit/module/Attention/multi_head_attention.py
TalhaAbid/MWPToolkit
train
0
2f680f92a24e61b51da3e8c26f3aaecb94ef5c3e
[ "self.chrom = str(chrom)\nself.this_id = str(this_id)\ntry:\n self.pos = int(pos)\nexcept ValueError:\n print(pos + ' was input as position of SNP with ID ' + this_id + \". Position '0' will be set and _ValueError appended to the ID.\")\n self.pos = 0\n self.this_id = self.this_id + '_ValueError'\nself....
<|body_start_0|> self.chrom = str(chrom) self.this_id = str(this_id) try: self.pos = int(pos) except ValueError: print(pos + ' was input as position of SNP with ID ' + this_id + ". Position '0' will be set and _ValueError appended to the ID.") self.pos...
Class for handling SNPs.
SNP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SNP: """Class for handling SNPs.""" def __init__(self, chrom, pos, this_id, ref, alt): """Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if n...
stack_v2_sparse_classes_36k_train_024806
5,097
no_license
[ { "docstring": "Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if not, the position is set to int(0) and '_ValueError' appended to self.ID. this_id : something that can ...
2
stack_v2_sparse_classes_30k_train_012603
Implement the Python class `SNP` described below. Class description: Class for handling SNPs. Method signatures and docstrings: - def __init__(self, chrom, pos, this_id, ref, alt): Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be conv...
Implement the Python class `SNP` described below. Class description: Class for handling SNPs. Method signatures and docstrings: - def __init__(self, chrom, pos, this_id, ref, alt): Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be conv...
dda36515c41cf435a1732a3e9dc6c35a0daedb8a
<|skeleton|> class SNP: """Class for handling SNPs.""" def __init__(self, chrom, pos, this_id, ref, alt): """Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SNP: """Class for handling SNPs.""" def __init__(self, chrom, pos, this_id, ref, alt): """Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if not, the posit...
the_stack_v2_python_sparse
analytic-modules/common_libs/filters/vcf_to_bed.py
korcsmarosgroup/iSNP
train
2
e770bc81cbfef62a5ae92d9cd9b93a2e546bf15d
[ "self.prefix_sums = []\nprefix_sum = 0\nfor weight in w:\n prefix_sum += weight\n self.prefix_sums.append(prefix_sum)\nself.total_sum = prefix_sum", "target = self.total_sum * random.random()\nfor i, prefix_sum in enumerate(self.prefix_sums):\n if target < prefix_sum:\n return i" ]
<|body_start_0|> self.prefix_sums = [] prefix_sum = 0 for weight in w: prefix_sum += weight self.prefix_sums.append(prefix_sum) self.total_sum = prefix_sum <|end_body_0|> <|body_start_1|> target = self.total_sum * random.random() for i, prefix_sum...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.prefix_sums = [] prefix_sum = 0 for weight in w: prefix_sum += ...
stack_v2_sparse_classes_36k_train_024807
845
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_007540
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
bbd01fb1785827c64ea28636352c6e0d7c8d62f4
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.prefix_sums = [] prefix_sum = 0 for weight in w: prefix_sum += weight self.prefix_sums.append(prefix_sum) self.total_sum = prefix_sum def pickIndex(self): """:rtype: int"...
the_stack_v2_python_sparse
misc/sampling_weight.py
iCodeIN/data_structures
train
0
1a79384472c7b5858646db5c053721bf8dca7635
[ "super(HonourAutoCombatHandler, self).start_combat()\nfor char in self.characters.values():\n character = char['char']\n character.start_auto_combat_skill()", "for char in self.characters.values():\n character = char['char']\n character.stop_auto_combat_skill()\nsuper(HonourAutoCombatHandler, self).fi...
<|body_start_0|> super(HonourAutoCombatHandler, self).start_combat() for char in self.characters.values(): character = char['char'] character.start_auto_combat_skill() <|end_body_0|> <|body_start_1|> for char in self.characters.values(): character = char['cha...
This implements the honour combat handler.
HonourAutoCombatHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HonourAutoCombatHandler: """This implements the honour combat handler.""" def start_combat(self): """Start a combat, make all NPCs to cast skills automatically.""" <|body_0|> def finish(self): """Finish a combat. Send results to players, and kill all failed chara...
stack_v2_sparse_classes_36k_train_024808
887
permissive
[ { "docstring": "Start a combat, make all NPCs to cast skills automatically.", "name": "start_combat", "signature": "def start_combat(self)" }, { "docstring": "Finish a combat. Send results to players, and kill all failed characters.", "name": "finish", "signature": "def finish(self)" }...
2
stack_v2_sparse_classes_30k_train_017570
Implement the Python class `HonourAutoCombatHandler` described below. Class description: This implements the honour combat handler. Method signatures and docstrings: - def start_combat(self): Start a combat, make all NPCs to cast skills automatically. - def finish(self): Finish a combat. Send results to players, and ...
Implement the Python class `HonourAutoCombatHandler` described below. Class description: This implements the honour combat handler. Method signatures and docstrings: - def start_combat(self): Start a combat, make all NPCs to cast skills automatically. - def finish(self): Finish a combat. Send results to players, and ...
4b4c6c0dc5cc237a5df012a05ed260fad1a793a7
<|skeleton|> class HonourAutoCombatHandler: """This implements the honour combat handler.""" def start_combat(self): """Start a combat, make all NPCs to cast skills automatically.""" <|body_0|> def finish(self): """Finish a combat. Send results to players, and kill all failed chara...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HonourAutoCombatHandler: """This implements the honour combat handler.""" def start_combat(self): """Start a combat, make all NPCs to cast skills automatically.""" super(HonourAutoCombatHandler, self).start_combat() for char in self.characters.values(): character = cha...
the_stack_v2_python_sparse
muddery/server/combat/honour_auto_combat_handler.py
nobodxbodon/muddery
train
0
354b2a07d87538d2ae3493609ff9912f12293456
[ "if user_level == 1:\n return u'体验级别'\nelif user_level >= 2 and user_level <= 6:\n return u'基本级别'\nelif user_level >= 7 and user_level <= 10:\n return u'黄金级别'\nelif user_level > 10:\n return u'VIP级别'\nelse:\n return u'神马级别'", "if user_level == 1:\n return AccountType.PRIME_TYPE\nelif user_level ...
<|body_start_0|> if user_level == 1: return u'体验级别' elif user_level >= 2 and user_level <= 6: return u'基本级别' elif user_level >= 7 and user_level <= 10: return u'黄金级别' elif user_level > 10: return u'VIP级别' else: return u'...
AccountType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountType: def get_type_desc(user_level): """10个level分4中类型,每个level对应的中文名称""" <|body_0|> def get_level_type(user_level): """10个level分4种类型,每个level对应的的大类别,暂时只用来显示页面用""" <|body_1|> <|end_skeleton|> <|body_start_0|> if user_level == 1: retu...
stack_v2_sparse_classes_36k_train_024809
8,480
no_license
[ { "docstring": "10个level分4中类型,每个level对应的中文名称", "name": "get_type_desc", "signature": "def get_type_desc(user_level)" }, { "docstring": "10个level分4种类型,每个level对应的的大类别,暂时只用来显示页面用", "name": "get_level_type", "signature": "def get_level_type(user_level)" } ]
2
stack_v2_sparse_classes_30k_train_017448
Implement the Python class `AccountType` described below. Class description: Implement the AccountType class. Method signatures and docstrings: - def get_type_desc(user_level): 10个level分4中类型,每个level对应的中文名称 - def get_level_type(user_level): 10个level分4种类型,每个level对应的的大类别,暂时只用来显示页面用
Implement the Python class `AccountType` described below. Class description: Implement the AccountType class. Method signatures and docstrings: - def get_type_desc(user_level): 10个level分4中类型,每个level对应的中文名称 - def get_level_type(user_level): 10个level分4种类型,每个level对应的的大类别,暂时只用来显示页面用 <|skeleton|> class AccountType: ...
8b1bb52051aed138e83e717c46fac397235c8115
<|skeleton|> class AccountType: def get_type_desc(user_level): """10个level分4中类型,每个level对应的中文名称""" <|body_0|> def get_level_type(user_level): """10个level分4种类型,每个level对应的的大类别,暂时只用来显示页面用""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountType: def get_type_desc(user_level): """10个level分4中类型,每个level对应的中文名称""" if user_level == 1: return u'体验级别' elif user_level >= 2 and user_level <= 6: return u'基本级别' elif user_level >= 7 and user_level <= 10: return u'黄金级别' elif ...
the_stack_v2_python_sparse
web/django/xpay/util/define.py
zhanghui9700/pykit
train
0
1766996703b2c6395758c05ab8ddf5af34d099c9
[ "Execute_Stage.__init__(self, instruction)\nself.wait_for_ibus = False\nself.word_hit = [True, True]\nself.word_cycles = self.calculate_required_memory_cycles()", "if not self.wait_for_ibus:\n if not self.word_hit[0]:\n Memory_Stage.bus_access_flag = True\n self.wait_for_ibus = True\n if not s...
<|body_start_0|> Execute_Stage.__init__(self, instruction) self.wait_for_ibus = False self.word_hit = [True, True] self.word_cycles = self.calculate_required_memory_cycles() <|end_body_0|> <|body_start_1|> if not self.wait_for_ibus: if not self.word_hit[0]: ...
Class for memory stage of pipepline.
Memory_Stage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Memory_Stage: """Class for memory stage of pipepline.""" def __init__(self, instruction): """Initialize the pipeline memory stage.""" <|body_0|> def execute(self, instruction): """Execute the memory stage.""" <|body_1|> def proceed(self): """...
stack_v2_sparse_classes_36k_train_024810
9,981
no_license
[ { "docstring": "Initialize the pipeline memory stage.", "name": "__init__", "signature": "def __init__(self, instruction)" }, { "docstring": "Execute the memory stage.", "name": "execute", "signature": "def execute(self, instruction)" }, { "docstring": "Proceed in the memory stag...
4
stack_v2_sparse_classes_30k_train_016141
Implement the Python class `Memory_Stage` described below. Class description: Class for memory stage of pipepline. Method signatures and docstrings: - def __init__(self, instruction): Initialize the pipeline memory stage. - def execute(self, instruction): Execute the memory stage. - def proceed(self): Proceed in the ...
Implement the Python class `Memory_Stage` described below. Class description: Class for memory stage of pipepline. Method signatures and docstrings: - def __init__(self, instruction): Initialize the pipeline memory stage. - def execute(self, instruction): Execute the memory stage. - def proceed(self): Proceed in the ...
fe92989ee0d1a864e3985fce3e708041c2917768
<|skeleton|> class Memory_Stage: """Class for memory stage of pipepline.""" def __init__(self, instruction): """Initialize the pipeline memory stage.""" <|body_0|> def execute(self, instruction): """Execute the memory stage.""" <|body_1|> def proceed(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Memory_Stage: """Class for memory stage of pipepline.""" def __init__(self, instruction): """Initialize the pipeline memory stage.""" Execute_Stage.__init__(self, instruction) self.wait_for_ibus = False self.word_hit = [True, True] self.word_cycles = self.calculate...
the_stack_v2_python_sparse
pipeline_execute_stage.py
manishc1/MIPS_Simulator
train
0
9ae02bbea2f4b5e58b1d7b7c81056a41435d3746
[ "self.condition = None\nif block:\n self.condition = threading.Condition()\n self.condition.acquire()\nself.lock_state = False\nif time is None:\n time = _t.time()\nself.time = time\nself.result = None\nself.initiator = initiator\nself.executor = executor\nself.result_queue = result_queue\nself.data = data...
<|body_start_0|> self.condition = None if block: self.condition = threading.Condition() self.condition.acquire() self.lock_state = False if time is None: time = _t.time() self.time = time self.result = None self.initiator = init...
Task
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Task: def __init__(self, time=None, result_queue=None, block=False, data=None, initiator=None, executor=None): """:param time 任务发起时间 :param result_queue 完成后该去的队列 :param block 是否阻塞 :param data 额外的数据 :param initiator 任务发起者 :param executor 任务执行者""" <|body_0|> def wait(self): ...
stack_v2_sparse_classes_36k_train_024811
1,875
no_license
[ { "docstring": ":param time 任务发起时间 :param result_queue 完成后该去的队列 :param block 是否阻塞 :param data 额外的数据 :param initiator 任务发起者 :param executor 任务执行者", "name": "__init__", "signature": "def __init__(self, time=None, result_queue=None, block=False, data=None, initiator=None, executor=None)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_017490
Implement the Python class `Task` described below. Class description: Implement the Task class. Method signatures and docstrings: - def __init__(self, time=None, result_queue=None, block=False, data=None, initiator=None, executor=None): :param time 任务发起时间 :param result_queue 完成后该去的队列 :param block 是否阻塞 :param data 额外的...
Implement the Python class `Task` described below. Class description: Implement the Task class. Method signatures and docstrings: - def __init__(self, time=None, result_queue=None, block=False, data=None, initiator=None, executor=None): :param time 任务发起时间 :param result_queue 完成后该去的队列 :param block 是否阻塞 :param data 额外的...
947469a73a158102831ee3cc4f52e583c9f6c5cc
<|skeleton|> class Task: def __init__(self, time=None, result_queue=None, block=False, data=None, initiator=None, executor=None): """:param time 任务发起时间 :param result_queue 完成后该去的队列 :param block 是否阻塞 :param data 额外的数据 :param initiator 任务发起者 :param executor 任务执行者""" <|body_0|> def wait(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Task: def __init__(self, time=None, result_queue=None, block=False, data=None, initiator=None, executor=None): """:param time 任务发起时间 :param result_queue 完成后该去的队列 :param block 是否阻塞 :param data 额外的数据 :param initiator 任务发起者 :param executor 任务执行者""" self.condition = None if block: ...
the_stack_v2_python_sparse
EasySpider/Base/Task.py
corpsepiges/EasySpider
train
1
ed26f15cf2cac17b51a8bc924b1ecbf624d752e2
[ "self.send_response(resp)\nself.send_header('Content-type', 'application/json')\nself.end_headers()", "global health_state\nself._set_headers(200)\nself.wfile.write(health_state.as_json())" ]
<|body_start_0|> self.send_response(resp) self.send_header('Content-type', 'application/json') self.end_headers() <|end_body_0|> <|body_start_1|> global health_state self._set_headers(200) self.wfile.write(health_state.as_json()) <|end_body_1|>
Custom HTTP handler for Mauka's health requests.
HealthRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealthRequestHandler: """Custom HTTP handler for Mauka's health requests.""" def _set_headers(self, resp: int): """Custom heaser setting method. :param resp: The response type.""" <|body_0|> def do_GET(self): """Returns the health state as JSON to the requestee. ...
stack_v2_sparse_classes_36k_train_024812
3,495
no_license
[ { "docstring": "Custom heaser setting method. :param resp: The response type.", "name": "_set_headers", "signature": "def _set_headers(self, resp: int)" }, { "docstring": "Returns the health state as JSON to the requestee. :return: The health state as JSON", "name": "do_GET", "signature"...
2
stack_v2_sparse_classes_30k_train_017653
Implement the Python class `HealthRequestHandler` described below. Class description: Custom HTTP handler for Mauka's health requests. Method signatures and docstrings: - def _set_headers(self, resp: int): Custom heaser setting method. :param resp: The response type. - def do_GET(self): Returns the health state as JS...
Implement the Python class `HealthRequestHandler` described below. Class description: Custom HTTP handler for Mauka's health requests. Method signatures and docstrings: - def _set_headers(self, resp: int): Custom heaser setting method. :param resp: The response type. - def do_GET(self): Returns the health state as JS...
0795f6140bc93c0a74d8ac788bdea547428517b5
<|skeleton|> class HealthRequestHandler: """Custom HTTP handler for Mauka's health requests.""" def _set_headers(self, resp: int): """Custom heaser setting method. :param resp: The response type.""" <|body_0|> def do_GET(self): """Returns the health state as JSON to the requestee. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HealthRequestHandler: """Custom HTTP handler for Mauka's health requests.""" def _set_headers(self, resp: int): """Custom heaser setting method. :param resp: The response type.""" self.send_response(resp) self.send_header('Content-type', 'application/json') self.end_header...
the_stack_v2_python_sparse
mauka/plugins/status_plugin.py
vinipletsch/opq
train
0
45b7c97a3248f1c0a43060a28a51e4ee325c8078
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('CancelTask', params, headers=headers)\n response = json.loads(body)\n model = models.CancelTaskResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n if isinstance(e,...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('CancelTask', params, headers=headers) response = json.loads(body) model = models.CancelTaskResponse() model._deserialize(response['Response']) ...
VmClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmClient: def CancelTask(self, request): """This API is used to cancel a video moderation task. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20210922.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20210922.models.CancelTaskResponse`...
stack_v2_sparse_classes_36k_train_024813
4,797
no_license
[ { "docstring": "This API is used to cancel a video moderation task. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20210922.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20210922.models.CancelTaskResponse`", "name": "CancelTask", "signature": "def C...
4
stack_v2_sparse_classes_30k_train_016289
Implement the Python class `VmClient` described below. Class description: Implement the VmClient class. Method signatures and docstrings: - def CancelTask(self, request): This API is used to cancel a video moderation task. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v202109...
Implement the Python class `VmClient` described below. Class description: Implement the VmClient class. Method signatures and docstrings: - def CancelTask(self, request): This API is used to cancel a video moderation task. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v202109...
042b4d7fb609d4d240728197901b46008b35d4b0
<|skeleton|> class VmClient: def CancelTask(self, request): """This API is used to cancel a video moderation task. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20210922.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20210922.models.CancelTaskResponse`...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VmClient: def CancelTask(self, request): """This API is used to cancel a video moderation task. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20210922.models.CancelTaskRequest` :rtype: :class:`tencentcloud.vm.v20210922.models.CancelTaskResponse`""" tr...
the_stack_v2_python_sparse
tencentcloud/vm/v20210922/vm_client.py
TencentCloud/tencentcloud-sdk-python-intl-en
train
4
0f5836b8c449965e0f46488aa183944ce7d17a7b
[ "if is_header:\n return '跟进记录'\nrecord_url = reverse('stark:problem_followuprecord_list', kwargs={'problem_id': obj.pk})\nreturn mark_safe('<a href=\"%s\">跟进记录</a>' % record_url)", "model_form_class = self.get_model_form_class(True, request, None, *args, **kwargs)\nif request.method == 'GET':\n form = mode...
<|body_start_0|> if is_header: return '跟进记录' record_url = reverse('stark:problem_followuprecord_list', kwargs={'problem_id': obj.pk}) return mark_safe('<a href="%s">跟进记录</a>' % record_url) <|end_body_0|> <|body_start_1|> model_form_class = self.get_model_form_class(True, re...
ProblemHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemHandler: def display_follow_up_record(self, obj=None, is_header=None, *args, **kwargs): """问题跟进记录 :param obj: :param is_header: :param args: :param kwargs: :return:""" <|body_0|> def add_view(self, request, *args, **kwargs): """添加页面 :param request: :param args...
stack_v2_sparse_classes_36k_train_024814
3,201
no_license
[ { "docstring": "问题跟进记录 :param obj: :param is_header: :param args: :param kwargs: :return:", "name": "display_follow_up_record", "signature": "def display_follow_up_record(self, obj=None, is_header=None, *args, **kwargs)" }, { "docstring": "添加页面 :param request: :param args: :param kwargs: :return...
2
stack_v2_sparse_classes_30k_train_018000
Implement the Python class `ProblemHandler` described below. Class description: Implement the ProblemHandler class. Method signatures and docstrings: - def display_follow_up_record(self, obj=None, is_header=None, *args, **kwargs): 问题跟进记录 :param obj: :param is_header: :param args: :param kwargs: :return: - def add_vie...
Implement the Python class `ProblemHandler` described below. Class description: Implement the ProblemHandler class. Method signatures and docstrings: - def display_follow_up_record(self, obj=None, is_header=None, *args, **kwargs): 问题跟进记录 :param obj: :param is_header: :param args: :param kwargs: :return: - def add_vie...
8017a63631b994e67d3aaa342a7ea6e60fe6fe9c
<|skeleton|> class ProblemHandler: def display_follow_up_record(self, obj=None, is_header=None, *args, **kwargs): """问题跟进记录 :param obj: :param is_header: :param args: :param kwargs: :return:""" <|body_0|> def add_view(self, request, *args, **kwargs): """添加页面 :param request: :param args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProblemHandler: def display_follow_up_record(self, obj=None, is_header=None, *args, **kwargs): """问题跟进记录 :param obj: :param is_header: :param args: :param kwargs: :return:""" if is_header: return '跟进记录' record_url = reverse('stark:problem_followuprecord_list', kwargs={'prob...
the_stack_v2_python_sparse
PHM/problem/views/problem.py
Mrs-wang1/python-test
train
0
139f0d89a835b48f41f5def957f38dc6471f7b4c
[ "offer_id = kwargs.pop('offer_id')\nself.offer_init = Offer.objects.get(id=offer_id)\nsuper(OfferEditForm, self).__init__(*args, **kwargs)", "offer_item = self.cleaned_data['offer_item']\nif self.offer_init.item.name != offer_item:\n offer = Offer.objects.filter(org=self.org, item__name=offer_item)\n if off...
<|body_start_0|> offer_id = kwargs.pop('offer_id') self.offer_init = Offer.objects.get(id=offer_id) super(OfferEditForm, self).__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> offer_item = self.cleaned_data['offer_item'] if self.offer_init.item.name != offer_item: ...
OfferEditForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfferEditForm: def __init__(self, *args, **kwargs): """a) org from parent view b) existing offer""" <|body_0|> def clean_offer_item(self): """if offer item was changed, check there is not an existing offer""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_024815
33,948
no_license
[ { "docstring": "a) org from parent view b) existing offer", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "if offer item was changed, check there is not an existing offer", "name": "clean_offer_item", "signature": "def clean_offer_item(self)" ...
2
stack_v2_sparse_classes_30k_train_013718
Implement the Python class `OfferEditForm` described below. Class description: Implement the OfferEditForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): a) org from parent view b) existing offer - def clean_offer_item(self): if offer item was changed, check there is not an existing o...
Implement the Python class `OfferEditForm` described below. Class description: Implement the OfferEditForm class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): a) org from parent view b) existing offer - def clean_offer_item(self): if offer item was changed, check there is not an existing o...
2498606b32ee3fcfada3e4f62d16cc419b6d1a4c
<|skeleton|> class OfferEditForm: def __init__(self, *args, **kwargs): """a) org from parent view b) existing offer""" <|body_0|> def clean_offer_item(self): """if offer item was changed, check there is not an existing offer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfferEditForm: def __init__(self, *args, **kwargs): """a) org from parent view b) existing offer""" offer_id = kwargs.pop('offer_id') self.offer_init = Offer.objects.get(id=offer_id) super(OfferEditForm, self).__init__(*args, **kwargs) def clean_offer_item(self): "...
the_stack_v2_python_sparse
openCurrents/forms.py
nickolashe/opencurrents-1
train
0
f603e141e239693960b3156121d59df40fbc2e97
[ "form_errors = form.errors\nfor fields_error in form_errors.keys():\n for error in form_errors[fields_error]:\n messages.error(self.request, fields_error + ': ' + error, 'danger')", "self.object = form.save(commit=False)\nself.object.tutor2 = tutor2\nif self.request.user.groups.filter(name='Teachers').e...
<|body_start_0|> form_errors = form.errors for fields_error in form_errors.keys(): for error in form_errors[fields_error]: messages.error(self.request, fields_error + ': ' + error, 'danger') <|end_body_0|> <|body_start_1|> self.object = form.save(commit=False) ...
Controlador de la vista update generica para todos los usuarios. Atributos: model(Tfms): Modelo TFG, el cual se va a editar. form_class(CreateTfgForm): formulario del Modelo TFM
UpdateTfm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateTfm: """Controlador de la vista update generica para todos los usuarios. Atributos: model(Tfms): Modelo TFG, el cual se va a editar. form_class(CreateTfgForm): formulario del Modelo TFM""" def _errors_form(self, form): """Función encargada de checkear los errores de un formular...
stack_v2_sparse_classes_36k_train_024816
4,712
no_license
[ { "docstring": "Función encargada de checkear los errores de un formulario. Parametros: form(form.Modelform): formulario del que se va a checkear, si existen errores.", "name": "_errors_form", "signature": "def _errors_form(self, form)" }, { "docstring": "Función encargada de crear un TFG dado s...
6
null
Implement the Python class `UpdateTfm` described below. Class description: Controlador de la vista update generica para todos los usuarios. Atributos: model(Tfms): Modelo TFG, el cual se va a editar. form_class(CreateTfgForm): formulario del Modelo TFM Method signatures and docstrings: - def _errors_form(self, form):...
Implement the Python class `UpdateTfm` described below. Class description: Controlador de la vista update generica para todos los usuarios. Atributos: model(Tfms): Modelo TFG, el cual se va a editar. form_class(CreateTfgForm): formulario del Modelo TFM Method signatures and docstrings: - def _errors_form(self, form):...
c106dfab0e5698109956cbbf731c049c05b9fa53
<|skeleton|> class UpdateTfm: """Controlador de la vista update generica para todos los usuarios. Atributos: model(Tfms): Modelo TFG, el cual se va a editar. form_class(CreateTfgForm): formulario del Modelo TFM""" def _errors_form(self, form): """Función encargada de checkear los errores de un formular...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateTfm: """Controlador de la vista update generica para todos los usuarios. Atributos: model(Tfms): Modelo TFG, el cual se va a editar. form_class(CreateTfgForm): formulario del Modelo TFM""" def _errors_form(self, form): """Función encargada de checkear los errores de un formulario. Parametro...
the_stack_v2_python_sparse
tfms/utils/update_tfm.py
EmilioSanchezCatalan/project_manager
train
0
d467ffa0d89c676f0953d514242778c7a87a35b9
[ "try:\n resource_id = UUID(resource_id)\nexcept ValueError:\n raise Http404()\nresources = handler_get_request(request, dataset_name)\nfor resource in resources:\n if resource.ckan_id == resource_id:\n return JsonResponse(serialize(resource), safe=True)\nraise Http404()", "request.PUT, request._fi...
<|body_start_0|> try: resource_id = UUID(resource_id) except ValueError: raise Http404() resources = handler_get_request(request, dataset_name) for resource in resources: if resource.ckan_id == resource_id: return JsonResponse(serialize...
ResourceShow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceShow: def get(self, request, dataset_name, resource_id): """Voir la ressource.""" <|body_0|> def put(self, request, dataset_name, resource_id): """Modifier la ressource.""" <|body_1|> def delete(self, request, dataset_name, resource_id): ...
stack_v2_sparse_classes_36k_train_024817
11,508
permissive
[ { "docstring": "Voir la ressource.", "name": "get", "signature": "def get(self, request, dataset_name, resource_id)" }, { "docstring": "Modifier la ressource.", "name": "put", "signature": "def put(self, request, dataset_name, resource_id)" }, { "docstring": "Supprimer la ressour...
3
stack_v2_sparse_classes_30k_train_008057
Implement the Python class `ResourceShow` described below. Class description: Implement the ResourceShow class. Method signatures and docstrings: - def get(self, request, dataset_name, resource_id): Voir la ressource. - def put(self, request, dataset_name, resource_id): Modifier la ressource. - def delete(self, reque...
Implement the Python class `ResourceShow` described below. Class description: Implement the ResourceShow class. Method signatures and docstrings: - def get(self, request, dataset_name, resource_id): Voir la ressource. - def put(self, request, dataset_name, resource_id): Modifier la ressource. - def delete(self, reque...
c73e67f22fa9bb38577c286271d02c2d9a708e40
<|skeleton|> class ResourceShow: def get(self, request, dataset_name, resource_id): """Voir la ressource.""" <|body_0|> def put(self, request, dataset_name, resource_id): """Modifier la ressource.""" <|body_1|> def delete(self, request, dataset_name, resource_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResourceShow: def get(self, request, dataset_name, resource_id): """Voir la ressource.""" try: resource_id = UUID(resource_id) except ValueError: raise Http404() resources = handler_get_request(request, dataset_name) for resource in resources: ...
the_stack_v2_python_sparse
api/views/resource.py
DataSud/DataSud-2017-2019
train
1
b98ab0a1c89c4b644a3692a6edf449cf65cabe48
[ "super().__init__()\nself.device = torch.device(device if torch.cuda.is_available() else 'cpu')\nself.to(self.device)\nself.seed = seed\nself.layers = nn.ModuleList()\nself.dim_layers = dim_layers\nself.activation_type = activation_type()\nself.dropout_rate = dropout_rate\nself.batch_norm = batch_norm", "for size...
<|body_start_0|> super().__init__() self.device = torch.device(device if torch.cuda.is_available() else 'cpu') self.to(self.device) self.seed = seed self.layers = nn.ModuleList() self.dim_layers = dim_layers self.activation_type = activation_type() self.dr...
TorchNeuralNetwork
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TorchNeuralNetwork: def __init__(self, dim_layers: tuple[int], activation_type: nn.Module, dropout_rate: float, batch_norm: bool=True, seed: int=42, device: str='cuda:1') -> None: """Instantiates a Torch neural network. Parameters ---------- dim_layers : tuple[int] Tuple of integers repr...
stack_v2_sparse_classes_36k_train_024818
7,243
permissive
[ { "docstring": "Instantiates a Torch neural network. Parameters ---------- dim_layers : tuple[int] Tuple of integers representing the dimensions of each hidden layer. activation_type : nn.Module Torch activation function module to be used in the hidden layers. dropout_rate : float Dropout rate for dropout regul...
4
stack_v2_sparse_classes_30k_train_021428
Implement the Python class `TorchNeuralNetwork` described below. Class description: Implement the TorchNeuralNetwork class. Method signatures and docstrings: - def __init__(self, dim_layers: tuple[int], activation_type: nn.Module, dropout_rate: float, batch_norm: bool=True, seed: int=42, device: str='cuda:1') -> None...
Implement the Python class `TorchNeuralNetwork` described below. Class description: Implement the TorchNeuralNetwork class. Method signatures and docstrings: - def __init__(self, dim_layers: tuple[int], activation_type: nn.Module, dropout_rate: float, batch_norm: bool=True, seed: int=42, device: str='cuda:1') -> None...
a0012dfcaef0b5d33452451dca955a99f7e7cccf
<|skeleton|> class TorchNeuralNetwork: def __init__(self, dim_layers: tuple[int], activation_type: nn.Module, dropout_rate: float, batch_norm: bool=True, seed: int=42, device: str='cuda:1') -> None: """Instantiates a Torch neural network. Parameters ---------- dim_layers : tuple[int] Tuple of integers repr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TorchNeuralNetwork: def __init__(self, dim_layers: tuple[int], activation_type: nn.Module, dropout_rate: float, batch_norm: bool=True, seed: int=42, device: str='cuda:1') -> None: """Instantiates a Torch neural network. Parameters ---------- dim_layers : tuple[int] Tuple of integers representing the d...
the_stack_v2_python_sparse
src/aequitas/fairflow/methods/inprocessing/neural_network.py
dssg/aequitas
train
575
772c5966470cb17b1696676e2d694b9d3c243309
[ "Consumption.__init__(self, name)\nself.amount = amount\n'\\n The amount consumed by this consumption\\n\\n :type: int\\n '", "consumption = SubElement(parent, 'CountingConsumption')\nself.generate_xml_common(consumption)\namount = SubElement(consumption, 'Amount')\namount.text = str(self.amo...
<|body_start_0|> Consumption.__init__(self, name) self.amount = amount '\n The amount consumed by this consumption\n\n :type: int\n ' <|end_body_0|> <|body_start_1|> consumption = SubElement(parent, 'CountingConsumption') self.generate_xml_common(consumption...
Class for generating XML messages for elements of type 'CountingConsumptionType'.
CountingConsumption
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CountingConsumption: """Class for generating XML messages for elements of type 'CountingConsumptionType'.""" def __init__(self, name, amount): """Object constructor.""" <|body_0|> def generate_xml(self, parent): """Generates the XML element for this consumption. ...
stack_v2_sparse_classes_36k_train_024819
1,354
permissive
[ { "docstring": "Object constructor.", "name": "__init__", "signature": "def __init__(self, name, amount)" }, { "docstring": "Generates the XML element for this consumption. :param xml.etree.ElementTree.Element parent: The parent XML element.", "name": "generate_xml", "signature": "def ge...
2
stack_v2_sparse_classes_30k_train_004529
Implement the Python class `CountingConsumption` described below. Class description: Class for generating XML messages for elements of type 'CountingConsumptionType'. Method signatures and docstrings: - def __init__(self, name, amount): Object constructor. - def generate_xml(self, parent): Generates the XML element f...
Implement the Python class `CountingConsumption` described below. Class description: Class for generating XML messages for elements of type 'CountingConsumptionType'. Method signatures and docstrings: - def __init__(self, name, amount): Object constructor. - def generate_xml(self, parent): Generates the XML element f...
eafd332e383f5f97dce4e35f6cff5a9a48dd3141
<|skeleton|> class CountingConsumption: """Class for generating XML messages for elements of type 'CountingConsumptionType'.""" def __init__(self, name, amount): """Object constructor.""" <|body_0|> def generate_xml(self, parent): """Generates the XML element for this consumption. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CountingConsumption: """Class for generating XML messages for elements of type 'CountingConsumptionType'.""" def __init__(self, name, amount): """Object constructor.""" Consumption.__init__(self, name) self.amount = amount '\n The amount consumed by this consumption...
the_stack_v2_python_sparse
enarksh_lib/xml_generator/consumption/CountingConsumption.py
SetBased/py-enarksh-lib
train
2
51ac191030786725027d539bcc1f32b02a9cd98a
[ "self.max_sum = 0\nself.traverse(root)\nreturn self.max_sum", "if not root:\n return [1, float('inf'), -float('inf'), 0]\nleft, right = (self.traverse(root.left), self.traverse(root.right))\nif left[0] and right[0] and (root.val > left[2]) and (root.val < right[1]):\n res = [1, min(left[1], root.val), max(r...
<|body_start_0|> self.max_sum = 0 self.traverse(root) return self.max_sum <|end_body_0|> <|body_start_1|> if not root: return [1, float('inf'), -float('inf'), 0] left, right = (self.traverse(root.left), self.traverse(root.right)) if left[0] and right[0] and (...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSumBST(self, root: TreeNode) -> int: """二叉树 后序遍历""" <|body_0|> def traverse(self, root): """return: [is_bst, min_val, max_val, bst_sum] 是否是bst、节点最小值、节点最大值、节点和""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.max_sum = 0 ...
stack_v2_sparse_classes_36k_train_024820
1,374
no_license
[ { "docstring": "二叉树 后序遍历", "name": "maxSumBST", "signature": "def maxSumBST(self, root: TreeNode) -> int" }, { "docstring": "return: [is_bst, min_val, max_val, bst_sum] 是否是bst、节点最小值、节点最大值、节点和", "name": "traverse", "signature": "def traverse(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSumBST(self, root: TreeNode) -> int: 二叉树 后序遍历 - def traverse(self, root): return: [is_bst, min_val, max_val, bst_sum] 是否是bst、节点最小值、节点最大值、节点和
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSumBST(self, root: TreeNode) -> int: 二叉树 后序遍历 - def traverse(self, root): return: [is_bst, min_val, max_val, bst_sum] 是否是bst、节点最小值、节点最大值、节点和 <|skeleton|> class Solution: ...
250f0431a0622c2fe7c40af7ddbef52ee9f354c1
<|skeleton|> class Solution: def maxSumBST(self, root: TreeNode) -> int: """二叉树 后序遍历""" <|body_0|> def traverse(self, root): """return: [is_bst, min_val, max_val, bst_sum] 是否是bst、节点最小值、节点最大值、节点和""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSumBST(self, root: TreeNode) -> int: """二叉树 后序遍历""" self.max_sum = 0 self.traverse(root) return self.max_sum def traverse(self, root): """return: [is_bst, min_val, max_val, bst_sum] 是否是bst、节点最小值、节点最大值、节点和""" if not root: return ...
the_stack_v2_python_sparse
1373.二叉搜索子树的最大键值和.py
cnxiekun/LeetCode
train
0
b341804263b527cb1b10ee8578429152100ee7d5
[ "try:\n profile = Profile.objects.get(pk=request.fb_id)\nexcept Profile.DoesNotExist:\n return NoProfileForbiddenResponse()\nserializer = ProfileSerializer(profile)\nreturn Response(serializer.data)", "try:\n Profile.objects.get(pk=request.fb_id)\n return Response({'id': f'Facebook ID \"{request.fb_id...
<|body_start_0|> try: profile = Profile.objects.get(pk=request.fb_id) except Profile.DoesNotExist: return NoProfileForbiddenResponse() serializer = ProfileSerializer(profile) return Response(serializer.data) <|end_body_0|> <|body_start_1|> try: ...
ProfileView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileView: def get(self, request): """Get profile #### Sample Response ``` { "id": integer, "goal": string, "experience": string, "weight": integer, "height": integer, "current_workout_program": integer|null, "current_custom_workout_program": integer|null } ```""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_024821
5,925
no_license
[ { "docstring": "Get profile #### Sample Response ``` { \"id\": integer, \"goal\": string, \"experience\": string, \"weight\": integer, \"height\": integer, \"current_workout_program\": integer|null, \"current_custom_workout_program\": integer|null } ```", "name": "get", "signature": "def get(self, reque...
4
stack_v2_sparse_classes_30k_train_020860
Implement the Python class `ProfileView` described below. Class description: Implement the ProfileView class. Method signatures and docstrings: - def get(self, request): Get profile #### Sample Response ``` { "id": integer, "goal": string, "experience": string, "weight": integer, "height": integer, "current_workout_p...
Implement the Python class `ProfileView` described below. Class description: Implement the ProfileView class. Method signatures and docstrings: - def get(self, request): Get profile #### Sample Response ``` { "id": integer, "goal": string, "experience": string, "weight": integer, "height": integer, "current_workout_p...
c528d2d31e273464f86e8ab2fac0c35028c5669b
<|skeleton|> class ProfileView: def get(self, request): """Get profile #### Sample Response ``` { "id": integer, "goal": string, "experience": string, "weight": integer, "height": integer, "current_workout_program": integer|null, "current_custom_workout_program": integer|null } ```""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileView: def get(self, request): """Get profile #### Sample Response ``` { "id": integer, "goal": string, "experience": string, "weight": integer, "height": integer, "current_workout_program": integer|null, "current_custom_workout_program": integer|null } ```""" try: profile = ...
the_stack_v2_python_sparse
backend/api/v1/endpoints/profile.py
gymapplife/backend
train
0
e7fba9d9114d739fa4722f02bcf65f003319138b
[ "if not quota_max_calls:\n use_rate_limiter = False\nself._projects = None\nself._organizations = None\nself._folders = None\nself._folders_v1 = None\nself._liens = None\nsuper(CloudResourceManagerRepositoryClient, self).__init__('cloudresourcemanager', versions=['v1', 'v2'], quota_max_calls=quota_max_calls, quo...
<|body_start_0|> if not quota_max_calls: use_rate_limiter = False self._projects = None self._organizations = None self._folders = None self._folders_v1 = None self._liens = None super(CloudResourceManagerRepositoryClient, self).__init__('cloudresource...
Cloud Resource Manager Respository.
CloudResourceManagerRepositoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudResourceManagerRepositoryClient: """Cloud Resource Manager Respository.""" def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True, credentials=None): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_p...
stack_v2_sparse_classes_36k_train_024822
25,620
permissive
[ { "docstring": "Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests over. use_rate_limiter (bool): Set to false to disable the use of a rate limiter for this service. credentials (OAuth2Credentials): Credentials that ...
6
stack_v2_sparse_classes_30k_train_019717
Implement the Python class `CloudResourceManagerRepositoryClient` described below. Class description: Cloud Resource Manager Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True, credentials=None): Constructor. Args: quota_max_calls (int):...
Implement the Python class `CloudResourceManagerRepositoryClient` described below. Class description: Cloud Resource Manager Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True, credentials=None): Constructor. Args: quota_max_calls (int):...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class CloudResourceManagerRepositoryClient: """Cloud Resource Manager Respository.""" def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True, credentials=None): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloudResourceManagerRepositoryClient: """Cloud Resource Manager Respository.""" def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True, credentials=None): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float)...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/cloud_resource_manager.py
kevensen/forseti-security
train
1
45ca7a657b667ceea587065ffd48290cc48eb2df
[ "self.id = None\nself.idGenerated = False\nself.tokenDeps = None\nself.maxLength = rowGrouping\nself.panelElements = []\nself.fieldset = []\nself.title = None\nself.ref = None\nself.app = None\nself.searches = []", "if self.maxLength == None or len(self.panelElements) < self.maxLength:\n self.panelElements.app...
<|body_start_0|> self.id = None self.idGenerated = False self.tokenDeps = None self.maxLength = rowGrouping self.panelElements = [] self.fieldset = [] self.title = None self.ref = None self.app = None self.searches = [] <|end_body_0|> <|bo...
Panel object
Panel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Panel: """Panel object""" def __init__(self, rowGrouping=1): """Init - sets maxLength - initialize panelElements @type rowGrouping: int @param rowGrouping: how many panel elements in this one panel.""" <|body_0|> def appendPanelElement(self, panelElement): """Add...
stack_v2_sparse_classes_36k_train_024823
2,070
no_license
[ { "docstring": "Init - sets maxLength - initialize panelElements @type rowGrouping: int @param rowGrouping: how many panel elements in this one panel.", "name": "__init__", "signature": "def __init__(self, rowGrouping=1)" }, { "docstring": "Add a panelElement to the panel. @rtype: boolean @retur...
2
null
Implement the Python class `Panel` described below. Class description: Panel object Method signatures and docstrings: - def __init__(self, rowGrouping=1): Init - sets maxLength - initialize panelElements @type rowGrouping: int @param rowGrouping: how many panel elements in this one panel. - def appendPanelElement(sel...
Implement the Python class `Panel` described below. Class description: Panel object Method signatures and docstrings: - def __init__(self, rowGrouping=1): Init - sets maxLength - initialize panelElements @type rowGrouping: int @param rowGrouping: how many panel elements in this one panel. - def appendPanelElement(sel...
7cf8a158bc8e1cecef374dad9165d44ccb00c6e0
<|skeleton|> class Panel: """Panel object""" def __init__(self, rowGrouping=1): """Init - sets maxLength - initialize panelElements @type rowGrouping: int @param rowGrouping: how many panel elements in this one panel.""" <|body_0|> def appendPanelElement(self, panelElement): """Add...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Panel: """Panel object""" def __init__(self, rowGrouping=1): """Init - sets maxLength - initialize panelElements @type rowGrouping: int @param rowGrouping: how many panel elements in this one panel.""" self.id = None self.idGenerated = False self.tokenDeps = None s...
the_stack_v2_python_sparse
models/view_escaping/panel.py
bullll/splunk
train
2
f13262169ff2b2ebb71dd80fd461a27bfaa49897
[ "self.network = network\nself.planes = planes\nself.preimages = preimages\nself.partially_computed = False\nself.transformed_planes = None\nself.computed = False\nself.classifications = None", "if self.partially_computed:\n return\nself.transformed_planes = self.network.transform_planes(self.planes, self.preim...
<|body_start_0|> self.network = network self.planes = planes self.preimages = preimages self.partially_computed = False self.transformed_planes = None self.computed = False self.classifications = None <|end_body_0|> <|body_start_1|> if self.partially_comp...
Handles classifying a set of planes using SyReNN.
PlanesClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanesClassifier: """Handles classifying a set of planes using SyReNN.""" def __init__(self, network, planes, preimages=True): """Creates a new PlanesClassifier for the given @network and @planes. @planes should be a list of Numpy arrays with each one representing a V-representation ...
stack_v2_sparse_classes_36k_train_024824
3,410
permissive
[ { "docstring": "Creates a new PlanesClassifier for the given @network and @planes. @planes should be a list of Numpy arrays with each one representing a V-representation polytope with (n_vertices, n_dims). If preimages=True is set, preimages of the endpoints of each classification region will be returned (other...
4
stack_v2_sparse_classes_30k_val_001033
Implement the Python class `PlanesClassifier` described below. Class description: Handles classifying a set of planes using SyReNN. Method signatures and docstrings: - def __init__(self, network, planes, preimages=True): Creates a new PlanesClassifier for the given @network and @planes. @planes should be a list of Nu...
Implement the Python class `PlanesClassifier` described below. Class description: Handles classifying a set of planes using SyReNN. Method signatures and docstrings: - def __init__(self, network, planes, preimages=True): Creates a new PlanesClassifier for the given @network and @planes. @planes should be a list of Nu...
19abf589e84ee67317134573054c648bb25c244d
<|skeleton|> class PlanesClassifier: """Handles classifying a set of planes using SyReNN.""" def __init__(self, network, planes, preimages=True): """Creates a new PlanesClassifier for the given @network and @planes. @planes should be a list of Numpy arrays with each one representing a V-representation ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlanesClassifier: """Handles classifying a set of planes using SyReNN.""" def __init__(self, network, planes, preimages=True): """Creates a new PlanesClassifier for the given @network and @planes. @planes should be a list of Numpy arrays with each one representing a V-representation polytope with...
the_stack_v2_python_sparse
pysyrenn/helpers/classify_planes.py
95616ARG/SyReNN
train
38
2b67dd36d7dd1572f39286da85087c1741336de4
[ "players_sufficient = len(self.players) >= 2\nif not players_sufficient:\n return False\nplayers_ready = all((p.ready for p in self.players.values()))\nif not players_ready:\n return False\nmap_specified = self.map_template is not None\nif not map_specified:\n return False\nreturn True", "if player_oid i...
<|body_start_0|> players_sufficient = len(self.players) >= 2 if not players_sufficient: return False players_ready = all((p.ready for p in self.players.values())) if not players_ready: return False map_specified = self.map_template is not None if n...
Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.
PendingGame
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PendingGame: """Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.""" def ready(self): """Check if the game is ready to be started. For the gam...
stack_v2_sparse_classes_36k_train_024825
3,604
permissive
[ { "docstring": "Check if the game is ready to be started. For the game to be ready to start, **ALL** of the following conditions must be fulfilled: - Player count >= 2 - All players are ready (``ready`` is set to ``True``) - Map to be used is specified :return: game is ready to be started or not", "name": "...
4
stack_v2_sparse_classes_30k_train_015770
Implement the Python class `PendingGame` described below. Class description: Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play. Method signatures and docstrings: - def ready(sel...
Implement the Python class `PendingGame` described below. Class description: Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play. Method signatures and docstrings: - def ready(sel...
c7da1e91783dce3a2b71b955b3a22b68db9056cf
<|skeleton|> class PendingGame: """Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.""" def ready(self): """Check if the game is ready to be started. For the gam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PendingGame: """Object representing a pending game. Pending game means that the game has not been started. For a pending game to be ready to start, the game should have 2+ players and decide the map to play.""" def ready(self): """Check if the game is ready to be started. For the game to be ready...
the_stack_v2_python_sparse
game/pkchess/game/pending.py
RxJellyBot/Jelly-Bot
train
5
55655f39fce3ea3c2e16e342d807000f48fe10aa
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AppConsentRequest()", "from .app_consent_request_scope import AppConsentRequestScope\nfrom .entity import Entity\nfrom .user_consent_request import UserConsentRequest\nfrom .app_consent_request_scope import AppConsentRequestScope\nfrom...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AppConsentRequest() <|end_body_0|> <|body_start_1|> from .app_consent_request_scope import AppConsentRequestScope from .entity import Entity from .user_consent_request import Use...
AppConsentRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppConsentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppConsentRequest: """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...
stack_v2_sparse_classes_36k_train_024826
3,447
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: AppConsentRequest", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `AppConsentRequest` described below. Class description: Implement the AppConsentRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppConsentRequest: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `AppConsentRequest` described below. Class description: Implement the AppConsentRequest class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppConsentRequest: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AppConsentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppConsentRequest: """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...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppConsentRequest: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AppConsentRequest: """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: AppC...
the_stack_v2_python_sparse
msgraph/generated/models/app_consent_request.py
microsoftgraph/msgraph-sdk-python
train
135
4437a1079ccf8122c485e9f0e247ddeec15bf38d
[ "if model.resource_type not in self.nodetypes:\n return False\nif self.name != model.search_name:\n return False\nreturn self.package is None or self.package == model.package_name", "for model in haystack:\n if self._matches(model):\n return model\nreturn None" ]
<|body_start_0|> if model.resource_type not in self.nodetypes: return False if self.name != model.search_name: return False return self.package is None or self.package == model.package_name <|end_body_0|> <|body_start_1|> for model in haystack: if sel...
NameSearcher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NameSearcher: def _matches(self, model: N) -> bool: """Return True if the model matches the given name, package, and type. If package is None, any package is allowed. nodetypes should be a container of NodeTypes that implements the 'in' operator.""" <|body_0|> def search(sel...
stack_v2_sparse_classes_36k_train_024827
34,419
permissive
[ { "docstring": "Return True if the model matches the given name, package, and type. If package is None, any package is allowed. nodetypes should be a container of NodeTypes that implements the 'in' operator.", "name": "_matches", "signature": "def _matches(self, model: N) -> bool" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_016194
Implement the Python class `NameSearcher` described below. Class description: Implement the NameSearcher class. Method signatures and docstrings: - def _matches(self, model: N) -> bool: Return True if the model matches the given name, package, and type. If package is None, any package is allowed. nodetypes should be ...
Implement the Python class `NameSearcher` described below. Class description: Implement the NameSearcher class. Method signatures and docstrings: - def _matches(self, model: N) -> bool: Return True if the model matches the given name, package, and type. If package is None, any package is allowed. nodetypes should be ...
3ec911b62c736e7b5ae26e624b9a981dc3fb177f
<|skeleton|> class NameSearcher: def _matches(self, model: N) -> bool: """Return True if the model matches the given name, package, and type. If package is None, any package is allowed. nodetypes should be a container of NodeTypes that implements the 'in' operator.""" <|body_0|> def search(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NameSearcher: def _matches(self, model: N) -> bool: """Return True if the model matches the given name, package, and type. If package is None, any package is allowed. nodetypes should be a container of NodeTypes that implements the 'in' operator.""" if model.resource_type not in self.nodetypes...
the_stack_v2_python_sparse
core/dbt/contracts/graph/manifest.py
better/dbt
train
0
d7083df9b5a345c708016a426b9f81c9d985d56d
[ "cnt, N = (0, len(M))\nvset = set()\n\ndef bfs(n):\n q = [n]\n while q:\n n = q.pop(0)\n for x in range(N):\n if M[n][x] and x not in vset:\n vset.add(x)\n q.append(x)\nfor x in range(N):\n if x not in vset:\n cnt += 1\n bfs(x)\nreturn cn...
<|body_start_0|> cnt, N = (0, len(M)) vset = set() def bfs(n): q = [n] while q: n = q.pop(0) for x in range(N): if M[n][x] and x not in vset: vset.add(x) q.append(x) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def findCircleNum_DFS(self, M): """:type M: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnt, N = (0, len(M)) vset = s...
stack_v2_sparse_classes_36k_train_024828
1,112
no_license
[ { "docstring": ":type M: List[List[int]] :rtype: int", "name": "findCircleNum", "signature": "def findCircleNum(self, M)" }, { "docstring": ":type M: List[List[int]] :rtype: int", "name": "findCircleNum_DFS", "signature": "def findCircleNum_DFS(self, M)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCircleNum(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_DFS(self, M): :type M: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCircleNum(self, M): :type M: List[List[int]] :rtype: int - def findCircleNum_DFS(self, M): :type M: List[List[int]] :rtype: int <|skeleton|> class Solution: def fin...
16e8a7935811fa71ce71998da8549e29ba68f847
<|skeleton|> class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" <|body_0|> def findCircleNum_DFS(self, M): """:type M: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findCircleNum(self, M): """:type M: List[List[int]] :rtype: int""" cnt, N = (0, len(M)) vset = set() def bfs(n): q = [n] while q: n = q.pop(0) for x in range(N): if M[n][x] and x not in v...
the_stack_v2_python_sparse
leetcode8/findCircleNum.py
lizyang95/leetcode
train
0
e2a6246ab6e78a55086562ce3f4173c79d7ff941
[ "retcode = 201\nsamp = None\ntry:\n post = BaseAssayDatum(self.get_engine(), self.get_session())\n study_name = None\n samp = post.post(assay_datum, study_name, studies, user)\nexcept DuplicateKeyException as dke:\n logging.getLogger(__name__).debug('create_assayDatum: %s', repr(dke))\n retcode = 422...
<|body_start_0|> retcode = 201 samp = None try: post = BaseAssayDatum(self.get_engine(), self.get_session()) study_name = None samp = post.post(assay_datum, study_name, studies, user) except DuplicateKeyException as dke: logging.getLogger(_...
AssayDatumController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssayDatumController: def create_assay_datum(self, assay_datum, studies=None, user=None, auths=None): """create_assay_datum Create a AssayDatum # noqa: E501 :param assayDatum: The assay datum to create :type assayDatum: dict | bytes :rtype: AssayDatum""" <|body_0|> def delet...
stack_v2_sparse_classes_36k_train_024829
5,503
no_license
[ { "docstring": "create_assay_datum Create a AssayDatum # noqa: E501 :param assayDatum: The assay datum to create :type assayDatum: dict | bytes :rtype: AssayDatum", "name": "create_assay_datum", "signature": "def create_assay_datum(self, assay_datum, studies=None, user=None, auths=None)" }, { "d...
6
stack_v2_sparse_classes_30k_train_011554
Implement the Python class `AssayDatumController` described below. Class description: Implement the AssayDatumController class. Method signatures and docstrings: - def create_assay_datum(self, assay_datum, studies=None, user=None, auths=None): create_assay_datum Create a AssayDatum # noqa: E501 :param assayDatum: The...
Implement the Python class `AssayDatumController` described below. Class description: Implement the AssayDatumController class. Method signatures and docstrings: - def create_assay_datum(self, assay_datum, studies=None, user=None, auths=None): create_assay_datum Create a AssayDatum # noqa: E501 :param assayDatum: The...
69884943f6e0afa2d371e78b02ab7ce3542e32c4
<|skeleton|> class AssayDatumController: def create_assay_datum(self, assay_datum, studies=None, user=None, auths=None): """create_assay_datum Create a AssayDatum # noqa: E501 :param assayDatum: The assay datum to create :type assayDatum: dict | bytes :rtype: AssayDatum""" <|body_0|> def delet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssayDatumController: def create_assay_datum(self, assay_datum, studies=None, user=None, auths=None): """create_assay_datum Create a AssayDatum # noqa: E501 :param assayDatum: The assay datum to create :type assayDatum: dict | bytes :rtype: AssayDatum""" retcode = 201 samp = None ...
the_stack_v2_python_sparse
server/backbone_server/controllers/assay_datum_controller.py
malariagen/sims-backbone
train
1
d590b24f7ec97bfadd9e39546ef9bc07f1b8f629
[ "self.log = log\nself.settings = dict(loc=1.0, sigma=0.02, xsize=2048, ysize=2066)\nself.settings.update(kwargs)\nself.log.info('The following input parameters were used:')\nfor key, value in self.settings.iteritems():\n self.log.info('%s = %s' % (key, value))", "self.log.info('Generating a flat field...')\nse...
<|body_start_0|> self.log = log self.settings = dict(loc=1.0, sigma=0.02, xsize=2048, ysize=2066) self.settings.update(kwargs) self.log.info('The following input parameters were used:') for key, value in self.settings.iteritems(): self.log.info('%s = %s' % (key, value...
This class can be used to generate a flat field that mimics the pixel size uniformity assumed for VIS. :param kwargs: The following arguments can be given:: * loc = centre of the distribution * sigma = standard deviation of the distribution * xsize = size of the flat field image in x direction * xsize = size of the fla...
flatField
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class flatField: """This class can be used to generate a flat field that mimics the pixel size uniformity assumed for VIS. :param kwargs: The following arguments can be given:: * loc = centre of the distribution * sigma = standard deviation of the distribution * xsize = size of the flat field image in ...
stack_v2_sparse_classes_36k_train_024830
3,409
permissive
[ { "docstring": "Class constructor.", "name": "__init__", "signature": "def __init__(self, log, **kwargs)" }, { "docstring": "Creates a flat field image with given properties. :return: flat field image :rtype: ndarray", "name": "generateFlat", "signature": "def generateFlat(self)" }, ...
3
null
Implement the Python class `flatField` described below. Class description: This class can be used to generate a flat field that mimics the pixel size uniformity assumed for VIS. :param kwargs: The following arguments can be given:: * loc = centre of the distribution * sigma = standard deviation of the distribution * x...
Implement the Python class `flatField` described below. Class description: This class can be used to generate a flat field that mimics the pixel size uniformity assumed for VIS. :param kwargs: The following arguments can be given:: * loc = centre of the distribution * sigma = standard deviation of the distribution * x...
22bb9fb6453fee138eeb7ac64b68b361d250d514
<|skeleton|> class flatField: """This class can be used to generate a flat field that mimics the pixel size uniformity assumed for VIS. :param kwargs: The following arguments can be given:: * loc = centre of the distribution * sigma = standard deviation of the distribution * xsize = size of the flat field image in ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class flatField: """This class can be used to generate a flat field that mimics the pixel size uniformity assumed for VIS. :param kwargs: The following arguments can be given:: * loc = centre of the distribution * sigma = standard deviation of the distribution * xsize = size of the flat field image in x direction *...
the_stack_v2_python_sparse
simulator/generateFlat.py
sniemi/EuclidVisibleInstrument
train
7
44c836c1e7089d810155f8b4ea3841268b752b31
[ "assert hasattr(receiver, 'got_selection')\nself.receiver = receiver\nself.frame = Frame(root, borderwidth=5)\nself.listbox = Listbox(self.frame)\nself.listbox.grid(row=0, column=0)\n\ndef on_select(event):\n \"\"\"\n Bound to the selection event in the Listbox\n Finds the selected text and...
<|body_start_0|> assert hasattr(receiver, 'got_selection') self.receiver = receiver self.frame = Frame(root, borderwidth=5) self.listbox = Listbox(self.frame) self.listbox.grid(row=0, column=0) def on_select(event): """ Bound to the select...
Provides a frame that can be used to select a given stock item reference from a list of stock items The stock item list is delivered to the class via the populate_listbox method Selection events will trigger a call of got_selection in the object provided as the receiver of selection messages
StockItemSelector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StockItemSelector: """Provides a frame that can be used to select a given stock item reference from a list of stock items The stock item list is delivered to the class via the populate_listbox method Selection events will trigger a call of got_selection in the object provided as the receiver of s...
stack_v2_sparse_classes_36k_train_024831
1,827
permissive
[ { "docstring": "Create an instance of the editor. root provides the Tkinter root frame for the editor receiver is a reference to the object that will receive messages when an item is selected The event will take the form of a call to the got_selection method in the receiver", "name": "__init__", "signat...
2
null
Implement the Python class `StockItemSelector` described below. Class description: Provides a frame that can be used to select a given stock item reference from a list of stock items The stock item list is delivered to the class via the populate_listbox method Selection events will trigger a call of got_selection in t...
Implement the Python class `StockItemSelector` described below. Class description: Provides a frame that can be used to select a given stock item reference from a list of stock items The stock item list is delivered to the class via the populate_listbox method Selection events will trigger a call of got_selection in t...
a72fdf18ca15f564be895c6394a91afc75fc3e2c
<|skeleton|> class StockItemSelector: """Provides a frame that can be used to select a given stock item reference from a list of stock items The stock item list is delivered to the class via the populate_listbox method Selection events will trigger a call of got_selection in the object provided as the receiver of s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StockItemSelector: """Provides a frame that can be used to select a given stock item reference from a list of stock items The stock item list is delivered to the class via the populate_listbox method Selection events will trigger a call of got_selection in the object provided as the receiver of selection mess...
the_stack_v2_python_sparse
13. Python and Graphical User Interfaces/EG13-09 StockSelectDemo/StockItemSelector.py
nikcbg/Begin-to-Code-with-Python
train
0
3a10b0f91edc46ded68987da64744308520020a2
[ "super().__init__()\nself._attr_name = name\nself._authentication = authentication\nself._username = username\nself._password = password\nself._mjpeg_url = mjpeg_url\nself._still_image_url = still_image_url\nself._auth = None\nif self._username and self._password and (self._authentication == HTTP_BASIC_AUTHENTICATI...
<|body_start_0|> super().__init__() self._attr_name = name self._authentication = authentication self._username = username self._password = password self._mjpeg_url = mjpeg_url self._still_image_url = still_image_url self._auth = None if self._user...
An implementation of an IP camera that is reachable over a URL.
MjpegCamera
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MjpegCamera: """An implementation of an IP camera that is reachable over a URL.""" def __init__(self, *, name: str | None=None, mjpeg_url: str, still_image_url: str | None, authentication: str | None=None, username: str | None=None, password: str='', verify_ssl: bool=True, unique_id: str | N...
stack_v2_sparse_classes_36k_train_024832
6,394
permissive
[ { "docstring": "Initialize a MJPEG camera.", "name": "__init__", "signature": "def __init__(self, *, name: str | None=None, mjpeg_url: str, still_image_url: str | None, authentication: str | None=None, username: str | None=None, password: str='', verify_ssl: bool=True, unique_id: str | None=None, device...
5
null
Implement the Python class `MjpegCamera` described below. Class description: An implementation of an IP camera that is reachable over a URL. Method signatures and docstrings: - def __init__(self, *, name: str | None=None, mjpeg_url: str, still_image_url: str | None, authentication: str | None=None, username: str | No...
Implement the Python class `MjpegCamera` described below. Class description: An implementation of an IP camera that is reachable over a URL. Method signatures and docstrings: - def __init__(self, *, name: str | None=None, mjpeg_url: str, still_image_url: str | None, authentication: str | None=None, username: str | No...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class MjpegCamera: """An implementation of an IP camera that is reachable over a URL.""" def __init__(self, *, name: str | None=None, mjpeg_url: str, still_image_url: str | None, authentication: str | None=None, username: str | None=None, password: str='', verify_ssl: bool=True, unique_id: str | N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MjpegCamera: """An implementation of an IP camera that is reachable over a URL.""" def __init__(self, *, name: str | None=None, mjpeg_url: str, still_image_url: str | None, authentication: str | None=None, username: str | None=None, password: str='', verify_ssl: bool=True, unique_id: str | None=None, dev...
the_stack_v2_python_sparse
homeassistant/components/mjpeg/camera.py
konnected-io/home-assistant
train
24
a2a597bf72c9644aa73e96cefbf998a4507f28af
[ "if len(seed_bytes) < Bip32Slip10MstKeyGeneratorConst.SEED_MIN_BYTE_LEN:\n raise ValueError(f'Invalid seed length ({len(seed_bytes)})')\nkey_bytes = Pbkdf2HmacSha512.DeriveKey(CardanoIcarusMasterKeyGeneratorConst.PBKDF2_PASSWORD, seed_bytes, CardanoIcarusMasterKeyGeneratorConst.PBKDF2_ROUNDS, CardanoIcarusMaster...
<|body_start_0|> if len(seed_bytes) < Bip32Slip10MstKeyGeneratorConst.SEED_MIN_BYTE_LEN: raise ValueError(f'Invalid seed length ({len(seed_bytes)})') key_bytes = Pbkdf2HmacSha512.DeriveKey(CardanoIcarusMasterKeyGeneratorConst.PBKDF2_PASSWORD, seed_bytes, CardanoIcarusMasterKeyGeneratorConst....
Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus.
CardanoIcarusMstKeyGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CardanoIcarusMstKeyGenerator: """Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus.""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a master key from the specified seed. Args: seed_bytes (byt...
stack_v2_sparse_classes_36k_train_024833
4,048
permissive
[ { "docstring": "Generate a master key from the specified seed. Args: seed_bytes (bytes): Seed bytes Returns: tuple[bytes, bytes]: Private key bytes (index 0) and chain code bytes (index 1) Raises: Bip32KeyError: If the seed is not suitable for master key generation ValueError: If seed length is not valid", ...
2
stack_v2_sparse_classes_30k_train_010585
Implement the Python class `CardanoIcarusMstKeyGenerator` described below. Class description: Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus. Method signatures and docstrings: - def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: Generate a ...
Implement the Python class `CardanoIcarusMstKeyGenerator` described below. Class description: Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus. Method signatures and docstrings: - def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: Generate a ...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class CardanoIcarusMstKeyGenerator: """Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus.""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a master key from the specified seed. Args: seed_bytes (byt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CardanoIcarusMstKeyGenerator: """Cardano Icarus master key generator class. It allows master keys generation in according to Cardano Icarus.""" def GenerateFromSeed(cls, seed_bytes: bytes) -> Tuple[bytes, bytes]: """Generate a master key from the specified seed. Args: seed_bytes (bytes): Seed byt...
the_stack_v2_python_sparse
bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py
ebellocchia/bip_utils
train
244
4781dde6daac9d9596f69dc6d648577128fd3041
[ "from collections import deque\nif not grid:\n return 0\nrow = len(grid)\ncol = len(grid[0])\ncnt = 0\nglobal visited\nvisited = set()\n\ndef bfs(i, j):\n global visited\n queue = deque()\n queue.appendleft((i, j))\n visited.add((i, j))\n while queue:\n i, j = queue.pop()\n if (i, j)...
<|body_start_0|> from collections import deque if not grid: return 0 row = len(grid) col = len(grid[0]) cnt = 0 global visited visited = set() def bfs(i, j): global visited queue = deque() queue.appendleft((...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int visited 一定要配置 , nextlevel不一定,deque 不一定""" <|body_0|> def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int dfs search for island numbers""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_024834
4,378
no_license
[ { "docstring": ":type grid: List[List[str]] :rtype: int visited 一定要配置 , nextlevel不一定,deque 不一定", "name": "numIslands", "signature": "def numIslands(self, grid)" }, { "docstring": ":type grid: List[List[str]] :rtype: int dfs search for island numbers", "name": "numIslands", "signature": "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int visited 一定要配置 , nextlevel不一定,deque 不一定 - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int d...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int visited 一定要配置 , nextlevel不一定,deque 不一定 - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int d...
507d5d8c904672f994d0418fa96bd42695464d80
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int visited 一定要配置 , nextlevel不一定,deque 不一定""" <|body_0|> def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int dfs search for island numbers""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int visited 一定要配置 , nextlevel不一定,deque 不一定""" from collections import deque if not grid: return 0 row = len(grid) col = len(grid[0]) cnt = 0 global visited v...
the_stack_v2_python_sparse
coding_unionfind/200_islandNumber.py
LEE2020/leetcode
train
0
19653bb630682deb932ab795dd3bbfc8581145d3
[ "super().__init__(net=net, **kwargs)\nself.action_dims = action_dims\nself.dueling = dueling", "x = self._model(inputs, training=training)\nif self.dueling:\n q = self._value[0](x, training=training)\n v = self._value[1](x, training=training)\n a = q - tf.math.reduce_mean(q, axis=-1, keepdims=True)\n ...
<|body_start_0|> super().__init__(net=net, **kwargs) self.action_dims = action_dims self.dueling = dueling <|end_body_0|> <|body_start_1|> x = self._model(inputs, training=training) if self.dueling: q = self._value[0](x, training=training) v = self._value...
QNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QNet: def __init__(self, action_dims: int, dueling: bool=False, net: tf.keras.Model=None, **kwargs): """Q-value net Args: action_dims (int): Output action size. dueling (bool, optional): Whether to use dueling nets. Defaults to False. net (tf.keras.Model, optional): Base network, feature...
stack_v2_sparse_classes_36k_train_024835
19,646
permissive
[ { "docstring": "Q-value net Args: action_dims (int): Output action size. dueling (bool, optional): Whether to use dueling nets. Defaults to False. net (tf.keras.Model, optional): Base network, feature extractor. Defaults to None.", "name": "__init__", "signature": "def __init__(self, action_dims: int, d...
3
stack_v2_sparse_classes_30k_train_004740
Implement the Python class `QNet` described below. Class description: Implement the QNet class. Method signatures and docstrings: - def __init__(self, action_dims: int, dueling: bool=False, net: tf.keras.Model=None, **kwargs): Q-value net Args: action_dims (int): Output action size. dueling (bool, optional): Whether ...
Implement the Python class `QNet` described below. Class description: Implement the QNet class. Method signatures and docstrings: - def __init__(self, action_dims: int, dueling: bool=False, net: tf.keras.Model=None, **kwargs): Q-value net Args: action_dims (int): Output action size. dueling (bool, optional): Whether ...
1d304115406f6e29186cedb0160811d4139e2733
<|skeleton|> class QNet: def __init__(self, action_dims: int, dueling: bool=False, net: tf.keras.Model=None, **kwargs): """Q-value net Args: action_dims (int): Output action size. dueling (bool, optional): Whether to use dueling nets. Defaults to False. net (tf.keras.Model, optional): Base network, feature...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QNet: def __init__(self, action_dims: int, dueling: bool=False, net: tf.keras.Model=None, **kwargs): """Q-value net Args: action_dims (int): Output action size. dueling (bool, optional): Whether to use dueling nets. Defaults to False. net (tf.keras.Model, optional): Base network, feature extractor. De...
the_stack_v2_python_sparse
unstable_baselines/algo/dqn/model.py
Ending2015a/unstable_baselines
train
10
601f92dec65beefe5d0cdc00b202c756c69ae660
[ "official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', email='email@email.com', original='original', wechat='wechat')\nrule = Rule.manager.add(official_account=official_account, name='rule test', reply_pattern=Rule.REPLY_PATTERN_ALL)\nkeyword = Keyword.manager.add(rule, keyword=...
<|body_start_0|> official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', email='email@email.com', original='original', wechat='wechat') rule = Rule.manager.add(official_account=official_account, name='rule test', reply_pattern=Rule.REPLY_PATTERN_ALL) keyword = ...
KeywordTest
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordTest: def test_add_keyword(self): """测试添加关键字""" <|body_0|> def test_keyword_search(self): """测试关键字搜索""" <|body_1|> <|end_skeleton|> <|body_start_0|> official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', em...
stack_v2_sparse_classes_36k_train_024836
4,271
permissive
[ { "docstring": "测试添加关键字", "name": "test_add_keyword", "signature": "def test_add_keyword(self)" }, { "docstring": "测试关键字搜索", "name": "test_keyword_search", "signature": "def test_keyword_search(self)" } ]
2
stack_v2_sparse_classes_30k_train_009125
Implement the Python class `KeywordTest` described below. Class description: Implement the KeywordTest class. Method signatures and docstrings: - def test_add_keyword(self): 测试添加关键字 - def test_keyword_search(self): 测试关键字搜索
Implement the Python class `KeywordTest` described below. Class description: Implement the KeywordTest class. Method signatures and docstrings: - def test_add_keyword(self): 测试添加关键字 - def test_keyword_search(self): 测试关键字搜索 <|skeleton|> class KeywordTest: def test_add_keyword(self): """测试添加关键字""" ...
37a6cd54584a2e1229c943c569daed7227d9f318
<|skeleton|> class KeywordTest: def test_add_keyword(self): """测试添加关键字""" <|body_0|> def test_keyword_search(self): """测试关键字搜索""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeywordTest: def test_add_keyword(self): """测试添加关键字""" official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', email='email@email.com', original='original', wechat='wechat') rule = Rule.manager.add(official_account=official_account, name='rule test', ...
the_stack_v2_python_sparse
wechat_platform/system/keyword/tests.py
qiyeboy/wechat-platform
train
1
dd45fc00d0617849f55619f52050a0dac1a24712
[ "super().__init__()\nself.output_size = embedding_size * 2 + node_type_embedding_size\nself.previous_actions_embed = PreviousActionsEmbedding(n_rule, n_token, embedding_size)\nself.node_type_embed = EmbeddingWithMask(n_node_type, node_type_embedding_size, -1)\nnn.init.normal_(self.previous_actions_embed.rule_embed....
<|body_start_0|> super().__init__() self.output_size = embedding_size * 2 + node_type_embedding_size self.previous_actions_embed = PreviousActionsEmbedding(n_rule, n_token, embedding_size) self.node_type_embed = EmbeddingWithMask(n_node_type, node_type_embedding_size, -1) nn.init...
ActionsEmbedding
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionsEmbedding: def __init__(self, n_rule: int, n_token: int, n_node_type: int, node_type_embedding_size: int, embedding_size: int): """Constructor Parameters ---------- n_rule: int The number of rules n_token: int The number of tokens n_node_type: int The number of node types node_typ...
stack_v2_sparse_classes_36k_train_024837
4,771
permissive
[ { "docstring": "Constructor Parameters ---------- n_rule: int The number of rules n_token: int The number of tokens n_node_type: int The number of node types node_type_embedding_size: int Size of each node-type embedding vector embedding_size: int Size of each embedding vector", "name": "__init__", "sig...
2
null
Implement the Python class `ActionsEmbedding` described below. Class description: Implement the ActionsEmbedding class. Method signatures and docstrings: - def __init__(self, n_rule: int, n_token: int, n_node_type: int, node_type_embedding_size: int, embedding_size: int): Constructor Parameters ---------- n_rule: int...
Implement the Python class `ActionsEmbedding` described below. Class description: Implement the ActionsEmbedding class. Method signatures and docstrings: - def __init__(self, n_rule: int, n_token: int, n_node_type: int, node_type_embedding_size: int, embedding_size: int): Constructor Parameters ---------- n_rule: int...
573e94c567064705fa65267dd83946bf183197de
<|skeleton|> class ActionsEmbedding: def __init__(self, n_rule: int, n_token: int, n_node_type: int, node_type_embedding_size: int, embedding_size: int): """Constructor Parameters ---------- n_rule: int The number of rules n_token: int The number of tokens n_node_type: int The number of node types node_typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActionsEmbedding: def __init__(self, n_rule: int, n_token: int, n_node_type: int, node_type_embedding_size: int, embedding_size: int): """Constructor Parameters ---------- n_rule: int The number of rules n_token: int The number of tokens n_node_type: int The number of node types node_type_embedding_si...
the_stack_v2_python_sparse
mlprogram/nn/action_sequence/embedding.py
brando90/mlprogram
train
0
84d50e581e672f418cdaaf6c758b57ff5c88b914
[ "param = req.media\nif 'cartridgeModelName' in param:\n data = db.Db()\n newId = data.addCartdrigeModel(param['cartridgeModelName'])\n resp.text = json.dumps({'id': newId, 'model': param['cartridgeModelName'], 'depString': ''})", "queryString = falcon.uri.parse_query_string(req.query_string)\ndata = db.D...
<|body_start_0|> param = req.media if 'cartridgeModelName' in param: data = db.Db() newId = data.addCartdrigeModel(param['cartridgeModelName']) resp.text = json.dumps({'id': newId, 'model': param['cartridgeModelName'], 'depString': ''}) <|end_body_0|> <|body_start_1|...
CartridgeModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CartridgeModel: def on_post(self, req, resp): """handle post""" <|body_0|> def on_get(self, req, resp): """handle get request""" <|body_1|> def on_put(self, req, resp): """handle put request""" <|body_2|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_024838
1,406
no_license
[ { "docstring": "handle post", "name": "on_post", "signature": "def on_post(self, req, resp)" }, { "docstring": "handle get request", "name": "on_get", "signature": "def on_get(self, req, resp)" }, { "docstring": "handle put request", "name": "on_put", "signature": "def on...
3
stack_v2_sparse_classes_30k_train_014006
Implement the Python class `CartridgeModel` described below. Class description: Implement the CartridgeModel class. Method signatures and docstrings: - def on_post(self, req, resp): handle post - def on_get(self, req, resp): handle get request - def on_put(self, req, resp): handle put request
Implement the Python class `CartridgeModel` described below. Class description: Implement the CartridgeModel class. Method signatures and docstrings: - def on_post(self, req, resp): handle post - def on_get(self, req, resp): handle get request - def on_put(self, req, resp): handle put request <|skeleton|> class Cart...
529e9a0c66a6c7021224a2daf60f378f01164ca5
<|skeleton|> class CartridgeModel: def on_post(self, req, resp): """handle post""" <|body_0|> def on_get(self, req, resp): """handle get request""" <|body_1|> def on_put(self, req, resp): """handle put request""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CartridgeModel: def on_post(self, req, resp): """handle post""" param = req.media if 'cartridgeModelName' in param: data = db.Db() newId = data.addCartdrigeModel(param['cartridgeModelName']) resp.text = json.dumps({'id': newId, 'model': param['cartri...
the_stack_v2_python_sparse
answers/cartridge_model.py
Logsod/noti_rest_server
train
0
a09087c91a4dc691c348ee3b8d21b3c20fc7b947
[ "self.embd_grain = embd_grain\nself.pdb_file = pdb_file\nself.pdb = PandasPdb().read_pdb(self.pdb_file)\nself.embd_chain = embd_chain\nif embd_chain != None:\n self.dfpdb = self.pdb.df['ATOM'][self.pdb.df['ATOM'].chain_id == embd_chain]\nelse:\n self.dfpdb = self.pdb.df['ATOM']\nif self.embd_grain == 'mean':\...
<|body_start_0|> self.embd_grain = embd_grain self.pdb_file = pdb_file self.pdb = PandasPdb().read_pdb(self.pdb_file) self.embd_chain = embd_chain if embd_chain != None: self.dfpdb = self.pdb.df['ATOM'][self.pdb.df['ATOM'].chain_id == embd_chain] else: ...
PDB2Img
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDB2Img: def __init__(self, pdb_file, embd_grain='CA', embd_chain=None): """embd_grain: {'CA', 'CB', 'mean', 'all'} pdb_file: pdf file path embd_chain: pdb chain to do embedding""" <|body_0|> def transform(self, fmap_shape=None, cmap='jet_r', vmin=0, vmax=80, dpi=100): ...
stack_v2_sparse_classes_36k_train_024839
14,707
permissive
[ { "docstring": "embd_grain: {'CA', 'CB', 'mean', 'all'} pdb_file: pdf file path embd_chain: pdb chain to do embedding", "name": "__init__", "signature": "def __init__(self, pdb_file, embd_grain='CA', embd_chain=None)" }, { "docstring": "fig size: dpi*3", "name": "transform", "signature":...
2
stack_v2_sparse_classes_30k_train_018934
Implement the Python class `PDB2Img` described below. Class description: Implement the PDB2Img class. Method signatures and docstrings: - def __init__(self, pdb_file, embd_grain='CA', embd_chain=None): embd_grain: {'CA', 'CB', 'mean', 'all'} pdb_file: pdf file path embd_chain: pdb chain to do embedding - def transfor...
Implement the Python class `PDB2Img` described below. Class description: Implement the PDB2Img class. Method signatures and docstrings: - def __init__(self, pdb_file, embd_grain='CA', embd_chain=None): embd_grain: {'CA', 'CB', 'mean', 'all'} pdb_file: pdf file path embd_chain: pdb chain to do embedding - def transfor...
a46526eb1094b87ffa387e357de9313cff7ff7e3
<|skeleton|> class PDB2Img: def __init__(self, pdb_file, embd_grain='CA', embd_chain=None): """embd_grain: {'CA', 'CB', 'mean', 'all'} pdb_file: pdf file path embd_chain: pdb chain to do embedding""" <|body_0|> def transform(self, fmap_shape=None, cmap='jet_r', vmin=0, vmax=80, dpi=100): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PDB2Img: def __init__(self, pdb_file, embd_grain='CA', embd_chain=None): """embd_grain: {'CA', 'CB', 'mean', 'all'} pdb_file: pdf file path embd_chain: pdb chain to do embedding""" self.embd_grain = embd_grain self.pdb_file = pdb_file self.pdb = PandasPdb().read_pdb(self.pdb_fi...
the_stack_v2_python_sparse
molmap/pdb.py
shenwanxiang/bidd-molmap
train
124
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_36k_train_024840
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
null
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_36k
data/stack_v2_sparse_classes_30k
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
374621501d5d2a603e733ebb55a2b45730aebd43
[ "self.l = []\ni = 0\nwhile i < max(len(v1), len(v2)):\n if i < len(v1):\n self.l.append(v1[i])\n if i < len(v2):\n self.l.append(v2[i])\n i += 1\nself.index = 0", "cur = self.l[self.index]\nself.index += 1\nreturn cur", "if self.index < len(self.l):\n return True\nelse:\n return Fal...
<|body_start_0|> self.l = [] i = 0 while i < max(len(v1), len(v2)): if i < len(v1): self.l.append(v1[i]) if i < len(v2): self.l.append(v2[i]) i += 1 self.index = 0 <|end_body_0|> <|body_start_1|> cur = self.l[se...
ZigzagIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_024841
2,529
no_license
[ { "docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]", "name": "__init__", "signature": "def __init__(self, v1, v2)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name"...
3
stack_v2_sparse_classes_30k_train_002205
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
Implement the Python class `ZigzagIterator` described below. Class description: Implement the ZigzagIterator class. Method signatures and docstrings: - def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int] - def next(self): :rtype: int - def hasNext(self): :rtype: bo...
5195b032d8000a3d888e2d4068984011bebd3b84
<|skeleton|> class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZigzagIterator: def __init__(self, v1, v2): """Initialize your data structure here. :type v1: List[int] :type v2: List[int]""" self.l = [] i = 0 while i < max(len(v1), len(v2)): if i < len(v1): self.l.append(v1[i]) if i < len(v2): ...
the_stack_v2_python_sparse
leetcode_python/Queue/zigzag-iterator.py
ChillOrb/CS_basics
train
1
9ecaa0bd85b98ad2aabfacbb1fe22be23e5b3fde
[ "EasyFrame.__init__(self, title='Bouncy')\nself.addLabel(text='Initial Height', row=0, column=0)\nself.heightField = self.addFloatField(value=0.0, row=0, column=1)\nself.addLabel(text='Bounciness Index', row=1, column=0)\nself.indexField = self.addFloatField(value=0.0, row=1, column=1)\nself.addLabel(text='Number o...
<|body_start_0|> EasyFrame.__init__(self, title='Bouncy') self.addLabel(text='Initial Height', row=0, column=0) self.heightField = self.addFloatField(value=0.0, row=0, column=1) self.addLabel(text='Bounciness Index', row=1, column=0) self.indexField = self.addFloatField(value=0.0...
BouncyGUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BouncyGUI: def __init__(self): """Set up the window and widgets.""" <|body_0|> def computeDistance(self): """Event handler for the Compute button and set the distanceField.""" <|body_1|> <|end_skeleton|> <|body_start_0|> EasyFrame.__init__(self, tit...
stack_v2_sparse_classes_36k_train_024842
2,472
no_license
[ { "docstring": "Set up the window and widgets.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Event handler for the Compute button and set the distanceField.", "name": "computeDistance", "signature": "def computeDistance(self)" } ]
2
stack_v2_sparse_classes_30k_train_015677
Implement the Python class `BouncyGUI` described below. Class description: Implement the BouncyGUI class. Method signatures and docstrings: - def __init__(self): Set up the window and widgets. - def computeDistance(self): Event handler for the Compute button and set the distanceField.
Implement the Python class `BouncyGUI` described below. Class description: Implement the BouncyGUI class. Method signatures and docstrings: - def __init__(self): Set up the window and widgets. - def computeDistance(self): Event handler for the Compute button and set the distanceField. <|skeleton|> class BouncyGUI: ...
30375264cf0103e3455fdf92c35a2c5c15b5d7ef
<|skeleton|> class BouncyGUI: def __init__(self): """Set up the window and widgets.""" <|body_0|> def computeDistance(self): """Event handler for the Compute button and set the distanceField.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BouncyGUI: def __init__(self): """Set up the window and widgets.""" EasyFrame.__init__(self, title='Bouncy') self.addLabel(text='Initial Height', row=0, column=0) self.heightField = self.addFloatField(value=0.0, row=0, column=1) self.addLabel(text='Bounciness Index', ro...
the_stack_v2_python_sparse
Ch8 exercises/bouncywithgui.py
davelpat/Fundamentals_of_Python
train
1
f64f500f1def33f5a76d8046ca284674b0301d0f
[ "master, slave = os.openpty()\ntty.setraw(master, termios.TCSANOW)\nself.sock = sock\nself.master, self.slave = (master, slave)\nself.on_socket_disconnect = on_socket_disconnect\nself.on_slave_disconnect = on_slave_disconnect\nself._terminated = True\nself._thread = None", "if self._thread:\n raise RuntimeErro...
<|body_start_0|> master, slave = os.openpty() tty.setraw(master, termios.TCSANOW) self.sock = sock self.master, self.slave = (master, slave) self.on_socket_disconnect = on_socket_disconnect self.on_slave_disconnect = on_slave_disconnect self._terminated = True ...
Plug a PTY between a network socket and Python code that expects to run in a terminal. Generally, having a PTY enables the "interactive" features of some *nix terminal apps. This is different from many online examples in that **we do not** use `pty.spawn`, so the code that runs on the PTY slave side doesn't need to be ...
PTYSocketProxy
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PTYSocketProxy: """Plug a PTY between a network socket and Python code that expects to run in a terminal. Generally, having a PTY enables the "interactive" features of some *nix terminal apps. This is different from many online examples in that **we do not** use `pty.spawn`, so the code that runs...
stack_v2_sparse_classes_36k_train_024843
5,008
permissive
[ { "docstring": "Open the PTY. The slave FD becomes available as `self.slave`. `on_socket_disconnect`, if set, is a one-argument callable that is called when an EOF is detected on the socket. It receives the `PTYSocketProxy` instance and can e.g. `os.write(proxy.master, some_disconnect_command)` to tell the soft...
3
null
Implement the Python class `PTYSocketProxy` described below. Class description: Plug a PTY between a network socket and Python code that expects to run in a terminal. Generally, having a PTY enables the "interactive" features of some *nix terminal apps. This is different from many online examples in that **we do not**...
Implement the Python class `PTYSocketProxy` described below. Class description: Plug a PTY between a network socket and Python code that expects to run in a terminal. Generally, having a PTY enables the "interactive" features of some *nix terminal apps. This is different from many online examples in that **we do not**...
4f85957bf64e1b786da0679eade3fe602793ceee
<|skeleton|> class PTYSocketProxy: """Plug a PTY between a network socket and Python code that expects to run in a terminal. Generally, having a PTY enables the "interactive" features of some *nix terminal apps. This is different from many online examples in that **we do not** use `pty.spawn`, so the code that runs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PTYSocketProxy: """Plug a PTY between a network socket and Python code that expects to run in a terminal. Generally, having a PTY enables the "interactive" features of some *nix terminal apps. This is different from many online examples in that **we do not** use `pty.spawn`, so the code that runs on the PTY s...
the_stack_v2_python_sparse
unpythonic/net/ptyproxy.py
Technologicat/unpythonic
train
81
763a4b843a0bb7607b1de9488be8bf2415897f08
[ "def dfs(node, depth):\n left = depth\n if node.left:\n left = dfs(node.left, depth + 1)\n if left < 0:\n return left\n right = depth\n if node.right:\n right = dfs(node.right, depth + 1)\n if right < 0:\n return right\n if left - right > 1 or right - left > 1:\n ...
<|body_start_0|> def dfs(node, depth): left = depth if node.left: left = dfs(node.left, depth + 1) if left < 0: return left right = depth if node.right: right = dfs(node.right, depth + 1) if r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isBalanced1(self, root: TreeNode) -> bool: """执行用时: 76 ms , 在所有 Python3 提交中击败了 31.32% 的用户 内存消耗: 19.9 MB , 在所有 Python3 提交中击败了 6.97% 的用户""" <|body_0|> def isBalanced(self, root: TreeNode) -> bool: """执行用时: 60 ms , 在所有 Python3 提交中击败了 72.75% 的用户 内存消耗: 19.6 ...
stack_v2_sparse_classes_36k_train_024844
2,368
no_license
[ { "docstring": "执行用时: 76 ms , 在所有 Python3 提交中击败了 31.32% 的用户 内存消耗: 19.9 MB , 在所有 Python3 提交中击败了 6.97% 的用户", "name": "isBalanced1", "signature": "def isBalanced1(self, root: TreeNode) -> bool" }, { "docstring": "执行用时: 60 ms , 在所有 Python3 提交中击败了 72.75% 的用户 内存消耗: 19.6 MB , 在所有 Python3 提交中击败了 36.65% ...
2
stack_v2_sparse_classes_30k_train_014637
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced1(self, root: TreeNode) -> bool: 执行用时: 76 ms , 在所有 Python3 提交中击败了 31.32% 的用户 内存消耗: 19.9 MB , 在所有 Python3 提交中击败了 6.97% 的用户 - def isBalanced(self, root: TreeNode) -> ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isBalanced1(self, root: TreeNode) -> bool: 执行用时: 76 ms , 在所有 Python3 提交中击败了 31.32% 的用户 内存消耗: 19.9 MB , 在所有 Python3 提交中击败了 6.97% 的用户 - def isBalanced(self, root: TreeNode) -> ...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def isBalanced1(self, root: TreeNode) -> bool: """执行用时: 76 ms , 在所有 Python3 提交中击败了 31.32% 的用户 内存消耗: 19.9 MB , 在所有 Python3 提交中击败了 6.97% 的用户""" <|body_0|> def isBalanced(self, root: TreeNode) -> bool: """执行用时: 60 ms , 在所有 Python3 提交中击败了 72.75% 的用户 内存消耗: 19.6 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isBalanced1(self, root: TreeNode) -> bool: """执行用时: 76 ms , 在所有 Python3 提交中击败了 31.32% 的用户 内存消耗: 19.9 MB , 在所有 Python3 提交中击败了 6.97% 的用户""" def dfs(node, depth): left = depth if node.left: left = dfs(node.left, depth + 1) if left ...
the_stack_v2_python_sparse
平衡二叉树.py
nomboy/leetcode
train
0
185feeb7567e172974caf1554188b5a6addf8127
[ "if self.vehicle_zev_type.vehicle_zev_code in ['BEV', 'FCEV'] and self.range < 80.47:\n return 'C'\nif self.vehicle_zev_type.vehicle_zev_code not in ['BEV', 'FCEV'] and self.range < 16:\n return 'C'\nif self.vehicle_zev_type.vehicle_zev_code == 'EREV' and self.range >= 121:\n return 'A'\nif self.vehicle_ze...
<|body_start_0|> if self.vehicle_zev_type.vehicle_zev_code in ['BEV', 'FCEV'] and self.range < 80.47: return 'C' if self.vehicle_zev_type.vehicle_zev_code not in ['BEV', 'FCEV'] and self.range < 16: return 'C' if self.vehicle_zev_type.vehicle_zev_code == 'EREV' and self.r...
Vehicle
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vehicle: def get_credit_class(self): """Gets the credit class of the vehicle""" <|body_0|> def get_credit_value(self): """Gets the credit value of the vehicle""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.vehicle_zev_type.vehicle_zev_code ...
stack_v2_sparse_classes_36k_train_024845
4,144
permissive
[ { "docstring": "Gets the credit class of the vehicle", "name": "get_credit_class", "signature": "def get_credit_class(self)" }, { "docstring": "Gets the credit value of the vehicle", "name": "get_credit_value", "signature": "def get_credit_value(self)" } ]
2
null
Implement the Python class `Vehicle` described below. Class description: Implement the Vehicle class. Method signatures and docstrings: - def get_credit_class(self): Gets the credit class of the vehicle - def get_credit_value(self): Gets the credit value of the vehicle
Implement the Python class `Vehicle` described below. Class description: Implement the Vehicle class. Method signatures and docstrings: - def get_credit_class(self): Gets the credit class of the vehicle - def get_credit_value(self): Gets the credit value of the vehicle <|skeleton|> class Vehicle: def get_credit...
b395efe620a1b82c2ecee2004cca358d8407397e
<|skeleton|> class Vehicle: def get_credit_class(self): """Gets the credit class of the vehicle""" <|body_0|> def get_credit_value(self): """Gets the credit value of the vehicle""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Vehicle: def get_credit_class(self): """Gets the credit class of the vehicle""" if self.vehicle_zev_type.vehicle_zev_code in ['BEV', 'FCEV'] and self.range < 80.47: return 'C' if self.vehicle_zev_type.vehicle_zev_code not in ['BEV', 'FCEV'] and self.range < 16: ...
the_stack_v2_python_sparse
backend/api/models/vehicle.py
emi-hi/zeva
train
0
fa6035d8192666f1a8b0f3dd543e2ac97d291c67
[ "source_dir = os.path.join(os.path.dirname(dir_path), 'image')\ntarget_dir = os.path.join(os.path.dirname(dir_path), 'image_target')\nself.imageutil = ImageUtils(source_dir, target_dir)", "print('欢迎来到图片处理页面'.center(100, '*'))\nmenu = ['文件夹下所有图片缩略功能', '获取件夹下所有图片大小数据并且保存到excel']\nfor i in range(len(menu)):\n pri...
<|body_start_0|> source_dir = os.path.join(os.path.dirname(dir_path), 'image') target_dir = os.path.join(os.path.dirname(dir_path), 'image_target') self.imageutil = ImageUtils(source_dir, target_dir) <|end_body_0|> <|body_start_1|> print('欢迎来到图片处理页面'.center(100, '*')) menu = ['文...
图片操作类
ImageManage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageManage: """图片操作类""" def __init__(self): """初始化""" <|body_0|> def image_page(self): """图片处理页面""" <|body_1|> <|end_skeleton|> <|body_start_0|> source_dir = os.path.join(os.path.dirname(dir_path), 'image') target_dir = os.path.join(os....
stack_v2_sparse_classes_36k_train_024846
1,225
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "图片处理页面", "name": "image_page", "signature": "def image_page(self)" } ]
2
stack_v2_sparse_classes_30k_train_004842
Implement the Python class `ImageManage` described below. Class description: 图片操作类 Method signatures and docstrings: - def __init__(self): 初始化 - def image_page(self): 图片处理页面
Implement the Python class `ImageManage` described below. Class description: 图片操作类 Method signatures and docstrings: - def __init__(self): 初始化 - def image_page(self): 图片处理页面 <|skeleton|> class ImageManage: """图片操作类""" def __init__(self): """初始化""" <|body_0|> def image_page(self): ...
173f3a5fa24176df4c53bd36771cc733a1221dfd
<|skeleton|> class ImageManage: """图片操作类""" def __init__(self): """初始化""" <|body_0|> def image_page(self): """图片处理页面""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageManage: """图片操作类""" def __init__(self): """初始化""" source_dir = os.path.join(os.path.dirname(dir_path), 'image') target_dir = os.path.join(os.path.dirname(dir_path), 'image_target') self.imageutil = ImageUtils(source_dir, target_dir) def image_page(self): ...
the_stack_v2_python_sparse
0303system-yanchunwei/joker_work/core/image_page.py
Joker2018goon/myGitRepo
train
1
3f46a08f861b79ce4c52bb92415fb8679821e3e9
[ "serializer = serializers.CreateInstitucionSerializer(data=request.data)\ndata = {}\nif serializer.is_valid():\n try:\n serializer.save()\n except ValidationError as e:\n return Response(data={'detail': e.message}, status=status.HTTP_400_BAD_REQUEST)\nelse:\n data = serializer.errors\n ret...
<|body_start_0|> serializer = serializers.CreateInstitucionSerializer(data=request.data) data = {} if serializer.is_valid(): try: serializer.save() except ValidationError as e: return Response(data={'detail': e.message}, status=status.HTTP_...
InstitucionViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstitucionViewSet: def create(self, request): """Crear nueva Institucion""" <|body_0|> def update(self, request, pk=None): """Editar Institucion""" <|body_1|> def destroy(self, request, pk=None): """Elimina una institucion""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_024847
5,469
no_license
[ { "docstring": "Crear nueva Institucion", "name": "create", "signature": "def create(self, request)" }, { "docstring": "Editar Institucion", "name": "update", "signature": "def update(self, request, pk=None)" }, { "docstring": "Elimina una institucion", "name": "destroy", ...
6
null
Implement the Python class `InstitucionViewSet` described below. Class description: Implement the InstitucionViewSet class. Method signatures and docstrings: - def create(self, request): Crear nueva Institucion - def update(self, request, pk=None): Editar Institucion - def destroy(self, request, pk=None): Elimina una...
Implement the Python class `InstitucionViewSet` described below. Class description: Implement the InstitucionViewSet class. Method signatures and docstrings: - def create(self, request): Crear nueva Institucion - def update(self, request, pk=None): Editar Institucion - def destroy(self, request, pk=None): Elimina una...
be80b2d15f84a8eeba898e753efee348de6ce998
<|skeleton|> class InstitucionViewSet: def create(self, request): """Crear nueva Institucion""" <|body_0|> def update(self, request, pk=None): """Editar Institucion""" <|body_1|> def destroy(self, request, pk=None): """Elimina una institucion""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstitucionViewSet: def create(self, request): """Crear nueva Institucion""" serializer = serializers.CreateInstitucionSerializer(data=request.data) data = {} if serializer.is_valid(): try: serializer.save() except ValidationError as e: ...
the_stack_v2_python_sparse
instituciones/api/views.py
Clear-Education/ontrack_backend
train
1
99c3c1b966c4f3037e7b35909ea5c5a885bf9c03
[ "session = DBSession()\nsession.merge(trans_inst)\nsession.commit()\nsession.close()", "session = DBSession()\nif 'user_id' in kwargs:\n _user_id = kwargs['user_id']\nselect = session.query(Trans_inst).filter(Trans_inst.user_id == _user_id).first()\nprint(select)\nsession.close()\nreturn select" ]
<|body_start_0|> session = DBSession() session.merge(trans_inst) session.commit() session.close() <|end_body_0|> <|body_start_1|> session = DBSession() if 'user_id' in kwargs: _user_id = kwargs['user_id'] select = session.query(Trans_inst).filter(Tran...
策略实例model类
Trans_inst
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Trans_inst: """策略实例model类""" def save(trans_inst): """新加/修改策略实例表 :param trans: :return:""" <|body_0|> def select(self, **kwargs): """新加/修改交易表 :param trans: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> session = DBSession() se...
stack_v2_sparse_classes_36k_train_024848
8,115
no_license
[ { "docstring": "新加/修改策略实例表 :param trans: :return:", "name": "save", "signature": "def save(trans_inst)" }, { "docstring": "新加/修改交易表 :param trans: :return:", "name": "select", "signature": "def select(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_004803
Implement the Python class `Trans_inst` described below. Class description: 策略实例model类 Method signatures and docstrings: - def save(trans_inst): 新加/修改策略实例表 :param trans: :return: - def select(self, **kwargs): 新加/修改交易表 :param trans: :return:
Implement the Python class `Trans_inst` described below. Class description: 策略实例model类 Method signatures and docstrings: - def save(trans_inst): 新加/修改策略实例表 :param trans: :return: - def select(self, **kwargs): 新加/修改交易表 :param trans: :return: <|skeleton|> class Trans_inst: """策略实例model类""" def save(trans_inst...
1bc744a6d331b4b733f6b6658b8310eb0c30524e
<|skeleton|> class Trans_inst: """策略实例model类""" def save(trans_inst): """新加/修改策略实例表 :param trans: :return:""" <|body_0|> def select(self, **kwargs): """新加/修改交易表 :param trans: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Trans_inst: """策略实例model类""" def save(trans_inst): """新加/修改策略实例表 :param trans: :return:""" session = DBSession() session.merge(trans_inst) session.commit() session.close() def select(self, **kwargs): """新加/修改交易表 :param trans: :return:""" sessio...
the_stack_v2_python_sparse
investment/transaction/models.py
cliicy/vtrade
train
0
00cce08c2675618953907a6bb92cca5d7dde72a5
[ "res = []\n\ndef dfs(tr):\n if not tr:\n return\n if tr.left:\n dfs(tr.left)\n res.append(tr.val)\n if tr.right:\n dfs(tr.right)\ndfs(root)\nreturn res", "res = []\nnq = []\np = root\nwhile nq or p:\n if p:\n nq.append(p)\n p = p.left\n else:\n p = nq.po...
<|body_start_0|> res = [] def dfs(tr): if not tr: return if tr.left: dfs(tr.left) res.append(tr.val) if tr.right: dfs(tr.right) dfs(root) return res <|end_body_0|> <|body_start_1|> r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal_recursion(self, root: TreeNode): """递归实现中序遍历二叉树""" <|body_0|> def inorderTraversal_recursion(self, root: TreeNode): """迭代实现中序遍历二叉树""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] def dfs(tr): ...
stack_v2_sparse_classes_36k_train_024849
1,511
no_license
[ { "docstring": "递归实现中序遍历二叉树", "name": "inorderTraversal_recursion", "signature": "def inorderTraversal_recursion(self, root: TreeNode)" }, { "docstring": "迭代实现中序遍历二叉树", "name": "inorderTraversal_recursion", "signature": "def inorderTraversal_recursion(self, root: TreeNode)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal_recursion(self, root: TreeNode): 递归实现中序遍历二叉树 - def inorderTraversal_recursion(self, root: TreeNode): 迭代实现中序遍历二叉树
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal_recursion(self, root: TreeNode): 递归实现中序遍历二叉树 - def inorderTraversal_recursion(self, root: TreeNode): 迭代实现中序遍历二叉树 <|skeleton|> class Solution: def inord...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def inorderTraversal_recursion(self, root: TreeNode): """递归实现中序遍历二叉树""" <|body_0|> def inorderTraversal_recursion(self, root: TreeNode): """迭代实现中序遍历二叉树""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTraversal_recursion(self, root: TreeNode): """递归实现中序遍历二叉树""" res = [] def dfs(tr): if not tr: return if tr.left: dfs(tr.left) res.append(tr.val) if tr.right: dfs(tr.rig...
the_stack_v2_python_sparse
leetcode/solved/094_.py
usnnu/python_foundation
train
0
a3a3634021cdca9cca82327300fafe76125bad40
[ "res = super(stock_picking, self).create(cr, uid, values, context=context)\nif 'delivery_tracking_ids' in values:\n for delivery_tracking_ids in values['delivery_tracking_ids']:\n self.pool.get('delivery.tracking.numbers').write(cr, uid, tracking_num_ids[1], {'delivery_id': res})\nreturn res", "if 'deli...
<|body_start_0|> res = super(stock_picking, self).create(cr, uid, values, context=context) if 'delivery_tracking_ids' in values: for delivery_tracking_ids in values['delivery_tracking_ids']: self.pool.get('delivery.tracking.numbers').write(cr, uid, tracking_num_ids[1], {'deli...
stock_picking_out
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_out: def create(self, cr, uid, values, context=None): """set delivery order id in the tracking number db table records on create""" <|body_0|> def write(self, cr, uid, ids, values, context=None): """set delivery order id in the tracking number db table ...
stack_v2_sparse_classes_36k_train_024850
5,870
no_license
[ { "docstring": "set delivery order id in the tracking number db table records on create", "name": "create", "signature": "def create(self, cr, uid, values, context=None)" }, { "docstring": "set delivery order id in the tracking number db table records on create", "name": "write", "signat...
2
null
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def create(self, cr, uid, values, context=None): set delivery order id in the tracking number db table records on create - def write(self, cr, uid, ids, values,...
Implement the Python class `stock_picking_out` described below. Class description: Implement the stock_picking_out class. Method signatures and docstrings: - def create(self, cr, uid, values, context=None): set delivery order id in the tracking number db table records on create - def write(self, cr, uid, ids, values,...
3a0d7ddb85d497b4f576678370a1fbbfd71379f4
<|skeleton|> class stock_picking_out: def create(self, cr, uid, values, context=None): """set delivery order id in the tracking number db table records on create""" <|body_0|> def write(self, cr, uid, ids, values, context=None): """set delivery order id in the tracking number db table ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stock_picking_out: def create(self, cr, uid, values, context=None): """set delivery order id in the tracking number db table records on create""" res = super(stock_picking, self).create(cr, uid, values, context=context) if 'delivery_tracking_ids' in values: for delivery_tra...
the_stack_v2_python_sparse
7.0/ursa_tracking/tracking_numbers.py
alephobjects/ao-openerp
train
3
1cdb75800c5cd30a0fd26897a2acf2f568e05073
[ "if user.is_superuser:\n return True\nelif society in user.societies.all():\n return True\nelse:\n return self._user_has_permission(user, Permission.USER_CAN_EDIT_SOCIETY, society)", "if user.is_superuser:\n return True\nelse:\n return False", "object_type = ContentType.objects.get_for_model(obje...
<|body_start_0|> if user.is_superuser: return True elif society in user.societies.all(): return True else: return self._user_has_permission(user, Permission.USER_CAN_EDIT_SOCIETY, society) <|end_body_0|> <|body_start_1|> if user.is_superuser: ...
This object stores all permission-related functions. All new permission checks should go here.
PermissionManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionManager: """This object stores all permission-related functions. All new permission checks should go here.""" def user_can_edit_society(self, user, society): """Checks if a user can edit a society.""" <|body_0|> def user_can_edit_society_name(self, user, societ...
stack_v2_sparse_classes_36k_train_024851
4,655
no_license
[ { "docstring": "Checks if a user can edit a society.", "name": "user_can_edit_society", "signature": "def user_can_edit_society(self, user, society)" }, { "docstring": "Only superusers (admins) can edit a society name.", "name": "user_can_edit_society_name", "signature": "def user_can_ed...
3
null
Implement the Python class `PermissionManager` described below. Class description: This object stores all permission-related functions. All new permission checks should go here. Method signatures and docstrings: - def user_can_edit_society(self, user, society): Checks if a user can edit a society. - def user_can_edit...
Implement the Python class `PermissionManager` described below. Class description: This object stores all permission-related functions. All new permission checks should go here. Method signatures and docstrings: - def user_can_edit_society(self, user, society): Checks if a user can edit a society. - def user_can_edit...
95379415881d8d37cd7f92ed89f494fe301a5f01
<|skeleton|> class PermissionManager: """This object stores all permission-related functions. All new permission checks should go here.""" def user_can_edit_society(self, user, society): """Checks if a user can edit a society.""" <|body_0|> def user_can_edit_society_name(self, user, societ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PermissionManager: """This object stores all permission-related functions. All new permission checks should go here.""" def user_can_edit_society(self, user, society): """Checks if a user can edit a society.""" if user.is_superuser: return True elif society in user.soc...
the_stack_v2_python_sparse
webapp/models/profile.py
Hitoki/ieee
train
0
f609d5e7c1662b2ab545b7b059d1819d4fa51147
[ "self.size = 0\nself.val2index = dict()\nself.index2val = dict()", "if val not in self.val2index:\n self.size += 1\n self.index2val[self.size] = val\n self.val2index[val] = self.size\n return True\nelse:\n return False", "if val in self.val2index:\n index = self.val2index[val]\n lastVal = s...
<|body_start_0|> self.size = 0 self.val2index = dict() self.index2val = dict() <|end_body_0|> <|body_start_1|> if val not in self.val2index: self.size += 1 self.index2val[self.size] = val self.val2index[val] = self.size return True ...
RandomizedSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_024852
1,697
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool", "name": "insert", "signature": ...
4
stack_v2_sparse_classes_30k_train_002502
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif...
2c3dbcbcb20cfdb276c0886e0193ef42551c5747
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.size = 0 self.val2index = dict() self.index2val = dict() def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. ...
the_stack_v2_python_sparse
380-Insert-Delete-GetRandom-O(1)/Solution.py
Lucces/leetcode
train
0
eb5ae0cd1adeb6b277059c6a80b7205b5a984d2f
[ "self.width = width\nself.state = 0\nself.total = 0", "sys.stdout.write('[%s]' % (' ' * self.width))\nsys.stdout.flush()\nsys.stdout.write('\\x08' * (self.width + 1))\nself.state, self.total = (0, total_iterations)", "state_ = int(self.width * n) / int(self.total)\nif state_ == self.state:\n pass\nelif self....
<|body_start_0|> self.width = width self.state = 0 self.total = 0 <|end_body_0|> <|body_start_1|> sys.stdout.write('[%s]' % (' ' * self.width)) sys.stdout.flush() sys.stdout.write('\x08' * (self.width + 1)) self.state, self.total = (0, total_iterations) <|end_bod...
Progress Bar
ProgressBar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgressBar: """Progress Bar""" def __init__(self, width=40): """Initialise with some width""" <|body_0|> def start(self, total_iterations): """Set up a scaling factor for total iterations""" <|body_1|> def update(self, n): """Update the tick...
stack_v2_sparse_classes_36k_train_024853
2,362
no_license
[ { "docstring": "Initialise with some width", "name": "__init__", "signature": "def __init__(self, width=40)" }, { "docstring": "Set up a scaling factor for total iterations", "name": "start", "signature": "def start(self, total_iterations)" }, { "docstring": "Update the ticker", ...
4
stack_v2_sparse_classes_30k_test_000414
Implement the Python class `ProgressBar` described below. Class description: Progress Bar Method signatures and docstrings: - def __init__(self, width=40): Initialise with some width - def start(self, total_iterations): Set up a scaling factor for total iterations - def update(self, n): Update the ticker - def stop(s...
Implement the Python class `ProgressBar` described below. Class description: Progress Bar Method signatures and docstrings: - def __init__(self, width=40): Initialise with some width - def start(self, total_iterations): Set up a scaling factor for total iterations - def update(self, n): Update the ticker - def stop(s...
327f77e7a4f2fe874e2c66e5c9914de23aa224ed
<|skeleton|> class ProgressBar: """Progress Bar""" def __init__(self, width=40): """Initialise with some width""" <|body_0|> def start(self, total_iterations): """Set up a scaling factor for total iterations""" <|body_1|> def update(self, n): """Update the tick...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgressBar: """Progress Bar""" def __init__(self, width=40): """Initialise with some width""" self.width = width self.state = 0 self.total = 0 def start(self, total_iterations): """Set up a scaling factor for total iterations""" sys.stdout.write('[%s]...
the_stack_v2_python_sparse
python/util/ProgressBar.py
arunchaganty/spectral
train
0
29902334611082682612dbba02191ce6e09b6100
[ "xml.sax.handler.ContentHandler.__init__(self)\nself.styleRegistry = styleRegistry\nif not tagAliases:\n tagAliases = XmlMarkupTagAliases()\nself.tagAliases = tagAliases", "self.style = CascadingStyleStack()\nself.document = None\nself.block = None\nself.glyphs = None", "styleDict = None\nstyleAttr = attrs.g...
<|body_start_0|> xml.sax.handler.ContentHandler.__init__(self) self.styleRegistry = styleRegistry if not tagAliases: tagAliases = XmlMarkupTagAliases() self.tagAliases = tagAliases <|end_body_0|> <|body_start_1|> self.style = CascadingStyleStack() self.docume...
XML content handler for XML text layout markup.
_XmlMarkupHandler
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _XmlMarkupHandler: """XML content handler for XML text layout markup.""" def __init__(self, styleRegistry, tagAliases=None): """Initializes the content handler with the given style registry and tag aliases.""" <|body_0|> def startDocument(self): """Called by the ...
stack_v2_sparse_classes_36k_train_024854
21,802
permissive
[ { "docstring": "Initializes the content handler with the given style registry and tag aliases.", "name": "__init__", "signature": "def __init__(self, styleRegistry, tagAliases=None)" }, { "docstring": "Called by the XML parser at the beginning of parsing the XML document.", "name": "startDoc...
6
null
Implement the Python class `_XmlMarkupHandler` described below. Class description: XML content handler for XML text layout markup. Method signatures and docstrings: - def __init__(self, styleRegistry, tagAliases=None): Initializes the content handler with the given style registry and tag aliases. - def startDocument(...
Implement the Python class `_XmlMarkupHandler` described below. Class description: XML content handler for XML text layout markup. Method signatures and docstrings: - def __init__(self, styleRegistry, tagAliases=None): Initializes the content handler with the given style registry and tag aliases. - def startDocument(...
61351f52f01367439e8810d2c482a9c9897545d8
<|skeleton|> class _XmlMarkupHandler: """XML content handler for XML text layout markup.""" def __init__(self, styleRegistry, tagAliases=None): """Initializes the content handler with the given style registry and tag aliases.""" <|body_0|> def startDocument(self): """Called by the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _XmlMarkupHandler: """XML content handler for XML text layout markup.""" def __init__(self, styleRegistry, tagAliases=None): """Initializes the content handler with the given style registry and tag aliases.""" xml.sax.handler.ContentHandler.__init__(self) self.styleRegistry = styl...
the_stack_v2_python_sparse
enso/enso/graphics/xmltextlayout.py
GChristensen/enso-portable
train
144
47bf006c512ea26638ffafcfc6020ebef3bf880a
[ "Idevice.__init__(self, x_(u'Multi-select'), x_(u'University of Auckland'), x_(u'Unlike the MCQ the SCORM quiz is used to test \\nthe learners knowledge on a topic without providing the learner with feedback \\nto the correct answer. The quiz will often be given once the learner has had \\ntime to learn and practic...
<|body_start_0|> Idevice.__init__(self, x_(u'Multi-select'), x_(u'University of Auckland'), x_(u'Unlike the MCQ the SCORM quiz is used to test \nthe learners knowledge on a topic without providing the learner with feedback \nto the correct answer. The quiz will often be given once the learner has had \ntime to ...
A MultiSelect Idevice is one built up from question and options
MultiSelectIdevice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiSelectIdevice: """A MultiSelect Idevice is one built up from question and options""" def __init__(self): """Initialize""" <|body_0|> def addQuestion(self): """Add a new question to this iDevice.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_024855
1,341
no_license
[ { "docstring": "Initialize", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Add a new question to this iDevice.", "name": "addQuestion", "signature": "def addQuestion(self)" } ]
2
null
Implement the Python class `MultiSelectIdevice` described below. Class description: A MultiSelect Idevice is one built up from question and options Method signatures and docstrings: - def __init__(self): Initialize - def addQuestion(self): Add a new question to this iDevice.
Implement the Python class `MultiSelectIdevice` described below. Class description: A MultiSelect Idevice is one built up from question and options Method signatures and docstrings: - def __init__(self): Initialize - def addQuestion(self): Add a new question to this iDevice. <|skeleton|> class MultiSelectIdevice: ...
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
<|skeleton|> class MultiSelectIdevice: """A MultiSelect Idevice is one built up from question and options""" def __init__(self): """Initialize""" <|body_0|> def addQuestion(self): """Add a new question to this iDevice.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiSelectIdevice: """A MultiSelect Idevice is one built up from question and options""" def __init__(self): """Initialize""" Idevice.__init__(self, x_(u'Multi-select'), x_(u'University of Auckland'), x_(u'Unlike the MCQ the SCORM quiz is used to test \nthe learners knowledge on a topic ...
the_stack_v2_python_sparse
eXe/rev2283-2409/left-trunk-2409/exe/engine/multiselectidevice.py
joliebig/featurehouse_fstmerge_examples
train
3
8a10b5cf2dc9dedd8fe53608e223dfc9ae72df92
[ "stdscr = curses.initscr()\ncurses.noecho()\ncurses.start_color()\nstdscr.addstr(x, y, 'x')\nstdscr.refresh()", "stdscr = curses.initscr()\ncurses.noecho()\nif direction.startswith('d'):\n for count in range(amount):\n self.y += 1\n stdscr.addstr(self.y, self.x, 'x')\nif direction.startswith('u')...
<|body_start_0|> stdscr = curses.initscr() curses.noecho() curses.start_color() stdscr.addstr(x, y, 'x') stdscr.refresh() <|end_body_0|> <|body_start_1|> stdscr = curses.initscr() curses.noecho() if direction.startswith('d'): for count in rang...
Artist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Artist: def poke(self, x, y): """Prints a 'x' on a specific coordinate.""" <|body_0|> def move(self, direction, amount): """Moves x and y of""" <|body_1|> <|end_skeleton|> <|body_start_0|> stdscr = curses.initscr() curses.noecho() cu...
stack_v2_sparse_classes_36k_train_024856
1,855
no_license
[ { "docstring": "Prints a 'x' on a specific coordinate.", "name": "poke", "signature": "def poke(self, x, y)" }, { "docstring": "Moves x and y of", "name": "move", "signature": "def move(self, direction, amount)" } ]
2
stack_v2_sparse_classes_30k_train_021683
Implement the Python class `Artist` described below. Class description: Implement the Artist class. Method signatures and docstrings: - def poke(self, x, y): Prints a 'x' on a specific coordinate. - def move(self, direction, amount): Moves x and y of
Implement the Python class `Artist` described below. Class description: Implement the Artist class. Method signatures and docstrings: - def poke(self, x, y): Prints a 'x' on a specific coordinate. - def move(self, direction, amount): Moves x and y of <|skeleton|> class Artist: def poke(self, x, y): """P...
73fd7df695cf643e9b07a21b90ac154c293d9b27
<|skeleton|> class Artist: def poke(self, x, y): """Prints a 'x' on a specific coordinate.""" <|body_0|> def move(self, direction, amount): """Moves x and y of""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Artist: def poke(self, x, y): """Prints a 'x' on a specific coordinate.""" stdscr = curses.initscr() curses.noecho() curses.start_color() stdscr.addstr(x, y, 'x') stdscr.refresh() def move(self, direction, amount): """Moves x and y of""" std...
the_stack_v2_python_sparse
artist/draw
reteps/ranpy
train
0
8966446ff73c6fa6e2d697c6cebe86b7b7a67777
[ "ConfigInitializer._generate_config_file_if_missing(path)\nconfig_parser = SafeConfigParser()\nconfig_parser.read(path)\nreturn config_parser", "if not os.path.isfile(dest_path):\n print(dest_path + ' missing, generating new one from ' + src_path)\n copyfile(src_path, dest_path)" ]
<|body_start_0|> ConfigInitializer._generate_config_file_if_missing(path) config_parser = SafeConfigParser() config_parser.read(path) return config_parser <|end_body_0|> <|body_start_1|> if not os.path.isfile(dest_path): print(dest_path + ' missing, generating new on...
Initialize the SafeConfigParser.
ConfigInitializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigInitializer: """Initialize the SafeConfigParser.""" def get_config_parser(path=dir_path + '../config.ini'): """Get a SafeConfigParser that parses a given config file. :param path: input path to the config file :return: SafeConfigParser for the config file""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_024857
1,177
no_license
[ { "docstring": "Get a SafeConfigParser that parses a given config file. :param path: input path to the config file :return: SafeConfigParser for the config file", "name": "get_config_parser", "signature": "def get_config_parser(path=dir_path + '../config.ini')" }, { "docstring": "Make a copy of ...
2
stack_v2_sparse_classes_30k_train_016359
Implement the Python class `ConfigInitializer` described below. Class description: Initialize the SafeConfigParser. Method signatures and docstrings: - def get_config_parser(path=dir_path + '../config.ini'): Get a SafeConfigParser that parses a given config file. :param path: input path to the config file :return: Sa...
Implement the Python class `ConfigInitializer` described below. Class description: Initialize the SafeConfigParser. Method signatures and docstrings: - def get_config_parser(path=dir_path + '../config.ini'): Get a SafeConfigParser that parses a given config file. :param path: input path to the config file :return: Sa...
187023f93937985e10f593b032ea7f48c1d61060
<|skeleton|> class ConfigInitializer: """Initialize the SafeConfigParser.""" def get_config_parser(path=dir_path + '../config.ini'): """Get a SafeConfigParser that parses a given config file. :param path: input path to the config file :return: SafeConfigParser for the config file""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigInitializer: """Initialize the SafeConfigParser.""" def get_config_parser(path=dir_path + '../config.ini'): """Get a SafeConfigParser that parses a given config file. :param path: input path to the config file :return: SafeConfigParser for the config file""" ConfigInitializer._gener...
the_stack_v2_python_sparse
config_initializer/config_initializer.py
janetzki/fact_extraction
train
5
97c48ebc01c91ca0db786bc0fd5d132d3b63ecc4
[ "Search.__init__(self)\nself.token = token\nself.serviceName = 'YouTube'", "self.logger.info('Running YouTube search for query %s...', query)\nurl = 'https://www.googleapis.com/youtube/v3/search?q=%s&maxResults=%i&part=snippet&key=%s&relevanceLanguage=%s&type=video' % (query.replace(' ', '+'), maxresults, self.to...
<|body_start_0|> Search.__init__(self) self.token = token self.serviceName = 'YouTube' <|end_body_0|> <|body_start_1|> self.logger.info('Running YouTube search for query %s...', query) url = 'https://www.googleapis.com/youtube/v3/search?q=%s&maxResults=%i&part=snippet&key=%s&rel...
YouTubeSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YouTubeSearch: def __init__(self, token): """Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.""" <|body_0|> def search(self, query, maxresults=10, lang='en', **opt): """Searches YouTube for videos using the given query. Returns a dic...
stack_v2_sparse_classes_36k_train_024858
5,488
no_license
[ { "docstring": "Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.", "name": "__init__", "signature": "def __init__(self, token)" }, { "docstring": "Searches YouTube for videos using the given query. Returns a dict of url: title pairs pointing to videos. If maxres...
2
stack_v2_sparse_classes_30k_train_008883
Implement the Python class `YouTubeSearch` described below. Class description: Implement the YouTubeSearch class. Method signatures and docstrings: - def __init__(self, token): Create a new YouTubeSearch instance. token should be a valid YouTube Data API key. - def search(self, query, maxresults=10, lang='en', **opt)...
Implement the Python class `YouTubeSearch` described below. Class description: Implement the YouTubeSearch class. Method signatures and docstrings: - def __init__(self, token): Create a new YouTubeSearch instance. token should be a valid YouTube Data API key. - def search(self, query, maxresults=10, lang='en', **opt)...
5fbff4606d50a114613edbb1f360aca070be9226
<|skeleton|> class YouTubeSearch: def __init__(self, token): """Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.""" <|body_0|> def search(self, query, maxresults=10, lang='en', **opt): """Searches YouTube for videos using the given query. Returns a dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class YouTubeSearch: def __init__(self, token): """Create a new YouTubeSearch instance. token should be a valid YouTube Data API key.""" Search.__init__(self) self.token = token self.serviceName = 'YouTube' def search(self, query, maxresults=10, lang='en', **opt): """Sea...
the_stack_v2_python_sparse
ytsearch.py
fredi-68/Ram
train
0
46c1bf38178e10091bce874178c79c8292b3cf46
[ "event = {'event': 'pause'}\nredis.publish(config.PLAYER_CHANNEL, json.dumps(event))\nreturn http.Created(event)", "event = {'event': 'resume'}\nredis.publish(config.PLAYER_CHANNEL, json.dumps(event))\nreturn http.OK(event)" ]
<|body_start_0|> event = {'event': 'pause'} redis.publish(config.PLAYER_CHANNEL, json.dumps(event)) return http.Created(event) <|end_body_0|> <|body_start_1|> event = {'event': 'resume'} redis.publish(config.PLAYER_CHANNEL, json.dumps(event)) return http.OK(event) <|end_...
The pause resources allows the payer to paused and unpaused via POST for pause and DELTETE to unpause the player.
PauseView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PauseView: """The pause resources allows the payer to paused and unpaused via POST for pause and DELTETE to unpause the player.""" def post(self): """Pauses the player.""" <|body_0|> def delete(self): """Unapuses the player.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_024859
12,943
no_license
[ { "docstring": "Pauses the player.", "name": "post", "signature": "def post(self)" }, { "docstring": "Unapuses the player.", "name": "delete", "signature": "def delete(self)" } ]
2
stack_v2_sparse_classes_30k_train_003405
Implement the Python class `PauseView` described below. Class description: The pause resources allows the payer to paused and unpaused via POST for pause and DELTETE to unpause the player. Method signatures and docstrings: - def post(self): Pauses the player. - def delete(self): Unapuses the player.
Implement the Python class `PauseView` described below. Class description: The pause resources allows the payer to paused and unpaused via POST for pause and DELTETE to unpause the player. Method signatures and docstrings: - def post(self): Pauses the player. - def delete(self): Unapuses the player. <|skeleton|> cla...
817766c6d2e2660291b723274d345ce5eb40ab77
<|skeleton|> class PauseView: """The pause resources allows the payer to paused and unpaused via POST for pause and DELTETE to unpause the player.""" def post(self): """Pauses the player.""" <|body_0|> def delete(self): """Unapuses the player.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PauseView: """The pause resources allows the payer to paused and unpaused via POST for pause and DELTETE to unpause the player.""" def post(self): """Pauses the player.""" event = {'event': 'pause'} redis.publish(config.PLAYER_CHANNEL, json.dumps(event)) return http.Create...
the_stack_v2_python_sparse
fm/views/player.py
thisissoon/FM-API
train
3
8f8df6a5d0f59e6f22f400809bd4bf2087368e4a
[ "self.image_list = image_list\nself.base_num = base_num\nself.pxpys = pxpys\nself.bss = bss\nself.scale = scale\nself.shift = shift\nself.method = method\nself.fit = Fitting(fit_method=fit_method, shift=self.shift, fit_range=self.scale).fit()\nself.one_point_calculation = self.with_eec if eec else self.without_eec\...
<|body_start_0|> self.image_list = image_list self.base_num = base_num self.pxpys = pxpys self.bss = bss self.scale = scale self.shift = shift self.method = method self.fit = Fitting(fit_method=fit_method, shift=self.shift, fit_range=self.scale).fit() ...
変位計測用クラス
Displacement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Displacement: """変位計測用クラス""" def __init__(self, image_list, base_num, pxpys, bss, scale, shift, fit_method='para', eec=True, method='abs'): """:param image_list: 画像のファイルパスリスト :param base_num: 基準フレームの番号 :param pxpys: 計測点の座標 :param bss: ブロックサイズ :param scale: 画像拡大率 :param shift: 探索範囲 :p...
stack_v2_sparse_classes_36k_train_024860
16,682
no_license
[ { "docstring": ":param image_list: 画像のファイルパスリスト :param base_num: 基準フレームの番号 :param pxpys: 計測点の座標 :param bss: ブロックサイズ :param scale: 画像拡大率 :param shift: 探索範囲 :param fit_method: フィッティング手法 :param eec: Estimate Error Cancellation :param method: 基準フレームからの絶対変位 or 前後フレームでの相対変位", "name": "__init__", "signature": ...
6
stack_v2_sparse_classes_30k_train_011415
Implement the Python class `Displacement` described below. Class description: 変位計測用クラス Method signatures and docstrings: - def __init__(self, image_list, base_num, pxpys, bss, scale, shift, fit_method='para', eec=True, method='abs'): :param image_list: 画像のファイルパスリスト :param base_num: 基準フレームの番号 :param pxpys: 計測点の座標 :par...
Implement the Python class `Displacement` described below. Class description: 変位計測用クラス Method signatures and docstrings: - def __init__(self, image_list, base_num, pxpys, bss, scale, shift, fit_method='para', eec=True, method='abs'): :param image_list: 画像のファイルパスリスト :param base_num: 基準フレームの番号 :param pxpys: 計測点の座標 :par...
dd0b0f1310c7a3eb5a5a589bb86d24486cbb37b1
<|skeleton|> class Displacement: """変位計測用クラス""" def __init__(self, image_list, base_num, pxpys, bss, scale, shift, fit_method='para', eec=True, method='abs'): """:param image_list: 画像のファイルパスリスト :param base_num: 基準フレームの番号 :param pxpys: 計測点の座標 :param bss: ブロックサイズ :param scale: 画像拡大率 :param shift: 探索範囲 :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Displacement: """変位計測用クラス""" def __init__(self, image_list, base_num, pxpys, bss, scale, shift, fit_method='para', eec=True, method='abs'): """:param image_list: 画像のファイルパスリスト :param base_num: 基準フレームの番号 :param pxpys: 計測点の座標 :param bss: ブロックサイズ :param scale: 画像拡大率 :param shift: 探索範囲 :param fit_meth...
the_stack_v2_python_sparse
my_utils/displacement/displacement.py
salem7mg/test4
train
0
544c7f2f4c4324c4d7cd7529fa85c984d79a8087
[ "assert type_constraint in IMMUTABLE_TYPES or issubclass(type_constraint, tuple) or issubclass(type_constraint, frozenset) or issubclass(type_constraint, HotProperty)\nself.type_constraint = type_constraint\nsuper(TypedHotList, self).__init__(init_iterable, name, container)", "if not isinstance(val, self.type_con...
<|body_start_0|> assert type_constraint in IMMUTABLE_TYPES or issubclass(type_constraint, tuple) or issubclass(type_constraint, frozenset) or issubclass(type_constraint, HotProperty) self.type_constraint = type_constraint super(TypedHotList, self).__init__(init_iterable, name, container) <|end_b...
TypedHotList is a HotList variant that can restrict it's items to the provided type.
TypedHotList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypedHotList: """TypedHotList is a HotList variant that can restrict it's items to the provided type.""" def __init__(self, type_constraint, init_iterable=None, name=None, container=None): """Initializes the structure, sets the type all items in the list must be.""" <|body_0|...
stack_v2_sparse_classes_36k_train_024861
13,089
permissive
[ { "docstring": "Initializes the structure, sets the type all items in the list must be.", "name": "__init__", "signature": "def __init__(self, type_constraint, init_iterable=None, name=None, container=None)" }, { "docstring": "The members may only be self.type_constraint. If the type_constraint ...
3
stack_v2_sparse_classes_30k_train_009404
Implement the Python class `TypedHotList` described below. Class description: TypedHotList is a HotList variant that can restrict it's items to the provided type. Method signatures and docstrings: - def __init__(self, type_constraint, init_iterable=None, name=None, container=None): Initializes the structure, sets the...
Implement the Python class `TypedHotList` described below. Class description: TypedHotList is a HotList variant that can restrict it's items to the provided type. Method signatures and docstrings: - def __init__(self, type_constraint, init_iterable=None, name=None, container=None): Initializes the structure, sets the...
9ce498d7dbfe285b2da4b6a8d62582ff0fb19239
<|skeleton|> class TypedHotList: """TypedHotList is a HotList variant that can restrict it's items to the provided type.""" def __init__(self, type_constraint, init_iterable=None, name=None, container=None): """Initializes the structure, sets the type all items in the list must be.""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypedHotList: """TypedHotList is a HotList variant that can restrict it's items to the provided type.""" def __init__(self, type_constraint, init_iterable=None, name=None, container=None): """Initializes the structure, sets the type all items in the list must be.""" assert type_constraint...
the_stack_v2_python_sparse
step07/hotmodel.py
petrblahos/modellerkit
train
0
f66b2142b0fb6f5c09c3e93ca56f50a5aaaac896
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('esaracin', 'esaracin')\ndataset = repo['esaracin.police_stats'].find()\ndf_police = pd.DataFrame(list(dataset))\ndataset = repo['esaracin.shootings_per_district'].find()\ndf_shootings = pd.DataFrame(list...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('esaracin', 'esaracin') dataset = repo['esaracin.police_stats'].find() df_police = pd.DataFrame(list(dataset)) dataset = repo['esaracin.sho...
join_sets
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class join_sets: def execute(trial=False): """Retrieves our data sets from Boston Open Data using specific URLs. Creates the necessary pymongo collections within our repo database.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): "...
stack_v2_sparse_classes_36k_train_024862
4,712
no_license
[ { "docstring": "Retrieves our data sets from Boston Open Data using specific URLs. Creates the necessary pymongo collections within our repo database.", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Creates the provenance document describing the merging of data oc...
2
null
Implement the Python class `join_sets` described below. Class description: Implement the join_sets class. Method signatures and docstrings: - def execute(trial=False): Retrieves our data sets from Boston Open Data using specific URLs. Creates the necessary pymongo collections within our repo database. - def provenanc...
Implement the Python class `join_sets` described below. Class description: Implement the join_sets class. Method signatures and docstrings: - def execute(trial=False): Retrieves our data sets from Boston Open Data using specific URLs. Creates the necessary pymongo collections within our repo database. - def provenanc...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class join_sets: def execute(trial=False): """Retrieves our data sets from Boston Open Data using specific URLs. Creates the necessary pymongo collections within our repo database.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class join_sets: def execute(trial=False): """Retrieves our data sets from Boston Open Data using specific URLs. Creates the necessary pymongo collections within our repo database.""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo re...
the_stack_v2_python_sparse
esaracin/join_sets.py
ROODAY/course-2017-fal-proj
train
3
423ff6637d2582044954e05a803d818d36f4e1f2
[ "KratosMultiphysics.Process.__init__(self)\ndefault_settings = KratosMultiphysics.Parameters('\\n {\\n \"help\" : \"This process helps to measure the time consumed on the simulations\",\\n \"output_filename\" : \"\",\\n \"print_interval_inform...
<|body_start_0|> KratosMultiphysics.Process.__init__(self) default_settings = KratosMultiphysics.Parameters('\n {\n "help" : "This process helps to measure the time consumed on the simulations",\n "output_filename" : "",\n "print_i...
This process helps to measure the time consumed on the simulations Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.
TimerProcess
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimerProcess: """This process helps to measure the time consumed on the simulations Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.""" d...
stack_v2_sparse_classes_36k_train_024863
2,747
permissive
[ { "docstring": "The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.", "name": "__init__", "signature": "def __init__(self, Model, settings)" }...
2
null
Implement the Python class `TimerProcess` described below. Class description: This process helps to measure the time consumed on the simulations Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameter...
Implement the Python class `TimerProcess` described below. Class description: This process helps to measure the time consumed on the simulations Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameter...
366949ec4e3651702edc6ac3061d2988f10dd271
<|skeleton|> class TimerProcess: """This process helps to measure the time consumed on the simulations Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.""" d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimerProcess: """This process helps to measure the time consumed on the simulations Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.""" def __init__(s...
the_stack_v2_python_sparse
kratos/python_scripts/timer_process.py
KratosMultiphysics/Kratos
train
994
6ecf34203786a82cdb3426efc7f51ca34580021e
[ "with transaction.atomic():\n event = CampusEvent.objects.select_for_update().get(id=enrollment_data['campus_event'].id)\n if now() > event.deadline:\n raise BadRequest('报名时间已过')\n if event.num_enrolled >= event.num_participants:\n raise BadRequest('报名人数已满')\n enrollment = Enrollment.objec...
<|body_start_0|> with transaction.atomic(): event = CampusEvent.objects.select_for_update().get(id=enrollment_data['campus_event'].id) if now() > event.deadline: raise BadRequest('报名时间已过') if event.num_enrolled >= event.num_participants: raise ...
Provide services for Enrollment.
EnrollmentService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnrollmentService: """Provide services for Enrollment.""" def create_enrollment(enrollment_data): """Create a enrollment for specific campus event. This action is atomic, will fail if there are no more heads counts for the campus event or duplicated enrollments are created. Parametse...
stack_v2_sparse_classes_36k_train_024864
8,615
no_license
[ { "docstring": "Create a enrollment for specific campus event. This action is atomic, will fail if there are no more heads counts for the campus event or duplicated enrollments are created. Parametsers ---------- enrollment_data: dict This dict should have full information needed to create an Enrollment. Return...
5
null
Implement the Python class `EnrollmentService` described below. Class description: Provide services for Enrollment. Method signatures and docstrings: - def create_enrollment(enrollment_data): Create a enrollment for specific campus event. This action is atomic, will fail if there are no more heads counts for the camp...
Implement the Python class `EnrollmentService` described below. Class description: Provide services for Enrollment. Method signatures and docstrings: - def create_enrollment(enrollment_data): Create a enrollment for specific campus event. This action is atomic, will fail if there are no more heads counts for the camp...
48cccddbe8347167cb6120a1cd7d61f9fc57cc7c
<|skeleton|> class EnrollmentService: """Provide services for Enrollment.""" def create_enrollment(enrollment_data): """Create a enrollment for specific campus event. This action is atomic, will fail if there are no more heads counts for the campus event or duplicated enrollments are created. Parametse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnrollmentService: """Provide services for Enrollment.""" def create_enrollment(enrollment_data): """Create a enrollment for specific campus event. This action is atomic, will fail if there are no more heads counts for the campus event or duplicated enrollments are created. Parametsers ----------...
the_stack_v2_python_sparse
training_event/services.py
DLUT-SIE/TMSFTT-BE
train
1
7bdbb0b966df4d0c3866846794f01389896f44fd
[ "if not root:\n return []\nif root.val == val:\n return root\nif root.val > val:\n root = root.left\n return self.searchBST(root, val)\nelse:\n root = root.right\n return self.searchBST(root, val)", "if not root:\n return []\nwhile root:\n if root.val == val:\n return root\n if v...
<|body_start_0|> if not root: return [] if root.val == val: return root if root.val > val: root = root.left return self.searchBST(root, val) else: root = root.right return self.searchBST(root, val) <|end_body_0|> <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_0|> def searchBST2(self, root, val): """不使用递归方法""" <|body_1|> def sortedArrayToBST(self, nums): """Given an array where elements are sorte...
stack_v2_sparse_classes_36k_train_024865
2,674
no_license
[ { "docstring": ":type root: TreeNode :type val: int :rtype: TreeNode", "name": "searchBST", "signature": "def searchBST(self, root, val)" }, { "docstring": "不使用递归方法", "name": "searchBST2", "signature": "def searchBST2(self, root, val)" }, { "docstring": "Given an array where elem...
5
stack_v2_sparse_classes_30k_val_000176
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchBST(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode - def searchBST2(self, root, val): 不使用递归方法 - def sortedArrayToBST(self, nums): Given an array...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchBST(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode - def searchBST2(self, root, val): 不使用递归方法 - def sortedArrayToBST(self, nums): Given an array...
11ad9d3841de09c0b4dc3a667e7e63c3558656a5
<|skeleton|> class Solution: def searchBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_0|> def searchBST2(self, root, val): """不使用递归方法""" <|body_1|> def sortedArrayToBST(self, nums): """Given an array where elements are sorte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchBST(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" if not root: return [] if root.val == val: return root if root.val > val: root = root.left return self.searchBST(root, val) ...
the_stack_v2_python_sparse
binary_search_tree.py
ganlanshu/leetcode
train
0
790e1bc996d03b7d6f4aeee8cb1f4bb932117324
[ "self.total_commission = 0.0\nfor data in self:\n if data.commission == True:\n if data.commission_type == 'fixed':\n data.total_commission = data.total_rent * (data.fix_qty / 100.0)\n if data.commission_type == 'fixedcost':\n data.total_commission = data.fix_cost", "for dat...
<|body_start_0|> self.total_commission = 0.0 for data in self: if data.commission == True: if data.commission_type == 'fixed': data.total_commission = data.total_rent * (data.fix_qty / 100.0) if data.commission_type == 'fixedcost': ...
AccountAnalyticAccount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountAnalyticAccount: def calculate_commission(self): """This method is used to calculate commistion as per commition type ----------------------------------------------------------------- @param self: The object pointer""" <|body_0|> def create_commission(self): "...
stack_v2_sparse_classes_36k_train_024866
11,342
no_license
[ { "docstring": "This method is used to calculate commistion as per commition type ----------------------------------------------------------------- @param self: The object pointer", "name": "calculate_commission", "signature": "def calculate_commission(self)" }, { "docstring": "This button metho...
3
stack_v2_sparse_classes_30k_train_004922
Implement the Python class `AccountAnalyticAccount` described below. Class description: Implement the AccountAnalyticAccount class. Method signatures and docstrings: - def calculate_commission(self): This method is used to calculate commistion as per commition type ----------------------------------------------------...
Implement the Python class `AccountAnalyticAccount` described below. Class description: Implement the AccountAnalyticAccount class. Method signatures and docstrings: - def calculate_commission(self): This method is used to calculate commistion as per commition type ----------------------------------------------------...
163136f382faa8607db8fb6cda42a5ba07c4076b
<|skeleton|> class AccountAnalyticAccount: def calculate_commission(self): """This method is used to calculate commistion as per commition type ----------------------------------------------------------------- @param self: The object pointer""" <|body_0|> def create_commission(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountAnalyticAccount: def calculate_commission(self): """This method is used to calculate commistion as per commition type ----------------------------------------------------------------- @param self: The object pointer""" self.total_commission = 0.0 for data in self: if...
the_stack_v2_python_sparse
property_commission_ee/models/property_commission.py
maarejsys/Roya
train
0
6e309daafaf2a964a525db9539edfc6c65e3aebb
[ "paper = NewsPaper(name=self.TEST_PAPER)\npaper.save()\nitem1 = TownnewsSite(URL=self.TEST_URL, name=self.TEST_NAME, paper=paper)\nitem1.full_clean()\nitem1.save()\nreadback = TownnewsSite.objects.get(URL=self.TEST_URL)\nself.assertIsNotNone(readback)\nself.assertEqual(readback.URL, self.TEST_URL)\nself.assertEqual...
<|body_start_0|> paper = NewsPaper(name=self.TEST_PAPER) paper.save() item1 = TownnewsSite(URL=self.TEST_URL, name=self.TEST_NAME, paper=paper) item1.full_clean() item1.save() readback = TownnewsSite.objects.get(URL=self.TEST_URL) self.assertIsNotNone(readback) ...
Unit tests for class :py:class:`~papers.models.TownnewsSite`.
TownnewsSiteTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TownnewsSiteTestCase: """Unit tests for class :py:class:`~papers.models.TownnewsSite`.""" def test_create(self): """Unit test for :py:meth:`papers.models.TownnewsSite`.""" <|body_0|> def test_domain(self): """Unit test for :py:prop:`~papers.models.TownnewsSite.do...
stack_v2_sparse_classes_36k_train_024867
4,217
no_license
[ { "docstring": "Unit test for :py:meth:`papers.models.TownnewsSite`.", "name": "test_create", "signature": "def test_create(self)" }, { "docstring": "Unit test for :py:prop:`~papers.models.TownnewsSite.domain`.", "name": "test_domain", "signature": "def test_domain(self)" }, { "d...
3
null
Implement the Python class `TownnewsSiteTestCase` described below. Class description: Unit tests for class :py:class:`~papers.models.TownnewsSite`. Method signatures and docstrings: - def test_create(self): Unit test for :py:meth:`papers.models.TownnewsSite`. - def test_domain(self): Unit test for :py:prop:`~papers.m...
Implement the Python class `TownnewsSiteTestCase` described below. Class description: Unit tests for class :py:class:`~papers.models.TownnewsSite`. Method signatures and docstrings: - def test_create(self): Unit test for :py:meth:`papers.models.TownnewsSite`. - def test_domain(self): Unit test for :py:prop:`~papers.m...
cd4238a0c27bfc5a4f487d68e6c756035e053203
<|skeleton|> class TownnewsSiteTestCase: """Unit tests for class :py:class:`~papers.models.TownnewsSite`.""" def test_create(self): """Unit test for :py:meth:`papers.models.TownnewsSite`.""" <|body_0|> def test_domain(self): """Unit test for :py:prop:`~papers.models.TownnewsSite.do...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TownnewsSiteTestCase: """Unit tests for class :py:class:`~papers.models.TownnewsSite`.""" def test_create(self): """Unit test for :py:meth:`papers.models.TownnewsSite`.""" paper = NewsPaper(name=self.TEST_PAPER) paper.save() item1 = TownnewsSite(URL=self.TEST_URL, name=sel...
the_stack_v2_python_sparse
papers/test_models.py
alflanagan/utl_lookup
train
0
8886a8e4984818da3abc78cad38b6372ef904544
[ "logger.info('Downloading DrugBank source data...')\nr = requests.get('https://go.drugbank.com/release_notes')\nif r.status_code == 200:\n soup = bs4.BeautifulSoup(r.content, features='lxml')\nelse:\n logger.error(f'DrugBank version fetch failed with status code: {r.status_code}')\n raise DownloadException...
<|body_start_0|> logger.info('Downloading DrugBank source data...') r = requests.get('https://go.drugbank.com/release_notes') if r.status_code == 200: soup = bs4.BeautifulSoup(r.content, features='lxml') else: logger.error(f'DrugBank version fetch failed with stat...
ETL the DrugBank source into therapy.db.
DrugBank
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DrugBank: """ETL the DrugBank source into therapy.db.""" def _download_data(self): """Download DrugBank source data.""" <|body_0|> def _load_meta(self): """Add DrugBank metadata.""" <|body_1|> def _transform_data(self): """Transform the DrugB...
stack_v2_sparse_classes_36k_train_024868
4,287
no_license
[ { "docstring": "Download DrugBank source data.", "name": "_download_data", "signature": "def _download_data(self)" }, { "docstring": "Add DrugBank metadata.", "name": "_load_meta", "signature": "def _load_meta(self)" }, { "docstring": "Transform the DrugBank source.", "name":...
3
stack_v2_sparse_classes_30k_val_000574
Implement the Python class `DrugBank` described below. Class description: ETL the DrugBank source into therapy.db. Method signatures and docstrings: - def _download_data(self): Download DrugBank source data. - def _load_meta(self): Add DrugBank metadata. - def _transform_data(self): Transform the DrugBank source.
Implement the Python class `DrugBank` described below. Class description: ETL the DrugBank source into therapy.db. Method signatures and docstrings: - def _download_data(self): Download DrugBank source data. - def _load_meta(self): Add DrugBank metadata. - def _transform_data(self): Transform the DrugBank source. <|...
f05062773dea519fdc0ce58cac9f7dc72d01ec56
<|skeleton|> class DrugBank: """ETL the DrugBank source into therapy.db.""" def _download_data(self): """Download DrugBank source data.""" <|body_0|> def _load_meta(self): """Add DrugBank metadata.""" <|body_1|> def _transform_data(self): """Transform the DrugB...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DrugBank: """ETL the DrugBank source into therapy.db.""" def _download_data(self): """Download DrugBank source data.""" logger.info('Downloading DrugBank source data...') r = requests.get('https://go.drugbank.com/release_notes') if r.status_code == 200: soup = ...
the_stack_v2_python_sparse
therapy/etl/drugbank.py
richardhj/therapy-normalization
train
0
a232274be705e3cfa03016d853a3c6eb22b30968
[ "if not spectator_apps.is_enabled('reading'):\n raise ImproperlyConfigured(\"To use the CreatorManager.by_publications() method, 'spectator.reading' must by in INSTALLED_APPS.\")\nqs = self.get_queryset()\nqs = qs.exclude(publications__reading__isnull=True).exclude(publications__reading__is_finished=False).annot...
<|body_start_0|> if not spectator_apps.is_enabled('reading'): raise ImproperlyConfigured("To use the CreatorManager.by_publications() method, 'spectator.reading' must by in INSTALLED_APPS.") qs = self.get_queryset() qs = qs.exclude(publications__reading__isnull=True).exclude(publicat...
CreatorManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreatorManager: def by_publications(self): """The Creators who have been most-read, ordered by number of read publications (ignoring if any of those publicatinos have been read multiple times.) Each Creator will have a `num_publications` attribute.""" <|body_0|> def by_readi...
stack_v2_sparse_classes_36k_train_024869
4,128
permissive
[ { "docstring": "The Creators who have been most-read, ordered by number of read publications (ignoring if any of those publicatinos have been read multiple times.) Each Creator will have a `num_publications` attribute.", "name": "by_publications", "signature": "def by_publications(self)" }, { "d...
4
stack_v2_sparse_classes_30k_train_005942
Implement the Python class `CreatorManager` described below. Class description: Implement the CreatorManager class. Method signatures and docstrings: - def by_publications(self): The Creators who have been most-read, ordered by number of read publications (ignoring if any of those publicatinos have been read multiple...
Implement the Python class `CreatorManager` described below. Class description: Implement the CreatorManager class. Method signatures and docstrings: - def by_publications(self): The Creators who have been most-read, ordered by number of read publications (ignoring if any of those publicatinos have been read multiple...
2d89dcdb624b01452a5b6ca0ee092774fcc0aa52
<|skeleton|> class CreatorManager: def by_publications(self): """The Creators who have been most-read, ordered by number of read publications (ignoring if any of those publicatinos have been read multiple times.) Each Creator will have a `num_publications` attribute.""" <|body_0|> def by_readi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreatorManager: def by_publications(self): """The Creators who have been most-read, ordered by number of read publications (ignoring if any of those publicatinos have been read multiple times.) Each Creator will have a `num_publications` attribute.""" if not spectator_apps.is_enabled('reading'...
the_stack_v2_python_sparse
spectator/core/managers.py
philgyford/django-spectator
train
45
367d3c25983cd2edb62cf274faa55796a342a6ed
[ "m, n = (len(heights), len(heights[0]))\npos = [(0, 1), (0, -1), (1, 0), (-1, 0)]\n\ndef dfs(x, y):\n if (x, y) in memo:\n return memo[x, y]\n visited.add((x, y))\n ans = 0\n if x == 0 or y == 0:\n ans |= 2\n if x == m - 1 or y == n - 1:\n ans |= 1\n print(x, y, ans)\n for ...
<|body_start_0|> m, n = (len(heights), len(heights[0])) pos = [(0, 1), (0, -1), (1, 0), (-1, 0)] def dfs(x, y): if (x, y) in memo: return memo[x, y] visited.add((x, y)) ans = 0 if x == 0 or y == 0: ans |= 2 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: """思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:""" <|bo...
stack_v2_sparse_classes_36k_train_024870
3,937
no_license
[ { "docstring": "思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:", "name": "pacificAtlantic", "signature": "def pacificAtlantic(self, heights: List[List[int]]) -> Li...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: 思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: 思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: """思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pacificAtlantic(self, heights: List[List[int]]) -> List[List[int]]: """思路:顺流而下 1. 从大陆开始流向太平洋和大西洋,通过两位二进制记录最终流向,如果能流向太平洋,ans |=2,如果能流向大西洋,ans |=1 1. 00:都不能流入 2. 01:能流向大西洋 3. 10:能流向太平洋 4. 11:能流向太平洋和大西洋 2. 当某个点对应的ans=3时,说明既能流向太平洋也能流向大西洋 @param heights: @return:""" m, n = (len(height...
the_stack_v2_python_sparse
LeetCode/深度优先搜索(dfs)/岛屿问题/417. 太平洋大西洋水流问题.py
yiming1012/MyLeetCode
train
2
da02f35c07e6566291951aa312cd7c96632a59d6
[ "end_date = dateutil.get_today()\nstart_date = dateutil.get_previous_date(end_date, 6)\nc = RequestContext(request, {'first_nav_name': FIRST_NAV, 'app_name': 'stats', 'second_navs': export.get_stats_second_navs(request), 'second_nav_name': export.STATS_SALES_SECOND_NAV, 'third_nav_name': export.PRODUCT_SUMMARY_NAV,...
<|body_start_0|> end_date = dateutil.get_today() start_date = dateutil.get_previous_date(end_date, 6) c = RequestContext(request, {'first_nav_name': FIRST_NAV, 'app_name': 'stats', 'second_navs': export.get_stats_second_navs(request), 'second_nav_name': export.STATS_SALES_SECOND_NAV, 'third_nav_...
商品概况
ProductSummary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductSummary: """商品概况""" def get(request): """显示商品概况页面""" <|body_0|> def api_get(request): """商品概况数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> end_date = dateutil.get_today() start_date = dateutil.get_previous_date(end_date, 6) ...
stack_v2_sparse_classes_36k_train_024871
3,724
no_license
[ { "docstring": "显示商品概况页面", "name": "get", "signature": "def get(request)" }, { "docstring": "商品概况数据", "name": "api_get", "signature": "def api_get(request)" } ]
2
stack_v2_sparse_classes_30k_train_010972
Implement the Python class `ProductSummary` described below. Class description: 商品概况 Method signatures and docstrings: - def get(request): 显示商品概况页面 - def api_get(request): 商品概况数据
Implement the Python class `ProductSummary` described below. Class description: 商品概况 Method signatures and docstrings: - def get(request): 显示商品概况页面 - def api_get(request): 商品概况数据 <|skeleton|> class ProductSummary: """商品概况""" def get(request): """显示商品概况页面""" <|body_0|> def api_get(reques...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class ProductSummary: """商品概况""" def get(request): """显示商品概况页面""" <|body_0|> def api_get(request): """商品概况数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductSummary: """商品概况""" def get(request): """显示商品概况页面""" end_date = dateutil.get_today() start_date = dateutil.get_previous_date(end_date, 6) c = RequestContext(request, {'first_nav_name': FIRST_NAV, 'app_name': 'stats', 'second_navs': export.get_stats_second_navs(reque...
the_stack_v2_python_sparse
weapp/stats/sales/product_summary.py
chengdg/weizoom
train
1
3c087209d3808e433195f59f70d42a5253f8552a
[ "f = f'{self.site_id}:{self.staff_id}:'\nf += f'{quote(self.organ)}:{self.group_number}:{self.sort_order}:'\nf += f'{quote(self.member_types)}:{quote(self.role)}'\nreturn URIRef(_site_group_prefix + f)", "subject = self.uriref()\ngraph.add((subject, rdflib.RDF.type, _site_type_uri))\ngraph.add((subject, _site_ref...
<|body_start_0|> f = f'{self.site_id}:{self.staff_id}:' f += f'{quote(self.organ)}:{self.group_number}:{self.sort_order}:' f += f'{quote(self.member_types)}:{quote(self.role)}' return URIRef(_site_group_prefix + f) <|end_body_0|> <|body_start_1|> subject = self.uriref() ...
Attributes of a site that's a member of organizational group.
_Site
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Site: """Attributes of a site that's a member of organizational group.""" def uriref(self): """Return this site's subject URI.""" <|body_0|> def add_to_graph(self, graph): """Describe this site in the given ``graph``.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_024872
6,009
permissive
[ { "docstring": "Return this site's subject URI.", "name": "uriref", "signature": "def uriref(self)" }, { "docstring": "Describe this site in the given ``graph``.", "name": "add_to_graph", "signature": "def add_to_graph(self, graph)" } ]
2
stack_v2_sparse_classes_30k_train_017382
Implement the Python class `_Site` described below. Class description: Attributes of a site that's a member of organizational group. Method signatures and docstrings: - def uriref(self): Return this site's subject URI. - def add_to_graph(self, graph): Describe this site in the given ``graph``.
Implement the Python class `_Site` described below. Class description: Attributes of a site that's a member of organizational group. Method signatures and docstrings: - def uriref(self): Return this site's subject URI. - def add_to_graph(self, graph): Describe this site in the given ``graph``. <|skeleton|> class _Si...
377d12260ca611a8950edc1b7bfe0bdb3d53c021
<|skeleton|> class _Site: """Attributes of a site that's a member of organizational group.""" def uriref(self): """Return this site's subject URI.""" <|body_0|> def add_to_graph(self, graph): """Describe this site in the given ``graph``.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Site: """Attributes of a site that's a member of organizational group.""" def uriref(self): """Return this site's subject URI.""" f = f'{self.site_id}:{self.staff_id}:' f += f'{quote(self.organ)}:{self.group_number}:{self.sort_order}:' f += f'{quote(self.member_types)}:{q...
the_stack_v2_python_sparse
src/edrn.rdf/edrn/rdf/membergrouprdfgenerator.py
EDRN/CancerDataExpo
train
0
8dd9222d489bc796c6a79ecb5a6bdf58a5710466
[ "dp = [[0, 0] for i in range(len(nums))]\nres = dp[0][0] = dp[0][1] = nums[0]\nfor i in range(1, len(nums)):\n dp[i][0] = max(dp[i - 1][0] * nums[i], dp[i - 1][1] * nums[i], nums[i])\n dp[i][1] = min(dp[i - 1][1] * nums[i], dp[i - 1][0] * nums[i], nums[i])\n res = max(dp[i][0], res)\nreturn res", "dp = [...
<|body_start_0|> dp = [[0, 0] for i in range(len(nums))] res = dp[0][0] = dp[0][1] = nums[0] for i in range(1, len(nums)): dp[i][0] = max(dp[i - 1][0] * nums[i], dp[i - 1][1] * nums[i], nums[i]) dp[i][1] = min(dp[i - 1][1] * nums[i], dp[i - 1][0] * nums[i], nums[i]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, nums: List[int]) -> int: """推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[i]) dp[i][1] = min(dp[i-1][1]*a[i], dp[i-1][0]*a[i]) 0代表着最大值 1代表着最小值,负负得正。""" <|body_0|> def maxProduct2(self, nums: List[int]) -> int: """推导公式: dp[i][0] = m...
stack_v2_sparse_classes_36k_train_024873
2,309
no_license
[ { "docstring": "推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[i]) dp[i][1] = min(dp[i-1][1]*a[i], dp[i-1][0]*a[i]) 0代表着最大值 1代表着最小值,负负得正。", "name": "maxProduct", "signature": "def maxProduct(self, nums: List[int]) -> int" }, { "docstring": "推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums: List[int]) -> int: 推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[i]) dp[i][1] = min(dp[i-1][1]*a[i], dp[i-1][0]*a[i]) 0代表着最大值 1代表着最小值,负负得正。 - def ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, nums: List[int]) -> int: 推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[i]) dp[i][1] = min(dp[i-1][1]*a[i], dp[i-1][0]*a[i]) 0代表着最大值 1代表着最小值,负负得正。 - def ...
c0dd577481b46129d950354d567d332a4d091137
<|skeleton|> class Solution: def maxProduct(self, nums: List[int]) -> int: """推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[i]) dp[i][1] = min(dp[i-1][1]*a[i], dp[i-1][0]*a[i]) 0代表着最大值 1代表着最小值,负负得正。""" <|body_0|> def maxProduct2(self, nums: List[int]) -> int: """推导公式: dp[i][0] = m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProduct(self, nums: List[int]) -> int: """推导公式: dp[i][0] = max(dp[i-1][0]*a[i], dp[i-1][1]*a[i]) dp[i][1] = min(dp[i-1][1]*a[i], dp[i-1][0]*a[i]) 0代表着最大值 1代表着最小值,负负得正。""" dp = [[0, 0] for i in range(len(nums))] res = dp[0][0] = dp[0][1] = nums[0] for i in range...
the_stack_v2_python_sparse
leetcode/152_乘积最大子序列.py
tenqaz/crazy_arithmetic
train
0
fbd7a6a0a7cb8b31348ab41c375ec0098f7a6aff
[ "super(CtrTrainerCallback, self).__init__()\nself.best_score = 0\nlogging.info('init autogate s1 trainer callback')", "self.model = self.trainer.model\nfeature_interaction_score = self.model.get_feature_interaction_score()\nprint('get feature_interaction_score', feature_interaction_score)\ncurr_auc = float(self.t...
<|body_start_0|> super(CtrTrainerCallback, self).__init__() self.best_score = 0 logging.info('init autogate s1 trainer callback') <|end_body_0|> <|body_start_1|> self.model = self.trainer.model feature_interaction_score = self.model.get_feature_interaction_score() print(...
AutoGateS1TrainerCallback module.
AutoGateS1TrainerCallback
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoGateS1TrainerCallback: """AutoGateS1TrainerCallback module.""" def __init__(self): """Construct AutoGateS1TrainerCallback class.""" <|body_0|> def after_valid(self, logs=None): """Call after_valid of the managed callbacks.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_024874
1,993
permissive
[ { "docstring": "Construct AutoGateS1TrainerCallback class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Call after_valid of the managed callbacks.", "name": "after_valid", "signature": "def after_valid(self, logs=None)" } ]
2
null
Implement the Python class `AutoGateS1TrainerCallback` described below. Class description: AutoGateS1TrainerCallback module. Method signatures and docstrings: - def __init__(self): Construct AutoGateS1TrainerCallback class. - def after_valid(self, logs=None): Call after_valid of the managed callbacks.
Implement the Python class `AutoGateS1TrainerCallback` described below. Class description: AutoGateS1TrainerCallback module. Method signatures and docstrings: - def __init__(self): Construct AutoGateS1TrainerCallback class. - def after_valid(self, logs=None): Call after_valid of the managed callbacks. <|skeleton|> c...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class AutoGateS1TrainerCallback: """AutoGateS1TrainerCallback module.""" def __init__(self): """Construct AutoGateS1TrainerCallback class.""" <|body_0|> def after_valid(self, logs=None): """Call after_valid of the managed callbacks.""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoGateS1TrainerCallback: """AutoGateS1TrainerCallback module.""" def __init__(self): """Construct AutoGateS1TrainerCallback class.""" super(CtrTrainerCallback, self).__init__() self.best_score = 0 logging.info('init autogate s1 trainer callback') def after_valid(sel...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/algorithms/nas/fis/autogate_s1_trainer_callback.py
Huawei-Ascend/modelzoo
train
1
2d3ecb0ff5225c6a9f4153632e2c4e547f80d374
[ "self.physics_controller = physics_controller\nself.physics_controller.add_device_gyro_channel('navxmxp_spi_4_angle')\nbumper_width = 3.25 * units.inch\nrobot_wheelbase = 22 * units.inch\nrobot_width = 23 * units.inch + bumper_width * 2\nrobot_length = 32 * units.inch + bumper_width * 2\nwheel_diameter = 6 * units....
<|body_start_0|> self.physics_controller = physics_controller self.physics_controller.add_device_gyro_channel('navxmxp_spi_4_angle') bumper_width = 3.25 * units.inch robot_wheelbase = 22 * units.inch robot_width = 23 * units.inch + bumper_width * 2 robot_length = 32 * uni...
Simulates a 4-wheel robot using Tank Drive joystick control
PhysicsEngine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhysicsEngine: """Simulates a 4-wheel robot using Tank Drive joystick control""" def __init__(self, physics_controller): """:param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to""" <|body_0|> def update_sim(self, hal_data, no...
stack_v2_sparse_classes_36k_train_024875
2,438
no_license
[ { "docstring": ":param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to", "name": "__init__", "signature": "def __init__(self, physics_controller)" }, { "docstring": "Called when the simulation parameters for the program need to be updated. :param now:...
2
stack_v2_sparse_classes_30k_train_004951
Implement the Python class `PhysicsEngine` described below. Class description: Simulates a 4-wheel robot using Tank Drive joystick control Method signatures and docstrings: - def __init__(self, physics_controller): :param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to - d...
Implement the Python class `PhysicsEngine` described below. Class description: Simulates a 4-wheel robot using Tank Drive joystick control Method signatures and docstrings: - def __init__(self, physics_controller): :param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to - d...
3643bbe895ef1bc44a57c6ddda89b0c0272198cc
<|skeleton|> class PhysicsEngine: """Simulates a 4-wheel robot using Tank Drive joystick control""" def __init__(self, physics_controller): """:param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to""" <|body_0|> def update_sim(self, hal_data, no...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhysicsEngine: """Simulates a 4-wheel robot using Tank Drive joystick control""" def __init__(self, physics_controller): """:param physics_controller: `pyfrc.physics.core.Physics` object to communicate simulation effects to""" self.physics_controller = physics_controller self.phys...
the_stack_v2_python_sparse
physics.py
longhuy322000/FRC7240-18
train
0
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTriggerDistanceToLocation, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._target_location = target_location\nself._actor = actor\nself._distance = distance", "new_status = py_trees.common.Status.RUNNING\nlocation = CarlaDataProvider.get_location(self._actor)\nif...
<|body_start_0|> super(InTriggerDistanceToLocation, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._target_location = target_location self._actor = actor self._distance = distance <|end_body_0|> <|body_start_1|> new_status = py_tre...
This class contains the trigger (condition) for a distance to a fixed location of a scenario Important parameters: - actor: CARLA actor to execute the behavior - target_location: Reference location (carla.location) - name: Name of the condition - distance: Trigger distance between the actor and the target location in m...
InTriggerDistanceToLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTriggerDistanceToLocation: """This class contains the trigger (condition) for a distance to a fixed location of a scenario Important parameters: - actor: CARLA actor to execute the behavior - target_location: Reference location (carla.location) - name: Name of the condition - distance: Trigger ...
stack_v2_sparse_classes_36k_train_024876
18,494
permissive
[ { "docstring": "Setup trigger distance", "name": "__init__", "signature": "def __init__(self, actor, target_location, distance, name='InTriggerDistanceToLocation')" }, { "docstring": "Check if the actor is within trigger distance to the target location", "name": "update", "signature": "d...
2
stack_v2_sparse_classes_30k_train_019808
Implement the Python class `InTriggerDistanceToLocation` described below. Class description: This class contains the trigger (condition) for a distance to a fixed location of a scenario Important parameters: - actor: CARLA actor to execute the behavior - target_location: Reference location (carla.location) - name: Nam...
Implement the Python class `InTriggerDistanceToLocation` described below. Class description: This class contains the trigger (condition) for a distance to a fixed location of a scenario Important parameters: - actor: CARLA actor to execute the behavior - target_location: Reference location (carla.location) - name: Nam...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTriggerDistanceToLocation: """This class contains the trigger (condition) for a distance to a fixed location of a scenario Important parameters: - actor: CARLA actor to execute the behavior - target_location: Reference location (carla.location) - name: Name of the condition - distance: Trigger ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InTriggerDistanceToLocation: """This class contains the trigger (condition) for a distance to a fixed location of a scenario Important parameters: - actor: CARLA actor to execute the behavior - target_location: Reference location (carla.location) - name: Name of the condition - distance: Trigger distance betw...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
2630f86cc508c9dce99b7ec7a60bb6069a93454e
[ "k = k % len(nums)\nself.reverse(nums, len(nums) - 1, 0)\nself.reverse(nums, len(nums) - 1, k)\nself.reverse(nums, k - 1, 0)\nreturn nums\n'\\n length = len(nums)\\n k = k % length\\n nums[:k], nums[k:] = nums[length-k:], nums[:length-k]\\n '", "while r > l:\n temp = nums[r]\n nu...
<|body_start_0|> k = k % len(nums) self.reverse(nums, len(nums) - 1, 0) self.reverse(nums, len(nums) - 1, k) self.reverse(nums, k - 1, 0) return nums '\n length = len(nums)\n k = k % length\n nums[:k], nums[k:] = nums[length-k:], nums[:length-k]\n ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]""" <|body_0|> def reverse(self, nums, r, l): """:type nums: List[int] :type r : int # the rig...
stack_v2_sparse_classes_36k_train_024877
1,084
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]", "name": "rotate", "signature": "def rotate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type r : int # the right cursor of the arra...
2
stack_v2_sparse_classes_30k_train_001420
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4] - def reverse(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4] - def reverse(sel...
a6d0e392134afe19d1aed2dfe7914b674e05ecc6
<|skeleton|> class Solution: def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]""" <|body_0|> def reverse(self, nums, r, l): """:type nums: List[int] :type r : int # the rig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, nums, k): """:type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. [1,2,3,4,5,6,7] [5,6,7,1,2,3,4]""" k = k % len(nums) self.reverse(nums, len(nums) - 1, 0) self.reverse(nums, len(nums) - 1, k) s...
the_stack_v2_python_sparse
189RotateArray.py
Ting007/leetcodePractice
train
0
cfba7d2a7fb7d9469e95be1c5b8923d2196cd939
[ "self.sArr = []\nfor e in nums:\n self.sArr += [e]\nfor i in range(1, len(self.sArr)):\n self.sArr[i] = self.sArr[i] + self.sArr[i - 1]", "if i == 0:\n return self.sArr[j]\nreturn self.sArr[j] - self.sArr[i - 1]" ]
<|body_start_0|> self.sArr = [] for e in nums: self.sArr += [e] for i in range(1, len(self.sArr)): self.sArr[i] = self.sArr[i] + self.sArr[i - 1] <|end_body_0|> <|body_start_1|> if i == 0: return self.sArr[j] return self.sArr[j] - self.sArr[i ...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sArr = [] for e in nums: self.sArr...
stack_v2_sparse_classes_36k_train_024878
681
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
f10c83858967287ffabc4f452aacd681c321b99b
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.sArr = [] for e in nums: self.sArr += [e] for i in range(1, len(self.sArr)): self.sArr[i] = self.sArr[i] + self.sArr[i - 1] def sumRange(self, i, j): """:type i: int :type ...
the_stack_v2_python_sparse
303/cg_303_easy.py
imranariffin/coding-practice
train
6
4970ac986818faa6c1eca91e47e1ec198b9d1265
[ "lines = self.test.render(anchor='@CA,C,N', mask='!:NA,WAT,HOH', align_mask=':1-100', trajin=[Path('test.crd')], parm=Path('test.prm'), prefix='snapshots/').splitlines()\nself.assertEqual(lines[0], f'# Generated by fmojinja version {get_version()}')\nself.assertEqual(lines[3], 'autoimage anchor @CA,C,N origin', 'au...
<|body_start_0|> lines = self.test.render(anchor='@CA,C,N', mask='!:NA,WAT,HOH', align_mask=':1-100', trajin=[Path('test.crd')], parm=Path('test.prm'), prefix='snapshots/').splitlines() self.assertEqual(lines[0], f'# Generated by fmojinja version {get_version()}') self.assertEqual(lines[3], 'aut...
TestSnapshot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSnapshot: def test_simple_1(self): """simple test 1 for snapshot python -m fmojinja.cpptraj snapshot -p test.prm -y test.crd --align-mask :1-100 --mask !:NA,WAT,HOH --prefix snapshots/ :return: None""" <|body_0|> def test_simple_2(self): """simple test 2 for snap...
stack_v2_sparse_classes_36k_train_024879
3,199
permissive
[ { "docstring": "simple test 1 for snapshot python -m fmojinja.cpptraj snapshot -p test.prm -y test.crd --align-mask :1-100 --mask !:NA,WAT,HOH --prefix snapshots/ :return: None", "name": "test_simple_1", "signature": "def test_simple_1(self)" }, { "docstring": "simple test 2 for snapshot python ...
2
stack_v2_sparse_classes_30k_train_011812
Implement the Python class `TestSnapshot` described below. Class description: Implement the TestSnapshot class. Method signatures and docstrings: - def test_simple_1(self): simple test 1 for snapshot python -m fmojinja.cpptraj snapshot -p test.prm -y test.crd --align-mask :1-100 --mask !:NA,WAT,HOH --prefix snapshots...
Implement the Python class `TestSnapshot` described below. Class description: Implement the TestSnapshot class. Method signatures and docstrings: - def test_simple_1(self): simple test 1 for snapshot python -m fmojinja.cpptraj snapshot -p test.prm -y test.crd --align-mask :1-100 --mask !:NA,WAT,HOH --prefix snapshots...
c0728660628b3d46fa9923f5439136d966f29e2f
<|skeleton|> class TestSnapshot: def test_simple_1(self): """simple test 1 for snapshot python -m fmojinja.cpptraj snapshot -p test.prm -y test.crd --align-mask :1-100 --mask !:NA,WAT,HOH --prefix snapshots/ :return: None""" <|body_0|> def test_simple_2(self): """simple test 2 for snap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSnapshot: def test_simple_1(self): """simple test 1 for snapshot python -m fmojinja.cpptraj snapshot -p test.prm -y test.crd --align-mask :1-100 --mask !:NA,WAT,HOH --prefix snapshots/ :return: None""" lines = self.test.render(anchor='@CA,C,N', mask='!:NA,WAT,HOH', align_mask=':1-100', tra...
the_stack_v2_python_sparse
fmojinja/cpptraj/test_snapshot.py
physchemstar/fmojinja
train
1
eb203bc93476b7b993df8e1b31c573a6242be77d
[ "sum_1 = 0\nstack = []\nfor i, h in enumerate(height):\n if not stack and h == 0:\n continue\n elif not stack or stack[-1][-1] > h:\n stack.append([i, h])\n else:\n lists = []\n while stack and stack[-1][-1] <= h:\n lists.append(stack.pop())\n if not stack:\n ...
<|body_start_0|> sum_1 = 0 stack = [] for i, h in enumerate(height): if not stack and h == 0: continue elif not stack or stack[-1][-1] > h: stack.append([i, h]) else: lists = [] while stack and st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int 68ms""" <|body_0|> def trap_1(self, height): """:type height: List[int] :rtype: int 59ms""" <|body_1|> def trap_2(self, height): """:type height: List[int] :rtype: int 49ms"...
stack_v2_sparse_classes_36k_train_024880
2,988
no_license
[ { "docstring": ":type height: List[int] :rtype: int 68ms", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": ":type height: List[int] :rtype: int 59ms", "name": "trap_1", "signature": "def trap_1(self, height)" }, { "docstring": ":type height: List[int] :rty...
3
stack_v2_sparse_classes_30k_train_003878
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int 68ms - def trap_1(self, height): :type height: List[int] :rtype: int 59ms - def trap_2(self, height): :type height: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int 68ms - def trap_1(self, height): :type height: List[int] :rtype: int 59ms - def trap_2(self, height): :type height: Li...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int 68ms""" <|body_0|> def trap_1(self, height): """:type height: List[int] :rtype: int 59ms""" <|body_1|> def trap_2(self, height): """:type height: List[int] :rtype: int 49ms"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int 68ms""" sum_1 = 0 stack = [] for i, h in enumerate(height): if not stack and h == 0: continue elif not stack or stack[-1][-1] > h: stack.append([i, h...
the_stack_v2_python_sparse
TrappingRainWater_HARD_42.py
953250587/leetcode-python
train
2
4c7be724b1e2cd059a840082a61c26cfe132baa1
[ "super().__init__(**kwargs)\nused_op = None\nif backend == 'noiseless':\n used_op = circuit_execution_ops.get_sampling_op(None)\nelif backend == 'noisy':\n used_op = noisy_samples_op.samples\nelse:\n used_op = circuit_execution_ops.get_sampling_op(backend)\nself.sample_op = used_op", "if repetitions is N...
<|body_start_0|> super().__init__(**kwargs) used_op = None if backend == 'noiseless': used_op = circuit_execution_ops.get_sampling_op(None) elif backend == 'noisy': used_op = noisy_samples_op.samples else: used_op = circuit_execution_ops.get_sa...
A Layer that samples from a quantum circuit. Given an input circuit and set of parameter values, output samples taken from the end of the circuit. First lets define a simple circuit to sample from: >>> def get_circuit(): ... q0 = cirq.GridQubit(0, 0) ... q1 = cirq.GridQubit(1, 0) ... circuit = cirq.Circuit( ... cirq.X(...
Sample
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sample: """A Layer that samples from a quantum circuit. Given an input circuit and set of parameter values, output samples taken from the end of the circuit. First lets define a simple circuit to sample from: >>> def get_circuit(): ... q0 = cirq.GridQubit(0, 0) ... q1 = cirq.GridQubit(1, 0) ... c...
stack_v2_sparse_classes_36k_train_024881
7,611
permissive
[ { "docstring": "Instantiate this Layer. Create a layer that will output bitstring samples taken from either a simulated quantum state or a real quantum computer Args: backend: Optional Backend to use to simulate this state. Defaults to the noiseless simulator. Options are {'noisy', 'noiseless'}, however users m...
2
null
Implement the Python class `Sample` described below. Class description: A Layer that samples from a quantum circuit. Given an input circuit and set of parameter values, output samples taken from the end of the circuit. First lets define a simple circuit to sample from: >>> def get_circuit(): ... q0 = cirq.GridQubit(0,...
Implement the Python class `Sample` described below. Class description: A Layer that samples from a quantum circuit. Given an input circuit and set of parameter values, output samples taken from the end of the circuit. First lets define a simple circuit to sample from: >>> def get_circuit(): ... q0 = cirq.GridQubit(0,...
f56257bceb988b743790e1e480eac76fd036d4ff
<|skeleton|> class Sample: """A Layer that samples from a quantum circuit. Given an input circuit and set of parameter values, output samples taken from the end of the circuit. First lets define a simple circuit to sample from: >>> def get_circuit(): ... q0 = cirq.GridQubit(0, 0) ... q1 = cirq.GridQubit(1, 0) ... c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sample: """A Layer that samples from a quantum circuit. Given an input circuit and set of parameter values, output samples taken from the end of the circuit. First lets define a simple circuit to sample from: >>> def get_circuit(): ... q0 = cirq.GridQubit(0, 0) ... q1 = cirq.GridQubit(1, 0) ... circuit = cirq...
the_stack_v2_python_sparse
tensorflow_quantum/python/layers/circuit_executors/sample.py
tensorflow/quantum
train
1,799
5d31725e2e365272579c381749a397c815d54153
[ "try:\n validate_email(email)\nexcept ValidationError:\n raise ValueError('Invalid email address, please try again.')\nuser = self.model(email=self.normalize_email(email))\nif password:\n user.set_password(password)\nelse:\n user.set_unusable_password()\nuser.save(using=self._db)\nreturn user", "user ...
<|body_start_0|> try: validate_email(email) except ValidationError: raise ValueError('Invalid email address, please try again.') user = self.model(email=self.normalize_email(email)) if password: user.set_password(password) else: use...
RinkUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_36k_train_024882
9,151
no_license
[ { "docstring": "Creates and saves a User with the given email and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email and password.", "name": "create_superuser", "signature": "...
2
stack_v2_sparse_classes_30k_train_020175
Implement the Python class `RinkUserManager` described below. Class description: Implement the RinkUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
Implement the Python class `RinkUserManager` described below. Class description: Implement the RinkUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email and password. - def create_superuser(self, email, password): Creates and ...
e3eebf1a9bce85616df698f7e33a01688929fe53
<|skeleton|> class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email and password.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RinkUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email and password.""" try: validate_email(email) except ValidationError: raise ValueError('Invalid email address, please try again.') user = self.mo...
the_stack_v2_python_sparse
rink/users/models.py
MadisonRollerDerby/rink
train
0
2d004ee7d91609d7ab695d23f0b696d5beacdda4
[ "super().__init__(router, description)\nself._partition = partition\nself._attr_name = f\"{partition['label']} {description.name}\"\nself._attr_unique_id = f\"{router.mac} {description.key} {disk['id']} {partition['id']}\"\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, disk['id'])}, model=disk['model'],...
<|body_start_0|> super().__init__(router, description) self._partition = partition self._attr_name = f"{partition['label']} {description.name}" self._attr_unique_id = f"{router.mac} {description.key} {disk['id']} {partition['id']}" self._attr_device_info = DeviceInfo(identifiers=...
Representation of a Freebox disk sensor.
FreeboxDiskSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FreeboxDiskSensor: """Representation of a Freebox disk sensor.""" def __init__(self, router: FreeboxRouter, disk: dict[str, Any], partition: dict[str, Any], description: SensorEntityDescription) -> None: """Initialize a Freebox disk sensor.""" <|body_0|> def async_update...
stack_v2_sparse_classes_36k_train_024883
7,660
permissive
[ { "docstring": "Initialize a Freebox disk sensor.", "name": "__init__", "signature": "def __init__(self, router: FreeboxRouter, disk: dict[str, Any], partition: dict[str, Any], description: SensorEntityDescription) -> None" }, { "docstring": "Update the Freebox disk sensor.", "name": "async_...
2
stack_v2_sparse_classes_30k_train_002499
Implement the Python class `FreeboxDiskSensor` described below. Class description: Representation of a Freebox disk sensor. Method signatures and docstrings: - def __init__(self, router: FreeboxRouter, disk: dict[str, Any], partition: dict[str, Any], description: SensorEntityDescription) -> None: Initialize a Freebox...
Implement the Python class `FreeboxDiskSensor` described below. Class description: Representation of a Freebox disk sensor. Method signatures and docstrings: - def __init__(self, router: FreeboxRouter, disk: dict[str, Any], partition: dict[str, Any], description: SensorEntityDescription) -> None: Initialize a Freebox...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class FreeboxDiskSensor: """Representation of a Freebox disk sensor.""" def __init__(self, router: FreeboxRouter, disk: dict[str, Any], partition: dict[str, Any], description: SensorEntityDescription) -> None: """Initialize a Freebox disk sensor.""" <|body_0|> def async_update...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FreeboxDiskSensor: """Representation of a Freebox disk sensor.""" def __init__(self, router: FreeboxRouter, disk: dict[str, Any], partition: dict[str, Any], description: SensorEntityDescription) -> None: """Initialize a Freebox disk sensor.""" super().__init__(router, description) ...
the_stack_v2_python_sparse
homeassistant/components/freebox/sensor.py
home-assistant/core
train
35,501
cf9ec76dac9fbe5f467fb8b66415d108fe7eb25e
[ "mes = {'message': 'success'}\nproduct_name = kwargs.get('product_name', '')\nspecification = kwargs.get('specification', '')\nnet_contents = kwargs.get('net_contents', '')\npackage_ratio = kwargs.get('package_ratio', '')\ndb_client = orm_module.get_client()\nw = orm_module.get_write_concern()\ncol = orm_module.get...
<|body_start_0|> mes = {'message': 'success'} product_name = kwargs.get('product_name', '') specification = kwargs.get('specification', '') net_contents = kwargs.get('net_contents', '') package_ratio = kwargs.get('package_ratio', '') db_client = orm_module.get_client() ...
公司产品信息
Product
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Product: """公司产品信息""" def add(cls, **kwargs) -> dict: """添加产品 :param kwargs: :return:""" <|body_0|> def selector_data(cls, filter_dict: dict=None) -> dict: """获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{product_name:_id} 第二级: ...
stack_v2_sparse_classes_36k_train_024884
27,644
no_license
[ { "docstring": "添加产品 :param kwargs: :return:", "name": "add", "signature": "def add(cls, **kwargs) -> dict" }, { "docstring": "获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{product_name:_id} 第二级: {\"product_name\": product_name} 返回{specification:_id} 第三级: {\"sp...
2
null
Implement the Python class `Product` described below. Class description: 公司产品信息 Method signatures and docstrings: - def add(cls, **kwargs) -> dict: 添加产品 :param kwargs: :return: - def selector_data(cls, filter_dict: dict=None) -> dict: 获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{pr...
Implement the Python class `Product` described below. Class description: 公司产品信息 Method signatures and docstrings: - def add(cls, **kwargs) -> dict: 添加产品 :param kwargs: :return: - def selector_data(cls, filter_dict: dict=None) -> dict: 获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{pr...
3a2bdfd1598bfcdfe56386ec0c46fcede772cbfe
<|skeleton|> class Product: """公司产品信息""" def add(cls, **kwargs) -> dict: """添加产品 :param kwargs: :return:""" <|body_0|> def selector_data(cls, filter_dict: dict=None) -> dict: """获取产品的选择器 :param filter_dict: 查询字典,None表示查询第一级 :return: 每一级别的查询方式如下: 第一级: None 返回{product_name:_id} 第二级: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Product: """公司产品信息""" def add(cls, **kwargs) -> dict: """添加产品 :param kwargs: :return:""" mes = {'message': 'success'} product_name = kwargs.get('product_name', '') specification = kwargs.get('specification', '') net_contents = kwargs.get('net_contents', '') ...
the_stack_v2_python_sparse
query_server/module/system_module.py
SYYDSN/py_projects
train
0
966616ede278f5c58b8ce4d04f3bb69a4863f93f
[ "super(TowerRepresentation, self).__init__()\nself.r_dim = k = r_dim\nself.pool = pool\nself.conv1 = nn.Conv2d(n_channels, k, kernel_size=2, stride=2)\nself.conv2 = nn.Conv2d(k, k, kernel_size=2, stride=2)\nself.conv3 = nn.Conv2d(k, k // 2, kernel_size=3, stride=1, padding=1)\nself.conv4 = nn.Conv2d(k // 2, k, kern...
<|body_start_0|> super(TowerRepresentation, self).__init__() self.r_dim = k = r_dim self.pool = pool self.conv1 = nn.Conv2d(n_channels, k, kernel_size=2, stride=2) self.conv2 = nn.Conv2d(k, k, kernel_size=2, stride=2) self.conv3 = nn.Conv2d(k, k // 2, kernel_size=3, strid...
TowerRepresentation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TowerRepresentation: def __init__(self, n_channels, v_dim, r_dim=256, pool=True): """Network that generates a condensed representation vector from a joint input of image and viewpoint. Employs the tower/pool architecture described in the paper. :param n_channels: number of color channels...
stack_v2_sparse_classes_36k_train_024885
3,901
permissive
[ { "docstring": "Network that generates a condensed representation vector from a joint input of image and viewpoint. Employs the tower/pool architecture described in the paper. :param n_channels: number of color channels in input image :param v_dim: dimensions of the viewpoint vector :param r_dim: dimensions of ...
2
stack_v2_sparse_classes_30k_train_009234
Implement the Python class `TowerRepresentation` described below. Class description: Implement the TowerRepresentation class. Method signatures and docstrings: - def __init__(self, n_channels, v_dim, r_dim=256, pool=True): Network that generates a condensed representation vector from a joint input of image and viewpo...
Implement the Python class `TowerRepresentation` described below. Class description: Implement the TowerRepresentation class. Method signatures and docstrings: - def __init__(self, n_channels, v_dim, r_dim=256, pool=True): Network that generates a condensed representation vector from a joint input of image and viewpo...
80440bee09951d24d739866b85dfa64cbdad2258
<|skeleton|> class TowerRepresentation: def __init__(self, n_channels, v_dim, r_dim=256, pool=True): """Network that generates a condensed representation vector from a joint input of image and viewpoint. Employs the tower/pool architecture described in the paper. :param n_channels: number of color channels...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TowerRepresentation: def __init__(self, n_channels, v_dim, r_dim=256, pool=True): """Network that generates a condensed representation vector from a joint input of image and viewpoint. Employs the tower/pool architecture described in the paper. :param n_channels: number of color channels in input imag...
the_stack_v2_python_sparse
gqn-wohlert/gqn/representation.py
yueqiw/gqn-world-model
train
6
2fc556642cfb310e8e174ba1cf2196e64b3dfeb9
[ "if not needle:\n return 0\nif not haystack:\n return -1\nif len(needle) > len(haystack):\n return -1\nfor i in range(len(haystack) - len(needle) + 1):\n find = True\n for j in range(len(needle)):\n if haystack[i + j] != needle[j]:\n find = False\n break\n if find:\n ...
<|body_start_0|> if not needle: return 0 if not haystack: return -1 if len(needle) > len(haystack): return -1 for i in range(len(haystack) - len(needle) + 1): find = True for j in range(len(needle)): if haystack[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def strStrRabinKarp(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_1|> def strStrSunday(self, haysta...
stack_v2_sparse_classes_36k_train_024886
7,020
no_license
[ { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStr", "signature": "def strStr(self, haystack, needle)" }, { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStrRabinKarp", "signature": "def strStrRabinKarp(self, haystack, need...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def strStrRabinKarp(self, haystack, needle): :type haystack: str :type needle: str :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def strStrRabinKarp(self, haystack, needle): :type haystack: str :type needle: str :rtype:...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def strStrRabinKarp(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_1|> def strStrSunday(self, haysta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" if not needle: return 0 if not haystack: return -1 if len(needle) > len(haystack): return -1 for i in range(len(haystack) - len(need...
the_stack_v2_python_sparse
I/ImplementstrStr.py
bssrdf/pyleet
train
2
35f25c3d04a4346bb7572fe9657e2898ae1bac44
[ "self.dbConn = dbConn\ndbConn.execute('CREATE TABLE IF NOT EXISTS sender_keys (_id INTEGER PRIMARY KEY AUTOINCREMENT,group_id TEXT NOT NULL,sender_id INTEGER NOT NULL, record BLOB);')\ndbConn.execute('CREATE UNIQUE INDEX IF NOT EXISTS sender_keys_idx ON sender_keys (group_id, sender_id);')", "q = 'INSERT INTO sen...
<|body_start_0|> self.dbConn = dbConn dbConn.execute('CREATE TABLE IF NOT EXISTS sender_keys (_id INTEGER PRIMARY KEY AUTOINCREMENT,group_id TEXT NOT NULL,sender_id INTEGER NOT NULL, record BLOB);') dbConn.execute('CREATE UNIQUE INDEX IF NOT EXISTS sender_keys_idx ON sender_keys (group_id, sende...
LiteSenderKeyStore
[ "GPL-3.0-only", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LiteSenderKeyStore: def __init__(self, dbConn): """:type dbConn: Connection""" <|body_0|> def storeSenderKey(self, senderKeyName, senderKeyRecord): """:type senderKeyName: SenderKeName :type senderKeyRecord: SenderKeyRecord""" <|body_1|> def loadSenderKe...
stack_v2_sparse_classes_36k_train_024887
2,025
permissive
[ { "docstring": ":type dbConn: Connection", "name": "__init__", "signature": "def __init__(self, dbConn)" }, { "docstring": ":type senderKeyName: SenderKeName :type senderKeyRecord: SenderKeyRecord", "name": "storeSenderKey", "signature": "def storeSenderKey(self, senderKeyName, senderKey...
3
null
Implement the Python class `LiteSenderKeyStore` described below. Class description: Implement the LiteSenderKeyStore class. Method signatures and docstrings: - def __init__(self, dbConn): :type dbConn: Connection - def storeSenderKey(self, senderKeyName, senderKeyRecord): :type senderKeyName: SenderKeName :type sende...
Implement the Python class `LiteSenderKeyStore` described below. Class description: Implement the LiteSenderKeyStore class. Method signatures and docstrings: - def __init__(self, dbConn): :type dbConn: Connection - def storeSenderKey(self, senderKeyName, senderKeyRecord): :type senderKeyName: SenderKeName :type sende...
822dfc46b80e7a26eb553e5a10e723dda5a9f77d
<|skeleton|> class LiteSenderKeyStore: def __init__(self, dbConn): """:type dbConn: Connection""" <|body_0|> def storeSenderKey(self, senderKeyName, senderKeyRecord): """:type senderKeyName: SenderKeName :type senderKeyRecord: SenderKeyRecord""" <|body_1|> def loadSenderKe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LiteSenderKeyStore: def __init__(self, dbConn): """:type dbConn: Connection""" self.dbConn = dbConn dbConn.execute('CREATE TABLE IF NOT EXISTS sender_keys (_id INTEGER PRIMARY KEY AUTOINCREMENT,group_id TEXT NOT NULL,sender_id INTEGER NOT NULL, record BLOB);') dbConn.execute('C...
the_stack_v2_python_sparse
service/yowsup/yowsup/layers/axolotl/store/sqlite/litesenderkeystore.py
PuneethReddyHC/whatsapp-rest-webservice
train
0
194e9f17ba1fdbf53518dc725edc26454ed736fc
[ "self.matrix = matrix\nself.empty = False\nself.length = len(matrix)\nself.bredth = None\nif self.length == 0 or (self.length == 1 and self.bredth == 0):\n self.empty = True\nelif self.length == 1 and len(matrix[0]) == 0:\n self.empty = True\nelse:\n self.bredth = len(matrix[0])\nself.opt = None\nif not se...
<|body_start_0|> self.matrix = matrix self.empty = False self.length = len(matrix) self.bredth = None if self.length == 0 or (self.length == 1 and self.bredth == 0): self.empty = True elif self.length == 1 and len(matrix[0]) == 0: self.empty = True...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_024888
1,270
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
3bfee704adb1d94efc8e531b732cf06c4f8aef0f
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.matrix = matrix self.empty = False self.length = len(matrix) self.bredth = None if self.length == 0 or (self.length == 1 and self.bredth == 0): self.empty = True ...
the_stack_v2_python_sparse
rangequerymatrix.py
zopepy/leetcode
train
0
4d6925f35335a77ab6db87d5605a7367c60178c7
[ "authority_id = None\ntry:\n return self.fields['authority'].initial[0].name\nexcept:\n try:\n authority_id = self.initial['authority']\n except:\n try:\n authority_id = self.data['authority']\n except:\n pass\nif authority_id:\n if isinstance(authority_id, bas...
<|body_start_0|> authority_id = None try: return self.fields['authority'].initial[0].name except: try: authority_id = self.initial['authority'] except: try: authority_id = self.data['authority'] ...
MakeRequestForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MakeRequestForm: def get_authority_label(self): """Return a label of an authority. Warning! Works only for the cases of a sigle Authority in a Draft.""" <|body_0|> def __init__(self, *args, **kwargs): """Initializing request form with message template.""" <|b...
stack_v2_sparse_classes_36k_train_024889
12,085
no_license
[ { "docstring": "Return a label of an authority. Warning! Works only for the cases of a sigle Authority in a Draft.", "name": "get_authority_label", "signature": "def get_authority_label(self)" }, { "docstring": "Initializing request form with message template.", "name": "__init__", "sign...
2
stack_v2_sparse_classes_30k_train_005556
Implement the Python class `MakeRequestForm` described below. Class description: Implement the MakeRequestForm class. Method signatures and docstrings: - def get_authority_label(self): Return a label of an authority. Warning! Works only for the cases of a sigle Authority in a Draft. - def __init__(self, *args, **kwar...
Implement the Python class `MakeRequestForm` described below. Class description: Implement the MakeRequestForm class. Method signatures and docstrings: - def get_authority_label(self): Return a label of an authority. Warning! Works only for the cases of a sigle Authority in a Draft. - def __init__(self, *args, **kwar...
ab7a7c54e3d2babf06559792abaa1e026acc2c7d
<|skeleton|> class MakeRequestForm: def get_authority_label(self): """Return a label of an authority. Warning! Works only for the cases of a sigle Authority in a Draft.""" <|body_0|> def __init__(self, *args, **kwargs): """Initializing request form with message template.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MakeRequestForm: def get_authority_label(self): """Return a label of an authority. Warning! Works only for the cases of a sigle Authority in a Draft.""" authority_id = None try: return self.fields['authority'].initial[0].name except: try: ...
the_stack_v2_python_sparse
apps/pia_request/forms.py
CCLab/sezam
train
0
d267fbb2880065bf54cb737b7a95791f39abb1ee
[ "self.q = []\nself.q2 = []\nself.tag = 1", "if self.tag == 1:\n self.q.append(x)\nelse:\n self.q2.append(x)", "if self.tag == 1:\n while len(self.q) > 1:\n t = self.q.pop(0)\n self.q2.append(t)\n self.tag = 2\n return self.q.pop(0)\nelse:\n while len(self.q2) > 1:\n t = se...
<|body_start_0|> self.q = [] self.q2 = [] self.tag = 1 <|end_body_0|> <|body_start_1|> if self.tag == 1: self.q.append(x) else: self.q2.append(x) <|end_body_1|> <|body_start_2|> if self.tag == 1: while len(self.q) > 1: ...
MyStack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyStack: def __init__(self): """Initialize your data structure here.""" <|body_0|> def push(self, x): """Push element x onto stack. :type x: int :rtype: None""" <|body_1|> def pop(self): """Removes the element on top of the stack and returns that...
stack_v2_sparse_classes_36k_train_024890
1,852
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Push element x onto stack. :type x: int :rtype: None", "name": "push", "signature": "def push(self, x)" }, { "docstring": "Removes the element on top of...
5
stack_v2_sparse_classes_30k_train_016115
Implement the Python class `MyStack` described below. Class description: Implement the MyStack class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def push(self, x): Push element x onto stack. :type x: int :rtype: None - def pop(self): Removes the element on top of th...
Implement the Python class `MyStack` described below. Class description: Implement the MyStack class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def push(self, x): Push element x onto stack. :type x: int :rtype: None - def pop(self): Removes the element on top of th...
fd6c8082f81bcd9eda084b347c77fd570cfbee4a
<|skeleton|> class MyStack: def __init__(self): """Initialize your data structure here.""" <|body_0|> def push(self, x): """Push element x onto stack. :type x: int :rtype: None""" <|body_1|> def pop(self): """Removes the element on top of the stack and returns that...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyStack: def __init__(self): """Initialize your data structure here.""" self.q = [] self.q2 = [] self.tag = 1 def push(self, x): """Push element x onto stack. :type x: int :rtype: None""" if self.tag == 1: self.q.append(x) else: ...
the_stack_v2_python_sparse
problems/225/test.py
neuxxm/leetcode
train
0
d49355121ebb239baf068135b498b02297f23fda
[ "send_url = self.get_peizhi_(name='contract', yaml_ming='yilou_zufang.yaml')\nsend_url = send_url['renter_confirm_contract']\nlogging.info('url is %s' % send_url)\nsend_dict = {'contractId': contractId}\nresponse = self.request_post(base_url=send_url, dict_data=send_dict)\nreturn response", "send_url = self.get_p...
<|body_start_0|> send_url = self.get_peizhi_(name='contract', yaml_ming='yilou_zufang.yaml') send_url = send_url['renter_confirm_contract'] logging.info('url is %s' % send_url) send_dict = {'contractId': contractId} response = self.request_post(base_url=send_url, dict_data=send_d...
租客端合同
Yilou_Zuke_Contract
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Yilou_Zuke_Contract: """租客端合同""" def renter_confirm_contract(self, contractId): """确认合同""" <|body_0|> def econtract_info(self, contractId): """获取合同信息""" <|body_1|> def getRentBillList(self, contractId): """获取合同信息""" <|body_2|> de...
stack_v2_sparse_classes_36k_train_024891
2,311
no_license
[ { "docstring": "确认合同", "name": "renter_confirm_contract", "signature": "def renter_confirm_contract(self, contractId)" }, { "docstring": "获取合同信息", "name": "econtract_info", "signature": "def econtract_info(self, contractId)" }, { "docstring": "获取合同信息", "name": "getRentBillLis...
4
null
Implement the Python class `Yilou_Zuke_Contract` described below. Class description: 租客端合同 Method signatures and docstrings: - def renter_confirm_contract(self, contractId): 确认合同 - def econtract_info(self, contractId): 获取合同信息 - def getRentBillList(self, contractId): 获取合同信息 - def getAccountInfo(self): 获取租客信息
Implement the Python class `Yilou_Zuke_Contract` described below. Class description: 租客端合同 Method signatures and docstrings: - def renter_confirm_contract(self, contractId): 确认合同 - def econtract_info(self, contractId): 获取合同信息 - def getRentBillList(self, contractId): 获取合同信息 - def getAccountInfo(self): 获取租客信息 <|skelet...
e173d4e535ac22b72b67371b8a2524ee425cdcbf
<|skeleton|> class Yilou_Zuke_Contract: """租客端合同""" def renter_confirm_contract(self, contractId): """确认合同""" <|body_0|> def econtract_info(self, contractId): """获取合同信息""" <|body_1|> def getRentBillList(self, contractId): """获取合同信息""" <|body_2|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Yilou_Zuke_Contract: """租客端合同""" def renter_confirm_contract(self, contractId): """确认合同""" send_url = self.get_peizhi_(name='contract', yaml_ming='yilou_zufang.yaml') send_url = send_url['renter_confirm_contract'] logging.info('url is %s' % send_url) send_dict = {'...
the_stack_v2_python_sparse
public/aYilou_zuke/yilou_zufang_business/yilou_zuke_contract.py
GSIL-Monitor/mrbao_python
train
0
ad348972f1000131c537436478b1d79b9c00950b
[ "self.num_filters = num_filters\nself.input_dim = input_dim\nself._build_layer_components()\nsuper(InceptionResnetC, self).__init__(**kwargs)", "self.conv_block1 = [Conv2D(self.num_filters, kernel_size=(1, 1), strides=1, padding='same', activation=tf.nn.relu)]\nself.conv_block2 = [Conv2D(filters=self.num_filters,...
<|body_start_0|> self.num_filters = num_filters self.input_dim = input_dim self._build_layer_components() super(InceptionResnetC, self).__init__(**kwargs) <|end_body_0|> <|body_start_1|> self.conv_block1 = [Conv2D(self.num_filters, kernel_size=(1, 1), strides=1, padding='same', ...
Variant C of the three InceptionResNet layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters. This allows capturing patterns over different scales in the inputs. Residual connections are additionally used and have been shown ...
InceptionResnetC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InceptionResnetC: """Variant C of the three InceptionResNet layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters. This allows capturing patterns over different scales in the inputs. Residual connection...
stack_v2_sparse_classes_36k_train_024892
17,354
permissive
[ { "docstring": "Parameters ---------- num_filters: int, Number of convolutional filters input_dim: int, Number of channels in the input.", "name": "__init__", "signature": "def __init__(self, num_filters, input_dim, **kwargs)" }, { "docstring": "Builds the layers components and set _layers attri...
3
null
Implement the Python class `InceptionResnetC` described below. Class description: Variant C of the three InceptionResNet layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters. This allows capturing patterns over different sc...
Implement the Python class `InceptionResnetC` described below. Class description: Variant C of the three InceptionResNet layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters. This allows capturing patterns over different sc...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class InceptionResnetC: """Variant C of the three InceptionResNet layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters. This allows capturing patterns over different scales in the inputs. Residual connection...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InceptionResnetC: """Variant C of the three InceptionResNet layers described in https://arxiv.org/abs/1710.02238. All variants use multiple convolutional blocks with varying kernel sizes and number of filters. This allows capturing patterns over different scales in the inputs. Residual connections are additio...
the_stack_v2_python_sparse
deepchem/models/chemnet_layers.py
deepchem/deepchem
train
4,876
4d46a01e4af37c89607d2dcfe9d0b41844c4ce82
[ "macaddresses = []\ntry:\n for port in self.data.PhysicalPorts:\n mac = port['MacAddress']\n macaddresses.append(mac)\n return macaddresses\nexcept AttributeError:\n return 'Not available'", "try:\n return self.data.StructuredName\nexcept AttributeError:\n return 'Not available'", "...
<|body_start_0|> macaddresses = [] try: for port in self.data.PhysicalPorts: mac = port['MacAddress'] macaddresses.append(mac) return macaddresses except AttributeError: return 'Not available' <|end_body_0|> <|body_start_1|> ...
Class to manage redfish hpe oem NetworkAdapters data.
NetworkAdapters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkAdapters: """Class to manage redfish hpe oem NetworkAdapters data.""" def get_mac(self): """Get NetworkAdapters mac address :returns: mac adresses or "Not available" :rtype: list""" <|body_0|> def get_structured_name(self): """Get NetworkAdapters Structure...
stack_v2_sparse_classes_36k_train_024893
6,341
permissive
[ { "docstring": "Get NetworkAdapters mac address :returns: mac adresses or \"Not available\" :rtype: list", "name": "get_mac", "signature": "def get_mac(self)" }, { "docstring": "Get NetworkAdapters StructuredName :returns: StructuredName or \"Not available\" :rtype: string", "name": "get_str...
3
stack_v2_sparse_classes_30k_val_000814
Implement the Python class `NetworkAdapters` described below. Class description: Class to manage redfish hpe oem NetworkAdapters data. Method signatures and docstrings: - def get_mac(self): Get NetworkAdapters mac address :returns: mac adresses or "Not available" :rtype: list - def get_structured_name(self): Get Netw...
Implement the Python class `NetworkAdapters` described below. Class description: Class to manage redfish hpe oem NetworkAdapters data. Method signatures and docstrings: - def get_mac(self): Get NetworkAdapters mac address :returns: mac adresses or "Not available" :rtype: list - def get_structured_name(self): Get Netw...
41115bc5982a2f2d4e9eb7106880dc3bbdfebc54
<|skeleton|> class NetworkAdapters: """Class to manage redfish hpe oem NetworkAdapters data.""" def get_mac(self): """Get NetworkAdapters mac address :returns: mac adresses or "Not available" :rtype: list""" <|body_0|> def get_structured_name(self): """Get NetworkAdapters Structure...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetworkAdapters: """Class to manage redfish hpe oem NetworkAdapters data.""" def get_mac(self): """Get NetworkAdapters mac address :returns: mac adresses or "Not available" :rtype: list""" macaddresses = [] try: for port in self.data.PhysicalPorts: mac ...
the_stack_v2_python_sparse
redfish/oem/hpe.py
bcornec/python-redfish
train
10
de569998a257743678b00c84bcf9995c1d7e612f
[ "conflict = fake_conflict('foo\\nbar\\nbacon\\n', 'bar\\n', 'bar\\neggs\\n')\nhandle_conflict(conflict)\nself.assertFalse(conflict.is_resolved())\nself.assertEqual(conflict.content, '<<<<<<<\\nfoo\\n|||||||\\n=======\\n>>>>>>>\\n' + 'bar\\n' + '<<<<<<<\\nbacon\\n|||||||\\n=======\\neggs\\n>>>>>>>\\n')", "conflict...
<|body_start_0|> conflict = fake_conflict('foo\nbar\nbacon\n', 'bar\n', 'bar\neggs\n') handle_conflict(conflict) self.assertFalse(conflict.is_resolved()) self.assertEqual(conflict.content, '<<<<<<<\nfoo\n|||||||\n=======\n>>>>>>>\n' + 'bar\n' + '<<<<<<<\nbacon\n|||||||\n=======\neggs\n>>...
SolverTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolverTest: def test_simplify_split(self): """Test a conflict which can be split in too""" <|body_0|> def test_simplify_shrink(self): """Test a conflict which can be shrunk""" <|body_1|> def test_simplify_multiple_split(self): """Test a conflict ...
stack_v2_sparse_classes_36k_train_024894
3,915
permissive
[ { "docstring": "Test a conflict which can be split in too", "name": "test_simplify_split", "signature": "def test_simplify_split(self)" }, { "docstring": "Test a conflict which can be shrunk", "name": "test_simplify_shrink", "signature": "def test_simplify_shrink(self)" }, { "doc...
6
stack_v2_sparse_classes_30k_train_012607
Implement the Python class `SolverTest` described below. Class description: Implement the SolverTest class. Method signatures and docstrings: - def test_simplify_split(self): Test a conflict which can be split in too - def test_simplify_shrink(self): Test a conflict which can be shrunk - def test_simplify_multiple_sp...
Implement the Python class `SolverTest` described below. Class description: Implement the SolverTest class. Method signatures and docstrings: - def test_simplify_split(self): Test a conflict which can be split in too - def test_simplify_shrink(self): Test a conflict which can be shrunk - def test_simplify_multiple_sp...
81ef5e9636f264221b8f8b6f6aaf4cfb5b6a79b6
<|skeleton|> class SolverTest: def test_simplify_split(self): """Test a conflict which can be split in too""" <|body_0|> def test_simplify_shrink(self): """Test a conflict which can be shrunk""" <|body_1|> def test_simplify_multiple_split(self): """Test a conflict ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolverTest: def test_simplify_split(self): """Test a conflict which can be split in too""" conflict = fake_conflict('foo\nbar\nbacon\n', 'bar\n', 'bar\neggs\n') handle_conflict(conflict) self.assertFalse(conflict.is_resolved()) self.assertEqual(conflict.content, '<<<<<<...
the_stack_v2_python_sparse
_gen_simplify_test.py
clmoreno/AutoMergeTool
train
1
d0b554282c62bd19c811832d5841482acabd6817
[ "self._parent = parent\nself.window = gtk.Dialog(flags=gtk.DIALOG_MODAL)\nself.window.set_transient_for(self._parent.window.builder.get_object('main_window'))\nself.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)\nself.buttons = []\nfor name, icon, dialog_class in loaders.iter_loaders():\n bt = gtk.Button(name...
<|body_start_0|> self._parent = parent self.window = gtk.Dialog(flags=gtk.DIALOG_MODAL) self.window.set_transient_for(self._parent.window.builder.get_object('main_window')) self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.buttons = [] for name, icon, dialog_cla...
rief dialog class showing buttons calling the appropriate loaders
loader_dialog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class loader_dialog: """rief dialog class showing buttons calling the appropriate loaders""" def __init__(self, parent): """rief constructor \\param parent - gtk_view class instance""" <|body_0|> def button_clicked(self, button, dialog_class): """rief executed when ...
stack_v2_sparse_classes_36k_train_024895
1,726
no_license
[ { "docstring": "\brief constructor \\\\param parent - gtk_view class instance", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "\brief executed when dialog button is clicked \\\\param button \\\\param dialog_class - dialog class given from", "name": "button_c...
3
stack_v2_sparse_classes_30k_val_000737
Implement the Python class `loader_dialog` described below. Class description: rief dialog class showing buttons calling the appropriate loaders Method signatures and docstrings: - def __init__(self, parent): rief constructor \\param parent - gtk_view class instance - def button_clicked(self, button, dialog_class):...
Implement the Python class `loader_dialog` described below. Class description: rief dialog class showing buttons calling the appropriate loaders Method signatures and docstrings: - def __init__(self, parent): rief constructor \\param parent - gtk_view class instance - def button_clicked(self, button, dialog_class):...
eb151afa9ee939ed7943da9eeed1e976ac816fec
<|skeleton|> class loader_dialog: """rief dialog class showing buttons calling the appropriate loaders""" def __init__(self, parent): """rief constructor \\param parent - gtk_view class instance""" <|body_0|> def button_clicked(self, button, dialog_class): """rief executed when ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class loader_dialog: """rief dialog class showing buttons calling the appropriate loaders""" def __init__(self, parent): """rief constructor \\param parent - gtk_view class instance""" self._parent = parent self.window = gtk.Dialog(flags=gtk.DIALOG_MODAL) self.window.set_trans...
the_stack_v2_python_sparse
src/loader_dialog.py
s9gf4ult/track-deal
train
1
51da4a18fe0782c2b2d417a87beb509b68d5bc50
[ "super(LossCallback, self).__init__()\nself.bach_size = bach_size\nself.time_start = time.time()", "cb_params = run_context.original_args()\nbatch_num = cb_params.batch_num\nepoch_num = cb_params.epoch_num\ndevice_number = cb_params.device_number\nprint('Starting Training : device_number={},per_step_size={},batch...
<|body_start_0|> super(LossCallback, self).__init__() self.bach_size = bach_size self.time_start = time.time() <|end_body_0|> <|body_start_1|> cb_params = run_context.original_args() batch_num = cb_params.batch_num epoch_num = cb_params.epoch_num device_number = ...
StopAtTime
LossCallback
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LossCallback: """StopAtTime""" def __init__(self, bach_size): """init""" <|body_0|> def begin(self, run_context): """train begin""" <|body_1|> def step_end(self, run_context): """step end""" <|body_2|> def end(self, run_context):...
stack_v2_sparse_classes_36k_train_024896
2,688
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, bach_size)" }, { "docstring": "train begin", "name": "begin", "signature": "def begin(self, run_context)" }, { "docstring": "step end", "name": "step_end", "signature": "def step_end(self, run_con...
4
null
Implement the Python class `LossCallback` described below. Class description: StopAtTime Method signatures and docstrings: - def __init__(self, bach_size): init - def begin(self, run_context): train begin - def step_end(self, run_context): step end - def end(self, run_context): train end
Implement the Python class `LossCallback` described below. Class description: StopAtTime Method signatures and docstrings: - def __init__(self, bach_size): init - def begin(self, run_context): train begin - def step_end(self, run_context): step end - def end(self, run_context): train end <|skeleton|> class LossCallb...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class LossCallback: """StopAtTime""" def __init__(self, bach_size): """init""" <|body_0|> def begin(self, run_context): """train begin""" <|body_1|> def step_end(self, run_context): """step end""" <|body_2|> def end(self, run_context):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LossCallback: """StopAtTime""" def __init__(self, bach_size): """init""" super(LossCallback, self).__init__() self.bach_size = bach_size self.time_start = time.time() def begin(self, run_context): """train begin""" cb_params = run_context.original_args...
the_stack_v2_python_sparse
research/cv/fairmot/src/utils/callback.py
mindspore-ai/models
train
301
bc2f29e606899bff21a8a28d0083ec3700ebd1ab
[ "devolver = False\np = sub.Popen(('shasum', p_ruta), stdout=sub.PIPE, stderr=sub.PIPE)\nsalidas_sha, errores_sha = p.communicate()\nif len(salidas_sha) != 0 and len(errores_sha) == 0:\n salidas = salidas_sha.split()\n sha = salidas[0]\n gestor_script = GestorScript.GestorScript()\n resultado_db = gestor...
<|body_start_0|> devolver = False p = sub.Popen(('shasum', p_ruta), stdout=sub.PIPE, stderr=sub.PIPE) salidas_sha, errores_sha = p.communicate() if len(salidas_sha) != 0 and len(errores_sha) == 0: salidas = salidas_sha.split() sha = salidas[0] gestor_s...
CAdminAnadirScript
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CAdminAnadirScript: def anadir_script(self, p_ruta, p_nombre_s, p_descripcion, p_activado): """Añade un nuevo script en la base de datos :return: True -> Todo ha ido bien False -> Algo no ha ido bien""" <|body_0|> def modificar_script(self, p_id_script, p_nombre_s, p_descrip...
stack_v2_sparse_classes_36k_train_024897
2,314
no_license
[ { "docstring": "Añade un nuevo script en la base de datos :return: True -> Todo ha ido bien False -> Algo no ha ido bien", "name": "anadir_script", "signature": "def anadir_script(self, p_ruta, p_nombre_s, p_descripcion, p_activado)" }, { "docstring": "Modifica los valores que establezca el usua...
2
stack_v2_sparse_classes_30k_train_009399
Implement the Python class `CAdminAnadirScript` described below. Class description: Implement the CAdminAnadirScript class. Method signatures and docstrings: - def anadir_script(self, p_ruta, p_nombre_s, p_descripcion, p_activado): Añade un nuevo script en la base de datos :return: True -> Todo ha ido bien False -> A...
Implement the Python class `CAdminAnadirScript` described below. Class description: Implement the CAdminAnadirScript class. Method signatures and docstrings: - def anadir_script(self, p_ruta, p_nombre_s, p_descripcion, p_activado): Añade un nuevo script en la base de datos :return: True -> Todo ha ido bien False -> A...
7fa252a193b934fd192763b6168bb48eb4542aed
<|skeleton|> class CAdminAnadirScript: def anadir_script(self, p_ruta, p_nombre_s, p_descripcion, p_activado): """Añade un nuevo script en la base de datos :return: True -> Todo ha ido bien False -> Algo no ha ido bien""" <|body_0|> def modificar_script(self, p_id_script, p_nombre_s, p_descrip...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CAdminAnadirScript: def anadir_script(self, p_ruta, p_nombre_s, p_descripcion, p_activado): """Añade un nuevo script en la base de datos :return: True -> Todo ha ido bien False -> Algo no ha ido bien""" devolver = False p = sub.Popen(('shasum', p_ruta), stdout=sub.PIPE, stderr=sub.PIPE...
the_stack_v2_python_sparse
src/packControladoras/CAdminAnadirScript.py
rubenmulero/Akeko_Admin
train
0
3e53ebba10be2b2c70c9d2efc190f5cef9dd8aca
[ "mycursor = self.db.connection.cursor()\nmycursor.execute('\\n INSERT INTO Substitute (id_product_to_substitute, id_product_substitute)\\n VALUES (%(id_product_to_substitute)s, %(id_product_substitute)s)\\n ', {'id_product_to_substitute': selected_product[0].id, 'id_product_substitute': better_...
<|body_start_0|> mycursor = self.db.connection.cursor() mycursor.execute('\n INSERT INTO Substitute (id_product_to_substitute, id_product_substitute)\n VALUES (%(id_product_to_substitute)s, %(id_product_substitute)s)\n ', {'id_product_to_substitute': selected_product[0].id, 'id_prod...
Manage the substitutes in the SQL database
SubstituteManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstituteManager: """Manage the substitutes in the SQL database""" def insert_substitute(self, selected_product, better_product): """Inserts substitutes into the SQL table when the user choose this option""" <|body_0|> def fetch_substitute_list(self): """Fetch a...
stack_v2_sparse_classes_36k_train_024898
7,181
no_license
[ { "docstring": "Inserts substitutes into the SQL table when the user choose this option", "name": "insert_substitute", "signature": "def insert_substitute(self, selected_product, better_product)" }, { "docstring": "Fetch all the substitutes from the SQL Substitute table so that the controllers c...
2
stack_v2_sparse_classes_30k_train_021474
Implement the Python class `SubstituteManager` described below. Class description: Manage the substitutes in the SQL database Method signatures and docstrings: - def insert_substitute(self, selected_product, better_product): Inserts substitutes into the SQL table when the user choose this option - def fetch_substitut...
Implement the Python class `SubstituteManager` described below. Class description: Manage the substitutes in the SQL database Method signatures and docstrings: - def insert_substitute(self, selected_product, better_product): Inserts substitutes into the SQL table when the user choose this option - def fetch_substitut...
8b1ae1ed03d2274e85b8a38c39ebfcf354857e42
<|skeleton|> class SubstituteManager: """Manage the substitutes in the SQL database""" def insert_substitute(self, selected_product, better_product): """Inserts substitutes into the SQL table when the user choose this option""" <|body_0|> def fetch_substitute_list(self): """Fetch a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubstituteManager: """Manage the substitutes in the SQL database""" def insert_substitute(self, selected_product, better_product): """Inserts substitutes into the SQL table when the user choose this option""" mycursor = self.db.connection.cursor() mycursor.execute('\n INSER...
the_stack_v2_python_sparse
core/managers.py
bientavu/openfoodfacts
train
0
fe3d5f98df4a311f16bf7df30be598b0b17bbdfd
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
* Allow to communicate with the vehicle's system shell.
ShellServiceServicer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShellServiceServicer: """* Allow to communicate with the vehicle's system shell.""" def Send(self, request, context): """Send a command line.""" <|body_0|> def SubscribeReceive(self, request, context): """Receive feedback from a sent command line. This subscripti...
stack_v2_sparse_classes_36k_train_024899
2,389
permissive
[ { "docstring": "Send a command line.", "name": "Send", "signature": "def Send(self, request, context)" }, { "docstring": "Receive feedback from a sent command line. This subscription needs to be made before a command line is sent, otherwise, no response will be sent.", "name": "SubscribeRece...
2
stack_v2_sparse_classes_30k_train_011577
Implement the Python class `ShellServiceServicer` described below. Class description: * Allow to communicate with the vehicle's system shell. Method signatures and docstrings: - def Send(self, request, context): Send a command line. - def SubscribeReceive(self, request, context): Receive feedback from a sent command ...
Implement the Python class `ShellServiceServicer` described below. Class description: * Allow to communicate with the vehicle's system shell. Method signatures and docstrings: - def Send(self, request, context): Send a command line. - def SubscribeReceive(self, request, context): Receive feedback from a sent command ...
a328834518621842f530804572ecb3baeec31805
<|skeleton|> class ShellServiceServicer: """* Allow to communicate with the vehicle's system shell.""" def Send(self, request, context): """Send a command line.""" <|body_0|> def SubscribeReceive(self, request, context): """Receive feedback from a sent command line. This subscripti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShellServiceServicer: """* Allow to communicate with the vehicle's system shell.""" def Send(self, request, context): """Send a command line.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method...
the_stack_v2_python_sparse
mavsdk/shell_pb2_grpc.py
PML-UCF/MAVSDK-Python
train
0