blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
a52f91dbb9cda4724de7e2dd31d4382edaa3deba
[ "p0 = list1\np1 = list2\nh0 = ListNode(-1)\nh = h0\nwhile p0 != None and p1 != None:\n if p0.val < p1.val:\n h.next = p0\n p0 = p0.next\n else:\n h.next = p1\n p1 = p1.next\n h = h.next\nif p0 != None:\n h.next = p0\nif p1 != None:\n h.next = p1\nreturn h0.next", "p0 = h...
<|body_start_0|> p0 = list1 p1 = list2 h0 = ListNode(-1) h = h0 while p0 != None and p1 != None: if p0.val < p1.val: h.next = p0 p0 = p0.next else: h.next = p1 p1 = p1.next h = h.n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKListsTwo(self, list1, list2): """使用归并的思想中的并处理""" <|body_0|> def midOfNode(self, head): """链表拆分成两半,返回后半部分""" <|body_1|> def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_009000
1,544
no_license
[ { "docstring": "使用归并的思想中的并处理", "name": "mergeKListsTwo", "signature": "def mergeKListsTwo(self, list1, list2)" }, { "docstring": "链表拆分成两半,返回后半部分", "name": "midOfNode", "signature": "def midOfNode(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": ...
3
stack_v2_sparse_classes_30k_train_012033
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKListsTwo(self, list1, list2): 使用归并的思想中的并处理 - def midOfNode(self, head): 链表拆分成两半,返回后半部分 - def sortList(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKListsTwo(self, list1, list2): 使用归并的思想中的并处理 - def midOfNode(self, head): 链表拆分成两半,返回后半部分 - def sortList(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> c...
4b30dd6a3f683c8dc71a85f7b947232613a28dc1
<|skeleton|> class Solution: def mergeKListsTwo(self, list1, list2): """使用归并的思想中的并处理""" <|body_0|> def midOfNode(self, head): """链表拆分成两半,返回后半部分""" <|body_1|> def sortList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeKListsTwo(self, list1, list2): """使用归并的思想中的并处理""" p0 = list1 p1 = list2 h0 = ListNode(-1) h = h0 while p0 != None and p1 != None: if p0.val < p1.val: h.next = p0 p0 = p0.next else: ...
the_stack_v2_python_sparse
链表排序_归并的方法.py
saintifly/leetcode
train
0
a17a9865b8223d0311da36e39f8dfc76193d3b8a
[ "self.first_name = first_name\nself.last_name = last_name\nself.address_boss = address_boss\nself.additional_properties = additional_properties\nsuper(BossCompany, self).__init__(address, cell_number, company_name, company)", "if dictionary is None:\n return None\naddress = dictionary.get('address')\naddress_b...
<|body_start_0|> self.first_name = first_name self.last_name = last_name self.address_boss = address_boss self.additional_properties = additional_properties super(BossCompany, self).__init__(address, cell_number, company_name, company) <|end_body_0|> <|body_start_1|> if ...
Implementation of the 'Boss_company' model. TODO: type model description here. NOTE: This class inherits from 'Company'. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. address_boss (string): TODO: type description here.
BossCompany
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BossCompany: """Implementation of the 'Boss_company' model. TODO: type model description here. NOTE: This class inherits from 'Company'. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. address_boss (string): TODO: type description her...
stack_v2_sparse_classes_75kplus_train_009001
16,075
permissive
[ { "docstring": "Constructor for the BossCompany class", "name": "__init__", "signature": "def __init__(self, address=None, address_boss=None, cell_number=None, company_name=None, first_name=None, last_name=None, company=None, additional_properties={})" }, { "docstring": "Creates an instance of t...
2
null
Implement the Python class `BossCompany` described below. Class description: Implementation of the 'Boss_company' model. TODO: type model description here. NOTE: This class inherits from 'Company'. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. address_bo...
Implement the Python class `BossCompany` described below. Class description: Implementation of the 'Boss_company' model. TODO: type model description here. NOTE: This class inherits from 'Company'. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. address_bo...
49acc3d416a1dde7ea43b178d070484baf1b7f2b
<|skeleton|> class BossCompany: """Implementation of the 'Boss_company' model. TODO: type model description here. NOTE: This class inherits from 'Company'. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. address_boss (string): TODO: type description her...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BossCompany: """Implementation of the 'Boss_company' model. TODO: type model description here. NOTE: This class inherits from 'Company'. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. address_boss (string): TODO: type description here.""" de...
the_stack_v2_python_sparse
PYTHON_GENERIC_LIB/tester/models/company.py
MaryamAdnan3/Tester1
train
0
bac7b7b23f10dcdd42adc1e2cd71e32dd23ca1e2
[ "report = view.report\nform_name = ('%s%s%s' % (slugify(report.name).title(), slugify(view.name).title(), 'ViewAggregationForm')).encode('ascii')\nindicators = [(i.pk, i.name) for i in report.indicators.all()]\nindicators += [(0, 'None of them')]\ntry:\n aggregator = Aggregator.objects.get(view=view)\n initia...
<|body_start_0|> report = view.report form_name = ('%s%s%s' % (slugify(report.name).title(), slugify(view.name).title(), 'ViewAggregationForm')).encode('ascii') indicators = [(i.pk, i.name) for i in report.indicators.all()] indicators += [(0, 'None of them')] try: agg...
Factory to create ViewAggregationForms on the fly.
ViewAggregationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewAggregationForm: """Factory to create ViewAggregationForms on the fly.""" def get_form(cls, view): """List all indicators in the view and make a choice list with it""" <|body_0|> def __new__(cls, *args, **kwargs): """Create the proper form according to the vi...
stack_v2_sparse_classes_75kplus_train_009002
5,190
no_license
[ { "docstring": "List all indicators in the view and make a choice list with it", "name": "get_form", "signature": "def get_form(cls, view)" }, { "docstring": "Create the proper form according to the view then instanciate the form with the proper args", "name": "__new__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_033415
Implement the Python class `ViewAggregationForm` described below. Class description: Factory to create ViewAggregationForms on the fly. Method signatures and docstrings: - def get_form(cls, view): List all indicators in the view and make a choice list with it - def __new__(cls, *args, **kwargs): Create the proper for...
Implement the Python class `ViewAggregationForm` described below. Class description: Factory to create ViewAggregationForms on the fly. Method signatures and docstrings: - def get_form(cls, view): List all indicators in the view and make a choice list with it - def __new__(cls, *args, **kwargs): Create the proper for...
15a4500ccb039e2d7e19dee2b0c5ce755e29da70
<|skeleton|> class ViewAggregationForm: """Factory to create ViewAggregationForms on the fly.""" def get_form(cls, view): """List all indicators in the view and make a choice list with it""" <|body_0|> def __new__(cls, *args, **kwargs): """Create the proper form according to the vi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ViewAggregationForm: """Factory to create ViewAggregationForms on the fly.""" def get_form(cls, view): """List all indicators in the view and make a choice list with it""" report = view.report form_name = ('%s%s%s' % (slugify(report.name).title(), slugify(view.name).title(), 'View...
the_stack_v2_python_sparse
django_mangrove/generic_report_admin/forms/_view_forms.py
joelimome/Mangrove
train
0
cc903b4de5c0c5ca45155821f9a66a5d8444a7ff
[ "buffer = bytearray()\nscratch = 0\nscratch_bits = 0\nfor index, data in enumerate(packet._raw):\n field = packet.FIELDS[index]\n bits_remaining = field.size\n while True:\n bits_used = min(8 - scratch_bits, bits_remaining)\n data_to_copy = data >> bits_remaining - bits_used\n bits_rem...
<|body_start_0|> buffer = bytearray() scratch = 0 scratch_bits = 0 for index, data in enumerate(packet._raw): field = packet.FIELDS[index] bits_remaining = field.size while True: bits_used = min(8 - scratch_bits, bits_remaining) ...
A class that serializes and deserializes packets to/from arrays of bytes.
PacketTranslator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PacketTranslator: """A class that serializes and deserializes packets to/from arrays of bytes.""" def serialize(self, packet): """Serializes a packet into an array of bytes. :param packet: The packet to serialize. :return: The serialized bytes.""" <|body_0|> def deserial...
stack_v2_sparse_classes_75kplus_train_009003
2,931
no_license
[ { "docstring": "Serializes a packet into an array of bytes. :param packet: The packet to serialize. :return: The serialized bytes.", "name": "serialize", "signature": "def serialize(self, packet)" }, { "docstring": "Deserializes a packet from an array of bytes. :param packet: The class of the pa...
2
stack_v2_sparse_classes_30k_train_014419
Implement the Python class `PacketTranslator` described below. Class description: A class that serializes and deserializes packets to/from arrays of bytes. Method signatures and docstrings: - def serialize(self, packet): Serializes a packet into an array of bytes. :param packet: The packet to serialize. :return: The ...
Implement the Python class `PacketTranslator` described below. Class description: A class that serializes and deserializes packets to/from arrays of bytes. Method signatures and docstrings: - def serialize(self, packet): Serializes a packet into an array of bytes. :param packet: The packet to serialize. :return: The ...
3490cf8bc89fd2c76f6fbafeec07134c28ae4d13
<|skeleton|> class PacketTranslator: """A class that serializes and deserializes packets to/from arrays of bytes.""" def serialize(self, packet): """Serializes a packet into an array of bytes. :param packet: The packet to serialize. :return: The serialized bytes.""" <|body_0|> def deserial...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PacketTranslator: """A class that serializes and deserializes packets to/from arrays of bytes.""" def serialize(self, packet): """Serializes a packet into an array of bytes. :param packet: The packet to serialize. :return: The serialized bytes.""" buffer = bytearray() scratch = 0 ...
the_stack_v2_python_sparse
common/packet.py
johndoknjas/Socket-Programming
train
0
d04950f9f010ad8b58cdea82af53bf9314aea11b
[ "self.language = language\nif language == 'en':\n f_pop = open(os.path.join(data_path, 'Eng_Pop.txt'))\n f_scarce = open(os.path.join(data_path, 'Eng_Scarce.txt'))\nelse:\n f_pop = open(os.path.join(data_path, 'Esp_Pop.txt'))\n f_scarce = open(os.path.join(data_path, 'Esp_Scarce.txt'))\nself.populous_ci...
<|body_start_0|> self.language = language if language == 'en': f_pop = open(os.path.join(data_path, 'Eng_Pop.txt')) f_scarce = open(os.path.join(data_path, 'Eng_Scarce.txt')) else: f_pop = open(os.path.join(data_path, 'Esp_Pop.txt')) f_scarce = ope...
ChangeCityNames
[ "MIT", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangeCityNames: def __init__(self, data_path, language='en'): """Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is "e...
stack_v2_sparse_classes_75kplus_train_009004
8,923
permissive
[ { "docstring": "Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is \"en\". Returns ------- None.", "name": "__init__", "signature": "de...
4
stack_v2_sparse_classes_30k_train_024701
Implement the Python class `ChangeCityNames` described below. Class description: Implement the ChangeCityNames class. Method signatures and docstrings: - def __init__(self, data_path, language='en'): Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous citi...
Implement the Python class `ChangeCityNames` described below. Class description: Implement the ChangeCityNames class. Method signatures and docstrings: - def __init__(self, data_path, language='en'): Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous citi...
619bc081fa506778526a1963d19a697367f1d553
<|skeleton|> class ChangeCityNames: def __init__(self, data_path, language='en'): """Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is "e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChangeCityNames: def __init__(self, data_path, language='en'): """Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is "en". Returns --...
the_stack_v2_python_sparse
transformations/city_names_transformation/transformation.py
dyrson11/NL-Augmenter
train
1
474e4dabbd2ade85f1a861cf7352dc5e4f04ce6c
[ "n = len(nums)\n\n@lru_cache(None)\ndef helper(i):\n \"\"\"True if we can arrive last when we start at i\"\"\"\n if i == n - 1:\n return True\n if i < 0 or i >= n:\n return False\n for j in range(1, nums[i] + 1):\n if helper(i + j):\n return True\n return False\nreturn...
<|body_start_0|> n = len(nums) @lru_cache(None) def helper(i): """True if we can arrive last when we start at i""" if i == n - 1: return True if i < 0 or i >= n: return False for j in range(1, nums[i] + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """Top-Down with Memoization, Time: O(n^2), Space: O(n), TLE""" <|body_0|> def canJump(self, nums: List[int]) -> bool: """Down-Top DP, Time: O(n^2), Space: O(n), TLE""" <|body_1|> def canJump(self, nu...
stack_v2_sparse_classes_75kplus_train_009005
1,569
no_license
[ { "docstring": "Top-Down with Memoization, Time: O(n^2), Space: O(n), TLE", "name": "canJump", "signature": "def canJump(self, nums: List[int]) -> bool" }, { "docstring": "Down-Top DP, Time: O(n^2), Space: O(n), TLE", "name": "canJump", "signature": "def canJump(self, nums: List[int]) ->...
3
stack_v2_sparse_classes_30k_train_002036
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: Top-Down with Memoization, Time: O(n^2), Space: O(n), TLE - def canJump(self, nums: List[int]) -> bool: Down-Top DP, Time: O(n^2), Spa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums: List[int]) -> bool: Top-Down with Memoization, Time: O(n^2), Space: O(n), TLE - def canJump(self, nums: List[int]) -> bool: Down-Top DP, Time: O(n^2), Spa...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def canJump(self, nums: List[int]) -> bool: """Top-Down with Memoization, Time: O(n^2), Space: O(n), TLE""" <|body_0|> def canJump(self, nums: List[int]) -> bool: """Down-Top DP, Time: O(n^2), Space: O(n), TLE""" <|body_1|> def canJump(self, nu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def canJump(self, nums: List[int]) -> bool: """Top-Down with Memoization, Time: O(n^2), Space: O(n), TLE""" n = len(nums) @lru_cache(None) def helper(i): """True if we can arrive last when we start at i""" if i == n - 1: return...
the_stack_v2_python_sparse
python/55-Jump Game.py
cwza/leetcode
train
0
afb3697be51a32a0b11bab897b51869c963d89c6
[ "super(SimpleTrainingRegimen, self).__init__(yaml_context=yaml_context, corpus_parser=corpus_parser, model=model, glob=glob, dev_every=dev_every, batcher=batcher, loss_calculator=loss_calculator, pretrained_model_file=pretrained_model_file, src_format=src_format, run_for_epochs=run_for_epochs, lr_decay=lr_decay, lr...
<|body_start_0|> super(SimpleTrainingRegimen, self).__init__(yaml_context=yaml_context, corpus_parser=corpus_parser, model=model, glob=glob, dev_every=dev_every, batcher=batcher, loss_calculator=loss_calculator, pretrained_model_file=pretrained_model_file, src_format=src_format, run_for_epochs=run_for_epochs, l...
SimpleTrainingRegimen
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleTrainingRegimen: def __init__(self, yaml_context, corpus_parser, model, glob={}, dev_every=0, batcher=None, loss_calculator=None, pretrained_model_file='', src_format='text', trainer=None, run_for_epochs=None, lr_decay=1.0, lr_decay_times=3, patience=1, initial_patience=None, dev_metrics='...
stack_v2_sparse_classes_75kplus_train_009006
14,373
permissive
[ { "docstring": ":param yaml_context: :param corpus_parser: an input.InputReader object :param model: a generator.GeneratorModel object :param dev_every (int): dev checkpoints every n sentences (0 for only after epoch) :param batcher: Type of batcher. Defaults to SrcBatcher of batch size 32. :param loss_calculat...
2
stack_v2_sparse_classes_30k_train_012278
Implement the Python class `SimpleTrainingRegimen` described below. Class description: Implement the SimpleTrainingRegimen class. Method signatures and docstrings: - def __init__(self, yaml_context, corpus_parser, model, glob={}, dev_every=0, batcher=None, loss_calculator=None, pretrained_model_file='', src_format='t...
Implement the Python class `SimpleTrainingRegimen` described below. Class description: Implement the SimpleTrainingRegimen class. Method signatures and docstrings: - def __init__(self, yaml_context, corpus_parser, model, glob={}, dev_every=0, batcher=None, loss_calculator=None, pretrained_model_file='', src_format='t...
742693eb9005a8a10a7137a379722553c4c19fe8
<|skeleton|> class SimpleTrainingRegimen: def __init__(self, yaml_context, corpus_parser, model, glob={}, dev_every=0, batcher=None, loss_calculator=None, pretrained_model_file='', src_format='text', trainer=None, run_for_epochs=None, lr_decay=1.0, lr_decay_times=3, patience=1, initial_patience=None, dev_metrics='...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleTrainingRegimen: def __init__(self, yaml_context, corpus_parser, model, glob={}, dev_every=0, batcher=None, loss_calculator=None, pretrained_model_file='', src_format='text', trainer=None, run_for_epochs=None, lr_decay=1.0, lr_decay_times=3, patience=1, initial_patience=None, dev_metrics='', schedule_me...
the_stack_v2_python_sparse
xnmt/training_regimen.py
john-hewitt/xnmt
train
0
325d78029ccca9948bbf2acd77fb356210f38035
[ "if len(args[1]) != 2:\n if len(args[1]) > 2:\n flash('Please select only 2 snapshots to view diffs')\n else:\n flash('Please select 2 snapshots to view diffs')\nelse:\n session['diff_files'] = args[1]\n return redirect(url_for('diffview.index'))", "for arg in args[1]:\n obj = Snapsho...
<|body_start_0|> if len(args[1]) != 2: if len(args[1]) > 2: flash('Please select only 2 snapshots to view diffs') else: flash('Please select 2 snapshots to view diffs') else: session['diff_files'] = args[1] return redirect(u...
Snapshot view
SnapshotsAdmin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapshotsAdmin: """Snapshot view""" def view_diffs(*args, **kwargs): """View the snapshot diffs""" <|body_0|> def view(*args, **kwargs): """View the snapshot""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(args[1]) != 2: if le...
stack_v2_sparse_classes_75kplus_train_009007
39,773
permissive
[ { "docstring": "View the snapshot diffs", "name": "view_diffs", "signature": "def view_diffs(*args, **kwargs)" }, { "docstring": "View the snapshot", "name": "view", "signature": "def view(*args, **kwargs)" } ]
2
null
Implement the Python class `SnapshotsAdmin` described below. Class description: Snapshot view Method signatures and docstrings: - def view_diffs(*args, **kwargs): View the snapshot diffs - def view(*args, **kwargs): View the snapshot
Implement the Python class `SnapshotsAdmin` described below. Class description: Snapshot view Method signatures and docstrings: - def view_diffs(*args, **kwargs): View the snapshot diffs - def view(*args, **kwargs): View the snapshot <|skeleton|> class SnapshotsAdmin: """Snapshot view""" def view_diffs(*arg...
629b84887dd0f0183b81efc8adb16817f985541a
<|skeleton|> class SnapshotsAdmin: """Snapshot view""" def view_diffs(*args, **kwargs): """View the snapshot diffs""" <|body_0|> def view(*args, **kwargs): """View the snapshot""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SnapshotsAdmin: """Snapshot view""" def view_diffs(*args, **kwargs): """View the snapshot diffs""" if len(args[1]) != 2: if len(args[1]) > 2: flash('Please select only 2 snapshots to view diffs') else: flash('Please select 2 snapshot...
the_stack_v2_python_sparse
applications/snapback/snapback.py
mrlesmithjr/acitoolkit
train
0
906a3b1da3d63be7b42cb78d9732d7d71f090419
[ "ret = []\nlevel_list = deque()\nif root is None:\n return []\nnode_queue = deque([root, None])\nis_order_left = True\nwhile len(node_queue) > 0:\n curr_node = node_queue.popleft()\n if curr_node:\n if is_order_left:\n level_list.append(curr_node.val)\n else:\n level_lis...
<|body_start_0|> ret = [] level_list = deque() if root is None: return [] node_queue = deque([root, None]) is_order_left = True while len(node_queue) > 0: curr_node = node_queue.popleft() if curr_node: if is_order_left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def zigzagLevelOrder(self, root: TreeNode): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def zigzagLevelOrderDFS(self, root: TreeNode): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_009008
2,368
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "zigzagLevelOrder", "signature": "def zigzagLevelOrder(self, root: TreeNode)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "zigzagLevelOrderDFS", "signature": "def zigzagLevelOrderDFS(self...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root: TreeNode): :type root: TreeNode :rtype: List[List[int]] - def zigzagLevelOrderDFS(self, root: TreeNode): :type root: TreeNode :rtype: List[List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root: TreeNode): :type root: TreeNode :rtype: List[List[int]] - def zigzagLevelOrderDFS(self, root: TreeNode): :type root: TreeNode :rtype: List[List[i...
3f3aa0cc869d7edf349691ecf1e057fd4aad2ab1
<|skeleton|> class Solution: def zigzagLevelOrder(self, root: TreeNode): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def zigzagLevelOrderDFS(self, root: TreeNode): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def zigzagLevelOrder(self, root: TreeNode): """:type root: TreeNode :rtype: List[List[int]]""" ret = [] level_list = deque() if root is None: return [] node_queue = deque([root, None]) is_order_left = True while len(node_queue) > 0:...
the_stack_v2_python_sparse
LeetCode_Python/LeetCode103.py
GDUT-Rp/LeetCode
train
2
1b3b8aef461926e771e8748320838a3fa9e19765
[ "class MixinCls(APICallMixin, SettingsMixin, InvenTreePlugin):\n NAME = 'Sample API Caller'\n SETTINGS = {'API_TOKEN': {'name': 'API Token', 'protected': True}, 'API_URL': {'name': 'External URL', 'description': 'Where is your API located?', 'default': 'https://api.github.com'}}\n API_URL_SETTING = 'API_UR...
<|body_start_0|> class MixinCls(APICallMixin, SettingsMixin, InvenTreePlugin): NAME = 'Sample API Caller' SETTINGS = {'API_TOKEN': {'name': 'API Token', 'protected': True}, 'API_URL': {'name': 'External URL', 'description': 'Where is your API located?', 'default': 'https://api.github.com...
Tests for APICallMixin.
APICallMixinTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APICallMixinTest: """Tests for APICallMixin.""" def setUp(self): """Setup for all tests.""" <|body_0|> def test_base_setup(self): """Test that the base settings work.""" <|body_1|> def test_args(self): """Test that building up args work.""" ...
stack_v2_sparse_classes_75kplus_train_009009
14,946
permissive
[ { "docstring": "Setup for all tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the base settings work.", "name": "test_base_setup", "signature": "def test_base_setup(self)" }, { "docstring": "Test that building up args work.", "name": "tes...
5
stack_v2_sparse_classes_30k_train_053394
Implement the Python class `APICallMixinTest` described below. Class description: Tests for APICallMixin. Method signatures and docstrings: - def setUp(self): Setup for all tests. - def test_base_setup(self): Test that the base settings work. - def test_args(self): Test that building up args work. - def test_api_call...
Implement the Python class `APICallMixinTest` described below. Class description: Tests for APICallMixin. Method signatures and docstrings: - def setUp(self): Setup for all tests. - def test_base_setup(self): Test that the base settings work. - def test_args(self): Test that building up args work. - def test_api_call...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class APICallMixinTest: """Tests for APICallMixin.""" def setUp(self): """Setup for all tests.""" <|body_0|> def test_base_setup(self): """Test that the base settings work.""" <|body_1|> def test_args(self): """Test that building up args work.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class APICallMixinTest: """Tests for APICallMixin.""" def setUp(self): """Setup for all tests.""" class MixinCls(APICallMixin, SettingsMixin, InvenTreePlugin): NAME = 'Sample API Caller' SETTINGS = {'API_TOKEN': {'name': 'API Token', 'protected': True}, 'API_URL': {'name...
the_stack_v2_python_sparse
InvenTree/plugin/base/integration/test_mixins.py
inventree/InvenTree
train
3,077
635c5bee25dbb5c2f14c3e1cb6c16f805c9dc727
[ "Company = self.old_state.apps.get_model('company', 'company')\ncustomer = Company.objects.create(name='My customer', description='A customer we sell stuff too', is_customer=True)\nSalesOrder = self.old_state.apps.get_model('order', 'salesorder')\nfor ii in range(5):\n order = SalesOrder.objects.create(reference...
<|body_start_0|> Company = self.old_state.apps.get_model('company', 'company') customer = Company.objects.create(name='My customer', description='A customer we sell stuff too', is_customer=True) SalesOrder = self.old_state.apps.get_model('order', 'salesorder') for ii in range(5): ...
Test data migration for the "SalesOrderShipment" model.
TestShipmentMigration
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestShipmentMigration: """Test data migration for the "SalesOrderShipment" model.""" def prepare(self): """Create an initial SalesOrder.""" <|body_0|> def test_shipment_creation(self): """Check that a SalesOrderShipment has been created.""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus_train_009010
7,688
permissive
[ { "docstring": "Create an initial SalesOrder.", "name": "prepare", "signature": "def prepare(self)" }, { "docstring": "Check that a SalesOrderShipment has been created.", "name": "test_shipment_creation", "signature": "def test_shipment_creation(self)" } ]
2
stack_v2_sparse_classes_30k_train_003979
Implement the Python class `TestShipmentMigration` described below. Class description: Test data migration for the "SalesOrderShipment" model. Method signatures and docstrings: - def prepare(self): Create an initial SalesOrder. - def test_shipment_creation(self): Check that a SalesOrderShipment has been created.
Implement the Python class `TestShipmentMigration` described below. Class description: Test data migration for the "SalesOrderShipment" model. Method signatures and docstrings: - def prepare(self): Create an initial SalesOrder. - def test_shipment_creation(self): Check that a SalesOrderShipment has been created. <|s...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class TestShipmentMigration: """Test data migration for the "SalesOrderShipment" model.""" def prepare(self): """Create an initial SalesOrder.""" <|body_0|> def test_shipment_creation(self): """Check that a SalesOrderShipment has been created.""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestShipmentMigration: """Test data migration for the "SalesOrderShipment" model.""" def prepare(self): """Create an initial SalesOrder.""" Company = self.old_state.apps.get_model('company', 'company') customer = Company.objects.create(name='My customer', description='A customer w...
the_stack_v2_python_sparse
InvenTree/order/test_migrations.py
inventree/InvenTree
train
3,077
b1dacffb0a10737c86f37d2d882f990282d604d1
[ "if not head:\n return []\nwhile head:\n if head.val == val:\n if head.next:\n head.val = head.next.val\n head.next = head.next.next\n else:\n return []\n else:\n break\nif not head:\n return []\nroot = head\npre = root\nhead = pre.next\nwhile head:\...
<|body_start_0|> if not head: return [] while head: if head.val == val: if head.next: head.val = head.next.val head.next = head.next.next else: return [] else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElements1(self, head: ListNode, val: int): """删除链表中等于给定值val的所有节点""" <|body_0|> def removeElements(self, head: ListNode, val: int): """删除链表中等于给定值val的所有节点""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: ret...
stack_v2_sparse_classes_75kplus_train_009011
1,661
no_license
[ { "docstring": "删除链表中等于给定值val的所有节点", "name": "removeElements1", "signature": "def removeElements1(self, head: ListNode, val: int)" }, { "docstring": "删除链表中等于给定值val的所有节点", "name": "removeElements", "signature": "def removeElements(self, head: ListNode, val: int)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements1(self, head: ListNode, val: int): 删除链表中等于给定值val的所有节点 - def removeElements(self, head: ListNode, val: int): 删除链表中等于给定值val的所有节点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements1(self, head: ListNode, val: int): 删除链表中等于给定值val的所有节点 - def removeElements(self, head: ListNode, val: int): 删除链表中等于给定值val的所有节点 <|skeleton|> class Solution: ...
2b9c78ba88e7bf74a46a287fb1914b4d6ba9af38
<|skeleton|> class Solution: def removeElements1(self, head: ListNode, val: int): """删除链表中等于给定值val的所有节点""" <|body_0|> def removeElements(self, head: ListNode, val: int): """删除链表中等于给定值val的所有节点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeElements1(self, head: ListNode, val: int): """删除链表中等于给定值val的所有节点""" if not head: return [] while head: if head.val == val: if head.next: head.val = head.next.val head.next = head.next.ne...
the_stack_v2_python_sparse
移除链表元素.py
Luckyaxah/leetcode-python
train
0
9805039ed80b415f06348d2180c36158d26ca0d2
[ "self.BERT_score_transform = BERT_Score_Transform(checkpoint_path, **kwargs)\nself.doc_resolver_transform = Document_Resolver_Transform(get_doc_fn)\nself.q_d_merge_transform = Query_Doc_Merge_Transform()\nself.BERT_numericalize_transform = BERT_Numericalise_Transform()\nself.key_fields = key_fields", "for sample_...
<|body_start_0|> self.BERT_score_transform = BERT_Score_Transform(checkpoint_path, **kwargs) self.doc_resolver_transform = Document_Resolver_Transform(get_doc_fn) self.q_d_merge_transform = Query_Doc_Merge_Transform() self.BERT_numericalize_transform = BERT_Numericalise_Transform() ...
BERT_ReRanker_Transform
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BERT_ReRanker_Transform: def __init__(self, checkpoint_path, get_doc_fn, key_fields={'query_field': 'query', 'target_field': 'search_results'}, **kwargs): """A Transform that reorders a list based on BERT query doc score checkpoint_path: str: path to only the state dict of the model, loa...
stack_v2_sparse_classes_75kplus_train_009012
24,876
no_license
[ { "docstring": "A Transform that reorders a list based on BERT query doc score checkpoint_path: str: path to only the state dict of the model, loaded with load_state_dict", "name": "__init__", "signature": "def __init__(self, checkpoint_path, get_doc_fn, key_fields={'query_field': 'query', 'target_field...
2
stack_v2_sparse_classes_30k_train_039019
Implement the Python class `BERT_ReRanker_Transform` described below. Class description: Implement the BERT_ReRanker_Transform class. Method signatures and docstrings: - def __init__(self, checkpoint_path, get_doc_fn, key_fields={'query_field': 'query', 'target_field': 'search_results'}, **kwargs): A Transform that r...
Implement the Python class `BERT_ReRanker_Transform` described below. Class description: Implement the BERT_ReRanker_Transform class. Method signatures and docstrings: - def __init__(self, checkpoint_path, get_doc_fn, key_fields={'query_field': 'query', 'target_field': 'search_results'}, **kwargs): A Transform that r...
92dd4d41ad6f2be5b5c4e296e2a355bb14b9a1db
<|skeleton|> class BERT_ReRanker_Transform: def __init__(self, checkpoint_path, get_doc_fn, key_fields={'query_field': 'query', 'target_field': 'search_results'}, **kwargs): """A Transform that reorders a list based on BERT query doc score checkpoint_path: str: path to only the state dict of the model, loa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BERT_ReRanker_Transform: def __init__(self, checkpoint_path, get_doc_fn, key_fields={'query_field': 'query', 'target_field': 'search_results'}, **kwargs): """A Transform that reorders a list based on BERT query doc score checkpoint_path: str: path to only the state dict of the model, loaded with load_...
the_stack_v2_python_sparse
notebooks/src/models_and_transforms/complex_transforms.py
carlos-gemmell/Glasgow-NLP
train
0
2614d1e11447753a478c4dbb944e624569250c78
[ "if not self.spectral_normalization:\n return partial(tf.keras.layers.Conv2D, kernel_size=(k, k), strides=(s, s), padding='SAME', activation=tf.nn.leaky_relu)\nelse:\n\n def conv_spectral_norm(net, filters, layer):\n in_channels = net.get_shape()[-1]\n weights = tf.get_variable('kernel/{}'.forma...
<|body_start_0|> if not self.spectral_normalization: return partial(tf.keras.layers.Conv2D, kernel_size=(k, k), strides=(s, s), padding='SAME', activation=tf.nn.leaky_relu) else: def conv_spectral_norm(net, filters, layer): in_channels = net.get_shape()[-1] ...
DCGAN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DCGAN: def get_conv(self, k=5, s=2, channels=1): """Get the convolution operation for this model. :param k: kernel size (uses same size for both dimensions by default). :param s: stride size (uses same size for both dimensions by default). :param channels: number of channels (should alwa...
stack_v2_sparse_classes_75kplus_train_009013
5,910
no_license
[ { "docstring": "Get the convolution operation for this model. :param k: kernel size (uses same size for both dimensions by default). :param s: stride size (uses same size for both dimensions by default). :param channels: number of channels (should always be 1). :return: a callable implementing the desired convo...
4
null
Implement the Python class `DCGAN` described below. Class description: Implement the DCGAN class. Method signatures and docstrings: - def get_conv(self, k=5, s=2, channels=1): Get the convolution operation for this model. :param k: kernel size (uses same size for both dimensions by default). :param s: stride size (us...
Implement the Python class `DCGAN` described below. Class description: Implement the DCGAN class. Method signatures and docstrings: - def get_conv(self, k=5, s=2, channels=1): Get the convolution operation for this model. :param k: kernel size (uses same size for both dimensions by default). :param s: stride size (us...
cbcdea5a6e7d82006646a593ae0408e5437ac24b
<|skeleton|> class DCGAN: def get_conv(self, k=5, s=2, channels=1): """Get the convolution operation for this model. :param k: kernel size (uses same size for both dimensions by default). :param s: stride size (uses same size for both dimensions by default). :param channels: number of channels (should alwa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DCGAN: def get_conv(self, k=5, s=2, channels=1): """Get the convolution operation for this model. :param k: kernel size (uses same size for both dimensions by default). :param s: stride size (uses same size for both dimensions by default). :param channels: number of channels (should always be 1). :ret...
the_stack_v2_python_sparse
fftracer/training/models/adversarial/dcgan.py
Asashou/ffn-tracer
train
0
1e355e32f09d4aaeb7f755e55e7c95da330b3f70
[ "node = eqnNode.spotByNumber(0).spotChain()[0].nodeRef\ntry:\n return node.formatRef.fieldDict[self.fieldName].mathValue(node, zeroBlanks, noMarkup)\nexcept KeyError:\n return zeroValue if zeroBlanks else None", "if 1 not in {len(spot.spotChain()) for spot in refNode.spotRefs}:\n return []\nrefs = [node ...
<|body_start_0|> node = eqnNode.spotByNumber(0).spotChain()[0].nodeRef try: return node.formatRef.fieldDict[self.fieldName].mathValue(node, zeroBlanks, noMarkup) except KeyError: return zeroValue if zeroBlanks else None <|end_body_0|> <|body_start_1|> if 1 not in...
Class to store and eval root node field references in a Math equation.
EquationRootRef
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EquationRootRef: """Class to store and eval root node field references in a Math equation.""" def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): """Return the root field value referenced from a given node. Return None if blank or doesn't exist and not zer...
stack_v2_sparse_classes_75kplus_train_009014
21,625
no_license
[ { "docstring": "Return the root field value referenced from a given node. Return None if blank or doesn't exist and not zeroBlanks, raise a ValueError if it isn't a number. Arguments: eqnNode -- the node containing the equation to evaluate zeroBlanks -- replace blank fields with zeroValue if True zeroValue -- t...
2
stack_v2_sparse_classes_30k_train_012519
Implement the Python class `EquationRootRef` described below. Class description: Class to store and eval root node field references in a Math equation. Method signatures and docstrings: - def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): Return the root field value referenced from a give...
Implement the Python class `EquationRootRef` described below. Class description: Class to store and eval root node field references in a Math equation. Method signatures and docstrings: - def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): Return the root field value referenced from a give...
c9429496e8ed15116746a23f3a90f262cf54f755
<|skeleton|> class EquationRootRef: """Class to store and eval root node field references in a Math equation.""" def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): """Return the root field value referenced from a given node. Return None if blank or doesn't exist and not zer...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EquationRootRef: """Class to store and eval root node field references in a Math equation.""" def referenceValue(self, eqnNode, zeroBlanks=True, zeroValue=0, noMarkup=True): """Return the root field value referenced from a given node. Return None if blank or doesn't exist and not zeroBlanks, rais...
the_stack_v2_python_sparse
source/matheval.py
doug-101/TreeLine
train
121
fa09705729613b29b27d4a87f6337ebe4334c9b5
[ "nums.sort()\nfor i in range(1, len(nums)):\n if nums[i] == nums[i - 1]:\n return True\nreturn False", "o = set(nums)\nif len(nums) != len(s):\n return True\nreturn False", "m = defaultdict(int)\nfor num in nums:\n if m[num]:\n return True\n m[num] += 1\nreturn False" ]
<|body_start_0|> nums.sort() for i in range(1, len(nums)): if nums[i] == nums[i - 1]: return True return False <|end_body_0|> <|body_start_1|> o = set(nums) if len(nums) != len(s): return True return False <|end_body_1|> <|body_st...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def contains_duplicate1(self, nums: List[int]) -> bool: """n(log(n)) Using sort with one loop :param nums: :return:""" <|body_0|> def contains_duplicate2(self, nums: List[int]) -> bool: """O(n), space = O(n) Using sort with one loop :param nums: :return:"""...
stack_v2_sparse_classes_75kplus_train_009015
1,740
permissive
[ { "docstring": "n(log(n)) Using sort with one loop :param nums: :return:", "name": "contains_duplicate1", "signature": "def contains_duplicate1(self, nums: List[int]) -> bool" }, { "docstring": "O(n), space = O(n) Using sort with one loop :param nums: :return:", "name": "contains_duplicate2"...
3
stack_v2_sparse_classes_30k_train_038786
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def contains_duplicate1(self, nums: List[int]) -> bool: n(log(n)) Using sort with one loop :param nums: :return: - def contains_duplicate2(self, nums: List[int]) -> bool: O(n), s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def contains_duplicate1(self, nums: List[int]) -> bool: n(log(n)) Using sort with one loop :param nums: :return: - def contains_duplicate2(self, nums: List[int]) -> bool: O(n), s...
47c406bda760c4fb3256150e0eacd2db80c2477e
<|skeleton|> class Solution: def contains_duplicate1(self, nums: List[int]) -> bool: """n(log(n)) Using sort with one loop :param nums: :return:""" <|body_0|> def contains_duplicate2(self, nums: List[int]) -> bool: """O(n), space = O(n) Using sort with one loop :param nums: :return:"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def contains_duplicate1(self, nums: List[int]) -> bool: """n(log(n)) Using sort with one loop :param nums: :return:""" nums.sort() for i in range(1, len(nums)): if nums[i] == nums[i - 1]: return True return False def contains_duplicate...
the_stack_v2_python_sparse
udemy_leetcode/Hash Map Facebook Interview Questions solutions/contain_duplicate.py
dipsuji/coding_pyhton
train
0
fb938e347bf9b77d209f21e161d2d52f76dfe45e
[ "tasks = []\nwith open(filename) as taskfile:\n file_contents = yaml.load(taskfile, Loader=yaml.BaseLoader)\n for taskdict in file_contents:\n tasks.append(Task(taskdict))\nreturn tasks", "with open(filename) as questionfile:\n file_contents = yaml.load(questionfile, Loader=yaml.BaseLoader)\n t...
<|body_start_0|> tasks = [] with open(filename) as taskfile: file_contents = yaml.load(taskfile, Loader=yaml.BaseLoader) for taskdict in file_contents: tasks.append(Task(taskdict)) return tasks <|end_body_0|> <|body_start_1|> with open(filename) a...
Read and write YAML files in a way that benefits the bot.
YAMLFileIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YAMLFileIO: """Read and write YAML files in a way that benefits the bot.""" def read_tasks(cls, filename): """Create tasks representing the ones in the file. The input file must be a YAML file, containing a list of dicts, each of them representing one task. Each task must have keys "...
stack_v2_sparse_classes_75kplus_train_009016
5,717
no_license
[ { "docstring": "Create tasks representing the ones in the file. The input file must be a YAML file, containing a list of dicts, each of them representing one task. Each task must have keys \"text\" and \"tasktype\", and may also contain any of the following: \"notes\", \"date\", \"difficulty\", \"uppable\" and ...
3
stack_v2_sparse_classes_30k_train_032314
Implement the Python class `YAMLFileIO` described below. Class description: Read and write YAML files in a way that benefits the bot. Method signatures and docstrings: - def read_tasks(cls, filename): Create tasks representing the ones in the file. The input file must be a YAML file, containing a list of dicts, each ...
Implement the Python class `YAMLFileIO` described below. Class description: Read and write YAML files in a way that benefits the bot. Method signatures and docstrings: - def read_tasks(cls, filename): Create tasks representing the ones in the file. The input file must be a YAML file, containing a list of dicts, each ...
f6c94c01fd72b63c38cfca20cf92960827a9eebd
<|skeleton|> class YAMLFileIO: """Read and write YAML files in a way that benefits the bot.""" def read_tasks(cls, filename): """Create tasks representing the ones in the file. The input file must be a YAML file, containing a list of dicts, each of them representing one task. Each task must have keys "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class YAMLFileIO: """Read and write YAML files in a way that benefits the bot.""" def read_tasks(cls, filename): """Create tasks representing the ones in the file. The input file must be a YAML file, containing a list of dicts, each of them representing one task. Each task must have keys "text" and "ta...
the_stack_v2_python_sparse
habot/io/yaml.py
bgigous/habot
train
0
6b914d2d05aa8965de3cb9676c420d51a2758717
[ "super().__init__(*args, **kwargs)\nself.full_model_name = full_model_name\nself.app_name, self.related_model_name = full_model_name.split('.')\nself.label = full_model_name\nself.known_models = RegisteredModels()", "if isinstance(value, Model):\n return value\nif isinstance(value, int):\n model_class = sel...
<|body_start_0|> super().__init__(*args, **kwargs) self.full_model_name = full_model_name self.app_name, self.related_model_name = full_model_name.split('.') self.label = full_model_name self.known_models = RegisteredModels() <|end_body_0|> <|body_start_1|> if isinstance...
Field representing a model. ForeignKey relation is modeled with this field.
ModelField
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelField: """Field representing a model. ForeignKey relation is modeled with this field.""" def __init__(self, full_model_name: str, *args, **kwargs): """Initialize.""" <|body_0|> def to_python(self, value): """Return the python object representing the field.""...
stack_v2_sparse_classes_75kplus_train_009017
19,131
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, full_model_name: str, *args, **kwargs)" }, { "docstring": "Return the python object representing the field.", "name": "to_python", "signature": "def to_python(self, value)" }, { "docstring": "Conve...
3
stack_v2_sparse_classes_30k_train_039879
Implement the Python class `ModelField` described below. Class description: Field representing a model. ForeignKey relation is modeled with this field. Method signatures and docstrings: - def __init__(self, full_model_name: str, *args, **kwargs): Initialize. - def to_python(self, value): Return the python object repr...
Implement the Python class `ModelField` described below. Class description: Field representing a model. ForeignKey relation is modeled with this field. Method signatures and docstrings: - def __init__(self, full_model_name: str, *args, **kwargs): Initialize. - def to_python(self, value): Return the python object repr...
25c0c45235ef37beb45c1af4c917fbbae6282016
<|skeleton|> class ModelField: """Field representing a model. ForeignKey relation is modeled with this field.""" def __init__(self, full_model_name: str, *args, **kwargs): """Initialize.""" <|body_0|> def to_python(self, value): """Return the python object representing the field.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelField: """Field representing a model. ForeignKey relation is modeled with this field.""" def __init__(self, full_model_name: str, *args, **kwargs): """Initialize.""" super().__init__(*args, **kwargs) self.full_model_name = full_model_name self.app_name, self.related_m...
the_stack_v2_python_sparse
resolwe/process/models.py
genialis/resolwe
train
35
4bff64b5ea30f00bceac84482cd4ab24f3a15ed2
[ "super(DefaultStaticAssetPolicy, self).__init__(config)\nself.settings = config.registry.settings\nself.views = {}", "cache_max_age = self.settings.get('websauna.cache_max_age_seconds')\nif cache_max_age:\n cache_max_age = int(cache_max_age)\nself.config.add_static_view(name, path, cache_max_age=cache_max_age)...
<|body_start_0|> super(DefaultStaticAssetPolicy, self).__init__(config) self.settings = config.registry.settings self.views = {} <|end_body_0|> <|body_start_1|> cache_max_age = self.settings.get('websauna.cache_max_age_seconds') if cache_max_age: cache_max_age = int(...
Default inplementation of StaticAssetPolicy.
DefaultStaticAssetPolicy
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultStaticAssetPolicy: """Default inplementation of StaticAssetPolicy.""" def __init__(self, config: Configurator): """Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.""" <|body_0|> def add_static_view(self, name: str, path: str): """Include...
stack_v2_sparse_classes_75kplus_train_009018
9,928
permissive
[ { "docstring": "Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.", "name": "__init__", "signature": "def __init__(self, config: Configurator)" }, { "docstring": "Include a path in static assets and configures cache busting for it. This does not only include the static resource...
3
stack_v2_sparse_classes_30k_train_009048
Implement the Python class `DefaultStaticAssetPolicy` described below. Class description: Default inplementation of StaticAssetPolicy. Method signatures and docstrings: - def __init__(self, config: Configurator): Initialize DefaultStaticAssetPolicy. :param config: Pyramid config. - def add_static_view(self, name: str...
Implement the Python class `DefaultStaticAssetPolicy` described below. Class description: Default inplementation of StaticAssetPolicy. Method signatures and docstrings: - def __init__(self, config: Configurator): Initialize DefaultStaticAssetPolicy. :param config: Pyramid config. - def add_static_view(self, name: str...
a57de54fb8a3fae859f24f373f0292e1e4b3c344
<|skeleton|> class DefaultStaticAssetPolicy: """Default inplementation of StaticAssetPolicy.""" def __init__(self, config: Configurator): """Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.""" <|body_0|> def add_static_view(self, name: str, path: str): """Include...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultStaticAssetPolicy: """Default inplementation of StaticAssetPolicy.""" def __init__(self, config: Configurator): """Initialize DefaultStaticAssetPolicy. :param config: Pyramid config.""" super(DefaultStaticAssetPolicy, self).__init__(config) self.settings = config.registry.s...
the_stack_v2_python_sparse
websauna/system/http/static.py
websauna/websauna
train
294
02149f738b297e4e34d37d5194d23764b53f5b04
[ "self.env.revert_snapshot('ready_with_5_slaves')\nself.prepare_plugin()\nself.helpers.fuel_createmirror()\nself.helpers.create_cluster(name=self.__class__.__name__)\nself.activate_plugin()\nself.helpers.deploy_cluster({'slave-01': ['controller'], 'slave-02': ['controller'], 'slave-03': ['controller'], 'slave-04': [...
<|body_start_0|> self.env.revert_snapshot('ready_with_5_slaves') self.prepare_plugin() self.helpers.fuel_createmirror() self.helpers.create_cluster(name=self.__class__.__name__) self.activate_plugin() self.helpers.deploy_cluster({'slave-01': ['controller'], 'slave-02': ['...
Class for system testing the Zabbix plugin.
TestZabbixPluginSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestZabbixPluginSystem: """Class for system testing the Zabbix plugin.""" def deploy_zabbix_ha_offline(self): """Run fuel-createmirror and deploy environment Scenario: 1. Copy Zabbix plugin to the Fuel Master node and install the plugin. 2. Run the following command on the master nod...
stack_v2_sparse_classes_75kplus_train_009019
6,549
no_license
[ { "docstring": "Run fuel-createmirror and deploy environment Scenario: 1. Copy Zabbix plugin to the Fuel Master node and install the plugin. 2. Run the following command on the master node: fuel-createmirror 3. Create an environment with enabled plugin in the Fuel Web UI and deploy it. 4. Run OSTF. Duration 60m...
2
null
Implement the Python class `TestZabbixPluginSystem` described below. Class description: Class for system testing the Zabbix plugin. Method signatures and docstrings: - def deploy_zabbix_ha_offline(self): Run fuel-createmirror and deploy environment Scenario: 1. Copy Zabbix plugin to the Fuel Master node and install t...
Implement the Python class `TestZabbixPluginSystem` described below. Class description: Class for system testing the Zabbix plugin. Method signatures and docstrings: - def deploy_zabbix_ha_offline(self): Run fuel-createmirror and deploy environment Scenario: 1. Copy Zabbix plugin to the Fuel Master node and install t...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestZabbixPluginSystem: """Class for system testing the Zabbix plugin.""" def deploy_zabbix_ha_offline(self): """Run fuel-createmirror and deploy environment Scenario: 1. Copy Zabbix plugin to the Fuel Master node and install the plugin. 2. Run the following command on the master nod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestZabbixPluginSystem: """Class for system testing the Zabbix plugin.""" def deploy_zabbix_ha_offline(self): """Run fuel-createmirror and deploy environment Scenario: 1. Copy Zabbix plugin to the Fuel Master node and install the plugin. 2. Run the following command on the master node: fuel-creat...
the_stack_v2_python_sparse
stacklight_tests/zabbix/test_system.py
rkhozinov/stacklight-integration-tests
train
1
4f50754d0b54b21756753e73d486c9418fb8db90
[ "assert isinstance(input_size, tuple), 'Input size must be a tuple (input_width, input_height)'\nself.input_size = input_size[:2]\nassert isinstance(width_shift_range, int) or isinstance(width_shift_range, float), 'width_shift_range must be an int ora a float'\nif isinstance(width_shift_range, int):\n assert wid...
<|body_start_0|> assert isinstance(input_size, tuple), 'Input size must be a tuple (input_width, input_height)' self.input_size = input_size[:2] assert isinstance(width_shift_range, int) or isinstance(width_shift_range, float), 'width_shift_range must be an int ora a float' if isinstance...
SpectrogramShift
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectrogramShift: def __init__(self, input_size, width_shift_range, shift_prob=1.0, left=False, random_side=False): """Callable that shift a spectrogram using numpy Args: - input_size: size of the spectrogram - width_shift_range: range of the shift OPTIONAL: - shift_prob: probability to ...
stack_v2_sparse_classes_75kplus_train_009020
5,592
no_license
[ { "docstring": "Callable that shift a spectrogram using numpy Args: - input_size: size of the spectrogram - width_shift_range: range of the shift OPTIONAL: - shift_prob: probability to have shifting - left: True if left shifting - random_side: True to decide randomly if left or right shift", "name": "__init...
2
stack_v2_sparse_classes_30k_train_007980
Implement the Python class `SpectrogramShift` described below. Class description: Implement the SpectrogramShift class. Method signatures and docstrings: - def __init__(self, input_size, width_shift_range, shift_prob=1.0, left=False, random_side=False): Callable that shift a spectrogram using numpy Args: - input_size...
Implement the Python class `SpectrogramShift` described below. Class description: Implement the SpectrogramShift class. Method signatures and docstrings: - def __init__(self, input_size, width_shift_range, shift_prob=1.0, left=False, random_side=False): Callable that shift a spectrogram using numpy Args: - input_size...
efaf7c637e8387116d0eea37a0a173bb65bbccc9
<|skeleton|> class SpectrogramShift: def __init__(self, input_size, width_shift_range, shift_prob=1.0, left=False, random_side=False): """Callable that shift a spectrogram using numpy Args: - input_size: size of the spectrogram - width_shift_range: range of the shift OPTIONAL: - shift_prob: probability to ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpectrogramShift: def __init__(self, input_size, width_shift_range, shift_prob=1.0, left=False, random_side=False): """Callable that shift a spectrogram using numpy Args: - input_size: size of the spectrogram - width_shift_range: range of the shift OPTIONAL: - shift_prob: probability to have shifting ...
the_stack_v2_python_sparse
core/data_augmentation/image_transformations.py
EmanueleMusumeci/UrbanSound8K-CNN-sound-classification
train
1
23daaba19348f375b76accf7ab3ec6c20471ac30
[ "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...
慢钱宝app精彩服务api
ICouponRecordShowServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ICouponRecordShowServiceServicer: """慢钱宝app精彩服务api""" def getCouponRecordById(self, request, context): """getCouponRecordById""" <|body_0|> def getCouponRecordByUserIdAndExpiredPaging(self, request, context): """根据用户id和是否失效以及类型获取优惠券记录页""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus_train_009021
2,742
no_license
[ { "docstring": "getCouponRecordById", "name": "getCouponRecordById", "signature": "def getCouponRecordById(self, request, context)" }, { "docstring": "根据用户id和是否失效以及类型获取优惠券记录页", "name": "getCouponRecordByUserIdAndExpiredPaging", "signature": "def getCouponRecordByUserIdAndExpiredPaging(se...
2
stack_v2_sparse_classes_30k_train_014147
Implement the Python class `ICouponRecordShowServiceServicer` described below. Class description: 慢钱宝app精彩服务api Method signatures and docstrings: - def getCouponRecordById(self, request, context): getCouponRecordById - def getCouponRecordByUserIdAndExpiredPaging(self, request, context): 根据用户id和是否失效以及类型获取优惠券记录页
Implement the Python class `ICouponRecordShowServiceServicer` described below. Class description: 慢钱宝app精彩服务api Method signatures and docstrings: - def getCouponRecordById(self, request, context): getCouponRecordById - def getCouponRecordByUserIdAndExpiredPaging(self, request, context): 根据用户id和是否失效以及类型获取优惠券记录页 <|ske...
08e9ca1f3e3c091756f8774f1b58055dd80d1e90
<|skeleton|> class ICouponRecordShowServiceServicer: """慢钱宝app精彩服务api""" def getCouponRecordById(self, request, context): """getCouponRecordById""" <|body_0|> def getCouponRecordByUserIdAndExpiredPaging(self, request, context): """根据用户id和是否失效以及类型获取优惠券记录页""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ICouponRecordShowServiceServicer: """慢钱宝app精彩服务api""" def getCouponRecordById(self, request, context): """getCouponRecordById""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented...
the_stack_v2_python_sparse
ICouponRecordService_pb2_grpc.py
qianbingbing/apitest
train
0
2b359d6db42ad1456a284127373bd437ce5f25cb
[ "with self._lock:\n if not self._done:\n self._Print('.')\nreturn self._done", "if self._spinner_only or not self._output_enabled:\n return\ndisplay_message = self._GetPrefix()\nself._stream.write(message or display_message + '\\n')\nreturn" ]
<|body_start_0|> with self._lock: if not self._done: self._Print('.') return self._done <|end_body_0|> <|body_start_1|> if self._spinner_only or not self._output_enabled: return display_message = self._GetPrefix() self._stream.write(messag...
A context manager for telling the user about long-running progress.
_NonInteractiveProgressTracker
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _NonInteractiveProgressTracker: """A context manager for telling the user about long-running progress.""" def Tick(self): """Give a visual indication to the user that some progress has been made. Output is sent to sys.stderr. Nothing is shown if output is not a TTY. Returns: Whether ...
stack_v2_sparse_classes_75kplus_train_009022
47,411
permissive
[ { "docstring": "Give a visual indication to the user that some progress has been made. Output is sent to sys.stderr. Nothing is shown if output is not a TTY. Returns: Whether progress has completed.", "name": "Tick", "signature": "def Tick(self)" }, { "docstring": "Reprints the prefix followed b...
2
stack_v2_sparse_classes_30k_train_046784
Implement the Python class `_NonInteractiveProgressTracker` described below. Class description: A context manager for telling the user about long-running progress. Method signatures and docstrings: - def Tick(self): Give a visual indication to the user that some progress has been made. Output is sent to sys.stderr. N...
Implement the Python class `_NonInteractiveProgressTracker` described below. Class description: A context manager for telling the user about long-running progress. Method signatures and docstrings: - def Tick(self): Give a visual indication to the user that some progress has been made. Output is sent to sys.stderr. N...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class _NonInteractiveProgressTracker: """A context manager for telling the user about long-running progress.""" def Tick(self): """Give a visual indication to the user that some progress has been made. Output is sent to sys.stderr. Nothing is shown if output is not a TTY. Returns: Whether ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _NonInteractiveProgressTracker: """A context manager for telling the user about long-running progress.""" def Tick(self): """Give a visual indication to the user that some progress has been made. Output is sent to sys.stderr. Nothing is shown if output is not a TTY. Returns: Whether progress has ...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/core/console/progress_tracker.py
bopopescu/socialliteapp
train
0
46ef82fc24bc8140fe63e8b26b8f7c29c5611b47
[ "self.name = name\nself.metalearning = metalearning\nself.local_algo = local_algo\nself.stopping = self.StoppingCriteria(metalearning_steps=metalearning_steps)", "params = AlgoProto.LTFB()\nparams.stopping_criteria.CopyFrom(self.stopping.export_proto())\nparams.meta_learning_strategy.Pack(self.metalearning.export...
<|body_start_0|> self.name = name self.metalearning = metalearning self.local_algo = local_algo self.stopping = self.StoppingCriteria(metalearning_steps=metalearning_steps) <|end_body_0|> <|body_start_1|> params = AlgoProto.LTFB() params.stopping_criteria.CopyFrom(self.s...
Livermore tournament fast-batch (LTFB) algorithm. This training algorithm is a simple composite training algorithm. The MPI universe is subdivided into several "trainers". Each trainer applies a local training algorithm. At the completion of local training, a metaheuristic ("metalearning" algorithm) is applied to selec...
LTFB
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LTFB: """Livermore tournament fast-batch (LTFB) algorithm. This training algorithm is a simple composite training algorithm. The MPI universe is subdivided into several "trainers". Each trainer applies a local training algorithm. At the completion of local training, a metaheuristic ("metalearning...
stack_v2_sparse_classes_75kplus_train_009023
18,905
permissive
[ { "docstring": "Construct a new LTFB algorithm. Args: name: A user-defined name to identify this object in logs. local_algo: The trainer-local algorithm to apply. metalearning: The metalearning strategy to apply after local training. metalearning_steps: The number of outer-loop iterations.", "name": "__init...
2
null
Implement the Python class `LTFB` described below. Class description: Livermore tournament fast-batch (LTFB) algorithm. This training algorithm is a simple composite training algorithm. The MPI universe is subdivided into several "trainers". Each trainer applies a local training algorithm. At the completion of local t...
Implement the Python class `LTFB` described below. Class description: Livermore tournament fast-batch (LTFB) algorithm. This training algorithm is a simple composite training algorithm. The MPI universe is subdivided into several "trainers". Each trainer applies a local training algorithm. At the completion of local t...
e8cf85eed2acbd3383892bf7cb2d88b44c194f4f
<|skeleton|> class LTFB: """Livermore tournament fast-batch (LTFB) algorithm. This training algorithm is a simple composite training algorithm. The MPI universe is subdivided into several "trainers". Each trainer applies a local training algorithm. At the completion of local training, a metaheuristic ("metalearning...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LTFB: """Livermore tournament fast-batch (LTFB) algorithm. This training algorithm is a simple composite training algorithm. The MPI universe is subdivided into several "trainers". Each trainer applies a local training algorithm. At the completion of local training, a metaheuristic ("metalearning" algorithm) ...
the_stack_v2_python_sparse
python/lbann/core/training_algorithm.py
LLNL/lbann
train
225
f2af16fa7a365800e12530d82ea924a71422ffb8
[ "parser = argparse.ArgumentParser(description='This is the front end of the ExaHyPE code generator.')\nfor arg in ArgumentParser.args:\n key = arg[0]\n type = arg[1]\n info = arg[2]\n if type == ArgumentParser.ArgType.MandatoryString:\n parser.add_argument(key, help=info)\n elif type == Argume...
<|body_start_0|> parser = argparse.ArgumentParser(description='This is the front end of the ExaHyPE code generator.') for arg in ArgumentParser.args: key = arg[0] type = arg[1] info = arg[2] if type == ArgumentParser.ArgType.MandatoryString: ...
Public API
ArgumentParser
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgumentParser: """Public API""" def parseArgs(): """Process the command line arguments""" <|body_0|> def validateInputConfig(inputConfig): """Validate a config and add the default value of missing optional arguments""" <|body_1|> def buildCommandLin...
stack_v2_sparse_classes_75kplus_train_009024
7,542
permissive
[ { "docstring": "Process the command line arguments", "name": "parseArgs", "signature": "def parseArgs()" }, { "docstring": "Validate a config and add the default value of missing optional arguments", "name": "validateInputConfig", "signature": "def validateInputConfig(inputConfig)" }, ...
3
stack_v2_sparse_classes_30k_train_037305
Implement the Python class `ArgumentParser` described below. Class description: Public API Method signatures and docstrings: - def parseArgs(): Process the command line arguments - def validateInputConfig(inputConfig): Validate a config and add the default value of missing optional arguments - def buildCommandLineFro...
Implement the Python class `ArgumentParser` described below. Class description: Public API Method signatures and docstrings: - def parseArgs(): Process the command line arguments - def validateInputConfig(inputConfig): Validate a config and add the default value of missing optional arguments - def buildCommandLineFro...
714a6052a8accace0235fd2483566d7e9cbacb0a
<|skeleton|> class ArgumentParser: """Public API""" def parseArgs(): """Process the command line arguments""" <|body_0|> def validateInputConfig(inputConfig): """Validate a config and add the default value of missing optional arguments""" <|body_1|> def buildCommandLin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArgumentParser: """Public API""" def parseArgs(): """Process the command line arguments""" parser = argparse.ArgumentParser(description='This is the front end of the ExaHyPE code generator.') for arg in ArgumentParser.args: key = arg[0] type = arg[1] ...
the_stack_v2_python_sparse
CodeGenerator/codegenerator/argumentParser.py
annereinarz/ExaHyPE-Workshop-Engine
train
2
3f7f3dfdef9347112e6a925cf4a6e1aef9642d44
[ "if not number:\n raise ValueError('\"number\" must not be empty.')\ntry:\n return cls.objects.create(phone_number=number)\nexcept IntegrityError:\n return None", "if not number:\n raise ValueError('\"number\" must not be empty.')\nnumber = cls.objects.filter(phone_number=number).only('id')\nif not nu...
<|body_start_0|> if not number: raise ValueError('"number" must not be empty.') try: return cls.objects.create(phone_number=number) except IntegrityError: return None <|end_body_0|> <|body_start_1|> if not number: raise ValueError('"number...
SuspiciousPhoneNumbers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuspiciousPhoneNumbers: def add(cls, number): """Creates and returns new record with banned phone number. :param number: phone number that should be added into the ban. :returns: BannedPhoneNumbers record - if number was successfully added into ban. None - if the number already present i...
stack_v2_sparse_classes_75kplus_train_009025
3,941
no_license
[ { "docstring": "Creates and returns new record with banned phone number. :param number: phone number that should be added into the ban. :returns: BannedPhoneNumbers record - if number was successfully added into ban. None - if the number already present in the ban. :raises: ValueError - if \"number\" is empty."...
3
stack_v2_sparse_classes_30k_test_002503
Implement the Python class `SuspiciousPhoneNumbers` described below. Class description: Implement the SuspiciousPhoneNumbers class. Method signatures and docstrings: - def add(cls, number): Creates and returns new record with banned phone number. :param number: phone number that should be added into the ban. :returns...
Implement the Python class `SuspiciousPhoneNumbers` described below. Class description: Implement the SuspiciousPhoneNumbers class. Method signatures and docstrings: - def add(cls, number): Creates and returns new record with banned phone number. :param number: phone number that should be added into the ban. :returns...
c060941b16c36d258989206f9c2143b5179b4acd
<|skeleton|> class SuspiciousPhoneNumbers: def add(cls, number): """Creates and returns new record with banned phone number. :param number: phone number that should be added into the ban. :returns: BannedPhoneNumbers record - if number was successfully added into ban. None - if the number already present i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SuspiciousPhoneNumbers: def add(cls, number): """Creates and returns new record with banned phone number. :param number: phone number that should be added into the ban. :returns: BannedPhoneNumbers record - if number was successfully added into ban. None - if the number already present in the ban. :ra...
the_stack_v2_python_sparse
core/managing/ban/models.py
HaySayCheese/mappino
train
0
2bcf0cc7e7c6718e9d8bfec07058cb2e656241a4
[ "n = len(nums)\nfor i in range(n):\n nums[nums[i] % (n + 1) - 1] += n + 1\ndissappeared = []\nfor i in range(n):\n if nums[i] / (n + 1) == 2:\n dissappeared.append(i + 1)\nreturn dissappeared", "res = []\nfor x in nums:\n if nums[abs(x) - 1] < 0:\n res.append(abs(x))\n else:\n num...
<|body_start_0|> n = len(nums) for i in range(n): nums[nums[i] % (n + 1) - 1] += n + 1 dissappeared = [] for i in range(n): if nums[i] / (n + 1) == 2: dissappeared.append(i + 1) return dissappeared <|end_body_0|> <|body_start_1|> r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) ...
stack_v2_sparse_classes_75kplus_train_009026
1,575
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers", "signature": "def findDisappearedNumbers(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDuplicates", "signature": "def findDuplicates(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_053258
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] - def findDuplicates(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class Solu...
058b6d6139a0d9b019547ae7b53a4e74fa114a8b
<|skeleton|> class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDuplicates(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" n = len(nums) for i in range(n): nums[nums[i] % (n + 1) - 1] += n + 1 dissappeared = [] for i in range(n): if nums[i] / (n + 1) == 2: ...
the_stack_v2_python_sparse
01_Arrays/442_Number_Duplicates/NumberDuplicates.py
dtran39/Programming_Preparation
train
0
c850878e683141c17d0e4e16c25ae0d4d2c4c175
[ "Presentation.__init__(self, pere, chapitre, attribut, False)\nif pere and chapitre:\n self.construire(chapitre)", "titre = self.ajouter_choix('titre', 't', Uniligne, chapitre, 'titre')\ntitre.parent = self\ntitre.prompt = 'Titre du chapitre : '\ntitre.apercu = '{objet.titre}'\ntitre.aide_courte = 'Entrez le |...
<|body_start_0|> Presentation.__init__(self, pere, chapitre, attribut, False) if pere and chapitre: self.construire(chapitre) <|end_body_0|> <|body_start_1|> titre = self.ajouter_choix('titre', 't', Uniligne, chapitre, 'titre') titre.parent = self titre.prompt = 'Tit...
Ce contexte permet d'éditer un chapitre d'un livre.
EdtChapitre
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdtChapitre: """Ce contexte permet d'éditer un chapitre d'un livre.""" def __init__(self, pere, chapitre=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def construire(self, chapitre): """Construction de l'éditeur""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_75kplus_train_009027
3,068
permissive
[ { "docstring": "Constructeur de l'éditeur", "name": "__init__", "signature": "def __init__(self, pere, chapitre=None, attribut=None)" }, { "docstring": "Construction de l'éditeur", "name": "construire", "signature": "def construire(self, chapitre)" } ]
2
stack_v2_sparse_classes_30k_train_023780
Implement the Python class `EdtChapitre` described below. Class description: Ce contexte permet d'éditer un chapitre d'un livre. Method signatures and docstrings: - def __init__(self, pere, chapitre=None, attribut=None): Constructeur de l'éditeur - def construire(self, chapitre): Construction de l'éditeur
Implement the Python class `EdtChapitre` described below. Class description: Ce contexte permet d'éditer un chapitre d'un livre. Method signatures and docstrings: - def __init__(self, pere, chapitre=None, attribut=None): Constructeur de l'éditeur - def construire(self, chapitre): Construction de l'éditeur <|skeleton...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class EdtChapitre: """Ce contexte permet d'éditer un chapitre d'un livre.""" def __init__(self, pere, chapitre=None, attribut=None): """Constructeur de l'éditeur""" <|body_0|> def construire(self, chapitre): """Construction de l'éditeur""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EdtChapitre: """Ce contexte permet d'éditer un chapitre d'un livre.""" def __init__(self, pere, chapitre=None, attribut=None): """Constructeur de l'éditeur""" Presentation.__init__(self, pere, chapitre, attribut, False) if pere and chapitre: self.construire(chapitre) ...
the_stack_v2_python_sparse
src/primaires/objet/types/editeurs/chapitre.py
vincent-lg/tsunami
train
5
28aafb3b6ad9509c895a524e3995edbf38b4a51a
[ "self._move_speed = move_speed\nself._pure_state = pure_state\nsuper(Humanoid, self).__init__(random=random)", "penetrating = True\nwhile penetrating:\n randomizers.randomize_limited_and_rotational_joints(physics, self.random)\n physics.after_reset()\n penetrating = physics.data.ncon > 0\nsuper(Humanoid,...
<|body_start_0|> self._move_speed = move_speed self._pure_state = pure_state super(Humanoid, self).__init__(random=random) <|end_body_0|> <|body_start_1|> penetrating = True while penetrating: randomizers.randomize_limited_and_rotational_joints(physics, self.random) ...
A humanoid task.
Humanoid
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Humanoid: """A humanoid task.""" def __init__(self, move_speed, pure_state, random=None): """Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the ...
stack_v2_sparse_classes_75kplus_train_009028
8,099
permissive
[ { "docstring": "Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the walking task. pure_state: A bool. Whether the observations consist of the pure MuJoCo state or includes s...
4
stack_v2_sparse_classes_30k_train_004487
Implement the Python class `Humanoid` described below. Class description: A humanoid task. Method signatures and docstrings: - def __init__(self, move_speed, pure_state, random=None): Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Other...
Implement the Python class `Humanoid` described below. Class description: A humanoid task. Method signatures and docstrings: - def __init__(self, move_speed, pure_state, random=None): Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Other...
33d3ea2682409ee82bf9c5129ceaf06ab01cd48e
<|skeleton|> class Humanoid: """A humanoid task.""" def __init__(self, move_speed, pure_state, random=None): """Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Humanoid: """A humanoid task.""" def __init__(self, move_speed, pure_state, random=None): """Initializes an instance of `Humanoid`. Args: move_speed: A float. If this value is zero, reward is given simply for standing up. Otherwise this specifies a target horizontal velocity for the walking task....
the_stack_v2_python_sparse
src/env/dm_control/dm_control/suite/humanoid.py
nicklashansen/svea-vit
train
16
1353c919d66c5f3e513d464c3fa7692a10cdecec
[ "if not quota_max_calls:\n use_rate_limiter = False\nself._apps = None\nself._app_services = None\nself._service_versions = None\nself._version_instances = None\nsuper(AppEngineRepositoryClient, self).__init__(API_NAME, versions=['v1'], quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limiter...
<|body_start_0|> if not quota_max_calls: use_rate_limiter = False self._apps = None self._app_services = None self._service_versions = None self._version_instances = None super(AppEngineRepositoryClient, self).__init__(API_NAME, versions=['v1'], quota_max_call...
AppEngine API Respository.
AppEngineRepositoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppEngineRepositoryClient: """AppEngine API Respository.""" def __init__(self, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track ...
stack_v2_sparse_classes_75kplus_train_009029
17,022
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.", "name": "__init__", "signature": "def __...
5
null
Implement the Python class `AppEngineRepositoryClient` described below. Class description: AppEngine API Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for...
Implement the Python class `AppEngineRepositoryClient` described below. Class description: AppEngine API Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class AppEngineRepositoryClient: """AppEngine API Respository.""" def __init__(self, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AppEngineRepositoryClient: """AppEngine API Respository.""" def __init__(self, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests over...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/appengine.py
kevensen/forseti-security
train
1
1c47c205acca739eeda75b44066fa010a6fa8785
[ "metadata = {'OriginalVolumeMetadataKey': 'OriginalVolumeMetadataValue'}\nsize = self.volumes.behaviors.get_configured_volume_type_property('min_size', id_=volume_type_id, name=volume_type_name)\nvolume = self.volumes.behaviors.create_available_volume(size, volume_type_id, self.random_volume_name(), metadata=metada...
<|body_start_0|> metadata = {'OriginalVolumeMetadataKey': 'OriginalVolumeMetadataValue'} size = self.volumes.behaviors.get_configured_volume_type_property('min_size', id_=volume_type_id, name=volume_type_name) volume = self.volumes.behaviors.create_available_volume(size, volume_type_id, self.ran...
CBSVolumeCloneTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBSVolumeCloneTests: def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): """Verify that data written to a volume is intact and available on a clone of that volume""" <|body_0|> def ddtest_create_larger_clone_of_volu...
stack_v2_sparse_classes_75kplus_train_009030
5,836
permissive
[ { "docstring": "Verify that data written to a volume is intact and available on a clone of that volume", "name": "ddtest_create_exact_clone_of_existing_volume_and_verify_attributes", "signature": "def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_...
2
stack_v2_sparse_classes_30k_train_009473
Implement the Python class `CBSVolumeCloneTests` described below. Class description: Implement the CBSVolumeCloneTests class. Method signatures and docstrings: - def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): Verify that data written to a volume is inta...
Implement the Python class `CBSVolumeCloneTests` described below. Class description: Implement the CBSVolumeCloneTests class. Method signatures and docstrings: - def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): Verify that data written to a volume is inta...
30f0e64672676c3f90b4a582fe90fac6621475b3
<|skeleton|> class CBSVolumeCloneTests: def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): """Verify that data written to a volume is intact and available on a clone of that volume""" <|body_0|> def ddtest_create_larger_clone_of_volu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CBSVolumeCloneTests: def ddtest_create_exact_clone_of_existing_volume_and_verify_attributes(self, volume_type_name, volume_type_id): """Verify that data written to a volume is intact and available on a clone of that volume""" metadata = {'OriginalVolumeMetadataKey': 'OriginalVolumeMetadataValu...
the_stack_v2_python_sparse
cloudroast/blockstorage/volumes_api/volumes/volume_cloning_tests.py
RULCSoft/cloudroast
train
1
bf56b178a5c82b65e0519ea771434e94be849dc9
[ "if isinstance(key, int):\n return HandoverInitiateStatus(key)\nif key not in HandoverInitiateStatus._member_map_:\n extend_enum(HandoverInitiateStatus, key, default)\nreturn HandoverInitiateStatus[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % ...
<|body_start_0|> if isinstance(key, int): return HandoverInitiateStatus(key) if key not in HandoverInitiateStatus._member_map_: extend_enum(HandoverInitiateStatus, key, default) return HandoverInitiateStatus[key] <|end_body_0|> <|body_start_1|> if not (isinstance...
[HandoverInitiateStatus] Handover Initiate Status Codes
HandoverInitiateStatus
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandoverInitiateStatus: """[HandoverInitiateStatus] Handover Initiate Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'HandoverInitiateStatus': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found.""" <|b...
stack_v2_sparse_classes_75kplus_train_009031
2,116
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found.", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'HandoverInitiateStatus'" }, { "docstring": "Lookup function used when value is not found. Arg...
2
null
Implement the Python class `HandoverInitiateStatus` described below. Class description: [HandoverInitiateStatus] Handover Initiate Status Codes Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'HandoverInitiateStatus': Backport support for original codes. Args: key: Key to get enum ...
Implement the Python class `HandoverInitiateStatus` described below. Class description: [HandoverInitiateStatus] Handover Initiate Status Codes Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'HandoverInitiateStatus': Backport support for original codes. Args: key: Key to get enum ...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class HandoverInitiateStatus: """[HandoverInitiateStatus] Handover Initiate Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'HandoverInitiateStatus': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HandoverInitiateStatus: """[HandoverInitiateStatus] Handover Initiate Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'HandoverInitiateStatus': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found.""" if isinstance(ke...
the_stack_v2_python_sparse
pcapkit/const/mh/handover_initiate_status.py
JarryShaw/PyPCAPKit
train
204
8d0093af25d59126094c8cd6bf23d5ff4e86296a
[ "self.pin = gpio_pin\nself.pi = pi\nself.speed = 0", "self.speed = speed\nif speed > MAX_SPEED:\n speed -= MAX_SPEED\n speed *= -1\npwm_speed = speed * CENTER_PWM_RANGE / MAX_SPEED + CENTER_PWM_VALUE\nself.pi.set_servo_pulsewidth(self.pin, pwm_speed)", "self.set_speed(MAX_SPEED / 6)\ntime.sleep(1)\nself.s...
<|body_start_0|> self.pin = gpio_pin self.pi = pi self.speed = 0 <|end_body_0|> <|body_start_1|> self.speed = speed if speed > MAX_SPEED: speed -= MAX_SPEED speed *= -1 pwm_speed = speed * CENTER_PWM_RANGE / MAX_SPEED + CENTER_PWM_VALUE se...
Motor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Motor: def __init__(self, gpio_pin, pi): """Instantiate a motor. gpio_pin: Pin on Raspberry Pi that this motor is connected to.i pi: Raspberry Pi GPIO object""" <|body_0|> def set_speed(self, speed): """Sets the speed of the motor. speed: double value specifying the ...
stack_v2_sparse_classes_75kplus_train_009032
1,357
no_license
[ { "docstring": "Instantiate a motor. gpio_pin: Pin on Raspberry Pi that this motor is connected to.i pi: Raspberry Pi GPIO object", "name": "__init__", "signature": "def __init__(self, gpio_pin, pi)" }, { "docstring": "Sets the speed of the motor. speed: double value specifying the speed that th...
3
stack_v2_sparse_classes_30k_train_016802
Implement the Python class `Motor` described below. Class description: Implement the Motor class. Method signatures and docstrings: - def __init__(self, gpio_pin, pi): Instantiate a motor. gpio_pin: Pin on Raspberry Pi that this motor is connected to.i pi: Raspberry Pi GPIO object - def set_speed(self, speed): Sets t...
Implement the Python class `Motor` described below. Class description: Implement the Motor class. Method signatures and docstrings: - def __init__(self, gpio_pin, pi): Instantiate a motor. gpio_pin: Pin on Raspberry Pi that this motor is connected to.i pi: Raspberry Pi GPIO object - def set_speed(self, speed): Sets t...
43ee81e5e766068f58da47b1250dcd79b5fbab7b
<|skeleton|> class Motor: def __init__(self, gpio_pin, pi): """Instantiate a motor. gpio_pin: Pin on Raspberry Pi that this motor is connected to.i pi: Raspberry Pi GPIO object""" <|body_0|> def set_speed(self, speed): """Sets the speed of the motor. speed: double value specifying the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Motor: def __init__(self, gpio_pin, pi): """Instantiate a motor. gpio_pin: Pin on Raspberry Pi that this motor is connected to.i pi: Raspberry Pi GPIO object""" self.pin = gpio_pin self.pi = pi self.speed = 0 def set_speed(self, speed): """Sets the speed of the mot...
the_stack_v2_python_sparse
auv/api/motor.py
Yonder-Deep/Origin
train
0
39641c5bb9bdbcec5e2f12438ccd960298c77dc5
[ "from m3gnet.models import M3GNet\nif model_path:\n self.describer_model = M3GNet.from_dir(model_path)\nelse:\n self.describer_model = M3GNet.from_dir(DEFAULT_MODEL)\nself.model_path = model_path\nsuper().__init__(**kwargs)", "from m3gnet.graph import Index, tf_compute_distance_angle\nfrom m3gnet.layers imp...
<|body_start_0|> from m3gnet.models import M3GNet if model_path: self.describer_model = M3GNet.from_dir(model_path) else: self.describer_model = M3GNet.from_dir(DEFAULT_MODEL) self.model_path = model_path super().__init__(**kwargs) <|end_body_0|> <|body_s...
M3GNetStructure
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class M3GNetStructure: def __init__(self, model_path: str | None=None, **kwargs): """Args: model_path (str): m3gnet models path. If no path is provided, the models will be M3GNet formation energy model on figshare: https://figshare.com/articles/software/m3gnet_property_model_weights/20099465 P...
stack_v2_sparse_classes_75kplus_train_009033
2,220
permissive
[ { "docstring": "Args: model_path (str): m3gnet models path. If no path is provided, the models will be M3GNet formation energy model on figshare: https://figshare.com/articles/software/m3gnet_property_model_weights/20099465 Please refer to the M3GNet paper: https://doi.org/10.1038/s43588-022-00349-3.", "nam...
2
stack_v2_sparse_classes_30k_train_012195
Implement the Python class `M3GNetStructure` described below. Class description: Implement the M3GNetStructure class. Method signatures and docstrings: - def __init__(self, model_path: str | None=None, **kwargs): Args: model_path (str): m3gnet models path. If no path is provided, the models will be M3GNet formation e...
Implement the Python class `M3GNetStructure` described below. Class description: Implement the M3GNetStructure class. Method signatures and docstrings: - def __init__(self, model_path: str | None=None, **kwargs): Args: model_path (str): m3gnet models path. If no path is provided, the models will be M3GNet formation e...
6ae3c7029b939e1183684358a3ae2fef41053be5
<|skeleton|> class M3GNetStructure: def __init__(self, model_path: str | None=None, **kwargs): """Args: model_path (str): m3gnet models path. If no path is provided, the models will be M3GNet formation energy model on figshare: https://figshare.com/articles/software/m3gnet_property_model_weights/20099465 P...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class M3GNetStructure: def __init__(self, model_path: str | None=None, **kwargs): """Args: model_path (str): m3gnet models path. If no path is provided, the models will be M3GNet formation energy model on figshare: https://figshare.com/articles/software/m3gnet_property_model_weights/20099465 Please refer to...
the_stack_v2_python_sparse
maml/describers/_m3gnet.py
materialsvirtuallab/maml
train
266
24ff7ba8da85cfe20aa3a230b6977a4b0c8a5858
[ "n = len(nums)\nself.sum1, temp = ([0 for i in range(n)], 0)\nfor i in range(n):\n temp += nums[i]\n self.sum1[i] = temp", "if i - 1 >= 0:\n return self.sum1[j] - self.sum1[i - 1]\nreturn self.sum1[j]" ]
<|body_start_0|> n = len(nums) self.sum1, temp = ([0 for i in range(n)], 0) for i in range(n): temp += nums[i] self.sum1[i] = temp <|end_body_0|> <|body_start_1|> if i - 1 >= 0: return self.sum1[j] - self.sum1[i - 1] return self.sum1[j] <|end_...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) self.sum1, temp = ([0 for i in range(...
stack_v2_sparse_classes_75kplus_train_009034
597
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
stack_v2_sparse_classes_30k_train_038271
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): ...
c7dc709a7a9b83ef85fbc2d0aad7a8829f1035d1
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" n = len(nums) self.sum1, temp = ([0 for i in range(n)], 0) for i in range(n): temp += nums[i] self.sum1[i] = temp def sumRange(self, i, j): """:type i: int :type j: int :rtype: ...
the_stack_v2_python_sparse
leetcode303.py
Marco2018/leetcode
train
0
8d5f1ecbf42f6cc1a97ff8ceb7e70aef366b86c7
[ "self.all_endpoints_reachable = all_endpoints_reachable\nself.auto_register_target = auto_register_target\nself.auto_registration = auto_registration\nself.bandwidth_limit = bandwidth_limit\nself.cluster_id = cluster_id\nself.cluster_incarnation_id = cluster_incarnation_id\nself.compression_enabled = compression_en...
<|body_start_0|> self.all_endpoints_reachable = all_endpoints_reachable self.auto_register_target = auto_register_target self.auto_registration = auto_registration self.bandwidth_limit = bandwidth_limit self.cluster_id = cluster_id self.cluster_incarnation_id = cluster_in...
Implementation of the 'RegisterRemoteCluster' model. Specifies the settings required for registering a remote Cluster on this local Cluster. Attributes: all_endpoints_reachable (bool): Specifies whether any endpoint (such as a Node) on the remote Cluster is reachable from this local Cluster. If true, a service running ...
RegisterRemoteCluster
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterRemoteCluster: """Implementation of the 'RegisterRemoteCluster' model. Specifies the settings required for registering a remote Cluster on this local Cluster. Attributes: all_endpoints_reachable (bool): Specifies whether any endpoint (such as a Node) on the remote Cluster is reachable fro...
stack_v2_sparse_classes_75kplus_train_009035
10,649
permissive
[ { "docstring": "Constructor for the RegisterRemoteCluster class", "name": "__init__", "signature": "def __init__(self, all_endpoints_reachable=None, auto_register_target=None, auto_registration=None, bandwidth_limit=None, cluster_id=None, cluster_incarnation_id=None, compression_enabled=None, descriptio...
2
stack_v2_sparse_classes_30k_test_002145
Implement the Python class `RegisterRemoteCluster` described below. Class description: Implementation of the 'RegisterRemoteCluster' model. Specifies the settings required for registering a remote Cluster on this local Cluster. Attributes: all_endpoints_reachable (bool): Specifies whether any endpoint (such as a Node)...
Implement the Python class `RegisterRemoteCluster` described below. Class description: Implementation of the 'RegisterRemoteCluster' model. Specifies the settings required for registering a remote Cluster on this local Cluster. Attributes: all_endpoints_reachable (bool): Specifies whether any endpoint (such as a Node)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RegisterRemoteCluster: """Implementation of the 'RegisterRemoteCluster' model. Specifies the settings required for registering a remote Cluster on this local Cluster. Attributes: all_endpoints_reachable (bool): Specifies whether any endpoint (such as a Node) on the remote Cluster is reachable fro...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegisterRemoteCluster: """Implementation of the 'RegisterRemoteCluster' model. Specifies the settings required for registering a remote Cluster on this local Cluster. Attributes: all_endpoints_reachable (bool): Specifies whether any endpoint (such as a Node) on the remote Cluster is reachable from this local ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/register_remote_cluster.py
cohesity/management-sdk-python
train
24
2949e51fec5fd32e3ab9a9417dccb84f67bb43da
[ "super(mpich, self).__init__(**kwargs)\nself.__baseurl = kwargs.pop('baseurl', 'https://www.mpich.org/static/downloads')\nself.__check = kwargs.pop('check', False)\nself.__configure_opts = kwargs.pop('configure_opts', [])\nself.__ospackages = kwargs.pop('ospackages', [])\nself.__prefix = kwargs.pop('prefix', '/usr/...
<|body_start_0|> super(mpich, self).__init__(**kwargs) self.__baseurl = kwargs.pop('baseurl', 'https://www.mpich.org/static/downloads') self.__check = kwargs.pop('check', False) self.__configure_opts = kwargs.pop('configure_opts', []) self.__ospackages = kwargs.pop('ospackages', ...
The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Parameters annotate: Boolean flag to s...
mpich
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mpich: """The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Param...
stack_v2_sparse_classes_75kplus_train_009036
8,511
permissive
[ { "docstring": "Initialize building block", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Setup configure options based on user parameters", "name": "__configure", "signature": "def __configure(self)" }, { "docstring": "Based on the Linux dist...
4
stack_v2_sparse_classes_30k_train_036883
Implement the Python class `mpich` described below. Class description: The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build u...
Implement the Python class `mpich` described below. Class description: The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build u...
60fd2a51c171258a6b3f93c2523101cb7018ba1b
<|skeleton|> class mpich: """The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class mpich: """The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Parameters annotat...
the_stack_v2_python_sparse
hpccm/building_blocks/mpich.py
NVIDIA/hpc-container-maker
train
419
394f68f04a5f20dfb234e3c441f9a6b71924fa56
[ "super(FunctionComponent, self).__init__(opts)\nself.res_options = opts.get('resilient', {})\nself.options = opts.get('pagerduty', {})\nvalidate_fields(['api_token', 'from_email'], self.options)\nself.log = logging.getLogger(__name__)", "self.res_options = opts.get('resilient', {})\nself.options = opts.get('pager...
<|body_start_0|> super(FunctionComponent, self).__init__(opts) self.res_options = opts.get('resilient', {}) self.options = opts.get('pagerduty', {}) validate_fields(['api_token', 'from_email'], self.options) self.log = logging.getLogger(__name__) <|end_body_0|> <|body_start_1|> ...
Component that implements Resilient function 'pagerduty_create_note
FunctionComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'pagerduty_create_note""" def __init__(self, opts): """constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration options have changed,...
stack_v2_sparse_classes_75kplus_train_009037
2,515
permissive
[ { "docstring": "constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Configuration options have changed, save new values", "name": "_reload", "signature": "def _reload(self, event, opts)" }, { "d...
4
stack_v2_sparse_classes_30k_train_015519
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'pagerduty_create_note Method signatures and docstrings: - def __init__(self, opts): constructor provides access to the configuration options - def _reload(self, event, opts): Configuration ...
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'pagerduty_create_note Method signatures and docstrings: - def __init__(self, opts): constructor provides access to the configuration options - def _reload(self, event, opts): Configuration ...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'pagerduty_create_note""" def __init__(self, opts): """constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration options have changed,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FunctionComponent: """Component that implements Resilient function 'pagerduty_create_note""" def __init__(self, opts): """constructor provides access to the configuration options""" super(FunctionComponent, self).__init__(opts) self.res_options = opts.get('resilient', {}) ...
the_stack_v2_python_sparse
fn_pagerduty/fn_pagerduty/components/funct_pagerduty_create_note.py
ibmresilient/resilient-community-apps
train
81
8df110d9126df23287bf1fb6503f980523bb6d74
[ "word_map = dict()\nword_list = []\nfor i in range(len(order)):\n word_map[i] = order[i]\nfor word in words:\n letter_to_num = []\n for l in word:\n letter_to_num.append(list(word_map.keys())[list(word_map.values()).index(l)])\n word_list.append(letter_to_num)\nif word_list == sorted(word_list):\...
<|body_start_0|> word_map = dict() word_list = [] for i in range(len(order)): word_map[i] = order[i] for word in words: letter_to_num = [] for l in word: letter_to_num.append(list(word_map.keys())[list(word_map.values()).index(l)]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isAlienSorted_naive(self, words, order): """:type words: List[str] :type order: str :rtype: bool""" <|body_0|> def isAlienSorted_ans(self, words, order): """:type words: List[str] :type order: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_009038
1,408
no_license
[ { "docstring": ":type words: List[str] :type order: str :rtype: bool", "name": "isAlienSorted_naive", "signature": "def isAlienSorted_naive(self, words, order)" }, { "docstring": ":type words: List[str] :type order: str :rtype: bool", "name": "isAlienSorted_ans", "signature": "def isAlie...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isAlienSorted_naive(self, words, order): :type words: List[str] :type order: str :rtype: bool - def isAlienSorted_ans(self, words, order): :type words: List[str] :type order:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isAlienSorted_naive(self, words, order): :type words: List[str] :type order: str :rtype: bool - def isAlienSorted_ans(self, words, order): :type words: List[str] :type order:...
11d68f96c5a5689c141ee6395d1f453dfd3d5aeb
<|skeleton|> class Solution: def isAlienSorted_naive(self, words, order): """:type words: List[str] :type order: str :rtype: bool""" <|body_0|> def isAlienSorted_ans(self, words, order): """:type words: List[str] :type order: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isAlienSorted_naive(self, words, order): """:type words: List[str] :type order: str :rtype: bool""" word_map = dict() word_list = [] for i in range(len(order)): word_map[i] = order[i] for word in words: letter_to_num = [] ...
the_stack_v2_python_sparse
Leetcode/Python/0953_Verifying_an_Alien_Dictionary.py
Modrisco/OJ-questions
train
2
675b60e927436b88eb72de5809c2ee400b92c27d
[ "request = None\nif self.context is not None and 'request' in self.context:\n request = self.context['request']\nif request is not None and (not request.user.is_anonymous):\n obj = mpmodels.Channel.objects.create_for_user(request.user, **validated_data)\nelse:\n obj = mpmodels.Channel.objects.create(**vali...
<|body_start_0|> request = None if self.context is not None and 'request' in self.context: request = self.context['request'] if request is not None and (not request.user.is_anonymous): obj = mpmodels.Channel.objects.create_for_user(request.user, **validated_data) ...
An individual channel.
ChannelSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChannelSerializer: """An individual channel.""" def create(self, validated_data): """Override behaviour when creating a new object using this serializer. If the current request is being passed in the context, give the request user edit and view permissions on the item.""" <|b...
stack_v2_sparse_classes_75kplus_train_009039
15,251
permissive
[ { "docstring": "Override behaviour when creating a new object using this serializer. If the current request is being passed in the context, give the request user edit and view permissions on the item.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Override...
2
stack_v2_sparse_classes_30k_train_003228
Implement the Python class `ChannelSerializer` described below. Class description: An individual channel. Method signatures and docstrings: - def create(self, validated_data): Override behaviour when creating a new object using this serializer. If the current request is being passed in the context, give the request u...
Implement the Python class `ChannelSerializer` described below. Class description: An individual channel. Method signatures and docstrings: - def create(self, validated_data): Override behaviour when creating a new object using this serializer. If the current request is being passed in the context, give the request u...
731bdd524c0a3b618586fea41aecca2a94486385
<|skeleton|> class ChannelSerializer: """An individual channel.""" def create(self, validated_data): """Override behaviour when creating a new object using this serializer. If the current request is being passed in the context, give the request user edit and view permissions on the item.""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChannelSerializer: """An individual channel.""" def create(self, validated_data): """Override behaviour when creating a new object using this serializer. If the current request is being passed in the context, give the request user edit and view permissions on the item.""" request = None ...
the_stack_v2_python_sparse
api/serializers.py
uisautomation/media-webapp
train
5
e6f926167837f772ace7305112339a0a384fe1b9
[ "res = ReconResource.query.get_or_404(id)\nargs = upload_parser.parse_args()\ntry:\n res.set_content(args['file'])\n from app.tasks import task_build_thumbnail\n task_build_thumbnail.delay(id)\n return ('Resource content successfully uploaded.', 204)\nexcept ValueExist as e:\n abort(409, error=str(e)...
<|body_start_0|> res = ReconResource.query.get_or_404(id) args = upload_parser.parse_args() try: res.set_content(args['file']) from app.tasks import task_build_thumbnail task_build_thumbnail.delay(id) return ('Resource content successfully uploaded...
ContentResourceItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentResourceItem: def post(self, id): """Set Resource content 200 Success 404 Resource not found 409 Content already exist 400 Validation error""" <|body_0|> def get(self, id): """Get Resource content 200 Success 404 Resource not found 400 Resource have no content...
stack_v2_sparse_classes_75kplus_train_009040
5,113
no_license
[ { "docstring": "Set Resource content 200 Success 404 Resource not found 409 Content already exist 400 Validation error", "name": "post", "signature": "def post(self, id)" }, { "docstring": "Get Resource content 200 Success 404 Resource not found 400 Resource have no content :param id: Resoure un...
3
stack_v2_sparse_classes_30k_train_015698
Implement the Python class `ContentResourceItem` described below. Class description: Implement the ContentResourceItem class. Method signatures and docstrings: - def post(self, id): Set Resource content 200 Success 404 Resource not found 409 Content already exist 400 Validation error - def get(self, id): Get Resource...
Implement the Python class `ContentResourceItem` described below. Class description: Implement the ContentResourceItem class. Method signatures and docstrings: - def post(self, id): Set Resource content 200 Success 404 Resource not found 409 Content already exist 400 Validation error - def get(self, id): Get Resource...
e748e9ce9bd40018389a6154aeba2d0c3c77430f
<|skeleton|> class ContentResourceItem: def post(self, id): """Set Resource content 200 Success 404 Resource not found 409 Content already exist 400 Validation error""" <|body_0|> def get(self, id): """Get Resource content 200 Success 404 Resource not found 400 Resource have no content...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContentResourceItem: def post(self, id): """Set Resource content 200 Success 404 Resource not found 409 Content already exist 400 Validation error""" res = ReconResource.query.get_or_404(id) args = upload_parser.parse_args() try: res.set_content(args['file']) ...
the_stack_v2_python_sparse
app/api/endpoints/Resources.py
averdier/elittoral_api
train
0
d87574e09b5d6209a73863ef4e1280e6ea6dd87c
[ "self.size = size\nself.q = collections.deque()\nself.total = 0", "if len(self.q) == self.size:\n self.total -= self.q.popleft()\nself.q.append(val)\nself.total += val\nreturn self.total / len(self.q)" ]
<|body_start_0|> self.size = size self.q = collections.deque() self.total = 0 <|end_body_0|> <|body_start_1|> if len(self.q) == self.size: self.total -= self.q.popleft() self.q.append(val) self.total += val return self.total / len(self.q) <|end_body_1...
MovingAverage2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage2: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.size = size self.q = co...
stack_v2_sparse_classes_75kplus_train_009041
2,826
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_054366
Implement the Python class `MovingAverage2` described below. Class description: Implement the MovingAverage2 class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage2` described below. Class description: Implement the MovingAverage2 class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage2:...
2ffe01713a12090848ed9b75457bf9ee156db84b
<|skeleton|> class MovingAverage2: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage2: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.size = size self.q = collections.deque() self.total = 0 def next(self, val): """:type val: int :rtype: float""" if len(self.q) == self.size: ...
the_stack_v2_python_sparse
array/Q346_movingAverage.py
liangming168/leetcode
train
0
c0296f9f9c855fc4b5c0e53fbbb615c4111fd2af
[ "self.hand = []\nself.hand_value = 0\nself.playing_hand = True", "for i in range(2):\n card = deck.deal_card()\n self.hand.append(card)", "input(\"\\nPress enter to reveal the dealer's hand. \")\nfor card in self.hand:\n card.display_card()\n time.sleep(1)", "self.get_hand_value()\nwhile self.hand...
<|body_start_0|> self.hand = [] self.hand_value = 0 self.playing_hand = True <|end_body_0|> <|body_start_1|> for i in range(2): card = deck.deal_card() self.hand.append(card) <|end_body_1|> <|body_start_2|> input("\nPress enter to reveal the dealer's han...
A class simulating the black jack dealer. They must hit up to 17 and they must reveal their first card.
Dealer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dealer: """A class simulating the black jack dealer. They must hit up to 17 and they must reveal their first card.""" def __init__(self): """Initialize the dealer""" <|body_0|> def draw_hand(self, deck): """Deal the dealers starting hand""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_009042
9,795
permissive
[ { "docstring": "Initialize the dealer", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Deal the dealers starting hand", "name": "draw_hand", "signature": "def draw_hand(self, deck)" }, { "docstring": "Show the dealers hand one card at a time.", "name...
5
stack_v2_sparse_classes_30k_train_015581
Implement the Python class `Dealer` described below. Class description: A class simulating the black jack dealer. They must hit up to 17 and they must reveal their first card. Method signatures and docstrings: - def __init__(self): Initialize the dealer - def draw_hand(self, deck): Deal the dealers starting hand - de...
Implement the Python class `Dealer` described below. Class description: A class simulating the black jack dealer. They must hit up to 17 and they must reveal their first card. Method signatures and docstrings: - def __init__(self): Initialize the dealer - def draw_hand(self, deck): Deal the dealers starting hand - de...
a9f44d20ae212b5cbc190ac49ca7acc638ff4228
<|skeleton|> class Dealer: """A class simulating the black jack dealer. They must hit up to 17 and they must reveal their first card.""" def __init__(self): """Initialize the dealer""" <|body_0|> def draw_hand(self, deck): """Deal the dealers starting hand""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dealer: """A class simulating the black jack dealer. They must hit up to 17 and they must reveal their first card.""" def __init__(self): """Initialize the dealer""" self.hand = [] self.hand_value = 0 self.playing_hand = True def draw_hand(self, deck): """Deal...
the_stack_v2_python_sparse
9_Classes/challenge_37_code.py
demoanddemo/The-Art-of-Doing-Code-40-Challenging-Python-Programs-Today
train
0
e09e618434940b6c466b5467941e4235e1376b18
[ "prefixSums = []\nprefixSum = 0\nfor num in nums:\n prefixSum += num\n prefixSums.append(prefixSum)\nself.prefixSums = prefixSums", "if i < 0 or i + 1 > len(self.prefixSums) or j < 0 or (j + 1 > len(self.prefixSums)):\n return\nif i == 0:\n return self.prefixSums[j]\nelse:\n return self.prefixSums[...
<|body_start_0|> prefixSums = [] prefixSum = 0 for num in nums: prefixSum += num prefixSums.append(prefixSum) self.prefixSums = prefixSums <|end_body_0|> <|body_start_1|> if i < 0 or i + 1 > len(self.prefixSums) or j < 0 or (j + 1 > len(self.prefixSums)):...
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|> prefixSums = [] prefixSum = 0 for num in nu...
stack_v2_sparse_classes_75kplus_train_009043
854
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): ...
1bd17e867d1d557a6ebbbd99f693d5fbd9f5b61e
<|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_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" prefixSums = [] prefixSum = 0 for num in nums: prefixSum += num prefixSums.append(prefixSum) self.prefixSums = prefixSums def sumRange(self, i, j): """:type i: int :type...
the_stack_v2_python_sparse
leetcode/303-range-sum-query-immutable/main.py
shriharshs/AlgoDaily
train
0
b3e34bb0f5d3e0df7ff4a7d695ae33c4771e2d5f
[ "result = []\nstack = []\nwhile stack or root:\n if root:\n stack.append(root)\n root = root.left\n else:\n root = stack.pop()\n result.append(root.val)\n root = root.right\nreturn result", "result = []\nif not root:\n return result\nstack = []\nwhile stack or root:\n ...
<|body_start_0|> result = [] stack = [] while stack or root: if root: stack.append(root) root = root.left else: root = stack.pop() result.append(root.val) root = root.right return resu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal(self, root): """:type root: Tree...
stack_v2_sparse_classes_75kplus_train_009044
1,927
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "inorderTraversal", "signature": "def inorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "preorderTraversal", "signature": "def preorderTraversal(self, root)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_054577
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal(self...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def preorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal(self, root): """:type root: Tree...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def inorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" result = [] stack = [] while stack or root: if root: stack.append(root) root = root.left else: root = stack.pop() ...
the_stack_v2_python_sparse
python_solution/091_100/BinaryTreeInorder.py
CescWang1991/LeetCode-Python
train
1
56e0edf2a488bd2f7278a30c7ccb60ff87c2335c
[ "super().__init__()\nself.in_partitions = in_partitions\nself.in_nodes = in_nodes\nself.out_regions = in_partitions\nself.out_nodes = out_nodes\nself.dropout = dropout\nself.weight = nn.Parameter(torch.empty(self.out_regions, self.out_nodes, self.in_nodes), requires_grad=True)\ndirichlet_(self.weight, alpha=1.0)", ...
<|body_start_0|> super().__init__() self.in_partitions = in_partitions self.in_nodes = in_nodes self.out_regions = in_partitions self.out_nodes = out_nodes self.dropout = dropout self.weight = nn.Parameter(torch.empty(self.out_regions, self.out_nodes, self.in_node...
SumLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SumLayer: def __init__(self, in_partitions: int, in_nodes: int, out_nodes: int, dropout: Optional[float]=None): """Initialize the sum layer. :param in_partitions: The number of input partitions. :param in_nodes: The number of input nodes per partition. :param out_nodes: The number of out...
stack_v2_sparse_classes_75kplus_train_009045
18,020
permissive
[ { "docstring": "Initialize the sum layer. :param in_partitions: The number of input partitions. :param in_nodes: The number of input nodes per partition. :param out_nodes: The number of output nodes per region. :param dropout: The input nodes dropout rate. It can be None.", "name": "__init__", "signatur...
4
stack_v2_sparse_classes_30k_train_031297
Implement the Python class `SumLayer` described below. Class description: Implement the SumLayer class. Method signatures and docstrings: - def __init__(self, in_partitions: int, in_nodes: int, out_nodes: int, dropout: Optional[float]=None): Initialize the sum layer. :param in_partitions: The number of input partitio...
Implement the Python class `SumLayer` described below. Class description: Implement the SumLayer class. Method signatures and docstrings: - def __init__(self, in_partitions: int, in_nodes: int, out_nodes: int, dropout: Optional[float]=None): Initialize the sum layer. :param in_partitions: The number of input partitio...
76094fb627e97867542ba2be1292a070028dbfdd
<|skeleton|> class SumLayer: def __init__(self, in_partitions: int, in_nodes: int, out_nodes: int, dropout: Optional[float]=None): """Initialize the sum layer. :param in_partitions: The number of input partitions. :param in_nodes: The number of input nodes per partition. :param out_nodes: The number of out...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SumLayer: def __init__(self, in_partitions: int, in_nodes: int, out_nodes: int, dropout: Optional[float]=None): """Initialize the sum layer. :param in_partitions: The number of input partitions. :param in_nodes: The number of input nodes per partition. :param out_nodes: The number of output nodes per ...
the_stack_v2_python_sparse
deeprob/spn/layers/ratspn.py
deeprob-org/deeprob-kit
train
66
9ec9848a4f2d096c3005121aeb36f422238704f2
[ "if any((mod == Modification.a for p, mod in monosaccharide.modifications.items())):\n return self.resolve_acid_color(monosaccharide)\nif 'hex' in [monosaccharide.superclass]:\n if any((mod == Modification.d for p, mod in monosaccharide.modifications.items())) and monosaccharide.stem == (Stem.gal,):\n ...
<|body_start_0|> if any((mod == Modification.a for p, mod in monosaccharide.modifications.items())): return self.resolve_acid_color(monosaccharide) if 'hex' in [monosaccharide.superclass]: if any((mod == Modification.d for p, mod in monosaccharide.modifications.items())) and mono...
SNFGNomenclature
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SNFGNomenclature: def residue_color(self, monosaccharide): """Determine which color to use to represent `monosaccharide` under the CFG symbol nomenclature. Parameters ---------- monosaccharide: |Monosaccharide| The residue to be rendered Returns ------- ResidueColor.EnumValue""" ...
stack_v2_sparse_classes_75kplus_train_009046
2,963
permissive
[ { "docstring": "Determine which color to use to represent `monosaccharide` under the CFG symbol nomenclature. Parameters ---------- monosaccharide: |Monosaccharide| The residue to be rendered Returns ------- ResidueColor.EnumValue", "name": "residue_color", "signature": "def residue_color(self, monosacc...
2
stack_v2_sparse_classes_30k_train_034468
Implement the Python class `SNFGNomenclature` described below. Class description: Implement the SNFGNomenclature class. Method signatures and docstrings: - def residue_color(self, monosaccharide): Determine which color to use to represent `monosaccharide` under the CFG symbol nomenclature. Parameters ---------- monos...
Implement the Python class `SNFGNomenclature` described below. Class description: Implement the SNFGNomenclature class. Method signatures and docstrings: - def residue_color(self, monosaccharide): Determine which color to use to represent `monosaccharide` under the CFG symbol nomenclature. Parameters ---------- monos...
35a2e9baf6248abd3d3737d8528b3f9463e6cff3
<|skeleton|> class SNFGNomenclature: def residue_color(self, monosaccharide): """Determine which color to use to represent `monosaccharide` under the CFG symbol nomenclature. Parameters ---------- monosaccharide: |Monosaccharide| The residue to be rendered Returns ------- ResidueColor.EnumValue""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SNFGNomenclature: def residue_color(self, monosaccharide): """Determine which color to use to represent `monosaccharide` under the CFG symbol nomenclature. Parameters ---------- monosaccharide: |Monosaccharide| The residue to be rendered Returns ------- ResidueColor.EnumValue""" if any((mod ==...
the_stack_v2_python_sparse
src/glypy/plot/snfg_symbols.py
mobiusklein/glypy
train
20
3e601976403ceac10bef638c213c0148ab34bc1c
[ "super().__init__(input_shape, filters, kernel_size, stride, dilation, groups, bias)\nif isinstance(padding, (*INT_TYPES, *FLOAT_TYPES)):\n self.padding_mode = 'constant'\n self._padding_value = padding\nelse:\n self.padding_mode = padding\n self._padding_value = 0.0\nif self.padding_mode == 'valid' or ...
<|body_start_0|> super().__init__(input_shape, filters, kernel_size, stride, dilation, groups, bias) if isinstance(padding, (*INT_TYPES, *FLOAT_TYPES)): self.padding_mode = 'constant' self._padding_value = padding else: self.padding_mode = padding ...
Conv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv: def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): """Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1)...
stack_v2_sparse_classes_75kplus_train_009047
13,566
no_license
[ { "docstring": "Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1) Shape of the input tensor is passed as argument of constructor. 2) Shape of the output tensor can be accessed by 'output_shape' property ...
3
stack_v2_sparse_classes_30k_train_013806
Implement the Python class `Conv` described below. Class description: Implement the Conv class. Method signatures and docstrings: - def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): Direct convolution layer generalized for different dims. This lay...
Implement the Python class `Conv` described below. Class description: Implement the Conv class. Method signatures and docstrings: - def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): Direct convolution layer generalized for different dims. This lay...
9554e0f96703a37a9a41fc70dc8e70e45c6181a2
<|skeleton|> class Conv: def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): """Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Conv: def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): """Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1) Shape of the ...
the_stack_v2_python_sparse
dnn_backend/radio_dep/models/models/pytorch/layers/conv.py
theVmagnificient/radiology_web
train
0
eb4dd50ccbfa23aed0d9fd314c69857441c95c48
[ "super().__init__(mean, cov_chol_flat)\nself._mean_is_parameter = mean_is_parameter\nself._cov_is_parameter = cov_is_parameter", "if not len(stacked.shape) == 1:\n raise pyrado.ValueErr(msg='Stacked has invalid shape! Must be 1-dimensional.')\nexpected_dim_multiplier = 0\nif self._mean_is_parameter:\n expec...
<|body_start_0|> super().__init__(mean, cov_chol_flat) self._mean_is_parameter = mean_is_parameter self._cov_is_parameter = cov_is_parameter <|end_body_0|> <|body_start_1|> if not len(stacked.shape) == 1: raise pyrado.ValueErr(msg='Stacked has invalid shape! Must be 1-dimens...
Version of the `MultivariateNormalWrapper` that is able to exclude either the mean of the covariance from the parameters and the stacking. This can be readily used for optimizing the mean or covariance while keeping the other fixed.
ParameterAgnosticMultivariateNormalWrapper
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterAgnosticMultivariateNormalWrapper: """Version of the `MultivariateNormalWrapper` that is able to exclude either the mean of the covariance from the parameters and the stacking. This can be readily used for optimizing the mean or covariance while keeping the other fixed.""" def __ini...
stack_v2_sparse_classes_75kplus_train_009048
26,918
permissive
[ { "docstring": "Constructor. :param mean: mean of the distribution; shape `(k,)` :param cov_chol_flat: standard deviations of the distribution; shape `(k,)` :param mean_is_parameter: if `True`, the mean is treated as a parameter and returned from `get_stacked` and similar methods. :param cov_is_parameter: if `T...
4
null
Implement the Python class `ParameterAgnosticMultivariateNormalWrapper` described below. Class description: Version of the `MultivariateNormalWrapper` that is able to exclude either the mean of the covariance from the parameters and the stacking. This can be readily used for optimizing the mean or covariance while kee...
Implement the Python class `ParameterAgnosticMultivariateNormalWrapper` described below. Class description: Version of the `MultivariateNormalWrapper` that is able to exclude either the mean of the covariance from the parameters and the stacking. This can be readily used for optimizing the mean or covariance while kee...
d7e9cd191ccb318d5f1e580babc2fc38b5b3675a
<|skeleton|> class ParameterAgnosticMultivariateNormalWrapper: """Version of the `MultivariateNormalWrapper` that is able to exclude either the mean of the covariance from the parameters and the stacking. This can be readily used for optimizing the mean or covariance while keeping the other fixed.""" def __ini...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParameterAgnosticMultivariateNormalWrapper: """Version of the `MultivariateNormalWrapper` that is able to exclude either the mean of the covariance from the parameters and the stacking. This can be readily used for optimizing the mean or covariance while keeping the other fixed.""" def __init__(self, mea...
the_stack_v2_python_sparse
Pyrado/pyrado/algorithms/meta/sprl.py
1abner1/SimuRLacra
train
0
76636a1200484ae7d2ef3113785f4f033cdaf370
[ "links = response.xpath('//a[@class=\"product-title-link\"]/@href').extract()\nfor link in links:\n yield response.follow('https://www.labirint.ru' + link, callback=self.parse_item)\nnext_page = response.xpath('//a[@class=\"pagination-next__text\"]/@href').extract_first()\nif next_page:\n yield response.follo...
<|body_start_0|> links = response.xpath('//a[@class="product-title-link"]/@href').extract() for link in links: yield response.follow('https://www.labirint.ru' + link, callback=self.parse_item) next_page = response.xpath('//a[@class="pagination-next__text"]/@href').extract_first() ...
Labirint.ru spider.
LabirintruSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabirintruSpider: """Labirint.ru spider.""" def parse(self, response): """Novelty page parser.""" <|body_0|> def parse_item(self, response: HtmlResponse): """Book item parser.""" <|body_1|> <|end_skeleton|> <|body_start_0|> links = response.xpat...
stack_v2_sparse_classes_75kplus_train_009049
1,756
no_license
[ { "docstring": "Novelty page parser.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Book item parser.", "name": "parse_item", "signature": "def parse_item(self, response: HtmlResponse)" } ]
2
stack_v2_sparse_classes_30k_test_000145
Implement the Python class `LabirintruSpider` described below. Class description: Labirint.ru spider. Method signatures and docstrings: - def parse(self, response): Novelty page parser. - def parse_item(self, response: HtmlResponse): Book item parser.
Implement the Python class `LabirintruSpider` described below. Class description: Labirint.ru spider. Method signatures and docstrings: - def parse(self, response): Novelty page parser. - def parse_item(self, response: HtmlResponse): Book item parser. <|skeleton|> class LabirintruSpider: """Labirint.ru spider.""...
69488f0e788578722bf4f1cf171508f1e5624145
<|skeleton|> class LabirintruSpider: """Labirint.ru spider.""" def parse(self, response): """Novelty page parser.""" <|body_0|> def parse_item(self, response: HtmlResponse): """Book item parser.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabirintruSpider: """Labirint.ru spider.""" def parse(self, response): """Novelty page parser.""" links = response.xpath('//a[@class="product-title-link"]/@href').extract() for link in links: yield response.follow('https://www.labirint.ru' + link, callback=self.parse_i...
the_stack_v2_python_sparse
lesson_6/bookparser/spiders/labirintru.py
IInvasion/collecting_and_processing_web_data
train
0
404d5af4f1bbae50ed525e30e2864011f3c4a614
[ "self.input_coords = np.array([0.0572, -0.0592, 5.1083]) * 1000.0\nself.coords = np.array([[0.0572, -0.0592, 5.1083], [0.0578, -0.0591, 5.0993], [0.0586, -0.0585, 5.0861]]) * 1000.0\nself.long = 4\nself.lat = 2\nself.phi = 0.1\nself.no_pv = 0\nself.yes_pv = 1", "print('Testing that covarxy_pv returns 1 dimensiona...
<|body_start_0|> self.input_coords = np.array([0.0572, -0.0592, 5.1083]) * 1000.0 self.coords = np.array([[0.0572, -0.0592, 5.1083], [0.0578, -0.0591, 5.0993], [0.0586, -0.0585, 5.0861]]) * 1000.0 self.long = 4 self.lat = 2 self.phi = 0.1 self.no_pv = 0 self.yes_p...
Test cases for covarxy_pv function
MyTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTestCase: """Test cases for covarxy_pv function""" def setUp(self): """Set up for test :return: Nothing""" <|body_0|> def test_return_shape(self): """Check that the returned covariance matrix is the correct size :return: Nothing""" <|body_1|> def t...
stack_v2_sparse_classes_75kplus_train_009050
3,091
no_license
[ { "docstring": "Set up for test :return: Nothing", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Check that the returned covariance matrix is the correct size :return: Nothing", "name": "test_return_shape", "signature": "def test_return_shape(self)" }, { "doc...
5
stack_v2_sparse_classes_30k_train_049852
Implement the Python class `MyTestCase` described below. Class description: Test cases for covarxy_pv function Method signatures and docstrings: - def setUp(self): Set up for test :return: Nothing - def test_return_shape(self): Check that the returned covariance matrix is the correct size :return: Nothing - def test_...
Implement the Python class `MyTestCase` described below. Class description: Test cases for covarxy_pv function Method signatures and docstrings: - def setUp(self): Set up for test :return: Nothing - def test_return_shape(self): Check that the returned covariance matrix is the correct size :return: Nothing - def test_...
3944e9783d58422d2d10bbc95f9706e168550034
<|skeleton|> class MyTestCase: """Test cases for covarxy_pv function""" def setUp(self): """Set up for test :return: Nothing""" <|body_0|> def test_return_shape(self): """Check that the returned covariance matrix is the correct size :return: Nothing""" <|body_1|> def t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyTestCase: """Test cases for covarxy_pv function""" def setUp(self): """Set up for test :return: Nothing""" self.input_coords = np.array([0.0572, -0.0592, 5.1083]) * 1000.0 self.coords = np.array([[0.0572, -0.0592, 5.1083], [0.0578, -0.0591, 5.0993], [0.0586, -0.0585, 5.0861]]) *...
the_stack_v2_python_sparse
ow_calibration/build_cov/covarxy_pv/covarxy_pv_test.py
gmaze/argodmqc_owc
train
0
455912b33abc587b0bd4ea135ce2da724d12d645
[ "r = station_diameter / 2\nfor i in range(strings_per_station):\n if i == 0:\n x_str = x\n y_str = y\n else:\n angle = 0 if i == 1 else 2 * np.pi * (i - 1) / (strings_per_station - 1)\n x_str = x + r * np.cos(angle)\n y_str = y + r * np.sin(angle)\n self.subsets.append(st...
<|body_start_0|> r = station_diameter / 2 for i in range(strings_per_station): if i == 0: x_str = x y_str = y else: angle = 0 if i == 1 else 2 * np.pi * (i - 1) / (strings_per_station - 1) x_str = x + r * np.cos(angl...
Station geometry with one string at the station center and the rest of the strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.
CoxeterStation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoxeterStation: """Station geometry with one string at the station center and the rest of the strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.""" def set_positions(self, x, y, strings_per_station=4, ...
stack_v2_sparse_classes_75kplus_train_009051
6,416
permissive
[ { "docstring": "Generates string positions around the station.", "name": "set_positions", "signature": "def set_positions(self, x, y, strings_per_station=4, station_diameter=50, string_type=IREXString, **string_kwargs)" }, { "docstring": "Test whether the number of hit antennas meets the given a...
2
stack_v2_sparse_classes_30k_test_000167
Implement the Python class `CoxeterStation` described below. Class description: Station geometry with one string at the station center and the rest of the strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class. Method signatures and...
Implement the Python class `CoxeterStation` described below. Class description: Station geometry with one string at the station center and the rest of the strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class. Method signatures and...
80798ec2c4fd2e27f40843e37013765ee6a4e551
<|skeleton|> class CoxeterStation: """Station geometry with one string at the station center and the rest of the strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.""" def set_positions(self, x, y, strings_per_station=4, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CoxeterStation: """Station geometry with one string at the station center and the rest of the strings evenly spaced radially around the station center. Supports any string type and passes extra keyword arguments on to the string class.""" def set_positions(self, x, y, strings_per_station=4, station_diame...
the_stack_v2_python_sparse
pyrex/custom/irex/detector.py
shrishabh/pyrex
train
0
6321777bb9c200b5223e44f69f8cf50dbcb2cd43
[ "self.params = {}\nself.reg = reg\nself.dtype = dtype\nC, H, W = input_dim\nself.params['W1'] = np.random.normal(0, weight_scale, (num_filters, C, filter_size, filter_size))\nself.params['W2'] = np.random.normal(0, weight_scale, (num_filters * int(H / 2) * int(W / 2), hidden_dim))\nself.params['W3'] = np.random.nor...
<|body_start_0|> self.params = {} self.reg = reg self.dtype = dtype C, H, W = input_dim self.params['W1'] = np.random.normal(0, weight_scale, (num_filters, C, filter_size, filter_size)) self.params['W2'] = np.random.normal(0, weight_scale, (num_filters * int(H / 2) * int(...
A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input channels.
ThreeLayerConvNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreeLayerConvNet: """A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input...
stack_v2_sparse_classes_75kplus_train_009052
8,239
permissive
[ { "docstring": "Initialize a new network. Inputs: - input_dim: Tuple (C, H, W) giving size of input data - num_filters: Number of filters to use in the convolutional layer - filter_size: Size of filters to use in the convolutional layer - hidden_dim: Number of units to use in the fully-connected hidden layer - ...
2
stack_v2_sparse_classes_30k_train_054233
Implement the Python class `ThreeLayerConvNet` described below. Class description: A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each wit...
Implement the Python class `ThreeLayerConvNet` described below. Class description: A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each wit...
930ef4168ffbddbb5e81a782ba1328077a4f2525
<|skeleton|> class ThreeLayerConvNet: """A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreeLayerConvNet: """A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input channels."""...
the_stack_v2_python_sparse
practice5/cnn.py
enliktjioe/nn2020
train
0
ac135bba8131e7843f7456698885b050019d6d76
[ "token_stream = super(Python35EnamlLexer, self).make_token_stream()\ntoken_stream = self.analyse_async(token_stream)\nreturn token_stream", "for tok in token_stream:\n if tok.type == 'ASYNC':\n next_token = next(token_stream)\n if next_token.type not in ('DEF', 'WITH', 'FOR', 'NAME'):\n ...
<|body_start_0|> token_stream = super(Python35EnamlLexer, self).make_token_stream() token_stream = self.analyse_async(token_stream) return token_stream <|end_body_0|> <|body_start_1|> for tok in token_stream: if tok.type == 'ASYNC': next_token = next(token_st...
Lexer specialized for Python > 3.5.
Python35EnamlLexer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Python35EnamlLexer: """Lexer specialized for Python > 3.5.""" def make_token_stream(self): """Add analysis of ASYNC/AWAIT.""" <|body_0|> def analyse_async(self, token_stream): """Transform ASYNC/AWAIT tokens to NAME outside async function.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_009053
4,388
permissive
[ { "docstring": "Add analysis of ASYNC/AWAIT.", "name": "make_token_stream", "signature": "def make_token_stream(self)" }, { "docstring": "Transform ASYNC/AWAIT tokens to NAME outside async function.", "name": "analyse_async", "signature": "def analyse_async(self, token_stream)" } ]
2
stack_v2_sparse_classes_30k_train_045018
Implement the Python class `Python35EnamlLexer` described below. Class description: Lexer specialized for Python > 3.5. Method signatures and docstrings: - def make_token_stream(self): Add analysis of ASYNC/AWAIT. - def analyse_async(self, token_stream): Transform ASYNC/AWAIT tokens to NAME outside async function.
Implement the Python class `Python35EnamlLexer` described below. Class description: Lexer specialized for Python > 3.5. Method signatures and docstrings: - def make_token_stream(self): Add analysis of ASYNC/AWAIT. - def analyse_async(self, token_stream): Transform ASYNC/AWAIT tokens to NAME outside async function. <...
a32d44a9c66c91cc83c59a6bc955c43bc83dbb48
<|skeleton|> class Python35EnamlLexer: """Lexer specialized for Python > 3.5.""" def make_token_stream(self): """Add analysis of ASYNC/AWAIT.""" <|body_0|> def analyse_async(self, token_stream): """Transform ASYNC/AWAIT tokens to NAME outside async function.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Python35EnamlLexer: """Lexer specialized for Python > 3.5.""" def make_token_stream(self): """Add analysis of ASYNC/AWAIT.""" token_stream = super(Python35EnamlLexer, self).make_token_stream() token_stream = self.analyse_async(token_stream) return token_stream def ana...
the_stack_v2_python_sparse
enaml/core/parser/lexer3.py
timgates42/enaml
train
0
ec2e8bb86780652c84ce52f715e90ccd603b9533
[ "self.p = Pipeline()\nfor FH in filesToResample:\n dirForOutput = self.getOutputDirectory(FH)\n currentRes = volumeFromFile(FH.getLastBasevol()).separations\n if not abs(abs(currentRes[0]) - abs(resolution)) < 0.01:\n crop = ma.autocrop(resolution, FH, defaultDir=dirForOutput)\n self.p.addSta...
<|body_start_0|> self.p = Pipeline() for FH in filesToResample: dirForOutput = self.getOutputDirectory(FH) currentRes = volumeFromFile(FH.getLastBasevol()).separations if not abs(abs(currentRes[0]) - abs(resolution)) < 0.01: crop = ma.autocrop(resoluti...
SetResolution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetResolution: def __init__(self, filesToResample, resolution): """During initialization make sure all files are resampled at resolution we'd like to use for each pipeline stage""" <|body_0|> def getOutputDirectory(self, FH): """Sets output directory based on whether...
stack_v2_sparse_classes_75kplus_train_009054
26,892
permissive
[ { "docstring": "During initialization make sure all files are resampled at resolution we'd like to use for each pipeline stage", "name": "__init__", "signature": "def __init__(self, filesToResample, resolution)" }, { "docstring": "Sets output directory based on whether or not we have a full Regi...
2
stack_v2_sparse_classes_30k_train_018025
Implement the Python class `SetResolution` described below. Class description: Implement the SetResolution class. Method signatures and docstrings: - def __init__(self, filesToResample, resolution): During initialization make sure all files are resampled at resolution we'd like to use for each pipeline stage - def ge...
Implement the Python class `SetResolution` described below. Class description: Implement the SetResolution class. Method signatures and docstrings: - def __init__(self, filesToResample, resolution): During initialization make sure all files are resampled at resolution we'd like to use for each pipeline stage - def ge...
1989e6d750c44f0e3e3599d8e080e30a46c7ab81
<|skeleton|> class SetResolution: def __init__(self, filesToResample, resolution): """During initialization make sure all files are resampled at resolution we'd like to use for each pipeline stage""" <|body_0|> def getOutputDirectory(self, FH): """Sets output directory based on whether...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SetResolution: def __init__(self, filesToResample, resolution): """During initialization make sure all files are resampled at resolution we'd like to use for each pipeline stage""" self.p = Pipeline() for FH in filesToResample: dirForOutput = self.getOutputDirectory(FH) ...
the_stack_v2_python_sparse
atoms_and_modules/minc_modules.py
edeguzman/pydpiper
train
0
6e911e1918da1faaa60959fdca507e4fbefa2d68
[ "network_sys = client_object.parent.parent.get_network_system()\ntry:\n for pg in network_sys.networkInfo.portgroup:\n if pg.spec.name == client_object.name and pg.spec.vswitchName == client_object.parent.name:\n return NetworkSchema(name=client_object.name, vlan=pg.spec.vlanId, switch=pg.spec....
<|body_start_0|> network_sys = client_object.parent.parent.get_network_system() try: for pg in network_sys.networkInfo.portgroup: if pg.spec.name == client_object.name and pg.spec.vswitchName == client_object.parent.name: return NetworkSchema(name=client_o...
ESX55CRUDImpl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESX55CRUDImpl: def read(cls, client_object): """Returns the properties for the given portgroup. @type client_object: client instance @param client_object: Portgroup client instance @rtype: Portgroup Schema instance @return: Returns a Portgroup instance with attributes name, vswitchName, ...
stack_v2_sparse_classes_75kplus_train_009055
2,522
no_license
[ { "docstring": "Returns the properties for the given portgroup. @type client_object: client instance @param client_object: Portgroup client instance @rtype: Portgroup Schema instance @return: Returns a Portgroup instance with attributes name, vswitchName, vlan_id.", "name": "read", "signature": "def rea...
2
stack_v2_sparse_classes_30k_train_044534
Implement the Python class `ESX55CRUDImpl` described below. Class description: Implement the ESX55CRUDImpl class. Method signatures and docstrings: - def read(cls, client_object): Returns the properties for the given portgroup. @type client_object: client instance @param client_object: Portgroup client instance @rtyp...
Implement the Python class `ESX55CRUDImpl` described below. Class description: Implement the ESX55CRUDImpl class. Method signatures and docstrings: - def read(cls, client_object): Returns the properties for the given portgroup. @type client_object: client instance @param client_object: Portgroup client instance @rtyp...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class ESX55CRUDImpl: def read(cls, client_object): """Returns the properties for the given portgroup. @type client_object: client instance @param client_object: Portgroup client instance @rtype: Portgroup Schema instance @return: Returns a Portgroup instance with attributes name, vswitchName, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ESX55CRUDImpl: def read(cls, client_object): """Returns the properties for the given portgroup. @type client_object: client instance @param client_object: Portgroup client instance @rtype: Portgroup Schema instance @return: Returns a Portgroup instance with attributes name, vswitchName, vlan_id.""" ...
the_stack_v2_python_sparse
SystemTesting/pylib/vmware/vsphere/esx/vsswitch/portgroup/api/esx55_crud_impl.py
Cloudxtreme/MyProject
train
0
add181f9395434b7e2e1d2331f9ac8ee6153148f
[ "from collections import deque\nq = deque([(root, 1)])\nans = 0\nwhile q:\n sz = len(q)\n l, r = (-1, -1)\n for i in range(sz):\n node, idx = q.popleft()\n if i == 0:\n l = idx\n if i == sz - 1:\n r = idx\n if node.left:\n q.append((node.left, id...
<|body_start_0|> from collections import deque q = deque([(root, 1)]) ans = 0 while q: sz = len(q) l, r = (-1, -1) for i in range(sz): node, idx = q.popleft() if i == 0: l = idx if i =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: """BFS, Time: O(n), Space: O(n)""" <|body_0|> def widthOfBinaryTree(self, root: TreeNode) -> int: """DFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> from coll...
stack_v2_sparse_classes_75kplus_train_009056
1,580
no_license
[ { "docstring": "BFS, Time: O(n), Space: O(n)", "name": "widthOfBinaryTree", "signature": "def widthOfBinaryTree(self, root: TreeNode) -> int" }, { "docstring": "DFS, Time: O(n), Space: O(n)", "name": "widthOfBinaryTree", "signature": "def widthOfBinaryTree(self, root: TreeNode) -> int" ...
2
stack_v2_sparse_classes_30k_train_020100
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree(self, root: TreeNode) -> int: BFS, Time: O(n), Space: O(n) - def widthOfBinaryTree(self, root: TreeNode) -> int: DFS, Time: O(n), Space: O(n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree(self, root: TreeNode) -> int: BFS, Time: O(n), Space: O(n) - def widthOfBinaryTree(self, root: TreeNode) -> int: DFS, Time: O(n), Space: O(n) <|skeleton|> ...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: """BFS, Time: O(n), Space: O(n)""" <|body_0|> def widthOfBinaryTree(self, root: TreeNode) -> int: """DFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: """BFS, Time: O(n), Space: O(n)""" from collections import deque q = deque([(root, 1)]) ans = 0 while q: sz = len(q) l, r = (-1, -1) for i in range(sz): nod...
the_stack_v2_python_sparse
python/662-Maximum Width of Binary Tree.py
cwza/leetcode
train
0
65212bb1c2daaaba0dc0fb2bfe02dce4962ea764
[ "plot = self.component\nx = plot.index_mapper.map_data(event.x)\ny = plot.value_mapper.map_data(event.y)\nself.select_point = (x, y)", "plot = self.component\nx = plot.index_mapper.map_data(event.x)\ny = plot.value_mapper.map_data(event.y)\nself.current_point = (x, y)" ]
<|body_start_0|> plot = self.component x = plot.index_mapper.map_data(event.x) y = plot.value_mapper.map_data(event.y) self.select_point = (x, y) <|end_body_0|> <|body_start_1|> plot = self.component x = plot.index_mapper.map_data(event.x) y = plot.value_mapper.m...
A tool for selecting navigation lines. This tool dispatches events with clicked locations. The work for choosing which lines to select is done in the survey map view.
LineSelectTool
[ "BSD-3-Clause", "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineSelectTool: """A tool for selecting navigation lines. This tool dispatches events with clicked locations. The work for choosing which lines to select is done in the survey map view.""" def normal_left_down(self, event): """Dispatch an event with clicked location""" <|body...
stack_v2_sparse_classes_75kplus_train_009057
1,083
permissive
[ { "docstring": "Dispatch an event with clicked location", "name": "normal_left_down", "signature": "def normal_left_down(self, event)" }, { "docstring": "Dispatch an event with double-clicked location", "name": "normal_left_dclick", "signature": "def normal_left_dclick(self, event)" } ...
2
null
Implement the Python class `LineSelectTool` described below. Class description: A tool for selecting navigation lines. This tool dispatches events with clicked locations. The work for choosing which lines to select is done in the survey map view. Method signatures and docstrings: - def normal_left_down(self, event): ...
Implement the Python class `LineSelectTool` described below. Class description: A tool for selecting navigation lines. This tool dispatches events with clicked locations. The work for choosing which lines to select is done in the survey map view. Method signatures and docstrings: - def normal_left_down(self, event): ...
bb8c8775f15bdc9fa1a0a443ad0cdd9702a7e7af
<|skeleton|> class LineSelectTool: """A tool for selecting navigation lines. This tool dispatches events with clicked locations. The work for choosing which lines to select is done in the survey map view.""" def normal_left_down(self, event): """Dispatch an event with clicked location""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LineSelectTool: """A tool for selecting navigation lines. This tool dispatches events with clicked locations. The work for choosing which lines to select is done in the survey map view.""" def normal_left_down(self, event): """Dispatch an event with clicked location""" plot = self.compone...
the_stack_v2_python_sparse
hydropick/ui/line_select_tool.py
dpinte/hydropick
train
2
ec325c9e3c867c3ade30579e7743fdadb932e0a8
[ "debit_limits = DebitLimits()\ndf = DebitLimitsConstructor.prepare_date(df)\ndebit_limits.df = df\nreturn debit_limits", "dates = pd.to_datetime(df[DebitLimits.date])\ndf[DebitLimits.date] = dates\nreturn df" ]
<|body_start_0|> debit_limits = DebitLimits() df = DebitLimitsConstructor.prepare_date(df) debit_limits.df = df return debit_limits <|end_body_0|> <|body_start_1|> dates = pd.to_datetime(df[DebitLimits.date]) df[DebitLimits.date] = dates return df <|end_body_1|>
DebitLimitsConstructor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DebitLimitsConstructor: def create_debit_limits(df: pd.DataFrame) -> DebitLimits: """Создает экземпляр класса с огрничениями по дебиту нефти и жидкости :param df: DataFrame с огрничениями :return: экземляр класса DebitLimits""" <|body_0|> def prepare_date(df: pd.DataFrame) -...
stack_v2_sparse_classes_75kplus_train_009058
3,339
no_license
[ { "docstring": "Создает экземпляр класса с огрничениями по дебиту нефти и жидкости :param df: DataFrame с огрничениями :return: экземляр класса DebitLimits", "name": "create_debit_limits", "signature": "def create_debit_limits(df: pd.DataFrame) -> DebitLimits" }, { "docstring": "Кофектор столбца...
2
null
Implement the Python class `DebitLimitsConstructor` described below. Class description: Implement the DebitLimitsConstructor class. Method signatures and docstrings: - def create_debit_limits(df: pd.DataFrame) -> DebitLimits: Создает экземпляр класса с огрничениями по дебиту нефти и жидкости :param df: DataFrame с ог...
Implement the Python class `DebitLimitsConstructor` described below. Class description: Implement the DebitLimitsConstructor class. Method signatures and docstrings: - def create_debit_limits(df: pd.DataFrame) -> DebitLimits: Создает экземпляр класса с огрничениями по дебиту нефти и жидкости :param df: DataFrame с ог...
d7ea784210dbca8509661b61a02f61c517cdad30
<|skeleton|> class DebitLimitsConstructor: def create_debit_limits(df: pd.DataFrame) -> DebitLimits: """Создает экземпляр класса с огрничениями по дебиту нефти и жидкости :param df: DataFrame с огрничениями :return: экземляр класса DebitLimits""" <|body_0|> def prepare_date(df: pd.DataFrame) -...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DebitLimitsConstructor: def create_debit_limits(df: pd.DataFrame) -> DebitLimits: """Создает экземпляр класса с огрничениями по дебиту нефти и жидкости :param df: DataFrame с огрничениями :return: экземляр класса DebitLimits""" debit_limits = DebitLimits() df = DebitLimitsConstructor.p...
the_stack_v2_python_sparse
ManagementObject/AdditionalSchedule/Bound.py
Jaapin/tNavigatorManager
train
0
88bc474550e4e52120e4360b9f2804dda95201cd
[ "self.links = links\nself.email_config = email_config\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nlinks = dictionary.get('links')\nemail_config = dictionary.get('emailConfig')\nfor key in cls._names.values():\n if key in dictionary:\n del dictionary[ke...
<|body_start_0|> self.links = links self.email_config = email_config self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None links = dictionary.get('links') email_config = dictionary.get('emailConf...
Implementation of the 'Generate Connect Email Response Multiple borrowers' model. TODO: type model description here. Attributes: links (list of string): The URL generated to send a Connect email email_config (object): The configuration used to generate the Connect email.
GenerateConnectEmailResponseMultipleBorrowers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenerateConnectEmailResponseMultipleBorrowers: """Implementation of the 'Generate Connect Email Response Multiple borrowers' model. TODO: type model description here. Attributes: links (list of string): The URL generated to send a Connect email email_config (object): The configuration used to gen...
stack_v2_sparse_classes_75kplus_train_009059
2,061
permissive
[ { "docstring": "Constructor for the GenerateConnectEmailResponseMultipleBorrowers class", "name": "__init__", "signature": "def __init__(self, links=None, email_config=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictio...
2
stack_v2_sparse_classes_30k_train_005025
Implement the Python class `GenerateConnectEmailResponseMultipleBorrowers` described below. Class description: Implementation of the 'Generate Connect Email Response Multiple borrowers' model. TODO: type model description here. Attributes: links (list of string): The URL generated to send a Connect email email_config ...
Implement the Python class `GenerateConnectEmailResponseMultipleBorrowers` described below. Class description: Implementation of the 'Generate Connect Email Response Multiple borrowers' model. TODO: type model description here. Attributes: links (list of string): The URL generated to send a Connect email email_config ...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class GenerateConnectEmailResponseMultipleBorrowers: """Implementation of the 'Generate Connect Email Response Multiple borrowers' model. TODO: type model description here. Attributes: links (list of string): The URL generated to send a Connect email email_config (object): The configuration used to gen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GenerateConnectEmailResponseMultipleBorrowers: """Implementation of the 'Generate Connect Email Response Multiple borrowers' model. TODO: type model description here. Attributes: links (list of string): The URL generated to send a Connect email email_config (object): The configuration used to generate the Con...
the_stack_v2_python_sparse
finicityapi/models/generate_connect_email_response_multiple_borrowers.py
monarchmoney/finicity-python
train
0
dbcf6a6159316c123dc8d5560b61313ece1ade42
[ "idx = 1\nrecord = []\nres = []\nself.dfs(n, k, idx, record, res)\nreturn res", "for i in range(idx, n + 1):\n record.append(i)\n if len(record) == k:\n copy_record = record.copy()\n res.append(copy_record)\n else:\n idx += 1\n self.dfs(n, k, idx, record, res)\n record.pop(...
<|body_start_0|> idx = 1 record = [] res = [] self.dfs(n, k, idx, record, res) return res <|end_body_0|> <|body_start_1|> for i in range(idx, n + 1): record.append(i) if len(record) == k: copy_record = record.copy() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_0|> def dfs(self, n, k, idx=1, record=[], res=[]): """:type k: int :type n: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_009060
753
no_license
[ { "docstring": ":type n: int :type k: int :rtype: List[List[int]]", "name": "combine", "signature": "def combine(self, n, k)" }, { "docstring": ":type k: int :type n: int :rtype: List[List[int]]", "name": "dfs", "signature": "def dfs(self, n, k, idx=1, record=[], res=[])" } ]
2
stack_v2_sparse_classes_30k_val_003027
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]] - def dfs(self, n, k, idx=1, record=[], res=[]): :type k: int :type n: int :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]] - def dfs(self, n, k, idx=1, record=[], res=[]): :type k: int :type n: int :rtype: List[List[int]] <|s...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" <|body_0|> def dfs(self, n, k, idx=1, record=[], res=[]): """:type k: int :type n: int :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def combine(self, n, k): """:type n: int :type k: int :rtype: List[List[int]]""" idx = 1 record = [] res = [] self.dfs(n, k, idx, record, res) return res def dfs(self, n, k, idx=1, record=[], res=[]): """:type k: int :type n: int :rtype: L...
the_stack_v2_python_sparse
leetcode/combine-77.py
pittcat/Algorithm_Practice
train
0
6ce31067b4a0af641709930a01e204e3f0aa8ee2
[ "super().__init__()\nself.args = args\nself.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * self.args.n_qubits))\nself.qai = quant_arc_interface", "q_in = torch.tanh(input_features) * np.pi / 2.0\nq_in = q_in.to(self.args.device)\nq_out = torch.Tensor(0, self.args.target_class)\nq_out ...
<|body_start_0|> super().__init__() self.args = args self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * self.args.n_qubits)) self.qai = quant_arc_interface <|end_body_0|> <|body_start_1|> q_in = torch.tanh(input_features) * np.pi / 2.0 q_in ...
Torch module implementing the *dressed* quantum net.
vqc_net
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class vqc_net: """Torch module implementing the *dressed* quantum net.""" def __init__(self, args, quant_arc_interface): """Definition of the *dressed* layout.""" <|body_0|> def forward(self, input_features): """Defining how tensors are supposed to move through the *dr...
stack_v2_sparse_classes_75kplus_train_009061
1,518
permissive
[ { "docstring": "Definition of the *dressed* layout.", "name": "__init__", "signature": "def __init__(self, args, quant_arc_interface)" }, { "docstring": "Defining how tensors are supposed to move through the *dressed* quantum net.", "name": "forward", "signature": "def forward(self, inpu...
2
stack_v2_sparse_classes_30k_train_003074
Implement the Python class `vqc_net` described below. Class description: Torch module implementing the *dressed* quantum net. Method signatures and docstrings: - def __init__(self, args, quant_arc_interface): Definition of the *dressed* layout. - def forward(self, input_features): Defining how tensors are supposed to...
Implement the Python class `vqc_net` described below. Class description: Torch module implementing the *dressed* quantum net. Method signatures and docstrings: - def __init__(self, args, quant_arc_interface): Definition of the *dressed* layout. - def forward(self, input_features): Defining how tensors are supposed to...
8126691b43bddc2b1a96f73ab35d04d1af200d7a
<|skeleton|> class vqc_net: """Torch module implementing the *dressed* quantum net.""" def __init__(self, args, quant_arc_interface): """Definition of the *dressed* layout.""" <|body_0|> def forward(self, input_features): """Defining how tensors are supposed to move through the *dr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class vqc_net: """Torch module implementing the *dressed* quantum net.""" def __init__(self, args, quant_arc_interface): """Definition of the *dressed* layout.""" super().__init__() self.args = args self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth *...
the_stack_v2_python_sparse
model/vqc_layers.py
zzh237/quanthmc
train
0
9868a9fbb8ec0e8b8e0e0a83a46b8cb5d7be5a9b
[ "channel_repo = DesignatedChannelRepository()\nchannels = await channel_repo.get_all_designated_channels()\nembed = discord.Embed(title=f'Designated Channels', color=Colors.ClemsonOrange)\nif channels is None:\n embed.add_field(name='No possible designated channels', value='')\n await ctx.send(embed=embed)\n ...
<|body_start_0|> channel_repo = DesignatedChannelRepository() channels = await channel_repo.get_all_designated_channels() embed = discord.Embed(title=f'Designated Channels', color=Colors.ClemsonOrange) if channels is None: embed.add_field(name='No possible designated channels...
DesignatedChannelsCog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DesignatedChannelsCog: async def channel(self, ctx): """Sends a formatted embed of the possible designated channels and their listeners to the context of the command""" <|body_0|> async def add(self, ctx, channel_type: str, channel: discord.TextChannel): """Command t...
stack_v2_sparse_classes_75kplus_train_009062
4,243
permissive
[ { "docstring": "Sends a formatted embed of the possible designated channels and their listeners to the context of the command", "name": "channel", "signature": "async def channel(self, ctx)" }, { "docstring": "Command to add a registered TextChannel too a designated channel Args: channel_type (s...
3
null
Implement the Python class `DesignatedChannelsCog` described below. Class description: Implement the DesignatedChannelsCog class. Method signatures and docstrings: - async def channel(self, ctx): Sends a formatted embed of the possible designated channels and their listeners to the context of the command - async def ...
Implement the Python class `DesignatedChannelsCog` described below. Class description: Implement the DesignatedChannelsCog class. Method signatures and docstrings: - async def channel(self, ctx): Sends a formatted embed of the possible designated channels and their listeners to the context of the command - async def ...
2f8b45f06abb510029f3461ab5e39535a5eb3385
<|skeleton|> class DesignatedChannelsCog: async def channel(self, ctx): """Sends a formatted embed of the possible designated channels and their listeners to the context of the command""" <|body_0|> async def add(self, ctx, channel_type: str, channel: discord.TextChannel): """Command t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DesignatedChannelsCog: async def channel(self, ctx): """Sends a formatted embed of the possible designated channels and their listeners to the context of the command""" channel_repo = DesignatedChannelRepository() channels = await channel_repo.get_all_designated_channels() embe...
the_stack_v2_python_sparse
bot/cogs/designated_channels_cog.py
new-zelind/ClemBot
train
1
b89cc1a4b7aee8abf2c5c25ddf4889d97bb242cc
[ "mobile = attrs.get('mobile')\nif not re.match('1[3-9]\\\\d{9}$', mobile):\n raise serializers.ValidationError('手机号不合法。')\nif attrs.get('password') != attrs.get('password2'):\n raise serializers.ValidationError('两次输入密码不一致。')\nredis_conn = get_redis_connection('default')\nreal_sms_code = redis_conn.get('sms_%s...
<|body_start_0|> mobile = attrs.get('mobile') if not re.match('1[3-9]\\d{9}$', mobile): raise serializers.ValidationError('手机号不合法。') if attrs.get('password') != attrs.get('password2'): raise serializers.ValidationError('两次输入密码不一致。') redis_conn = get_redis_connecti...
用户注册序列化器
UserRegisterSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRegisterSerializer: """用户注册序列化器""" def validate(self, attrs): """验证数据 :param attrs: :return:""" <|body_0|> def create(self, validated_data): """重写父类create方法 :param validated_data: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> mobi...
stack_v2_sparse_classes_75kplus_train_009063
3,402
no_license
[ { "docstring": "验证数据 :param attrs: :return:", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "重写父类create方法 :param validated_data: :return:", "name": "create", "signature": "def create(self, validated_data)" } ]
2
stack_v2_sparse_classes_30k_test_000395
Implement the Python class `UserRegisterSerializer` described below. Class description: 用户注册序列化器 Method signatures and docstrings: - def validate(self, attrs): 验证数据 :param attrs: :return: - def create(self, validated_data): 重写父类create方法 :param validated_data: :return:
Implement the Python class `UserRegisterSerializer` described below. Class description: 用户注册序列化器 Method signatures and docstrings: - def validate(self, attrs): 验证数据 :param attrs: :return: - def create(self, validated_data): 重写父类create方法 :param validated_data: :return: <|skeleton|> class UserRegisterSerializer: "...
c7a57b6ac23885a6db682899d9360017708d084a
<|skeleton|> class UserRegisterSerializer: """用户注册序列化器""" def validate(self, attrs): """验证数据 :param attrs: :return:""" <|body_0|> def create(self, validated_data): """重写父类create方法 :param validated_data: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserRegisterSerializer: """用户注册序列化器""" def validate(self, attrs): """验证数据 :param attrs: :return:""" mobile = attrs.get('mobile') if not re.match('1[3-9]\\d{9}$', mobile): raise serializers.ValidationError('手机号不合法。') if attrs.get('password') != attrs.get('passwo...
the_stack_v2_python_sparse
backend/backend/apps/users/serializers.py
chenya1123236324/AutomationTestPlat
train
1
b8715e3fce019f376643ca7164d0492969bd21fd
[ "if s == None or t == None:\n return s == t\nelse:\n return self.is_same(s, t) or self.isSubtree(s.left, t) or self.isSubtree(s.right, t)", "if s == None or t == None:\n return s == t\nelse:\n return s.val == t.val and self.is_same(s.left, t.left) and self.is_same(s.right, t.right)" ]
<|body_start_0|> if s == None or t == None: return s == t else: return self.is_same(s, t) or self.isSubtree(s.left, t) or self.isSubtree(s.right, t) <|end_body_0|> <|body_start_1|> if s == None or t == None: return s == t else: return s.va...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_0|> def is_same(self, s, t): """这个函数的作用是判断两棵树是否相等""" <|body_1|> <|end_skeleton|> <|body_start_0|> if s == None or t == None: return s == t...
stack_v2_sparse_classes_75kplus_train_009064
1,074
no_license
[ { "docstring": ":type s: TreeNode :type t: TreeNode :rtype: bool", "name": "isSubtree", "signature": "def isSubtree(self, s, t)" }, { "docstring": "这个函数的作用是判断两棵树是否相等", "name": "is_same", "signature": "def is_same(self, s, t)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool - def is_same(self, s, t): 这个函数的作用是判断两棵树是否相等
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSubtree(self, s, t): :type s: TreeNode :type t: TreeNode :rtype: bool - def is_same(self, s, t): 这个函数的作用是判断两棵树是否相等 <|skeleton|> class Solution: def isSubtree(self, s,...
9dccbdea918cc0531f7cbe60677a197a60ac61b7
<|skeleton|> class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" <|body_0|> def is_same(self, s, t): """这个函数的作用是判断两棵树是否相等""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isSubtree(self, s, t): """:type s: TreeNode :type t: TreeNode :rtype: bool""" if s == None or t == None: return s == t else: return self.is_same(s, t) or self.isSubtree(s.left, t) or self.isSubtree(s.right, t) def is_same(self, s, t): ...
the_stack_v2_python_sparse
leetcode/Tree/SubtreeofAnotherTree.py
chuanfanyoudong/algorithm
train
0
5e01368734d75e145c89d7234eb112a95433cc38
[ "if type(rdata) == list:\n rdata = np.array(rdata)\nself.rdata = rdata\nself.nfeat = rdata.shape[1]\nself.rsize = rdata.shape[0]\nself.scount = 0\nself.wsize = wsize\nself.wpsize = wpsize\nself.vcount = 0\nself.cdata = list()", "assertGreaterEqual(self.wsize, 50, 'minimum window size is 50')\nself.scount += 1\...
<|body_start_0|> if type(rdata) == list: rdata = np.array(rdata) self.rdata = rdata self.nfeat = rdata.shape[1] self.rsize = rdata.shape[0] self.scount = 0 self.wsize = wsize self.wpsize = wpsize self.vcount = 0 self.cdata = list() <|en...
drift detection without label feedback
UnSupConceptDrift
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnSupConceptDrift: """drift detection without label feedback""" def __init__(self, rdata, wsize, wpsize): """initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size""" <|body_0|> def add(self, flist): """detects drif...
stack_v2_sparse_classes_75kplus_train_009065
4,219
permissive
[ { "docstring": "initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size", "name": "__init__", "signature": "def __init__(self, rdata, wsize, wpsize)" }, { "docstring": "detects drift online Parameters flist : feature value list", "name": "add", ...
3
stack_v2_sparse_classes_30k_train_011987
Implement the Python class `UnSupConceptDrift` described below. Class description: drift detection without label feedback Method signatures and docstrings: - def __init__(self, rdata, wsize, wpsize): initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size - def add(self,...
Implement the Python class `UnSupConceptDrift` described below. Class description: drift detection without label feedback Method signatures and docstrings: - def __init__(self, rdata, wsize, wpsize): initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size - def add(self,...
861fd06b6b7abaffe5e8ca795136ab0fbb2234b5
<|skeleton|> class UnSupConceptDrift: """drift detection without label feedback""" def __init__(self, rdata, wsize, wpsize): """initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size""" <|body_0|> def add(self, flist): """detects drif...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnSupConceptDrift: """drift detection without label feedback""" def __init__(self, rdata, wsize, wpsize): """initializer Parameters rdata : reference data wsize : window size wpsize : window processing step size""" if type(rdata) == list: rdata = np.array(rdata) self.r...
the_stack_v2_python_sparse
matumizi/matumizi/udrift.py
pranab/whakapai
train
18
46f324c5e26717807963c5ebe1bd34e28eacbc0e
[ "armors = Armor.objects.all()\nserializer = ArmorSerializer(armors, many=True)\nreturn Response(serializer.data)", "queryset = Armor.objects.all()\narmor = get_object_or_404(queryset, pk=pk)\nserializer = ArmorSerializer(armor)\nreturn Response(serializer.data)" ]
<|body_start_0|> armors = Armor.objects.all() serializer = ArmorSerializer(armors, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> queryset = Armor.objects.all() armor = get_object_or_404(queryset, pk=pk) serializer = ArmorSerializer(armor) ...
ArmorView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArmorView: def list(self, request): """Получение списка брони""" <|body_0|> def retrieve(self, request, pk=None): """Получение брони по идентификатору pk - идентификатор брони""" <|body_1|> <|end_skeleton|> <|body_start_0|> armors = Armor.objects.al...
stack_v2_sparse_classes_75kplus_train_009066
12,404
no_license
[ { "docstring": "Получение списка брони", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Получение брони по идентификатору pk - идентификатор брони", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" } ]
2
stack_v2_sparse_classes_30k_train_034851
Implement the Python class `ArmorView` described below. Class description: Implement the ArmorView class. Method signatures and docstrings: - def list(self, request): Получение списка брони - def retrieve(self, request, pk=None): Получение брони по идентификатору pk - идентификатор брони
Implement the Python class `ArmorView` described below. Class description: Implement the ArmorView class. Method signatures and docstrings: - def list(self, request): Получение списка брони - def retrieve(self, request, pk=None): Получение брони по идентификатору pk - идентификатор брони <|skeleton|> class ArmorView...
be47a0a6f50bf8680b22e0b9cae3e3b34a198a3d
<|skeleton|> class ArmorView: def list(self, request): """Получение списка брони""" <|body_0|> def retrieve(self, request, pk=None): """Получение брони по идентификатору pk - идентификатор брони""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArmorView: def list(self, request): """Получение списка брони""" armors = Armor.objects.all() serializer = ArmorSerializer(armors, many=True) return Response(serializer.data) def retrieve(self, request, pk=None): """Получение брони по идентификатору pk - идентифика...
the_stack_v2_python_sparse
StarfinderBack/starfinder/views.py
Skirgus/StarfinderMasterAssistant
train
0
ce79b9a6b5e82afc4fee52595900ad58a8f9af12
[ "super(IIJSeil, self).__init__(raw)\nself.os = 'SEIL'\nself.model = self.UNKNOWN\nself.version = self.UNKNOWN", "regex = '(SEIL\\\\/.*)\\\\s+ver\\\\s+(.*)\\\\s+\\\\(.*\\\\)'\npat = re.compile(regex)\nres = pat.search(self.raw)\nif res:\n self.model = res.group(1)\n self.version = res.group(2)\n return se...
<|body_start_0|> super(IIJSeil, self).__init__(raw) self.os = 'SEIL' self.model = self.UNKNOWN self.version = self.UNKNOWN <|end_body_0|> <|body_start_1|> regex = '(SEIL\\/.*)\\s+ver\\s+(.*)\\s+\\(.*\\)' pat = re.compile(regex) res = pat.search(self.raw) ...
Class IIJSeil. SNMP sysDescr for IIJSeil.
IIJSeil
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IIJSeil: """Class IIJSeil. SNMP sysDescr for IIJSeil.""" def __init__(self, raw): """Constructor.""" <|body_0|> def parse(self): """Parse.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(IIJSeil, self).__init__(raw) self.os = 'SEIL...
stack_v2_sparse_classes_75kplus_train_009067
698
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, raw)" }, { "docstring": "Parse.", "name": "parse", "signature": "def parse(self)" } ]
2
stack_v2_sparse_classes_30k_val_001468
Implement the Python class `IIJSeil` described below. Class description: Class IIJSeil. SNMP sysDescr for IIJSeil. Method signatures and docstrings: - def __init__(self, raw): Constructor. - def parse(self): Parse.
Implement the Python class `IIJSeil` described below. Class description: Class IIJSeil. SNMP sysDescr for IIJSeil. Method signatures and docstrings: - def __init__(self, raw): Constructor. - def parse(self): Parse. <|skeleton|> class IIJSeil: """Class IIJSeil. SNMP sysDescr for IIJSeil.""" def __init__(self...
23898bf68428439a9ea8d7369a230890301f73c6
<|skeleton|> class IIJSeil: """Class IIJSeil. SNMP sysDescr for IIJSeil.""" def __init__(self, raw): """Constructor.""" <|body_0|> def parse(self): """Parse.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IIJSeil: """Class IIJSeil. SNMP sysDescr for IIJSeil.""" def __init__(self, raw): """Constructor.""" super(IIJSeil, self).__init__(raw) self.os = 'SEIL' self.model = self.UNKNOWN self.version = self.UNKNOWN def parse(self): """Parse.""" regex =...
the_stack_v2_python_sparse
sysdescrparser/iij_seil.py
mtoshi/sysdescrparser
train
14
04c07f4ed4dd26e83238371ada0b03dffca0aea6
[ "super(CloudSQLInstance, self).__init__(resource_id=instance_id, resource_type=resource.ResourceType.CLOUD_SQL_INSTANCE, name=name, display_name=display_name, parent=parent, locations=locations, lifecycle_state=lifecycle_state)\nself.full_name = full_name\nself.data = data", "instance_dict = json.loads(json_strin...
<|body_start_0|> super(CloudSQLInstance, self).__init__(resource_id=instance_id, resource_type=resource.ResourceType.CLOUD_SQL_INSTANCE, name=name, display_name=display_name, parent=parent, locations=locations, lifecycle_state=lifecycle_state) self.full_name = full_name self.data = data <|end_bo...
CloudSQL Instance resource.
CloudSQLInstance
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudSQLInstance: """CloudSQL Instance resource.""" def __init__(self, instance_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=CloudSQLInstanceLifecycleState.UNSPECIFIED): """Initialize. Args: instance_id (str): The cloud sql...
stack_v2_sparse_classes_75kplus_train_009068
3,326
permissive
[ { "docstring": "Initialize. Args: instance_id (str): The cloud sql instance id. full_name (str): The full resource name and ancestry. data (str): Resource representation of the cloud sql instance. name (str): The cloud_sql_instance's unique GCP name, with the format \"cloud_sql_instances/{id}\". display_name (s...
2
stack_v2_sparse_classes_30k_train_031612
Implement the Python class `CloudSQLInstance` described below. Class description: CloudSQL Instance resource. Method signatures and docstrings: - def __init__(self, instance_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=CloudSQLInstanceLifecycleState.UNSPECI...
Implement the Python class `CloudSQLInstance` described below. Class description: CloudSQL Instance resource. Method signatures and docstrings: - def __init__(self, instance_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=CloudSQLInstanceLifecycleState.UNSPECI...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class CloudSQLInstance: """CloudSQL Instance resource.""" def __init__(self, instance_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=CloudSQLInstanceLifecycleState.UNSPECIFIED): """Initialize. Args: instance_id (str): The cloud sql...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CloudSQLInstance: """CloudSQL Instance resource.""" def __init__(self, instance_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=CloudSQLInstanceLifecycleState.UNSPECIFIED): """Initialize. Args: instance_id (str): The cloud sql instance id....
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_type/cloudsql_instance.py
kevensen/forseti-security
train
1
d25cb5a993337334cda38fd4c1303c5996d9f547
[ "map = set()\nwhile head:\n if head in map:\n return True\n else:\n map.add(head)\n head = head.next\nreturn False", "if not head or not head.next:\n return False\nfast, slow = (head.next, head)\nwhile fast != slow:\n if not fast or not fast.next:\n return False\n slow = slo...
<|body_start_0|> map = set() while head: if head in map: return True else: map.add(head) head = head.next return False <|end_body_0|> <|body_start_1|> if not head or not head.next: return False fast,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool 哈希表 时间击败78.12%,内存击败12.87%""" <|body_0|> def hasCycle1(self, head: ListNode) -> bool: """:type head: ListNode :rtype: bool 快慢指针 利用了Floyd 判圈算法,又称龟兔赛跑算法 假想「乌龟」和「兔子」在链表上移动,「兔子」跑得快,「乌龟」跑得慢。 当「乌龟」和「兔子...
stack_v2_sparse_classes_75kplus_train_009069
3,134
no_license
[ { "docstring": ":type head: ListNode :rtype: bool 哈希表 时间击败78.12%,内存击败12.87%", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool 快慢指针 利用了Floyd 判圈算法,又称龟兔赛跑算法 假想「乌龟」和「兔子」在链表上移动,「兔子」跑得快,「乌龟」跑得慢。 当「乌龟」和「兔子」从链表上的同一个节点开始移动时,如果该链表中没有环,那么「兔子」...
2
stack_v2_sparse_classes_30k_train_016698
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool 哈希表 时间击败78.12%,内存击败12.87% - def hasCycle1(self, head: ListNode) -> bool: :type head: ListNode :rtype: bool 快慢指针 利用了Flo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool 哈希表 时间击败78.12%,内存击败12.87% - def hasCycle1(self, head: ListNode) -> bool: :type head: ListNode :rtype: bool 快慢指针 利用了Flo...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool 哈希表 时间击败78.12%,内存击败12.87%""" <|body_0|> def hasCycle1(self, head: ListNode) -> bool: """:type head: ListNode :rtype: bool 快慢指针 利用了Floyd 判圈算法,又称龟兔赛跑算法 假想「乌龟」和「兔子」在链表上移动,「兔子」跑得快,「乌龟」跑得慢。 当「乌龟」和「兔子...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool 哈希表 时间击败78.12%,内存击败12.87%""" map = set() while head: if head in map: return True else: map.add(head) head = head.next return False d...
the_stack_v2_python_sparse
141_linked-list-cycle.py
95275059/Algorithm
train
0
a2796351de78a282c6999edd4f2b1726072060ec
[ "p = 0\nif len(nums) == 0:\n return []\nif k >= len(nums):\n return [max(nums)]\nresult = []\nwhile p + k <= len(nums):\n result.append(max(nums[p:p + k]))\n p += 1\nreturn result", "if len(nums) == 0:\n return []\nif k >= len(nums):\n return [max(nums)]\nresult = []\nmaxValue = max(nums[0:k])\n...
<|body_start_0|> p = 0 if len(nums) == 0: return [] if k >= len(nums): return [max(nums)] result = [] while p + k <= len(nums): result.append(max(nums[p:p + k])) p += 1 return result <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxSlidingWindow2(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_009070
859
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "maxSlidingWindow2", "signature": "def maxSlidingWindow2...
2
stack_v2_sparse_classes_30k_train_001862
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxSlidingWindow2(self, nums, k): :type nums: List[int] :type k: int :rtype: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def maxSlidingWindow2(self, nums, k): :type nums: List[int] :type k: int :rtype: List[...
0fddcc61923d760faa5fc60311861cbe89a54ba9
<|skeleton|> class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def maxSlidingWindow2(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSlidingWindow(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" p = 0 if len(nums) == 0: return [] if k >= len(nums): return [max(nums)] result = [] while p + k <= len(nums): result.ap...
the_stack_v2_python_sparse
239.py
zenmeder/leetcode
train
0
ea9741d0003975c6d8a0b075fd2247a8476b1936
[ "self.rects = rects\ncurSize = 0\nself.preSize = []\nfor rect in rects:\n curSize += (rect[2] - rect[0]) * (rect[3] - rect[1])\n self.preSize.append(curSize)\nself.totalSize = curSize", "randWeight = random.randint(1, self.totalSize)\nstart = 0\nend = len(self.preSize) - 1\nidx = None\nwhile start < end:\n ...
<|body_start_0|> self.rects = rects curSize = 0 self.preSize = [] for rect in rects: curSize += (rect[2] - rect[0]) * (rect[3] - rect[1]) self.preSize.append(curSize) self.totalSize = curSize <|end_body_0|> <|body_start_1|> randWeight = random.ran...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.rects = rects curSize = 0 self.preSize = [] for rect...
stack_v2_sparse_classes_75kplus_train_009071
2,383
no_license
[ { "docstring": ":type rects: List[List[int]]", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_050301
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] - def pick(self): :rtype: List[int] <|skeleton|> class Solution: def __init__(self, rects): """:type rects: ...
fd310ec0a989e003242f1840230aaac150f006f0
<|skeleton|> class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, rects): """:type rects: List[List[int]]""" self.rects = rects curSize = 0 self.preSize = [] for rect in rects: curSize += (rect[2] - rect[0]) * (rect[3] - rect[1]) self.preSize.append(curSize) self.totalSize =...
the_stack_v2_python_sparse
好咧,最后还是要搞google/medium/RandomPointinNonoverlappingRectangles497_WRONG.py
jing1988a/python_fb
train
0
15134f02b3556dbd2a9e00e668d640d8b9a9f1bd
[ "self.sensor = sensor\nself.pump = pump\nself.decider = decider\nself.liquid_level = int()\nself.pump_status = int()\nself.control_decision = int()\nself.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}", "self.liquid_level = self.sensor.measure()\nlogging.debug('In Contro...
<|body_start_0|> self.sensor = sensor self.pump = pump self.decider = decider self.liquid_level = int() self.pump_status = int() self.control_decision = int() self.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF} <|end_body...
Encapsulates command and coordination for the water-regulation module
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_75kplus_train_009072
2,605
no_license
[ { "docstring": "Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance of decider.Decider", "name": "__init__", "signature": "def __init__(self, sensor, pump, decider)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_035201
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
Implement the Python class `Controller` described below. Class description: Encapsulates command and coordination for the water-regulation module Method signatures and docstrings: - def __init__(self, sensor, pump, decider): Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Ty...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typicall...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Controller: """Encapsulates command and coordination for the water-regulation module""" def __init__(self, sensor, pump, decider): """Create a new controller :param sensor: Typically an instance of sensor.Sensor :param pump: Typically an instance of pump.Pump :param decider: Typically an instance...
the_stack_v2_python_sparse
students/srepking/lesson06/water-regulation/waterregulation/controller.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
d4bf322be501cd9bfbf4c71d03cc1afaa6da019b
[ "self._path = path\nself._summary_dirs: List[Path] = []\nevent_files = self._discover_event_files(self._path)\ncb_summaries = self._discover_cerebras_summary_dirs(event_files)\nself._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries)\nif not self._summary_dirs:\n logging.warning(f'Could not find any...
<|body_start_0|> self._path = path self._summary_dirs: List[Path] = [] event_files = self._discover_event_files(self._path) cb_summaries = self._discover_cerebras_summary_dirs(event_files) self._summary_dirs = self._discover_tensor_summary_dirs(cb_summaries) if not self._...
Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live run. As more data becomes available, calling the ...
TensorSummaryReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorSummaryReader: """Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live ru...
stack_v2_sparse_classes_75kplus_train_009073
16,325
permissive
[ { "docstring": "Constructs a `TensorSummaryReader` instance. Args: path: Path to a Tensorboard events file or a directory containing Tensorboard events files. Location of tensor summaries are inferred from these events files as there is a one-to-one mapping from Tensorboard events files and tensor summary direc...
6
stack_v2_sparse_classes_30k_train_049047
Implement the Python class `TensorSummaryReader` described below. Class description: Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching....
Implement the Python class `TensorSummaryReader` described below. Class description: Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching....
97bdaf4460ace1681ad437b07ba33f0e179f5ca4
<|skeleton|> class TensorSummaryReader: """Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live ru...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TensorSummaryReader: """Class for reading summarized tensors. This class works in tandem with `TensorSummary` defined above. It provides general convenience APIs for inspecting tensor summaries produced by a run. Currently this class does not do any caching. So it can be used to inspect a live run. As more da...
the_stack_v2_python_sparse
modelzoo/common/pytorch/summaries/tensor_summary.py
Cerebras/modelzoo
train
644
805f530bab71d4a09b91e729ee876a7b65185179
[ "for i in range(len(board)):\n for j in range(len(board[0])):\n if self.dfs(board, i, j, word):\n return True\nreturn False", "if len(word) == 0:\n return True\nif i < 0 or i > len(board) - 1 or j < 0 or (j > len(board[0]) - 1) or (board[i][j] != word[0]):\n return False\ntmp = board[i]...
<|body_start_0|> for i in range(len(board)): for j in range(len(board[0])): if self.dfs(board, i, j, word): return True return False <|end_body_0|> <|body_start_1|> if len(word) == 0: return True if i < 0 or i > len(board) - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def exist(self, board, word): """horizontally search""" <|body_0|> def dfs(self, board, i, j, word): """make sure whether there exists a path of given word start from board[i][j] this is dfs search!!! 1. first check if board[i][j] == word[0], return false i...
stack_v2_sparse_classes_75kplus_train_009074
1,860
no_license
[ { "docstring": "horizontally search", "name": "exist", "signature": "def exist(self, board, word)" }, { "docstring": "make sure whether there exists a path of given word start from board[i][j] this is dfs search!!! 1. first check if board[i][j] == word[0], return false if not, turn to another di...
2
stack_v2_sparse_classes_30k_train_001265
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exist(self, board, word): horizontally search - def dfs(self, board, i, j, word): make sure whether there exists a path of given word start from board[i][j] this is dfs searc...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exist(self, board, word): horizontally search - def dfs(self, board, i, j, word): make sure whether there exists a path of given word start from board[i][j] this is dfs searc...
b9a2bd8385e44cc79454f9c7f2146370896559ec
<|skeleton|> class Solution: def exist(self, board, word): """horizontally search""" <|body_0|> def dfs(self, board, i, j, word): """make sure whether there exists a path of given word start from board[i][j] this is dfs search!!! 1. first check if board[i][j] == word[0], return false i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def exist(self, board, word): """horizontally search""" for i in range(len(board)): for j in range(len(board[0])): if self.dfs(board, i, j, word): return True return False def dfs(self, board, i, j, word): """make s...
the_stack_v2_python_sparse
79.WordSearch.py
haveGrasses/Algorithm
train
0
8cdd9c4831233327bfd3a2ec7a1116fb1a2926ed
[ "try:\n url = base + cls.url if base is not None else cls.url\nexcept AttributeError:\n raise ViewConfigurationError('No URL provided!')\nkwargs = {}\nname = getattr(cls, 'name', None)\nif name is not None:\n kwargs['name'] = name\ncls.route = app.router.add_view(url, cls, **kwargs)\ncls.rental_manager = a...
<|body_start_0|> try: url = base + cls.url if base is not None else cls.url except AttributeError: raise ViewConfigurationError('No URL provided!') kwargs = {} name = getattr(cls, 'name', None) if name is not None: kwargs['name'] = name ...
The base view that all other views extend. Contains some useful helper functions that the extending classes can use.
BaseView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseView: """The base view that all other views extend. Contains some useful helper functions that the extending classes can use.""" def register_route(cls, app: Application, base: Optional[str]=None): """Registers the view with the given router. :raises ViewConfigurationError: If th...
stack_v2_sparse_classes_75kplus_train_009075
2,797
permissive
[ { "docstring": "Registers the view with the given router. :raises ViewConfigurationError: If the URL hasn't been set on the given view.", "name": "register_route", "signature": "def register_route(cls, app: Application, base: Optional[str]=None)" }, { "docstring": "Enables CORS on the view.", ...
2
stack_v2_sparse_classes_30k_train_018774
Implement the Python class `BaseView` described below. Class description: The base view that all other views extend. Contains some useful helper functions that the extending classes can use. Method signatures and docstrings: - def register_route(cls, app: Application, base: Optional[str]=None): Registers the view wit...
Implement the Python class `BaseView` described below. Class description: The base view that all other views extend. Contains some useful helper functions that the extending classes can use. Method signatures and docstrings: - def register_route(cls, app: Application, base: Optional[str]=None): Registers the view wit...
fc6f9230e4701cbddcb16d7257fddb9ff08bddb9
<|skeleton|> class BaseView: """The base view that all other views extend. Contains some useful helper functions that the extending classes can use.""" def register_route(cls, app: Application, base: Optional[str]=None): """Registers the view with the given router. :raises ViewConfigurationError: If th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseView: """The base view that all other views extend. Contains some useful helper functions that the extending classes can use.""" def register_route(cls, app: Application, base: Optional[str]=None): """Registers the view with the given router. :raises ViewConfigurationError: If the URL hasn't ...
the_stack_v2_python_sparse
server/views/base.py
dragorhast/server
train
6
113625d1e35f6d827093f5c2423538f371052849
[ "self.DRIVER = DRIVER\nself.SERVER = SERVER\nself.DATABASE = DATABASE\nself.UID = UID\nself.PWD = PWD", "if not self.DATABASE:\n raise (NameError, 'no setting db info')\nself.conn = pyodbc.connect(DRIVER=self.DRIVER, SERVER=self.SERVER, DATABASE=self.DATABASE, UID=self.UID, PWD=self.PWD, charset='UTF-8')\ncur ...
<|body_start_0|> self.DRIVER = DRIVER self.SERVER = SERVER self.DATABASE = DATABASE self.UID = UID self.PWD = PWD <|end_body_0|> <|body_start_1|> if not self.DATABASE: raise (NameError, 'no setting db info') self.conn = pyodbc.connect(DRIVER=self.DRIV...
'' 对pyodbc库的操作进行简单封装 pyodbc库的下载地址:http://code.google.com/p/pyodbc/downloads/list 使用该库时,需要在Sql Server Configuration Manager里面将TCP/IP协议开启 此类完成对数据库DB的连接/查询/执行操作 正确的连接方式如下: cnxn = pyodbc.connect('DRIVER={SQL SERVER};SERVER=ZHANGHUAMIN\\MSSQLSERVER_ZHM;DATABASE=AdventureWorks2008;UID=sa;PWD=wa1234') cnxn = pyodbc.connect(DR...
ODBC_MS
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ODBC_MS: """'' 对pyodbc库的操作进行简单封装 pyodbc库的下载地址:http://code.google.com/p/pyodbc/downloads/list 使用该库时,需要在Sql Server Configuration Manager里面将TCP/IP协议开启 此类完成对数据库DB的连接/查询/执行操作 正确的连接方式如下: cnxn = pyodbc.connect('DRIVER={SQL SERVER};SERVER=ZHANGHUAMIN\\MSSQLSERVER_ZHM;DATABASE=AdventureWorks2008;UID=sa;PW...
stack_v2_sparse_classes_75kplus_train_009076
2,271
permissive
[ { "docstring": "'' initialization", "name": "__init__", "signature": "def __init__(self, DRIVER, SERVER, DATABASE, UID, PWD)" }, { "docstring": "'' Connect to the DB", "name": "__GetConnect", "signature": "def __GetConnect(self)" }, { "docstring": "'' Perform one Sql statement", ...
4
stack_v2_sparse_classes_30k_train_031221
Implement the Python class `ODBC_MS` described below. Class description: '' 对pyodbc库的操作进行简单封装 pyodbc库的下载地址:http://code.google.com/p/pyodbc/downloads/list 使用该库时,需要在Sql Server Configuration Manager里面将TCP/IP协议开启 此类完成对数据库DB的连接/查询/执行操作 正确的连接方式如下: cnxn = pyodbc.connect('DRIVER={SQL SERVER};SERVER=ZHANGHUAMIN\\MSSQLSERVER_ZH...
Implement the Python class `ODBC_MS` described below. Class description: '' 对pyodbc库的操作进行简单封装 pyodbc库的下载地址:http://code.google.com/p/pyodbc/downloads/list 使用该库时,需要在Sql Server Configuration Manager里面将TCP/IP协议开启 此类完成对数据库DB的连接/查询/执行操作 正确的连接方式如下: cnxn = pyodbc.connect('DRIVER={SQL SERVER};SERVER=ZHANGHUAMIN\\MSSQLSERVER_ZH...
0f42eb49a102626b11a0902c61deee9c5a17189b
<|skeleton|> class ODBC_MS: """'' 对pyodbc库的操作进行简单封装 pyodbc库的下载地址:http://code.google.com/p/pyodbc/downloads/list 使用该库时,需要在Sql Server Configuration Manager里面将TCP/IP协议开启 此类完成对数据库DB的连接/查询/执行操作 正确的连接方式如下: cnxn = pyodbc.connect('DRIVER={SQL SERVER};SERVER=ZHANGHUAMIN\\MSSQLSERVER_ZHM;DATABASE=AdventureWorks2008;UID=sa;PW...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ODBC_MS: """'' 对pyodbc库的操作进行简单封装 pyodbc库的下载地址:http://code.google.com/p/pyodbc/downloads/list 使用该库时,需要在Sql Server Configuration Manager里面将TCP/IP协议开启 此类完成对数据库DB的连接/查询/执行操作 正确的连接方式如下: cnxn = pyodbc.connect('DRIVER={SQL SERVER};SERVER=ZHANGHUAMIN\\MSSQLSERVER_ZHM;DATABASE=AdventureWorks2008;UID=sa;PWD=wa1234') cn...
the_stack_v2_python_sparse
team-7/src/bookodbc.py
ynu-python-course/2017-autumn
train
0
512c2194c9fc1e2c180c3c18d45bb655df620bcb
[ "if request.access.has_scope('project:write'):\n results = list(SavedSearch.objects.filter(project=project, owner__isnull=True).order_by('name'))\nelse:\n results = list(SavedSearch.objects.filter(Q(owner=request.user) | Q(owner__isnull=True), project=project).order_by('name'))\nreturn Response(serialize(resu...
<|body_start_0|> if request.access.has_scope('project:write'): results = list(SavedSearch.objects.filter(project=project, owner__isnull=True).order_by('name')) else: results = list(SavedSearch.objects.filter(Q(owner=request.user) | Q(owner__isnull=True), project=project).order_by...
ProjectSearchesEndpoint
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectSearchesEndpoint: def get(self, request, project): """List a project's saved searches Retrieve a list of saved searches for a given project. {method} {path}""" <|body_0|> def post(self, request, project): """Create a new saved search Create a new saved search ...
stack_v2_sparse_classes_75kplus_train_009077
3,680
permissive
[ { "docstring": "List a project's saved searches Retrieve a list of saved searches for a given project. {method} {path}", "name": "get", "signature": "def get(self, request, project)" }, { "docstring": "Create a new saved search Create a new saved search for the given project. {method} {path} {{ ...
2
null
Implement the Python class `ProjectSearchesEndpoint` described below. Class description: Implement the ProjectSearchesEndpoint class. Method signatures and docstrings: - def get(self, request, project): List a project's saved searches Retrieve a list of saved searches for a given project. {method} {path} - def post(s...
Implement the Python class `ProjectSearchesEndpoint` described below. Class description: Implement the ProjectSearchesEndpoint class. Method signatures and docstrings: - def get(self, request, project): List a project's saved searches Retrieve a list of saved searches for a given project. {method} {path} - def post(s...
b937615079d7b24dc225a83b99b1b65da932fc66
<|skeleton|> class ProjectSearchesEndpoint: def get(self, request, project): """List a project's saved searches Retrieve a list of saved searches for a given project. {method} {path}""" <|body_0|> def post(self, request, project): """Create a new saved search Create a new saved search ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectSearchesEndpoint: def get(self, request, project): """List a project's saved searches Retrieve a list of saved searches for a given project. {method} {path}""" if request.access.has_scope('project:write'): results = list(SavedSearch.objects.filter(project=project, owner__isn...
the_stack_v2_python_sparse
src/sentry/api/endpoints/project_searches.py
atlassian/sentry
train
1
c39112dc88eaf85969b92f02b681899a79b2b5c4
[ "submission, submission_guids = submission\nif submission is None:\n raise werkzeug.exceptions.NotFound\nreturn submission", "context = api.commit_or_abort(db.session, default_error_message='Failed to update Submission details.')\nwith context:\n parameters.PatchSubmissionDetailsParameters.perform_patch(arg...
<|body_start_0|> submission, submission_guids = submission if submission is None: raise werkzeug.exceptions.NotFound return submission <|end_body_0|> <|body_start_1|> context = api.commit_or_abort(db.session, default_error_message='Failed to update Submission details.') ...
Manipulations with a specific Submission.
SubmissionByID
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionByID: """Manipulations with a specific Submission.""" def get(self, submission): """Get Submission details by ID. If submission is not found locally in database, a None submission will be returned. In this event, check SubmissionManager for remote Submission by UUID, if not...
stack_v2_sparse_classes_75kplus_train_009078
9,991
permissive
[ { "docstring": "Get Submission details by ID. If submission is not found locally in database, a None submission will be returned. In this event, check SubmissionManager for remote Submission by UUID, if not found, throw 404 as intended", "name": "get", "signature": "def get(self, submission)" }, { ...
3
stack_v2_sparse_classes_30k_train_054330
Implement the Python class `SubmissionByID` described below. Class description: Manipulations with a specific Submission. Method signatures and docstrings: - def get(self, submission): Get Submission details by ID. If submission is not found locally in database, a None submission will be returned. In this event, chec...
Implement the Python class `SubmissionByID` described below. Class description: Manipulations with a specific Submission. Method signatures and docstrings: - def get(self, submission): Get Submission details by ID. If submission is not found locally in database, a None submission will be returned. In this event, chec...
821c9cae985751a129b3be1ad08b8ad295d0a3d8
<|skeleton|> class SubmissionByID: """Manipulations with a specific Submission.""" def get(self, submission): """Get Submission details by ID. If submission is not found locally in database, a None submission will be returned. In this event, check SubmissionManager for remote Submission by UUID, if not...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubmissionByID: """Manipulations with a specific Submission.""" def get(self, submission): """Get Submission details by ID. If submission is not found locally in database, a None submission will be returned. In this event, check SubmissionManager for remote Submission by UUID, if not found, throw...
the_stack_v2_python_sparse
app/modules/submissions/resources.py
Emily-Ke/houston
train
0
f748a21c4217748fb2f34586dfe1d6b4312712f6
[ "if not root:\n return\nself.getMinimumDifferenceRecur(root.left, data)\ndata.append(root.val)\nself.getMinimumDifferenceRecur(root.right, data)", "data = []\nself.getMinimumDifferenceRecur(root, data)\nmin_diff = float('inf')\nfor i in range(1, len(data)):\n if data[i] - data[i - 1] < min_diff:\n mi...
<|body_start_0|> if not root: return self.getMinimumDifferenceRecur(root.left, data) data.append(root.val) self.getMinimumDifferenceRecur(root.right, data) <|end_body_0|> <|body_start_1|> data = [] self.getMinimumDifferenceRecur(root, data) min_diff =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMinimumDifferenceRecur(self, root, data): """:type root: TreeNode :rtype: int""" <|body_0|> def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_75kplus_train_009079
1,062
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "getMinimumDifferenceRecur", "signature": "def getMinimumDifferenceRecur(self, root, data)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "getMinimumDifference", "signature": "def getMinimumDifference(self, root)"...
2
stack_v2_sparse_classes_30k_train_003289
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifferenceRecur(self, root, data): :type root: TreeNode :rtype: int - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMinimumDifferenceRecur(self, root, data): :type root: TreeNode :rtype: int - def getMinimumDifference(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Sol...
37ece0a8e92a41ced2b4ce0f2d8dda3826b915ae
<|skeleton|> class Solution: def getMinimumDifferenceRecur(self, root, data): """:type root: TreeNode :rtype: int""" <|body_0|> def getMinimumDifference(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getMinimumDifferenceRecur(self, root, data): """:type root: TreeNode :rtype: int""" if not root: return self.getMinimumDifferenceRecur(root.left, data) data.append(root.val) self.getMinimumDifferenceRecur(root.right, data) def getMinimumDi...
the_stack_v2_python_sparse
Q530MinimumAbsoluteDifferenceinBST.py
ShenTonyM/LeetCode-Learn
train
0
0d1063036868595795e41de81e915077db2296d4
[ "self._conn = Http()\nself._client_key = client_key\nself._output = output", "request_params = urlencode(kwargs)\nuri = u'%s?%s&ywsid=%s&output=%s' % (base_url, request_params, self._client_key, self._output)\nself.LOG.debug('_http_request() - URI: %s', uri)\nheader, response = self._conn.request(uri, method='GET...
<|body_start_0|> self._conn = Http() self._client_key = client_key self._output = output <|end_body_0|> <|body_start_1|> request_params = urlencode(kwargs) uri = u'%s?%s&ywsid=%s&output=%s' % (base_url, request_params, self._client_key, self._output) self.LOG.debug('_htt...
Base implementation for an HTTP API Client. Used by the different API implementation objects to manage Http connection.
HttpApiClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpApiClient: """Base implementation for an HTTP API Client. Used by the different API implementation objects to manage Http connection.""" def __init__(self, client_key, output): """Initialize base http client.""" <|body_0|> def _http_request(self, base_url, **kwargs):...
stack_v2_sparse_classes_75kplus_train_009080
8,345
no_license
[ { "docstring": "Initialize base http client.", "name": "__init__", "signature": "def __init__(self, client_key, output)" }, { "docstring": "Perform an HTTP Request using base_url and parameters given by kwargs. Results are expected to be given in JSON format and are parsed to python data structu...
2
stack_v2_sparse_classes_30k_train_026578
Implement the Python class `HttpApiClient` described below. Class description: Base implementation for an HTTP API Client. Used by the different API implementation objects to manage Http connection. Method signatures and docstrings: - def __init__(self, client_key, output): Initialize base http client. - def _http_re...
Implement the Python class `HttpApiClient` described below. Class description: Base implementation for an HTTP API Client. Used by the different API implementation objects to manage Http connection. Method signatures and docstrings: - def __init__(self, client_key, output): Initialize base http client. - def _http_re...
8390a0139137574ab237b3ff5fe8ea61e8a0b76b
<|skeleton|> class HttpApiClient: """Base implementation for an HTTP API Client. Used by the different API implementation objects to manage Http connection.""" def __init__(self, client_key, output): """Initialize base http client.""" <|body_0|> def _http_request(self, base_url, **kwargs):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HttpApiClient: """Base implementation for an HTTP API Client. Used by the different API implementation objects to manage Http connection.""" def __init__(self, client_key, output): """Initialize base http client.""" self._conn = Http() self._client_key = client_key self._o...
the_stack_v2_python_sparse
data/input/adamhadani/python-yelp/yelp/api.py
bopopescu/pythonanalyzer
train
0
872203336420d05f7776ca38a46f0947a0c0de1e
[ "self.source = source\nself.line_num = 0\nreturn", "s = self.source.readline()\nself.line_num += 1\nreturn s" ]
<|body_start_0|> self.source = source self.line_num = 0 return <|end_body_0|> <|body_start_1|> s = self.source.readline() self.line_num += 1 return s <|end_body_1|>
FileWithLineNum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileWithLineNum: def __init__(self, source): """start at line 0""" <|body_0|> def read(self, bytes): """read the next line and inc the line number""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.source = source self.line_num = 0 ...
stack_v2_sparse_classes_75kplus_train_009081
1,785
no_license
[ { "docstring": "start at line 0", "name": "__init__", "signature": "def __init__(self, source)" }, { "docstring": "read the next line and inc the line number", "name": "read", "signature": "def read(self, bytes)" } ]
2
stack_v2_sparse_classes_30k_train_012370
Implement the Python class `FileWithLineNum` described below. Class description: Implement the FileWithLineNum class. Method signatures and docstrings: - def __init__(self, source): start at line 0 - def read(self, bytes): read the next line and inc the line number
Implement the Python class `FileWithLineNum` described below. Class description: Implement the FileWithLineNum class. Method signatures and docstrings: - def __init__(self, source): start at line 0 - def read(self, bytes): read the next line and inc the line number <|skeleton|> class FileWithLineNum: def __init...
eba6c1489b503fdcf040a126942643b355867bcd
<|skeleton|> class FileWithLineNum: def __init__(self, source): """start at line 0""" <|body_0|> def read(self, bytes): """read the next line and inc the line number""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileWithLineNum: def __init__(self, source): """start at line 0""" self.source = source self.line_num = 0 return def read(self, bytes): """read the next line and inc the line number""" s = self.source.readline() self.line_num += 1 return s
the_stack_v2_python_sparse
src/ibm/teal/util/xml_file_reader.py
ppjsand/pyteal
train
1
d941014e19a1ea98ecc7b73d26a05e3917ee6bb1
[ "spiketrains = []\nwith open(dir + pattern.format(idx=idx), 'r') as fl:\n for line in fl:\n spiketrains.append([int(e.strip()) for e in line.split(',') if e != '\\n'])\nreturn spiketrains", "lst_spiketrains = SpiketrainPlotter.load_spiketrain(**kwargs)\nx_pos = []\ny_pos = []\nfor i, spiketrain in enume...
<|body_start_0|> spiketrains = [] with open(dir + pattern.format(idx=idx), 'r') as fl: for line in fl: spiketrains.append([int(e.strip()) for e in line.split(',') if e != '\n']) return spiketrains <|end_body_0|> <|body_start_1|> lst_spiketrains = SpiketrainPl...
SpiketrainPlotter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpiketrainPlotter: def load_spiketrain(dir: str='../HH-SGD/mnist/', idx: int=10, pattern: str='OUT_POISSON_{idx}.txt') -> List[List[int]]: """from a file, load spiketrains into a list of lists ### Parameters: - `dir : str` directory to look for the spiketrains in (defaults to `'../HH-SGD...
stack_v2_sparse_classes_75kplus_train_009082
3,295
permissive
[ { "docstring": "from a file, load spiketrains into a list of lists ### Parameters: - `dir : str` directory to look for the spiketrains in (defaults to `'../HH-SGD/mnist/'`) - `idx : int` index of file (defaults to `10`) - `pattern : str` pattern to get the filename, appended to `dir` to get full path (defaults ...
3
null
Implement the Python class `SpiketrainPlotter` described below. Class description: Implement the SpiketrainPlotter class. Method signatures and docstrings: - def load_spiketrain(dir: str='../HH-SGD/mnist/', idx: int=10, pattern: str='OUT_POISSON_{idx}.txt') -> List[List[int]]: from a file, load spiketrains into a lis...
Implement the Python class `SpiketrainPlotter` described below. Class description: Implement the SpiketrainPlotter class. Method signatures and docstrings: - def load_spiketrain(dir: str='../HH-SGD/mnist/', idx: int=10, pattern: str='OUT_POISSON_{idx}.txt') -> List[List[int]]: from a file, load spiketrains into a lis...
a387bbee59b34a47ee99d470eb90564cde96d861
<|skeleton|> class SpiketrainPlotter: def load_spiketrain(dir: str='../HH-SGD/mnist/', idx: int=10, pattern: str='OUT_POISSON_{idx}.txt') -> List[List[int]]: """from a file, load spiketrains into a list of lists ### Parameters: - `dir : str` directory to look for the spiketrains in (defaults to `'../HH-SGD...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpiketrainPlotter: def load_spiketrain(dir: str='../HH-SGD/mnist/', idx: int=10, pattern: str='OUT_POISSON_{idx}.txt') -> List[List[int]]: """from a file, load spiketrains into a list of lists ### Parameters: - `dir : str` directory to look for the spiketrains in (defaults to `'../HH-SGD/mnist/'`) - `...
the_stack_v2_python_sparse
plotting/plot_poisson.py
Mustafa-pnevma-galinis/BNBP
train
0
d0ff635c84d8451fd8401180185b67c528f5c8b5
[ "dst_url = ''.join(self.request.path.split('esb/', 1))\ndst_url = f\"/api/{dst_url.split('/api/', 1)[1]}\"\ntry:\n view, args, kwargs = resolve(dst_url)\nexcept Resolver404:\n raise exceptions.UrlNotExistError()\ndst_views_objects = view.cls(request=self.request)\ntry:\n action = view.actions[self.request....
<|body_start_0|> dst_url = ''.join(self.request.path.split('esb/', 1)) dst_url = f"/api/{dst_url.split('/api/', 1)[1]}" try: view, args, kwargs = resolve(dst_url) except Resolver404: raise exceptions.UrlNotExistError() dst_views_objects = view.cls(request=...
LogESBViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogESBViewSet: def check_permissions(self, request): """重写rest_framework.views.APIView,目的是为了resolve对应path的view以获得对应的view的get_permissions以及has_permission方法""" <|body_0|> def call(self, request): """访问esb接口""" <|body_1|> def request_params_regroup(self, qu...
stack_v2_sparse_classes_75kplus_train_009083
6,866
permissive
[ { "docstring": "重写rest_framework.views.APIView,目的是为了resolve对应path的view以获得对应的view的get_permissions以及has_permission方法", "name": "check_permissions", "signature": "def check_permissions(self, request)" }, { "docstring": "访问esb接口", "name": "call", "signature": "def call(self, request)" }, ...
3
stack_v2_sparse_classes_30k_test_002696
Implement the Python class `LogESBViewSet` described below. Class description: Implement the LogESBViewSet class. Method signatures and docstrings: - def check_permissions(self, request): 重写rest_framework.views.APIView,目的是为了resolve对应path的view以获得对应的view的get_permissions以及has_permission方法 - def call(self, request): 访问es...
Implement the Python class `LogESBViewSet` described below. Class description: Implement the LogESBViewSet class. Method signatures and docstrings: - def check_permissions(self, request): 重写rest_framework.views.APIView,目的是为了resolve对应path的view以获得对应的view的get_permissions以及has_permission方法 - def call(self, request): 访问es...
85107762102ba2c72dcfb30fcf8986e146c03889
<|skeleton|> class LogESBViewSet: def check_permissions(self, request): """重写rest_framework.views.APIView,目的是为了resolve对应path的view以获得对应的view的get_permissions以及has_permission方法""" <|body_0|> def call(self, request): """访问esb接口""" <|body_1|> def request_params_regroup(self, qu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LogESBViewSet: def check_permissions(self, request): """重写rest_framework.views.APIView,目的是为了resolve对应path的view以获得对应的view的get_permissions以及has_permission方法""" dst_url = ''.join(self.request.path.split('esb/', 1)) dst_url = f"/api/{dst_url.split('/api/', 1)[1]}" try: ...
the_stack_v2_python_sparse
apps/esb/views.py
jiazhizhong/bk-log
train
0
c4b37f93ec72b2ccad83b5372a8e2c72f6665a35
[ "super().__init__(*args, master=master, **kwargs)\nself._master = master\nself.columns, self.contents = columns_and_contents\nself.columns.insert(0, '#')\nfor i, content in enumerate(self.contents):\n content.insert(0, i + 1)\nself._send_cancel_request = send_cancel_request\nself._send_accepted_request = send_ac...
<|body_start_0|> super().__init__(*args, master=master, **kwargs) self._master = master self.columns, self.contents = columns_and_contents self.columns.insert(0, '#') for i, content in enumerate(self.contents): content.insert(0, i + 1) self._send_cancel_reques...
Widget to display current active students requesting for question resolution in rows and columns
ListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListView: """Widget to display current active students requesting for question resolution in rows and columns""" def __init__(self, master, columns_and_contents, send_cancel_request, send_accepted_request, *args, **kwargs): """:param master: master component :param columns_and_conten...
stack_v2_sparse_classes_75kplus_train_009084
12,278
no_license
[ { "docstring": ":param master: master component :param columns_and_contents: [], [[]] the column names and contents to display :param send_cancel_request: external function offer by the controller :param send_accepted_request: external function offer by the controller :param args: :param kwargs:", "name": "...
5
stack_v2_sparse_classes_30k_train_052248
Implement the Python class `ListView` described below. Class description: Widget to display current active students requesting for question resolution in rows and columns Method signatures and docstrings: - def __init__(self, master, columns_and_contents, send_cancel_request, send_accepted_request, *args, **kwargs): ...
Implement the Python class `ListView` described below. Class description: Widget to display current active students requesting for question resolution in rows and columns Method signatures and docstrings: - def __init__(self, master, columns_and_contents, send_cancel_request, send_accepted_request, *args, **kwargs): ...
2de10943d13dd0a09fb6ef7f129224a1a4f7e5ba
<|skeleton|> class ListView: """Widget to display current active students requesting for question resolution in rows and columns""" def __init__(self, master, columns_and_contents, send_cancel_request, send_accepted_request, *args, **kwargs): """:param master: master component :param columns_and_conten...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ListView: """Widget to display current active students requesting for question resolution in rows and columns""" def __init__(self, master, columns_and_contents, send_cancel_request, send_accepted_request, *args, **kwargs): """:param master: master component :param columns_and_contents: [], [[]] ...
the_stack_v2_python_sparse
CSSE7030/assign3/demo/assignment3_45407422/view.py
Maplexc/UQ-IT
train
1
0ed27124791a1a0e70c27d5e6ba55891f41eea98
[ "if not mail:\n raise ValueError(_('The mail must be set'))\nmail = self.normalize_email(mail)\nuser = self.model(mail=mail, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user", "extra_fields.setdefault('is_staff', True)\nextra_fields.setdefault('is_superuser', True)\nextra_fields.setdefaul...
<|body_start_0|> if not mail: raise ValueError(_('The mail must be set')) mail = self.normalize_email(mail) user = self.model(mail=mail, **extra_fields) user.set_password(password) user.save() return user <|end_body_0|> <|body_start_1|> extra_fields.s...
Custom user model manager where mail is the unique identifiers for authentication instead of usernames.
CustomUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomUserManager: """Custom user model manager where mail is the unique identifiers for authentication instead of usernames.""" def create_user(self, mail, password, **extra_fields): """Create and save a User with the given mail and password.""" <|body_0|> def create_su...
stack_v2_sparse_classes_75kplus_train_009085
1,316
no_license
[ { "docstring": "Create and save a User with the given mail and password.", "name": "create_user", "signature": "def create_user(self, mail, password, **extra_fields)" }, { "docstring": "Create and save a SuperUser with the given mail and password.", "name": "create_superuser", "signature...
2
stack_v2_sparse_classes_30k_train_038400
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where mail is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, mail, password, **extra_fields): Create and save a User with the given ma...
Implement the Python class `CustomUserManager` described below. Class description: Custom user model manager where mail is the unique identifiers for authentication instead of usernames. Method signatures and docstrings: - def create_user(self, mail, password, **extra_fields): Create and save a User with the given ma...
def86352c8d68281900688b1b95621c28848ccf0
<|skeleton|> class CustomUserManager: """Custom user model manager where mail is the unique identifiers for authentication instead of usernames.""" def create_user(self, mail, password, **extra_fields): """Create and save a User with the given mail and password.""" <|body_0|> def create_su...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomUserManager: """Custom user model manager where mail is the unique identifiers for authentication instead of usernames.""" def create_user(self, mail, password, **extra_fields): """Create and save a User with the given mail and password.""" if not mail: raise ValueError(...
the_stack_v2_python_sparse
accounts/managers.py
der-bernd/BiloPortal
train
0
3197c074ec4b258664ae95b1e1c98f6b730298fd
[ "parser.add_argument('--restricted', help='The key is resricted - can only take specific values', action='store_true', default=False)\nparser.add_argument('--readonly', help='The key is readonly - can only be changed with extra effort', action='store_true', default=False)\nparser.add_argument('--noaudit', help=\"Ch...
<|body_start_0|> parser.add_argument('--restricted', help='The key is resricted - can only take specific values', action='store_true', default=False) parser.add_argument('--readonly', help='The key is readonly - can only be changed with extra effort', action='store_true', default=False) parser.a...
Command to add a new key
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Command to add a new key""" def parseArgs(self, parser): """The args""" <|body_0|> def handle(self, namespace): """Base Command line handler""" <|body_1|> def validateKeytype(self, keytype): """Work out which type it should be""" ...
stack_v2_sparse_classes_75kplus_train_009086
4,040
no_license
[ { "docstring": "The args", "name": "parseArgs", "signature": "def parseArgs(self, parser)" }, { "docstring": "Base Command line handler", "name": "handle", "signature": "def handle(self, namespace)" }, { "docstring": "Work out which type it should be", "name": "validateKeytyp...
3
stack_v2_sparse_classes_30k_train_024471
Implement the Python class `Command` described below. Class description: Command to add a new key Method signatures and docstrings: - def parseArgs(self, parser): The args - def handle(self, namespace): Base Command line handler - def validateKeytype(self, keytype): Work out which type it should be
Implement the Python class `Command` described below. Class description: Command to add a new key Method signatures and docstrings: - def parseArgs(self, parser): The args - def handle(self, namespace): Base Command line handler - def validateKeytype(self, keytype): Work out which type it should be <|skeleton|> clas...
75a0b877878d1e8db3a071a2b46a4c324f6b422c
<|skeleton|> class Command: """Command to add a new key""" def parseArgs(self, parser): """The args""" <|body_0|> def handle(self, namespace): """Base Command line handler""" <|body_1|> def validateKeytype(self, keytype): """Work out which type it should be""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Command: """Command to add a new key""" def parseArgs(self, parser): """The args""" parser.add_argument('--restricted', help='The key is resricted - can only take specific values', action='store_true', default=False) parser.add_argument('--readonly', help='The key is readonly - ca...
the_stack_v2_python_sparse
hostinfo/host/commands/cmd_hostinfo_addkey.py
dwagon/Hostinfo
train
8
4ec90ad0420feed893fb3353d225ec566301bdf1
[ "payload['routerId'] = self.otp_router\npayload['algorithm'] = self.algorithm\nheaders = {'Accept': 'application/json'}\nisochrone_response = requests.get(self.isochrone_url, params=payload, headers=headers)\ntry:\n json_poly = json.loads(isochrone_response.content.decode('utf-8'))\nexcept:\n json_poly = json...
<|body_start_0|> payload['routerId'] = self.otp_router payload['algorithm'] = self.algorithm headers = {'Accept': 'application/json'} isochrone_response = requests.get(self.isochrone_url, params=payload, headers=headers) try: json_poly = json.loads(isochrone_response....
Class based view for fetching isochrone and finding destinations of interest within it.
FindReachableDestinations
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindReachableDestinations: """Class based view for fetching isochrone and finding destinations of interest within it.""" def isochrone(self, payload): """Make request to Open Trip Planner for isochrone geometry. Take the provided args and return OTP JSON.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_009087
22,560
permissive
[ { "docstring": "Make request to Open Trip Planner for isochrone geometry. Take the provided args and return OTP JSON.", "name": "isochrone", "signature": "def isochrone(self, payload)" }, { "docstring": "When a GET hits this endpoint, calculate an isochrone and find destinations within it. Retur...
2
null
Implement the Python class `FindReachableDestinations` described below. Class description: Class based view for fetching isochrone and finding destinations of interest within it. Method signatures and docstrings: - def isochrone(self, payload): Make request to Open Trip Planner for isochrone geometry. Take the provid...
Implement the Python class `FindReachableDestinations` described below. Class description: Class based view for fetching isochrone and finding destinations of interest within it. Method signatures and docstrings: - def isochrone(self, payload): Make request to Open Trip Planner for isochrone geometry. Take the provid...
53b493361f05db7af08df24039c9e5c0968a2fd7
<|skeleton|> class FindReachableDestinations: """Class based view for fetching isochrone and finding destinations of interest within it.""" def isochrone(self, payload): """Make request to Open Trip Planner for isochrone geometry. Take the provided args and return OTP JSON.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FindReachableDestinations: """Class based view for fetching isochrone and finding destinations of interest within it.""" def isochrone(self, payload): """Make request to Open Trip Planner for isochrone geometry. Take the provided args and return OTP JSON.""" payload['routerId'] = self.otp...
the_stack_v2_python_sparse
python/cac_tripplanner/destinations/views.py
flibbertigibbet/cac-tripplanner
train
2
fc07a31e8a93ca3e15da71309f6ce4cfbaa22194
[ "try:\n return self._select.first_selected_option.get_attribute('innerHTML').strip()\nexcept exceptions.NoSuchElementException as e:\n if e.msg == 'No options are selected':\n return ''\n raise", "if value in self.value:\n return\nfor i, v in enumerate(self.values):\n if value in v:\n ...
<|body_start_0|> try: return self._select.first_selected_option.get_attribute('innerHTML').strip() except exceptions.NoSuchElementException as e: if e.msg == 'No options are selected': return '' raise <|end_body_0|> <|body_start_1|> if value i...
Custom combobox.
ComboBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComboBox: """Custom combobox.""" def value(self): """Combobox value.""" <|body_0|> def value(self, value): """Set combobox value.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: return self._select.first_selected_option.get_attr...
stack_v2_sparse_classes_75kplus_train_009088
1,546
no_license
[ { "docstring": "Combobox value.", "name": "value", "signature": "def value(self)" }, { "docstring": "Set combobox value.", "name": "value", "signature": "def value(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_021058
Implement the Python class `ComboBox` described below. Class description: Custom combobox. Method signatures and docstrings: - def value(self): Combobox value. - def value(self, value): Set combobox value.
Implement the Python class `ComboBox` described below. Class description: Custom combobox. Method signatures and docstrings: - def value(self): Combobox value. - def value(self, value): Set combobox value. <|skeleton|> class ComboBox: """Custom combobox.""" def value(self): """Combobox value.""" ...
78950b95d98e791e6e5852aaef05ce9b7266be04
<|skeleton|> class ComboBox: """Custom combobox.""" def value(self): """Combobox value.""" <|body_0|> def value(self, value): """Set combobox value.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComboBox: """Custom combobox.""" def value(self): """Combobox value.""" try: return self._select.first_selected_option.get_attribute('innerHTML').strip() except exceptions.NoSuchElementException as e: if e.msg == 'No options are selected': r...
the_stack_v2_python_sparse
whale/decapod_ui/app/ui/combobox.py
Mirantis/whale
train
1
66ada6ea65123fbced34bdc40f09528f9a3898a8
[ "if len(nums) == 1:\n return [nums]\nn = len(nums)\nrec = []\nfor i in range(n):\n res = self.permute(nums[:i] + nums[i + 1:])\n for r in res:\n a = [nums[i]] + r\n rec.append(a)\nreturn rec", "res = []\nrec = self.permute(nums)\nfor r in rec:\n if r in res:\n continue\n res.ap...
<|body_start_0|> if len(nums) == 1: return [nums] n = len(nums) rec = [] for i in range(n): res = self.permute(nums[:i] + nums[i + 1:]) for r in res: a = [nums[i]] + r rec.append(a) return rec <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums): """leetcode 46 题题解 8.20 重做, 请好好反思 :type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permuteUnique(self, nums): """leetcode 47. Permutations II, 同题28 :type nums: List[int] :rtype: List[List[int]]""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_009089
2,030
no_license
[ { "docstring": "leetcode 46 题题解 8.20 重做, 请好好反思 :type nums: List[int] :rtype: List[List[int]]", "name": "permute", "signature": "def permute(self, nums)" }, { "docstring": "leetcode 47. Permutations II, 同题28 :type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signatu...
3
stack_v2_sparse_classes_30k_test_001958
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): leetcode 46 题题解 8.20 重做, 请好好反思 :type nums: List[int] :rtype: List[List[int]] - def permuteUnique(self, nums): leetcode 47. Permutations II, 同题28 :type nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): leetcode 46 题题解 8.20 重做, 请好好反思 :type nums: List[int] :rtype: List[List[int]] - def permuteUnique(self, nums): leetcode 47. Permutations II, 同题28 :type nu...
8c0c2a8bcd51825e6902e4d03dabbaf6f303ba83
<|skeleton|> class Solution: def permute(self, nums): """leetcode 46 题题解 8.20 重做, 请好好反思 :type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permuteUnique(self, nums): """leetcode 47. Permutations II, 同题28 :type nums: List[int] :rtype: List[List[int]]""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute(self, nums): """leetcode 46 题题解 8.20 重做, 请好好反思 :type nums: List[int] :rtype: List[List[int]]""" if len(nums) == 1: return [nums] n = len(nums) rec = [] for i in range(n): res = self.permute(nums[:i] + nums[i + 1:]) ...
the_stack_v2_python_sparse
python_fundemental/28_permutation.py
Deanwinger/python_project
train
0
f54606f8d5746eecda25cec1c99b1ab0058a9ce7
[ "layout = self.layout\nfor i in range(len(self.phobos_data)):\n name = self.phobos_data[i].name[2:].replace('_', ' ')\n self.phobos_data[i].draw(layout, name)\nif self.annotation_checks:\n box = layout.box()\n box.label(text='Include annotations:')\n for i in range(len(self.annotation_checks)):\n ...
<|body_start_0|> layout = self.layout for i in range(len(self.phobos_data)): name = self.phobos_data[i].name[2:].replace('_', ' ') self.phobos_data[i].draw(layout, name) if self.annotation_checks: box = layout.box() box.label(text='Include annotati...
Temporary operator to add a generic object.
TempObjAddOperator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempObjAddOperator: """Temporary operator to add a generic object.""" def draw(self, context): """Args: context: Returns:""" <|body_0|> def invoke(self, context, event): """Args: context: event: Returns:""" <|body_1|> def execute(self, context): ...
stack_v2_sparse_classes_75kplus_train_009090
17,163
permissive
[ { "docstring": "Args: context: Returns:", "name": "draw", "signature": "def draw(self, context)" }, { "docstring": "Args: context: event: Returns:", "name": "invoke", "signature": "def invoke(self, context, event)" }, { "docstring": "Args: context: Returns:", "name": "execute...
3
stack_v2_sparse_classes_30k_train_032779
Implement the Python class `TempObjAddOperator` described below. Class description: Temporary operator to add a generic object. Method signatures and docstrings: - def draw(self, context): Args: context: Returns: - def invoke(self, context, event): Args: context: event: Returns: - def execute(self, context): Args: co...
Implement the Python class `TempObjAddOperator` described below. Class description: Temporary operator to add a generic object. Method signatures and docstrings: - def draw(self, context): Args: context: Returns: - def invoke(self, context, event): Args: context: event: Returns: - def execute(self, context): Args: co...
543d220c65bbee0e23e810d89307e23aa79eb0cd
<|skeleton|> class TempObjAddOperator: """Temporary operator to add a generic object.""" def draw(self, context): """Args: context: Returns:""" <|body_0|> def invoke(self, context, event): """Args: context: event: Returns:""" <|body_1|> def execute(self, context): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TempObjAddOperator: """Temporary operator to add a generic object.""" def draw(self, context): """Args: context: Returns:""" layout = self.layout for i in range(len(self.phobos_data)): name = self.phobos_data[i].name[2:].replace('_', ' ') self.phobos_data[i...
the_stack_v2_python_sparse
phobos/blender/operators/generic.py
dfki-ric/phobos
train
483
fd603bb71353611ebb3c52086591316ab594f730
[ "date = getattr(model_instance, self.attname)\nif date is not None:\n if type(date) is str and re.match('\\\\d{4}-\\\\d{2}-\\\\d{2}', date):\n year = int(date[:4])\n month = int(date[5:7])\n day = int(date[8:])\n setattr(model_instance, self.attname, create_utc_time(year, month, day))...
<|body_start_0|> date = getattr(model_instance, self.attname) if date is not None: if type(date) is str and re.match('\\d{4}-\\d{2}-\\d{2}', date): year = int(date[:4]) month = int(date[5:7]) day = int(date[8:]) setattr(model_in...
PSTDateTimeField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSTDateTimeField: def pre_save(self, model_instance, add): """Makes sure to convert the date to UTC time before saving if its in Canada/Pacific timezone""" <|body_0|> def from_db_value(self, value, expression, connection): """Converts the value from the DB from UTC t...
stack_v2_sparse_classes_75kplus_train_009091
1,612
no_license
[ { "docstring": "Makes sure to convert the date to UTC time before saving if its in Canada/Pacific timezone", "name": "pre_save", "signature": "def pre_save(self, model_instance, add)" }, { "docstring": "Converts the value from the DB from UTC time to PST time before returning to calling code", ...
2
stack_v2_sparse_classes_30k_train_034516
Implement the Python class `PSTDateTimeField` described below. Class description: Implement the PSTDateTimeField class. Method signatures and docstrings: - def pre_save(self, model_instance, add): Makes sure to convert the date to UTC time before saving if its in Canada/Pacific timezone - def from_db_value(self, valu...
Implement the Python class `PSTDateTimeField` described below. Class description: Implement the PSTDateTimeField class. Method signatures and docstrings: - def pre_save(self, model_instance, add): Makes sure to convert the date to UTC time before saving if its in Canada/Pacific timezone - def from_db_value(self, valu...
5152787e8db3b1c4a73362e8f06a117f5fadc817
<|skeleton|> class PSTDateTimeField: def pre_save(self, model_instance, add): """Makes sure to convert the date to UTC time before saving if its in Canada/Pacific timezone""" <|body_0|> def from_db_value(self, value, expression, connection): """Converts the value from the DB from UTC t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PSTDateTimeField: def pre_save(self, model_instance, add): """Makes sure to convert the date to UTC time before saving if its in Canada/Pacific timezone""" date = getattr(model_instance, self.attname) if date is not None: if type(date) is str and re.match('\\d{4}-\\d{2}-\\d...
the_stack_v2_python_sparse
csss-site/src/csss/PSTDateTimeField.py
CSSS/csss-site
train
9
bc46bfc9d45e338dfd0ea2ae7f65f5c759cbb2d5
[ "self.__super = super(self.__decorator_class, self)\nself.__super.__init__(config, groupset, maxsize, drop)\nself.max_notification_size = maxsize", "from svnmailer import stream\nfp = self.__super._getMailWriter(fp)\nself.url_fp = stream.TruncatingStream(self.url_fp, self.max_notification_size, True)\nreturn fp" ...
<|body_start_0|> self.__super = super(self.__decorator_class, self) self.__super.__init__(config, groupset, maxsize, drop) self.max_notification_size = maxsize <|end_body_0|> <|body_start_1|> from svnmailer import stream fp = self.__super._getMailWriter(fp) self.url_fp =...
Truncates the mail body after n bytes
URLTruncatingDecorator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URLTruncatingDecorator: """Truncates the mail body after n bytes""" def __init__(self, config, groupset, maxsize, drop): """Initialization :Parameters: - `maxsize`: The maximum number of bytes that should be written into one mail - `drop`: maximum number of mails :Types: - `maxsize`:...
stack_v2_sparse_classes_75kplus_train_009092
16,622
permissive
[ { "docstring": "Initialization :Parameters: - `maxsize`: The maximum number of bytes that should be written into one mail - `drop`: maximum number of mails :Types: - `maxsize`: ``int`` - `drop`: ``int``", "name": "__init__", "signature": "def __init__(self, config, groupset, maxsize, drop)" }, { ...
2
stack_v2_sparse_classes_30k_train_049484
Implement the Python class `URLTruncatingDecorator` described below. Class description: Truncates the mail body after n bytes Method signatures and docstrings: - def __init__(self, config, groupset, maxsize, drop): Initialization :Parameters: - `maxsize`: The maximum number of bytes that should be written into one ma...
Implement the Python class `URLTruncatingDecorator` described below. Class description: Truncates the mail body after n bytes Method signatures and docstrings: - def __init__(self, config, groupset, maxsize, drop): Initialization :Parameters: - `maxsize`: The maximum number of bytes that should be written into one ma...
faecefdabd8fbf6d40738a24004772020c244f64
<|skeleton|> class URLTruncatingDecorator: """Truncates the mail body after n bytes""" def __init__(self, config, groupset, maxsize, drop): """Initialization :Parameters: - `maxsize`: The maximum number of bytes that should be written into one mail - `drop`: maximum number of mails :Types: - `maxsize`:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class URLTruncatingDecorator: """Truncates the mail body after n bytes""" def __init__(self, config, groupset, maxsize, drop): """Initialization :Parameters: - `maxsize`: The maximum number of bytes that should be written into one mail - `drop`: maximum number of mails :Types: - `maxsize`: ``int`` - `d...
the_stack_v2_python_sparse
src/lib/svnmailer/notifier/_textmail.py
m-tmatma/svnmailer
train
1
01df4017975a88fb8de2751e8e90419ba9ee75e9
[ "super(RectangularConduitUnit, self).__init__(**kwargs)\nself._unit_type = RectangularConduitUnit.UNIT_TYPE\nself._unit_category = RectangularConduitUnit.UNIT_CATEGORY\nself.head_data = {'comment': HeadDataItem('', '', 0, 0, dtype=dt.STRING), 'distance': HeadDataItem(0.0, '{:>10}', 3, 0, dtype=dt.FLOAT, dps=3), 'ro...
<|body_start_0|> super(RectangularConduitUnit, self).__init__(**kwargs) self._unit_type = RectangularConduitUnit.UNIT_TYPE self._unit_category = RectangularConduitUnit.UNIT_CATEGORY self.head_data = {'comment': HeadDataItem('', '', 0, 0, dtype=dt.STRING), 'distance': HeadDataItem(0.0, '{...
RectangularConduitUnit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RectangularConduitUnit: def __init__(self, **kwargs): """Constructor.""" <|body_0|> def readUnitData(self, unit_data, file_line): """Reads the given data into the object. See Also: isisunit. Args: unit_data (list): The raw file data to be processed.""" <|body...
stack_v2_sparse_classes_75kplus_train_009093
27,052
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Reads the given data into the object. See Also: isisunit. Args: unit_data (list): The raw file data to be processed.", "name": "readUnitData", "signature": "def readUnitData(...
3
stack_v2_sparse_classes_30k_train_001584
Implement the Python class `RectangularConduitUnit` described below. Class description: Implement the RectangularConduitUnit class. Method signatures and docstrings: - def __init__(self, **kwargs): Constructor. - def readUnitData(self, unit_data, file_line): Reads the given data into the object. See Also: isisunit. A...
Implement the Python class `RectangularConduitUnit` described below. Class description: Implement the RectangularConduitUnit class. Method signatures and docstrings: - def __init__(self, **kwargs): Constructor. - def readUnitData(self, unit_data, file_line): Reads the given data into the object. See Also: isisunit. A...
e8e7249a511d52b29d34be0951d6a05f346b836c
<|skeleton|> class RectangularConduitUnit: def __init__(self, **kwargs): """Constructor.""" <|body_0|> def readUnitData(self, unit_data, file_line): """Reads the given data into the object. See Also: isisunit. Args: unit_data (list): The raw file data to be processed.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RectangularConduitUnit: def __init__(self, **kwargs): """Constructor.""" super(RectangularConduitUnit, self).__init__(**kwargs) self._unit_type = RectangularConduitUnit.UNIT_TYPE self._unit_category = RectangularConduitUnit.UNIT_CATEGORY self.head_data = {'comment': Hea...
the_stack_v2_python_sparse
ship/fmp/datunits/conduitunit.py
duncan-r/SHIP
train
6
6c8358280839c52e2e1fa03de7b5e988ab05fafc
[ "self._substs = {}\nself._var_config = var_config\nself._scope_config = scope_config\nfor var_id, var_value in var_config.items():\n key = '%%{var}%%'.format(var=var_id)\n self._substs[key] = str(var_value)\nfor scope_id, var_config in scope_config.items():\n for var_id, var_value in var_config.items():\n ...
<|body_start_0|> self._substs = {} self._var_config = var_config self._scope_config = scope_config for var_id, var_value in var_config.items(): key = '%%{var}%%'.format(var=var_id) self._substs[key] = str(var_value) for scope_id, var_config in scope_config...
A class representing substitution environment.
Substitution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Substitution: """A class representing substitution environment.""" def __init__(self, var_config: VarConfig, scope_config: ScopeConfig): """Initializes the substitution environment. Args: var_config: A configuration (concrete values) of pattern variables. scope_config: A configuratio...
stack_v2_sparse_classes_75kplus_train_009094
6,380
permissive
[ { "docstring": "Initializes the substitution environment. Args: var_config: A configuration (concrete values) of pattern variables. scope_config: A configuration (concrete values) of pattern scopes.", "name": "__init__", "signature": "def __init__(self, var_config: VarConfig, scope_config: ScopeConfig)"...
2
stack_v2_sparse_classes_30k_train_006423
Implement the Python class `Substitution` described below. Class description: A class representing substitution environment. Method signatures and docstrings: - def __init__(self, var_config: VarConfig, scope_config: ScopeConfig): Initializes the substitution environment. Args: var_config: A configuration (concrete v...
Implement the Python class `Substitution` described below. Class description: A class representing substitution environment. Method signatures and docstrings: - def __init__(self, var_config: VarConfig, scope_config: ScopeConfig): Initializes the substitution environment. Args: var_config: A configuration (concrete v...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class Substitution: """A class representing substitution environment.""" def __init__(self, var_config: VarConfig, scope_config: ScopeConfig): """Initializes the substitution environment. Args: var_config: A configuration (concrete values) of pattern variables. scope_config: A configuratio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Substitution: """A class representing substitution environment.""" def __init__(self, var_config: VarConfig, scope_config: ScopeConfig): """Initializes the substitution environment. Args: var_config: A configuration (concrete values) of pattern variables. scope_config: A configuration (concrete v...
the_stack_v2_python_sparse
grr/core/grr_response_core/lib/interpolation.py
google/grr
train
4,683
6d7b9e560e0fea1009ceff9bcfb444e20c280650
[ "\"\"\"\n\t\tA flag to indicate whether or not a goal has not been reached.\n\t\tTrue means that a goal is in progress of being completed.\n\t\tFalse means that a goal has been completed (or not started\n\t\twith any goal)\n\t\t\"\"\"\nself.flag = False\nrospy.init_node('los_path_following')\nself.sub = rospy.Subsc...
<|body_start_0|> """ A flag to indicate whether or not a goal has not been reached. True means that a goal is in progress of being completed. False means that a goal has been completed (or not started with any goal) """ self.flag = False rospy.in...
This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /odometry/filtered Publishes to: /manta/thruste...
LosPathFollowing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LosPathFollowing: """This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /od...
stack_v2_sparse_classes_75kplus_train_009095
10,684
permissive
[ { "docstring": "To initialize the ROS wrapper, the node, subscribers and publishers are set up. The high-level guidance and controller objects are also intialized. Lastly, dynamic reconfigure and action servers are set up.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring":...
6
stack_v2_sparse_classes_30k_train_028611
Implement the Python class `LosPathFollowing` described below. Class description: This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created...
Implement the Python class `LosPathFollowing` described below. Class description: This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created...
a5b4a292b6b29b765cbe29d4701e6a8917adbb0a
<|skeleton|> class LosPathFollowing: """This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /od...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LosPathFollowing: """This is the ROS wrapper class for the LOS class. Attributes: _feedback A vortex_msgs action that contains the distance to goal _result A vortex_msgs action, true if a goal is set within the sphereof acceptance, false if not Nodes created: los_path_following Subscribes to: /odometry/filter...
the_stack_v2_python_sparse
motion/los_guidance/scripts/old_los_guidance_euler.py
oysand/Vortex-AUV
train
0
89287db9ca453d6775f00b091909301711461dd2
[ "self.uname = 'testuser'\nself.email = 'test+courses@edx.org'\nself.password = 'foo'\nself.user = User.objects.create_user(self.uname, self.email, self.password)\nself.user.is_active = True\nself.user.is_staff = True\nself.user.save()\nself.course_data = {'template': 'i4x://edx/templates/course/Empty', 'org': 'MITx...
<|body_start_0|> self.uname = 'testuser' self.email = 'test+courses@edx.org' self.password = 'foo' self.user = User.objects.create_user(self.uname, self.email, self.password) self.user.is_active = True self.user.is_staff = True self.user.save() self.course...
Tests to validate Internationalization.
InternationalizationTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InternationalizationTest: """Tests to validate Internationalization.""" def setUp(self): """These tests need a user in the DB so that the django Test Client can log them in. They inherit from the ModuleStoreTestCase class so that the mongodb collection will be cleared out before each...
stack_v2_sparse_classes_75kplus_train_009096
3,349
no_license
[ { "docstring": "These tests need a user in the DB so that the django Test Client can log them in. They inherit from the ModuleStoreTestCase class so that the mongodb collection will be cleared out before each test case execution and deleted afterwards.", "name": "setUp", "signature": "def setUp(self)" ...
4
stack_v2_sparse_classes_30k_train_031401
Implement the Python class `InternationalizationTest` described below. Class description: Tests to validate Internationalization. Method signatures and docstrings: - def setUp(self): These tests need a user in the DB so that the django Test Client can log them in. They inherit from the ModuleStoreTestCase class so th...
Implement the Python class `InternationalizationTest` described below. Class description: Tests to validate Internationalization. Method signatures and docstrings: - def setUp(self): These tests need a user in the DB so that the django Test Client can log them in. They inherit from the ModuleStoreTestCase class so th...
5fa3a818c3d41bd9c3eb25122e1d376c8910269c
<|skeleton|> class InternationalizationTest: """Tests to validate Internationalization.""" def setUp(self): """These tests need a user in the DB so that the django Test Client can log them in. They inherit from the ModuleStoreTestCase class so that the mongodb collection will be cleared out before each...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InternationalizationTest: """Tests to validate Internationalization.""" def setUp(self): """These tests need a user in the DB so that the django Test Client can log them in. They inherit from the ModuleStoreTestCase class so that the mongodb collection will be cleared out before each test case ex...
the_stack_v2_python_sparse
ExtractFeatures/Data/pratik98/test_i18n.py
vivekaxl/LexisNexis
train
9
00aebdf3dfd86c7ea7580ca6118a1db55fb135ab
[ "self.y = np.empty(0)\nself.ts_period = ts_period\nself.timestamp_interval = -1\nself.last_timestamp = -1\nself._fitted = False\nself.copy = copy\nif self.ts_period is None:\n raise ValueError(\"'ts_period' must be given.\")", "if X.size != y.size:\n raise ValueError(\"'X' and 'y' size must match.\")\nif se...
<|body_start_0|> self.y = np.empty(0) self.ts_period = ts_period self.timestamp_interval = -1 self.last_timestamp = -1 self._fitted = False self.copy = copy if self.ts_period is None: raise ValueError("'ts_period' must be given.") <|end_body_0|> <|bod...
Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding timestamp of the previous period.
TSNaiveSeasonal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSNaiveSeasonal: """Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding times...
stack_v2_sparse_classes_75kplus_train_009097
12,299
permissive
[ { "docstring": "Init a Seasonal Naive Model.", "name": "__init__", "signature": "def __init__(self, ts_period: int, copy: bool=False)" }, { "docstring": "Fit a Seasonal Naive model.", "name": "fit", "signature": "def fit(self, X: np.ndarray, y: np.ndarray, **kwargs) -> 'TSNaiveSeasonal'"...
3
stack_v2_sparse_classes_30k_train_047613
Implement the Python class `TSNaiveSeasonal` described below. Class description: Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal ...
Implement the Python class `TSNaiveSeasonal` described below. Class description: Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal ...
61cc1f63fa055c7466151cfefa7baff8df1702b7
<|skeleton|> class TSNaiveSeasonal: """Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding times...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TSNaiveSeasonal: """Seasonal Naive model for time-series forecasting. This model is similar to the Naive model, but instead of using only the very last observation from the fitted time-series, it is used the whole past period. Then, each prediction is equal to the value in the corresponding timestamp of the p...
the_stack_v2_python_sparse
tspymfe/_models.py
FelSiq/ts-pymfe
train
9
0a5374403a8db9051262c8c53e7864242f46ea9b
[ "time.sleep(1)\ninterface = 'nothing'\nstatus, interface = self.target.run(\"ifconfig | grep '^enp' | awk '{print $1}'\")\nstatus, output = self.target.run(\"ifconfig %s | grep 'inet6 addr:' | awk '{print $3}'\" % interface)\nif output.split('%')[0] == '':\n assertEqual(status, 0, msg='Target ipv6 address get fa...
<|body_start_0|> time.sleep(1) interface = 'nothing' status, interface = self.target.run("ifconfig | grep '^enp' | awk '{print $1}'") status, output = self.target.run("ifconfig %s | grep 'inet6 addr:' | awk '{print $3}'" % interface) if output.split('%')[0] == '': ass...
@class CommEthernet
CommEthernet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommEthernet: """@class CommEthernet""" def get_ipv6(self): """@fn get_ipv6 @param self @return""" <|body_0|> def get_ipv4(self): """@fn get_ipv4 @param self @return""" <|body_1|> def get_interface(self): """@fn get_interface @param self @ret...
stack_v2_sparse_classes_75kplus_train_009098
4,423
permissive
[ { "docstring": "@fn get_ipv6 @param self @return", "name": "get_ipv6", "signature": "def get_ipv6(self)" }, { "docstring": "@fn get_ipv4 @param self @return", "name": "get_ipv4", "signature": "def get_ipv4(self)" }, { "docstring": "@fn get_interface @param self @return", "nam...
5
stack_v2_sparse_classes_30k_test_000229
Implement the Python class `CommEthernet` described below. Class description: @class CommEthernet Method signatures and docstrings: - def get_ipv6(self): @fn get_ipv6 @param self @return - def get_ipv4(self): @fn get_ipv4 @param self @return - def get_interface(self): @fn get_interface @param self @return - def test_...
Implement the Python class `CommEthernet` described below. Class description: @class CommEthernet Method signatures and docstrings: - def get_ipv6(self): @fn get_ipv6 @param self @return - def get_ipv4(self): @fn get_ipv4 @param self @return - def get_interface(self): @fn get_interface @param self @return - def test_...
786a4de29c30b47f885d8ad9cb2d110a08919ebd
<|skeleton|> class CommEthernet: """@class CommEthernet""" def get_ipv6(self): """@fn get_ipv6 @param self @return""" <|body_0|> def get_ipv4(self): """@fn get_ipv4 @param self @return""" <|body_1|> def get_interface(self): """@fn get_interface @param self @ret...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommEthernet: """@class CommEthernet""" def get_ipv6(self): """@fn get_ipv6 @param self @return""" time.sleep(1) interface = 'nothing' status, interface = self.target.run("ifconfig | grep '^enp' | awk '{print $1}'") status, output = self.target.run("ifconfig %s | g...
the_stack_v2_python_sparse
meta-iotqa/lib/oeqa/runtime/connectivity/ethernet/ethernet.py
intel/intel-iot-refkit
train
38
4b4bea26936fa928500a4ab982c04e05346361f2
[ "super().__init__()\nself.window_size = window_size\nself.return_cs = return_cs", "if len(target.shape) == 3:\n try:\n target = tensor_one_hot(target, n_classes=yhat.shape[1])\n except Exception:\n target = target.unsqueeze(1)\nsim, cs = ssim(yhat, target, window_size=self.window_size)\nloss =...
<|body_start_0|> super().__init__() self.window_size = window_size self.return_cs = return_cs <|end_body_0|> <|body_start_1|> if len(target.shape) == 3: try: target = tensor_one_hot(target, n_classes=yhat.shape[1]) except Exception: ...
SSIM
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSIM: def __init__(self, window_size: int=11, return_cs: bool=False, **kwargs) -> None: """Structural similarity index loss. I.e. the dissimilarity: (1 - SSIM(x, y)) / 2 Parameters ---------- window_size : int, default=11 Size of the gaussian kernel. return_cs : bool, default=False Retur...
stack_v2_sparse_classes_75kplus_train_009099
5,322
permissive
[ { "docstring": "Structural similarity index loss. I.e. the dissimilarity: (1 - SSIM(x, y)) / 2 Parameters ---------- window_size : int, default=11 Size of the gaussian kernel. return_cs : bool, default=False Return also the the contrast sensitivity coeff.", "name": "__init__", "signature": "def __init__...
2
stack_v2_sparse_classes_30k_train_017128
Implement the Python class `SSIM` described below. Class description: Implement the SSIM class. Method signatures and docstrings: - def __init__(self, window_size: int=11, return_cs: bool=False, **kwargs) -> None: Structural similarity index loss. I.e. the dissimilarity: (1 - SSIM(x, y)) / 2 Parameters ---------- win...
Implement the Python class `SSIM` described below. Class description: Implement the SSIM class. Method signatures and docstrings: - def __init__(self, window_size: int=11, return_cs: bool=False, **kwargs) -> None: Structural similarity index loss. I.e. the dissimilarity: (1 - SSIM(x, y)) / 2 Parameters ---------- win...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class SSIM: def __init__(self, window_size: int=11, return_cs: bool=False, **kwargs) -> None: """Structural similarity index loss. I.e. the dissimilarity: (1 - SSIM(x, y)) / 2 Parameters ---------- window_size : int, default=11 Size of the gaussian kernel. return_cs : bool, default=False Retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSIM: def __init__(self, window_size: int=11, return_cs: bool=False, **kwargs) -> None: """Structural similarity index loss. I.e. the dissimilarity: (1 - SSIM(x, y)) / 2 Parameters ---------- window_size : int, default=11 Size of the gaussian kernel. return_cs : bool, default=False Return also the the...
the_stack_v2_python_sparse
cellseg_models_pytorch/losses/criterions/ssim.py
okunator/cellseg_models.pytorch
train
43