blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
83435ec322fe9868ea19f6f0d2ee0ab93e2a9001
[ "stack = []\nvals = []\nnode = root\nwhile stack or node:\n while node:\n stack.append(node)\n node = node.left\n node = stack.pop()\n vals.append(node.val)\n node = node.right\nvals.sort()\nnode = root\ni = 0\nwhile stack or node:\n while node:\n stack.append(node)\n node...
<|body_start_0|> stack = [] vals = [] node = root while stack or node: while node: stack.append(node) node = node.left node = stack.pop() vals.append(node.val) node = node.right vals.sort() no...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def recoverTree(self, root: Optional[TreeNode]) -> None: """Do not return anything, modify root in-place instead.""" <|body_0|> def recoverTree2(self, root: Optional[TreeNode]) -> None: """Do not return anything, modify root in-place instead.""" <|b...
stack_v2_sparse_classes_10k_train_000400
2,570
no_license
[ { "docstring": "Do not return anything, modify root in-place instead.", "name": "recoverTree", "signature": "def recoverTree(self, root: Optional[TreeNode]) -> None" }, { "docstring": "Do not return anything, modify root in-place instead.", "name": "recoverTree2", "signature": "def recov...
3
stack_v2_sparse_classes_30k_train_007069
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root: Optional[TreeNode]) -> None: Do not return anything, modify root in-place instead. - def recoverTree2(self, root: Optional[TreeNode]) -> None: Do not ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def recoverTree(self, root: Optional[TreeNode]) -> None: Do not return anything, modify root in-place instead. - def recoverTree2(self, root: Optional[TreeNode]) -> None: Do not ...
7f8145f0c7ffdf18c557f01d221087b10443156e
<|skeleton|> class Solution: def recoverTree(self, root: Optional[TreeNode]) -> None: """Do not return anything, modify root in-place instead.""" <|body_0|> def recoverTree2(self, root: Optional[TreeNode]) -> None: """Do not return anything, modify root in-place instead.""" <|b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def recoverTree(self, root: Optional[TreeNode]) -> None: """Do not return anything, modify root in-place instead.""" stack = [] vals = [] node = root while stack or node: while node: stack.append(node) node = node.le...
the_stack_v2_python_sparse
tree/099 Recover Binary Search Tree.py
mofei952/leetcode_python
train
0
6ba23a850b67a8fb27034340ccc0aee22c6e62b1
[ "_type, qname, qclass, qtype, _id, ip = query\nself.has_result = False\nqname_lower = qname.lower()\n'List of servers to round-robin'\nservers = ['192.168.1.201', '192.168.1.202']\nserver = random.choice(servers)\nself.results = []\nif (qtype == 'A' or qtype == 'ANY') and qname_lower == 'test.domain.org':\n self...
<|body_start_0|> _type, qname, qclass, qtype, _id, ip = query self.has_result = False qname_lower = qname.lower() 'List of servers to round-robin' servers = ['192.168.1.201', '192.168.1.202'] server = random.choice(servers) self.results = [] if (qtype == '...
Handle PowerDNS pipe-backend domain name lookups.
DNSLookup
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNSLookup: """Handle PowerDNS pipe-backend domain name lookups.""" def __init__(self, query): """parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.h...
stack_v2_sparse_classes_10k_train_000401
4,118
permissive
[ { "docstring": "parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.html#PIPEBACKEND-PROTOCOL", "name": "__init__", "signature": "def __init__(self, query)" }, { ...
2
null
Implement the Python class `DNSLookup` described below. Class description: Handle PowerDNS pipe-backend domain name lookups. Method signatures and docstrings: - def __init__(self, query): parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://do...
Implement the Python class `DNSLookup` described below. Class description: Handle PowerDNS pipe-backend domain name lookups. Method signatures and docstrings: - def __init__(self, query): parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://do...
665d39a2bd82543d5196555f0801ef8fd4a3ee48
<|skeleton|> class DNSLookup: """Handle PowerDNS pipe-backend domain name lookups.""" def __init__(self, query): """parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.h...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DNSLookup: """Handle PowerDNS pipe-backend domain name lookups.""" def __init__(self, query): """parse DNS query and produce lookup result. query: a sequence containing the DNS query as per PowerDNS manual appendix A: http://downloads.powerdns.com/documentation/html/backends-detail.html#PIPEBACKE...
the_stack_v2_python_sparse
dockerized-gists/10069682/snippet.py
gistable/gistable
train
76
4019039f663f17ee6c87ade74a3205524bdfe54f
[ "combinations = []\nself.subroutine(n, 0, 0, '', combinations)\nreturn combinations", "if num_open == n and num_close == n:\n combinations.append(string)\nif num_open < n:\n self.subroutine(n, num_open + 1, num_close, string + '(', combinations)\nif num_close < num_open:\n self.subroutine(n, num_open, nu...
<|body_start_0|> combinations = [] self.subroutine(n, 0, 0, '', combinations) return combinations <|end_body_0|> <|body_start_1|> if num_open == n and num_close == n: combinations.append(string) if num_open < n: self.subroutine(n, num_open + 1, num_close,...
Leet22
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Leet22: def generate_parenthesis(self, n): """Generate all combinations of well-formed parentheses. Args: n -- An integer. Returns: All combinations of well-formed parentheses.""" <|body_0|> def subroutine(self, n, num_open, num_close, string, combinations): """Gener...
stack_v2_sparse_classes_10k_train_000402
1,779
no_license
[ { "docstring": "Generate all combinations of well-formed parentheses. Args: n -- An integer. Returns: All combinations of well-formed parentheses.", "name": "generate_parenthesis", "signature": "def generate_parenthesis(self, n)" }, { "docstring": "Generate all combinations of well-formed parent...
2
stack_v2_sparse_classes_30k_train_003405
Implement the Python class `Leet22` described below. Class description: Implement the Leet22 class. Method signatures and docstrings: - def generate_parenthesis(self, n): Generate all combinations of well-formed parentheses. Args: n -- An integer. Returns: All combinations of well-formed parentheses. - def subroutine...
Implement the Python class `Leet22` described below. Class description: Implement the Leet22 class. Method signatures and docstrings: - def generate_parenthesis(self, n): Generate all combinations of well-formed parentheses. Args: n -- An integer. Returns: All combinations of well-formed parentheses. - def subroutine...
b0cfcfa1eff0101cf8e0e3fb9db55fb83f566f6f
<|skeleton|> class Leet22: def generate_parenthesis(self, n): """Generate all combinations of well-formed parentheses. Args: n -- An integer. Returns: All combinations of well-formed parentheses.""" <|body_0|> def subroutine(self, n, num_open, num_close, string, combinations): """Gener...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Leet22: def generate_parenthesis(self, n): """Generate all combinations of well-formed parentheses. Args: n -- An integer. Returns: All combinations of well-formed parentheses.""" combinations = [] self.subroutine(n, 0, 0, '', combinations) return combinations def subrouti...
the_stack_v2_python_sparse
archive/algorithms-leetcode/leet22.py
riehseun/software-engineering
train
0
fa03eb978f72ad075abdc2637a5dca7e5bff5ef8
[ "self.minheap = []\nself.maxheap = []\nself.len_min = self.len_max = 0", "if self.len_max == 0:\n heapq.heappush(self.maxheap, num)\n self.len_max += 1\n return\nif self.len_max == self.len_min:\n if num >= self.maxheap[0]:\n heapq.heappush(self.maxheap, num)\n else:\n heapq.heappush(...
<|body_start_0|> self.minheap = [] self.maxheap = [] self.len_min = self.len_max = 0 <|end_body_0|> <|body_start_1|> if self.len_max == 0: heapq.heappush(self.maxheap, num) self.len_max += 1 return if self.len_max == self.len_min: ...
MedianFinder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_10k_train_000403
1,807
permissive
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: None", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_003355
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: None - def findMedian(self): :rtype: float <|skeleton|> class Me...
c5e7777e6a5b691bb410c25f29ae0f51a6598a12
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: None""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.minheap = [] self.maxheap = [] self.len_min = self.len_max = 0 def addNum(self, num): """:type num: int :rtype: None""" if self.len_max == 0: heapq.heappush(self.m...
the_stack_v2_python_sparse
剑指offer/41-Stream-Median.py
xizhang77/CodingInterview
train
1
c57ff9c6ae888e8c5f8df102f0f835ad4df175da
[ "self.line_style = line_style\nself.has_fill = has_fill\nself.fill_colour = fill_colour", "plt.title(title)\nplt.xlabel(labels[0])\nplt.ylabel(labels[1])\nif self.has_fill:\n plt.plot(data[0], data[1], self.line_style)\n plt.fill_between(data[0], data[1], color=f'{self.fill_colour}')\nelse:\n plt.plot(da...
<|body_start_0|> self.line_style = line_style self.has_fill = has_fill self.fill_colour = fill_colour <|end_body_0|> <|body_start_1|> plt.title(title) plt.xlabel(labels[0]) plt.ylabel(labels[1]) if self.has_fill: plt.plot(data[0], data[1], self.line_s...
Represents an object that generates a line graph when it is called and executed as a function
LineGraph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineGraph: """Represents an object that generates a line graph when it is called and executed as a function""" def __init__(self, line_style, has_fill=False, fill_colour=None): """Initializes a LineGraph object :param line_style: style of a line in a line graph as a String :param has...
stack_v2_sparse_classes_10k_train_000404
5,075
no_license
[ { "docstring": "Initializes a LineGraph object :param line_style: style of a line in a line graph as a String :param has_fill: tells if a line graph has a fill as a Bool :param fill_colour: colour of the fill as a String", "name": "__init__", "signature": "def __init__(self, line_style, has_fill=False, ...
2
stack_v2_sparse_classes_30k_train_001032
Implement the Python class `LineGraph` described below. Class description: Represents an object that generates a line graph when it is called and executed as a function Method signatures and docstrings: - def __init__(self, line_style, has_fill=False, fill_colour=None): Initializes a LineGraph object :param line_styl...
Implement the Python class `LineGraph` described below. Class description: Represents an object that generates a line graph when it is called and executed as a function Method signatures and docstrings: - def __init__(self, line_style, has_fill=False, fill_colour=None): Initializes a LineGraph object :param line_styl...
e4953c9a4f574a6d92cbd0815e5150dd1523c31d
<|skeleton|> class LineGraph: """Represents an object that generates a line graph when it is called and executed as a function""" def __init__(self, line_style, has_fill=False, fill_colour=None): """Initializes a LineGraph object :param line_style: style of a line in a line graph as a String :param has...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LineGraph: """Represents an object that generates a line graph when it is called and executed as a function""" def __init__(self, line_style, has_fill=False, fill_colour=None): """Initializes a LineGraph object :param line_style: style of a line in a line graph as a String :param has_fill: tells ...
the_stack_v2_python_sparse
Labs/Lab9/observers.py
kchung90/Python-Labs-Assignments
train
0
e1423d947641b2b3a68de8634fc74139b599e3e1
[ "keys = set(keys)\nmatch = {}\nif depth == 1:\n for key in keys:\n value = top_level.get(key, None)\n if value is not None:\n match[key] = value\nelse:\n for _, parsed_key, parsed_value in plist_interface.RecurseKey(top_level, depth=depth):\n if parsed_key in keys:\n ...
<|body_start_0|> keys = set(keys) match = {} if depth == 1: for key in keys: value = top_level.get(key, None) if value is not None: match[key] = value else: for _, parsed_key, parsed_value in plist_interface.Recu...
MacOS user accounts plugin.
MacOSUserAccountsPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSUserAccountsPlugin: """MacOS user accounts plugin.""" def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): """Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be re...
stack_v2_sparse_classes_10k_train_000405
10,128
permissive
[ { "docstring": "Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be returned. depth (int): depth within the plist, where 1 is top level. Returns: dict[str, str]: values of the requested keys.", "nam...
3
null
Implement the Python class `MacOSUserAccountsPlugin` described below. Class description: MacOS user accounts plugin. Method signatures and docstrings: - def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist...
Implement the Python class `MacOSUserAccountsPlugin` described below. Class description: MacOS user accounts plugin. Method signatures and docstrings: - def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist...
f9299b8ad0cb2a6bbbd5e65f01d2ba06406c70ac
<|skeleton|> class MacOSUserAccountsPlugin: """MacOS user accounts plugin.""" def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): """Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MacOSUserAccountsPlugin: """MacOS user accounts plugin.""" def _GetKeysDefaultEmpty(self, top_level, keys, depth=1): """Retrieves plist keys, defaulting to empty values. Args: top_level (plistlib._InternalDict): top level plist object. keys (set[str]): names of keys that should be returned. depth...
the_stack_v2_python_sparse
engine/preprocessors/macos.py
dfrc-korea/carpe
train
75
fb11f150c17464687c6b74bcd58c7fcb80635ecc
[ "ret = -1\nfor i in range(len(strs)):\n for j in range(len(strs)):\n if j != i and self.judge(strs[i], strs[j]):\n break\n else:\n ret = max(ret, len(strs[i]))\nreturn ret", "if len(s2) < len(s1):\n return False\nindex_of_s1 = 0\nindex_of_s2 = 0\nwhile index_of_s1 < len(s1) and i...
<|body_start_0|> ret = -1 for i in range(len(strs)): for j in range(len(strs)): if j != i and self.judge(strs[i], strs[j]): break else: ret = max(ret, len(strs[i])) return ret <|end_body_0|> <|body_start_1|> if ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findLUSlength(self, strs): """:type strs: List[str] :rtype: int""" <|body_0|> def judge(self, s1, s2): """if s1 is a subsequence of s2 :param s1: :param s2: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = -1 for ...
stack_v2_sparse_classes_10k_train_000406
1,176
no_license
[ { "docstring": ":type strs: List[str] :rtype: int", "name": "findLUSlength", "signature": "def findLUSlength(self, strs)" }, { "docstring": "if s1 is a subsequence of s2 :param s1: :param s2: :return:", "name": "judge", "signature": "def judge(self, s1, s2)" } ]
2
stack_v2_sparse_classes_30k_train_001183
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLUSlength(self, strs): :type strs: List[str] :rtype: int - def judge(self, s1, s2): if s1 is a subsequence of s2 :param s1: :param s2: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findLUSlength(self, strs): :type strs: List[str] :rtype: int - def judge(self, s1, s2): if s1 is a subsequence of s2 :param s1: :param s2: :return: <|skeleton|> class Soluti...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def findLUSlength(self, strs): """:type strs: List[str] :rtype: int""" <|body_0|> def judge(self, s1, s2): """if s1 is a subsequence of s2 :param s1: :param s2: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findLUSlength(self, strs): """:type strs: List[str] :rtype: int""" ret = -1 for i in range(len(strs)): for j in range(len(strs)): if j != i and self.judge(strs[i], strs[j]): break else: ret = max(...
the_stack_v2_python_sparse
python/leetcode/522_Longest_Uncommon_Subsequence_II.py
bobcaoge/my-code
train
0
56af4f14d7a7bc49058f75a5ffd34e3bf122239b
[ "ss = acm.FStoredScenario.Select(\"name='{0}'\".format(title))\nif len(ss) != 1:\n raise ValueError('Could not find the specified scenario.')\nself.scenario = ss[0].Scenario()", "scen_dim = self.scenario.ExplicitDimensions()[vector_nr]\nsel_value = lambda x: str(x.Parameter('rs'))\nvec = scen_dim.ShiftVectors(...
<|body_start_0|> ss = acm.FStoredScenario.Select("name='{0}'".format(title)) if len(ss) != 1: raise ValueError('Could not find the specified scenario.') self.scenario = ss[0].Scenario() <|end_body_0|> <|body_start_1|> scen_dim = self.scenario.ExplicitDimensions()[vector_nr] ...
Contains methods that are related to FStoredScenario.
FScenarioUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FScenarioUtil: """Contains methods that are related to FStoredScenario.""" def __init__(self, title): """Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title""" <|body_0|> def get_scenario_vector_as_list(self, v...
stack_v2_sparse_classes_10k_train_000407
8,293
no_license
[ { "docstring": "Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title", "name": "__init__", "signature": "def __init__(self, title)" }, { "docstring": "Returns the tuple (title, values) with the vector title and the vector items values",...
2
stack_v2_sparse_classes_30k_val_000121
Implement the Python class `FScenarioUtil` described below. Class description: Contains methods that are related to FStoredScenario. Method signatures and docstrings: - def __init__(self, title): Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title - def get...
Implement the Python class `FScenarioUtil` described below. Class description: Contains methods that are related to FStoredScenario. Method signatures and docstrings: - def __init__(self, title): Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title - def get...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class FScenarioUtil: """Contains methods that are related to FStoredScenario.""" def __init__(self, title): """Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title""" <|body_0|> def get_scenario_vector_as_list(self, v...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FScenarioUtil: """Contains methods that are related to FStoredScenario.""" def __init__(self, title): """Sets the scenario attribute to the front arena instance of the FStoredScenario type with the corresponding title""" ss = acm.FStoredScenario.Select("name='{0}'".format(title)) ...
the_stack_v2_python_sparse
Python modules/RiskMatrixViewSimpleReport.py
webclinic017/fa-absa-py3
train
0
97126404bc1cbec7c9daa3622909b52755830540
[ "self.encoding_size = encoding_size\nself.policy_model = policy_model\nself.next_visual_in: List[tf.Tensor] = []\nencoded_state, encoded_next_state = self.create_curiosity_encoders()\nself.create_inverse_model(encoded_state, encoded_next_state)\nself.create_forward_model(encoded_state, encoded_next_state)\nself.cre...
<|body_start_0|> self.encoding_size = encoding_size self.policy_model = policy_model self.next_visual_in: List[tf.Tensor] = [] encoded_state, encoded_next_state = self.create_curiosity_encoders() self.create_inverse_model(encoded_state, encoded_next_state) self.create_for...
CuriosityModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CuriosityModel: def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): """Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the e...
stack_v2_sparse_classes_10k_train_000408
8,093
permissive
[ { "docstring": "Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the encoding for the Curiosity module :param learning_rate: The learning rate for the curiosity module", "name": "__init__", "...
5
stack_v2_sparse_classes_30k_train_006115
Implement the Python class `CuriosityModel` described below. Class description: Implement the CuriosityModel class. Method signatures and docstrings: - def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): Creates the curiosity model for the Curiosity reward Generator :...
Implement the Python class `CuriosityModel` described below. Class description: Implement the CuriosityModel class. Method signatures and docstrings: - def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): Creates the curiosity model for the Curiosity reward Generator :...
334df1e8afbfff3544413ade46fb12f03556014b
<|skeleton|> class CuriosityModel: def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): """Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the e...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CuriosityModel: def __init__(self, policy_model: LearningModel, encoding_size: int=128, learning_rate: float=0.0003): """Creates the curiosity model for the Curiosity reward Generator :param policy_model: The model being used by the learning policy :param encoding_size: The size of the encoding for th...
the_stack_v2_python_sparse
mlagents/trainers/components/reward_signals/curiosity/model.py
Abluceli/HRG-SAC
train
7
93b3eae173a8cc589faea3e7007c8d4cba236de5
[ "enc_hex = Encoder.encode_hex(bssid, psk)\nenc_freq = Encoder.encode_frequencies(enc_hex)\nreturn enc_freq", "bssid = bssid.lower().strip()\npsk = psk.strip()\nmain = MainActivity()\nencoder = DataEncoder()\nshort_bssid = main._to_mac_address(bssid)\nmac = main._gen_mac_bytes(short_bssid)\nencoded = encoder.encod...
<|body_start_0|> enc_hex = Encoder.encode_hex(bssid, psk) enc_freq = Encoder.encode_frequencies(enc_hex) return enc_freq <|end_body_0|> <|body_start_1|> bssid = bssid.lower().strip() psk = psk.strip() main = MainActivity() encoder = DataEncoder() short_bs...
Essentially a minimalist wrapper for ..voice.encoder.DataEncoder.DataEncoder Utilising: ..voice.MainActivity.MainActivity ..voice.encoder.VoicePlayer.VoicePlayer
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Essentially a minimalist wrapper for ..voice.encoder.DataEncoder.DataEncoder Utilising: ..voice.MainActivity.MainActivity ..voice.encoder.VoicePlayer.VoicePlayer""" def encode(bssid, psk): """Shortcut for: Encoder.encode_hex Encoder.encode_frequencies Encode 'bssid' and '...
stack_v2_sparse_classes_10k_train_000409
2,118
no_license
[ { "docstring": "Shortcut for: Encoder.encode_hex Encoder.encode_frequencies Encode 'bssid' and 'psk' into 'frequencies'", "name": "encode", "signature": "def encode(bssid, psk)" }, { "docstring": "Wrapper for: ..voice.MainActivity.MainActivity._to_mac_address ..voice.MainActivity.MainActivity._g...
3
stack_v2_sparse_classes_30k_train_003424
Implement the Python class `Encoder` described below. Class description: Essentially a minimalist wrapper for ..voice.encoder.DataEncoder.DataEncoder Utilising: ..voice.MainActivity.MainActivity ..voice.encoder.VoicePlayer.VoicePlayer Method signatures and docstrings: - def encode(bssid, psk): Shortcut for: Encoder.e...
Implement the Python class `Encoder` described below. Class description: Essentially a minimalist wrapper for ..voice.encoder.DataEncoder.DataEncoder Utilising: ..voice.MainActivity.MainActivity ..voice.encoder.VoicePlayer.VoicePlayer Method signatures and docstrings: - def encode(bssid, psk): Shortcut for: Encoder.e...
7d370342f34e26e6e66718ae397eb1d81253cd8a
<|skeleton|> class Encoder: """Essentially a minimalist wrapper for ..voice.encoder.DataEncoder.DataEncoder Utilising: ..voice.MainActivity.MainActivity ..voice.encoder.VoicePlayer.VoicePlayer""" def encode(bssid, psk): """Shortcut for: Encoder.encode_hex Encoder.encode_frequencies Encode 'bssid' and '...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Encoder: """Essentially a minimalist wrapper for ..voice.encoder.DataEncoder.DataEncoder Utilising: ..voice.MainActivity.MainActivity ..voice.encoder.VoicePlayer.VoicePlayer""" def encode(bssid, psk): """Shortcut for: Encoder.encode_hex Encoder.encode_frequencies Encode 'bssid' and 'psk' into 'fr...
the_stack_v2_python_sparse
yatwin/onekeywifi/encoder/Encoder.py
andre95d/python-yatwin
train
0
0de177fd79e2d4f2177fca3b65bfe114eaa9c092
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsOverview()", "from .entity import Entity\nfrom .user_experience_analytics_insight import UserExperienceAnalyticsInsight\nfrom .entity import Entity\nfrom .user_experience_analytics_insight import UserExperienceAn...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserExperienceAnalyticsOverview() <|end_body_0|> <|body_start_1|> from .entity import Entity from .user_experience_analytics_insight import UserExperienceAnalyticsInsight from .e...
The user experience analytics overview entity contains the overall score and the scores and insights of every metric of all categories.
UserExperienceAnalyticsOverview
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserExperienceAnalyticsOverview: """The user experience analytics overview entity contains the overall score and the scores and insights of every metric of all categories.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsOverview: ...
stack_v2_sparse_classes_10k_train_000410
2,549
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserExperienceAnalyticsOverview", "name": "create_from_discriminator_value", "signature": "def create_from_d...
3
stack_v2_sparse_classes_30k_train_003813
Implement the Python class `UserExperienceAnalyticsOverview` described below. Class description: The user experience analytics overview entity contains the overall score and the scores and insights of every metric of all categories. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: O...
Implement the Python class `UserExperienceAnalyticsOverview` described below. Class description: The user experience analytics overview entity contains the overall score and the scores and insights of every metric of all categories. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: O...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserExperienceAnalyticsOverview: """The user experience analytics overview entity contains the overall score and the scores and insights of every metric of all categories.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsOverview: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserExperienceAnalyticsOverview: """The user experience analytics overview entity contains the overall score and the scores and insights of every metric of all categories.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsOverview: """Creates a...
the_stack_v2_python_sparse
msgraph/generated/models/user_experience_analytics_overview.py
microsoftgraph/msgraph-sdk-python
train
135
09ceeff88db61da4ecf6a84878bedc5302bdf39a
[ "if self.request.version == 'v6':\n return IngestDetailsSerializerV6\nelif self.request.version == 'v7':\n return IngestDetailsSerializerV6", "if request.version == 'v6' or request.version == 'v7':\n return self.retrieve_v6(request, ingest_id)\nraise Http404()", "try:\n is_staff = False\n if requ...
<|body_start_0|> if self.request.version == 'v6': return IngestDetailsSerializerV6 elif self.request.version == 'v7': return IngestDetailsSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6' or request.version == 'v7': return self.retrieve_...
This view is the endpoint for retrieving/updating details of an ingest.
IngestDetailsView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IngestDetailsView: """This view is the endpoint for retrieving/updating details of an ingest.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def retrieve(self, request, ingest_id=None,...
stack_v2_sparse_classes_10k_train_000411
30,689
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Determine api version and call specific method :param request: the HTTP GET request :type request: ...
3
null
Implement the Python class `IngestDetailsView` described below. Class description: This view is the endpoint for retrieving/updating details of an ingest. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def retriev...
Implement the Python class `IngestDetailsView` described below. Class description: This view is the endpoint for retrieving/updating details of an ingest. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def retriev...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class IngestDetailsView: """This view is the endpoint for retrieving/updating details of an ingest.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def retrieve(self, request, ingest_id=None,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IngestDetailsView: """This view is the endpoint for retrieving/updating details of an ingest.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" if self.request.version == 'v6': return IngestDetailsSeriali...
the_stack_v2_python_sparse
scale/ingest/views.py
kfconsultant/scale
train
0
18bfc8b192f6ec564224c5a719f370957497d070
[ "article = check_article.retrieve_article(slug)\nhighlight_data = request.data\narticle_field = highlight_data.get('field')\nindex_start = highlight_data.get('start_index')\nindex_end = highlight_data.get('end_index')\nvalidate_field(article_field)\nfield_data = check_field(article, article_field)\nvalidate_index(f...
<|body_start_0|> article = check_article.retrieve_article(slug) highlight_data = request.data article_field = highlight_data.get('field') index_start = highlight_data.get('start_index') index_end = highlight_data.get('end_index') validate_field(article_field) fiel...
Highlight and comment on text views
HighlightAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HighlightAPIView: """Highlight and comment on text views""" def post(self, request, slug): """Create a text Highlight""" <|body_0|> def get(self, request, slug): """Fetch all highlighted text for a single article for user""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_000412
4,382
permissive
[ { "docstring": "Create a text Highlight", "name": "post", "signature": "def post(self, request, slug)" }, { "docstring": "Fetch all highlighted text for a single article for user", "name": "get", "signature": "def get(self, request, slug)" } ]
2
stack_v2_sparse_classes_30k_train_003069
Implement the Python class `HighlightAPIView` described below. Class description: Highlight and comment on text views Method signatures and docstrings: - def post(self, request, slug): Create a text Highlight - def get(self, request, slug): Fetch all highlighted text for a single article for user
Implement the Python class `HighlightAPIView` described below. Class description: Highlight and comment on text views Method signatures and docstrings: - def post(self, request, slug): Create a text Highlight - def get(self, request, slug): Fetch all highlighted text for a single article for user <|skeleton|> class ...
d0f73bf166ad41f243cff6d82caced2f9facf2f9
<|skeleton|> class HighlightAPIView: """Highlight and comment on text views""" def post(self, request, slug): """Create a text Highlight""" <|body_0|> def get(self, request, slug): """Fetch all highlighted text for a single article for user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HighlightAPIView: """Highlight and comment on text views""" def post(self, request, slug): """Create a text Highlight""" article = check_article.retrieve_article(slug) highlight_data = request.data article_field = highlight_data.get('field') index_start = highlight...
the_stack_v2_python_sparse
authors/apps/highlights/views.py
andela/ah-the-immortals-backend
train
3
e9b7380f22a3d65fbcbd8fb6363b7a2ad1e58156
[ "self._sess = sess\nself._grammar = grammar\nself._max_length = max_length\nconditions = {}\nif symbolic_properties_dict is not None:\n conditions.update({key: np.array([value], dtype=np.float32) for key, value in symbolic_properties_dict.iteritems()})\nself._conditions = conditions", "if not isinstance(state,...
<|body_start_0|> self._sess = sess self._grammar = grammar self._max_length = max_length conditions = {} if symbolic_properties_dict is not None: conditions.update({key: np.array([value], dtype=np.float32) for key, value in symbolic_properties_dict.iteritems()}) ...
Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model.
NeuralProductionRuleAppendPolicy
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeuralProductionRuleAppendPolicy: """Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model.""" def __init__(self, sess, grammar, max_length, symbolic_properties_dict): """Initializer. Ar...
stack_v2_sparse_classes_10k_train_000413
12,289
permissive
[ { "docstring": "Initializer. Args: sess: tf.Session, the session contains the trained model to predict next production rule from input partial sequence. If None, each step will be selected randomly. grammar: arithmetic_grammar.Grammar object. max_length: Integer, the max length of production rule sequence. symb...
2
stack_v2_sparse_classes_30k_train_002371
Implement the Python class `NeuralProductionRuleAppendPolicy` described below. Class description: Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model. Method signatures and docstrings: - def __init__(self, sess, gramma...
Implement the Python class `NeuralProductionRuleAppendPolicy` described below. Class description: Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model. Method signatures and docstrings: - def __init__(self, sess, gramma...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class NeuralProductionRuleAppendPolicy: """Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model.""" def __init__(self, sess, grammar, max_length, symbolic_properties_dict): """Initializer. Ar...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NeuralProductionRuleAppendPolicy: """Appends a valid production rule on existing list of production rules. The probabilities of the actions will be determined by the partial sequence model.""" def __init__(self, sess, grammar, max_length, symbolic_properties_dict): """Initializer. Args: sess: tf....
the_stack_v2_python_sparse
neural_guided_symbolic_regression/models/mcts.py
Jimmy-INL/google-research
train
1
244437b8afbe5873d9918e7369ad48d5232f3df4
[ "roles = self.get_queryset().all()\nserialized_roles = self.schema.dump(roles, many=True)\nreturn response(serialized_roles, SUCCESS_MESSAGES['FETCHED'].format('roles'))", "request_json = request.get_json()\nrole_details = self.schema.load(request_json)\nrole_details['name'] = role_details['name'].strip().lower()...
<|body_start_0|> roles = self.get_queryset().all() serialized_roles = self.schema.dump(roles, many=True) return response(serialized_roles, SUCCESS_MESSAGES['FETCHED'].format('roles')) <|end_body_0|> <|body_start_1|> request_json = request.get_json() role_details = self.schema.lo...
Roles Resource
RoleListResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleListResource: """Roles Resource""" def get(self): """Get roles""" <|body_0|> def post(self): """Create a new role""" <|body_1|> <|end_skeleton|> <|body_start_0|> roles = self.get_queryset().all() serialized_roles = self.schema.dump(r...
stack_v2_sparse_classes_10k_train_000414
7,412
permissive
[ { "docstring": "Get roles", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new role", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_003551
Implement the Python class `RoleListResource` described below. Class description: Roles Resource Method signatures and docstrings: - def get(self): Get roles - def post(self): Create a new role
Implement the Python class `RoleListResource` described below. Class description: Roles Resource Method signatures and docstrings: - def get(self): Get roles - def post(self): Create a new role <|skeleton|> class RoleListResource: """Roles Resource""" def get(self): """Get roles""" <|body_0|...
c5cf6baf60e95a7790156c85e37c76c697efd585
<|skeleton|> class RoleListResource: """Roles Resource""" def get(self): """Get roles""" <|body_0|> def post(self): """Create a new role""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoleListResource: """Roles Resource""" def get(self): """Get roles""" roles = self.get_queryset().all() serialized_roles = self.schema.dump(roles, many=True) return response(serialized_roles, SUCCESS_MESSAGES['FETCHED'].format('roles')) def post(self): """Crea...
the_stack_v2_python_sparse
src/views/role.py
Nardri/rbac-service
train
0
5242f7cee917ad5ba54d93b816adc91da09ae43b
[ "def dfs(root):\n if not root:\n return ''\n left = dfs(root.left)\n right = dfs(root.right)\n return left + ',' + right + ',' + str(root.val)\nreturn dfs(root)", "data = [int(x) for x in data.split(',')]\n\ndef helper(lower=float('-inf'), upper=float('+inf')):\n if not data or data[-1] < lo...
<|body_start_0|> def dfs(root): if not root: return '' left = dfs(root.left) right = dfs(root.right) return left + ',' + right + ',' + str(root.val) return dfs(root) <|end_body_0|> <|body_start_1|> data = [int(x) for x in data.spli...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(root):...
stack_v2_sparse_classes_10k_train_000415
955
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_006374
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
0566622daa5849f7deb0cfdc6de2282fb3127f4c
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def dfs(root): if not root: return '' left = dfs(root.left) right = dfs(root.right) return left + ',' + right + ',' + str(root.val) ...
the_stack_v2_python_sparse
python/树/449. 序列化和反序列化二叉搜索树.py
Weless/leetcode
train
0
22fcc0cd69accb362d71f418cc4e41c05f9ee297
[ "app_label = obj.category._meta.app_label\nmodel_name = obj.category._meta.model_name\nlink = reverse('admin:%s_%s_change' % (app_label, model_name), kwargs={'object_id': obj.category_id})\nreturn format_html(u'<a href=\"%s\">%s</a>' % (link, obj.category))", "form = super().get_form(request, obj=None, change=Fal...
<|body_start_0|> app_label = obj.category._meta.app_label model_name = obj.category._meta.model_name link = reverse('admin:%s_%s_change' % (app_label, model_name), kwargs={'object_id': obj.category_id}) return format_html(u'<a href="%s">%s</a>' % (link, obj.category)) <|end_body_0|> <|b...
ArticleAdmin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleAdmin: def category_link(self, obj): """链接到文章所属分类, obj是一个文章对象""" <|body_0|> def get_form(self, request, obj=None, change=False, **kwargs): """文章详情页内选择作者, 只有超级管理员才会被filter出来 Return a Form class for use in the admin add view.""" <|body_1|> def get_q...
stack_v2_sparse_classes_10k_train_000416
10,733
permissive
[ { "docstring": "链接到文章所属分类, obj是一个文章对象", "name": "category_link", "signature": "def category_link(self, obj)" }, { "docstring": "文章详情页内选择作者, 只有超级管理员才会被filter出来 Return a Form class for use in the admin add view.", "name": "get_form", "signature": "def get_form(self, request, obj=None, chan...
5
stack_v2_sparse_classes_30k_train_002514
Implement the Python class `ArticleAdmin` described below. Class description: Implement the ArticleAdmin class. Method signatures and docstrings: - def category_link(self, obj): 链接到文章所属分类, obj是一个文章对象 - def get_form(self, request, obj=None, change=False, **kwargs): 文章详情页内选择作者, 只有超级管理员才会被filter出来 Return a Form class fo...
Implement the Python class `ArticleAdmin` described below. Class description: Implement the ArticleAdmin class. Method signatures and docstrings: - def category_link(self, obj): 链接到文章所属分类, obj是一个文章对象 - def get_form(self, request, obj=None, change=False, **kwargs): 文章详情页内选择作者, 只有超级管理员才会被filter出来 Return a Form class fo...
0fcf3709fabeee49874343b3a4ab80582698c466
<|skeleton|> class ArticleAdmin: def category_link(self, obj): """链接到文章所属分类, obj是一个文章对象""" <|body_0|> def get_form(self, request, obj=None, change=False, **kwargs): """文章详情页内选择作者, 只有超级管理员才会被filter出来 Return a Form class for use in the admin add view.""" <|body_1|> def get_q...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArticleAdmin: def category_link(self, obj): """链接到文章所属分类, obj是一个文章对象""" app_label = obj.category._meta.app_label model_name = obj.category._meta.model_name link = reverse('admin:%s_%s_change' % (app_label, model_name), kwargs={'object_id': obj.category_id}) return forma...
the_stack_v2_python_sparse
blog/admin.py
enjoy-binbin/Django-blog
train
113
ad3f4df2546fd6e40267041de63f5de166c06f9d
[ "vowel = 'AEIOUaeiou'\ns = list(s)\ni, j = (0, len(s) - 1)\nwhile i < j:\n while s[i] not in vowel and i < j:\n i += 1\n while s[j] not in vowel and i < j:\n j -= 1\n s[i], s[j] = (s[j], s[i])\n i, j = (i + 1, j - 1)\nreturn ''.join(s)", "if len(s) == 0:\n return s\nvolwels = set('aei...
<|body_start_0|> vowel = 'AEIOUaeiou' s = list(s) i, j = (0, len(s) - 1) while i < j: while s[i] not in vowel and i < j: i += 1 while s[j] not in vowel and i < j: j -= 1 s[i], s[j] = (s[j], s[i]) i, j = (i + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseVowels(self, s): """前后指针法 :type s: str :rtype: str""" <|body_0|> def reverseVowels_timeout(self, s): """超时算法! 一个case通不过, O(2n) :type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> vowel = 'AEIOUaeiou' ...
stack_v2_sparse_classes_10k_train_000417
1,797
no_license
[ { "docstring": "前后指针法 :type s: str :rtype: str", "name": "reverseVowels", "signature": "def reverseVowels(self, s)" }, { "docstring": "超时算法! 一个case通不过, O(2n) :type s: str :rtype: str", "name": "reverseVowels_timeout", "signature": "def reverseVowels_timeout(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_006802
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseVowels(self, s): 前后指针法 :type s: str :rtype: str - def reverseVowels_timeout(self, s): 超时算法! 一个case通不过, O(2n) :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseVowels(self, s): 前后指针法 :type s: str :rtype: str - def reverseVowels_timeout(self, s): 超时算法! 一个case通不过, O(2n) :type s: str :rtype: str <|skeleton|> class Solution: ...
e4d21223c85b622b5a905d1a056dfb2f300964b1
<|skeleton|> class Solution: def reverseVowels(self, s): """前后指针法 :type s: str :rtype: str""" <|body_0|> def reverseVowels_timeout(self, s): """超时算法! 一个case通不过, O(2n) :type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverseVowels(self, s): """前后指针法 :type s: str :rtype: str""" vowel = 'AEIOUaeiou' s = list(s) i, j = (0, len(s) - 1) while i < j: while s[i] not in vowel and i < j: i += 1 while s[j] not in vowel and i < j: ...
the_stack_v2_python_sparse
Algorithms/345.Reverse_Vowels_of_a_String/reverse_vowels_of_a_string.py
gosyang/leetcode
train
1
c4c280497a3fbe85c495333b651fa757d0cf8658
[ "def to_tree(i, j):\n if j < i:\n return None\n m = i + (j - i) // 2\n return TreeNode(nums[m], left=to_tree(i, m - 1), right=to_tree(m + 1, j))\nreturn to_tree(0, len(nums) - 1)", "def build(i, j):\n if j < i:\n return None\n m = i + (j - i) // 2\n root = TreeNode(nums[m])\n ro...
<|body_start_0|> def to_tree(i, j): if j < i: return None m = i + (j - i) // 2 return TreeNode(nums[m], left=to_tree(i, m - 1), right=to_tree(m + 1, j)) return to_tree(0, len(nums) - 1) <|end_body_0|> <|body_start_1|> def build(i, j): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: """08/19/2021 12:17""" <|body_0|> def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: """08/21/2022 15:11""" <|body_1|> <|end_skeleton|> <|body_start_0|> def...
stack_v2_sparse_classes_10k_train_000418
2,331
no_license
[ { "docstring": "08/19/2021 12:17", "name": "sortedArrayToBST", "signature": "def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]" }, { "docstring": "08/21/2022 15:11", "name": "sortedArrayToBST", "signature": "def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: 08/19/2021 12:17 - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: 08/21/2022 15:11
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: 08/19/2021 12:17 - def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: 08/21/2022 15:11 <|skele...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: """08/19/2021 12:17""" <|body_0|> def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: """08/21/2022 15:11""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def sortedArrayToBST(self, nums: List[int]) -> Optional[TreeNode]: """08/19/2021 12:17""" def to_tree(i, j): if j < i: return None m = i + (j - i) // 2 return TreeNode(nums[m], left=to_tree(i, m - 1), right=to_tree(m + 1, j)) ...
the_stack_v2_python_sparse
leetcode/solved/108_Convert_Sorted_Array_to_Binary_Search_Tree/solution.py
sungminoh/algorithms
train
0
5395b86cb4f2e05b9b10d4e6b31f2bfac0a2df68
[ "parser.add_argument('--network', metavar='NETWORK', required=True, help='The network in the current project to be peered with the service')\nparser.add_argument('--service', metavar='SERVICE', default='servicenetworking.googleapis.com', help='The service to connect to')\nparser.add_argument('--ranges', metavar='RA...
<|body_start_0|> parser.add_argument('--network', metavar='NETWORK', required=True, help='The network in the current project to be peered with the service') parser.add_argument('--service', metavar='SERVICE', default='servicenetworking.googleapis.com', help='The service to connect to') parser.ad...
Update a private service connection to a service for a project network.
Update
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Update: """Update a private service connection to a service for a project network.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this comman...
stack_v2_sparse_classes_10k_train_000419
4,097
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
null
Implement the Python class `Update` described below. Class description: Update a private service connection to a service for a project network. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to ad...
Implement the Python class `Update` described below. Class description: Update a private service connection to a service for a project network. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to ad...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class Update: """Update a private service connection to a service for a project network.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this comman...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Update: """Update a private service connection to a service for a project network.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/services/vpc_peerings/update.py
bopopescu/socialliteapp
train
0
3093455e886f371492c9bb274c3b6e0f534eb14b
[ "prefix_sum_count = {}\nprefix_sum_count[0] = 1\nreturn self.helper(root, prefix_sum_count, sum, 0)", "if not node:\n return 0\nres = 0\ncur_sum += node.val\nres += prefix_sum_count.get(cur_sum - target, 0)\nprefix_sum_count[cur_sum] = prefix_sum_count.get(cur_sum, 0) + 1\nres += self.helper(node.left, prefix_...
<|body_start_0|> prefix_sum_count = {} prefix_sum_count[0] = 1 return self.helper(root, prefix_sum_count, sum, 0) <|end_body_0|> <|body_start_1|> if not node: return 0 res = 0 cur_sum += node.val res += prefix_sum_count.get(cur_sum - target, 0) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root, sum): """Args: root: TreeNode sum: int Return: int""" <|body_0|> def helper(self, node, prefix_sum_count, target, cur_sum): """Args: node: TreeNode prefix_sum_count: dict{int: int} target: int cur_sum: int Return: int""" <|bo...
stack_v2_sparse_classes_10k_train_000420
1,878
no_license
[ { "docstring": "Args: root: TreeNode sum: int Return: int", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": "Args: node: TreeNode prefix_sum_count: dict{int: int} target: int cur_sum: int Return: int", "name": "helper", "signature": "def helper(self, node...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): Args: root: TreeNode sum: int Return: int - def helper(self, node, prefix_sum_count, target, cur_sum): Args: node: TreeNode prefix_sum_count: dict{i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): Args: root: TreeNode sum: int Return: int - def helper(self, node, prefix_sum_count, target, cur_sum): Args: node: TreeNode prefix_sum_count: dict{i...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def pathSum(self, root, sum): """Args: root: TreeNode sum: int Return: int""" <|body_0|> def helper(self, node, prefix_sum_count, target, cur_sum): """Args: node: TreeNode prefix_sum_count: dict{int: int} target: int cur_sum: int Return: int""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def pathSum(self, root, sum): """Args: root: TreeNode sum: int Return: int""" prefix_sum_count = {} prefix_sum_count[0] = 1 return self.helper(root, prefix_sum_count, sum, 0) def helper(self, node, prefix_sum_count, target, cur_sum): """Args: node: TreeNo...
the_stack_v2_python_sparse
code/437. 路径总和 III.py
AiZhanghan/Leetcode
train
0
f5d152942a426e5154f715a2c4f16e0228ac1ef9
[ "key_file = tempfile.NamedTemporaryFile()\nkey_file.write(test_crypto.TEST_PRIVATE_KEY_PEM)\nkey_file.flush()\ncrypto = util.read_private_key(key_file.name)\nself.assertEqual(test_crypto.TEST_PRIVATE_KEY_X, crypto.x)\nkey_file.close()", "key_file = tempfile.NamedTemporaryFile()\nkey_file.write(TEST_SECT163K1_PRIV...
<|body_start_0|> key_file = tempfile.NamedTemporaryFile() key_file.write(test_crypto.TEST_PRIVATE_KEY_PEM) key_file.flush() crypto = util.read_private_key(key_file.name) self.assertEqual(test_crypto.TEST_PRIVATE_KEY_X, crypto.x) key_file.close() <|end_body_0|> <|body_sta...
TestReadPrivateKey
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestReadPrivateKey: def test_read_private_key(self): """Test reading the signing key from a file.""" <|body_0|> def test_read_private_key_invalid_curve(self): """Test that we require NIST384p for the signing key.""" <|body_1|> def test_read_private_key_i...
stack_v2_sparse_classes_10k_train_000421
6,083
permissive
[ { "docstring": "Test reading the signing key from a file.", "name": "test_read_private_key", "signature": "def test_read_private_key(self)" }, { "docstring": "Test that we require NIST384p for the signing key.", "name": "test_read_private_key_invalid_curve", "signature": "def test_read_p...
3
stack_v2_sparse_classes_30k_train_005541
Implement the Python class `TestReadPrivateKey` described below. Class description: Implement the TestReadPrivateKey class. Method signatures and docstrings: - def test_read_private_key(self): Test reading the signing key from a file. - def test_read_private_key_invalid_curve(self): Test that we require NIST384p for ...
Implement the Python class `TestReadPrivateKey` described below. Class description: Implement the TestReadPrivateKey class. Method signatures and docstrings: - def test_read_private_key(self): Test reading the signing key from a file. - def test_read_private_key_invalid_curve(self): Test that we require NIST384p for ...
936355508212b55ba9d34aeec41a0aadb96ac645
<|skeleton|> class TestReadPrivateKey: def test_read_private_key(self): """Test reading the signing key from a file.""" <|body_0|> def test_read_private_key_invalid_curve(self): """Test that we require NIST384p for the signing key.""" <|body_1|> def test_read_private_key_i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestReadPrivateKey: def test_read_private_key(self): """Test reading the signing key from a file.""" key_file = tempfile.NamedTemporaryFile() key_file.write(test_crypto.TEST_PRIVATE_KEY_PEM) key_file.flush() crypto = util.read_private_key(key_file.name) self.ass...
the_stack_v2_python_sparse
brkt_cli/test_util.py
ramyabrkt/brkt-cli
train
0
c0fe732d4db0ead1857c99d89e678602c7a718ea
[ "self.subject_name = 'client'\nSubject.__init__(self, profile, self.subject_name)\nself.api_base_url = self.profile.platform_url + '/api/v1/client'", "url = self.api_base_url\nparams = {'size': page_size, 'page': page_number}\ntry:\n raw_response = self.request_handler.make_request(ApiRequestHandler.GET, url, ...
<|body_start_0|> self.subject_name = 'client' Subject.__init__(self, profile, self.subject_name) self.api_base_url = self.profile.platform_url + '/api/v1/client' <|end_body_0|> <|body_start_1|> url = self.api_base_url params = {'size': page_size, 'page': page_number} try...
Clients class
Clients
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Clients: """Clients class""" def __init__(self, profile): """Initialization of Clients object. :param profile: Profile Object :type profile: _profile""" <|body_0|> def get_clients(self, page_size=500, page_number=0): """Gets all clients associated with the API ke...
stack_v2_sparse_classes_10k_train_000422
3,806
permissive
[ { "docstring": "Initialization of Clients object. :param profile: Profile Object :type profile: _profile", "name": "__init__", "signature": "def __init__(self, profile)" }, { "docstring": "Gets all clients associated with the API key. :param page_size: Number of results to be returned on each pa...
4
stack_v2_sparse_classes_30k_train_003606
Implement the Python class `Clients` described below. Class description: Clients class Method signatures and docstrings: - def __init__(self, profile): Initialization of Clients object. :param profile: Profile Object :type profile: _profile - def get_clients(self, page_size=500, page_number=0): Gets all clients assoc...
Implement the Python class `Clients` described below. Class description: Clients class Method signatures and docstrings: - def __init__(self, profile): Initialization of Clients object. :param profile: Profile Object :type profile: _profile - def get_clients(self, page_size=500, page_number=0): Gets all clients assoc...
1564cd93505a4d4ccd546f68310e0a09f888e590
<|skeleton|> class Clients: """Clients class""" def __init__(self, profile): """Initialization of Clients object. :param profile: Profile Object :type profile: _profile""" <|body_0|> def get_clients(self, page_size=500, page_number=0): """Gets all clients associated with the API ke...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Clients: """Clients class""" def __init__(self, profile): """Initialization of Clients object. :param profile: Profile Object :type profile: _profile""" self.subject_name = 'client' Subject.__init__(self, profile, self.subject_name) self.api_base_url = self.profile.platfor...
the_stack_v2_python_sparse
lib/risksense_api/__subject/__clients/__clients.py
mtornga/risksense_tools
train
0
90315a0baf1c422e9797f94c4e0ed8ffed50c51d
[ "if not intervals:\n return []\nintervals.sort(key=lambda x: x.start)\noutput = []\ncurrent_interval = Interval(intervals[0].start, intervals[0].end)\nfor interval in intervals[1:]:\n if interval.start > current_interval.end:\n output.append(current_interval)\n current_interval = Interval(interv...
<|body_start_0|> if not intervals: return [] intervals.sort(key=lambda x: x.start) output = [] current_interval = Interval(intervals[0].start, intervals[0].end) for interval in intervals[1:]: if interval.start > current_interval.end: output...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_0|> def merge_verbose(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000423
2,933
no_license
[ { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge", "signature": "def merge(self, intervals)" }, { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge_verbose", "signature": "def merge_verbose(self, intervals)" } ]
2
stack_v2_sparse_classes_30k_train_004178
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] - def merge_verbose(self, intervals): :type intervals: List[Interval] :rtype: List[Interval]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] - def merge_verbose(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] <...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_0|> def merge_verbose(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" if not intervals: return [] intervals.sort(key=lambda x: x.start) output = [] current_interval = Interval(intervals[0].start, intervals[0].end) for int...
the_stack_v2_python_sparse
src/lt_56.py
oxhead/CodingYourWay
train
0
6f58f47950723cbe3c286397077abbc51661877d
[ "func = self._module.learning_curve\ndata = self._data\ntarget = self._target\ntr_size, tr_score, te_score = func(estimator, *args, X=data.values, y=target.values, **kwargs)\nreturn (tr_size, tr_score, te_score)", "func = self._module.validation_curve\ndata = self._data\ntarget = self._target\ntr_score, te_score ...
<|body_start_0|> func = self._module.learning_curve data = self._data target = self._target tr_size, tr_score, te_score = func(estimator, *args, X=data.values, y=target.values, **kwargs) return (tr_size, tr_score, te_score) <|end_body_0|> <|body_start_1|> func = self._mo...
Deprecated. Accessor to ``sklearn.learning_curve``.
LearningCurveMethods
[ "Python-2.0", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LearningCurveMethods: """Deprecated. Accessor to ``sklearn.learning_curve``.""" def learning_curve(self, estimator, *args, **kwargs): """Call ``sklearn.lerning_curve.learning_curve`` using automatic mapping. - ``X``: ``ModelFrame.data`` - ``y``: ``ModelFrame.target``""" <|bod...
stack_v2_sparse_classes_10k_train_000424
1,422
permissive
[ { "docstring": "Call ``sklearn.lerning_curve.learning_curve`` using automatic mapping. - ``X``: ``ModelFrame.data`` - ``y``: ``ModelFrame.target``", "name": "learning_curve", "signature": "def learning_curve(self, estimator, *args, **kwargs)" }, { "docstring": "Call ``sklearn.learning_curve.vali...
2
null
Implement the Python class `LearningCurveMethods` described below. Class description: Deprecated. Accessor to ``sklearn.learning_curve``. Method signatures and docstrings: - def learning_curve(self, estimator, *args, **kwargs): Call ``sklearn.lerning_curve.learning_curve`` using automatic mapping. - ``X``: ``ModelFra...
Implement the Python class `LearningCurveMethods` described below. Class description: Deprecated. Accessor to ``sklearn.learning_curve``. Method signatures and docstrings: - def learning_curve(self, estimator, *args, **kwargs): Call ``sklearn.lerning_curve.learning_curve`` using automatic mapping. - ``X``: ``ModelFra...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class LearningCurveMethods: """Deprecated. Accessor to ``sklearn.learning_curve``.""" def learning_curve(self, estimator, *args, **kwargs): """Call ``sklearn.lerning_curve.learning_curve`` using automatic mapping. - ``X``: ``ModelFrame.data`` - ``y``: ``ModelFrame.target``""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LearningCurveMethods: """Deprecated. Accessor to ``sklearn.learning_curve``.""" def learning_curve(self, estimator, *args, **kwargs): """Call ``sklearn.lerning_curve.learning_curve`` using automatic mapping. - ``X``: ``ModelFrame.data`` - ``y``: ``ModelFrame.target``""" func = self._modul...
the_stack_v2_python_sparse
lib/python2.7/site-packages/pandas_ml/skaccessors/learning_curve.py
wangyum/Anaconda
train
11
396eaeace6c7022357e6e014ffe3947b8fc36954
[ "type_id = self.data.resource_type_id or -1\nquery = Query(ResourceType.collection, service_id=self._client.service_id)\nquery.add_term(field=ResourceType.id_field, value=type_id)\nreturn InstanceProxy(ResourceType, query, client=self._client)", "query = Query(AbilityType.collection, service_id=self._client.servi...
<|body_start_0|> type_id = self.data.resource_type_id or -1 query = Query(ResourceType.collection, service_id=self._client.service_id) query.add_term(field=ResourceType.id_field, value=type_id) return InstanceProxy(ResourceType, query, client=self._client) <|end_body_0|> <|body_start_1|...
An ability triggered by a character or vehicle. See the corresponding :class:`~auraxium.ps2.AbilityType` instance via the :meth:`Ability.type` method for information on generic parameters. .. note:: The in-game mechanics these abilities correspond to is currently undocumented due to the lack of links between abilities ...
Ability
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ability: """An ability triggered by a character or vehicle. See the corresponding :class:`~auraxium.ps2.AbilityType` instance via the :meth:`Ability.type` method for information on generic parameters. .. note:: The in-game mechanics these abilities correspond to is currently undocumented due to t...
stack_v2_sparse_classes_10k_train_000425
9,409
permissive
[ { "docstring": "Return the resource type used by this ability, if any. This returns an :class:`auraxium.InstanceProxy`.", "name": "resource_type", "signature": "def resource_type(self) -> InstanceProxy[ResourceType]" }, { "docstring": "Return the ability type of this ability. This returns an :cl...
2
stack_v2_sparse_classes_30k_train_004912
Implement the Python class `Ability` described below. Class description: An ability triggered by a character or vehicle. See the corresponding :class:`~auraxium.ps2.AbilityType` instance via the :meth:`Ability.type` method for information on generic parameters. .. note:: The in-game mechanics these abilities correspon...
Implement the Python class `Ability` described below. Class description: An ability triggered by a character or vehicle. See the corresponding :class:`~auraxium.ps2.AbilityType` instance via the :meth:`Ability.type` method for information on generic parameters. .. note:: The in-game mechanics these abilities correspon...
23dcf927a199c8d7c917d89fe96b470a34cf4bba
<|skeleton|> class Ability: """An ability triggered by a character or vehicle. See the corresponding :class:`~auraxium.ps2.AbilityType` instance via the :meth:`Ability.type` method for information on generic parameters. .. note:: The in-game mechanics these abilities correspond to is currently undocumented due to t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ability: """An ability triggered by a character or vehicle. See the corresponding :class:`~auraxium.ps2.AbilityType` instance via the :meth:`Ability.type` method for information on generic parameters. .. note:: The in-game mechanics these abilities correspond to is currently undocumented due to the lack of li...
the_stack_v2_python_sparse
auraxium/ps2/_ability.py
leonhard-s/auraxium
train
29
45a2b73b5b66b0059ee6dcbfeac393737c946a39
[ "super().__init__(pos_enc_class)\nself.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU())\nself.linear = Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim)\nself.subsampling_rate = 8\nself.right_context = 14", "x = x.unsqueeze...
<|body_start_0|> super().__init__(pos_enc_class) self.conv = nn.Sequential(Conv2D(1, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU(), Conv2D(odim, odim, 3, 2), nn.ReLU()) self.linear = Linear(odim * ((((idim - 1) // 2 - 1) // 2 - 1) // 2), odim) self.subsampling_rate = 8 ...
Convolutional 2D subsampling (to 1/8 length).
Conv2dSubsampling8
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2dSubsampling8: """Convolutional 2D subsampling (to 1/8 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimensio...
stack_v2_sparse_classes_10k_train_000426
11,942
permissive
[ { "docstring": "Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate.", "name": "__init__", "signature": "def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding)" },...
2
stack_v2_sparse_classes_30k_train_006607
Implement the Python class `Conv2dSubsampling8` described below. Class description: Convolutional 2D subsampling (to 1/8 length). Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling8 object. Args:...
Implement the Python class `Conv2dSubsampling8` described below. Class description: Convolutional 2D subsampling (to 1/8 length). Method signatures and docstrings: - def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): Construct an Conv2dSubsampling8 object. Args:...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class Conv2dSubsampling8: """Convolutional 2D subsampling (to 1/8 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimensio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Conv2dSubsampling8: """Convolutional 2D subsampling (to 1/8 length).""" def __init__(self, idim: int, odim: int, dropout_rate: float, pos_enc_class: nn.Layer=PositionalEncoding): """Construct an Conv2dSubsampling8 object. Args: idim (int): Input dimension. odim (int): Output dimension. dropout_ra...
the_stack_v2_python_sparse
paddlespeech/s2t/modules/subsampling.py
anniyanvr/DeepSpeech-1
train
0
4ee36d78578dbfcc28fdb6601e088ea0fefc4fc7
[ "super(ActorModel, self).__init__()\nself.params = params\nself.fc1 = nn.Linear(self.params['state_size'], self.params['hidden_size'])\nself.fc1.weight.data = fanin_init(self.fc1.weight.data)\nself.fc2 = nn.Linear(self.params['hidden_size'], self.params['hidden_size'])\nself.fc2.weight.data = fanin_init(self.fc2.we...
<|body_start_0|> super(ActorModel, self).__init__() self.params = params self.fc1 = nn.Linear(self.params['state_size'], self.params['hidden_size']) self.fc1.weight.data = fanin_init(self.fc1.weight.data) self.fc2 = nn.Linear(self.params['hidden_size'], self.params['hidden_size']...
ActorModel
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActorModel: def __init__(self, **params): """Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-a...
stack_v2_sparse_classes_10k_train_000427
7,544
permissive
[ { "docstring": "Provides the policy function :math:`a=\\\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-action_gain,+action_gain]``. eps: A constant used in...
2
stack_v2_sparse_classes_30k_train_002635
Implement the Python class `ActorModel` described below. Class description: Implement the ActorModel class. Method signatures and docstrings: - def __init__(self, **params): Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (...
Implement the Python class `ActorModel` described below. Class description: Implement the ActorModel class. Method signatures and docstrings: - def __init__(self, **params): Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (...
e42f10a58cec6cab70ac2be5ce3af6102caefd81
<|skeleton|> class ActorModel: def __init__(self, **params): """Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ActorModel: def __init__(self, **params): """Provides the policy function :math:`a=\\pi(s)`. Args: state_size (int): Dimension of input state action_size (int): Dimension of output action (int) action_gain (float): Used to scale the output action. The output action range will be in ``[-action_gain,+ac...
the_stack_v2_python_sparse
digideep/agent/ddpg/policy.py
sharif1093/digideep
train
17
5b27f794883ed18b0c95360e6ea778cb50d750a2
[ "postorder = []\n\ndef traverse(root):\n if root is None:\n postorder.append('#')\n return\n traverse(root.left)\n traverse(root.right)\n postorder.append(root.val)\ntraverse(root)\nreturn ','.join([str(val) for val in postorder])", "if data == '':\n return None\npostorder = data.spli...
<|body_start_0|> postorder = [] def traverse(root): if root is None: postorder.append('#') return traverse(root.left) traverse(root.right) postorder.append(root.val) traverse(root) return ','.join([str(val) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000428
6,926
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0821af55eca60084b503b5f751301048c55e4381
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" postorder = [] def traverse(root): if root is None: postorder.append('#') return traverse(root.left) traverse...
the_stack_v2_python_sparse
Hard/LC297.py
shuowenwei/LeetCodePython
train
2
34b54ca5614d3efaafe4dcd8703581cfa3a061bb
[ "super(Chef, self).__init__(image=Chef.chef_image, x=games.screen.width / 2, y=y, dx=speed)\nself.odds_change = odds_change\nself.time_til_drop = 0", "if self.right > games.screen.width or self.left < 0:\n self.dx = -self.dx\nif self.bottom > games.screen.height or self.top < 0:\n self.dy = -self.dy\nself.c...
<|body_start_0|> super(Chef, self).__init__(image=Chef.chef_image, x=games.screen.width / 2, y=y, dx=speed) self.odds_change = odds_change self.time_til_drop = 0 <|end_body_0|> <|body_start_1|> if self.right > games.screen.width or self.left < 0: self.dx = -self.dx i...
The chef that throws pizza
Chef
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chef: """The chef that throws pizza""" def __init__(self, y=115, speed=2, odds_change=200): """Initialize Chef""" <|body_0|> def update(self): """Changes speed vectors when Chef comes to the screen edge""" <|body_1|> def check_drop(self): """...
stack_v2_sparse_classes_10k_train_000429
4,179
no_license
[ { "docstring": "Initialize Chef", "name": "__init__", "signature": "def __init__(self, y=115, speed=2, odds_change=200)" }, { "docstring": "Changes speed vectors when Chef comes to the screen edge", "name": "update", "signature": "def update(self)" }, { "docstring": "Decrease int...
3
null
Implement the Python class `Chef` described below. Class description: The chef that throws pizza Method signatures and docstrings: - def __init__(self, y=115, speed=2, odds_change=200): Initialize Chef - def update(self): Changes speed vectors when Chef comes to the screen edge - def check_drop(self): Decrease interv...
Implement the Python class `Chef` described below. Class description: The chef that throws pizza Method signatures and docstrings: - def __init__(self, y=115, speed=2, odds_change=200): Initialize Chef - def update(self): Changes speed vectors when Chef comes to the screen edge - def check_drop(self): Decrease interv...
19343c985f368770dc01ce415506506d62a23285
<|skeleton|> class Chef: """The chef that throws pizza""" def __init__(self, y=115, speed=2, odds_change=200): """Initialize Chef""" <|body_0|> def update(self): """Changes speed vectors when Chef comes to the screen edge""" <|body_1|> def check_drop(self): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Chef: """The chef that throws pizza""" def __init__(self, y=115, speed=2, odds_change=200): """Initialize Chef""" super(Chef, self).__init__(image=Chef.chef_image, x=games.screen.width / 2, y=y, dx=speed) self.odds_change = odds_change self.time_til_drop = 0 def updat...
the_stack_v2_python_sparse
graphics/pizza_panic.py
gofr1/python-learning
train
0
1d3376b4a156f6ff922dfcfd3e6dfbee4a25fec7
[ "for x in range(len(factors)):\n if factors[x] > 1:\n tree = StencilCacheBlocker.StripMineLoopByIndex(x * 2, factors[x]).visit(tree)\nfor x in range(1, len(factors)):\n if factors[x] > 1:\n tree = self.bubble(tree, 2 * x, x)\nreturn tree", "for x in range(index - new_index):\n tree = LoopSw...
<|body_start_0|> for x in range(len(factors)): if factors[x] > 1: tree = StencilCacheBlocker.StripMineLoopByIndex(x * 2, factors[x]).visit(tree) for x in range(1, len(factors)): if factors[x] > 1: tree = self.bubble(tree, 2 * x, x) return t...
Class that takes a tree of perfectly-nested For loops (as in a stencil) and performs standard cache blocking on them. Usage: StencilCacheBlocker().block(tree, factors) where factors is a tuple, one for each loop nest in the original tree.
StencilCacheBlocker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StencilCacheBlocker: """Class that takes a tree of perfectly-nested For loops (as in a stencil) and performs standard cache blocking on them. Usage: StencilCacheBlocker().block(tree, factors) where factors is a tuple, one for each loop nest in the original tree.""" def block(self, tree, fact...
stack_v2_sparse_classes_10k_train_000430
8,373
no_license
[ { "docstring": "Main method in StencilCacheBlocker. Used to block the loops in the tree.", "name": "block", "signature": "def block(self, tree, factors)" }, { "docstring": "Helper function to 'bubble up' a loop at index to be at new_index (new_index < index) while preserving the ordering of the ...
2
stack_v2_sparse_classes_30k_train_005498
Implement the Python class `StencilCacheBlocker` described below. Class description: Class that takes a tree of perfectly-nested For loops (as in a stencil) and performs standard cache blocking on them. Usage: StencilCacheBlocker().block(tree, factors) where factors is a tuple, one for each loop nest in the original t...
Implement the Python class `StencilCacheBlocker` described below. Class description: Class that takes a tree of perfectly-nested For loops (as in a stencil) and performs standard cache blocking on them. Usage: StencilCacheBlocker().block(tree, factors) where factors is a tuple, one for each loop nest in the original t...
87f5d5115587f3362c8ea097900d3d50a3485b1a
<|skeleton|> class StencilCacheBlocker: """Class that takes a tree of perfectly-nested For loops (as in a stencil) and performs standard cache blocking on them. Usage: StencilCacheBlocker().block(tree, factors) where factors is a tuple, one for each loop nest in the original tree.""" def block(self, tree, fact...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StencilCacheBlocker: """Class that takes a tree of perfectly-nested For loops (as in a stencil) and performs standard cache blocking on them. Usage: StencilCacheBlocker().block(tree, factors) where factors is a tuple, one for each loop nest in the original tree.""" def block(self, tree, factors): ...
the_stack_v2_python_sparse
stencil_code/optimizer.py
ucb-sejits/stencil_code
train
3
b7117c6d58b6c2e48f6abe080cd7e4d15144f522
[ "starttime = request.query_params.get('value1')\nendtime = request.query_params.get('value2')\nprint(starttime, endtime)\nif starttime == '0':\n myBugResult = Bugs.objects.filter(delete_flag=0).order_by('team')\n serializer = Bugsserializer(myBugResult, many=True)\n return Response({'status': True, 'messag...
<|body_start_0|> starttime = request.query_params.get('value1') endtime = request.query_params.get('value2') print(starttime, endtime) if starttime == '0': myBugResult = Bugs.objects.filter(delete_flag=0).order_by('team') serializer = Bugsserializer(myBugResult, m...
bug汇总
Bug
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bug: """bug汇总""" def get(self, request): """获取bug列表""" <|body_0|> def post(self, request): """新增bug""" <|body_1|> def put(self, request): """修改bug""" <|body_2|> def delete(self, request): """删除bug""" <|body_3|> <...
stack_v2_sparse_classes_10k_train_000431
3,316
no_license
[ { "docstring": "获取bug列表", "name": "get", "signature": "def get(self, request)" }, { "docstring": "新增bug", "name": "post", "signature": "def post(self, request)" }, { "docstring": "修改bug", "name": "put", "signature": "def put(self, request)" }, { "docstring": "删除bu...
4
stack_v2_sparse_classes_30k_train_006574
Implement the Python class `Bug` described below. Class description: bug汇总 Method signatures and docstrings: - def get(self, request): 获取bug列表 - def post(self, request): 新增bug - def put(self, request): 修改bug - def delete(self, request): 删除bug
Implement the Python class `Bug` described below. Class description: bug汇总 Method signatures and docstrings: - def get(self, request): 获取bug列表 - def post(self, request): 新增bug - def put(self, request): 修改bug - def delete(self, request): 删除bug <|skeleton|> class Bug: """bug汇总""" def get(self, request): ...
9ccebcc6820af3f950c28fc2a4dee4f41a3157f1
<|skeleton|> class Bug: """bug汇总""" def get(self, request): """获取bug列表""" <|body_0|> def post(self, request): """新增bug""" <|body_1|> def put(self, request): """修改bug""" <|body_2|> def delete(self, request): """删除bug""" <|body_3|> <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Bug: """bug汇总""" def get(self, request): """获取bug列表""" starttime = request.query_params.get('value1') endtime = request.query_params.get('value2') print(starttime, endtime) if starttime == '0': myBugResult = Bugs.objects.filter(delete_flag=0).order_by('...
the_stack_v2_python_sparse
moon/task/views_bug.py
xiaominwanglast/python
train
0
42cd333e1a576c41e07004f92f345bc1aa7a8fa4
[ "super(AwsDiskSpec, cls)._ApplyFlags(config_values, flag_values)\nif flag_values['aws_provisioned_iops'].present:\n config_values['iops'] = flag_values.aws_provisioned_iops\nif flag_values['aws_provisioned_throughput'].present:\n config_values['throughput'] = flag_values.aws_provisioned_throughput", "result...
<|body_start_0|> super(AwsDiskSpec, cls)._ApplyFlags(config_values, flag_values) if flag_values['aws_provisioned_iops'].present: config_values['iops'] = flag_values.aws_provisioned_iops if flag_values['aws_provisioned_throughput'].present: config_values['throughput'] = fl...
Object holding the information needed to create an AwsDisk. Attributes: iops: None or int. IOPS for Provisioned IOPS (SSD) volumes in AWS. throughput: None or int. Throughput for (SSD) volumes in AWS.
AwsDiskSpec
[ "Classpath-exception-2.0", "BSD-3-Clause", "AGPL-3.0-only", "MIT", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AwsDiskSpec: """Object holding the information needed to create an AwsDisk. Attributes: iops: None or int. IOPS for Provisioned IOPS (SSD) volumes in AWS. throughput: None or int. Throughput for (SSD) volumes in AWS.""" def _ApplyFlags(cls, config_values, flag_values): """Modifies co...
stack_v2_sparse_classes_10k_train_000432
17,465
permissive
[ { "docstring": "Modifies config options based on runtime flag values. Can be overridden by derived classes to add support for specific flags. Args: config_values: dict mapping config option names to provided values. May be modified by this function. flag_values: flags.FlagValues. Runtime flags that may override...
2
null
Implement the Python class `AwsDiskSpec` described below. Class description: Object holding the information needed to create an AwsDisk. Attributes: iops: None or int. IOPS for Provisioned IOPS (SSD) volumes in AWS. throughput: None or int. Throughput for (SSD) volumes in AWS. Method signatures and docstrings: - def ...
Implement the Python class `AwsDiskSpec` described below. Class description: Object holding the information needed to create an AwsDisk. Attributes: iops: None or int. IOPS for Provisioned IOPS (SSD) volumes in AWS. throughput: None or int. Throughput for (SSD) volumes in AWS. Method signatures and docstrings: - def ...
d0699f32998898757b036704fba39e5471641f01
<|skeleton|> class AwsDiskSpec: """Object holding the information needed to create an AwsDisk. Attributes: iops: None or int. IOPS for Provisioned IOPS (SSD) volumes in AWS. throughput: None or int. Throughput for (SSD) volumes in AWS.""" def _ApplyFlags(cls, config_values, flag_values): """Modifies co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AwsDiskSpec: """Object holding the information needed to create an AwsDisk. Attributes: iops: None or int. IOPS for Provisioned IOPS (SSD) volumes in AWS. throughput: None or int. Throughput for (SSD) volumes in AWS.""" def _ApplyFlags(cls, config_values, flag_values): """Modifies config options ...
the_stack_v2_python_sparse
perfkitbenchmarker/providers/aws/aws_disk.py
GoogleCloudPlatform/PerfKitBenchmarker
train
1,923
73850ece6ea7fea6d0c3c338ed6e0f05a206f5ab
[ "for var, name in [(points, 'points'), (img_metas, 'img_metas')]:\n if not isinstance(var, list):\n raise TypeError('{} must be a list, but got {}'.format(name, type(var)))\nnum_augs = len(points)\nif num_augs != len(img_metas):\n raise ValueError('num of augmentations ({}) != num of image meta ({})'.f...
<|body_start_0|> for var, name in [(points, 'points'), (img_metas, 'img_metas')]: if not isinstance(var, list): raise TypeError('{} must be a list, but got {}'.format(name, type(var))) num_augs = len(points) if num_augs != len(img_metas): raise ValueError(...
Base class for detectors.
Base3DDetector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base3DDetector: """Base class for detectors.""" def forward_test(self, points, img_metas, img=None, **kwargs): """Args: points (list[torch.Tensor]): the outer list indicates test-time augmentations and inner torch.Tensor should have a shape NxC, which contains all points in the batch...
stack_v2_sparse_classes_10k_train_000433
5,565
permissive
[ { "docstring": "Args: points (list[torch.Tensor]): the outer list indicates test-time augmentations and inner torch.Tensor should have a shape NxC, which contains all points in the batch. img_metas (list[list[dict]]): the outer list indicates test-time augs (multiscale, flip, etc.) and the inner list indicates ...
3
stack_v2_sparse_classes_30k_train_004525
Implement the Python class `Base3DDetector` described below. Class description: Base class for detectors. Method signatures and docstrings: - def forward_test(self, points, img_metas, img=None, **kwargs): Args: points (list[torch.Tensor]): the outer list indicates test-time augmentations and inner torch.Tensor should...
Implement the Python class `Base3DDetector` described below. Class description: Base class for detectors. Method signatures and docstrings: - def forward_test(self, points, img_metas, img=None, **kwargs): Args: points (list[torch.Tensor]): the outer list indicates test-time augmentations and inner torch.Tensor should...
f71858d02eb0fbd09860150ade67558d7984b1be
<|skeleton|> class Base3DDetector: """Base class for detectors.""" def forward_test(self, points, img_metas, img=None, **kwargs): """Args: points (list[torch.Tensor]): the outer list indicates test-time augmentations and inner torch.Tensor should have a shape NxC, which contains all points in the batch...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Base3DDetector: """Base class for detectors.""" def forward_test(self, points, img_metas, img=None, **kwargs): """Args: points (list[torch.Tensor]): the outer list indicates test-time augmentations and inner torch.Tensor should have a shape NxC, which contains all points in the batch. img_metas (...
the_stack_v2_python_sparse
mmdet3d/models/detectors/base.py
HuangJunJie2017/BEVDet
train
985
a5eef6f68ed1112a9350ac19109fec232028a099
[ "pos = 0\nfor i in range(len(nums)):\n if nums[i] != 0:\n nums[i], nums[pos] = (nums[pos], nums[i])\n pos += 1", "def sorting(n):\n return (0,) if n != 0 else (1, 0)\nnums.sort(key=sorting)", "count = 0\nfor i in range(len(nums) - 1):\n i = i - count\n if nums[i] == 0:\n count +...
<|body_start_0|> pos = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[pos] = (nums[pos], nums[i]) pos += 1 <|end_body_0|> <|body_start_1|> def sorting(n): return (0,) if n != 0 else (1, 0) nums.sort(key=sorting) <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def moveZeroes3(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. time complexity : O(NlogN) space ...
stack_v2_sparse_classes_10k_train_000434
1,082
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "moveZeroes3", "signature": "def moveZeroes3(self, nums: List[int]) -> None" }, { "docstring": "Do not return anything, modify nums in-place instead. time complexity : O(NlogN) space complexity : O(1)", "name": "...
3
stack_v2_sparse_classes_30k_train_002180
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes3(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, mo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def moveZeroes3(self, nums: List[int]) -> None: Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums: List[int]) -> None: Do not return anything, mo...
29cb49a166a1dfd19c39613a0e9895c545a6bfe9
<|skeleton|> class Solution: def moveZeroes3(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead. time complexity : O(NlogN) space ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def moveZeroes3(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" pos = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[pos] = (nums[pos], nums[i]) pos += 1 def moveZeroes2(...
the_stack_v2_python_sparse
01.Array&String/2-09.moveZeroes.py
mjmingd/study_algorithm
train
0
55b9e0147b69520e91074e5af18e3b79796987b5
[ "if bubble['is_user']:\n t = 'user'\nelif bubble['is_system']:\n t = 'system'\nelif bubble['is_info']:\n t = 'info'\nelse:\n t = 'status'\nreturn t", "self.type = self._demultiplex_bubbletype(bubble)\nself.html = bubble['message']\nself.url = bubble['bubble_url'] if bubble['bubble_url'] != '' else Non...
<|body_start_0|> if bubble['is_user']: t = 'user' elif bubble['is_system']: t = 'system' elif bubble['is_info']: t = 'info' else: t = 'status' return t <|end_body_0|> <|body_start_1|> self.type = self._demultiplex_bubbletyp...
Converted bubble which is returned by the API.
DataBubble
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataBubble: """Converted bubble which is returned by the API.""" def _demultiplex_bubbletype(bubble): """Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:""" <|body_0|> def __init__(self, bubble): """...
stack_v2_sparse_classes_10k_train_000435
3,741
permissive
[ { "docstring": "Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:", "name": "_demultiplex_bubbletype", "signature": "def _demultiplex_bubbletype(bubble)" }, { "docstring": "Convert given bubble to reduced bubble holding only the core...
2
stack_v2_sparse_classes_30k_train_000178
Implement the Python class `DataBubble` described below. Class description: Converted bubble which is returned by the API. Method signatures and docstrings: - def _demultiplex_bubbletype(bubble): Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return: - def __i...
Implement the Python class `DataBubble` described below. Class description: Converted bubble which is returned by the API. Method signatures and docstrings: - def _demultiplex_bubbletype(bubble): Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return: - def __i...
7996dbe0c66149c710217839877a1ec4e7eb46ed
<|skeleton|> class DataBubble: """Converted bubble which is returned by the API.""" def _demultiplex_bubbletype(bubble): """Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:""" <|body_0|> def __init__(self, bubble): """...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataBubble: """Converted bubble which is returned by the API.""" def _demultiplex_bubbletype(bubble): """Use a single field to dispatch the type and resolve BubbleTypes-Enum. :param bubble: Constructed bubble :return:""" if bubble['is_user']: t = 'user' elif bubble['is...
the_stack_v2_python_sparse
api/models.py
hhucn/dbas
train
25
073961f1b3c7f559cf9b661cbea2c74a2baa1bf4
[ "try:\n user = getUser(request.session.get('login'))\n ago = request.GET.get('ago')\n page = request.GET.get('page')\n three_month_ago = get_three_month_ago()\n if ago:\n tailwindTake = TailwindTakeOrder.objects.filter(Q(mandatory=user) & Q(create_time__lte=three_month_ago))\n else:\n ...
<|body_start_0|> try: user = getUser(request.session.get('login')) ago = request.GET.get('ago') page = request.GET.get('page') three_month_ago = get_three_month_ago() if ago: tailwindTake = TailwindTakeOrder.objects.filter(Q(mandatory=u...
用户对接受单的一系列操作
UserTailwindTakeOrderView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTailwindTakeOrderView: """用户对接受单的一系列操作""" def get(self, request): """获取用户的所有接收单 :param request: :return:""" <|body_0|> def put(self, request, rid): """用户接单 :param request: :param rid: request id :return:""" <|body_1|> def delete(self, request, ri...
stack_v2_sparse_classes_10k_train_000436
5,314
no_license
[ { "docstring": "获取用户的所有接收单 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "用户接单 :param request: :param rid: request id :return:", "name": "put", "signature": "def put(self, request, rid)" }, { "docstring": "用户撤销接受单 :param request...
3
stack_v2_sparse_classes_30k_train_003807
Implement the Python class `UserTailwindTakeOrderView` described below. Class description: 用户对接受单的一系列操作 Method signatures and docstrings: - def get(self, request): 获取用户的所有接收单 :param request: :return: - def put(self, request, rid): 用户接单 :param request: :param rid: request id :return: - def delete(self, request, rid): ...
Implement the Python class `UserTailwindTakeOrderView` described below. Class description: 用户对接受单的一系列操作 Method signatures and docstrings: - def get(self, request): 获取用户的所有接收单 :param request: :return: - def put(self, request, rid): 用户接单 :param request: :param rid: request id :return: - def delete(self, request, rid): ...
bcfbfb71bac696695ec98ac7796fea8262e5af8a
<|skeleton|> class UserTailwindTakeOrderView: """用户对接受单的一系列操作""" def get(self, request): """获取用户的所有接收单 :param request: :return:""" <|body_0|> def put(self, request, rid): """用户接单 :param request: :param rid: request id :return:""" <|body_1|> def delete(self, request, ri...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserTailwindTakeOrderView: """用户对接受单的一系列操作""" def get(self, request): """获取用户的所有接收单 :param request: :return:""" try: user = getUser(request.session.get('login')) ago = request.GET.get('ago') page = request.GET.get('page') three_month_ago = g...
the_stack_v2_python_sparse
App/Account/views/restFul/userTailwindInfo/userTailwindBaseInfo/userTailwindTakeOrderInfo.py
DICKQI/UTime_BackEnd
train
0
8d925ff65c9e354626b7254abc7ba6086cd9b61f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserSecurityState()", "from .email_role import EmailRole\nfrom .logon_type import LogonType\nfrom .user_account_security_type import UserAccountSecurityType\nfrom .email_role import EmailRole\nfrom .logon_type import LogonType\nfrom .u...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UserSecurityState() <|end_body_0|> <|body_start_1|> from .email_role import EmailRole from .logon_type import LogonType from .user_account_security_type import UserAccountSecurit...
UserSecurityState
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSecurityState: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_10k_train_000437
6,982
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserSecurityState", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_v...
3
null
Implement the Python class `UserSecurityState` described below. Class description: Implement the UserSecurityState class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: Creates a new instance of the appropriate class based on discrim...
Implement the Python class `UserSecurityState` described below. Class description: Implement the UserSecurityState class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: Creates a new instance of the appropriate class based on discrim...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UserSecurityState: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserSecurityState: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserSecurityState: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: User...
the_stack_v2_python_sparse
msgraph/generated/models/user_security_state.py
microsoftgraph/msgraph-sdk-python
train
135
7c1ca75a4f218e02e1c9b99c1c60a43e56d3f8f6
[ "super().__init__(game, mode_label_ui)\nself.mode_label_ui = mode_label_ui\nself.stage_1_ui, self.stage_2_ui = (stage_1_ui, stage_2_ui)", "logger.info(f'{self.mode_name}: {self.stages} stages available.')\nif self.stages > 0:\n self.game.select_mode(self.mode_name)\n stage_1_num, stage_2_num = self.separate...
<|body_start_0|> super().__init__(game, mode_label_ui) self.mode_label_ui = mode_label_ui self.stage_1_ui, self.stage_2_ui = (stage_1_ui, stage_2_ui) <|end_body_0|> <|body_start_1|> logger.info(f'{self.mode_name}: {self.stages} stages available.') if self.stages > 0: ...
Class for working with Epic Quests with two separate stages.
TwoStageEpicQuest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoStageEpicQuest: """Class for working with Epic Quests with two separate stages.""" def __init__(self, game, mode_label_ui, stage_1_ui, stage_2_ui): """Class initialization. :param lib.game.game.Game game: instance of the game. :param ui.UIElement mode_label_ui: mission's game mode...
stack_v2_sparse_classes_10k_train_000438
26,035
permissive
[ { "docstring": "Class initialization. :param lib.game.game.Game game: instance of the game. :param ui.UIElement mode_label_ui: mission's game mode label UI element.", "name": "__init__", "signature": "def __init__(self, game, mode_label_ui, stage_1_ui, stage_2_ui)" }, { "docstring": "Starts two ...
3
stack_v2_sparse_classes_30k_train_002011
Implement the Python class `TwoStageEpicQuest` described below. Class description: Class for working with Epic Quests with two separate stages. Method signatures and docstrings: - def __init__(self, game, mode_label_ui, stage_1_ui, stage_2_ui): Class initialization. :param lib.game.game.Game game: instance of the gam...
Implement the Python class `TwoStageEpicQuest` described below. Class description: Class for working with Epic Quests with two separate stages. Method signatures and docstrings: - def __init__(self, game, mode_label_ui, stage_1_ui, stage_2_ui): Class initialization. :param lib.game.game.Game game: instance of the gam...
fd3f0bd45aea45e2e8ad8e8fc73a8953c96d350a
<|skeleton|> class TwoStageEpicQuest: """Class for working with Epic Quests with two separate stages.""" def __init__(self, game, mode_label_ui, stage_1_ui, stage_2_ui): """Class initialization. :param lib.game.game.Game game: instance of the game. :param ui.UIElement mode_label_ui: mission's game mode...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TwoStageEpicQuest: """Class for working with Epic Quests with two separate stages.""" def __init__(self, game, mode_label_ui, stage_1_ui, stage_2_ui): """Class initialization. :param lib.game.game.Game game: instance of the game. :param ui.UIElement mode_label_ui: mission's game mode label UI ele...
the_stack_v2_python_sparse
lib/game/missions/epic_quest.py
th3f1v3/mff_auto
train
0
0974e74c06389988f8723f724fc5c6cc32423335
[ "caffemodel = config.HEAD_POSE['caffemodel']\ndeploy = config.HEAD_POSE['deploy']\nself.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel)\nself.detector_confidence = 0.7", "height, width = (img.shape[0], img.shape[1])\naspect_ratio = width / height\nif img.shape[1] * img.shape[0] >= 192 * 192:\n img = cv...
<|body_start_0|> caffemodel = config.HEAD_POSE['caffemodel'] deploy = config.HEAD_POSE['deploy'] self.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel) self.detector_confidence = 0.7 <|end_body_0|> <|body_start_1|> height, width = (img.shape[0], img.shape[1]) aspec...
Detection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Detection: def __init__(self): """init the class with caffe model and decide the amount of confidence.""" <|body_0|> def get_bbox(self, img): """get a bbox representing the corners of the image after normalization :param img: image to get its corners. :return: an arr...
stack_v2_sparse_classes_10k_train_000439
1,913
no_license
[ { "docstring": "init the class with caffe model and decide the amount of confidence.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "get a bbox representing the corners of the image after normalization :param img: image to get its corners. :return: an array of corners ...
2
stack_v2_sparse_classes_30k_train_007360
Implement the Python class `Detection` described below. Class description: Implement the Detection class. Method signatures and docstrings: - def __init__(self): init the class with caffe model and decide the amount of confidence. - def get_bbox(self, img): get a bbox representing the corners of the image after norma...
Implement the Python class `Detection` described below. Class description: Implement the Detection class. Method signatures and docstrings: - def __init__(self): init the class with caffe model and decide the amount of confidence. - def get_bbox(self, img): get a bbox representing the corners of the image after norma...
607e459d737ac689d6974bf05f452abf89cbdfe2
<|skeleton|> class Detection: def __init__(self): """init the class with caffe model and decide the amount of confidence.""" <|body_0|> def get_bbox(self, img): """get a bbox representing the corners of the image after normalization :param img: image to get its corners. :return: an arr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Detection: def __init__(self): """init the class with caffe model and decide the amount of confidence.""" caffemodel = config.HEAD_POSE['caffemodel'] deploy = config.HEAD_POSE['deploy'] self.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel) self.detector_confidenc...
the_stack_v2_python_sparse
Measurements/HeadPose/detect.py
alexshachor/TheBackEye
train
0
cc0ab4517fc230ae28637fd8120a94186d5c1bfc
[ "output, stack = ([], [(root, False)])\nwhile stack:\n node, is_visited = stack.pop()\n if not node:\n continue\n if is_visited:\n output.append(node.val)\n else:\n stack.append((node, True))\n stack.append((node.right, False))\n stack.append((node.left, False))\nretur...
<|body_start_0|> output, stack = ([], [(root, False)]) while stack: node, is_visited = stack.pop() if not node: continue if is_visited: output.append(node.val) else: stack.append((node, True)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def postorderTraversal_iterative2(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal_recursive(self, root): ...
stack_v2_sparse_classes_10k_train_000440
3,850
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "postorderTraversal", "signature": "def postorderTraversal(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "postorderTraversal_iterative2", "signature": "def postorderTraversal_iterative2(se...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal_iterative2(self, root): :type root: TreeNode :rtype: List[int] - def postorder...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int] - def postorderTraversal_iterative2(self, root): :type root: TreeNode :rtype: List[int] - def postorder...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def postorderTraversal_iterative2(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> def postorderTraversal_recursive(self, root): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def postorderTraversal(self, root): """:type root: TreeNode :rtype: List[int]""" output, stack = ([], [(root, False)]) while stack: node, is_visited = stack.pop() if not node: continue if is_visited: output.a...
the_stack_v2_python_sparse
src/lt_145.py
oxhead/CodingYourWay
train
0
6c666b20ff63070b0c7fccb33beab8549357a0a0
[ "def recursive(outputlist):\n ll = outputlist[-1]\n new_list = [1]\n for i in range(1, len(ll)):\n new_list.append(ll[i - 1] + ll[i])\n new_list.append(1)\n outputlist.append(new_list)\n return outputlist\nif not numRows:\n return []\nout = [[1]]\nfor j in range(1, numRows):\n out = r...
<|body_start_0|> def recursive(outputlist): ll = outputlist[-1] new_list = [1] for i in range(1, len(ll)): new_list.append(ll[i - 1] + ll[i]) new_list.append(1) outputlist.append(new_list) return outputlist if not nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_0|> def generate_cool(self, numRows): """explanation: Any row can be constructed using the offset sum of the previous row 1 3 3 1 0 + 0 1 3 3 1 = 1 4 6 4 1 :type numRows: i...
stack_v2_sparse_classes_10k_train_000441
1,836
no_license
[ { "docstring": ":type numRows: int :rtype: List[List[int]]", "name": "generate", "signature": "def generate(self, numRows)" }, { "docstring": "explanation: Any row can be constructed using the offset sum of the previous row 1 3 3 1 0 + 0 1 3 3 1 = 1 4 6 4 1 :type numRows: int :rtype: List[List[i...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] - def generate_cool(self, numRows): explanation: Any row can be constructed using the offset sum of the pr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] - def generate_cool(self, numRows): explanation: Any row can be constructed using the offset sum of the pr...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_0|> def generate_cool(self, numRows): """explanation: Any row can be constructed using the offset sum of the previous row 1 3 3 1 0 + 0 1 3 3 1 = 1 4 6 4 1 :type numRows: i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" def recursive(outputlist): ll = outputlist[-1] new_list = [1] for i in range(1, len(ll)): new_list.append(ll[i - 1] + ll[i]) new_list.append(1...
the_stack_v2_python_sparse
LeetCode/Array/118_Pascal's_triangle.py
XyK0907/for_work
train
0
4eb2547610c4c276c18ce6cfe18ca135b47fcbcb
[ "dxf = super(DXFGraphic, self).load_dxf_attribs(processor)\nif processor:\n processor.simple_dxfattribs_loader(dxf, merged_shape_group_codes)\n if processor.r12:\n elevation_to_z_axis(dxf, ('center',))\nreturn dxf", "super().export_entity(tagwriter)\nif tagwriter.dxfversion > DXF12:\n tagwriter.wr...
<|body_start_0|> dxf = super(DXFGraphic, self).load_dxf_attribs(processor) if processor: processor.simple_dxfattribs_loader(dxf, merged_shape_group_codes) if processor.r12: elevation_to_z_axis(dxf, ('center',)) return dxf <|end_body_0|> <|body_start_1|> ...
DXF SHAPE entity
Shape
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Shape: """DXF SHAPE entity""" def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: """Loading interface. (internal API)""" <|body_0|> def export_entity(self, tagwriter: AbstractTagWriter) -> None: """Export entity specific data...
stack_v2_sparse_classes_10k_train_000442
4,684
permissive
[ { "docstring": "Loading interface. (internal API)", "name": "load_dxf_attribs", "signature": "def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace" }, { "docstring": "Export entity specific data as DXF tags.", "name": "export_entity", "signature": "def ...
3
null
Implement the Python class `Shape` described below. Class description: DXF SHAPE entity Method signatures and docstrings: - def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: Loading interface. (internal API) - def export_entity(self, tagwriter: AbstractTagWriter) -> None: Export...
Implement the Python class `Shape` described below. Class description: DXF SHAPE entity Method signatures and docstrings: - def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: Loading interface. (internal API) - def export_entity(self, tagwriter: AbstractTagWriter) -> None: Export...
ba6ab0264dcb6833173042a37b1b5ae878d75113
<|skeleton|> class Shape: """DXF SHAPE entity""" def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: """Loading interface. (internal API)""" <|body_0|> def export_entity(self, tagwriter: AbstractTagWriter) -> None: """Export entity specific data...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Shape: """DXF SHAPE entity""" def load_dxf_attribs(self, processor: Optional[SubclassProcessor]=None) -> DXFNamespace: """Loading interface. (internal API)""" dxf = super(DXFGraphic, self).load_dxf_attribs(processor) if processor: processor.simple_dxfattribs_loader(dxf...
the_stack_v2_python_sparse
src/ezdxf/entities/shape.py
mozman/ezdxf
train
750
55d72c67ad38d7dae4f05c6d1cb7e56ae730e236
[ "t0 = Triangle()\nself.assertIsNot(t0, None)\nself.assertIsInstance(t0, Triangle)", "t1 = Triangle([1, 2, 3])\nself.assertIsNot(t1, None)\nself.assertIsInstance(t1, Triangle)\nt2 = Triangle('xyz')\nself.assertIsNot(t2, None)\nself.assertIsInstance(t2, Triangle)\nt3 = Triangle(['x', 'y', 'z'])\nself.assertIsNot(t3...
<|body_start_0|> t0 = Triangle() self.assertIsNot(t0, None) self.assertIsInstance(t0, Triangle) <|end_body_0|> <|body_start_1|> t1 = Triangle([1, 2, 3]) self.assertIsNot(t1, None) self.assertIsInstance(t1, Triangle) t2 = Triangle('xyz') self.assertIsNot(t...
Test Triangle class call
TestConstructor_Triangle
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" <|body_0|> def test_iterable(self): """Calling Vertex class with iterable key""" <|body_1|> def test_iterable_specific...
stack_v2_sparse_classes_10k_train_000443
6,423
permissive
[ { "docstring": "Calling Triangle class with no key (key = None)", "name": "test_none", "signature": "def test_none(self)" }, { "docstring": "Calling Vertex class with iterable key", "name": "test_iterable", "signature": "def test_iterable(self)" }, { "docstring": "Calling Vertex ...
3
stack_v2_sparse_classes_30k_train_004079
Implement the Python class `TestConstructor_Triangle` described below. Class description: Test Triangle class call Method signatures and docstrings: - def test_none(self): Calling Triangle class with no key (key = None) - def test_iterable(self): Calling Vertex class with iterable key - def test_iterable_specific(sel...
Implement the Python class `TestConstructor_Triangle` described below. Class description: Test Triangle class call Method signatures and docstrings: - def test_none(self): Calling Triangle class with no key (key = None) - def test_iterable(self): Calling Vertex class with iterable key - def test_iterable_specific(sel...
f9b00a39bc16aea4abac60c0dd0aab2acac5adcf
<|skeleton|> class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" <|body_0|> def test_iterable(self): """Calling Vertex class with iterable key""" <|body_1|> def test_iterable_specific...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" t0 = Triangle() self.assertIsNot(t0, None) self.assertIsInstance(t0, Triangle) def test_iterable(self): """Calling Vertex class ...
the_stack_v2_python_sparse
_BACKUPS_v3/v3_1/LightPicture_Test.py
nagame/LightPicture
train
0
0782d804c865c6b451f993683f102d738a2a5485
[ "self.logger = get_logger(name='OutputFilter')\nself.data = copy.deepcopy(data)\nself.required = None\nself.excluded = None\nif isinstance(required, list):\n self.required = required\nelse:\n self.required = []\n self.logger.error(msg='Required is not a list!')\nif isinstance(excluded, list):\n self.exc...
<|body_start_0|> self.logger = get_logger(name='OutputFilter') self.data = copy.deepcopy(data) self.required = None self.excluded = None if isinstance(required, list): self.required = required else: self.required = [] self.logger.error(...
This class helps to minimize dictionary structure by specifying only the desired keys.
OutputFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputFilter: """This class helps to minimize dictionary structure by specifying only the desired keys.""" def __init__(self, data=None, required=[], excluded=[]): """:param data: Data to be filtered. :param list required: List of required keys. Returned entries will contain only the...
stack_v2_sparse_classes_10k_train_000444
13,875
permissive
[ { "docstring": ":param data: Data to be filtered. :param list required: List of required keys. Returned entries will contain only these specified keys. Example: `{\"key1\": \"value1\", \"key2\": \"value2\"}` with ``required`` `[\"key1\"]` will only return `{\"key1\": \"value1\"}`. :param list excluded: List of ...
2
stack_v2_sparse_classes_30k_test_000286
Implement the Python class `OutputFilter` described below. Class description: This class helps to minimize dictionary structure by specifying only the desired keys. Method signatures and docstrings: - def __init__(self, data=None, required=[], excluded=[]): :param data: Data to be filtered. :param list required: List...
Implement the Python class `OutputFilter` described below. Class description: This class helps to minimize dictionary structure by specifying only the desired keys. Method signatures and docstrings: - def __init__(self, data=None, required=[], excluded=[]): :param data: Data to be filtered. :param list required: List...
3e050be98404dac79c071eb035d30095bda33fac
<|skeleton|> class OutputFilter: """This class helps to minimize dictionary structure by specifying only the desired keys.""" def __init__(self, data=None, required=[], excluded=[]): """:param data: Data to be filtered. :param list required: List of required keys. Returned entries will contain only the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OutputFilter: """This class helps to minimize dictionary structure by specifying only the desired keys.""" def __init__(self, data=None, required=[], excluded=[]): """:param data: Data to be filtered. :param list required: List of required keys. Returned entries will contain only these specified ...
the_stack_v2_python_sparse
nuaal/utils/Filter.py
mihudec/nuaal
train
1
f47292324269e352c52288ae770524fa16e7b536
[ "labels = []\nlabel_ids = []\nscores = []\ndisplay_names = []\nrelative_keypoints = []\nfor category in self.categories:\n scores.append(category.score)\n if category.index:\n label_ids.append(category.index)\n if category.category_name:\n labels.append(category.category_name)\n if categor...
<|body_start_0|> labels = [] label_ids = [] scores = [] display_names = [] relative_keypoints = [] for category in self.categories: scores.append(category.score) if category.index: label_ids.append(category.index) if cat...
Represents one detected object in the object detector's results. Attributes: bounding_box: A BoundingBox object. categories: A list of Category objects. keypoints: A list of NormalizedKeypoint objects.
Detection
[ "Apache-2.0", "dtoa" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Detection: """Represents one detected object in the object detector's results. Attributes: bounding_box: A BoundingBox object. categories: A list of Category objects. keypoints: A list of NormalizedKeypoint objects.""" def to_pb2(self) -> _DetectionProto: """Generates a Detection pro...
stack_v2_sparse_classes_10k_train_000445
5,843
permissive
[ { "docstring": "Generates a Detection protobuf object.", "name": "to_pb2", "signature": "def to_pb2(self) -> _DetectionProto" }, { "docstring": "Creates a `Detection` object from the given protobuf object.", "name": "create_from_pb2", "signature": "def create_from_pb2(cls, pb2_obj: _Dete...
3
stack_v2_sparse_classes_30k_train_007058
Implement the Python class `Detection` described below. Class description: Represents one detected object in the object detector's results. Attributes: bounding_box: A BoundingBox object. categories: A list of Category objects. keypoints: A list of NormalizedKeypoint objects. Method signatures and docstrings: - def t...
Implement the Python class `Detection` described below. Class description: Represents one detected object in the object detector's results. Attributes: bounding_box: A BoundingBox object. categories: A list of Category objects. keypoints: A list of NormalizedKeypoint objects. Method signatures and docstrings: - def t...
007824594bf1d07c7c1467df03a43886f8a4b3ad
<|skeleton|> class Detection: """Represents one detected object in the object detector's results. Attributes: bounding_box: A BoundingBox object. categories: A list of Category objects. keypoints: A list of NormalizedKeypoint objects.""" def to_pb2(self) -> _DetectionProto: """Generates a Detection pro...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Detection: """Represents one detected object in the object detector's results. Attributes: bounding_box: A BoundingBox object. categories: A list of Category objects. keypoints: A list of NormalizedKeypoint objects.""" def to_pb2(self) -> _DetectionProto: """Generates a Detection protobuf object....
the_stack_v2_python_sparse
mediapipe/tasks/python/components/containers/detections.py
google/mediapipe
train
23,940
2da750b4b196d236e289d467d04796659b218130
[ "base_directory_glob = f'{self.multihost_base_directory}-*'\nbase_directories = tf.io.gfile.glob(base_directory_glob)\nif self.base_directory not in base_directories:\n return None\ncheckpoints = {}\nfor base_directory in base_directories:\n checkpoint_manager = tf.train.CheckpointManager(tf.train.Checkpoint(...
<|body_start_0|> base_directory_glob = f'{self.multihost_base_directory}-*' base_directories = tf.io.gfile.glob(base_directory_glob) if self.base_directory not in base_directories: return None checkpoints = {} for base_directory in base_directories: checkp...
An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.
QueryMultihostCheckpoint
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryMultihostCheckpoint: """An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.""" def get_all_checkpoints_to_restore_from(self): """Returns the latest checkpoint available on all hosts.""" <|body_0|> def restore_from_path(self, state: T, path: str...
stack_v2_sparse_classes_10k_train_000446
7,517
permissive
[ { "docstring": "Returns the latest checkpoint available on all hosts.", "name": "get_all_checkpoints_to_restore_from", "signature": "def get_all_checkpoints_to_restore_from(self)" }, { "docstring": "Restores from a given checkpoint path. Args: state : A flax checkpoint to be stored or to serve a...
2
stack_v2_sparse_classes_30k_train_001722
Implement the Python class `QueryMultihostCheckpoint` described below. Class description: An subclass of `Checkpoint` that synchronizes between multiple JAX hosts. Method signatures and docstrings: - def get_all_checkpoints_to_restore_from(self): Returns the latest checkpoint available on all hosts. - def restore_fro...
Implement the Python class `QueryMultihostCheckpoint` described below. Class description: An subclass of `Checkpoint` that synchronizes between multiple JAX hosts. Method signatures and docstrings: - def get_all_checkpoints_to_restore_from(self): Returns the latest checkpoint available on all hosts. - def restore_fro...
1ed54e21f889775cf9e78ff736f804472c9b4337
<|skeleton|> class QueryMultihostCheckpoint: """An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.""" def get_all_checkpoints_to_restore_from(self): """Returns the latest checkpoint available on all hosts.""" <|body_0|> def restore_from_path(self, state: T, path: str...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QueryMultihostCheckpoint: """An subclass of `Checkpoint` that synchronizes between multiple JAX hosts.""" def get_all_checkpoints_to_restore_from(self): """Returns the latest checkpoint available on all hosts.""" base_directory_glob = f'{self.multihost_base_directory}-*' base_dire...
the_stack_v2_python_sparse
xmcgan/utils/task_manager.py
jiny419/xmcgan_image_generation
train
0
c26c2039ea0afa6f699a7decc83a72fff7344846
[ "tiles = data_input('test_data')\nresult = part_1(tiles)\nself.assertEqual(result, 20899048083289)", "tiles = data_input('data')\nresult = part_1(tiles)\nself.assertEqual(result, 18482479935793)", "tiles = data_input('test_data')\nresult = part_2(tiles)\nself.assertEqual(result, 273)", "tiles = data_input('da...
<|body_start_0|> tiles = data_input('test_data') result = part_1(tiles) self.assertEqual(result, 20899048083289) <|end_body_0|> <|body_start_1|> tiles = data_input('data') result = part_1(tiles) self.assertEqual(result, 18482479935793) <|end_body_1|> <|body_start_2|> ...
()
TestAoC20
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """()""" <|body_0|> def test_part_1_2(self): """()""" <|body_1|> def test_part_2_1(self): """()""" <|body_2|> def test_part_2_2(self): """()""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_10k_train_000447
953
no_license
[ { "docstring": "()", "name": "test_part_1_1", "signature": "def test_part_1_1(self)" }, { "docstring": "()", "name": "test_part_1_2", "signature": "def test_part_1_2(self)" }, { "docstring": "()", "name": "test_part_2_1", "signature": "def test_part_2_1(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_005483
Implement the Python class `TestAoC20` described below. Class description: () Method signatures and docstrings: - def test_part_1_1(self): () - def test_part_1_2(self): () - def test_part_2_1(self): () - def test_part_2_2(self): ()
Implement the Python class `TestAoC20` described below. Class description: () Method signatures and docstrings: - def test_part_1_1(self): () - def test_part_1_2(self): () - def test_part_2_1(self): () - def test_part_2_2(self): () <|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """(...
934c1c45daf189ce2f517b70abe896fedb152b88
<|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """()""" <|body_0|> def test_part_1_2(self): """()""" <|body_1|> def test_part_2_1(self): """()""" <|body_2|> def test_part_2_2(self): """()""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestAoC20: """()""" def test_part_1_1(self): """()""" tiles = data_input('test_data') result = part_1(tiles) self.assertEqual(result, 20899048083289) def test_part_1_2(self): """()""" tiles = data_input('data') result = part_1(tiles) se...
the_stack_v2_python_sparse
20/test.py
iveL91/Advent-of-Code-2020
train
0
edc58cecc83ea494cd5301bda66b0d51b03f6718
[ "solution_cells = []\nwith self.gradebook as gb:\n num_submissions = len(gb.notebook_submissions(notebook_id, assignment_id))\n notebook_id = gb.find_notebook(notebook_id, assignment_id).id\n for cell_name in gb.db.query(BaseCell.name).filter(BaseCell.type == 'SolutionCell').filter(BaseCell.notebook_id == ...
<|body_start_0|> solution_cells = [] with self.gradebook as gb: num_submissions = len(gb.notebook_submissions(notebook_id, assignment_id)) notebook_id = gb.find_notebook(notebook_id, assignment_id).id for cell_name in gb.db.query(BaseCell.name).filter(BaseCell.type ==...
E2xAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class E2xAPI: def get_solution_cell_ids(self, assignment_id, notebook_id): """Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells:...
stack_v2_sparse_classes_10k_train_000448
6,177
permissive
[ { "docstring": "Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells: dict A dictionary containing information about the solution cells", "name":...
2
stack_v2_sparse_classes_30k_train_005847
Implement the Python class `E2xAPI` described below. Class description: Implement the E2xAPI class. Method signatures and docstrings: - def get_solution_cell_ids(self, assignment_id, notebook_id): Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name...
Implement the Python class `E2xAPI` described below. Class description: Implement the E2xAPI class. Method signatures and docstrings: - def get_solution_cell_ids(self, assignment_id, notebook_id): Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name...
19eb4662e4eee5ddef673097517e4bd4fb469e62
<|skeleton|> class E2xAPI: def get_solution_cell_ids(self, assignment_id, notebook_id): """Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class E2xAPI: def get_solution_cell_ids(self, assignment_id, notebook_id): """Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells: dict A dictio...
the_stack_v2_python_sparse
e2xgrader/apps/api.py
divindevaiah/e2xgrader
train
0
da577011b4bad29f3cbda1e044ee544f6bcce846
[ "if not os.path.exists(path):\n return\nif os.path.isfile(path) or os.path.islink(path):\n os.unlink(path)\nelse:\n shutil.rmtree(path)", "if os.path.exists(dstname):\n if os.path.abspath(linkto) == os.path.abspath(dstname):\n return\n os.unlink(dstname)\nos.symlink(linkto, dstname)", "try...
<|body_start_0|> if not os.path.exists(path): return if os.path.isfile(path) or os.path.islink(path): os.unlink(path) else: shutil.rmtree(path) <|end_body_0|> <|body_start_1|> if os.path.exists(dstname): if os.path.abspath(linkto) == os.pa...
FileUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileUtils: def rm_rf(path): """Util to delete path""" <|body_0|> def symlink(linkto, dstname): """Util to symlink path""" <|body_1|> def mkdir_p(start_path): """Util to make path""" <|body_2|> def dir_size(start_path): """Uti...
stack_v2_sparse_classes_10k_train_000449
1,591
no_license
[ { "docstring": "Util to delete path", "name": "rm_rf", "signature": "def rm_rf(path)" }, { "docstring": "Util to symlink path", "name": "symlink", "signature": "def symlink(linkto, dstname)" }, { "docstring": "Util to make path", "name": "mkdir_p", "signature": "def mkdir...
4
stack_v2_sparse_classes_30k_train_004782
Implement the Python class `FileUtils` described below. Class description: Implement the FileUtils class. Method signatures and docstrings: - def rm_rf(path): Util to delete path - def symlink(linkto, dstname): Util to symlink path - def mkdir_p(start_path): Util to make path - def dir_size(start_path): Util to get t...
Implement the Python class `FileUtils` described below. Class description: Implement the FileUtils class. Method signatures and docstrings: - def rm_rf(path): Util to delete path - def symlink(linkto, dstname): Util to symlink path - def mkdir_p(start_path): Util to make path - def dir_size(start_path): Util to get t...
3962b3c7bab9d26bf871d257e15dd39c45ffaddd
<|skeleton|> class FileUtils: def rm_rf(path): """Util to delete path""" <|body_0|> def symlink(linkto, dstname): """Util to symlink path""" <|body_1|> def mkdir_p(start_path): """Util to make path""" <|body_2|> def dir_size(start_path): """Uti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileUtils: def rm_rf(path): """Util to delete path""" if not os.path.exists(path): return if os.path.isfile(path) or os.path.islink(path): os.unlink(path) else: shutil.rmtree(path) def symlink(linkto, dstname): """Util to symlink...
the_stack_v2_python_sparse
tools/files/file_utils.py
zigvu/samosa
train
0
6496fcc5c465ff63b3b1a46d5da4b7c5875d666c
[ "q = collections.deque()\nq.append(root)\nres = []\nwhile q:\n curr = q.popleft()\n if curr:\n res.append(curr.val)\n q.append(curr.left)\n q.append(curr.right)\n else:\n res.append(None)\nreturn str(res)", "orig = eval(data)\nroot = TreeNode(orig[0]) if orig and orig[0] != No...
<|body_start_0|> q = collections.deque() q.append(root) res = [] while q: curr = q.popleft() if curr: res.append(curr.val) q.append(curr.left) q.append(curr.right) else: res.append(None) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """apply bfs and index for decoding string""" <|body_1|> <|end_skeleton|> <|body_start_0|> q = collec...
stack_v2_sparse_classes_10k_train_000450
1,405
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "apply bfs and index for decoding string", "name": "deserialize", "signature": "def deserialize(self, data)" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): apply bfs and index for decoding string
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): apply bfs and index for decoding string <|skeleton|> clas...
7609fbd164e3dbedc11308fdc24b57b5097ade81
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """apply bfs and index for decoding string""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = collections.deque() q.append(root) res = [] while q: curr = q.popleft() if curr: res.append(curr.val) ...
the_stack_v2_python_sparse
python/297_serialize_and_deserialize_binary_tree.py
MakrisHuang/LeetCode
train
0
4ee43d75b7619b50e1ab89aba5eac4aa7a9c76e7
[ "if x < 0:\n return False\nelse:\n return x == self.reverseInt(x)", "reverse = 0\nwhile x:\n reverse *= 10\n reverse += x % 10\n x //= 10\nreturn reverse" ]
<|body_start_0|> if x < 0: return False else: return x == self.reverseInt(x) <|end_body_0|> <|body_start_1|> reverse = 0 while x: reverse *= 10 reverse += x % 10 x //= 10 return reverse <|end_body_1|>
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """Time: O(log(x)) Space: O(1)""" <|body_0|> def reverseInt(self, x): """Return the reversed version of a positive int.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False e...
stack_v2_sparse_classes_10k_train_000451
680
no_license
[ { "docstring": "Time: O(log(x)) Space: O(1)", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": "Return the reversed version of a positive int.", "name": "reverseInt", "signature": "def reverseInt(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_003543
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): Time: O(log(x)) Space: O(1) - def reverseInt(self, x): Return the reversed version of a positive int.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): Time: O(log(x)) Space: O(1) - def reverseInt(self, x): Return the reversed version of a positive int. <|skeleton|> class Solution: def isPalindro...
dfe4aa136fe57913e5c0bac091262ad451a57703
<|skeleton|> class Solution: def isPalindrome(self, x): """Time: O(log(x)) Space: O(1)""" <|body_0|> def reverseInt(self, x): """Return the reversed version of a positive int.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """Time: O(log(x)) Space: O(1)""" if x < 0: return False else: return x == self.reverseInt(x) def reverseInt(self, x): """Return the reversed version of a positive int.""" reverse = 0 while x: ...
the_stack_v2_python_sparse
LeetCode/src/009 - Palindrome Number.py
Rudra-Patil/Programming-Exercises
train
1
9fb2c1b5fa8cc6e1a0b8314c7c9794b617b3698a
[ "super().__init__(xsize, ysize)\nif self.xsize % 2 == 0 or self.ysize % 2 == 0:\n raise ValueError('xsize and ysize must be odd')\nself.grid = [['@'] * self.xsize for _ in range(self.ysize)]\nself.generate()\nself.start = (1, 1)\nself.goal = (self.xsize - 2, self.ysize - 2)\nassert self.is_free(*self.start)\nass...
<|body_start_0|> super().__init__(xsize, ysize) if self.xsize % 2 == 0 or self.ysize % 2 == 0: raise ValueError('xsize and ysize must be odd') self.grid = [['@'] * self.xsize for _ in range(self.ysize)] self.generate() self.start = (1, 1) self.goal = (self.xsi...
Randomly generated maze using Prim's algorithm: https://en.wikipedia.org/wiki/Prim%27s_algorithm (Known for producing mazes with lots of short dead ends, only moderately challenging for humans.)
PrimRandomMaze
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrimRandomMaze: """Randomly generated maze using Prim's algorithm: https://en.wikipedia.org/wiki/Prim%27s_algorithm (Known for producing mazes with lots of short dead ends, only moderately challenging for humans.)""" def __init__(self, xsize, ysize): """Create a new random maze of si...
stack_v2_sparse_classes_10k_train_000452
8,089
no_license
[ { "docstring": "Create a new random maze of size (xsize,ysize). Both dimensions must be odd.", "name": "__init__", "signature": "def __init__(self, xsize, ysize)" }, { "docstring": "Make the maze using Prim's algorithm", "name": "generate", "signature": "def generate(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_005284
Implement the Python class `PrimRandomMaze` described below. Class description: Randomly generated maze using Prim's algorithm: https://en.wikipedia.org/wiki/Prim%27s_algorithm (Known for producing mazes with lots of short dead ends, only moderately challenging for humans.) Method signatures and docstrings: - def __i...
Implement the Python class `PrimRandomMaze` described below. Class description: Randomly generated maze using Prim's algorithm: https://en.wikipedia.org/wiki/Prim%27s_algorithm (Known for producing mazes with lots of short dead ends, only moderately challenging for humans.) Method signatures and docstrings: - def __i...
6886dab8fe2a62d0bf2668d783a8fdc35b62d6de
<|skeleton|> class PrimRandomMaze: """Randomly generated maze using Prim's algorithm: https://en.wikipedia.org/wiki/Prim%27s_algorithm (Known for producing mazes with lots of short dead ends, only moderately challenging for humans.)""" def __init__(self, xsize, ysize): """Create a new random maze of si...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrimRandomMaze: """Randomly generated maze using Prim's algorithm: https://en.wikipedia.org/wiki/Prim%27s_algorithm (Known for producing mazes with lots of short dead ends, only moderately challenging for humans.)""" def __init__(self, xsize, ysize): """Create a new random maze of size (xsize,ysi...
the_stack_v2_python_sparse
samplecode/recursion/maze.py
daviddumas/mcs275spring2021
train
0
5d5b29c9197d99cad3bcedcfbd6e81568364e188
[ "self.alias_name = alias_name\nself.client_subnet_whitelist = client_subnet_whitelist\nself.smb_config = smb_config\nself.view_path = view_path", "if dictionary is None:\n return None\nalias_name = dictionary.get('aliasName')\nclient_subnet_whitelist = None\nif dictionary.get('clientSubnetWhitelist') != None:\...
<|body_start_0|> self.alias_name = alias_name self.client_subnet_whitelist = client_subnet_whitelist self.smb_config = smb_config self.view_path = view_path <|end_body_0|> <|body_start_1|> if dictionary is None: return None alias_name = dictionary.get('aliasN...
Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. Attributes: alias_name (string): Alias name. client_subnet_whitelist (list of ClusterConfigProtoSubnet): List of external client subnet IPs that are allowed to access the share. smb_config (AliasSmbConfig): Message defining ...
ViewAliasInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewAliasInfo: """Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. Attributes: alias_name (string): Alias name. client_subnet_whitelist (list of ClusterConfigProtoSubnet): List of external client subnet IPs that are allowed to access the share. smb_c...
stack_v2_sparse_classes_10k_train_000453
2,873
permissive
[ { "docstring": "Constructor for the ViewAliasInfo class", "name": "__init__", "signature": "def __init__(self, alias_name=None, client_subnet_whitelist=None, smb_config=None, view_path=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A ...
2
stack_v2_sparse_classes_30k_train_000866
Implement the Python class `ViewAliasInfo` described below. Class description: Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. Attributes: alias_name (string): Alias name. client_subnet_whitelist (list of ClusterConfigProtoSubnet): List of external client subnet IPs that...
Implement the Python class `ViewAliasInfo` described below. Class description: Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. Attributes: alias_name (string): Alias name. client_subnet_whitelist (list of ClusterConfigProtoSubnet): List of external client subnet IPs that...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ViewAliasInfo: """Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. Attributes: alias_name (string): Alias name. client_subnet_whitelist (list of ClusterConfigProtoSubnet): List of external client subnet IPs that are allowed to access the share. smb_c...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ViewAliasInfo: """Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. Attributes: alias_name (string): Alias name. client_subnet_whitelist (list of ClusterConfigProtoSubnet): List of external client subnet IPs that are allowed to access the share. smb_config (AliasS...
the_stack_v2_python_sparse
cohesity_management_sdk/models/view_alias_info.py
cohesity/management-sdk-python
train
24
b269c5963df6e2986513560b1c158dc5e1ec4958
[ "super(Text_Encoder, self).__init__()\nself.fc1_text_dim = model_parameters.FC1_TEXT_DIM\nself.fc2_text_dim = model_parameters.FC2_TEXT_DIM\nself.fine_tune_text = model_parameters.FINE_TUNE_TEXT\nself.fine_tune_text_layers = model_parameters.FINE_TUNE_TEXT_LAYERS\nself.dropout_p = model_parameters.DROPOUT_P\nself.c...
<|body_start_0|> super(Text_Encoder, self).__init__() self.fc1_text_dim = model_parameters.FC1_TEXT_DIM self.fc2_text_dim = model_parameters.FC2_TEXT_DIM self.fine_tune_text = model_parameters.FINE_TUNE_TEXT self.fine_tune_text_layers = model_parameters.FINE_TUNE_TEXT_LAYERS ...
Text Encoder MOdel
Text_Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Text_Encoder: """Text Encoder MOdel""" def __init__(self): """@param fine_tune_text (bool): Set `False` to fine-tune the BERT model""" <|body_0|> def forward(self, input_ids, attention_mask): """Feed input to BERT and the classifier to compute logits. @param inpu...
stack_v2_sparse_classes_10k_train_000454
9,539
no_license
[ { "docstring": "@param fine_tune_text (bool): Set `False` to fine-tune the BERT model", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Feed input to BERT and the classifier to compute logits. @param input_ids (torch.Tensor): an input tensor with shape (batch_size, max_l...
3
stack_v2_sparse_classes_30k_train_002874
Implement the Python class `Text_Encoder` described below. Class description: Text Encoder MOdel Method signatures and docstrings: - def __init__(self): @param fine_tune_text (bool): Set `False` to fine-tune the BERT model - def forward(self, input_ids, attention_mask): Feed input to BERT and the classifier to comput...
Implement the Python class `Text_Encoder` described below. Class description: Text Encoder MOdel Method signatures and docstrings: - def __init__(self): @param fine_tune_text (bool): Set `False` to fine-tune the BERT model - def forward(self, input_ids, attention_mask): Feed input to BERT and the classifier to comput...
cf4d2a603ec0cbfaab0ce550f19110742970bcba
<|skeleton|> class Text_Encoder: """Text Encoder MOdel""" def __init__(self): """@param fine_tune_text (bool): Set `False` to fine-tune the BERT model""" <|body_0|> def forward(self, input_ids, attention_mask): """Feed input to BERT and the classifier to compute logits. @param inpu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Text_Encoder: """Text Encoder MOdel""" def __init__(self): """@param fine_tune_text (bool): Set `False` to fine-tune the BERT model""" super(Text_Encoder, self).__init__() self.fc1_text_dim = model_parameters.FC1_TEXT_DIM self.fc2_text_dim = model_parameters.FC2_TEXT_DIM ...
the_stack_v2_python_sparse
code/src/sub_modules.py
mudit-dhawan/FND
train
2
be3ef39a100787c28ef1f7579f7aa2352d42a905
[ "self.name = name\nself.rect = pg.Rect(rect)\nself.command = command\nself.color = (128, 128, 128)\nself.select_rect = self.rect.inflate(-10, -10)\nself.checked = checked", "if event.type == pg.MOUSEBUTTONDOWN and event.button == 1:\n if self.rect.collidepoint(event.pos):\n self.toggle()", "self.check...
<|body_start_0|> self.name = name self.rect = pg.Rect(rect) self.command = command self.color = (128, 128, 128) self.select_rect = self.rect.inflate(-10, -10) self.checked = checked <|end_body_0|> <|body_start_1|> if event.type == pg.MOUSEBUTTONDOWN and event.but...
A simple checkbox class. Size and appearance are currently hardcoded.
CheckBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckBox: """A simple checkbox class. Size and appearance are currently hardcoded.""" def __init__(self, name, rect, checked=False, command=None): """The argument name is a string used to refer to the box; rect is a pygame.Rect for the area of the box (inclusive of the border); check...
stack_v2_sparse_classes_10k_train_000455
14,532
no_license
[ { "docstring": "The argument name is a string used to refer to the box; rect is a pygame.Rect for the area of the box (inclusive of the border); checked is a boolean indicating whether or not the button is currently checked; command is the function that is called when the box is checked or unchecked.", "nam...
4
stack_v2_sparse_classes_30k_train_005891
Implement the Python class `CheckBox` described below. Class description: A simple checkbox class. Size and appearance are currently hardcoded. Method signatures and docstrings: - def __init__(self, name, rect, checked=False, command=None): The argument name is a string used to refer to the box; rect is a pygame.Rect...
Implement the Python class `CheckBox` described below. Class description: A simple checkbox class. Size and appearance are currently hardcoded. Method signatures and docstrings: - def __init__(self, name, rect, checked=False, command=None): The argument name is a string used to refer to the box; rect is a pygame.Rect...
cee7e4b5dc28c57a6c912852827652b5f51005ae
<|skeleton|> class CheckBox: """A simple checkbox class. Size and appearance are currently hardcoded.""" def __init__(self, name, rect, checked=False, command=None): """The argument name is a string used to refer to the box; rect is a pygame.Rect for the area of the box (inclusive of the border); check...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheckBox: """A simple checkbox class. Size and appearance are currently hardcoded.""" def __init__(self, name, rect, checked=False, command=None): """The argument name is a string used to refer to the box; rect is a pygame.Rect for the area of the box (inclusive of the border); checked is a boole...
the_stack_v2_python_sparse
IE_games_3/cabbages-and-kings-master/data/map_components/map_gui_widgets.py
IndexErrorCoders/PygamesCompilation
train
2
a569d13be0708392f855863b48568f42128abc76
[ "self.get_compression_type_string(compression_type)\nself.compression_type = compression_type\nself.flush_mode = flush_mode\nself.input_buffer_size = input_buffer_size\nself.output_buffer_size = output_buffer_size\nself.window_bits = window_bits\nself.compression_level = compression_level\nself.compression_method =...
<|body_start_0|> self.get_compression_type_string(compression_type) self.compression_type = compression_type self.flush_mode = flush_mode self.input_buffer_size = input_buffer_size self.output_buffer_size = output_buffer_size self.window_bits = window_bits self.co...
Options used for manipulating TFRecord files.
TFRecordOptions
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFRecordOptions: """Options used for manipulating TFRecord files.""" def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compression_method=None, mem_level=None, compression_strategy=None): ...
stack_v2_sparse_classes_10k_train_000456
11,670
permissive
[ { "docstring": "Creates a `TFRecordOptions` instance. Options only effect TFRecordWriter when compression_type is not `None`. Documentation, details, and defaults can be found in [`zlib_compression_options.h`](https://www.tensorflow.org/code/tensorflow/core/lib/io/zlib_compression_options.h) and in the [zlib ma...
3
stack_v2_sparse_classes_30k_train_005450
Implement the Python class `TFRecordOptions` described below. Class description: Options used for manipulating TFRecord files. Method signatures and docstrings: - def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compr...
Implement the Python class `TFRecordOptions` described below. Class description: Options used for manipulating TFRecord files. Method signatures and docstrings: - def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compr...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class TFRecordOptions: """Options used for manipulating TFRecord files.""" def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compression_method=None, mem_level=None, compression_strategy=None): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TFRecordOptions: """Options used for manipulating TFRecord files.""" def __init__(self, compression_type=None, flush_mode=None, input_buffer_size=None, output_buffer_size=None, window_bits=None, compression_level=None, compression_method=None, mem_level=None, compression_strategy=None): """Create...
the_stack_v2_python_sparse
tensorflow/python/lib/io/tf_record.py
tensorflow/tensorflow
train
208,740
9ed44e8405a992a194d64ef1dfe95b7da8b63d1b
[ "outString = ''\nunitLen = 8\nfor singleStr in strs:\n strLen = len(singleStr)\n strLenLen = len(str(strLen))\n outString += '0' * (unitLen - strLenLen) + str(strLen)\n outString += singleStr\nreturn outString", "strList = []\ninputLen = len(s)\nif inputLen > 0:\n unitLen = 8\n curIdx = 0\n w...
<|body_start_0|> outString = '' unitLen = 8 for singleStr in strs: strLen = len(singleStr) strLenLen = len(str(strLen)) outString += '0' * (unitLen - strLenLen) + str(strLen) outString += singleStr return outString <|end_body_0|> <|body_st...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> outString...
stack_v2_sparse_classes_10k_train_000457
1,253
permissive
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
48a57f6a5d5745199c5685cd2c8f5c4fa293e54a
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" outString = '' unitLen = 8 for singleStr in strs: strLen = len(singleStr) strLenLen = len(str(strLen)) outString += '0' * (unitLen - strLenLen) +...
the_stack_v2_python_sparse
Q02__/71_Encode_and_Decode_Strings/Solution.py
hsclinical/leetcode
train
0
ac53cfcd3a64493e0ae54c879ed11c122106dcc9
[ "if self.memory:\n return str(self.data)\nwith helpers.ensure_open(self):\n return self.text_stream.read(size)", "resource = target\nif not isinstance(resource, Resource):\n resource = TextResource(**options)\nif not isinstance(resource, TextResource):\n raise FrictionlessException('target must be a t...
<|body_start_0|> if self.memory: return str(self.data) with helpers.ensure_open(self): return self.text_stream.read(size) <|end_body_0|> <|body_start_1|> resource = target if not isinstance(resource, Resource): resource = TextResource(**options) ...
TextResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextResource: def read_text(self, *, size: Optional[int]=None) -> str: """Read text into memory Returns: str: resource text""" <|body_0|> def write_text(self, target: Optional[Union[TextResource, Any]]=None, **options: Any): """Write text data to the target""" ...
stack_v2_sparse_classes_10k_train_000458
1,414
permissive
[ { "docstring": "Read text into memory Returns: str: resource text", "name": "read_text", "signature": "def read_text(self, *, size: Optional[int]=None) -> str" }, { "docstring": "Write text data to the target", "name": "write_text", "signature": "def write_text(self, target: Optional[Uni...
2
null
Implement the Python class `TextResource` described below. Class description: Implement the TextResource class. Method signatures and docstrings: - def read_text(self, *, size: Optional[int]=None) -> str: Read text into memory Returns: str: resource text - def write_text(self, target: Optional[Union[TextResource, Any...
Implement the Python class `TextResource` described below. Class description: Implement the TextResource class. Method signatures and docstrings: - def read_text(self, *, size: Optional[int]=None) -> str: Read text into memory Returns: str: resource text - def write_text(self, target: Optional[Union[TextResource, Any...
740319edeee58f12cc6956a53356f3065ff18cbb
<|skeleton|> class TextResource: def read_text(self, *, size: Optional[int]=None) -> str: """Read text into memory Returns: str: resource text""" <|body_0|> def write_text(self, target: Optional[Union[TextResource, Any]]=None, **options: Any): """Write text data to the target""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextResource: def read_text(self, *, size: Optional[int]=None) -> str: """Read text into memory Returns: str: resource text""" if self.memory: return str(self.data) with helpers.ensure_open(self): return self.text_stream.read(size) def write_text(self, targ...
the_stack_v2_python_sparse
frictionless/resources/text.py
frictionlessdata/frictionless-py
train
295
d72ce3187a2d3dcaadc879d8dcc3b0dae44e774b
[ "self.records = int(records)\nself.sql = sql\nself.group_id = group_id\nself.token = token\nself.pagesql = self.get_page_sql()", "page_sql = ''\nif self.group_id == None:\n page_sql = self.sql[:-5] + ' order by adddate desc'\nelif self.group_id == '0':\n groupid = GROP_OPT(self.token).getGroupID()\n if g...
<|body_start_0|> self.records = int(records) self.sql = sql self.group_id = group_id self.token = token self.pagesql = self.get_page_sql() <|end_body_0|> <|body_start_1|> page_sql = '' if self.group_id == None: page_sql = self.sql[:-5] + ' order by ad...
分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回
Paginator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Paginator: """分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回""" def __init__(self, records, sql, group_id=None, token=None): """初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID""" <|body_0|> def get_page_sql(self): """获取数据查询sql语句 :param group...
stack_v2_sparse_classes_10k_train_000459
7,184
permissive
[ { "docstring": "初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID", "name": "__init__", "signature": "def __init__(self, records, sql, group_id=None, token=None)" }, { "docstring": "获取数据查询sql语句 :param group_id:分组ID :return: 数据查询sql", "name": "get_page_sql", "signatu...
6
stack_v2_sparse_classes_30k_train_003586
Implement the Python class `Paginator` described below. Class description: 分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回 Method signatures and docstrings: - def __init__(self, records, sql, group_id=None, token=None): 初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID - def get_page_sql(self): 获取数...
Implement the Python class `Paginator` described below. Class description: 分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回 Method signatures and docstrings: - def __init__(self, records, sql, group_id=None, token=None): 初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID - def get_page_sql(self): 获取数...
e188b15a0aa4a9fde00dba15e8300e4b87973e2d
<|skeleton|> class Paginator: """分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回""" def __init__(self, records, sql, group_id=None, token=None): """初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID""" <|body_0|> def get_page_sql(self): """获取数据查询sql语句 :param group...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Paginator: """分页模块 主要是解决前端分页问题 输入 分页的每页记录数,分组id即可完成分页的数据返回""" def __init__(self, records, sql, group_id=None, token=None): """初始化分页类 :param records: 每页显示数量 :param sql: 要查询的sql :param group_id: 分组ID""" self.records = int(records) self.sql = sql self.group_id = group_id ...
the_stack_v2_python_sparse
at_tmp/model/util/TMP_PAGINATOR.py
zuoleilei3253/zuoleilei
train
0
55d5c80f475978a4009e1af24d720b8a0c3ca0eb
[ "ctx.shift = shift\nctx.quantum_circuit = quantum_circuit\nresults = []\nfor batch in input:\n expectation_z = ctx.quantum_circuit.run(batch)\n results.append(expectation_z)\nresults = t.Tensor(results)\nctx.save_for_backward(input, results)\nreturn results", "input, expectation_z = ctx.saved_tensors\ninput...
<|body_start_0|> ctx.shift = shift ctx.quantum_circuit = quantum_circuit results = [] for batch in input: expectation_z = ctx.quantum_circuit.run(batch) results.append(expectation_z) results = t.Tensor(results) ctx.save_for_backward(input, results)...
Hybrid quantum - classical function definition
HybridFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HybridFunction: """Hybrid quantum - classical function definition""" def forward(ctx, input, quantum_circuit, shift): """Forward pass computation""" <|body_0|> def backward(ctx, grad_output): """Backward pass computation""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_000460
25,405
no_license
[ { "docstring": "Forward pass computation", "name": "forward", "signature": "def forward(ctx, input, quantum_circuit, shift)" }, { "docstring": "Backward pass computation", "name": "backward", "signature": "def backward(ctx, grad_output)" } ]
2
stack_v2_sparse_classes_30k_train_001803
Implement the Python class `HybridFunction` described below. Class description: Hybrid quantum - classical function definition Method signatures and docstrings: - def forward(ctx, input, quantum_circuit, shift): Forward pass computation - def backward(ctx, grad_output): Backward pass computation
Implement the Python class `HybridFunction` described below. Class description: Hybrid quantum - classical function definition Method signatures and docstrings: - def forward(ctx, input, quantum_circuit, shift): Forward pass computation - def backward(ctx, grad_output): Backward pass computation <|skeleton|> class H...
d87e5652085bcb1848f30aadde848fd530e984c2
<|skeleton|> class HybridFunction: """Hybrid quantum - classical function definition""" def forward(ctx, input, quantum_circuit, shift): """Forward pass computation""" <|body_0|> def backward(ctx, grad_output): """Backward pass computation""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HybridFunction: """Hybrid quantum - classical function definition""" def forward(ctx, input, quantum_circuit, shift): """Forward pass computation""" ctx.shift = shift ctx.quantum_circuit = quantum_circuit results = [] for batch in input: expectation_z =...
the_stack_v2_python_sparse
src/partiqleDTR/pipelines/data_science/qftgnn.py
stroblme/partiqleDTR
train
0
5d7d5d7acb30597d90f54b6474d6e5e367cd7d7a
[ "response_mock = Mock()\nresponse_mock.json.return_value = payload\nreturn response_mock", "with patch('utils.requests') as mock_requests:\n mock_requests.get.return_value = self.response(payload)\n self.assertEqual(get_json(url), expected)\n assert mock_requests.get.call_count == 1" ]
<|body_start_0|> response_mock = Mock() response_mock.json.return_value = payload return response_mock <|end_body_0|> <|body_start_1|> with patch('utils.requests') as mock_requests: mock_requests.get.return_value = self.response(payload) self.assertEqual(get_json...
[summary] Args: unittest ([type]): [description]
TestGetJson
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetJson: """[summary] Args: unittest ([type]): [description]""" def response(self, payload): """[summary]""" <|body_0|> def test_get_json(self, url, payload, expected): """[summary]""" <|body_1|> <|end_skeleton|> <|body_start_0|> response_mo...
stack_v2_sparse_classes_10k_train_000461
3,221
no_license
[ { "docstring": "[summary]", "name": "response", "signature": "def response(self, payload)" }, { "docstring": "[summary]", "name": "test_get_json", "signature": "def test_get_json(self, url, payload, expected)" } ]
2
stack_v2_sparse_classes_30k_train_006619
Implement the Python class `TestGetJson` described below. Class description: [summary] Args: unittest ([type]): [description] Method signatures and docstrings: - def response(self, payload): [summary] - def test_get_json(self, url, payload, expected): [summary]
Implement the Python class `TestGetJson` described below. Class description: [summary] Args: unittest ([type]): [description] Method signatures and docstrings: - def response(self, payload): [summary] - def test_get_json(self, url, payload, expected): [summary] <|skeleton|> class TestGetJson: """[summary] Args: ...
94cae2ce3aa4cd72fc5907bd0148694054a9e60f
<|skeleton|> class TestGetJson: """[summary] Args: unittest ([type]): [description]""" def response(self, payload): """[summary]""" <|body_0|> def test_get_json(self, url, payload, expected): """[summary]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestGetJson: """[summary] Args: unittest ([type]): [description]""" def response(self, payload): """[summary]""" response_mock = Mock() response_mock.json.return_value = payload return response_mock def test_get_json(self, url, payload, expected): """[summary]...
the_stack_v2_python_sparse
0x09-Unittests_and_integration_tests/test_utils.py
nakadorx/holbertonschool-web_back_end
train
0
55b40ed88c7de608ff1ae5d5fe14d375d7597956
[ "self.attributes_descriptor = attributes_descriptor\nself.enable_rollup = enable_rollup\nself.entities_time_to_live_secs = entities_time_to_live_secs\nself.flush_interval_secs = flush_interval_secs\nself.is_internal_schema = is_internal_schema\nself.largest_flush_interval_secs = largest_flush_interval_secs\nself.na...
<|body_start_0|> self.attributes_descriptor = attributes_descriptor self.enable_rollup = enable_rollup self.entities_time_to_live_secs = entities_time_to_live_secs self.flush_interval_secs = flush_interval_secs self.is_internal_schema = is_internal_schema self.largest_flu...
Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool): Timeseries for an entity schema is rolled up...
EntitySchemaProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntitySchemaProto: """Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool):...
stack_v2_sparse_classes_10k_train_000462
7,912
permissive
[ { "docstring": "Constructor for the EntitySchemaProto class", "name": "__init__", "signature": "def __init__(self, attributes_descriptor=None, enable_rollup=None, entities_time_to_live_secs=None, flush_interval_secs=None, is_internal_schema=None, largest_flush_interval_secs=None, name=None, rollup_granu...
2
null
Implement the Python class `EntitySchemaProto` described below. Class description: Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type ...
Implement the Python class `EntitySchemaProto` described below. Class description: Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class EntitySchemaProto: """Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool):...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EntitySchemaProto: """Implementation of the 'EntitySchemaProto' model. Specifies the meta-data associated with entity such as the list of attributes and time series data. Attributes: attributes_descriptor (EntitySchemaProto_AttributesDescriptor): TODO: Type description here. enable_rollup (bool): Timeseries f...
the_stack_v2_python_sparse
cohesity_management_sdk/models/entity_schema_proto.py
cohesity/management-sdk-python
train
24
df78e9548770460872b397047f451255f69bf0a2
[ "self.large = []\nself.small = []\nself.len_large = 0\nself.len_small = 0", "if self.len_large == self.len_small:\n heappush(self.small, -heappushpop(self.large, num))\n self.len_small += 1\nelse:\n heappush(self.large, -heappushpop(self.small, -num))\n self.len_large += 1", "if self.len_small == 0:...
<|body_start_0|> self.large = [] self.small = [] self.len_large = 0 self.len_small = 0 <|end_body_0|> <|body_start_1|> if self.len_large == self.len_small: heappush(self.small, -heappushpop(self.large, num)) self.len_small += 1 else: h...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_10k_train_000463
1,946
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
null
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
a46b07adec6a8cb7e331e0b985d88cd34a3d5667
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.large = [] self.small = [] self.len_large = 0 self.len_small = 0 def addNum(self, num): """:type num: int :rtype: void""" if self.len_large == self.len_small: ...
the_stack_v2_python_sparse
295_Find_Median_from_Data_Stream.py
ZDawang/leetcode
train
8
e485d15ba9140bb22e30b9c72e18bd6fd5a8b19a
[ "super(LayerNorm, self).__init__()\nself.weight = self.set_parameters('gamma', ones(hidden_size))\nself.bias = self.set_parameters('beta', zeros(hidden_size))\nself.variance_epsilon = eps", "u = x.mean(-1, keepdim=True)\ns = (x - u).pow(2).mean(-1, keepdim=True)\nx = (x - u) / sqrt(s + self.variance_epsilon)\nret...
<|body_start_0|> super(LayerNorm, self).__init__() self.weight = self.set_parameters('gamma', ones(hidden_size)) self.bias = self.set_parameters('beta', zeros(hidden_size)) self.variance_epsilon = eps <|end_body_0|> <|body_start_1|> u = x.mean(-1, keepdim=True) s = (x - ...
Layer Norm module.
LayerNorm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LayerNorm: """Layer Norm module.""" def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root).""" <|body_0|> def call(self, x): """Call LayerNorm.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_000464
25,894
permissive
[ { "docstring": "Construct a layernorm module in the TF style (epsilon inside the square root).", "name": "__init__", "signature": "def __init__(self, hidden_size, eps=1e-12)" }, { "docstring": "Call LayerNorm.", "name": "call", "signature": "def call(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_005652
Implement the Python class `LayerNorm` described below. Class description: Layer Norm module. Method signatures and docstrings: - def __init__(self, hidden_size, eps=1e-12): Construct a layernorm module in the TF style (epsilon inside the square root). - def call(self, x): Call LayerNorm.
Implement the Python class `LayerNorm` described below. Class description: Layer Norm module. Method signatures and docstrings: - def __init__(self, hidden_size, eps=1e-12): Construct a layernorm module in the TF style (epsilon inside the square root). - def call(self, x): Call LayerNorm. <|skeleton|> class LayerNor...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class LayerNorm: """Layer Norm module.""" def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root).""" <|body_0|> def call(self, x): """Call LayerNorm.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LayerNorm: """Layer Norm module.""" def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(LayerNorm, self).__init__() self.weight = self.set_parameters('gamma', ones(hidden_size)) self.bias = ...
the_stack_v2_python_sparse
zeus/modules/operators/functions/pytorch_fn.py
huawei-noah/xingtian
train
308
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTimeToArrivalToLocation, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._time = time\nself._target_location = location", "new_status = py_trees.common.Status.RUNNING\ncurrent_location = CarlaDataProvider.get_location(self._actor)\nif current_...
<|body_start_0|> super(InTimeToArrivalToLocation, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._time = time self._target_location = location <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status....
This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - location: Location to be checked in this behavior The condi...
InTimeToArrivalToLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTimeToArrivalToLocation: """This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - locati...
stack_v2_sparse_classes_10k_train_000465
18,494
permissive
[ { "docstring": "Setup parameters", "name": "__init__", "signature": "def __init__(self, actor, time, location, name='TimeToArrival')" }, { "docstring": "Check if the actor can arrive at target_location within time", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_003038
Implement the Python class `InTimeToArrivalToLocation` described below. Class description: This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA ...
Implement the Python class `InTimeToArrivalToLocation` described below. Class description: This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA ...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTimeToArrivalToLocation: """This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - locati...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InTimeToArrivalToLocation: """This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - location: Location ...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
6af940cc2225fd3a2fefcb2d105878856acb5e03
[ "tmp = []\nfor a in arr:\n if a == 0:\n tmp.append(0)\n tmp.append(0)\n else:\n tmp.append(a)\n if len(tmp) == len(arr):\n break\nfor i in range(len(arr)):\n arr[i] = tmp[i]\nreturn", "possible_dups = 0\nlength_ = len(arr) - 1\nfor left in range(length_ + 1):\n if left >...
<|body_start_0|> tmp = [] for a in arr: if a == 0: tmp.append(0) tmp.append(0) else: tmp.append(a) if len(tmp) == len(arr): break for i in range(len(arr)): arr[i] = tmp[i] retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def duplicateZeros(self, arr: List[int]) -> None: """Do not return anything, modify arr in-place instead.""" <|body_0|> def duplicateZeros2(self, arr: List[int]) -> None: """Do not return anything, modify arr in-place instead.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k_train_000466
2,706
no_license
[ { "docstring": "Do not return anything, modify arr in-place instead.", "name": "duplicateZeros", "signature": "def duplicateZeros(self, arr: List[int]) -> None" }, { "docstring": "Do not return anything, modify arr in-place instead.", "name": "duplicateZeros2", "signature": "def duplicat...
2
stack_v2_sparse_classes_30k_train_001550
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def duplicateZeros(self, arr: List[int]) -> None: Do not return anything, modify arr in-place instead. - def duplicateZeros2(self, arr: List[int]) -> None: Do not return anything...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def duplicateZeros(self, arr: List[int]) -> None: Do not return anything, modify arr in-place instead. - def duplicateZeros2(self, arr: List[int]) -> None: Do not return anything...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def duplicateZeros(self, arr: List[int]) -> None: """Do not return anything, modify arr in-place instead.""" <|body_0|> def duplicateZeros2(self, arr: List[int]) -> None: """Do not return anything, modify arr in-place instead.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def duplicateZeros(self, arr: List[int]) -> None: """Do not return anything, modify arr in-place instead.""" tmp = [] for a in arr: if a == 0: tmp.append(0) tmp.append(0) else: tmp.append(a) i...
the_stack_v2_python_sparse
D/DuplicateZeros.py
bssrdf/pyleet
train
2
21b5ca12c811872e34248dc43f74403446b30991
[ "date_by_year = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}\nyear, month, date = [int(x) for x in date.split('-')]\ndates = 0\nif self.is_leap(year):\n date_by_year[2] += 1\nfor key in range(1, month):\n dates += date_by_year[key]\nreturn dates + date", "if year %...
<|body_start_0|> date_by_year = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31} year, month, date = [int(x) for x in date.split('-')] dates = 0 if self.is_leap(year): date_by_year[2] += 1 for key in range(1, month): ...
Runtime: 36 ms, faster than 100.00% of Python3 online submissions for Day of the Year. Memory Usage: 13.8 MB, less than 100.00% of Python3 online submissions for Day of the Year.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 36 ms, faster than 100.00% of Python3 online submissions for Day of the Year. Memory Usage: 13.8 MB, less than 100.00% of Python3 online submissions for Day of the Year.""" def dayOfYear(self, date): """Given a string date representing a Gregorian calendar date ...
stack_v2_sparse_classes_10k_train_000467
1,914
no_license
[ { "docstring": "Given a string date representing a Gregorian calendar date formatted as YYYY-MM-DD, return the day number of the year. Example 1: Input: date = \"2019-01-09\" Output: 9 Explanation: Given date is the 9th day of the year in 2019. Example 2: Input: date = \"2019-02-10\" Output: 41 Example 3: Input...
2
null
Implement the Python class `Solution` described below. Class description: Runtime: 36 ms, faster than 100.00% of Python3 online submissions for Day of the Year. Memory Usage: 13.8 MB, less than 100.00% of Python3 online submissions for Day of the Year. Method signatures and docstrings: - def dayOfYear(self, date): Gi...
Implement the Python class `Solution` described below. Class description: Runtime: 36 ms, faster than 100.00% of Python3 online submissions for Day of the Year. Memory Usage: 13.8 MB, less than 100.00% of Python3 online submissions for Day of the Year. Method signatures and docstrings: - def dayOfYear(self, date): Gi...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class Solution: """Runtime: 36 ms, faster than 100.00% of Python3 online submissions for Day of the Year. Memory Usage: 13.8 MB, less than 100.00% of Python3 online submissions for Day of the Year.""" def dayOfYear(self, date): """Given a string date representing a Gregorian calendar date ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Runtime: 36 ms, faster than 100.00% of Python3 online submissions for Day of the Year. Memory Usage: 13.8 MB, less than 100.00% of Python3 online submissions for Day of the Year.""" def dayOfYear(self, date): """Given a string date representing a Gregorian calendar date formatted as ...
the_stack_v2_python_sparse
LeetCode/1154_day_of_the_year.py
KKosukeee/CodingQuestions
train
1
30494a7b1a538396380a9897b4209b08a10edfaa
[ "try:\n ScfUser.objects.get(email=data)\nexcept:\n raise ParseError('User {} does not exist'.format(data))\nreturn data", "newPassword = data.get('newPassword')\nif newPassword and newPassword != data.get('newPasswordConfirm'):\n raise ParseError('newPassword did not match newPasswordConfirm')\nreturn da...
<|body_start_0|> try: ScfUser.objects.get(email=data) except: raise ParseError('User {} does not exist'.format(data)) return data <|end_body_0|> <|body_start_1|> newPassword = data.get('newPassword') if newPassword and newPassword != data.get('newPassword...
User reset password serializer
UserPasswordResetSerializer
[ "Apache-2.0", "GPL-3.0-only", "BSD-3-Clause", "AGPL-3.0-only", "GPL-1.0-or-later", "Python-2.0", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPasswordResetSerializer: """User reset password serializer""" def validate_email(self, data): """check email is exist or not""" <|body_0|> def validate(self, data): """validate password""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_10k_train_000468
4,134
permissive
[ { "docstring": "check email is exist or not", "name": "validate_email", "signature": "def validate_email(self, data)" }, { "docstring": "validate password", "name": "validate", "signature": "def validate(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_002488
Implement the Python class `UserPasswordResetSerializer` described below. Class description: User reset password serializer Method signatures and docstrings: - def validate_email(self, data): check email is exist or not - def validate(self, data): validate password
Implement the Python class `UserPasswordResetSerializer` described below. Class description: User reset password serializer Method signatures and docstrings: - def validate_email(self, data): check email is exist or not - def validate(self, data): validate password <|skeleton|> class UserPasswordResetSerializer: ...
4df3f46e35eb8fcab796be27fc1cc7fa7ed561f3
<|skeleton|> class UserPasswordResetSerializer: """User reset password serializer""" def validate_email(self, data): """check email is exist or not""" <|body_0|> def validate(self, data): """validate password""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserPasswordResetSerializer: """User reset password serializer""" def validate_email(self, data): """check email is exist or not""" try: ScfUser.objects.get(email=data) except: raise ParseError('User {} does not exist'.format(data)) return data ...
the_stack_v2_python_sparse
SCRM/ums/serializers.py
aricent/secure-cloud-native-fabric
train
2
12d13c4e8ebb52e213bfdf1f2afb672c0966b735
[ "endpoint = cls.list_api_endpoint\nif user_id:\n endpoint += f'?user_id={user_id}'\nelif created_after:\n endpoint += f'?created_after={created_after.isoformat()}'\nresponse_json = cls.get(endpoint)\nmessages = [Message(**s) for s in response_json['results']]\nreturn messages", "response_json = cls.get(cls....
<|body_start_0|> endpoint = cls.list_api_endpoint if user_id: endpoint += f'?user_id={user_id}' elif created_after: endpoint += f'?created_after={created_after.isoformat()}' response_json = cls.get(endpoint) messages = [Message(**s) for s in response_json[...
Messages
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Messages: def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: """Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param create...
stack_v2_sparse_classes_10k_train_000469
2,139
permissive
[ { "docstring": "Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param created_after: Only fetch messages created after timestamp. Must be provided if no user_id is provided. You can only fetch up to...
3
null
Implement the Python class `Messages` described below. Class description: Implement the Messages class. Method signatures and docstrings: - def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: Get messages between you and another user or your messages with all users :pa...
Implement the Python class `Messages` described below. Class description: Implement the Messages class. Method signatures and docstrings: - def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: Get messages between you and another user or your messages with all users :pa...
1f540f9bd866d5fd625be4a4d61ad6bce564f1ed
<|skeleton|> class Messages: def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: """Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param create...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Messages: def list(cls, user_id: Optional[str]=None, created_after: Optional[datetime]=None) -> List[Message]: """Get messages between you and another user or your messages with all users :param user_id: Another user ID, must be provided if no created_after date is provided :param created_after: Only ...
the_stack_v2_python_sparse
mephisto/abstractions/providers/prolific/api/messages.py
facebookresearch/Mephisto
train
281
5e53856906b22ba704b770636f090eef27fa3426
[ "q = [root]\nhead = 0\ntail = 1\nresult = []\nwhile head < tail:\n node = q[head]\n if node == None:\n result.append('null')\n else:\n result.append(node.val)\n q.append(node.left)\n q.append(node.right)\n tail += 2\n head += 1\nreturn ','.join(result)", "s = data.sp...
<|body_start_0|> q = [root] head = 0 tail = 1 result = [] while head < tail: node = q[head] if node == None: result.append('null') else: result.append(node.val) q.append(node.left) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000470
1,642
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_006015
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
6ce22264a9c34d6addf4eff4c196105eec12b113
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = [root] head = 0 tail = 1 result = [] while head < tail: node = q[head] if node == None: result.append('null') ...
the_stack_v2_python_sparse
Serialize_and_Deserialize_Binary_Tree.py
zhubw91/Leetcode
train
0
6510d25e3ea6fd49a9e769d1be2b267e0b0585af
[ "if len(s) == 0:\n return True\nnew_s = ''.join((i.lower for i in s if i.isalnum()))\nif new_s == new_s[::-1]:\n return True\nelse:\n return False", "if len(s) == 0:\n return True\nnew_s = re.sub('[^A-Za-z0-9]', '', s)\nreturn s == s[::-1]" ]
<|body_start_0|> if len(s) == 0: return True new_s = ''.join((i.lower for i in s if i.isalnum())) if new_s == new_s[::-1]: return True else: return False <|end_body_0|> <|body_start_1|> if len(s) == 0: return True new_s = r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) == 0: return True new_s = ''.join((...
stack_v2_sparse_classes_10k_train_000471
1,110
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_001110
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - def isPalindrome(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - def isPalindrome(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, s): ...
604efd2c53c369fb262f42f7f7f31997ea4d029b
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" if len(s) == 0: return True new_s = ''.join((i.lower for i in s if i.isalnum())) if new_s == new_s[::-1]: return True else: return False def isPalindrome(self, ...
the_stack_v2_python_sparse
125_Valid_Palindrome.py
fxy1018/Leetcode
train
1
e2cb58ec1dc8e1432bfe105ed9aedef9548af49c
[ "if action_list is None:\n self.action_list = ['R', 'P', 'S']\nelse:\n self.action_list = action_list\nif payoff_matrix is None:\n self.payoff_matrix = {('R', 'P'): (0, 1), ('P', 'S'): (0, 1), ('S', 'R'): (0, 1)}\nfor action1 in self.action_list:\n for action2 in self.action_list:\n if (action1, ...
<|body_start_0|> if action_list is None: self.action_list = ['R', 'P', 'S'] else: self.action_list = action_list if payoff_matrix is None: self.payoff_matrix = {('R', 'P'): (0, 1), ('P', 'S'): (0, 1), ('S', 'R'): (0, 1)} for action1 in self.action_list...
The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on both actions. - Each round of the...
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on b...
stack_v2_sparse_classes_10k_train_000472
2,366
no_license
[ { "docstring": "Create a new game model; defaults to Rock Paper Scissors. Args: action_list: The list of actions each player may take. payoff_matrix: Dictionary with the form {(action1, action2): (payoff1, payoff2), ....} If a pair of actions don't exist: If the inverse exists, use that (assume payoff is symmet...
2
stack_v2_sparse_classes_30k_train_001310
Implement the Python class `Game` described below. Class description: The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of act...
Implement the Python class `Game` described below. Class description: The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of act...
aad981ebbc9400c795740ff5c3b1b920ec886be6
<|skeleton|> class Game: """The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on b...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Game: """The class that describes the rules of the game. Defaults to Rock Paper Scissors, but can be used to describe any game where: - Players simultaneously and independently choose an action to play. - Both players have the same fixed, constant set of actions. - Payoffs are resolved based on both actions. ...
the_stack_v2_python_sparse
David Masad/RPS/Game.py
Aarijit/css605_2012
train
0
75467b608eeb5b1e32b0066815c42b8f9c48de2e
[ "self.name = name\nself.tags = tags\nself.enabled = enabled\nself.mtype = mtype\nself.vlan = vlan\nself.voice_vlan = voice_vlan\nself.allowed_vlans = allowed_vlans\nself.poe_enabled = poe_enabled\nself.isolation_enabled = isolation_enabled\nself.rstp_enabled = rstp_enabled\nself.stp_guard = stp_guard\nself.access_p...
<|body_start_0|> self.name = name self.tags = tags self.enabled = enabled self.mtype = mtype self.vlan = vlan self.voice_vlan = voice_vlan self.allowed_vlans = allowed_vlans self.poe_enabled = poe_enabled self.isolation_enabled = isolation_enabled ...
Implementation of the 'updateDeviceSwitchPort' model. TODO: type model description here. Attributes: name (string): The name of the switch port tags (string): The tags of the switch port enabled (bool): The status of the switch port mtype (string): The type of the switch port ("access" or "trunk") vlan (int): The VLAN ...
UpdateDeviceSwitchPortModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDeviceSwitchPortModel: """Implementation of the 'updateDeviceSwitchPort' model. TODO: type model description here. Attributes: name (string): The name of the switch port tags (string): The tags of the switch port enabled (bool): The status of the switch port mtype (string): The type of the ...
stack_v2_sparse_classes_10k_train_000473
7,240
permissive
[ { "docstring": "Constructor for the UpdateDeviceSwitchPortModel class", "name": "__init__", "signature": "def __init__(self, name=None, tags=None, enabled=None, mtype=None, vlan=None, voice_vlan=None, allowed_vlans=None, poe_enabled=None, isolation_enabled=None, rstp_enabled=None, stp_guard=None, access...
2
null
Implement the Python class `UpdateDeviceSwitchPortModel` described below. Class description: Implementation of the 'updateDeviceSwitchPort' model. TODO: type model description here. Attributes: name (string): The name of the switch port tags (string): The tags of the switch port enabled (bool): The status of the switc...
Implement the Python class `UpdateDeviceSwitchPortModel` described below. Class description: Implementation of the 'updateDeviceSwitchPort' model. TODO: type model description here. Attributes: name (string): The name of the switch port tags (string): The tags of the switch port enabled (bool): The status of the switc...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateDeviceSwitchPortModel: """Implementation of the 'updateDeviceSwitchPort' model. TODO: type model description here. Attributes: name (string): The name of the switch port tags (string): The tags of the switch port enabled (bool): The status of the switch port mtype (string): The type of the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateDeviceSwitchPortModel: """Implementation of the 'updateDeviceSwitchPort' model. TODO: type model description here. Attributes: name (string): The name of the switch port tags (string): The tags of the switch port enabled (bool): The status of the switch port mtype (string): The type of the switch port (...
the_stack_v2_python_sparse
meraki/models/update_device_switch_port_model.py
RaulCatalano/meraki-python-sdk
train
1
5925875f72848916fcb282858aae0bdf3e1ab559
[ "bitmask = 0\nfor e in value:\n bitmask = bitmask | e.value\nreturn bitmask", "masks = list()\nif value:\n for e in enums.CryptographicUsageMask:\n if e.value & value:\n masks.append(e)\nreturn masks" ]
<|body_start_0|> bitmask = 0 for e in value: bitmask = bitmask | e.value return bitmask <|end_body_0|> <|body_start_1|> masks = list() if value: for e in enums.CryptographicUsageMask: if e.value & value: masks.append(e)...
Converts a list of enums.CryptographicUsageMask Enums in an integer bitmask. This allows the database to only store an integer instead of a list of enumbs. This also does the reverse of converting an integer bit mask into a list enums.CryptographicUsageMask Enums.
UsageMaskType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsageMaskType: """Converts a list of enums.CryptographicUsageMask Enums in an integer bitmask. This allows the database to only store an integer instead of a list of enumbs. This also does the reverse of converting an integer bit mask into a list enums.CryptographicUsageMask Enums.""" def pr...
stack_v2_sparse_classes_10k_train_000474
5,593
permissive
[ { "docstring": "Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL dialect", "name": "process_bind_param", "signature": "def process_bind_param(self, value, diale...
2
stack_v2_sparse_classes_30k_train_005857
Implement the Python class `UsageMaskType` described below. Class description: Converts a list of enums.CryptographicUsageMask Enums in an integer bitmask. This allows the database to only store an integer instead of a list of enumbs. This also does the reverse of converting an integer bit mask into a list enums.Crypt...
Implement the Python class `UsageMaskType` described below. Class description: Converts a list of enums.CryptographicUsageMask Enums in an integer bitmask. This allows the database to only store an integer instead of a list of enumbs. This also does the reverse of converting an integer bit mask into a list enums.Crypt...
f0a44b26ce902d8b9c330634d5b3603959edf1d4
<|skeleton|> class UsageMaskType: """Converts a list of enums.CryptographicUsageMask Enums in an integer bitmask. This allows the database to only store an integer instead of a list of enumbs. This also does the reverse of converting an integer bit mask into a list enums.CryptographicUsageMask Enums.""" def pr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UsageMaskType: """Converts a list of enums.CryptographicUsageMask Enums in an integer bitmask. This allows the database to only store an integer instead of a list of enumbs. This also does the reverse of converting an integer bit mask into a list enums.CryptographicUsageMask Enums.""" def process_bind_pa...
the_stack_v2_python_sparse
kmip/pie/sqltypes.py
OpenKMIP/PyKMIP
train
232
39365c2c3046c14a833e4408ffa54e4112c3a9bf
[ "self.n_head = n_head\nself.d_k = self.d_v = d_k = d_v = d_model // n_head\nself.dropout = dropout\nvs_layer = tf.keras.layers.Dense(d_v, use_bias=False)\nself.qs_layers = [_dense_layer(d_k, use_bias=False) for _ in range(n_head)]\nself.ks_layers = [_dense_layer(d_k, use_bias=False) for _ in range(n_head)]\nself.vs...
<|body_start_0|> self.n_head = n_head self.d_k = self.d_v = d_k = d_v = d_model // n_head self.dropout = dropout vs_layer = tf.keras.layers.Dense(d_v, use_bias=False) self.qs_layers = [_dense_layer(d_k, use_bias=False) for _ in range(n_head)] self.ks_layers = [_dense_laye...
Defines interpretable multi-head attention layer. Attributes: n_head: The number of heads for attention layer. d_k: The key and query dimensionality per head. d_v: The value dimensionality. dropout: The dropout rate to apply qs_layers: The list of query layers across heads. ks_layers: The list of key layers across head...
InterpretableMultiHeadAttention
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterpretableMultiHeadAttention: """Defines interpretable multi-head attention layer. Attributes: n_head: The number of heads for attention layer. d_k: The key and query dimensionality per head. d_v: The value dimensionality. dropout: The dropout rate to apply qs_layers: The list of query layers ...
stack_v2_sparse_classes_10k_train_000475
19,798
permissive
[ { "docstring": "Initialises layer. Args: n_head: The number of heads. d_model: The dimensionality of TFT state. dropout: The dropout rate to be applied to the output.", "name": "__init__", "signature": "def __init__(self, n_head, d_model, dropout)" }, { "docstring": "Applies interpretable multih...
2
null
Implement the Python class `InterpretableMultiHeadAttention` described below. Class description: Defines interpretable multi-head attention layer. Attributes: n_head: The number of heads for attention layer. d_k: The key and query dimensionality per head. d_v: The value dimensionality. dropout: The dropout rate to app...
Implement the Python class `InterpretableMultiHeadAttention` described below. Class description: Defines interpretable multi-head attention layer. Attributes: n_head: The number of heads for attention layer. d_k: The key and query dimensionality per head. d_v: The value dimensionality. dropout: The dropout rate to app...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class InterpretableMultiHeadAttention: """Defines interpretable multi-head attention layer. Attributes: n_head: The number of heads for attention layer. d_k: The key and query dimensionality per head. d_v: The value dimensionality. dropout: The dropout rate to apply qs_layers: The list of query layers ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InterpretableMultiHeadAttention: """Defines interpretable multi-head attention layer. Attributes: n_head: The number of heads for attention layer. d_k: The key and query dimensionality per head. d_v: The value dimensionality. dropout: The dropout rate to apply qs_layers: The list of query layers across heads....
the_stack_v2_python_sparse
saf/models/tft_layers.py
Jimmy-INL/google-research
train
1
17180925069fc4ed68eb2ef0415c0286b12ce395
[ "self._attr_name = f'{name} {SENSOR_TYPES[sensor_type][0]}'\nself.bme680_client = bme680_client\nself.temp_unit = temp_unit\nself.type = sensor_type\nself._attr_unit_of_measurement = SENSOR_TYPES[sensor_type][1]\nself._attr_device_class = SENSOR_TYPES[sensor_type][2]", "await self.hass.async_add_executor_job(self...
<|body_start_0|> self._attr_name = f'{name} {SENSOR_TYPES[sensor_type][0]}' self.bme680_client = bme680_client self.temp_unit = temp_unit self.type = sensor_type self._attr_unit_of_measurement = SENSOR_TYPES[sensor_type][1] self._attr_device_class = SENSOR_TYPES[sensor_ty...
Implementation of the BME680 sensor.
BME680Sensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BME680Sensor: """Implementation of the BME680 sensor.""" def __init__(self, bme680_client, sensor_type, temp_unit, name): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Get the latest data from the BME680 and update the states.""" ...
stack_v2_sparse_classes_10k_train_000476
13,136
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, bme680_client, sensor_type, temp_unit, name)" }, { "docstring": "Get the latest data from the BME680 and update the states.", "name": "async_update", "signature": "async def async_update(self)" ...
2
null
Implement the Python class `BME680Sensor` described below. Class description: Implementation of the BME680 sensor. Method signatures and docstrings: - def __init__(self, bme680_client, sensor_type, temp_unit, name): Initialize the sensor. - async def async_update(self): Get the latest data from the BME680 and update ...
Implement the Python class `BME680Sensor` described below. Class description: Implementation of the BME680 sensor. Method signatures and docstrings: - def __init__(self, bme680_client, sensor_type, temp_unit, name): Initialize the sensor. - async def async_update(self): Get the latest data from the BME680 and update ...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class BME680Sensor: """Implementation of the BME680 sensor.""" def __init__(self, bme680_client, sensor_type, temp_unit, name): """Initialize the sensor.""" <|body_0|> async def async_update(self): """Get the latest data from the BME680 and update the states.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BME680Sensor: """Implementation of the BME680 sensor.""" def __init__(self, bme680_client, sensor_type, temp_unit, name): """Initialize the sensor.""" self._attr_name = f'{name} {SENSOR_TYPES[sensor_type][0]}' self.bme680_client = bme680_client self.temp_unit = temp_unit ...
the_stack_v2_python_sparse
homeassistant/components/bme680/sensor.py
BenWoodford/home-assistant
train
11
c7e36edd24db6319dd4e0d8dcf0c2dd532a7ca9d
[ "req_parser = RequestParser()\nreq_parser.add_argument('target', type=parser.article_id, required=True, location='json')\nreq_parser.add_argument('Trace', type=inputs.regex('^.+$'), required=False, location='headers')\nargs = req_parser.parse_args()\ntarget = args.target\nif args.Trace:\n article = cache_article...
<|body_start_0|> req_parser = RequestParser() req_parser.add_argument('target', type=parser.article_id, required=True, location='json') req_parser.add_argument('Trace', type=inputs.regex('^.+$'), required=False, location='headers') args = req_parser.parse_args() target = args.tar...
文章收藏
CollectionListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" <|body_0|> def get(self): """获取用户的收藏历史""" <|body_1|> <|end_skeleton|> <|body_start_0|> req_parser = RequestParser() req_parser.add_argument('target', type=parser.article_id,...
stack_v2_sparse_classes_10k_train_000477
3,971
no_license
[ { "docstring": "用户收藏文章", "name": "post", "signature": "def post(self)" }, { "docstring": "获取用户的收藏历史", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_004834
Implement the Python class `CollectionListResource` described below. Class description: 文章收藏 Method signatures and docstrings: - def post(self): 用户收藏文章 - def get(self): 获取用户的收藏历史
Implement the Python class `CollectionListResource` described below. Class description: 文章收藏 Method signatures and docstrings: - def post(self): 用户收藏文章 - def get(self): 获取用户的收藏历史 <|skeleton|> class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" <|body_0|> def get(self):...
12b52f21a4ec20b4853870468c28d2385dc185a8
<|skeleton|> class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" <|body_0|> def get(self): """获取用户的收藏历史""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CollectionListResource: """文章收藏""" def post(self): """用户收藏文章""" req_parser = RequestParser() req_parser.add_argument('target', type=parser.article_id, required=True, location='json') req_parser.add_argument('Trace', type=inputs.regex('^.+$'), required=False, location='head...
the_stack_v2_python_sparse
flask_prj/tbd_42/toutiao/resources/news/collection.py
123wuyu/demo_prj
train
1
cfd67a60b14509ef84e84268f2c29e507bf2585f
[ "self._io_stream = io_stream\nself._output_format = output_format\nBase.__init__(self, **kw)", "while True:\n batch = self._batch_q.pop()\n if batch is None:\n break\n self._io_stream.write(batch.formatted_str(self._output_format))\n self._io_stream.flush()" ]
<|body_start_0|> self._io_stream = io_stream self._output_format = output_format Base.__init__(self, **kw) <|end_body_0|> <|body_start_1|> while True: batch = self._batch_q.pop() if batch is None: break self._io_stream.write(batch.form...
Output records into IO stream
IoStream
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IoStream: """Output records into IO stream""" def __init__(self, io_stream, output_format='json', **kw): """Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__...
stack_v2_sparse_classes_10k_train_000478
991
permissive
[ { "docstring": "Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__init__()`", "name": "__init__", "signature": "def __init__(self, io_stream, output_format='json', **kw)" }, ...
2
stack_v2_sparse_classes_30k_train_000361
Implement the Python class `IoStream` described below. Class description: Output records into IO stream Method signatures and docstrings: - def __init__(self, io_stream, output_format='json', **kw): Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', '...
Implement the Python class `IoStream` described below. Class description: Output records into IO stream Method signatures and docstrings: - def __init__(self, io_stream, output_format='json', **kw): Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', '...
a1e34af507b94d51ba588ad4a039ce0115b46475
<|skeleton|> class IoStream: """Output records into IO stream""" def __init__(self, io_stream, output_format='json', **kw): """Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IoStream: """Output records into IO stream""" def __init__(self, io_stream, output_format='json', **kw): """Setup ostream :param io_stream: stream to `write()` :param output_format: ouput format of each record. One of 'json', 'csv' are supported. :param **kw: passed to :func:`Base.__init__()`""" ...
the_stack_v2_python_sparse
shellstreaming/ostream/io_stream.py
laysakura/shellstreaming
train
1
a8b901effd6b802e80959fc12ed71be79a91520a
[ "expiring = parsed_args['expiring']\nif expiring:\n expiration = app.config.get('APP_SPECIFIC_TOKEN_EXPIRATION')\n token_expiration = convert_to_timedelta(expiration or _DEFAULT_TOKEN_EXPIRATION_WINDOW)\n seconds = math.ceil(token_expiration.total_seconds() * 0.1) or 1\n soon = timedelta(seconds=seconds...
<|body_start_0|> expiring = parsed_args['expiring'] if expiring: expiration = app.config.get('APP_SPECIFIC_TOKEN_EXPIRATION') token_expiration = convert_to_timedelta(expiration or _DEFAULT_TOKEN_EXPIRATION_WINDOW) seconds = math.ceil(token_expiration.total_seconds() *...
Lists all app specific tokens for a user.
AppTokens
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppTokens: """Lists all app specific tokens for a user.""" def get(self, parsed_args): """Lists the app specific tokens for the user.""" <|body_0|> def post(self): """Create a new app specific token for user.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_000479
4,648
permissive
[ { "docstring": "Lists the app specific tokens for the user.", "name": "get", "signature": "def get(self, parsed_args)" }, { "docstring": "Create a new app specific token for user.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `AppTokens` described below. Class description: Lists all app specific tokens for a user. Method signatures and docstrings: - def get(self, parsed_args): Lists the app specific tokens for the user. - def post(self): Create a new app specific token for user.
Implement the Python class `AppTokens` described below. Class description: Lists all app specific tokens for a user. Method signatures and docstrings: - def get(self, parsed_args): Lists the app specific tokens for the user. - def post(self): Create a new app specific token for user. <|skeleton|> class AppTokens: ...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class AppTokens: """Lists all app specific tokens for a user.""" def get(self, parsed_args): """Lists the app specific tokens for the user.""" <|body_0|> def post(self): """Create a new app specific token for user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AppTokens: """Lists all app specific tokens for a user.""" def get(self, parsed_args): """Lists the app specific tokens for the user.""" expiring = parsed_args['expiring'] if expiring: expiration = app.config.get('APP_SPECIFIC_TOKEN_EXPIRATION') token_expir...
the_stack_v2_python_sparse
endpoints/api/appspecifictokens.py
quay/quay
train
2,363
fdd48b6bd749fb056c73f66fede65c9650111c22
[ "self.browser.get(self.live_server_url)\nnavbar = self.browser.find_element_by_id('id_navigation')\nself.assertTrue(len(navbar.find_elements_by_link_text('Superlists')) > 0)\nself.assertEqual(navbar.find_elements_by_link_text('应用'), [])\nself.assertEqual(navbar.find_elements_by_link_text('账单'), [])", "self.goto_b...
<|body_start_0|> self.browser.get(self.live_server_url) navbar = self.browser.find_element_by_id('id_navigation') self.assertTrue(len(navbar.find_elements_by_link_text('Superlists')) > 0) self.assertEqual(navbar.find_elements_by_link_text('应用'), []) self.assertEqual(navbar.find_e...
BillPageTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BillPageTest: def test_001(self): """未登录用户看不到 "应用" 菜单""" <|body_0|> def test_002(self): """进入账单页面,查看标题和表单""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.browser.get(self.live_server_url) navbar = self.browser.find_element_by_id('id_nav...
stack_v2_sparse_classes_10k_train_000480
2,050
no_license
[ { "docstring": "未登录用户看不到 \"应用\" 菜单", "name": "test_001", "signature": "def test_001(self)" }, { "docstring": "进入账单页面,查看标题和表单", "name": "test_002", "signature": "def test_002(self)" } ]
2
stack_v2_sparse_classes_30k_train_005898
Implement the Python class `BillPageTest` described below. Class description: Implement the BillPageTest class. Method signatures and docstrings: - def test_001(self): 未登录用户看不到 "应用" 菜单 - def test_002(self): 进入账单页面,查看标题和表单
Implement the Python class `BillPageTest` described below. Class description: Implement the BillPageTest class. Method signatures and docstrings: - def test_001(self): 未登录用户看不到 "应用" 菜单 - def test_002(self): 进入账单页面,查看标题和表单 <|skeleton|> class BillPageTest: def test_001(self): """未登录用户看不到 "应用" 菜单""" ...
973b3afb239db5f55cb52897e7a8a241a459349f
<|skeleton|> class BillPageTest: def test_001(self): """未登录用户看不到 "应用" 菜单""" <|body_0|> def test_002(self): """进入账单页面,查看标题和表单""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BillPageTest: def test_001(self): """未登录用户看不到 "应用" 菜单""" self.browser.get(self.live_server_url) navbar = self.browser.find_element_by_id('id_navigation') self.assertTrue(len(navbar.find_elements_by_link_text('Superlists')) > 0) self.assertEqual(navbar.find_elements_by_l...
the_stack_v2_python_sparse
functional_tests/test_bills/test_bill_page.py
aaluo001/superlists
train
0
0cb680548459736603a9c09d9f8286f44d899cdc
[ "if key in ['predict_proba', 'decision_function']:\n key = 'predict'\nreturn super().get_args(key=key, obj=obj, deepcopy_args=deepcopy_args)", "def get_tag(obj, tag_name):\n if isclass(obj):\n return obj.get_class_tag(tag_name)\n else:\n return obj.get_tag(tag_name)\nregr_or_classf = (BaseC...
<|body_start_0|> if key in ['predict_proba', 'decision_function']: key = 'predict' return super().get_args(key=key, obj=obj, deepcopy_args=deepcopy_args) <|end_body_0|> <|body_start_1|> def get_tag(obj, tag_name): if isclass(obj): return obj.get_class_tag...
Generic test scenario for classifiers.
ClassifierTestScenario
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassifierTestScenario: """Generic test scenario for classifiers.""" def get_args(self, key, obj=None, deepcopy_args=True): """Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[ke...
stack_v2_sparse_classes_10k_train_000481
7,126
permissive
[ { "docstring": "Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[key] = x without deepcopying self.args first Parameters ---------- key : str, argument key to construct/retrieve args for obj : obj, optional...
2
null
Implement the Python class `ClassifierTestScenario` described below. Class description: Generic test scenario for classifiers. Method signatures and docstrings: - def get_args(self, key, obj=None, deepcopy_args=True): Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any ...
Implement the Python class `ClassifierTestScenario` described below. Class description: Generic test scenario for classifiers. Method signatures and docstrings: - def get_args(self, key, obj=None, deepcopy_args=True): Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any ...
70b2bfaaa597eb31bc3a1032366dcc0e1f4c8a9f
<|skeleton|> class ClassifierTestScenario: """Generic test scenario for classifiers.""" def get_args(self, key, obj=None, deepcopy_args=True): """Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[ke...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ClassifierTestScenario: """Generic test scenario for classifiers.""" def get_args(self, key, obj=None, deepcopy_args=True): """Return args for key. Can be overridden for dynamic arg generation. If overridden, must not have any side effects on self.args e.g., avoid assignments args[key] = x withou...
the_stack_v2_python_sparse
sktime/utils/_testing/scenarios_classification.py
sktime/sktime
train
1,117
f8028f9fbedd6475467cb4383864cfb7320cd2ec
[ "self._config = config\nself._config_entry = config_entry\nself.device_id = device_id\nself.discovery_data = discovery_data\nself.hass = hass\nself._sub_state: dict[str, EntitySubscription] | None = None\nself._value_template = MqttValueTemplate(config.get(CONF_VALUE_TEMPLATE), hass=self.hass).async_render_with_pos...
<|body_start_0|> self._config = config self._config_entry = config_entry self.device_id = device_id self.discovery_data = discovery_data self.hass = hass self._sub_state: dict[str, EntitySubscription] | None = None self._value_template = MqttValueTemplate(config.g...
MQTT Tag scanner.
MQTTTagScanner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MQTTTagScanner: """MQTT Tag scanner.""" def __init__(self, hass: HomeAssistant, config: ConfigType, device_id: str | None, discovery_data: DiscoveryInfoType, config_entry: ConfigEntry) -> None: """Initialize.""" <|body_0|> async def async_update(self, discovery_data: MQT...
stack_v2_sparse_classes_10k_train_000482
5,499
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, config: ConfigType, device_id: str | None, discovery_data: DiscoveryInfoType, config_entry: ConfigEntry) -> None" }, { "docstring": "Handle MQTT tag discovery updates.", "name": "async_upd...
4
null
Implement the Python class `MQTTTagScanner` described below. Class description: MQTT Tag scanner. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, config: ConfigType, device_id: str | None, discovery_data: DiscoveryInfoType, config_entry: ConfigEntry) -> None: Initialize. - async def async_...
Implement the Python class `MQTTTagScanner` described below. Class description: MQTT Tag scanner. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, config: ConfigType, device_id: str | None, discovery_data: DiscoveryInfoType, config_entry: ConfigEntry) -> None: Initialize. - async def async_...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class MQTTTagScanner: """MQTT Tag scanner.""" def __init__(self, hass: HomeAssistant, config: ConfigType, device_id: str | None, discovery_data: DiscoveryInfoType, config_entry: ConfigEntry) -> None: """Initialize.""" <|body_0|> async def async_update(self, discovery_data: MQT...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MQTTTagScanner: """MQTT Tag scanner.""" def __init__(self, hass: HomeAssistant, config: ConfigType, device_id: str | None, discovery_data: DiscoveryInfoType, config_entry: ConfigEntry) -> None: """Initialize.""" self._config = config self._config_entry = config_entry self....
the_stack_v2_python_sparse
homeassistant/components/mqtt/tag.py
home-assistant/core
train
35,501
277dd2c2997935969ff24de53b6f84f65d796bd9
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Ad service. Service to manage ads.
AdServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdServiceServicer: """Proto file describing the Ad service. Service to manage ads.""" def GetAd(self, request, context): """Returns the requested ad in full detail.""" <|body_0|> def MutateAds(self, request, context): """Updates ads. Operation statuses are return...
stack_v2_sparse_classes_10k_train_000483
2,941
permissive
[ { "docstring": "Returns the requested ad in full detail.", "name": "GetAd", "signature": "def GetAd(self, request, context)" }, { "docstring": "Updates ads. Operation statuses are returned.", "name": "MutateAds", "signature": "def MutateAds(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_val_000260
Implement the Python class `AdServiceServicer` described below. Class description: Proto file describing the Ad service. Service to manage ads. Method signatures and docstrings: - def GetAd(self, request, context): Returns the requested ad in full detail. - def MutateAds(self, request, context): Updates ads. Operatio...
Implement the Python class `AdServiceServicer` described below. Class description: Proto file describing the Ad service. Service to manage ads. Method signatures and docstrings: - def GetAd(self, request, context): Returns the requested ad in full detail. - def MutateAds(self, request, context): Updates ads. Operatio...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class AdServiceServicer: """Proto file describing the Ad service. Service to manage ads.""" def GetAd(self, request, context): """Returns the requested ad in full detail.""" <|body_0|> def MutateAds(self, request, context): """Updates ads. Operation statuses are return...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdServiceServicer: """Proto file describing the Ad service. Service to manage ads.""" def GetAd(self, request, context): """Returns the requested ad in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotI...
the_stack_v2_python_sparse
google/ads/google_ads/v3/proto/services/ad_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
09819c575296574bf10ed2136dbc6862aa5f99c6
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SynchronizationJobRestartCriteria()", "from .synchronization_job_restart_scope import SynchronizationJobRestartScope\nfrom .synchronization_job_restart_scope import SynchronizationJobRestartScope\nfields: Dict[str, Callable[[Any], None...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return SynchronizationJobRestartCriteria() <|end_body_0|> <|body_start_1|> from .synchronization_job_restart_scope import SynchronizationJobRestartScope from .synchronization_job_restart_scope ...
SynchronizationJobRestartCriteria
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SynchronizationJobRestartCriteria: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_10k_train_000484
3,964
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SynchronizationJobRestartCriteria", "name": "create_from_discriminator_value", "signature": "def create_from...
3
null
Implement the Python class `SynchronizationJobRestartCriteria` described below. Class description: Implement the SynchronizationJobRestartCriteria class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: Creates a new in...
Implement the Python class `SynchronizationJobRestartCriteria` described below. Class description: Implement the SynchronizationJobRestartCriteria class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: Creates a new in...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class SynchronizationJobRestartCriteria: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discrimin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SynchronizationJobRestartCriteria: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SynchronizationJobRestartCriteria: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and...
the_stack_v2_python_sparse
msgraph/generated/models/synchronization_job_restart_criteria.py
microsoftgraph/msgraph-sdk-python
train
135
897028f25efced9aedd4c5848e44158771dffe22
[ "self.l = nums\nself.n = k\nself.last = -sys.maxsize - 1", "k = self.n\nself.l.append(val)\n\ndef quickSelect(arr, k):\n big = []\n small = []\n piv = random.randint(0, len(arr) - 1)\n temp = arr[piv]\n for i, x in enumerate(arr):\n if i == piv:\n continue\n if x > temp:\n ...
<|body_start_0|> self.l = nums self.n = k self.last = -sys.maxsize - 1 <|end_body_0|> <|body_start_1|> k = self.n self.l.append(val) def quickSelect(arr, k): big = [] small = [] piv = random.randint(0, len(arr) - 1) temp =...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.l = nums self.n = k self.last = -sys....
stack_v2_sparse_classes_10k_train_000485
1,125
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_test_000240
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
de8f9e7a7c45e325ac0de43a4e1f711a7c6a0a0c
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.l = nums self.n = k self.last = -sys.maxsize - 1 def add(self, val): """:type val: int :rtype: int""" k = self.n self.l.append(val) def quickSelect(arr, ...
the_stack_v2_python_sparse
KthLargest.py
unsortedtosorted/codeChallenges
train
0
157dffc9b5668b4527b22df7076f75ed2d7d478b
[ "try:\n self.db = pymysql.connect(host=host, port=port, user=username, password=password)\n self.cursor = self.db.cursor()\nexcept pymysql.MySQLError as e:\n print(e.args)", "keys = ', '.join(data.keys())\nvalues = ', '.join(['%s'] * len(data))\nsql_query = 'insert into {table} values {keys} {values}'.fo...
<|body_start_0|> try: self.db = pymysql.connect(host=host, port=port, user=username, password=password) self.cursor = self.db.cursor() except pymysql.MySQLError as e: print(e.args) <|end_body_0|> <|body_start_1|> keys = ', '.join(data.keys()) values =...
MySQL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQL: def __init__(self, host=MYSQL_HOST, port=MYSQL_PORT, username=MYSQL_USER, password=MYSQL_PASSWORD, database=MYSQL_DATABASE): """MySQL初始化 :param host: :param port: :param username: :param password: :param database:""" <|body_0|> def insert(self, table, data): "...
stack_v2_sparse_classes_10k_train_000486
1,476
no_license
[ { "docstring": "MySQL初始化 :param host: :param port: :param username: :param password: :param database:", "name": "__init__", "signature": "def __init__(self, host=MYSQL_HOST, port=MYSQL_PORT, username=MYSQL_USER, password=MYSQL_PASSWORD, database=MYSQL_DATABASE)" }, { "docstring": "插入数据 :param ta...
2
stack_v2_sparse_classes_30k_train_004704
Implement the Python class `MySQL` described below. Class description: Implement the MySQL class. Method signatures and docstrings: - def __init__(self, host=MYSQL_HOST, port=MYSQL_PORT, username=MYSQL_USER, password=MYSQL_PASSWORD, database=MYSQL_DATABASE): MySQL初始化 :param host: :param port: :param username: :param ...
Implement the Python class `MySQL` described below. Class description: Implement the MySQL class. Method signatures and docstrings: - def __init__(self, host=MYSQL_HOST, port=MYSQL_PORT, username=MYSQL_USER, password=MYSQL_PASSWORD, database=MYSQL_DATABASE): MySQL初始化 :param host: :param port: :param username: :param ...
916a3269cb3946f33bc87b289c5f20f26c265436
<|skeleton|> class MySQL: def __init__(self, host=MYSQL_HOST, port=MYSQL_PORT, username=MYSQL_USER, password=MYSQL_PASSWORD, database=MYSQL_DATABASE): """MySQL初始化 :param host: :param port: :param username: :param password: :param database:""" <|body_0|> def insert(self, table, data): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MySQL: def __init__(self, host=MYSQL_HOST, port=MYSQL_PORT, username=MYSQL_USER, password=MYSQL_PASSWORD, database=MYSQL_DATABASE): """MySQL初始化 :param host: :param port: :param username: :param password: :param database:""" try: self.db = pymysql.connect(host=host, port=port, user=...
the_stack_v2_python_sparse
Python3网络爬虫开发实战/chapter9/section5/mysql.py
daedalaus/practice
train
0
8cc3d2a0a40aab6a66ce02735a4793bc068c1808
[ "if not callable(func):\n raise TypeError('func must be callable')\nwith suppress(TypeError):\n sig = inspect.signature(func)\n kinds = [x.kind for x in sig.parameters.values()]\n if len((x for x in kinds if x == sig.POSITIONAL_ONLY)) != 2 and sig.VAR_POSITIONAL not in kinds:\n raise ValueError('...
<|body_start_0|> if not callable(func): raise TypeError('func must be callable') with suppress(TypeError): sig = inspect.signature(func) kinds = [x.kind for x in sig.parameters.values()] if len((x for x in kinds if x == sig.POSITIONAL_ONLY)) != 2 and sig.V...
A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : class The coordinate frame class to start...
DataTransform
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataTransform: """A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : ...
stack_v2_sparse_classes_10k_train_000487
12,601
permissive
[ { "docstring": "Create a data transformer.", "name": "__init__", "signature": "def __init__(self, func: T.Callable, fromtype, totype, priority: int=1, register_graph=None, func_args: T.Optional[T.Sequence]=None, func_kwargs: T.Optional[T.Mapping]=None)" }, { "docstring": "Run transformation. Par...
2
stack_v2_sparse_classes_30k_train_006113
Implement the Python class `DataTransform` described below. Class description: A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fr...
Implement the Python class `DataTransform` described below. Class description: A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fr...
17984942145d31126724df23500bafba18fb7516
<|skeleton|> class DataTransform: """A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataTransform: """A transformation defined by a function. A transformation defined by a function that accepts a type and returns the transformed object. Parameters ---------- func : callable The transformation function. Should have a call signature ``func(fromdata, *args, **kwargs)``. fromtype : class The coo...
the_stack_v2_python_sparse
utilipy/data_utils/xfm/transformations.py
nstarman/utilipy
train
2
2a56771e62894f6e7641f749f15d054604071868
[ "maintenance_requests = request.env['maintenance.equipment'].sudo().search([])\nmaintenance_team = request.env['maintenance.team'].sudo().search([])\nuser = request.env.user.id\nemployee = request.env['hr.employee'].sudo().search([('user_id', '=', user)])\nrequest_dict = []\nteam_name = []\nfor record in maintenanc...
<|body_start_0|> maintenance_requests = request.env['maintenance.equipment'].sudo().search([]) maintenance_team = request.env['maintenance.team'].sudo().search([]) user = request.env.user.id employee = request.env['hr.employee'].sudo().search([('user_id', '=', user)]) request_dic...
MaintenanceRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaintenanceRequest: def request(self, **post): """Browses all maintenance teams and equipments in backend and returns them to the web page""" <|body_0|> def send_request(self, **post): """Searches for related employee of the currently logged in user. The maintenance ...
stack_v2_sparse_classes_10k_train_000488
3,467
no_license
[ { "docstring": "Browses all maintenance teams and equipments in backend and returns them to the web page", "name": "request", "signature": "def request(self, **post)" }, { "docstring": "Searches for related employee of the currently logged in user. The maintenance request is only created if the ...
2
stack_v2_sparse_classes_30k_test_000104
Implement the Python class `MaintenanceRequest` described below. Class description: Implement the MaintenanceRequest class. Method signatures and docstrings: - def request(self, **post): Browses all maintenance teams and equipments in backend and returns them to the web page - def send_request(self, **post): Searches...
Implement the Python class `MaintenanceRequest` described below. Class description: Implement the MaintenanceRequest class. Method signatures and docstrings: - def request(self, **post): Browses all maintenance teams and equipments in backend and returns them to the web page - def send_request(self, **post): Searches...
bb6453404e4f28060643f23c1c6311587f7d2925
<|skeleton|> class MaintenanceRequest: def request(self, **post): """Browses all maintenance teams and equipments in backend and returns them to the web page""" <|body_0|> def send_request(self, **post): """Searches for related employee of the currently logged in user. The maintenance ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MaintenanceRequest: def request(self, **post): """Browses all maintenance teams and equipments in backend and returns them to the web page""" maintenance_requests = request.env['maintenance.equipment'].sudo().search([]) maintenance_team = request.env['maintenance.team'].sudo().search([...
the_stack_v2_python_sparse
website_maintenance_hr/controllers/controllers.py
aaltinisik/CybroAddons
train
1
a970b507741bcd2b7bd2659887c6c90985b6b7c5
[ "super(AlternatingCoattention, self).__init__()\nself.n_entities = 1 if weight_tying else 2\nwith self.init_scope():\n self.energy_layers_1 = chainer.ChainList(*[GraphLinear(hidden_dim + out_dim, head) for _ in range(self.n_entities)])\n self.energy_layers_2 = chainer.ChainList(*[GraphLinear(head, 1)])\n s...
<|body_start_0|> super(AlternatingCoattention, self).__init__() self.n_entities = 1 if weight_tying else 2 with self.init_scope(): self.energy_layers_1 = chainer.ChainList(*[GraphLinear(hidden_dim + out_dim, head) for _ in range(self.n_entities)]) self.energy_layers_2 = c...
AlternatingCoattention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlternatingCoattention: def __init__(self, hidden_dim, out_dim, head, weight_tying=False): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism :param weight_tying: indicate whethe...
stack_v2_sparse_classes_10k_train_000489
3,771
permissive
[ { "docstring": ":param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism :param weight_tying: indicate whether the weights should be shared between two attention computation", "name": "__init__", "signat...
3
stack_v2_sparse_classes_30k_train_002124
Implement the Python class `AlternatingCoattention` described below. Class description: Implement the AlternatingCoattention class. Method signatures and docstrings: - def __init__(self, hidden_dim, out_dim, head, weight_tying=False): :param hidden_dim: dimension of atom representation :param out_dim: dimension of mo...
Implement the Python class `AlternatingCoattention` described below. Class description: Implement the AlternatingCoattention class. Method signatures and docstrings: - def __init__(self, hidden_dim, out_dim, head, weight_tying=False): :param hidden_dim: dimension of atom representation :param out_dim: dimension of mo...
21b64a3c8cc9bc33718ae09c65aa917e575132eb
<|skeleton|> class AlternatingCoattention: def __init__(self, hidden_dim, out_dim, head, weight_tying=False): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism :param weight_tying: indicate whethe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AlternatingCoattention: def __init__(self, hidden_dim, out_dim, head, weight_tying=False): """:param hidden_dim: dimension of atom representation :param out_dim: dimension of molecular representation :param head: number of heads in attention mechanism :param weight_tying: indicate whether the weights ...
the_stack_v2_python_sparse
models/coattention/alternating_coattention.py
Minys233/GCN-BMP
train
1
71831eecd77d756deea680897f41eca739677182
[ "super(DjangoThread, self).__init__()\nself.options = {'host': 'localhost', 'port': 8888, 'threads': 10, 'request_queue_size': 15}\nself.options.update(**kwargs)\nself.setDaemon(True)", "server = CherryPyWSGIServer((self.options['host'], int(self.options['port'])), WSGIPathInfoDispatcher({'/': WSGIHandler(), sett...
<|body_start_0|> super(DjangoThread, self).__init__() self.options = {'host': 'localhost', 'port': 8888, 'threads': 10, 'request_queue_size': 15} self.options.update(**kwargs) self.setDaemon(True) <|end_body_0|> <|body_start_1|> server = CherryPyWSGIServer((self.options['host'],...
Django server control thread.
DjangoThread
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DjangoThread: """Django server control thread.""" def __init__(self, **kwargs): """Initialize CherryPy Django web server.""" <|body_0|> def run(self): """Launch CherryPy Django web server.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Dj...
stack_v2_sparse_classes_10k_train_000490
1,311
permissive
[ { "docstring": "Initialize CherryPy Django web server.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Launch CherryPy Django web server.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_003439
Implement the Python class `DjangoThread` described below. Class description: Django server control thread. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize CherryPy Django web server. - def run(self): Launch CherryPy Django web server.
Implement the Python class `DjangoThread` described below. Class description: Django server control thread. Method signatures and docstrings: - def __init__(self, **kwargs): Initialize CherryPy Django web server. - def run(self): Launch CherryPy Django web server. <|skeleton|> class DjangoThread: """Django serve...
7461d5eadc5fbaa0fa5a4121597bf9a7c20453a4
<|skeleton|> class DjangoThread: """Django server control thread.""" def __init__(self, **kwargs): """Initialize CherryPy Django web server.""" <|body_0|> def run(self): """Launch CherryPy Django web server.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DjangoThread: """Django server control thread.""" def __init__(self, **kwargs): """Initialize CherryPy Django web server.""" super(DjangoThread, self).__init__() self.options = {'host': 'localhost', 'port': 8888, 'threads': 10, 'request_queue_size': 15} self.options.update...
the_stack_v2_python_sparse
djangodevtools/wsgitest/djangoserver.py
adamhaney/djangodevtools
train
0
85f596e6c859893db0d0019b8ffb20508bf7ef9e
[ "if isinstance(item, cls):\n return item\nif not type(item) in (str, int):\n raise TypeError(f'Source type ({type(item)}) for casting not handled.')\nfor i in list(cls):\n if i == item:\n return i\nif silent_fail:\n return None\nraise ValueError(f'`{cls.__qualname__}` casting failed. Item: {item}...
<|body_start_0|> if isinstance(item, cls): return item if not type(item) in (str, int): raise TypeError(f'Source type ({type(item)}) for casting not handled.') for i in list(cls): if i == item: return i if silent_fail: retur...
Mixin for some extend enum functionality.
FlagEnumMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlagEnumMixin: """Mixin for some extend enum functionality.""" def cast(cls, item: Union[str, int], *, silent_fail=False): """Cast ``item`` to the corresponding :class:`FlagEnumMixin`. ``item`` can only be either ``code`` (:class:`str`) or ``name`` (:class:`int`). If ``silent_fail`` ...
stack_v2_sparse_classes_10k_train_000491
11,828
permissive
[ { "docstring": "Cast ``item`` to the corresponding :class:`FlagEnumMixin`. ``item`` can only be either ``code`` (:class:`str`) or ``name`` (:class:`int`). If ``silent_fail`` is ``True``, returns ``None`` if not found. Otherwise, raises :class:`ValueError`. :param item: item to be casted :param silent_fail: if t...
2
stack_v2_sparse_classes_30k_train_001352
Implement the Python class `FlagEnumMixin` described below. Class description: Mixin for some extend enum functionality. Method signatures and docstrings: - def cast(cls, item: Union[str, int], *, silent_fail=False): Cast ``item`` to the corresponding :class:`FlagEnumMixin`. ``item`` can only be either ``code`` (:cla...
Implement the Python class `FlagEnumMixin` described below. Class description: Mixin for some extend enum functionality. Method signatures and docstrings: - def cast(cls, item: Union[str, int], *, silent_fail=False): Cast ``item`` to the corresponding :class:`FlagEnumMixin`. ``item`` can only be either ``code`` (:cla...
c7da1e91783dce3a2b71b955b3a22b68db9056cf
<|skeleton|> class FlagEnumMixin: """Mixin for some extend enum functionality.""" def cast(cls, item: Union[str, int], *, silent_fail=False): """Cast ``item`` to the corresponding :class:`FlagEnumMixin`. ``item`` can only be either ``code`` (:class:`str`) or ``name`` (:class:`int`). If ``silent_fail`` ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FlagEnumMixin: """Mixin for some extend enum functionality.""" def cast(cls, item: Union[str, int], *, silent_fail=False): """Cast ``item`` to the corresponding :class:`FlagEnumMixin`. ``item`` can only be either ``code`` (:class:`str`) or ``name`` (:class:`int`). If ``silent_fail`` is ``True``, ...
the_stack_v2_python_sparse
extutils/flags/main.py
RxJellyBot/Jelly-Bot
train
5
f36544964ab2a32eec870eed70a41fc7979871be
[ "super().parse_command_line(argv)\nself.build_kernel_argv(self.extra_args)\nself.filenames_to_run = self.extra_args[:]", "self.log.debug('jupyter run: initialize...')\nsuper().initialize(argv)\nJupyterConsoleApp.initialize(self)\nsignal.signal(signal.SIGINT, self.handle_sigint)\nself.init_kernel_info()", "if se...
<|body_start_0|> super().parse_command_line(argv) self.build_kernel_argv(self.extra_args) self.filenames_to_run = self.extra_args[:] <|end_body_0|> <|body_start_1|> self.log.debug('jupyter run: initialize...') super().initialize(argv) JupyterConsoleApp.initialize(self) ...
An Jupyter Console app to run files.
RunApp
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunApp: """An Jupyter Console app to run files.""" def parse_command_line(self, argv=None): """Parse the command line arguments.""" <|body_0|> def initialize(self, argv=None): """Initialize the app.""" <|body_1|> def handle_sigint(self, *args): ...
stack_v2_sparse_classes_10k_train_000492
4,496
permissive
[ { "docstring": "Parse the command line arguments.", "name": "parse_command_line", "signature": "def parse_command_line(self, argv=None)" }, { "docstring": "Initialize the app.", "name": "initialize", "signature": "def initialize(self, argv=None)" }, { "docstring": "Handle SIGINT....
5
null
Implement the Python class `RunApp` described below. Class description: An Jupyter Console app to run files. Method signatures and docstrings: - def parse_command_line(self, argv=None): Parse the command line arguments. - def initialize(self, argv=None): Initialize the app. - def handle_sigint(self, *args): Handle SI...
Implement the Python class `RunApp` described below. Class description: An Jupyter Console app to run files. Method signatures and docstrings: - def parse_command_line(self, argv=None): Parse the command line arguments. - def initialize(self, argv=None): Initialize the app. - def handle_sigint(self, *args): Handle SI...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class RunApp: """An Jupyter Console app to run files.""" def parse_command_line(self, argv=None): """Parse the command line arguments.""" <|body_0|> def initialize(self, argv=None): """Initialize the app.""" <|body_1|> def handle_sigint(self, *args): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RunApp: """An Jupyter Console app to run files.""" def parse_command_line(self, argv=None): """Parse the command line arguments.""" super().parse_command_line(argv) self.build_kernel_argv(self.extra_args) self.filenames_to_run = self.extra_args[:] def initialize(self,...
the_stack_v2_python_sparse
contrib/python/jupyter-client/py3/jupyter_client/runapp.py
catboost/catboost
train
8,012
11ef01f03025f4049d8a9c4b631680f48a632216
[ "self.operands: List[Operand] = list(operands)\nfor i in range(len(self.operands)):\n self.operands[i] = Operand.validate_operand(self.operands[i])\nsuper().__init__()", "incomplete_expression = False\nfor operand in self.operands:\n if not issubclass(type(operand), Operand):\n raise RuntimeError(f'O...
<|body_start_0|> self.operands: List[Operand] = list(operands) for i in range(len(self.operands)): self.operands[i] = Operand.validate_operand(self.operands[i]) super().__init__() <|end_body_0|> <|body_start_1|> incomplete_expression = False for operand in self.opera...
And operator class for filtering JumpStart content.
And
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class And: """And operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates And object. Args: operand (Operand): Operand for And-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_000493
16,623
permissive
[ { "docstring": "Instantiates And object. Args: operand (Operand): Operand for And-ing. Raises: RuntimeError: If the operands cannot be validated.", "name": "__init__", "signature": "def __init__(self, *operands: Union[Operand, str]) -> None" }, { "docstring": "Evaluates operator. Raises: Runtime...
3
null
Implement the Python class `And` described below. Class description: And operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates And object. Args: operand (Operand): Operand for And-ing. Raises: RuntimeError: If the o...
Implement the Python class `And` described below. Class description: And operator class for filtering JumpStart content. Method signatures and docstrings: - def __init__(self, *operands: Union[Operand, str]) -> None: Instantiates And object. Args: operand (Operand): Operand for And-ing. Raises: RuntimeError: If the o...
8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85
<|skeleton|> class And: """And operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates And object. Args: operand (Operand): Operand for And-ing. Raises: RuntimeError: If the operands cannot be validated.""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class And: """And operator class for filtering JumpStart content.""" def __init__(self, *operands: Union[Operand, str]) -> None: """Instantiates And object. Args: operand (Operand): Operand for And-ing. Raises: RuntimeError: If the operands cannot be validated.""" self.operands: List[Operand] =...
the_stack_v2_python_sparse
src/sagemaker/jumpstart/filters.py
aws/sagemaker-python-sdk
train
2,050
03616a4e5e7c906570b129961e8c5d71c38bce50
[ "self.created_at = created_at\nself.id = id\nself.is_nfs_interface = is_nfs_interface\nself.is_smb_interface = is_smb_interface\nself.name = name\nself.protocols = protocols\nself.used_bytes = used_bytes\nself.uuid = uuid", "if dictionary is None:\n return None\ncreated_at = dictionary.get('createdAt')\nid = d...
<|body_start_0|> self.created_at = created_at self.id = id self.is_nfs_interface = is_nfs_interface self.is_smb_interface = is_smb_interface self.name = name self.protocols = protocols self.used_bytes = used_bytes self.uuid = uuid <|end_body_0|> <|body_st...
Implementation of the 'ElastifileContainer' model. Specifies information about container in an Elastifile Cluster. Attributes: created_at (string): Specifies the creation date of the container. id (int): Specifies id of a Elastifile Container in a Cluster. is_nfs_interface (bool): Specifies if the container has NFS vol...
ElastifileContainer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElastifileContainer: """Implementation of the 'ElastifileContainer' model. Specifies information about container in an Elastifile Cluster. Attributes: created_at (string): Specifies the creation date of the container. id (int): Specifies id of a Elastifile Container in a Cluster. is_nfs_interface...
stack_v2_sparse_classes_10k_train_000494
3,291
permissive
[ { "docstring": "Constructor for the ElastifileContainer class", "name": "__init__", "signature": "def __init__(self, created_at=None, id=None, is_nfs_interface=None, is_smb_interface=None, name=None, protocols=None, used_bytes=None, uuid=None)" }, { "docstring": "Creates an instance of this mode...
2
null
Implement the Python class `ElastifileContainer` described below. Class description: Implementation of the 'ElastifileContainer' model. Specifies information about container in an Elastifile Cluster. Attributes: created_at (string): Specifies the creation date of the container. id (int): Specifies id of a Elastifile C...
Implement the Python class `ElastifileContainer` described below. Class description: Implementation of the 'ElastifileContainer' model. Specifies information about container in an Elastifile Cluster. Attributes: created_at (string): Specifies the creation date of the container. id (int): Specifies id of a Elastifile C...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ElastifileContainer: """Implementation of the 'ElastifileContainer' model. Specifies information about container in an Elastifile Cluster. Attributes: created_at (string): Specifies the creation date of the container. id (int): Specifies id of a Elastifile Container in a Cluster. is_nfs_interface...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ElastifileContainer: """Implementation of the 'ElastifileContainer' model. Specifies information about container in an Elastifile Cluster. Attributes: created_at (string): Specifies the creation date of the container. id (int): Specifies id of a Elastifile Container in a Cluster. is_nfs_interface (bool): Spec...
the_stack_v2_python_sparse
cohesity_management_sdk/models/elastifile_container.py
cohesity/management-sdk-python
train
24
cb368d801f1cc91c9ca65f339cca370141865b41
[ "self.path = path\nself.fileName = path + filename\nif not os.path.exists(self.path):\n os.makedirs(self.path)\nself.logger = logging.getLogger('PLANHEAT')\nself.logger.setLevel('DEBUG')\nself.filehandler = logging.FileHandler(self.fileName)\nself.filehandler.setLevel(logging_level)\nstreamformatter = logging.Fo...
<|body_start_0|> self.path = path self.fileName = path + filename if not os.path.exists(self.path): os.makedirs(self.path) self.logger = logging.getLogger('PLANHEAT') self.logger.setLevel('DEBUG') self.filehandler = logging.FileHandler(self.fileName) s...
Python Logger API Control level, formatting and output handlers for logger
Logger
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: """Python Logger API Control level, formatting and output handlers for logger""" def __init__(self, path, filename, logging_level): """logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level""" <|bod...
stack_v2_sparse_classes_10k_train_000495
3,218
permissive
[ { "docstring": "logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level", "name": "__init__", "signature": "def __init__(self, path, filename, logging_level)" }, { "docstring": "Write Message in Log file :param level str: level...
2
stack_v2_sparse_classes_30k_train_006938
Implement the Python class `Logger` described below. Class description: Python Logger API Control level, formatting and output handlers for logger Method signatures and docstrings: - def __init__(self, path, filename, logging_level): logger Constructor :param path str:path of log file :param fileName str: name of log...
Implement the Python class `Logger` described below. Class description: Python Logger API Control level, formatting and output handlers for logger Method signatures and docstrings: - def __init__(self, path, filename, logging_level): logger Constructor :param path str:path of log file :param fileName str: name of log...
9764fcb86d3898b232c4cc333dab75ebe41cd421
<|skeleton|> class Logger: """Python Logger API Control level, formatting and output handlers for logger""" def __init__(self, path, filename, logging_level): """logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level""" <|bod...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Logger: """Python Logger API Control level, formatting and output handlers for logger""" def __init__(self, path, filename, logging_level): """logger Constructor :param path str:path of log file :param fileName str: name of log file :param fileName str: Control level""" self.path = path ...
the_stack_v2_python_sparse
PlanheatMappingModule/PlanHeatDMM/manageLog/logger.py
Planheat/Planheat-Tool
train
2
d3b5daa677faa8560d7471e25695676446ec9b57
[ "super(ConvertVideoTask, self).__init__(*args, **kwargs)\nself.setOption('videoArgs', self.__defaultVideoArgs)\nself.setOption('audioArgs', self.__defaultAudioArgs)\nself.setOption('bitRate', self.__defaultBitRate)", "videoArgs = self.option('videoArgs')\naudioArgs = self.option('audioArgs')\nbitRate = self.optio...
<|body_start_0|> super(ConvertVideoTask, self).__init__(*args, **kwargs) self.setOption('videoArgs', self.__defaultVideoArgs) self.setOption('audioArgs', self.__defaultAudioArgs) self.setOption('bitRate', self.__defaultBitRate) <|end_body_0|> <|body_start_1|> videoArgs = self.op...
Convert a video using ffmpeg.
ConvertVideoTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvertVideoTask: """Convert a video using ffmpeg.""" def __init__(self, *args, **kwargs): """Create a convert video object.""" <|body_0|> def _perform(self): """Perform the task.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(ConvertVide...
stack_v2_sparse_classes_10k_train_000496
2,356
permissive
[ { "docstring": "Create a convert video object.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Perform the task.", "name": "_perform", "signature": "def _perform(self)" } ]
2
stack_v2_sparse_classes_30k_train_001360
Implement the Python class `ConvertVideoTask` described below. Class description: Convert a video using ffmpeg. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a convert video object. - def _perform(self): Perform the task.
Implement the Python class `ConvertVideoTask` described below. Class description: Convert a video using ffmpeg. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a convert video object. - def _perform(self): Perform the task. <|skeleton|> class ConvertVideoTask: """Convert a video u...
046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4
<|skeleton|> class ConvertVideoTask: """Convert a video using ffmpeg.""" def __init__(self, *args, **kwargs): """Create a convert video object.""" <|body_0|> def _perform(self): """Perform the task.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ConvertVideoTask: """Convert a video using ffmpeg.""" def __init__(self, *args, **kwargs): """Create a convert video object.""" super(ConvertVideoTask, self).__init__(*args, **kwargs) self.setOption('videoArgs', self.__defaultVideoArgs) self.setOption('audioArgs', self.__d...
the_stack_v2_python_sparse
src/lib/kombi/Task/Video/ConvertVideoTask.py
kombiHQ/kombi
train
2
300684ac6049b6a2d169ff9ef6be34d9a6e02535
[ "def rserialize(root, res):\n if not root:\n res += 'None,'\n else:\n res += str(root.val) + ','\n res = rserialize(root.left, res)\n res = rserialize(root.right, res)\n return res\nreturn rserialize(root, '')", "def rdeserialize(datalist):\n if datalist[0] == 'None':\n ...
<|body_start_0|> def rserialize(root, res): if not root: res += 'None,' else: res += str(root.val) + ',' res = rserialize(root.left, res) res = rserialize(root.right, res) return res return rserialize(roo...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000497
2,784
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
7a459e9742958e63be8886874904e5ab2489411a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def rserialize(root, res): if not root: res += 'None,' else: res += str(root.val) + ',' res = rserialize(root.left...
the_stack_v2_python_sparse
Hard/297.py
Hellofafar/Leetcode
train
6
f89139c2774cece69f0e7269000d6edd245210ef
[ "tests = [((8, 8), 1, [(8, 8)]), ((8, 8), 2, [(8, 8), (4, 4)]), ((8, 8), 3, [(8, 8), (4, 4), (2, 2)]), ((8, 8), 4, [(8, 8), (4, 4), (2, 2), (1, 1)])]\nfor i, ((width, height), levels, want_layers) in enumerate(tests):\n image = Image()\n image.create(width, height)\n pyramid = Pyramid(image, levels)\n h...
<|body_start_0|> tests = [((8, 8), 1, [(8, 8)]), ((8, 8), 2, [(8, 8), (4, 4)]), ((8, 8), 3, [(8, 8), (4, 4), (2, 2)]), ((8, 8), 4, [(8, 8), (4, 4), (2, 2), (1, 1)])] for i, ((width, height), levels, want_layers) in enumerate(tests): image = Image() image.create(width, height) ...
Tests for the Pyramid class.
TestPyramid
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPyramid: """Tests for the Pyramid class.""" def test_init(self): """Tests the Pyramid.__init__() function.""" <|body_0|> def test_reconstruct(self): """Tests the Pyramid.reconstruct() function.""" <|body_1|> def test_items(self): """Tests...
stack_v2_sparse_classes_10k_train_000498
2,570
permissive
[ { "docstring": "Tests the Pyramid.__init__() function.", "name": "test_init", "signature": "def test_init(self)" }, { "docstring": "Tests the Pyramid.reconstruct() function.", "name": "test_reconstruct", "signature": "def test_reconstruct(self)" }, { "docstring": "Tests the Pyram...
3
stack_v2_sparse_classes_30k_train_000233
Implement the Python class `TestPyramid` described below. Class description: Tests for the Pyramid class. Method signatures and docstrings: - def test_init(self): Tests the Pyramid.__init__() function. - def test_reconstruct(self): Tests the Pyramid.reconstruct() function. - def test_items(self): Tests the Pyramid.__...
Implement the Python class `TestPyramid` described below. Class description: Tests for the Pyramid class. Method signatures and docstrings: - def test_init(self): Tests the Pyramid.__init__() function. - def test_reconstruct(self): Tests the Pyramid.reconstruct() function. - def test_items(self): Tests the Pyramid.__...
7e7282698befd53383cbd6566039340babb0a289
<|skeleton|> class TestPyramid: """Tests for the Pyramid class.""" def test_init(self): """Tests the Pyramid.__init__() function.""" <|body_0|> def test_reconstruct(self): """Tests the Pyramid.reconstruct() function.""" <|body_1|> def test_items(self): """Tests...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestPyramid: """Tests for the Pyramid class.""" def test_init(self): """Tests the Pyramid.__init__() function.""" tests = [((8, 8), 1, [(8, 8)]), ((8, 8), 2, [(8, 8), (4, 4)]), ((8, 8), 3, [(8, 8), (4, 4), (2, 2)]), ((8, 8), 4, [(8, 8), (4, 4), (2, 2), (1, 1)])] for i, ((width, he...
the_stack_v2_python_sparse
sandbox/image/pyramid_test.py
Mandrenkov/SVBRDF-Texture-Synthesis
train
3
c8be236df4be6b86d3f4197a11adb8103d6b6f9a
[ "try:\n return Part.objects.create(**validated_data)\nexcept (IntegrityError, ValidationError):\n raise PartSameNameExistError", "try:\n result = super().update(instance, validated_data)\n return result\nexcept (IntegrityError, ValidationError):\n raise PartSameNameExistError" ]
<|body_start_0|> try: return Part.objects.create(**validated_data) except (IntegrityError, ValidationError): raise PartSameNameExistError <|end_body_0|> <|body_start_1|> try: result = super().update(instance, validated_data) return result ...
PartSerializer.
PartSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartSerializer: """PartSerializer.""" def create(self, validated_data): """create. Args: validated_data:""" <|body_0|> def update(self, instance, validated_data): """update. Args: instance: validated_data:""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_000499
1,320
permissive
[ { "docstring": "create. Args: validated_data:", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "update. Args: instance: validated_data:", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_000956
Implement the Python class `PartSerializer` described below. Class description: PartSerializer. Method signatures and docstrings: - def create(self, validated_data): create. Args: validated_data: - def update(self, instance, validated_data): update. Args: instance: validated_data:
Implement the Python class `PartSerializer` described below. Class description: PartSerializer. Method signatures and docstrings: - def create(self, validated_data): create. Args: validated_data: - def update(self, instance, validated_data): update. Args: instance: validated_data: <|skeleton|> class PartSerializer: ...
1d2f42cbf9f21157c1e1abf044b26160dfed5b16
<|skeleton|> class PartSerializer: """PartSerializer.""" def create(self, validated_data): """create. Args: validated_data:""" <|body_0|> def update(self, instance, validated_data): """update. Args: instance: validated_data:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PartSerializer: """PartSerializer.""" def create(self, validated_data): """create. Args: validated_data:""" try: return Part.objects.create(**validated_data) except (IntegrityError, ValidationError): raise PartSameNameExistError def update(self, instan...
the_stack_v2_python_sparse
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_parts/api/serializers.py
Azure-Samples/azure-intelligent-edge-patterns
train
193