blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
207e23d8f9b38c2531e34335e73ab15c27390800 | [
"st, c1, min_so_far, result, fmap = (0, Counter(t), len(s) + 1, '', defaultdict(int))\nunique_ch = len(c1)\nfor end in range(len(s)):\n if s[end] in c1:\n fmap[s[end]] += 1\n if fmap[s[end]] == c1[s[end]]:\n unique_ch -= 1\n while st <= end and unique_ch == 0:\n if end ... | <|body_start_0|>
st, c1, min_so_far, result, fmap = (0, Counter(t), len(s) + 1, '', defaultdict(int))
unique_ch = len(c1)
for end in range(len(s)):
if s[end] in c1:
fmap[s[end]] += 1
if fmap[s[end]] == c1[s[end]]:
unique_ch -= 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minWindow(self, s: str, t: str) -> str:
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str:
""":type s: str :type t: List[str] :rtype: str"""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus_train_068300 | 7,059 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "minWindow",
"signature": "def minWindow(self, s: str, t: str) -> str"
},
{
"docstring": ":type s: str :type t: List[str] :rtype: str",
"name": "minWindow_facebook_and_google_phone_screen",
"signature": "def minWindow_facebo... | 2 | stack_v2_sparse_classes_30k_train_018058 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minWindow(self, s: str, t: str) -> str: :type s: str :type t: str :rtype: str
- def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str: :type s: st... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minWindow(self, s: str, t: str) -> str: :type s: str :type t: str :rtype: str
- def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str: :type s: st... | f2621cd76822a922c49b60f32931f26cce1c571d | <|skeleton|>
class Solution:
def minWindow(self, s: str, t: str) -> str:
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str:
""":type s: str :type t: List[str] :rtype: str"""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minWindow(self, s: str, t: str) -> str:
""":type s: str :type t: str :rtype: str"""
st, c1, min_so_far, result, fmap = (0, Counter(t), len(s) + 1, '', defaultdict(int))
unique_ch = len(c1)
for end in range(len(s)):
if s[end] in c1:
fmap... | the_stack_v2_python_sparse | String/022_leetcode_P_076_MinimumWindowSubstring/Solution.py | Keshav1506/competitive_programming | train | 0 | |
07d7ed11ec81e569a68a1df969087a08a0eab14d | [
"self.bnet = bnet\nself.verbose = verbose\nself.is_quantum = is_quantum\nsorted_nd_names = sorted([nd.name for nd in self.bnet.nodes])\nself.bnet_ord_nodes = [self.bnet.get_node_named(name) for name in sorted_nd_names]",
"pairs = sorted([(node.name, str(annotated_story[node])) for node in annotated_story.keys()])... | <|body_start_0|>
self.bnet = bnet
self.verbose = verbose
self.is_quantum = is_quantum
sorted_nd_names = sorted([nd.name for nd in self.bnet.nodes])
self.bnet_ord_nodes = [self.bnet.get_node_named(name) for name in sorted_nd_names]
<|end_body_0|>
<|body_start_1|>
pairs = ... | This is the parent class of all inference engines. Attributes ---------- bnet : BayesNet bnet_ord_nodes : list[BayesNode] list of nodes of bnet ordered alphabetically by node name is_quantum : bool verbose : bool | InferenceEngine | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InferenceEngine:
"""This is the parent class of all inference engines. Attributes ---------- bnet : BayesNet bnet_ord_nodes : list[BayesNode] list of nodes of bnet ordered alphabetically by node name is_quantum : bool verbose : bool"""
def __init__(self, bnet, verbose=False, is_quantum=False... | stack_v2_sparse_classes_75kplus_train_068301 | 1,732 | permissive | [
{
"docstring": "Constructor Parameters ---------- bnet : BayesNet verbose : bool is_quantum : bool Returns -------",
"name": "__init__",
"signature": "def __init__(self, bnet, verbose=False, is_quantum=False)"
},
{
"docstring": "An annotated story is a dictionary that maps each node to its curre... | 2 | stack_v2_sparse_classes_30k_train_043857 | Implement the Python class `InferenceEngine` described below.
Class description:
This is the parent class of all inference engines. Attributes ---------- bnet : BayesNet bnet_ord_nodes : list[BayesNode] list of nodes of bnet ordered alphabetically by node name is_quantum : bool verbose : bool
Method signatures and do... | Implement the Python class `InferenceEngine` described below.
Class description:
This is the parent class of all inference engines. Attributes ---------- bnet : BayesNet bnet_ord_nodes : list[BayesNode] list of nodes of bnet ordered alphabetically by node name is_quantum : bool verbose : bool
Method signatures and do... | 5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2 | <|skeleton|>
class InferenceEngine:
"""This is the parent class of all inference engines. Attributes ---------- bnet : BayesNet bnet_ord_nodes : list[BayesNode] list of nodes of bnet ordered alphabetically by node name is_quantum : bool verbose : bool"""
def __init__(self, bnet, verbose=False, is_quantum=False... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InferenceEngine:
"""This is the parent class of all inference engines. Attributes ---------- bnet : BayesNet bnet_ord_nodes : list[BayesNode] list of nodes of bnet ordered alphabetically by node name is_quantum : bool verbose : bool"""
def __init__(self, bnet, verbose=False, is_quantum=False):
""... | the_stack_v2_python_sparse | inference/InferenceEngine.py | artiste-qb-net/quantum-fog | train | 95 |
62d6584c2b47f966c964d1875f06e83e47e3bdfa | [
"trie = Trie()\nfor p in products:\n trie.add(p)\nres = []\nprefix = ''\nfor c in searchWord:\n prefix += c\n l = trie.findAll(prefix)\n res.append(sorted(l)[:3])\nreturn res",
"products.sort()\nprefix = ''\nres = []\nfor c in searchWord:\n temp = []\n prefix += c\n i = bisect.bisect_left(pro... | <|body_start_0|>
trie = Trie()
for p in products:
trie.add(p)
res = []
prefix = ''
for c in searchWord:
prefix += c
l = trie.findAll(prefix)
res.append(sorted(l)[:3])
return res
<|end_body_0|>
<|body_start_1|>
produ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
"""Trie 구현."""
<|body_0|>
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
"""sort 후 binary search."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_75kplus_train_068302 | 1,844 | no_license | [
{
"docstring": "Trie 구현.",
"name": "suggestedProducts",
"signature": "def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]"
},
{
"docstring": "sort 후 binary search.",
"name": "suggestedProducts",
"signature": "def suggestedProducts(self, products: List[str... | 2 | stack_v2_sparse_classes_30k_train_047675 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]: Trie 구현.
- def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[st... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]: Trie 구현.
- def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[st... | c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1 | <|skeleton|>
class Solution:
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
"""Trie 구현."""
<|body_0|>
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
"""sort 후 binary search."""
<|body_1|>
<|end_skele... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def suggestedProducts(self, products: List[str], searchWord: str) -> List[List[str]]:
"""Trie 구현."""
trie = Trie()
for p in products:
trie.add(p)
res = []
prefix = ''
for c in searchWord:
prefix += c
l = trie.findAll... | the_stack_v2_python_sparse | Leetcode/1268.py | hanwgyu/algorithm_problem_solving | train | 5 | |
89a228e893e87b20035e03a43537bcf5d1fcf929 | [
"super(MaDTwinNet, self).__init__()\nself.mad = MaD(rnn_enc_input_dim=rnn_enc_input_dim, rnn_dec_input_dim=rnn_dec_input_dim, context_length=context_length, original_input_dim=original_input_dim)\nself.twin_net = TwinNet(rnn_dec_input_dim=rnn_dec_input_dim, original_input_dim=original_input_dim, context_length=cont... | <|body_start_0|>
super(MaDTwinNet, self).__init__()
self.mad = MaD(rnn_enc_input_dim=rnn_enc_input_dim, rnn_dec_input_dim=rnn_dec_input_dim, context_length=context_length, original_input_dim=original_input_dim)
self.twin_net = TwinNet(rnn_dec_input_dim=rnn_dec_input_dim, original_input_dim=origi... | MaDTwinNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaDTwinNet:
def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length):
"""The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dime... | stack_v2_sparse_classes_75kplus_train_068303 | 16,858 | no_license | [
{
"docstring": "The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dimensionality of the RNN encoder. :type rnn_enc_input_dim: int :param rnn_dec_input_dim: The input dimensionality of the... | 2 | stack_v2_sparse_classes_30k_train_020223 | Implement the Python class `MaDTwinNet` described below.
Class description:
Implement the MaDTwinNet class.
Method signatures and docstrings:
- def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): The MaD TwinNet as a module. This class implements the MaD TwinNet as a module a... | Implement the Python class `MaDTwinNet` described below.
Class description:
Implement the MaDTwinNet class.
Method signatures and docstrings:
- def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length): The MaD TwinNet as a module. This class implements the MaD TwinNet as a module a... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class MaDTwinNet:
def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length):
"""The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dime... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MaDTwinNet:
def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, original_input_dim, context_length):
"""The MaD TwinNet as a module. This class implements the MaD TwinNet as a module and it is based on the separate modules of MaD and TwinNet. :param rnn_enc_input_dim: The input dimensionality of ... | the_stack_v2_python_sparse | generated/test_dr_costas_mad_twinnet.py | jansel/pytorch-jit-paritybench | train | 35 | |
b6a78f4112aa176227764269211ba9bc1bf6a2ad | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | ZipaiServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZipaiServicer:
def calculate(self, request, context):
"""进行过程计算"""
<|body_0|>
def settle(self, request, context):
"""结算"""
<|body_1|>
def shuffle(self, request, context):
"""洗牌函数"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
c... | stack_v2_sparse_classes_75kplus_train_068304 | 2,856 | no_license | [
{
"docstring": "进行过程计算",
"name": "calculate",
"signature": "def calculate(self, request, context)"
},
{
"docstring": "结算",
"name": "settle",
"signature": "def settle(self, request, context)"
},
{
"docstring": "洗牌函数",
"name": "shuffle",
"signature": "def shuffle(self, requ... | 3 | stack_v2_sparse_classes_30k_train_013014 | Implement the Python class `ZipaiServicer` described below.
Class description:
Implement the ZipaiServicer class.
Method signatures and docstrings:
- def calculate(self, request, context): 进行过程计算
- def settle(self, request, context): 结算
- def shuffle(self, request, context): 洗牌函数 | Implement the Python class `ZipaiServicer` described below.
Class description:
Implement the ZipaiServicer class.
Method signatures and docstrings:
- def calculate(self, request, context): 进行过程计算
- def settle(self, request, context): 结算
- def shuffle(self, request, context): 洗牌函数
<|skeleton|>
class ZipaiServicer:
... | 383ebca3162734107b1d8af61274a76cb3822684 | <|skeleton|>
class ZipaiServicer:
def calculate(self, request, context):
"""进行过程计算"""
<|body_0|>
def settle(self, request, context):
"""结算"""
<|body_1|>
def shuffle(self, request, context):
"""洗牌函数"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZipaiServicer:
def calculate(self, request, context):
"""进行过程计算"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def settle(self, request, context):
"""结算"""
... | the_stack_v2_python_sparse | zipai/zipai_pb2_grpc.py | chrinide/phz | train | 1 | |
50e6a2e9e665c04a0f8b3f1e9f955b1cec0e6191 | [
"self.nombre = nombre\nself.apellidos = apellidos\nself.email = email\nself.password = password\npass",
"fecha = datetime.datetime.now()\ncifrado = hashlib.sha256()\ncifrado.update(self.password.encode('utf8'))\nsql = 'INSERT INTO usuarios VALUES(null, %s, %s, %s, %s, %s)'\nusuario = (self.nombre, self.apellidos,... | <|body_start_0|>
self.nombre = nombre
self.apellidos = apellidos
self.email = email
self.password = password
pass
<|end_body_0|>
<|body_start_1|>
fecha = datetime.datetime.now()
cifrado = hashlib.sha256()
cifrado.update(self.password.encode('utf8'))
... | model user | Usuario | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Usuario:
"""model user"""
def __init__(self, nombre, apellidos, email, password):
"""constructor"""
<|body_0|>
def registrar(self):
"""registrar user"""
<|body_1|>
def identificar(self):
"""logear user"""
<|body_2|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_068305 | 1,883 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, nombre, apellidos, email, password)"
},
{
"docstring": "registrar user",
"name": "registrar",
"signature": "def registrar(self)"
},
{
"docstring": "logear user",
"name": "identificar",
"sig... | 3 | null | Implement the Python class `Usuario` described below.
Class description:
model user
Method signatures and docstrings:
- def __init__(self, nombre, apellidos, email, password): constructor
- def registrar(self): registrar user
- def identificar(self): logear user | Implement the Python class `Usuario` described below.
Class description:
model user
Method signatures and docstrings:
- def __init__(self, nombre, apellidos, email, password): constructor
- def registrar(self): registrar user
- def identificar(self): logear user
<|skeleton|>
class Usuario:
"""model user"""
... | 34a3946b54b34eed18c839f3631f71fa2cebf7ad | <|skeleton|>
class Usuario:
"""model user"""
def __init__(self, nombre, apellidos, email, password):
"""constructor"""
<|body_0|>
def registrar(self):
"""registrar user"""
<|body_1|>
def identificar(self):
"""logear user"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Usuario:
"""model user"""
def __init__(self, nombre, apellidos, email, password):
"""constructor"""
self.nombre = nombre
self.apellidos = apellidos
self.email = email
self.password = password
pass
def registrar(self):
"""registrar user"""
... | the_stack_v2_python_sparse | 20-proyecto-phyton/usuarios/usuario.py | pacomonle/Python-curso | train | 0 |
da90410829f66f6168589165737cbc1f288b005e | [
"self._holo_name = _holo_name\nself._hp = _hp\nself._threat = _threat\nkwargs['_list_target_types'] = [self.TYPE_LOCATION]\nkwargs['_requires_LOS'] = True\nsuper(ToolHoloprojector, self).__init__(_eid=_eid, _level=_level, **kwargs)",
"holo = Actor.Actor(-1, self._level, _entity_name=self._holo_name, _max_hp=self.... | <|body_start_0|>
self._holo_name = _holo_name
self._hp = _hp
self._threat = _threat
kwargs['_list_target_types'] = [self.TYPE_LOCATION]
kwargs['_requires_LOS'] = True
super(ToolHoloprojector, self).__init__(_eid=_eid, _level=_level, **kwargs)
<|end_body_0|>
<|body_start_... | ToolHoloprojector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ToolHoloprojector:
def __init__(self, _eid, _level, _holo_name='Hologram', _hp=999, _threat=9, **kwargs):
""":type _eid: int :type _level: level.LevelView.LevelView :type _holo_name: str :type _hp: int :type _threat: int"""
<|body_0|>
def _effects_of_use_on_location(self, _x... | stack_v2_sparse_classes_75kplus_train_068306 | 3,088 | no_license | [
{
"docstring": ":type _eid: int :type _level: level.LevelView.LevelView :type _holo_name: str :type _hp: int :type _threat: int",
"name": "__init__",
"signature": "def __init__(self, _eid, _level, _holo_name='Hologram', _hp=999, _threat=9, **kwargs)"
},
{
"docstring": ":type _x: int :type _y: in... | 2 | null | Implement the Python class `ToolHoloprojector` described below.
Class description:
Implement the ToolHoloprojector class.
Method signatures and docstrings:
- def __init__(self, _eid, _level, _holo_name='Hologram', _hp=999, _threat=9, **kwargs): :type _eid: int :type _level: level.LevelView.LevelView :type _holo_name:... | Implement the Python class `ToolHoloprojector` described below.
Class description:
Implement the ToolHoloprojector class.
Method signatures and docstrings:
- def __init__(self, _eid, _level, _holo_name='Hologram', _hp=999, _threat=9, **kwargs): :type _eid: int :type _level: level.LevelView.LevelView :type _holo_name:... | 0342700b0edfeedd8e3a8c1fea9bd790d2b8a042 | <|skeleton|>
class ToolHoloprojector:
def __init__(self, _eid, _level, _holo_name='Hologram', _hp=999, _threat=9, **kwargs):
""":type _eid: int :type _level: level.LevelView.LevelView :type _holo_name: str :type _hp: int :type _threat: int"""
<|body_0|>
def _effects_of_use_on_location(self, _x... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ToolHoloprojector:
def __init__(self, _eid, _level, _holo_name='Hologram', _hp=999, _threat=9, **kwargs):
""":type _eid: int :type _level: level.LevelView.LevelView :type _holo_name: str :type _hp: int :type _threat: int"""
self._holo_name = _holo_name
self._hp = _hp
self._thre... | the_stack_v2_python_sparse | Python_Zappy/entity/tool/ToolHoloprojector.py | MoyTW/Zappy | train | 0 | |
0bf63f0f323d3373bc2ab45321f869be69494cf9 | [
"if config_dict is not None:\n if AFAN_CONFIG_WHEN in config_dict:\n self.when = config_dict[AFAN_CONFIG_WHEN]\n if self.when != AFAN_WHEN_TYPE_NOT_FROM and self.when != AFAN_WHEN_TYPE_FROM:\n out_str = 'AlertFilterFromAnalyzer when must be from_analyzer or not_from_analyzer'\n ... | <|body_start_0|>
if config_dict is not None:
if AFAN_CONFIG_WHEN in config_dict:
self.when = config_dict[AFAN_CONFIG_WHEN]
if self.when != AFAN_WHEN_TYPE_NOT_FROM and self.when != AFAN_WHEN_TYPE_FROM:
out_str = 'AlertFilterFromAnalyzer when must be... | Filter alerts based on what analyzer produced them | AlertFilterAnalyzerName | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlertFilterAnalyzerName:
"""Filter alerts based on what analyzer produced them"""
def __init__(self, name, config_dict=None):
"""The constructor"""
<|body_0|>
def keep_from_listeners(self, alert):
"""Filter the alert. True means filtered and False means send on""... | stack_v2_sparse_classes_75kplus_train_068307 | 3,616 | no_license | [
{
"docstring": "The constructor",
"name": "__init__",
"signature": "def __init__(self, name, config_dict=None)"
},
{
"docstring": "Filter the alert. True means filtered and False means send on",
"name": "keep_from_listeners",
"signature": "def keep_from_listeners(self, alert)"
},
{
... | 3 | null | Implement the Python class `AlertFilterAnalyzerName` described below.
Class description:
Filter alerts based on what analyzer produced them
Method signatures and docstrings:
- def __init__(self, name, config_dict=None): The constructor
- def keep_from_listeners(self, alert): Filter the alert. True means filtered and ... | Implement the Python class `AlertFilterAnalyzerName` described below.
Class description:
Filter alerts based on what analyzer produced them
Method signatures and docstrings:
- def __init__(self, name, config_dict=None): The constructor
- def keep_from_listeners(self, alert): Filter the alert. True means filtered and ... | eba6c1489b503fdcf040a126942643b355867bcd | <|skeleton|>
class AlertFilterAnalyzerName:
"""Filter alerts based on what analyzer produced them"""
def __init__(self, name, config_dict=None):
"""The constructor"""
<|body_0|>
def keep_from_listeners(self, alert):
"""Filter the alert. True means filtered and False means send on""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlertFilterAnalyzerName:
"""Filter alerts based on what analyzer produced them"""
def __init__(self, name, config_dict=None):
"""The constructor"""
if config_dict is not None:
if AFAN_CONFIG_WHEN in config_dict:
self.when = config_dict[AFAN_CONFIG_WHEN]
... | the_stack_v2_python_sparse | src/ibm/teal/filter/alert_filter_analyzer_name.py | ppjsand/pyteal | train | 1 |
31a5652849dc86ada6aeff64de5470ec5afd0978 | [
"from vistrails.db.services.io import open_bundle_from_zip_xml\nfrom vistrails.core.system import vistrails_root_directory\nimport os\nsave_bundle, vt_save_dir = open_bundle_from_zip_xml(DBVistrail.vtType, os.path.join(vistrails_root_directory(), 'tests/resources/paramexp-1.0.2.vt'))\nvistrail = translateVistrail(s... | <|body_start_0|>
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
save_bundle, vt_save_dir = open_bundle_from_zip_xml(DBVistrail.vtType, os.path.join(vistrails_root_directory(), 'tests/resources/paramexp-1.... | TestTranslate | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestTranslate:
def testParamexp(self):
"""test translating parameter explorations from 1.0.2 to 1.0.3"""
<|body_0|>
def testVistrailvars(self):
"""test translating vistrail variables from 1.0.2 to 1.0.3"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_068308 | 15,014 | permissive | [
{
"docstring": "test translating parameter explorations from 1.0.2 to 1.0.3",
"name": "testParamexp",
"signature": "def testParamexp(self)"
},
{
"docstring": "test translating vistrail variables from 1.0.2 to 1.0.3",
"name": "testVistrailvars",
"signature": "def testVistrailvars(self)"
... | 2 | stack_v2_sparse_classes_30k_train_038289 | Implement the Python class `TestTranslate` described below.
Class description:
Implement the TestTranslate class.
Method signatures and docstrings:
- def testParamexp(self): test translating parameter explorations from 1.0.2 to 1.0.3
- def testVistrailvars(self): test translating vistrail variables from 1.0.2 to 1.0.... | Implement the Python class `TestTranslate` described below.
Class description:
Implement the TestTranslate class.
Method signatures and docstrings:
- def testParamexp(self): test translating parameter explorations from 1.0.2 to 1.0.3
- def testVistrailvars(self): test translating vistrail variables from 1.0.2 to 1.0.... | 23ef56ec24b85c82416e1437a08381635328abe5 | <|skeleton|>
class TestTranslate:
def testParamexp(self):
"""test translating parameter explorations from 1.0.2 to 1.0.3"""
<|body_0|>
def testVistrailvars(self):
"""test translating vistrail variables from 1.0.2 to 1.0.3"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestTranslate:
def testParamexp(self):
"""test translating parameter explorations from 1.0.2 to 1.0.3"""
from vistrails.db.services.io import open_bundle_from_zip_xml
from vistrails.core.system import vistrails_root_directory
import os
save_bundle, vt_save_dir = open_bu... | the_stack_v2_python_sparse | vistrails_current/vistrails/db/versions/v1_0_3/translate/v1_0_2.py | lumig242/VisTrailsRecommendation | train | 3 | |
872d216d4d4093e5acfbf2d3a9fe5823f2ace938 | [
"name = attrs[source]\nparent = Domain.get_parent_domain(name)\nif parent and parent.account != self.account:\n raise ValidationError(_('Can not create subdomains of other users domains'))\nreturn attrs",
"instance = super(DomainSerializer, self).full_clean(instance)\nif instance and instance.name:\n record... | <|body_start_0|>
name = attrs[source]
parent = Domain.get_parent_domain(name)
if parent and parent.account != self.account:
raise ValidationError(_('Can not create subdomains of other users domains'))
return attrs
<|end_body_0|>
<|body_start_1|>
instance = super(Doma... | Validates if this zone generates a correct zone file | DomainSerializer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DomainSerializer:
"""Validates if this zone generates a correct zone file"""
def clean_name(self, attrs, source):
"""prevent users creating subdomains of other users domains"""
<|body_0|>
def full_clean(self, instance):
"""Checks if everything is consistent"""
... | stack_v2_sparse_classes_75kplus_train_068309 | 1,708 | permissive | [
{
"docstring": "prevent users creating subdomains of other users domains",
"name": "clean_name",
"signature": "def clean_name(self, attrs, source)"
},
{
"docstring": "Checks if everything is consistent",
"name": "full_clean",
"signature": "def full_clean(self, instance)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020582 | Implement the Python class `DomainSerializer` described below.
Class description:
Validates if this zone generates a correct zone file
Method signatures and docstrings:
- def clean_name(self, attrs, source): prevent users creating subdomains of other users domains
- def full_clean(self, instance): Checks if everythin... | Implement the Python class `DomainSerializer` described below.
Class description:
Validates if this zone generates a correct zone file
Method signatures and docstrings:
- def clean_name(self, attrs, source): prevent users creating subdomains of other users domains
- def full_clean(self, instance): Checks if everythin... | 9a836f6e252d39dfe3741dd5df4c4a9e67040c1b | <|skeleton|>
class DomainSerializer:
"""Validates if this zone generates a correct zone file"""
def clean_name(self, attrs, source):
"""prevent users creating subdomains of other users domains"""
<|body_0|>
def full_clean(self, instance):
"""Checks if everything is consistent"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DomainSerializer:
"""Validates if this zone generates a correct zone file"""
def clean_name(self, attrs, source):
"""prevent users creating subdomains of other users domains"""
name = attrs[source]
parent = Domain.get_parent_domain(name)
if parent and parent.account != sel... | the_stack_v2_python_sparse | orchestra/contrib/domains/serializers.py | amon-ra/django-orchestra | train | 0 |
82475cacfeb4b09092ba8ab8bdb1c408a52c6ea1 | [
"res = []\n\ndef _permute(nums, curr, k):\n if len(curr) == k:\n res.append(curr[:])\n return\n for i in nums:\n if i not in curr:\n curr.append(i)\n _permute(nums, curr, k)\n curr.pop()\n_permute(nums, [], len(nums))\nreturn res",
"res = []\n\ndef _perm... | <|body_start_0|>
res = []
def _permute(nums, curr, k):
if len(curr) == k:
res.append(curr[:])
return
for i in nums:
if i not in curr:
curr.append(i)
_permute(nums, curr, k)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permute(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permute(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = []
def _permut... | stack_v2_sparse_classes_75kplus_train_068310 | 917 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permute",
"signature": "def permute(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permute",
"signature": "def permute(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permute(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permute(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permute(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | 66a17448a9c58623bacc54446bbeb6f88e775ae0 | <|skeleton|>
class Solution:
def permute(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permute(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def permute(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
res = []
def _permute(nums, curr, k):
if len(curr) == k:
res.append(curr[:])
return
for i in nums:
if i not in curr:
... | the_stack_v2_python_sparse | Week_03/permutations.py | jijianwen/algorithm013 | train | 0 | |
8b20c9043d60c4fef9dfda9239c51e9c6b202f04 | [
"super().__init__()\nself.title = '人人都是Pythonista'\nself.left = 200\nself.top = 250\nself.width = 500\nself.height = 500\nself.initUI()",
"self.setWindowTitle(self.title)\nself.setGeometry(self.left, self.top, self.width, self.height)\nself.setWindowIcon(QtGui.QIcon('icon.jpg'))\nself.textbox = QLineEdit(self)\ns... | <|body_start_0|>
super().__init__()
self.title = '人人都是Pythonista'
self.left = 200
self.top = 250
self.width = 500
self.height = 500
self.initUI()
<|end_body_0|>
<|body_start_1|>
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top,... | App | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class App:
def __init__(self):
"""初始化操作"""
<|body_0|>
def initUI(self):
"""页面ui初始化"""
<|body_1|>
def on_click(self):
"""点击事件"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
super().__init__()
self.title = '人人都是Pythonista'
... | stack_v2_sparse_classes_75kplus_train_068311 | 2,286 | no_license | [
{
"docstring": "初始化操作",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "页面ui初始化",
"name": "initUI",
"signature": "def initUI(self)"
},
{
"docstring": "点击事件",
"name": "on_click",
"signature": "def on_click(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_026920 | Implement the Python class `App` described below.
Class description:
Implement the App class.
Method signatures and docstrings:
- def __init__(self): 初始化操作
- def initUI(self): 页面ui初始化
- def on_click(self): 点击事件 | Implement the Python class `App` described below.
Class description:
Implement the App class.
Method signatures and docstrings:
- def __init__(self): 初始化操作
- def initUI(self): 页面ui初始化
- def on_click(self): 点击事件
<|skeleton|>
class App:
def __init__(self):
"""初始化操作"""
<|body_0|>
def initUI(se... | 08b314e7ecb10e13394aa93b92084c53596834f3 | <|skeleton|>
class App:
def __init__(self):
"""初始化操作"""
<|body_0|>
def initUI(self):
"""页面ui初始化"""
<|body_1|>
def on_click(self):
"""点击事件"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class App:
def __init__(self):
"""初始化操作"""
super().__init__()
self.title = '人人都是Pythonista'
self.left = 200
self.top = 250
self.width = 500
self.height = 500
self.initUI()
def initUI(self):
"""页面ui初始化"""
self.setWindowTitle(self.ti... | the_stack_v2_python_sparse | xiayang_qt/click_and_show.py | everydayxy/xy_py | train | 2 | |
dc8c925bad73a2b18c14df33c8f168e8f0e51155 | [
"rc_mock = cros_build_lib_unittest.RunCommandMock()\nnoarch = 'target=foo\\ncategory=bla\\n'\nrc_mock.SetDefaultCmdResult(output=noarch)\nwith rc_mock:\n self.assertEqual(None, toolchain.GetArchForTarget('fake_target'))\namd64arch = 'arch=amd64\\ntarget=foo\\n'\nrc_mock.SetDefaultCmdResult(output=amd64arch)\nwit... | <|body_start_0|>
rc_mock = cros_build_lib_unittest.RunCommandMock()
noarch = 'target=foo\ncategory=bla\n'
rc_mock.SetDefaultCmdResult(output=noarch)
with rc_mock:
self.assertEqual(None, toolchain.GetArchForTarget('fake_target'))
amd64arch = 'arch=amd64\ntarget=foo\n'
... | Tests for lib.toolchain. | ToolchainTest | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ToolchainTest:
"""Tests for lib.toolchain."""
def testArchForToolchain(self):
"""Tests that we correctly parse crossdev's output."""
<|body_0|>
def testReadsBoardToolchains(self, find_overlays_mock):
"""Tests that we correctly parse toolchain configs for an overl... | stack_v2_sparse_classes_75kplus_train_068312 | 2,556 | permissive | [
{
"docstring": "Tests that we correctly parse crossdev's output.",
"name": "testArchForToolchain",
"signature": "def testArchForToolchain(self)"
},
{
"docstring": "Tests that we correctly parse toolchain configs for an overlay stack.",
"name": "testReadsBoardToolchains",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_015474 | Implement the Python class `ToolchainTest` described below.
Class description:
Tests for lib.toolchain.
Method signatures and docstrings:
- def testArchForToolchain(self): Tests that we correctly parse crossdev's output.
- def testReadsBoardToolchains(self, find_overlays_mock): Tests that we correctly parse toolchain... | Implement the Python class `ToolchainTest` described below.
Class description:
Tests for lib.toolchain.
Method signatures and docstrings:
- def testArchForToolchain(self): Tests that we correctly parse crossdev's output.
- def testReadsBoardToolchains(self, find_overlays_mock): Tests that we correctly parse toolchain... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class ToolchainTest:
"""Tests for lib.toolchain."""
def testArchForToolchain(self):
"""Tests that we correctly parse crossdev's output."""
<|body_0|>
def testReadsBoardToolchains(self, find_overlays_mock):
"""Tests that we correctly parse toolchain configs for an overl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ToolchainTest:
"""Tests for lib.toolchain."""
def testArchForToolchain(self):
"""Tests that we correctly parse crossdev's output."""
rc_mock = cros_build_lib_unittest.RunCommandMock()
noarch = 'target=foo\ncategory=bla\n'
rc_mock.SetDefaultCmdResult(output=noarch)
... | the_stack_v2_python_sparse | third_party/chromite/lib/toolchain_unittest.py | metux/chromium-suckless | train | 5 |
d5bd89fef6f90d9bbb5c94e25598ff57681454db | [
"self._LR_SCHEDULE_MAP = {'ExponentialDecay': tf.keras.optimizers.schedules.ExponentialDecay, 'PiecewiseConstantDecay': tf.keras.optimizers.schedules.PiecewiseConstantDecay, 'PolynomialDecay': tf.keras.optimizers.schedules.PolynomialDecay}\nself._OPTIMIZER_MAP = {'Adam': tf.keras.optimizers.Adam, 'RMSprop': tf.kera... | <|body_start_0|>
self._LR_SCHEDULE_MAP = {'ExponentialDecay': tf.keras.optimizers.schedules.ExponentialDecay, 'PiecewiseConstantDecay': tf.keras.optimizers.schedules.PiecewiseConstantDecay, 'PolynomialDecay': tf.keras.optimizers.schedules.PolynomialDecay}
self._OPTIMIZER_MAP = {'Adam': tf.keras.optimize... | ModelTrainer | [
"LicenseRef-scancode-unicode"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelTrainer:
def __init__(self, config_path='configs/sample_config.ini'):
"""Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_p... | stack_v2_sparse_classes_75kplus_train_068313 | 9,317 | permissive | [
{
"docstring": "Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_path: Str, path to config (.ini) file. Raises: ValueError: if values in config file doe... | 4 | stack_v2_sparse_classes_30k_train_021895 | Implement the Python class `ModelTrainer` described below.
Class description:
Implement the ModelTrainer class.
Method signatures and docstrings:
- def __init__(self, config_path='configs/sample_config.ini'): Read and set configuration from config file (.ini file) and create keras.Model object or input function accor... | Implement the Python class `ModelTrainer` described below.
Class description:
Implement the ModelTrainer class.
Method signatures and docstrings:
- def __init__(self, config_path='configs/sample_config.ini'): Read and set configuration from config file (.ini file) and create keras.Model object or input function accor... | 2b78bf2c37fb474162573c73b67411a84f235b2b | <|skeleton|>
class ModelTrainer:
def __init__(self, config_path='configs/sample_config.ini'):
"""Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelTrainer:
def __init__(self, config_path='configs/sample_config.ini'):
"""Read and set configuration from config file (.ini file) and create keras.Model object or input function according to configuration. To add new model, simply add new base model to self._MODEL_MAP. Args: config_path: Str, path... | the_stack_v2_python_sparse | custom_train.py | airbagy/ml-confusables-generator | train | 1 | |
41d9d1256bc0a4d64e1bc152d8b71af2eb2523a2 | [
"super().__init__()\nnum_filters = 32\nself.feature_extractor = nn.Sequential(nn.Conv2d(in_channels=image_channels, out_channels=num_filters, kernel_size=5, stride=1, padding=2), nn.MaxPool2d(kernel_size=2, stride=2), nn.ReLU())\nself.num_output_features = 32 * 16 * 16\nself.classifier = nn.Sequential(nn.Linear(sel... | <|body_start_0|>
super().__init__()
num_filters = 32
self.feature_extractor = nn.Sequential(nn.Conv2d(in_channels=image_channels, out_channels=num_filters, kernel_size=5, stride=1, padding=2), nn.MaxPool2d(kernel_size=2, stride=2), nn.ReLU())
self.num_output_features = 32 * 16 * 16
... | ExampleModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExampleModel:
def __init__(self, image_channels, num_classes):
"""Is called when model is initialized. Args: image_channels. Number of color channels in image (3) num_classes: Number of classes we want to predict (10)"""
<|body_0|>
def forward(self, x):
"""Performs a... | stack_v2_sparse_classes_75kplus_train_068314 | 7,617 | permissive | [
{
"docstring": "Is called when model is initialized. Args: image_channels. Number of color channels in image (3) num_classes: Number of classes we want to predict (10)",
"name": "__init__",
"signature": "def __init__(self, image_channels, num_classes)"
},
{
"docstring": "Performs a forward pass ... | 2 | stack_v2_sparse_classes_30k_train_013816 | Implement the Python class `ExampleModel` described below.
Class description:
Implement the ExampleModel class.
Method signatures and docstrings:
- def __init__(self, image_channels, num_classes): Is called when model is initialized. Args: image_channels. Number of color channels in image (3) num_classes: Number of c... | Implement the Python class `ExampleModel` described below.
Class description:
Implement the ExampleModel class.
Method signatures and docstrings:
- def __init__(self, image_channels, num_classes): Is called when model is initialized. Args: image_channels. Number of color channels in image (3) num_classes: Number of c... | 0df83bb24fd2aa94dad2ce29e493a75e3363d727 | <|skeleton|>
class ExampleModel:
def __init__(self, image_channels, num_classes):
"""Is called when model is initialized. Args: image_channels. Number of color channels in image (3) num_classes: Number of classes we want to predict (10)"""
<|body_0|>
def forward(self, x):
"""Performs a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExampleModel:
def __init__(self, image_channels, num_classes):
"""Is called when model is initialized. Args: image_channels. Number of color channels in image (3) num_classes: Number of classes we want to predict (10)"""
super().__init__()
num_filters = 32
self.feature_extracto... | the_stack_v2_python_sparse | tdt_4265_code/starter_code.py | thaiKari/mmdetection-sau | train | 1 | |
a345816caa9e4ec1e1a11fa8be596215404d0135 | [
"logging.debug('Attempting to save clipboard data in ClipboardState object')\nself.__formatData = {}\nfor format in self._SAVED_FORMATS:\n if win32clipboard.IsClipboardFormatAvailable(format):\n try:\n dataHandle = win32clipboard.GetClipboardDataHandle(format)\n except... | <|body_start_0|>
logging.debug('Attempting to save clipboard data in ClipboardState object')
self.__formatData = {}
for format in self._SAVED_FORMATS:
if win32clipboard.IsClipboardFormatAvailable(format):
try:
dataHandle = win32c... | A class that encapsulates a state of the clipboard. Upon intialization it stores the current state of the clipboard. | ClipboardState | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClipboardState:
"""A class that encapsulates a state of the clipboard. Upon intialization it stores the current state of the clipboard."""
def __init__(self):
"""Reads current state of clipboard, creates a ClipboardState object duplicating that state."""
<|body_0|>
def r... | stack_v2_sparse_classes_75kplus_train_068315 | 8,488 | permissive | [
{
"docstring": "Reads current state of clipboard, creates a ClipboardState object duplicating that state.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Puts the data contained in this object back into the clipboard.",
"name": "restore",
"signature": "def rest... | 3 | null | Implement the Python class `ClipboardState` described below.
Class description:
A class that encapsulates a state of the clipboard. Upon intialization it stores the current state of the clipboard.
Method signatures and docstrings:
- def __init__(self): Reads current state of clipboard, creates a ClipboardState object... | Implement the Python class `ClipboardState` described below.
Class description:
A class that encapsulates a state of the clipboard. Upon intialization it stores the current state of the clipboard.
Method signatures and docstrings:
- def __init__(self): Reads current state of clipboard, creates a ClipboardState object... | 61351f52f01367439e8810d2c482a9c9897545d8 | <|skeleton|>
class ClipboardState:
"""A class that encapsulates a state of the clipboard. Upon intialization it stores the current state of the clipboard."""
def __init__(self):
"""Reads current state of clipboard, creates a ClipboardState object duplicating that state."""
<|body_0|>
def r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClipboardState:
"""A class that encapsulates a state of the clipboard. Upon intialization it stores the current state of the clipboard."""
def __init__(self):
"""Reads current state of clipboard, creates a ClipboardState object duplicating that state."""
logging.debug('Attempting to save ... | the_stack_v2_python_sparse | enso/enso/platform/win32/selection/ClipboardArchive.py | GChristensen/enso-portable | train | 144 |
a81959a6420d067403715a5b7c70ed6c723b438a | [
"self._gtobjs = {}\nself.lang = AppriseLocale.detect_language(language)\nif GETTEXT_LOADED is False:\n return\nif self.lang:\n try:\n self._gtobjs[self.lang] = gettext.translation(DOMAIN, localedir=LOCALE_DIR, languages=[self.lang])\n self._gtobjs[self.lang].install()\n except IOError:\n ... | <|body_start_0|>
self._gtobjs = {}
self.lang = AppriseLocale.detect_language(language)
if GETTEXT_LOADED is False:
return
if self.lang:
try:
self._gtobjs[self.lang] = gettext.translation(DOMAIN, localedir=LOCALE_DIR, languages=[self.lang])
... | A wrapper class to gettext so that we can manipulate multiple lanaguages on the fly if required. | AppriseLocale | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppriseLocale:
"""A wrapper class to gettext so that we can manipulate multiple lanaguages on the fly if required."""
def __init__(self, language=None):
"""Initializes our object, if a language is specified, then we initialize ourselves to that, otherwise we use whatever we detect fr... | stack_v2_sparse_classes_75kplus_train_068316 | 7,036 | permissive | [
{
"docstring": "Initializes our object, if a language is specified, then we initialize ourselves to that, otherwise we use whatever we detect from the local operating system. If all else fails, we resort to the defined default_language.",
"name": "__init__",
"signature": "def __init__(self, language=Non... | 3 | stack_v2_sparse_classes_30k_train_005501 | Implement the Python class `AppriseLocale` described below.
Class description:
A wrapper class to gettext so that we can manipulate multiple lanaguages on the fly if required.
Method signatures and docstrings:
- def __init__(self, language=None): Initializes our object, if a language is specified, then we initialize ... | Implement the Python class `AppriseLocale` described below.
Class description:
A wrapper class to gettext so that we can manipulate multiple lanaguages on the fly if required.
Method signatures and docstrings:
- def __init__(self, language=None): Initializes our object, if a language is specified, then we initialize ... | 784e073eea64d2ee37cc52e7a2391bce35b05720 | <|skeleton|>
class AppriseLocale:
"""A wrapper class to gettext so that we can manipulate multiple lanaguages on the fly if required."""
def __init__(self, language=None):
"""Initializes our object, if a language is specified, then we initialize ourselves to that, otherwise we use whatever we detect fr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AppriseLocale:
"""A wrapper class to gettext so that we can manipulate multiple lanaguages on the fly if required."""
def __init__(self, language=None):
"""Initializes our object, if a language is specified, then we initialize ourselves to that, otherwise we use whatever we detect from the local ... | the_stack_v2_python_sparse | apprise/AppriseLocale.py | raman325/apprise | train | 1 |
a0123f76b9e5d5ea2c6c6d4de5954d068b697cd5 | [
"frame = Frame(user=user or g.current_user)\nframe.from_dict(data)\nreturn frame",
"for key in list(data.keys()):\n try:\n setattr(self, key, data[key])\n except KeyError:\n print(f'Key {key} not valid.')"
] | <|body_start_0|>
frame = Frame(user=user or g.current_user)
frame.from_dict(data)
return frame
<|end_body_0|>
<|body_start_1|>
for key in list(data.keys()):
try:
setattr(self, key, data[key])
except KeyError:
print(f'Key {key} not ... | The Frames model Attributes: __tablename__ (str): Table name for user model in database instance (SQLAlchemy table column, str): Unique ID for processed frame date (SQLAlchemy table column, datetime): Date that frame is processed session_id (SQLAlchemy table column, int): User's login count frame_count (SQLAlchemy tabl... | Frame | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Frame:
"""The Frames model Attributes: __tablename__ (str): Table name for user model in database instance (SQLAlchemy table column, str): Unique ID for processed frame date (SQLAlchemy table column, datetime): Date that frame is processed session_id (SQLAlchemy table column, int): User's login c... | stack_v2_sparse_classes_75kplus_train_068317 | 7,286 | permissive | [
{
"docstring": "Create a new frame. The user is obtained from the context unless provided explicitly. Args: data (dict): Dictionary containing values for some or all class attributes listed above Returns: frame (object): Newly generated frame",
"name": "create",
"signature": "def create(data, user=None)... | 2 | stack_v2_sparse_classes_30k_train_013352 | Implement the Python class `Frame` described below.
Class description:
The Frames model Attributes: __tablename__ (str): Table name for user model in database instance (SQLAlchemy table column, str): Unique ID for processed frame date (SQLAlchemy table column, datetime): Date that frame is processed session_id (SQLAlc... | Implement the Python class `Frame` described below.
Class description:
The Frames model Attributes: __tablename__ (str): Table name for user model in database instance (SQLAlchemy table column, str): Unique ID for processed frame date (SQLAlchemy table column, datetime): Date that frame is processed session_id (SQLAlc... | d1ddc6d086bf93b36a430fbcae0af14b9c584e92 | <|skeleton|>
class Frame:
"""The Frames model Attributes: __tablename__ (str): Table name for user model in database instance (SQLAlchemy table column, str): Unique ID for processed frame date (SQLAlchemy table column, datetime): Date that frame is processed session_id (SQLAlchemy table column, int): User's login c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Frame:
"""The Frames model Attributes: __tablename__ (str): Table name for user model in database instance (SQLAlchemy table column, str): Unique ID for processed frame date (SQLAlchemy table column, datetime): Date that frame is processed session_id (SQLAlchemy table column, int): User's login count frame_co... | the_stack_v2_python_sparse | gesture_recognition/models.py | JoshBClemons/gesture_recognition | train | 0 |
8f429a0287307f1780503d984f1fb61d48938f27 | [
"super().__init__(*args, **kwargs)\nself.OUT_QUESTION_MUL = OUT_QUESTION_MUL\nself.outQuestion = Linear(CMD_DIM, CMD_DIM)\nself.in_dim = 3 * self.in_dim if OUT_QUESTION_MUL else 2 * self.in_dim\nself.classifier_layer = nn.Sequential(nn.Dropout(1 - outputDropout), Linear(self.in_dim, CMD_DIM), nn.ELU(), nn.Dropout(1... | <|body_start_0|>
super().__init__(*args, **kwargs)
self.OUT_QUESTION_MUL = OUT_QUESTION_MUL
self.outQuestion = Linear(CMD_DIM, CMD_DIM)
self.in_dim = 3 * self.in_dim if OUT_QUESTION_MUL else 2 * self.in_dim
self.classifier_layer = nn.Sequential(nn.Dropout(1 - outputDropout), Line... | LCGNClassiferHead | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LCGNClassiferHead:
def __init__(self, OUT_QUESTION_MUL: bool, CMD_DIM: int, outputDropout: float, *args, **kwargs) -> None:
"""initialization of LCGNClassiferHead. Args: OUT_QUESTION_MUL: bool to identify if do the multiplication opearation based on features CMD_DIM: command vector's dim... | stack_v2_sparse_classes_75kplus_train_068318 | 8,420 | permissive | [
{
"docstring": "initialization of LCGNClassiferHead. Args: OUT_QUESTION_MUL: bool to identify if do the multiplication opearation based on features CMD_DIM: command vector's dimension outputDropout: dropout rate in output layer *args: optional **kwargs: optional",
"name": "__init__",
"signature": "def _... | 2 | stack_v2_sparse_classes_30k_train_013879 | Implement the Python class `LCGNClassiferHead` described below.
Class description:
Implement the LCGNClassiferHead class.
Method signatures and docstrings:
- def __init__(self, OUT_QUESTION_MUL: bool, CMD_DIM: int, outputDropout: float, *args, **kwargs) -> None: initialization of LCGNClassiferHead. Args: OUT_QUESTION... | Implement the Python class `LCGNClassiferHead` described below.
Class description:
Implement the LCGNClassiferHead class.
Method signatures and docstrings:
- def __init__(self, OUT_QUESTION_MUL: bool, CMD_DIM: int, outputDropout: float, *args, **kwargs) -> None: initialization of LCGNClassiferHead. Args: OUT_QUESTION... | af87a17275f02c94932bb2e29f132a84db812002 | <|skeleton|>
class LCGNClassiferHead:
def __init__(self, OUT_QUESTION_MUL: bool, CMD_DIM: int, outputDropout: float, *args, **kwargs) -> None:
"""initialization of LCGNClassiferHead. Args: OUT_QUESTION_MUL: bool to identify if do the multiplication opearation based on features CMD_DIM: command vector's dim... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LCGNClassiferHead:
def __init__(self, OUT_QUESTION_MUL: bool, CMD_DIM: int, outputDropout: float, *args, **kwargs) -> None:
"""initialization of LCGNClassiferHead. Args: OUT_QUESTION_MUL: bool to identify if do the multiplication opearation based on features CMD_DIM: command vector's dimension outputD... | the_stack_v2_python_sparse | imix/models/heads/classifier_mix.py | linxi1158/iMIX | train | 0 | |
ca60386c219f28e2a6cc022b98731172f1ae6bc0 | [
"self.sum_matrix = [[0] * len(matrix[0]) for j in range(len(matrix))]\nself.matrix = matrix\nfor i in range(len(matrix)):\n summ = 0\n for j in range(len(matrix[0])):\n summ += matrix[i][j]\n self.sum_matrix[i][j] = summ",
"diff = val - self.matrix[row][col]\nself.matrix[row][col] = val\nfor i... | <|body_start_0|>
self.sum_matrix = [[0] * len(matrix[0]) for j in range(len(matrix))]
self.matrix = matrix
for i in range(len(matrix)):
summ = 0
for j in range(len(matrix[0])):
summ += matrix[i][j]
self.sum_matrix[i][j] = summ
<|end_body_0|... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_75kplus_train_068319 | 2,415 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row: int :type col: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, row, col, val)"
},
{
"docstring": ":type r... | 3 | stack_v2_sparse_classes_30k_train_014539 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | 6e4894c2d80413b13dc247d1783afd709ad984c8 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
self.sum_matrix = [[0] * len(matrix[0]) for j in range(len(matrix))]
self.matrix = matrix
for i in range(len(matrix)):
summ = 0
for j in range(len(matrix[0])):
sum... | the_stack_v2_python_sparse | leet_code308.py | tejamupparaju/LeetCode_Python | train | 2 | |
ff6a8054b1f8438a02fdde2f2a2fbb97630276db | [
"idx = list()\nfor i, value in enumerate(nums):\n for j in range(i + 1, len(nums)):\n if value + nums[j] == target:\n idx.append(i)\n idx.append(j)\nreturn idx",
"idx = list()\norder = sorted(range(len(nums)), key=lambda k: nums[k])\nnums = [nums[i] for i in order]\nfor i, value in... | <|body_start_0|>
idx = list()
for i, value in enumerate(nums):
for j in range(i + 1, len(nums)):
if value + nums[j] == target:
idx.append(i)
idx.append(j)
return idx
<|end_body_0|>
<|body_start_1|>
idx = list()
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
"""sort nums and retain order in original list start with a[0], check a[0]+a[1], then a[0]+a[n-1] then move to middl... | stack_v2_sparse_classes_75kplus_train_068320 | 5,563 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum1",
"signature": "def twoSum1(self, nums, target)"
},
{
"docstring": "sort nums and retain order in original list start with a[0], check a[0]+a[1], then a[0]+a[n-1] then move to middle SHOULD consider chec... | 5 | stack_v2_sparse_classes_30k_test_002111 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): sort nums and retain order in original list start wi... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): sort nums and retain order in original list start wi... | 4af44f7364c6fb4d95309056f7a7853de779b3bb | <|skeleton|>
class Solution:
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
"""sort nums and retain order in original list start with a[0], check a[0]+a[1], then a[0]+a[n-1] then move to middl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twoSum1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
idx = list()
for i, value in enumerate(nums):
for j in range(i + 1, len(nums)):
if value + nums[j] == target:
idx.append(i)
... | the_stack_v2_python_sparse | codes_python/0001_Two_Sum.py | mondler/leetcode | train | 0 | |
4a9cf49521b1d5efb99f675eb5a7431c06f342fc | [
"super().__init__()\nself.dropout = nn.Dropout(p=dropout)\nself.layers = numlayers\nself.dirs = 2 if bidirectional else 1\nself.hsz = hiddensize\nif input_dropout > 0 and unknown_idx is None:\n raise RuntimeError('input_dropout > 0 but unknown_idx not set')\nself.input_dropout = UnknownDropout(unknown_idx, input... | <|body_start_0|>
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.layers = numlayers
self.dirs = 2 if bidirectional else 1
self.hsz = hiddensize
if input_dropout > 0 and unknown_idx is None:
raise RuntimeError('input_dropout > 0 but unknown_idx not... | RNN Encoder. | RNNEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNEncoder:
"""RNN Encoder."""
def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidirectional=False, shared_lt=None, shared_rnn=None, input_dropout=0, unknown_idx=None, sparse=False):
"""Initialize recurrent encode... | stack_v2_sparse_classes_75kplus_train_068321 | 24,820 | permissive | [
{
"docstring": "Initialize recurrent encoder.",
"name": "__init__",
"signature": "def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidirectional=False, shared_lt=None, shared_rnn=None, input_dropout=0, unknown_idx=None, sparse=False)"... | 2 | stack_v2_sparse_classes_30k_val_002622 | Implement the Python class `RNNEncoder` described below.
Class description:
RNN Encoder.
Method signatures and docstrings:
- def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidirectional=False, shared_lt=None, shared_rnn=None, input_dropout=0, unk... | Implement the Python class `RNNEncoder` described below.
Class description:
RNN Encoder.
Method signatures and docstrings:
- def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidirectional=False, shared_lt=None, shared_rnn=None, input_dropout=0, unk... | e1d899edfb92471552bae153f59ad30aa7fca468 | <|skeleton|>
class RNNEncoder:
"""RNN Encoder."""
def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidirectional=False, shared_lt=None, shared_rnn=None, input_dropout=0, unknown_idx=None, sparse=False):
"""Initialize recurrent encode... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RNNEncoder:
"""RNN Encoder."""
def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidirectional=False, shared_lt=None, shared_rnn=None, input_dropout=0, unknown_idx=None, sparse=False):
"""Initialize recurrent encoder."""
... | the_stack_v2_python_sparse | parlai/agents/seq2seq/modules.py | facebookresearch/ParlAI | train | 10,943 |
2ac952ac12cdaefd7ce1c5123d3de49c3ba5d61f | [
"m, n = (len(grid), len(grid[0]))\n\ndef dfs(i: int, j: int):\n \"\"\" 深度优先搜索一个岛屿中的所有陆地,计算其面积 \"\"\"\n if 0 <= i < m and 0 <= j < n and (grid[i][j] == 1):\n nonlocal area\n area += 1\n grid[i][j] = 2\n dfs(i - 1, j)\n dfs(i + 1, j)\n dfs(i, j - 1)\n dfs(i, j + ... | <|body_start_0|>
m, n = (len(grid), len(grid[0]))
def dfs(i: int, j: int):
""" 深度优先搜索一个岛屿中的所有陆地,计算其面积 """
if 0 <= i < m and 0 <= j < n and (grid[i][j] == 1):
nonlocal area
area += 1
grid[i][j] = 2
dfs(i - 1, j)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
<|body_0|>
def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int:
"""BFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m, n = (len(grid), len(grid[0]))
def ... | stack_v2_sparse_classes_75kplus_train_068322 | 2,707 | no_license | [
{
"docstring": "DFS",
"name": "maxAreaOfIsland",
"signature": "def maxAreaOfIsland(self, grid: List[List[int]]) -> int"
},
{
"docstring": "BFS",
"name": "maxAreaOfIslandBFS",
"signature": "def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_006608 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: DFS
- def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int: BFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxAreaOfIsland(self, grid: List[List[int]]) -> int: DFS
- def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int: BFS
<|skeleton|>
class Solution:
def maxAreaOfIsl... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
<|body_0|>
def maxAreaOfIslandBFS(self, grid: List[List[int]]) -> int:
"""BFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
"""DFS"""
m, n = (len(grid), len(grid[0]))
def dfs(i: int, j: int):
""" 深度优先搜索一个岛屿中的所有陆地,计算其面积 """
if 0 <= i < m and 0 <= j < n and (grid[i][j] == 1):
nonlocal area
... | the_stack_v2_python_sparse | 695.岛屿的最大面积/solution.py | QtTao/daily_leetcode | train | 0 | |
7e1bf2c28a9124974ab2ad4a01134df0b6d50347 | [
"tally = {}\nfor i in nums:\n if not i in tally:\n tally[i] = 1\n else:\n tally[i] += 1\nnum, n = (nums[0], 0)\nfor i, t in tally.items():\n if t > n:\n num, n = (i, t)\nreturn num",
"candidate = 0\ntally = 1\nfor i in range(1, len(nums)):\n if nums[i] == nums[candidate]:\n ... | <|body_start_0|>
tally = {}
for i in nums:
if not i in tally:
tally[i] = 1
else:
tally[i] += 1
num, n = (nums[0], 0)
for i, t in tally.items():
if t > n:
num, n = (i, t)
return num
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def majorityElement(self, nums):
"""Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algorithm :type nums: list[int] :rtype int"""
<|body_0|>
def majorityElementMoore(self, nums):
"""Algorithm: O(n lgn) sort and take the middle one O(n) ... | stack_v2_sparse_classes_75kplus_train_068323 | 1,632 | no_license | [
{
"docstring": "Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algorithm :type nums: list[int] :rtype int",
"name": "majorityElement",
"signature": "def majorityElement(self, nums)"
},
{
"docstring": "Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algo... | 2 | stack_v2_sparse_classes_30k_train_013650 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums): Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algorithm :type nums: list[int] :rtype int
- def majorityElementMoore(self, ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums): Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algorithm :type nums: list[int] :rtype int
- def majorityElementMoore(self, ... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def majorityElement(self, nums):
"""Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algorithm :type nums: list[int] :rtype int"""
<|body_0|>
def majorityElementMoore(self, nums):
"""Algorithm: O(n lgn) sort and take the middle one O(n) ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def majorityElement(self, nums):
"""Algorithm: O(n lgn) sort and take the middle one O(n) Moore's Voting Algorithm :type nums: list[int] :rtype int"""
tally = {}
for i in nums:
if not i in tally:
tally[i] = 1
else:
tally... | the_stack_v2_python_sparse | M/MajorityElement.py | bssrdf/pyleet | train | 2 | |
6262c0041709a393733545ebe5f1060e82ce72e0 | [
"logFile = open(filePath + docName, 'r')\nlog = logFile.read().split('\\n')\nlogFile.close()\nreturn log",
"logFile = open(filePath + docName, 'w')\nlogFile.write(log)\nlogFile.close()",
"timeStamp = time.strftime('%Y/%m/%d\\t[%H:%M:%S]')\navgRunTim = art\ntotRunTim = trt\ndiceCodes = dcr\nprocFileN = pfn\nnewL... | <|body_start_0|>
logFile = open(filePath + docName, 'r')
log = logFile.read().split('\n')
logFile.close()
return log
<|end_body_0|>
<|body_start_1|>
logFile = open(filePath + docName, 'w')
logFile.write(log)
logFile.close()
<|end_body_1|>
<|body_start_2|>
... | SpreadsheetSearchLog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpreadsheetSearchLog:
def openLog(self, filePath='files\\', docName='SpreadsheetSearchLog.txt'):
"""open the SpreadsheetSearch Log file for editing. filePath --> base file path containing the log docName --> name of the SpreadsheetSearch log"""
<|body_0|>
def saveLog(self, l... | stack_v2_sparse_classes_75kplus_train_068324 | 2,779 | no_license | [
{
"docstring": "open the SpreadsheetSearch Log file for editing. filePath --> base file path containing the log docName --> name of the SpreadsheetSearch log",
"name": "openLog",
"signature": "def openLog(self, filePath='files\\\\', docName='SpreadsheetSearchLog.txt')"
},
{
"docstring": "save th... | 3 | null | Implement the Python class `SpreadsheetSearchLog` described below.
Class description:
Implement the SpreadsheetSearchLog class.
Method signatures and docstrings:
- def openLog(self, filePath='files\\', docName='SpreadsheetSearchLog.txt'): open the SpreadsheetSearch Log file for editing. filePath --> base file path co... | Implement the Python class `SpreadsheetSearchLog` described below.
Class description:
Implement the SpreadsheetSearchLog class.
Method signatures and docstrings:
- def openLog(self, filePath='files\\', docName='SpreadsheetSearchLog.txt'): open the SpreadsheetSearch Log file for editing. filePath --> base file path co... | ebcb022cd587a70f3a039f579880f99467ba0fce | <|skeleton|>
class SpreadsheetSearchLog:
def openLog(self, filePath='files\\', docName='SpreadsheetSearchLog.txt'):
"""open the SpreadsheetSearch Log file for editing. filePath --> base file path containing the log docName --> name of the SpreadsheetSearch log"""
<|body_0|>
def saveLog(self, l... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpreadsheetSearchLog:
def openLog(self, filePath='files\\', docName='SpreadsheetSearchLog.txt'):
"""open the SpreadsheetSearch Log file for editing. filePath --> base file path containing the log docName --> name of the SpreadsheetSearch log"""
logFile = open(filePath + docName, 'r')
l... | the_stack_v2_python_sparse | SpreadsheetSearchLog.py | gabastil/pyDocs | train | 0 | |
a59be2338f98961ea1354a8dece5d9f33c220211 | [
"if category:\n self.services[category].update()\nelse:\n for category in self.services:\n self.services[category].update()",
"if category:\n self.services[category].refresh_current_semester()\nelse:\n for category in self.refreshable_services:\n self.services[category].refresh_current_s... | <|body_start_0|>
if category:
self.services[category].update()
else:
for category in self.services:
self.services[category].update()
<|end_body_0|>
<|body_start_1|>
if category:
self.services[category].refresh_current_semester()
else:
... | Playlist Service. | PlaylistService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlaylistService:
"""Playlist Service."""
def update(self, category=None):
"""Update all playlist categories. If given category, update only playlists in that category."""
<|body_0|>
def refresh_current_semester(self, category=None):
"""Fetch the playlist courses ... | stack_v2_sparse_classes_75kplus_train_068325 | 2,278 | permissive | [
{
"docstring": "Update all playlist categories. If given category, update only playlists in that category.",
"name": "update",
"signature": "def update(self, category=None)"
},
{
"docstring": "Fetch the playlist courses from SIS for the current semester, overwriting the cache.",
"name": "ref... | 3 | stack_v2_sparse_classes_30k_train_019815 | Implement the Python class `PlaylistService` described below.
Class description:
Playlist Service.
Method signatures and docstrings:
- def update(self, category=None): Update all playlist categories. If given category, update only playlists in that category.
- def refresh_current_semester(self, category=None): Fetch ... | Implement the Python class `PlaylistService` described below.
Class description:
Playlist Service.
Method signatures and docstrings:
- def update(self, category=None): Update all playlist categories. If given category, update only playlists in that category.
- def refresh_current_semester(self, category=None): Fetch ... | 34578dc14c8e5c2cfb28f8d6710e791cdd773d59 | <|skeleton|>
class PlaylistService:
"""Playlist Service."""
def update(self, category=None):
"""Update all playlist categories. If given category, update only playlists in that category."""
<|body_0|>
def refresh_current_semester(self, category=None):
"""Fetch the playlist courses ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlaylistService:
"""Playlist Service."""
def update(self, category=None):
"""Update all playlist categories. If given category, update only playlists in that category."""
if category:
self.services[category].update()
else:
for category in self.services:
... | the_stack_v2_python_sparse | backend/playlist/service/playlist.py | AviFS/berkeleytime | train | 0 |
fc26cb07de0a6458130cedb2be9e5491fe0cc862 | [
"self.sensor_dimensions_in_cm = (Sensor_dim_in_px[0] * (pixel_size_in_um / 10000), Sensor_dim_in_px[1] * (pixel_size_in_um / 10000))\nself.focal_in_cm = focal_in_mm / 10\nself.element_height_in_cm = element_heigth_in_cm\nself.sensor_aperture_in_degrees = 2 * atan(self.sensor_dimensions_in_cm[0] / (2 * self.focal_in... | <|body_start_0|>
self.sensor_dimensions_in_cm = (Sensor_dim_in_px[0] * (pixel_size_in_um / 10000), Sensor_dim_in_px[1] * (pixel_size_in_um / 10000))
self.focal_in_cm = focal_in_mm / 10
self.element_height_in_cm = element_heigth_in_cm
self.sensor_aperture_in_degrees = 2 * atan(self.sensor... | CameraCalculator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraCalculator:
def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_IN_CM):
"""Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parame... | stack_v2_sparse_classes_75kplus_train_068326 | 5,412 | no_license | [
{
"docstring": "Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parameters of the camera (focal length, sensor dimensions and pixel size), the height of the target and the height of its detected reflexion in the camera sensor. :param pixel_size_in_um: Float. Pixel siz... | 4 | stack_v2_sparse_classes_30k_train_035060 | Implement the Python class `CameraCalculator` described below.
Class description:
Implement the CameraCalculator class.
Method signatures and docstrings:
- def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_I... | Implement the Python class `CameraCalculator` described below.
Class description:
Implement the CameraCalculator class.
Method signatures and docstrings:
- def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_I... | 5103b2bd78ffbbb42afb892bdca67859324726e9 | <|skeleton|>
class CameraCalculator:
def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_IN_CM):
"""Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parame... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CameraCalculator:
def __init__(self, pixel_size_in_um=SENSOR_PIXEL_SIZE_IN_UM, Sensor_dim_in_px=SENSOR_DIM_IN_PIXELS, focal_in_mm=FOCAL_IN_MM, element_heigth_in_cm=ELEMENT_HEIGHT_IN_CM):
"""Uses the Gauss Formula for Lens for calculating the distance to the baby in function of the parameters of the ca... | the_stack_v2_python_sparse | RobotController/PiCamera/CameraCalculator/CameraCalculator.py | Eric-Canas/BabyRobot | train | 1 | |
2e4425708b5b83bcb5a806ae0f01bfee33d19fe6 | [
"super(ClusterDeploymentConfigs, self).__init__()\nself.log = logger.setup_logging(self.__class__.__name__)\nself.schema_class = 'cluster_deployment_configs_schema.ClusterDeploymentConfigsSchema'\nself.set_connection(service.get_connection())\nself.create_endpoint = 'si/deploy'\nself.delete_endpoint = 'si/deploy/' ... | <|body_start_0|>
super(ClusterDeploymentConfigs, self).__init__()
self.log = logger.setup_logging(self.__class__.__name__)
self.schema_class = 'cluster_deployment_configs_schema.ClusterDeploymentConfigsSchema'
self.set_connection(service.get_connection())
self.create_endpoint = '... | ClusterDeploymentConfigs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClusterDeploymentConfigs:
def __init__(self, service=None):
"""Constructor to create ClusterDeploymentConfigs object @param vsm object on which ClusterDeploymentConfigs has to be configured"""
<|body_0|>
def delete(self, schema_object=None):
"""Over riding delete met... | stack_v2_sparse_classes_75kplus_train_068327 | 1,442 | no_license | [
{
"docstring": "Constructor to create ClusterDeploymentConfigs object @param vsm object on which ClusterDeploymentConfigs has to be configured",
"name": "__init__",
"signature": "def __init__(self, service=None)"
},
{
"docstring": "Over riding delete method to perform DELETE operation",
"nam... | 2 | stack_v2_sparse_classes_30k_train_006117 | Implement the Python class `ClusterDeploymentConfigs` described below.
Class description:
Implement the ClusterDeploymentConfigs class.
Method signatures and docstrings:
- def __init__(self, service=None): Constructor to create ClusterDeploymentConfigs object @param vsm object on which ClusterDeploymentConfigs has to... | Implement the Python class `ClusterDeploymentConfigs` described below.
Class description:
Implement the ClusterDeploymentConfigs class.
Method signatures and docstrings:
- def __init__(self, service=None): Constructor to create ClusterDeploymentConfigs object @param vsm object on which ClusterDeploymentConfigs has to... | 5b55817c050b637e2747084290f6206d2e622938 | <|skeleton|>
class ClusterDeploymentConfigs:
def __init__(self, service=None):
"""Constructor to create ClusterDeploymentConfigs object @param vsm object on which ClusterDeploymentConfigs has to be configured"""
<|body_0|>
def delete(self, schema_object=None):
"""Over riding delete met... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ClusterDeploymentConfigs:
def __init__(self, service=None):
"""Constructor to create ClusterDeploymentConfigs object @param vsm object on which ClusterDeploymentConfigs has to be configured"""
super(ClusterDeploymentConfigs, self).__init__()
self.log = logger.setup_logging(self.__class... | the_stack_v2_python_sparse | SystemTesting/pylib/nsx/vsm/service_insertion/cluster_deployment_configs.py | Cloudxtreme/MyProject | train | 0 | |
d9d441a089d8b563e8a752c66b6f3bbb2445bcde | [
"config = loadcookiecutterconfig(template.metadata.location, template.root)\nrenderer = createcookiecutterrenderer(template.root, config)\npaths = findcookiecutterpaths(template.root, config)\nhooks = findcookiecutterhooks(template.root)\nreturn cls(template.metadata, config, renderer, paths, hooks)",
"binder: Bi... | <|body_start_0|>
config = loadcookiecutterconfig(template.metadata.location, template.root)
renderer = createcookiecutterrenderer(template.root, config)
paths = findcookiecutterpaths(template.root, config)
hooks = findcookiecutterhooks(template.root)
return cls(template.metadata,... | A project generator. | ProjectGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectGenerator:
"""A project generator."""
def create(cls, template: Template) -> ProjectGenerator:
"""Create a project generator."""
<|body_0|>
def bind(self, *, interactive: bool=True, bindings: Sequence[Binding]=()) -> Sequence[Binding]:
"""Bind the variable... | stack_v2_sparse_classes_75kplus_train_068328 | 3,727 | permissive | [
{
"docstring": "Create a project generator.",
"name": "create",
"signature": "def create(cls, template: Template) -> ProjectGenerator"
},
{
"docstring": "Bind the variables.",
"name": "bind",
"signature": "def bind(self, *, interactive: bool=True, bindings: Sequence[Binding]=()) -> Seque... | 4 | stack_v2_sparse_classes_30k_train_046562 | Implement the Python class `ProjectGenerator` described below.
Class description:
A project generator.
Method signatures and docstrings:
- def create(cls, template: Template) -> ProjectGenerator: Create a project generator.
- def bind(self, *, interactive: bool=True, bindings: Sequence[Binding]=()) -> Sequence[Bindin... | Implement the Python class `ProjectGenerator` described below.
Class description:
A project generator.
Method signatures and docstrings:
- def create(cls, template: Template) -> ProjectGenerator: Create a project generator.
- def bind(self, *, interactive: bool=True, bindings: Sequence[Binding]=()) -> Sequence[Bindin... | c6b26377153d60d5da825002e03f9a28467378a9 | <|skeleton|>
class ProjectGenerator:
"""A project generator."""
def create(cls, template: Template) -> ProjectGenerator:
"""Create a project generator."""
<|body_0|>
def bind(self, *, interactive: bool=True, bindings: Sequence[Binding]=()) -> Sequence[Binding]:
"""Bind the variable... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectGenerator:
"""A project generator."""
def create(cls, template: Template) -> ProjectGenerator:
"""Create a project generator."""
config = loadcookiecutterconfig(template.metadata.location, template.root)
renderer = createcookiecutterrenderer(template.root, config)
p... | the_stack_v2_python_sparse | src/cutty/projects/generate.py | cjolowicz/cutty | train | 4 |
b57df1e75351369793b1073e61ac2bd351abd0ef | [
"if not head or head.next:\n return head\nnew_head = self.reverse_(head.next)\nhead.next.next = new_head\nhead.next = None\nreturn new_head",
"prev = None\ncurr = head\nwhile curr:\n next_node = curr.next\n curr.next = prev\n prev = curr\n curr = next_node\nreturn prev"
] | <|body_start_0|>
if not head or head.next:
return head
new_head = self.reverse_(head.next)
head.next.next = new_head
head.next = None
return new_head
<|end_body_0|>
<|body_start_1|>
prev = None
curr = head
while curr:
next_node = c... | LinkedList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkedList:
def reverse_(self, head: 'ListNode') -> 'ListNode':
"""Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:"""
<|body_0|>
def reverse(self, head: 'ListNode') -> 'ListNode':
"""Approach: Iterative Time Complexity: O(N) Spa... | stack_v2_sparse_classes_75kplus_train_068329 | 1,231 | no_license | [
{
"docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:",
"name": "reverse_",
"signature": "def reverse_(self, head: 'ListNode') -> 'ListNode'"
},
{
"docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return:... | 2 | stack_v2_sparse_classes_30k_train_044606 | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def reverse_(self, head: 'ListNode') -> 'ListNode': Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:
- def reverse(self, head: 'ListNode... | Implement the Python class `LinkedList` described below.
Class description:
Implement the LinkedList class.
Method signatures and docstrings:
- def reverse_(self, head: 'ListNode') -> 'ListNode': Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:
- def reverse(self, head: 'ListNode... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class LinkedList:
def reverse_(self, head: 'ListNode') -> 'ListNode':
"""Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:"""
<|body_0|>
def reverse(self, head: 'ListNode') -> 'ListNode':
"""Approach: Iterative Time Complexity: O(N) Spa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinkedList:
def reverse_(self, head: 'ListNode') -> 'ListNode':
"""Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param head: :return:"""
if not head or head.next:
return head
new_head = self.reverse_(head.next)
head.next.next = new_head
h... | the_stack_v2_python_sparse | goldman_sachs/reverse_linked_list.py | Shiv2157k/leet_code | train | 1 | |
1551cf21b02340673adabca151988a906dc0f1ae | [
"for i in range(1, len(array)):\n while i > 0 and array[i] < array[i - 1]:\n array[i], array[i - 1] = (array[i - 1], array[i])\n i -= 1",
"for i, val in enumerate(array):\n while i > 0 and val < array[i - 1]:\n array[i] = array[i - 1]\n i -= 1\n array[i] = val",
"j = 0\nfor ... | <|body_start_0|>
for i in range(1, len(array)):
while i > 0 and array[i] < array[i - 1]:
array[i], array[i - 1] = (array[i - 1], array[i])
i -= 1
<|end_body_0|>
<|body_start_1|>
for i, val in enumerate(array):
while i > 0 and val < array[i - 1]:
... | Contains various insertion sort implementations. http://en.wikipedia.org/wiki/Insertion_sort | Insertion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Insertion:
"""Contains various insertion sort implementations. http://en.wikipedia.org/wiki/Insertion_sort"""
def insertion(array):
"""Basic insertion sort. Still worst of O(n^2) but much faster than other algorithms of the same time complexity like bubble sort. Inplace: Yes Time com... | stack_v2_sparse_classes_75kplus_train_068330 | 14,101 | no_license | [
{
"docstring": "Basic insertion sort. Still worst of O(n^2) but much faster than other algorithms of the same time complexity like bubble sort. Inplace: Yes Time complexity: best O(n), avg and worst O(n^2)",
"name": "insertion",
"signature": "def insertion(array)"
},
{
"docstring": "Improves per... | 3 | stack_v2_sparse_classes_30k_train_033793 | Implement the Python class `Insertion` described below.
Class description:
Contains various insertion sort implementations. http://en.wikipedia.org/wiki/Insertion_sort
Method signatures and docstrings:
- def insertion(array): Basic insertion sort. Still worst of O(n^2) but much faster than other algorithms of the sam... | Implement the Python class `Insertion` described below.
Class description:
Contains various insertion sort implementations. http://en.wikipedia.org/wiki/Insertion_sort
Method signatures and docstrings:
- def insertion(array): Basic insertion sort. Still worst of O(n^2) but much faster than other algorithms of the sam... | c88059dc66297af577ad2b8afa4e0ac0ad622915 | <|skeleton|>
class Insertion:
"""Contains various insertion sort implementations. http://en.wikipedia.org/wiki/Insertion_sort"""
def insertion(array):
"""Basic insertion sort. Still worst of O(n^2) but much faster than other algorithms of the same time complexity like bubble sort. Inplace: Yes Time com... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Insertion:
"""Contains various insertion sort implementations. http://en.wikipedia.org/wiki/Insertion_sort"""
def insertion(array):
"""Basic insertion sort. Still worst of O(n^2) but much faster than other algorithms of the same time complexity like bubble sort. Inplace: Yes Time complexity: best... | the_stack_v2_python_sparse | codes/BuildLinks1.02/test_input/sort_codes/pysort.py | DaHuO/Supergraph | train | 2 |
9bc46ea84932af7397f0c23c585801421a479073 | [
"if len(nums) <= 1:\n return len(nums)\nsubStack = [nums[-1]]\nfor index in range(len(nums) - 2, -1, -1):\n if nums[index] < subStack[-1]:\n subStack.append(nums[index])\n elif nums[index] == subStack[-1]:\n continue\n else:\n position = self.findPosition(nums, subStack, 0, len(subS... | <|body_start_0|>
if len(nums) <= 1:
return len(nums)
subStack = [nums[-1]]
for index in range(len(nums) - 2, -1, -1):
if nums[index] < subStack[-1]:
subStack.append(nums[index])
elif nums[index] == subStack[-1]:
continue
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findPosition(self, nums, subStack, start, end, num):
"""找到num在subStack中应该处于的位置,并返回那个索引 :param nums:[int,] ,原始的数列 :param subStack: [int,],到目前为止已经构造好的降序数列栈 :param start: int,开... | stack_v2_sparse_classes_75kplus_train_068331 | 3,887 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "lengthOfLIS",
"signature": "def lengthOfLIS(self, nums)"
},
{
"docstring": "找到num在subStack中应该处于的位置,并返回那个索引 :param nums:[int,] ,原始的数列 :param subStack: [int,],到目前为止已经构造好的降序数列栈 :param start: int,开始索引 :param end: int,终止索引 :param num: int,新... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
- def findPosition(self, nums, subStack, start, end, num): 找到num在subStack中应该处于的位置,并返回那个索引 :param nums:[int,] ,原始的数列... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS(self, nums): :type nums: List[int] :rtype: int
- def findPosition(self, nums, subStack, start, end, num): 找到num在subStack中应该处于的位置,并返回那个索引 :param nums:[int,] ,原始的数列... | 807ba32ed7802b756e93dfe44264dac5bb9317a0 | <|skeleton|>
class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findPosition(self, nums, subStack, start, end, num):
"""找到num在subStack中应该处于的位置,并返回那个索引 :param nums:[int,] ,原始的数列 :param subStack: [int,],到目前为止已经构造好的降序数列栈 :param start: int,开... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lengthOfLIS(self, nums):
""":type nums: List[int] :rtype: int"""
if len(nums) <= 1:
return len(nums)
subStack = [nums[-1]]
for index in range(len(nums) - 2, -1, -1):
if nums[index] < subStack[-1]:
subStack.append(nums[index]... | the_stack_v2_python_sparse | num201_300/num291_300/num300.py | guozhaoxin/leetcode | train | 0 | |
01627473b422a441a17a979212c1f4becc5f189f | [
"filter_list, update_list = parse_and_validate_bulk_update_arguments(filter, update)\nassert filter_list == expected_output[0]\nassert update_list == expected_output[1]",
"with pytest.raises(DemistoException) as e:\n parse_and_validate_bulk_update_arguments(filter, update)\n assert error_message in str(e.va... | <|body_start_0|>
filter_list, update_list = parse_and_validate_bulk_update_arguments(filter, update)
assert filter_list == expected_output[0]
assert update_list == expected_output[1]
<|end_body_0|>
<|body_start_1|>
with pytest.raises(DemistoException) as e:
parse_and_validat... | Class for bulk_update_query_command UTs. | TestBulkUpdateQueryCommands | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBulkUpdateQueryCommands:
"""Class for bulk_update_query_command UTs."""
def test_parse_and_validate_bulk_update_arguments(self, filter, update, expected_output):
"""Given: valid arguments for bulk update command When: running mongodb-bulk-update command in XSOAR Then: parse_and_v... | stack_v2_sparse_classes_75kplus_train_068332 | 17,096 | permissive | [
{
"docstring": "Given: valid arguments for bulk update command When: running mongodb-bulk-update command in XSOAR Then: parse_and_validate_bulk_update_arguments will parse validate the filter and update arguments",
"name": "test_parse_and_validate_bulk_update_arguments",
"signature": "def test_parse_and... | 3 | stack_v2_sparse_classes_30k_train_029372 | Implement the Python class `TestBulkUpdateQueryCommands` described below.
Class description:
Class for bulk_update_query_command UTs.
Method signatures and docstrings:
- def test_parse_and_validate_bulk_update_arguments(self, filter, update, expected_output): Given: valid arguments for bulk update command When: runni... | Implement the Python class `TestBulkUpdateQueryCommands` described below.
Class description:
Class for bulk_update_query_command UTs.
Method signatures and docstrings:
- def test_parse_and_validate_bulk_update_arguments(self, filter, update, expected_output): Given: valid arguments for bulk update command When: runni... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestBulkUpdateQueryCommands:
"""Class for bulk_update_query_command UTs."""
def test_parse_and_validate_bulk_update_arguments(self, filter, update, expected_output):
"""Given: valid arguments for bulk update command When: running mongodb-bulk-update command in XSOAR Then: parse_and_v... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestBulkUpdateQueryCommands:
"""Class for bulk_update_query_command UTs."""
def test_parse_and_validate_bulk_update_arguments(self, filter, update, expected_output):
"""Given: valid arguments for bulk update command When: running mongodb-bulk-update command in XSOAR Then: parse_and_validate_bulk_... | the_stack_v2_python_sparse | Packs/MongoDB/Integrations/MongoDB/MongoDB_test.py | demisto/content | train | 1,023 |
c9065dd7580a48a9039bf4a86fd0b4dff7c93942 | [
"for name, tpl in utils.get_domain_limit_templates():\n if name == self.name:\n return tpl\nreturn None",
"definition = self.definition\nif not definition:\n raise RuntimeError('Bad limit {}'.format(self.name))\nrelation = getattr(self.domain, definition['relation'])\nif 'extra_filters' in definition... | <|body_start_0|>
for name, tpl in utils.get_domain_limit_templates():
if name == self.name:
return tpl
return None
<|end_body_0|>
<|body_start_1|>
definition = self.definition
if not definition:
raise RuntimeError('Bad limit {}'.format(self.name))... | Per-domain limits on object creation. | DomainObjectLimit | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DomainObjectLimit:
"""Per-domain limits on object creation."""
def definition(self):
"""Return the definition of this limit."""
<|body_0|>
def current_value(self) -> int:
"""Return the current number of objects."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_75kplus_train_068333 | 5,094 | permissive | [
{
"docstring": "Return the definition of this limit.",
"name": "definition",
"signature": "def definition(self)"
},
{
"docstring": "Return the current number of objects.",
"name": "current_value",
"signature": "def current_value(self) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_015818 | Implement the Python class `DomainObjectLimit` described below.
Class description:
Per-domain limits on object creation.
Method signatures and docstrings:
- def definition(self): Return the definition of this limit.
- def current_value(self) -> int: Return the current number of objects. | Implement the Python class `DomainObjectLimit` described below.
Class description:
Per-domain limits on object creation.
Method signatures and docstrings:
- def definition(self): Return the definition of this limit.
- def current_value(self) -> int: Return the current number of objects.
<|skeleton|>
class DomainObje... | df699aab0799ec1725b6b89be38e56285821c889 | <|skeleton|>
class DomainObjectLimit:
"""Per-domain limits on object creation."""
def definition(self):
"""Return the definition of this limit."""
<|body_0|>
def current_value(self) -> int:
"""Return the current number of objects."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DomainObjectLimit:
"""Per-domain limits on object creation."""
def definition(self):
"""Return the definition of this limit."""
for name, tpl in utils.get_domain_limit_templates():
if name == self.name:
return tpl
return None
def current_value(self... | the_stack_v2_python_sparse | modoboa/limits/models.py | modoboa/modoboa | train | 2,201 |
e1a73872bc01451676c5afa74deeaf9143289763 | [
"logger.info('Begin {0} x {1} experiment, bot={2}, mutation_rate={3}.'.format(n, m, bot, mutation_rate))\nself.n = n\nself.m = m\nself.bot = bot\nself.mutation_rate = mutation_rate\nself.recruiter = u'bots' if bot else u'None'\nself.bot_policy = u'AdvantageSeekingBot' if bot else u'None'\nself.run(n, m)",
"logger... | <|body_start_0|>
logger.info('Begin {0} x {1} experiment, bot={2}, mutation_rate={3}.'.format(n, m, bot, mutation_rate))
self.n = n
self.m = m
self.bot = bot
self.mutation_rate = mutation_rate
self.recruiter = u'bots' if bot else u'None'
self.bot_policy = u'Advant... | The n x m iteractive evolutionary algorithm | Evolve | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Evolve:
"""The n x m iteractive evolutionary algorithm"""
def __init__(self, n, m, bot=False, mutation_rate=0.1):
"""Run experiment loop"""
<|body_0|>
def player_feedback(self, currPay, lastPay, feedback):
"""Generate feedback based on dollars earned. This requir... | stack_v2_sparse_classes_75kplus_train_068334 | 8,532 | no_license | [
{
"docstring": "Run experiment loop",
"name": "__init__",
"signature": "def __init__(self, n, m, bot=False, mutation_rate=0.1)"
},
{
"docstring": "Generate feedback based on dollars earned. This requires a check to see how fun the game is based on fixed amounts of money in the beginning, relativ... | 3 | stack_v2_sparse_classes_30k_train_029712 | Implement the Python class `Evolve` described below.
Class description:
The n x m iteractive evolutionary algorithm
Method signatures and docstrings:
- def __init__(self, n, m, bot=False, mutation_rate=0.1): Run experiment loop
- def player_feedback(self, currPay, lastPay, feedback): Generate feedback based on dollar... | Implement the Python class `Evolve` described below.
Class description:
The n x m iteractive evolutionary algorithm
Method signatures and docstrings:
- def __init__(self, n, m, bot=False, mutation_rate=0.1): Run experiment loop
- def player_feedback(self, currPay, lastPay, feedback): Generate feedback based on dollar... | db433433e5755d6d8f2daca679823958d8715cc5 | <|skeleton|>
class Evolve:
"""The n x m iteractive evolutionary algorithm"""
def __init__(self, n, m, bot=False, mutation_rate=0.1):
"""Run experiment loop"""
<|body_0|>
def player_feedback(self, currPay, lastPay, feedback):
"""Generate feedback based on dollars earned. This requir... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Evolve:
"""The n x m iteractive evolutionary algorithm"""
def __init__(self, n, m, bot=False, mutation_rate=0.1):
"""Run experiment loop"""
logger.info('Begin {0} x {1} experiment, bot={2}, mutation_rate={3}.'.format(n, m, bot, mutation_rate))
self.n = n
self.m = m
... | the_stack_v2_python_sparse | demos/iec_demo.py | Dallinger/Griduniverse | train | 5 |
e53b88a283a5d842c8838222976b7a6ff70a74cf | [
"self.s = s\nself.res = []\nself.visited = [False for _ in range(len(s))]\nself.dfs(0, [])\nreturn list(self.res)",
"if len(path) == len(self.s):\n self.res.append(''.join(path))\n return\nrepeat = set()\nfor i in range(len(self.s)):\n if not self.visited[i] and self.s[i] not in repeat:\n repeat.a... | <|body_start_0|>
self.s = s
self.res = []
self.visited = [False for _ in range(len(s))]
self.dfs(0, [])
return list(self.res)
<|end_body_0|>
<|body_start_1|>
if len(path) == len(self.s):
self.res.append(''.join(path))
return
repeat = set()... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permutation(self, s):
"""Args: s: str Return: list[str]"""
<|body_0|>
def dfs(self, index, path):
"""Args: index: int path: list[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.s = s
self.res = []
self.visited... | stack_v2_sparse_classes_75kplus_train_068335 | 1,767 | no_license | [
{
"docstring": "Args: s: str Return: list[str]",
"name": "permutation",
"signature": "def permutation(self, s)"
},
{
"docstring": "Args: index: int path: list[str]",
"name": "dfs",
"signature": "def dfs(self, index, path)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014938 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permutation(self, s): Args: s: str Return: list[str]
- def dfs(self, index, path): Args: index: int path: list[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permutation(self, s): Args: s: str Return: list[str]
- def dfs(self, index, path): Args: index: int path: list[str]
<|skeleton|>
class Solution:
def permutation(self, s... | 101bce2fac8b188a4eb2f5e017293d21ad0ecb21 | <|skeleton|>
class Solution:
def permutation(self, s):
"""Args: s: str Return: list[str]"""
<|body_0|>
def dfs(self, index, path):
"""Args: index: int path: list[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def permutation(self, s):
"""Args: s: str Return: list[str]"""
self.s = s
self.res = []
self.visited = [False for _ in range(len(s))]
self.dfs(0, [])
return list(self.res)
def dfs(self, index, path):
"""Args: index: int path: list[str]"""
... | the_stack_v2_python_sparse | 剑指offer/剑指 Offer 38. 字符串的排列.py | AiZhanghan/Leetcode | train | 0 | |
e672577da09a1355cc0d899d4b1077a670613154 | [
"def is_exe(f):\n return os.path.isfile(f) and os.access(f, os.X_OK)\nfpath, fname = os.path.split(cmd)\nif fpath:\n if is_exe(cmd):\n self._gulp_cmd = cmd\n return\nelse:\n for path in os.environ['PATH'].split(os.pathsep):\n path = path.strip('\"')\n file = os.path.join(path, c... | <|body_start_0|>
def is_exe(f):
return os.path.isfile(f) and os.access(f, os.X_OK)
fpath, fname = os.path.split(cmd)
if fpath:
if is_exe(cmd):
self._gulp_cmd = cmd
return
else:
for path in os.environ['PATH'].split(os.pat... | Class to run gulp from commandline | GulpCaller | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GulpCaller:
"""Class to run gulp from commandline"""
def __init__(self, cmd='gulp'):
"""Initialize with the executable if not in the standard path Args: cmd: Command. Defaults to gulp."""
<|body_0|>
def run(self, gin):
"""Run GULP using the gin as input Args: gin... | stack_v2_sparse_classes_75kplus_train_068336 | 26,921 | permissive | [
{
"docstring": "Initialize with the executable if not in the standard path Args: cmd: Command. Defaults to gulp.",
"name": "__init__",
"signature": "def __init__(self, cmd='gulp')"
},
{
"docstring": "Run GULP using the gin as input Args: gin: GULP input string Returns: gout: GULP output string",... | 2 | stack_v2_sparse_classes_30k_val_001678 | Implement the Python class `GulpCaller` described below.
Class description:
Class to run gulp from commandline
Method signatures and docstrings:
- def __init__(self, cmd='gulp'): Initialize with the executable if not in the standard path Args: cmd: Command. Defaults to gulp.
- def run(self, gin): Run GULP using the g... | Implement the Python class `GulpCaller` described below.
Class description:
Class to run gulp from commandline
Method signatures and docstrings:
- def __init__(self, cmd='gulp'): Initialize with the executable if not in the standard path Args: cmd: Command. Defaults to gulp.
- def run(self, gin): Run GULP using the g... | 62ecae1c7382a41861e3a5d9b9c8dd1207472409 | <|skeleton|>
class GulpCaller:
"""Class to run gulp from commandline"""
def __init__(self, cmd='gulp'):
"""Initialize with the executable if not in the standard path Args: cmd: Command. Defaults to gulp."""
<|body_0|>
def run(self, gin):
"""Run GULP using the gin as input Args: gin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GulpCaller:
"""Class to run gulp from commandline"""
def __init__(self, cmd='gulp'):
"""Initialize with the executable if not in the standard path Args: cmd: Command. Defaults to gulp."""
def is_exe(f):
return os.path.isfile(f) and os.access(f, os.X_OK)
fpath, fname = ... | the_stack_v2_python_sparse | pymatgen/command_line/gulp_caller.py | montoyjh/pymatgen | train | 2 |
83dc42edefe43ae0c3df9af1d792d5d8e370ea2a | [
"QObject.__init__(self, parent)\nself._sequence = 0\nself.grp = grp\nself.vectorDatasets = {}\nself.chunkIndices = {}\nfor name, dtype in vectorFields:\n if compression:\n kwargs = {'compression': 'gzip', 'shuffle': True, 'fletcher32': True}\n else:\n kwargs = {}\n ds = self.grp.create_datase... | <|body_start_0|>
QObject.__init__(self, parent)
self._sequence = 0
self.grp = grp
self.vectorDatasets = {}
self.chunkIndices = {}
for name, dtype in vectorFields:
if compression:
kwargs = {'compression': 'gzip', 'shuffle': True, 'fletcher32': T... | *HdfStreamWriter* writes multiple datastreams to hdf files, with the data coming in chunks. The hdf datasets are expanded automatically. | HdfStreamsWriter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HdfStreamsWriter:
"""*HdfStreamWriter* writes multiple datastreams to hdf files, with the data coming in chunks. The hdf datasets are expanded automatically."""
def __init__(self, grp, vectorFields, scalarFields=[], compression=True, parent=None):
"""Construct a HdfStreamWriter objec... | stack_v2_sparse_classes_75kplus_train_068337 | 9,074 | no_license | [
{
"docstring": "Construct a HdfStreamWriter object. *grp*: the hdfRoot where the datasets will be created *vectorFields* : list of (name, dtype) tuples specifying the names and data-types of the vector data *scalarFields*: list of tuples specifying name and datatypes of any additional scalar data to be stored f... | 2 | stack_v2_sparse_classes_30k_train_044267 | Implement the Python class `HdfStreamsWriter` described below.
Class description:
*HdfStreamWriter* writes multiple datastreams to hdf files, with the data coming in chunks. The hdf datasets are expanded automatically.
Method signatures and docstrings:
- def __init__(self, grp, vectorFields, scalarFields=[], compress... | Implement the Python class `HdfStreamsWriter` described below.
Class description:
*HdfStreamWriter* writes multiple datastreams to hdf files, with the data coming in chunks. The hdf datasets are expanded automatically.
Method signatures and docstrings:
- def __init__(self, grp, vectorFields, scalarFields=[], compress... | ffba586a4aec423c3dd126be535ea07d84b10eff | <|skeleton|>
class HdfStreamsWriter:
"""*HdfStreamWriter* writes multiple datastreams to hdf files, with the data coming in chunks. The hdf datasets are expanded automatically."""
def __init__(self, grp, vectorFields, scalarFields=[], compression=True, parent=None):
"""Construct a HdfStreamWriter objec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HdfStreamsWriter:
"""*HdfStreamWriter* writes multiple datastreams to hdf files, with the data coming in chunks. The hdf datasets are expanded automatically."""
def __init__(self, grp, vectorFields, scalarFields=[], compression=True, parent=None):
"""Construct a HdfStreamWriter object. *grp*: the... | the_stack_v2_python_sparse | Utility/HdfWriter.py | AvirupRoy/research | train | 0 |
bcf1b9c13fa954c345b9ae9778b1cea8e402d049 | [
"super(Expmap0, self).__init__()\nself.clamp_min = ClampMin()\nself.min_norm = min_norm\nself.clamp_tanh = ClampTanh()\nself.norm_k = Norm(axis=-1, keep_dims=True)",
"sqrt_c = c ** 0.5\nu_norm = self.clamp_min(self.norm_k(u), self.min_norm)\ngamma_1 = self.clamp_tanh(sqrt_c * u_norm) * u / (sqrt_c * u_norm)\nretu... | <|body_start_0|>
super(Expmap0, self).__init__()
self.clamp_min = ClampMin()
self.min_norm = min_norm
self.clamp_tanh = ClampTanh()
self.norm_k = Norm(axis=-1, keep_dims=True)
<|end_body_0|>
<|body_start_1|>
sqrt_c = c ** 0.5
u_norm = self.clamp_min(self.norm_k(u... | expmap0 class | Expmap0 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Expmap0:
"""expmap0 class"""
def __init__(self, min_norm):
"""init fun"""
<|body_0|>
def construct(self, u, c):
"""constructfun"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(Expmap0, self).__init__()
self.clamp_min = ClampMin()
... | stack_v2_sparse_classes_75kplus_train_068338 | 8,596 | permissive | [
{
"docstring": "init fun",
"name": "__init__",
"signature": "def __init__(self, min_norm)"
},
{
"docstring": "constructfun",
"name": "construct",
"signature": "def construct(self, u, c)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008344 | Implement the Python class `Expmap0` described below.
Class description:
expmap0 class
Method signatures and docstrings:
- def __init__(self, min_norm): init fun
- def construct(self, u, c): constructfun | Implement the Python class `Expmap0` described below.
Class description:
expmap0 class
Method signatures and docstrings:
- def __init__(self, min_norm): init fun
- def construct(self, u, c): constructfun
<|skeleton|>
class Expmap0:
"""expmap0 class"""
def __init__(self, min_norm):
"""init fun"""
... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class Expmap0:
"""expmap0 class"""
def __init__(self, min_norm):
"""init fun"""
<|body_0|>
def construct(self, u, c):
"""constructfun"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Expmap0:
"""expmap0 class"""
def __init__(self, min_norm):
"""init fun"""
super(Expmap0, self).__init__()
self.clamp_min = ClampMin()
self.min_norm = min_norm
self.clamp_tanh = ClampTanh()
self.norm_k = Norm(axis=-1, keep_dims=True)
def construct(self,... | the_stack_v2_python_sparse | research/nlp/hypertext/src/poincare.py | mindspore-ai/models | train | 301 |
56445945f919ee175790c234783392aec87525df | [
"self.k = k\nself.heap = nums\nheapq.heapify(self.heap)\nwhile len(self.heap) > k:\n heapq.heappop(self.heap)",
"if len(self.heap) < self.k:\n heapq.heappush(self.heap, val)\nelif val > self.heap[0]:\n heapq.heapreplace(self.heap, val)\nreturn self.heap[0]"
] | <|body_start_0|>
self.k = k
self.heap = nums
heapq.heapify(self.heap)
while len(self.heap) > k:
heapq.heappop(self.heap)
<|end_body_0|>
<|body_start_1|>
if len(self.heap) < self.k:
heapq.heappush(self.heap, val)
elif val > self.heap[0]:
... | 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.k = k
self.heap = nums
heapq.heapify(... | stack_v2_sparse_classes_75kplus_train_068339 | 1,213 | 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_train_004190 | 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... | 1461b10b8910fa90a311939c6df9082a8526f9b1 | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k, nums):
""":type k: int :type nums: List[int]"""
self.k = k
self.heap = nums
heapq.heapify(self.heap)
while len(self.heap) > k:
heapq.heappop(self.heap)
def add(self, val):
""":type val: int :rtype: int"""
... | the_stack_v2_python_sparse | Easy/703_kthLargestElementInAStream.py | Yucheng7713/CodingPracticeByYuch | train | 0 | |
6da662f984b025a6a22fd9967d4e14877fc7044a | [
"user = User.find_by(id_=get_jwt_identity())\nteams = list(user.teams)\nreturn teams",
"team = Team(**params).save()\nuser = User.find_by(id_=get_jwt_identity())\nteam.members.connect(user)\n_notify_of_team_creation(team)\nreturn team"
] | <|body_start_0|>
user = User.find_by(id_=get_jwt_identity())
teams = list(user.teams)
return teams
<|end_body_0|>
<|body_start_1|>
team = Team(**params).save()
user = User.find_by(id_=get_jwt_identity())
team.members.connect(user)
_notify_of_team_creation(team)
... | Controller for teams | TeamsView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamsView:
"""Controller for teams"""
def get(self, **params):
"""Logic for querying several teams"""
<|body_0|>
def post(self, **params):
"""Logic for creating a team"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = User.find_by(id_=get_j... | stack_v2_sparse_classes_75kplus_train_068340 | 3,112 | permissive | [
{
"docstring": "Logic for querying several teams",
"name": "get",
"signature": "def get(self, **params)"
},
{
"docstring": "Logic for creating a team",
"name": "post",
"signature": "def post(self, **params)"
}
] | 2 | null | Implement the Python class `TeamsView` described below.
Class description:
Controller for teams
Method signatures and docstrings:
- def get(self, **params): Logic for querying several teams
- def post(self, **params): Logic for creating a team | Implement the Python class `TeamsView` described below.
Class description:
Controller for teams
Method signatures and docstrings:
- def get(self, **params): Logic for querying several teams
- def post(self, **params): Logic for creating a team
<|skeleton|>
class TeamsView:
"""Controller for teams"""
def get... | 98173eb380bd6add52b21dc9045893949a8a2d30 | <|skeleton|>
class TeamsView:
"""Controller for teams"""
def get(self, **params):
"""Logic for querying several teams"""
<|body_0|>
def post(self, **params):
"""Logic for creating a team"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeamsView:
"""Controller for teams"""
def get(self, **params):
"""Logic for querying several teams"""
user = User.find_by(id_=get_jwt_identity())
teams = list(user.teams)
return teams
def post(self, **params):
"""Logic for creating a team"""
team = Tea... | the_stack_v2_python_sparse | application/teams/teams_view.py | hpi-sam/ask-your-repository-api | train | 4 |
d8511d383996cf7221d95f5083db567872bd5bf4 | [
"n = len(arr)\nans = 0\nMOD = 10 ** 9 + 7\nm = {}\nfor i in range(n - 1):\n for j in range(i + 1, n):\n if target - arr[j] - arr[i] in m:\n ans += m[target - arr[j] - arr[i]]\n m[arr[i]] = m.setdefault(arr[i], 0) + 1\nreturn ans % MOD",
"n = len(arr)\narr.sort()\nans = 0\nMOD = 10 ** 9 + 7... | <|body_start_0|>
n = len(arr)
ans = 0
MOD = 10 ** 9 + 7
m = {}
for i in range(n - 1):
for j in range(i + 1, n):
if target - arr[j] - arr[i] in m:
ans += m[target - arr[j] - arr[i]]
m[arr[i]] = m.setdefault(arr[i], 0) + 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSumMulti(self, arr, target):
""":type arr: List[int] :type target: int :rtype: int"""
<|body_0|>
def threeSumMultiTwoPointers(self, arr, target):
""":type arr: List[int] :type target: int :rtype: int"""
<|body_1|>
def threeSumMultiUsin... | stack_v2_sparse_classes_75kplus_train_068341 | 3,256 | no_license | [
{
"docstring": ":type arr: List[int] :type target: int :rtype: int",
"name": "threeSumMulti",
"signature": "def threeSumMulti(self, arr, target)"
},
{
"docstring": ":type arr: List[int] :type target: int :rtype: int",
"name": "threeSumMultiTwoPointers",
"signature": "def threeSumMultiTwo... | 3 | stack_v2_sparse_classes_30k_train_022900 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSumMulti(self, arr, target): :type arr: List[int] :type target: int :rtype: int
- def threeSumMultiTwoPointers(self, arr, target): :type arr: List[int] :type target: int... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSumMulti(self, arr, target): :type arr: List[int] :type target: int :rtype: int
- def threeSumMultiTwoPointers(self, arr, target): :type arr: List[int] :type target: int... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def threeSumMulti(self, arr, target):
""":type arr: List[int] :type target: int :rtype: int"""
<|body_0|>
def threeSumMultiTwoPointers(self, arr, target):
""":type arr: List[int] :type target: int :rtype: int"""
<|body_1|>
def threeSumMultiUsin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def threeSumMulti(self, arr, target):
""":type arr: List[int] :type target: int :rtype: int"""
n = len(arr)
ans = 0
MOD = 10 ** 9 + 7
m = {}
for i in range(n - 1):
for j in range(i + 1, n):
if target - arr[j] - arr[i] in m:
... | the_stack_v2_python_sparse | 3/3SumWithMultiplicity.py | bssrdf/pyleet | train | 2 | |
e6b9cbe9625a59885544641e0e5bd59376331582 | [
"self.port = port\nself.host = host\nself.static_dir = static_dir\nself.cwd = lambda_invoke_context.get_cwd()\nself.api_provider = ApiProvider(lambda_invoke_context.stacks, cwd=self.cwd)\nself.lambda_runner = lambda_invoke_context.local_lambda_runner\nself.stderr_stream = lambda_invoke_context.stderr",
"if not se... | <|body_start_0|>
self.port = port
self.host = host
self.static_dir = static_dir
self.cwd = lambda_invoke_context.get_cwd()
self.api_provider = ApiProvider(lambda_invoke_context.stacks, cwd=self.cwd)
self.lambda_runner = lambda_invoke_context.local_lambda_runner
se... | Implementation of Local API service that is capable of serving API defined in a configuration file that invoke a Lambda function. | LocalApiService | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalApiService:
"""Implementation of Local API service that is capable of serving API defined in a configuration file that invoke a Lambda function."""
def __init__(self, lambda_invoke_context, port, host, static_dir):
"""Initialize the local API service. :param samcli.commands.loca... | stack_v2_sparse_classes_75kplus_train_068342 | 5,524 | permissive | [
{
"docstring": "Initialize the local API service. :param samcli.commands.local.cli_common.invoke_context.InvokeContext lambda_invoke_context: Context object that can help with Lambda invocation :param int port: Port to listen on :param string host: Local hostname or IP address to bind to :param string static_di... | 4 | stack_v2_sparse_classes_30k_train_020788 | Implement the Python class `LocalApiService` described below.
Class description:
Implementation of Local API service that is capable of serving API defined in a configuration file that invoke a Lambda function.
Method signatures and docstrings:
- def __init__(self, lambda_invoke_context, port, host, static_dir): Init... | Implement the Python class `LocalApiService` described below.
Class description:
Implementation of Local API service that is capable of serving API defined in a configuration file that invoke a Lambda function.
Method signatures and docstrings:
- def __init__(self, lambda_invoke_context, port, host, static_dir): Init... | b297ff015f2b69d7c74059c2d42ece1c29ea73ee | <|skeleton|>
class LocalApiService:
"""Implementation of Local API service that is capable of serving API defined in a configuration file that invoke a Lambda function."""
def __init__(self, lambda_invoke_context, port, host, static_dir):
"""Initialize the local API service. :param samcli.commands.loca... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LocalApiService:
"""Implementation of Local API service that is capable of serving API defined in a configuration file that invoke a Lambda function."""
def __init__(self, lambda_invoke_context, port, host, static_dir):
"""Initialize the local API service. :param samcli.commands.local.cli_common.... | the_stack_v2_python_sparse | samcli/commands/local/lib/local_api_service.py | aws/aws-sam-cli | train | 1,402 |
3c1ae498137ca0bb073c5755c2674f823f34626c | [
"super().__init__(*args, category=CATEGORY_SENSOR)\nstate = self.hass.states.get(self.entity_id)\nserv_co = self.add_preload_service(SERV_CARBON_MONOXIDE_SENSOR, [CHAR_CARBON_MONOXIDE_LEVEL, CHAR_CARBON_MONOXIDE_PEAK_LEVEL])\nself.char_level = serv_co.configure_char(CHAR_CARBON_MONOXIDE_LEVEL, value=0)\nself.char_p... | <|body_start_0|>
super().__init__(*args, category=CATEGORY_SENSOR)
state = self.hass.states.get(self.entity_id)
serv_co = self.add_preload_service(SERV_CARBON_MONOXIDE_SENSOR, [CHAR_CARBON_MONOXIDE_LEVEL, CHAR_CARBON_MONOXIDE_PEAK_LEVEL])
self.char_level = serv_co.configure_char(CHAR_CAR... | Generate a CarbonMonoxidSensor accessory as CO sensor. | CarbonMonoxideSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CarbonMonoxideSensor:
"""Generate a CarbonMonoxidSensor accessory as CO sensor."""
def __init__(self, *args):
"""Initialize a CarbonMonoxideSensor accessory object."""
<|body_0|>
def async_update_state(self, new_state):
"""Update accessory after state change."""
... | stack_v2_sparse_classes_75kplus_train_068343 | 17,041 | permissive | [
{
"docstring": "Initialize a CarbonMonoxideSensor accessory object.",
"name": "__init__",
"signature": "def __init__(self, *args)"
},
{
"docstring": "Update accessory after state change.",
"name": "async_update_state",
"signature": "def async_update_state(self, new_state)"
}
] | 2 | stack_v2_sparse_classes_30k_train_046798 | Implement the Python class `CarbonMonoxideSensor` described below.
Class description:
Generate a CarbonMonoxidSensor accessory as CO sensor.
Method signatures and docstrings:
- def __init__(self, *args): Initialize a CarbonMonoxideSensor accessory object.
- def async_update_state(self, new_state): Update accessory af... | Implement the Python class `CarbonMonoxideSensor` described below.
Class description:
Generate a CarbonMonoxidSensor accessory as CO sensor.
Method signatures and docstrings:
- def __init__(self, *args): Initialize a CarbonMonoxideSensor accessory object.
- def async_update_state(self, new_state): Update accessory af... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class CarbonMonoxideSensor:
"""Generate a CarbonMonoxidSensor accessory as CO sensor."""
def __init__(self, *args):
"""Initialize a CarbonMonoxideSensor accessory object."""
<|body_0|>
def async_update_state(self, new_state):
"""Update accessory after state change."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CarbonMonoxideSensor:
"""Generate a CarbonMonoxidSensor accessory as CO sensor."""
def __init__(self, *args):
"""Initialize a CarbonMonoxideSensor accessory object."""
super().__init__(*args, category=CATEGORY_SENSOR)
state = self.hass.states.get(self.entity_id)
serv_co = ... | the_stack_v2_python_sparse | homeassistant/components/homekit/type_sensors.py | home-assistant/core | train | 35,501 |
d26108156cd7118eef2be57c1c4d877c5c391189 | [
"fields = []\ncondition = ' 1 = 1 '\nvalue_list = []\nif 'name' in params and params['name']:\n condition += ' and name like %s'\n value_list.append('%' + params['name'] + '%')\nif 'mobile_no' in params and params['mobile_no']:\n condition += ' and mobile_no = %s'\n value_list.append(params['mobile_no']... | <|body_start_0|>
fields = []
condition = ' 1 = 1 '
value_list = []
if 'name' in params and params['name']:
condition += ' and name like %s'
value_list.append('%' + params['name'] + '%')
if 'mobile_no' in params and params['mobile_no']:
conditio... | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
def query_list(self, params):
"""查询客户列表 :param params: :return:"""
<|body_0|>
def dele(self, shop_id, customer_id_list):
"""删除客户 :param shop_id: :param customer_id_list: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
fields = []
... | stack_v2_sparse_classes_75kplus_train_068344 | 2,359 | no_license | [
{
"docstring": "查询客户列表 :param params: :return:",
"name": "query_list",
"signature": "def query_list(self, params)"
},
{
"docstring": "删除客户 :param shop_id: :param customer_id_list: :return:",
"name": "dele",
"signature": "def dele(self, shop_id, customer_id_list)"
}
] | 2 | stack_v2_sparse_classes_30k_train_034184 | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def query_list(self, params): 查询客户列表 :param params: :return:
- def dele(self, shop_id, customer_id_list): 删除客户 :param shop_id: :param customer_id_list: :return: | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def query_list(self, params): 查询客户列表 :param params: :return:
- def dele(self, shop_id, customer_id_list): 删除客户 :param shop_id: :param customer_id_list: :return:
<|skeleton|>
class Mod... | 80a2c9cc6065127c0f220adfdd4b97e5e62d7ae0 | <|skeleton|>
class Model:
def query_list(self, params):
"""查询客户列表 :param params: :return:"""
<|body_0|>
def dele(self, shop_id, customer_id_list):
"""删除客户 :param shop_id: :param customer_id_list: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Model:
def query_list(self, params):
"""查询客户列表 :param params: :return:"""
fields = []
condition = ' 1 = 1 '
value_list = []
if 'name' in params and params['name']:
condition += ' and name like %s'
value_list.append('%' + params['name'] + '%')
... | the_stack_v2_python_sparse | v1/module/customer/model.py | ftconan/YuiTornado | train | 0 | |
dd40b22637a89c37078d8a8c3f47812ece69be5d | [
"self.hmi_structure = hmi_dictionary\nself.plc_adress = plc_ip_address\nself.port_number = port_number",
"node_identifier = node.nodeid.Identifier\nrelay_name = self.hmi_structure[node_identifier]['name']\nawait plc_tcp_socket_write(self.plc_adress, self.port_number, relay_name, val)"
] | <|body_start_0|>
self.hmi_structure = hmi_dictionary
self.plc_adress = plc_ip_address
self.port_number = port_number
<|end_body_0|>
<|body_start_1|>
node_identifier = node.nodeid.Identifier
relay_name = self.hmi_structure[node_identifier]['name']
await plc_tcp_socket_wri... | SubHmiHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubHmiHandler:
def __init__(self, hmi_dictionary, plc_ip_address, port_number):
"""initialise SubHmiHandler Args: hmi_dictionary (dictionary): dictionary containing the values associated with hmi nodes plc_ip_address (string): string of ipaddress port_number ([type]): port number in stri... | stack_v2_sparse_classes_75kplus_train_068345 | 22,613 | no_license | [
{
"docstring": "initialise SubHmiHandler Args: hmi_dictionary (dictionary): dictionary containing the values associated with hmi nodes plc_ip_address (string): string of ipaddress port_number ([type]): port number in string",
"name": "__init__",
"signature": "def __init__(self, hmi_dictionary, plc_ip_ad... | 2 | null | Implement the Python class `SubHmiHandler` described below.
Class description:
Implement the SubHmiHandler class.
Method signatures and docstrings:
- def __init__(self, hmi_dictionary, plc_ip_address, port_number): initialise SubHmiHandler Args: hmi_dictionary (dictionary): dictionary containing the values associated... | Implement the Python class `SubHmiHandler` described below.
Class description:
Implement the SubHmiHandler class.
Method signatures and docstrings:
- def __init__(self, hmi_dictionary, plc_ip_address, port_number): initialise SubHmiHandler Args: hmi_dictionary (dictionary): dictionary containing the values associated... | 131978a4d1bc5ff9e82d7d59e9c7fbdc7cc6aaac | <|skeleton|>
class SubHmiHandler:
def __init__(self, hmi_dictionary, plc_ip_address, port_number):
"""initialise SubHmiHandler Args: hmi_dictionary (dictionary): dictionary containing the values associated with hmi nodes plc_ip_address (string): string of ipaddress port_number ([type]): port number in stri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubHmiHandler:
def __init__(self, hmi_dictionary, plc_ip_address, port_number):
"""initialise SubHmiHandler Args: hmi_dictionary (dictionary): dictionary containing the values associated with hmi nodes plc_ip_address (string): string of ipaddress port_number ([type]): port number in string"""
... | the_stack_v2_python_sparse | opc_ua_server/gsh_opc_platform (multi device)/gsh_opc_platform_server.py | Alfy102/OPC_UA_Server | train | 0 | |
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a | [
"super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.weight, mbart_layer.self_attn.k_proj.weight, mbart_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.bias, mbart_layer.self_attn.k_proj.bias, mbart_layer.sel... | <|body_start_0|>
super().__init__(config)
self.in_proj_weight = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.weight, mbart_layer.self_attn.k_proj.weight, mbart_layer.self_attn.v_proj.weight]))
self.in_proj_bias = nn.Parameter(torch.cat([mbart_layer.self_attn.q_proj.bias, mbart_layer.self... | MBartEncoderLayerBetterTransformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MBartEncoderLayerBetterTransformer:
def __init__(self, mbart_layer, config):
"""A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved."""
... | stack_v2_sparse_classes_75kplus_train_068346 | 43,670 | no_license | [
{
"docstring": "A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved.",
"name": "__init__",
"signature": "def __init__(self, mbart_layer, config)"
},
{... | 2 | stack_v2_sparse_classes_30k_train_002376 | Implement the Python class `MBartEncoderLayerBetterTransformer` described below.
Class description:
Implement the MBartEncoderLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, mbart_layer, config): A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementat... | Implement the Python class `MBartEncoderLayerBetterTransformer` described below.
Class description:
Implement the MBartEncoderLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, mbart_layer, config): A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementat... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class MBartEncoderLayerBetterTransformer:
def __init__(self, mbart_layer, config):
"""A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MBartEncoderLayerBetterTransformer:
def __init__(self, mbart_layer, config):
"""A simple conversion of the `MBartEncoderLayer` to its `BetterTransformer` implementation. Args: mbart_layer (`torch.nn.Module`): The original `MBartEncoderLayer` where the weights needs to be retrieved."""
super().... | the_stack_v2_python_sparse | generated/test_huggingface_optimum.py | jansel/pytorch-jit-paritybench | train | 35 | |
7d40021a7809292734db186325aff32ae39491c3 | [
"protocol = request.uri\nwhite_list = ['register', 'login', 'checkLogin', 'registerInitData']\nif protocol.split('/')[2] in white_list:\n return True\ntoken = request.headers.get('Authorization', None)\nif token:\n res = Authentication.verifyToken(token)\n if res:\n return True\n else:\n r... | <|body_start_0|>
protocol = request.uri
white_list = ['register', 'login', 'checkLogin', 'registerInitData']
if protocol.split('/')[2] in white_list:
return True
token = request.headers.get('Authorization', None)
if token:
res = Authentication.verifyToken(... | 用户认证公共方法 | AuthenticationUtil | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthenticationUtil:
"""用户认证公共方法"""
def verifyUser(cls, request):
"""用户认证"""
<|body_0|>
def getUserIdByToken(self, request):
"""根据token获得用户ID"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
protocol = request.uri
white_list = ['register',... | stack_v2_sparse_classes_75kplus_train_068347 | 1,191 | no_license | [
{
"docstring": "用户认证",
"name": "verifyUser",
"signature": "def verifyUser(cls, request)"
},
{
"docstring": "根据token获得用户ID",
"name": "getUserIdByToken",
"signature": "def getUserIdByToken(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006166 | Implement the Python class `AuthenticationUtil` described below.
Class description:
用户认证公共方法
Method signatures and docstrings:
- def verifyUser(cls, request): 用户认证
- def getUserIdByToken(self, request): 根据token获得用户ID | Implement the Python class `AuthenticationUtil` described below.
Class description:
用户认证公共方法
Method signatures and docstrings:
- def verifyUser(cls, request): 用户认证
- def getUserIdByToken(self, request): 根据token获得用户ID
<|skeleton|>
class AuthenticationUtil:
"""用户认证公共方法"""
def verifyUser(cls, request):
... | 5feaf8b466c125e93fd08f31cc0eed99c9b4d164 | <|skeleton|>
class AuthenticationUtil:
"""用户认证公共方法"""
def verifyUser(cls, request):
"""用户认证"""
<|body_0|>
def getUserIdByToken(self, request):
"""根据token获得用户ID"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AuthenticationUtil:
"""用户认证公共方法"""
def verifyUser(cls, request):
"""用户认证"""
protocol = request.uri
white_list = ['register', 'login', 'checkLogin', 'registerInitData']
if protocol.split('/')[2] in white_list:
return True
token = request.headers.get('Aut... | the_stack_v2_python_sparse | base/authentication/AuthenticationUtil.py | goodcan/financial-system-backend | train | 1 |
9ece43640bb3d5218cf9542d446dacfb74d28266 | [
"super(FFN, self).__init__()\nself.layers = [nn.Linear(input_nodes, layers[0])]\nfor i in range(len(layers) - 1):\n self.layers.append(nn.Linear(layers[i], layers[i + 1]))\nself.layers = nn.ModuleList(self.layers)\nself.relu = nn.ReLU()\nself.dropout = nn.Dropout(p=dropout)\nself.batchnorm = nn.ModuleList([nn.Ba... | <|body_start_0|>
super(FFN, self).__init__()
self.layers = [nn.Linear(input_nodes, layers[0])]
for i in range(len(layers) - 1):
self.layers.append(nn.Linear(layers[i], layers[i + 1]))
self.layers = nn.ModuleList(self.layers)
self.relu = nn.ReLU()
self.dropout ... | FFN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FFN:
def __init__(self, input_nodes, layers, dropout):
"""FFN network class. See master thesis for architecture details. Args: input_nodes (int): Dimensionality of input embeddings. layers (list[int]): Number of nodes to use in each layer. Number of layers becomes length of layers list. ... | stack_v2_sparse_classes_75kplus_train_068348 | 13,585 | no_license | [
{
"docstring": "FFN network class. See master thesis for architecture details. Args: input_nodes (int): Dimensionality of input embeddings. layers (list[int]): Number of nodes to use in each layer. Number of layers becomes length of layers list. dropout (float): Dropout rate.",
"name": "__init__",
"sign... | 2 | stack_v2_sparse_classes_30k_train_027450 | Implement the Python class `FFN` described below.
Class description:
Implement the FFN class.
Method signatures and docstrings:
- def __init__(self, input_nodes, layers, dropout): FFN network class. See master thesis for architecture details. Args: input_nodes (int): Dimensionality of input embeddings. layers (list[i... | Implement the Python class `FFN` described below.
Class description:
Implement the FFN class.
Method signatures and docstrings:
- def __init__(self, input_nodes, layers, dropout): FFN network class. See master thesis for architecture details. Args: input_nodes (int): Dimensionality of input embeddings. layers (list[i... | 5b3fa974002eb68244081df6442688f2cc411008 | <|skeleton|>
class FFN:
def __init__(self, input_nodes, layers, dropout):
"""FFN network class. See master thesis for architecture details. Args: input_nodes (int): Dimensionality of input embeddings. layers (list[int]): Number of nodes to use in each layer. Number of layers becomes length of layers list. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FFN:
def __init__(self, input_nodes, layers, dropout):
"""FFN network class. See master thesis for architecture details. Args: input_nodes (int): Dimensionality of input embeddings. layers (list[int]): Number of nodes to use in each layer. Number of layers becomes length of layers list. dropout (float... | the_stack_v2_python_sparse | networks.py | joakiol/RealEstateSummaryQuality | train | 0 | |
d887a6aaa42233c1c1a3dc29243b6c785a0102d5 | [
"super(VGG11_bnNet, self).__init__()\nself.select_feats = ['MaxPool2d_1', 'MaxPool2d_2', 'MaxPool2d_3', 'MaxPool2d_4', 'MaxPool2d_5']\nself.select_classifier = ['fc6', 'fc7', 'fc8']\nself.feat_list = self.select_feats + self.select_classifier\nself.vgg_feats = models.vgg11_bn(pretrained=is_pretrained).features\nsel... | <|body_start_0|>
super(VGG11_bnNet, self).__init__()
self.select_feats = ['MaxPool2d_1', 'MaxPool2d_2', 'MaxPool2d_3', 'MaxPool2d_4', 'MaxPool2d_5']
self.select_classifier = ['fc6', 'fc7', 'fc8']
self.feat_list = self.select_feats + self.select_classifier
self.vgg_feats = models.... | VGG11_bnNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VGG11_bnNet:
def __init__(self, is_pretrained):
"""Select conv1_1 ~ conv5_1 activation maps."""
<|body_0|>
def forward(self, x):
"""Extract multiple feature maps."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(VGG11_bnNet, self).__init__()
... | stack_v2_sparse_classes_75kplus_train_068349 | 2,585 | no_license | [
{
"docstring": "Select conv1_1 ~ conv5_1 activation maps.",
"name": "__init__",
"signature": "def __init__(self, is_pretrained)"
},
{
"docstring": "Extract multiple feature maps.",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030765 | Implement the Python class `VGG11_bnNet` described below.
Class description:
Implement the VGG11_bnNet class.
Method signatures and docstrings:
- def __init__(self, is_pretrained): Select conv1_1 ~ conv5_1 activation maps.
- def forward(self, x): Extract multiple feature maps. | Implement the Python class `VGG11_bnNet` described below.
Class description:
Implement the VGG11_bnNet class.
Method signatures and docstrings:
- def __init__(self, is_pretrained): Select conv1_1 ~ conv5_1 activation maps.
- def forward(self, x): Extract multiple feature maps.
<|skeleton|>
class VGG11_bnNet:
de... | c614918e04451d3f8c18894ba2c2245c41803239 | <|skeleton|>
class VGG11_bnNet:
def __init__(self, is_pretrained):
"""Select conv1_1 ~ conv5_1 activation maps."""
<|body_0|>
def forward(self, x):
"""Extract multiple feature maps."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VGG11_bnNet:
def __init__(self, is_pretrained):
"""Select conv1_1 ~ conv5_1 activation maps."""
super(VGG11_bnNet, self).__init__()
self.select_feats = ['MaxPool2d_1', 'MaxPool2d_2', 'MaxPool2d_3', 'MaxPool2d_4', 'MaxPool2d_5']
self.select_classifier = ['fc6', 'fc7', 'fc8']
... | the_stack_v2_python_sparse | networks/vgg11_bn.py | AliPTehrani/Numerosity-in-Neural-Networks | train | 0 | |
498e25ad324c1d4b8bec4f8e6cbb25d697fdef2e | [
"if self.action == 'list':\n return Area.objects.filter(parent=None)\nelse:\n return Area.objects.all()",
"if self.action == 'list':\n return serializers.AreaSerializer\nelse:\n return serializers.SubsSerializer"
] | <|body_start_0|>
if self.action == 'list':
return Area.objects.filter(parent=None)
else:
return Area.objects.all()
<|end_body_0|>
<|body_start_1|>
if self.action == 'list':
return serializers.AreaSerializer
else:
return serializers.SubsSer... | 查询省市区数据 | AreaViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AreaViewSet:
"""查询省市区数据"""
def get_queryset(self):
"""重写get_queryset()方法,动态指定查询集"""
<|body_0|>
def get_serializer_class(self):
"""重写get_serializer_class()方法,动态指定序列化(输出)器"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.action == 'list':
... | stack_v2_sparse_classes_75kplus_train_068350 | 1,003 | no_license | [
{
"docstring": "重写get_queryset()方法,动态指定查询集",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "重写get_serializer_class()方法,动态指定序列化(输出)器",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_039800 | Implement the Python class `AreaViewSet` described below.
Class description:
查询省市区数据
Method signatures and docstrings:
- def get_queryset(self): 重写get_queryset()方法,动态指定查询集
- def get_serializer_class(self): 重写get_serializer_class()方法,动态指定序列化(输出)器 | Implement the Python class `AreaViewSet` described below.
Class description:
查询省市区数据
Method signatures and docstrings:
- def get_queryset(self): 重写get_queryset()方法,动态指定查询集
- def get_serializer_class(self): 重写get_serializer_class()方法,动态指定序列化(输出)器
<|skeleton|>
class AreaViewSet:
"""查询省市区数据"""
def get_queryset... | ffb5427754575597395fd9c19069b1165f4259a4 | <|skeleton|>
class AreaViewSet:
"""查询省市区数据"""
def get_queryset(self):
"""重写get_queryset()方法,动态指定查询集"""
<|body_0|>
def get_serializer_class(self):
"""重写get_serializer_class()方法,动态指定序列化(输出)器"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AreaViewSet:
"""查询省市区数据"""
def get_queryset(self):
"""重写get_queryset()方法,动态指定查询集"""
if self.action == 'list':
return Area.objects.filter(parent=None)
else:
return Area.objects.all()
def get_serializer_class(self):
"""重写get_serializer_class()方法,... | the_stack_v2_python_sparse | dpy_meiduo_mall/dpy_meiduo_mall/apps/areas/views.py | Higher312/meiduo3 | train | 0 |
8ff03e50ef6d7717f97eed296740cab6f423bc63 | [
"self.orientFlip = image.isNeurological()\nvolumeopts.NiftiOpts.__init__(self, image, *args, **kwargs)\nself.__registered = self.getParent() is not None\nif self.__registered:\n self.overlayList.addListener('overlays', self.name, self.__overlayListChanged)\n self.addListener('clipImage', self.name, self.__cli... | <|body_start_0|>
self.orientFlip = image.isNeurological()
volumeopts.NiftiOpts.__init__(self, image, *args, **kwargs)
self.__registered = self.getParent() is not None
if self.__registered:
self.overlayList.addListener('overlays', self.name, self.__overlayListChanged)
... | The ``VectorOpts`` class is the base class for :class:`LineVectorOpts`, :class:`RGBVectorOpts`, :class:`.TensorOpts`, and :class:`.SHOpts`. It contains display settings which are common to each of them. *A note on orientation* The :attr:`orientFlip` property allows you to flip the left-right orientation of line vectors... | VectorOpts | [
"BSD-3-Clause",
"CC-BY-3.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VectorOpts:
"""The ``VectorOpts`` class is the base class for :class:`LineVectorOpts`, :class:`RGBVectorOpts`, :class:`.TensorOpts`, and :class:`.SHOpts`. It contains display settings which are common to each of them. *A note on orientation* The :attr:`orientFlip` property allows you to flip the ... | stack_v2_sparse_classes_75kplus_train_068351 | 11,490 | permissive | [
{
"docstring": "Create a ``VectorOpts`` instance for the given image. All arguments are passed through to the :class:`.NiftiOpts` constructor.",
"name": "__init__",
"signature": "def __init__(self, image, *args, **kwargs)"
},
{
"docstring": "Removes some property listeners, and calls the :meth:`... | 6 | null | Implement the Python class `VectorOpts` described below.
Class description:
The ``VectorOpts`` class is the base class for :class:`LineVectorOpts`, :class:`RGBVectorOpts`, :class:`.TensorOpts`, and :class:`.SHOpts`. It contains display settings which are common to each of them. *A note on orientation* The :attr:`orien... | Implement the Python class `VectorOpts` described below.
Class description:
The ``VectorOpts`` class is the base class for :class:`LineVectorOpts`, :class:`RGBVectorOpts`, :class:`.TensorOpts`, and :class:`.SHOpts`. It contains display settings which are common to each of them. *A note on orientation* The :attr:`orien... | 46ccb4fe2b2346eb57576247f49714032b61307a | <|skeleton|>
class VectorOpts:
"""The ``VectorOpts`` class is the base class for :class:`LineVectorOpts`, :class:`RGBVectorOpts`, :class:`.TensorOpts`, and :class:`.SHOpts`. It contains display settings which are common to each of them. *A note on orientation* The :attr:`orientFlip` property allows you to flip the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VectorOpts:
"""The ``VectorOpts`` class is the base class for :class:`LineVectorOpts`, :class:`RGBVectorOpts`, :class:`.TensorOpts`, and :class:`.SHOpts`. It contains display settings which are common to each of them. *A note on orientation* The :attr:`orientFlip` property allows you to flip the left-right or... | the_stack_v2_python_sparse | fsleyes/displaycontext/vectoropts.py | sanjayankur31/fsleyes | train | 1 |
4a0521e733d7580ef3eba6519f3e26a369b68637 | [
"super().__init__()\nself.in_channels = in_channels\nself.out_channels = out_channels\nself.spherical_cheb_bn_1 = SphericalChebBN(in_channels, middle_channels, lap, kernel_size)\nself.spherical_cheb_bn_2 = SphericalChebBN(middle_channels, out_channels, lap, kernel_size)",
"x = self.spherical_cheb_bn_1(x)\nx = sel... | <|body_start_0|>
super().__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.spherical_cheb_bn_1 = SphericalChebBN(in_channels, middle_channels, lap, kernel_size)
self.spherical_cheb_bn_2 = SphericalChebBN(middle_channels, out_channels, lap, kernel_siz... | Building Block made of 2 Building Blocks (convolution, batchnorm, activation). | SphericalChebBN2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SphericalChebBN2:
"""Building Block made of 2 Building Blocks (convolution, batchnorm, activation)."""
def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): midd... | stack_v2_sparse_classes_75kplus_train_068352 | 41,403 | no_license | [
{
"docstring": "Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): middle number of channels. out_channels (int): output number of channels. lap (:obj:`torch.sparse.FloatTensor`): laplacian. kernel_size (int, optional): polynomial degree.",
"name": "__init__",
"s... | 2 | stack_v2_sparse_classes_30k_train_054523 | Implement the Python class `SphericalChebBN2` described below.
Class description:
Building Block made of 2 Building Blocks (convolution, batchnorm, activation).
Method signatures and docstrings:
- def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int)... | Implement the Python class `SphericalChebBN2` described below.
Class description:
Building Block made of 2 Building Blocks (convolution, batchnorm, activation).
Method signatures and docstrings:
- def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size): Initialization. Args: in_channels (int)... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class SphericalChebBN2:
"""Building Block made of 2 Building Blocks (convolution, batchnorm, activation)."""
def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): midd... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SphericalChebBN2:
"""Building Block made of 2 Building Blocks (convolution, batchnorm, activation)."""
def __init__(self, in_channels, middle_channels, out_channels, lap, kernel_size):
"""Initialization. Args: in_channels (int): initial number of channels. middle_channels (int): middle number of ... | the_stack_v2_python_sparse | generated/test_deepsphere_deepsphere_pytorch.py | jansel/pytorch-jit-paritybench | train | 35 |
1825667c12c5d0dc54eec26a83f55ba72a5e8e52 | [
"n = 2\nm = 2\nresult = sock_days(n, m)\nself.assertEqual(result, 3)",
"n = 9\nm = 3\nresult = sock_days(n, m)\nself.assertEqual(result, 13)",
"n = 9\nm = 16\nresult = sock_days(n, m)\nself.assertEqual(result, 9)",
"n = 9\nm = 4\nresult = sock_days(n, m)\nself.assertEqual(result, 11)"
] | <|body_start_0|>
n = 2
m = 2
result = sock_days(n, m)
self.assertEqual(result, 3)
<|end_body_0|>
<|body_start_1|>
n = 9
m = 3
result = sock_days(n, m)
self.assertEqual(result, 13)
<|end_body_1|>
<|body_start_2|>
n = 9
m = 16
resul... | TestSum | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSum:
def testsame(self):
"""Test to check if n == m"""
<|body_0|>
def testfactor(self):
"""Test to check if n%m == 0 and n != m"""
<|body_1|>
def testless(self):
"""Test to check when n < m"""
<|body_2|>
def testnotfactor(self):
... | stack_v2_sparse_classes_75kplus_train_068353 | 878 | permissive | [
{
"docstring": "Test to check if n == m",
"name": "testsame",
"signature": "def testsame(self)"
},
{
"docstring": "Test to check if n%m == 0 and n != m",
"name": "testfactor",
"signature": "def testfactor(self)"
},
{
"docstring": "Test to check when n < m",
"name": "testless"... | 4 | stack_v2_sparse_classes_30k_train_013225 | Implement the Python class `TestSum` described below.
Class description:
Implement the TestSum class.
Method signatures and docstrings:
- def testsame(self): Test to check if n == m
- def testfactor(self): Test to check if n%m == 0 and n != m
- def testless(self): Test to check when n < m
- def testnotfactor(self): T... | Implement the Python class `TestSum` described below.
Class description:
Implement the TestSum class.
Method signatures and docstrings:
- def testsame(self): Test to check if n == m
- def testfactor(self): Test to check if n%m == 0 and n != m
- def testless(self): Test to check when n < m
- def testnotfactor(self): T... | b609972ada1c7177f182665e998beaa0c1eba514 | <|skeleton|>
class TestSum:
def testsame(self):
"""Test to check if n == m"""
<|body_0|>
def testfactor(self):
"""Test to check if n%m == 0 and n != m"""
<|body_1|>
def testless(self):
"""Test to check when n < m"""
<|body_2|>
def testnotfactor(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestSum:
def testsame(self):
"""Test to check if n == m"""
n = 2
m = 2
result = sock_days(n, m)
self.assertEqual(result, 3)
def testfactor(self):
"""Test to check if n%m == 0 and n != m"""
n = 9
m = 3
result = sock_days(n, m)
... | the_stack_v2_python_sparse | Camp-Summer-Training/week1/2/test2.py | hanzohasashi33/Competetive_programming | train | 22 | |
2b95c81167a9c8ad2b419ba7df2b789271935d7a | [
"if cls == OmnisciLaunchParameters or (OmnisciLaunchParameters.varname in os.environ and HdkLaunchParameters.varname not in os.environ):\n return OmnisciLaunchParameters._get()\nelse:\n return HdkLaunchParameters._get()",
"custom_parameters = super().get()\nresult = cls._get_default().copy()\nresult.update(... | <|body_start_0|>
if cls == OmnisciLaunchParameters or (OmnisciLaunchParameters.varname in os.environ and HdkLaunchParameters.varname not in os.environ):
return OmnisciLaunchParameters._get()
else:
return HdkLaunchParameters._get()
<|end_body_0|>
<|body_start_1|>
custom_p... | Additional command line options for the HDK engine. Please visit OmniSci documentation for the description of available parameters: https://docs.omnisci.com/installation-and-configuration/config-parameters#configuration-parameters-for-omniscidb | HdkLaunchParameters | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HdkLaunchParameters:
"""Additional command line options for the HDK engine. Please visit OmniSci documentation for the description of available parameters: https://docs.omnisci.com/installation-and-configuration/config-parameters#configuration-parameters-for-omniscidb"""
def get(cls) -> dict... | stack_v2_sparse_classes_75kplus_train_068354 | 21,244 | permissive | [
{
"docstring": "Get the resulted command-line options. Decode and merge specified command-line options with the default one. Returns ------- dict Decoded and verified config value.",
"name": "get",
"signature": "def get(cls) -> dict"
},
{
"docstring": "Get the resulted command-line options. Retu... | 3 | null | Implement the Python class `HdkLaunchParameters` described below.
Class description:
Additional command line options for the HDK engine. Please visit OmniSci documentation for the description of available parameters: https://docs.omnisci.com/installation-and-configuration/config-parameters#configuration-parameters-for... | Implement the Python class `HdkLaunchParameters` described below.
Class description:
Additional command line options for the HDK engine. Please visit OmniSci documentation for the description of available parameters: https://docs.omnisci.com/installation-and-configuration/config-parameters#configuration-parameters-for... | 8f6e00378e095817deccd25f4140406c5ee6c992 | <|skeleton|>
class HdkLaunchParameters:
"""Additional command line options for the HDK engine. Please visit OmniSci documentation for the description of available parameters: https://docs.omnisci.com/installation-and-configuration/config-parameters#configuration-parameters-for-omniscidb"""
def get(cls) -> dict... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HdkLaunchParameters:
"""Additional command line options for the HDK engine. Please visit OmniSci documentation for the description of available parameters: https://docs.omnisci.com/installation-and-configuration/config-parameters#configuration-parameters-for-omniscidb"""
def get(cls) -> dict:
"""... | the_stack_v2_python_sparse | modin/config/envvars.py | modin-project/modin | train | 9,241 |
8b65546e0921706d76ff03285aaf646194255e69 | [
"if self.current_user == team.owner:\n return True\nraise ApiException(403, '权限错误')",
"team = Team.get_or_404(id=team_id)\nself.has_read_permission(team)\nquery = TeamMemberGroup.select().where(TeamMemberGroup.team == team)\npage = self.paginate_query(query)\ndata = self.get_paginated_data(page=page, alias='gr... | <|body_start_0|>
if self.current_user == team.owner:
return True
raise ApiException(403, '权限错误')
<|end_body_0|>
<|body_start_1|>
team = Team.get_or_404(id=team_id)
self.has_read_permission(team)
query = TeamMemberGroup.select().where(TeamMemberGroup.team == team)
... | 俱乐部分组列表 | TeamMemberGroupHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
<|body_0|>
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
<|body_1|>
def post(self, team_id):
"""新建俱乐部分组 Args: team_id: Returns:"""
... | stack_v2_sparse_classes_75kplus_train_068355 | 13,604 | no_license | [
{
"docstring": "具有俱乐部分组读取权限",
"name": "has_read_permission",
"signature": "def has_read_permission(self, team)"
},
{
"docstring": "获取俱乐部分组 Args: team_id: int",
"name": "get",
"signature": "def get(self, team_id)"
},
{
"docstring": "新建俱乐部分组 Args: team_id: Returns:",
"name": "p... | 3 | stack_v2_sparse_classes_30k_train_020488 | Implement the Python class `TeamMemberGroupHandler` described below.
Class description:
俱乐部分组列表
Method signatures and docstrings:
- def has_read_permission(self, team): 具有俱乐部分组读取权限
- def get(self, team_id): 获取俱乐部分组 Args: team_id: int
- def post(self, team_id): 新建俱乐部分组 Args: team_id: Returns: | Implement the Python class `TeamMemberGroupHandler` described below.
Class description:
俱乐部分组列表
Method signatures and docstrings:
- def has_read_permission(self, team): 具有俱乐部分组读取权限
- def get(self, team_id): 获取俱乐部分组 Args: team_id: int
- def post(self, team_id): 新建俱乐部分组 Args: team_id: Returns:
<|skeleton|>
class TeamM... | 49c31d9cce6ca451ff069697913b33fe55028a46 | <|skeleton|>
class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
<|body_0|>
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
<|body_1|>
def post(self, team_id):
"""新建俱乐部分组 Args: team_id: Returns:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeamMemberGroupHandler:
"""俱乐部分组列表"""
def has_read_permission(self, team):
"""具有俱乐部分组读取权限"""
if self.current_user == team.owner:
return True
raise ApiException(403, '权限错误')
def get(self, team_id):
"""获取俱乐部分组 Args: team_id: int"""
team = Team.get_or... | the_stack_v2_python_sparse | PaiDuiGuanJia/yiyun/handlers/rest/team.py | haoweiking/image_tesseract_private | train | 0 |
4c8b0a33e51f216919a8f2a7ebb33e8e2cc477dd | [
"self.model = model\nself.pca_components = pca_components\nself.model_params = model_params",
"self.model_final = self.model.set_params(**self.model_params)\nself.pca = PCA(n_components=self.pca_components)\nX_small = self.pca.fit_transform(X)\nself.model_final.fit(X_small, y)",
"X_small = self.pca.transform(X)... | <|body_start_0|>
self.model = model
self.pca_components = pca_components
self.model_params = model_params
<|end_body_0|>
<|body_start_1|>
self.model_final = self.model.set_params(**self.model_params)
self.pca = PCA(n_components=self.pca_components)
X_small = self.pca.fit... | Model that first do PCA on the data before it fits's data on the model | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
"""Model that first do PCA on the data before it fits's data on the model"""
def __init__(self, model=None, pca_components=1, model_params={}):
""":param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model"""
... | stack_v2_sparse_classes_75kplus_train_068356 | 4,723 | no_license | [
{
"docstring": ":param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model",
"name": "__init__",
"signature": "def __init__(self, model=None, pca_components=1, model_params={})"
},
{
"docstring": "First transform the data with PCA and t... | 3 | stack_v2_sparse_classes_30k_train_026146 | Implement the Python class `Model` described below.
Class description:
Model that first do PCA on the data before it fits's data on the model
Method signatures and docstrings:
- def __init__(self, model=None, pca_components=1, model_params={}): :param model: model to fit, predict :param pca_components: param for PCA ... | Implement the Python class `Model` described below.
Class description:
Model that first do PCA on the data before it fits's data on the model
Method signatures and docstrings:
- def __init__(self, model=None, pca_components=1, model_params={}): :param model: model to fit, predict :param pca_components: param for PCA ... | 62e386d81ffc5dab7165ea228f62861c4bbee57b | <|skeleton|>
class Model:
"""Model that first do PCA on the data before it fits's data on the model"""
def __init__(self, model=None, pca_components=1, model_params={}):
""":param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Model:
"""Model that first do PCA on the data before it fits's data on the model"""
def __init__(self, model=None, pca_components=1, model_params={}):
""":param model: model to fit, predict :param pca_components: param for PCA :param model_params: parameters for the model"""
self.model = ... | the_stack_v2_python_sparse | src/plot_quality_prediction/quality_prediction.py | AndrejHafner/how-good-is-my-plot | train | 3 |
e2f870a282722fcbb33fd24ee9b269ef69147939 | [
"self.dag_application_server_info_list = dag_application_server_info_list\nself.exchange_dag_protection_preference = exchange_dag_protection_preference\nself.guid = guid\nself.name = name",
"if dictionary is None:\n return None\ndag_application_server_info_list = None\nif dictionary.get('dagApplicationServerIn... | <|body_start_0|>
self.dag_application_server_info_list = dag_application_server_info_list
self.exchange_dag_protection_preference = exchange_dag_protection_preference
self.guid = guid
self.name = name
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None... | Implementation of the 'DagInfo' model. Specifies the information about the DAG(Database availability group). Attributes: dag_application_server_info_list (list of DagApplicationServerInfo): Specifies the status of all the Exchange Application Servers that are part of this DAG. exchange_dag_protection_preference (Exchan... | DagInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DagInfo:
"""Implementation of the 'DagInfo' model. Specifies the information about the DAG(Database availability group). Attributes: dag_application_server_info_list (list of DagApplicationServerInfo): Specifies the status of all the Exchange Application Servers that are part of this DAG. exchang... | stack_v2_sparse_classes_75kplus_train_068357 | 3,283 | permissive | [
{
"docstring": "Constructor for the DagInfo class",
"name": "__init__",
"signature": "def __init__(self, dag_application_server_info_list=None, exchange_dag_protection_preference=None, guid=None, name=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary ... | 2 | stack_v2_sparse_classes_30k_train_022713 | Implement the Python class `DagInfo` described below.
Class description:
Implementation of the 'DagInfo' model. Specifies the information about the DAG(Database availability group). Attributes: dag_application_server_info_list (list of DagApplicationServerInfo): Specifies the status of all the Exchange Application Ser... | Implement the Python class `DagInfo` described below.
Class description:
Implementation of the 'DagInfo' model. Specifies the information about the DAG(Database availability group). Attributes: dag_application_server_info_list (list of DagApplicationServerInfo): Specifies the status of all the Exchange Application Ser... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class DagInfo:
"""Implementation of the 'DagInfo' model. Specifies the information about the DAG(Database availability group). Attributes: dag_application_server_info_list (list of DagApplicationServerInfo): Specifies the status of all the Exchange Application Servers that are part of this DAG. exchang... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DagInfo:
"""Implementation of the 'DagInfo' model. Specifies the information about the DAG(Database availability group). Attributes: dag_application_server_info_list (list of DagApplicationServerInfo): Specifies the status of all the Exchange Application Servers that are part of this DAG. exchange_dag_protect... | the_stack_v2_python_sparse | cohesity_management_sdk/models/dag_info.py | cohesity/management-sdk-python | train | 24 |
0db05f26679c1f753d5fcd0e60f5f9349a80bed1 | [
"lhs_bytes = old_contentfile_bytes\npatch_bytes_ex = patch_bytes\nrhs_bytes = file_patch(lhs_bytes, patch_bytes_ex, ver=1)\nnew_contentfile_bytes = rhs_bytes\nreturn new_contentfile_bytes",
"ls = []\nfor patch_idx, imay_parent_idx, user_data_dir_path, contentfile_path, content_binary_ifile in iter_tpl5s:\n wit... | <|body_start_0|>
lhs_bytes = old_contentfile_bytes
patch_bytes_ex = patch_bytes
rhs_bytes = file_patch(lhs_bytes, patch_bytes_ex, ver=1)
new_contentfile_bytes = rhs_bytes
return new_contentfile_bytes
<|end_body_0|>
<|body_start_1|>
ls = []
for patch_idx, imay_par... | IRepositorySetting__using_file_cmp__file_patch_ver1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IRepositorySetting__using_file_cmp__file_patch_ver1:
def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /):
"""old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes"""
<|body_0|>
def ___open_patch_idx___(sf, iter_tpl5s, /):
"""Iter (patch_idx, imay... | stack_v2_sparse_classes_75kplus_train_068358 | 1,796 | no_license | [
{
"docstring": "old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes",
"name": "contentfile_patch",
"signature": "def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /)"
},
{
"docstring": "Iter (patch_idx, imay_parent_idx, user_data_dir_path, contentfile_path, content_binary_i... | 2 | stack_v2_sparse_classes_30k_train_016920 | Implement the Python class `IRepositorySetting__using_file_cmp__file_patch_ver1` described below.
Class description:
Implement the IRepositorySetting__using_file_cmp__file_patch_ver1 class.
Method signatures and docstrings:
- def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /): old_contentfile_bytes -> p... | Implement the Python class `IRepositorySetting__using_file_cmp__file_patch_ver1` described below.
Class description:
Implement the IRepositorySetting__using_file_cmp__file_patch_ver1 class.
Method signatures and docstrings:
- def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /): old_contentfile_bytes -> p... | 41f3a506feffb5f33d4559e5b69717d9bb6303c9 | <|skeleton|>
class IRepositorySetting__using_file_cmp__file_patch_ver1:
def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /):
"""old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes"""
<|body_0|>
def ___open_patch_idx___(sf, iter_tpl5s, /):
"""Iter (patch_idx, imay... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IRepositorySetting__using_file_cmp__file_patch_ver1:
def contentfile_patch(sf, old_contentfile_bytes, patch_bytes, /):
"""old_contentfile_bytes -> patch_bytes -> new_contentfile_bytes"""
lhs_bytes = old_contentfile_bytes
patch_bytes_ex = patch_bytes
rhs_bytes = file_patch(lhs_b... | the_stack_v2_python_sparse | nn_ns/filedir/backup_tools/IRepositorySetting__using_file_cmp__file_patch.py | edt-yxz-zzd/python3_src | train | 2 | |
33e6134243e899f7a03cfd2d4341a8744a2c27fe | [
"super().__init__(*args, **kwargs)\nif 'send_policy_freq' in ext_args:\n self._freq = ext_args['send_policy_freq']\nelse:\n self._freq = 1",
"last_iter = engine.last_iter.val\nif engine.rank == 0 and last_iter % self._freq == 0:\n state_dict = {'model': engine.policy.state_dict()['model'], 'iter': last_i... | <|body_start_0|>
super().__init__(*args, **kwargs)
if 'send_policy_freq' in ext_args:
self._freq = ext_args['send_policy_freq']
else:
self._freq = 1
<|end_body_0|>
<|body_start_1|>
last_iter = engine.last_iter.val
if engine.rank == 0 and last_iter % self.... | Overview: Hook to send policy Interfaces: __init__, __call__ Property: name, priority, position | SendPolicyHook | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SendPolicyHook:
"""Overview: Hook to send policy Interfaces: __init__, __call__ Property: name, priority, position"""
def __init__(self, *args, ext_args: dict={}, **kwargs) -> None:
"""Overview: init SendpolicyHook Arguments: - ext_args (:obj:`dict`): Extended arguments. Use ``ext_ar... | stack_v2_sparse_classes_75kplus_train_068359 | 15,492 | permissive | [
{
"docstring": "Overview: init SendpolicyHook Arguments: - ext_args (:obj:`dict`): Extended arguments. Use ``ext_args.freq`` to set send_policy_freq",
"name": "__init__",
"signature": "def __init__(self, *args, ext_args: dict={}, **kwargs) -> None"
},
{
"docstring": "Overview: Save learner's pol... | 2 | null | Implement the Python class `SendPolicyHook` described below.
Class description:
Overview: Hook to send policy Interfaces: __init__, __call__ Property: name, priority, position
Method signatures and docstrings:
- def __init__(self, *args, ext_args: dict={}, **kwargs) -> None: Overview: init SendpolicyHook Arguments: -... | Implement the Python class `SendPolicyHook` described below.
Class description:
Overview: Hook to send policy Interfaces: __init__, __call__ Property: name, priority, position
Method signatures and docstrings:
- def __init__(self, *args, ext_args: dict={}, **kwargs) -> None: Overview: init SendpolicyHook Arguments: -... | eb483fa6e46602d58c8e7d2ca1e566adca28e703 | <|skeleton|>
class SendPolicyHook:
"""Overview: Hook to send policy Interfaces: __init__, __call__ Property: name, priority, position"""
def __init__(self, *args, ext_args: dict={}, **kwargs) -> None:
"""Overview: init SendpolicyHook Arguments: - ext_args (:obj:`dict`): Extended arguments. Use ``ext_ar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SendPolicyHook:
"""Overview: Hook to send policy Interfaces: __init__, __call__ Property: name, priority, position"""
def __init__(self, *args, ext_args: dict={}, **kwargs) -> None:
"""Overview: init SendpolicyHook Arguments: - ext_args (:obj:`dict`): Extended arguments. Use ``ext_args.freq`` to ... | the_stack_v2_python_sparse | ding/worker/learner/comm/flask_fs_learner.py | shengxuesun/DI-engine | train | 1 |
1b1c1906f9e64859ee8ed57fe1debe7a348c5907 | [
"if not username:\n raise ValueError('Users must have a username')\nif not phone_number:\n raise ValueError('Users must have a phone number')\nuser = self.model(username=username, phone_number=phone_number)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(usern... | <|body_start_0|>
if not username:
raise ValueError('Users must have a username')
if not phone_number:
raise ValueError('Users must have a phone number')
user = self.model(username=username, phone_number=phone_number)
user.set_password(password)
user.save(u... | TuserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TuserManager:
def create_user(self, username, phone_number, password=None):
"""Creates and saves a User with the given username, phone number and password."""
<|body_0|>
def create_superuser(self, username, phone_number, password):
"""Creates and saves a superuser wi... | stack_v2_sparse_classes_75kplus_train_068360 | 6,192 | no_license | [
{
"docstring": "Creates and saves a User with the given username, phone number and password.",
"name": "create_user",
"signature": "def create_user(self, username, phone_number, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
... | 2 | stack_v2_sparse_classes_30k_train_011297 | Implement the Python class `TuserManager` described below.
Class description:
Implement the TuserManager class.
Method signatures and docstrings:
- def create_user(self, username, phone_number, password=None): Creates and saves a User with the given username, phone number and password.
- def create_superuser(self, us... | Implement the Python class `TuserManager` described below.
Class description:
Implement the TuserManager class.
Method signatures and docstrings:
- def create_user(self, username, phone_number, password=None): Creates and saves a User with the given username, phone number and password.
- def create_superuser(self, us... | 881825a430e8d3c4811d103d7066a599dd4953fe | <|skeleton|>
class TuserManager:
def create_user(self, username, phone_number, password=None):
"""Creates and saves a User with the given username, phone number and password."""
<|body_0|>
def create_superuser(self, username, phone_number, password):
"""Creates and saves a superuser wi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TuserManager:
def create_user(self, username, phone_number, password=None):
"""Creates and saves a User with the given username, phone number and password."""
if not username:
raise ValueError('Users must have a username')
if not phone_number:
raise ValueError('... | the_stack_v2_python_sparse | accounts_api/models.py | OketchoHillary/tossapp | train | 0 | |
258fa2d7c5873801c63264e09d57e339eeaa4b37 | [
"super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nself.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob)])\nch = chans\nfor i in range(num_pool_layers - 1):\n self.down_sample_... | <|body_start_0|>
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob)])
ch... | PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. | UnetModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnetModel:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. S... | stack_v2_sparse_classes_75kplus_train_068361 | 30,521 | no_license | [
{
"docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ... | 2 | stack_v2_sparse_classes_30k_train_037022 | Implement the Python class `UnetModel` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-... | Implement the Python class `UnetModel` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class UnetModel:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. S... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnetModel:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015... | the_stack_v2_python_sparse | lemawarersn_t1assist/models.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
d25a60fd706303e81a9eac9e4071776e34e9ba98 | [
"self.surface = surface\nself.beans = beans\nself.__dict__.update(parameter_dict)\nself.x = None\nself.y = None\nself.x_off = None\nself.y_off = None\nself.vel = 3\nself.accel = -0.003\nself.width = self.surface.get_width()\nself.height = self.surface.get_height()\nself.color = pygame.Color(0, 0, 0, 0)",
"if self... | <|body_start_0|>
self.surface = surface
self.beans = beans
self.__dict__.update(parameter_dict)
self.x = None
self.y = None
self.x_off = None
self.y_off = None
self.vel = 3
self.accel = -0.003
self.width = self.surface.get_width()
s... | represents one colored line | Bean | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bean:
"""represents one colored line"""
def __init__(self, surface, beans, parameter_dict):
"""(pygame.Surface) surface - surface to draw on (list) beans - list of beans to remove self when velocity is 0 (dict) parameter_dict - dictionary of parameters"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_068362 | 3,495 | no_license | [
{
"docstring": "(pygame.Surface) surface - surface to draw on (list) beans - list of beans to remove self when velocity is 0 (dict) parameter_dict - dictionary of parameters",
"name": "__init__",
"signature": "def __init__(self, surface, beans, parameter_dict)"
},
{
"docstring": "draw line",
... | 2 | stack_v2_sparse_classes_30k_train_027159 | Implement the Python class `Bean` described below.
Class description:
represents one colored line
Method signatures and docstrings:
- def __init__(self, surface, beans, parameter_dict): (pygame.Surface) surface - surface to draw on (list) beans - list of beans to remove self when velocity is 0 (dict) parameter_dict -... | Implement the Python class `Bean` described below.
Class description:
represents one colored line
Method signatures and docstrings:
- def __init__(self, surface, beans, parameter_dict): (pygame.Surface) surface - surface to draw on (list) beans - list of beans to remove self when velocity is 0 (dict) parameter_dict -... | 1fd421195a2888c0588a49f5a043a1110eedcdbf | <|skeleton|>
class Bean:
"""represents one colored line"""
def __init__(self, surface, beans, parameter_dict):
"""(pygame.Surface) surface - surface to draw on (list) beans - list of beans to remove self when velocity is 0 (dict) parameter_dict - dictionary of parameters"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Bean:
"""represents one colored line"""
def __init__(self, surface, beans, parameter_dict):
"""(pygame.Surface) surface - surface to draw on (list) beans - list of beans to remove self when velocity is 0 (dict) parameter_dict - dictionary of parameters"""
self.surface = surface
se... | the_stack_v2_python_sparse | effects/CoffeeBean.py | gunny26/pygame | train | 5 |
6e01af137eb0f7bc8a1434ede6bdcea3e4524331 | [
"self.content_type = CONTENT_TYPE\nself.root = partition_type\nself.headers_obj = HmcHeaders.HmcHeaders('web')\ndirectory_path = os.path.dirname(__file__)\nself.input = open(directory_path + '\\\\data\\\\poweroff_lpar.xml', 'r').read()\nself.input = self.input.format(partition_type)",
"super().__init__(ip, self.r... | <|body_start_0|>
self.content_type = CONTENT_TYPE
self.root = partition_type
self.headers_obj = HmcHeaders.HmcHeaders('web')
directory_path = os.path.dirname(__file__)
self.input = open(directory_path + '\\data\\poweroff_lpar.xml', 'r').read()
self.input = self.input.form... | PowerOffPartition | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PowerOffPartition:
def __init__(self, partition_type):
"""initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer"""
<|body_0|>
def poweroff_Partition(self, ip, logicalpartition_object, session_id):
"""performs the... | stack_v2_sparse_classes_75kplus_train_068363 | 2,534 | permissive | [
{
"docstring": "initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer",
"name": "__init__",
"signature": "def __init__(self, partition_type)"
},
{
"docstring": "performs the poweroff operation for the provided LogicalPartition object Args: i... | 2 | stack_v2_sparse_classes_30k_train_021237 | Implement the Python class `PowerOffPartition` described below.
Class description:
Implement the PowerOffPartition class.
Method signatures and docstrings:
- def __init__(self, partition_type): initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer
- def poweroff_... | Implement the Python class `PowerOffPartition` described below.
Class description:
Implement the PowerOffPartition class.
Method signatures and docstrings:
- def __init__(self, partition_type): initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer
- def poweroff_... | 8e46a5a25a57d07f0612404f4b978234d6d2cd4b | <|skeleton|>
class PowerOffPartition:
def __init__(self, partition_type):
"""initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer"""
<|body_0|>
def poweroff_Partition(self, ip, logicalpartition_object, session_id):
"""performs the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PowerOffPartition:
def __init__(self, partition_type):
"""initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer"""
self.content_type = CONTENT_TYPE
self.root = partition_type
self.headers_obj = HmcHeaders.HmcHeaders('web')
... | the_stack_v2_python_sparse | src/partition_operation_util/PowerOffPartition.py | Python3pkg/HmcRestClient | train | 0 | |
b69aca511d4b23b662223ce0c7b672b22c1984be | [
"def can_eat_all(n):\n return sum(((pile + n - 1) // n for pile in piles)) <= h\n\ndef bisearch(s, e, key=can_eat_all):\n while s <= e:\n m = s + (e - s) // 2\n if key(m):\n e = m - 1\n else:\n s = m + 1\n return e + 1\nreturn bisearch(1, max(piles))",
"l = 1\nr... | <|body_start_0|>
def can_eat_all(n):
return sum(((pile + n - 1) // n for pile in piles)) <= h
def bisearch(s, e, key=can_eat_all):
while s <= e:
m = s + (e - s) // 2
if key(m):
e = m - 1
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minEatingSpeed(self, piles: List[int], h: int) -> int:
"""Feb 04, 2022 15:24"""
<|body_0|>
def minEatingSpeed(self, piles: List[int], h: int) -> int:
"""Apr 07, 2023 20:12"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def can_eat_all... | stack_v2_sparse_classes_75kplus_train_068364 | 2,168 | no_license | [
{
"docstring": "Feb 04, 2022 15:24",
"name": "minEatingSpeed",
"signature": "def minEatingSpeed(self, piles: List[int], h: int) -> int"
},
{
"docstring": "Apr 07, 2023 20:12",
"name": "minEatingSpeed",
"signature": "def minEatingSpeed(self, piles: List[int], h: int) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minEatingSpeed(self, piles: List[int], h: int) -> int: Feb 04, 2022 15:24
- def minEatingSpeed(self, piles: List[int], h: int) -> int: Apr 07, 2023 20:12 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minEatingSpeed(self, piles: List[int], h: int) -> int: Feb 04, 2022 15:24
- def minEatingSpeed(self, piles: List[int], h: int) -> int: Apr 07, 2023 20:12
<|skeleton|>
class ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def minEatingSpeed(self, piles: List[int], h: int) -> int:
"""Feb 04, 2022 15:24"""
<|body_0|>
def minEatingSpeed(self, piles: List[int], h: int) -> int:
"""Apr 07, 2023 20:12"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minEatingSpeed(self, piles: List[int], h: int) -> int:
"""Feb 04, 2022 15:24"""
def can_eat_all(n):
return sum(((pile + n - 1) // n for pile in piles)) <= h
def bisearch(s, e, key=can_eat_all):
while s <= e:
m = s + (e - s) // 2
... | the_stack_v2_python_sparse | leetcode/solved/907_Koko_Eating_Bananas/solution.py | sungminoh/algorithms | train | 0 | |
e56b1cf13574e362df8cd5785b9816c1507793f6 | [
"log_as_info('\\nToggleNoteDirective.run')\nif len(self.arguments) > 0:\n toggle_start = self.arguments[0]\nelse:\n toggle_start = 'expanded'\nif len(self.arguments) > 1:\n extra_title_text = self.arguments[1]\nelse:\n extra_title_text = ''\nself.assert_has_content()\ntext = '\\n'.join(self.content)\nno... | <|body_start_0|>
log_as_info('\nToggleNoteDirective.run')
if len(self.arguments) > 0:
toggle_start = self.arguments[0]
else:
toggle_start = 'expanded'
if len(self.arguments) > 1:
extra_title_text = self.arguments[1]
else:
extra_titl... | Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If extra_title_text is to be provided, the author... | ToggleNoteDirective | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ToggleNoteDirective:
"""Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If... | stack_v2_sparse_classes_75kplus_train_068365 | 16,710 | permissive | [
{
"docstring": "Parses the directive when encountered in a \\\\*.rst file. At the time this method is called, the arguments, options, and content for the directive have been store in initializing the directive object. This method returns a list containing any nodes to be inserted into the Docutils document. For... | 2 | stack_v2_sparse_classes_30k_train_047219 | Implement the Python class `ToggleNoteDirective` described below.
Class description:
Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument ... | Implement the Python class `ToggleNoteDirective` described below.
Class description:
Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument ... | 46a11295394093de3a23cb8dec1e2e76eac752e8 | <|skeleton|>
class ToggleNoteDirective:
"""Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ToggleNoteDirective:
"""Implements a note directive that allows the content of the note to be collapsed by the browser user. Usage: .\\. astutus_toggle_note:: [ expanded|collapsed [extra_title_text]] indented block of text for note ... If the first argument is omitted, it defaults to expanded. If extra_title_... | the_stack_v2_python_sparse | src/astutus/sphinx/dyn_pages.py | rich-dobbs-13440/astutus | train | 0 |
7ab7f18474229eaef8e4e13cc2437ef5a48fc7e5 | [
"self.non_zero_dict = {}\nfor i, num in enumerate(nums):\n if num != 0:\n self.non_zero_dict[i] = num",
"result = 0\nfor key, val in self.non_zero_dict.items():\n if vec.non_zero_dict.get(key, 0):\n result += val * vec.non_zero_dict.get(key, 0)\nreturn result"
] | <|body_start_0|>
self.non_zero_dict = {}
for i, num in enumerate(nums):
if num != 0:
self.non_zero_dict[i] = num
<|end_body_0|>
<|body_start_1|>
result = 0
for key, val in self.non_zero_dict.items():
if vec.non_zero_dict.get(key, 0):
... | SparseVector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparseVector:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def dotProduct(self, vec):
""":type vec: 'SparseVector' :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.non_zero_dict = {}
for i, num in enumerat... | stack_v2_sparse_classes_75kplus_train_068366 | 1,831 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type vec: 'SparseVector' :rtype: int",
"name": "dotProduct",
"signature": "def dotProduct(self, vec)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054638 | Implement the Python class `SparseVector` described below.
Class description:
Implement the SparseVector class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int | Implement the Python class `SparseVector` described below.
Class description:
Implement the SparseVector class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def dotProduct(self, vec): :type vec: 'SparseVector' :rtype: int
<|skeleton|>
class SparseVector:
def __init__(sel... | 844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4 | <|skeleton|>
class SparseVector:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def dotProduct(self, vec):
""":type vec: 'SparseVector' :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SparseVector:
def __init__(self, nums):
""":type nums: List[int]"""
self.non_zero_dict = {}
for i, num in enumerate(nums):
if num != 0:
self.non_zero_dict[i] = num
def dotProduct(self, vec):
""":type vec: 'SparseVector' :rtype: int"""
re... | the_stack_v2_python_sparse | 1570-dot_product_of_two_sparse_vectors.py | stevestar888/leetcode-problems | train | 2 | |
1d984788ae3589a2d046935cb6c54ae2c323784f | [
"customerId = kwargs['pk']\ndefaultAddress = get_object_or_404(CustomerAddress, customer_id=customerId, isDefault=True)\nserializer = CustomerAddressSerializer(defaultAddress)\nreturn Response(serializer.data)",
"data = request.data\nnewDefaultAddress = get_object_or_404(CustomerAddress, id=data['address'])\nnewD... | <|body_start_0|>
customerId = kwargs['pk']
defaultAddress = get_object_or_404(CustomerAddress, customer_id=customerId, isDefault=True)
serializer = CustomerAddressSerializer(defaultAddress)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
data = request.data
... | DefaultAddress | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultAddress:
def get(self, request, *args, **kwargs):
"""获取用户默认地址"""
<|body_0|>
def patch(self, request, *args, **kwargs):
"""修改用户默认地址 :param request: address:新地址id :param args: :param kwargs: id:用户id :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_068367 | 5,621 | no_license | [
{
"docstring": "获取用户默认地址",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "修改用户默认地址 :param request: address:新地址id :param args: :param kwargs: id:用户id :return:",
"name": "patch",
"signature": "def patch(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_051166 | Implement the Python class `DefaultAddress` described below.
Class description:
Implement the DefaultAddress class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 获取用户默认地址
- def patch(self, request, *args, **kwargs): 修改用户默认地址 :param request: address:新地址id :param args: :param kwargs: id:用... | Implement the Python class `DefaultAddress` described below.
Class description:
Implement the DefaultAddress class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 获取用户默认地址
- def patch(self, request, *args, **kwargs): 修改用户默认地址 :param request: address:新地址id :param args: :param kwargs: id:用... | 4510c5bb5b1a936dc881412b92518d01b5d5be13 | <|skeleton|>
class DefaultAddress:
def get(self, request, *args, **kwargs):
"""获取用户默认地址"""
<|body_0|>
def patch(self, request, *args, **kwargs):
"""修改用户默认地址 :param request: address:新地址id :param args: :param kwargs: id:用户id :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DefaultAddress:
def get(self, request, *args, **kwargs):
"""获取用户默认地址"""
customerId = kwargs['pk']
defaultAddress = get_object_or_404(CustomerAddress, customer_id=customerId, isDefault=True)
serializer = CustomerAddressSerializer(defaultAddress)
return Response(serialize... | the_stack_v2_python_sparse | WeChat/views/customer.py | liuyucomeon/WeChatMall | train | 1 | |
c15cddef33f51e4d2268ae3cf22dbcc7c1f7fdca | [
"pygame.init()\nself._display = pygame.display.set_mode((600, 250))\nself._display.fill((153, 255, 153))\nself._title_font = pygame.font.SysFont('Arial', 42)\nself._regular_font = pygame.font.SysFont('Arial', 26)\nself._small_font = pygame.font.SysFont('Arial', 18)",
"for i in range(5, 0, -1):\n self._display.... | <|body_start_0|>
pygame.init()
self._display = pygame.display.set_mode((600, 250))
self._display.fill((153, 255, 153))
self._title_font = pygame.font.SysFont('Arial', 42)
self._regular_font = pygame.font.SysFont('Arial', 26)
self._small_font = pygame.font.SysFont('Arial',... | A class to display information after a game is played. | EndScreen | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EndScreen:
"""A class to display information after a game is played."""
def __init__(self):
"""Sets a new pygame display and fonts."""
<|body_0|>
def draw_endscreen(self, score):
"""A method that draws the information about the game just played. Displays a real t... | stack_v2_sparse_classes_75kplus_train_068368 | 1,487 | no_license | [
{
"docstring": "Sets a new pygame display and fonts.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "A method that draws the information about the game just played. Displays a real time timer when returning to the main menu. Args: score (int): The amount of shots neede... | 2 | stack_v2_sparse_classes_30k_train_038455 | Implement the Python class `EndScreen` described below.
Class description:
A class to display information after a game is played.
Method signatures and docstrings:
- def __init__(self): Sets a new pygame display and fonts.
- def draw_endscreen(self, score): A method that draws the information about the game just play... | Implement the Python class `EndScreen` described below.
Class description:
A class to display information after a game is played.
Method signatures and docstrings:
- def __init__(self): Sets a new pygame display and fonts.
- def draw_endscreen(self, score): A method that draws the information about the game just play... | c0b4513cef6cebbc2db103d2d58f681a85a3f92b | <|skeleton|>
class EndScreen:
"""A class to display information after a game is played."""
def __init__(self):
"""Sets a new pygame display and fonts."""
<|body_0|>
def draw_endscreen(self, score):
"""A method that draws the information about the game just played. Displays a real t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EndScreen:
"""A class to display information after a game is played."""
def __init__(self):
"""Sets a new pygame display and fonts."""
pygame.init()
self._display = pygame.display.set_mode((600, 250))
self._display.fill((153, 255, 153))
self._title_font = pygame.fo... | the_stack_v2_python_sparse | minigolf-game/src/ui/end_screen.py | makeri89/Ohjelmistotekniikka | train | 0 |
bf985eea811555ee882327d7fa2dd7d4288f757b | [
"dev = self.selectedDevice(c)\nresp = (yield dev.query('KRDG? 0'))\nvals = [parse(val) * K for val in resp.split(',')]\nreturnValue(vals)",
"dev = self.selectedDevice(c)\nresp = (yield dev.query('SRDG? 0'))\nvals = [parse(val) * V for val in resp.split(',')]\nreturnValue(vals)"
] | <|body_start_0|>
dev = self.selectedDevice(c)
resp = (yield dev.query('KRDG? 0'))
vals = [parse(val) * K for val in resp.split(',')]
returnValue(vals)
<|end_body_0|>
<|body_start_1|>
dev = self.selectedDevice(c)
resp = (yield dev.query('SRDG? 0'))
vals = [parse(v... | LakeshoreDiodeServer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LakeshoreDiodeServer:
def temperatures(self, c):
"""Read channel temperatures. Returns a ValueList of the channel temperatures in Kelvin."""
<|body_0|>
def voltages(self, c):
"""Read channel voltages. Returns a ValueList of the channel voltages in Volts."""
<... | stack_v2_sparse_classes_75kplus_train_068369 | 2,342 | no_license | [
{
"docstring": "Read channel temperatures. Returns a ValueList of the channel temperatures in Kelvin.",
"name": "temperatures",
"signature": "def temperatures(self, c)"
},
{
"docstring": "Read channel voltages. Returns a ValueList of the channel voltages in Volts.",
"name": "voltages",
"... | 2 | stack_v2_sparse_classes_30k_train_017191 | Implement the Python class `LakeshoreDiodeServer` described below.
Class description:
Implement the LakeshoreDiodeServer class.
Method signatures and docstrings:
- def temperatures(self, c): Read channel temperatures. Returns a ValueList of the channel temperatures in Kelvin.
- def voltages(self, c): Read channel vol... | Implement the Python class `LakeshoreDiodeServer` described below.
Class description:
Implement the LakeshoreDiodeServer class.
Method signatures and docstrings:
- def temperatures(self, c): Read channel temperatures. Returns a ValueList of the channel temperatures in Kelvin.
- def voltages(self, c): Read channel vol... | 94c7aa8db708badf0be53b582dc2ba80262834a0 | <|skeleton|>
class LakeshoreDiodeServer:
def temperatures(self, c):
"""Read channel temperatures. Returns a ValueList of the channel temperatures in Kelvin."""
<|body_0|>
def voltages(self, c):
"""Read channel voltages. Returns a ValueList of the channel voltages in Volts."""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LakeshoreDiodeServer:
def temperatures(self, c):
"""Read channel temperatures. Returns a ValueList of the channel temperatures in Kelvin."""
dev = self.selectedDevice(c)
resp = (yield dev.query('KRDG? 0'))
vals = [parse(val) * K for val in resp.split(',')]
returnValue(v... | the_stack_v2_python_sparse | lakeshore218.py | yutaka-tabuchi/servers | train | 0 | |
eca03524295201045bd9c0cff897369d3a20a4b5 | [
"self.dataset_config = dataset_config\nself.preprocessed_datasets: Optional[Dict[str, 'Dataset']] = None\nself.preprocessor: Optional['Preprocessor'] = None",
"for key, dataset in list(datasets.items()):\n conf = self._config(key)\n local_window = 1 > conf.max_object_store_memory_fraction >= 0\n if conf.... | <|body_start_0|>
self.dataset_config = dataset_config
self.preprocessed_datasets: Optional[Dict[str, 'Dataset']] = None
self.preprocessor: Optional['Preprocessor'] = None
<|end_body_0|>
<|body_start_1|>
for key, dataset in list(datasets.items()):
conf = self._config(key)
... | Implements the execution of DatasetConfig preprocessing and ingest. | DataParallelIngestSpec | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataParallelIngestSpec:
"""Implements the execution of DatasetConfig preprocessing and ingest."""
def __init__(self, dataset_config: Dict[str, DatasetConfig]):
"""Construct an ingest spec. Args: dataset_config: The merged default + user config dict for the trainer with all defaults f... | stack_v2_sparse_classes_75kplus_train_068370 | 10,494 | permissive | [
{
"docstring": "Construct an ingest spec. Args: dataset_config: The merged default + user config dict for the trainer with all defaults filled in.",
"name": "__init__",
"signature": "def __init__(self, dataset_config: Dict[str, DatasetConfig])"
},
{
"docstring": "Preprocess the given datasets. T... | 4 | null | Implement the Python class `DataParallelIngestSpec` described below.
Class description:
Implements the execution of DatasetConfig preprocessing and ingest.
Method signatures and docstrings:
- def __init__(self, dataset_config: Dict[str, DatasetConfig]): Construct an ingest spec. Args: dataset_config: The merged defau... | Implement the Python class `DataParallelIngestSpec` described below.
Class description:
Implements the execution of DatasetConfig preprocessing and ingest.
Method signatures and docstrings:
- def __init__(self, dataset_config: Dict[str, DatasetConfig]): Construct an ingest spec. Args: dataset_config: The merged defau... | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | <|skeleton|>
class DataParallelIngestSpec:
"""Implements the execution of DatasetConfig preprocessing and ingest."""
def __init__(self, dataset_config: Dict[str, DatasetConfig]):
"""Construct an ingest spec. Args: dataset_config: The merged default + user config dict for the trainer with all defaults f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataParallelIngestSpec:
"""Implements the execution of DatasetConfig preprocessing and ingest."""
def __init__(self, dataset_config: Dict[str, DatasetConfig]):
"""Construct an ingest spec. Args: dataset_config: The merged default + user config dict for the trainer with all defaults filled in."""
... | the_stack_v2_python_sparse | python/ray/train/_internal/dataset_spec.py | ray-project/ray | train | 29,482 |
dfe91c59d774f4d7d93386b091ea20b446abf875 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | InterfaceTagAssignmentConfigServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterfaceTagAssignmentConfigServiceServicer:
def GetOne(self, request, context):
"""GetOne returns a unary model as specified by the key in the request. The key must be provided and all fields populated (unless otherwise specified)."""
<|body_0|>
def GetAll(self, request, co... | stack_v2_sparse_classes_75kplus_train_068371 | 30,872 | permissive | [
{
"docstring": "GetOne returns a unary model as specified by the key in the request. The key must be provided and all fields populated (unless otherwise specified).",
"name": "GetOne",
"signature": "def GetOne(self, request, context)"
},
{
"docstring": "GetAll returns all entities for this model... | 5 | null | Implement the Python class `InterfaceTagAssignmentConfigServiceServicer` described below.
Class description:
Implement the InterfaceTagAssignmentConfigServiceServicer class.
Method signatures and docstrings:
- def GetOne(self, request, context): GetOne returns a unary model as specified by the key in the request. The... | Implement the Python class `InterfaceTagAssignmentConfigServiceServicer` described below.
Class description:
Implement the InterfaceTagAssignmentConfigServiceServicer class.
Method signatures and docstrings:
- def GetOne(self, request, context): GetOne returns a unary model as specified by the key in the request. The... | d93b5f66a00b1e3710257d607d62f9d43736304e | <|skeleton|>
class InterfaceTagAssignmentConfigServiceServicer:
def GetOne(self, request, context):
"""GetOne returns a unary model as specified by the key in the request. The key must be provided and all fields populated (unless otherwise specified)."""
<|body_0|>
def GetAll(self, request, co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InterfaceTagAssignmentConfigServiceServicer:
def GetOne(self, request, context):
"""GetOne returns a unary model as specified by the key in the request. The key must be provided and all fields populated (unless otherwise specified)."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
co... | the_stack_v2_python_sparse | CVP_API/Snapshot_Utils/getSnapshots_Resource_API/cloudvision-python/arista/tag/v1/services/gen_pb2_grpc.py | Hugh-Adams/Example_Scripts | train | 4 | |
ff239c6f8d4328cd5cfef6b0ed4b032ae21387a5 | [
"size__xz = [None, z_size]\nself.mean = mean\nself.logvar = logvar\nself.noise = noise = tf.random_normal(tf.shape(logvar))\nself.sample = mean + tf.exp(0.5 * logvar) * noise\nmean.set_shape(size__xz)\nlogvar.set_shape(size__xz)\nself.sample.set_shape(size__xz)",
"if z is None:\n z = self.sample\nif z == self.... | <|body_start_0|>
size__xz = [None, z_size]
self.mean = mean
self.logvar = logvar
self.noise = noise = tf.random_normal(tf.shape(logvar))
self.sample = mean + tf.exp(0.5 * logvar) * noise
mean.set_shape(size__xz)
logvar.set_shape(size__xz)
self.sample.set_s... | Diagonal Gaussian with different constant mean and variances in each dimension. | DiagonalGaussian | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiagonalGaussian:
"""Diagonal Gaussian with different constant mean and variances in each dimension."""
def __init__(self, batch_size, z_size, mean, logvar):
"""Create a diagonal gaussian distribution. Args: batch_size: The size of the batch, i.e. 0th dim in 2D tensor of samples. z_s... | stack_v2_sparse_classes_75kplus_train_068372 | 17,394 | permissive | [
{
"docstring": "Create a diagonal gaussian distribution. Args: batch_size: The size of the batch, i.e. 0th dim in 2D tensor of samples. z_size: The dimension of the distribution, i.e. 1st dim in 2D tensor. mean: The N-D mean of the distribution. logvar: The N-D log variance of the diagonal distribution.",
"... | 2 | stack_v2_sparse_classes_30k_train_028796 | Implement the Python class `DiagonalGaussian` described below.
Class description:
Diagonal Gaussian with different constant mean and variances in each dimension.
Method signatures and docstrings:
- def __init__(self, batch_size, z_size, mean, logvar): Create a diagonal gaussian distribution. Args: batch_size: The siz... | Implement the Python class `DiagonalGaussian` described below.
Class description:
Diagonal Gaussian with different constant mean and variances in each dimension.
Method signatures and docstrings:
- def __init__(self, batch_size, z_size, mean, logvar): Create a diagonal gaussian distribution. Args: batch_size: The siz... | a115d918f6894a69586174653172be0b5d1de952 | <|skeleton|>
class DiagonalGaussian:
"""Diagonal Gaussian with different constant mean and variances in each dimension."""
def __init__(self, batch_size, z_size, mean, logvar):
"""Create a diagonal gaussian distribution. Args: batch_size: The size of the batch, i.e. 0th dim in 2D tensor of samples. z_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiagonalGaussian:
"""Diagonal Gaussian with different constant mean and variances in each dimension."""
def __init__(self, batch_size, z_size, mean, logvar):
"""Create a diagonal gaussian distribution. Args: batch_size: The size of the batch, i.e. 0th dim in 2D tensor of samples. z_size: The dime... | the_stack_v2_python_sparse | models/research/lfads/distributions.py | finnickniu/tensorflow_object_detection_tflite | train | 60 |
361b4bb42d398e6419e88de77e4e6bca0c95d58c | [
"self.tcex = tcex\nself._is_organization = False\nself._notification_type = None\nself._recipients = None\nself._priority = 'Low'",
"self._notification_type = notification_type\nself._recipients = recipients\nself._priority = priority\nself._is_organization = False",
"self._notification_type = notification_type... | <|body_start_0|>
self.tcex = tcex
self._is_organization = False
self._notification_type = None
self._recipients = None
self._priority = 'Low'
<|end_body_0|>
<|body_start_1|>
self._notification_type = notification_type
self._recipients = recipients
self._p... | TcEx Notification Class | Notifications | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notifications:
"""TcEx Notification Class"""
def __init__(self, tcex):
"""Initialize the Class properties. Args: tcex (obj): An instance of TcEx object."""
<|body_0|>
def recipients(self, notification_type, recipients, priority='Low'):
"""Set vars for the passed ... | stack_v2_sparse_classes_75kplus_train_068373 | 2,888 | permissive | [
{
"docstring": "Initialize the Class properties. Args: tcex (obj): An instance of TcEx object.",
"name": "__init__",
"signature": "def __init__(self, tcex)"
},
{
"docstring": "Set vars for the passed in data. Used for one or more recipient notification. .. code-block:: javascript { \"notificatio... | 4 | null | Implement the Python class `Notifications` described below.
Class description:
TcEx Notification Class
Method signatures and docstrings:
- def __init__(self, tcex): Initialize the Class properties. Args: tcex (obj): An instance of TcEx object.
- def recipients(self, notification_type, recipients, priority='Low'): Set... | Implement the Python class `Notifications` described below.
Class description:
TcEx Notification Class
Method signatures and docstrings:
- def __init__(self, tcex): Initialize the Class properties. Args: tcex (obj): An instance of TcEx object.
- def recipients(self, notification_type, recipients, priority='Low'): Set... | 7cf04fec048fadc71ff851970045b8a587269ccf | <|skeleton|>
class Notifications:
"""TcEx Notification Class"""
def __init__(self, tcex):
"""Initialize the Class properties. Args: tcex (obj): An instance of TcEx object."""
<|body_0|>
def recipients(self, notification_type, recipients, priority='Low'):
"""Set vars for the passed ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Notifications:
"""TcEx Notification Class"""
def __init__(self, tcex):
"""Initialize the Class properties. Args: tcex (obj): An instance of TcEx object."""
self.tcex = tcex
self._is_organization = False
self._notification_type = None
self._recipients = None
... | the_stack_v2_python_sparse | tcex/notifications/notifications.py | TpyoKnig/tcex | train | 0 |
da2a55412d5a053b87096105d6484e855feda29f | [
"question = Question.get(pk=question_id)\nserializer = serialize(QuestionSerializer, question)\nreturn QuaApiResponse(serializer.data)",
"question = Question.get(pk=question_id)\nserializer = serialize(QuestionSerializer, question, data=request.data)\nserializer.save(user=request.user)\nreturn QuaApiResponse(seri... | <|body_start_0|>
question = Question.get(pk=question_id)
serializer = serialize(QuestionSerializer, question)
return QuaApiResponse(serializer.data)
<|end_body_0|>
<|body_start_1|>
question = Question.get(pk=question_id)
serializer = serialize(QuestionSerializer, question, data=... | QuestionView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionView:
def get(self, request, question_id):
"""Get question by question_id"""
<|body_0|>
def put(self, request, question_id):
"""Update question information"""
<|body_1|>
def delete(self, request, question_id):
"""Delete the specific quest... | stack_v2_sparse_classes_75kplus_train_068374 | 1,772 | no_license | [
{
"docstring": "Get question by question_id",
"name": "get",
"signature": "def get(self, request, question_id)"
},
{
"docstring": "Update question information",
"name": "put",
"signature": "def put(self, request, question_id)"
},
{
"docstring": "Delete the specific question",
... | 3 | stack_v2_sparse_classes_30k_train_030422 | Implement the Python class `QuestionView` described below.
Class description:
Implement the QuestionView class.
Method signatures and docstrings:
- def get(self, request, question_id): Get question by question_id
- def put(self, request, question_id): Update question information
- def delete(self, request, question_i... | Implement the Python class `QuestionView` described below.
Class description:
Implement the QuestionView class.
Method signatures and docstrings:
- def get(self, request, question_id): Get question by question_id
- def put(self, request, question_id): Update question information
- def delete(self, request, question_i... | 670752a3b48619eeba2fa9f2cf133e6050737a73 | <|skeleton|>
class QuestionView:
def get(self, request, question_id):
"""Get question by question_id"""
<|body_0|>
def put(self, request, question_id):
"""Update question information"""
<|body_1|>
def delete(self, request, question_id):
"""Delete the specific quest... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuestionView:
def get(self, request, question_id):
"""Get question by question_id"""
question = Question.get(pk=question_id)
serializer = serialize(QuestionSerializer, question)
return QuaApiResponse(serializer.data)
def put(self, request, question_id):
"""Update q... | the_stack_v2_python_sparse | controller/src/api/views/questions.py | Sapunov/qua | train | 1 | |
7f65487368703d49644d55c3e68ca9df59b07a7a | [
"vendor = get_a_vendor(vendor_id)\nif not vendor:\n api.abort(404)\nelse:\n return vendor",
"data = request.json\nvendor = update_vendor(data=data, id=vendor_id)\nif not vendor:\n api.abort(404)\nelse:\n return vendor"
] | <|body_start_0|>
vendor = get_a_vendor(vendor_id)
if not vendor:
api.abort(404)
else:
return vendor
<|end_body_0|>
<|body_start_1|>
data = request.json
vendor = update_vendor(data=data, id=vendor_id)
if not vendor:
api.abort(404)
... | Vendor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vendor:
def get(self, vendor_id):
"""get a vendor given its identifier"""
<|body_0|>
def put(self, vendor_id):
"""Updates a new Vendor"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
vendor = get_a_vendor(vendor_id)
if not vendor:
... | stack_v2_sparse_classes_75kplus_train_068375 | 1,938 | no_license | [
{
"docstring": "get a vendor given its identifier",
"name": "get",
"signature": "def get(self, vendor_id)"
},
{
"docstring": "Updates a new Vendor",
"name": "put",
"signature": "def put(self, vendor_id)"
}
] | 2 | null | Implement the Python class `Vendor` described below.
Class description:
Implement the Vendor class.
Method signatures and docstrings:
- def get(self, vendor_id): get a vendor given its identifier
- def put(self, vendor_id): Updates a new Vendor | Implement the Python class `Vendor` described below.
Class description:
Implement the Vendor class.
Method signatures and docstrings:
- def get(self, vendor_id): get a vendor given its identifier
- def put(self, vendor_id): Updates a new Vendor
<|skeleton|>
class Vendor:
def get(self, vendor_id):
"""get... | 3f33450a1c556724ff131ccf0f3afeb590b859b8 | <|skeleton|>
class Vendor:
def get(self, vendor_id):
"""get a vendor given its identifier"""
<|body_0|>
def put(self, vendor_id):
"""Updates a new Vendor"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vendor:
def get(self, vendor_id):
"""get a vendor given its identifier"""
vendor = get_a_vendor(vendor_id)
if not vendor:
api.abort(404)
else:
return vendor
def put(self, vendor_id):
"""Updates a new Vendor"""
data = request.json
... | the_stack_v2_python_sparse | app/main/controller/vendor_controller.py | TheJina/orderquick | train | 0 | |
89e07c8832749505e130cde70796631878662eb3 | [
"queue_obj = self.channel.queue_declare(exclusive=True)\nself.callback_queue = queue_obj.method.queue\nprint('随机生成的队列名为', self.callback_queue)\nself.corr_id = str(uuid.uuid4())\nself.channel.basic_publish(exchange='', routing_key=ip_address, properties=pika.BasicProperties(reply_to=self.callback_queue, correlation_... | <|body_start_0|>
queue_obj = self.channel.queue_declare(exclusive=True)
self.callback_queue = queue_obj.method.queue
print('随机生成的队列名为', self.callback_queue)
self.corr_id = str(uuid.uuid4())
self.channel.basic_publish(exchange='', routing_key=ip_address, properties=pika.BasicPrope... | RPC客户端类 | RpcClient | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RpcClient:
"""RPC客户端类"""
def call(self, ip_address, command):
"""向rabbitmq server队列中发送数据的方法函数 :param ip_address: 需要执行命令的主机ip地址 :param command: 需要执行的命令 :return:"""
<|body_0|>
def get_response(self):
"""从rabbitmq server队列中接收消息的方法函数 :return:"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_068376 | 10,681 | no_license | [
{
"docstring": "向rabbitmq server队列中发送数据的方法函数 :param ip_address: 需要执行命令的主机ip地址 :param command: 需要执行的命令 :return:",
"name": "call",
"signature": "def call(self, ip_address, command)"
},
{
"docstring": "从rabbitmq server队列中接收消息的方法函数 :return:",
"name": "get_response",
"signature": "def get_res... | 3 | null | Implement the Python class `RpcClient` described below.
Class description:
RPC客户端类
Method signatures and docstrings:
- def call(self, ip_address, command): 向rabbitmq server队列中发送数据的方法函数 :param ip_address: 需要执行命令的主机ip地址 :param command: 需要执行的命令 :return:
- def get_response(self): 从rabbitmq server队列中接收消息的方法函数 :return:
- d... | Implement the Python class `RpcClient` described below.
Class description:
RPC客户端类
Method signatures and docstrings:
- def call(self, ip_address, command): 向rabbitmq server队列中发送数据的方法函数 :param ip_address: 需要执行命令的主机ip地址 :param command: 需要执行的命令 :return:
- def get_response(self): 从rabbitmq server队列中接收消息的方法函数 :return:
- d... | 5e51d789be2a2724a04ad1a3498fc54e87797ada | <|skeleton|>
class RpcClient:
"""RPC客户端类"""
def call(self, ip_address, command):
"""向rabbitmq server队列中发送数据的方法函数 :param ip_address: 需要执行命令的主机ip地址 :param command: 需要执行的命令 :return:"""
<|body_0|>
def get_response(self):
"""从rabbitmq server队列中接收消息的方法函数 :return:"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RpcClient:
"""RPC客户端类"""
def call(self, ip_address, command):
"""向rabbitmq server队列中发送数据的方法函数 :param ip_address: 需要执行命令的主机ip地址 :param command: 需要执行的命令 :return:"""
queue_obj = self.channel.queue_declare(exclusive=True)
self.callback_queue = queue_obj.method.queue
print('随机生... | the_stack_v2_python_sparse | day11/Host_management_based_on_RabbitMQ_RPC/client/core/main.py | 374904887/Python_homework | train | 0 |
c78691d6634d07d5b648576e8bb0f2d2bacd1dfc | [
"if not self.has_feature(request, project):\n raise PermissionDenied\nexpand = request.GET.getlist('expand', [])\nexpand.append('errors')\ncodeowners = list(ProjectCodeOwners.objects.filter(project=project).order_by('-date_added'))\nreturn Response(serialize(codeowners, request.user, serializer=projectcodeowners... | <|body_start_0|>
if not self.has_feature(request, project):
raise PermissionDenied
expand = request.GET.getlist('expand', [])
expand.append('errors')
codeowners = list(ProjectCodeOwners.objects.filter(project=project).order_by('-date_added'))
return Response(serialize... | ProjectCodeOwnersEndpoint | [
"Apache-2.0",
"BUSL-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectCodeOwnersEndpoint:
def get(self, request: Request, project: Project) -> Response:
"""Retrieve List of CODEOWNERS configurations for a project ```````````````````````````````````````````` Return a list of a project's CODEOWNERS configuration. :auth: required"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_068377 | 3,254 | permissive | [
{
"docstring": "Retrieve List of CODEOWNERS configurations for a project ```````````````````````````````````````````` Return a list of a project's CODEOWNERS configuration. :auth: required",
"name": "get",
"signature": "def get(self, request: Request, project: Project) -> Response"
},
{
"docstri... | 2 | null | Implement the Python class `ProjectCodeOwnersEndpoint` described below.
Class description:
Implement the ProjectCodeOwnersEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project: Project) -> Response: Retrieve List of CODEOWNERS configurations for a project ````````````````````````... | Implement the Python class `ProjectCodeOwnersEndpoint` described below.
Class description:
Implement the ProjectCodeOwnersEndpoint class.
Method signatures and docstrings:
- def get(self, request: Request, project: Project) -> Response: Retrieve List of CODEOWNERS configurations for a project ````````````````````````... | d9dd4f382f96b5c4576b64cbf015db651556c18b | <|skeleton|>
class ProjectCodeOwnersEndpoint:
def get(self, request: Request, project: Project) -> Response:
"""Retrieve List of CODEOWNERS configurations for a project ```````````````````````````````````````````` Return a list of a project's CODEOWNERS configuration. :auth: required"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectCodeOwnersEndpoint:
def get(self, request: Request, project: Project) -> Response:
"""Retrieve List of CODEOWNERS configurations for a project ```````````````````````````````````````````` Return a list of a project's CODEOWNERS configuration. :auth: required"""
if not self.has_feature(r... | the_stack_v2_python_sparse | src/sentry/api/endpoints/codeowners/index.py | nagyist/sentry | train | 0 | |
6c76187299f7f913d3618943e30784bd2e5744f4 | [
"result = {'id': self.id, 'createDateTime': model_utils.format_ts(self.create_ts), 'registrationId': self.registration_id, 'reportData': self.report_data, 'reportType': self.report_type}\nif self.doc_storage_url:\n result['documentStorageURL'] = self.doc_storage_url\nreturn result",
"try:\n db.session.add(s... | <|body_start_0|>
result = {'id': self.id, 'createDateTime': model_utils.format_ts(self.create_ts), 'registrationId': self.registration_id, 'reportData': self.report_data, 'reportType': self.report_type}
if self.doc_storage_url:
result['documentStorageURL'] = self.doc_storage_url
retu... | This class maintains MHR registration report information. | MhrRegistrationReport | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MhrRegistrationReport:
"""This class maintains MHR registration report information."""
def json(self) -> dict:
"""Return the verification report information as a json object."""
<|body_0|>
def save(self):
"""Render a record of mhr registration report information ... | stack_v2_sparse_classes_75kplus_train_068378 | 3,564 | permissive | [
{
"docstring": "Return the verification report information as a json object.",
"name": "json",
"signature": "def json(self) -> dict"
},
{
"docstring": "Render a record of mhr registration report information to the local cache.",
"name": "save",
"signature": "def save(self)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_025192 | Implement the Python class `MhrRegistrationReport` described below.
Class description:
This class maintains MHR registration report information.
Method signatures and docstrings:
- def json(self) -> dict: Return the verification report information as a json object.
- def save(self): Render a record of mhr registratio... | Implement the Python class `MhrRegistrationReport` described below.
Class description:
This class maintains MHR registration report information.
Method signatures and docstrings:
- def json(self) -> dict: Return the verification report information as a json object.
- def save(self): Render a record of mhr registratio... | af1a4458bb78c16ecca484514d4bd0d1d8c24b5d | <|skeleton|>
class MhrRegistrationReport:
"""This class maintains MHR registration report information."""
def json(self) -> dict:
"""Return the verification report information as a json object."""
<|body_0|>
def save(self):
"""Render a record of mhr registration report information ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MhrRegistrationReport:
"""This class maintains MHR registration report information."""
def json(self) -> dict:
"""Return the verification report information as a json object."""
result = {'id': self.id, 'createDateTime': model_utils.format_ts(self.create_ts), 'registrationId': self.regist... | the_stack_v2_python_sparse | mhr_api/src/mhr_api/models/mhr_registration_report.py | bcgov/ppr | train | 4 |
6df9ef16c3bc391bce7e791fb952254abd023eca | [
"if not citations:\n return 0\nif len(citations) == 1:\n if citations[0] == 0:\n return 0\n else:\n return 1\nmax_cite = max(citations)\ncount = [0 for _ in range(max_cite + 1)]\nfor elem in citations:\n count[elem] += 1\nk = 0\nfor i in range(len(count) - 1, -1, -1):\n k += count[i]\n ... | <|body_start_0|>
if not citations:
return 0
if len(citations) == 1:
if citations[0] == 0:
return 0
else:
return 1
max_cite = max(citations)
count = [0 for _ in range(max_cite + 1)]
for elem in citations:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hIndex_counting(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not citations:
... | stack_v2_sparse_classes_75kplus_train_068379 | 2,081 | no_license | [
{
"docstring": ":type citations: List[int] :rtype: int",
"name": "hIndex_counting",
"signature": "def hIndex_counting(self, citations)"
},
{
"docstring": ":type citations: List[int] :rtype: int",
"name": "hIndex",
"signature": "def hIndex(self, citations)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037750 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex_counting(self, citations): :type citations: List[int] :rtype: int
- def hIndex(self, citations): :type citations: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex_counting(self, citations): :type citations: List[int] :rtype: int
- def hIndex(self, citations): :type citations: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 66a4325c5999535e64e8e985bac4e3a96108bf1a | <|skeleton|>
class Solution:
def hIndex_counting(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hIndex_counting(self, citations):
""":type citations: List[int] :rtype: int"""
if not citations:
return 0
if len(citations) == 1:
if citations[0] == 0:
return 0
else:
return 1
max_cite = max(citat... | the_stack_v2_python_sparse | Algorithm_And_Data_Structure/hashtable/H_index.py | omidziaee/DataStructure | train | 0 | |
6286f3dfaa5de1d6c43249dafcdde3ff9731f3a8 | [
"self.rlist = deque()\nif startlist:\n for x in startlist:\n self.add(x)",
"if len(self.rlist) == 0:\n c = RangeUnion.Range(c.low, c.high)\n self.rlist.append(c)\n return\nx = c\nleft = deque()\nwhile len(self.rlist) > 0:\n r = self.rlist.popleft()\n if x.low <= r.high + 1 and x.high >= r... | <|body_start_0|>
self.rlist = deque()
if startlist:
for x in startlist:
self.add(x)
<|end_body_0|>
<|body_start_1|>
if len(self.rlist) == 0:
c = RangeUnion.Range(c.low, c.high)
self.rlist.append(c)
return
x = c
left... | Used to maintain a list of ranges The class is designed to solve the problem where a list of ranges is given and needs to be "simplified" to an equivalent list with the minimum possible number of ranges and no overlaps. The range list is maintained as the instance variable rlist, and rlist is updated each time a new ra... | RangeUnion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangeUnion:
"""Used to maintain a list of ranges The class is designed to solve the problem where a list of ranges is given and needs to be "simplified" to an equivalent list with the minimum possible number of ranges and no overlaps. The range list is maintained as the instance variable rlist, a... | stack_v2_sparse_classes_75kplus_train_068380 | 3,597 | no_license | [
{
"docstring": "Takes an optional argument that allows this L{RangeUnion} to be initialized from an existing range list, otherwise empty. @param startlist: The list of ranges to be initialized from @type startlist: Range object list",
"name": "__init__",
"signature": "def __init__(self, startlist=None)"... | 2 | null | Implement the Python class `RangeUnion` described below.
Class description:
Used to maintain a list of ranges The class is designed to solve the problem where a list of ranges is given and needs to be "simplified" to an equivalent list with the minimum possible number of ranges and no overlaps. The range list is maint... | Implement the Python class `RangeUnion` described below.
Class description:
Used to maintain a list of ranges The class is designed to solve the problem where a list of ranges is given and needs to be "simplified" to an equivalent list with the minimum possible number of ranges and no overlaps. The range list is maint... | 5eefa31343d5c9cf2c89fe855eb595d8c647b1d9 | <|skeleton|>
class RangeUnion:
"""Used to maintain a list of ranges The class is designed to solve the problem where a list of ranges is given and needs to be "simplified" to an equivalent list with the minimum possible number of ranges and no overlaps. The range list is maintained as the instance variable rlist, a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RangeUnion:
"""Used to maintain a list of ranges The class is designed to solve the problem where a list of ranges is given and needs to be "simplified" to an equivalent list with the minimum possible number of ranges and no overlaps. The range list is maintained as the instance variable rlist, and rlist is u... | the_stack_v2_python_sparse | morpher/collector/range_union.py | SavinSpring/api-smart-fuzzing | train | 0 |
b6b98dffebcab7363811fc76a34477e9bdb7b852 | [
"super().__init__(n_arms)\nself.n_arms = n_arms\nself.sigma = 10\nself.tau = [10] * n_arms\nself.mu = [1000] * n_arms\nself.last30dayschoice = []\nself.delayedreward = []\nself.rewards_per_arm = np.zeros(n_arms)\nself.percentage = 0.2",
"if self.t < 10:\n idx = np.random.randint(0, 10)\nelse:\n mean = np.ra... | <|body_start_0|>
super().__init__(n_arms)
self.n_arms = n_arms
self.sigma = 10
self.tau = [10] * n_arms
self.mu = [1000] * n_arms
self.last30dayschoice = []
self.delayedreward = []
self.rewards_per_arm = np.zeros(n_arms)
self.percentage = 0.2
<|end... | Thomson Sampling Learner Class | TSLearnerGauss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TSLearnerGauss:
"""Thomson Sampling Learner Class"""
def __init__(self, n_arms):
"""Initialize the Thompson Sampling Learner class with number of arms, arms, sigma, expected mean. :param n_arms:"""
<|body_0|>
def pull_arm(self):
"""Pulls the current arm with the ... | stack_v2_sparse_classes_75kplus_train_068381 | 2,796 | no_license | [
{
"docstring": "Initialize the Thompson Sampling Learner class with number of arms, arms, sigma, expected mean. :param n_arms:",
"name": "__init__",
"signature": "def __init__(self, n_arms)"
},
{
"docstring": "Pulls the current arm with the given budget and returns it. :return: The index of the ... | 3 | stack_v2_sparse_classes_30k_train_002727 | Implement the Python class `TSLearnerGauss` described below.
Class description:
Thomson Sampling Learner Class
Method signatures and docstrings:
- def __init__(self, n_arms): Initialize the Thompson Sampling Learner class with number of arms, arms, sigma, expected mean. :param n_arms:
- def pull_arm(self): Pulls the ... | Implement the Python class `TSLearnerGauss` described below.
Class description:
Thomson Sampling Learner Class
Method signatures and docstrings:
- def __init__(self, n_arms): Initialize the Thompson Sampling Learner class with number of arms, arms, sigma, expected mean. :param n_arms:
- def pull_arm(self): Pulls the ... | 5747765edaddb75263ccf8e8d117c3757acc564d | <|skeleton|>
class TSLearnerGauss:
"""Thomson Sampling Learner Class"""
def __init__(self, n_arms):
"""Initialize the Thompson Sampling Learner class with number of arms, arms, sigma, expected mean. :param n_arms:"""
<|body_0|>
def pull_arm(self):
"""Pulls the current arm with the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TSLearnerGauss:
"""Thomson Sampling Learner Class"""
def __init__(self, n_arms):
"""Initialize the Thompson Sampling Learner class with number of arms, arms, sigma, expected mean. :param n_arms:"""
super().__init__(n_arms)
self.n_arms = n_arms
self.sigma = 10
self.... | the_stack_v2_python_sparse | tsgaussbid.py | roxpietro/DataIntelligenceApplications | train | 0 |
2d405e67146f82aeae513417457fce2635ba3dcb | [
"if len(matrix) == 0 or len(matrix[0]) == 0:\n return 0\nm = len(matrix)\nn = len(matrix[0])\ndp = [[0] * n for _ in range(m)]\nans = 0\nfor i in range(m):\n for j in range(n):\n if matrix[i][j] == '1':\n if i == 0 or j == 0:\n dp[i][j] = 1\n else:\n ... | <|body_start_0|>
if len(matrix) == 0 or len(matrix[0]) == 0:
return 0
m = len(matrix)
n = len(matrix[0])
dp = [[0] * n for _ in range(m)]
ans = 0
for i in range(m):
for j in range(n):
if matrix[i][j] == '1':
if i... | dp(i,j) 表示以 (i, j)(i,j) 为右下角,且只包含 11 的正方形的边长最大值 对于每个位置 (i, j)(i,j),检查在矩阵中该位置的值: 如果该位置的值是 00,则 dp(i, j) = 0dp(i,j)=0,因为当前位置不可能在由 11 组成的正方形中; 如果该位置的值是 11,则 dp(i, j)dp(i,j) 的值由其上方、左方和左上方的三个相邻位置的 dpdp 值决定。具体而言,当前位置的元素值等于三个相邻位置的元素中的最小值加 11,状态转移方程如下: dp(i, j)=min(dp(i−1, j), dp(i−1, j−1), dp(i, j−1))+1 | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""dp(i,j) 表示以 (i, j)(i,j) 为右下角,且只包含 11 的正方形的边长最大值 对于每个位置 (i, j)(i,j),检查在矩阵中该位置的值: 如果该位置的值是 00,则 dp(i, j) = 0dp(i,j)=0,因为当前位置不可能在由 11 组成的正方形中; 如果该位置的值是 11,则 dp(i, j)dp(i,j) 的值由其上方、左方和左上方的三个相邻位置的 dpdp 值决定。具体而言,当前位置的元素值等于三个相邻位置的元素中的最小值加 11,状态转移方程如下: dp(i, j)=min(dp(i−1, j), dp(i−1, j−1), ... | stack_v2_sparse_classes_75kplus_train_068382 | 3,398 | no_license | [
{
"docstring": ":type matrix: List[List[str]] :rtype: int",
"name": "maximalSquare",
"signature": "def maximalSquare(self, matrix)"
},
{
"docstring": ":type matrix: List[List[str]] :rtype: int",
"name": "maximalSquare",
"signature": "def maximalSquare(self, matrix)"
}
] | 2 | stack_v2_sparse_classes_30k_val_002413 | Implement the Python class `Solution` described below.
Class description:
dp(i,j) 表示以 (i, j)(i,j) 为右下角,且只包含 11 的正方形的边长最大值 对于每个位置 (i, j)(i,j),检查在矩阵中该位置的值: 如果该位置的值是 00,则 dp(i, j) = 0dp(i,j)=0,因为当前位置不可能在由 11 组成的正方形中; 如果该位置的值是 11,则 dp(i, j)dp(i,j) 的值由其上方、左方和左上方的三个相邻位置的 dpdp 值决定。具体而言,当前位置的元素值等于三个相邻位置的元素中的最小值加 11,状态转移方程如下: ... | Implement the Python class `Solution` described below.
Class description:
dp(i,j) 表示以 (i, j)(i,j) 为右下角,且只包含 11 的正方形的边长最大值 对于每个位置 (i, j)(i,j),检查在矩阵中该位置的值: 如果该位置的值是 00,则 dp(i, j) = 0dp(i,j)=0,因为当前位置不可能在由 11 组成的正方形中; 如果该位置的值是 11,则 dp(i, j)dp(i,j) 的值由其上方、左方和左上方的三个相邻位置的 dpdp 值决定。具体而言,当前位置的元素值等于三个相邻位置的元素中的最小值加 11,状态转移方程如下: ... | c162817f717b78997197649c084c27af48c3fd6f | <|skeleton|>
class Solution:
"""dp(i,j) 表示以 (i, j)(i,j) 为右下角,且只包含 11 的正方形的边长最大值 对于每个位置 (i, j)(i,j),检查在矩阵中该位置的值: 如果该位置的值是 00,则 dp(i, j) = 0dp(i,j)=0,因为当前位置不可能在由 11 组成的正方形中; 如果该位置的值是 11,则 dp(i, j)dp(i,j) 的值由其上方、左方和左上方的三个相邻位置的 dpdp 值决定。具体而言,当前位置的元素值等于三个相邻位置的元素中的最小值加 11,状态转移方程如下: dp(i, j)=min(dp(i−1, j), dp(i−1, j−1), ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""dp(i,j) 表示以 (i, j)(i,j) 为右下角,且只包含 11 的正方形的边长最大值 对于每个位置 (i, j)(i,j),检查在矩阵中该位置的值: 如果该位置的值是 00,则 dp(i, j) = 0dp(i,j)=0,因为当前位置不可能在由 11 组成的正方形中; 如果该位置的值是 11,则 dp(i, j)dp(i,j) 的值由其上方、左方和左上方的三个相邻位置的 dpdp 值决定。具体而言,当前位置的元素值等于三个相邻位置的元素中的最小值加 11,状态转移方程如下: dp(i, j)=min(dp(i−1, j), dp(i−1, j−1), dp(i, j−1))+1... | the_stack_v2_python_sparse | Week_06/221.最大正方形.py | dream201188/algorithm017 | train | 1 |
ff647a85125b8d6c0b62aa317491874e73e6c050 | [
"self.period = period\nself.resolution = resolution\nself.insightPeriod = Time.Multiply(Extensions.ToTimeSpan(resolution), period)\nself.symbolDataBySymbol = {}\nresolutionString = Extensions.GetEnumString(resolution, Resolution)\nself.Name = '{}({},{})'.format(self.__class__.__name__, period, resolutionString)",
... | <|body_start_0|>
self.period = period
self.resolution = resolution
self.insightPeriod = Time.Multiply(Extensions.ToTimeSpan(resolution), period)
self.symbolDataBySymbol = {}
resolutionString = Extensions.GetEnumString(resolution, Resolution)
self.Name = '{}({},{})'.format... | Uses Wilder's RSI to create insights. Using default settings, a cross over below 30 or above 70 will trigger a new insight. | RsiAlphaModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RsiAlphaModel:
"""Uses Wilder's RSI to create insights. Using default settings, a cross over below 30 or above 70 will trigger a new insight."""
def __init__(self, period=14, resolution=Resolution.Daily):
"""Initializes a new instance of the RsiAlphaModel class Args: period: The RSI ... | stack_v2_sparse_classes_75kplus_train_068383 | 5,343 | permissive | [
{
"docstring": "Initializes a new instance of the RsiAlphaModel class Args: period: The RSI indicator period",
"name": "__init__",
"signature": "def __init__(self, period=14, resolution=Resolution.Daily)"
},
{
"docstring": "Updates this alpha model with the latest data from the algorithm. This i... | 4 | stack_v2_sparse_classes_30k_test_000956 | Implement the Python class `RsiAlphaModel` described below.
Class description:
Uses Wilder's RSI to create insights. Using default settings, a cross over below 30 or above 70 will trigger a new insight.
Method signatures and docstrings:
- def __init__(self, period=14, resolution=Resolution.Daily): Initializes a new i... | Implement the Python class `RsiAlphaModel` described below.
Class description:
Uses Wilder's RSI to create insights. Using default settings, a cross over below 30 or above 70 will trigger a new insight.
Method signatures and docstrings:
- def __init__(self, period=14, resolution=Resolution.Daily): Initializes a new i... | b33dd3bc140e14b883f39ecf848a793cf7292277 | <|skeleton|>
class RsiAlphaModel:
"""Uses Wilder's RSI to create insights. Using default settings, a cross over below 30 or above 70 will trigger a new insight."""
def __init__(self, period=14, resolution=Resolution.Daily):
"""Initializes a new instance of the RsiAlphaModel class Args: period: The RSI ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RsiAlphaModel:
"""Uses Wilder's RSI to create insights. Using default settings, a cross over below 30 or above 70 will trigger a new insight."""
def __init__(self, period=14, resolution=Resolution.Daily):
"""Initializes a new instance of the RsiAlphaModel class Args: period: The RSI indicator per... | the_stack_v2_python_sparse | Algorithm.Framework/Alphas/RsiAlphaModel.py | Capnode/Algoloop | train | 87 |
b4cd736685543be5365879ce492e6624fcc836c3 | [
"super().__init__(name, cwd)\nself.run_settings = run_settings\nself.alloc = None\nself.managed = True\nif not self.run_settings.in_batch:\n self._set_alloc()",
"srun = self.run_settings.run_command\noutput, error = self.get_output_files()\nsrun_cmd = [srun, '--output', output, '--error', error, '--job-name', ... | <|body_start_0|>
super().__init__(name, cwd)
self.run_settings = run_settings
self.alloc = None
self.managed = True
if not self.run_settings.in_batch:
self._set_alloc()
<|end_body_0|>
<|body_start_1|>
srun = self.run_settings.run_command
output, error... | SrunStep | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SrunStep:
def __init__(self, name, cwd, run_settings):
"""Initialize a srun job step :param name: name of the entity to be launched :type name: str :param cwd: path to launch dir :type cwd: str :param run_settings: run settings for entity :type run_settings: RunSettings"""
<|body... | stack_v2_sparse_classes_75kplus_train_068384 | 6,565 | permissive | [
{
"docstring": "Initialize a srun job step :param name: name of the entity to be launched :type name: str :param cwd: path to launch dir :type cwd: str :param run_settings: run settings for entity :type run_settings: RunSettings",
"name": "__init__",
"signature": "def __init__(self, name, cwd, run_setti... | 5 | stack_v2_sparse_classes_30k_train_045451 | Implement the Python class `SrunStep` described below.
Class description:
Implement the SrunStep class.
Method signatures and docstrings:
- def __init__(self, name, cwd, run_settings): Initialize a srun job step :param name: name of the entity to be launched :type name: str :param cwd: path to launch dir :type cwd: s... | Implement the Python class `SrunStep` described below.
Class description:
Implement the SrunStep class.
Method signatures and docstrings:
- def __init__(self, name, cwd, run_settings): Initialize a srun job step :param name: name of the entity to be launched :type name: str :param cwd: path to launch dir :type cwd: s... | bb3fbe7a8ba4f3d205825c3b3829f7d167982028 | <|skeleton|>
class SrunStep:
def __init__(self, name, cwd, run_settings):
"""Initialize a srun job step :param name: name of the entity to be launched :type name: str :param cwd: path to launch dir :type cwd: str :param run_settings: run settings for entity :type run_settings: RunSettings"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SrunStep:
def __init__(self, name, cwd, run_settings):
"""Initialize a srun job step :param name: name of the entity to be launched :type name: str :param cwd: path to launch dir :type cwd: str :param run_settings: run settings for entity :type run_settings: RunSettings"""
super().__init__(nam... | the_stack_v2_python_sparse | smartsim/launcher/step/slurmStep.py | ctandon11/SmartSim | train | 0 | |
0d6a1744af5ceeb90546cf3f1ba99fd0baace008 | [
"assert len(input_list) > 0\nsuper().__init__(self.PROBLEM_NAME)\nself.input_list = input_list",
"print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nleft = 0\nright = len(self.input_list) - 1\narea = 0\nwhile left < right:\n area = max(area, min(self.input_list[left], self.input_list[right]) * (right -... | <|body_start_0|>
assert len(input_list) > 0
super().__init__(self.PROBLEM_NAME)
self.input_list = input_list
<|end_body_0|>
<|body_start_1|>
print('Solving {} problem ...'.format(self.PROBLEM_NAME))
left = 0
right = len(self.input_list) - 1
area = 0
while... | Container With Most Water | ContainerWithMostWater | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContainerWithMostWater:
"""Container With Most Water"""
def __init__(self, input_list):
"""ContainerWithMostWater Args: input_list: Contains a list of integers Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solve the problem Note: O(n) (runtime) and... | stack_v2_sparse_classes_75kplus_train_068385 | 1,929 | no_license | [
{
"docstring": "ContainerWithMostWater Args: input_list: Contains a list of integers Returns: None Raises: None",
"name": "__init__",
"signature": "def __init__(self, input_list)"
},
{
"docstring": "Solve the problem Note: O(n) (runtime) and O(1) (space) Args: Returns: integer Raises: None",
... | 2 | null | Implement the Python class `ContainerWithMostWater` described below.
Class description:
Container With Most Water
Method signatures and docstrings:
- def __init__(self, input_list): ContainerWithMostWater Args: input_list: Contains a list of integers Returns: None Raises: None
- def solve(self): Solve the problem Not... | Implement the Python class `ContainerWithMostWater` described below.
Class description:
Container With Most Water
Method signatures and docstrings:
- def __init__(self, input_list): ContainerWithMostWater Args: input_list: Contains a list of integers Returns: None Raises: None
- def solve(self): Solve the problem Not... | 11f4d25cb211740514c119a60962d075a0817abd | <|skeleton|>
class ContainerWithMostWater:
"""Container With Most Water"""
def __init__(self, input_list):
"""ContainerWithMostWater Args: input_list: Contains a list of integers Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solve the problem Note: O(n) (runtime) and... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContainerWithMostWater:
"""Container With Most Water"""
def __init__(self, input_list):
"""ContainerWithMostWater Args: input_list: Contains a list of integers Returns: None Raises: None"""
assert len(input_list) > 0
super().__init__(self.PROBLEM_NAME)
self.input_list = in... | the_stack_v2_python_sparse | python/problems/array/container_with_most_water.py | santhosh-kumar/AlgorithmsAndDataStructures | train | 2 |
482c9dfcbea8c6bcbb52d604a319ba01dd4b808e | [
"super(CleanCorpus, self).__init__()\nself.documents = documents\nself.start_time = time.time()\nself.article_names = []\nself.total_articles = len(documents)\nself.dictionary = dictionary or self.corpus_dictionary(no_below, keep_n)",
"time_now = time.time()\nelapsed_time = time_now - self.start_time\nestimated_r... | <|body_start_0|>
super(CleanCorpus, self).__init__()
self.documents = documents
self.start_time = time.time()
self.article_names = []
self.total_articles = len(documents)
self.dictionary = dictionary or self.corpus_dictionary(no_below, keep_n)
<|end_body_0|>
<|body_start... | Tokenizes each document in a Redis database. Each value in Redis is regarded as a document, the value is the corresponding text from Wikipedia Documents should be text files. Stems all words and removes stop words. | CleanCorpus | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CleanCorpus:
"""Tokenizes each document in a Redis database. Each value in Redis is regarded as a document, the value is the corresponding text from Wikipedia Documents should be text files. Stems all words and removes stop words."""
def __init__(self, documents, dictionary=None, no_below=20... | stack_v2_sparse_classes_75kplus_train_068386 | 9,834 | no_license | [
{
"docstring": "Args: documents: Documents keys on the Redis database. no_below: Words that appear less than this are neglected. keep_n: Maximum dictionary size (default: 50000)",
"name": "__init__",
"signature": "def __init__(self, documents, dictionary=None, no_below=20, keep_n=50000)"
},
{
"d... | 6 | stack_v2_sparse_classes_30k_train_015327 | Implement the Python class `CleanCorpus` described below.
Class description:
Tokenizes each document in a Redis database. Each value in Redis is regarded as a document, the value is the corresponding text from Wikipedia Documents should be text files. Stems all words and removes stop words.
Method signatures and docs... | Implement the Python class `CleanCorpus` described below.
Class description:
Tokenizes each document in a Redis database. Each value in Redis is regarded as a document, the value is the corresponding text from Wikipedia Documents should be text files. Stems all words and removes stop words.
Method signatures and docs... | e3f2e00ff99f08dcc5febcac0d5026da905eb55a | <|skeleton|>
class CleanCorpus:
"""Tokenizes each document in a Redis database. Each value in Redis is regarded as a document, the value is the corresponding text from Wikipedia Documents should be text files. Stems all words and removes stop words."""
def __init__(self, documents, dictionary=None, no_below=20... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CleanCorpus:
"""Tokenizes each document in a Redis database. Each value in Redis is regarded as a document, the value is the corresponding text from Wikipedia Documents should be text files. Stems all words and removes stop words."""
def __init__(self, documents, dictionary=None, no_below=20, keep_n=5000... | the_stack_v2_python_sparse | experiments/_65_linkedarticles/esa/zmq_wikicorpus.py | rubiruchi/sna_classifier | train | 0 |
3990563763126102dda5c281a5827ccb2d664ebe | [
"m = len(nums)\nif not m:\n return -1\nreturn self.searchBinary(nums, 0, m - 1, target)",
"if l > h:\n return -1\nmid = l + (h - l) // 2\nif nums[mid] == target:\n return mid\nif nums[l] <= nums[mid]:\n if nums[l] <= target <= nums[mid]:\n return self.searchBinary(nums, l, mid, target)\n els... | <|body_start_0|>
m = len(nums)
if not m:
return -1
return self.searchBinary(nums, 0, m - 1, target)
<|end_body_0|>
<|body_start_1|>
if l > h:
return -1
mid = l + (h - l) // 2
if nums[mid] == target:
return mid
if nums[l] <= num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def searchBinary(self, nums, l, h, target):
"""search nums[l:h+1] for target"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
m = len(nums)... | stack_v2_sparse_classes_75kplus_train_068387 | 2,415 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: int",
"name": "search",
"signature": "def search(self, nums, target)"
},
{
"docstring": "search nums[l:h+1] for target",
"name": "searchBinary",
"signature": "def searchBinary(self, nums, l, h, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int
- def searchBinary(self, nums, l, h, target): search nums[l:h+1] for target | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def search(self, nums, target): :type nums: List[int] :type target: int :rtype: int
- def searchBinary(self, nums, l, h, target): search nums[l:h+1] for target
<|skeleton|>
clas... | e00cf94c5b86c8cca27e3bee69ad21e727b7679b | <|skeleton|>
class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
<|body_0|>
def searchBinary(self, nums, l, h, target):
"""search nums[l:h+1] for target"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def search(self, nums, target):
""":type nums: List[int] :type target: int :rtype: int"""
m = len(nums)
if not m:
return -1
return self.searchBinary(nums, 0, m - 1, target)
def searchBinary(self, nums, l, h, target):
"""search nums[l:h+1] for ... | the_stack_v2_python_sparse | interview/prob33.py | binchen15/leet-python | train | 1 | |
d37814361508d5d24a63e1673f9e517bcaf7a95e | [
"super(ACELoss, self).__init__()\nself.dict = character\nself.eps = eps",
"batch, time_dim, _ = inputs.size()\ninputs = inputs + self.eps\nlabel = label.float()\nlabel[:, 0] = time_dim - label[:, 0]\ninputs = torch.sum(inputs, 1)\ninputs = inputs / time_dim\nlabel = label / time_dim\nloss = -torch.sum(torch.log(i... | <|body_start_0|>
super(ACELoss, self).__init__()
self.dict = character
self.eps = eps
<|end_body_0|>
<|body_start_1|>
batch, time_dim, _ = inputs.size()
inputs = inputs + self.eps
label = label.float()
label[:, 0] = time_dim - label[:, 0]
inputs = torch.s... | Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019 | ACELoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ACELoss:
"""Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019"""
def __init__(self, character, eps=1e-10):
"""Args: character (dict): recognition dictionary eps (float): margin of error"""
<|body_0|>
def forward(self, inputs, label):
"""Args:... | stack_v2_sparse_classes_75kplus_train_068388 | 1,733 | permissive | [
{
"docstring": "Args: character (dict): recognition dictionary eps (float): margin of error",
"name": "__init__",
"signature": "def __init__(self, character, eps=1e-10)"
},
{
"docstring": "Args: inputs (Torch.Tensor): model output label (Torch.Tensor): label information Returns: Torch.Tensor: ac... | 2 | stack_v2_sparse_classes_30k_train_054675 | Implement the Python class `ACELoss` described below.
Class description:
Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019
Method signatures and docstrings:
- def __init__(self, character, eps=1e-10): Args: character (dict): recognition dictionary eps (float): margin of error
- def forward(self, ... | Implement the Python class `ACELoss` described below.
Class description:
Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019
Method signatures and docstrings:
- def __init__(self, character, eps=1e-10): Args: character (dict): recognition dictionary eps (float): margin of error
- def forward(self, ... | fb47a96d1a38f5ce634c6f12d710ed5300cc89fc | <|skeleton|>
class ACELoss:
"""Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019"""
def __init__(self, character, eps=1e-10):
"""Args: character (dict): recognition dictionary eps (float): margin of error"""
<|body_0|>
def forward(self, inputs, label):
"""Args:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ACELoss:
"""Ref: [1] Aggregation Cross-Entropy for Sequence Recognition. CVPR-2019"""
def __init__(self, character, eps=1e-10):
"""Args: character (dict): recognition dictionary eps (float): margin of error"""
super(ACELoss, self).__init__()
self.dict = character
self.eps ... | the_stack_v2_python_sparse | davarocr/davarocr/davar_rcg/models/losses/ace_loss.py | OCRWorld/DAVAR-Lab-OCR | train | 0 |
9ab4d2f18ca8de76c41941f49878aafd0bd8c6ae | [
"if BaseDao.databaseConfig == None:\n configParser = ConfigParserUtil()\n BaseDao.databaseConfig = configParser.getDictionary('database')\nreturn BaseDao.databaseConfig[key]",
"if self.getParameter('type') == 'mysql':\n con = mysql.connector.connect(user=self.getParameter('user'), password=self.getParame... | <|body_start_0|>
if BaseDao.databaseConfig == None:
configParser = ConfigParserUtil()
BaseDao.databaseConfig = configParser.getDictionary('database')
return BaseDao.databaseConfig[key]
<|end_body_0|>
<|body_start_1|>
if self.getParameter('type') == 'mysql':
c... | mysql数据库访问 | BaseDao | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseDao:
"""mysql数据库访问"""
def getParameter(self, key):
"""加载配置"""
<|body_0|>
def createConnect(self):
"""获得数据库链接"""
<|body_1|>
def beachInsert(self, dates):
"""批量执行插入操作"""
<|body_2|>
def doSelect(self, sql):
"""执行查询语句"""
... | stack_v2_sparse_classes_75kplus_train_068389 | 1,940 | no_license | [
{
"docstring": "加载配置",
"name": "getParameter",
"signature": "def getParameter(self, key)"
},
{
"docstring": "获得数据库链接",
"name": "createConnect",
"signature": "def createConnect(self)"
},
{
"docstring": "批量执行插入操作",
"name": "beachInsert",
"signature": "def beachInsert(self, ... | 5 | stack_v2_sparse_classes_30k_train_035107 | Implement the Python class `BaseDao` described below.
Class description:
mysql数据库访问
Method signatures and docstrings:
- def getParameter(self, key): 加载配置
- def createConnect(self): 获得数据库链接
- def beachInsert(self, dates): 批量执行插入操作
- def doSelect(self, sql): 执行查询语句
- def close(self): 关闭链接 | Implement the Python class `BaseDao` described below.
Class description:
mysql数据库访问
Method signatures and docstrings:
- def getParameter(self, key): 加载配置
- def createConnect(self): 获得数据库链接
- def beachInsert(self, dates): 批量执行插入操作
- def doSelect(self, sql): 执行查询语句
- def close(self): 关闭链接
<|skeleton|>
class BaseDao:
... | b24be18d0d9eab755d573dc64b4edf433a5e34c9 | <|skeleton|>
class BaseDao:
"""mysql数据库访问"""
def getParameter(self, key):
"""加载配置"""
<|body_0|>
def createConnect(self):
"""获得数据库链接"""
<|body_1|>
def beachInsert(self, dates):
"""批量执行插入操作"""
<|body_2|>
def doSelect(self, sql):
"""执行查询语句"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseDao:
"""mysql数据库访问"""
def getParameter(self, key):
"""加载配置"""
if BaseDao.databaseConfig == None:
configParser = ConfigParserUtil()
BaseDao.databaseConfig = configParser.getDictionary('database')
return BaseDao.databaseConfig[key]
def createConnect(... | the_stack_v2_python_sparse | src/cc/pillars/octopus/dao/BaseDao.py | yupengfei/PillarsOctopus | train | 0 |
717266e6858c13d06b8c9c1b3cdff61f838237e3 | [
"if model._meta.app_label == 'mouse':\n return 'mouse_db'\nreturn None",
"if model._meta.app_label == 'mouse':\n return 'mouse_db'\nreturn None",
"if obj1._meta.app_label == 'mouse' and obj2._meta.app_label == 'mouse':\n return True\nelif 'mouse' not in [obj1._meta.app_label, obj2._meta.app_label]:\n ... | <|body_start_0|>
if model._meta.app_label == 'mouse':
return 'mouse_db'
return None
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label == 'mouse':
return 'mouse_db'
return None
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_label == 'mouse' and ... | Determine how to route database calls for an app's models. | AppRouter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppRouter:
"""Determine how to route database calls for an app's models."""
def db_for_read(self, model, **hints):
"""Send all read operations on Mouse app models to `mouse_db`."""
<|body_0|>
def db_for_write(self, model, **hints):
"""Send all write operations on... | stack_v2_sparse_classes_75kplus_train_068390 | 1,161 | no_license | [
{
"docstring": "Send all read operations on Mouse app models to `mouse_db`.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Send all write operations on Mouse app models to `mouse_db`.",
"name": "db_for_write",
"signature": "def db_for_wri... | 4 | stack_v2_sparse_classes_30k_train_008324 | Implement the Python class `AppRouter` described below.
Class description:
Determine how to route database calls for an app's models.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Send all read operations on Mouse app models to `mouse_db`.
- def db_for_write(self, model, **hints): Send al... | Implement the Python class `AppRouter` described below.
Class description:
Determine how to route database calls for an app's models.
Method signatures and docstrings:
- def db_for_read(self, model, **hints): Send all read operations on Mouse app models to `mouse_db`.
- def db_for_write(self, model, **hints): Send al... | 3a4253b611bf09061e443bfe33526fd07ad1dfcd | <|skeleton|>
class AppRouter:
"""Determine how to route database calls for an app's models."""
def db_for_read(self, model, **hints):
"""Send all read operations on Mouse app models to `mouse_db`."""
<|body_0|>
def db_for_write(self, model, **hints):
"""Send all write operations on... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AppRouter:
"""Determine how to route database calls for an app's models."""
def db_for_read(self, model, **hints):
"""Send all read operations on Mouse app models to `mouse_db`."""
if model._meta.app_label == 'mouse':
return 'mouse_db'
return None
def db_for_write... | the_stack_v2_python_sparse | taxibros/app_router.py | zhengqunkoo/taxibros | train | 1 |
7a09780d23b7c1a6fa3c8883149960bd40442331 | [
"super().__init__()\nself.cnn_type = cnn_type\nself.n_channels = n_channels\nself.output_dim = output_dim\nif cnn_type == 'wideresnet':\n self.cnn = torchvision.models.wide_resnet50_2()\n self.cnn.conv1 = nn.Conv2d(n_channels, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)\n self.cnn.fc... | <|body_start_0|>
super().__init__()
self.cnn_type = cnn_type
self.n_channels = n_channels
self.output_dim = output_dim
if cnn_type == 'wideresnet':
self.cnn = torchvision.models.wide_resnet50_2()
self.cnn.conv1 = nn.Conv2d(n_channels, 64, kernel_size=(7, 7... | StrokeAsImageEncoderCNN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrokeAsImageEncoderCNN:
def __init__(self, cnn_type, n_channels, output_dim):
"""Args: cnn_type (str): wideresnet, cbam, or se n_channels (int): Number of input channels, which can vary depending on if pre, post, full images are used output_dim (int): output dim"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_068391 | 40,451 | permissive | [
{
"docstring": "Args: cnn_type (str): wideresnet, cbam, or se n_channels (int): Number of input channels, which can vary depending on if pre, post, full images are used output_dim (int): output dim",
"name": "__init__",
"signature": "def __init__(self, cnn_type, n_channels, output_dim)"
},
{
"do... | 2 | stack_v2_sparse_classes_30k_train_041399 | Implement the Python class `StrokeAsImageEncoderCNN` described below.
Class description:
Implement the StrokeAsImageEncoderCNN class.
Method signatures and docstrings:
- def __init__(self, cnn_type, n_channels, output_dim): Args: cnn_type (str): wideresnet, cbam, or se n_channels (int): Number of input channels, whic... | Implement the Python class `StrokeAsImageEncoderCNN` described below.
Class description:
Implement the StrokeAsImageEncoderCNN class.
Method signatures and docstrings:
- def __init__(self, cnn_type, n_channels, output_dim): Args: cnn_type (str): wideresnet, cbam, or se n_channels (int): Number of input channels, whic... | b0c7f25d13e1713b883335c278d1e0db67c50bbe | <|skeleton|>
class StrokeAsImageEncoderCNN:
def __init__(self, cnn_type, n_channels, output_dim):
"""Args: cnn_type (str): wideresnet, cbam, or se n_channels (int): Number of input channels, which can vary depending on if pre, post, full images are used output_dim (int): output dim"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StrokeAsImageEncoderCNN:
def __init__(self, cnn_type, n_channels, output_dim):
"""Args: cnn_type (str): wideresnet, cbam, or se n_channels (int): Number of input channels, which can vary depending on if pre, post, full images are used output_dim (int): output dim"""
super().__init__()
... | the_stack_v2_python_sparse | src/models/base/stroke_models.py | sosuperic/sketching-with-language | train | 0 | |
89c0b929f4c869bc954454e47ec133db802b5833 | [
"value = parameter.value\ndefinition = parameter.definition\nif len(value) != 1 or len(definition) != 1:\n raise InternalError('Parameter monitor can not handle arrays; use Array monitor instead.')\nself._manager = manager\nvalue = self._replace(value[0], definition)\ndel self._manager\nself._init(parameter.name... | <|body_start_0|>
value = parameter.value
definition = parameter.definition
if len(value) != 1 or len(definition) != 1:
raise InternalError('Parameter monitor can not handle arrays; use Array monitor instead.')
self._manager = manager
value = self._replace(value[0], de... | Class which allows to handle a standard parameter. | ParameterMonitor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParameterMonitor:
"""Class which allows to handle a standard parameter."""
def __init__(self, parameter, manager):
"""Add a parameter to the parameter server. @param parameter: Parameter command describing parameter which should be monitored. @type parameter: subclass of core.command... | stack_v2_sparse_classes_75kplus_train_068392 | 38,693 | permissive | [
{
"docstring": "Add a parameter to the parameter server. @param parameter: Parameter command describing parameter which should be monitored. @type parameter: subclass of core.command._ParameterCommand @param manager: Parameter manager which is responsible for this monitor. @type manager: core.manager.ParameterM... | 4 | stack_v2_sparse_classes_30k_val_000548 | Implement the Python class `ParameterMonitor` described below.
Class description:
Class which allows to handle a standard parameter.
Method signatures and docstrings:
- def __init__(self, parameter, manager): Add a parameter to the parameter server. @param parameter: Parameter command describing parameter which shoul... | Implement the Python class `ParameterMonitor` described below.
Class description:
Class which allows to handle a standard parameter.
Method signatures and docstrings:
- def __init__(self, parameter, manager): Add a parameter to the parameter server. @param parameter: Parameter command describing parameter which shoul... | c277efd809fce8f0f18b009fb3b9c7f785cc3739 | <|skeleton|>
class ParameterMonitor:
"""Class which allows to handle a standard parameter."""
def __init__(self, parameter, manager):
"""Add a parameter to the parameter server. @param parameter: Parameter command describing parameter which should be monitored. @type parameter: subclass of core.command... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParameterMonitor:
"""Class which allows to handle a standard parameter."""
def __init__(self, parameter, manager):
"""Add a parameter to the parameter server. @param parameter: Parameter command describing parameter which should be monitored. @type parameter: subclass of core.command._ParameterCo... | the_stack_v2_python_sparse | framework/core/monitor.py | LCROBOT/rce | train | 0 |
6ec06e56e6a81fbf9e98a546c3e27cee91b2194f | [
"n1 = n2 = 0\nlen1 = len(num1)\nlen2 = len(num2)\nfor i in num1:\n n1 += (ord(i) - 48) * 10 ** (len1 - 1)\n len1 -= 1\nfor i in num2:\n n2 += (ord(i) - 48) * 10 ** (len2 - 1)\n len2 -= 1\nreturn str(n1 + n2)",
"while len(num1) < len(num2):\n num1 = '0' + num1\nwhile len(num1) > len(num2):\n num2... | <|body_start_0|>
n1 = n2 = 0
len1 = len(num1)
len2 = len(num2)
for i in num1:
n1 += (ord(i) - 48) * 10 ** (len1 - 1)
len1 -= 1
for i in num2:
n2 += (ord(i) - 48) * 10 ** (len2 - 1)
len2 -= 1
return str(n1 + n2)
<|end_body_0|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addStrings(self, num1, num2):
""":type num1: str :type num2: str :rtype: str 688ms, beats: 5.28%"""
<|body_0|>
def addStrings2(self, num1, num2):
""":type num1: str :type num2: str :rtype: str 68ms, beats: 30.57%"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_068393 | 1,135 | no_license | [
{
"docstring": ":type num1: str :type num2: str :rtype: str 688ms, beats: 5.28%",
"name": "addStrings",
"signature": "def addStrings(self, num1, num2)"
},
{
"docstring": ":type num1: str :type num2: str :rtype: str 68ms, beats: 30.57%",
"name": "addStrings2",
"signature": "def addStrings... | 2 | stack_v2_sparse_classes_30k_train_002492 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addStrings(self, num1, num2): :type num1: str :type num2: str :rtype: str 688ms, beats: 5.28%
- def addStrings2(self, num1, num2): :type num1: str :type num2: str :rtype: str... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addStrings(self, num1, num2): :type num1: str :type num2: str :rtype: str 688ms, beats: 5.28%
- def addStrings2(self, num1, num2): :type num1: str :type num2: str :rtype: str... | 624975f767f6efa1d7361cc077eaebc344d57210 | <|skeleton|>
class Solution:
def addStrings(self, num1, num2):
""":type num1: str :type num2: str :rtype: str 688ms, beats: 5.28%"""
<|body_0|>
def addStrings2(self, num1, num2):
""":type num1: str :type num2: str :rtype: str 68ms, beats: 30.57%"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def addStrings(self, num1, num2):
""":type num1: str :type num2: str :rtype: str 688ms, beats: 5.28%"""
n1 = n2 = 0
len1 = len(num1)
len2 = len(num2)
for i in num1:
n1 += (ord(i) - 48) * 10 ** (len1 - 1)
len1 -= 1
for i in num2:... | the_stack_v2_python_sparse | 415. 字符串相加.py | dx19910707/LeetCode | train | 0 | |
f105af83563a156316d08bfa64b3b8330df0ee4d | [
"super().__init__()\nself.unavailable = True\nself.base_url = base_url",
"if interval <= 2:\n interval = 2\nwhile self.unavailable:\n self.r = self.get(self.base_url)\n self.html = self.r.html\n button_what = \"//button[@id='AddToCart-product-template']\"\n self.button = self.html.xpath(button_what... | <|body_start_0|>
super().__init__()
self.unavailable = True
self.base_url = base_url
<|end_body_0|>
<|body_start_1|>
if interval <= 2:
interval = 2
while self.unavailable:
self.r = self.get(self.base_url)
self.html = self.r.html
bu... | Novelkeys | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Novelkeys:
def __init__(self, base_url):
"""HTMLSession object as basis for check script base_url : str the url you want to check"""
<|body_0|>
def check(self, interval, verbose):
"""basic script to check the page at some user-defined interval interval : int interval... | stack_v2_sparse_classes_75kplus_train_068394 | 2,324 | permissive | [
{
"docstring": "HTMLSession object as basis for check script base_url : str the url you want to check",
"name": "__init__",
"signature": "def __init__(self, base_url)"
},
{
"docstring": "basic script to check the page at some user-defined interval interval : int interval to refresh page, in seco... | 2 | null | Implement the Python class `Novelkeys` described below.
Class description:
Implement the Novelkeys class.
Method signatures and docstrings:
- def __init__(self, base_url): HTMLSession object as basis for check script base_url : str the url you want to check
- def check(self, interval, verbose): basic script to check ... | Implement the Python class `Novelkeys` described below.
Class description:
Implement the Novelkeys class.
Method signatures and docstrings:
- def __init__(self, base_url): HTMLSession object as basis for check script base_url : str the url you want to check
- def check(self, interval, verbose): basic script to check ... | 7af26520055104dcaf1ff21d94ece27d81c97918 | <|skeleton|>
class Novelkeys:
def __init__(self, base_url):
"""HTMLSession object as basis for check script base_url : str the url you want to check"""
<|body_0|>
def check(self, interval, verbose):
"""basic script to check the page at some user-defined interval interval : int interval... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Novelkeys:
def __init__(self, base_url):
"""HTMLSession object as basis for check script base_url : str the url you want to check"""
super().__init__()
self.unavailable = True
self.base_url = base_url
def check(self, interval, verbose):
"""basic script to check the... | the_stack_v2_python_sparse | just-for-fun/novelkeys-webscraper.py | jydiw/assorted-algorithms | train | 0 | |
94d13429b67386fa0227672b5ce7c89627ff85c6 | [
"if not root:\n return True\nif not root.left and (not root.right):\n return True\nif not root.left or not root.right:\n return False\ndeque = []\ncur = root\ndeque.append(cur)\nwhile deque:\n n = len(deque)\n stack = []\n for i in range(n):\n cur = deque.pop(0)\n if cur:\n ... | <|body_start_0|>
if not root:
return True
if not root.left and (not root.right):
return True
if not root.left or not root.right:
return False
deque = []
cur = root
deque.append(cur)
while deque:
n = len(deque)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric0(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return True
... | stack_v2_sparse_classes_75kplus_train_068395 | 2,013 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric0",
"signature": "def isSymmetric0(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030396 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric0(self, root): :type root: TreeNode :rtype: bool
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric0(self, root): :type root: TreeNode :rtype: bool
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
<|skeleton|>
class Solution:
def isSymmetri... | 6e18c5d257840489cc3fb1079ae3804c743982a4 | <|skeleton|>
class Solution:
def isSymmetric0(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isSymmetric0(self, root):
""":type root: TreeNode :rtype: bool"""
if not root:
return True
if not root.left and (not root.right):
return True
if not root.left or not root.right:
return False
deque = []
cur = root... | the_stack_v2_python_sparse | 剑指 Offer 28. 对称的二叉树.py | yangyuxiang1996/leetcode | train | 0 | |
4f6044abd25ef749a9a6297da123ac66ca1ff4c2 | [
"if context is None:\n context = {}\nresult = {}\nmove_obj = self.pool.get('stock.move')\nfor prodlot in self.browse(cr, uid, ids, context=context):\n result[prodlot.id] = False\n move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', prodlot.id), ('state', '=', 'done')], limit=1, order='date desc', cont... | <|body_start_0|>
if context is None:
context = {}
result = {}
move_obj = self.pool.get('stock.move')
for prodlot in self.browse(cr, uid, ids, context=context):
result[prodlot.id] = False
move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', prodlot.... | stock_production_lot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stock_production_lot:
def _get_current_location(self, cr, uid, ids, field_name, arg, context=None):
"""Method to get the current location of the production lot based on the moves and the date"""
<|body_0|>
def _get_prod_lot(self, cr, uid, ids, context=None):
"""Metho... | stack_v2_sparse_classes_75kplus_train_068396 | 2,868 | no_license | [
{
"docstring": "Method to get the current location of the production lot based on the moves and the date",
"name": "_get_current_location",
"signature": "def _get_current_location(self, cr, uid, ids, field_name, arg, context=None)"
},
{
"docstring": "Method to get the list of production lots to ... | 2 | null | Implement the Python class `stock_production_lot` described below.
Class description:
Implement the stock_production_lot class.
Method signatures and docstrings:
- def _get_current_location(self, cr, uid, ids, field_name, arg, context=None): Method to get the current location of the production lot based on the moves ... | Implement the Python class `stock_production_lot` described below.
Class description:
Implement the stock_production_lot class.
Method signatures and docstrings:
- def _get_current_location(self, cr, uid, ids, field_name, arg, context=None): Method to get the current location of the production lot based on the moves ... | 3e35f7ba7246c54e5a5b31921b28aa5f1ab24999 | <|skeleton|>
class stock_production_lot:
def _get_current_location(self, cr, uid, ids, field_name, arg, context=None):
"""Method to get the current location of the production lot based on the moves and the date"""
<|body_0|>
def _get_prod_lot(self, cr, uid, ids, context=None):
"""Metho... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class stock_production_lot:
def _get_current_location(self, cr, uid, ids, field_name, arg, context=None):
"""Method to get the current location of the production lot based on the moves and the date"""
if context is None:
context = {}
result = {}
move_obj = self.pool.get('... | the_stack_v2_python_sparse | stock_production_lot_current_location/stock.py | mgielissen/julius-openobject-addons | train | 1 | |
234833266e481c97a7cc4b03407dd21deb106e69 | [
"try:\n if car_name is None:\n cars = Car.query.all()\n cars_dict = {}\n for car in cars:\n new_car = new_car_dict(self, car)\n cars_dict[new_car['name']] = new_car\n responseObject = {'status': 'success', 'message': 'Response to get all cars', 'data': cars_dict}... | <|body_start_0|>
try:
if car_name is None:
cars = Car.query.all()
cars_dict = {}
for car in cars:
new_car = new_car_dict(self, car)
cars_dict[new_car['name']] = new_car
responseObject = {'status':... | Cars CRUD APIs | RestfulAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestfulAPI:
"""Cars CRUD APIs"""
def get(self, car_name=None):
"""Responds to GET requests"""
<|body_0|>
def post(self):
"""Responds to POST requests"""
<|body_1|>
def put(self, car_name):
"""Responds to PUT requests Request body must contain... | stack_v2_sparse_classes_75kplus_train_068397 | 7,823 | no_license | [
{
"docstring": "Responds to GET requests",
"name": "get",
"signature": "def get(self, car_name=None)"
},
{
"docstring": "Responds to POST requests",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Responds to PUT requests Request body must contain all fields",
... | 4 | null | Implement the Python class `RestfulAPI` described below.
Class description:
Cars CRUD APIs
Method signatures and docstrings:
- def get(self, car_name=None): Responds to GET requests
- def post(self): Responds to POST requests
- def put(self, car_name): Responds to PUT requests Request body must contain all fields
- d... | Implement the Python class `RestfulAPI` described below.
Class description:
Cars CRUD APIs
Method signatures and docstrings:
- def get(self, car_name=None): Responds to GET requests
- def post(self): Responds to POST requests
- def put(self, car_name): Responds to PUT requests Request body must contain all fields
- d... | 2474a494febfbec82ef80f4b533819d5443c340f | <|skeleton|>
class RestfulAPI:
"""Cars CRUD APIs"""
def get(self, car_name=None):
"""Responds to GET requests"""
<|body_0|>
def post(self):
"""Responds to POST requests"""
<|body_1|>
def put(self, car_name):
"""Responds to PUT requests Request body must contain... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RestfulAPI:
"""Cars CRUD APIs"""
def get(self, car_name=None):
"""Responds to GET requests"""
try:
if car_name is None:
cars = Car.query.all()
cars_dict = {}
for car in cars:
new_car = new_car_dict(self, car)
... | the_stack_v2_python_sparse | app/apis/cars_method.py | zd247/piot2-car-share | train | 0 |
3350c2d476a7de4040639e44c3d35f0d141bfbbe | [
"if isinstance(key, int):\n return NotifyMessage(key)\nif key not in NotifyMessage._member_map_:\n return extend_enum(NotifyMessage, key, default)\nreturn NotifyMessage[key]",
"if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif ... | <|body_start_0|>
if isinstance(key, int):
return NotifyMessage(key)
if key not in NotifyMessage._member_map_:
return extend_enum(NotifyMessage, key, default)
return NotifyMessage[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <... | [NotifyMessage] Notify Message Types | NotifyMessage | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NotifyMessage:
"""[NotifyMessage] Notify Message Types"""
def get(key: 'int | str', default: 'int'=-1) -> 'NotifyMessage':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _miss... | stack_v2_sparse_classes_75kplus_train_068398 | 5,787 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'NotifyMessage'"
},
{
"docstring": "Lookup function used when value is not foun... | 2 | null | Implement the Python class `NotifyMessage` described below.
Class description:
[NotifyMessage] Notify Message Types
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'NotifyMessage': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not f... | Implement the Python class `NotifyMessage` described below.
Class description:
[NotifyMessage] Notify Message Types
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'NotifyMessage': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not f... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class NotifyMessage:
"""[NotifyMessage] Notify Message Types"""
def get(key: 'int | str', default: 'int'=-1) -> 'NotifyMessage':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _miss... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NotifyMessage:
"""[NotifyMessage] Notify Message Types"""
def get(key: 'int | str', default: 'int'=-1) -> 'NotifyMessage':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, int):
r... | the_stack_v2_python_sparse | pcapkit/const/hip/notify_message.py | JarryShaw/PyPCAPKit | train | 204 |
93dc61cf0fb1617bb55b709a823395700e4584d4 | [
"super().__init__(coord, color, rad)\nself.vx = randint(-25, +25)\nself.vy = randint(-25, +25)\nself.vel = [self.vx, self.vy]",
"self.vel[1] += int(g * t_step)\nfor i in range(2):\n self.coord[i] += int(self.vel[i] * t_step)\nself.check_walls()\nif self.vel[0] ** 2 + self.vel[1] ** 2 < 2 ** 2 and self.coord[1]... | <|body_start_0|>
super().__init__(coord, color, rad)
self.vx = randint(-25, +25)
self.vy = randint(-25, +25)
self.vel = [self.vx, self.vy]
<|end_body_0|>
<|body_start_1|>
self.vel[1] += int(g * t_step)
for i in range(2):
self.coord[i] += int(self.vel[i] * t_s... | Creates a moving target, using the creation of a static target. Controls it's motion and collision with a cannon ball. | MovingTarget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingTarget:
"""Creates a moving target, using the creation of a static target. Controls it's motion and collision with a cannon ball."""
def __init__(self, coord=None, color=None, rad=30):
"""Sets coordinates, velocity, color and radius of the target."""
<|body_0|>
def... | stack_v2_sparse_classes_75kplus_train_068399 | 11,360 | no_license | [
{
"docstring": "Sets coordinates, velocity, color and radius of the target.",
"name": "__init__",
"signature": "def __init__(self, coord=None, color=None, rad=30)"
},
{
"docstring": "Moves the target according to it's velocity and time step. Changes the target's velocity due to gravitational for... | 3 | null | Implement the Python class `MovingTarget` described below.
Class description:
Creates a moving target, using the creation of a static target. Controls it's motion and collision with a cannon ball.
Method signatures and docstrings:
- def __init__(self, coord=None, color=None, rad=30): Sets coordinates, velocity, color... | Implement the Python class `MovingTarget` described below.
Class description:
Creates a moving target, using the creation of a static target. Controls it's motion and collision with a cannon ball.
Method signatures and docstrings:
- def __init__(self, coord=None, color=None, rad=30): Sets coordinates, velocity, color... | a393f1ef617a1360cc767fa29029aabfbef094a8 | <|skeleton|>
class MovingTarget:
"""Creates a moving target, using the creation of a static target. Controls it's motion and collision with a cannon ball."""
def __init__(self, coord=None, color=None, rad=30):
"""Sets coordinates, velocity, color and radius of the target."""
<|body_0|>
def... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MovingTarget:
"""Creates a moving target, using the creation of a static target. Controls it's motion and collision with a cannon ball."""
def __init__(self, coord=None, color=None, rad=30):
"""Sets coordinates, velocity, color and radius of the target."""
super().__init__(coord, color, r... | the_stack_v2_python_sparse | lab 5/Gun.py | dimaz20022710/infa_2020_zarubin | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.