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
7bc6928595764d6306476afc99dd5a5f380e761b
[ "n, m = (len(board), len(board[0]))\nboard_copy = [[i for i in j] for j in board]\npos = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]\nfor i in range(n):\n for j in range(m):\n sum_ = 0\n for l, r in pos:\n i_, j_ = (i + l, j + r)\n if 0 <= i_ < n and...
<|body_start_0|> n, m = (len(board), len(board[0])) board_copy = [[i for i in j] for j in board] pos = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)] for i in range(n): for j in range(m): sum_ = 0 for l, r in pos: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.""" <|body_0|> def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-...
stack_v2_sparse_classes_36k_train_013400
2,200
no_license
[ { "docstring": ":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.", "name": "gameOfLife", "signature": "def gameOfLife(self, board)" }, { "docstring": ":type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead."...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board): :type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead. - def gameOfLife(self, board): :type board: List[Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board): :type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead. - def gameOfLife(self, board): :type board: List[Lis...
63b7eedc720c1ce14880b80744dcd5ef7107065c
<|skeleton|> class Solution: def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.""" <|body_0|> def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def gameOfLife(self, board): """:type board: List[List[int]] :rtype: None Do not return anything, modify board in-place instead.""" n, m = (len(board), len(board[0])) board_copy = [[i for i in j] for j in board] pos = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, ...
the_stack_v2_python_sparse
problems/gameOfLife.py
joddiy/leetcode
train
1
9162fc337c7bb1d6afcc15c29d05e15bc5989ac6
[ "super().__init__()\nself._path = path\nself._detect_change = detect_change\nself._data = None\nif initialize_data:\n self.validate_change()", "old_data = self._data\nif not self.validate_file():\n return False\nreturn old_data != self._data if self._detect_change else True", "if not self._path.exists():\...
<|body_start_0|> super().__init__() self._path = path self._detect_change = detect_change self._data = None if initialize_data: self.validate_change() <|end_body_0|> <|body_start_1|> old_data = self._data if not self.validate_file(): retur...
DefinitionValidator
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefinitionValidator: def __init__(self, path: Path, detect_change: bool=True, initialize_data: bool=True) -> None: """Validator for JSON and YAML files. Calling validate_change() will return True if the definition is valid and has changes. Parameters ---------- path : Path Path to the de...
stack_v2_sparse_classes_36k_train_013401
2,590
permissive
[ { "docstring": "Validator for JSON and YAML files. Calling validate_change() will return True if the definition is valid and has changes. Parameters ---------- path : Path Path to the definition file detect_change : bool, optional validation will only be successful if there are changes between current and previ...
3
stack_v2_sparse_classes_30k_train_004367
Implement the Python class `DefinitionValidator` described below. Class description: Implement the DefinitionValidator class. Method signatures and docstrings: - def __init__(self, path: Path, detect_change: bool=True, initialize_data: bool=True) -> None: Validator for JSON and YAML files. Calling validate_change() w...
Implement the Python class `DefinitionValidator` described below. Class description: Implement the DefinitionValidator class. Method signatures and docstrings: - def __init__(self, path: Path, detect_change: bool=True, initialize_data: bool=True) -> None: Validator for JSON and YAML files. Calling validate_change() w...
b297ff015f2b69d7c74059c2d42ece1c29ea73ee
<|skeleton|> class DefinitionValidator: def __init__(self, path: Path, detect_change: bool=True, initialize_data: bool=True) -> None: """Validator for JSON and YAML files. Calling validate_change() will return True if the definition is valid and has changes. Parameters ---------- path : Path Path to the de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefinitionValidator: def __init__(self, path: Path, detect_change: bool=True, initialize_data: bool=True) -> None: """Validator for JSON and YAML files. Calling validate_change() will return True if the definition is valid and has changes. Parameters ---------- path : Path Path to the definition file ...
the_stack_v2_python_sparse
samcli/lib/utils/definition_validator.py
aws/aws-sam-cli
train
1,402
968b1b0349ce74e58af2193d7743ea3b4aafa6a4
[ "def reverse(nl: ListNode):\n if nl is None or nl.next is None:\n return (nl, nl)\n hnode, tnode = reverse(nl.next)\n nl.next = None\n tnode.next = nl\n return (hnode, nl)\nret, _ = reverse(head)\nreturn ret", "pre = None\nwhile head:\n pre, head.next, head = (head, pre, head.next)\nretur...
<|body_start_0|> def reverse(nl: ListNode): if nl is None or nl.next is None: return (nl, nl) hnode, tnode = reverse(nl.next) nl.next = None tnode.next = nl return (hnode, nl) ret, _ = reverse(head) return ret <|end_body...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: """20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:""" <|body_0|> def reverseList(self, head: ListNode) -...
stack_v2_sparse_classes_36k_train_013402
1,605
permissive
[ { "docstring": "20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:", "name": "reverseList2", "signature": "def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]" }, { "docstring": "2022-08-23 :...
2
stack_v2_sparse_classes_30k_train_005252
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: 20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: 20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage:...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: """20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:""" <|body_0|> def reverseList(self, head: ListNode) -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList2(self, head: Optional[ListNode]) -> Optional[ListNode]: """20210907 Updated with recursively 28 / 28 test cases passed. Status: Accepted Runtime: 40 ms Memory Usage: 20.3 MB :param head: :return:""" def reverse(nl: ListNode): if nl is None or nl.next is No...
the_stack_v2_python_sparse
src/206-ReverseLinkedList.py
Jiezhi/myleetcode
train
1
d91c296fa0155a3005edc3acbc8228f2c83e88f2
[ "self.auth = auth\nself.homedata = None\nself.home_names = []\nself.room_names = []\nself.schedules = []\nself.home = home\nself.home_id = None", "self.setup()\nif self.homedata is None:\n return []\nfor home in self.homedata.homes:\n if 'therm_schedules' in self.homedata.homes[home] and 'modules' in self.h...
<|body_start_0|> self.auth = auth self.homedata = None self.home_names = [] self.room_names = [] self.schedules = [] self.home = home self.home_id = None <|end_body_0|> <|body_start_1|> self.setup() if self.homedata is None: return [] ...
Representation Netatmo homes.
HomeData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HomeData: """Representation Netatmo homes.""" def __init__(self, auth, home=None): """Initialize the HomeData object.""" <|body_0|> def get_home_names(self): """Get all the home names returned by NetAtmo API.""" <|body_1|> def setup(self): ""...
stack_v2_sparse_classes_36k_train_013403
16,202
permissive
[ { "docstring": "Initialize the HomeData object.", "name": "__init__", "signature": "def __init__(self, auth, home=None)" }, { "docstring": "Get all the home names returned by NetAtmo API.", "name": "get_home_names", "signature": "def get_home_names(self)" }, { "docstring": "Retri...
3
null
Implement the Python class `HomeData` described below. Class description: Representation Netatmo homes. Method signatures and docstrings: - def __init__(self, auth, home=None): Initialize the HomeData object. - def get_home_names(self): Get all the home names returned by NetAtmo API. - def setup(self): Retrieve HomeD...
Implement the Python class `HomeData` described below. Class description: Representation Netatmo homes. Method signatures and docstrings: - def __init__(self, auth, home=None): Initialize the HomeData object. - def get_home_names(self): Get all the home names returned by NetAtmo API. - def setup(self): Retrieve HomeD...
6e414983738d9495eb9e4f858e3e98e9e38869db
<|skeleton|> class HomeData: """Representation Netatmo homes.""" def __init__(self, auth, home=None): """Initialize the HomeData object.""" <|body_0|> def get_home_names(self): """Get all the home names returned by NetAtmo API.""" <|body_1|> def setup(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HomeData: """Representation Netatmo homes.""" def __init__(self, auth, home=None): """Initialize the HomeData object.""" self.auth = auth self.homedata = None self.home_names = [] self.room_names = [] self.schedules = [] self.home = home sel...
the_stack_v2_python_sparse
homeassistant/components/netatmo/climate.py
Watemlifts/home-assistant
train
4
99a1f1f6d4accf81c3a65ca0c72a28e53e1f5d0a
[ "s_len = len(s)\np_len = len(p)\nstate_array = []\nfor i in range(s_len + 1):\n state_array.append([])\n for j in range(p_len + 1):\n state_array[-1].append(False)\nstate_array[0][0] = True\nfor idx, char in enumerate(p):\n if char == '*':\n state_array[0][idx + 1] = True\n else:\n ...
<|body_start_0|> s_len = len(s) p_len = len(p) state_array = [] for i in range(s_len + 1): state_array.append([]) for j in range(p_len + 1): state_array[-1].append(False) state_array[0][0] = True for idx, char in enumerate(p): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch_DP(self, s, p): """使用DP的方法来进行模式串与源串的匹配,注意DP的思维方式,将子问题的答案存储 :type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013404
2,411
no_license
[ { "docstring": "使用DP的方法来进行模式串与源串的匹配,注意DP的思维方式,将子问题的答案存储 :type s: str :type p: str :rtype: bool", "name": "isMatch_DP", "signature": "def isMatch_DP(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch", "signature": "def isMatch(self, s, p)" } ]
2
stack_v2_sparse_classes_30k_train_018790
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch_DP(self, s, p): 使用DP的方法来进行模式串与源串的匹配,注意DP的思维方式,将子问题的答案存储 :type s: str :type p: str :rtype: bool - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch_DP(self, s, p): 使用DP的方法来进行模式串与源串的匹配,注意DP的思维方式,将子问题的答案存储 :type s: str :type p: str :rtype: bool - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool <|sk...
45d116d790075b1583af6aecd00f8babfe2c3107
<|skeleton|> class Solution: def isMatch_DP(self, s, p): """使用DP的方法来进行模式串与源串的匹配,注意DP的思维方式,将子问题的答案存储 :type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isMatch_DP(self, s, p): """使用DP的方法来进行模式串与源串的匹配,注意DP的思维方式,将子问题的答案存储 :type s: str :type p: str :rtype: bool""" s_len = len(s) p_len = len(p) state_array = [] for i in range(s_len + 1): state_array.append([]) for j in range(p_len + 1):...
the_stack_v2_python_sparse
leetcode/dynamic_programming/exercise_44.py
YinongLong/Data-Structures-and-Algorithm-Analysis
train
0
70df75befe5a6fe23884255e8034bbd6765cc6af
[ "Parametre.__init__(self, 'créer', 'create')\nself.schema = '<modele_navire>'\nself.aide_courte = 'crée un navire sur un modèle'\nself.aide_longue = \"Crée un navire sur un modèle existant. Cette commande crée un navire mais ne le place dans aucune étendue d'eau.\"", "modele = dic_masques['modele_navire'].modele\...
<|body_start_0|> Parametre.__init__(self, 'créer', 'create') self.schema = '<modele_navire>' self.aide_courte = 'crée un navire sur un modèle' self.aide_longue = "Crée un navire sur un modèle existant. Cette commande crée un navire mais ne le place dans aucune étendue d'eau." <|end_body_...
Commande 'navire créer'.
PrmCreer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmCreer: """Commande 'navire créer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__in...
stack_v2_sparse_classes_36k_train_013405
3,038
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmCreer` described below. Class description: Commande 'navire créer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmCreer` described below. Class description: Commande 'navire créer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmCreer: """Commande 'navire créer...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmCreer: """Commande 'navire créer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmCreer: """Commande 'navire créer'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'créer', 'create') self.schema = '<modele_navire>' self.aide_courte = 'crée un navire sur un modèle' self.aide_longue = "Crée un navire sur un modè...
the_stack_v2_python_sparse
src/secondaires/navigation/commandes/navire/creer.py
vincent-lg/tsunami
train
5
fc57ec28a6b068de63451c5c1197219c35d645f7
[ "self.k = k\nself.model = model\nself.start_id = start_id\nself.end_id = end_id\nself.max_length = max_length\nif min_length is None:\n min_length = 2\nself.min_length = min_length\nif num_required is None:\n num_required == 99999999\nself.num_required = num_required\nself.leaf_nodes = [BeamNode(start_id)]\ns...
<|body_start_0|> self.k = k self.model = model self.start_id = start_id self.end_id = end_id self.max_length = max_length if min_length is None: min_length = 2 self.min_length = min_length if num_required is None: num_required == 99...
BeamSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BeamSearch: def __init__(self, k, model, start_id, end_id, max_length, min_length=None, num_required=None): """Args: k: Beam search size model: Neural Net to beam search start_id: Tokenizer id of start token <s> end_id: Tokenizer id of end token </s> max_length: Maximum length of ids (in...
stack_v2_sparse_classes_36k_train_013406
4,956
no_license
[ { "docstring": "Args: k: Beam search size model: Neural Net to beam search start_id: Tokenizer id of start token <s> end_id: Tokenizer id of end token </s> max_length: Maximum length of ids (include <s> and </s>) min_length: Minimun length of ids (include <s> and </s>) num_required: Searching ends when count of...
3
stack_v2_sparse_classes_30k_train_021105
Implement the Python class `BeamSearch` described below. Class description: Implement the BeamSearch class. Method signatures and docstrings: - def __init__(self, k, model, start_id, end_id, max_length, min_length=None, num_required=None): Args: k: Beam search size model: Neural Net to beam search start_id: Tokenizer...
Implement the Python class `BeamSearch` described below. Class description: Implement the BeamSearch class. Method signatures and docstrings: - def __init__(self, k, model, start_id, end_id, max_length, min_length=None, num_required=None): Args: k: Beam search size model: Neural Net to beam search start_id: Tokenizer...
dc6fdb5ed4ee7746e731cbe449ce83a0831eb860
<|skeleton|> class BeamSearch: def __init__(self, k, model, start_id, end_id, max_length, min_length=None, num_required=None): """Args: k: Beam search size model: Neural Net to beam search start_id: Tokenizer id of start token <s> end_id: Tokenizer id of end token </s> max_length: Maximum length of ids (in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BeamSearch: def __init__(self, k, model, start_id, end_id, max_length, min_length=None, num_required=None): """Args: k: Beam search size model: Neural Net to beam search start_id: Tokenizer id of start token <s> end_id: Tokenizer id of end token </s> max_length: Maximum length of ids (include <s> and ...
the_stack_v2_python_sparse
utils/beam_search.py
robinstart/video2text_abr
train
5
7bcfaf280485922d37acc7737d336136f5e00350
[ "assert avg_degree >= 1, 'Average degree should be greater than 0'\nself.min_nodes = min_nodes\nself.max_nodes = max_nodes\nself.avg_degree = avg_degree\nself.n_node_features = n_node_features\nself.n_edge_features = n_edge_features\nself.n_classes = n_classes\nself.task = task\nself.kwargs = kwargs", "graphs, la...
<|body_start_0|> assert avg_degree >= 1, 'Average degree should be greater than 0' self.min_nodes = min_nodes self.max_nodes = max_nodes self.avg_degree = avg_degree self.n_node_features = n_node_features self.n_edge_features = n_edge_features self.n_classes = n_c...
Generates a random graphs which can be used for testing or other purposes. The generated graph supports both node-level and graph-level labels. Example ------- >>> from deepchem.utils.fake_data_generator import FakeGraphGenerator >>> fgg = FakeGraphGenerator(min_nodes=8, max_nodes=10, n_node_features=5, avg_degree=8, n...
FakeGraphGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FakeGraphGenerator: """Generates a random graphs which can be used for testing or other purposes. The generated graph supports both node-level and graph-level labels. Example ------- >>> from deepchem.utils.fake_data_generator import FakeGraphGenerator >>> fgg = FakeGraphGenerator(min_nodes=8, ma...
stack_v2_sparse_classes_36k_train_013407
6,134
permissive
[ { "docstring": "Parameters ---------- min_nodes: int, default 10 Minimum number of permissible nodes in a graph max_nodes: int, default 10 Maximum number of permissible nodes in a graph n_node_features: int, default 5 Average number of node features in a graph avg_degree: int, default 4 Average degree of the gr...
2
stack_v2_sparse_classes_30k_train_012105
Implement the Python class `FakeGraphGenerator` described below. Class description: Generates a random graphs which can be used for testing or other purposes. The generated graph supports both node-level and graph-level labels. Example ------- >>> from deepchem.utils.fake_data_generator import FakeGraphGenerator >>> f...
Implement the Python class `FakeGraphGenerator` described below. Class description: Generates a random graphs which can be used for testing or other purposes. The generated graph supports both node-level and graph-level labels. Example ------- >>> from deepchem.utils.fake_data_generator import FakeGraphGenerator >>> f...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class FakeGraphGenerator: """Generates a random graphs which can be used for testing or other purposes. The generated graph supports both node-level and graph-level labels. Example ------- >>> from deepchem.utils.fake_data_generator import FakeGraphGenerator >>> fgg = FakeGraphGenerator(min_nodes=8, ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FakeGraphGenerator: """Generates a random graphs which can be used for testing or other purposes. The generated graph supports both node-level and graph-level labels. Example ------- >>> from deepchem.utils.fake_data_generator import FakeGraphGenerator >>> fgg = FakeGraphGenerator(min_nodes=8, max_nodes=10, n...
the_stack_v2_python_sparse
deepchem/utils/fake_data_generator.py
deepchem/deepchem
train
4,876
dd50d263bc895efde61bbaef02bb68baacff985d
[ "if os.path.isfile(file_path_name):\n os.remove(file_path_name)\nself.logger = logging.getLogger('losses_logger')\nself.logger.setLevel(1)\nfile_handler = logging.FileHandler(file_path_name)\nfile_handler.setLevel(1)\nself.logger.addHandler(file_handler)\nheader = ','.join(['Epoch', 'Train Loss', 'Valid Loss', '...
<|body_start_0|> if os.path.isfile(file_path_name): os.remove(file_path_name) self.logger = logging.getLogger('losses_logger') self.logger.setLevel(1) file_handler = logging.FileHandler(file_path_name) file_handler.setLevel(1) self.logger.addHandler(file_handl...
Class definition for objects to write data to log files in a form which is then easy to be plotted.
LossesLogger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LossesLogger: """Class definition for objects to write data to log files in a form which is then easy to be plotted.""" def __init__(self, file_path_name): """Create a logger to store information for plotting.""" <|body_0|> def log(self, epoch, storer): """Write ...
stack_v2_sparse_classes_36k_train_013408
6,647
permissive
[ { "docstring": "Create a logger to store information for plotting.", "name": "__init__", "signature": "def __init__(self, file_path_name)" }, { "docstring": "Write to the log file.", "name": "log", "signature": "def log(self, epoch, storer)" } ]
2
stack_v2_sparse_classes_30k_train_002251
Implement the Python class `LossesLogger` described below. Class description: Class definition for objects to write data to log files in a form which is then easy to be plotted. Method signatures and docstrings: - def __init__(self, file_path_name): Create a logger to store information for plotting. - def log(self, e...
Implement the Python class `LossesLogger` described below. Class description: Class definition for objects to write data to log files in a form which is then easy to be plotted. Method signatures and docstrings: - def __init__(self, file_path_name): Create a logger to store information for plotting. - def log(self, e...
ce26ce718cf5cf18a18d38f273a84324dbd5f4b2
<|skeleton|> class LossesLogger: """Class definition for objects to write data to log files in a form which is then easy to be plotted.""" def __init__(self, file_path_name): """Create a logger to store information for plotting.""" <|body_0|> def log(self, epoch, storer): """Write ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LossesLogger: """Class definition for objects to write data to log files in a form which is then easy to be plotted.""" def __init__(self, file_path_name): """Create a logger to store information for plotting.""" if os.path.isfile(file_path_name): os.remove(file_path_name) ...
the_stack_v2_python_sparse
flexehr/training.py
medical-projects/flexible-ehr
train
0
1abe9da6a20bb1086c0837faf9fd4e7af63f03e8
[ "self._payment_dates = payment_dates\nself._payment_steps = payment_steps\nself._maturity = payment_dates[len(payment_dates) - 1]\nself._steps = payment_steps[len(payment_steps) - 1]\nself._coupon_rates = coupon_rates\nself._frequency = frequency\nself._bond_tree = {}", "if not hw_tree._is_built:\n hw_tree.hw_...
<|body_start_0|> self._payment_dates = payment_dates self._payment_steps = payment_steps self._maturity = payment_dates[len(payment_dates) - 1] self._steps = payment_steps[len(payment_steps) - 1] self._coupon_rates = coupon_rates self._frequency = frequency self._...
Representation of a Bond
Bond
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bond: """Representation of a Bond""" def __init__(self, payment_dates, payment_steps, coupon_rates, frequency=2): """Initialize a Bond object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment dates payment_steps : array_like of shape (M, ) with int...
stack_v2_sparse_classes_36k_train_013409
6,090
no_license
[ { "docstring": "Initialize a Bond object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment dates payment_steps : array_like of shape (M, ) with integer payment steps that corresponds to the tree coupon_rates : scalar or array_like of shape (M, ) with the coupon rates frequenc...
3
stack_v2_sparse_classes_30k_train_018156
Implement the Python class `Bond` described below. Class description: Representation of a Bond Method signatures and docstrings: - def __init__(self, payment_dates, payment_steps, coupon_rates, frequency=2): Initialize a Bond object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment...
Implement the Python class `Bond` described below. Class description: Representation of a Bond Method signatures and docstrings: - def __init__(self, payment_dates, payment_steps, coupon_rates, frequency=2): Initialize a Bond object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment...
9f710a8de56fb9b4456c6f98be91f4b22ef5ede5
<|skeleton|> class Bond: """Representation of a Bond""" def __init__(self, payment_dates, payment_steps, coupon_rates, frequency=2): """Initialize a Bond object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment dates payment_steps : array_like of shape (M, ) with int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bond: """Representation of a Bond""" def __init__(self, payment_dates, payment_steps, coupon_rates, frequency=2): """Initialize a Bond object Parameters ---------- payment_dates : array_like of shape (M, ) with datetime payment dates payment_steps : array_like of shape (M, ) with integer payment ...
the_stack_v2_python_sparse
Hull-White Model/simple_bond.py
jesusmramirez/Term-Structure-Models
train
1
890d36ce87d07b45dbb853e4bc7bc8ab542ee963
[ "m, n = (len(text1), len(text2))\npre = [0] * (n + 1)\ndp = [0] * (n + 1)\nfor i in range(m):\n for j in range(1, n + 1):\n if text1[i] == text2[j - 1]:\n dp[j] = pre[j - 1] + 1\n else:\n dp[j] = max(pre[j], dp[j - 1])\n pre[j - 1] = dp[j - 1]\n pre[j] = dp[j]\nretur...
<|body_start_0|> m, n = (len(text1), len(text2)) pre = [0] * (n + 1) dp = [0] * (n + 1) for i in range(m): for j in range(1, n + 1): if text1[i] == text2[j - 1]: dp[j] = pre[j - 1] + 1 else: dp[j] = max(p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: """1143. 最长公共子序列 不改变顺序,不需要连续 :param text1: :param text2: :return:""" <|body_0|> def grayCode(self, n: int) -> List[int]: """89. 格雷编码 格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。 给定一个代表编码总位数的非负整数 n...
stack_v2_sparse_classes_36k_train_013410
3,687
no_license
[ { "docstring": "1143. 最长公共子序列 不改变顺序,不需要连续 :param text1: :param text2: :return:", "name": "longestCommonSubsequence", "signature": "def longestCommonSubsequence(self, text1: str, text2: str) -> int" }, { "docstring": "89. 格雷编码 格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。 给定一个代表编码总位数的非负整数 n,打印其格雷编码序列。即使...
2
stack_v2_sparse_classes_30k_train_018601
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: 1143. 最长公共子序列 不改变顺序,不需要连续 :param text1: :param text2: :return: - def grayCode(self, n: int) -> List[int]: 89. 格...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonSubsequence(self, text1: str, text2: str) -> int: 1143. 最长公共子序列 不改变顺序,不需要连续 :param text1: :param text2: :return: - def grayCode(self, n: int) -> List[int]: 89. 格...
330330ef6bc42eeb17f4dea53c30d230506b4e8f
<|skeleton|> class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: """1143. 最长公共子序列 不改变顺序,不需要连续 :param text1: :param text2: :return:""" <|body_0|> def grayCode(self, n: int) -> List[int]: """89. 格雷编码 格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。 给定一个代表编码总位数的非负整数 n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonSubsequence(self, text1: str, text2: str) -> int: """1143. 最长公共子序列 不改变顺序,不需要连续 :param text1: :param text2: :return:""" m, n = (len(text1), len(text2)) pre = [0] * (n + 1) dp = [0] * (n + 1) for i in range(m): for j in range(1, n + ...
the_stack_v2_python_sparse
Code/leetcode_everyday/0403.py
NiceToMeeetU/ToGetReady
train
0
d458279e3c6a589739bc64d944eae1fc6579cf20
[ "size = len(prices)\nresult = 0\nfor i in range(size):\n for j in range(i + 1, size):\n if prices[j] >= prices[i]:\n result = max(result, prices[j] - prices[i])\nreturn result", "size = len(prices)\nresult = 0\nmin_price = 10000000\nfor i in range(size):\n min_price = min(min_price, prices...
<|body_start_0|> size = len(prices) result = 0 for i in range(size): for j in range(i + 1, size): if prices[j] >= prices[i]: result = max(result, prices[j] - prices[i]) return result <|end_body_0|> <|body_start_1|> size = len(price...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit_brute(self, prices): """暴力解法""" <|body_0|> def maxProfit_greedy(self, prices): """贪心算法, 最左侧的最小值和最右侧的最大值之间差值""" <|body_1|> def maxProfit(self, prices): """DP, dp[i][0]: 第i天持有股票时的现金 dp[i][1]: 第i天不持有股票时的现金""" <|body_2...
stack_v2_sparse_classes_36k_train_013411
1,345
no_license
[ { "docstring": "暴力解法", "name": "maxProfit_brute", "signature": "def maxProfit_brute(self, prices)" }, { "docstring": "贪心算法, 最左侧的最小值和最右侧的最大值之间差值", "name": "maxProfit_greedy", "signature": "def maxProfit_greedy(self, prices)" }, { "docstring": "DP, dp[i][0]: 第i天持有股票时的现金 dp[i][1]: 第...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_brute(self, prices): 暴力解法 - def maxProfit_greedy(self, prices): 贪心算法, 最左侧的最小值和最右侧的最大值之间差值 - def maxProfit(self, prices): DP, dp[i][0]: 第i天持有股票时的现金 dp[i][1]: 第i天不持有股...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_brute(self, prices): 暴力解法 - def maxProfit_greedy(self, prices): 贪心算法, 最左侧的最小值和最右侧的最大值之间差值 - def maxProfit(self, prices): DP, dp[i][0]: 第i天持有股票时的现金 dp[i][1]: 第i天不持有股...
be46de7cdd29557c01d4b89f1c2f638e055b6d70
<|skeleton|> class Solution: def maxProfit_brute(self, prices): """暴力解法""" <|body_0|> def maxProfit_greedy(self, prices): """贪心算法, 最左侧的最小值和最右侧的最大值之间差值""" <|body_1|> def maxProfit(self, prices): """DP, dp[i][0]: 第i天持有股票时的现金 dp[i][1]: 第i天不持有股票时的现金""" <|body_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit_brute(self, prices): """暴力解法""" size = len(prices) result = 0 for i in range(size): for j in range(i + 1, size): if prices[j] >= prices[i]: result = max(result, prices[j] - prices[i]) return result ...
the_stack_v2_python_sparse
python/No121.py
OhOHOh/LeetCodePractice
train
0
4ef11d7f202667cda8a12ade33d06daef142ee12
[ "self.method = 'GET'\nself.headers = {}\nself.path = ''\nself.query = {}\nself.body = ''", "args = self.body.split('&')\nf = {}\nfor arg in args:\n k, v = arg.split('=')\n f[unquote(k)] = unquote(v)\nreturn f" ]
<|body_start_0|> self.method = 'GET' self.headers = {} self.path = '' self.query = {} self.body = '' <|end_body_0|> <|body_start_1|> args = self.body.split('&') f = {} for arg in args: k, v = arg.split('=') f[unquote(k)] = unquote(...
Request
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Request: def __init__(self): """GET /top250 HTTP/1.1 Host: movie.douban.com Connection: keep-alive body""" <|body_0|> def form(self): """form 函数用于把 body 解析为一个字典并返回 body 的格式如下 a=b&c=d&e=1 可能编码出现: '%E1%E2', 这里需要把 body 里面的数据 unquote 解码 unquote 可以 unquote('/El%20Ni%C3%B1...
stack_v2_sparse_classes_36k_train_013412
3,725
no_license
[ { "docstring": "GET /top250 HTTP/1.1 Host: movie.douban.com Connection: keep-alive body", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "form 函数用于把 body 解析为一个字典并返回 body 的格式如下 a=b&c=d&e=1 可能编码出现: '%E1%E2', 这里需要把 body 里面的数据 unquote 解码 unquote 可以 unquote('/El%20Ni%C3%B1o/'...
2
stack_v2_sparse_classes_30k_train_003546
Implement the Python class `Request` described below. Class description: Implement the Request class. Method signatures and docstrings: - def __init__(self): GET /top250 HTTP/1.1 Host: movie.douban.com Connection: keep-alive body - def form(self): form 函数用于把 body 解析为一个字典并返回 body 的格式如下 a=b&c=d&e=1 可能编码出现: '%E1%E2', 这里...
Implement the Python class `Request` described below. Class description: Implement the Request class. Method signatures and docstrings: - def __init__(self): GET /top250 HTTP/1.1 Host: movie.douban.com Connection: keep-alive body - def form(self): form 函数用于把 body 解析为一个字典并返回 body 的格式如下 a=b&c=d&e=1 可能编码出现: '%E1%E2', 这里...
80ec43c52bb5515e1cfdc99e6ca4c1c93299bedb
<|skeleton|> class Request: def __init__(self): """GET /top250 HTTP/1.1 Host: movie.douban.com Connection: keep-alive body""" <|body_0|> def form(self): """form 函数用于把 body 解析为一个字典并返回 body 的格式如下 a=b&c=d&e=1 可能编码出现: '%E1%E2', 这里需要把 body 里面的数据 unquote 解码 unquote 可以 unquote('/El%20Ni%C3%B1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Request: def __init__(self): """GET /top250 HTTP/1.1 Host: movie.douban.com Connection: keep-alive body""" self.method = 'GET' self.headers = {} self.path = '' self.query = {} self.body = '' def form(self): """form 函数用于把 body 解析为一个字典并返回 body 的格式如下 a...
the_stack_v2_python_sparse
todo/python/flask/todo-V4.5.0-jinja/server.py
hacker0limbo/todo
train
4
bfe29d0d21e448dcfaef5393dd2eaade2cc5cde5
[ "self.projectId.append(projectId)\nself.name.append(name)\nself.owner.append(owner)\nself.tag.append(tag)\nself.description.append(description)\nsuper(Checklist, self).__init__()", "self.validate_object()\nif kind is None or kind == 'create':\n self.only_available_attrs(['description', 'owner', 'tag'])\n re...
<|body_start_0|> self.projectId.append(projectId) self.name.append(name) self.owner.append(owner) self.tag.append(tag) self.description.append(description) super(Checklist, self).__init__() <|end_body_0|> <|body_start_1|> self.validate_object() if kind is...
Checklist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Checklist: def __init__(self, name: str=Empty, projectId=Empty, owner: str=Empty, tag: str=Empty, description: str=Empty): """:param name: :param projectId: :param owner: :param tag: :param description:""" <|body_0|> def __todict__(self, kind=None): """:param kind: :...
stack_v2_sparse_classes_36k_train_013413
2,754
no_license
[ { "docstring": ":param name: :param projectId: :param owner: :param tag: :param description:", "name": "__init__", "signature": "def __init__(self, name: str=Empty, projectId=Empty, owner: str=Empty, tag: str=Empty, description: str=Empty)" }, { "docstring": ":param kind: :return:", "name": ...
2
null
Implement the Python class `Checklist` described below. Class description: Implement the Checklist class. Method signatures and docstrings: - def __init__(self, name: str=Empty, projectId=Empty, owner: str=Empty, tag: str=Empty, description: str=Empty): :param name: :param projectId: :param owner: :param tag: :param ...
Implement the Python class `Checklist` described below. Class description: Implement the Checklist class. Method signatures and docstrings: - def __init__(self, name: str=Empty, projectId=Empty, owner: str=Empty, tag: str=Empty, description: str=Empty): :param name: :param projectId: :param owner: :param tag: :param ...
623d23917ecf6761e7254d7d6a4881b6a05e11f8
<|skeleton|> class Checklist: def __init__(self, name: str=Empty, projectId=Empty, owner: str=Empty, tag: str=Empty, description: str=Empty): """:param name: :param projectId: :param owner: :param tag: :param description:""" <|body_0|> def __todict__(self, kind=None): """:param kind: :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Checklist: def __init__(self, name: str=Empty, projectId=Empty, owner: str=Empty, tag: str=Empty, description: str=Empty): """:param name: :param projectId: :param owner: :param tag: :param description:""" self.projectId.append(projectId) self.name.append(name) self.owner.appen...
the_stack_v2_python_sparse
space_sdk/space_types/checklist.py
AnthraxisBR/jetbrains-space-python-sdk
train
0
a4fe45be14699409e3a83f504c7aaab129249104
[ "if root is None:\n return 0\ndeep = 1\nqueue = []\nqueue.append(root)\nqueue.append(deep)\nwhile len(queue) > 0:\n ele = queue.pop(0)\n if type(ele) is TreeNode:\n if ele.left is not None:\n queue.append(ele.left)\n if ele.right is not None:\n queue.append(ele.right)\n ...
<|body_start_0|> if root is None: return 0 deep = 1 queue = [] queue.append(root) queue.append(deep) while len(queue) > 0: ele = queue.pop(0) if type(ele) is TreeNode: if ele.left is not None: queue.a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: """思路:类似于图的广度搜索,按层遍历。借助于队列的结构。 :param root: :return:""" <|body_0|> def max_Depth(self, root: TreeNode) -> int: """思路:递归,最大层=MAX(左子树层数,右子树层数)+1 :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_013414
1,781
no_license
[ { "docstring": "思路:类似于图的广度搜索,按层遍历。借助于队列的结构。 :param root: :return:", "name": "maxDepth", "signature": "def maxDepth(self, root: TreeNode) -> int" }, { "docstring": "思路:递归,最大层=MAX(左子树层数,右子树层数)+1 :param root: :return:", "name": "max_Depth", "signature": "def max_Depth(self, root: TreeNode) ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root: TreeNode) -> int: 思路:类似于图的广度搜索,按层遍历。借助于队列的结构。 :param root: :return: - def max_Depth(self, root: TreeNode) -> int: 思路:递归,最大层=MAX(左子树层数,右子树层数)+1 :param roo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root: TreeNode) -> int: 思路:类似于图的广度搜索,按层遍历。借助于队列的结构。 :param root: :return: - def max_Depth(self, root: TreeNode) -> int: 思路:递归,最大层=MAX(左子树层数,右子树层数)+1 :param roo...
46cfe84921a9a3e865edd1f94e7807b320b53778
<|skeleton|> class Solution: def maxDepth(self, root: TreeNode) -> int: """思路:类似于图的广度搜索,按层遍历。借助于队列的结构。 :param root: :return:""" <|body_0|> def max_Depth(self, root: TreeNode) -> int: """思路:递归,最大层=MAX(左子树层数,右子树层数)+1 :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepth(self, root: TreeNode) -> int: """思路:类似于图的广度搜索,按层遍历。借助于队列的结构。 :param root: :return:""" if root is None: return 0 deep = 1 queue = [] queue.append(root) queue.append(deep) while len(queue) > 0: ele = queue.pop...
the_stack_v2_python_sparse
2020-08/Q104-max-depth.py
EAGLE50/LearnLeetCode
train
0
3f1cc7a524db9dd65f30dd029ec638665f3b0b41
[ "bloc_names2country_codes = {b.name: [c.code for c in b.countries.all()] for b in Bloc.objects.prefetch_related('countries')}\nall_country_codes = set(Country.objects.values_list('code', flat=True))\ndecomposer = SetDecomposer(bloc_names2country_codes, all_country_codes)\nreturn lambda countries: decomposer.decompo...
<|body_start_0|> bloc_names2country_codes = {b.name: [c.code for c in b.countries.all()] for b in Bloc.objects.prefetch_related('countries')} all_country_codes = set(Country.objects.values_list('code', flat=True)) decomposer = SetDecomposer(bloc_names2country_codes, all_country_codes) re...
BlocManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlocManager: def make_get_description_from_countries(self) -> 'Callable[[Iterable[Country]], str]': """Return a function taking as input an iterable of countries and returning a string describing the set of countries in terms of blocs.""" <|body_0|> def get_country_id2contai...
stack_v2_sparse_classes_36k_train_013415
1,851
no_license
[ { "docstring": "Return a function taking as input an iterable of countries and returning a string describing the set of countries in terms of blocs.", "name": "make_get_description_from_countries", "signature": "def make_get_description_from_countries(self) -> 'Callable[[Iterable[Country]], str]'" }, ...
2
null
Implement the Python class `BlocManager` described below. Class description: Implement the BlocManager class. Method signatures and docstrings: - def make_get_description_from_countries(self) -> 'Callable[[Iterable[Country]], str]': Return a function taking as input an iterable of countries and returning a string des...
Implement the Python class `BlocManager` described below. Class description: Implement the BlocManager class. Method signatures and docstrings: - def make_get_description_from_countries(self) -> 'Callable[[Iterable[Country]], str]': Return a function taking as input an iterable of countries and returning a string des...
196e849cb70de44523132e67659f8344f8d5cc0a
<|skeleton|> class BlocManager: def make_get_description_from_countries(self) -> 'Callable[[Iterable[Country]], str]': """Return a function taking as input an iterable of countries and returning a string describing the set of countries in terms of blocs.""" <|body_0|> def get_country_id2contai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlocManager: def make_get_description_from_countries(self) -> 'Callable[[Iterable[Country]], str]': """Return a function taking as input an iterable of countries and returning a string describing the set of countries in terms of blocs.""" bloc_names2country_codes = {b.name: [c.code for c in b....
the_stack_v2_python_sparse
backend/app/models/bloc.py
dandavison/_owldock
train
0
23f6d393e0cae3bd82b6274a4a3fde5988f5b513
[ "self._key_to_value: Dict[Hashable, object] = {}\nself._key_to_value_get = self._key_to_value.get\nself._key_to_value_set = self._key_to_value.__setitem__\nself._lock = Lock()", "assert isinstance(key, Hashable), f'{repr(key)} unhashable.'\nwith self._lock:\n value_old = self._key_to_value_get(key, _SENTINEL)\...
<|body_start_0|> self._key_to_value: Dict[Hashable, object] = {} self._key_to_value_get = self._key_to_value.get self._key_to_value_set = self._key_to_value.__setitem__ self._lock = Lock() <|end_body_0|> <|body_start_1|> assert isinstance(key, Hashable), f'{repr(key)} unhashable...
**Thread-safe strongly unbounded cache** (i.e., mapping of unlimited size from strongly referenced arbitrary keys onto strongly referenced arbitrary values, whose methods are guaranteed to behave thread-safely). Design ------ Cache implementations typically employ weak references for safety. Employing strong references...
CacheUnboundedStrong
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacheUnboundedStrong: """**Thread-safe strongly unbounded cache** (i.e., mapping of unlimited size from strongly referenced arbitrary keys onto strongly referenced arbitrary values, whose methods are guaranteed to behave thread-safely). Design ------ Cache implementations typically employ weak re...
stack_v2_sparse_classes_36k_train_013416
8,884
permissive
[ { "docstring": "Initialize this cache to an empty cache.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Statically associate the passed key with the passed value if this cache has yet to cache this key (i.e., if this method has yet to be passed this key) and, ...
3
null
Implement the Python class `CacheUnboundedStrong` described below. Class description: **Thread-safe strongly unbounded cache** (i.e., mapping of unlimited size from strongly referenced arbitrary keys onto strongly referenced arbitrary values, whose methods are guaranteed to behave thread-safely). Design ------ Cache i...
Implement the Python class `CacheUnboundedStrong` described below. Class description: **Thread-safe strongly unbounded cache** (i.e., mapping of unlimited size from strongly referenced arbitrary keys onto strongly referenced arbitrary values, whose methods are guaranteed to behave thread-safely). Design ------ Cache i...
3df840dfd11f09dc9b6f04cb6d29703909e2cb0a
<|skeleton|> class CacheUnboundedStrong: """**Thread-safe strongly unbounded cache** (i.e., mapping of unlimited size from strongly referenced arbitrary keys onto strongly referenced arbitrary values, whose methods are guaranteed to behave thread-safely). Design ------ Cache implementations typically employ weak re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CacheUnboundedStrong: """**Thread-safe strongly unbounded cache** (i.e., mapping of unlimited size from strongly referenced arbitrary keys onto strongly referenced arbitrary values, whose methods are guaranteed to behave thread-safely). Design ------ Cache implementations typically employ weak references for ...
the_stack_v2_python_sparse
beartype/_util/cache/map/utilmapbig.py
MTouny/beartype
train
0
5116ed1d9654a14fa2d3b76f27dce49e1f6eb6fd
[ "super(ClusterUNet, self).__init__(cfg, name=name)\nself.model_config = cfg['modules'][name]\nself.num_classes = self.model_config.get('num_classes', 5)\nself.N = self.model_config.get('N', 1)\nself.simpleN = self.model_config.get('simple_conv', False)\nself.embedding_dim = self.model_config.get('embedding_dim', 8)...
<|body_start_0|> super(ClusterUNet, self).__init__(cfg, name=name) self.model_config = cfg['modules'][name] self.num_classes = self.model_config.get('num_classes', 5) self.N = self.model_config.get('N', 1) self.simpleN = self.model_config.get('simple_conv', False) self.em...
ClusterUNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterUNet: def __init__(self, cfg, name='clusterunet'): """Multi-Scale Clustering Network for Particle Instance Segmentation. ClusterUNet adds N convolution layers to each of the decoding path feature tensor of UResNet and outputs an embedding for each spatial resolution. This module s...
stack_v2_sparse_classes_36k_train_013417
11,035
no_license
[ { "docstring": "Multi-Scale Clustering Network for Particle Instance Segmentation. ClusterUNet adds N convolution layers to each of the decoding path feature tensor of UResNet and outputs an embedding for each spatial resolution. This module serves as a base architecture for clustering on multiple spatial resol...
3
stack_v2_sparse_classes_30k_train_001924
Implement the Python class `ClusterUNet` described below. Class description: Implement the ClusterUNet class. Method signatures and docstrings: - def __init__(self, cfg, name='clusterunet'): Multi-Scale Clustering Network for Particle Instance Segmentation. ClusterUNet adds N convolution layers to each of the decodin...
Implement the Python class `ClusterUNet` described below. Class description: Implement the ClusterUNet class. Method signatures and docstrings: - def __init__(self, cfg, name='clusterunet'): Multi-Scale Clustering Network for Particle Instance Segmentation. ClusterUNet adds N convolution layers to each of the decodin...
02269c7ab25d031afd1dd1a60c4d3826cd03a464
<|skeleton|> class ClusterUNet: def __init__(self, cfg, name='clusterunet'): """Multi-Scale Clustering Network for Particle Instance Segmentation. ClusterUNet adds N convolution layers to each of the decoding path feature tensor of UResNet and outputs an embedding for each spatial resolution. This module s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterUNet: def __init__(self, cfg, name='clusterunet'): """Multi-Scale Clustering Network for Particle Instance Segmentation. ClusterUNet adds N convolution layers to each of the decoding path feature tensor of UResNet and outputs an embedding for each spatial resolution. This module serves as a bas...
the_stack_v2_python_sparse
mlreco/models/cluster_cnn/clusternet.py
Picodes/lartpc_mlreco3d
train
0
acef56a8770700fd9b921c31fe63419e0ec40992
[ "super(HealpixSlicer, self).__init__(verbose=verbose, lonCol=lonCol, latCol=latCol, badval=badval, radius=radius, leafsize=leafsize, useCamera=useCamera, rotSkyPosColName=rotSkyPosColName, mjdColName=mjdColName, chipNames=chipNames, latLonDeg=latLonDeg)\nif not hp.isnsideok(nside):\n raise ValueError('Valid valu...
<|body_start_0|> super(HealpixSlicer, self).__init__(verbose=verbose, lonCol=lonCol, latCol=latCol, badval=badval, radius=radius, leafsize=leafsize, useCamera=useCamera, rotSkyPosColName=rotSkyPosColName, mjdColName=mjdColName, chipNames=chipNames, latLonDeg=latLonDeg) if not hp.isnsideok(nside): ...
A spatial slicer that evaluates pointings on a healpix-based grid. Note that a healpix slicer is intended to evaluate the sky on a spatial grid. Usually this grid will be something like RA as the lonCol and Dec as the latCol. However, it could also be altitude and azimuth, in which case altitude as latCol, and azimuth ...
HealpixSlicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HealpixSlicer: """A spatial slicer that evaluates pointings on a healpix-based grid. Note that a healpix slicer is intended to evaluate the sky on a spatial grid. Usually this grid will be something like RA as the lonCol and Dec as the latCol. However, it could also be altitude and azimuth, in wh...
stack_v2_sparse_classes_36k_train_013418
7,657
no_license
[ { "docstring": "Instantiate and set up healpix slicer object.", "name": "__init__", "signature": "def __init__(self, nside=128, lonCol='fieldRA', latCol='fieldDec', latLonDeg=True, verbose=True, badval=hp.UNSEEN, useCache=True, leafsize=100, radius=1.75, useCamera=False, rotSkyPosColName='rotSkyPos', mj...
3
stack_v2_sparse_classes_30k_train_007108
Implement the Python class `HealpixSlicer` described below. Class description: A spatial slicer that evaluates pointings on a healpix-based grid. Note that a healpix slicer is intended to evaluate the sky on a spatial grid. Usually this grid will be something like RA as the lonCol and Dec as the latCol. However, it co...
Implement the Python class `HealpixSlicer` described below. Class description: A spatial slicer that evaluates pointings on a healpix-based grid. Note that a healpix slicer is intended to evaluate the sky on a spatial grid. Usually this grid will be something like RA as the lonCol and Dec as the latCol. However, it co...
81c08613e966e6c516dfda7a2c1a491e77170140
<|skeleton|> class HealpixSlicer: """A spatial slicer that evaluates pointings on a healpix-based grid. Note that a healpix slicer is intended to evaluate the sky on a spatial grid. Usually this grid will be something like RA as the lonCol and Dec as the latCol. However, it could also be altitude and azimuth, in wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HealpixSlicer: """A spatial slicer that evaluates pointings on a healpix-based grid. Note that a healpix slicer is intended to evaluate the sky on a spatial grid. Usually this grid will be something like RA as the lonCol and Dec as the latCol. However, it could also be altitude and azimuth, in which case alti...
the_stack_v2_python_sparse
python/lsst/sims/maf/slicers/healpixSlicer.py
rjassef/sims_maf
train
0
a1069eb9d5e7466eadaa2b7a688c599ec6e65552
[ "if len(s) <= 1:\n return 0\ndp = [0, 0]\nif s[0] == '0':\n dp[1] = 1\nelse:\n dp[0] = 1\nfor i in range(1, len(s)):\n dp[1] = min(dp[0], dp[1]) + (0 if s[i] == '1' else 1)\n dp[0] = dp[0] + (0 if s[i] == '0' else 1)\nreturn min(dp)", "cnt = 0\nans = 0\nfor i in range(len(s)):\n if s[i] == '1':\...
<|body_start_0|> if len(s) <= 1: return 0 dp = [0, 0] if s[0] == '0': dp[1] = 1 else: dp[0] = 1 for i in range(1, len(s)): dp[1] = min(dp[0], dp[1]) + (0 if s[i] == '1' else 1) dp[0] = dp[0] + (0 if s[i] == '0' else 1) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minFlipsMonoIncr0(self, s): """:type s: str :rtype: int""" <|body_0|> def minFlipsMonoIncr(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) <= 1: return 0 dp = [0, 0] ...
stack_v2_sparse_classes_36k_train_013419
1,869
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "minFlipsMonoIncr0", "signature": "def minFlipsMonoIncr0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "minFlipsMonoIncr", "signature": "def minFlipsMonoIncr(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minFlipsMonoIncr0(self, s): :type s: str :rtype: int - def minFlipsMonoIncr(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minFlipsMonoIncr0(self, s): :type s: str :rtype: int - def minFlipsMonoIncr(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def minFlipsMonoIncr0(self, ...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def minFlipsMonoIncr0(self, s): """:type s: str :rtype: int""" <|body_0|> def minFlipsMonoIncr(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minFlipsMonoIncr0(self, s): """:type s: str :rtype: int""" if len(s) <= 1: return 0 dp = [0, 0] if s[0] == '0': dp[1] = 1 else: dp[0] = 1 for i in range(1, len(s)): dp[1] = min(dp[0], dp[1]) + (0 if s...
the_stack_v2_python_sparse
剑指 Offer II 092. 翻转字符.py
yangyuxiang1996/leetcode
train
0
7a50fd0b5cf10a93cc6a5c7e6d77e7f54aaf790b
[ "for key, value_set in set_map.items():\n for value_in_set in value_set:\n if value_in_set.__class__ == enum_value.__class__ and value_in_set == enum_value:\n return key\nreturn None", "if value.command_class == CommandClass.BATTERY:\n return NumericSensorDataTemplateData(ENTITY_DESC_KEY_B...
<|body_start_0|> for key, value_set in set_map.items(): for value_in_set in value_set: if value_in_set.__class__ == enum_value.__class__ and value_in_set == enum_value: return key return None <|end_body_0|> <|body_start_1|> if value.command_class ...
Data template class for Z-Wave Sensor entities.
NumericSensorDataTemplate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumericSensorDataTemplate: """Data template class for Z-Wave Sensor entities.""" def find_key_from_matching_set(enum_value: MultilevelSensorType | MultilevelSensorScaleType | MeterScaleType | EnergyProductionParameter | EnergyProductionScaleType, set_map: Mapping[str, list[MultilevelSensorTy...
stack_v2_sparse_classes_36k_train_013420
22,449
permissive
[ { "docstring": "Find a key in a set map that matches a given enum value.", "name": "find_key_from_matching_set", "signature": "def find_key_from_matching_set(enum_value: MultilevelSensorType | MultilevelSensorScaleType | MeterScaleType | EnergyProductionParameter | EnergyProductionScaleType, set_map: Ma...
2
null
Implement the Python class `NumericSensorDataTemplate` described below. Class description: Data template class for Z-Wave Sensor entities. Method signatures and docstrings: - def find_key_from_matching_set(enum_value: MultilevelSensorType | MultilevelSensorScaleType | MeterScaleType | EnergyProductionParameter | Ener...
Implement the Python class `NumericSensorDataTemplate` described below. Class description: Data template class for Z-Wave Sensor entities. Method signatures and docstrings: - def find_key_from_matching_set(enum_value: MultilevelSensorType | MultilevelSensorScaleType | MeterScaleType | EnergyProductionParameter | Ener...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class NumericSensorDataTemplate: """Data template class for Z-Wave Sensor entities.""" def find_key_from_matching_set(enum_value: MultilevelSensorType | MultilevelSensorScaleType | MeterScaleType | EnergyProductionParameter | EnergyProductionScaleType, set_map: Mapping[str, list[MultilevelSensorTy...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumericSensorDataTemplate: """Data template class for Z-Wave Sensor entities.""" def find_key_from_matching_set(enum_value: MultilevelSensorType | MultilevelSensorScaleType | MeterScaleType | EnergyProductionParameter | EnergyProductionScaleType, set_map: Mapping[str, list[MultilevelSensorType] | list[Mu...
the_stack_v2_python_sparse
homeassistant/components/zwave_js/discovery_data_template.py
home-assistant/core
train
35,501
4f35d6e58f2ae06f86f034e26f77ae20448cb0a8
[ "result = []\n\ndef dfs(r, tmpr):\n if r == len(s) and len(tmpr) == 4:\n result.append(tmpr[:])\n return\n if len(tmpr) > 4:\n return\n for i in range(r + 1, len(s) + 1):\n if i > i + 3:\n break\n if 0 <= int(s[r:i]) <= 255:\n if int(s[r:i]) == 0 and...
<|body_start_0|> result = [] def dfs(r, tmpr): if r == len(s) and len(tmpr) == 4: result.append(tmpr[:]) return if len(tmpr) > 4: return for i in range(r + 1, len(s) + 1): if i > i + 3: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def restoreIpAddresses(self, s): """:type s: str :rtype: List[str] dfs""" <|body_0|> def rewrite(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [] def dfs(r, tmpr): ...
stack_v2_sparse_classes_36k_train_013421
2,292
no_license
[ { "docstring": ":type s: str :rtype: List[str] dfs", "name": "restoreIpAddresses", "signature": "def restoreIpAddresses(self, s)" }, { "docstring": ":type s: str :rtype: List[str]", "name": "rewrite", "signature": "def rewrite(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def restoreIpAddresses(self, s): :type s: str :rtype: List[str] dfs - def rewrite(self, s): :type s: str :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def restoreIpAddresses(self, s): :type s: str :rtype: List[str] dfs - def rewrite(self, s): :type s: str :rtype: List[str] <|skeleton|> class Solution: def restoreIpAddress...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def restoreIpAddresses(self, s): """:type s: str :rtype: List[str] dfs""" <|body_0|> def rewrite(self, s): """:type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def restoreIpAddresses(self, s): """:type s: str :rtype: List[str] dfs""" result = [] def dfs(r, tmpr): if r == len(s) and len(tmpr) == 4: result.append(tmpr[:]) return if len(tmpr) > 4: return ...
the_stack_v2_python_sparse
backtracking/93_Restore_IP_Addresses.py
vsdrun/lc_public
train
6
f4210211733ca76f0073c5bab388ee7ee88ab38a
[ "self.state_model = state_model\nself._action_slug = action_slug\nif self._action_slug is None:\n self._invoked_action = None\nelse:\n self._invoked_action = f'{action_slug}_invoked'\nsuper().__init__(target, *args, logger=logger, **kwargs)", "if self._invoked_action is not None:\n try:\n self.sta...
<|body_start_0|> self.state_model = state_model self._action_slug = action_slug if self._action_slug is None: self._invoked_action = None else: self._invoked_action = f'{action_slug}_invoked' super().__init__(target, *args, logger=logger, **kwargs) <|end_b...
StateModelCommand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StateModelCommand: def __init__(self, target, state_model, action_slug, *args, logger=None, **kwargs): """A base command for commands that drive a state model. :param target: the object that this command acts upon; for example, a component manager :type target: object :param state_model:...
stack_v2_sparse_classes_36k_train_013422
14,989
permissive
[ { "docstring": "A base command for commands that drive a state model. :param target: the object that this command acts upon; for example, a component manager :type target: object :param state_model: the state model that this command uses, for example to raise a fatal error if the command errors out. :type state...
3
stack_v2_sparse_classes_30k_train_019041
Implement the Python class `StateModelCommand` described below. Class description: Implement the StateModelCommand class. Method signatures and docstrings: - def __init__(self, target, state_model, action_slug, *args, logger=None, **kwargs): A base command for commands that drive a state model. :param target: the obj...
Implement the Python class `StateModelCommand` described below. Class description: Implement the StateModelCommand class. Method signatures and docstrings: - def __init__(self, target, state_model, action_slug, *args, logger=None, **kwargs): A base command for commands that drive a state model. :param target: the obj...
32b740065bd856a7155c068e82cede094207ec71
<|skeleton|> class StateModelCommand: def __init__(self, target, state_model, action_slug, *args, logger=None, **kwargs): """A base command for commands that drive a state model. :param target: the object that this command acts upon; for example, a component manager :type target: object :param state_model:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StateModelCommand: def __init__(self, target, state_model, action_slug, *args, logger=None, **kwargs): """A base command for commands that drive a state model. :param target: the object that this command acts upon; for example, a component manager :type target: object :param state_model: the state mod...
the_stack_v2_python_sparse
src/ska_tango_base/commands.py
Umadevi-amin/lmc-base-classes
train
0
d42ed03251948c456c11cb1c31527be41a30e1ca
[ "if not root:\n return []\nres = []\nres += self.inorderTravel(root.left)\nres.append(root.val)\nres += self.inorderTravel(root.right)\nreturn res", "res, stack = ([], [])\nwhile root is not None or stack:\n while root:\n stack.append(root)\n root = root.left\n node = stack.pop()\n res.a...
<|body_start_0|> if not root: return [] res = [] res += self.inorderTravel(root.left) res.append(root.val) res += self.inorderTravel(root.right) return res <|end_body_0|> <|body_start_1|> res, stack = ([], []) while root is not None or stack: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def inorderTravel(self, root: TreeNode) -> list[int]: """递归解法""" <|body_0|> def inorderTravel2(self, root: TreeNode) -> list[int]: """迭代解法""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return [] res = [] ...
stack_v2_sparse_classes_36k_train_013423
725
no_license
[ { "docstring": "递归解法", "name": "inorderTravel", "signature": "def inorderTravel(self, root: TreeNode) -> list[int]" }, { "docstring": "迭代解法", "name": "inorderTravel2", "signature": "def inorderTravel2(self, root: TreeNode) -> list[int]" } ]
2
stack_v2_sparse_classes_30k_train_003109
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTravel(self, root: TreeNode) -> list[int]: 递归解法 - def inorderTravel2(self, root: TreeNode) -> list[int]: 迭代解法
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def inorderTravel(self, root: TreeNode) -> list[int]: 递归解法 - def inorderTravel2(self, root: TreeNode) -> list[int]: 迭代解法 <|skeleton|> class Solution: def inorderTravel(self...
bb02714b312d5a8368d7e4f4c35bb66eaaff36b9
<|skeleton|> class Solution: def inorderTravel(self, root: TreeNode) -> list[int]: """递归解法""" <|body_0|> def inorderTravel2(self, root: TreeNode) -> list[int]: """迭代解法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def inorderTravel(self, root: TreeNode) -> list[int]: """递归解法""" if not root: return [] res = [] res += self.inorderTravel(root.left) res.append(root.val) res += self.inorderTravel(root.right) return res def inorderTravel2(self...
the_stack_v2_python_sparse
数据结构/树/0010inorderTravel.py
AndongWen/leetcode
train
0
2f1dd4047b8f2b459f1514375ed1d1a629f2fcf2
[ "self.env = env\nassert len(state_terminal) == env.no_states\nself.state_terminal = state_terminal", "if abs(state[0] - self.state_terminal[0]) > 4:\n return True\nelif abs(state[1] - self.state_terminal[1]) > 1000:\n return True\nelse:\n return False" ]
<|body_start_0|> self.env = env assert len(state_terminal) == env.no_states self.state_terminal = state_terminal <|end_body_0|> <|body_start_1|> if abs(state[0] - self.state_terminal[0]) > 4: return True elif abs(state[1] - self.state_terminal[1]) > 1000: ...
DIBound
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DIBound: def __init__(self, env, state_terminal): """Input: env : dynamics of the system""" <|body_0|> def end_episode(self, state): """Input: state : state at time t""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.env = env assert len(...
stack_v2_sparse_classes_36k_train_013424
1,738
no_license
[ { "docstring": "Input: env : dynamics of the system", "name": "__init__", "signature": "def __init__(self, env, state_terminal)" }, { "docstring": "Input: state : state at time t", "name": "end_episode", "signature": "def end_episode(self, state)" } ]
2
stack_v2_sparse_classes_30k_train_007432
Implement the Python class `DIBound` described below. Class description: Implement the DIBound class. Method signatures and docstrings: - def __init__(self, env, state_terminal): Input: env : dynamics of the system - def end_episode(self, state): Input: state : state at time t
Implement the Python class `DIBound` described below. Class description: Implement the DIBound class. Method signatures and docstrings: - def __init__(self, env, state_terminal): Input: env : dynamics of the system - def end_episode(self, state): Input: state : state at time t <|skeleton|> class DIBound: def __...
39de89ab859c894e569398636363f1b9731cedfb
<|skeleton|> class DIBound: def __init__(self, env, state_terminal): """Input: env : dynamics of the system""" <|body_0|> def end_episode(self, state): """Input: state : state at time t""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DIBound: def __init__(self, env, state_terminal): """Input: env : dynamics of the system""" self.env = env assert len(state_terminal) == env.no_states self.state_terminal = state_terminal def end_episode(self, state): """Input: state : state at time t""" if...
the_stack_v2_python_sparse
srcpy/model_free/bounds.py
avadesh02/fml-project
train
0
69f86ffd9038b134738c76594792cf6fcb8557e9
[ "test_inventory = ElectricAppliances(123, 'chair', 100, 50, 'GE', 75)\nself.assertEqual(test_inventory.brand, 'GE')\nself.assertEqual(test_inventory.voltage, 75)", "test_inventory = ElectricAppliances(123, 'chair', 100, 50, 'GE', 75).return_as_dictionary()\nself.assertEqual(test_inventory['brand'], 'GE')\nself.as...
<|body_start_0|> test_inventory = ElectricAppliances(123, 'chair', 100, 50, 'GE', 75) self.assertEqual(test_inventory.brand, 'GE') self.assertEqual(test_inventory.voltage, 75) <|end_body_0|> <|body_start_1|> test_inventory = ElectricAppliances(123, 'chair', 100, 50, 'GE', 75).return_as_...
Test the Electrical class
ElectricTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElectricTest: """Test the Electrical class""" def test_init(self): """Test init""" <|body_0|> def test_return_as_dictionary(self): """Test the return as dictionary method""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_inventory = ElectricA...
stack_v2_sparse_classes_36k_train_013425
3,232
no_license
[ { "docstring": "Test init", "name": "test_init", "signature": "def test_init(self)" }, { "docstring": "Test the return as dictionary method", "name": "test_return_as_dictionary", "signature": "def test_return_as_dictionary(self)" } ]
2
stack_v2_sparse_classes_30k_train_017476
Implement the Python class `ElectricTest` described below. Class description: Test the Electrical class Method signatures and docstrings: - def test_init(self): Test init - def test_return_as_dictionary(self): Test the return as dictionary method
Implement the Python class `ElectricTest` described below. Class description: Test the Electrical class Method signatures and docstrings: - def test_init(self): Test init - def test_return_as_dictionary(self): Test the return as dictionary method <|skeleton|> class ElectricTest: """Test the Electrical class""" ...
6ffd7b4ab8346076d3b6cc02ca1ebca3bf028697
<|skeleton|> class ElectricTest: """Test the Electrical class""" def test_init(self): """Test init""" <|body_0|> def test_return_as_dictionary(self): """Test the return as dictionary method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElectricTest: """Test the Electrical class""" def test_init(self): """Test init""" test_inventory = ElectricAppliances(123, 'chair', 100, 50, 'GE', 75) self.assertEqual(test_inventory.brand, 'GE') self.assertEqual(test_inventory.voltage, 75) def test_return_as_diction...
the_stack_v2_python_sparse
students/AndrewMiotke/lesson01/assignment/test_unit.py
UWPCE-PythonCert-ClassRepos/220-Advanced-Summer-2019
train
4
0ade7ff3a4375de4aa53f5b86599052a7db04930
[ "self._request_context = request_context\nself._request = request\nself._scalars_plugin_instance = scalars_plugin_instance\nself._experiment = experiment", "run, tag = metrics.run_tag_from_session_and_metric(self._request.session_name, self._request.metric_name)\nbody, _ = self._scalars_plugin_instance.scalars_im...
<|body_start_0|> self._request_context = request_context self._request = request self._scalars_plugin_instance = scalars_plugin_instance self._experiment = experiment <|end_body_0|> <|body_start_1|> run, tag = metrics.run_tag_from_session_and_metric(self._request.session_name, s...
Handles a ListMetricEvals request.
Handler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Handler: """Handles a ListMetricEvals request.""" def __init__(self, request_context, request, scalars_plugin_instance, experiment): """Constructor. Args: request_context: A tensorboard.context.RequestContext. request: A ListSessionGroupsRequest protobuf. scalars_plugin_instance: A s...
stack_v2_sparse_classes_36k_train_013426
2,132
permissive
[ { "docstring": "Constructor. Args: request_context: A tensorboard.context.RequestContext. request: A ListSessionGroupsRequest protobuf. scalars_plugin_instance: A scalars_plugin.ScalarsPlugin. experiment: A experiment ID, as a possibly-empty `str`.", "name": "__init__", "signature": "def __init__(self, ...
2
stack_v2_sparse_classes_30k_train_006175
Implement the Python class `Handler` described below. Class description: Handles a ListMetricEvals request. Method signatures and docstrings: - def __init__(self, request_context, request, scalars_plugin_instance, experiment): Constructor. Args: request_context: A tensorboard.context.RequestContext. request: A ListSe...
Implement the Python class `Handler` described below. Class description: Handles a ListMetricEvals request. Method signatures and docstrings: - def __init__(self, request_context, request, scalars_plugin_instance, experiment): Constructor. Args: request_context: A tensorboard.context.RequestContext. request: A ListSe...
5961c76dca0fb9bb40d146f5ce13834ac29d8ddb
<|skeleton|> class Handler: """Handles a ListMetricEvals request.""" def __init__(self, request_context, request, scalars_plugin_instance, experiment): """Constructor. Args: request_context: A tensorboard.context.RequestContext. request: A ListSessionGroupsRequest protobuf. scalars_plugin_instance: A s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Handler: """Handles a ListMetricEvals request.""" def __init__(self, request_context, request, scalars_plugin_instance, experiment): """Constructor. Args: request_context: A tensorboard.context.RequestContext. request: A ListSessionGroupsRequest protobuf. scalars_plugin_instance: A scalars_plugin...
the_stack_v2_python_sparse
tensorboard/plugins/hparams/list_metric_evals.py
tensorflow/tensorboard
train
6,766
d8484937f0ac2a2d4dee24e631593bbb667d3973
[ "self.temp_dir = tempfile.mkdtemp()\nself.binfiles = []\nself.to_delete = []\nself.nf = nf\nself.ni = ni\nself.output_fn = output_fn\nself.progress = progress\nself.interval = interval\nself.nsentences = 0", "self.binfiles.append(fn)\nself.to_delete.append(fn)\nif self.progress:\n if self.nsentences % self.int...
<|body_start_0|> self.temp_dir = tempfile.mkdtemp() self.binfiles = [] self.to_delete = [] self.nf = nf self.ni = ni self.output_fn = output_fn self.progress = progress self.interval = interval self.nsentences = 0 <|end_body_0|> <|body_start_1|> ...
Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. TODO(ajit): Rearrange histlib.enco...
PFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PFile: """Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. T...
stack_v2_sparse_classes_36k_train_013427
4,954
no_license
[ { "docstring": "Initialize a .pfile. Args: nf: Number of floats ni: Number of ints output_fn: Name of the .pfile to create progess: If true, print an status messages on number of sentences written to sys.stdout. interval: Number of calls to add_sentence between status messages.", "name": "__init__", "si...
3
null
Implement the Python class `PFile` described below. Class description: Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this c...
Implement the Python class `PFile` described below. Class description: Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this c...
36d9b7b6f864ee93220c960065f8c7e216c5009c
<|skeleton|> class PFile: """Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PFile: """Encapsulate the steps of .pfile creation. Creating a .pfile using obs-print requires encoding each sentence/segment to a binary file, creating an listing of the binary files, and feeding that to obs-print. A lot of tempfiles are created, and this class handles all of the book-keeping. TODO(ajit): Re...
the_stack_v2_python_sparse
sourceCodes/python/util/file.py
melodi-lab/SGM
train
1
9c5c20446e41bbe90b3b51b0c6059018bfa498f2
[ "Thread.__init__(self, name='Reader' + str(instance))\nself.accessCount = accessCount\nself.cell = cell\nself.sleepMax = sleepMax", "print('%s starting up' % self.getName())\nfor count in range(self.accessCount):\n time.sleep(random.randint(1, self.sleepMax))\n value = self.cell.read(lambda counter: self.ce...
<|body_start_0|> Thread.__init__(self, name='Reader' + str(instance)) self.accessCount = accessCount self.cell = cell self.sleepMax = sleepMax <|end_body_0|> <|body_start_1|> print('%s starting up' % self.getName()) for count in range(self.accessCount): time....
Reads from the shared cell
Reader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: """Reads from the shared cell""" def __init__(self, cell, accessCount, sleepMax, instance): """Create a reader of the given shared cell, number of accesses, and maximum sleep interval.""" <|body_0|> def run(self): """Announce start-up, sleep and read from...
stack_v2_sparse_classes_36k_train_013428
5,757
no_license
[ { "docstring": "Create a reader of the given shared cell, number of accesses, and maximum sleep interval.", "name": "__init__", "signature": "def __init__(self, cell, accessCount, sleepMax, instance)" }, { "docstring": "Announce start-up, sleep and read from shared cell the given number of times...
2
stack_v2_sparse_classes_30k_train_010604
Implement the Python class `Reader` described below. Class description: Reads from the shared cell Method signatures and docstrings: - def __init__(self, cell, accessCount, sleepMax, instance): Create a reader of the given shared cell, number of accesses, and maximum sleep interval. - def run(self): Announce start-up...
Implement the Python class `Reader` described below. Class description: Reads from the shared cell Method signatures and docstrings: - def __init__(self, cell, accessCount, sleepMax, instance): Create a reader of the given shared cell, number of accesses, and maximum sleep interval. - def run(self): Announce start-up...
30375264cf0103e3455fdf92c35a2c5c15b5d7ef
<|skeleton|> class Reader: """Reads from the shared cell""" def __init__(self, cell, accessCount, sleepMax, instance): """Create a reader of the given shared cell, number of accesses, and maximum sleep interval.""" <|body_0|> def run(self): """Announce start-up, sleep and read from...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reader: """Reads from the shared cell""" def __init__(self, cell, accessCount, sleepMax, instance): """Create a reader of the given shared cell, number of accesses, and maximum sleep interval.""" Thread.__init__(self, name='Reader' + str(instance)) self.accessCount = accessCount ...
the_stack_v2_python_sparse
Ch10 exercises/reader-writer.py
davelpat/Fundamentals_of_Python
train
1
3d1891aa9cd44a9d17d27e0ade3f91ed28630e5e
[ "if len(nums) == 0:\n self.zero = True\nself.nums = nums\nself.summary = [0] * len(nums)\nself.summary[0] = nums[0]\nfor i in range(1, len(nums)):\n self.summary[i] = self.summary[i - 1] + nums[i]\nself.updateDict = {}", "if self.zero:\n return\nif len(self.nums) == 1:\n self.nums[0] = val\n return...
<|body_start_0|> if len(nums) == 0: self.zero = True self.nums = nums self.summary = [0] * len(nums) self.summary[0] = nums[0] for i in range(1, len(nums)): self.summary[i] = self.summary[i - 1] + nums[i] self.updateDict = {} <|end_body_0|> <|body...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k_train_013429
1,475
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
7a1c3aba65f338f6e11afd2864dabd2b26142b6c
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" if len(nums) == 0: self.zero = True self.nums = nums self.summary = [0] * len(nums) self.summary[0] = nums[0] for i in range(1, len(nums)): self.summary[i] = self.summary[i -...
the_stack_v2_python_sparse
exercise/leetcode/python_src/by2017_Sep/Leet307.py
SS4G/AlgorithmTraining
train
2
8ce58143c4d182c56a2bee7ce2df9457cc7542ef
[ "if not isinstance(args, dict):\n raise TypeError('Object (type %s) is not a dictionary' % type(args))\nfd = sio.BytesIO()\nsavemat(fd, args)\nout = fd.getvalue()\nfd.close()\nreturn out", "fd = sio.BytesIO(msg)\nout = loadmat(fd, matlab_compatible=True)\nmat_keys = ['__header__', '__globals__', '__version__']...
<|body_start_0|> if not isinstance(args, dict): raise TypeError('Object (type %s) is not a dictionary' % type(args)) fd = sio.BytesIO() savemat(fd, args) out = fd.getvalue() fd.close() return out <|end_body_0|> <|body_start_1|> fd = sio.BytesIO(msg) ...
Class for serializing a python object into a bytes message using the Matlab .mat format.
MatSerialize
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatSerialize: """Class for serializing a python object into a bytes message using the Matlab .mat format.""" def func_serialize(self, args): """Serialize a message. Args: args (obj): Python object to be serialized. Returns: bytes, str: Serialized message. Raises: TypeError: If args i...
stack_v2_sparse_classes_36k_train_013430
2,886
permissive
[ { "docstring": "Serialize a message. Args: args (obj): Python object to be serialized. Returns: bytes, str: Serialized message. Raises: TypeError: If args is not a dictionary.", "name": "func_serialize", "signature": "def func_serialize(self, args)" }, { "docstring": "Deserialize a message. Args...
4
stack_v2_sparse_classes_30k_train_000139
Implement the Python class `MatSerialize` described below. Class description: Class for serializing a python object into a bytes message using the Matlab .mat format. Method signatures and docstrings: - def func_serialize(self, args): Serialize a message. Args: args (obj): Python object to be serialized. Returns: byt...
Implement the Python class `MatSerialize` described below. Class description: Class for serializing a python object into a bytes message using the Matlab .mat format. Method signatures and docstrings: - def func_serialize(self, args): Serialize a message. Args: args (obj): Python object to be serialized. Returns: byt...
dcc4d75a4d2c6aaa7e50e75095a16df1df6b2b0a
<|skeleton|> class MatSerialize: """Class for serializing a python object into a bytes message using the Matlab .mat format.""" def func_serialize(self, args): """Serialize a message. Args: args (obj): Python object to be serialized. Returns: bytes, str: Serialized message. Raises: TypeError: If args i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatSerialize: """Class for serializing a python object into a bytes message using the Matlab .mat format.""" def func_serialize(self, args): """Serialize a message. Args: args (obj): Python object to be serialized. Returns: bytes, str: Serialized message. Raises: TypeError: If args is not a dicti...
the_stack_v2_python_sparse
yggdrasil/serialize/MatSerialize.py
leighmatth/yggdrasil
train
0
6fadbdb7d59da050da98b6ebfaa1449f04b33e5f
[ "result = {'result': 'NG', 'error': ''}\ndata_json = request.get_json(force=True)\nflag, error = CtrlUserGroup().update_manager_member(data_json)\nif flag:\n result['result'] = 'OK'\nelse:\n result['error'] = error\nreturn result", "result = {'result': 'NG', 'error': ''}\nflag, error = CtrlUserGroup().delet...
<|body_start_0|> result = {'result': 'NG', 'error': ''} data_json = request.get_json(force=True) flag, error = CtrlUserGroup().update_manager_member(data_json) if flag: result['result'] = 'OK' else: result['error'] = error return result <|end_body_...
项目体制增加组员
ApiManagerMemeber
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiManagerMemeber: """项目体制增加组员""" def post(self): """更新""" <|body_0|> def delete(self, proj_id, group_id, user_id, commit_user): """删除""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {'result': 'NG', 'error': ''} data_json = req...
stack_v2_sparse_classes_36k_train_013431
3,031
no_license
[ { "docstring": "更新", "name": "post", "signature": "def post(self)" }, { "docstring": "删除", "name": "delete", "signature": "def delete(self, proj_id, group_id, user_id, commit_user)" } ]
2
stack_v2_sparse_classes_30k_train_005632
Implement the Python class `ApiManagerMemeber` described below. Class description: 项目体制增加组员 Method signatures and docstrings: - def post(self): 更新 - def delete(self, proj_id, group_id, user_id, commit_user): 删除
Implement the Python class `ApiManagerMemeber` described below. Class description: 项目体制增加组员 Method signatures and docstrings: - def post(self): 更新 - def delete(self, proj_id, group_id, user_id, commit_user): 删除 <|skeleton|> class ApiManagerMemeber: """项目体制增加组员""" def post(self): """更新""" <|b...
64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11
<|skeleton|> class ApiManagerMemeber: """项目体制增加组员""" def post(self): """更新""" <|body_0|> def delete(self, proj_id, group_id, user_id, commit_user): """删除""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiManagerMemeber: """项目体制增加组员""" def post(self): """更新""" result = {'result': 'NG', 'error': ''} data_json = request.get_json(force=True) flag, error = CtrlUserGroup().update_manager_member(data_json) if flag: result['result'] = 'OK' else: ...
the_stack_v2_python_sparse
koala/koala_server/app/api_1_0/api_user_group.py
lsn1183/web_project
train
0
381257b4eff807db729903150781ef6eb9abbb23
[ "self.decks = deck()\nself.decks.shuffle()\nself.one_score = 0\nself.two_score = 0", "deck_dbl = 2\nassert len(self.decks.deck) > n, 'Deck has not enough cards'\nself.decks.deal_cards(n * 2)\nfor i in range(1, n + 1, 1):\n player_one_card = self.decks.dealt_cards[deck_dbl * i - deck_dbl]\n player_two_card =...
<|body_start_0|> self.decks = deck() self.decks.shuffle() self.one_score = 0 self.two_score = 0 <|end_body_0|> <|body_start_1|> deck_dbl = 2 assert len(self.decks.deck) > n, 'Deck has not enough cards' self.decks.deal_cards(n * 2) for i in range(1, n + 1,...
WarGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarGame: def __init__(self): """Initializes WarGame and creates a score for player one and two. It first creates a deck and then shuffles it""" <|body_0|> def play_rounds(self, n=1): """Plays the game for n times(rounds). It also prints who wins for each round. In th...
stack_v2_sparse_classes_36k_train_013432
14,518
no_license
[ { "docstring": "Initializes WarGame and creates a score for player one and two. It first creates a deck and then shuffles it", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Plays the game for n times(rounds). It also prints who wins for each round. In the end it prints...
3
stack_v2_sparse_classes_30k_train_006829
Implement the Python class `WarGame` described below. Class description: Implement the WarGame class. Method signatures and docstrings: - def __init__(self): Initializes WarGame and creates a score for player one and two. It first creates a deck and then shuffles it - def play_rounds(self, n=1): Plays the game for n ...
Implement the Python class `WarGame` described below. Class description: Implement the WarGame class. Method signatures and docstrings: - def __init__(self): Initializes WarGame and creates a score for player one and two. It first creates a deck and then shuffles it - def play_rounds(self, n=1): Plays the game for n ...
a26bfcb962a7e30cf87b138ee21f0026811d123e
<|skeleton|> class WarGame: def __init__(self): """Initializes WarGame and creates a score for player one and two. It first creates a deck and then shuffles it""" <|body_0|> def play_rounds(self, n=1): """Plays the game for n times(rounds). It also prints who wins for each round. In th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WarGame: def __init__(self): """Initializes WarGame and creates a score for player one and two. It first creates a deck and then shuffles it""" self.decks = deck() self.decks.shuffle() self.one_score = 0 self.two_score = 0 def play_rounds(self, n=1): """Pla...
the_stack_v2_python_sparse
Homeworks/hw08.py
iLuigi98/UCSD-DSC20
train
0
f1f2ab8a2dd361b8dd32ad5e25f9c3c0393a02d9
[ "if not is_string(field):\n raise TypeError('Field name must be a string')\nfield = field.strip()\nif not field or ' ' in field:\n raise ValueError(\"Empty or invalid property field name '{0}'\".format(field))\nif name is not None:\n if not is_string(name):\n raise TypeError('Property name must be a...
<|body_start_0|> if not is_string(field): raise TypeError('Field name must be a string') field = field.strip() if not field or ' ' in field: raise ValueError("Empty or invalid property field name '{0}'".format(field)) if name is not None: if not is_str...
@Property decorator Defines a component property.
Property
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Property: """@Property decorator Defines a component property.""" def __init__(self, field=None, name=None, value=None): """Sets up the property :param field: The property field in the class (can't be None nor empty) :param name: The property name (if None, this will be the field nam...
stack_v2_sparse_classes_36k_train_013433
41,418
permissive
[ { "docstring": "Sets up the property :param field: The property field in the class (can't be None nor empty) :param name: The property name (if None, this will be the field name) :param value: The property value :raise TypeError: Invalid argument type :raise ValueError: If the name or the name is None or empty"...
2
stack_v2_sparse_classes_30k_train_021157
Implement the Python class `Property` described below. Class description: @Property decorator Defines a component property. Method signatures and docstrings: - def __init__(self, field=None, name=None, value=None): Sets up the property :param field: The property field in the class (can't be None nor empty) :param nam...
Implement the Python class `Property` described below. Class description: @Property decorator Defines a component property. Method signatures and docstrings: - def __init__(self, field=None, name=None, value=None): Sets up the property :param field: The property field in the class (can't be None nor empty) :param nam...
686556cdde20beba77ae202de9969be46feed5e2
<|skeleton|> class Property: """@Property decorator Defines a component property.""" def __init__(self, field=None, name=None, value=None): """Sets up the property :param field: The property field in the class (can't be None nor empty) :param name: The property name (if None, this will be the field nam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Property: """@Property decorator Defines a component property.""" def __init__(self, field=None, name=None, value=None): """Sets up the property :param field: The property field in the class (can't be None nor empty) :param name: The property name (if None, this will be the field name) :param val...
the_stack_v2_python_sparse
python/src/lib/python/pelix/ipopo/decorators.py
cohorte/cohorte-runtime
train
3
35c1c558537f07acdb4f2470cb96e1cf791c61ff
[ "self.surface = pygame.Surface(dim)\nself.center = (dim[0] // 2, dim[1] // 2)\nself.radius = dim[1] // 2\nself.radius = 100\nself.chunk = 360\nself.format = pyaudio.paInt16\naudio = pyaudio.PyAudio()\nself.stream = audio.open(format=pyaudio.paInt16, channels=1, rate=rate, input=True, frames_per_buffer=self.chunk)\n...
<|body_start_0|> self.surface = pygame.Surface(dim) self.center = (dim[0] // 2, dim[1] // 2) self.radius = dim[1] // 2 self.radius = 100 self.chunk = 360 self.format = pyaudio.paInt16 audio = pyaudio.PyAudio() self.stream = audio.open(format=pyaudio.paInt1...
audio spectrograph effect for background
SpectrumCircle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectrumCircle: """audio spectrograph effect for background""" def __init__(self, dim: tuple, rate: int=44100): """polar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate""" <|body_0|> def update(self) -> pygame.Surface: """update every fram...
stack_v2_sparse_classes_36k_train_013434
4,338
no_license
[ { "docstring": "polar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate", "name": "__init__", "signature": "def __init__(self, dim: tuple, rate: int=44100)" }, { "docstring": "update every frame", "name": "update", "signature": "def update(self) -> pygame.Surface" ...
2
null
Implement the Python class `SpectrumCircle` described below. Class description: audio spectrograph effect for background Method signatures and docstrings: - def __init__(self, dim: tuple, rate: int=44100): polar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate - def update(self) -> pygame.Surfa...
Implement the Python class `SpectrumCircle` described below. Class description: audio spectrograph effect for background Method signatures and docstrings: - def __init__(self, dim: tuple, rate: int=44100): polar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate - def update(self) -> pygame.Surfa...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class SpectrumCircle: """audio spectrograph effect for background""" def __init__(self, dim: tuple, rate: int=44100): """polar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate""" <|body_0|> def update(self) -> pygame.Surface: """update every fram...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectrumCircle: """audio spectrograph effect for background""" def __init__(self, dim: tuple, rate: int=44100): """polar spectrograph :param dim: dimension in (x, y) :param rate: sampling rate""" self.surface = pygame.Surface(dim) self.center = (dim[0] // 2, dim[1] // 2) s...
the_stack_v2_python_sparse
effects/Spectrographs.py
gunny26/pygame
train
5
0a107924bf5ad651bba0fead48d0853bb5e914b2
[ "if not (head and head.next):\n return head\nnext = head.next\nhead.next = self.swapPairs(next.next)\nnext.next = head\nreturn next", "prev = dummy = ListNode(None)\nprev.next = head\nwhile prev.next and prev.next.next:\n a1 = prev.next\n a2 = a1.next\n a1.next = a2.next\n a2.next = a1\n prev.ne...
<|body_start_0|> if not (head and head.next): return head next = head.next head.next = self.swapPairs(next.next) next.next = head return next <|end_body_0|> <|body_start_1|> prev = dummy = ListNode(None) prev.next = head while prev.next and pr...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swapPairs_1(self, head: ListNode) -> ListNode: """1. 递归解法""" <|body_0|> def swapPairs(self, head: ListNode) -> ListNode: """2. 递推解法:多个节点 prev、a1、a2、next 的交替操作; 难点:要返回处理后链表的 首节点 --> 设置一个 dummy 节点!!""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_013435
2,016
no_license
[ { "docstring": "1. 递归解法", "name": "swapPairs_1", "signature": "def swapPairs_1(self, head: ListNode) -> ListNode" }, { "docstring": "2. 递推解法:多个节点 prev、a1、a2、next 的交替操作; 难点:要返回处理后链表的 首节点 --> 设置一个 dummy 节点!!", "name": "swapPairs", "signature": "def swapPairs(self, head: ListNode) -> ListNo...
2
stack_v2_sparse_classes_30k_train_011751
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs_1(self, head: ListNode) -> ListNode: 1. 递归解法 - def swapPairs(self, head: ListNode) -> ListNode: 2. 递推解法:多个节点 prev、a1、a2、next 的交替操作; 难点:要返回处理后链表的 首节点 --> 设置一个 dummy ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs_1(self, head: ListNode) -> ListNode: 1. 递归解法 - def swapPairs(self, head: ListNode) -> ListNode: 2. 递推解法:多个节点 prev、a1、a2、next 的交替操作; 难点:要返回处理后链表的 首节点 --> 设置一个 dummy ...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def swapPairs_1(self, head: ListNode) -> ListNode: """1. 递归解法""" <|body_0|> def swapPairs(self, head: ListNode) -> ListNode: """2. 递推解法:多个节点 prev、a1、a2、next 的交替操作; 难点:要返回处理后链表的 首节点 --> 设置一个 dummy 节点!!""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def swapPairs_1(self, head: ListNode) -> ListNode: """1. 递归解法""" if not (head and head.next): return head next = head.next head.next = self.swapPairs(next.next) next.next = head return next def swapPairs(self, head: ListNode) -> ListNo...
the_stack_v2_python_sparse
02-linkedlist/24.两两交换链表中的节点.py
xiaoruijiang/algorithm
train
0
d184f43ace6aed4cafc1c44e3e9997b24506c9d6
[ "if not nums:\n return None\nmaxnum = nums[0]\ndp = [0] * len(nums)\ndp[0] = nums[0]\nfor i in range(1, len(nums)):\n dp[i] = nums[i] + dp[i - 1] if dp[i - 1] > 0 else nums[i]\n maxnum = max(dp[i], maxnum)\nreturn maxnum", "if not nums:\n return None\nmaxnum = nums[0]\nmaxendwithi = nums[0]\nfor i in ...
<|body_start_0|> if not nums: return None maxnum = nums[0] dp = [0] * len(nums) dp[0] = nums[0] for i in range(1, len(nums)): dp[i] = nums[i] + dp[i - 1] if dp[i - 1] > 0 else nums[i] maxnum = max(dp[i], maxnum) return maxnum <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013436
1,035
no_license
[ { "docstring": ":type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4], - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4], - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],...
85128e7d26157b3c36eb43868269de42ea2fcb98
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int [-2,1,-3,4,-1,2,1,-5,4],""" if not nums: return None maxnum = nums[0] dp = [0] * len(nums) dp[0] = nums[0] for i in range(1, len(nums)): dp[i] = nums[i] + dp[i - ...
the_stack_v2_python_sparse
src/maxSubArray.py
jsdiuf/leetcode
train
1
a08c3a72efe65833d82f927c705c7737c8349713
[ "left = array[start:middle]\nright = array[middle:end]\nleft.append(sys.maxsize)\nright.append(sys.maxsize)\nleft_inx = 0\nright_inx = 0\nfor inx in range(start, end):\n if left[left_inx] <= right[right_inx]:\n array[inx] = left[left_inx]\n left_inx += 1\n else:\n array[inx] = right[right...
<|body_start_0|> left = array[start:middle] right = array[middle:end] left.append(sys.maxsize) right.append(sys.maxsize) left_inx = 0 right_inx = 0 for inx in range(start, end): if left[left_inx] <= right[right_inx]: array[inx] = left[l...
Implementation of merge sort Thomas H. Cormen Algorithms Unlocked (2013) page 54
MergeSort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MergeSort: """Implementation of merge sort Thomas H. Cormen Algorithms Unlocked (2013) page 54""" def merge(array, start, middle, end): """Merge of two pre sorted arrays left and right both arrays should be have common border :Parameters: array: *list* - array of elements to sort sta...
stack_v2_sparse_classes_36k_train_013437
2,707
no_license
[ { "docstring": "Merge of two pre sorted arrays left and right both arrays should be have common border :Parameters: array: *list* - array of elements to sort start: *number* - start index of left array middle: *number* - end of left array end; end: *number* - end right array", "name": "merge", "signatur...
3
stack_v2_sparse_classes_30k_train_012619
Implement the Python class `MergeSort` described below. Class description: Implementation of merge sort Thomas H. Cormen Algorithms Unlocked (2013) page 54 Method signatures and docstrings: - def merge(array, start, middle, end): Merge of two pre sorted arrays left and right both arrays should be have common border :...
Implement the Python class `MergeSort` described below. Class description: Implementation of merge sort Thomas H. Cormen Algorithms Unlocked (2013) page 54 Method signatures and docstrings: - def merge(array, start, middle, end): Merge of two pre sorted arrays left and right both arrays should be have common border :...
8b3b1f146b7eac5dc15b16aaf837441069cf5989
<|skeleton|> class MergeSort: """Implementation of merge sort Thomas H. Cormen Algorithms Unlocked (2013) page 54""" def merge(array, start, middle, end): """Merge of two pre sorted arrays left and right both arrays should be have common border :Parameters: array: *list* - array of elements to sort sta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MergeSort: """Implementation of merge sort Thomas H. Cormen Algorithms Unlocked (2013) page 54""" def merge(array, start, middle, end): """Merge of two pre sorted arrays left and right both arrays should be have common border :Parameters: array: *list* - array of elements to sort start: *number* ...
the_stack_v2_python_sparse
sort/merge.py
shuvava/python_algorithms
train
2
5632a874d92f4e5186e2f6fc66b4fb5dea18b8e0
[ "if value is None:\n return SkillEffectiveness.StandardPeriodic\nif isinstance(value, SkillEffectiveness):\n return value\nmapping = dict()\nif hasattr(SkillEffectiveness, 'Small'):\n mapping[CommonSkillEffectiveness.SMALL] = SkillEffectiveness.Small\nif hasattr(SkillEffectiveness, 'Large'):\n mapping[C...
<|body_start_0|> if value is None: return SkillEffectiveness.StandardPeriodic if isinstance(value, SkillEffectiveness): return value mapping = dict() if hasattr(SkillEffectiveness, 'Small'): mapping[CommonSkillEffectiveness.SMALL] = SkillEffectiveness....
Various Skill Effectiveness.
CommonSkillEffectiveness
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonSkillEffectiveness: """Various Skill Effectiveness.""" def convert_to_vanilla(value: 'CommonSkillEffectiveness') -> SkillEffectiveness: """convert_to_vanilla(value) Convert a value into a vanilla SkillEffectiveness value. :param value: An instance of CommonSkillEffectiveness :t...
stack_v2_sparse_classes_36k_train_013438
5,822
permissive
[ { "docstring": "convert_to_vanilla(value) Convert a value into a vanilla SkillEffectiveness value. :param value: An instance of CommonSkillEffectiveness :type value: CommonSkillEffectiveness :return: The specified value translated to an SkillEffectiveness or StandardPeriodic if the value could not be translated...
2
null
Implement the Python class `CommonSkillEffectiveness` described below. Class description: Various Skill Effectiveness. Method signatures and docstrings: - def convert_to_vanilla(value: 'CommonSkillEffectiveness') -> SkillEffectiveness: convert_to_vanilla(value) Convert a value into a vanilla SkillEffectiveness value....
Implement the Python class `CommonSkillEffectiveness` described below. Class description: Various Skill Effectiveness. Method signatures and docstrings: - def convert_to_vanilla(value: 'CommonSkillEffectiveness') -> SkillEffectiveness: convert_to_vanilla(value) Convert a value into a vanilla SkillEffectiveness value....
58e7beb30b9c818b294d35abd2436a0192cd3e82
<|skeleton|> class CommonSkillEffectiveness: """Various Skill Effectiveness.""" def convert_to_vanilla(value: 'CommonSkillEffectiveness') -> SkillEffectiveness: """convert_to_vanilla(value) Convert a value into a vanilla SkillEffectiveness value. :param value: An instance of CommonSkillEffectiveness :t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonSkillEffectiveness: """Various Skill Effectiveness.""" def convert_to_vanilla(value: 'CommonSkillEffectiveness') -> SkillEffectiveness: """convert_to_vanilla(value) Convert a value into a vanilla SkillEffectiveness value. :param value: An instance of CommonSkillEffectiveness :type value: Co...
the_stack_v2_python_sparse
Scripts/sims4communitylib/enums/common_skill_effectiveness.py
ColonolNutty/Sims4CommunityLibrary
train
183
12d4da5cc1de552b81dbc74e37fb09e85d4b633f
[ "unit = service.get(id)\nif not unit:\n abort(404, 'unit {} Not Found'.format(id))\nresponse = detail_schema.dump(unit).data\nreturn (response, 200)", "unit = service.get(id)\nif not unit:\n abort(404, 'unit {} Not Found'.format(id))\nunit = detail_schema.load(api.payload, instance=unit, partial=True)\nif n...
<|body_start_0|> unit = service.get(id) if not unit: abort(404, 'unit {} Not Found'.format(id)) response = detail_schema.dump(unit).data return (response, 200) <|end_body_0|> <|body_start_1|> unit = service.get(id) if not unit: abort(404, 'unit {}...
Unit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Unit: def get(self, id): """Fetch a unit resource given its id""" <|body_0|> def put(self, id): """Update a paramters data given its id""" <|body_1|> def delete(self, id): """Deletes a unit given its id""" <|body_2|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_013439
2,616
no_license
[ { "docstring": "Fetch a unit resource given its id", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update a paramters data given its id", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Deletes a unit given its id", "name": "delete", ...
3
stack_v2_sparse_classes_30k_train_019961
Implement the Python class `Unit` described below. Class description: Implement the Unit class. Method signatures and docstrings: - def get(self, id): Fetch a unit resource given its id - def put(self, id): Update a paramters data given its id - def delete(self, id): Deletes a unit given its id
Implement the Python class `Unit` described below. Class description: Implement the Unit class. Method signatures and docstrings: - def get(self, id): Fetch a unit resource given its id - def put(self, id): Update a paramters data given its id - def delete(self, id): Deletes a unit given its id <|skeleton|> class Un...
d6f026e1a75d65cac993a674e9e8bcf91bc9158b
<|skeleton|> class Unit: def get(self, id): """Fetch a unit resource given its id""" <|body_0|> def put(self, id): """Update a paramters data given its id""" <|body_1|> def delete(self, id): """Deletes a unit given its id""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Unit: def get(self, id): """Fetch a unit resource given its id""" unit = service.get(id) if not unit: abort(404, 'unit {} Not Found'.format(id)) response = detail_schema.dump(unit).data return (response, 200) def put(self, id): """Update a param...
the_stack_v2_python_sparse
src/app/api/units.py
USEPA/Interoperable-Watersheds-Network-Data-Appliance
train
2
3c5441a9df4a66d80d30bb975cc02649e04e57f3
[ "if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host", "headers = {'org': org, 'user': user}\nroute_name = ''\nserv...
<|body_start_0|> if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0): raise Exception('server_ip和server_port必须同时指定') self._server_ip = server_ip self._server_port = server_port self._service_name = service_name self._host = host <|end_bod...
AlertRuleClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlertRuleClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和ser...
stack_v2_sparse_classes_36k_train_013440
4,691
permissive
[ { "docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com", "name": "__ini...
3
null
Implement the Python class `AlertRuleClient` described below. Class description: Implement the AlertRuleClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的serv...
Implement the Python class `AlertRuleClient` described below. Class description: Implement the AlertRuleClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的serv...
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
<|skeleton|> class AlertRuleClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和ser...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlertRuleClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,...
the_stack_v2_python_sparse
alert_service_sdk/api/alert_rule/alert_rule_client.py
easyopsapis/easyops-api-python
train
5
b713480e274200242f8abef85847966f5c90cb74
[ "super().__init__()\nself.input_channels = input_channels\nself.output_channels = output_channels\nself.data_layout = data_layout\nGCNConv.global_count += 1\nself.name = name if name else 'GCN_{}'.format(GCNConv.global_count)\nvalue = math.sqrt(6 / (input_channels + output_channels))\nself.mat_weights = lbann.Weigh...
<|body_start_0|> super().__init__() self.input_channels = input_channels self.output_channels = output_channels self.data_layout = data_layout GCNConv.global_count += 1 self.name = name if name else 'GCN_{}'.format(GCNConv.global_count) value = math.sqrt(6 / (inpu...
GCN Conv later. See: https://arxiv.org/abs/1609.02907
GCNConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GCNConv: """GCN Conv later. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): """Initialize GCN layer Args: input_channels (int): The size of the input node features ...
stack_v2_sparse_classes_36k_train_013441
4,650
permissive
[ { "docstring": "Initialize GCN layer Args: input_channels (int): The size of the input node features output_channels (int): The output size of the node features bias (bool): Whether to apply biases after MatMul activation (type): Activation leyer for the node features. If None, then no activation is applied. (d...
2
stack_v2_sparse_classes_30k_val_000849
Implement the Python class `GCNConv` described below. Class description: GCN Conv later. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): Initialize GCN layer Args: i...
Implement the Python class `GCNConv` described below. Class description: GCN Conv later. See: https://arxiv.org/abs/1609.02907 Method signatures and docstrings: - def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): Initialize GCN layer Args: i...
57116ecc030c0d17bc941f81131c1a335bc2c4ad
<|skeleton|> class GCNConv: """GCN Conv later. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): """Initialize GCN layer Args: input_channels (int): The size of the input node features ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GCNConv: """GCN Conv later. See: https://arxiv.org/abs/1609.02907""" def __init__(self, input_channels, output_channels, bias=True, activation=lbann.Relu, name=None, data_layout='data_parallel'): """Initialize GCN layer Args: input_channels (int): The size of the input node features output_channe...
the_stack_v2_python_sparse
python/lbann/modules/graph/sparse/GCNConv.py
oyamay/lbann
train
0
8417dc42f77c4855434f754f63be1bfa4d47bf15
[ "super().__init__()\nlogger.debug('Create PaddleTextConnectionHandler to process the text request')\nself.text_engine = text_engine\nself.task = self.text_engine.executor.task\nself.model = self.text_engine.executor.model\nself.tokenizer = self.text_engine.executor.tokenizer\nself._punc_list = self.text_engine.exec...
<|body_start_0|> super().__init__() logger.debug('Create PaddleTextConnectionHandler to process the text request') self.text_engine = text_engine self.task = self.text_engine.executor.task self.model = self.text_engine.executor.model self.tokenizer = self.text_engine.exec...
PaddleTextConnectionHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaddleTextConnectionHandler: def __init__(self, text_engine): """The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine""" <|body_0|> def run(self, text): """The connection process ...
stack_v2_sparse_classes_36k_train_013442
6,419
permissive
[ { "docstring": "The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine", "name": "__init__", "signature": "def __init__(self, text_engine)" }, { "docstring": "The connection process the request text Args: text ...
5
stack_v2_sparse_classes_30k_train_006414
Implement the Python class `PaddleTextConnectionHandler` described below. Class description: Implement the PaddleTextConnectionHandler class. Method signatures and docstrings: - def __init__(self, text_engine): The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_eng...
Implement the Python class `PaddleTextConnectionHandler` described below. Class description: Implement the PaddleTextConnectionHandler class. Method signatures and docstrings: - def __init__(self, text_engine): The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_eng...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class PaddleTextConnectionHandler: def __init__(self, text_engine): """The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine""" <|body_0|> def run(self, text): """The connection process ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaddleTextConnectionHandler: def __init__(self, text_engine): """The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine""" super().__init__() logger.debug('Create PaddleTextConnectionHandler to proces...
the_stack_v2_python_sparse
paddlespeech/server/engine/text/python/text_engine.py
anniyanvr/DeepSpeech-1
train
0
eedf072f38a5bd0cf24c5bde2febdee1785981fa
[ "self._disable_patching = True\nself._validate_base(self)\nself._disable_patching = False", "self._validate()\nresult = method(*args, **kwargs)\nself._validate()\nreturn result", "attr = super().__getattribute__(name)\nif name in ('_patched_method', '_validate', '_validate_base', '_disable_patching'):\n retu...
<|body_start_0|> self._disable_patching = True self._validate_base(self) self._disable_patching = False <|end_body_0|> <|body_start_1|> self._validate() result = method(*args, **kwargs) self._validate() return result <|end_body_1|> <|body_start_2|> attr ...
InvariantedClass
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvariantedClass: def _validate(self) -> None: """Step 5 (1st flow) or Step 4 (2nd flow). Process contract for object.""" <|body_0|> def _patched_method(self, method: Callable, *args, **kwargs): """Step 4 (1st flow). Call method""" <|body_1|> def __getat...
stack_v2_sparse_classes_36k_train_013443
3,490
permissive
[ { "docstring": "Step 5 (1st flow) or Step 4 (2nd flow). Process contract for object.", "name": "_validate", "signature": "def _validate(self) -> None" }, { "docstring": "Step 4 (1st flow). Call method", "name": "_patched_method", "signature": "def _patched_method(self, method: Callable, ...
4
stack_v2_sparse_classes_30k_train_007069
Implement the Python class `InvariantedClass` described below. Class description: Implement the InvariantedClass class. Method signatures and docstrings: - def _validate(self) -> None: Step 5 (1st flow) or Step 4 (2nd flow). Process contract for object. - def _patched_method(self, method: Callable, *args, **kwargs): ...
Implement the Python class `InvariantedClass` described below. Class description: Implement the InvariantedClass class. Method signatures and docstrings: - def _validate(self) -> None: Step 5 (1st flow) or Step 4 (2nd flow). Process contract for object. - def _patched_method(self, method: Callable, *args, **kwargs): ...
9dff86e1dc5c8607f02ded34b6d64e770f1959fa
<|skeleton|> class InvariantedClass: def _validate(self) -> None: """Step 5 (1st flow) or Step 4 (2nd flow). Process contract for object.""" <|body_0|> def _patched_method(self, method: Callable, *args, **kwargs): """Step 4 (1st flow). Call method""" <|body_1|> def __getat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvariantedClass: def _validate(self) -> None: """Step 5 (1st flow) or Step 4 (2nd flow). Process contract for object.""" self._disable_patching = True self._validate_base(self) self._disable_patching = False def _patched_method(self, method: Callable, *args, **kwargs): ...
the_stack_v2_python_sparse
deal/_decorators/inv.py
toonarmycaptain/deal
train
0
75674ea2539bb7d4187e18d42c38398275d9421c
[ "if authorization_header is None:\n return None\nif not isinstance(authorization_header, str):\n return None\nif not authorization_header.startswith('Basic '):\n return None\nelse:\n return authorization_header.replace('Basic ', '', 1)", "if base64_authorization_header is None:\n return None\nif no...
<|body_start_0|> if authorization_header is None: return None if not isinstance(authorization_header, str): return None if not authorization_header.startswith('Basic '): return None else: return authorization_header.replace('Basic ', '', 1)...
Basic authentication class
BasicAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicAuth: """Basic authentication class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Extracts the base64 encoded authorization header""" <|body_0|> def decode_base64_authorization_header(self, base64_authorization_header: str) -...
stack_v2_sparse_classes_36k_train_013444
3,046
no_license
[ { "docstring": "Extracts the base64 encoded authorization header", "name": "extract_base64_authorization_header", "signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str" }, { "docstring": "Decodes the base64 encoded authorization header", "name": "decod...
5
stack_v2_sparse_classes_30k_train_007224
Implement the Python class `BasicAuth` described below. Class description: Basic authentication class Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: Extracts the base64 encoded authorization header - def decode_base64_authorization_header(self, bas...
Implement the Python class `BasicAuth` described below. Class description: Basic authentication class Method signatures and docstrings: - def extract_base64_authorization_header(self, authorization_header: str) -> str: Extracts the base64 encoded authorization header - def decode_base64_authorization_header(self, bas...
3a9bf33a51033aba492586773b30cd234bc0e80d
<|skeleton|> class BasicAuth: """Basic authentication class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Extracts the base64 encoded authorization header""" <|body_0|> def decode_base64_authorization_header(self, base64_authorization_header: str) -...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicAuth: """Basic authentication class""" def extract_base64_authorization_header(self, authorization_header: str) -> str: """Extracts the base64 encoded authorization header""" if authorization_header is None: return None if not isinstance(authorization_header, str)...
the_stack_v2_python_sparse
0x06-Basic_authentication/api/v1/auth/basic_auth.py
cort-robinson/holbertonschool-web_back_end
train
0
70d4d807891ff208eb54f0241a9d57abbdfa7033
[ "self._site = site\nself._registry_client = registry_client\nif trust_store:\n self._verify = str(trust_store)\nelse:\n self._verify = True\nif not client_credentials:\n self._cred = None\nelse:\n self._cred = (str(client_credentials[0]), str(client_credentials[1]))", "try:\n site = self._registry_...
<|body_start_0|> self._site = site self._registry_client = registry_client if trust_store: self._verify = str(trust_store) else: self._verify = True if not client_credentials: self._cred = None else: self._cred = (str(client...
Handles connecting to other sites' runners and stores.
SiteRestClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SiteRestClient: """Handles connecting to other sites' runners and stores.""" def __init__(self, site: str, registry_client: RegistryClient, trust_store: Optional[Path]=None, client_credentials: Optional[Tuple[Path, Path]]=None) -> None: """Create a SiteRestClient. Args: site: The sit...
stack_v2_sparse_classes_36k_train_013445
6,710
permissive
[ { "docstring": "Create a SiteRestClient. Args: site: The site at which this client acts. registry_client: A registry client to get sites from. trust_store: A file with trusted certificates/anchors. client_credentials: An HTTPS client certificate and the corresponding key, as paths to PEM files.", "name": "_...
6
stack_v2_sparse_classes_30k_train_021565
Implement the Python class `SiteRestClient` described below. Class description: Handles connecting to other sites' runners and stores. Method signatures and docstrings: - def __init__(self, site: str, registry_client: RegistryClient, trust_store: Optional[Path]=None, client_credentials: Optional[Tuple[Path, Path]]=No...
Implement the Python class `SiteRestClient` described below. Class description: Handles connecting to other sites' runners and stores. Method signatures and docstrings: - def __init__(self, site: str, registry_client: RegistryClient, trust_store: Optional[Path]=None, client_credentials: Optional[Tuple[Path, Path]]=No...
22f9533a506e039237227ca66faea5375cce5fcb
<|skeleton|> class SiteRestClient: """Handles connecting to other sites' runners and stores.""" def __init__(self, site: str, registry_client: RegistryClient, trust_store: Optional[Path]=None, client_credentials: Optional[Tuple[Path, Path]]=None) -> None: """Create a SiteRestClient. Args: site: The sit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SiteRestClient: """Handles connecting to other sites' runners and stores.""" def __init__(self, site: str, registry_client: RegistryClient, trust_store: Optional[Path]=None, client_credentials: Optional[Tuple[Path, Path]]=None) -> None: """Create a SiteRestClient. Args: site: The site at which th...
the_stack_v2_python_sparse
mahiru/rest/site_client.py
SecConNet/mahiru
train
4
7517a3815c19aec69e44c85c554b61f4c07b5197
[ "name = name.lower()\nproperties = filter(lambda property_: property_.name.lower() == name, self.property)\nif properties:\n return properties[0].value", "name = name.lower()\nproperties = filter(lambda property_: property_.name.lower() == name, self.property)\nreturn properties and properties[0] or self._Empt...
<|body_start_0|> name = name.lower() properties = filter(lambda property_: property_.name.lower() == name, self.property) if properties: return properties[0].value <|end_body_0|> <|body_start_1|> name = name.lower() properties = filter(lambda property_: property_.nam...
Pattern class to be used as a base for xml node to py object translation
_ObjectifiedXmlNode_
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ObjectifiedXmlNode_: """Pattern class to be used as a base for xml node to py object translation""" def getPropertyValueByName(self, name): """@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection""" <|body_0|> def getPropertyByName(self, name): """Utility met...
stack_v2_sparse_classes_36k_train_013446
39,195
no_license
[ { "docstring": "@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection", "name": "getPropertyValueByName", "signature": "def getPropertyValueByName(self, name)" }, { "docstring": "Utility method making it easy to grab properties defined in such manner <properties> <property name=\"n1\" value=\"...
2
stack_v2_sparse_classes_30k_val_000290
Implement the Python class `_ObjectifiedXmlNode_` described below. Class description: Pattern class to be used as a base for xml node to py object translation Method signatures and docstrings: - def getPropertyValueByName(self, name): @types: str -> _ObjectifiedXmlNode_ or _EmptyCollection - def getPropertyByName(sel...
Implement the Python class `_ObjectifiedXmlNode_` described below. Class description: Pattern class to be used as a base for xml node to py object translation Method signatures and docstrings: - def getPropertyValueByName(self, name): @types: str -> _ObjectifiedXmlNode_ or _EmptyCollection - def getPropertyByName(sel...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class _ObjectifiedXmlNode_: """Pattern class to be used as a base for xml node to py object translation""" def getPropertyValueByName(self, name): """@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection""" <|body_0|> def getPropertyByName(self, name): """Utility met...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _ObjectifiedXmlNode_: """Pattern class to be used as a base for xml node to py object translation""" def getPropertyValueByName(self, name): """@types: str -> _ObjectifiedXmlNode_ or _EmptyCollection""" name = name.lower() properties = filter(lambda property_: property_.name.lower...
the_stack_v2_python_sparse
reference/ucmdb/discovery/glassfish_discoverer.py
madmonkyang/cda-record
train
0
3140a93642e1fd952585b8c9297c03ea08103cc7
[ "self.check_parameters(params)\nct = np.cos(params[0] / 2)\nst = np.sin(params[0] / 2)\ncp = np.cos(params[1])\nsp = np.sin(params[1])\ncl = np.cos(params[2])\nsl = np.sin(params[2])\nel = cl + 1j * sl\nep = cp + 1j * sp\nreturn UnitaryMatrix([[ct, -el * st], [ep * st, ep * el * ct]])", "self.check_parameters(par...
<|body_start_0|> self.check_parameters(params) ct = np.cos(params[0] / 2) st = np.sin(params[0] / 2) cp = np.cos(params[1]) sp = np.sin(params[1]) cl = np.cos(params[2]) sl = np.sin(params[2]) el = cl + 1j * sl ep = cp + 1j * sp return Unit...
The U3 single qubit gate.
U3Gate
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class U3Gate: """The U3 single qubit gate.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" <|body_0|> def get_grad(self, params: Sequence[float]=[]) -> np.ndarray: """Returns the...
stack_v2_sparse_classes_36k_train_013447
2,018
permissive
[ { "docstring": "Returns the unitary for this gate, see Unitary for more info.", "name": "get_unitary", "signature": "def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix" }, { "docstring": "Returns the gradient for this gate, see Gate for more info.", "name": "get_grad", "s...
2
stack_v2_sparse_classes_30k_train_004923
Implement the Python class `U3Gate` described below. Class description: The U3 single qubit gate. Method signatures and docstrings: - def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the unitary for this gate, see Unitary for more info. - def get_grad(self, params: Sequence[float]=[]) -> np...
Implement the Python class `U3Gate` described below. Class description: The U3 single qubit gate. Method signatures and docstrings: - def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: Returns the unitary for this gate, see Unitary for more info. - def get_grad(self, params: Sequence[float]=[]) -> np...
3083218c2f4e3c3ce4ba027d12caa30c384d7665
<|skeleton|> class U3Gate: """The U3 single qubit gate.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" <|body_0|> def get_grad(self, params: Sequence[float]=[]) -> np.ndarray: """Returns the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class U3Gate: """The U3 single qubit gate.""" def get_unitary(self, params: Sequence[float]=[]) -> UnitaryMatrix: """Returns the unitary for this gate, see Unitary for more info.""" self.check_parameters(params) ct = np.cos(params[0] / 2) st = np.sin(params[0] / 2) cp = ...
the_stack_v2_python_sparse
bqskit/ir/gates/parameterized/u3.py
mtreinish/bqskit
train
0
036e53dd52ec497b05b88b7feef4b76992c69b6e
[ "ConfigData.__init__(self)\nself.doMainFrame()\nreturn True", "bmp = wx.Image(self.skinGraphics() + '/splash.png').ConvertToBitmap()\nbmpStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT\nwx.SplashScreen(bmp, bmpStyle, 1000, None, -1)\nwx.Yield()\nself.doWelcome()\nreturn True", "welcome = TemplateDesigner...
<|body_start_0|> ConfigData.__init__(self) self.doMainFrame() return True <|end_body_0|> <|body_start_1|> bmp = wx.Image(self.skinGraphics() + '/splash.png').ConvertToBitmap() bmpStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT wx.SplashScreen(bmp, bmpStyle, 1000, ...
TemplateDesigner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateDesigner: def OnInit(self): """Called after instantiation Calls the Splash screen and returns true""" <|body_0|> def doSplash(self): """Show the Splash screen and call the method which handles the welcome dialog returns true""" <|body_1|> def doW...
stack_v2_sparse_classes_36k_train_013448
1,796
permissive
[ { "docstring": "Called after instantiation Calls the Splash screen and returns true", "name": "OnInit", "signature": "def OnInit(self)" }, { "docstring": "Show the Splash screen and call the method which handles the welcome dialog returns true", "name": "doSplash", "signature": "def doSp...
4
stack_v2_sparse_classes_30k_train_004173
Implement the Python class `TemplateDesigner` described below. Class description: Implement the TemplateDesigner class. Method signatures and docstrings: - def OnInit(self): Called after instantiation Calls the Splash screen and returns true - def doSplash(self): Show the Splash screen and call the method which handl...
Implement the Python class `TemplateDesigner` described below. Class description: Implement the TemplateDesigner class. Method signatures and docstrings: - def OnInit(self): Called after instantiation Calls the Splash screen and returns true - def doSplash(self): Show the Splash screen and call the method which handl...
7981ae2e5984221925f0ff94da88cfe03f8f92fc
<|skeleton|> class TemplateDesigner: def OnInit(self): """Called after instantiation Calls the Splash screen and returns true""" <|body_0|> def doSplash(self): """Show the Splash screen and call the method which handles the welcome dialog returns true""" <|body_1|> def doW...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplateDesigner: def OnInit(self): """Called after instantiation Calls the Splash screen and returns true""" ConfigData.__init__(self) self.doMainFrame() return True def doSplash(self): """Show the Splash screen and call the method which handles the welcome dialog...
the_stack_v2_python_sparse
page_designer/template_designer/code/templatedesigner.py
s0ap/tex
train
0
c5a3ac9f940a7fc2dc669884477d9636fd3ef5d7
[ "print('\\r\\n')\npath = os.path.dirname(os.path.realpath(__file__))\nself.run_check(path)", "print('\\r\\n')\npath = os.path.dirname(os.path.realpath(__file__))\npath += '/../pygccxml/'\nself.run_check(path)", "print('\\r\\n')\npath = os.path.dirname(os.path.realpath(__file__))\npath += '/../docs/examples/'\nf...
<|body_start_0|> print('\r\n') path = os.path.dirname(os.path.realpath(__file__)) self.run_check(path) <|end_body_0|> <|body_start_1|> print('\r\n') path = os.path.dirname(os.path.realpath(__file__)) path += '/../pygccxml/' self.run_check(path) <|end_body_1|> <|...
Test
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test_pep8_conformance_unitests(self): """Pep8 conformance test (unitests) Runs on the unittest directory.""" <|body_0|> def test_pep8_conformance_pygccxml(self): """Pep8 conformance test (pygccxml) Runs on the pygccxml directory.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_013449
2,428
permissive
[ { "docstring": "Pep8 conformance test (unitests) Runs on the unittest directory.", "name": "test_pep8_conformance_unitests", "signature": "def test_pep8_conformance_unitests(self)" }, { "docstring": "Pep8 conformance test (pygccxml) Runs on the pygccxml directory.", "name": "test_pep8_confor...
5
stack_v2_sparse_classes_30k_train_019911
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_pep8_conformance_unitests(self): Pep8 conformance test (unitests) Runs on the unittest directory. - def test_pep8_conformance_pygccxml(self): Pep8 conformance test (pygccxml) Ru...
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_pep8_conformance_unitests(self): Pep8 conformance test (unitests) Runs on the unittest directory. - def test_pep8_conformance_pygccxml(self): Pep8 conformance test (pygccxml) Ru...
f872d056f477ed2438cd22b422d60dc924469805
<|skeleton|> class Test: def test_pep8_conformance_unitests(self): """Pep8 conformance test (unitests) Runs on the unittest directory.""" <|body_0|> def test_pep8_conformance_pygccxml(self): """Pep8 conformance test (pygccxml) Runs on the pygccxml directory.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test: def test_pep8_conformance_unitests(self): """Pep8 conformance test (unitests) Runs on the unittest directory.""" print('\r\n') path = os.path.dirname(os.path.realpath(__file__)) self.run_check(path) def test_pep8_conformance_pygccxml(self): """Pep8 conformanc...
the_stack_v2_python_sparse
unittests/pep8_tester.py
iMichka/pygccxml
train
0
cec802315a266f548a1ba6d8a883d7dc5105a9a5
[ "stack = list()\ncurt = head\nwhile curt:\n stack.append(curt)\n curt = curt.next\ncarry = 1\nwhile stack:\n node = stack.pop()\n su = node.val + carry\n carry = su / 10\n node.val = su % 10\nif carry:\n node = ListNode(1)\n node.next = head\n head = node\nreturn head", "s = ''\nwhile h...
<|body_start_0|> stack = list() curt = head while curt: stack.append(curt) curt = curt.next carry = 1 while stack: node = stack.pop() su = node.val + carry carry = su / 10 node.val = su % 10 if carry:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def plusOne(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def plusOne(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> stack = list() curt = head wh...
stack_v2_sparse_classes_36k_train_013450
1,417
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "plusOne", "signature": "def plusOne(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "plusOne", "signature": "def plusOne(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, head): :type head: ListNode :rtype: ListNode - def plusOne(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def plusOne(self, head): :type head: ListNode :rtype: ListNode - def plusOne(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def plusOne(sel...
8bb17099be02d997d554519be360ef4aa1c028e3
<|skeleton|> class Solution: def plusOne(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def plusOne(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def plusOne(self, head): """:type head: ListNode :rtype: ListNode""" stack = list() curt = head while curt: stack.append(curt) curt = curt.next carry = 1 while stack: node = stack.pop() su = node.val + ca...
the_stack_v2_python_sparse
Google/2. medium/369. Plus One Linked List.py
yemao616/summer18
train
0
06fdbd5e5bf8dcc90ace8ff30c0aa406da1b4ae0
[ "self.page_mock.text = '{{REDaten\\n|BAND=S I\\n|KEINE_SCHÖPFUNGSHÖHE=ON\\n|TODESJAHR=1950\\n}}\\nbla\\n{{REAutor|Stein.}}'\nre_page = RePage(self.page_mock)\ntask = PDKSTask(None, self.logger)\ncompare({'success': True, 'changed': True}, task.run(re_page))\ncompare('', re_page[0]['TODESJAHR'].value)", "self.page...
<|body_start_0|> self.page_mock.text = '{{REDaten\n|BAND=S I\n|KEINE_SCHÖPFUNGSHÖHE=ON\n|TODESJAHR=1950\n}}\nbla\n{{REAutor|Stein.}}' re_page = RePage(self.page_mock) task = PDKSTask(None, self.logger) compare({'success': True, 'changed': True}, task.run(re_page)) compare('', re_...
TestCOPDTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCOPDTask: def test_process_newly_public_domain_tj(self): """article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed""" <|body_0|> def test_process_newly_public_domain_gj(self): """article is in...
stack_v2_sparse_classes_36k_train_013451
3,086
permissive
[ { "docstring": "article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed", "name": "test_process_newly_public_domain_tj", "signature": "def test_process_newly_public_domain_tj(self)" }, { "docstring": "article is in public doma...
5
stack_v2_sparse_classes_30k_train_012759
Implement the Python class `TestCOPDTask` described below. Class description: Implement the TestCOPDTask class. Method signatures and docstrings: - def test_process_newly_public_domain_tj(self): article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article chang...
Implement the Python class `TestCOPDTask` described below. Class description: Implement the TestCOPDTask class. Method signatures and docstrings: - def test_process_newly_public_domain_tj(self): article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article chang...
ce0ff778eb895da81ca5fb1cf2ef4d91f08c1881
<|skeleton|> class TestCOPDTask: def test_process_newly_public_domain_tj(self): """article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed""" <|body_0|> def test_process_newly_public_domain_gj(self): """article is in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCOPDTask: def test_process_newly_public_domain_tj(self): """article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed""" self.page_mock.text = '{{REDaten\n|BAND=S I\n|KEINE_SCHÖPFUNGSHÖHE=ON\n|TODESJAHR=1950\n}}\nbla\n{{RE...
the_stack_v2_python_sparse
service/ws_re/scanner/tasks/test_move_to_public_domain.py
the-it/WS_THEbotIT
train
6
970b77954e3edb5d114b8701f2654963d2ef1263
[ "\"\"\"\n You'll have to do a set of jumps, and choose for each one whether \n to do it using a rope or bricks. It's always optimal to use ropes \n in the largest jumps.\n\n \"\"\"\nA = heights\nheap = []\n'\\n Iterate on the buildings, maintaining the largest r jumps and the \\n ...
<|body_start_0|> """ You'll have to do a set of jumps, and choose for each one whether to do it using a rope or bricks. It's always optimal to use ropes in the largest jumps. """ A = heights heap = [] '\n Iterate o...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def furthestBuilding(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type ladders: int :rtype: int""" <|body_0|> def furthestBuildingHeap(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type la...
stack_v2_sparse_classes_36k_train_013452
4,669
no_license
[ { "docstring": ":type heights: List[int] :type bricks: int :type ladders: int :rtype: int", "name": "furthestBuilding", "signature": "def furthestBuilding(self, heights, bricks, ladders)" }, { "docstring": ":type heights: List[int] :type bricks: int :type ladders: int :rtype: int", "name": "...
3
stack_v2_sparse_classes_30k_train_019929
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def furthestBuilding(self, heights, bricks, ladders): :type heights: List[int] :type bricks: int :type ladders: int :rtype: int - def furthestBuildingHeap(self, heights, bricks, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def furthestBuilding(self, heights, bricks, ladders): :type heights: List[int] :type bricks: int :type ladders: int :rtype: int - def furthestBuildingHeap(self, heights, bricks, ...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def furthestBuilding(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type ladders: int :rtype: int""" <|body_0|> def furthestBuildingHeap(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type la...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def furthestBuilding(self, heights, bricks, ladders): """:type heights: List[int] :type bricks: int :type ladders: int :rtype: int""" """ You'll have to do a set of jumps, and choose for each one whether to do it using a rope or bricks. It's always op...
the_stack_v2_python_sparse
F/FurthestBuildingYouCanReach.py
bssrdf/pyleet
train
2
87629a2c258546b8fa1dd7e4c5ab97a8c2509d27
[ "n2_disp1d = np.arange(-self.N + 1, self.N + 1) ** 2\nn2 = np.sum([el.flatten() for el in np.meshgrid(*[n2_disp1d] * self._ndim)], axis=0)\nif self.spherical:\n n2 = np.array([el for el in n2 if el < self.N ** 2])\nreturn n2", "all_vecs = {}\nfor n2 in self._get_n2():\n all_vecs[n2] = all_vecs.get(n2, 0) + ...
<|body_start_0|> n2_disp1d = np.arange(-self.N + 1, self.N + 1) ** 2 n2 = np.sum([el.flatten() for el in np.meshgrid(*[n2_disp1d] * self._ndim)], axis=0) if self.spherical: n2 = np.array([el for el in n2 if el < self.N ** 2]) return n2 <|end_body_0|> <|body_start_1|> ...
Two dimensional Zeta function for discretized finite volume. This class implements $$ S_2^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi \\\\log(N) + \\\\delta^A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(A\\\\) means either spherical or c...
Zeta2D
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Zeta2D: """Two dimensional Zeta function for discretized finite volume. This class implements $$ S_2^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi \\\\log(N) + \\\\delta^A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(...
stack_v2_sparse_classes_36k_train_013453
5,339
permissive
[ { "docstring": "Returns all normalized momentum modes allowed on the lattice. This is the list of all \\\\\\\\(n^2 = n_1^2 + n_2^2\\\\\\\\) with * \\\\\\\\(\\\\\\\\Lambda \\\\\\\\leq n_i < \\\\\\\\Lambda\\\\\\\\) (cartesian) * \\\\\\\\(n^2 < \\\\\\\\Lambda\\\\\\\\) (spherical)", "name": "_get_n2", "sign...
3
stack_v2_sparse_classes_30k_train_017316
Implement the Python class `Zeta2D` described below. Class description: Two dimensional Zeta function for discretized finite volume. This class implements $$ S_2^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi \\\\log(N) + \\\\delta^A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is...
Implement the Python class `Zeta2D` described below. Class description: Two dimensional Zeta function for discretized finite volume. This class implements $$ S_2^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi \\\\log(N) + \\\\delta^A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is...
d1bc6bff0c6ee9f4dc0d1d0bb4bcfa842c44cceb
<|skeleton|> class Zeta2D: """Two dimensional Zeta function for discretized finite volume. This class implements $$ S_2^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi \\\\log(N) + \\\\delta^A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Zeta2D: """Two dimensional Zeta function for discretized finite volume. This class implements $$ S_2^{A}(x; N) = \\\\sum_{n_i \\\\in M^A(N)} \\\\frac{1}{\\\\vec{n}^2 - x} - 2 \\\\pi \\\\log(N) + \\\\delta^A $$ where \\\\(N = \\\\Lambda L / (2 \\\\pi)\\\\) is the cutoff of the zeta function, \\\\(A\\\\) means ...
the_stack_v2_python_sparse
luescher_nd/zeta/zeta2d.py
ckoerber/luescher-nd
train
2
0372bd457bf7f2bed9a41da325f43fb4081d1f3b
[ "if not head or not head.next:\n return head\nlength = 0\ncur = head\nwhile cur:\n length += 1\n cur = cur.next\nmove = length / 2\ncur = head\npre = head\nwhile move > 0:\n pre = cur\n cur = cur.next\n move -= 1\npre.next = None\nhead2 = self.reverse(cur)\ncur = head\nwhile cur and head2:\n tm...
<|body_start_0|> if not head or not head.next: return head length = 0 cur = head while cur: length += 1 cur = cur.next move = length / 2 cur = head pre = head while move > 0: pre = cur cur = cur.n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reorderList(self, head): """:type head: ListNode :rtype: None Do not return anything, modify head in-place instead.""" <|body_0|> def reverse(self, head): """翻转链表 :param head: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if...
stack_v2_sparse_classes_36k_train_013454
1,383
no_license
[ { "docstring": ":type head: ListNode :rtype: None Do not return anything, modify head in-place instead.", "name": "reorderList", "signature": "def reorderList(self, head)" }, { "docstring": "翻转链表 :param head: :return:", "name": "reverse", "signature": "def reverse(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderList(self, head): :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. - def reverse(self, head): 翻转链表 :param head: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderList(self, head): :type head: ListNode :rtype: None Do not return anything, modify head in-place instead. - def reverse(self, head): 翻转链表 :param head: :return: <|skel...
a75310a96d2b165b15d5ee10ec409a17cdc880ba
<|skeleton|> class Solution: def reorderList(self, head): """:type head: ListNode :rtype: None Do not return anything, modify head in-place instead.""" <|body_0|> def reverse(self, head): """翻转链表 :param head: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reorderList(self, head): """:type head: ListNode :rtype: None Do not return anything, modify head in-place instead.""" if not head or not head.next: return head length = 0 cur = head while cur: length += 1 cur = cur.next...
the_stack_v2_python_sparse
leetcode/linked_list/code/143.py
skyxyz-lang/CS_Note
train
0
79609da4ebb7b41e9546575df82cac770fc8e609
[ "permissions = [IsAuthenticated]\nif self.action in ['update', 'partial_update', 'destroy']:\n permissions.append(IsRecipeOwner)\nreturn [permission() for permission in permissions]", "if self.action == 'create':\n return CreateRecipeSerializer\nelse:\n return RecipeModelSerializer", "fridge_ingredient...
<|body_start_0|> permissions = [IsAuthenticated] if self.action in ['update', 'partial_update', 'destroy']: permissions.append(IsRecipeOwner) return [permission() for permission in permissions] <|end_body_0|> <|body_start_1|> if self.action == 'create': return Cr...
Recipes viewset.
RecipesViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecipesViewSet: """Recipes viewset.""" def get_permissions(self): """Assign permissions based on action.""" <|body_0|> def get_serializer_class(self): """Return serializer class based on action.""" <|body_1|> def possible_recipes(self, request): ...
stack_v2_sparse_classes_36k_train_013455
2,893
no_license
[ { "docstring": "Assign permissions based on action.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Return serializer class based on action.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": ...
4
stack_v2_sparse_classes_30k_train_014141
Implement the Python class `RecipesViewSet` described below. Class description: Recipes viewset. Method signatures and docstrings: - def get_permissions(self): Assign permissions based on action. - def get_serializer_class(self): Return serializer class based on action. - def possible_recipes(self, request): Returns ...
Implement the Python class `RecipesViewSet` described below. Class description: Recipes viewset. Method signatures and docstrings: - def get_permissions(self): Assign permissions based on action. - def get_serializer_class(self): Return serializer class based on action. - def possible_recipes(self, request): Returns ...
5cd1b3155c4542d0479948f39701b539497e28f7
<|skeleton|> class RecipesViewSet: """Recipes viewset.""" def get_permissions(self): """Assign permissions based on action.""" <|body_0|> def get_serializer_class(self): """Return serializer class based on action.""" <|body_1|> def possible_recipes(self, request): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecipesViewSet: """Recipes viewset.""" def get_permissions(self): """Assign permissions based on action.""" permissions = [IsAuthenticated] if self.action in ['update', 'partial_update', 'destroy']: permissions.append(IsRecipeOwner) return [permission() for per...
the_stack_v2_python_sparse
apps/recipes/views/recipes.py
NicolasTerroni/MyFridgeAPI
train
0
bf44bef705f056479f0efebb33885a747a70deea
[ "self.project_id = project_id\nself.cluster_id = cluster_id\ntry:\n self.tool = Tool.objects.get(id=tool_id)\nexcept Tool.DoesNotExist:\n raise ValidationError(f'invalid tool_id({tool_id})')\nself.cmd = HelmCmd(project_id=project_id, cluster_id=cluster_id)", "itool = InstalledTool.create(request_user.userna...
<|body_start_0|> self.project_id = project_id self.cluster_id = cluster_id try: self.tool = Tool.objects.get(id=tool_id) except Tool.DoesNotExist: raise ValidationError(f'invalid tool_id({tool_id})') self.cmd = HelmCmd(project_id=project_id, cluster_id=clu...
组件管理器: 管理组件的安装, 更新和卸载
ToolManager
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "BSD-3-Clause", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToolManager: """组件管理器: 管理组件的安装, 更新和卸载""" def __init__(self, project_id: str, cluster_id: str, tool_id: int): """初始化 :param project_id 项目 ID :param cluster_id 集群 ID :param tool_id 组件库中的组件 ID""" <|body_0|> def install(self, request_user, values: Optional[str]=None) -> Inst...
stack_v2_sparse_classes_36k_train_013456
6,700
permissive
[ { "docstring": "初始化 :param project_id 项目 ID :param cluster_id 集群 ID :param tool_id 组件库中的组件 ID", "name": "__init__", "signature": "def __init__(self, project_id: str, cluster_id: str, tool_id: int)" }, { "docstring": "安装组件 :param request_user: 操作者信息(request.user) :param values: 安装组件时的初始配置", "...
4
null
Implement the Python class `ToolManager` described below. Class description: 组件管理器: 管理组件的安装, 更新和卸载 Method signatures and docstrings: - def __init__(self, project_id: str, cluster_id: str, tool_id: int): 初始化 :param project_id 项目 ID :param cluster_id 集群 ID :param tool_id 组件库中的组件 ID - def install(self, request_user, val...
Implement the Python class `ToolManager` described below. Class description: 组件管理器: 管理组件的安装, 更新和卸载 Method signatures and docstrings: - def __init__(self, project_id: str, cluster_id: str, tool_id: int): 初始化 :param project_id 项目 ID :param cluster_id 集群 ID :param tool_id 组件库中的组件 ID - def install(self, request_user, val...
859a415ef35ea1c01f0ed040956afa849a4cb7be
<|skeleton|> class ToolManager: """组件管理器: 管理组件的安装, 更新和卸载""" def __init__(self, project_id: str, cluster_id: str, tool_id: int): """初始化 :param project_id 项目 ID :param cluster_id 集群 ID :param tool_id 组件库中的组件 ID""" <|body_0|> def install(self, request_user, values: Optional[str]=None) -> Inst...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToolManager: """组件管理器: 管理组件的安装, 更新和卸载""" def __init__(self, project_id: str, cluster_id: str, tool_id: int): """初始化 :param project_id 项目 ID :param cluster_id 集群 ID :param tool_id 组件库中的组件 ID""" self.project_id = project_id self.cluster_id = cluster_id try: self....
the_stack_v2_python_sparse
bcs-ui/backend/container_service/cluster_tools/manager.py
DeveloperJim/bk-bcs
train
5
17d3d0945ade65d73d016a58daaf48e9f5df8891
[ "xsrf_token = self.request.get('xsrf-token', None)\nif settings.XSRF_PROTECTION_ENABLED:\n if not util.XsrfTokenValidate(xsrf_token, action, user=email):\n raise errors.AccessDeniedError('Valid XSRF token not provided')\nelif not xsrf_token:\n logging.info('Ignoring missing XSRF token; settings.XSRF_PR...
<|body_start_0|> xsrf_token = self.request.get('xsrf-token', None) if settings.XSRF_PROTECTION_ENABLED: if not util.XsrfTokenValidate(xsrf_token, action, user=email): raise errors.AccessDeniedError('Valid XSRF token not provided') elif not xsrf_token: logg...
Class which handles AccessError exceptions.
BaseHandler
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseHandler: """Class which handles AccessError exceptions.""" def VerifyXsrfToken(self, action, email=None): """Verifies a valid XSRF token was passed for the current request. Args: action: String, validate the token against this action. email: optional, str; current user's email. R...
stack_v2_sparse_classes_36k_train_013457
4,354
permissive
[ { "docstring": "Verifies a valid XSRF token was passed for the current request. Args: action: String, validate the token against this action. email: optional, str; current user's email. Returns: Boolean. True if the XSRF Token was valid. Raises: errors.AccessDeniedError: the XSRF token was invalid or not suppli...
2
stack_v2_sparse_classes_30k_train_019380
Implement the Python class `BaseHandler` described below. Class description: Class which handles AccessError exceptions. Method signatures and docstrings: - def VerifyXsrfToken(self, action, email=None): Verifies a valid XSRF token was passed for the current request. Args: action: String, validate the token against t...
Implement the Python class `BaseHandler` described below. Class description: Class which handles AccessError exceptions. Method signatures and docstrings: - def VerifyXsrfToken(self, action, email=None): Verifies a valid XSRF token was passed for the current request. Args: action: String, validate the token against t...
d3f52501ebed8b9a392350c8e177bbc602a6a09d
<|skeleton|> class BaseHandler: """Class which handles AccessError exceptions.""" def VerifyXsrfToken(self, action, email=None): """Verifies a valid XSRF token was passed for the current request. Args: action: String, validate the token against this action. email: optional, str; current user's email. R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseHandler: """Class which handles AccessError exceptions.""" def VerifyXsrfToken(self, action, email=None): """Verifies a valid XSRF token was passed for the current request. Args: action: String, validate the token against this action. email: optional, str; current user's email. Returns: Boole...
the_stack_v2_python_sparse
cauliflowervest/server/handlers/base_handler.py
ghas-results/cauliflowervest
train
0
ac10d941590290c988be4b79d33718a2b5a4eb55
[ "app_prompt = {'header': 'Add Reddit application', 'description': \"Please go to https://www.reddit.com/prefs/apps and click on 'create app'.\\nFill out the form that appears:\\nname: enter any name you'd like for the app\\ntype of app: select 'script'\\ndescription: (optional field)\\nabout url: (optional field)\\...
<|body_start_0|> app_prompt = {'header': 'Add Reddit application', 'description': "Please go to https://www.reddit.com/prefs/apps and click on 'create app'.\nFill out the form that appears:\nname: enter any name you'd like for the app\ntype of app: select 'script'\ndescription: (optional field)\nabout url: (opt...
Class defined mainly to add credentials
reddit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class reddit: """Class defined mainly to add credentials""" def add_application(self, appname='default'): """Add a Reddit app""" <|body_0|> def add_credentials(self, appname='default'): """Add credentials to a specified app""" <|body_1|> def _get_client(se...
stack_v2_sparse_classes_36k_train_013458
12,095
no_license
[ { "docstring": "Add a Reddit app", "name": "add_application", "signature": "def add_application(self, appname='default')" }, { "docstring": "Add credentials to a specified app", "name": "add_credentials", "signature": "def add_credentials(self, appname='default')" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_006450
Implement the Python class `reddit` described below. Class description: Class defined mainly to add credentials Method signatures and docstrings: - def add_application(self, appname='default'): Add a Reddit app - def add_credentials(self, appname='default'): Add credentials to a specified app - def _get_client(self, ...
Implement the Python class `reddit` described below. Class description: Class defined mainly to add credentials Method signatures and docstrings: - def add_application(self, appname='default'): Add a Reddit app - def add_credentials(self, appname='default'): Add credentials to a specified app - def _get_client(self, ...
b3532ca47d59013fe88731ee0a5fe95b6e8e40f1
<|skeleton|> class reddit: """Class defined mainly to add credentials""" def add_application(self, appname='default'): """Add a Reddit app""" <|body_0|> def add_credentials(self, appname='default'): """Add credentials to a specified app""" <|body_1|> def _get_client(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class reddit: """Class defined mainly to add credentials""" def add_application(self, appname='default'): """Add a Reddit app""" app_prompt = {'header': 'Add Reddit application', 'description': "Please go to https://www.reddit.com/prefs/apps and click on 'create app'.\nFill out the form that ap...
the_stack_v2_python_sparse
inca/clients/reddit_client.py
uvacw/inca
train
23
8659451e6172ff2bf2a74292389e40a4ed166de5
[ "self.wall_list = pygame.sprite.Group()\nself.enemy_list = pygame.sprite.Group()\nself.sludge = pygame.sprite.Group()\nself.consumeable = pygame.sprite.Group()\nself.can_climb = pygame.sprite.Group()\nself.player = player\nself.spore_list = [Decompose_Spore, Ledge_Spore]\nself.active_spore = self.spore_list[0]\nsel...
<|body_start_0|> self.wall_list = pygame.sprite.Group() self.enemy_list = pygame.sprite.Group() self.sludge = pygame.sprite.Group() self.consumeable = pygame.sprite.Group() self.can_climb = pygame.sprite.Group() self.player = player self.spore_list = [Decompose_Sp...
This is a generic super-class used to define a level. Create a child class for each level with level-specific info.
Room
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Room: """This is a generic super-class used to define a level. Create a child class for each level with level-specific info.""" def __init__(self, player): """Constructor. Pass in a handle to player. Needed for when moving platforms collide with the player.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_013459
4,353
permissive
[ { "docstring": "Constructor. Pass in a handle to player. Needed for when moving platforms collide with the player.", "name": "__init__", "signature": "def __init__(self, player)" }, { "docstring": "Update everything in this level.", "name": "update", "signature": "def update(self)" }, ...
4
stack_v2_sparse_classes_30k_train_013175
Implement the Python class `Room` described below. Class description: This is a generic super-class used to define a level. Create a child class for each level with level-specific info. Method signatures and docstrings: - def __init__(self, player): Constructor. Pass in a handle to player. Needed for when moving plat...
Implement the Python class `Room` described below. Class description: This is a generic super-class used to define a level. Create a child class for each level with level-specific info. Method signatures and docstrings: - def __init__(self, player): Constructor. Pass in a handle to player. Needed for when moving plat...
85b93c3ed756afec05a1c2ca58b68f856aa140cb
<|skeleton|> class Room: """This is a generic super-class used to define a level. Create a child class for each level with level-specific info.""" def __init__(self, player): """Constructor. Pass in a handle to player. Needed for when moving platforms collide with the player.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Room: """This is a generic super-class used to define a level. Create a child class for each level with level-specific info.""" def __init__(self, player): """Constructor. Pass in a handle to player. Needed for when moving platforms collide with the player.""" self.wall_list = pygame.spri...
the_stack_v2_python_sparse
Sean_Code_Review.py
KaitlynKeil/bug-free-spork
train
0
3a04d2fbdbcdd11d1baa0f7f3a87f70299d5ae75
[ "specs = super().getInputSpecification()\nspecs.name = 'differencing'\nspecs.description = 'applies Nth order differencing to the data.'\nspecs.addSub(InputData.parameterInputFactory('order', contentType=InputTypes.IntegerType, descr='differencing order.'))\nreturn specs", "settings = super().handleInput(spec)\ns...
<|body_start_0|> specs = super().getInputSpecification() specs.name = 'differencing' specs.description = 'applies Nth order differencing to the data.' specs.addSub(InputData.parameterInputFactory('order', contentType=InputTypes.IntegerType, descr='differencing order.')) return sp...
Differences the signal N times.
Differencing
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Differencing: """Differences the signal N times.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_013460
5,350
permissive
[ { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls.", "name": "getInputSpecification", "signature": "def getInputSpecification(cls)" }, { "docstring": "Reads...
6
null
Implement the Python class `Differencing` described below. Class description: Differences the signal N times. Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class t...
Implement the Python class `Differencing` described below. Class description: Differences the signal N times. Method signatures and docstrings: - def getInputSpecification(cls): Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class t...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class Differencing: """Differences the signal N times.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Differencing: """Differences the signal N times.""" def getInputSpecification(cls): """Method to get a reference to a class that specifies the input data for class cls. @ In, None @ Out, specs, InputData.ParameterInput, class to use for specifying input of cls.""" specs = super().getInput...
the_stack_v2_python_sparse
ravenframework/TSA/Transformers/Differencing.py
idaholab/raven
train
201
eec162e62d7481b26c41010b187e808c90d05ed2
[ "if not n:\n return n\nprv_1, prv_2 = (1, 0)\nfor i in range(n):\n prv_1, prv_2 = (prv_1 + prv_2, prv_1)\nreturn prv_1", "if n < 3:\n return n\nreturn self.climbStairs(n - 2) + self.climbStairs(n - 1)" ]
<|body_start_0|> if not n: return n prv_1, prv_2 = (1, 0) for i in range(n): prv_1, prv_2 = (prv_1 + prv_2, prv_1) return prv_1 <|end_body_0|> <|body_start_1|> if n < 3: return n return self.climbStairs(n - 2) + self.climbStairs(n - 1)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not n: return n prv_1, prv_2 = (1, 0) ...
stack_v2_sparse_classes_36k_train_013461
547
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "climbStairs", "signature": "def climbStairs(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "climbStairs2", "signature": "def climbStairs2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_009344
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n): :type n: int :rtype: int - def climbStairs2(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def climbStairs(self, n): """:...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" <|body_0|> def climbStairs2(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n): """:type n: int :rtype: int""" if not n: return n prv_1, prv_2 = (1, 0) for i in range(n): prv_1, prv_2 = (prv_1 + prv_2, prv_1) return prv_1 def climbStairs2(self, n): """:type n: int :rtype: int"...
the_stack_v2_python_sparse
cs_notes/dynamic_programming/climbing_stairs.py
hwc1824/LeetCodeSolution
train
0
9985abc960788d175174727dd8eeff505caab325
[ "self.Triton = TritonContext()\nself.Triton.setArchitecture(ARCH.X86_64)\nself.astCtxt = self.Triton.getAstContext()", "expr1 = self.Triton.newSymbolicExpression(self.astCtxt.bv(17, 8))\nmem = MemoryAccess(256, CPUSIZE.BYTE)\nself.Triton.assignSymbolicExpressionToMemory(expr1, mem)\nexpr2 = self.Triton.getSymboli...
<|body_start_0|> self.Triton = TritonContext() self.Triton.setArchitecture(ARCH.X86_64) self.astCtxt = self.Triton.getAstContext() <|end_body_0|> <|body_start_1|> expr1 = self.Triton.newSymbolicExpression(self.astCtxt.bv(17, 8)) mem = MemoryAccess(256, CPUSIZE.BYTE) self...
Testing the symbolic engine.
TestSymbolic
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSymbolic: """Testing the symbolic engine.""" def setUp(self): """Define the arch.""" <|body_0|> def test_bind_expr_to_memory(self): """Check symbolic expression binded to memory can be retrieve.""" <|body_1|> def test_bind_expr_to_multi_memory(se...
stack_v2_sparse_classes_36k_train_013462
4,357
permissive
[ { "docstring": "Define the arch.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Check symbolic expression binded to memory can be retrieve.", "name": "test_bind_expr_to_memory", "signature": "def test_bind_expr_to_memory(self)" }, { "docstring": "Check symbo...
4
null
Implement the Python class `TestSymbolic` described below. Class description: Testing the symbolic engine. Method signatures and docstrings: - def setUp(self): Define the arch. - def test_bind_expr_to_memory(self): Check symbolic expression binded to memory can be retrieve. - def test_bind_expr_to_multi_memory(self):...
Implement the Python class `TestSymbolic` described below. Class description: Testing the symbolic engine. Method signatures and docstrings: - def setUp(self): Define the arch. - def test_bind_expr_to_memory(self): Check symbolic expression binded to memory can be retrieve. - def test_bind_expr_to_multi_memory(self):...
a61651ce331ac53ec09e1d8fef5eab744e98c9de
<|skeleton|> class TestSymbolic: """Testing the symbolic engine.""" def setUp(self): """Define the arch.""" <|body_0|> def test_bind_expr_to_memory(self): """Check symbolic expression binded to memory can be retrieve.""" <|body_1|> def test_bind_expr_to_multi_memory(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSymbolic: """Testing the symbolic engine.""" def setUp(self): """Define the arch.""" self.Triton = TritonContext() self.Triton.setArchitecture(ARCH.X86_64) self.astCtxt = self.Triton.getAstContext() def test_bind_expr_to_memory(self): """Check symbolic exp...
the_stack_v2_python_sparse
src/testers/unittests/test_symbolic.py
JonathanSalwan/Triton
train
3,163
55ebd2d2d70382b10b68b082d5b7b73ced4f01e6
[ "self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nself.K = self.kernel(X_init, X_init)", "σ2 = self.sigma_f ** 2\nl2 = self.l ** 2\nsqr_sumx1 = np.sum(X1 ** 2, 1).reshape(-1, 1)\nsqr_sumx2 = np.sum(X2 ** 2, 1)\nsqr_dist = sqr_sumx1 - 2 * np.dot(X1, X2.T) + sqr_sumx2\nkernel = σ2 * np.exp(-0.5...
<|body_start_0|> self.X = X_init self.Y = Y_init self.l = l self.sigma_f = sigma_f self.K = self.kernel(X_init, X_init) <|end_body_0|> <|body_start_1|> σ2 = self.sigma_f ** 2 l2 = self.l ** 2 sqr_sumx1 = np.sum(X1 ** 2, 1).reshape(-1, 1) sqr_sumx2...
Represents a noiseless 1D Gaussian process
GaussianProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcess: """Represents a noiseless 1D Gaussian process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """Instantiation methid Args: X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function Y_init is a numpy.ndarray ...
stack_v2_sparse_classes_36k_train_013463
2,246
no_license
[ { "docstring": "Instantiation methid Args: X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function Y_init is a numpy.ndarray of shape (t, 1) representing the outputs of the black-box function for each input in X_init l is the length parameter for the kernel ...
3
stack_v2_sparse_classes_30k_train_002506
Implement the Python class `GaussianProcess` described below. Class description: Represents a noiseless 1D Gaussian process Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): Instantiation methid Args: X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampl...
Implement the Python class `GaussianProcess` described below. Class description: Represents a noiseless 1D Gaussian process Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): Instantiation methid Args: X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampl...
bb980395b146c9f4e0d4e9766c4a36f67de70d2e
<|skeleton|> class GaussianProcess: """Represents a noiseless 1D Gaussian process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """Instantiation methid Args: X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function Y_init is a numpy.ndarray ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianProcess: """Represents a noiseless 1D Gaussian process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """Instantiation methid Args: X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function Y_init is a numpy.ndarray of shape (t, ...
the_stack_v2_python_sparse
unsupervised_learning/0x03-hyperparameter_tuning/1-gp.py
AndrewKalil/holbertonschool-machine_learning
train
0
a10bcaeec6ab1d0db5624810b75b64b16fa5857e
[ "task = get_object_or_404(Task, id=id)\nform = TaskForm(instance=task)\nreturn render(request, 'task/add-task.html', {'form': form, 'func': 'Update', 'task': task})", "task = get_object_or_404(Task, id=id)\norder = get_object_or_404(Order, id=task.order.id)\nform = TaskForm(request.POST, instance=task)\nif form.i...
<|body_start_0|> task = get_object_or_404(Task, id=id) form = TaskForm(instance=task) return render(request, 'task/add-task.html', {'form': form, 'func': 'Update', 'task': task}) <|end_body_0|> <|body_start_1|> task = get_object_or_404(Task, id=id) order = get_object_or_404(Orde...
Class based view for updating new task.
TaskUpdateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskUpdateView: """Class based view for updating new task.""" def get(self, request, id): """Return add new task form.""" <|body_0|> def post(self, request, id): """Save order and redirect to task list.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_013464
3,296
no_license
[ { "docstring": "Return add new task form.", "name": "get", "signature": "def get(self, request, id)" }, { "docstring": "Save order and redirect to task list.", "name": "post", "signature": "def post(self, request, id)" } ]
2
stack_v2_sparse_classes_30k_train_006455
Implement the Python class `TaskUpdateView` described below. Class description: Class based view for updating new task. Method signatures and docstrings: - def get(self, request, id): Return add new task form. - def post(self, request, id): Save order and redirect to task list.
Implement the Python class `TaskUpdateView` described below. Class description: Class based view for updating new task. Method signatures and docstrings: - def get(self, request, id): Return add new task form. - def post(self, request, id): Save order and redirect to task list. <|skeleton|> class TaskUpdateView: ...
93c3106ab90fb9aed85658f93f51686ba4734091
<|skeleton|> class TaskUpdateView: """Class based view for updating new task.""" def get(self, request, id): """Return add new task form.""" <|body_0|> def post(self, request, id): """Save order and redirect to task list.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskUpdateView: """Class based view for updating new task.""" def get(self, request, id): """Return add new task form.""" task = get_object_or_404(Task, id=id) form = TaskForm(instance=task) return render(request, 'task/add-task.html', {'form': form, 'func': 'Update', 'tas...
the_stack_v2_python_sparse
order/views/task_views.py
saadali5997/tms
train
0
42a999234b876fab73f16660a6c6d8a2d6aa2612
[ "self.ListOfUrl = ListOfUrl\nself.url = None\nself.usr_agent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}\nself.directory = os.getcwd()\nself.alt_dict = {}\nself.title_dict = {}\nself.h2_dict = {}\nself.h3_dict = {}", "i = ...
<|body_start_0|> self.ListOfUrl = ListOfUrl self.url = None self.usr_agent = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'} self.directory = os.getcwd() self.alt_dict = {} self.title_di...
FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency.
FetchTags
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FetchTags: """FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency.""" def __init__(self, ListOfUrl): """__init__ method takes L...
stack_v2_sparse_classes_36k_train_013465
5,116
permissive
[ { "docstring": "__init__ method takes ListOfUrl generated by SearchResuts module", "name": "__init__", "signature": "def __init__(self, ListOfUrl)" }, { "docstring": "get_results method returns 4 dictionaries with keywords as keys and their frecuency as value", "name": "get_results", "si...
6
stack_v2_sparse_classes_30k_train_013714
Implement the Python class `FetchTags` described below. Class description: FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency. Method signatures and docstrings:...
Implement the Python class `FetchTags` described below. Class description: FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency. Method signatures and docstrings:...
31fd3fb1233f39ea2252a7a44160ff8a2140f7bd
<|skeleton|> class FetchTags: """FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency.""" def __init__(self, ListOfUrl): """__init__ method takes L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FetchTags: """FetchTags class has Constructor, get_results as method with with the Main.py will interact. Other methods with which the internal methods will interact are get_html,get_keywords, save_file and count_frequency.""" def __init__(self, ListOfUrl): """__init__ method takes ListOfUrl gene...
the_stack_v2_python_sparse
Python/Tags_Scraper/Fetch_Tags.py
HarshCasper/Rotten-Scripts
train
1,474
1dfd602082d4f88c2330735a16a65a6c4b56680a
[ "self.index = index\nself.id = 'a' + unicode(index) + 'b' + idevice.id\nself.idevice = idevice\nself.option = option\nself.answerId = 'optionAnswer' + unicode(index) + 'b' + idevice.id\nself.keyId = 'optionKey' + idevice.id\nself.feedbackId = 'optionFeedback' + unicode(index) + 'b' + idevice.id", "log.debug('proc...
<|body_start_0|> self.index = index self.id = 'a' + unicode(index) + 'b' + idevice.id self.idevice = idevice self.option = option self.answerId = 'optionAnswer' + unicode(index) + 'b' + idevice.id self.keyId = 'optionKey' + idevice.id self.feedbackId = 'optionFeed...
OptionElement is responsible for a block of option. Used by MultichoiceBlock
OptionElement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionElement: """OptionElement is responsible for a block of option. Used by MultichoiceBlock""" def __init__(self, index, idevice, option): """Initialize""" <|body_0|> def process(self, request): """Process arguments from the webserver. Return any which apply t...
stack_v2_sparse_classes_36k_train_013466
4,035
no_license
[ { "docstring": "Initialize", "name": "__init__", "signature": "def __init__(self, index, idevice, option)" }, { "docstring": "Process arguments from the webserver. Return any which apply to this element.", "name": "process", "signature": "def process(self, request)" }, { "docstri...
5
stack_v2_sparse_classes_30k_train_019060
Implement the Python class `OptionElement` described below. Class description: OptionElement is responsible for a block of option. Used by MultichoiceBlock Method signatures and docstrings: - def __init__(self, index, idevice, option): Initialize - def process(self, request): Process arguments from the webserver. Ret...
Implement the Python class `OptionElement` described below. Class description: OptionElement is responsible for a block of option. Used by MultichoiceBlock Method signatures and docstrings: - def __init__(self, index, idevice, option): Initialize - def process(self, request): Process arguments from the webserver. Ret...
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
<|skeleton|> class OptionElement: """OptionElement is responsible for a block of option. Used by MultichoiceBlock""" def __init__(self, index, idevice, option): """Initialize""" <|body_0|> def process(self, request): """Process arguments from the webserver. Return any which apply t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptionElement: """OptionElement is responsible for a block of option. Used by MultichoiceBlock""" def __init__(self, index, idevice, option): """Initialize""" self.index = index self.id = 'a' + unicode(index) + 'b' + idevice.id self.idevice = idevice self.option = ...
the_stack_v2_python_sparse
eXe/rev2283-2337/base-trunk-2283/exe/webui/optionelement.py
joliebig/featurehouse_fstmerge_examples
train
3
9ee2298062fb0153b54bfb6f616e084551999668
[ "if root == None:\n return True\nelse:\n return self.judge(root.left, root.right)", "if left == None and right != None:\n return False\nelif left != None and right == None:\n return False\nelif left == None and right == None:\n return True\nelif left.val != right.val:\n return False\nelse:\n ...
<|body_start_0|> if root == None: return True else: return self.judge(root.left, root.right) <|end_body_0|> <|body_start_1|> if left == None and right != None: return False elif left != None and right == None: return False elif lef...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def is_symmetric_1(self, root: TreeNode) -> bool: """递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:""" <|body_0|> def judge(self, left, right): """递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩子和右节点的右孩子是否想等 :param left: :param right: :return:""" ...
stack_v2_sparse_classes_36k_train_013467
3,606
no_license
[ { "docstring": "递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:", "name": "is_symmetric_1", "signature": "def is_symmetric_1(self, root: TreeNode) -> bool" }, { "docstring": "递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩子和右节点的右孩子是否想等 :param left: :param right: :return:", "name": "judge", ...
3
stack_v2_sparse_classes_30k_train_006277
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_symmetric_1(self, root: TreeNode) -> bool: 递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return: - def judge(self, left, right): 递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def is_symmetric_1(self, root: TreeNode) -> bool: 递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return: - def judge(self, left, right): 递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩...
f68e60dd1d8bb010cdae88e6273b3fac4ea48776
<|skeleton|> class Solution: def is_symmetric_1(self, root: TreeNode) -> bool: """递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:""" <|body_0|> def judge(self, left, right): """递归法判断左右节点是否对称, 左节点的右孩子和右节点的左孩子是否相等 左节点的左孩子和右节点的右孩子是否想等 :param left: :param right: :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def is_symmetric_1(self, root: TreeNode) -> bool: """递归法判断是不是镜像二叉树 分支法,看左子树和右子树是不是相等的 :param root: :return:""" if root == None: return True else: return self.judge(root.left, root.right) def judge(self, left, right): """递归法判断左右节点是否对称, 左节点的...
the_stack_v2_python_sparse
tree/101_isSymmetric.py
liying123456/python_leetcode
train
0
a212e9d3903531976da6f89480c480ba0efc3547
[ "self.shape = shape\nself.x_mask = x_mask\nself.y_mask = y_mask", "self.rectangle_mask = np.zeros(self.shape)\nself.rectangle_mask[:] = False\nself.rectangle_mask[self.x_mask[0]:self.x_mask[1], self.y_mask[0]:self.y_mask[1]] = True\nreturn self.rectangle_mask", "if array.shape[:2] != self.shape[:2]:\n raise ...
<|body_start_0|> self.shape = shape self.x_mask = x_mask self.y_mask = y_mask <|end_body_0|> <|body_start_1|> self.rectangle_mask = np.zeros(self.shape) self.rectangle_mask[:] = False self.rectangle_mask[self.x_mask[0]:self.x_mask[1], self.y_mask[0]:self.y_mask[1]] = Tru...
Numpy array with rectangle mask to be applied on 2d or 3d array.
RectangleMask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RectangleMask: """Numpy array with rectangle mask to be applied on 2d or 3d array.""" def __init__(self, shape: Tuple[int, int], x_mask: Tuple[int, int], y_mask: Tuple[int, int]): """:param shape: (x_shape, y_shape) for the original array. :param x_mask: first and last indexes for th...
stack_v2_sparse_classes_36k_train_013468
3,143
no_license
[ { "docstring": ":param shape: (x_shape, y_shape) for the original array. :param x_mask: first and last indexes for the mask on the 0-axis. :param y_mask: first and last indexes for the mask on the 1-axis.", "name": "__init__", "signature": "def __init__(self, shape: Tuple[int, int], x_mask: Tuple[int, i...
4
stack_v2_sparse_classes_30k_train_000664
Implement the Python class `RectangleMask` described below. Class description: Numpy array with rectangle mask to be applied on 2d or 3d array. Method signatures and docstrings: - def __init__(self, shape: Tuple[int, int], x_mask: Tuple[int, int], y_mask: Tuple[int, int]): :param shape: (x_shape, y_shape) for the ori...
Implement the Python class `RectangleMask` described below. Class description: Numpy array with rectangle mask to be applied on 2d or 3d array. Method signatures and docstrings: - def __init__(self, shape: Tuple[int, int], x_mask: Tuple[int, int], y_mask: Tuple[int, int]): :param shape: (x_shape, y_shape) for the ori...
736ba8ecf1f4a1f8fe0ad46bdf964aff34238abe
<|skeleton|> class RectangleMask: """Numpy array with rectangle mask to be applied on 2d or 3d array.""" def __init__(self, shape: Tuple[int, int], x_mask: Tuple[int, int], y_mask: Tuple[int, int]): """:param shape: (x_shape, y_shape) for the original array. :param x_mask: first and last indexes for th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RectangleMask: """Numpy array with rectangle mask to be applied on 2d or 3d array.""" def __init__(self, shape: Tuple[int, int], x_mask: Tuple[int, int], y_mask: Tuple[int, int]): """:param shape: (x_shape, y_shape) for the original array. :param x_mask: first and last indexes for the mask on the...
the_stack_v2_python_sparse
src/hyperpy/spectral/cube_crop.py
antoinelaborde/hyperpy
train
2
780318bf4f708eff41a10b38dd6db318e318e7d5
[ "super().__init__(test_case, name=name, subdir=subdir, cpus_per_task=None, min_cpus_per_task=None)\nself.base_mesh_step = base_mesh_step\nself.remap_topography = remap_topography\nfor file in ['culled_mesh.nc', 'culled_graph.info', 'critical_passages_mask_final.nc']:\n self.add_output_file(filename=file)\nif wit...
<|body_start_0|> super().__init__(test_case, name=name, subdir=subdir, cpus_per_task=None, min_cpus_per_task=None) self.base_mesh_step = base_mesh_step self.remap_topography = remap_topography for file in ['culled_mesh.nc', 'culled_graph.info', 'critical_passages_mask_final.nc']: ...
A step for culling a global MPAS-Ocean mesh Attributes ---------- base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh includes ice-shelf cavities do_inject_bathymetry : bool Whether to interpolate bathymetry fro...
CullMeshStep
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CullMeshStep: """A step for culling a global MPAS-Ocean mesh Attributes ---------- base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh includes ice-shelf cavities do_inject_bathymetry : bo...
stack_v2_sparse_classes_36k_train_013469
20,987
permissive
[ { "docstring": "Create a new step Parameters ---------- test_case : compass.ocean.tests.global_ocean.mesh.Mesh The test case this step belongs to base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh inclu...
4
stack_v2_sparse_classes_30k_train_018714
Implement the Python class `CullMeshStep` described below. Class description: A step for culling a global MPAS-Ocean mesh Attributes ---------- base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh includes ice-s...
Implement the Python class `CullMeshStep` described below. Class description: A step for culling a global MPAS-Ocean mesh Attributes ---------- base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh includes ice-s...
0b7440f0aa77c1ae052922a39e646bd35c267661
<|skeleton|> class CullMeshStep: """A step for culling a global MPAS-Ocean mesh Attributes ---------- base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh includes ice-shelf cavities do_inject_bathymetry : bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CullMeshStep: """A step for culling a global MPAS-Ocean mesh Attributes ---------- base_mesh_step : compass.mesh.spherical.SphericalBaseStep The base mesh step containing input files to this step with_ice_shelf_cavities : bool Whether the mesh includes ice-shelf cavities do_inject_bathymetry : bool Whether to...
the_stack_v2_python_sparse
compass/ocean/mesh/cull.py
MPAS-Dev/compass
train
10
dd505beeab289a88129187e103c67ad510c5a85f
[ "if path is None:\n outpath = os.path.dirname(os.path.abspath(configfile))\nelse:\n outpath = path\nself.config = Configuration(configfile, outpath=path)\nself.pixel = pixel\nself.nside = nside", "if not self.config.galfile_pixelized:\n raise ValueError('Code only runs with pixelized galfile.')\nself.con...
<|body_start_0|> if path is None: outpath = os.path.dirname(os.path.abspath(configfile)) else: outpath = path self.config = Configuration(configfile, outpath=path) self.pixel = pixel self.nside = nside <|end_body_0|> <|body_start_1|> if not self.c...
Class to run redmapper zmask randoms on a single healpix pixel, for distributed runs.
RunZmaskPixelTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunZmaskPixelTask: """Class to run redmapper zmask randoms on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RunZmaskPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int...
stack_v2_sparse_classes_36k_train_013470
10,033
permissive
[ { "docstring": "Instantiate a RunZmaskPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int` Healpix pixel to run on. nside: `int` Healpix nside associated with pixel. path: `str`, optional Output path. Default is None, use same absolute path as configfile.", "name": "_...
2
stack_v2_sparse_classes_30k_train_007544
Implement the Python class `RunZmaskPixelTask` described below. Class description: Class to run redmapper zmask randoms on a single healpix pixel, for distributed runs. Method signatures and docstrings: - def __init__(self, configfile, pixel, nside, path=None): Instantiate a RunZmaskPixelTask. Parameters ---------- c...
Implement the Python class `RunZmaskPixelTask` described below. Class description: Class to run redmapper zmask randoms on a single healpix pixel, for distributed runs. Method signatures and docstrings: - def __init__(self, configfile, pixel, nside, path=None): Instantiate a RunZmaskPixelTask. Parameters ---------- c...
d3a8b432c2f3a20aa518a7781c0f2aa315624855
<|skeleton|> class RunZmaskPixelTask: """Class to run redmapper zmask randoms on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RunZmaskPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunZmaskPixelTask: """Class to run redmapper zmask randoms on a single healpix pixel, for distributed runs.""" def __init__(self, configfile, pixel, nside, path=None): """Instantiate a RunZmaskPixelTask. Parameters ---------- configfile: `str` Configuration yaml filename. pixel: `int` Healpix pix...
the_stack_v2_python_sparse
redmapper/pipeline/redmappertask.py
erykoff/redmapper
train
20
30d39e75f433bee9d07207d1847c4ffd06b27a40
[ "self._waveforms = waveforms\nself._frames = frames\nself.channel = channel\nself._init_phase = 0.0\nself._init_frequency = 0.0\nself._dt = 0.0", "waveforms = {}\nframes = defaultdict(list)\nfor t0, inst in program.filter(channels=[channel]).instructions:\n if isinstance(inst, cls._waveform_group):\n if...
<|body_start_0|> self._waveforms = waveforms self._frames = frames self.channel = channel self._init_phase = 0.0 self._init_frequency = 0.0 self._dt = 0.0 <|end_body_0|> <|body_start_1|> waveforms = {} frames = defaultdict(list) for t0, inst in pr...
Channel event manager.
ChannelEvents
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChannelEvents: """Channel event manager.""" def __init__(self, waveforms: dict[int, pulse.Instruction], frames: dict[int, list[pulse.Instruction]], channel: pulse.channels.Channel): """Create new event manager. Args: waveforms: List of waveforms shown in this channel. frames: List of...
stack_v2_sparse_classes_36k_train_013471
10,390
permissive
[ { "docstring": "Create new event manager. Args: waveforms: List of waveforms shown in this channel. frames: List of frame change type instructions shown in this channel. channel: Channel object associated with this manager.", "name": "__init__", "signature": "def __init__(self, waveforms: dict[int, puls...
6
null
Implement the Python class `ChannelEvents` described below. Class description: Channel event manager. Method signatures and docstrings: - def __init__(self, waveforms: dict[int, pulse.Instruction], frames: dict[int, list[pulse.Instruction]], channel: pulse.channels.Channel): Create new event manager. Args: waveforms:...
Implement the Python class `ChannelEvents` described below. Class description: Channel event manager. Method signatures and docstrings: - def __init__(self, waveforms: dict[int, pulse.Instruction], frames: dict[int, list[pulse.Instruction]], channel: pulse.channels.Channel): Create new event manager. Args: waveforms:...
0b51250e219ca303654fc28a318c21366584ccd3
<|skeleton|> class ChannelEvents: """Channel event manager.""" def __init__(self, waveforms: dict[int, pulse.Instruction], frames: dict[int, list[pulse.Instruction]], channel: pulse.channels.Channel): """Create new event manager. Args: waveforms: List of waveforms shown in this channel. frames: List of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChannelEvents: """Channel event manager.""" def __init__(self, waveforms: dict[int, pulse.Instruction], frames: dict[int, list[pulse.Instruction]], channel: pulse.channels.Channel): """Create new event manager. Args: waveforms: List of waveforms shown in this channel. frames: List of frame change...
the_stack_v2_python_sparse
qiskit/visualization/pulse_v2/events.py
1ucian0/qiskit-terra
train
6
563d9bedf699301391bf3ecffa8b7cfb0bf4194b
[ "if not tf.__internal__.tf2.enabled():\n self.skipTest('pickle model only available in v2 when tf format is used.')\nmodel = test_utils.get_small_mlp(num_hidden=1, num_classes=2, input_dim=3)\nmodel.compile(optimizer='sgd', loss='sparse_categorical_crossentropy')\nx = np.random.random(size=(10, 3))\ny = np.rando...
<|body_start_0|> if not tf.__internal__.tf2.enabled(): self.skipTest('pickle model only available in v2 when tf format is used.') model = test_utils.get_small_mlp(num_hidden=1, num_classes=2, input_dim=3) model.compile(optimizer='sgd', loss='sparse_categorical_crossentropy') ...
Tests pickle protocol support.
TestPickleProtocol
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPickleProtocol: """Tests pickle protocol support.""" def test_built_models(self, serializer): """Built models should be copyable and pickleable for all model types.""" <|body_0|> def test_unbuilt_models(self, serializer): """Unbuilt models should be copyable ...
stack_v2_sparse_classes_36k_train_013472
3,574
permissive
[ { "docstring": "Built models should be copyable and pickleable for all model types.", "name": "test_built_models", "signature": "def test_built_models(self, serializer)" }, { "docstring": "Unbuilt models should be copyable & deepcopyable for all model types.", "name": "test_unbuilt_models", ...
2
stack_v2_sparse_classes_30k_train_016324
Implement the Python class `TestPickleProtocol` described below. Class description: Tests pickle protocol support. Method signatures and docstrings: - def test_built_models(self, serializer): Built models should be copyable and pickleable for all model types. - def test_unbuilt_models(self, serializer): Unbuilt model...
Implement the Python class `TestPickleProtocol` described below. Class description: Tests pickle protocol support. Method signatures and docstrings: - def test_built_models(self, serializer): Built models should be copyable and pickleable for all model types. - def test_unbuilt_models(self, serializer): Unbuilt model...
8d5e9b2163ec9b7d9f70920d1c7992b6df6820ec
<|skeleton|> class TestPickleProtocol: """Tests pickle protocol support.""" def test_built_models(self, serializer): """Built models should be copyable and pickleable for all model types.""" <|body_0|> def test_unbuilt_models(self, serializer): """Unbuilt models should be copyable ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPickleProtocol: """Tests pickle protocol support.""" def test_built_models(self, serializer): """Built models should be copyable and pickleable for all model types.""" if not tf.__internal__.tf2.enabled(): self.skipTest('pickle model only available in v2 when tf format is ...
the_stack_v2_python_sparse
keras/saving/pickle_utils_test.py
xiaoheilong3112/keras
train
1
d56b20c9c038f2a636de9aee5cc0d98868d217e3
[ "super(FunctionComponent, self).__init__(opts)\nself.fn_options = opts.get(PACKAGE_NAME, {})\nself.opts = opts\nvalidate_fields(config.REQUIRED_CONFIG_SETTINGS, self.fn_options)", "self.fn_options = opts.get(PACKAGE_NAME, {})\nself.opts = opts\nvalidate_fields(config.REQUIRED_CONFIG_SETTINGS, self.fn_options)", ...
<|body_start_0|> super(FunctionComponent, self).__init__(opts) self.fn_options = opts.get(PACKAGE_NAME, {}) self.opts = opts validate_fields(config.REQUIRED_CONFIG_SETTINGS, self.fn_options) <|end_body_0|> <|body_start_1|> self.fn_options = opts.get(PACKAGE_NAME, {}) sel...
Component that implements Resilient function 'funct_zia_remove_from_url_category''
FunctionComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'funct_zia_remove_from_url_category''""" def __init__(self, opts): """Constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration option...
stack_v2_sparse_classes_36k_train_013473
3,635
permissive
[ { "docstring": "Constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Configuration options have changed, save new values", "name": "_reload", "signature": "def _reload(self, event, opts)" }, { "d...
3
null
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'funct_zia_remove_from_url_category'' Method signatures and docstrings: - def __init__(self, opts): Constructor provides access to the configuration options - def _reload(self, event, opts):...
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'funct_zia_remove_from_url_category'' Method signatures and docstrings: - def __init__(self, opts): Constructor provides access to the configuration options - def _reload(self, event, opts):...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'funct_zia_remove_from_url_category''""" def __init__(self, opts): """Constructor provides access to the configuration options""" <|body_0|> def _reload(self, event, opts): """Configuration option...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionComponent: """Component that implements Resilient function 'funct_zia_remove_from_url_category''""" def __init__(self, opts): """Constructor provides access to the configuration options""" super(FunctionComponent, self).__init__(opts) self.fn_options = opts.get(PACKAGE_NAM...
the_stack_v2_python_sparse
fn_zia/fn_zia/components/funct_zia_remove_from_url_category.py
ibmresilient/resilient-community-apps
train
81
1404d761efab744c4f0a44dacc0f55e9ff39dd05
[ "if kwargs.get('units', None):\n kwargs['units'] = UNITS[kwargs['units']]\nsuper(IPerfParser, self).__init__(*args, **kwargs)\nself.format = iperfexpressions.ParserKeys.human", "results = []\nfor line in output.splitlines():\n match = self.search(line)\n if match:\n start = float(match[iperfexpres...
<|body_start_0|> if kwargs.get('units', None): kwargs['units'] = UNITS[kwargs['units']] super(IPerfParser, self).__init__(*args, **kwargs) self.format = iperfexpressions.ParserKeys.human <|end_body_0|> <|body_start_1|> results = [] for line in output.splitlines(): ...
Class for parsing Iperf output.
IPerfParser
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPerfParser: """Class for parsing Iperf output.""" def __init__(self, *args, **kwargs): """Initialize IPerfParser class.""" <|body_0|> def parse(self, output): """Parse output from iperf execution. Args: output(str): iperf output Returns: list: list of parsed ipe...
stack_v2_sparse_classes_36k_train_013474
4,769
permissive
[ { "docstring": "Initialize IPerfParser class.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Parse output from iperf execution. Args: output(str): iperf output Returns: list: list of parsed iperf results", "name": "parse", "signature": "def pa...
2
stack_v2_sparse_classes_30k_train_009128
Implement the Python class `IPerfParser` described below. Class description: Class for parsing Iperf output. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize IPerfParser class. - def parse(self, output): Parse output from iperf execution. Args: output(str): iperf output Returns: lis...
Implement the Python class `IPerfParser` described below. Class description: Class for parsing Iperf output. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize IPerfParser class. - def parse(self, output): Parse output from iperf execution. Args: output(str): iperf output Returns: lis...
2007bf3fe66edfe704e485141c55caed54fe13aa
<|skeleton|> class IPerfParser: """Class for parsing Iperf output.""" def __init__(self, *args, **kwargs): """Initialize IPerfParser class.""" <|body_0|> def parse(self, output): """Parse output from iperf execution. Args: output(str): iperf output Returns: list: list of parsed ipe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPerfParser: """Class for parsing Iperf output.""" def __init__(self, *args, **kwargs): """Initialize IPerfParser class.""" if kwargs.get('units', None): kwargs['units'] = UNITS[kwargs['units']] super(IPerfParser, self).__init__(*args, **kwargs) self.format = i...
the_stack_v2_python_sparse
taf/testlib/linux/iperf/iperf.py
AndriyZabavskyy/taf
train
0
50ac5890660c3d5867a039f35a2cc576188302d8
[ "data = data.get('parent', {}).get('review')\nif data is not None:\n self.service.review.create(identity, data, record, uow=self.uow)", "review = draft.parent.review\nif review is None:\n return\nif review.is_open:\n raise ReviewStateError(_('You cannot delete a draft with an open review. Please cancel t...
<|body_start_0|> data = data.get('parent', {}).get('review') if data is not None: self.service.review.create(identity, data, record, uow=self.uow) <|end_body_0|> <|body_start_1|> review = draft.parent.review if review is None: return if review.is_open: ...
Service component for request integration.
ReviewComponent
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewComponent: """Service component for request integration.""" def create(self, identity, data=None, record=None, **kwargs): """Create the review if requested.""" <|body_0|> def delete_draft(self, identity, draft=None, record=None, force=False): """Delete a dr...
stack_v2_sparse_classes_36k_train_013475
2,074
permissive
[ { "docstring": "Create the review if requested.", "name": "create", "signature": "def create(self, identity, data=None, record=None, **kwargs)" }, { "docstring": "Delete a draft.", "name": "delete_draft", "signature": "def delete_draft(self, identity, draft=None, record=None, force=False...
3
stack_v2_sparse_classes_30k_train_006649
Implement the Python class `ReviewComponent` described below. Class description: Service component for request integration. Method signatures and docstrings: - def create(self, identity, data=None, record=None, **kwargs): Create the review if requested. - def delete_draft(self, identity, draft=None, record=None, forc...
Implement the Python class `ReviewComponent` described below. Class description: Service component for request integration. Method signatures and docstrings: - def create(self, identity, data=None, record=None, **kwargs): Create the review if requested. - def delete_draft(self, identity, draft=None, record=None, forc...
b4bcc2e16df6048149177a6e1ebd514bdb6b0626
<|skeleton|> class ReviewComponent: """Service component for request integration.""" def create(self, identity, data=None, record=None, **kwargs): """Create the review if requested.""" <|body_0|> def delete_draft(self, identity, draft=None, record=None, force=False): """Delete a dr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReviewComponent: """Service component for request integration.""" def create(self, identity, data=None, record=None, **kwargs): """Create the review if requested.""" data = data.get('parent', {}).get('review') if data is not None: self.service.review.create(identity, d...
the_stack_v2_python_sparse
invenio_rdm_records/services/components/review.py
ppanero/invenio-rdm-records
train
0
a4b960ff4bfecd2df654888732ac301dca842b76
[ "ds, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True)\nself.metadata = metadata\nself.data_train = ds['train']\nself.data_valid = ds['validation']\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en = tokeni...
<|body_start_0|> ds, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True) self.metadata = metadata self.data_train = ds['train'] self.data_valid = ds['validation'] tokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train) self....
Loads and preps a dataset for machine translation
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Loads and preps a dataset for machine translation""" def __init__(self, batch_size, max_len): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Function that creates sub-word tokenizers for our dataset""" <|body_1|> def en...
stack_v2_sparse_classes_36k_train_013476
3,060
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, batch_size, max_len)" }, { "docstring": "Function that creates sub-word tokenizers for our dataset", "name": "tokenize_dataset", "signature": "def tokenize_dataset(self, data)" }, { "docstring": "M...
4
stack_v2_sparse_classes_30k_val_000989
Implement the Python class `Dataset` described below. Class description: Loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self, batch_size, max_len): Constructor - def tokenize_dataset(self, data): Function that creates sub-word tokenizers for our dataset - def encode...
Implement the Python class `Dataset` described below. Class description: Loads and preps a dataset for machine translation Method signatures and docstrings: - def __init__(self, batch_size, max_len): Constructor - def tokenize_dataset(self, data): Function that creates sub-word tokenizers for our dataset - def encode...
c7b6ea4c37b7c5dc41e63cdb8142b3cdfb3e1d23
<|skeleton|> class Dataset: """Loads and preps a dataset for machine translation""" def __init__(self, batch_size, max_len): """Constructor""" <|body_0|> def tokenize_dataset(self, data): """Function that creates sub-word tokenizers for our dataset""" <|body_1|> def en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Loads and preps a dataset for machine translation""" def __init__(self, batch_size, max_len): """Constructor""" ds, metadata = tfds.load('ted_hrlr_translate/pt_to_en', with_info=True, as_supervised=True) self.metadata = metadata self.data_train = ds['train'] ...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/3-dataset.py
linkjavier/holbertonschool-machine_learning
train
0
2d68b016ac3b57dfdb06067f6e25d351a4ad9c6b
[ "rb_params = params\nparam_units = {k: unit.kJ / unit.mol for k in rb_params}\nreturn _copy_params(rb_params, param_units=param_units)", "for proper in topology.propers:\n atom_indices = tuple((topology.atom_index(atom) for atom in proper))\n top_key = TopologyKey(atom_indices=atom_indices)\n pot_key_ids...
<|body_start_0|> rb_params = params param_units = {k: unit.kJ / unit.mol for k in rb_params} return _copy_params(rb_params, param_units=param_units) <|end_body_0|> <|body_start_1|> for proper in topology.propers: atom_indices = tuple((topology.atom_index(atom) for atom in pr...
Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.
FoyerRBProperHandler
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoyerRBProperHandler: """Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.""" def get_params_with_units(self, params): """Get the parameters of this handler, tagged with units.""" <|body_0|> def store_matches(self, atom_slot...
stack_v2_sparse_classes_36k_train_013477
6,006
permissive
[ { "docstring": "Get the parameters of this handler, tagged with units.", "name": "get_params_with_units", "signature": "def get_params_with_units(self, params)" }, { "docstring": "Populate self.key_map with key-val pairs of [TopologyKey, PotentialKey].", "name": "store_matches", "signatu...
2
null
Implement the Python class `FoyerRBProperHandler` described below. Class description: Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field. Method signatures and docstrings: - def get_params_with_units(self, params): Get the parameters of this handler, tagged with units. - d...
Implement the Python class `FoyerRBProperHandler` described below. Class description: Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field. Method signatures and docstrings: - def get_params_with_units(self, params): Get the parameters of this handler, tagged with units. - d...
4616f2cff477c18e2c6ca70ac4c74c28b283a4be
<|skeleton|> class FoyerRBProperHandler: """Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.""" def get_params_with_units(self, params): """Get the parameters of this handler, tagged with units.""" <|body_0|> def store_matches(self, atom_slot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FoyerRBProperHandler: """Handler storing Ryckaert-Bellemans proper torsion potentials as produced by a Foyer force field.""" def get_params_with_units(self, params): """Get the parameters of this handler, tagged with units.""" rb_params = params param_units = {k: unit.kJ / unit.mo...
the_stack_v2_python_sparse
openff/interchange/foyer/_valence.py
openforcefield/openff-interchange
train
39
c6992478c7dcc7b645135dcf7ed4c1e77f31f589
[ "if not head:\n return head\nlast = None\nwhile head.next:\n later = head.next\n head.next = last\n last = head\n head = later\nhead.next = last\nreturn head\nprev = None\nwhile head:\n cur = head\n head = head.next\n cur.next = prev\n prev = cur\nreturn prev", "if not head:\n return...
<|body_start_0|> if not head: return head last = None while head.next: later = head.next head.next = last last = head head = later head.next = last return head prev = None while head: cur = he...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head, last=None): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: ...
stack_v2_sparse_classes_36k_train_013478
1,595
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList2", "signature": "def reverseList2(self, head, last=None)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseList2(self, head, last=None): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reverseList2(self, head, last=None): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: ...
b4dccd3d1c59aa1e92f10ed5c4f7a3e1d08897d8
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reverseList2(self, head, last=None): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" if not head: return head last = None while head.next: later = head.next head.next = last last = head head = later head.next = l...
the_stack_v2_python_sparse
ReverseLinkedList.py
janewjy/Leetcode
train
1
4618037b377dd3e668621132eaa33124aec08071
[ "self.id = id\nself.name = name\nself.mtype = mtype\nself.usage_bytes = usage_bytes", "if dictionary is None:\n return None\nid = dictionary.get('id')\nname = dictionary.get('name')\nmtype = dictionary.get('type')\nusage_bytes = dictionary.get('usageBytes')\nreturn cls(id, name, mtype, usage_bytes)" ]
<|body_start_0|> self.id = id self.name = name self.mtype = mtype self.usage_bytes = usage_bytes <|end_body_0|> <|body_start_1|> if dictionary is None: return None id = dictionary.get('id') name = dictionary.get('name') mtype = dictionary.get(...
Implementation of the 'VaultStatsInfo' model. Specifies the stats for each vault. Attributes: id (long|int): Specifies the Vault Id. name (string): Specifies the Vault name. mtype (TypeVaultStatsInfoEnum): Specifies the Vault type. usage_bytes (long|int): Specifies the bytes used by the Vault.
VaultStatsInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VaultStatsInfo: """Implementation of the 'VaultStatsInfo' model. Specifies the stats for each vault. Attributes: id (long|int): Specifies the Vault Id. name (string): Specifies the Vault name. mtype (TypeVaultStatsInfoEnum): Specifies the Vault type. usage_bytes (long|int): Specifies the bytes us...
stack_v2_sparse_classes_36k_train_013479
1,885
permissive
[ { "docstring": "Constructor for the VaultStatsInfo class", "name": "__init__", "signature": "def __init__(self, id=None, name=None, mtype=None, usage_bytes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of ...
2
stack_v2_sparse_classes_30k_train_000229
Implement the Python class `VaultStatsInfo` described below. Class description: Implementation of the 'VaultStatsInfo' model. Specifies the stats for each vault. Attributes: id (long|int): Specifies the Vault Id. name (string): Specifies the Vault name. mtype (TypeVaultStatsInfoEnum): Specifies the Vault type. usage_b...
Implement the Python class `VaultStatsInfo` described below. Class description: Implementation of the 'VaultStatsInfo' model. Specifies the stats for each vault. Attributes: id (long|int): Specifies the Vault Id. name (string): Specifies the Vault name. mtype (TypeVaultStatsInfoEnum): Specifies the Vault type. usage_b...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VaultStatsInfo: """Implementation of the 'VaultStatsInfo' model. Specifies the stats for each vault. Attributes: id (long|int): Specifies the Vault Id. name (string): Specifies the Vault name. mtype (TypeVaultStatsInfoEnum): Specifies the Vault type. usage_bytes (long|int): Specifies the bytes us...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VaultStatsInfo: """Implementation of the 'VaultStatsInfo' model. Specifies the stats for each vault. Attributes: id (long|int): Specifies the Vault Id. name (string): Specifies the Vault name. mtype (TypeVaultStatsInfoEnum): Specifies the Vault type. usage_bytes (long|int): Specifies the bytes used by the Vau...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vault_stats_info.py
cohesity/management-sdk-python
train
24
8bd52e34a3e6fab768cdacbefb4e47142321352c
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Interface exported by the server.
InferenceCoordinatorServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InferenceCoordinatorServicer: """Interface exported by the server.""" def DeploySpire(self, request, context): """Deploy a Spire""" <|body_0|> def DeleteSpire(self, request, context): """Delete a Spire""" <|body_1|> def GetSpireDeployStatus(self, req...
stack_v2_sparse_classes_36k_train_013480
8,159
no_license
[ { "docstring": "Deploy a Spire", "name": "DeploySpire", "signature": "def DeploySpire(self, request, context)" }, { "docstring": "Delete a Spire", "name": "DeleteSpire", "signature": "def DeleteSpire(self, request, context)" }, { "docstring": "Check whether a spire is running", ...
4
stack_v2_sparse_classes_30k_train_007976
Implement the Python class `InferenceCoordinatorServicer` described below. Class description: Interface exported by the server. Method signatures and docstrings: - def DeploySpire(self, request, context): Deploy a Spire - def DeleteSpire(self, request, context): Delete a Spire - def GetSpireDeployStatus(self, request...
Implement the Python class `InferenceCoordinatorServicer` described below. Class description: Interface exported by the server. Method signatures and docstrings: - def DeploySpire(self, request, context): Deploy a Spire - def DeleteSpire(self, request, context): Delete a Spire - def GetSpireDeployStatus(self, request...
49dc92036e71ca758cc35e8851a803b89d76ef52
<|skeleton|> class InferenceCoordinatorServicer: """Interface exported by the server.""" def DeploySpire(self, request, context): """Deploy a Spire""" <|body_0|> def DeleteSpire(self, request, context): """Delete a Spire""" <|body_1|> def GetSpireDeployStatus(self, req...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InferenceCoordinatorServicer: """Interface exported by the server.""" def DeploySpire(self, request, context): """Deploy a Spire""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemen...
the_stack_v2_python_sparse
proto/inference_coordinator/inference_coordinator_pb2_grpc.py
selwynClarifai/video-manager
train
2
e6b54d56cb98332c4cfd9b142d19984444f38b75
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
UserAppServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAppServiceServicer: """Missing associated documentation comment in .proto file.""" def user_by_email_and_password(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def user_by_id(self, request, context): """Mis...
stack_v2_sparse_classes_36k_train_013481
10,079
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "user_by_email_and_password", "signature": "def user_by_email_and_password(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "user_by_id", "sign...
5
null
Implement the Python class `UserAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def user_by_email_and_password(self, request, context): Missing associated documentation comment in .proto file. - def user_by_id(self, r...
Implement the Python class `UserAppServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def user_by_email_and_password(self, request, context): Missing associated documentation comment in .proto file. - def user_by_id(self, r...
55d36c068e26e13ee5bae5c033e2e17784c63feb
<|skeleton|> class UserAppServiceServicer: """Missing associated documentation comment in .proto file.""" def user_by_email_and_password(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def user_by_id(self, request, context): """Mis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserAppServiceServicer: """Missing associated documentation comment in .proto file.""" def user_by_email_and_password(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method...
the_stack_v2_python_sparse
src/resource/proto/_generated/identity/user_app_service_pb2_grpc.py
arkanmgerges/cafm.identity
train
0
4b612ccddcca123d374e51540159ac2215f18f3c
[ "user = User.query.get(id)\nif not user:\n api.abort(code=404, message='User not found')\nreturn {'data': user.__jsonapi__()}", "current_identity = import_user()\nuser = User.query.get(id)\nif not user:\n api.abort(code=404, message='User not found')\ndata = request.get_json()['data']\nif 'name' in data['at...
<|body_start_0|> user = User.query.get(id) if not user: api.abort(code=404, message='User not found') return {'data': user.__jsonapi__()} <|end_body_0|> <|body_start_1|> current_identity = import_user() user = User.query.get(id) if not user: api.a...
Users
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Users: def get(self, id): """Get user""" <|body_0|> def put(self, id): """Update user""" <|body_1|> def delete(self, id): """Delete user""" <|body_2|> <|end_skeleton|> <|body_start_0|> user = User.query.get(id) if not us...
stack_v2_sparse_classes_36k_train_013482
46,738
permissive
[ { "docstring": "Get user", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Update user", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Delete user", "name": "delete", "signature": "def delete(self, id)" } ]
3
stack_v2_sparse_classes_30k_train_013944
Implement the Python class `Users` described below. Class description: Implement the Users class. Method signatures and docstrings: - def get(self, id): Get user - def put(self, id): Update user - def delete(self, id): Delete user
Implement the Python class `Users` described below. Class description: Implement the Users class. Method signatures and docstrings: - def get(self, id): Get user - def put(self, id): Update user - def delete(self, id): Delete user <|skeleton|> class Users: def get(self, id): """Get user""" <|bod...
3439a2dd0bd527c5d604801fec3a5aac904a72e2
<|skeleton|> class Users: def get(self, id): """Get user""" <|body_0|> def put(self, id): """Update user""" <|body_1|> def delete(self, id): """Delete user""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Users: def get(self, id): """Get user""" user = User.query.get(id) if not user: api.abort(code=404, message='User not found') return {'data': user.__jsonapi__()} def put(self, id): """Update user""" current_identity = import_user() user ...
the_stack_v2_python_sparse
app/views.py
taidos/lxc-rest
train
0
ab65bfbcf2129a3ff14e88aa17de1fe1bafc18dd
[ "self.u1 = UserBase.objects.create(email='testuser1@example.com', is_email_verified=True)\nself.u2 = UserBase.objects.create(email='testuser2@example.com', is_email_verified=True)\nu3 = UserBase.objects.create(email='testuser3@example.com', is_email_verified=True)\nu4 = UserBase.objects.create(email='testuser4@exam...
<|body_start_0|> self.u1 = UserBase.objects.create(email='testuser1@example.com', is_email_verified=True) self.u2 = UserBase.objects.create(email='testuser2@example.com', is_email_verified=True) u3 = UserBase.objects.create(email='testuser3@example.com', is_email_verified=True) u4 = User...
Test case for Daily Expert Stats.
TestDailyExpertStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDailyExpertStats: """Test case for Daily Expert Stats.""" def setUp(self): """SetUp method for test case""" <|body_0|> def test_calculate_daily_expert_stats_user_one_first_time(self): """test case for testing Daily Expert Stats""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k_train_013483
3,088
no_license
[ { "docstring": "SetUp method for test case", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test case for testing Daily Expert Stats", "name": "test_calculate_daily_expert_stats_user_one_first_time", "signature": "def test_calculate_daily_expert_stats_user_one_first_t...
2
null
Implement the Python class `TestDailyExpertStats` described below. Class description: Test case for Daily Expert Stats. Method signatures and docstrings: - def setUp(self): SetUp method for test case - def test_calculate_daily_expert_stats_user_one_first_time(self): test case for testing Daily Expert Stats
Implement the Python class `TestDailyExpertStats` described below. Class description: Test case for Daily Expert Stats. Method signatures and docstrings: - def setUp(self): SetUp method for test case - def test_calculate_daily_expert_stats_user_one_first_time(self): test case for testing Daily Expert Stats <|skeleto...
248a7b406686c0c98e944319a6eca08485104f5d
<|skeleton|> class TestDailyExpertStats: """Test case for Daily Expert Stats.""" def setUp(self): """SetUp method for test case""" <|body_0|> def test_calculate_daily_expert_stats_user_one_first_time(self): """test case for testing Daily Expert Stats""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDailyExpertStats: """Test case for Daily Expert Stats.""" def setUp(self): """SetUp method for test case""" self.u1 = UserBase.objects.create(email='testuser1@example.com', is_email_verified=True) self.u2 = UserBase.objects.create(email='testuser2@example.com', is_email_verifi...
the_stack_v2_python_sparse
search/search/tests.py
skshivammahajan/DRFChat
train
0
b16e368f96ab7863c17f4261075868ea99707fc9
[ "length = len(s)\nif not s or length == 1 or length == 0:\n return s\nfor i in range(length, 0, -1):\n n = 0\n while n + i <= length:\n sub_str = s[n:n + i]\n sub_str_re = sub_str[::-1]\n if sub_str_re == sub_str:\n return sub_str\n n += 1", "length = len(s)\ndp = [...
<|body_start_0|> length = len(s) if not s or length == 1 or length == 0: return s for i in range(length, 0, -1): n = 0 while n + i <= length: sub_str = s[n:n + i] sub_str_re = sub_str[::-1] if sub_str_re == sub_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome1(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(s) if not s or length == 1 or lengt...
stack_v2_sparse_classes_36k_train_013484
1,568
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome1(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome1(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def longestPalindrome(self...
d4a33dc28a6d3f99d5179fdb6a83b2ab8c5a0beb
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome1(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" length = len(s) if not s or length == 1 or length == 0: return s for i in range(length, 0, -1): n = 0 while n + i <= length: sub_str = s[n:n + i] ...
the_stack_v2_python_sparse
leetcode/5_longest_palindrome.py
294150302hxq/python_learn
train
0
c5764aee5381a7546c4774728b3b207aa5715303
[ "N = len(nums)\nnums.sort()\nres = []\nfor t in range(N - 2):\n i, j = (t + 1, N - 1)\n while i < j:\n _sum = nums[t] + nums[i] + nums[j]\n if _sum == 0:\n res.append([nums[t], nums[i], nums[j]])\n i += 1\n j -= 1\n elif _sum < 0:\n i += 1\n ...
<|body_start_0|> N = len(nums) nums.sort() res = [] for t in range(N - 2): i, j = (t + 1, N - 1) while i < j: _sum = nums[t] + nums[i] + nums[j] if _sum == 0: res.append([nums[t], nums[i], nums[j]]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> N = len(nums) nums...
stack_v2_sparse_classes_36k_train_013485
3,808
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum1", "signature": "def threeSum1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_017009
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum1(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum1(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
1379a6dc2400751ecf79ccd6ed401a1fb0d78046
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" N = len(nums) nums.sort() res = [] for t in range(N - 2): i, j = (t + 1, N - 1) while i < j: _sum = nums[t] + nums[i] + nums[j] ...
the_stack_v2_python_sparse
Python3.6/15-Py3-M-3Sum.py
Hidenver2016/Leetcode
train
1
1e8d33d581429e0915424eddd1b9369710aa120b
[ "if k == len(c):\n res.append(c[:])\n return\nfor i in range(start, len(nums) - (k - len(c)) + 1):\n c.append(nums[i])\n self.findCombinations(nums, k, i + 1, c, res)\n c.pop()\nreturn", "if nums == []:\n return [[]]\nres = list()\nres.append([])\nfor k in range(1, len(nums)):\n c = list()\n ...
<|body_start_0|> if k == len(c): res.append(c[:]) return for i in range(start, len(nums) - (k - len(c)) + 1): c.append(nums[i]) self.findCombinations(nums, k, i + 1, c, res) c.pop() return <|end_body_0|> <|body_start_1|> if num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findCombinations(self, nums, k, start, c, res): """:type nums: List[int] :type k: int :type start: int: start index :type c: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" ...
stack_v2_sparse_classes_36k_train_013486
1,265
no_license
[ { "docstring": ":type nums: List[int] :type k: int :type start: int: start index :type c: List[int] :rtype: List[List[int]]", "name": "findCombinations", "signature": "def findCombinations(self, nums, k, start, c, res)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name...
2
stack_v2_sparse_classes_30k_train_020877
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCombinations(self, nums, k, start, c, res): :type nums: List[int] :type k: int :type start: int: start index :type c: List[int] :rtype: List[List[int]] - def subsets(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findCombinations(self, nums, k, start, c, res): :type nums: List[int] :type k: int :type start: int: start index :type c: List[int] :rtype: List[List[int]] - def subsets(self...
f8b35179b980e55f61bbcd2631fa3a9bf30c40ec
<|skeleton|> class Solution: def findCombinations(self, nums, k, start, c, res): """:type nums: List[int] :type k: int :type start: int: start index :type c: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findCombinations(self, nums, k, start, c, res): """:type nums: List[int] :type k: int :type start: int: start index :type c: List[int] :rtype: List[List[int]]""" if k == len(c): res.append(c[:]) return for i in range(start, len(nums) - (k - len(c))...
the_stack_v2_python_sparse
Python Solutions/078 Subsets.py
Sue9/Leetcode
train
0
d6b3a3552c03fcb6162c45cf138f9b9686feda87
[ "cookies = self.request.COOKIES\nout_list = ['nsfw', 'политика', 'жесть']\nif cookies.get('is_18_age') and cookies.get('nsfw'):\n out_list.remove('nsfw')\nif cookies.get('politic'):\n out_list.remove('политика')\nif cookies.get('gore'):\n out_list.remove('жесть')\nreturn out_list", "request = self.reques...
<|body_start_0|> cookies = self.request.COOKIES out_list = ['nsfw', 'политика', 'жесть'] if cookies.get('is_18_age') and cookies.get('nsfw'): out_list.remove('nsfw') if cookies.get('politic'): out_list.remove('политика') if cookies.get('gore'): ...
Миксин для сборки запроса исходя из настроек поиска
SearchQuerysetMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchQuerysetMixin: """Миксин для сборки запроса исходя из настроек поиска""" def get_tags_filter_Search(self): """Смотрит куки и возвращет спиок запрещенных постов""" <|body_0|> def get_queryset_search(self): """Определяем какие данные пришли из get и собираем ...
stack_v2_sparse_classes_36k_train_013487
4,472
no_license
[ { "docstring": "Смотрит куки и возвращет спиок запрещенных постов", "name": "get_tags_filter_Search", "signature": "def get_tags_filter_Search(self)" }, { "docstring": "Определяем какие данные пришли из get и собираем запрос или возвращаем количество постов", "name": "get_queryset_search", ...
2
null
Implement the Python class `SearchQuerysetMixin` described below. Class description: Миксин для сборки запроса исходя из настроек поиска Method signatures and docstrings: - def get_tags_filter_Search(self): Смотрит куки и возвращет спиок запрещенных постов - def get_queryset_search(self): Определяем какие данные приш...
Implement the Python class `SearchQuerysetMixin` described below. Class description: Миксин для сборки запроса исходя из настроек поиска Method signatures and docstrings: - def get_tags_filter_Search(self): Смотрит куки и возвращет спиок запрещенных постов - def get_queryset_search(self): Определяем какие данные приш...
48a9b0c5779a5ccf40c05176fff135d1e6efd893
<|skeleton|> class SearchQuerysetMixin: """Миксин для сборки запроса исходя из настроек поиска""" def get_tags_filter_Search(self): """Смотрит куки и возвращет спиок запрещенных постов""" <|body_0|> def get_queryset_search(self): """Определяем какие данные пришли из get и собираем ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchQuerysetMixin: """Миксин для сборки запроса исходя из настроек поиска""" def get_tags_filter_Search(self): """Смотрит куки и возвращет спиок запрещенных постов""" cookies = self.request.COOKIES out_list = ['nsfw', 'политика', 'жесть'] if cookies.get('is_18_age') and ...
the_stack_v2_python_sparse
search/package.py
untiwe/citrom_test
train
0
26e807f8b34ac8bb96b2a76e3f731b84890a2937
[ "collection = Collection.get_not_deleted(uid=collection_uid)\nif collection is None:\n raise ResourceNotFound('Collection not found')\npost = Post.get_not_deleted(uid=post_uid)\nif post is None:\n raise ResourceNotFound('Post not found')\npost.update(collection_id=collection.id)\nreturn api_success_response()...
<|body_start_0|> collection = Collection.get_not_deleted(uid=collection_uid) if collection is None: raise ResourceNotFound('Collection not found') post = Post.get_not_deleted(uid=post_uid) if post is None: raise ResourceNotFound('Post not found') post.upda...
CollectionPostsView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectionPostsView: def put(self, collection_uid, post_uid): """Add a post to a collection""" <|body_0|> def delete(self, collection_uid, post_uid): """Remove a post from a collection""" <|body_1|> <|end_skeleton|> <|body_start_0|> collection = Col...
stack_v2_sparse_classes_36k_train_013488
4,875
no_license
[ { "docstring": "Add a post to a collection", "name": "put", "signature": "def put(self, collection_uid, post_uid)" }, { "docstring": "Remove a post from a collection", "name": "delete", "signature": "def delete(self, collection_uid, post_uid)" } ]
2
stack_v2_sparse_classes_30k_train_002657
Implement the Python class `CollectionPostsView` described below. Class description: Implement the CollectionPostsView class. Method signatures and docstrings: - def put(self, collection_uid, post_uid): Add a post to a collection - def delete(self, collection_uid, post_uid): Remove a post from a collection
Implement the Python class `CollectionPostsView` described below. Class description: Implement the CollectionPostsView class. Method signatures and docstrings: - def put(self, collection_uid, post_uid): Add a post to a collection - def delete(self, collection_uid, post_uid): Remove a post from a collection <|skeleto...
610f3786b4402f9798225d2e97830e527bedc2d0
<|skeleton|> class CollectionPostsView: def put(self, collection_uid, post_uid): """Add a post to a collection""" <|body_0|> def delete(self, collection_uid, post_uid): """Remove a post from a collection""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectionPostsView: def put(self, collection_uid, post_uid): """Add a post to a collection""" collection = Collection.get_not_deleted(uid=collection_uid) if collection is None: raise ResourceNotFound('Collection not found') post = Post.get_not_deleted(uid=post_uid)...
the_stack_v2_python_sparse
modules/collections.py
babatundeladega/social-network-flask-bootstrap
train
0
a2ade2c6ca67f1449d567d17b0258d2879668864
[ "try:\n self.account = Account.actives.get(pk=account_id)\nexcept Account.DoesNotExist:\n raise AccountNotExistError('Account ID %s does not exist or not active' % account_id)\nelse:\n storage = Storage(GoogleCredentials, 'account', self.account, 'credentials')\n self.credentials = storage.get()\n if...
<|body_start_0|> try: self.account = Account.actives.get(pk=account_id) except Account.DoesNotExist: raise AccountNotExistError('Account ID %s does not exist or not active' % account_id) else: storage = Storage(GoogleCredentials, 'account', self.account, 'cred...
Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/contacts/default/full', {'max-results': 1...
GDataClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GDataClient: """Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/co...
stack_v2_sparse_classes_36k_train_013489
2,708
no_license
[ { "docstring": "Create GDataClient connecting to an account_id. This account must have google credentials.", "name": "__init__", "signature": "def __init__(self, account_id)" }, { "docstring": "Returns access_token. Refresh if access_token has already expired.", "name": "get_access_token", ...
3
stack_v2_sparse_classes_30k_train_014685
Implement the Python class `GDataClient` described below. Class description: Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('ge...
Implement the Python class `GDataClient` described below. Class description: Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('ge...
0d5912eb2800eeb095df9aec19045e3916ba0d13
<|skeleton|> class GDataClient: """Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GDataClient: """Call Google Data APIs using pre-existing google credentials. Use /api/self/google-connect to get and save credentials. Sample usage: Get all Google contacts of account with id=3 g = GDataClient(account_id=3) response = g.get_json_response('get', 'https://www.google.com/m8/feeds/contacts/defaul...
the_stack_v2_python_sparse
core/shared/google_data_api.py
eventure-interactive/eventure_django
train
0
5aa692bc58b9cfa196cac4928291e2637d996e94
[ "if not nums:\n return 0\nn = len(nums)\npreSum = [0] * (n + 1)\nfor i in range(n):\n preSum[i + 1] = preSum[i] + nums[i]\ncount = 0\nfor i in range(n):\n for j in range(i, n):\n sums = preSum[j + 1] - preSum[i]\n if sums == k:\n count += 1\nreturn count", "if not nums:\n retu...
<|body_start_0|> if not nums: return 0 n = len(nums) preSum = [0] * (n + 1) for i in range(n): preSum[i + 1] = preSum[i] + nums[i] count = 0 for i in range(n): for j in range(i, n): sums = preSum[j + 1] - preSum[i] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraySum(self, nums: list, k: int) -> int: """前缀和,然后暴力循环 数据太多超时""" <|body_0|> def subarraySum_2(self, nums: list, k: int) -> int: """优化版 1. 上面的方法中第二个for循环可以不要,它就是在计算某个范围的和而已,可以改成减法来做 2. 前缀和可以不用开辟数组,仅计算当前的和 3. 可以用字典来保存前缀和-k的差值""" <|body_1|> <...
stack_v2_sparse_classes_36k_train_013490
1,785
no_license
[ { "docstring": "前缀和,然后暴力循环 数据太多超时", "name": "subarraySum", "signature": "def subarraySum(self, nums: list, k: int) -> int" }, { "docstring": "优化版 1. 上面的方法中第二个for循环可以不要,它就是在计算某个范围的和而已,可以改成减法来做 2. 前缀和可以不用开辟数组,仅计算当前的和 3. 可以用字典来保存前缀和-k的差值", "name": "subarraySum_2", "signature": "def subarray...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum(self, nums: list, k: int) -> int: 前缀和,然后暴力循环 数据太多超时 - def subarraySum_2(self, nums: list, k: int) -> int: 优化版 1. 上面的方法中第二个for循环可以不要,它就是在计算某个范围的和而已,可以改成减法来做 2. 前缀和...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum(self, nums: list, k: int) -> int: 前缀和,然后暴力循环 数据太多超时 - def subarraySum_2(self, nums: list, k: int) -> int: 优化版 1. 上面的方法中第二个for循环可以不要,它就是在计算某个范围的和而已,可以改成减法来做 2. 前缀和...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def subarraySum(self, nums: list, k: int) -> int: """前缀和,然后暴力循环 数据太多超时""" <|body_0|> def subarraySum_2(self, nums: list, k: int) -> int: """优化版 1. 上面的方法中第二个for循环可以不要,它就是在计算某个范围的和而已,可以改成减法来做 2. 前缀和可以不用开辟数组,仅计算当前的和 3. 可以用字典来保存前缀和-k的差值""" <|body_1|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subarraySum(self, nums: list, k: int) -> int: """前缀和,然后暴力循环 数据太多超时""" if not nums: return 0 n = len(nums) preSum = [0] * (n + 1) for i in range(n): preSum[i + 1] = preSum[i] + nums[i] count = 0 for i in range(n): ...
the_stack_v2_python_sparse
algorithm/leetcode/list/19-和为K的子数组.py
lxconfig/UbuntuCode_bak
train
0
c7e334876ccb9cc6facedf6814ea43bc0c8f9004
[ "f = lambda *args, **kwargs: ircutils.bold(ircutils.mircColor(*args, **kwargs))\nif not isinstance(aqino, int):\n return f(_(' %s No data ') % aqino, fg='white', bg='black')\nif aqino <= 50:\n return f(_(' %s (Good) ') % aqino, fg='white', bg='green')\nelif aqino <= 100:\n return f(_(' %s (Moderate) ') % a...
<|body_start_0|> f = lambda *args, **kwargs: ircutils.bold(ircutils.mircColor(*args, **kwargs)) if not isinstance(aqino, int): return f(_(' %s No data ') % aqino, fg='white', bg='black') if aqino <= 50: return f(_(' %s (Good) ') % aqino, fg='white', bg='green') el...
Retrieves air quality index info from aqicn.org
AQI
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AQI: """Retrieves air quality index info from aqicn.org""" def _format_aqi(aqino): """Formats the given AQINO index.""" <|body_0|> def aqi(self, irc, msg, args, optlist, location): """[--geocode-backend <backend>] <location> Looks up Air Quality Index information...
stack_v2_sparse_classes_36k_train_013491
5,706
permissive
[ { "docstring": "Formats the given AQINO index.", "name": "_format_aqi", "signature": "def _format_aqi(aqino)" }, { "docstring": "[--geocode-backend <backend>] <location> Looks up Air Quality Index information for <location> using aqicn.org. --geocode-backend can be set to \"native\" or any geoco...
2
stack_v2_sparse_classes_30k_train_010159
Implement the Python class `AQI` described below. Class description: Retrieves air quality index info from aqicn.org Method signatures and docstrings: - def _format_aqi(aqino): Formats the given AQINO index. - def aqi(self, irc, msg, args, optlist, location): [--geocode-backend <backend>] <location> Looks up Air Qual...
Implement the Python class `AQI` described below. Class description: Retrieves air quality index info from aqicn.org Method signatures and docstrings: - def _format_aqi(aqino): Formats the given AQINO index. - def aqi(self, irc, msg, args, optlist, location): [--geocode-backend <backend>] <location> Looks up Air Qual...
11bd8181af9028b9319c7c9f0cd078546c6a908a
<|skeleton|> class AQI: """Retrieves air quality index info from aqicn.org""" def _format_aqi(aqino): """Formats the given AQINO index.""" <|body_0|> def aqi(self, irc, msg, args, optlist, location): """[--geocode-backend <backend>] <location> Looks up Air Quality Index information...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AQI: """Retrieves air quality index info from aqicn.org""" def _format_aqi(aqino): """Formats the given AQINO index.""" f = lambda *args, **kwargs: ircutils.bold(ircutils.mircColor(*args, **kwargs)) if not isinstance(aqino, int): return f(_(' %s No data ') % aqino, fg=...
the_stack_v2_python_sparse
AQI/plugin.py
jlu5/SupyPlugins
train
19
a82dc05a7a8c71cbc945a92d07a0a9ded32c795d
[ "self.spec = spec\nself.body_spec = body_spec\nself.body = body\nself.brain = brain\nself.expected_neurons = {}\nself.neurons = {}\nself.neural_connections = {}\nself.parts = set()", "self._process_body_part(self.body.root)\nfor neuron in self.brain.neuron:\n self._process_neuron(neuron)\nfor conn in self.brai...
<|body_start_0|> self.spec = spec self.body_spec = body_spec self.body = body self.brain = brain self.expected_neurons = {} self.neurons = {} self.neural_connections = {} self.parts = set() <|end_body_0|> <|body_start_1|> self._process_body_part(s...
Validates a neural net against a spec - this requires knowledge of the body as well.
NeuralNetValidator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeuralNetValidator: """Validates a neural net against a spec - this requires knowledge of the body as well.""" def __init__(self, spec, body_spec, body, brain): """:param spec: :type spec: NeuralNetImplementation :param body_spec: :type spec: BodyImplementation :param body: :param br...
stack_v2_sparse_classes_36k_train_013492
7,454
permissive
[ { "docstring": ":param spec: :type spec: NeuralNetImplementation :param body_spec: :type spec: BodyImplementation :param body: :param brain:", "name": "__init__", "signature": "def __init__(self, spec, body_spec, body, brain)" }, { "docstring": "Validates the neural network, raises exceptions of...
5
stack_v2_sparse_classes_30k_train_001095
Implement the Python class `NeuralNetValidator` described below. Class description: Validates a neural net against a spec - this requires knowledge of the body as well. Method signatures and docstrings: - def __init__(self, spec, body_spec, body, brain): :param spec: :type spec: NeuralNetImplementation :param body_sp...
Implement the Python class `NeuralNetValidator` described below. Class description: Validates a neural net against a spec - this requires knowledge of the body as well. Method signatures and docstrings: - def __init__(self, spec, body_spec, body, brain): :param spec: :type spec: NeuralNetImplementation :param body_sp...
70e65320a28fe04e121145b2cdde289d3052728a
<|skeleton|> class NeuralNetValidator: """Validates a neural net against a spec - this requires knowledge of the body as well.""" def __init__(self, spec, body_spec, body, brain): """:param spec: :type spec: NeuralNetImplementation :param body_spec: :type spec: BodyImplementation :param body: :param br...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeuralNetValidator: """Validates a neural net against a spec - this requires knowledge of the body as well.""" def __init__(self, spec, body_spec, body, brain): """:param spec: :type spec: NeuralNetImplementation :param body_spec: :type spec: BodyImplementation :param body: :param brain:""" ...
the_stack_v2_python_sparse
revolve/spec/validate.py
ElteHupkes/revolve
train
0
bf2007a9d519c1ef8356ea1a687cbc5399279d61
[ "start_time = datetime.now()\ntitle = cls.get_parameter('title', required=True, location=['json', 'form'])\ndesc = cls.get_parameter('desc', location=['json', 'form'])\nBaseController().create_task(index_id=index, task_id=task, title=title, desc=desc)\nresponse_data = dict(index=index, task=task, title=title, desc=...
<|body_start_0|> start_time = datetime.now() title = cls.get_parameter('title', required=True, location=['json', 'form']) desc = cls.get_parameter('desc', location=['json', 'form']) BaseController().create_task(index_id=index, task_id=task, title=title, desc=desc) response_data =...
Task相关资源接口
TaskResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskResource: """Task相关资源接口""" def post(cls, index, task): """新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应""" <|body_0|> def delete(cls, index, task): """删除一个task :param index: Task所属的index :param task: Task的id :return: 删除成功响应""" ...
stack_v2_sparse_classes_36k_train_013493
3,892
permissive
[ { "docstring": "新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应", "name": "post", "signature": "def post(cls, index, task)" }, { "docstring": "删除一个task :param index: Task所属的index :param task: Task的id :return: 删除成功响应", "name": "delete", "signature": "def delete(cl...
5
stack_v2_sparse_classes_30k_train_004520
Implement the Python class `TaskResource` described below. Class description: Task相关资源接口 Method signatures and docstrings: - def post(cls, index, task): 新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应 - def delete(cls, index, task): 删除一个task :param index: Task所属的index :param task: Task的id :re...
Implement the Python class `TaskResource` described below. Class description: Task相关资源接口 Method signatures and docstrings: - def post(cls, index, task): 新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应 - def delete(cls, index, task): 删除一个task :param index: Task所属的index :param task: Task的id :re...
3d50d3854a087eecaf45a744ddfe2fa2e225951a
<|skeleton|> class TaskResource: """Task相关资源接口""" def post(cls, index, task): """新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应""" <|body_0|> def delete(cls, index, task): """删除一个task :param index: Task所属的index :param task: Task的id :return: 删除成功响应""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskResource: """Task相关资源接口""" def post(cls, index, task): """新建一个Task :param index: Task所属的index :param task: Task的id :return: 创建成功响应""" start_time = datetime.now() title = cls.get_parameter('title', required=True, location=['json', 'form']) desc = cls.get_parameter('desc...
the_stack_v2_python_sparse
App/apis/TaskResource.py
PhenomingZ/dicer2
train
1
e998b49a3db66c22905d0c817517699f4fdd9e84
[ "super().__init__()\nassert batch_size % num_id == 0\nself.anneal = anneal\nself.batch_size = batch_size\nself.num_id = num_id\nself.feat_dims = feat_dims", "preds = F.normalize(preds, dim=1)\nmask = 1.0 - torch.eye(self.batch_size)\nmask = mask.unsqueeze(dim=0).repeat(self.batch_size, 1, 1)\nsim_all = torch.mm(p...
<|body_start_0|> super().__init__() assert batch_size % num_id == 0 self.anneal = anneal self.batch_size = batch_size self.num_id = num_id self.feat_dims = feat_dims <|end_body_0|> <|body_start_1|> preds = F.normalize(preds, dim=1) mask = 1.0 - torch.eye(...
PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the same number of instances represented in...
SmoothAP_old
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmoothAP_old: """PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the...
stack_v2_sparse_classes_36k_train_013494
10,777
permissive
[ { "docstring": "Parameters ---------- anneal : float the temperature of the sigmoid that is used to smooth the ranking function batch_size : int the batch size being used num_id : int the number of different classes that are represented in the batch feat_dims : int the dimension of the input feature embeddings"...
2
stack_v2_sparse_classes_30k_train_018968
Implement the Python class `SmoothAP_old` described below. Class description: PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined numb...
Implement the Python class `SmoothAP_old` described below. Class description: PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined numb...
d0eaee768e0be606417a27ce5ea2b3071b5a9bc2
<|skeleton|> class SmoothAP_old: """PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SmoothAP_old: """PyTorch implementation of the Smooth-AP loss. implementation of the Smooth-AP loss. Takes as input the mini-batch of CNN-produced feature embeddings and returns the value of the Smooth-AP loss. The mini-batch must be formed of a defined number of classes. Each class must have the same number ...
the_stack_v2_python_sparse
fastreid/modeling/losses/smooth_ap.py
SZLSP/reid2020NAIC
train
2
09708350bf3d70b4c8c284e8cb9f8ec62cbe963e
[ "if len(nums) < 3:\n return 0\nfirstBiggest, secondBiggest, thirdBiggest = (float('-inf'), float('-inf'), float('-inf'))\nfirstSmallest, secondSmallest = (float('-inf'), float('-inf'))\nC = Counter(nums)\nfirstBiggest = max(C)\nC[firstBiggest] -= 1\nif not C[firstBiggest]:\n del C[firstBiggest]\nsecondBiggest...
<|body_start_0|> if len(nums) < 3: return 0 firstBiggest, secondBiggest, thirdBiggest = (float('-inf'), float('-inf'), float('-inf')) firstSmallest, secondSmallest = (float('-inf'), float('-inf')) C = Counter(nums) firstBiggest = max(C) C[firstBiggest] -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximumProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maximumProductFirstSolution(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(nums) < 3: ...
stack_v2_sparse_classes_36k_train_013495
1,631
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maximumProduct", "signature": "def maximumProduct(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maximumProductFirstSolution", "signature": "def maximumProductFirstSolution(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_008867
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumProduct(self, nums): :type nums: List[int] :rtype: int - def maximumProductFirstSolution(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximumProduct(self, nums): :type nums: List[int] :rtype: int - def maximumProductFirstSolution(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
25e5caf324e25edfdf0a7a3be1e572f5d4c88837
<|skeleton|> class Solution: def maximumProduct(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maximumProductFirstSolution(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maximumProduct(self, nums): """:type nums: List[int] :rtype: int""" if len(nums) < 3: return 0 firstBiggest, secondBiggest, thirdBiggest = (float('-inf'), float('-inf'), float('-inf')) firstSmallest, secondSmallest = (float('-inf'), float('-inf')) ...
the_stack_v2_python_sparse
Arrays/maximum_product_of_three_numbers.py
msraju2009/CodingProblemsPractice
train
0
c94811c3fa387981ae712874af7af55f987415dc
[ "self.find(MobileBy.XPATH, '//android.widget.RelativeLayout[@resource-id=\"com.tencent.wework:id/cth\"]').click()\nsleep(2)\nif '快速输入' in self.driver.page_source:\n self.find(MobileBy.XPATH, '//*[@text=\"快速输入\"]').click()\nelse:\n print('当前处于快速输入页')\nreturn QuickEditPage(self.driver)", "self.find(MobileBy.X...
<|body_start_0|> self.find(MobileBy.XPATH, '//android.widget.RelativeLayout[@resource-id="com.tencent.wework:id/cth"]').click() sleep(2) if '快速输入' in self.driver.page_source: self.find(MobileBy.XPATH, '//*[@text="快速输入"]').click() else: print('当前处于快速输入页') r...
AddMembersPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMembersPage: def goto_manuall_edit_page(self): """点击 手动添加成员到快速输入page :return:""" <|body_0|> def goto_full_edit_page(self): """点击手动添加成员到完整输入page :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.find(MobileBy.XPATH, '//android.widget.R...
stack_v2_sparse_classes_36k_train_013496
1,520
no_license
[ { "docstring": "点击 手动添加成员到快速输入page :return:", "name": "goto_manuall_edit_page", "signature": "def goto_manuall_edit_page(self)" }, { "docstring": "点击手动添加成员到完整输入page :return:", "name": "goto_full_edit_page", "signature": "def goto_full_edit_page(self)" } ]
2
stack_v2_sparse_classes_30k_train_012154
Implement the Python class `AddMembersPage` described below. Class description: Implement the AddMembersPage class. Method signatures and docstrings: - def goto_manuall_edit_page(self): 点击 手动添加成员到快速输入page :return: - def goto_full_edit_page(self): 点击手动添加成员到完整输入page :return:
Implement the Python class `AddMembersPage` described below. Class description: Implement the AddMembersPage class. Method signatures and docstrings: - def goto_manuall_edit_page(self): 点击 手动添加成员到快速输入page :return: - def goto_full_edit_page(self): 点击手动添加成员到完整输入page :return: <|skeleton|> class AddMembersPage: def...
8e8a859b2bfc032e78ac5bd1895a35ca5d981ed5
<|skeleton|> class AddMembersPage: def goto_manuall_edit_page(self): """点击 手动添加成员到快速输入page :return:""" <|body_0|> def goto_full_edit_page(self): """点击手动添加成员到完整输入page :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddMembersPage: def goto_manuall_edit_page(self): """点击 手动添加成员到快速输入page :return:""" self.find(MobileBy.XPATH, '//android.widget.RelativeLayout[@resource-id="com.tencent.wework:id/cth"]').click() sleep(2) if '快速输入' in self.driver.page_source: self.find(MobileBy.XPATH...
the_stack_v2_python_sparse
app/appo/page/add_menbers_page.py
zwnong/HogwartsSDE17_HomeWork
train
1
18a95e1da5f43bf4586a1a2c77ad942c54626d2a
[ "self.region = region\nself.subnet = subnet\nself.vpc = vpc", "if dictionary is None:\n return None\nregion = dictionary.get('region')\nsubnet = dictionary.get('subnet')\nvpc = dictionary.get('vpc')\nreturn cls(region, subnet, vpc)" ]
<|body_start_0|> self.region = region self.subnet = subnet self.vpc = vpc <|end_body_0|> <|body_start_1|> if dictionary is None: return None region = dictionary.get('region') subnet = dictionary.get('subnet') vpc = dictionary.get('vpc') return...
Implementation of the 'AWSFleetParams_NetworkParams' model. TODO: type description here. Attributes: region (string): Region for the VM. subnet (string): Subnet for the VM. vpc (string): VPC for the VM.
AWSFleetParams_NetworkParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AWSFleetParams_NetworkParams: """Implementation of the 'AWSFleetParams_NetworkParams' model. TODO: type description here. Attributes: region (string): Region for the VM. subnet (string): Subnet for the VM. vpc (string): VPC for the VM.""" def __init__(self, region=None, subnet=None, vpc=None...
stack_v2_sparse_classes_36k_train_013497
1,661
permissive
[ { "docstring": "Constructor for the AWSFleetParams_NetworkParams class", "name": "__init__", "signature": "def __init__(self, region=None, subnet=None, vpc=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of ...
2
null
Implement the Python class `AWSFleetParams_NetworkParams` described below. Class description: Implementation of the 'AWSFleetParams_NetworkParams' model. TODO: type description here. Attributes: region (string): Region for the VM. subnet (string): Subnet for the VM. vpc (string): VPC for the VM. Method signatures and...
Implement the Python class `AWSFleetParams_NetworkParams` described below. Class description: Implementation of the 'AWSFleetParams_NetworkParams' model. TODO: type description here. Attributes: region (string): Region for the VM. subnet (string): Subnet for the VM. vpc (string): VPC for the VM. Method signatures and...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class AWSFleetParams_NetworkParams: """Implementation of the 'AWSFleetParams_NetworkParams' model. TODO: type description here. Attributes: region (string): Region for the VM. subnet (string): Subnet for the VM. vpc (string): VPC for the VM.""" def __init__(self, region=None, subnet=None, vpc=None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AWSFleetParams_NetworkParams: """Implementation of the 'AWSFleetParams_NetworkParams' model. TODO: type description here. Attributes: region (string): Region for the VM. subnet (string): Subnet for the VM. vpc (string): VPC for the VM.""" def __init__(self, region=None, subnet=None, vpc=None): ""...
the_stack_v2_python_sparse
cohesity_management_sdk/models/aws_fleet_params_network_params.py
cohesity/management-sdk-python
train
24
787b47ca0fd5146b77ce4edcf0f895ed27d910e2
[ "M, elements_lv0, data_impress, wells = initial_mesh(mesh, load=load, convert=convert)\nctes.init(M, wells)\nctes.component_properties()\nfprop = self.get_initial_properties(M, wells)\nreturn (M, data_impress, wells, fprop, load, elements_lv0)", "t0 = time.time()\nt_obj = delta_time(fprop)\n'---- Get pressure fie...
<|body_start_0|> M, elements_lv0, data_impress, wells = initial_mesh(mesh, load=load, convert=convert) ctes.init(M, wells) ctes.component_properties() fprop = self.get_initial_properties(M, wells) return (M, data_impress, wells, fprop, load, elements_lv0) <|end_body_0|> <|body_s...
RunSimulationAdm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunSimulationAdm: def initialize(self, load, convert, mesh, **kwargs): """Function to initialize mesh (preprocess) get and compute initial mesh properties""" <|body_0|> def run(self, M, wells, fprop, load, **kwargs): """Function created to compute reservoir and fluid...
stack_v2_sparse_classes_36k_train_013498
3,699
no_license
[ { "docstring": "Function to initialize mesh (preprocess) get and compute initial mesh properties", "name": "initialize", "signature": "def initialize(self, load, convert, mesh, **kwargs)" }, { "docstring": "Function created to compute reservoir and fluid properties at each time step", "name"...
2
null
Implement the Python class `RunSimulationAdm` described below. Class description: Implement the RunSimulationAdm class. Method signatures and docstrings: - def initialize(self, load, convert, mesh, **kwargs): Function to initialize mesh (preprocess) get and compute initial mesh properties - def run(self, M, wells, fp...
Implement the Python class `RunSimulationAdm` described below. Class description: Implement the RunSimulationAdm class. Method signatures and docstrings: - def initialize(self, load, convert, mesh, **kwargs): Function to initialize mesh (preprocess) get and compute initial mesh properties - def run(self, M, wells, fp...
f322547d5dc315b592e5f8334fdc55caaa8b9851
<|skeleton|> class RunSimulationAdm: def initialize(self, load, convert, mesh, **kwargs): """Function to initialize mesh (preprocess) get and compute initial mesh properties""" <|body_0|> def run(self, M, wells, fprop, load, **kwargs): """Function created to compute reservoir and fluid...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunSimulationAdm: def initialize(self, load, convert, mesh, **kwargs): """Function to initialize mesh (preprocess) get and compute initial mesh properties""" M, elements_lv0, data_impress, wells = initial_mesh(mesh, load=load, convert=convert) ctes.init(M, wells) ctes.component...
the_stack_v2_python_sparse
adm_impec-00/run_compositional_adm.py
obel01/obel-impec
train
0
5b5d8e99def0cd2ca057f9f16d0b48d6a8083853
[ "self._rootProduction = root\nself._declaration = declaration\nself._generator = simpleparsegrammar.Parser(declaration, prebuilts, definitionSources=definitionSources).generator", "if production is None:\n production = self._rootProduction\nif processor is None:\n processor = self.buildProcessor()\nreturn s...
<|body_start_0|> self._rootProduction = root self._declaration = declaration self._generator = simpleparsegrammar.Parser(declaration, prebuilts, definitionSources=definitionSources).generator <|end_body_0|> <|body_start_1|> if production is None: production = self._rootProdu...
EBNF-generated Parsers with results-handling The Parser is a two-stage object: Passed an EBNF definition during initialisation, it compiles the definition into a tagging table (which in turn requires creating a tagging table for parsing the EBNF). You then call the parser's parse method to perform the actual parsing of...
Parser
[ "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "LGPL-2.1-or-later", "GPL-3.0-only", "LGPL-2.0-or-later", "GPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parser: """EBNF-generated Parsers with results-handling The Parser is a two-stage object: Passed an EBNF definition during initialisation, it compiles the definition into a tagging table (which in turn requires creating a tagging table for parsing the EBNF). You then call the parser's parse metho...
stack_v2_sparse_classes_36k_train_013499
1,696
permissive
[ { "docstring": "Initialise the parser, creating the tagging table for it declaration -- simpleparse ebnf declaration of the language being parsed root -- root production used for parsing if none explicitly specified prebuilts -- sequence of (name,value) tuples with prebuilt tables, values can be either objectge...
2
null
Implement the Python class `Parser` described below. Class description: EBNF-generated Parsers with results-handling The Parser is a two-stage object: Passed an EBNF definition during initialisation, it compiles the definition into a tagging table (which in turn requires creating a tagging table for parsing the EBNF)....
Implement the Python class `Parser` described below. Class description: EBNF-generated Parsers with results-handling The Parser is a two-stage object: Passed an EBNF definition during initialisation, it compiles the definition into a tagging table (which in turn requires creating a tagging table for parsing the EBNF)....
7f600ad153270feff12aa7aa86d7ed0a49ebc71c
<|skeleton|> class Parser: """EBNF-generated Parsers with results-handling The Parser is a two-stage object: Passed an EBNF definition during initialisation, it compiles the definition into a tagging table (which in turn requires creating a tagging table for parsing the EBNF). You then call the parser's parse metho...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parser: """EBNF-generated Parsers with results-handling The Parser is a two-stage object: Passed an EBNF definition during initialisation, it compiles the definition into a tagging table (which in turn requires creating a tagging table for parsing the EBNF). You then call the parser's parse method to perform ...
the_stack_v2_python_sparse
pythonAnimations/pyOpenGLChess/engineDirectory/oglc-env/lib/python2.7/site-packages/simpleparse/parser.py
alexus37/AugmentedRealityChess
train
1