blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
58223a5755289cb41d090f31f16a1f492c9f3b46
[ "sampleAtom = atoms[-1]\nself.atoms = []\nself.name = sampleAtom.resName\nself.chainID = sampleAtom.chainID\nself.resSeq = sampleAtom.resSeq\nself.iCode = sampleAtom.iCode\nself.fixed = 0\nself.ffname = 'WAT'\nself.map = {}\nself.reference = ref\nfor a in atoms:\n if a.name in ref.altnames:\n a.name = ref...
<|body_start_0|> sampleAtom = atoms[-1] self.atoms = [] self.name = sampleAtom.resName self.chainID = sampleAtom.chainID self.resSeq = sampleAtom.resSeq self.iCode = sampleAtom.iCode self.fixed = 0 self.ffname = 'WAT' self.map = {} self.ref...
Generic ligand class This class gives data about the generic ligand object, and inherits off the base residue class.
LIG
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LIG: """Generic ligand class This class gives data about the generic ligand object, and inherits off the base residue class.""" def __init__(self, atoms, ref): """Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_019800
22,508
permissive
[ { "docstring": "Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)", "name": "__init__", "signature": "def __init__(self, atoms, ref)" }, { "docstring": "Create a water atom. Note the HETATM field. Parameters atomname: The name of the atom (string) ne...
3
stack_v2_sparse_classes_30k_train_010266
Implement the Python class `LIG` described below. Class description: Generic ligand class This class gives data about the generic ligand object, and inherits off the base residue class. Method signatures and docstrings: - def __init__(self, atoms, ref): Initialize the class Parameters atoms: A list of Atom objects to...
Implement the Python class `LIG` described below. Class description: Generic ligand class This class gives data about the generic ligand object, and inherits off the base residue class. Method signatures and docstrings: - def __init__(self, atoms, ref): Initialize the class Parameters atoms: A list of Atom objects to...
a50f0b2f7104007c730baa51b4ec65c891008c47
<|skeleton|> class LIG: """Generic ligand class This class gives data about the generic ligand object, and inherits off the base residue class.""" def __init__(self, atoms, ref): """Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LIG: """Generic ligand class This class gives data about the generic ligand object, and inherits off the base residue class.""" def __init__(self, atoms, ref): """Initialize the class Parameters atoms: A list of Atom objects to be stored in this class (list)""" sampleAtom = atoms[-1] ...
the_stack_v2_python_sparse
mscreen/autodocktools_prepare_py3k/MolKit/pdb2pqr/src/aa.py
e-mayo/mscreen
train
10
9087ab9d342e65b3fad1226bd2fccbec7309f88d
[ "parser = reqparse.RequestParser()\nqueries = parse_request_args_keys(request)\nfor _ in queries:\n parser.add_argument(_)\niargs = parser.parse_args()\nusers = User.query.filter_by(**iargs).all()\nreturn users_schema.dump(users)", "parser = reqparse.RequestParser()\npost_keys = parse_request_json_keys(request...
<|body_start_0|> parser = reqparse.RequestParser() queries = parse_request_args_keys(request) for _ in queries: parser.add_argument(_) iargs = parser.parse_args() users = User.query.filter_by(**iargs).all() return users_schema.dump(users) <|end_body_0|> <|bod...
UserList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserList: def get(self): """Get users Filter fields: id username name email phone gender GET /api/users Response 200 [ { "updated_time": "2020-06-18T22:35:12", "name": null, "id": "0ede8bb172ac4c56beed11c978a53fb3", "created_time": "2020-06-18T22:35:12", "email": null, "phone": null, "ge...
stack_v2_sparse_classes_36k_train_019801
3,749
no_license
[ { "docstring": "Get users Filter fields: id username name email phone gender GET /api/users Response 200 [ { \"updated_time\": \"2020-06-18T22:35:12\", \"name\": null, \"id\": \"0ede8bb172ac4c56beed11c978a53fb3\", \"created_time\": \"2020-06-18T22:35:12\", \"email\": null, \"phone\": null, \"gender\": null, \"u...
2
stack_v2_sparse_classes_30k_train_002947
Implement the Python class `UserList` described below. Class description: Implement the UserList class. Method signatures and docstrings: - def get(self): Get users Filter fields: id username name email phone gender GET /api/users Response 200 [ { "updated_time": "2020-06-18T22:35:12", "name": null, "id": "0ede8bb172...
Implement the Python class `UserList` described below. Class description: Implement the UserList class. Method signatures and docstrings: - def get(self): Get users Filter fields: id username name email phone gender GET /api/users Response 200 [ { "updated_time": "2020-06-18T22:35:12", "name": null, "id": "0ede8bb172...
6a9abe6dbf0ffe7f6fd1d7a559734c70ce80a663
<|skeleton|> class UserList: def get(self): """Get users Filter fields: id username name email phone gender GET /api/users Response 200 [ { "updated_time": "2020-06-18T22:35:12", "name": null, "id": "0ede8bb172ac4c56beed11c978a53fb3", "created_time": "2020-06-18T22:35:12", "email": null, "phone": null, "ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserList: def get(self): """Get users Filter fields: id username name email phone gender GET /api/users Response 200 [ { "updated_time": "2020-06-18T22:35:12", "name": null, "id": "0ede8bb172ac4c56beed11c978a53fb3", "created_time": "2020-06-18T22:35:12", "email": null, "phone": null, "gender": null, "...
the_stack_v2_python_sparse
resources/user.py
lightcax/flask_structure_example
train
0
a84e7ae7ee160908762952dd49af68148cda57bd
[ "Q = [root] if root else []\nlst = []\nwhile len(Q) > 0:\n l = len(Q)\n f = False\n while l:\n l -= 1\n p = Q.pop(0)\n if p:\n lst.append(p.val)\n Q.append(p.left)\n Q.append(p.right)\n if p.left or p.right:\n f = True\n ...
<|body_start_0|> Q = [root] if root else [] lst = [] while len(Q) > 0: l = len(Q) f = False while l: l -= 1 p = Q.pop(0) if p: lst.append(p.val) Q.append(p.left) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_019802
2,483
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_000719
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
a95b871578aae0103066962c33b8c0f4ec22d0f2
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" Q = [root] if root else [] lst = [] while len(Q) > 0: l = len(Q) f = False while l: l -= 1 p = Q.pop(0...
the_stack_v2_python_sparse
297.py
Jane11111/Leetcode2021
train
2
6cfc05d815b3101fc3193c8137ffc2066cbbd215
[ "if l1 or l2:\n if l1 is None:\n return l2\n if l2 is None:\n return l1\nhead = ListNode()\nnode = head\nwhile l1 or l2:\n if l1 and l2:\n if l1.val <= l2.val:\n node.next = l1\n l1 = l1.next\n else:\n node.next = l2\n l2 = l2.next\n ...
<|body_start_0|> if l1 or l2: if l1 is None: return l2 if l2 is None: return l1 head = ListNode() node = head while l1 or l2: if l1 and l2: if l1.val <= l2.val: node.next = l1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if l1 or...
stack_v2_sparse_classes_36k_train_019803
2,364
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
stack_v2_sparse_classes_30k_train_001728
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|>...
df7d2229c50aa5134d297cc5599f7df9e64780c1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" if l1 or l2: if l1 is None: return l2 if l2 is None: return l1 head = ListNode() node = head while l1 or l2: ...
the_stack_v2_python_sparse
23.合并k个升序链表.py
libowei1213/LeetCode
train
0
4e39afdb898dba6c7959a72f9ca2099386791bda
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('bohan_nyx_xh1994_yiran123', 'bohan_nyx_xh1994_yiran123')\nairbnb = repo.bohan_nyx_xh1994_yiran123.airbnb_rating.find()\ncrime = repo.bohan_nyx_xh1994_yiran123.crime_boston.find()\ncrimes = [c for c in cr...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('bohan_nyx_xh1994_yiran123', 'bohan_nyx_xh1994_yiran123') airbnb = repo.bohan_nyx_xh1994_yiran123.airbnb_rating.find() crime = repo.bohan_nyx_xh199...
transformation7
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class transformation7: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythi...
stack_v2_sparse_classes_36k_train_019804
6,098
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `transformation7` described below. Class description: Implement the transformation7 class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=Non...
Implement the Python class `transformation7` described below. Class description: Implement the transformation7 class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=Non...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class transformation7: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class transformation7: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('bohan_nyx_xh1994_yiran123', 'bohan_...
the_stack_v2_python_sparse
bohan_nyx_xh1994_yiran123/transformation7.py
lingyigu/course-2017-spr-proj
train
0
942f7e2ac06f33815a91e6f04e0527deb23a6d66
[ "expected_shape_x = (65, 64)\nexpected_shape_y = (64, 65)\nexpected_result_x = np.full(expected_shape_x, 0.5)\nexpected_result_y = np.full(expected_shape_y, 0.5)\nresult_x, result_y = RecursiveFilter()._pad_coefficients(*self.smoothing_coefficients)\nself.assertIsInstance(result_x.data, np.ndarray)\nself.assertIsIn...
<|body_start_0|> expected_shape_x = (65, 64) expected_shape_y = (64, 65) expected_result_x = np.full(expected_shape_x, 0.5) expected_result_y = np.full(expected_shape_y, 0.5) result_x, result_y = RecursiveFilter()._pad_coefficients(*self.smoothing_coefficients) self.asser...
Test the _pad_coefficients method
Test__pad_coefficients
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__pad_coefficients: """Test the _pad_coefficients method""" def test_padding_default(self): """Test that the returned smoothing_coefficients array is padded as expected with the default edge_width. Using default edge_width of 15 cells, which is doubled and applied to both sides o...
stack_v2_sparse_classes_36k_train_019805
22,857
permissive
[ { "docstring": "Test that the returned smoothing_coefficients array is padded as expected with the default edge_width. Using default edge_width of 15 cells, which is doubled and applied to both sides of the array, so array should be padded with 15 * 4 extra rows/columns.", "name": "test_padding_default", ...
3
null
Implement the Python class `Test__pad_coefficients` described below. Class description: Test the _pad_coefficients method Method signatures and docstrings: - def test_padding_default(self): Test that the returned smoothing_coefficients array is padded as expected with the default edge_width. Using default edge_width ...
Implement the Python class `Test__pad_coefficients` described below. Class description: Test the _pad_coefficients method Method signatures and docstrings: - def test_padding_default(self): Test that the returned smoothing_coefficients array is padded as expected with the default edge_width. Using default edge_width ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__pad_coefficients: """Test the _pad_coefficients method""" def test_padding_default(self): """Test that the returned smoothing_coefficients array is padded as expected with the default edge_width. Using default edge_width of 15 cells, which is doubled and applied to both sides o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__pad_coefficients: """Test the _pad_coefficients method""" def test_padding_default(self): """Test that the returned smoothing_coefficients array is padded as expected with the default edge_width. Using default edge_width of 15 cells, which is doubled and applied to both sides of the array, ...
the_stack_v2_python_sparse
improver_tests/nbhood/recursive_filter/test_RecursiveFilter.py
metoppv/improver
train
101
3fe5977fd199730adb4dc53d67b54e741a6f5ee2
[ "status = response.reinjection_functionality_status\nheader = response.sdp_header\nresult[header.source_chip_x, header.source_chip_y] = status", "status = dict()\nself._send_request(GetReinjectionStatusMessage(x, y, p), functools.partial(self.__handle_response, status))\nself._finish()\nself.check_for_error()\nre...
<|body_start_0|> status = response.reinjection_functionality_status header = response.sdp_header result[header.source_chip_x, header.source_chip_y] = status <|end_body_0|> <|body_start_1|> status = dict() self._send_request(GetReinjectionStatusMessage(x, y, p), functools.partial...
How to send messages to read the status of extra monitors.
ReadStatusProcess
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadStatusProcess: """How to send messages to read the status of extra monitors.""" def __handle_response(result, response): """:param dict result: :param GetReinjectionStatusMessageResponse response:""" <|body_0|> def get_reinjection_status(self, x, y, p): """:p...
stack_v2_sparse_classes_36k_train_019806
2,665
permissive
[ { "docstring": ":param dict result: :param GetReinjectionStatusMessageResponse response:", "name": "__handle_response", "signature": "def __handle_response(result, response)" }, { "docstring": ":param int x: :param int y: :param int p: :rtype: ReInjectionStatus", "name": "get_reinjection_sta...
3
null
Implement the Python class `ReadStatusProcess` described below. Class description: How to send messages to read the status of extra monitors. Method signatures and docstrings: - def __handle_response(result, response): :param dict result: :param GetReinjectionStatusMessageResponse response: - def get_reinjection_stat...
Implement the Python class `ReadStatusProcess` described below. Class description: How to send messages to read the status of extra monitors. Method signatures and docstrings: - def __handle_response(result, response): :param dict result: :param GetReinjectionStatusMessageResponse response: - def get_reinjection_stat...
8ab1d0b50bf47afc0ccec8d31c9e513113fffd3b
<|skeleton|> class ReadStatusProcess: """How to send messages to read the status of extra monitors.""" def __handle_response(result, response): """:param dict result: :param GetReinjectionStatusMessageResponse response:""" <|body_0|> def get_reinjection_status(self, x, y, p): """:p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadStatusProcess: """How to send messages to read the status of extra monitors.""" def __handle_response(result, response): """:param dict result: :param GetReinjectionStatusMessageResponse response:""" status = response.reinjection_functionality_status header = response.sdp_head...
the_stack_v2_python_sparse
spinn_front_end_common/utilities/utility_objs/extra_monitor_scp_processes/read_status_process.py
SpiNNakerManchester/SpiNNFrontEndCommon
train
16
6e324257502a73984cd3dbf61e03b55f8b9a0305
[ "super().__init__()\nself.CTX_DIM = CTX_DIM\nself.ENC_DIM = ENC_DIM\nself.proj_q = Linear(self.ENC_DIM, self.CTX_DIM)\nself.inter2att = Linear(self.CTX_DIM, 1)", "proj_q = self.proj_q(vecQuestions)\ninteractions = F.normalize(kb * proj_q[:, None, :], dim=-1)\nraw_att = self.inter2att(interactions).squeeze(-1)\nra...
<|body_start_0|> super().__init__() self.CTX_DIM = CTX_DIM self.ENC_DIM = ENC_DIM self.proj_q = Linear(self.ENC_DIM, self.CTX_DIM) self.inter2att = Linear(self.CTX_DIM, 1) <|end_body_0|> <|body_start_1|> proj_q = self.proj_q(vecQuestions) interactions = F.normali...
SingleHop
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleHop: def __init__(self, CTX_DIM: int, ENC_DIM: int) -> None: """initialzation of SingleHop. Args: CTX_DIM: context dimension ENC_DIM: encoder dimension""" <|body_0|> def forward(self, kb: Tensor, vecQuestions: Tensor, imagesObjectNum: Tensor) -> Tensor: """forw...
stack_v2_sparse_classes_36k_train_019807
3,925
permissive
[ { "docstring": "initialzation of SingleHop. Args: CTX_DIM: context dimension ENC_DIM: encoder dimension", "name": "__init__", "signature": "def __init__(self, CTX_DIM: int, ENC_DIM: int) -> None" }, { "docstring": "forward computation of SingleHop. Args: kb: the output feature of backbone, is x^...
2
null
Implement the Python class `SingleHop` described below. Class description: Implement the SingleHop class. Method signatures and docstrings: - def __init__(self, CTX_DIM: int, ENC_DIM: int) -> None: initialzation of SingleHop. Args: CTX_DIM: context dimension ENC_DIM: encoder dimension - def forward(self, kb: Tensor, ...
Implement the Python class `SingleHop` described below. Class description: Implement the SingleHop class. Method signatures and docstrings: - def __init__(self, CTX_DIM: int, ENC_DIM: int) -> None: initialzation of SingleHop. Args: CTX_DIM: context dimension ENC_DIM: encoder dimension - def forward(self, kb: Tensor, ...
af87a17275f02c94932bb2e29f132a84db812002
<|skeleton|> class SingleHop: def __init__(self, CTX_DIM: int, ENC_DIM: int) -> None: """initialzation of SingleHop. Args: CTX_DIM: context dimension ENC_DIM: encoder dimension""" <|body_0|> def forward(self, kb: Tensor, vecQuestions: Tensor, imagesObjectNum: Tensor) -> Tensor: """forw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleHop: def __init__(self, CTX_DIM: int, ENC_DIM: int) -> None: """initialzation of SingleHop. Args: CTX_DIM: context dimension ENC_DIM: encoder dimension""" super().__init__() self.CTX_DIM = CTX_DIM self.ENC_DIM = ENC_DIM self.proj_q = Linear(self.ENC_DIM, self.CTX_...
the_stack_v2_python_sparse
imix/models/vqa_models/lcgn.py
linxi1158/iMIX
train
0
e4b91303ab3dffd8ed7f37cb61d125e50448b183
[ "self.input_dim = input_dim\nself.output_dim = output_dim\nself.act_func = act_func\nself.name_W = name_W\nself.name_b = name_b\nself.W = tf.Variable(rng.uniform(low=-0.08, high=0.08, size=(input_dim, output_dim)).astype('float32'), name=name_W)\nself.b = tf.Variable(rng.uniform(low=-0.08, high=0.08, size=output_di...
<|body_start_0|> self.input_dim = input_dim self.output_dim = output_dim self.act_func = act_func self.name_W = name_W self.name_b = name_b self.W = tf.Variable(rng.uniform(low=-0.08, high=0.08, size=(input_dim, output_dim)).astype('float32'), name=name_W) self.b ...
Dense layer class
Dense
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dense: """Dense layer class""" def __init__(self, input_dim, output_dim, act_func, name_W, name_b): """:param input_dim : int, input dimension :param output_dim : int, output dimension :param act_func : function, actimation function :param name_W : str, weight name :param name_b : st...
stack_v2_sparse_classes_36k_train_019808
2,750
permissive
[ { "docstring": ":param input_dim : int, input dimension :param output_dim : int, output dimension :param act_func : function, actimation function :param name_W : str, weight name :param name_b : str, bias name", "name": "__init__", "signature": "def __init__(self, input_dim, output_dim, act_func, name_W...
2
stack_v2_sparse_classes_30k_train_003180
Implement the Python class `Dense` described below. Class description: Dense layer class Method signatures and docstrings: - def __init__(self, input_dim, output_dim, act_func, name_W, name_b): :param input_dim : int, input dimension :param output_dim : int, output dimension :param act_func : function, actimation fun...
Implement the Python class `Dense` described below. Class description: Dense layer class Method signatures and docstrings: - def __init__(self, input_dim, output_dim, act_func, name_W, name_b): :param input_dim : int, input dimension :param output_dim : int, output dimension :param act_func : function, actimation fun...
ad8e050cd754e5a1c73ed5df3bc223a1f6dc4148
<|skeleton|> class Dense: """Dense layer class""" def __init__(self, input_dim, output_dim, act_func, name_W, name_b): """:param input_dim : int, input dimension :param output_dim : int, output dimension :param act_func : function, actimation function :param name_W : str, weight name :param name_b : st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dense: """Dense layer class""" def __init__(self, input_dim, output_dim, act_func, name_W, name_b): """:param input_dim : int, input dimension :param output_dim : int, output dimension :param act_func : function, actimation function :param name_W : str, weight name :param name_b : str, bias name"...
the_stack_v2_python_sparse
neuralnet/fine-tuning_transfer-learning/src/modeldev/d_layer.py
hsmtknj/machine-learning
train
0
b05b91cc0cfa4d85ee88571193c56607fde67a07
[ "obj = self.new_obj\nobj.save()\ntag_obj = Tags.objects.get(id=obj.tag.id)\narticle_obj = PageDetail.objects.get(id=obj.article.id)\nif article_obj:\n article_obj.tags += ',' + tag_obj.tag_name\n article_obj.save()", "obj = self.obj\ntag_obj = Tags.objects.get(id=obj.tag.id)\narticle_obj = PageDetail.object...
<|body_start_0|> obj = self.new_obj obj.save() tag_obj = Tags.objects.get(id=obj.tag.id) article_obj = PageDetail.objects.get(id=obj.article.id) if article_obj: article_obj.tags += ',' + tag_obj.tag_name article_obj.save() <|end_body_0|> <|body_start_1|> ...
TagMapAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagMapAdmin: def save_models(self): """tag引用计数的更新""" <|body_0|> def delete_model(self): """删除Tag映射""" <|body_1|> <|end_skeleton|> <|body_start_0|> obj = self.new_obj obj.save() tag_obj = Tags.objects.get(id=obj.tag.id) articl...
stack_v2_sparse_classes_36k_train_019809
4,329
no_license
[ { "docstring": "tag引用计数的更新", "name": "save_models", "signature": "def save_models(self)" }, { "docstring": "删除Tag映射", "name": "delete_model", "signature": "def delete_model(self)" } ]
2
stack_v2_sparse_classes_30k_train_001156
Implement the Python class `TagMapAdmin` described below. Class description: Implement the TagMapAdmin class. Method signatures and docstrings: - def save_models(self): tag引用计数的更新 - def delete_model(self): 删除Tag映射
Implement the Python class `TagMapAdmin` described below. Class description: Implement the TagMapAdmin class. Method signatures and docstrings: - def save_models(self): tag引用计数的更新 - def delete_model(self): 删除Tag映射 <|skeleton|> class TagMapAdmin: def save_models(self): """tag引用计数的更新""" <|body_0|>...
7d86de995deacac4eb45fed31865ba8a9598c289
<|skeleton|> class TagMapAdmin: def save_models(self): """tag引用计数的更新""" <|body_0|> def delete_model(self): """删除Tag映射""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagMapAdmin: def save_models(self): """tag引用计数的更新""" obj = self.new_obj obj.save() tag_obj = Tags.objects.get(id=obj.tag.id) article_obj = PageDetail.objects.get(id=obj.article.id) if article_obj: article_obj.tags += ',' + tag_obj.tag_name ...
the_stack_v2_python_sparse
apps/blog/adminx.py
SatoKoi/Blog
train
1
4b612ccddcca123d374e51540159ac2215f18f3c
[ "ability = Ability.query.get(id)\nif not ability:\n api.abort(code=404, message='Ability not found')\nreturn {'data': ability.__jsonapi__()}", "ability = Ability.query.get(id)\ndata = request.get_json()['data']\ntry:\n if len(data['relationships']['groups']['data']) >= 0:\n ability.groups = list((id[...
<|body_start_0|> ability = Ability.query.get(id) if not ability: api.abort(code=404, message='Ability not found') return {'data': ability.__jsonapi__()} <|end_body_0|> <|body_start_1|> ability = Ability.query.get(id) data = request.get_json()['data'] try: ...
Abilities
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Abilities: def get(self, id): """Get ability""" <|body_0|> def put(self, id): """Update ability""" <|body_1|> <|end_skeleton|> <|body_start_0|> ability = Ability.query.get(id) if not ability: api.abort(code=404, message='Ability ...
stack_v2_sparse_classes_36k_train_019810
46,738
permissive
[ { "docstring": "Get ability", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update ability", "name": "put", "signature": "def put(self, id)" } ]
2
stack_v2_sparse_classes_30k_train_017386
Implement the Python class `Abilities` described below. Class description: Implement the Abilities class. Method signatures and docstrings: - def get(self, id): Get ability - def put(self, id): Update ability
Implement the Python class `Abilities` described below. Class description: Implement the Abilities class. Method signatures and docstrings: - def get(self, id): Get ability - def put(self, id): Update ability <|skeleton|> class Abilities: def get(self, id): """Get ability""" <|body_0|> def ...
3439a2dd0bd527c5d604801fec3a5aac904a72e2
<|skeleton|> class Abilities: def get(self, id): """Get ability""" <|body_0|> def put(self, id): """Update ability""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Abilities: def get(self, id): """Get ability""" ability = Ability.query.get(id) if not ability: api.abort(code=404, message='Ability not found') return {'data': ability.__jsonapi__()} def put(self, id): """Update ability""" ability = Ability.que...
the_stack_v2_python_sparse
app/views.py
taidos/lxc-rest
train
0
be4c15a46d621582bd8651a5a00a806ea546c6e8
[ "for conf in self:\n for line in conf.voucher_line_ids:\n line.write({'state': 'approve'})\nreturn super(AccountBudgetConfirmation, self).budget_valid()", "for conf in self:\n for line in conf.voucher_line_ids:\n line.write({'state': 'no_approve'})\nreturn super(AccountBudgetConfirmation, self...
<|body_start_0|> for conf in self: for line in conf.voucher_line_ids: line.write({'state': 'approve'}) return super(AccountBudgetConfirmation, self).budget_valid() <|end_body_0|> <|body_start_1|> for conf in self: for line in conf.voucher_line_ids: ...
Inherit to overwrite workflow mothods to reflect confirmation state in voucher line
AccountBudgetConfirmation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountBudgetConfirmation: """Inherit to overwrite workflow mothods to reflect confirmation state in voucher line""" def budget_valid(self): """overwrite to change vocher line state to approve""" <|body_0|> def budget_unvalid(self): """overwrite to change vocher ...
stack_v2_sparse_classes_36k_train_019811
40,481
no_license
[ { "docstring": "overwrite to change vocher line state to approve", "name": "budget_valid", "signature": "def budget_valid(self)" }, { "docstring": "overwrite to change vocher line state to no_approve", "name": "budget_unvalid", "signature": "def budget_unvalid(self)" }, { "docstr...
3
null
Implement the Python class `AccountBudgetConfirmation` described below. Class description: Inherit to overwrite workflow mothods to reflect confirmation state in voucher line Method signatures and docstrings: - def budget_valid(self): overwrite to change vocher line state to approve - def budget_unvalid(self): overwr...
Implement the Python class `AccountBudgetConfirmation` described below. Class description: Inherit to overwrite workflow mothods to reflect confirmation state in voucher line Method signatures and docstrings: - def budget_valid(self): overwrite to change vocher line state to approve - def budget_unvalid(self): overwr...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class AccountBudgetConfirmation: """Inherit to overwrite workflow mothods to reflect confirmation state in voucher line""" def budget_valid(self): """overwrite to change vocher line state to approve""" <|body_0|> def budget_unvalid(self): """overwrite to change vocher ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountBudgetConfirmation: """Inherit to overwrite workflow mothods to reflect confirmation state in voucher line""" def budget_valid(self): """overwrite to change vocher line state to approve""" for conf in self: for line in conf.voucher_line_ids: line.write({...
the_stack_v2_python_sparse
v_11/EBS-SVN/branches/ebs/account_voucher_custom/models/account_voucher.py
musabahmed/baba
train
0
e785c85afa12588ea4d8003148057f66ca8c7497
[ "credentials = authorized_user.Credentials.from_authorized_user_info({'client_id': 'client_id', 'client_secret': 'client_secret', 'refresh_token': 'refresh_token'})\nentity = TestModel(id='foo', credentials=credentials)\nentity.put()\nretrieved = TestModel.get_by_id('foo')\nself.assertIsNotNone(retrieved.credential...
<|body_start_0|> credentials = authorized_user.Credentials.from_authorized_user_info({'client_id': 'client_id', 'client_secret': 'client_secret', 'refresh_token': 'refresh_token'}) entity = TestModel(id='foo', credentials=credentials) entity.put() retrieved = TestModel.get_by_id('foo') ...
Tests for oauth2_util.CredentialsProperty.
CredentialsPropertyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredentialsPropertyTest: """Tests for oauth2_util.CredentialsProperty.""" def testStore(self): """Tests that credentials can be stored and retrieved.""" <|body_0|> def testValidate(self): """Tests that the credentials type is validated.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_019812
2,907
permissive
[ { "docstring": "Tests that credentials can be stored and retrieved.", "name": "testStore", "signature": "def testStore(self)" }, { "docstring": "Tests that the credentials type is validated.", "name": "testValidate", "signature": "def testValidate(self)" }, { "docstring": "Tests ...
3
stack_v2_sparse_classes_30k_train_015947
Implement the Python class `CredentialsPropertyTest` described below. Class description: Tests for oauth2_util.CredentialsProperty. Method signatures and docstrings: - def testStore(self): Tests that credentials can be stored and retrieved. - def testValidate(self): Tests that the credentials type is validated. - def...
Implement the Python class `CredentialsPropertyTest` described below. Class description: Tests for oauth2_util.CredentialsProperty. Method signatures and docstrings: - def testStore(self): Tests that credentials can be stored and retrieved. - def testValidate(self): Tests that the credentials type is validated. - def...
5e10bed02089e4cf29ae4d9d67e127f77e8fb3c9
<|skeleton|> class CredentialsPropertyTest: """Tests for oauth2_util.CredentialsProperty.""" def testStore(self): """Tests that credentials can be stored and retrieved.""" <|body_0|> def testValidate(self): """Tests that the credentials type is validated.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CredentialsPropertyTest: """Tests for oauth2_util.CredentialsProperty.""" def testStore(self): """Tests that credentials can be stored and retrieved.""" credentials = authorized_user.Credentials.from_authorized_user_info({'client_id': 'client_id', 'client_secret': 'client_secret', 'refres...
the_stack_v2_python_sparse
multitest_transport/util/oauth2_util_test.py
maksonlee/multitest_transport
train
0
8f87339b6b9b5c589d023713951fd7b1f52a7e84
[ "right_remove = 0\nleft_remove = 0\nleft_total = 0\nright_total = 0\nfor c in s:\n if c == '(':\n left_total += 1\n left_remove += 1\n elif c == ')':\n right_total += 1\n if left_remove == 0:\n right_remove += 1\n else:\n left_remove -= 1\nres = set()\n...
<|body_start_0|> right_remove = 0 left_remove = 0 left_total = 0 right_total = 0 for c in s: if c == '(': left_total += 1 left_remove += 1 elif c == ')': right_total += 1 if left_remove == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove): """leftcnt: number of left parentheses to add left_remove: number of left parentheses to rem...
stack_v2_sparse_classes_36k_train_019813
2,477
no_license
[ { "docstring": ":type s: str :rtype: List[str]", "name": "removeInvalidParentheses", "signature": "def removeInvalidParentheses(self, s)" }, { "docstring": "leftcnt: number of left parentheses to add left_remove: number of left parentheses to remove", "name": "dfs", "signature": "def dfs...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeInvalidParentheses(self, s): :type s: str :rtype: List[str] - def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove): leftcnt: number of left pare...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeInvalidParentheses(self, s): :type s: str :rtype: List[str] - def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove): leftcnt: number of left pare...
4fd63ced37732d2c3f14b87bd115b1cebc4d5fc4
<|skeleton|> class Solution: def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def dfs(self, s, i, res, path, leftcnt, rightcnt, left_remove, right_remove): """leftcnt: number of left parentheses to add left_remove: number of left parentheses to rem...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str]""" right_remove = 0 left_remove = 0 left_total = 0 right_total = 0 for c in s: if c == '(': left_total += 1 left_remove += 1 ...
the_stack_v2_python_sparse
0301. Remove Invalid Parentheses.py
zannn3/LeetCode-Solutions-Python
train
0
6dac2e38224206cb86ad763409d2090cce888ee6
[ "def no_rob(node):\n if node in hashtable:\n return hashtable[node]\n if node is None:\n return 0\n rob_left = rob_right = rob_both = rob_neither = 0\n rob_neither = no_rob(node.left) + no_rob(node.right)\n if node.left:\n rob_left = node.left.val + no_rob(node.left.left) + no_ro...
<|body_start_0|> def no_rob(node): if node in hashtable: return hashtable[node] if node is None: return 0 rob_left = rob_right = rob_both = rob_neither = 0 rob_neither = no_rob(node.left) + no_rob(node.right) if node.lef...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rob_simple(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def no_rob(node): if node in hashtable: ...
stack_v2_sparse_classes_36k_train_019814
3,124
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "rob", "signature": "def rob(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "rob_simple", "signature": "def rob_simple(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, root): :type root: TreeNode :rtype: int - def rob_simple(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 rob(self, root): :type root: TreeNode :rtype: int - def rob_simple(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def rob(self, root): ...
d308e0e41c288f23a846b8505e572943d30b1392
<|skeleton|> class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rob_simple(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" def no_rob(node): if node in hashtable: return hashtable[node] if node is None: return 0 rob_left = rob_right = rob_both = rob_neither = 0 rob_n...
the_stack_v2_python_sparse
python/337_House_Robber_III.py
HankerZheng/LeetCode-Problems
train
2
c457a8dd7eb601c308c7b0bb507ff5e0ba0d1524
[ "count = 1\narr = [0 for i in range(num_people)]\nwhile candies >= count:\n arr[(count - 1) % num_people] += count\n candies -= count\n count += 1\narr[(count - 1) % num_people] += candies\nreturn arr", "count = 1\narr = [0 for i in range(num_people)]\nwhile candies > 0:\n '\\n min(count, c...
<|body_start_0|> count = 1 arr = [0 for i in range(num_people)] while candies >= count: arr[(count - 1) % num_people] += count candies -= count count += 1 arr[(count - 1) % num_people] += candies return arr <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def distributeCandies(self, candies: int, num_people: int) -> List[int]: """执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:""" <|body_0|> def distributeCandies2(self, candies: int, num_...
stack_v2_sparse_classes_36k_train_019815
3,806
no_license
[ { "docstring": "执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:", "name": "distributeCandies", "signature": "def distributeCandies(self, candies: int, num_people: int) -> List[int]" }, { "docstring": "执行用时 :52 ms, 在所...
3
stack_v2_sparse_classes_30k_train_015354
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distributeCandies(self, candies: int, num_people: int) -> List[int]: 执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :para...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distributeCandies(self, candies: int, num_people: int) -> List[int]: 执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :para...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def distributeCandies(self, candies: int, num_people: int) -> List[int]: """执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:""" <|body_0|> def distributeCandies2(self, candies: int, num_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def distributeCandies(self, candies: int, num_people: int) -> List[int]: """执行用时 :64 ms, 在所有 Python3 提交中击败了18.87%的用户 内存消耗 :13.5 MB, 在所有 Python3 提交中击败了23.58%的用户 :param candies: :param num_people: :return:""" count = 1 arr = [0 for i in range(num_people)] while candies ...
the_stack_v2_python_sparse
LeetCode/1103. Distribute Candies to People.py
yiming1012/MyLeetCode
train
2
ac4e1a8e084b67d2eefc85e10b532c49ddf7ea3d
[ "client_id = current_token.get('azp') or None\nuser_id = current_token['sub']\nusername = current_token.get('context', {}).get('user', {}).get('name')\nwith GoogleCloudManager() as g_cloud_manager:\n proxy_group_id = get_or_create_proxy_group_id()\n service_account = get_or_create_service_account(client_id=cl...
<|body_start_0|> client_id = current_token.get('azp') or None user_id = current_token['sub'] username = current_token.get('context', {}).get('user', {}).get('name') with GoogleCloudManager() as g_cloud_manager: proxy_group_id = get_or_create_proxy_group_id() servi...
For ``/credentials/google`` endpoint.
GoogleCredentialsList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoogleCredentialsList: """For ``/credentials/google`` endpoint.""" def get(self): """List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/ke...
stack_v2_sparse_classes_36k_train_019816
12,068
permissive
[ { "docstring": "List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/keys endpoint but get the expiration time from our DB .. code-block:: JavaScript { \"access_keys\":...
4
stack_v2_sparse_classes_30k_val_000329
Implement the Python class `GoogleCredentialsList` described below. Class description: For ``/credentials/google`` endpoint. Method signatures and docstrings: - def get(self): List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: applicatio...
Implement the Python class `GoogleCredentialsList` described below. Class description: For ``/credentials/google`` endpoint. Method signatures and docstrings: - def get(self): List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: applicatio...
ea885f0e882d8e6bb5db7670c4025bb8e282cdfc
<|skeleton|> class GoogleCredentialsList: """For ``/credentials/google`` endpoint.""" def get(self): """List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/ke...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GoogleCredentialsList: """For ``/credentials/google`` endpoint.""" def get(self): """List access keys for user **Example:** .. code-block:: http POST /credentials/apis/ HTTP/1.1 Content-Type: application/json Accept: application/json Info from Google API /serviceAccounts/<account>/keys endpoint b...
the_stack_v2_python_sparse
fence/blueprints/storage_creds/google.py
uc-cdis/fence
train
42
2810122f26f673f977042e805b49b7a230765355
[ "if not matrix or not matrix[0]:\n return\nrows, self.cols = (len(matrix), len(matrix[0]))\nfor r in range(rows):\n for c in range(1, self.cols):\n matrix[r][c] += matrix[r][c - 1]\nself.matrix = matrix", "prev = self.matrix[row][col]\nif col != 0:\n prev -= self.matrix[row][col - 1]\ndiff = val -...
<|body_start_0|> if not matrix or not matrix[0]: return rows, self.cols = (len(matrix), len(matrix[0])) for r in range(rows): for c in range(1, self.cols): matrix[r][c] += matrix[r][c - 1] self.matrix = matrix <|end_body_0|> <|body_start_1|> ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_36k_train_019817
1,888
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row: int :type col: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, row, col, val)" }, { "docstring": ":type r...
3
stack_v2_sparse_classes_30k_train_013477
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void - def sumRegion(self, row...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: void""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix or not matrix[0]: return rows, self.cols = (len(matrix), len(matrix[0])) for r in range(rows): for c in range(1, self.cols): matrix[r][c] += matrix[r...
the_stack_v2_python_sparse
python_1_to_1000/308_Range_Sum_Query_2D-Mutable.py
jakehoare/leetcode
train
58
8d7dc8e915175f23bf636840159ccda24c1a97e7
[ "if len(lists) < 1:\n return None\nelif sum([1 if i else 0 for i in lists]) == 0:\n return lists[0]\nwhile len(lists) > 1:\n tmp = []\n for i in range(0, len(lists) - 1, 2):\n l = self.mergeTwoLists(lists[i], lists[i + 1])\n tmp.append(l)\n if len(lists) % 2 == 1:\n tmp.append(li...
<|body_start_0|> if len(lists) < 1: return None elif sum([1 if i else 0 for i in lists]) == 0: return lists[0] while len(lists) > 1: tmp = [] for i in range(0, len(lists) - 1, 2): l = self.mergeTwoLists(lists[i], lists[i + 1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(l...
stack_v2_sparse_classes_36k_train_019818
4,076
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode <|skeleton|>...
e41a86e9d4615079247ef3ef9a35537f4b40d338
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" if len(lists) < 1: return None elif sum([1 if i else 0 for i in lists]) == 0: return lists[0] while len(lists) > 1: tmp = [] for i in range...
the_stack_v2_python_sparse
Algorithms/合并K个排序链表.py
pppineapple/LeetCode
train
0
6a4b9bc2e65480b737491836490afc0df3957382
[ "settings = init_settings(project_name, calculations, calc_spot, post_spot, plot_spot)\nsettings['NOTEBOOK_IP'] = 'localhost'\nsettings['extra_allowed_hosts'] = []\nsite_port = 8000\nsettings['NOTEBOOK_PORT'] = site_port + 1\nconnect_run(project_name=project_name, settings_custom=settings, post_spot=post_spot, plot...
<|body_start_0|> settings = init_settings(project_name, calculations, calc_spot, post_spot, plot_spot) settings['NOTEBOOK_IP'] = 'localhost' settings['extra_allowed_hosts'] = [] site_port = 8000 settings['NOTEBOOK_PORT'] = site_port + 1 connect_run(project_name=project_na...
Route requests for an omnicalc project to the connect_run function with settings depending on the connection dictionary.
OmniFromFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OmniFromFactory: """Route requests for an omnicalc project to the connect_run function with settings depending on the connection dictionary.""" def connection_development(self, project_name, calculations, calc_spot, post_spot, plot_spot, omnicalc=None, meta_filter=None): """Main hand...
stack_v2_sparse_classes_36k_train_019819
17,542
no_license
[ { "docstring": "Main handler for the development environment.", "name": "connection_development", "signature": "def connection_development(self, project_name, calculations, calc_spot, post_spot, plot_spot, omnicalc=None, meta_filter=None)" }, { "docstring": "Main handler for the development envi...
2
stack_v2_sparse_classes_30k_train_006481
Implement the Python class `OmniFromFactory` described below. Class description: Route requests for an omnicalc project to the connect_run function with settings depending on the connection dictionary. Method signatures and docstrings: - def connection_development(self, project_name, calculations, calc_spot, post_spo...
Implement the Python class `OmniFromFactory` described below. Class description: Route requests for an omnicalc project to the connect_run function with settings depending on the connection dictionary. Method signatures and docstrings: - def connection_development(self, project_name, calculations, calc_spot, post_spo...
1aff816154c8acca80e30f9477a03ec19d3183fe
<|skeleton|> class OmniFromFactory: """Route requests for an omnicalc project to the connect_run function with settings depending on the connection dictionary.""" def connection_development(self, project_name, calculations, calc_spot, post_spot, plot_spot, omnicalc=None, meta_filter=None): """Main hand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OmniFromFactory: """Route requests for an omnicalc project to the connect_run function with settings depending on the connection dictionary.""" def connection_development(self, project_name, calculations, calc_spot, post_spot, plot_spot, omnicalc=None, meta_filter=None): """Main handler for the d...
the_stack_v2_python_sparse
manager/cli.py
bradleyrp/factory
train
0
5bd1b2096685be50dc512f52c12b1cf16e4a556d
[ "ClarinService.__init__(self)\nself.url_base = 'http://ws.clarin-pl.eu/nlprest2/base/startTask'\nself.url_check = 'http://ws.clarin-pl.eu/nlprest2/base/getStatus'\nself.url_download = 'http://ws.clarin-pl.eu/nlprest2/base/download'\nself.file_id = ''\nself.compressed_suffix = 'ann_morphosyntax.xml.gz'", "raw_resp...
<|body_start_0|> ClarinService.__init__(self) self.url_base = 'http://ws.clarin-pl.eu/nlprest2/base/startTask' self.url_check = 'http://ws.clarin-pl.eu/nlprest2/base/getStatus' self.url_download = 'http://ws.clarin-pl.eu/nlprest2/base/download' self.file_id = '' self.comp...
Extended service for calling clarin backend api that must be called in asynchronous way
AsynchronousClarinService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsynchronousClarinService: """Extended service for calling clarin backend api that must be called in asynchronous way""" def __init__(self): """Init service with asynchronous url""" <|body_0|> def is_document_ready(self) -> bool: """Ask clarin backend whether pro...
stack_v2_sparse_classes_36k_train_019820
9,033
permissive
[ { "docstring": "Init service with asynchronous url", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Ask clarin backend whether processed document is ready", "name": "is_document_ready", "signature": "def is_document_ready(self) -> bool" }, { "docstring":...
5
stack_v2_sparse_classes_30k_train_018843
Implement the Python class `AsynchronousClarinService` described below. Class description: Extended service for calling clarin backend api that must be called in asynchronous way Method signatures and docstrings: - def __init__(self): Init service with asynchronous url - def is_document_ready(self) -> bool: Ask clari...
Implement the Python class `AsynchronousClarinService` described below. Class description: Extended service for calling clarin backend api that must be called in asynchronous way Method signatures and docstrings: - def __init__(self): Init service with asynchronous url - def is_document_ready(self) -> bool: Ask clari...
af03252e19075feec3fa478fa271ea3ae8cf8d11
<|skeleton|> class AsynchronousClarinService: """Extended service for calling clarin backend api that must be called in asynchronous way""" def __init__(self): """Init service with asynchronous url""" <|body_0|> def is_document_ready(self) -> bool: """Ask clarin backend whether pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsynchronousClarinService: """Extended service for calling clarin backend api that must be called in asynchronous way""" def __init__(self): """Init service with asynchronous url""" ClarinService.__init__(self) self.url_base = 'http://ws.clarin-pl.eu/nlprest2/base/startTask' ...
the_stack_v2_python_sparse
services/ClarinServices.py
kubasikora/WEDT-Projekt
train
0
29d15c4c250ca4850556ce4ef32048387d4e4249
[ "result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id')\nresult.SetDuration(str(1), str(2000))\nself.assertTrue(result.is_slow_result)", "result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id')\nresult.SetDuration(30, 100000)\nself.assertFalse(result.is_slow_result...
<|body_start_0|> result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') result.SetDuration(str(1), str(2000)) self.assertTrue(result.is_slow_result) <|end_body_0|> <|body_start_1|> result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') ...
WebTestResultUnittest
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebTestResultUnittest: def testSetDurationString(self): """Tests that strings are properly converted when setting durations.""" <|body_0|> def testSetDurationNotSlow(self): """Tests that setting a duration for a non-slow result works.""" <|body_1|> def t...
stack_v2_sparse_classes_36k_train_019821
10,707
permissive
[ { "docstring": "Tests that strings are properly converted when setting durations.", "name": "testSetDurationString", "signature": "def testSetDurationString(self)" }, { "docstring": "Tests that setting a duration for a non-slow result works.", "name": "testSetDurationNotSlow", "signature...
5
stack_v2_sparse_classes_30k_train_013168
Implement the Python class `WebTestResultUnittest` described below. Class description: Implement the WebTestResultUnittest class. Method signatures and docstrings: - def testSetDurationString(self): Tests that strings are properly converted when setting durations. - def testSetDurationNotSlow(self): Tests that settin...
Implement the Python class `WebTestResultUnittest` described below. Class description: Implement the WebTestResultUnittest class. Method signatures and docstrings: - def testSetDurationString(self): Tests that strings are properly converted when setting durations. - def testSetDurationNotSlow(self): Tests that settin...
fd8a8914ca0183f0add65ae55f04e287543c7d4a
<|skeleton|> class WebTestResultUnittest: def testSetDurationString(self): """Tests that strings are properly converted when setting durations.""" <|body_0|> def testSetDurationNotSlow(self): """Tests that setting a duration for a non-slow result works.""" <|body_1|> def t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebTestResultUnittest: def testSetDurationString(self): """Tests that strings are properly converted when setting durations.""" result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') result.SetDuration(str(1), str(2000)) self.assertTrue(result.is_slow_r...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/data_types_unittest.py
SREERAGI18/chromium
train
1
4ec8946ea5ff1ad4387cfd7a57f72f3a3061cd42
[ "QtGui.QLabel.__init__(self, parent)\nself.alias = alias\nself.caption = text\nif default_label:\n self.default_label = default_label\nelse:\n self.default_label = ''\nself.updateText()\nself.setAttribute(QtCore.Qt.WA_Hover)\nself.setCursor(QtCore.Qt.PointingHandCursor)\nself.setToolTip(alias)\nself.palette()...
<|body_start_0|> QtGui.QLabel.__init__(self, parent) self.alias = alias self.caption = text if default_label: self.default_label = default_label else: self.default_label = '' self.updateText() self.setAttribute(QtCore.Qt.WA_Hover) s...
AliasLabel is a QLabel that supports hover actions similar to a hot link
AliasLabel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliasLabel: """AliasLabel is a QLabel that supports hover actions similar to a hot link""" def __init__(self, alias='', text='', default_label='', parent=None): """AliasLabel(alias:str , text: str, default_label: str, parent: QWidget) -> QHoverAliasLabel Initialize the label with a t...
stack_v2_sparse_classes_36k_train_019822
26,543
permissive
[ { "docstring": "AliasLabel(alias:str , text: str, default_label: str, parent: QWidget) -> QHoverAliasLabel Initialize the label with a text", "name": "__init__", "signature": "def __init__(self, alias='', text='', default_label='', parent=None)" }, { "docstring": "updateText() -> None Update the...
4
null
Implement the Python class `AliasLabel` described below. Class description: AliasLabel is a QLabel that supports hover actions similar to a hot link Method signatures and docstrings: - def __init__(self, alias='', text='', default_label='', parent=None): AliasLabel(alias:str , text: str, default_label: str, parent: Q...
Implement the Python class `AliasLabel` described below. Class description: AliasLabel is a QLabel that supports hover actions similar to a hot link Method signatures and docstrings: - def __init__(self, alias='', text='', default_label='', parent=None): AliasLabel(alias:str , text: str, default_label: str, parent: Q...
23ef56ec24b85c82416e1437a08381635328abe5
<|skeleton|> class AliasLabel: """AliasLabel is a QLabel that supports hover actions similar to a hot link""" def __init__(self, alias='', text='', default_label='', parent=None): """AliasLabel(alias:str , text: str, default_label: str, parent: QWidget) -> QHoverAliasLabel Initialize the label with a t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AliasLabel: """AliasLabel is a QLabel that supports hover actions similar to a hot link""" def __init__(self, alias='', text='', default_label='', parent=None): """AliasLabel(alias:str , text: str, default_label: str, parent: QWidget) -> QHoverAliasLabel Initialize the label with a text""" ...
the_stack_v2_python_sparse
vistrails_current/vistrails/gui/ports_pane.py
lumig242/VisTrailsRecommendation
train
3
f2d856825689abb7989abeb80baf99770c8b59a8
[ "departments = self.filter(scale=Perimeter.SCALES.department, is_obsolete=False)\nif values:\n departments = departments.values(*values)\ndepartments = departments.order_by('code')\ndepartments_list = []\nfor department in departments:\n if values:\n department['slug'] = slugify(department['name'])\n ...
<|body_start_0|> departments = self.filter(scale=Perimeter.SCALES.department, is_obsolete=False) if values: departments = departments.values(*values) departments = departments.order_by('code') departments_list = [] for department in departments: if values:...
PerimeterQuerySet
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerimeterQuerySet: def departments(self, values=None): """Returns a list of the departments - with a slug - sorted by code - and so that the Corsican ones are listed between 19 and 21""" <|body_0|> def communes_by_distance(self, latitude: float, longitude: float, radius: int...
stack_v2_sparse_classes_36k_train_019823
15,447
permissive
[ { "docstring": "Returns a list of the departments - with a slug - sorted by code - and so that the Corsican ones are listed between 19 and 21", "name": "departments", "signature": "def departments(self, values=None)" }, { "docstring": "Returns a queryset of the communes closest to the given coor...
2
null
Implement the Python class `PerimeterQuerySet` described below. Class description: Implement the PerimeterQuerySet class. Method signatures and docstrings: - def departments(self, values=None): Returns a list of the departments - with a slug - sorted by code - and so that the Corsican ones are listed between 19 and 2...
Implement the Python class `PerimeterQuerySet` described below. Class description: Implement the PerimeterQuerySet class. Method signatures and docstrings: - def departments(self, values=None): Returns a list of the departments - with a slug - sorted by code - and so that the Corsican ones are listed between 19 and 2...
af9f6e6e8b1918363793fbf291f3518ef1454169
<|skeleton|> class PerimeterQuerySet: def departments(self, values=None): """Returns a list of the departments - with a slug - sorted by code - and so that the Corsican ones are listed between 19 and 21""" <|body_0|> def communes_by_distance(self, latitude: float, longitude: float, radius: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerimeterQuerySet: def departments(self, values=None): """Returns a list of the departments - with a slug - sorted by code - and so that the Corsican ones are listed between 19 and 21""" departments = self.filter(scale=Perimeter.SCALES.department, is_obsolete=False) if values: ...
the_stack_v2_python_sparse
src/geofr/models.py
MTES-MCT/aides-territoires
train
21
2c86b556579afe108ae604eb05f390011194be7a
[ "res = []\n\ndef dfs(node):\n if not node:\n return\n res.append(str(node.val))\n res.append(str(len(node.children)))\n for child in node.children:\n dfs(child)\ndfs(root)\nreturn ','.join(res)", "if not data:\n return None\ndata = iter(data.split(','))\n\ndef dfs():\n root = Node(...
<|body_start_0|> res = [] def dfs(node): if not node: return res.append(str(node.val)) res.append(str(len(node.children))) for child in node.children: dfs(child) dfs(root) return ','.join(res) <|end_body_0|>...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_019824
1,186
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def des...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
238995bd23c8a6c40c6035890e94baa2473d4bbc
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" res = [] def dfs(node): if not node: return res.append(str(node.val)) res.append(str(len(node.children))) ...
the_stack_v2_python_sparse
problems/N428_Serialize_And_Deserialize_Nary_Tree.py
wan-catherine/Leetcode
train
5
afb49b7c2cee52340f47288b645fb7d1982d7190
[ "self.scanner_name = 'misc-package-updates'\nself.full_scanner_name = 'registry.centos.org/pipeline-images/misc-package-updates'\nself.scan_types = ['pip-updates', 'npm-updates', 'gem-updates']", "logs = []\nsuper(MiscPackageUpdates, self).__init__(image_under_test=image_under_test, scanner_name=self.scanner_name...
<|body_start_0|> self.scanner_name = 'misc-package-updates' self.full_scanner_name = 'registry.centos.org/pipeline-images/misc-package-updates' self.scan_types = ['pip-updates', 'npm-updates', 'gem-updates'] <|end_body_0|> <|body_start_1|> logs = [] super(MiscPackageUpdates, sel...
Checks updates for packages other than RPM.
MiscPackageUpdates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MiscPackageUpdates: """Checks updates for packages other than RPM.""" def __init__(self): """Name it to Misc Package update check.""" <|body_0|> def scan(self, image_under_test): """Run the scanner.""" <|body_1|> def process_output(self, logs): ...
stack_v2_sparse_classes_36k_train_019825
2,143
no_license
[ { "docstring": "Name it to Misc Package update check.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Run the scanner.", "name": "scan", "signature": "def scan(self, image_under_test)" }, { "docstring": "Genaralising output. Processing data for this sca...
3
stack_v2_sparse_classes_30k_train_005647
Implement the Python class `MiscPackageUpdates` described below. Class description: Checks updates for packages other than RPM. Method signatures and docstrings: - def __init__(self): Name it to Misc Package update check. - def scan(self, image_under_test): Run the scanner. - def process_output(self, logs): Genaralis...
Implement the Python class `MiscPackageUpdates` described below. Class description: Checks updates for packages other than RPM. Method signatures and docstrings: - def __init__(self): Name it to Misc Package update check. - def scan(self, image_under_test): Run the scanner. - def process_output(self, logs): Genaralis...
4b59184c3453ae706d5e352306fe9e551c90dc41
<|skeleton|> class MiscPackageUpdates: """Checks updates for packages other than RPM.""" def __init__(self): """Name it to Misc Package update check.""" <|body_0|> def scan(self, image_under_test): """Run the scanner.""" <|body_1|> def process_output(self, logs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MiscPackageUpdates: """Checks updates for packages other than RPM.""" def __init__(self): """Name it to Misc Package update check.""" self.scanner_name = 'misc-package-updates' self.full_scanner_name = 'registry.centos.org/pipeline-images/misc-package-updates' self.scan_ty...
the_stack_v2_python_sparse
container_pipeline/scanners/misc_package_updates.py
eupraxialabs/container-pipeline-service
train
0
202b6c8ea2cd12df4a1ed63eb25345dd2057e5bf
[ "if user_index >= self.num_users or following_index >= self.num_users:\n raise ValueError(f'Number of users is {self.num_users}, but indices {user_index} and {following_index} were requested.')\nif self.users_hat[following_index, user_index] == 0:\n self.users_hat[following_index, user_index] = 1\nelif self.i...
<|body_start_0|> if user_index >= self.num_users or following_index >= self.num_users: raise ValueError(f'Number of users is {self.num_users}, but indices {user_index} and {following_index} were requested.') if self.users_hat[following_index, user_index] == 0: self.users_hat[foll...
A mixin for classes with a :attr:`~trecs.models.recommender.BaseRecommender.users_hat` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`.
BinarySocialGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySocialGraph: """A mixin for classes with a :attr:`~trecs.models.recommender.BaseRecommender.users_hat` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`.""" def follow(self, user_index, following_index): ...
stack_v2_sparse_classes_36k_train_019826
5,088
permissive
[ { "docstring": "Method to follow another user -- that is, to create a unidirectional link from one user to the other. Parameters ---------- user_index: int Index of the user initiating the follow. following_index: int Index of the user to be followed. Raises ------ ValueError If either of the user indices does ...
4
stack_v2_sparse_classes_30k_train_018592
Implement the Python class `BinarySocialGraph` described below. Class description: A mixin for classes with a :attr:`~trecs.models.recommender.BaseRecommender.users_hat` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`. Method signatures and d...
Implement the Python class `BinarySocialGraph` described below. Class description: A mixin for classes with a :attr:`~trecs.models.recommender.BaseRecommender.users_hat` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`. Method signatures and d...
c4db28013f397ccad9eb5f5e530ca301599f36fb
<|skeleton|> class BinarySocialGraph: """A mixin for classes with a :attr:`~trecs.models.recommender.BaseRecommender.users_hat` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`.""" def follow(self, user_index, following_index): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinarySocialGraph: """A mixin for classes with a :attr:`~trecs.models.recommender.BaseRecommender.users_hat` attribute to gain the basic functionality of a binary social graph. It assumes a network adjacency matrix of size `|U|x|U|`.""" def follow(self, user_index, following_index): """Method to ...
the_stack_v2_python_sparse
trecs/components/socialgraph.py
amywinecoff/t-recs
train
1
8527586a0c72d15bee55a53df872f17394450f70
[ "self.valmin = valmin\nself.ax.set_xlim((self.valmin, self.valmax))\nif self.val < self.valmin:\n self.set_val(self.valmin)\nif self.valinit < self.valmin:\n self.valinit = (self.valmax - self.valmin) / 2.0 + self.valmin\n if self.vline in self.ax.lines:\n if hasattr(self.ax.lines, 'remove'):\n ...
<|body_start_0|> self.valmin = valmin self.ax.set_xlim((self.valmin, self.valmax)) if self.val < self.valmin: self.set_val(self.valmin) if self.valinit < self.valmin: self.valinit = (self.valmax - self.valmin) / 2.0 + self.valmin if self.vline in self....
ModifiableSlider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModifiableSlider: def set_valmin(self, valmin): """Change the minimum value of the slider""" <|body_0|> def set_valmax(self, valmax): """Change the maximum value of the slider""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.valmin = valmin ...
stack_v2_sparse_classes_36k_train_019827
16,045
permissive
[ { "docstring": "Change the minimum value of the slider", "name": "set_valmin", "signature": "def set_valmin(self, valmin)" }, { "docstring": "Change the maximum value of the slider", "name": "set_valmax", "signature": "def set_valmax(self, valmax)" } ]
2
stack_v2_sparse_classes_30k_train_012647
Implement the Python class `ModifiableSlider` described below. Class description: Implement the ModifiableSlider class. Method signatures and docstrings: - def set_valmin(self, valmin): Change the minimum value of the slider - def set_valmax(self, valmax): Change the maximum value of the slider
Implement the Python class `ModifiableSlider` described below. Class description: Implement the ModifiableSlider class. Method signatures and docstrings: - def set_valmin(self, valmin): Change the minimum value of the slider - def set_valmax(self, valmax): Change the maximum value of the slider <|skeleton|> class Mo...
262a94997bda663ed5b7501cb661fbf673c244b8
<|skeleton|> class ModifiableSlider: def set_valmin(self, valmin): """Change the minimum value of the slider""" <|body_0|> def set_valmax(self, valmax): """Change the maximum value of the slider""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModifiableSlider: def set_valmin(self, valmin): """Change the minimum value of the slider""" self.valmin = valmin self.ax.set_xlim((self.valmin, self.valmax)) if self.val < self.valmin: self.set_val(self.valmin) if self.valinit < self.valmin: sel...
the_stack_v2_python_sparse
pyspeckit/spectrum/widgets.py
pyspeckit/pyspeckit
train
93
62afc88518ee0d7271a1948bde5311cfa9b8d7c1
[ "eval_locals = copy(entry)\neval_locals.update({'has_field': lambda f: f in entry})\ntry:\n passed = evaluate_expression(condition, eval_locals)\n if passed:\n logger.debug('{} matched requirement {}', entry['title'], condition)\n return passed\nexcept UndefinedError as e:\n missing_field = e.arg...
<|body_start_0|> eval_locals = copy(entry) eval_locals.update({'has_field': lambda f: f in entry}) try: passed = evaluate_expression(condition, eval_locals) if passed: logger.debug('{} matched requirement {}', entry['title'], condition) return ...
Can run actions on entries that satisfy a given condition. Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries.
FilterIf
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterIf: """Can run actions on entries that satisfy a given condition. Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries.""" def check_condition(self, condition, entry): """Checks if a given `entry` passes `condition`""" ...
stack_v2_sparse_classes_36k_train_019828
3,906
permissive
[ { "docstring": "Checks if a given `entry` passes `condition`", "name": "check_condition", "signature": "def check_condition(self, condition, entry)" }, { "docstring": "Provides handlers for all phases.", "name": "__getattr__", "signature": "def __getattr__(self, item)" } ]
2
null
Implement the Python class `FilterIf` described below. Class description: Can run actions on entries that satisfy a given condition. Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries. Method signatures and docstrings: - def check_condition(self, condition, ent...
Implement the Python class `FilterIf` described below. Class description: Can run actions on entries that satisfy a given condition. Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries. Method signatures and docstrings: - def check_condition(self, condition, ent...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class FilterIf: """Can run actions on entries that satisfy a given condition. Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries.""" def check_condition(self, condition, entry): """Checks if a given `entry` passes `condition`""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterIf: """Can run actions on entries that satisfy a given condition. Actions include accept, reject, and fail, as well as the ability to run other filter plugins on the entries.""" def check_condition(self, condition, entry): """Checks if a given `entry` passes `condition`""" eval_loca...
the_stack_v2_python_sparse
flexget/plugins/filter/if_condition.py
BrutuZ/Flexget
train
1
37ddb5c29cfe7ef2cf185736c73014ce24e7c44f
[ "self._c0 = calibration_coefficients[0]\nself._c1 = calibration_coefficients[1]\nself._c00 = calibration_coefficients[2]\nself._c10 = calibration_coefficients[3]\nself._c01 = calibration_coefficients[4]\nself._c11 = calibration_coefficients[5]\nself._c20 = calibration_coefficients[6]\nself._c21 = calibration_coeffi...
<|body_start_0|> self._c0 = calibration_coefficients[0] self._c1 = calibration_coefficients[1] self._c00 = calibration_coefficients[2] self._c10 = calibration_coefficients[3] self._c01 = calibration_coefficients[4] self._c11 = calibration_coefficients[5] self._c20...
Takes raw data from a SPL06-007 pressure sensor and converts it to pressure data in Pa and temperature data in degC.
Calibrator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Calibrator: """Takes raw data from a SPL06-007 pressure sensor and converts it to pressure data in Pa and temperature data in degC.""" def __init__(self, calibration_coefficients, pressure_scaling_factor, temperature_scaling_factor): """Initializes self. Parameters ---------- calibra...
stack_v2_sparse_classes_36k_train_019829
29,696
permissive
[ { "docstring": "Initializes self. Parameters ---------- calibration_coefficients : iterable An iterable with the coefficients (c0, c1, c00, c10, c01, c11, c20, c21, c30) as defined in the data sheet. pressure_scaling_factor : int A scaling factor corresponding with the selected pressure oversampling. temperatur...
3
stack_v2_sparse_classes_30k_train_000781
Implement the Python class `Calibrator` described below. Class description: Takes raw data from a SPL06-007 pressure sensor and converts it to pressure data in Pa and temperature data in degC. Method signatures and docstrings: - def __init__(self, calibration_coefficients, pressure_scaling_factor, temperature_scaling...
Implement the Python class `Calibrator` described below. Class description: Takes raw data from a SPL06-007 pressure sensor and converts it to pressure data in Pa and temperature data in degC. Method signatures and docstrings: - def __init__(self, calibration_coefficients, pressure_scaling_factor, temperature_scaling...
8fda5d2bd9929650ea273b66980dac4596645e81
<|skeleton|> class Calibrator: """Takes raw data from a SPL06-007 pressure sensor and converts it to pressure data in Pa and temperature data in degC.""" def __init__(self, calibration_coefficients, pressure_scaling_factor, temperature_scaling_factor): """Initializes self. Parameters ---------- calibra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Calibrator: """Takes raw data from a SPL06-007 pressure sensor and converts it to pressure data in Pa and temperature data in degC.""" def __init__(self, calibration_coefficients, pressure_scaling_factor, temperature_scaling_factor): """Initializes self. Parameters ---------- calibration_coeffici...
the_stack_v2_python_sparse
spl06_007.py
tetrabiodistributed/project-tetra-display
train
4
372bd4be0e4161c83334626c90fd48a93adb2a07
[ "self.callbacks = callbacks\nif serializer is None:\n serializer = rpc_serializer.NoOpSerializer()\nself.serializer = serializer", "new_kwargs = dict()\nfor argname, arg in kwargs.iteritems():\n new_kwargs[argname] = self.serializer.deserialize_entity(context, arg)\nreturn new_kwargs", "print('XXXXXX')\np...
<|body_start_0|> self.callbacks = callbacks if serializer is None: serializer = rpc_serializer.NoOpSerializer() self.serializer = serializer <|end_body_0|> <|body_start_1|> new_kwargs = dict() for argname, arg in kwargs.iteritems(): new_kwargs[argname] = ...
Dispatch rpc messages according to the requested API version. This class can be used as the top level 'manager' for a service. It contains a list of underlying managers that have an API_VERSION attribute.
DirectRpcDispatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectRpcDispatcher: """Dispatch rpc messages according to the requested API version. This class can be used as the top level 'manager' for a service. It contains a list of underlying managers that have an API_VERSION attribute.""" def __init__(self, callbacks, serializer=None): """I...
stack_v2_sparse_classes_36k_train_019830
3,026
no_license
[ { "docstring": "Initialize the rpc dispatcher. :param callbacks: List of proxy objects that are an instance of a class with rpc methods exposed. Each proxy object should have an RPC_API_VERSION attribute. :param serializer: The Serializer object that will be used to deserialize arguments before the method call ...
3
stack_v2_sparse_classes_30k_train_014515
Implement the Python class `DirectRpcDispatcher` described below. Class description: Dispatch rpc messages according to the requested API version. This class can be used as the top level 'manager' for a service. It contains a list of underlying managers that have an API_VERSION attribute. Method signatures and docstr...
Implement the Python class `DirectRpcDispatcher` described below. Class description: Dispatch rpc messages according to the requested API version. This class can be used as the top level 'manager' for a service. It contains a list of underlying managers that have an API_VERSION attribute. Method signatures and docstr...
289d938227e48d77467bc357e1c72d47a63fc1a8
<|skeleton|> class DirectRpcDispatcher: """Dispatch rpc messages according to the requested API version. This class can be used as the top level 'manager' for a service. It contains a list of underlying managers that have an API_VERSION attribute.""" def __init__(self, callbacks, serializer=None): """I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirectRpcDispatcher: """Dispatch rpc messages according to the requested API version. This class can be used as the top level 'manager' for a service. It contains a list of underlying managers that have an API_VERSION attribute.""" def __init__(self, callbacks, serializer=None): """Initialize the...
the_stack_v2_python_sparse
ccbilling/billing/dispatcher.py
gaolichuang/cc_open_stack_addon
train
0
6f226064f895be5a5f4d529f3959ccaca29a056a
[ "rmg_path = os.path.normpath(os.path.join(get_path(), '..'))\nself.settings1 = QMSettings(software='mopac', method='pm3', fileStore=os.path.join(rmg_path, 'testing', 'qm', 'QMfiles'), scratchDirectory=None, onlyCyclics=False, maxRadicalNumber=0)\nself.settings2 = QMSettings()", "try:\n self.settings1.check_all...
<|body_start_0|> rmg_path = os.path.normpath(os.path.join(get_path(), '..')) self.settings1 = QMSettings(software='mopac', method='pm3', fileStore=os.path.join(rmg_path, 'testing', 'qm', 'QMfiles'), scratchDirectory=None, onlyCyclics=False, maxRadicalNumber=0) self.settings2 = QMSettings() <|end...
Contains unit tests for the QMSettings class.
TestQMSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestQMSettings: """Contains unit tests for the QMSettings class.""" def setUp(self): """A function run before each unit test in this class.""" <|body_0|> def test_check_all_set(self): """Test that check_all_set() works correctly.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_019831
14,056
permissive
[ { "docstring": "A function run before each unit test in this class.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that check_all_set() works correctly.", "name": "test_check_all_set", "signature": "def test_check_all_set(self)" } ]
2
stack_v2_sparse_classes_30k_train_005908
Implement the Python class `TestQMSettings` described below. Class description: Contains unit tests for the QMSettings class. Method signatures and docstrings: - def setUp(self): A function run before each unit test in this class. - def test_check_all_set(self): Test that check_all_set() works correctly.
Implement the Python class `TestQMSettings` described below. Class description: Contains unit tests for the QMSettings class. Method signatures and docstrings: - def setUp(self): A function run before each unit test in this class. - def test_check_all_set(self): Test that check_all_set() works correctly. <|skeleton|...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TestQMSettings: """Contains unit tests for the QMSettings class.""" def setUp(self): """A function run before each unit test in this class.""" <|body_0|> def test_check_all_set(self): """Test that check_all_set() works correctly.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestQMSettings: """Contains unit tests for the QMSettings class.""" def setUp(self): """A function run before each unit test in this class.""" rmg_path = os.path.normpath(os.path.join(get_path(), '..')) self.settings1 = QMSettings(software='mopac', method='pm3', fileStore=os.path....
the_stack_v2_python_sparse
rmgpy/qm/mainTest.py
CanePan-cc/CanePanWorkshop
train
2
3098c3bf41779b7d950672506123d02db989f66b
[ "ROW, COL = (len(grid), len(grid[0]))\nQ = sorted([(qv, qi) for qi, qv in enumerate(queries)], key=lambda x: x[0])\nres = [0] * len(Q)\npq = [(grid[0][0], 0, 0)]\nvisited = [[False] * COL for _ in range(ROW)]\nvisited[0][0] = True\ncount = 0\nfor qv, qi in Q:\n while pq and pq[0][0] < qv:\n _, curRow, cur...
<|body_start_0|> ROW, COL = (len(grid), len(grid[0])) Q = sorted([(qv, qi) for qi, qv in enumerate(queries)], key=lambda x: x[0]) res = [0] * len(Q) pq = [(grid[0][0], 0, 0)] visited = [[False] * COL for _ in range(ROW)] visited[0][0] = True count = 0 for ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]: """离线查询+堆 => 每次更新都看当前值最小的点,看是否能继续扩散(接雨水II)""" <|body_0|> def maxPoints2(self, grid: List[List[int]], queries: List[int]) -> List[int]: """离线查询+并查集""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_019832
4,992
no_license
[ { "docstring": "离线查询+堆 => 每次更新都看当前值最小的点,看是否能继续扩散(接雨水II)", "name": "maxPoints", "signature": "def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]" }, { "docstring": "离线查询+并查集", "name": "maxPoints2", "signature": "def maxPoints2(self, grid: List[List[int]], queries:...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]: 离线查询+堆 => 每次更新都看当前值最小的点,看是否能继续扩散(接雨水II) - def maxPoints2(self, grid: List[List[int]], queries: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]: 离线查询+堆 => 每次更新都看当前值最小的点,看是否能继续扩散(接雨水II) - def maxPoints2(self, grid: List[List[int]], queries: List[i...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]: """离线查询+堆 => 每次更新都看当前值最小的点,看是否能继续扩散(接雨水II)""" <|body_0|> def maxPoints2(self, grid: List[List[int]], queries: List[int]) -> List[int]: """离线查询+并查集""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxPoints(self, grid: List[List[int]], queries: List[int]) -> List[int]: """离线查询+堆 => 每次更新都看当前值最小的点,看是否能继续扩散(接雨水II)""" ROW, COL = (len(grid), len(grid[0])) Q = sorted([(qv, qi) for qi, qv in enumerate(queries)], key=lambda x: x[0]) res = [0] * len(Q) pq = ...
the_stack_v2_python_sparse
22_专题/离线查询/并查集/网格矩阵/6260. 矩阵查询可获得的最大分数-离线查询+堆或者并查集.py
981377660LMT/algorithm-study
train
225
bcd9673f18a4b3f6d64d22d2e79f671b76e661de
[ "super().__init__(coordinator)\nself.entity_description = sensor_description\ndevice_name = data.name.title()\nself._attr_name = f'{device_name} {sensor_description.name}'\nself._attr_unique_id = f'{unique_id}_{sensor_description.key}'\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, unique_id)}, name=dev...
<|body_start_0|> super().__init__(coordinator) self.entity_description = sensor_description device_name = data.name.title() self._attr_name = f'{device_name} {sensor_description.name}' self._attr_unique_id = f'{unique_id}_{sensor_description.key}' self._attr_device_info =...
Representation of a sensor entity for NUT status values.
NUTSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NUTSensor: """Representation of a sensor entity for NUT status values.""" def __init__(self, coordinator: DataUpdateCoordinator[dict[str, str]], sensor_description: SensorEntityDescription, data: PyNUTData, unique_id: str) -> None: """Initialize the sensor.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_019833
28,254
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: DataUpdateCoordinator[dict[str, str]], sensor_description: SensorEntityDescription, data: PyNUTData, unique_id: str) -> None" }, { "docstring": "Return entity state from ups.", "name": ...
2
stack_v2_sparse_classes_30k_train_016957
Implement the Python class `NUTSensor` described below. Class description: Representation of a sensor entity for NUT status values. Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[dict[str, str]], sensor_description: SensorEntityDescription, data: PyNUTData, unique_id: str) -...
Implement the Python class `NUTSensor` described below. Class description: Representation of a sensor entity for NUT status values. Method signatures and docstrings: - def __init__(self, coordinator: DataUpdateCoordinator[dict[str, str]], sensor_description: SensorEntityDescription, data: PyNUTData, unique_id: str) -...
bfa315be51371a1b63e04342a0b275a57ae148bd
<|skeleton|> class NUTSensor: """Representation of a sensor entity for NUT status values.""" def __init__(self, coordinator: DataUpdateCoordinator[dict[str, str]], sensor_description: SensorEntityDescription, data: PyNUTData, unique_id: str) -> None: """Initialize the sensor.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NUTSensor: """Representation of a sensor entity for NUT status values.""" def __init__(self, coordinator: DataUpdateCoordinator[dict[str, str]], sensor_description: SensorEntityDescription, data: PyNUTData, unique_id: str) -> None: """Initialize the sensor.""" super().__init__(coordinator...
the_stack_v2_python_sparse
homeassistant/components/nut/sensor.py
bdraco/home-assistant
train
13
f045da5bd573489fde2068648c396371ed07aef0
[ "myDeck = deck.Deck()\ncard1 = myDeck.deal_card()\ncard2 = myDeck.deal_card()\nmyPerson = person.Person(card1, card2)\nself.assertEqual(len(myPerson), 2)\nself.assertEqual(myPerson.get_total(), card1.get_value() + card2.get_value())", "myDeck = deck.Deck()\ncard1 = myDeck.deal_card()\ncard2 = myDeck.deal_card()\n...
<|body_start_0|> myDeck = deck.Deck() card1 = myDeck.deal_card() card2 = myDeck.deal_card() myPerson = person.Person(card1, card2) self.assertEqual(len(myPerson), 2) self.assertEqual(myPerson.get_total(), card1.get_value() + card2.get_value()) <|end_body_0|> <|body_start...
TestPerson
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPerson: def test_one(self): """Testing the constructor, the len, and the total""" <|body_0|> def test_two(self): """Testing the add card function""" <|body_1|> def test_three(self): """Testing the num_aces function""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_019834
1,998
no_license
[ { "docstring": "Testing the constructor, the len, and the total", "name": "test_one", "signature": "def test_one(self)" }, { "docstring": "Testing the add card function", "name": "test_two", "signature": "def test_two(self)" }, { "docstring": "Testing the num_aces function", ...
4
stack_v2_sparse_classes_30k_train_012592
Implement the Python class `TestPerson` described below. Class description: Implement the TestPerson class. Method signatures and docstrings: - def test_one(self): Testing the constructor, the len, and the total - def test_two(self): Testing the add card function - def test_three(self): Testing the num_aces function ...
Implement the Python class `TestPerson` described below. Class description: Implement the TestPerson class. Method signatures and docstrings: - def test_one(self): Testing the constructor, the len, and the total - def test_two(self): Testing the add card function - def test_three(self): Testing the num_aces function ...
86146cf124c21e4d74e1dac561321395e6555ecc
<|skeleton|> class TestPerson: def test_one(self): """Testing the constructor, the len, and the total""" <|body_0|> def test_two(self): """Testing the add card function""" <|body_1|> def test_three(self): """Testing the num_aces function""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPerson: def test_one(self): """Testing the constructor, the len, and the total""" myDeck = deck.Deck() card1 = myDeck.deal_card() card2 = myDeck.deal_card() myPerson = person.Person(card1, card2) self.assertEqual(len(myPerson), 2) self.assertEqual(my...
the_stack_v2_python_sparse
test_person.py
alexz12948/BlackJack
train
0
a9c3ba960690756f88d22e81291e4d283be26e16
[ "self.lr = lr\nself.num_params = num_params\nself.runner = [0 for _ in range(num_params)]", "new_params = []\nfor i in range(self.num_params):\n self.runner[i] = self.runner[i] + grad_params[i] ** 2\n new_params.append(params[i] - self.lr / (np.sqrt(self.runner[i]) + 1e-08) * grad_params[i])\nreturn new_par...
<|body_start_0|> self.lr = lr self.num_params = num_params self.runner = [0 for _ in range(num_params)] <|end_body_0|> <|body_start_1|> new_params = [] for i in range(self.num_params): self.runner[i] = self.runner[i] + grad_params[i] ** 2 new_params.appen...
Adagrad
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Adagrad: def __init__(self, num_params, lr=0.00146): """Initializer for Adagrad optimizer inputs: num params: number of parameters which are ought to be passed lr: The learning rate with which the gradient step should be taken(integer/float), default is 0.00146""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_019835
10,861
no_license
[ { "docstring": "Initializer for Adagrad optimizer inputs: num params: number of parameters which are ought to be passed lr: The learning rate with which the gradient step should be taken(integer/float), default is 0.00146", "name": "__init__", "signature": "def __init__(self, num_params, lr=0.00146)" ...
2
stack_v2_sparse_classes_30k_val_000885
Implement the Python class `Adagrad` described below. Class description: Implement the Adagrad class. Method signatures and docstrings: - def __init__(self, num_params, lr=0.00146): Initializer for Adagrad optimizer inputs: num params: number of parameters which are ought to be passed lr: The learning rate with which...
Implement the Python class `Adagrad` described below. Class description: Implement the Adagrad class. Method signatures and docstrings: - def __init__(self, num_params, lr=0.00146): Initializer for Adagrad optimizer inputs: num params: number of parameters which are ought to be passed lr: The learning rate with which...
9406b21aef9b2d94091d570e809f88a752277e30
<|skeleton|> class Adagrad: def __init__(self, num_params, lr=0.00146): """Initializer for Adagrad optimizer inputs: num params: number of parameters which are ought to be passed lr: The learning rate with which the gradient step should be taken(integer/float), default is 0.00146""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Adagrad: def __init__(self, num_params, lr=0.00146): """Initializer for Adagrad optimizer inputs: num params: number of parameters which are ought to be passed lr: The learning rate with which the gradient step should be taken(integer/float), default is 0.00146""" self.lr = lr self.num...
the_stack_v2_python_sparse
optimizers.py
viswambhar-yasa/AuToDiFf
train
0
b81029539ac0ebdd0109e8cf82af72bfcaeccf8c
[ "iap_util.AddIapIamResourceArgs(parser)\niap_util.AddAddIamPolicyBindingArgs(parser)\nbase.URI_FLAG.RemoveFromParser(parser)", "condition = iam_util.ValidateAndExtractConditionMutexRole(args)\niap_iam_ref = iap_util.ParseIapIamResource(self.ReleaseTrack(), args)\nreturn iap_iam_ref.AddIamPolicyBinding(args.member...
<|body_start_0|> iap_util.AddIapIamResourceArgs(parser) iap_util.AddAddIamPolicyBindingArgs(parser) base.URI_FLAG.RemoveFromParser(parser) <|end_body_0|> <|body_start_1|> condition = iam_util.ValidateAndExtractConditionMutexRole(args) iap_iam_ref = iap_util.ParseIapIamResource(s...
Add IAM policy binding to an IAP IAM resource. Adds a policy binding to the IAM policy of an IAP IAM resource. One binding consists of a member, a role, and an optional condition. See $ {parent_command} get-iam-policy for examples of how to specify an IAP IAM resource.
AddIamPolicyBinding
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddIamPolicyBinding: """Add IAM policy binding to an IAP IAM resource. Adds a policy binding to the IAM policy of an IAP IAM resource. One binding consists of a member, a role, and an optional condition. See $ {parent_command} get-iam-policy for examples of how to specify an IAP IAM resource.""" ...
stack_v2_sparse_classes_36k_train_019836
3,523
permissive
[ { "docstring": "Register flags for this command. Args: parser: An argparse.ArgumentParser-like object. It is mocked out in order to capture some information, but behaves like an ArgumentParser.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the...
2
null
Implement the Python class `AddIamPolicyBinding` described below. Class description: Add IAM policy binding to an IAP IAM resource. Adds a policy binding to the IAM policy of an IAP IAM resource. One binding consists of a member, a role, and an optional condition. See $ {parent_command} get-iam-policy for examples of ...
Implement the Python class `AddIamPolicyBinding` described below. Class description: Add IAM policy binding to an IAP IAM resource. Adds a policy binding to the IAM policy of an IAP IAM resource. One binding consists of a member, a role, and an optional condition. See $ {parent_command} get-iam-policy for examples of ...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class AddIamPolicyBinding: """Add IAM policy binding to an IAP IAM resource. Adds a policy binding to the IAM policy of an IAP IAM resource. One binding consists of a member, a role, and an optional condition. See $ {parent_command} get-iam-policy for examples of how to specify an IAP IAM resource.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddIamPolicyBinding: """Add IAM policy binding to an IAP IAM resource. Adds a policy binding to the IAM policy of an IAP IAM resource. One binding consists of a member, a role, and an optional condition. See $ {parent_command} get-iam-policy for examples of how to specify an IAP IAM resource.""" def Args...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/iap/web/add_iam_policy_binding.py
bopopescu/socialliteapp
train
0
deb05ec793a2c4a0967862f916fed512abe816ae
[ "ne = self.maxCommonLength(str2)\nn, m = (len(str1), len(str2))\ni, j = (0, 0)\nwhile i < n and j < m:\n if j == -1 or str1[i] == str2[j]:\n i += 1\n j += 1\n else:\n j = ne[j]\nif j == m:\n return i - j\nelse:\n return None", "l = len(str)\nidx = list()\ni, j = (1, 0)\nm = 0\nidx...
<|body_start_0|> ne = self.maxCommonLength(str2) n, m = (len(str1), len(str2)) i, j = (0, 0) while i < n and j < m: if j == -1 or str1[i] == str2[j]: i += 1 j += 1 else: j = ne[j] if j == m: retur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, str1, str2): """这是求最长公共子串 :param str: :return: rstr""" <|body_0|> def maxCommonLength(self, str): """返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:""" <|body_1|> def longestPalindrome2(self, s): ...
stack_v2_sparse_classes_36k_train_019837
1,606
no_license
[ { "docstring": "这是求最长公共子串 :param str: :return: rstr", "name": "longestPalindrome", "signature": "def longestPalindrome(self, str1, str2)" }, { "docstring": "返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:", "name": "maxCommonLength", "signature": "def maxCommonLength(self, ...
3
stack_v2_sparse_classes_30k_train_011065
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, str1, str2): 这是求最长公共子串 :param str: :return: rstr - def maxCommonLength(self, str): 返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return: - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, str1, str2): 这是求最长公共子串 :param str: :return: rstr - def maxCommonLength(self, str): 返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return: - def...
cd746c37e0a44dc80c5c5177450769908a38fee5
<|skeleton|> class Solution: def longestPalindrome(self, str1, str2): """这是求最长公共子串 :param str: :return: rstr""" <|body_0|> def maxCommonLength(self, str): """返回一个数组,数组包括每段字符串的最大前缀公共串的长度m 没有m时就置变量为-1 :param str: :return:""" <|body_1|> def longestPalindrome2(self, s): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, str1, str2): """这是求最长公共子串 :param str: :return: rstr""" ne = self.maxCommonLength(str2) n, m = (len(str1), len(str2)) i, j = (0, 0) while i < n and j < m: if j == -1 or str1[i] == str2[j]: i += 1 ...
the_stack_v2_python_sparse
leetcode/LongestPalindrome.py
Sparkoor/learning
train
0
b3218b1f63512719bf13a8f67966abd43290d8ef
[ "if model._meta.app_label in self.route_app_labels:\n return self.using\nreturn None", "if model._meta.app_label in self.route_app_labels:\n return self.using\nreturn None", "if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:\n return True\nreturn None", ...
<|body_start_0|> if model._meta.app_label in self.route_app_labels: return self.using return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.route_app_labels: return self.using return None <|end_body_1|> <|body_start_2|> if obj1._me...
A router to control all database operations on models in the auth application.
UserRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_36k_train_019838
3,768
no_license
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
null
Implement the Python class `UserRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): At...
Implement the Python class `UserRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): At...
23d31fbeddcd303a7dc90ac9cfbe2c762d61c61e
<|skeleton|> class UserRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if model._meta.app_label in self.route_app_labels: return self.using return None ...
the_stack_v2_python_sparse
ultratech_fare/settings/routers.py
KONASANI-0143/Dev
train
0
cb75e8f343370ef052790f90866f439072ce71a7
[ "q1 = Path([P(0, 0), P(50, 50), P(100, 0), P(0, 0)])\nq2 = Path([P(0, 0), P(-50, -50), P(-100, 0), P(0, 0)])\na = xsarea(q1, X(), q2, X())\nself.assertAlmostEqual(a, 0)", "q1 = quadrato(P(0, 0), 100)\na = xsarea(q1, X(), q1, xlate(P(50, 50)))\nself.assertAlmostEqual(a, 2500)", "q1 = quadrato(P(0, 0), 100)\nq2 =...
<|body_start_0|> q1 = Path([P(0, 0), P(50, 50), P(100, 0), P(0, 0)]) q2 = Path([P(0, 0), P(-50, -50), P(-100, 0), P(0, 0)]) a = xsarea(q1, X(), q2, X()) self.assertAlmostEqual(a, 0) <|end_body_0|> <|body_start_1|> q1 = quadrato(P(0, 0), 100) a = xsarea(q1, X(), q1, xlate...
TestXSArea
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestXSArea: def testAreeNonConnesse(self): """Due path si intersecano solo in un punto""" <|body_0|> def testQuadratoSovrapposto(self): """Quadrato di area 10000 sovrapposto a se stesso per 1/4.""" <|body_1|> def testQuadratiSovrapposti(self): ""...
stack_v2_sparse_classes_36k_train_019839
1,739
no_license
[ { "docstring": "Due path si intersecano solo in un punto", "name": "testAreeNonConnesse", "signature": "def testAreeNonConnesse(self)" }, { "docstring": "Quadrato di area 10000 sovrapposto a se stesso per 1/4.", "name": "testQuadratoSovrapposto", "signature": "def testQuadratoSovrapposto...
5
null
Implement the Python class `TestXSArea` described below. Class description: Implement the TestXSArea class. Method signatures and docstrings: - def testAreeNonConnesse(self): Due path si intersecano solo in un punto - def testQuadratoSovrapposto(self): Quadrato di area 10000 sovrapposto a se stesso per 1/4. - def tes...
Implement the Python class `TestXSArea` described below. Class description: Implement the TestXSArea class. Method signatures and docstrings: - def testAreeNonConnesse(self): Due path si intersecano solo in un punto - def testQuadratoSovrapposto(self): Quadrato di area 10000 sovrapposto a se stesso per 1/4. - def tes...
11d5f06c9e79cc45a0e849fdfedf73004133e792
<|skeleton|> class TestXSArea: def testAreeNonConnesse(self): """Due path si intersecano solo in un punto""" <|body_0|> def testQuadratoSovrapposto(self): """Quadrato di area 10000 sovrapposto a se stesso per 1/4.""" <|body_1|> def testQuadratiSovrapposti(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestXSArea: def testAreeNonConnesse(self): """Due path si intersecano solo in un punto""" q1 = Path([P(0, 0), P(50, 50), P(100, 0), P(0, 0)]) q2 = Path([P(0, 0), P(-50, -50), P(-100, 0), P(0, 0)]) a = xsarea(q1, X(), q2, X()) self.assertAlmostEqual(a, 0) def testQu...
the_stack_v2_python_sparse
src/geo2d/test_xsarea.py
rbianchi66/pyqt_md
train
0
b558a76131e8bcbc35b033bb3809cea087f2641b
[ "if model._meta.app_label == 'orion_flash':\n return 'orion_aux_db'\nreturn None", "if model._meta.app_label == 'orion_flash':\n return 'orion_aux_db'\nreturn None", "if obj1._state.db == 'orion_aux_db' and obj2._state.db == 'orion_aux_db':\n return True\nreturn None", "if app_label == 'orion_flash':...
<|body_start_0|> if model._meta.app_label == 'orion_flash': return 'orion_aux_db' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == 'orion_flash': return 'orion_aux_db' return None <|end_body_1|> <|body_start_2|> if obj1._state.db =...
database router class for the orion auxiliary database
OrionAuxRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrionAuxRouter: """database router class for the orion auxiliary database""" def db_for_read(self, model, **hints): """all models in orion_flash will read from the orion auxiliary database""" <|body_0|> def db_for_write(self, model, **hints): """all models in ori...
stack_v2_sparse_classes_36k_train_019840
1,525
no_license
[ { "docstring": "all models in orion_flash will read from the orion auxiliary database", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "all models in orion_flash will write to the orion auxiliary database", "name": "db_for_write", "signature...
4
stack_v2_sparse_classes_30k_train_001667
Implement the Python class `OrionAuxRouter` described below. Class description: database router class for the orion auxiliary database Method signatures and docstrings: - def db_for_read(self, model, **hints): all models in orion_flash will read from the orion auxiliary database - def db_for_write(self, model, **hint...
Implement the Python class `OrionAuxRouter` described below. Class description: database router class for the orion auxiliary database Method signatures and docstrings: - def db_for_read(self, model, **hints): all models in orion_flash will read from the orion auxiliary database - def db_for_write(self, model, **hint...
08bf0cc90e4d63a84fcd4e35bf5d196430c43319
<|skeleton|> class OrionAuxRouter: """database router class for the orion auxiliary database""" def db_for_read(self, model, **hints): """all models in orion_flash will read from the orion auxiliary database""" <|body_0|> def db_for_write(self, model, **hints): """all models in ori...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrionAuxRouter: """database router class for the orion auxiliary database""" def db_for_read(self, model, **hints): """all models in orion_flash will read from the orion auxiliary database""" if model._meta.app_label == 'orion_flash': return 'orion_aux_db' return None ...
the_stack_v2_python_sparse
orion_flash/router.py
PHSAServiceOperationsCenter/PHSA-SOC
train
0
5356c0ee44f62f2c08ff4ff75157e085f853766c
[ "super(Application, self).__init__(master)\nself.grid()\nself.create_widgets()", "self.inst_lbl = Label(self, text='Enter password for the secret of longevity')\nself.pw_lbl = Label(self, text='Password: ')\nself.pw_lbl.grid(row=1, column=0, sticky=W)\nself.pw_ent = Entry(self)\nself.pw_ent.grid(row=1, column=1, ...
<|body_start_0|> super(Application, self).__init__(master) self.grid() self.create_widgets() <|end_body_0|> <|body_start_1|> self.inst_lbl = Label(self, text='Enter password for the secret of longevity') self.pw_lbl = Label(self, text='Password: ') self.pw_lbl.grid(row=1...
GUI application which can reveal the secret of longevity.
Application
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """GUI application which can reveal the secret of longevity.""" def __init__(self, master): """Initialize the frame.""" <|body_0|> def create_widgets(self): """Create button, text, and entry widgets.""" <|body_1|> def reveal(self): ...
stack_v2_sparse_classes_36k_train_019841
1,917
no_license
[ { "docstring": "Initialize the frame.", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Create button, text, and entry widgets.", "name": "create_widgets", "signature": "def create_widgets(self)" }, { "docstring": "Display message based on passwor...
3
stack_v2_sparse_classes_30k_train_013504
Implement the Python class `Application` described below. Class description: GUI application which can reveal the secret of longevity. Method signatures and docstrings: - def __init__(self, master): Initialize the frame. - def create_widgets(self): Create button, text, and entry widgets. - def reveal(self): Display m...
Implement the Python class `Application` described below. Class description: GUI application which can reveal the secret of longevity. Method signatures and docstrings: - def __init__(self, master): Initialize the frame. - def create_widgets(self): Create button, text, and entry widgets. - def reveal(self): Display m...
e1947161426cf53eba96debc641f058ee8cf47e3
<|skeleton|> class Application: """GUI application which can reveal the secret of longevity.""" def __init__(self, master): """Initialize the frame.""" <|body_0|> def create_widgets(self): """Create button, text, and entry widgets.""" <|body_1|> def reveal(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Application: """GUI application which can reveal the secret of longevity.""" def __init__(self, master): """Initialize the frame.""" super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): """Create button, text, a...
the_stack_v2_python_sparse
Python_Programming_for_the_Absolute_Beginner/10_logevity.py
wzlwit/python
train
0
d8e24afe50a6eb2d72ce119617733112ecade97e
[ "self._start = to_datetime(start)\nself._end = to_datetime_rel(end, self._start)\ndt = to_fraction(timestep)\nself._timestep = dt\nn = int(to_fraction(self._end - self._start) / self._timestep) + 1\nTimeContainer.__init__(self, [self._start + to_timedelta(i * dt) for i in range(n)], init=init)\nself.start = self._s...
<|body_start_0|> self._start = to_datetime(start) self._end = to_datetime_rel(end, self._start) dt = to_fraction(timestep) self._timestep = dt n = int(to_fraction(self._end - self._start) / self._timestep) + 1 TimeContainer.__init__(self, [self._start + to_timedelta(i * d...
!A time-indexed array that can only handle equally spaced times. This implements an array-like object that uses time as an index. It recognizes only discrete times as specified by a start, an end and a timestep. The end is only used as a guideline: if it does not lie exactly on a timestep, the next timestep end is used...
TimeArray
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeArray: """!A time-indexed array that can only handle equally spaced times. This implements an array-like object that uses time as an index. It recognizes only discrete times as specified by a start, an end and a timestep. The end is only used as a guideline: if it does not lie exactly on a ti...
stack_v2_sparse_classes_36k_train_019842
33,464
permissive
[ { "docstring": "!TimeArray constructor. @param start,end,timestep Specifies the equally-spaced times. @param init The initializer for data values. This is typically a constructor (dict, list, etc.) or a function that calls a constructor.", "name": "__init__", "signature": "def __init__(self, start, end,...
2
null
Implement the Python class `TimeArray` described below. Class description: !A time-indexed array that can only handle equally spaced times. This implements an array-like object that uses time as an index. It recognizes only discrete times as specified by a start, an end and a timestep. The end is only used as a guidel...
Implement the Python class `TimeArray` described below. Class description: !A time-indexed array that can only handle equally spaced times. This implements an array-like object that uses time as an index. It recognizes only discrete times as specified by a start, an end and a timestep. The end is only used as a guidel...
a666ac3b58d19f04249f76c9340f2e4a4a27939b
<|skeleton|> class TimeArray: """!A time-indexed array that can only handle equally spaced times. This implements an array-like object that uses time as an index. It recognizes only discrete times as specified by a start, an end and a timestep. The end is only used as a guideline: if it does not lie exactly on a ti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeArray: """!A time-indexed array that can only handle equally spaced times. This implements an array-like object that uses time as an index. It recognizes only discrete times as specified by a start, an end and a timestep. The end is only used as a guideline: if it does not lie exactly on a timestep, the n...
the_stack_v2_python_sparse
produtil/numerics.py
dtcenter/METplus
train
41
a4e2e7ef5c28a9d9fed11a70909fa91c9dfed64a
[ "super(ObservationGroupEncoder, self).__init__()\nassert isinstance(observation_group_shapes, OrderedDict)\nassert np.all([isinstance(observation_group_shapes[k], OrderedDict) for k in observation_group_shapes])\nself.observation_group_shapes = observation_group_shapes\nself.nets = nn.ModuleDict()\nfor obs_group in...
<|body_start_0|> super(ObservationGroupEncoder, self).__init__() assert isinstance(observation_group_shapes, OrderedDict) assert np.all([isinstance(observation_group_shapes[k], OrderedDict) for k in observation_group_shapes]) self.observation_group_shapes = observation_group_shapes ...
This class allows networks to encode multiple observation dictionaries into a single flat, concatenated vector representation. It does this by assigning each observation dictionary (observation group) an @ObservationEncoder object. The class takes a dictionary of dictionaries, @observation_group_shapes. Each key corres...
ObservationGroupEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservationGroupEncoder: """This class allows networks to encode multiple observation dictionaries into a single flat, concatenated vector representation. It does this by assigning each observation dictionary (observation group) an @ObservationEncoder object. The class takes a dictionary of dicti...
stack_v2_sparse_classes_36k_train_019843
37,945
permissive
[ { "docstring": "Args: observation_group_shapes (OrderedDict): a dictionary of dictionaries. Each key in this dictionary should specify an observation group, and the value should be an OrderedDict that maps modalities to expected shapes. visual_feature_dimension (int): feature dimension to encode images into vis...
4
stack_v2_sparse_classes_30k_train_019871
Implement the Python class `ObservationGroupEncoder` described below. Class description: This class allows networks to encode multiple observation dictionaries into a single flat, concatenated vector representation. It does this by assigning each observation dictionary (observation group) an @ObservationEncoder object...
Implement the Python class `ObservationGroupEncoder` described below. Class description: This class allows networks to encode multiple observation dictionaries into a single flat, concatenated vector representation. It does this by assigning each observation dictionary (observation group) an @ObservationEncoder object...
2804dd97dd1625ec861298a35cb677129d3bfacc
<|skeleton|> class ObservationGroupEncoder: """This class allows networks to encode multiple observation dictionaries into a single flat, concatenated vector representation. It does this by assigning each observation dictionary (observation group) an @ObservationEncoder object. The class takes a dictionary of dicti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObservationGroupEncoder: """This class allows networks to encode multiple observation dictionaries into a single flat, concatenated vector representation. It does this by assigning each observation dictionary (observation group) an @ObservationEncoder object. The class takes a dictionary of dictionaries, @obs...
the_stack_v2_python_sparse
robomimic/models/obs_nets.py
sohams-MASS/robomimic
train
0
5270ca0a778c4850095a8808f8d62875333fae87
[ "if len(key) not in key_size:\n raise ValueError('Incorrect key length for Salsa20 (%d bytes)' % len(key))\nif len(nonce) != 8:\n raise ValueError('Incorrect nonce length for Salsa20 (%d bytes)' % len(nonce))\nself.nonce = _copy_bytes(None, None, nonce)\nself._state = VoidPointer()\nresult = _raw_salsa20_lib....
<|body_start_0|> if len(key) not in key_size: raise ValueError('Incorrect key length for Salsa20 (%d bytes)' % len(key)) if len(nonce) != 8: raise ValueError('Incorrect nonce length for Salsa20 (%d bytes)' % len(nonce)) self.nonce = _copy_bytes(None, None, nonce) ...
Salsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string
Salsa20Cipher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Salsa20Cipher: """Salsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string""" def __init__(self, key, nonce): """Initialize a Salsa20 cipher object See also `new()` at the module level.""" <|...
stack_v2_sparse_classes_36k_train_019844
6,349
permissive
[ { "docstring": "Initialize a Salsa20 cipher object See also `new()` at the module level.", "name": "__init__", "signature": "def __init__(self, key, nonce)" }, { "docstring": "Encrypt a piece of data. Args: plaintext(bytes/bytearray/memoryview): The data to encrypt, of any size. Keyword Args: ou...
3
stack_v2_sparse_classes_30k_train_017787
Implement the Python class `Salsa20Cipher` described below. Class description: Salsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string Method signatures and docstrings: - def __init__(self, key, nonce): Initialize a Salsa20 cipher o...
Implement the Python class `Salsa20Cipher` described below. Class description: Salsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string Method signatures and docstrings: - def __init__(self, key, nonce): Initialize a Salsa20 cipher o...
fa82044a2dc2f0f1f7454f5394e6d68fa923c289
<|skeleton|> class Salsa20Cipher: """Salsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string""" def __init__(self, key, nonce): """Initialize a Salsa20 cipher object See also `new()` at the module level.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Salsa20Cipher: """Salsa20 cipher object. Do not create it directly. Use :py:func:`new` instead. :var nonce: The nonce with length 8 :vartype nonce: byte string""" def __init__(self, key, nonce): """Initialize a Salsa20 cipher object See also `new()` at the module level.""" if len(key) not...
the_stack_v2_python_sparse
venv/lib/python3.6/site-packages/Crypto/Cipher/Salsa20.py
masora1030/eigoyurusan
train
11
776db6c7e325fdb6c294486324a384ed712f7ea5
[ "x = self.e(i)\neps = 0\nwhile x is not None:\n x = x.e(i)\n eps = eps + 1\nreturn eps", "P = self[-1].parent().weight_lattice_realization()\nh = P.simple_coroots()\nomega = P(self.weight()).scalar(h[i])\nreturn self.epsilon(i) + omega", "N = len(self) + 1\npos = None\nfor k in range(1, N):\n if all((s...
<|body_start_0|> x = self.e(i) eps = 0 while x is not None: x = x.e(i) eps = eps + 1 return eps <|end_body_0|> <|body_start_1|> P = self[-1].parent().weight_lattice_realization() h = P.simple_coroots() omega = P(self.weight()).scalar(h[i])...
An element in the polyhedral realization of `B(\\infty)`.
Element
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Element: """An element in the polyhedral realization of `B(\\infty)`.""" def epsilon(self, i): """Return `\\varepsilon_i` of ``self``. EXAMPLES:: sage: B = crystals.infinity.PolyhedralRealization(['A',2,1]) sage: mg = B.module_generators[0] sage: [mg.epsilon(i) for i in B.index_set()...
stack_v2_sparse_classes_36k_train_019845
13,619
no_license
[ { "docstring": "Return `\\\\varepsilon_i` of ``self``. EXAMPLES:: sage: B = crystals.infinity.PolyhedralRealization(['A',2,1]) sage: mg = B.module_generators[0] sage: [mg.epsilon(i) for i in B.index_set()] [0, 0, 0] sage: elt = mg.f(0) sage: [elt.epsilon(i) for i in B.index_set()] [1, 0, 0] sage: elt = mg.f_str...
5
stack_v2_sparse_classes_30k_train_003560
Implement the Python class `Element` described below. Class description: An element in the polyhedral realization of `B(\\infty)`. Method signatures and docstrings: - def epsilon(self, i): Return `\\varepsilon_i` of ``self``. EXAMPLES:: sage: B = crystals.infinity.PolyhedralRealization(['A',2,1]) sage: mg = B.module_...
Implement the Python class `Element` described below. Class description: An element in the polyhedral realization of `B(\\infty)`. Method signatures and docstrings: - def epsilon(self, i): Return `\\varepsilon_i` of ``self``. EXAMPLES:: sage: B = crystals.infinity.PolyhedralRealization(['A',2,1]) sage: mg = B.module_...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class Element: """An element in the polyhedral realization of `B(\\infty)`.""" def epsilon(self, i): """Return `\\varepsilon_i` of ``self``. EXAMPLES:: sage: B = crystals.infinity.PolyhedralRealization(['A',2,1]) sage: mg = B.module_generators[0] sage: [mg.epsilon(i) for i in B.index_set()...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Element: """An element in the polyhedral realization of `B(\\infty)`.""" def epsilon(self, i): """Return `\\varepsilon_i` of ``self``. EXAMPLES:: sage: B = crystals.infinity.PolyhedralRealization(['A',2,1]) sage: mg = B.module_generators[0] sage: [mg.epsilon(i) for i in B.index_set()] [0, 0, 0] s...
the_stack_v2_python_sparse
sage/src/sage/combinat/crystals/polyhedral_realization.py
bopopescu/geosci
train
0
7b229e3fc17e32282f18286bada6cf5488c88977
[ "deck = models.Deck.objects.get(id=deck_id, author=user_id)\nalgorithm = algorithms.algorithm_engine(deck)\nnext_card = algorithm.next_card_to_review()\nreturn next_card", "deck = models.Deck.objects.get(id=deck_id, author=user_id)\ncard = models.Card.objects.get(id=card_id, deck=deck_id)\nalgorithm = algorithms....
<|body_start_0|> deck = models.Deck.objects.get(id=deck_id, author=user_id) algorithm = algorithms.algorithm_engine(deck) next_card = algorithm.next_card_to_review() return next_card <|end_body_0|> <|body_start_1|> deck = models.Deck.objects.get(id=deck_id, author=user_id) ...
Mixin for study related functions. Bridges the gap bewteen the API and the Database.
StudyOps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudyOps: """Mixin for study related functions. Bridges the gap bewteen the API and the Database.""" def get_next_card(self, user_id: str, deck_id: str) -> 'Card': """Gives the next card in the deck to be studied. FIXME will break if deck does not belong to user, but the exception is...
stack_v2_sparse_classes_36k_train_019846
1,794
no_license
[ { "docstring": "Gives the next card in the deck to be studied. FIXME will break if deck does not belong to user, but the exception is not well managed. :param deck_id: Deck to take the card from :param user_id: deck owner, for validation :returns: a database Card object.", "name": "get_next_card", "sign...
2
stack_v2_sparse_classes_30k_train_015408
Implement the Python class `StudyOps` described below. Class description: Mixin for study related functions. Bridges the gap bewteen the API and the Database. Method signatures and docstrings: - def get_next_card(self, user_id: str, deck_id: str) -> 'Card': Gives the next card in the deck to be studied. FIXME will br...
Implement the Python class `StudyOps` described below. Class description: Mixin for study related functions. Bridges the gap bewteen the API and the Database. Method signatures and docstrings: - def get_next_card(self, user_id: str, deck_id: str) -> 'Card': Gives the next card in the deck to be studied. FIXME will br...
212c7047f3ea2cc19eb490c14be9e51907943e51
<|skeleton|> class StudyOps: """Mixin for study related functions. Bridges the gap bewteen the API and the Database.""" def get_next_card(self, user_id: str, deck_id: str) -> 'Card': """Gives the next card in the deck to be studied. FIXME will break if deck does not belong to user, but the exception is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudyOps: """Mixin for study related functions. Bridges the gap bewteen the API and the Database.""" def get_next_card(self, user_id: str, deck_id: str) -> 'Card': """Gives the next card in the deck to be studied. FIXME will break if deck does not belong to user, but the exception is not well man...
the_stack_v2_python_sparse
backend/ebisu_flashcards/operations/study.py
ZanSara/ebisu-flashcards
train
4
c6013f131a6b3e35cb594c75e7cd391dcc7d983f
[ "user = self.get_user(request, username)\nprofile, _ = Profile.objects.get_or_create(user=user)\nform = AvatarForm(data=request.POST)\ntimezones = ['[']\nfor val, text in TIMEZONES:\n timezones.append('{value: \"' + val + '\", text: \"' + text + '\"},')\ntimezones.append(']')\nreturn render(request, 'profile.htm...
<|body_start_0|> user = self.get_user(request, username) profile, _ = Profile.objects.get_or_create(user=user) form = AvatarForm(data=request.POST) timezones = ['['] for val, text in TIMEZONES: timezones.append('{value: "' + val + '", text: "' + text + '"},') ...
ProfileView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProfileView: def get(self, request, username): """User profile.""" <|body_0|> def post(self, request, username=None): """Update user callback.""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = self.get_user(request, username) profile, _...
stack_v2_sparse_classes_36k_train_019847
30,576
permissive
[ { "docstring": "User profile.", "name": "get", "signature": "def get(self, request, username)" }, { "docstring": "Update user callback.", "name": "post", "signature": "def post(self, request, username=None)" } ]
2
stack_v2_sparse_classes_30k_val_000616
Implement the Python class `ProfileView` described below. Class description: Implement the ProfileView class. Method signatures and docstrings: - def get(self, request, username): User profile. - def post(self, request, username=None): Update user callback.
Implement the Python class `ProfileView` described below. Class description: Implement the ProfileView class. Method signatures and docstrings: - def get(self, request, username): User profile. - def post(self, request, username=None): Update user callback. <|skeleton|> class ProfileView: def get(self, request,...
51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0
<|skeleton|> class ProfileView: def get(self, request, username): """User profile.""" <|body_0|> def post(self, request, username=None): """Update user callback.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProfileView: def get(self, request, username): """User profile.""" user = self.get_user(request, username) profile, _ = Profile.objects.get_or_create(user=user) form = AvatarForm(data=request.POST) timezones = ['['] for val, text in TIMEZONES: timezo...
the_stack_v2_python_sparse
tool/views/views.py
mikekeda/tools
train
0
3ff993c6982a3c4f7712f863c9235179958992fe
[ "self.locations = []\nself.facilities = []\nself.flow_mat = []\nself.distance_mat = []\nself.no_facilities = 0\nself.solution = None", "self.solution = Solution(self.locations, self.facilities)\nself.solution.generate_permutation(len(self.locations))\nself.solution.calculate_cost()\nreturn self.solution", "try:...
<|body_start_0|> self.locations = [] self.facilities = [] self.flow_mat = [] self.distance_mat = [] self.no_facilities = 0 self.solution = None <|end_body_0|> <|body_start_1|> self.solution = Solution(self.locations, self.facilities) self.solution.generat...
QAP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QAP: def __init__(self): """inicialización de propiedades""" <|body_0|> def random_solution(self): """generamos una solución aleatoria para comenzar""" <|body_1|> def read_data(self, filename=''): """read_data lee del archivo de pruebas el número...
stack_v2_sparse_classes_36k_train_019848
2,979
no_license
[ { "docstring": "inicialización de propiedades", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "generamos una solución aleatoria para comenzar", "name": "random_solution", "signature": "def random_solution(self)" }, { "docstring": "read_data lee del archi...
3
stack_v2_sparse_classes_30k_test_001175
Implement the Python class `QAP` described below. Class description: Implement the QAP class. Method signatures and docstrings: - def __init__(self): inicialización de propiedades - def random_solution(self): generamos una solución aleatoria para comenzar - def read_data(self, filename=''): read_data lee del archivo ...
Implement the Python class `QAP` described below. Class description: Implement the QAP class. Method signatures and docstrings: - def __init__(self): inicialización de propiedades - def random_solution(self): generamos una solución aleatoria para comenzar - def read_data(self, filename=''): read_data lee del archivo ...
6c100e2fb05f2278ef8b4153c9d3eeac9b19681c
<|skeleton|> class QAP: def __init__(self): """inicialización de propiedades""" <|body_0|> def random_solution(self): """generamos una solución aleatoria para comenzar""" <|body_1|> def read_data(self, filename=''): """read_data lee del archivo de pruebas el número...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QAP: def __init__(self): """inicialización de propiedades""" self.locations = [] self.facilities = [] self.flow_mat = [] self.distance_mat = [] self.no_facilities = 0 self.solution = None def random_solution(self): """generamos una solución ...
the_stack_v2_python_sparse
QAP/Classes/QAP.py
JoseGzz/Research-ITESM
train
1
f85298f82023d6dfe91713fbad57ea8df6060061
[ "try:\n return Person.objects.get(pk=user_id)\nexcept Person.DoesNotExist:\n return None", "if phone:\n username = phone\nif not username or not password:\n return None\ntry:\n user = Person.objects.get(Q(pk=parse_int(username)) | Q(code=username) | Q(email=username) | Q(phone=username), status=Sta...
<|body_start_0|> try: return Person.objects.get(pk=user_id) except Person.DoesNotExist: return None <|end_body_0|> <|body_start_1|> if phone: username = phone if not username or not password: return None try: user = Per...
Custom User Authenticator class. This class logs in using any of pk, code, email and username of an active user Arguments: object Returns: Authenticator class
BoilerAuthenticator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoilerAuthenticator: """Custom User Authenticator class. This class logs in using any of pk, code, email and username of an active user Arguments: object Returns: Authenticator class""" def get_user(self, user_id): """this function is for getting a single user by pk Arguments: user_i...
stack_v2_sparse_classes_36k_train_019849
1,961
no_license
[ { "docstring": "this function is for getting a single user by pk Arguments: user_id {integer} Returns: User object", "name": "get_user", "signature": "def get_user(self, user_id)" }, { "docstring": "this function is basically used when anyone tries to login Arguments: username {string or integer...
2
stack_v2_sparse_classes_30k_train_006996
Implement the Python class `BoilerAuthenticator` described below. Class description: Custom User Authenticator class. This class logs in using any of pk, code, email and username of an active user Arguments: object Returns: Authenticator class Method signatures and docstrings: - def get_user(self, user_id): this func...
Implement the Python class `BoilerAuthenticator` described below. Class description: Custom User Authenticator class. This class logs in using any of pk, code, email and username of an active user Arguments: object Returns: Authenticator class Method signatures and docstrings: - def get_user(self, user_id): this func...
72520b4290971485ffd809cb0d17a7536862be23
<|skeleton|> class BoilerAuthenticator: """Custom User Authenticator class. This class logs in using any of pk, code, email and username of an active user Arguments: object Returns: Authenticator class""" def get_user(self, user_id): """this function is for getting a single user by pk Arguments: user_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoilerAuthenticator: """Custom User Authenticator class. This class logs in using any of pk, code, email and username of an active user Arguments: object Returns: Authenticator class""" def get_user(self, user_id): """this function is for getting a single user by pk Arguments: user_id {integer} R...
the_stack_v2_python_sparse
projectile/core/backends.py
kayes-shawon/DjangoRestApiWithGulpAngularBoilerPlate
train
1
04d34252be10d3c9cdef35dfe9284544d1c5e319
[ "Utils.validate_uuid(id_patient)\nif not Patient.objects.filter(id=id_patient).exists():\n raise ValidationError('The patient is not valid!')", "return_value = {}\nreturn_value['person_id'] = PersonService.add_person({'street': patient_request['address']['street'], 'zip_code': patient_request['address']['zip_c...
<|body_start_0|> Utils.validate_uuid(id_patient) if not Patient.objects.filter(id=id_patient).exists(): raise ValidationError('The patient is not valid!') <|end_body_0|> <|body_start_1|> return_value = {} return_value['person_id'] = PersonService.add_person({'street': patien...
Service class for patient related operations
PatientService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatientService: """Service class for patient related operations""" def is_valid_patient(id_patient): """Checks if the specified patient exists :param id_patient: ID of patient to be checked""" <|body_0|> def add_patient(patient_request): """Method to add a new pa...
stack_v2_sparse_classes_36k_train_019850
4,931
no_license
[ { "docstring": "Checks if the specified patient exists :param id_patient: ID of patient to be checked", "name": "is_valid_patient", "signature": "def is_valid_patient(id_patient)" }, { "docstring": "Method to add a new patient :param patient_request: Incoming request :return: patient and person ...
4
stack_v2_sparse_classes_30k_test_000023
Implement the Python class `PatientService` described below. Class description: Service class for patient related operations Method signatures and docstrings: - def is_valid_patient(id_patient): Checks if the specified patient exists :param id_patient: ID of patient to be checked - def add_patient(patient_request): M...
Implement the Python class `PatientService` described below. Class description: Service class for patient related operations Method signatures and docstrings: - def is_valid_patient(id_patient): Checks if the specified patient exists :param id_patient: ID of patient to be checked - def add_patient(patient_request): M...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class PatientService: """Service class for patient related operations""" def is_valid_patient(id_patient): """Checks if the specified patient exists :param id_patient: ID of patient to be checked""" <|body_0|> def add_patient(patient_request): """Method to add a new pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatientService: """Service class for patient related operations""" def is_valid_patient(id_patient): """Checks if the specified patient exists :param id_patient: ID of patient to be checked""" Utils.validate_uuid(id_patient) if not Patient.objects.filter(id=id_patient).exists(): ...
the_stack_v2_python_sparse
backend/martin_helder/services/patient_service.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
490df29fb92ed8719e6a5d4f89fd4272e3f0b199
[ "self.fromZoneType = fromZoneType\nif toZoneType is None:\n toZoneType = DISCARD_PILE\nself.toZoneType = toZoneType", "fromZone = context.loadZone(self.fromZoneType)\ntoZone = context.loadZone(self.toZoneType)\nfor card in fromZone:\n coroutine = context.owner.gainCard(card, fromZone, toZone=toZone)\n tr...
<|body_start_0|> self.fromZoneType = fromZoneType if toZoneType is None: toZoneType = DISCARD_PILE self.toZoneType = toZoneType <|end_body_0|> <|body_start_1|> fromZone = context.loadZone(self.fromZoneType) toZone = context.loadZone(self.toZoneType) for card ...
Represents an effect to Gain a card
GainCard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GainCard: """Represents an effect to Gain a card""" def __init__(self, fromZoneType, toZoneType=None): """Initialize the Effect with the card to remove from play before discarding""" <|body_0|> def perform(self, context): """Perform the Game Effect""" <|b...
stack_v2_sparse_classes_36k_train_019851
948
no_license
[ { "docstring": "Initialize the Effect with the card to remove from play before discarding", "name": "__init__", "signature": "def __init__(self, fromZoneType, toZoneType=None)" }, { "docstring": "Perform the Game Effect", "name": "perform", "signature": "def perform(self, context)" } ]
2
stack_v2_sparse_classes_30k_train_012281
Implement the Python class `GainCard` described below. Class description: Represents an effect to Gain a card Method signatures and docstrings: - def __init__(self, fromZoneType, toZoneType=None): Initialize the Effect with the card to remove from play before discarding - def perform(self, context): Perform the Game ...
Implement the Python class `GainCard` described below. Class description: Represents an effect to Gain a card Method signatures and docstrings: - def __init__(self, fromZoneType, toZoneType=None): Initialize the Effect with the card to remove from play before discarding - def perform(self, context): Perform the Game ...
0b5a7573a3cf33430fe61e4ff8a8a7a0ae20b258
<|skeleton|> class GainCard: """Represents an effect to Gain a card""" def __init__(self, fromZoneType, toZoneType=None): """Initialize the Effect with the card to remove from play before discarding""" <|body_0|> def perform(self, context): """Perform the Game Effect""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GainCard: """Represents an effect to Gain a card""" def __init__(self, fromZoneType, toZoneType=None): """Initialize the Effect with the card to remove from play before discarding""" self.fromZoneType = fromZoneType if toZoneType is None: toZoneType = DISCARD_PILE ...
the_stack_v2_python_sparse
src/Game/Effects/gain_card.py
dfwarden/DeckBuilding
train
0
f73c21481e642260dd50fd0f4b9d82ddc7b8798f
[ "super(CSVParser, self).__init__(*args, **kwargs)\nself.delimiter = kwargs.get('delimiter', ',')\nself.hasheader = kwargs.get('hasheader', True)\nself.lineterminator = kwargs.get('lineterminator', '\\n')\nself.quoting = kwargs.get('quoting', csv.QUOTE_MINIMAL)", "super(CSVParser, self)._set_argparser_options()\ns...
<|body_start_0|> super(CSVParser, self).__init__(*args, **kwargs) self.delimiter = kwargs.get('delimiter', ',') self.hasheader = kwargs.get('hasheader', True) self.lineterminator = kwargs.get('lineterminator', '\n') self.quoting = kwargs.get('quoting', csv.QUOTE_MINIMAL) <|end_bo...
CSVParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVParser: def __init__(self, *args, **kwargs): """:option delimiter [str]: Column delimiter :option hasheader [bool]: Use first row in csv file as header row :option lineterminator [str]: Row delimiter :option quoting [int]: Quoting level""" <|body_0|> def _set_argparser_op...
stack_v2_sparse_classes_36k_train_019852
4,381
no_license
[ { "docstring": ":option delimiter [str]: Column delimiter :option hasheader [bool]: Use first row in csv file as header row :option lineterminator [str]: Row delimiter :option quoting [int]: Quoting level", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_013376
Implement the Python class `CSVParser` described below. Class description: Implement the CSVParser class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): :option delimiter [str]: Column delimiter :option hasheader [bool]: Use first row in csv file as header row :option lineterminator [str]: R...
Implement the Python class `CSVParser` described below. Class description: Implement the CSVParser class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): :option delimiter [str]: Column delimiter :option hasheader [bool]: Use first row in csv file as header row :option lineterminator [str]: R...
d0b69daf20e230bded3b814d02ee08ca6c39f612
<|skeleton|> class CSVParser: def __init__(self, *args, **kwargs): """:option delimiter [str]: Column delimiter :option hasheader [bool]: Use first row in csv file as header row :option lineterminator [str]: Row delimiter :option quoting [int]: Quoting level""" <|body_0|> def _set_argparser_op...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSVParser: def __init__(self, *args, **kwargs): """:option delimiter [str]: Column delimiter :option hasheader [bool]: Use first row in csv file as header row :option lineterminator [str]: Row delimiter :option quoting [int]: Quoting level""" super(CSVParser, self).__init__(*args, **kwargs) ...
the_stack_v2_python_sparse
csvutils/parsers/builtins/csv.py
hhubbell/polytab
train
0
d87f92842b644fcf65afb05764ddeea07f0ecd33
[ "create_pool_flow = linear_flow.Flow(constants.CREATE_POOL_FLOW)\ncreate_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(requires=[constants.POOL_ID, constants.LISTENERS, constants.LOADBALANCER]))\ncreate_pool_flow.add(database_tasks.MarkPoolPendingCreateInDB(requires=constants.POOL_ID))\ncreate_pool_flow.add...
<|body_start_0|> create_pool_flow = linear_flow.Flow(constants.CREATE_POOL_FLOW) create_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(requires=[constants.POOL_ID, constants.LISTENERS, constants.LOADBALANCER])) create_pool_flow.add(database_tasks.MarkPoolPendingCreateInDB(requires=constan...
PoolFlows
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PoolFlows: def get_create_pool_flow(self): """Create a flow to create a pool :returns: The flow for creating a pool""" <|body_0|> def get_delete_pool_flow(self): """Create a flow to delete a pool :returns: The flow for deleting a pool""" <|body_1|> def g...
stack_v2_sparse_classes_36k_train_019853
5,372
permissive
[ { "docstring": "Create a flow to create a pool :returns: The flow for creating a pool", "name": "get_create_pool_flow", "signature": "def get_create_pool_flow(self)" }, { "docstring": "Create a flow to delete a pool :returns: The flow for deleting a pool", "name": "get_delete_pool_flow", ...
4
null
Implement the Python class `PoolFlows` described below. Class description: Implement the PoolFlows class. Method signatures and docstrings: - def get_create_pool_flow(self): Create a flow to create a pool :returns: The flow for creating a pool - def get_delete_pool_flow(self): Create a flow to delete a pool :returns:...
Implement the Python class `PoolFlows` described below. Class description: Implement the PoolFlows class. Method signatures and docstrings: - def get_create_pool_flow(self): Create a flow to create a pool :returns: The flow for creating a pool - def get_delete_pool_flow(self): Create a flow to delete a pool :returns:...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class PoolFlows: def get_create_pool_flow(self): """Create a flow to create a pool :returns: The flow for creating a pool""" <|body_0|> def get_delete_pool_flow(self): """Create a flow to delete a pool :returns: The flow for deleting a pool""" <|body_1|> def g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PoolFlows: def get_create_pool_flow(self): """Create a flow to create a pool :returns: The flow for creating a pool""" create_pool_flow = linear_flow.Flow(constants.CREATE_POOL_FLOW) create_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(requires=[constants.POOL_ID, constants.LIS...
the_stack_v2_python_sparse
octavia/controller/worker/v2/flows/pool_flows.py
openstack/octavia
train
147
4dd498c5771e025ac0ba9c15433a31104b0310dd
[ "if request.GET.get('code'):\n code = request.GET.get('code')\n auth_type = request.GET.get('auth_type', 'web')\n instance = AccessToken.update_access_token(code, auth_type=auth_type)\n if instance is None:\n return Response(dict(message='code 无效,请重新登录'), status=status.HTTP_401_UNAUTHORIZED)\n ...
<|body_start_0|> if request.GET.get('code'): code = request.GET.get('code') auth_type = request.GET.get('auth_type', 'web') instance = AccessToken.update_access_token(code, auth_type=auth_type) if instance is None: return Response(dict(message='cod...
WxLoginView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WxLoginView: def get(self, request, *args, **kwargs): """获取登录链接""" <|body_0|> def post(self, request, *args, **kwargs): """小程序端获取登录 Session""" <|body_1|> <|end_skeleton|> <|body_start_0|> if request.GET.get('code'): code = request.GET.ge...
stack_v2_sparse_classes_36k_train_019854
3,730
permissive
[ { "docstring": "获取登录链接", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "小程序端获取登录 Session", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_015183
Implement the Python class `WxLoginView` described below. Class description: Implement the WxLoginView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取登录链接 - def post(self, request, *args, **kwargs): 小程序端获取登录 Session
Implement the Python class `WxLoginView` described below. Class description: Implement the WxLoginView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取登录链接 - def post(self, request, *args, **kwargs): 小程序端获取登录 Session <|skeleton|> class WxLoginView: def get(self, request, *a...
b8021250bf3d8cf7adc566deebdba55225148316
<|skeleton|> class WxLoginView: def get(self, request, *args, **kwargs): """获取登录链接""" <|body_0|> def post(self, request, *args, **kwargs): """小程序端获取登录 Session""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WxLoginView: def get(self, request, *args, **kwargs): """获取登录链接""" if request.GET.get('code'): code = request.GET.get('code') auth_type = request.GET.get('auth_type', 'web') instance = AccessToken.update_access_token(code, auth_type=auth_type) if...
the_stack_v2_python_sparse
wxapp/views.py
lianxiaopang/camel-store-api
train
0
aec4e05b567dd771e14544f27f007cdf08280014
[ "np.random.seed(106)\nself.params = dict()\nself.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size)\nself.params['b1'] = np.zeros(hidden_size)\nself.params['W2'] = weight_init_std * np.random.randn(hidden_size, output_size)\nself.params['b2'] = np.zeros(output_size)\nself.layers = OrderedDict...
<|body_start_0|> np.random.seed(106) self.params = dict() self.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size) self.params['b1'] = np.zeros(hidden_size) self.params['W2'] = weight_init_std * np.random.randn(hidden_size, output_size) self.params['...
TwoLayerNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoLayerNetwork: def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): """신경망의 구조 결정""" <|body_0|> def predict(self, x): """input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 = self.layer['affine1].forward(x) Y2 = self.layer['relu].forward(Y1)...
stack_v2_sparse_classes_36k_train_019855
7,910
no_license
[ { "docstring": "신경망의 구조 결정", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01)" }, { "docstring": "input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 = self.layer['affine1].forward(x) Y2 = self.layer['relu].forward(Y1) Y3 = self.layer[...
5
stack_v2_sparse_classes_30k_train_011908
Implement the Python class `TwoLayerNetwork` described below. Class description: Implement the TwoLayerNetwork class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): 신경망의 구조 결정 - def predict(self, x): input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 ...
Implement the Python class `TwoLayerNetwork` described below. Class description: Implement the TwoLayerNetwork class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): 신경망의 구조 결정 - def predict(self, x): input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 ...
99ddcadec0c93bd42113f6b5fbecd9171c030f8b
<|skeleton|> class TwoLayerNetwork: def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): """신경망의 구조 결정""" <|body_0|> def predict(self, x): """input x를 받아 Forwrd Propagation을 통해 예측된 output Y1 = self.layer['affine1].forward(x) Y2 = self.layer['relu].forward(Y1)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoLayerNetwork: def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01): """신경망의 구조 결정""" np.random.seed(106) self.params = dict() self.params['W1'] = weight_init_std * np.random.randn(input_size, hidden_size) self.params['b1'] = np.zeros(hidden_...
the_stack_v2_python_sparse
ch05_Back_Propagation/ex10_MNIST_Two_Layer_NN_Propagation.py
handaeho/lab_dl
train
0
8d95f93edceb47bdb8c06c9c407fb390e01d4fc7
[ "AssessmentResults.__init__(self, controller, **kwargs)\nself._lst_labels.append(u'π<sub>C</sub>:')\nself._lst_labels.append(u'π<sub>CYC</sub>:')\nself._lst_labels.append(u'π<sub>F</sub>:')\nself._lst_labels.append(u'π<sub>L</sub>:')\nself._lblModel.set_tooltip_markup(_(u\"The assessment model used to calculate the...
<|body_start_0|> AssessmentResults.__init__(self, controller, **kwargs) self._lst_labels.append(u'π<sub>C</sub>:') self._lst_labels.append(u'π<sub>CYC</sub>:') self._lst_labels.append(u'π<sub>F</sub>:') self._lst_labels.append(u'π<sub>L</sub>:') self._lblModel.set_tooltip...
Display Relay assessment results attribute data in the RAMSTK Work Book. The Relay assessment result view displays all the assessment results for the selected relay. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The attributes of a relay assessment result vie...
RelayAssessmentResults
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelayAssessmentResults: """Display Relay assessment results attribute data in the RAMSTK Work Book. The Relay assessment result view displays all the assessment results for the selected relay. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress method...
stack_v2_sparse_classes_36k_train_019856
25,536
permissive
[ { "docstring": "Initialize an instance of the Relay assessment result view. :param controller: the hardware data controller instance. :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController`", "name": "__init__", "signature": "def __init__(self, controller, **kwargs)" }, { ...
5
null
Implement the Python class `RelayAssessmentResults` described below. Class description: Display Relay assessment results attribute data in the RAMSTK Work Book. The Relay assessment result view displays all the assessment results for the selected relay. This includes, currently, results for MIL-HDBK-217FN2 parts count...
Implement the Python class `RelayAssessmentResults` described below. Class description: Display Relay assessment results attribute data in the RAMSTK Work Book. The Relay assessment result view displays all the assessment results for the selected relay. This includes, currently, results for MIL-HDBK-217FN2 parts count...
488ffed8b842399ddcae93007de6c6f1dda23d05
<|skeleton|> class RelayAssessmentResults: """Display Relay assessment results attribute data in the RAMSTK Work Book. The Relay assessment result view displays all the assessment results for the selected relay. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress method...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelayAssessmentResults: """Display Relay assessment results attribute data in the RAMSTK Work Book. The Relay assessment result view displays all the assessment results for the selected relay. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The attrib...
the_stack_v2_python_sparse
src/ramstk/gui/gtk/workviews/components/Relay.py
JmiXIII/ramstk
train
0
b48d0cc3a0347ee9da7f29b18238dfea97c8f00f
[ "assert IGSContentManagerFolderMarker in providedBy(folder)\nself.context = self.folder = folder\nself.__tree = None", "if self.__tree is None:\n self.__tree = self.get_tree(self.get_root(self.folder))\nretval = self.__tree\nassert retval\nassert len(retval) == 2\nassert IGSContentManagerFolderMarker in provid...
<|body_start_0|> assert IGSContentManagerFolderMarker in providedBy(folder) self.context = self.folder = folder self.__tree = None <|end_body_0|> <|body_start_1|> if self.__tree is None: self.__tree = self.get_tree(self.get_root(self.folder)) retval = self.__tree ...
A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (node, children).
PageTree
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageTree: """A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (...
stack_v2_sparse_classes_36k_train_019857
5,595
permissive
[ { "docstring": "Create a tree. ARGUMENTS folder A folder, any folder, in the tree.", "name": "__init__", "signature": "def __init__(self, folder)" }, { "docstring": "Get the tree as a 2-tuple: (node, children). Each child is represented as a 2-tuple of (node, children).", "name": "tree", ...
4
stack_v2_sparse_classes_30k_train_018624
Implement the Python class `PageTree` described below. Class description: A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. P...
Implement the Python class `PageTree` described below. Class description: A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. P...
2fd8d708f378eb1bde4a7331f724f4c9a3b974ae
<|skeleton|> class PageTree: """A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PageTree: """A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (node, childre...
the_stack_v2_python_sparse
Products/GSContentManager/pagetree.py
groupserver/Products.GSContentManager
train
0
008acc477c6de384db81166439581d21a3140acd
[ "vals = []\n\ndef preOrder(root):\n if not root:\n vals.append('#')\n else:\n vals.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\npreOrder(root)\nreturn ' '.join(vals)", "vals = collections.deque((val for val in data.split()))\n\ndef build():\n if vals:\n ...
<|body_start_0|> vals = [] def preOrder(root): if not root: vals.append('#') else: vals.append(str(root.val)) preOrder(root.left) preOrder(root.right) preOrder(root) return ' '.join(vals) <|end_body_...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_019858
17,936
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_006257
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" vals = [] def preOrder(root): if not root: vals.append('#') else: vals.append(str(root.val)) preOrder(roo...
the_stack_v2_python_sparse
leetcode_python/Tree/serialize-and-deserialize-binary-tree.py
yennanliu/CS_basics
train
64
8eb943f0ad70308aecd62c854f0bab9804d1f651
[ "def reverse(pre, cur):\n if cur is None:\n return pre\n tmp = cur.next\n cur.next = pre\n return reverse(cur, tmp)\nreturn reverse(None, head)", "if head is None or head.next is None:\n return head\npre, cur = (None, head)\nwhile cur is not None:\n tmp = cur.next\n cur.next = pre\n ...
<|body_start_0|> def reverse(pre, cur): if cur is None: return pre tmp = cur.next cur.next = pre return reverse(cur, tmp) return reverse(None, head) <|end_body_0|> <|body_start_1|> if head is None or head.next is None: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """递归方式""" <|body_0|> def reverseList_1(self, head): """双指针法""" <|body_1|> <|end_skeleton|> <|body_start_0|> def reverse(pre, cur): if cur is None: return pre tmp = cur.n...
stack_v2_sparse_classes_36k_train_019859
815
no_license
[ { "docstring": "递归方式", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": "双指针法", "name": "reverseList_1", "signature": "def reverseList_1(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): 递归方式 - def reverseList_1(self, head): 双指针法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): 递归方式 - def reverseList_1(self, head): 双指针法 <|skeleton|> class Solution: def reverseList(self, head): """递归方式""" <|body_0|> ...
be46de7cdd29557c01d4b89f1c2f638e055b6d70
<|skeleton|> class Solution: def reverseList(self, head): """递归方式""" <|body_0|> def reverseList_1(self, head): """双指针法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """递归方式""" def reverse(pre, cur): if cur is None: return pre tmp = cur.next cur.next = pre return reverse(cur, tmp) return reverse(None, head) def reverseList_1(self, head): ...
the_stack_v2_python_sparse
python/No206.py
OhOHOh/LeetCodePractice
train
0
3539fe6196ff26c70e775659deea8c40b007165b
[ "self.bgcolor = bgcolor\nself.size = size\nself.scale_mode = scale_mode\nself.colormap = colormap\nself.mode = mode\nself.scale_factor = scale_factor\nself.show_axes = show_axes\nself.show_outline = show_outline\nself.show_colorbar = show_colorbar\nself.show_fig = show_fig\nself.view = view\nself.gpu = gpu\nself.fi...
<|body_start_0|> self.bgcolor = bgcolor self.size = size self.scale_mode = scale_mode self.colormap = colormap self.mode = mode self.scale_factor = scale_factor self.show_axes = show_axes self.show_outline = show_outline self.show_colorbar = show_c...
三维quiver图,需要确定画图的文件夹
quiver3D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class quiver3D: """三维quiver图,需要确定画图的文件夹""" def __init__(self, bgcolor=None, size=(1080, 720), scale_mode='vector', colormap='bwr', mode='arrow', scale_factor=1e-09, show_outline=False, show_axes=False, show_colorbar=True, show_fig=True, view=np.array([[90, 180]]), gpu=False, fig_format='.png', sav...
stack_v2_sparse_classes_36k_train_019860
5,858
no_license
[ { "docstring": "bgcolor:tuple,背景颜色:(1,1,1) size:tuple,图片大小 (1080,720) scale_mode:str,颜色模式:scalar/vector colormap:str,'bwr','coolwarm' mode:str,arrow,cone,cube.... scale_factor:float,缩放 show_outline:bool,显示外框 show_axes:bool,显示坐标轴 view:array,视图 gpu:bool fig_format:str,图片格式", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_train_008061
Implement the Python class `quiver3D` described below. Class description: 三维quiver图,需要确定画图的文件夹 Method signatures and docstrings: - def __init__(self, bgcolor=None, size=(1080, 720), scale_mode='vector', colormap='bwr', mode='arrow', scale_factor=1e-09, show_outline=False, show_axes=False, show_colorbar=True, show_fig...
Implement the Python class `quiver3D` described below. Class description: 三维quiver图,需要确定画图的文件夹 Method signatures and docstrings: - def __init__(self, bgcolor=None, size=(1080, 720), scale_mode='vector', colormap='bwr', mode='arrow', scale_factor=1e-09, show_outline=False, show_axes=False, show_colorbar=True, show_fig...
b851c5988c8abcfdc911cb84f3290e849e83a9f6
<|skeleton|> class quiver3D: """三维quiver图,需要确定画图的文件夹""" def __init__(self, bgcolor=None, size=(1080, 720), scale_mode='vector', colormap='bwr', mode='arrow', scale_factor=1e-09, show_outline=False, show_axes=False, show_colorbar=True, show_fig=True, view=np.array([[90, 180]]), gpu=False, fig_format='.png', sav...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class quiver3D: """三维quiver图,需要确定画图的文件夹""" def __init__(self, bgcolor=None, size=(1080, 720), scale_mode='vector', colormap='bwr', mode='arrow', scale_factor=1e-09, show_outline=False, show_axes=False, show_colorbar=True, show_fig=True, view=np.array([[90, 180]]), gpu=False, fig_format='.png', save_path=os.get...
the_stack_v2_python_sparse
mpy0.1/tool/quiver3d.py
plenari/omfPython
train
5
70e8eb95c6b9c68515cee4f5988c88118c55a7a8
[ "self._attr_name = name\nself._file_path = file_path\nself._attr_native_unit_of_measurement = unit_of_measurement\nself._val_tpl = value_template", "try:\n with FileReadBackwards(self._file_path, encoding='utf-8') as file_data:\n for line in file_data:\n data = line\n break\n ...
<|body_start_0|> self._attr_name = name self._file_path = file_path self._attr_native_unit_of_measurement = unit_of_measurement self._val_tpl = value_template <|end_body_0|> <|body_start_1|> try: with FileReadBackwards(self._file_path, encoding='utf-8') as file_data:...
Implementation of a file sensor.
FileSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSensor: """Implementation of a file sensor.""" def __init__(self, name: str, file_path: str, unit_of_measurement: str | None, value_template: Template | None) -> None: """Initialize the file sensor.""" <|body_0|> def update(self) -> None: """Get the latest en...
stack_v2_sparse_classes_36k_train_019861
3,083
permissive
[ { "docstring": "Initialize the file sensor.", "name": "__init__", "signature": "def __init__(self, name: str, file_path: str, unit_of_measurement: str | None, value_template: Template | None) -> None" }, { "docstring": "Get the latest entry from a file and updates the state.", "name": "updat...
2
null
Implement the Python class `FileSensor` described below. Class description: Implementation of a file sensor. Method signatures and docstrings: - def __init__(self, name: str, file_path: str, unit_of_measurement: str | None, value_template: Template | None) -> None: Initialize the file sensor. - def update(self) -> No...
Implement the Python class `FileSensor` described below. Class description: Implementation of a file sensor. Method signatures and docstrings: - def __init__(self, name: str, file_path: str, unit_of_measurement: str | None, value_template: Template | None) -> None: Initialize the file sensor. - def update(self) -> No...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class FileSensor: """Implementation of a file sensor.""" def __init__(self, name: str, file_path: str, unit_of_measurement: str | None, value_template: Template | None) -> None: """Initialize the file sensor.""" <|body_0|> def update(self) -> None: """Get the latest en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileSensor: """Implementation of a file sensor.""" def __init__(self, name: str, file_path: str, unit_of_measurement: str | None, value_template: Template | None) -> None: """Initialize the file sensor.""" self._attr_name = name self._file_path = file_path self._attr_nativ...
the_stack_v2_python_sparse
homeassistant/components/file/sensor.py
home-assistant/core
train
35,501
3e67135375e8e9ffc5c02e10c0562c42049e6251
[ "if 'username' in request.COOKIES:\n username = request.COOKIES.get('username')\n checked = 'checked'\nelse:\n username = ''\n checked = ''\nreturn render(request, 'login.html', {'username': username, 'checked': checked})", "username = request.POST.get('username')\npassword = request.POST.get('pwd')\n...
<|body_start_0|> if 'username' in request.COOKIES: username = request.COOKIES.get('username') checked = 'checked' else: username = '' checked = '' return render(request, 'login.html', {'username': username, 'checked': checked}) <|end_body_0|> <|bo...
登录
LoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginView: """登录""" def get(self, request): """显示登陆页面""" <|body_0|> def post(self, request): """登录校验""" <|body_1|> <|end_skeleton|> <|body_start_0|> if 'username' in request.COOKIES: username = request.COOKIES.get('username') ...
stack_v2_sparse_classes_36k_train_019862
11,775
no_license
[ { "docstring": "显示登陆页面", "name": "get", "signature": "def get(self, request)" }, { "docstring": "登录校验", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_017364
Implement the Python class `LoginView` described below. Class description: 登录 Method signatures and docstrings: - def get(self, request): 显示登陆页面 - def post(self, request): 登录校验
Implement the Python class `LoginView` described below. Class description: 登录 Method signatures and docstrings: - def get(self, request): 显示登陆页面 - def post(self, request): 登录校验 <|skeleton|> class LoginView: """登录""" def get(self, request): """显示登陆页面""" <|body_0|> def post(self, request)...
91293b05eb28697f5dec7f99a0f608904f6a0b1f
<|skeleton|> class LoginView: """登录""" def get(self, request): """显示登陆页面""" <|body_0|> def post(self, request): """登录校验""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginView: """登录""" def get(self, request): """显示登陆页面""" if 'username' in request.COOKIES: username = request.COOKIES.get('username') checked = 'checked' else: username = '' checked = '' return render(request, 'login.html', {...
the_stack_v2_python_sparse
dailyfresh/apps/user/views.py
IronmanJay/Python_Project
train
15
382504403a478260e06aed3283dce1f607788acc
[ "super(MetaDice, self).__init__()\nassert method in ('2d', '3d'), method\nself.method = method\nself.reduce = reduce\nself.eps = eps\nself.weight = weight", "assert pred.shape == target.shape, f'`pred` and `target` should have the same shape, given `pred`:{pred.shape}, `target`:{target.shape}.'\nassert not target...
<|body_start_0|> super(MetaDice, self).__init__() assert method in ('2d', '3d'), method self.method = method self.reduce = reduce self.eps = eps self.weight = weight <|end_body_0|> <|body_start_1|> assert pred.shape == target.shape, f'`pred` and `target` should h...
3D and 2D dice computator, not the loss
MetaDice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetaDice: """3D and 2D dice computator, not the loss""" def __init__(self, method: str, weight: Tensor=None, reduce: bool=False, eps: float=1e-08) -> None: """:param method must be in (2d, 3d) :param weight: Weight to be multipled to each class. :param eps: default to 1e-8 :param red...
stack_v2_sparse_classes_36k_train_019863
4,501
permissive
[ { "docstring": ":param method must be in (2d, 3d) :param weight: Weight to be multipled to each class. :param eps: default to 1e-8 :param reduce: if reduce classwise mean. mean on batch samples. :return:", "name": "__init__", "signature": "def __init__(self, method: str, weight: Tensor=None, reduce: boo...
2
stack_v2_sparse_classes_30k_train_004361
Implement the Python class `MetaDice` described below. Class description: 3D and 2D dice computator, not the loss Method signatures and docstrings: - def __init__(self, method: str, weight: Tensor=None, reduce: bool=False, eps: float=1e-08) -> None: :param method must be in (2d, 3d) :param weight: Weight to be multip...
Implement the Python class `MetaDice` described below. Class description: 3D and 2D dice computator, not the loss Method signatures and docstrings: - def __init__(self, method: str, weight: Tensor=None, reduce: bool=False, eps: float=1e-08) -> None: :param method must be in (2d, 3d) :param weight: Weight to be multip...
0721cbbb278af027409ed4c115ccc743b6daed1b
<|skeleton|> class MetaDice: """3D and 2D dice computator, not the loss""" def __init__(self, method: str, weight: Tensor=None, reduce: bool=False, eps: float=1e-08) -> None: """:param method must be in (2d, 3d) :param weight: Weight to be multipled to each class. :param eps: default to 1e-8 :param red...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetaDice: """3D and 2D dice computator, not the loss""" def __init__(self, method: str, weight: Tensor=None, reduce: bool=False, eps: float=1e-08) -> None: """:param method must be in (2d, 3d) :param weight: Weight to be multipled to each class. :param eps: default to 1e-8 :param reduce: if reduc...
the_stack_v2_python_sparse
deepclustering/loss/dice_loss.py
jizongFox/deep-clustering-toolbox
train
37
ea7efe3f2db967c8ca5e0efb5874d60d5c33f20b
[ "self.queue = [0] * k\nself.headIndex = 0\nself.count = 0\nself.capacity = k\nself.queueLock = Lock()", "with self.queueLock:\n if self.count == self.capacity:\n return False\n self.queue[(self.headIndex + self.count) % self.capacity] = value\n self.count += 1\nreturn True" ]
<|body_start_0|> self.queue = [0] * k self.headIndex = 0 self.count = 0 self.capacity = k self.queueLock = Lock() <|end_body_0|> <|body_start_1|> with self.queueLock: if self.count == self.capacity: return False self.queue[(self.he...
MyCircularQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyCircularQueue: def __init__(self, k: int): """Initialize your data structure here. Set the size of the queue to be k.""" <|body_0|> def enQueue(self, value: int) -> bool: """Insert an element into the circular queue. Return true if the operation is successful.""" ...
stack_v2_sparse_classes_36k_train_019864
18,175
no_license
[ { "docstring": "Initialize your data structure here. Set the size of the queue to be k.", "name": "__init__", "signature": "def __init__(self, k: int)" }, { "docstring": "Insert an element into the circular queue. Return true if the operation is successful.", "name": "enQueue", "signatur...
2
stack_v2_sparse_classes_30k_train_013070
Implement the Python class `MyCircularQueue` described below. Class description: Implement the MyCircularQueue class. Method signatures and docstrings: - def __init__(self, k: int): Initialize your data structure here. Set the size of the queue to be k. - def enQueue(self, value: int) -> bool: Insert an element into ...
Implement the Python class `MyCircularQueue` described below. Class description: Implement the MyCircularQueue class. Method signatures and docstrings: - def __init__(self, k: int): Initialize your data structure here. Set the size of the queue to be k. - def enQueue(self, value: int) -> bool: Insert an element into ...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class MyCircularQueue: def __init__(self, k: int): """Initialize your data structure here. Set the size of the queue to be k.""" <|body_0|> def enQueue(self, value: int) -> bool: """Insert an element into the circular queue. Return true if the operation is successful.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyCircularQueue: def __init__(self, k: int): """Initialize your data structure here. Set the size of the queue to be k.""" self.queue = [0] * k self.headIndex = 0 self.count = 0 self.capacity = k self.queueLock = Lock() def enQueue(self, value: int) -> bool...
the_stack_v2_python_sparse
leetcode_python/Queue/design_circular_queue.py
yennanliu/CS_basics
train
64
4eae8f0722c2b3deadc57599dddbe26e7cc15f0e
[ "if not m and (not n):\n return 0\ndp = [[0 for _ in range(n)] for _ in range(m)]\ndp[0][0] = matrix[0][0]\nfor j in range(1, n):\n dp[0][j] = dp[0][j - 1] + matrix[0][j]\nfor i in range(1, m):\n dp[i][0] = dp[i - 1][0] + matrix[i][0]\nfor i in range(1, m):\n for j in range(1, n):\n dp[i][j] = ma...
<|body_start_0|> if not m and (not n): return 0 dp = [[0 for _ in range(n)] for _ in range(m)] dp[0][0] = matrix[0][0] for j in range(1, n): dp[0][j] = dp[0][j - 1] + matrix[0][j] for i in range(1, m): dp[i][0] = dp[i - 1][0] + matrix[i][0] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calMaxNum(self, matrix: List[List[int]], m: int, n: int) -> int: """统计胡萝卜的最大数目 :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return:""" <|body_0|> def calMaxNum2(self, matrix: List[List[int]], m: int, n: int) -> int: """统计胡萝卜的最大数目(空间优化) :param matr...
stack_v2_sparse_classes_36k_train_019865
2,305
no_license
[ { "docstring": "统计胡萝卜的最大数目 :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return:", "name": "calMaxNum", "signature": "def calMaxNum(self, matrix: List[List[int]], m: int, n: int) -> int" }, { "docstring": "统计胡萝卜的最大数目(空间优化) :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return:", "na...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calMaxNum(self, matrix: List[List[int]], m: int, n: int) -> int: 统计胡萝卜的最大数目 :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return: - def calMaxNum2(self, matrix: List[Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calMaxNum(self, matrix: List[List[int]], m: int, n: int) -> int: 统计胡萝卜的最大数目 :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return: - def calMaxNum2(self, matrix: List[Lis...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def calMaxNum(self, matrix: List[List[int]], m: int, n: int) -> int: """统计胡萝卜的最大数目 :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return:""" <|body_0|> def calMaxNum2(self, matrix: List[List[int]], m: int, n: int) -> int: """统计胡萝卜的最大数目(空间优化) :param matr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def calMaxNum(self, matrix: List[List[int]], m: int, n: int) -> int: """统计胡萝卜的最大数目 :param matrix: 输入矩阵 :param m 矩阵的行数 :param n 矩阵的列数 :return:""" if not m and (not n): return 0 dp = [[0 for _ in range(n)] for _ in range(m)] dp[0][0] = matrix[0][0] f...
the_stack_v2_python_sparse
cecilia-python/others/CalMaxPathNum.py
Cecilia520/algorithmic-learning-leetcode
train
7
1a7c66eed58c3019f4e47dbdef190ad3e3ebb54b
[ "if e in self.vals and self.vals[e] < 1:\n pass\nelif e in self.vals:\n self.vals[e] -= 1\n ASet.unmodified[e] = False\nelse:\n pass", "if self.vals[e] == 0:\n return False\nelif e in self.vals and e not in ASet.unmodified:\n return True\nelse:\n return False" ]
<|body_start_0|> if e in self.vals and self.vals[e] < 1: pass elif e in self.vals: self.vals[e] -= 1 ASet.unmodified[e] = False else: pass <|end_body_0|> <|body_start_1|> if self.vals[e] == 0: return False elif e in sel...
ASet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ASet: def remove(self, e): """assumes e is hashable removes e from self""" <|body_0|> def is_in(self, e): """assumes e is hashable returns True if e has been inserted in self and not subsequently removed, and False otherwise.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_019866
5,303
no_license
[ { "docstring": "assumes e is hashable removes e from self", "name": "remove", "signature": "def remove(self, e)" }, { "docstring": "assumes e is hashable returns True if e has been inserted in self and not subsequently removed, and False otherwise.", "name": "is_in", "signature": "def is...
2
null
Implement the Python class `ASet` described below. Class description: Implement the ASet class. Method signatures and docstrings: - def remove(self, e): assumes e is hashable removes e from self - def is_in(self, e): assumes e is hashable returns True if e has been inserted in self and not subsequently removed, and F...
Implement the Python class `ASet` described below. Class description: Implement the ASet class. Method signatures and docstrings: - def remove(self, e): assumes e is hashable removes e from self - def is_in(self, e): assumes e is hashable returns True if e has been inserted in self and not subsequently removed, and F...
4e8727154a24c7a1d05361a559a997c8d076480d
<|skeleton|> class ASet: def remove(self, e): """assumes e is hashable removes e from self""" <|body_0|> def is_in(self, e): """assumes e is hashable returns True if e has been inserted in self and not subsequently removed, and False otherwise.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ASet: def remove(self, e): """assumes e is hashable removes e from self""" if e in self.vals and self.vals[e] < 1: pass elif e in self.vals: self.vals[e] -= 1 ASet.unmodified[e] = False else: pass def is_in(self, e): ...
the_stack_v2_python_sparse
01_MIT_Learning/00_final_exam/final_problem_6_pt3.py
daftstar/learn_python
train
0
48195e0256d65b7e000ebbf4dca34128f0705b22
[ "from ._mumps import DMumpsContext\nLinSolver.__init__(self, prop)\nself.name = 'mumps'\nif prop == self.UNSYMMETRIC:\n self.mumps = DMumpsContext(par=1, sym=0)\nelif prop == self.SYMMETRIC:\n self.mumps = DMumpsContext(par=1, sym=2)\nelse:\n raise ValueError('invalid property')\nself.mumps.set_silent()\ns...
<|body_start_0|> from ._mumps import DMumpsContext LinSolver.__init__(self, prop) self.name = 'mumps' if prop == self.UNSYMMETRIC: self.mumps = DMumpsContext(par=1, sym=0) elif prop == self.SYMMETRIC: self.mumps = DMumpsContext(par=1, sym=2) else: ...
Linear solver based on MUMPS.
LinSolverMUMPS
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinSolverMUMPS: """Linear solver based on MUMPS.""" def __init__(self, prop='unsymmetric'): """Linear solver based on MUMPS.""" <|body_0|> def analyze(self, A): """Analyzes structure of A. Parameters ---------- A : matrix For symmetric systems, should contain onl...
stack_v2_sparse_classes_36k_train_019867
2,725
permissive
[ { "docstring": "Linear solver based on MUMPS.", "name": "__init__", "signature": "def __init__(self, prop='unsymmetric')" }, { "docstring": "Analyzes structure of A. Parameters ---------- A : matrix For symmetric systems, should contain only lower diagonal part.", "name": "analyze", "sig...
5
stack_v2_sparse_classes_30k_train_021245
Implement the Python class `LinSolverMUMPS` described below. Class description: Linear solver based on MUMPS. Method signatures and docstrings: - def __init__(self, prop='unsymmetric'): Linear solver based on MUMPS. - def analyze(self, A): Analyzes structure of A. Parameters ---------- A : matrix For symmetric system...
Implement the Python class `LinSolverMUMPS` described below. Class description: Linear solver based on MUMPS. Method signatures and docstrings: - def __init__(self, prop='unsymmetric'): Linear solver based on MUMPS. - def analyze(self, A): Analyzes structure of A. Parameters ---------- A : matrix For symmetric system...
9103b99e6bc3517c7052ab075cbc5bdad310a25a
<|skeleton|> class LinSolverMUMPS: """Linear solver based on MUMPS.""" def __init__(self, prop='unsymmetric'): """Linear solver based on MUMPS.""" <|body_0|> def analyze(self, A): """Analyzes structure of A. Parameters ---------- A : matrix For symmetric systems, should contain onl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinSolverMUMPS: """Linear solver based on MUMPS.""" def __init__(self, prop='unsymmetric'): """Linear solver based on MUMPS.""" from ._mumps import DMumpsContext LinSolver.__init__(self, prop) self.name = 'mumps' if prop == self.UNSYMMETRIC: self.mumps ...
the_stack_v2_python_sparse
optalg/lin_solver/mumps.py
ttinoco/OPTALG
train
10
cd3b3d6a7bb19d188620791432a74139229a3d81
[ "if not a:\n return b[k]\nif not b:\n return a[k]\nia, ib = (len(a) // 2, len(b) // 2)\nma, mb = (a[ia], b[ib])\nif ia + ib < k:\n if ma > mb:\n return self.kth(a, b[ib + 1:], k - ib - 1)\n else:\n return self.kth(a[ia + 1:], b, k - ia - 1)\nelif ma > mb:\n return self.kth(a[:ia], b, k)...
<|body_start_0|> if not a: return b[k] if not b: return a[k] ia, ib = (len(a) // 2, len(b) // 2) ma, mb = (a[ia], b[ib]) if ia + ib < k: if ma > mb: return self.kth(a, b[ib + 1:], k - ib - 1) else: re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kth(self, a, b, k): """寻找两个排序数组中第k小的数 :param a: 数组1 :param b: 数组2 :param k: :return:""" <|body_0|> def findMedianSortedArrays(self, nums1, nums2): """奇数: 找出nums1, nums2中的第m+n//2大的数 偶数: eg: [1,2],[3,4,5,6] -> m+n=6, 中位数index:2,3 = (m+n)//2-1,(m+n)//2 :ty...
stack_v2_sparse_classes_36k_train_019868
2,704
no_license
[ { "docstring": "寻找两个排序数组中第k小的数 :param a: 数组1 :param b: 数组2 :param k: :return:", "name": "kth", "signature": "def kth(self, a, b, k)" }, { "docstring": "奇数: 找出nums1, nums2中的第m+n//2大的数 偶数: eg: [1,2],[3,4,5,6] -> m+n=6, 中位数index:2,3 = (m+n)//2-1,(m+n)//2 :type nums1: List[int] :type nums2: List[int...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kth(self, a, b, k): 寻找两个排序数组中第k小的数 :param a: 数组1 :param b: 数组2 :param k: :return: - def findMedianSortedArrays(self, nums1, nums2): 奇数: 找出nums1, nums2中的第m+n//2大的数 偶数: eg: [1,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kth(self, a, b, k): 寻找两个排序数组中第k小的数 :param a: 数组1 :param b: 数组2 :param k: :return: - def findMedianSortedArrays(self, nums1, nums2): 奇数: 找出nums1, nums2中的第m+n//2大的数 偶数: eg: [1,...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def kth(self, a, b, k): """寻找两个排序数组中第k小的数 :param a: 数组1 :param b: 数组2 :param k: :return:""" <|body_0|> def findMedianSortedArrays(self, nums1, nums2): """奇数: 找出nums1, nums2中的第m+n//2大的数 偶数: eg: [1,2],[3,4,5,6] -> m+n=6, 中位数index:2,3 = (m+n)//2-1,(m+n)//2 :ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kth(self, a, b, k): """寻找两个排序数组中第k小的数 :param a: 数组1 :param b: 数组2 :param k: :return:""" if not a: return b[k] if not b: return a[k] ia, ib = (len(a) // 2, len(b) // 2) ma, mb = (a[ia], b[ib]) if ia + ib < k: if m...
the_stack_v2_python_sparse
4_寻找两个有序数组的中位数.py
lovehhf/LeetCode
train
0
7fab7d663a19374823121e2d99e1a4af22498918
[ "super(ExclusionFilter, self).__init__(order)\nself.info = 'Filters search results based on a exclusion list.'\nself.exclusion_list_string = ' '.join(filter(str.isalpha, terms.replace('+', ' ').lower().split()))\nself.filter_fields = ['title', 'summary']\nfor field in customFields:\n self.filter_fields.append(fi...
<|body_start_0|> super(ExclusionFilter, self).__init__(order) self.info = 'Filters search results based on a exclusion list.' self.exclusion_list_string = ' '.join(filter(str.isalpha, terms.replace('+', ' ').lower().split())) self.filter_fields = ['title', 'summary'] for field in...
Filters search results based on a list of words to exclude, if any of these are found the result in question is rejected. Options: * order (int): defines when, in the pipeline, this filter will be executed * terms (str): terms that, if appearing in the result, will cause it to be rejected - separated by "+'s" * customF...
ExclusionFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExclusionFilter: """Filters search results based on a list of words to exclude, if any of these are found the result in question is rejected. Options: * order (int): defines when, in the pipeline, this filter will be executed * terms (str): terms that, if appearing in the result, will cause it to...
stack_v2_sparse_classes_36k_train_019869
3,745
permissive
[ { "docstring": "Constructor for ExclusionFilter.", "name": "__init__", "signature": "def __init__(self, order=0, terms='', customFields=[])" }, { "docstring": "Removes results that includes words contained in exclusion list. Parameters: * exclusion_list_string: terms which, if found, will cause ...
3
stack_v2_sparse_classes_30k_train_019892
Implement the Python class `ExclusionFilter` described below. Class description: Filters search results based on a list of words to exclude, if any of these are found the result in question is rejected. Options: * order (int): defines when, in the pipeline, this filter will be executed * terms (str): terms that, if ap...
Implement the Python class `ExclusionFilter` described below. Class description: Filters search results based on a list of words to exclude, if any of these are found the result in question is rejected. Options: * order (int): defines when, in the pipeline, this filter will be executed * terms (str): terms that, if ap...
ed72aee466649bd834d5b4459eb6e0173df6e2ec
<|skeleton|> class ExclusionFilter: """Filters search results based on a list of words to exclude, if any of these are found the result in question is rejected. Options: * order (int): defines when, in the pipeline, this filter will be executed * terms (str): terms that, if appearing in the result, will cause it to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExclusionFilter: """Filters search results based on a list of words to exclude, if any of these are found the result in question is rejected. Options: * order (int): defines when, in the pipeline, this filter will be executed * terms (str): terms that, if appearing in the result, will cause it to be rejected ...
the_stack_v2_python_sparse
reference-code/puppy/result/filter/exclusionfilter.py
Granvanoeli/ifind
train
0
4fc5b8a135c695c5b24b11096175f6145308383b
[ "\"\"\"\n :type name: str \n :rtype: int\n \"\"\"\nself.name = name", "self.prob = prob\nself.R = R\nif self.name == 'Binomial':\n return np.where(self.prob <= 1 - self.R, 1, 0)\nelse:\n print('Not available!')\n return []" ]
<|body_start_0|> """ :type name: str :rtype: int """ self.name = name <|end_body_0|> <|body_start_1|> self.prob = prob self.R = R if self.name == 'Binomial': return np.where(self.prob <= 1 - self.R, 1, 0) else:...
Indicator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Indicator: def __init__(self, name): """Constructor for this class.""" <|body_0|> def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> """ :type name: str ...
stack_v2_sparse_classes_36k_train_019870
771
permissive
[ { "docstring": "Constructor for this class.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": ":type pi: float :type R: float :rtype: int", "name": "Binary_Indicator", "signature": "def Binary_Indicator(self, prob, R)" } ]
2
stack_v2_sparse_classes_30k_train_014545
Implement the Python class `Indicator` described below. Class description: Implement the Indicator class. Method signatures and docstrings: - def __init__(self, name): Constructor for this class. - def Binary_Indicator(self, prob, R): :type pi: float :type R: float :rtype: int
Implement the Python class `Indicator` described below. Class description: Implement the Indicator class. Method signatures and docstrings: - def __init__(self, name): Constructor for this class. - def Binary_Indicator(self, prob, R): :type pi: float :type R: float :rtype: int <|skeleton|> class Indicator: def ...
0517780d05443cb77ce339db1854c298b87681e3
<|skeleton|> class Indicator: def __init__(self, name): """Constructor for this class.""" <|body_0|> def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Indicator: def __init__(self, name): """Constructor for this class.""" """ :type name: str :rtype: int """ self.name = name def Binary_Indicator(self, prob, R): """:type pi: float :type R: float :rtype: int""" self.p...
the_stack_v2_python_sparse
brdt/Indicator.py
ericchen12377/BRDT-Python
train
2
2d43ee9133a47b53caef7d151d3fb3622d3d8ba1
[ "self.test_data_true = dictionary_class_helper_true()\nself.test_data_false = dictionary_class_helper_false()\nself.sock_conn = socketconnection.SocketConnection(self.test_data_true.car_id)\nprint('Test suite: {}'.format(type(self).__name__))", "dict_to_test_true = self.test_data_true.get_socket_dictionary()\nret...
<|body_start_0|> self.test_data_true = dictionary_class_helper_true() self.test_data_false = dictionary_class_helper_false() self.sock_conn = socketconnection.SocketConnection(self.test_data_true.car_id) print('Test suite: {}'.format(type(self).__name__)) <|end_body_0|> <|body_start_1|>...
This class tests :mod:`socketconnection` and by implication, also tests :mod:`socketresponder` and :mod:`masterpiresponder`. As such, it tests the raw socket, and requires database interaction to pass. .. warning:: Some of these tests will FAIL if testing on the actual database unless the database is updated with the r...
TestSocketConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSocketConnection: """This class tests :mod:`socketconnection` and by implication, also tests :mod:`socketresponder` and :mod:`masterpiresponder`. As such, it tests the raw socket, and requires database interaction to pass. .. warning:: Some of these tests will FAIL if testing on the actual da...
stack_v2_sparse_classes_36k_train_019871
23,291
no_license
[ { "docstring": "It is necessary to instantiate the true data class and extract the relevant dictionary. A valid socket connection is also required.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the connection", "name": "test_socket_conn_true", "signature": "de...
3
null
Implement the Python class `TestSocketConnection` described below. Class description: This class tests :mod:`socketconnection` and by implication, also tests :mod:`socketresponder` and :mod:`masterpiresponder`. As such, it tests the raw socket, and requires database interaction to pass. .. warning:: Some of these test...
Implement the Python class `TestSocketConnection` described below. Class description: This class tests :mod:`socketconnection` and by implication, also tests :mod:`socketresponder` and :mod:`masterpiresponder`. As such, it tests the raw socket, and requires database interaction to pass. .. warning:: Some of these test...
8f68cc2a6ca568e803a6bfea49a452a5b0c1a2cf
<|skeleton|> class TestSocketConnection: """This class tests :mod:`socketconnection` and by implication, also tests :mod:`socketresponder` and :mod:`masterpiresponder`. As such, it tests the raw socket, and requires database interaction to pass. .. warning:: Some of these tests will FAIL if testing on the actual da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSocketConnection: """This class tests :mod:`socketconnection` and by implication, also tests :mod:`socketresponder` and :mod:`masterpiresponder`. As such, it tests the raw socket, and requires database interaction to pass. .. warning:: Some of these tests will FAIL if testing on the actual database unless...
the_stack_v2_python_sparse
AgentPi/agenttesting.py
JiewenGuan/Iot-Carshare
train
0
4c58f6ce4f5f92e69fa53334ce11acbf1e113b63
[ "if not event.collided_entity_id:\n return\nskill = self.entities.find_entity_by_id(event.entity_id)\ntarget = self.entities.find_entity_by_id(event.collided_entity_id)\nskill_damage_component = skill.components.get('damaging_skill', None)\nskill_target_component = skill.components.get('point_ranged_targeted_ski...
<|body_start_0|> if not event.collided_entity_id: return skill = self.entities.find_entity_by_id(event.entity_id) target = self.entities.find_entity_by_id(event.collided_entity_id) skill_damage_component = skill.components.get('damaging_skill', None) skill_target_comp...
Damaging skill system.
DamagingSkillSystem
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DamagingSkillSystem: """Damaging skill system.""" def on_entity_collision(self, event): """Handle an entity skill usage.""" <|body_0|> def on_entity_skill_usage(self, event): """Handle an entity skill usage.""" <|body_1|> def perform_damage(self, ent...
stack_v2_sparse_classes_36k_train_019872
21,180
permissive
[ { "docstring": "Handle an entity skill usage.", "name": "on_entity_collision", "signature": "def on_entity_collision(self, event)" }, { "docstring": "Handle an entity skill usage.", "name": "on_entity_skill_usage", "signature": "def on_entity_skill_usage(self, event)" }, { "docst...
3
stack_v2_sparse_classes_30k_val_000130
Implement the Python class `DamagingSkillSystem` described below. Class description: Damaging skill system. Method signatures and docstrings: - def on_entity_collision(self, event): Handle an entity skill usage. - def on_entity_skill_usage(self, event): Handle an entity skill usage. - def perform_damage(self, entity,...
Implement the Python class `DamagingSkillSystem` described below. Class description: Damaging skill system. Method signatures and docstrings: - def on_entity_collision(self, event): Handle an entity skill usage. - def on_entity_skill_usage(self, event): Handle an entity skill usage. - def perform_damage(self, entity,...
1d84c2869a242a112e57c6cafc6da7329f9d0808
<|skeleton|> class DamagingSkillSystem: """Damaging skill system.""" def on_entity_collision(self, event): """Handle an entity skill usage.""" <|body_0|> def on_entity_skill_usage(self, event): """Handle an entity skill usage.""" <|body_1|> def perform_damage(self, ent...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DamagingSkillSystem: """Damaging skill system.""" def on_entity_collision(self, event): """Handle an entity skill usage.""" if not event.collided_entity_id: return skill = self.entities.find_entity_by_id(event.entity_id) target = self.entities.find_entity_by_id...
the_stack_v2_python_sparse
akurra/skills.py
multatronic/akurra
train
0
99090aa4fad4c9ba36cc4895c2779a3f4498a7c4
[ "user = getattr(request._request, 'user', None)\nif not user or not user.is_active:\n return None\nself.enforce_csrf(request)\nreturn (user, None)", "reason = CSRFCheck().process_view(request, None, (), {})\nif reason:\n raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)" ]
<|body_start_0|> user = getattr(request._request, 'user', None) if not user or not user.is_active: return None self.enforce_csrf(request) return (user, None) <|end_body_0|> <|body_start_1|> reason = CSRFCheck().process_view(request, None, (), {}) if reason: ...
Use Django's session framework for authentication.
SessionAuthentication
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionAuthentication: """Use Django's session framework for authentication.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" <|body_0|> def enforce_csrf(self, request): ""...
stack_v2_sparse_classes_36k_train_019873
8,216
permissive
[ { "docstring": "Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.", "name": "authenticate", "signature": "def authenticate(self, request)" }, { "docstring": "Enforce CSRF validation for session based authentication.", "name": "enforce_csrf", ...
2
stack_v2_sparse_classes_30k_train_013688
Implement the Python class `SessionAuthentication` described below. Class description: Use Django's session framework for authentication. Method signatures and docstrings: - def authenticate(self, request): Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`. - def enforce...
Implement the Python class `SessionAuthentication` described below. Class description: Use Django's session framework for authentication. Method signatures and docstrings: - def authenticate(self, request): Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`. - def enforce...
7e3dedddbe821283d909393f333eed4acd452953
<|skeleton|> class SessionAuthentication: """Use Django's session framework for authentication.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" <|body_0|> def enforce_csrf(self, request): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SessionAuthentication: """Use Django's session framework for authentication.""" def authenticate(self, request): """Returns a `User` if the request session currently has a logged in user. Otherwise returns `None`.""" user = getattr(request._request, 'user', None) if not user or no...
the_stack_v2_python_sparse
api/authentication.py
erigones/esdc-ce
train
123
87ecd5518f3befb9afe7101947964df954e1d40e
[ "checked_choid: Set[ObjectId] = set()\nret: List[ChannelData] = []\nmissing = []\nch_oids = ProfileManager.get_users_exist_channel_dict([root_oid]).get(root_oid)\nif not ch_oids:\n return ret\nfor ch_model in ChannelManager.get_channel_default_name(keyword, hide_private=True):\n ch_oid = ch_model.id\n if c...
<|body_start_0|> checked_choid: Set[ObjectId] = set() ret: List[ChannelData] = [] missing = [] ch_oids = ProfileManager.get_users_exist_channel_dict([root_oid]).get(root_oid) if not ch_oids: return ret for ch_model in ChannelManager.get_channel_default_name(ke...
Class to search for any types of identity data.
IdentitySearcher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IdentitySearcher: """Class to search for any types of identity data.""" def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: """Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned resul...
stack_v2_sparse_classes_36k_train_019874
4,634
permissive
[ { "docstring": "Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned result will be sorted by last message time (DESC) then by its ID (DESC). ----------- ``keyword`` can be: - partial word from the message of a channel - a part of the d...
2
stack_v2_sparse_classes_30k_train_013799
Implement the Python class `IdentitySearcher` described below. Class description: Class to search for any types of identity data. Method signatures and docstrings: - def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: Search the channels that the user ``root_oid`` is inside using ``keyword``. T...
Implement the Python class `IdentitySearcher` described below. Class description: Class to search for any types of identity data. Method signatures and docstrings: - def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: Search the channels that the user ``root_oid`` is inside using ``keyword``. T...
c7da1e91783dce3a2b71b955b3a22b68db9056cf
<|skeleton|> class IdentitySearcher: """Class to search for any types of identity data.""" def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: """Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned resul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IdentitySearcher: """Class to search for any types of identity data.""" def search_channel(keyword: str, root_oid: ObjectId) -> List[ChannelData]: """Search the channels that the user ``root_oid`` is inside using ``keyword``. This search **hides** all private channels. Returned result will be sor...
the_stack_v2_python_sparse
mongodb/helper/search.py
RxJellyBot/Jelly-Bot
train
5
ce2a3ecf1244f542f8f25a4a40481236a16f5041
[ "try:\n response_root = response['body'].get('responseData', {})\n user_id = request.get('UserID', None)\n media_category = request.get('MediaCategory', None)\n media_s3_url = response_root.get('MediaS3URL', None)\n data_map = {'user_id': user_id, 'media_category': media_category, 'media_s3_url': med...
<|body_start_0|> try: response_root = response['body'].get('responseData', {}) user_id = request.get('UserID', None) media_category = request.get('MediaCategory', None) media_s3_url = response_root.get('MediaS3URL', None) data_map = {'user_id': user_id...
DBhandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBhandler: def prepare_user_media_data_map(self, request=None, response=None): """prepare_user_media_data_map() => Preapares Data Map to insert data in 'user_media' table. params => request (object, EventBodyData), response (object, Issue response object)""" <|body_0|> def i...
stack_v2_sparse_classes_36k_train_019875
4,941
no_license
[ { "docstring": "prepare_user_media_data_map() => Preapares Data Map to insert data in 'user_media' table. params => request (object, EventBodyData), response (object, Issue response object)", "name": "prepare_user_media_data_map", "signature": "def prepare_user_media_data_map(self, request=None, respons...
2
null
Implement the Python class `DBhandler` described below. Class description: Implement the DBhandler class. Method signatures and docstrings: - def prepare_user_media_data_map(self, request=None, response=None): prepare_user_media_data_map() => Preapares Data Map to insert data in 'user_media' table. params => request ...
Implement the Python class `DBhandler` described below. Class description: Implement the DBhandler class. Method signatures and docstrings: - def prepare_user_media_data_map(self, request=None, response=None): prepare_user_media_data_map() => Preapares Data Map to insert data in 'user_media' table. params => request ...
bbe7c7e74313ed63d7765a16cf11fdf7f3ad706a
<|skeleton|> class DBhandler: def prepare_user_media_data_map(self, request=None, response=None): """prepare_user_media_data_map() => Preapares Data Map to insert data in 'user_media' table. params => request (object, EventBodyData), response (object, Issue response object)""" <|body_0|> def i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DBhandler: def prepare_user_media_data_map(self, request=None, response=None): """prepare_user_media_data_map() => Preapares Data Map to insert data in 'user_media' table. params => request (object, EventBodyData), response (object, Issue response object)""" try: response_root = re...
the_stack_v2_python_sparse
skytrip/user_media/db_handler.py
NumanIbnMazid/reservation
train
1
5f565405eb588aac72b19d4ccb47838ed671753d
[ "rows, cols = (len(grid), len(grid[0]))\ndp = [[0] * cols for _ in range(rows)]\nfor row in range(rows - 1, -1, -1):\n for col in range(cols - 1, -1, -1):\n if row == rows - 1 and col != cols - 1:\n dp[row][col] = grid[row][col] + dp[row][col + 1]\n elif row != rows - 1 and col == cols -...
<|body_start_0|> rows, cols = (len(grid), len(grid[0])) dp = [[0] * cols for _ in range(rows)] for row in range(rows - 1, -1, -1): for col in range(cols - 1, -1, -1): if row == rows - 1 and col != cols - 1: dp[row][col] = grid[row][col] + dp[row][c...
Grid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grid: def minimum_path_sum_2d(self, grid: List[List[int]]) -> int: """Approach: DP (2 D Array) Time Complexity: O(MN) Space Complexity: O(MN) :param grid: :return:""" <|body_0|> def minimum_path_sum_1d(self, grid: List[List[int]]) -> int: """Approach: DP (1D Array) T...
stack_v2_sparse_classes_36k_train_019876
2,968
no_license
[ { "docstring": "Approach: DP (2 D Array) Time Complexity: O(MN) Space Complexity: O(MN) :param grid: :return:", "name": "minimum_path_sum_2d", "signature": "def minimum_path_sum_2d(self, grid: List[List[int]]) -> int" }, { "docstring": "Approach: DP (1D Array) Time Complexity: O(MN) Space Comple...
3
null
Implement the Python class `Grid` described below. Class description: Implement the Grid class. Method signatures and docstrings: - def minimum_path_sum_2d(self, grid: List[List[int]]) -> int: Approach: DP (2 D Array) Time Complexity: O(MN) Space Complexity: O(MN) :param grid: :return: - def minimum_path_sum_1d(self,...
Implement the Python class `Grid` described below. Class description: Implement the Grid class. Method signatures and docstrings: - def minimum_path_sum_2d(self, grid: List[List[int]]) -> int: Approach: DP (2 D Array) Time Complexity: O(MN) Space Complexity: O(MN) :param grid: :return: - def minimum_path_sum_1d(self,...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Grid: def minimum_path_sum_2d(self, grid: List[List[int]]) -> int: """Approach: DP (2 D Array) Time Complexity: O(MN) Space Complexity: O(MN) :param grid: :return:""" <|body_0|> def minimum_path_sum_1d(self, grid: List[List[int]]) -> int: """Approach: DP (1D Array) T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grid: def minimum_path_sum_2d(self, grid: List[List[int]]) -> int: """Approach: DP (2 D Array) Time Complexity: O(MN) Space Complexity: O(MN) :param grid: :return:""" rows, cols = (len(grid), len(grid[0])) dp = [[0] * cols for _ in range(rows)] for row in range(rows - 1, -1, -1...
the_stack_v2_python_sparse
goldman_sachs/minimum_path_sum.py
Shiv2157k/leet_code
train
1
0ab0d79fde37438672846d9bdd2494e494043d58
[ "initial_position = m3.pit.user_readback.get()\nnum = [31]\nstart = [-0.001]\nstop = [0.001]\nvertical = 30\nhorizontal = [75]\ninitial_vertical = extslt.vg.position\ninitial_horizontal = extslt.hg.position\ninitial_gcdiagy = gcdiag.y.position\nyield from gcdiag.grid\nyield from mv(extslt.vg, vertical)\nfor i in ra...
<|body_start_0|> initial_position = m3.pit.user_readback.get() num = [31] start = [-0.001] stop = [0.001] vertical = 30 horizontal = [75] initial_vertical = extslt.vg.position initial_horizontal = extslt.hg.position initial_gcdiagy = gcdiag.y.posit...
Defines class for alignment scans. Defines all attribute functions to align the beamline.
align_class
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class align_class: """Defines class for alignment scans. Defines all attribute functions to align the beamline.""" def m3pit(self): """Aligns mirror M3 in three scans with increasing accuracy. Performs M3.pit scan detected at gcdiag.grid in three scans with decreasing range and exit slits,...
stack_v2_sparse_classes_36k_train_019877
4,385
permissive
[ { "docstring": "Aligns mirror M3 in three scans with increasing accuracy. Performs M3.pit scan detected at gcdiag.grid in three scans with decreasing range and exit slits, but increasing accuracy. Parameters ---------- position : float, output position of the peak found after each M3 pitch scan, and is printed ...
2
stack_v2_sparse_classes_30k_train_011565
Implement the Python class `align_class` described below. Class description: Defines class for alignment scans. Defines all attribute functions to align the beamline. Method signatures and docstrings: - def m3pit(self): Aligns mirror M3 in three scans with increasing accuracy. Performs M3.pit scan detected at gcdiag....
Implement the Python class `align_class` described below. Class description: Defines class for alignment scans. Defines all attribute functions to align the beamline. Method signatures and docstrings: - def m3pit(self): Aligns mirror M3 in three scans with increasing accuracy. Performs M3.pit scan detected at gcdiag....
7cbd3ad2e1675aa14099be0aab00a6516ce7981d
<|skeleton|> class align_class: """Defines class for alignment scans. Defines all attribute functions to align the beamline.""" def m3pit(self): """Aligns mirror M3 in three scans with increasing accuracy. Performs M3.pit scan detected at gcdiag.grid in three scans with decreasing range and exit slits,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class align_class: """Defines class for alignment scans. Defines all attribute functions to align the beamline.""" def m3pit(self): """Aligns mirror M3 in three scans with increasing accuracy. Performs M3.pit scan detected at gcdiag.grid in three scans with decreasing range and exit slits, but increasi...
the_stack_v2_python_sparse
startup/43-alignment_scans.py
NSLS-II-SIX/profile_collection
train
0
2ceae4d80edc8730bb994e6beb8da69a0ef13202
[ "if kernel == 'multivariate_gaussian':\n kernel = ms_utils.multivariate_gaussian_kernel\nelif kernel == 'epanechnikov_kernel':\n kernel = ms_utils.epanechnikov_kernel\nself.kernel = kernel", "if iteration_callback:\n iteration_callback(points, 0)\nshift_points = np.array(points)\nmax_min_dist = 1\ndist =...
<|body_start_0|> if kernel == 'multivariate_gaussian': kernel = ms_utils.multivariate_gaussian_kernel elif kernel == 'epanechnikov_kernel': kernel = ms_utils.epanechnikov_kernel self.kernel = kernel <|end_body_0|> <|body_start_1|> if iteration_callback: ...
MeanShift
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeanShift: def __init__(self, kernel=ms_utils.gaussian_kernel): """Inicializa el objeto meanshift, con un kernel""" <|body_0|> def cluster(self, points, distance, kernel_bandwidth, iteration_callback=None): """Recibe una lista de puntos, el tamaño de la distancia a t...
stack_v2_sparse_classes_36k_train_019878
3,781
no_license
[ { "docstring": "Inicializa el objeto meanshift, con un kernel", "name": "__init__", "signature": "def __init__(self, kernel=ms_utils.gaussian_kernel)" }, { "docstring": "Recibe una lista de puntos, el tamaño de la distancia a tener en cuenta al utilizar el Kernel, y un parametro para sacar los e...
3
stack_v2_sparse_classes_30k_train_004096
Implement the Python class `MeanShift` described below. Class description: Implement the MeanShift class. Method signatures and docstrings: - def __init__(self, kernel=ms_utils.gaussian_kernel): Inicializa el objeto meanshift, con un kernel - def cluster(self, points, distance, kernel_bandwidth, iteration_callback=No...
Implement the Python class `MeanShift` described below. Class description: Implement the MeanShift class. Method signatures and docstrings: - def __init__(self, kernel=ms_utils.gaussian_kernel): Inicializa el objeto meanshift, con un kernel - def cluster(self, points, distance, kernel_bandwidth, iteration_callback=No...
50df5e9566ec3a08a5096ca1b0e926db30f70761
<|skeleton|> class MeanShift: def __init__(self, kernel=ms_utils.gaussian_kernel): """Inicializa el objeto meanshift, con un kernel""" <|body_0|> def cluster(self, points, distance, kernel_bandwidth, iteration_callback=None): """Recibe una lista de puntos, el tamaño de la distancia a t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeanShift: def __init__(self, kernel=ms_utils.gaussian_kernel): """Inicializa el objeto meanshift, con un kernel""" if kernel == 'multivariate_gaussian': kernel = ms_utils.multivariate_gaussian_kernel elif kernel == 'epanechnikov_kernel': kernel = ms_utils.epane...
the_stack_v2_python_sparse
pid/mean_shift_epanechnikov.py
frapercan/PID
train
1
07ed1f04c28173d59c618436933b0aa8b8452066
[ "self.verbose = verbose\nif self.verbose:\n print('Loading lookup tables from', filename)\ngrid, bins, template = self.parse_fits_table(filename)\nx_bins, y_bins = bins\nself.interpolator = interpolate.LinearNDInterpolator(grid, template, fill_value=0)\nself.nearest_interpolator = interpolate.NearestNDInterpolat...
<|body_start_0|> self.verbose = verbose if self.verbose: print('Loading lookup tables from', filename) grid, bins, template = self.parse_fits_table(filename) x_bins, y_bins = bins self.interpolator = interpolate.LinearNDInterpolator(grid, template, fill_value=0) ...
This is a simple class for loading lookup tables from a fits file and interpolating between them
TableInterpolator
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableInterpolator: """This is a simple class for loading lookup tables from a fits file and interpolating between them""" def __init__(self, filename, verbose=1): """Initialisation of class to load templates from a file and create the interpolation objects Parameters ---------- filen...
stack_v2_sparse_classes_36k_train_019879
5,703
permissive
[ { "docstring": "Initialisation of class to load templates from a file and create the interpolation objects Parameters ---------- filename: string Location of Template file verbose: int Verbosity level, 0 = no logging 1 = File + interpolation point information 2 = Detailed description of interpolation points", ...
4
stack_v2_sparse_classes_30k_train_013180
Implement the Python class `TableInterpolator` described below. Class description: This is a simple class for loading lookup tables from a fits file and interpolating between them Method signatures and docstrings: - def __init__(self, filename, verbose=1): Initialisation of class to load templates from a file and cre...
Implement the Python class `TableInterpolator` described below. Class description: This is a simple class for loading lookup tables from a fits file and interpolating between them Method signatures and docstrings: - def __init__(self, filename, verbose=1): Initialisation of class to load templates from a file and cre...
10b058f8dcc166177d1eb5b2af638ca37722a021
<|skeleton|> class TableInterpolator: """This is a simple class for loading lookup tables from a fits file and interpolating between them""" def __init__(self, filename, verbose=1): """Initialisation of class to load templates from a file and create the interpolation objects Parameters ---------- filen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TableInterpolator: """This is a simple class for loading lookup tables from a fits file and interpolating between them""" def __init__(self, filename, verbose=1): """Initialisation of class to load templates from a file and create the interpolation objects Parameters ---------- filename: string L...
the_stack_v2_python_sparse
ctapipe/utils/table_interpolator.py
cta-sst-1m/ctapipe
train
1
7bd3067a99964878918d4302e738b48b829d8fc1
[ "result = self._get_html(page_name)\nif result['success']:\n result['content'] = self._tidy_html(result['content'])\nreturn result", "error_message = ''\nurl = 'https://en.wikipedia.org/wiki/%s' % page_name\ntry:\n response = requests.get(url, params={'action': 'render'}, timeout=5)\nexcept requests.excepti...
<|body_start_0|> result = self._get_html(page_name) if result['success']: result['content'] = self._tidy_html(result['content']) return result <|end_body_0|> <|body_start_1|> error_message = '' url = 'https://en.wikipedia.org/wiki/%s' % page_name try: ...
WikipediaFetcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WikipediaFetcher: def fetch(self, page_name): """Passed a Wikipedia page's URL fragment, like 'Edward_Montagu,_1st_Earl_of_Sandwich', this will fetch the page's main contents, tidy the HTML, strip out any elements we don't want and return the final HTML string. Returns a dict with two el...
stack_v2_sparse_classes_36k_train_019880
7,254
no_license
[ { "docstring": "Passed a Wikipedia page's URL fragment, like 'Edward_Montagu,_1st_Earl_of_Sandwich', this will fetch the page's main contents, tidy the HTML, strip out any elements we don't want and return the final HTML string. Returns a dict with two elements: 'success' is either True or, if we couldn't fetch...
5
stack_v2_sparse_classes_30k_train_007437
Implement the Python class `WikipediaFetcher` described below. Class description: Implement the WikipediaFetcher class. Method signatures and docstrings: - def fetch(self, page_name): Passed a Wikipedia page's URL fragment, like 'Edward_Montagu,_1st_Earl_of_Sandwich', this will fetch the page's main contents, tidy th...
Implement the Python class `WikipediaFetcher` described below. Class description: Implement the WikipediaFetcher class. Method signatures and docstrings: - def fetch(self, page_name): Passed a Wikipedia page's URL fragment, like 'Edward_Montagu,_1st_Earl_of_Sandwich', this will fetch the page's main contents, tidy th...
c6d99f39046eb5309f3292bfb4edb8b008f37aeb
<|skeleton|> class WikipediaFetcher: def fetch(self, page_name): """Passed a Wikipedia page's URL fragment, like 'Edward_Montagu,_1st_Earl_of_Sandwich', this will fetch the page's main contents, tidy the HTML, strip out any elements we don't want and return the final HTML string. Returns a dict with two el...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WikipediaFetcher: def fetch(self, page_name): """Passed a Wikipedia page's URL fragment, like 'Edward_Montagu,_1st_Earl_of_Sandwich', this will fetch the page's main contents, tidy the HTML, strip out any elements we don't want and return the final HTML string. Returns a dict with two elements: 'succe...
the_stack_v2_python_sparse
pepysdiary/encyclopedia/wikipedia_fetcher.py
philgyford/pepysdiary
train
16
16ed1c8825d10f9148d9f33084c8e49d67afbe07
[ "@lru_cache(None)\ndef dfs(index: int) -> int:\n if index == n:\n return 0\n curMax, remain = (0, shelfWidth)\n res = INF\n for select in range(1, n - index + 1):\n width, height = books[index + select - 1]\n if width > remain:\n break\n curMax = max(curMax, height...
<|body_start_0|> @lru_cache(None) def dfs(index: int) -> int: if index == n: return 0 curMax, remain = (0, shelfWidth) res = INF for select in range(1, n - index + 1): width, height = books[index + select - 1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int: """O(n^2) dfs[i]表示前i本书的高度之和最小值""" <|body_0|> def minHeightShelves2(self, books: List[List[int]], shelfWidth: int) -> int: """O(n^2) dp[i]表示前i本书的最小高度之和""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_019881
2,367
no_license
[ { "docstring": "O(n^2) dfs[i]表示前i本书的高度之和最小值", "name": "minHeightShelves", "signature": "def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int" }, { "docstring": "O(n^2) dp[i]表示前i本书的最小高度之和", "name": "minHeightShelves2", "signature": "def minHeightShelves2(self, books:...
2
stack_v2_sparse_classes_30k_train_017743
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int: O(n^2) dfs[i]表示前i本书的高度之和最小值 - def minHeightShelves2(self, books: List[List[int]], shelfWidth: int) -> ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int: O(n^2) dfs[i]表示前i本书的高度之和最小值 - def minHeightShelves2(self, books: List[List[int]], shelfWidth: int) -> ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int: """O(n^2) dfs[i]表示前i本书的高度之和最小值""" <|body_0|> def minHeightShelves2(self, books: List[List[int]], shelfWidth: int) -> int: """O(n^2) dp[i]表示前i本书的最小高度之和""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minHeightShelves(self, books: List[List[int]], shelfWidth: int) -> int: """O(n^2) dfs[i]表示前i本书的高度之和最小值""" @lru_cache(None) def dfs(index: int) -> int: if index == n: return 0 curMax, remain = (0, shelfWidth) res = INF ...
the_stack_v2_python_sparse
11_动态规划/经典题/dfs+cache/1105. 填充书架..py
981377660LMT/algorithm-study
train
225
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_36k_train_019882
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
null
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_36k
data/stack_v2_sparse_classes_30k
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
e9c588c0f89c88cde8b41fb80b30db5f372bac47
[ "config = kwargs.pop('config', None)\nif config is not None:\n self.config = config\nsuper(Configurable, self).__init__(**kwargs)\nself.created = datetime.datetime.now()", "traits = self.traits(config=True)\nsection_names = [cls.__name__ for cls in reversed(self.__class__.__mro__) if issubclass(cls, Configurab...
<|body_start_0|> config = kwargs.pop('config', None) if config is not None: self.config = config super(Configurable, self).__init__(**kwargs) self.created = datetime.datetime.now() <|end_body_0|> <|body_start_1|> traits = self.traits(config=True) section_name...
Configurable
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configurable: def __init__(self, **kwargs): """Create a conigurable given a config config. Parameters ---------- config : Config If this is empty, default values are used. If config is a :class:`Config` instance, it will be used to configure the instance. Notes ----- Subclasses of Config...
stack_v2_sparse_classes_36k_train_019883
5,849
permissive
[ { "docstring": "Create a conigurable given a config config. Parameters ---------- config : Config If this is empty, default values are used. If config is a :class:`Config` instance, it will be used to configure the instance. Notes ----- Subclasses of Configurable must call the :meth:`__init__` method of :class:...
2
stack_v2_sparse_classes_30k_train_015071
Implement the Python class `Configurable` described below. Class description: Implement the Configurable class. Method signatures and docstrings: - def __init__(self, **kwargs): Create a conigurable given a config config. Parameters ---------- config : Config If this is empty, default values are used. If config is a ...
Implement the Python class `Configurable` described below. Class description: Implement the Configurable class. Method signatures and docstrings: - def __init__(self, **kwargs): Create a conigurable given a config config. Parameters ---------- config : Config If this is empty, default values are used. If config is a ...
1cf44de3833929a4cf9e0069e8c75ef9086eeaca
<|skeleton|> class Configurable: def __init__(self, **kwargs): """Create a conigurable given a config config. Parameters ---------- config : Config If this is empty, default values are used. If config is a :class:`Config` instance, it will be used to configure the instance. Notes ----- Subclasses of Config...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Configurable: def __init__(self, **kwargs): """Create a conigurable given a config config. Parameters ---------- config : Config If this is empty, default values are used. If config is a :class:`Config` instance, it will be used to configure the instance. Notes ----- Subclasses of Configurable must ca...
the_stack_v2_python_sparse
IPython/config/configurable.py
omazapa/ipython
train
3
b30b7ffe0406cbe4b5e32d45b05eebd33b047780
[ "dtype = bittensor.serializer.torch_dtype_to_bittensor_dtype(torch_tensor.dtype)\nshape = list(torch_tensor.shape)\ntorch_numpy = torch_tensor.cpu().detach().numpy().copy()\ndata_buffer = msgpack.packb(torch_numpy, default=msgpack_numpy.encode)\ntorch_proto = bittensor.proto.Tensor(version=bittensor.__version_as_in...
<|body_start_0|> dtype = bittensor.serializer.torch_dtype_to_bittensor_dtype(torch_tensor.dtype) shape = list(torch_tensor.shape) torch_numpy = torch_tensor.cpu().detach().numpy().copy() data_buffer = msgpack.packb(torch_numpy, default=msgpack_numpy.encode) torch_proto = bittenso...
Make conversion between torch and bittensor.proto.torch
MSGPackSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MSGPackSerializer: """Make conversion between torch and bittensor.proto.torch""" def serialize_from_torch(self, torch_tensor: torch.Tensor, modality: bittensor.proto.Modality) -> bittensor.proto.Tensor: """Serializes a torch.Tensor to an bittensor Tensor proto. Args: torch_tensor (to...
stack_v2_sparse_classes_36k_train_019884
8,656
permissive
[ { "docstring": "Serializes a torch.Tensor to an bittensor Tensor proto. Args: torch_tensor (torch.Tensor): Torch tensor to serialize. modality (bittensor.proto.Modality): Datatype modality. i.e. TENSOR, TEXT, IMAGE Returns: bittensor.proto.Tensor: The serialized torch tensor as bittensor.proto.proto.", "nam...
2
stack_v2_sparse_classes_30k_train_001394
Implement the Python class `MSGPackSerializer` described below. Class description: Make conversion between torch and bittensor.proto.torch Method signatures and docstrings: - def serialize_from_torch(self, torch_tensor: torch.Tensor, modality: bittensor.proto.Modality) -> bittensor.proto.Tensor: Serializes a torch.Te...
Implement the Python class `MSGPackSerializer` described below. Class description: Make conversion between torch and bittensor.proto.torch Method signatures and docstrings: - def serialize_from_torch(self, torch_tensor: torch.Tensor, modality: bittensor.proto.Modality) -> bittensor.proto.Tensor: Serializes a torch.Te...
9e6d2b9c6447e485b06a5def12a3e9f197735301
<|skeleton|> class MSGPackSerializer: """Make conversion between torch and bittensor.proto.torch""" def serialize_from_torch(self, torch_tensor: torch.Tensor, modality: bittensor.proto.Modality) -> bittensor.proto.Tensor: """Serializes a torch.Tensor to an bittensor Tensor proto. Args: torch_tensor (to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MSGPackSerializer: """Make conversion between torch and bittensor.proto.torch""" def serialize_from_torch(self, torch_tensor: torch.Tensor, modality: bittensor.proto.Modality) -> bittensor.proto.Tensor: """Serializes a torch.Tensor to an bittensor Tensor proto. Args: torch_tensor (torch.Tensor): ...
the_stack_v2_python_sparse
bittensor/_serializer/serializer_impl.py
shnwang/bittensor
train
0
414491573713102416641f6723f66354db6ac025
[ "obj = _GA(self, 'db_account')\nif not obj:\n obj = _GA(self, 'db_obj')\nreturn obj", "try:\n value = _GA(value, 'dbobj')\nexcept AttributeError:\n pass\nif isinstance(value, (str, int)):\n value = to_str(value)\n if value.isdigit() or value.startswith('#'):\n dbid = dbref(value, reqhash=Fal...
<|body_start_0|> obj = _GA(self, 'db_account') if not obj: obj = _GA(self, 'db_obj') return obj <|end_body_0|> <|body_start_1|> try: value = _GA(value, 'dbobj') except AttributeError: pass if isinstance(value, (str, int)): ...
The Script database representation. The TypedObject supplies the following (inherited) properties: key - main name name - alias for key typeclass_path - the path to the decorating typeclass typeclass - auto-linked typeclass date_created - time stamp of object creation permissions - perm strings dbref - #id of object db...
ScriptDB
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScriptDB: """The Script database representation. The TypedObject supplies the following (inherited) properties: key - main name name - alias for key typeclass_path - the path to the decorating typeclass typeclass - auto-linked typeclass date_created - time stamp of object creation permissions - p...
stack_v2_sparse_classes_36k_train_019885
6,311
permissive
[ { "docstring": "Property wrapper that homogenizes access to either the db_account or db_obj field, using the same object property name.", "name": "__get_obj", "signature": "def __get_obj(self)" }, { "docstring": "Set account or obj to their right database field. If a dbref is given, assume Objec...
2
null
Implement the Python class `ScriptDB` described below. Class description: The Script database representation. The TypedObject supplies the following (inherited) properties: key - main name name - alias for key typeclass_path - the path to the decorating typeclass typeclass - auto-linked typeclass date_created - time s...
Implement the Python class `ScriptDB` described below. Class description: The Script database representation. The TypedObject supplies the following (inherited) properties: key - main name name - alias for key typeclass_path - the path to the decorating typeclass typeclass - auto-linked typeclass date_created - time s...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class ScriptDB: """The Script database representation. The TypedObject supplies the following (inherited) properties: key - main name name - alias for key typeclass_path - the path to the decorating typeclass typeclass - auto-linked typeclass date_created - time stamp of object creation permissions - p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScriptDB: """The Script database representation. The TypedObject supplies the following (inherited) properties: key - main name name - alias for key typeclass_path - the path to the decorating typeclass typeclass - auto-linked typeclass date_created - time stamp of object creation permissions - perm strings d...
the_stack_v2_python_sparse
evennia/scripts/models.py
evennia/evennia
train
1,781
bfb32d878a18808b86090dc954a3b22c835bf830
[ "body1 = {'reqId': get_uuid(), 'areaCode': 'T1AJ', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'}\na = api_v1_analysis_channel_efficiency(body1)\ndict_data = json.loads(a)\nself.assertEqual(None, dict_data['result'])", "body1 = {'reqId': get_uuid(), 'areaCode': 'T1AJ', 'startTime': '201...
<|body_start_0|> body1 = {'reqId': get_uuid(), 'areaCode': 'T1AJ', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'} a = api_v1_analysis_channel_efficiency(body1) dict_data = json.loads(a) self.assertEqual(None, dict_data['result']) <|end_body_0|> <|body_start_1|...
2.4.9.1安检通道基础流量查询
TestApiAnalysisChannelEfficiency
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestApiAnalysisChannelEfficiency: """2.4.9.1安检通道基础流量查询""" def test_01(self): """验证正确传入参数时能返回安检通道基础流量数据""" <|body_0|> def test_02(self): """验证查询非有效时间内不能查询到安检通道基础流量数据""" <|body_1|> def test_03(self): """验证区域通道不存在时,不能查到安检通道基础流量数据""" <|bo...
stack_v2_sparse_classes_36k_train_019886
2,745
no_license
[ { "docstring": "验证正确传入参数时能返回安检通道基础流量数据", "name": "test_01", "signature": "def test_01(self)" }, { "docstring": "验证查询非有效时间内不能查询到安检通道基础流量数据", "name": "test_02", "signature": "def test_02(self)" }, { "docstring": "验证区域通道不存在时,不能查到安检通道基础流量数据", "name": "test_03", "signature": "...
5
null
Implement the Python class `TestApiAnalysisChannelEfficiency` described below. Class description: 2.4.9.1安检通道基础流量查询 Method signatures and docstrings: - def test_01(self): 验证正确传入参数时能返回安检通道基础流量数据 - def test_02(self): 验证查询非有效时间内不能查询到安检通道基础流量数据 - def test_03(self): 验证区域通道不存在时,不能查到安检通道基础流量数据 - def test_04(self): 验证startTi...
Implement the Python class `TestApiAnalysisChannelEfficiency` described below. Class description: 2.4.9.1安检通道基础流量查询 Method signatures and docstrings: - def test_01(self): 验证正确传入参数时能返回安检通道基础流量数据 - def test_02(self): 验证查询非有效时间内不能查询到安检通道基础流量数据 - def test_03(self): 验证区域通道不存在时,不能查到安检通道基础流量数据 - def test_04(self): 验证startTi...
aa0749f4a237ee76a61579dc5984635a7127a631
<|skeleton|> class TestApiAnalysisChannelEfficiency: """2.4.9.1安检通道基础流量查询""" def test_01(self): """验证正确传入参数时能返回安检通道基础流量数据""" <|body_0|> def test_02(self): """验证查询非有效时间内不能查询到安检通道基础流量数据""" <|body_1|> def test_03(self): """验证区域通道不存在时,不能查到安检通道基础流量数据""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestApiAnalysisChannelEfficiency: """2.4.9.1安检通道基础流量查询""" def test_01(self): """验证正确传入参数时能返回安检通道基础流量数据""" body1 = {'reqId': get_uuid(), 'areaCode': 'T1AJ', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'} a = api_v1_analysis_channel_efficiency(body1) ...
the_stack_v2_python_sparse
Airport/Auto_return/TestCase/test_data_platform_091.py
jingshiyue/zhongkeyuan_workspace
train
0
62a972c544b7955e5deb20480fc1b2abf84e55e3
[ "super().__init__(**kwargs)\nself.dataset_name = DATASET\nself.partset_source = PARTPATH\nself.images_source = IMGPATH\nself.negatives = 2\nself.naugment = 2\nself.parse_arguments(argv)", "parser = argparse.ArgumentParser(description='Runs a experiment')\nparser.add_argument('--combine', action='store_true')\npar...
<|body_start_0|> super().__init__(**kwargs) self.dataset_name = DATASET self.partset_source = PARTPATH self.images_source = IMGPATH self.negatives = 2 self.naugment = 2 self.parse_arguments(argv) <|end_body_0|> <|body_start_1|> parser = argparse.ArgumentP...
A class to generate training and test data from the PascalPartSet.
Generator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """A class to generate training and test data from the PascalPartSet.""" def __init__(self, argv, **kwargs): """Initialize the new experiment from the cli args Args: argv (str): The options string""" <|body_0|> def parse_arguments(self, argv): """Parse...
stack_v2_sparse_classes_36k_train_019887
1,902
permissive
[ { "docstring": "Initialize the new experiment from the cli args Args: argv (str): The options string", "name": "__init__", "signature": "def __init__(self, argv, **kwargs)" }, { "docstring": "Parse the arguments for an experiment script", "name": "parse_arguments", "signature": "def pars...
3
stack_v2_sparse_classes_30k_train_014147
Implement the Python class `Generator` described below. Class description: A class to generate training and test data from the PascalPartSet. Method signatures and docstrings: - def __init__(self, argv, **kwargs): Initialize the new experiment from the cli args Args: argv (str): The options string - def parse_argumen...
Implement the Python class `Generator` described below. Class description: A class to generate training and test data from the PascalPartSet. Method signatures and docstrings: - def __init__(self, argv, **kwargs): Initialize the new experiment from the cli args Args: argv (str): The options string - def parse_argumen...
4fec329000af041b7f24f31f485c2a3fadf0ff66
<|skeleton|> class Generator: """A class to generate training and test data from the PascalPartSet.""" def __init__(self, argv, **kwargs): """Initialize the new experiment from the cli args Args: argv (str): The options string""" <|body_0|> def parse_arguments(self, argv): """Parse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: """A class to generate training and test data from the PascalPartSet.""" def __init__(self, argv, **kwargs): """Initialize the new experiment from the cli args Args: argv (str): The options string""" super().__init__(**kwargs) self.dataset_name = DATASET self.pa...
the_stack_v2_python_sparse
ba/data.py
morris-frank/bachelor-thesis
train
0
9fc802374ab633245ea8ef5d10208cd15e294317
[ "def dfs(index, num, digit):\n if index == digit:\n res.append(int(''.join(num)))\n return\n for i in range(10):\n num.append(str(i))\n dfs(index + 1, num, digit)\n num.pop()\nres = []\nfor digit in range(1, n + 1):\n for first in range(1, 10):\n num = [str(first)]...
<|body_start_0|> def dfs(index, num, digit): if index == digit: res.append(int(''.join(num))) return for i in range(10): num.append(str(i)) dfs(index + 1, num, digit) num.pop() res = [] for di...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def printNumbers(self, n): """:type n: int :rtype: List[int] 全排列""" <|body_0|> def printNumbers0(self, n): """:type n: int :rtype: List[int] 队列""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(index, num, digit): if inde...
stack_v2_sparse_classes_36k_train_019888
1,638
no_license
[ { "docstring": ":type n: int :rtype: List[int] 全排列", "name": "printNumbers", "signature": "def printNumbers(self, n)" }, { "docstring": ":type n: int :rtype: List[int] 队列", "name": "printNumbers0", "signature": "def printNumbers0(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_000686
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printNumbers(self, n): :type n: int :rtype: List[int] 全排列 - def printNumbers0(self, n): :type n: int :rtype: List[int] 队列
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def printNumbers(self, n): :type n: int :rtype: List[int] 全排列 - def printNumbers0(self, n): :type n: int :rtype: List[int] 队列 <|skeleton|> class Solution: def printNumbers(...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def printNumbers(self, n): """:type n: int :rtype: List[int] 全排列""" <|body_0|> def printNumbers0(self, n): """:type n: int :rtype: List[int] 队列""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def printNumbers(self, n): """:type n: int :rtype: List[int] 全排列""" def dfs(index, num, digit): if index == digit: res.append(int(''.join(num))) return for i in range(10): num.append(str(i)) dfs(i...
the_stack_v2_python_sparse
剑指 Offer 17. 打印从1到最大的n位数.py
yangyuxiang1996/leetcode
train
0
548c61bebbd58b2ce45bff81f194c58e8aa6fe85
[ "stamps = []\nfor mod in self.distribution.ext_modules:\n for source in mod.sources:\n base, ext = splitext(source)\n if not ext in ('.pyx', '.py'):\n continue\n source_hash = sha1(open(source, 'rt').read()).hexdigest()\n stamps.append('%s, %s\\n' % (source, source_hash))\n...
<|body_start_0|> stamps = [] for mod in self.distribution.ext_modules: for source in mod.sources: base, ext = splitext(source) if not ext in ('.pyx', '.py'): continue source_hash = sha1(open(source, 'rt').read()).hexdigest()...
Custom distutils sdist command to generate .c files from pyx files. Running the command object ``obj.run()`` will compile the pyx / py files in any extensions, into c files, and add them to the list of files to put into the source archive, as well as the usual behavior of distutils ``sdist``. It will also take the sha1...
PyxSDist
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PyxSDist: """Custom distutils sdist command to generate .c files from pyx files. Running the command object ``obj.run()`` will compile the pyx / py files in any extensions, into c files, and add them to the list of files to put into the source archive, as well as the usual behavior of distutils `...
stack_v2_sparse_classes_36k_train_019889
7,351
permissive
[ { "docstring": "Compile pyx to c files, add to sources, stamp sha1s", "name": "make_distribution", "signature": "def make_distribution(self)" }, { "docstring": "Put pyx stamps file into release tree", "name": "make_release_tree", "signature": "def make_release_tree(self, base_dir, files)...
2
null
Implement the Python class `PyxSDist` described below. Class description: Custom distutils sdist command to generate .c files from pyx files. Running the command object ``obj.run()`` will compile the pyx / py files in any extensions, into c files, and add them to the list of files to put into the source archive, as we...
Implement the Python class `PyxSDist` described below. Class description: Custom distutils sdist command to generate .c files from pyx files. Running the command object ``obj.run()`` will compile the pyx / py files in any extensions, into c files, and add them to the list of files to put into the source archive, as we...
4341b734995d6f51ac9c16df26a7de00c46f57ef
<|skeleton|> class PyxSDist: """Custom distutils sdist command to generate .c files from pyx files. Running the command object ``obj.run()`` will compile the pyx / py files in any extensions, into c files, and add them to the list of files to put into the source archive, as well as the usual behavior of distutils `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PyxSDist: """Custom distutils sdist command to generate .c files from pyx files. Running the command object ``obj.run()`` will compile the pyx / py files in any extensions, into c files, and add them to the list of files to put into the source archive, as well as the usual behavior of distutils ``sdist``. It ...
the_stack_v2_python_sparse
cythexts.py
Garyfallidis/dipy
train
7
95400d35d973a11887c6073d57a98c2e27cc9f85
[ "self.file_system = file_system\nself.name = name\nself.storage_array = storage_array\nself.mtype = mtype", "if dictionary is None:\n return None\nfile_system = cohesity_management_sdk.models.flash_blade_file_system.FlashBladeFileSystem.from_dictionary(dictionary.get('fileSystem')) if dictionary.get('fileSyste...
<|body_start_0|> self.file_system = file_system self.name = name self.storage_array = storage_array self.mtype = mtype <|end_body_0|> <|body_start_1|> if dictionary is None: return None file_system = cohesity_management_sdk.models.flash_blade_file_system.Flas...
Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the object type is 'kFileSystem'. name (string): Specifies a ...
FlashBladeProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlashBladeProtectionSource: """Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the obj...
stack_v2_sparse_classes_36k_train_019890
3,009
permissive
[ { "docstring": "Constructor for the FlashBladeProtectionSource class", "name": "__init__", "signature": "def __init__(self, file_system=None, name=None, storage_array=None, mtype=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
stack_v2_sparse_classes_30k_test_001034
Implement the Python class `FlashBladeProtectionSource` described below. Class description: Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System inf...
Implement the Python class `FlashBladeProtectionSource` described below. Class description: Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System inf...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FlashBladeProtectionSource: """Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the obj...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlashBladeProtectionSource: """Implementation of the 'FlashBladeProtectionSource' model. Specifies a Protection Source in Pure Storage FlashBlade environment. Attributes: file_system (FlashBladeFileSystem): Specifies a Pure Storage FlashBlade File System information. This is set only when the object type is '...
the_stack_v2_python_sparse
cohesity_management_sdk/models/flash_blade_protection_source.py
cohesity/management-sdk-python
train
24
31c7d54cb2ebf974366c31050cedde8cf2113d27
[ "ctx.save_for_backward(input)\ninput_shape = input.shape[0]\neven_indices = [i for i in range(0, input_shape, 2)]\nodd_indices = [i for i in range(1, input_shape, 2)]\noutput = input.clone()\noutput[even_indices] = output[even_indices].clamp(min=0)\noutput[odd_indices] = 0 - output[odd_indices]\noutput[odd_indices]...
<|body_start_0|> ctx.save_for_backward(input) input_shape = input.shape[0] even_indices = [i for i in range(0, input_shape, 2)] odd_indices = [i for i in range(1, input_shape, 2)] output = input.clone() output[even_indices] = output[even_indices].clamp(min=0) outp...
brelu_function
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class brelu_function: def forward(ctx, input): """In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backw...
stack_v2_sparse_classes_36k_train_019891
32,265
no_license
[ { "docstring": "In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using the ctx.save_for_backward method.", ...
2
stack_v2_sparse_classes_30k_train_008428
Implement the Python class `brelu_function` described below. Class description: Implement the brelu_function class. Method signatures and docstrings: - def forward(ctx, input): In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be u...
Implement the Python class `brelu_function` described below. Class description: Implement the brelu_function class. Method signatures and docstrings: - def forward(ctx, input): In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be u...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class brelu_function: def forward(ctx, input): """In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class brelu_function: def forward(ctx, input): """In the forward pass we receive a Tensor containing the input and return a Tensor containing the output. ctx is a context object that can be used to stash information for backward computation. You can cache arbitrary objects for use in the backward pass using...
the_stack_v2_python_sparse
generated/test_digantamisra98_Echo.py
jansel/pytorch-jit-paritybench
train
35
ce127c5765b0dbce33d90ebdf2d7d1e4ee2b1dc4
[ "super(FINN, self).__init__()\nself.device = device\nself.Nx = u.size()[1]\nself.BC = th.tensor(BC, dtype=th.float).to(device=self.device)\nself.layer_sizes = layer_sizes\nself.mode = mode\nself.cfg = config\nself.bias = bias\nself.sigmoid = sigmoid\nif not learn_coeff:\n self.D = th.tensor(D, dtype=th.float, de...
<|body_start_0|> super(FINN, self).__init__() self.device = device self.Nx = u.size()[1] self.BC = th.tensor(BC, dtype=th.float).to(device=self.device) self.layer_sizes = layer_sizes self.mode = mode self.cfg = config self.bias = bias self.sigmoid ...
This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (or the flux multiplier) and reac...
FINN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FINN: """This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (...
stack_v2_sparse_classes_36k_train_019892
10,673
no_license
[ { "docstring": "Constructor. Inputs: :param u: the unknown variable :type u: th.tensor[len(t), Nx, Ny, num_vars] :param D: diffusion coefficient :type D: np.array[num_vars] --- th.tensor is also accepted :param BC: the boundary condition values. In case of Dirichlet BC, this contains the scalar values. In case ...
2
stack_v2_sparse_classes_30k_train_012728
Implement the Python class `FINN` described below. Class description: This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which ...
Implement the Python class `FINN` described below. Class description: This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which ...
82b4eac6b55be3b44e736f139ed50256c4415f0c
<|skeleton|> class FINN: """This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FINN: """This is the parent FINN class. This class initializes all sharable parameters between different implementations to be inherited to each of the implementation. It also contains the initialization of the function_learner and reaction_learner NN which learns the constitutive relationships (or the flux m...
the_stack_v2_python_sparse
sampling/finn_exp.py
CognitiveModeling/finn
train
28
3bce24aa669609dbf40955b70ee6340e20bdf00a
[ "version_url = self._get_base_version_url()\nresp, body = self.raw_request(version_url, 'GET')\nself._error_checker(resp, body)\nbody = json.loads(body)\nself.validate_response(schema.list_versions, resp, body)\nreturn rest_client.ResponseBody(resp, body)", "version_url = urljoin(self._get_base_version_url(), ver...
<|body_start_0|> version_url = self._get_base_version_url() resp, body = self.raw_request(version_url, 'GET') self._error_checker(resp, body) body = json.loads(body) self.validate_response(schema.list_versions, resp, body) return rest_client.ResponseBody(resp, body) <|end...
VersionsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionsClient: def list_versions(self): """List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions""" <|body_0|> def show_version(self, version): ...
stack_v2_sparse_classes_36k_train_019893
2,524
permissive
[ { "docstring": "List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions", "name": "list_versions", "signature": "def list_versions(self)" }, { "docstring": "Show API version ...
2
stack_v2_sparse_classes_30k_train_005713
Implement the Python class `VersionsClient` described below. Class description: Implement the VersionsClient class. Method signatures and docstrings: - def list_versions(self): List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/blo...
Implement the Python class `VersionsClient` described below. Class description: Implement the VersionsClient class. Method signatures and docstrings: - def list_versions(self): List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/blo...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class VersionsClient: def list_versions(self): """List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions""" <|body_0|> def show_version(self, version): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VersionsClient: def list_versions(self): """List API versions For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-api-versions""" version_url = self._get_base_version_url() resp, body = self....
the_stack_v2_python_sparse
tempest/lib/services/volume/v3/versions_client.py
openstack/tempest
train
270
9f6ccd86c692a4bf7aaef915aef9826d6fdb0be2
[ "commonStates = {}\nfor data in results:\n if data['site_name'] not in commonStates:\n commonStates[data['site_name']] = {}\n module = __import__('WMCore.BossAir.Plugins.%s' % data['plugin'], globals(), locals(), [data['plugin']])\n plugIn = getattr(module, data['plugin'])\n for status in viewval...
<|body_start_0|> commonStates = {} for data in results: if data['site_name'] not in commonStates: commonStates[data['site_name']] = {} module = __import__('WMCore.BossAir.Plugins.%s' % data['plugin'], globals(), locals(), [data['plugin']]) plugIn = get...
_JobStatusByLocation_ Load all jobs with a certain scheduler status including all the joined information.
JobStatusByLocation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobStatusByLocation: """_JobStatusByLocation_ Load all jobs with a certain scheduler status including all the joined information.""" def mappedStatusFormat(self, results): """convert each individual batch system plugin status to a common status. Warning: This assumes all the plugin a...
stack_v2_sparse_classes_36k_train_019894
2,942
permissive
[ { "docstring": "convert each individual batch system plugin status to a common status. Warning: This assumes all the plugin are under WMCore/BossAir/Plugins/ and its module name and class name should be the same. __import__ doesn't reload if the module exist. (so doesn't need to keep track what is already impor...
2
null
Implement the Python class `JobStatusByLocation` described below. Class description: _JobStatusByLocation_ Load all jobs with a certain scheduler status including all the joined information. Method signatures and docstrings: - def mappedStatusFormat(self, results): convert each individual batch system plugin status t...
Implement the Python class `JobStatusByLocation` described below. Class description: _JobStatusByLocation_ Load all jobs with a certain scheduler status including all the joined information. Method signatures and docstrings: - def mappedStatusFormat(self, results): convert each individual batch system plugin status t...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class JobStatusByLocation: """_JobStatusByLocation_ Load all jobs with a certain scheduler status including all the joined information.""" def mappedStatusFormat(self, results): """convert each individual batch system plugin status to a common status. Warning: This assumes all the plugin a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobStatusByLocation: """_JobStatusByLocation_ Load all jobs with a certain scheduler status including all the joined information.""" def mappedStatusFormat(self, results): """convert each individual batch system plugin status to a common status. Warning: This assumes all the plugin are under WMCo...
the_stack_v2_python_sparse
src/python/WMCore/BossAir/MySQL/JobStatusByLocation.py
vkuznet/WMCore
train
0
74bce0dbec2c1a92c40a962f3a099097be735c96
[ "super().__init__()\nself.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout)\nself.dropout = nn.Dropout(dropout)\nself.linear1 = nn.Linear(d_model, dim_feedforward)\nself.linear2 = nn.Linear(dim_feedforward, d_model)\nself.norm1 = nn.LayerNorm(d_model)\nself.norm2 = nn.LayerNorm(d_model)\nself.dropo...
<|body_start_0|> super().__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.dropout = nn.Dropout(dropout) self.linear1 = nn.Linear(d_model, dim_feedforward) self.linear2 = nn.Linear(dim_feedforward, d_model) self.norm1 = nn.LayerNorm(d...
TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neu...
TransformerEncoderLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderLayer: """TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. ...
stack_v2_sparse_classes_36k_train_019895
20,460
permissive
[ { "docstring": "Initialize a TransformerEncoderLayer. Parameters ---------- d_model : int The number of expected features in the input. n_head : int The number of heads in the multiheadattention models. dim_feedforward : int, optional The dimension of the feedforward network (default=2048). dropout : float, opt...
2
stack_v2_sparse_classes_30k_train_004731
Implement the Python class `TransformerEncoderLayer` described below. Class description: TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez...
Implement the Python class `TransformerEncoderLayer` described below. Class description: TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class TransformerEncoderLayer: """TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerEncoderLayer: """TransformerEncoderLayer is made up of self-attn and feedforward. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attenti...
the_stack_v2_python_sparse
flambe/nn/transformer.py
cle-ros/flambe
train
1
3c1bbb0f188cf6d2e839ff701af3958dbfd89554
[ "def dfs(n, m):\n if n < 0 or m < 0:\n return 0\n return max(dfs(n - 1, m), dfs(n, m - 1)) + grid[n][m]\nrow = len(grid) - 1\ncolumn = len(grid[0]) - 1\nreturn dfs(row, column)", "row = len(grid)\ncolumn = len(grid[0])\ndp = [[0] * column for i in range(row)]\nfor i in range(row):\n for j in range...
<|body_start_0|> def dfs(n, m): if n < 0 or m < 0: return 0 return max(dfs(n - 1, m), dfs(n, m - 1)) + grid[n][m] row = len(grid) - 1 column = len(grid[0]) - 1 return dfs(row, column) <|end_body_0|> <|body_start_1|> row = len(grid) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxValue2(self, grid: List[List[int]]) -> int: """递归逆推,超时. 可以优化,加上剪枝""" <|body_0|> def maxValue(self, grid: List[List[int]]) -> int: """动态规划。 使用一个二维数组DP,计算每一个格子中的最大值,最后取最后一个格子中的值。 Args: grid: Returns:""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_019896
1,637
no_license
[ { "docstring": "递归逆推,超时. 可以优化,加上剪枝", "name": "maxValue2", "signature": "def maxValue2(self, grid: List[List[int]]) -> int" }, { "docstring": "动态规划。 使用一个二维数组DP,计算每一个格子中的最大值,最后取最后一个格子中的值。 Args: grid: Returns:", "name": "maxValue", "signature": "def maxValue(self, grid: List[List[int]]) -> ...
2
stack_v2_sparse_classes_30k_train_007334
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxValue2(self, grid: List[List[int]]) -> int: 递归逆推,超时. 可以优化,加上剪枝 - def maxValue(self, grid: List[List[int]]) -> int: 动态规划。 使用一个二维数组DP,计算每一个格子中的最大值,最后取最后一个格子中的值。 Args: grid: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxValue2(self, grid: List[List[int]]) -> int: 递归逆推,超时. 可以优化,加上剪枝 - def maxValue(self, grid: List[List[int]]) -> int: 动态规划。 使用一个二维数组DP,计算每一个格子中的最大值,最后取最后一个格子中的值。 Args: grid: ...
c0dd577481b46129d950354d567d332a4d091137
<|skeleton|> class Solution: def maxValue2(self, grid: List[List[int]]) -> int: """递归逆推,超时. 可以优化,加上剪枝""" <|body_0|> def maxValue(self, grid: List[List[int]]) -> int: """动态规划。 使用一个二维数组DP,计算每一个格子中的最大值,最后取最后一个格子中的值。 Args: grid: Returns:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxValue2(self, grid: List[List[int]]) -> int: """递归逆推,超时. 可以优化,加上剪枝""" def dfs(n, m): if n < 0 or m < 0: return 0 return max(dfs(n - 1, m), dfs(n, m - 1)) + grid[n][m] row = len(grid) - 1 column = len(grid[0]) - 1 r...
the_stack_v2_python_sparse
leetcode/剑指offer/剑指 Offer 47. 礼物的最大价值.py
tenqaz/crazy_arithmetic
train
0
3aa2057b10727f444068488d5b1ae791324615b3
[ "text = 'python'\nresult = cap.cap_text(text)\nself.assertEqual(result, 'Python')", "text = 'monty python'\nresult = cap.cap_text(text)\nself.assertEqual(result, 'Monty Python')" ]
<|body_start_0|> text = 'python' result = cap.cap_text(text) self.assertEqual(result, 'Python') <|end_body_0|> <|body_start_1|> text = 'monty python' result = cap.cap_text(text) self.assertEqual(result, 'Monty Python') <|end_body_1|>
Inside the class we write methods to test our methods in script. For each method or function in our script we can write multiple test functions.
TestCap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCap: """Inside the class we write methods to test our methods in script. For each method or function in our script we can write multiple test functions.""" def test_one_word(self): """The format of the method is simple we give it an input in this case text we define a variable ho...
stack_v2_sparse_classes_36k_train_019897
1,334
no_license
[ { "docstring": "The format of the method is simple we give it an input in this case text we define a variable hold the value returned after invoking our function then we assert that our result matches the result we expected It is important to note that first is the result from the function we invoked and then i...
2
null
Implement the Python class `TestCap` described below. Class description: Inside the class we write methods to test our methods in script. For each method or function in our script we can write multiple test functions. Method signatures and docstrings: - def test_one_word(self): The format of the method is simple we g...
Implement the Python class `TestCap` described below. Class description: Inside the class we write methods to test our methods in script. For each method or function in our script we can write multiple test functions. Method signatures and docstrings: - def test_one_word(self): The format of the method is simple we g...
688617ded71ff1c025bdcd25caefba5b6d4665fb
<|skeleton|> class TestCap: """Inside the class we write methods to test our methods in script. For each method or function in our script we can write multiple test functions.""" def test_one_word(self): """The format of the method is simple we give it an input in this case text we define a variable ho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCap: """Inside the class we write methods to test our methods in script. For each method or function in our script we can write multiple test functions.""" def test_one_word(self): """The format of the method is simple we give it an input in this case text we define a variable hold the value ...
the_stack_v2_python_sparse
Errors _and_exceptions/pylint/test_cap.py
mohammadasim/python-course
train
0
74a0528dee5586da89aab349e7b0b69e28454ab8
[ "if data:\n try:\n variables, units, observations = (data['variables'], data['units'], data['observations'])\n except KeyError as err:\n raise ValueError(f'Missing expected key in `data` param: {err}')\n except TypeError as err:\n raise ValueError(f'Bad value for `data` param: {err}')\...
<|body_start_0|> if data: try: variables, units, observations = (data['variables'], data['units'], data['observations']) except KeyError as err: raise ValueError(f'Missing expected key in `data` param: {err}') except TypeError as err: ...
Handle "tidy data" with per-column units. This can be used to convert from a simple dictionary/json representation like this:: { "variables": ["compound", "pressure"], "units": [null|None, "Pa"], "observations": [ ["benzene", 4890000.0], ...etc.. ] } into a pandas DataFrame. A convenience method is provided for returni...
TidyUnitData
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TidyUnitData: """Handle "tidy data" with per-column units. This can be used to convert from a simple dictionary/json representation like this:: { "variables": ["compound", "pressure"], "units": [null|None, "Pa"], "observations": [ ["benzene", 4890000.0], ...etc.. ] } into a pandas DataFrame. A co...
stack_v2_sparse_classes_36k_train_019898
43,787
permissive
[ { "docstring": "Constructor. Args: data: Optional, data dict (overrides variables/units/observations) variables: List of variables (table header) units: List of units, or None, same length as `variables` observations: Rows of the body of the table Raises: ValueError: For bad `data` (missing keys, not dict, etc....
2
null
Implement the Python class `TidyUnitData` described below. Class description: Handle "tidy data" with per-column units. This can be used to convert from a simple dictionary/json representation like this:: { "variables": ["compound", "pressure"], "units": [null|None, "Pa"], "observations": [ ["benzene", 4890000.0], ......
Implement the Python class `TidyUnitData` described below. Class description: Handle "tidy data" with per-column units. This can be used to convert from a simple dictionary/json representation like this:: { "variables": ["compound", "pressure"], "units": [null|None, "Pa"], "observations": [ ["benzene", 4890000.0], ......
deacf4c422bc9e50cb347e11a8cbfa0195bd4274
<|skeleton|> class TidyUnitData: """Handle "tidy data" with per-column units. This can be used to convert from a simple dictionary/json representation like this:: { "variables": ["compound", "pressure"], "units": [null|None, "Pa"], "observations": [ ["benzene", 4890000.0], ...etc.. ] } into a pandas DataFrame. A co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TidyUnitData: """Handle "tidy data" with per-column units. This can be used to convert from a simple dictionary/json representation like this:: { "variables": ["compound", "pressure"], "units": [null|None, "Pa"], "observations": [ ["benzene", 4890000.0], ...etc.. ] } into a pandas DataFrame. A convenience met...
the_stack_v2_python_sparse
idaes/core/dmf/resource.py
IDAES/idaes-pse
train
173
b4f2bf194cce2fd88682429504a88de29c1b1245
[ "error_found = 0\nif CONF.log_dir:\n logs = [x for x in os.listdir(CONF.log_dir) if x.endswith('.log')]\n for file in logs:\n log_file = os.path.join(CONF.log_dir, file)\n lines = [line.strip() for line in open(log_file, 'r')]\n lines.reverse()\n print_name = 0\n for index, ...
<|body_start_0|> error_found = 0 if CONF.log_dir: logs = [x for x in os.listdir(CONF.log_dir) if x.endswith('.log')] for file in logs: log_file = os.path.join(CONF.log_dir, file) lines = [line.strip() for line in open(log_file, 'r')] ...
Get logging information.
GetLogCommands
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetLogCommands: """Get logging information.""" def errors(self): """Get all of the errors from the log files.""" <|body_0|> def syslog(self, num_entries=10): """Get <num_entries> of the manila syslog events.""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_019899
19,425
permissive
[ { "docstring": "Get all of the errors from the log files.", "name": "errors", "signature": "def errors(self)" }, { "docstring": "Get <num_entries> of the manila syslog events.", "name": "syslog", "signature": "def syslog(self, num_entries=10)" } ]
2
stack_v2_sparse_classes_30k_train_014883
Implement the Python class `GetLogCommands` described below. Class description: Get logging information. Method signatures and docstrings: - def errors(self): Get all of the errors from the log files. - def syslog(self, num_entries=10): Get <num_entries> of the manila syslog events.
Implement the Python class `GetLogCommands` described below. Class description: Get logging information. Method signatures and docstrings: - def errors(self): Get all of the errors from the log files. - def syslog(self, num_entries=10): Get <num_entries> of the manila syslog events. <|skeleton|> class GetLogCommands...
a93a844398a11a8a85f204782fb9456f7caccdbe
<|skeleton|> class GetLogCommands: """Get logging information.""" def errors(self): """Get all of the errors from the log files.""" <|body_0|> def syslog(self, num_entries=10): """Get <num_entries> of the manila syslog events.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetLogCommands: """Get logging information.""" def errors(self): """Get all of the errors from the log files.""" error_found = 0 if CONF.log_dir: logs = [x for x in os.listdir(CONF.log_dir) if x.endswith('.log')] for file in logs: log_file =...
the_stack_v2_python_sparse
manila/cmd/manage.py
openstack/manila
train
178