blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
09b97aed0991099d58d87bc3c2f01ce25eb3db39 | [
"super(DuelingNetworkMLP3, self).__init__()\nself._device = device\nself.fc1 = nn.Linear(in_features=n_states, out_features=n_hiddens).to(self._device)\nself.fc2 = nn.Linear(in_features=n_hiddens, out_features=n_hiddens).to(self._device)\nself.fc3_adv = nn.Linear(in_features=n_hiddens, out_features=n_actions).to(se... | <|body_start_0|>
super(DuelingNetworkMLP3, self).__init__()
self._device = device
self.fc1 = nn.Linear(in_features=n_states, out_features=n_hiddens).to(self._device)
self.fc2 = nn.Linear(in_features=n_hiddens, out_features=n_hiddens).to(self._device)
self.fc3_adv = nn.Linear(in_f... | Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク | DuelingNetworkMLP3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DuelingNetworkMLP3:
"""Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク"""
def __init__(self, device, n_states, n_hiddens, n_actions):
"""[Args] devi... | stack_v2_sparse_classes_36k_train_013000 | 2,523 | no_license | [
{
"docstring": "[Args] device : 使用デバイス n_states : 状態数 |S| / 入力ノード数に対応する。 n_actions : 状態数 |A| / 出力ノード数に対応する。",
"name": "__init__",
"signature": "def __init__(self, device, n_states, n_hiddens, n_actions)"
},
{
"docstring": "ネットワークの順方向での更新処理",
"name": "forward",
"signature": "def forward(s... | 2 | stack_v2_sparse_classes_30k_train_017989 | Implement the Python class `DuelingNetworkMLP3` described below.
Class description:
Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク
Method signatures and docstrings:
- def __init__(s... | Implement the Python class `DuelingNetworkMLP3` described below.
Class description:
Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク
Method signatures and docstrings:
- def __init__(s... | b0bae63db6183cbaee15d6a96499e40c482a517d | <|skeleton|>
class DuelingNetworkMLP3:
"""Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク"""
def __init__(self, device, n_states, n_hiddens, n_actions):
"""[Args] devi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DuelingNetworkMLP3:
"""Dueling Network のネットワーク構成 PyTorch の nn.Module を継承して実装 [public] fc1 : [nn.Linear] 入力層 fc2 : [nn.Linear] 隠れ層 fc3_adv : [nn.Linear] アドバンテージ関数のネットワーク fc3_vfunc : [nn.Linear] 状態価値関数のネットワーク"""
def __init__(self, device, n_states, n_hiddens, n_actions):
"""[Args] device : 使用デバイス n... | the_stack_v2_python_sparse | CartPole_DuelingNetwork_PyTorch_OpenAIGym/DuelingNetworkMLP3.py | Yagami360/ReinforcementLearning_Exercises | train | 14 |
d58f11e5172c450c8744e65b400586f3f40cfeff | [
"self.stacks = []\nself.cap = capacity\nself.open_positions = []",
"while self.open_positions and self.open_positions[0] < len(self.stacks) and (len(self.stacks[self.open_positions[0]]) == self.cap):\n heapq.heappop(self.open_positions)\nif not self.open_positions:\n heapq.heappush(self.open_positions, len(... | <|body_start_0|>
self.stacks = []
self.cap = capacity
self.open_positions = []
<|end_body_0|>
<|body_start_1|>
while self.open_positions and self.open_positions[0] < len(self.stacks) and (len(self.stacks[self.open_positions[0]]) == self.cap):
heapq.heappop(self.open_position... | DinnerPlates | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DinnerPlates:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def push(self, val):
""":type val: int :rtype: None"""
<|body_1|>
def pop(self):
""":rtype: int"""
<|body_2|>
def popAtStack(self, index):
""":t... | stack_v2_sparse_classes_36k_train_013001 | 1,445 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type val: int :rtype: None",
"name": "push",
"signature": "def push(self, val)"
},
{
"docstring": ":rtype: int",
"name": "pop",
"signature": "def pop(... | 4 | stack_v2_sparse_classes_30k_train_018454 | Implement the Python class `DinnerPlates` described below.
Class description:
Implement the DinnerPlates class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def push(self, val): :type val: int :rtype: None
- def pop(self): :rtype: int
- def popAtStack(self, index): :type ind... | Implement the Python class `DinnerPlates` described below.
Class description:
Implement the DinnerPlates class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def push(self, val): :type val: int :rtype: None
- def pop(self): :rtype: int
- def popAtStack(self, index): :type ind... | 20623defecf65cbc35b194d8b60d8b211816ee4f | <|skeleton|>
class DinnerPlates:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def push(self, val):
""":type val: int :rtype: None"""
<|body_1|>
def pop(self):
""":rtype: int"""
<|body_2|>
def popAtStack(self, index):
""":t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DinnerPlates:
def __init__(self, capacity):
""":type capacity: int"""
self.stacks = []
self.cap = capacity
self.open_positions = []
def push(self, val):
""":type val: int :rtype: None"""
while self.open_positions and self.open_positions[0] < len(self.stacks... | the_stack_v2_python_sparse | in_Python/1172 Dinner Plate Stacks.py | YangLiyli131/Leetcode2020 | train | 0 | |
54fe4f7aa87f58dd420f6f517bcfcda918b4408e | [
"self.model = nn.Linear(numUnits, numX, bias=False)\nself.optimizer = torch.optim.AdamW(self.model.parameters(), lr=0.001, weight_decay=0.3)\nself.loss_fn = nn.CrossEntropyLoss()",
"h = (h - self.h_mean) / self.h_std\nh = torch.tensor(h, dtype=torch.float)\np_X = self.model(h)\ndecodedX = p_X.argmax(dim=1)\nif wi... | <|body_start_0|>
self.model = nn.Linear(numUnits, numX, bias=False)
self.optimizer = torch.optim.AdamW(self.model.parameters(), lr=0.001, weight_decay=0.3)
self.loss_fn = nn.CrossEntropyLoss()
<|end_body_0|>
<|body_start_1|>
h = (h - self.h_mean) / self.h_std
h = torch.tensor(h,... | linearDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class linearDecoder:
def __init__(self, numUnits, numX):
"""Parameters ---------- numUnits : Number of units numX : Number of spatial locations"""
<|body_0|>
def decode(self, h, withSoftmax=True, asNumpy=True):
"""Parameters ---------- h : [Nt x Nunits] numpy array withSof... | stack_v2_sparse_classes_36k_train_013002 | 4,331 | no_license | [
{
"docstring": "Parameters ---------- numUnits : Number of units numX : Number of spatial locations",
"name": "__init__",
"signature": "def __init__(self, numUnits, numX)"
},
{
"docstring": "Parameters ---------- h : [Nt x Nunits] numpy array withSoftmax : T/F, optional. If true, returns probabi... | 4 | null | Implement the Python class `linearDecoder` described below.
Class description:
Implement the linearDecoder class.
Method signatures and docstrings:
- def __init__(self, numUnits, numX): Parameters ---------- numUnits : Number of units numX : Number of spatial locations
- def decode(self, h, withSoftmax=True, asNumpy=... | Implement the Python class `linearDecoder` described below.
Class description:
Implement the linearDecoder class.
Method signatures and docstrings:
- def __init__(self, numUnits, numX): Parameters ---------- numUnits : Number of units numX : Number of spatial locations
- def decode(self, h, withSoftmax=True, asNumpy=... | 24c9466d6a8a1deaf6b30f38388e90212af07c1e | <|skeleton|>
class linearDecoder:
def __init__(self, numUnits, numX):
"""Parameters ---------- numUnits : Number of units numX : Number of spatial locations"""
<|body_0|>
def decode(self, h, withSoftmax=True, asNumpy=True):
"""Parameters ---------- h : [Nt x Nunits] numpy array withSof... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class linearDecoder:
def __init__(self, numUnits, numX):
"""Parameters ---------- numUnits : Number of units numX : Number of spatial locations"""
self.model = nn.Linear(numUnits, numX, bias=False)
self.optimizer = torch.optim.AdamW(self.model.parameters(), lr=0.001, weight_decay=0.3)
... | the_stack_v2_python_sparse | pyna/LinearDecoder.py | gviejo/LMNphysio | train | 0 | |
6dc3e81895aced2b16b47e6c2b07c58b85ea9232 | [
"if filename is not None:\n assert v is None and f is None and (vc is None)\nelse:\n assert v is not None or f is not None\n if vc is not None:\n assert len(v) == len(vc)\nif filename is not None:\n plydata = plyfile.PlyData.read(filename)\n self.v = np.hstack((np.atleast_2d(plydata['vertex'][... | <|body_start_0|>
if filename is not None:
assert v is None and f is None and (vc is None)
else:
assert v is not None or f is not None
if vc is not None:
assert len(v) == len(vc)
if filename is not None:
plydata = plyfile.PlyData.rea... | An easy to use mesh interface. | Mesh | [
"LicenseRef-scancode-proprietary-license",
"CC-BY-NC-4.0",
"LicenseRef-scancode-unknown",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mesh:
"""An easy to use mesh interface."""
def __init__(self, filename=None, v=None, vc=None, f=None):
"""Construct a mesh either from a file or with the provided data."""
<|body_0|>
def write_ply(self, out_name):
"""Write to a .ply file."""
<|body_1|>
<... | stack_v2_sparse_classes_36k_train_013003 | 2,298 | permissive | [
{
"docstring": "Construct a mesh either from a file or with the provided data.",
"name": "__init__",
"signature": "def __init__(self, filename=None, v=None, vc=None, f=None)"
},
{
"docstring": "Write to a .ply file.",
"name": "write_ply",
"signature": "def write_ply(self, out_name)"
}
... | 2 | null | Implement the Python class `Mesh` described below.
Class description:
An easy to use mesh interface.
Method signatures and docstrings:
- def __init__(self, filename=None, v=None, vc=None, f=None): Construct a mesh either from a file or with the provided data.
- def write_ply(self, out_name): Write to a .ply file. | Implement the Python class `Mesh` described below.
Class description:
An easy to use mesh interface.
Method signatures and docstrings:
- def __init__(self, filename=None, v=None, vc=None, f=None): Construct a mesh either from a file or with the provided data.
- def write_ply(self, out_name): Write to a .ply file.
<|... | 4b66e083da2f1fadb2fd8a993d1268972f7d45e0 | <|skeleton|>
class Mesh:
"""An easy to use mesh interface."""
def __init__(self, filename=None, v=None, vc=None, f=None):
"""Construct a mesh either from a file or with the provided data."""
<|body_0|>
def write_ply(self, out_name):
"""Write to a .ply file."""
<|body_1|>
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mesh:
"""An easy to use mesh interface."""
def __init__(self, filename=None, v=None, vc=None, f=None):
"""Construct a mesh either from a file or with the provided data."""
if filename is not None:
assert v is None and f is None and (vc is None)
else:
assert... | the_stack_v2_python_sparse | neural_body_fitting-master/external/up/up_tools/mesh.py | sg-first/Motion-Capture-CV | train | 1 |
6566b3e449e5d21a61522a3d9cc0267bc93c703a | [
"vowels = ['a', 'e', 'i', 'o', 'u']\ni = 0\nj = len(s) - 1\ns = list(s)\nwhile i < j:\n if s[i].lower() in vowels and s[j].lower() in vowels:\n s[i], s[j] = (s[j], s[i])\n i += 1\n j -= 1\n elif s[i].lower() not in vowels and s[j].lower() not in vowels:\n i += 1\n j -= 1\n ... | <|body_start_0|>
vowels = ['a', 'e', 'i', 'o', 'u']
i = 0
j = len(s) - 1
s = list(s)
while i < j:
if s[i].lower() in vowels and s[j].lower() in vowels:
s[i], s[j] = (s[j], s[i])
i += 1
j -= 1
elif s[i].lower(... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseVowels(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def reverseVowels1(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
vowels = ['a', 'e', 'i', 'o', 'u']
i = 0
j = len... | stack_v2_sparse_classes_36k_train_013004 | 1,707 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "reverseVowels",
"signature": "def reverseVowels(self, s)"
},
{
"docstring": ":type s: str :rtype: str",
"name": "reverseVowels1",
"signature": "def reverseVowels1(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012525 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseVowels(self, s): :type s: str :rtype: str
- def reverseVowels1(self, s): :type s: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseVowels(self, s): :type s: str :rtype: str
- def reverseVowels1(self, s): :type s: str :rtype: str
<|skeleton|>
class Solution:
def reverseVowels(self, s):
... | c55b0cfd2967a2221c27ed738e8de15034775945 | <|skeleton|>
class Solution:
def reverseVowels(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def reverseVowels1(self, s):
""":type s: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverseVowels(self, s):
""":type s: str :rtype: str"""
vowels = ['a', 'e', 'i', 'o', 'u']
i = 0
j = len(s) - 1
s = list(s)
while i < j:
if s[i].lower() in vowels and s[j].lower() in vowels:
s[i], s[j] = (s[j], s[i])
... | the_stack_v2_python_sparse | PycharmProjects/leetcode/UsingArray/ReverseVowelsOfaString.py | crystal30/DataStructure | train | 0 | |
91769a42fe5a77b06a9d4690e792c7888d03eb23 | [
"memo = [0, 1]\nfor i in range(2, N):\n memo[i % 2] = sum(memo)\nreturn sum(memo) if N != 0 else 0",
"if N == 0:\n return 0\nif N == 1:\n return 1\nif N in self.memo:\n return self.memo[N]\nelse:\n self.memo[N] = self.fib(N - 1) + self.fib(N - 2)\nreturn self.memo[N]",
"if N == 0:\n return 0\n... | <|body_start_0|>
memo = [0, 1]
for i in range(2, N):
memo[i % 2] = sum(memo)
return sum(memo) if N != 0 else 0
<|end_body_0|>
<|body_start_1|>
if N == 0:
return 0
if N == 1:
return 1
if N in self.memo:
return self.memo[N]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def fib(self, N):
""":type N: int :rtype: int"""
<|body_0|>
def fib(self, N):
""":type N: int :rtype: int"""
<|body_1|>
def fib(self, N):
""":type N: int :rtype: int"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
memo... | stack_v2_sparse_classes_36k_train_013005 | 958 | no_license | [
{
"docstring": ":type N: int :rtype: int",
"name": "fib",
"signature": "def fib(self, N)"
},
{
"docstring": ":type N: int :rtype: int",
"name": "fib",
"signature": "def fib(self, N)"
},
{
"docstring": ":type N: int :rtype: int",
"name": "fib",
"signature": "def fib(self, ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fib(self, N): :type N: int :rtype: int
- def fib(self, N): :type N: int :rtype: int
- def fib(self, N): :type N: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def fib(self, N): :type N: int :rtype: int
- def fib(self, N): :type N: int :rtype: int
- def fib(self, N): :type N: int :rtype: int
<|skeleton|>
class Solution:
def fib(se... | 2ecaeed38178819480388b5742bc2ea12009ae16 | <|skeleton|>
class Solution:
def fib(self, N):
""":type N: int :rtype: int"""
<|body_0|>
def fib(self, N):
""":type N: int :rtype: int"""
<|body_1|>
def fib(self, N):
""":type N: int :rtype: int"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def fib(self, N):
""":type N: int :rtype: int"""
memo = [0, 1]
for i in range(2, N):
memo[i % 2] = sum(memo)
return sum(memo) if N != 0 else 0
def fib(self, N):
""":type N: int :rtype: int"""
if N == 0:
return 0
if ... | the_stack_v2_python_sparse | 509.fibonacci-number.py | LouisYLWang/leetcode_python | train | 0 | |
a6832174d98cc2b267356fe91659782d18214009 | [
"if self.column_to_check[self.column_to_check.isnull()].empty:\n if self.column_to_check[self.column_to_check == ''].empty:\n return True\n else:\n return False\nelse:\n return False",
"df_check_column = self.column_to_check.to_frame()\ndf_ref_column = self.ref_column.to_frame()\ndf_check_s... | <|body_start_0|>
if self.column_to_check[self.column_to_check.isnull()].empty:
if self.column_to_check[self.column_to_check == ''].empty:
return True
else:
return False
else:
return False
<|end_body_0|>
<|body_start_1|>
df_chec... | Check object represents a specific check on the data to be done having attributes as follows: - mandatory: a boolean attribute to indicate whether the check is mandatory to be passed or if it is just a warning - passed: A boolean attribute indicating if the check has passed or not. - type: one of the specified type che... | Check | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Check:
"""Check object represents a specific check on the data to be done having attributes as follows: - mandatory: a boolean attribute to indicate whether the check is mandatory to be passed or if it is just a warning - passed: A boolean attribute indicating if the check has passed or not. - ty... | stack_v2_sparse_classes_36k_train_013006 | 2,018 | no_license | [
{
"docstring": "check if all rows have values in them, i.e. neither empty nor none :return:",
"name": "rows_filled_check",
"signature": "def rows_filled_check(self)"
},
{
"docstring": ":return:",
"name": "fk_existence_check",
"signature": "def fk_existence_check(self)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_012909 | Implement the Python class `Check` described below.
Class description:
Check object represents a specific check on the data to be done having attributes as follows: - mandatory: a boolean attribute to indicate whether the check is mandatory to be passed or if it is just a warning - passed: A boolean attribute indicati... | Implement the Python class `Check` described below.
Class description:
Check object represents a specific check on the data to be done having attributes as follows: - mandatory: a boolean attribute to indicate whether the check is mandatory to be passed or if it is just a warning - passed: A boolean attribute indicati... | 84401e245b40f0a6412e14928f0a6d63a7ab2412 | <|skeleton|>
class Check:
"""Check object represents a specific check on the data to be done having attributes as follows: - mandatory: a boolean attribute to indicate whether the check is mandatory to be passed or if it is just a warning - passed: A boolean attribute indicating if the check has passed or not. - ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Check:
"""Check object represents a specific check on the data to be done having attributes as follows: - mandatory: a boolean attribute to indicate whether the check is mandatory to be passed or if it is just a warning - passed: A boolean attribute indicating if the check has passed or not. - type: one of th... | the_stack_v2_python_sparse | BTalaqa/Helpers/Check.py | driad91/BTalaqa | train | 0 |
3f1cd5c620913560c286ea0ce43cb267023617c2 | [
"self.conf_file = current_file_path + '/../../conf/appviewx.conf'\nself.conf_data = config_parser(self.conf_file)\nself.component = component\nself.state = state\nself.path = self.conf_data['ENVIRONMENT']['path'][self.conf_data['ENVIRONMENT']['ips'].index(hostname)]\nif self.state.upper() not in ['HTTP', 'HTTPS']:\... | <|body_start_0|>
self.conf_file = current_file_path + '/../../conf/appviewx.conf'
self.conf_data = config_parser(self.conf_file)
self.component = component
self.state = state
self.path = self.conf_data['ENVIRONMENT']['path'][self.conf_data['ENVIRONMENT']['ips'].index(hostname)]
... | The class to convert components from http to https and vice-versa. | Convert | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Convert:
"""The class to convert components from http to https and vice-versa."""
def __init__(self, component, state):
"""Declare class variables."""
<|body_0|>
def edit_in_conf_file(self):
"""Edit the contents of the conf file before conversion."""
<|bo... | stack_v2_sparse_classes_36k_train_013007 | 7,340 | no_license | [
{
"docstring": "Declare class variables.",
"name": "__init__",
"signature": "def __init__(self, component, state)"
},
{
"docstring": "Edit the contents of the conf file before conversion.",
"name": "edit_in_conf_file",
"signature": "def edit_in_conf_file(self)"
},
{
"docstring": ... | 5 | stack_v2_sparse_classes_30k_train_008156 | Implement the Python class `Convert` described below.
Class description:
The class to convert components from http to https and vice-versa.
Method signatures and docstrings:
- def __init__(self, component, state): Declare class variables.
- def edit_in_conf_file(self): Edit the contents of the conf file before conver... | Implement the Python class `Convert` described below.
Class description:
The class to convert components from http to https and vice-versa.
Method signatures and docstrings:
- def __init__(self, component, state): Declare class variables.
- def edit_in_conf_file(self): Edit the contents of the conf file before conver... | e513224364dce05ea4d17ac25ecfa981238b1311 | <|skeleton|>
class Convert:
"""The class to convert components from http to https and vice-versa."""
def __init__(self, component, state):
"""Declare class variables."""
<|body_0|>
def edit_in_conf_file(self):
"""Edit the contents of the conf file before conversion."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Convert:
"""The class to convert components from http to https and vice-versa."""
def __init__(self, component, state):
"""Declare class variables."""
self.conf_file = current_file_path + '/../../conf/appviewx.conf'
self.conf_data = config_parser(self.conf_file)
self.compo... | the_stack_v2_python_sparse | scripts_avx/scripts/scripts/Commons/http_https.py | Poonammahunta/Integration | train | 0 |
0b47ef46e9f790829b38c2c780132ebbcee19b84 | [
"log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR], 'ui_contact_case2 : case Start')\nglobal case_flag\ncase_flag = False\nstart_activity('com.android.contacts', 'com.android.contacts.activities.PeopleActivity')\nsleep(1)\nclick_textview_by_text(SC.PRIVATE_CONTACT_CONTACTS_OPTION, isScrollable=0)\nconta... | <|body_start_0|>
log_test_case(self.case_config_map[fs_wrapper.CASE_NAME_ATTR], 'ui_contact_case2 : case Start')
global case_flag
case_flag = False
start_activity('com.android.contacts', 'com.android.contacts.activities.PeopleActivity')
sleep(1)
click_textview_by_text(SC.... | test_suit_ui_contact_case2 is a class for add a new contact @see: L{TestCaseBase <TestCaseBase>} | test_suit_ui_contact_case2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_suit_ui_contact_case2:
"""test_suit_ui_contact_case2 is a class for add a new contact @see: L{TestCaseBase <TestCaseBase>}"""
def test_case_main(self, case_results):
"""main entry. @type case_results: tuple @param case_results: record some case result information"""
<|bo... | stack_v2_sparse_classes_36k_train_013008 | 3,491 | no_license | [
{
"docstring": "main entry. @type case_results: tuple @param case_results: record some case result information",
"name": "test_case_main",
"signature": "def test_case_main(self, case_results)"
},
{
"docstring": "record the case result",
"name": "test_case_end",
"signature": "def test_cas... | 2 | null | Implement the Python class `test_suit_ui_contact_case2` described below.
Class description:
test_suit_ui_contact_case2 is a class for add a new contact @see: L{TestCaseBase <TestCaseBase>}
Method signatures and docstrings:
- def test_case_main(self, case_results): main entry. @type case_results: tuple @param case_res... | Implement the Python class `test_suit_ui_contact_case2` described below.
Class description:
test_suit_ui_contact_case2 is a class for add a new contact @see: L{TestCaseBase <TestCaseBase>}
Method signatures and docstrings:
- def test_case_main(self, case_results): main entry. @type case_results: tuple @param case_res... | a04b717ae437511abae1e7e9e399373c161a7b65 | <|skeleton|>
class test_suit_ui_contact_case2:
"""test_suit_ui_contact_case2 is a class for add a new contact @see: L{TestCaseBase <TestCaseBase>}"""
def test_case_main(self, case_results):
"""main entry. @type case_results: tuple @param case_results: record some case result information"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class test_suit_ui_contact_case2:
"""test_suit_ui_contact_case2 is a class for add a new contact @see: L{TestCaseBase <TestCaseBase>}"""
def test_case_main(self, case_results):
"""main entry. @type case_results: tuple @param case_results: record some case result information"""
log_test_case(sel... | the_stack_v2_python_sparse | test_env/test_suit_ui_contact/test_suit_ui_contact_case2.py | wwlwwlqaz/Qualcomm | train | 1 |
981429351bd450245f47f4f0c13c6a5e6edccbd5 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UnifiedRoleEligibilityScheduleInstance()",
"from .unified_role_schedule_instance_base import UnifiedRoleScheduleInstanceBase\nfrom .unified_role_schedule_instance_base import UnifiedRoleScheduleInstanceBase\nfields: Dict[str, Callable[... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return UnifiedRoleEligibilityScheduleInstance()
<|end_body_0|>
<|body_start_1|>
from .unified_role_schedule_instance_base import UnifiedRoleScheduleInstanceBase
from .unified_role_schedule_inst... | UnifiedRoleEligibilityScheduleInstance | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnifiedRoleEligibilityScheduleInstance:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleEligibilityScheduleInstance:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the... | stack_v2_sparse_classes_36k_train_013009 | 3,418 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UnifiedRoleEligibilityScheduleInstance",
"name": "create_from_discriminator_value",
"signature": "def create... | 3 | null | Implement the Python class `UnifiedRoleEligibilityScheduleInstance` described below.
Class description:
Implement the UnifiedRoleEligibilityScheduleInstance class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleEligibilityScheduleInstance: C... | Implement the Python class `UnifiedRoleEligibilityScheduleInstance` described below.
Class description:
Implement the UnifiedRoleEligibilityScheduleInstance class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleEligibilityScheduleInstance: C... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class UnifiedRoleEligibilityScheduleInstance:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleEligibilityScheduleInstance:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnifiedRoleEligibilityScheduleInstance:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleEligibilityScheduleInstance:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator... | the_stack_v2_python_sparse | msgraph/generated/models/unified_role_eligibility_schedule_instance.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
11f6d99b679fdd5e067b766fc02b0280149e679c | [
"self.capacity = capacity\nself.map = {}\nself.freqlist = DoubleLinkedList()",
"if key not in self.map:\n print('-1')\n return -1\nelse:\n node = self.map[key]\n self._updatefreq(node)\n print(node.val[1])\n return node.val[1]",
"if self.capacity < 1:\n return\nif key in self.map:\n node... | <|body_start_0|>
self.capacity = capacity
self.map = {}
self.freqlist = DoubleLinkedList()
<|end_body_0|>
<|body_start_1|>
if key not in self.map:
print('-1')
return -1
else:
node = self.map[key]
self._updatefreq(node)
... | LFUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
def... | stack_v2_sparse_classes_36k_train_013010 | 6,538 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 5 | null | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
- def... | Implement the Python class `LFUCache` described below.
Class description:
Implement the LFUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
- def... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
def... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LFUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.map = {}
self.freqlist = DoubleLinkedList()
def get(self, key):
""":type key: int :rtype: int"""
if key not in self.map:
print('-1')
retu... | the_stack_v2_python_sparse | code460LFUCache.py | cybelewang/leetcode-python | train | 0 | |
5bef7139903ab402d83be46d77281148b5ecad4f | [
"self.subject_name = 'attachment'\nSubject.__init__(self, profile, self.subject_name)\nself.api_base_url += '/tag/{}/'",
"if client_id is None:\n client_id = self._use_default_client_id()[0]\nurl = self.api_base_url.format(str(client_id), str(tag_id)) + '/attachment'\nupload_file = {'attachments': (file_name, ... | <|body_start_0|>
self.subject_name = 'attachment'
Subject.__init__(self, profile, self.subject_name)
self.api_base_url += '/tag/{}/'
<|end_body_0|>
<|body_start_1|>
if client_id is None:
client_id = self._use_default_client_id()[0]
url = self.api_base_url.format(str(... | Attachments class | Attachments | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attachments:
"""Attachments class"""
def __init__(self, profile):
"""Initialization of Attachments object. :param profile: Profile Object :type profile: _profile"""
<|body_0|>
def upload(self, tag_id, file_name, client_id=None):
"""Upload a new attachment for a t... | stack_v2_sparse_classes_36k_train_013011 | 7,261 | permissive | [
{
"docstring": "Initialization of Attachments object. :param profile: Profile Object :type profile: _profile",
"name": "__init__",
"signature": "def __init__(self, profile)"
},
{
"docstring": "Upload a new attachment for a tag. :param tag_id: The tag ID. :type tag_id: int :param file_name: The f... | 6 | stack_v2_sparse_classes_30k_train_008379 | Implement the Python class `Attachments` described below.
Class description:
Attachments class
Method signatures and docstrings:
- def __init__(self, profile): Initialization of Attachments object. :param profile: Profile Object :type profile: _profile
- def upload(self, tag_id, file_name, client_id=None): Upload a n... | Implement the Python class `Attachments` described below.
Class description:
Attachments class
Method signatures and docstrings:
- def __init__(self, profile): Initialization of Attachments object. :param profile: Profile Object :type profile: _profile
- def upload(self, tag_id, file_name, client_id=None): Upload a n... | 1564cd93505a4d4ccd546f68310e0a09f888e590 | <|skeleton|>
class Attachments:
"""Attachments class"""
def __init__(self, profile):
"""Initialization of Attachments object. :param profile: Profile Object :type profile: _profile"""
<|body_0|>
def upload(self, tag_id, file_name, client_id=None):
"""Upload a new attachment for a t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Attachments:
"""Attachments class"""
def __init__(self, profile):
"""Initialization of Attachments object. :param profile: Profile Object :type profile: _profile"""
self.subject_name = 'attachment'
Subject.__init__(self, profile, self.subject_name)
self.api_base_url += '/t... | the_stack_v2_python_sparse | lib/risksense_api/__subject/__attachments/__attachments.py | mtornga/risksense_tools | train | 0 |
0339655834d2ce9071a94ea902d1dbeda83e3908 | [
"try:\n detail_html = source.pop('bbd_html', '')\n detail_url = source.get('bbd_url', '')\n self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))\n json_data = json.loads(detail_html)\n data_content = json_data['data']['dataContentJson']\n data_func = self.get_value(json_data['data']... | <|body_start_0|>
try:
detail_html = source.pop('bbd_html', '')
detail_url = source.get('bbd_url', '')
self.logger.info('开始解析:{} {}'.format(self.parser_info, detail_url))
json_data = json.loads(detail_html)
data_content = json_data['data']['dataContentJ... | class Parser__qyxg_xzxk__credit_fengjie for 信用奉节-行政许可 解析 | Parser__qyxg_xzxk__credit_fengjie | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parser__qyxg_xzxk__credit_fengjie:
"""class Parser__qyxg_xzxk__credit_fengjie for 信用奉节-行政许可 解析"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
<|body_0|>
def get_value(self, json_dict... | stack_v2_sparse_classes_36k_train_013012 | 3,589 | no_license | [
{
"docstring": "parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None",
"name": "parse",
"signature": "def parse(self, source, *args, **kwargs)"
},
{
"docstring": ":Keyword Arguments: self -- json_dict -- :return: None",
"name": "get_value",
"signature": "d... | 2 | null | Implement the Python class `Parser__qyxg_xzxk__credit_fengjie` described below.
Class description:
class Parser__qyxg_xzxk__credit_fengjie for 信用奉节-行政许可 解析
Method signatures and docstrings:
- def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None... | Implement the Python class `Parser__qyxg_xzxk__credit_fengjie` described below.
Class description:
class Parser__qyxg_xzxk__credit_fengjie for 信用奉节-行政许可 解析
Method signatures and docstrings:
- def parse(self, source, *args, **kwargs): parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None... | 991902517a94e26fbe6378610d3cd12ff4a5c1f7 | <|skeleton|>
class Parser__qyxg_xzxk__credit_fengjie:
"""class Parser__qyxg_xzxk__credit_fengjie for 信用奉节-行政许可 解析"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
<|body_0|>
def get_value(self, json_dict... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parser__qyxg_xzxk__credit_fengjie:
"""class Parser__qyxg_xzxk__credit_fengjie for 信用奉节-行政许可 解析"""
def parse(self, source, *args, **kwargs):
"""parse logic :Keyword Arguments: self -- source -- *args -- **kwargs -- :return: None"""
try:
detail_html = source.pop('bbd_html', '')
... | the_stack_v2_python_sparse | parse/qyxg_xzxk/Parser__qyxg_xzxk__credit_fengjie.py | ZhouForrest/Spider | train | 0 |
28e494e4b8b335cd133e9b0871810fa45783225b | [
"setting = JsonSetting(settingFilePath)\nself.bd_rest_api = setting.get('bd_rest_api')\nself.oauth = setting.get('oauth')\nself.others = setting.get('others')\nself.access_token = self.get_oauth_token()",
"headers = {'content-type': 'application/json'}\nurl = self.bd_rest_api['domain']\nurl += ':' + self.bd_rest_... | <|body_start_0|>
setting = JsonSetting(settingFilePath)
self.bd_rest_api = setting.get('bd_rest_api')
self.oauth = setting.get('oauth')
self.others = setting.get('others')
self.access_token = self.get_oauth_token()
<|end_body_0|>
<|body_start_1|>
headers = {'content-type... | Building Depot Helpe Class | BuildingDepotHelper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BuildingDepotHelper:
"""Building Depot Helpe Class"""
def __init__(self, settingFilePath='./knockingSettings.json'):
"""Initialize instance and load settings"""
<|body_0|>
def get_oauth_token(self):
"""Get OAuth access token"""
<|body_1|>
def get_tim... | stack_v2_sparse_classes_36k_train_013013 | 4,153 | permissive | [
{
"docstring": "Initialize instance and load settings",
"name": "__init__",
"signature": "def __init__(self, settingFilePath='./knockingSettings.json')"
},
{
"docstring": "Get OAuth access token",
"name": "get_oauth_token",
"signature": "def get_oauth_token(self)"
},
{
"docstring... | 4 | stack_v2_sparse_classes_30k_train_015640 | Implement the Python class `BuildingDepotHelper` described below.
Class description:
Building Depot Helpe Class
Method signatures and docstrings:
- def __init__(self, settingFilePath='./knockingSettings.json'): Initialize instance and load settings
- def get_oauth_token(self): Get OAuth access token
- def get_timeser... | Implement the Python class `BuildingDepotHelper` described below.
Class description:
Building Depot Helpe Class
Method signatures and docstrings:
- def __init__(self, settingFilePath='./knockingSettings.json'): Initialize instance and load settings
- def get_oauth_token(self): Get OAuth access token
- def get_timeser... | d7e8237f13cb264f9c772b343e2830ebe1319662 | <|skeleton|>
class BuildingDepotHelper:
"""Building Depot Helpe Class"""
def __init__(self, settingFilePath='./knockingSettings.json'):
"""Initialize instance and load settings"""
<|body_0|>
def get_oauth_token(self):
"""Get OAuth access token"""
<|body_1|>
def get_tim... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BuildingDepotHelper:
"""Building Depot Helpe Class"""
def __init__(self, settingFilePath='./knockingSettings.json'):
"""Initialize instance and load settings"""
setting = JsonSetting(settingFilePath)
self.bd_rest_api = setting.get('bd_rest_api')
self.oauth = setting.get('o... | the_stack_v2_python_sparse | BuildingDepotHelper.py | gs27/Edge-Analytics | train | 0 |
158a910eb56846f4efdf9a58a7029ae883e8c1a5 | [
"suite = unittest.TestSuite()\nloader = unittest.TestLoader()\nsuite.addTest(loader.loadTestsFromModule(test_login))\nwith open('http_report.html', 'wb') as file:\n runner = HTMLTestRunner.HTMLTestRunner(stream=file, verbosity=2, title='测试http请求的测试报告', description='一共写了4条测试用例')\n runner.run(suite)",
"suite ... | <|body_start_0|>
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTest(loader.loadTestsFromModule(test_login))
with open('http_report.html', 'wb') as file:
runner = HTMLTestRunner.HTMLTestRunner(stream=file, verbosity=2, title='测试http请求的测试报告', description=... | TestHttpSuite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestHttpSuite:
def http_suite_runner_001(self):
"""采用loader来加载用例,通过模块名来加载"""
<|body_0|>
def http_suite_runner_002(self):
"""用loader来加载用例,通过类名来加载"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
suite = unittest.TestSuite()
loader = unittest.T... | stack_v2_sparse_classes_36k_train_013014 | 1,407 | no_license | [
{
"docstring": "采用loader来加载用例,通过模块名来加载",
"name": "http_suite_runner_001",
"signature": "def http_suite_runner_001(self)"
},
{
"docstring": "用loader来加载用例,通过类名来加载",
"name": "http_suite_runner_002",
"signature": "def http_suite_runner_002(self)"
}
] | 2 | null | Implement the Python class `TestHttpSuite` described below.
Class description:
Implement the TestHttpSuite class.
Method signatures and docstrings:
- def http_suite_runner_001(self): 采用loader来加载用例,通过模块名来加载
- def http_suite_runner_002(self): 用loader来加载用例,通过类名来加载 | Implement the Python class `TestHttpSuite` described below.
Class description:
Implement the TestHttpSuite class.
Method signatures and docstrings:
- def http_suite_runner_001(self): 采用loader来加载用例,通过模块名来加载
- def http_suite_runner_002(self): 用loader来加载用例,通过类名来加载
<|skeleton|>
class TestHttpSuite:
def http_suite_r... | 1313e56ddfa67a2490e703a1a5ef4a6967565849 | <|skeleton|>
class TestHttpSuite:
def http_suite_runner_001(self):
"""采用loader来加载用例,通过模块名来加载"""
<|body_0|>
def http_suite_runner_002(self):
"""用loader来加载用例,通过类名来加载"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestHttpSuite:
def http_suite_runner_001(self):
"""采用loader来加载用例,通过模块名来加载"""
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTest(loader.loadTestsFromModule(test_login))
with open('http_report.html', 'wb') as file:
runner = HTMLTestRunne... | the_stack_v2_python_sparse | week_7/class_0326/main.py | EuniceHu/python15_api_test | train | 0 | |
2a6e62639eac740ae3f63d1a6d2e31003f47e84b | [
"self.timeStep = 40\nself.RShoulderPitch = self.getDevice('RShoulderPitch')\nself.LShoulderPitch = self.getDevice('LShoulderPitch')\nself.RShoulderPitch.setPosition(1.1)\nself.LShoulderPitch.setPosition(1.1)",
"walk = Motion('forward.motion')\nwalk.setLoop(True)\nwalk.play()\nwhile True:\n if walk.getTime() ==... | <|body_start_0|>
self.timeStep = 40
self.RShoulderPitch = self.getDevice('RShoulderPitch')
self.LShoulderPitch = self.getDevice('LShoulderPitch')
self.RShoulderPitch.setPosition(1.1)
self.LShoulderPitch.setPosition(1.1)
<|end_body_0|>
<|body_start_1|>
walk = Motion('forw... | Make the NAO robot run as fast as possible. | Sprinter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sprinter:
"""Make the NAO robot run as fast as possible."""
def initialize(self):
"""Get device pointers, enable sensors and set robot initial pose."""
<|body_0|>
def run(self):
"""Play the forward motion and loop on the walking cycle."""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k_train_013015 | 2,606 | permissive | [
{
"docstring": "Get device pointers, enable sensors and set robot initial pose.",
"name": "initialize",
"signature": "def initialize(self)"
},
{
"docstring": "Play the forward motion and loop on the walking cycle.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | null | Implement the Python class `Sprinter` described below.
Class description:
Make the NAO robot run as fast as possible.
Method signatures and docstrings:
- def initialize(self): Get device pointers, enable sensors and set robot initial pose.
- def run(self): Play the forward motion and loop on the walking cycle. | Implement the Python class `Sprinter` described below.
Class description:
Make the NAO robot run as fast as possible.
Method signatures and docstrings:
- def initialize(self): Get device pointers, enable sensors and set robot initial pose.
- def run(self): Play the forward motion and loop on the walking cycle.
<|ske... | 8aba6eaae76989facf3442305c8089d3cc366bcf | <|skeleton|>
class Sprinter:
"""Make the NAO robot run as fast as possible."""
def initialize(self):
"""Get device pointers, enable sensors and set robot initial pose."""
<|body_0|>
def run(self):
"""Play the forward motion and loop on the walking cycle."""
<|body_1|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sprinter:
"""Make the NAO robot run as fast as possible."""
def initialize(self):
"""Get device pointers, enable sensors and set robot initial pose."""
self.timeStep = 40
self.RShoulderPitch = self.getDevice('RShoulderPitch')
self.LShoulderPitch = self.getDevice('LShoulder... | the_stack_v2_python_sparse | projects/samples/robotbenchmark/humanoid_sprint/controllers/sprinter/sprinter.py | cyberbotics/webots | train | 2,495 |
71a6f0f730df2831c9dcda704e5ec44c73fd59f1 | [
"super(ResConfigSettings, self).set_values()\nself.env['ir.config_parameter'].sudo().set_param('recruitment.li_username', self.li_username)\nself.env['ir.config_parameter'].sudo().set_param('recruitment.li_password', self.li_password)",
"res = super(ResConfigSettings, self).get_values()\nres.update(li_username=se... | <|body_start_0|>
super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].sudo().set_param('recruitment.li_username', self.li_username)
self.env['ir.config_parameter'].sudo().set_param('recruitment.li_password', self.li_password)
<|end_body_0|>
<|body_start_1|>
res = ... | config settings | ResConfigSettings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResConfigSettings:
"""config settings"""
def set_values(self):
"""super the config to set the value"""
<|body_0|>
def get_values(self):
"""super the config to get the value"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(ResConfigSettings,... | stack_v2_sparse_classes_36k_train_013016 | 1,944 | no_license | [
{
"docstring": "super the config to set the value",
"name": "set_values",
"signature": "def set_values(self)"
},
{
"docstring": "super the config to get the value",
"name": "get_values",
"signature": "def get_values(self)"
}
] | 2 | null | Implement the Python class `ResConfigSettings` described below.
Class description:
config settings
Method signatures and docstrings:
- def set_values(self): super the config to set the value
- def get_values(self): super the config to get the value | Implement the Python class `ResConfigSettings` described below.
Class description:
config settings
Method signatures and docstrings:
- def set_values(self): super the config to set the value
- def get_values(self): super the config to get the value
<|skeleton|>
class ResConfigSettings:
"""config settings"""
... | 4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14 | <|skeleton|>
class ResConfigSettings:
"""config settings"""
def set_values(self):
"""super the config to set the value"""
<|body_0|>
def get_values(self):
"""super the config to get the value"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResConfigSettings:
"""config settings"""
def set_values(self):
"""super the config to set the value"""
super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].sudo().set_param('recruitment.li_username', self.li_username)
self.env['ir.config_parameter'].... | the_stack_v2_python_sparse | hr_linkedin_recruitment/models/recruitment_config.py | CybroOdoo/CybroAddons | train | 209 |
a7dcbd6b58388ec690c116c75300758d5c0896ae | [
"self.root_path = 'D:\\\\无版权图片下载\\\\\\\\'\nif not os.path.exists(self.root_path):\n os.mkdir(self.root_path)\nself.download = htmlDownload()",
"count = 0\nfor url in img_urls:\n download_path = '{}{}'.format(self.root_path, url[58:])\n if not os.path.exists(download_path):\n response = self.downlo... | <|body_start_0|>
self.root_path = 'D:\\无版权图片下载\\\\'
if not os.path.exists(self.root_path):
os.mkdir(self.root_path)
self.download = htmlDownload()
<|end_body_0|>
<|body_start_1|>
count = 0
for url in img_urls:
download_path = '{}{}'.format(self.root_path,... | 数据输出处理 | dataOutput | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class dataOutput:
"""数据输出处理"""
def __init__(self):
"""创建图片保存路径"""
<|body_0|>
def download_img(self, img_urls):
"""下载图片的函数 :param img_urls: 图片名称,url 对应的列表 :return:"""
<|body_1|>
def progress_bar(self, count, lenth):
"""显示进度条 :return:"""
<|bo... | stack_v2_sparse_classes_36k_train_013017 | 1,463 | permissive | [
{
"docstring": "创建图片保存路径",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "下载图片的函数 :param img_urls: 图片名称,url 对应的列表 :return:",
"name": "download_img",
"signature": "def download_img(self, img_urls)"
},
{
"docstring": "显示进度条 :return:",
"name": "progress... | 3 | null | Implement the Python class `dataOutput` described below.
Class description:
数据输出处理
Method signatures and docstrings:
- def __init__(self): 创建图片保存路径
- def download_img(self, img_urls): 下载图片的函数 :param img_urls: 图片名称,url 对应的列表 :return:
- def progress_bar(self, count, lenth): 显示进度条 :return: | Implement the Python class `dataOutput` described below.
Class description:
数据输出处理
Method signatures and docstrings:
- def __init__(self): 创建图片保存路径
- def download_img(self, img_urls): 下载图片的函数 :param img_urls: 图片名称,url 对应的列表 :return:
- def progress_bar(self, count, lenth): 显示进度条 :return:
<|skeleton|>
class dataOutput... | 91999493b093cff3d9d6f66f6b68ca9384c5ff37 | <|skeleton|>
class dataOutput:
"""数据输出处理"""
def __init__(self):
"""创建图片保存路径"""
<|body_0|>
def download_img(self, img_urls):
"""下载图片的函数 :param img_urls: 图片名称,url 对应的列表 :return:"""
<|body_1|>
def progress_bar(self, count, lenth):
"""显示进度条 :return:"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class dataOutput:
"""数据输出处理"""
def __init__(self):
"""创建图片保存路径"""
self.root_path = 'D:\\无版权图片下载\\\\'
if not os.path.exists(self.root_path):
os.mkdir(self.root_path)
self.download = htmlDownload()
def download_img(self, img_urls):
"""下载图片的函数 :param img_ur... | the_stack_v2_python_sparse | 无版权图下载/dataOutput.py | WangRongsheng/Interesting-python | train | 6 |
b9590dc6d5cbe2c1720c51260df40e6f771b61e9 | [
"if root is None:\n return True\nnode_bounds_stack = [(root, -float('inf'), float('inf'))]\nwhile len(node_bounds_stack):\n node, lb, ub = node_bounds_stack.pop()\n if node.val <= lb or node.val >= ub:\n return False\n if node.left:\n node_bounds_stack.append((node.left, lb, node.val))\n ... | <|body_start_0|>
if root is None:
return True
node_bounds_stack = [(root, -float('inf'), float('inf'))]
while len(node_bounds_stack):
node, lb, ub = node_bounds_stack.pop()
if node.val <= lb or node.val >= ub:
return False
if node.l... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValidBST1(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isValidBST(self, root, lb=-float('inf'), ub=float('inf')):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is ... | stack_v2_sparse_classes_36k_train_013018 | 2,250 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isValidBST1",
"signature": "def isValidBST1(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isValidBST",
"signature": "def isValidBST(self, root, lb=-float('inf'), ub=float('inf'))"
}
] | 2 | stack_v2_sparse_classes_30k_train_007692 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValidBST1(self, root): :type root: TreeNode :rtype: bool
- def isValidBST(self, root, lb=-float('inf'), ub=float('inf')): :type root: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValidBST1(self, root): :type root: TreeNode :rtype: bool
- def isValidBST(self, root, lb=-float('inf'), ub=float('inf')): :type root: TreeNode :rtype: bool
<|skeleton|>
cl... | d181f2075c6c3881772dfbf54df3ac3390936079 | <|skeleton|>
class Solution:
def isValidBST1(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isValidBST(self, root, lb=-float('inf'), ub=float('inf')):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isValidBST1(self, root):
""":type root: TreeNode :rtype: bool"""
if root is None:
return True
node_bounds_stack = [(root, -float('inf'), float('inf'))]
while len(node_bounds_stack):
node, lb, ub = node_bounds_stack.pop()
if node... | the_stack_v2_python_sparse | 98. Validate Binary Search Tree.py | melekoktay/Leetcode-Practice | train | 0 | |
23e5d34c456074a52cc3c183c8f595c6b1dff0b7 | [
"self.data = data\nself.left = None\nself.right = None",
"if not root:\n return\nstack, tree = ([], [])\ncur = root\nwhile stack or cur:\n if cur:\n stack.append(cur)\n cur = cur.left\n else:\n node = stack.pop()\n tree.append(node.data)\n cur = node.right\nreturn tree"... | <|body_start_0|>
self.data = data
self.left = None
self.right = None
<|end_body_0|>
<|body_start_1|>
if not root:
return
stack, tree = ([], [])
cur = root
while stack or cur:
if cur:
stack.append(cur)
cur = ... | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
def __init__(self, data):
"""Initializes Node data attributes."""
<|body_0|>
def inorderIteration(self, root):
"""Performs LNR traversal algorithm iteratively."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.data = data
self.left ... | stack_v2_sparse_classes_36k_train_013019 | 1,144 | no_license | [
{
"docstring": "Initializes Node data attributes.",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "Performs LNR traversal algorithm iteratively.",
"name": "inorderIteration",
"signature": "def inorderIteration(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013348 | Implement the Python class `Node` described below.
Class description:
Implement the Node class.
Method signatures and docstrings:
- def __init__(self, data): Initializes Node data attributes.
- def inorderIteration(self, root): Performs LNR traversal algorithm iteratively. | Implement the Python class `Node` described below.
Class description:
Implement the Node class.
Method signatures and docstrings:
- def __init__(self, data): Initializes Node data attributes.
- def inorderIteration(self, root): Performs LNR traversal algorithm iteratively.
<|skeleton|>
class Node:
def __init__(... | 9ad4b2ab8b6e1bf643534f61fe030ca56b094bde | <|skeleton|>
class Node:
def __init__(self, data):
"""Initializes Node data attributes."""
<|body_0|>
def inorderIteration(self, root):
"""Performs LNR traversal algorithm iteratively."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Node:
def __init__(self, data):
"""Initializes Node data attributes."""
self.data = data
self.left = None
self.right = None
def inorderIteration(self, root):
"""Performs LNR traversal algorithm iteratively."""
if not root:
return
stack, ... | the_stack_v2_python_sparse | trees/tree traversals/inorder_it.py | gabrielleevaristo/algo-practice | train | 0 | |
58663fe800219eb9d707be9cbd98919426a837ec | [
"pre_dp = [0] * 2001\npre_dp[nums[0] + 1000] = 1\npre_dp[-nums[0] + 1000] += 1\nfor index in range(1, len(nums)):\n cur_dp = [0] * 2001\n for sum_ in range(-1000, 1001):\n if pre_dp[sum_ + 1000] > 0:\n cur_dp[sum_ + nums[index] + 1000] += pre_dp[sum_ + 1000]\n cur_dp[sum_ - nums[i... | <|body_start_0|>
pre_dp = [0] * 2001
pre_dp[nums[0] + 1000] = 1
pre_dp[-nums[0] + 1000] += 1
for index in range(1, len(nums)):
cur_dp = [0] * 2001
for sum_ in range(-1000, 1001):
if pre_dp[sum_ + 1000] > 0:
cur_dp[sum_ + nums[in... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums, S):
""":type nums: List[int] :type S: int :rtype: int"""
<|body_0|>
def findTargetSumWays1(self, nums, S):
""":type nums: List[int] :type S: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_013020 | 1,240 | no_license | [
{
"docstring": ":type nums: List[int] :type S: int :rtype: int",
"name": "findTargetSumWays",
"signature": "def findTargetSumWays(self, nums, S)"
},
{
"docstring": ":type nums: List[int] :type S: int :rtype: int",
"name": "findTargetSumWays1",
"signature": "def findTargetSumWays1(self, n... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums, S): :type nums: List[int] :type S: int :rtype: int
- def findTargetSumWays1(self, nums, S): :type nums: List[int] :type S: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTargetSumWays(self, nums, S): :type nums: List[int] :type S: int :rtype: int
- def findTargetSumWays1(self, nums, S): :type nums: List[int] :type S: int :rtype: int
<|sk... | 9d394cd2862703cfb7a7b505b35deda7450a692e | <|skeleton|>
class Solution:
def findTargetSumWays(self, nums, S):
""":type nums: List[int] :type S: int :rtype: int"""
<|body_0|>
def findTargetSumWays1(self, nums, S):
""":type nums: List[int] :type S: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findTargetSumWays(self, nums, S):
""":type nums: List[int] :type S: int :rtype: int"""
pre_dp = [0] * 2001
pre_dp[nums[0] + 1000] = 1
pre_dp[-nums[0] + 1000] += 1
for index in range(1, len(nums)):
cur_dp = [0] * 2001
for sum_ in ran... | the_stack_v2_python_sparse | 494.目标和.py | Ezi4Zy/leetcode | train | 0 | |
39f3a1566a6d5c5a33a4162187c7ddb20ed89971 | [
"super().__init__(coordinator)\nself._attr_device_info = {'identifiers': {(DOMAIN, str(coordinator.gios.station_id))}, 'name': DEFAULT_NAME, 'manufacturer': MANUFACTURER, 'entry_type': 'service'}\nself._attr_name = f'{name} {description.name}'\nself._attr_unique_id = f'{coordinator.gios.station_id}-{description.key... | <|body_start_0|>
super().__init__(coordinator)
self._attr_device_info = {'identifiers': {(DOMAIN, str(coordinator.gios.station_id))}, 'name': DEFAULT_NAME, 'manufacturer': MANUFACTURER, 'entry_type': 'service'}
self._attr_name = f'{name} {description.name}'
self._attr_unique_id = f'{coor... | Define an GIOS sensor. | GiosSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GiosSensor:
"""Define an GIOS sensor."""
def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None:
"""Initialize."""
<|body_0|>
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the state ... | stack_v2_sparse_classes_36k_train_013021 | 4,462 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None"
},
{
"docstring": "Return the state attributes.",
"name": "extra_state_attributes",
"signature": "def e... | 3 | null | Implement the Python class `GiosSensor` described below.
Class description:
Define an GIOS sensor.
Method signatures and docstrings:
- def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: Initialize.
- def extra_state_attributes(self) -> dict[str, An... | Implement the Python class `GiosSensor` described below.
Class description:
Define an GIOS sensor.
Method signatures and docstrings:
- def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None: Initialize.
- def extra_state_attributes(self) -> dict[str, An... | 8de7966104911bca6f855a1755a6d71a07afb9de | <|skeleton|>
class GiosSensor:
"""Define an GIOS sensor."""
def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None:
"""Initialize."""
<|body_0|>
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the state ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GiosSensor:
"""Define an GIOS sensor."""
def __init__(self, name: str, coordinator: GiosDataUpdateCoordinator, description: GiosSensorEntityDescription) -> None:
"""Initialize."""
super().__init__(coordinator)
self._attr_device_info = {'identifiers': {(DOMAIN, str(coordinator.gios... | the_stack_v2_python_sparse | homeassistant/components/gios/sensor.py | AlexxIT/home-assistant | train | 9 |
5aaa1cb065834685c6f079391e64f5080d5d7e95 | [
"self.label = label\nself.statement = statement\nself.asset_id = asset_id\nself.file_type = file_type\nself.data_available = data_available\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nlabel = dictionary.get('label')\nstatement = dictionary.get('statement')\nasse... | <|body_start_0|>
self.label = label
self.statement = statement
self.asset_id = asset_id
self.file_type = file_type
self.data_available = data_available
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label will allow the paystub to go through primary data extra... | StorePayStatementRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StorePayStatementRequest:
"""Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label wil... | stack_v2_sparse_classes_36k_train_013022 | 3,317 | permissive | [
{
"docstring": "Constructor for the StorePayStatementRequest class",
"name": "__init__",
"signature": "def __init__(self, label=None, statement=None, asset_id=None, file_type=None, data_available=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a diction... | 2 | stack_v2_sparse_classes_30k_train_001427 | Implement the Python class `StorePayStatementRequest` described below.
Class description:
Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most rece... | Implement the Python class `StorePayStatementRequest` described below.
Class description:
Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most rece... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class StorePayStatementRequest:
"""Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label wil... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StorePayStatementRequest:
"""Implementation of the 'StorePayStatementRequest' model. TODO: type model description here. Attributes: label (string): The label to be associated with the pay statement. These are recommended labels: lastPayPeriod - The most recent (last) pay statement. This label will allow the p... | the_stack_v2_python_sparse | finicityapi/models/store_pay_statement_request.py | monarchmoney/finicity-python | train | 0 |
481b47115333c043b87d7e3e70909dd6b3018d46 | [
"Parametre.__init__(self, 'annuler', 'cancel')\nself.nom_groupe = 'administrateur'\nself.schema = '(<cle_navire>)'\nself.aide_courte = \"efface les ordres d'un équipage\"\nself.aide_longue = \"Cette commande permet de supprimer tous les ordres en cours d'un équipage. Elle doit être utilisée si un équipage se voit d... | <|body_start_0|>
Parametre.__init__(self, 'annuler', 'cancel')
self.nom_groupe = 'administrateur'
self.schema = '(<cle_navire>)'
self.aide_courte = "efface les ordres d'un équipage"
self.aide_longue = "Cette commande permet de supprimer tous les ordres en cours d'un équipage. Ell... | Commande 'équipage annuler'. | PrmAnnuler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmAnnuler:
"""Commande 'équipage annuler'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parametr... | stack_v2_sparse_classes_36k_train_013023 | 3,656 | permissive | [
{
"docstring": "Constructeur du paramètre",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Interprétation du paramètre",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | null | Implement the Python class `PrmAnnuler` described below.
Class description:
Commande 'équipage annuler'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre | Implement the Python class `PrmAnnuler` described below.
Class description:
Commande 'équipage annuler'.
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre
- def interpreter(self, personnage, dic_masques): Interprétation du paramètre
<|skeleton|>
class PrmAnnuler:
"""Commande 'équi... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmAnnuler:
"""Commande 'équipage annuler'."""
def __init__(self):
"""Constructeur du paramètre"""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Interprétation du paramètre"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmAnnuler:
"""Commande 'équipage annuler'."""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, 'annuler', 'cancel')
self.nom_groupe = 'administrateur'
self.schema = '(<cle_navire>)'
self.aide_courte = "efface les ordres d'un équipage"
... | the_stack_v2_python_sparse | src/secondaires/navigation/commandes/equipage/annuler.py | vincent-lg/tsunami | train | 5 |
db152461c5acf8d66de6e1d0faae0904edb78581 | [
"token = self.oauth2_api.get_access_token(token_id)\nuser = self.identity_api.get_user(token['authorizing_user_id'])\napplication_id = token['consumer_id']\norganizations = self.roles_api.get_authorized_organizations(user, application_id, remove_default_organization=True)\nreturn {'organizations': organizations}",
... | <|body_start_0|>
token = self.oauth2_api.get_access_token(token_id)
user = self.identity_api.get_user(token['authorizing_user_id'])
application_id = token['consumer_id']
organizations = self.roles_api.get_authorized_organizations(user, application_id, remove_default_organization=True)
... | FiwareApiControllerV3 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FiwareApiControllerV3:
def authorized_organizations(self, context, token_id):
"""Returns all the organizations in which the user has a role from the application that got the OAuth2.0 token."""
<|body_0|>
def validate_oauth2_token(self, context, token_id):
"""Return a... | stack_v2_sparse_classes_36k_train_013024 | 21,226 | permissive | [
{
"docstring": "Returns all the organizations in which the user has a role from the application that got the OAuth2.0 token.",
"name": "authorized_organizations",
"signature": "def authorized_organizations(self, context, token_id)"
},
{
"docstring": "Return a list of the roles and permissions of... | 2 | stack_v2_sparse_classes_30k_train_006934 | Implement the Python class `FiwareApiControllerV3` described below.
Class description:
Implement the FiwareApiControllerV3 class.
Method signatures and docstrings:
- def authorized_organizations(self, context, token_id): Returns all the organizations in which the user has a role from the application that got the OAut... | Implement the Python class `FiwareApiControllerV3` described below.
Class description:
Implement the FiwareApiControllerV3 class.
Method signatures and docstrings:
- def authorized_organizations(self, context, token_id): Returns all the organizations in which the user has a role from the application that got the OAut... | 0dfdfcfbc239d55d0669cd32e92b93487939ef84 | <|skeleton|>
class FiwareApiControllerV3:
def authorized_organizations(self, context, token_id):
"""Returns all the organizations in which the user has a role from the application that got the OAuth2.0 token."""
<|body_0|>
def validate_oauth2_token(self, context, token_id):
"""Return a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FiwareApiControllerV3:
def authorized_organizations(self, context, token_id):
"""Returns all the organizations in which the user has a role from the application that got the OAuth2.0 token."""
token = self.oauth2_api.get_access_token(token_id)
user = self.identity_api.get_user(token['a... | the_stack_v2_python_sparse | keystone/contrib/roles/controllers.py | ging/keystone | train | 4 | |
64535387923dab6c9b6dd9b235680647e52ff975 | [
"Thread.__init__(self)\nself.command = command\nself.process = None",
"self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\ntry:\n _stream_output(self.process)\nexcept RuntimeError as e:\n msg = 'Failed to run: %s, %s' % (self.command, str(e))\n raise RuntimeErro... | <|body_start_0|>
Thread.__init__(self)
self.command = command
self.process = None
<|end_body_0|>
<|body_start_1|>
self.process = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
_stream_output(self.process)
except RuntimeErr... | Placeholder docstring. | _HostingContainer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _HostingContainer:
"""Placeholder docstring."""
def __init__(self, command):
"""Creates a new threaded hosting container. Args: command:"""
<|body_0|>
def run(self):
"""Placeholder docstring"""
<|body_1|>
def down(self):
"""Placeholder docstr... | stack_v2_sparse_classes_36k_train_013025 | 43,196 | permissive | [
{
"docstring": "Creates a new threaded hosting container. Args: command:",
"name": "__init__",
"signature": "def __init__(self, command)"
},
{
"docstring": "Placeholder docstring",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Placeholder docstring",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_003713 | Implement the Python class `_HostingContainer` described below.
Class description:
Placeholder docstring.
Method signatures and docstrings:
- def __init__(self, command): Creates a new threaded hosting container. Args: command:
- def run(self): Placeholder docstring
- def down(self): Placeholder docstring | Implement the Python class `_HostingContainer` described below.
Class description:
Placeholder docstring.
Method signatures and docstrings:
- def __init__(self, command): Creates a new threaded hosting container. Args: command:
- def run(self): Placeholder docstring
- def down(self): Placeholder docstring
<|skeleton... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class _HostingContainer:
"""Placeholder docstring."""
def __init__(self, command):
"""Creates a new threaded hosting container. Args: command:"""
<|body_0|>
def run(self):
"""Placeholder docstring"""
<|body_1|>
def down(self):
"""Placeholder docstr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _HostingContainer:
"""Placeholder docstring."""
def __init__(self, command):
"""Creates a new threaded hosting container. Args: command:"""
Thread.__init__(self)
self.command = command
self.process = None
def run(self):
"""Placeholder docstring"""
self... | the_stack_v2_python_sparse | src/sagemaker/local/image.py | aws/sagemaker-python-sdk | train | 2,050 |
7aafc28155784d1966fb2b4a3b65535a81837578 | [
"pointer_a = headA\npointer_b = headB\nseen = set()\nwhile pointer_a is not None:\n seen.add(pointer_a)\n pointer_a = pointer_a.next\nwhile pointer_b is not None:\n if pointer_b in seen:\n return pointer_b\n pointer_b = pointer_b.next\nreturn None",
"pointer_a = headA\npointer_b = headB\nif poi... | <|body_start_0|>
pointer_a = headA
pointer_b = headB
seen = set()
while pointer_a is not None:
seen.add(pointer_a)
pointer_a = pointer_a.next
while pointer_b is not None:
if pointer_b in seen:
return pointer_b
pointe... | https://leetcode-cn.com/problems/intersection-of-two-linked-lists/ | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""https://leetcode-cn.com/problems/intersection-of-two-linked-lists/"""
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
"""哈希表法: https://leetcode-cn.com/problems/intersection-of-two-linked-lists/solution/xiang-jiao-lian-biao-by-leetcode/"""
... | stack_v2_sparse_classes_36k_train_013026 | 4,375 | no_license | [
{
"docstring": "哈希表法: https://leetcode-cn.com/problems/intersection-of-two-linked-lists/solution/xiang-jiao-lian-biao-by-leetcode/",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode"
},
{
"docstring": "解:https://leetcode-cn.... | 2 | stack_v2_sparse_classes_30k_train_002116 | Implement the Python class `Solution` described below.
Class description:
https://leetcode-cn.com/problems/intersection-of-two-linked-lists/
Method signatures and docstrings:
- def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: 哈希表法: https://leetcode-cn.com/problems/intersection-of-two-linke... | Implement the Python class `Solution` described below.
Class description:
https://leetcode-cn.com/problems/intersection-of-two-linked-lists/
Method signatures and docstrings:
- def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: 哈希表法: https://leetcode-cn.com/problems/intersection-of-two-linke... | 3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6 | <|skeleton|>
class Solution:
"""https://leetcode-cn.com/problems/intersection-of-two-linked-lists/"""
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
"""哈希表法: https://leetcode-cn.com/problems/intersection-of-two-linked-lists/solution/xiang-jiao-lian-biao-by-leetcode/"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""https://leetcode-cn.com/problems/intersection-of-two-linked-lists/"""
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
"""哈希表法: https://leetcode-cn.com/problems/intersection-of-two-linked-lists/solution/xiang-jiao-lian-biao-by-leetcode/"""
pointer_... | the_stack_v2_python_sparse | Intersection_of_Two_Linked_Lists_160.py | jay6413682/Leetcode | train | 0 |
648f3500cafc8b435a60cffc50bc4ae1878854fa | [
"end_of_day_position = np.array(end_of_day_position)\ntrade_number = np.array([0] * len(prices))\ntrade_count = 0\nfor row in range(start + 1, len(prices)):\n if end_of_day_position[row] == 0:\n if end_of_day_position[row - 1] == 0:\n trade_number[row] = 0\n else:\n trade_numb... | <|body_start_0|>
end_of_day_position = np.array(end_of_day_position)
trade_number = np.array([0] * len(prices))
trade_count = 0
for row in range(start + 1, len(prices)):
if end_of_day_position[row] == 0:
if end_of_day_position[row - 1] == 0:
... | Calculate trade numbers, prices and combined trade signals | Trades | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Trades:
"""Calculate trade numbers, prices and combined trade signals"""
def trade_numbers(prices, end_of_day_position, start):
"""Calculate the trade numbers Parameters ---------- prices : DataFrame The OHLC data. end_of_day_position : Series The number of units of position held at ... | stack_v2_sparse_classes_36k_train_013027 | 10,558 | permissive | [
{
"docstring": "Calculate the trade numbers Parameters ---------- prices : DataFrame The OHLC data. end_of_day_position : Series The number of units of position held at the end of day. start : Int The first valid row to start calculating trade information from. Returns ------- trade_number : Series Array of tra... | 3 | stack_v2_sparse_classes_30k_train_018858 | Implement the Python class `Trades` described below.
Class description:
Calculate trade numbers, prices and combined trade signals
Method signatures and docstrings:
- def trade_numbers(prices, end_of_day_position, start): Calculate the trade numbers Parameters ---------- prices : DataFrame The OHLC data. end_of_day_p... | Implement the Python class `Trades` described below.
Class description:
Calculate trade numbers, prices and combined trade signals
Method signatures and docstrings:
- def trade_numbers(prices, end_of_day_position, start): Calculate the trade numbers Parameters ---------- prices : DataFrame The OHLC data. end_of_day_p... | caed559fde5da48defa3defc24cba4f49fb88a97 | <|skeleton|>
class Trades:
"""Calculate trade numbers, prices and combined trade signals"""
def trade_numbers(prices, end_of_day_position, start):
"""Calculate the trade numbers Parameters ---------- prices : DataFrame The OHLC data. end_of_day_position : Series The number of units of position held at ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Trades:
"""Calculate trade numbers, prices and combined trade signals"""
def trade_numbers(prices, end_of_day_position, start):
"""Calculate the trade numbers Parameters ---------- prices : DataFrame The OHLC data. end_of_day_position : Series The number of units of position held at the end of da... | the_stack_v2_python_sparse | tradingsystems/trades.py | t3ch9/tradingsystems | train | 0 |
8df6a2c611ec0b231297b531ecb457fded5a8281 | [
"for start in range(0, 101, 20):\n page_url = self.url.format(start)\n yield scrapy.Request(url=page_url, callback=self.parse)",
"html = json.loads(response.text)\nfor one_dict in html:\n item = DoubanItem()\n item['rank'] = one_dict['rank']\n item['title'] = one_dict['title']\n item['score'] = ... | <|body_start_0|>
for start in range(0, 101, 20):
page_url = self.url.format(start)
yield scrapy.Request(url=page_url, callback=self.parse)
<|end_body_0|>
<|body_start_1|>
html = json.loads(response.text)
for one_dict in html:
item = DoubanItem()
i... | DoubanSpider | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DoubanSpider:
def start_requests(self):
"""生成所有要抓取的URL地址,交给调度器入队列"""
<|body_0|>
def parse(self, response):
"""解析提取数据"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for start in range(0, 101, 20):
page_url = self.url.format(start)
... | stack_v2_sparse_classes_36k_train_013028 | 996 | permissive | [
{
"docstring": "生成所有要抓取的URL地址,交给调度器入队列",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "解析提取数据",
"name": "parse",
"signature": "def parse(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015489 | Implement the Python class `DoubanSpider` described below.
Class description:
Implement the DoubanSpider class.
Method signatures and docstrings:
- def start_requests(self): 生成所有要抓取的URL地址,交给调度器入队列
- def parse(self, response): 解析提取数据 | Implement the Python class `DoubanSpider` described below.
Class description:
Implement the DoubanSpider class.
Method signatures and docstrings:
- def start_requests(self): 生成所有要抓取的URL地址,交给调度器入队列
- def parse(self, response): 解析提取数据
<|skeleton|>
class DoubanSpider:
def start_requests(self):
"""生成所有要抓取的U... | abe983ddc52690f4726cf42cc6390cba815026d8 | <|skeleton|>
class DoubanSpider:
def start_requests(self):
"""生成所有要抓取的URL地址,交给调度器入队列"""
<|body_0|>
def parse(self, response):
"""解析提取数据"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DoubanSpider:
def start_requests(self):
"""生成所有要抓取的URL地址,交给调度器入队列"""
for start in range(0, 101, 20):
page_url = self.url.format(start)
yield scrapy.Request(url=page_url, callback=self.parse)
def parse(self, response):
"""解析提取数据"""
html = json.loads(... | the_stack_v2_python_sparse | month05/spider/day07_course/day07_code/Douban/Douban/spiders/douban.py | chaofan-zheng/tedu-python-demo | train | 4 | |
4e4369a646698128a210a6d2d696b7fdf9769459 | [
"params = dict(output='extend', history=self.value_type.val, itemids=self.id, limit=limit, sortfield='clock', sortorder='DESC')\nif ts_from:\n params['time_from'] = ts_from.strftime('%s')\nif ts_to:\n params['time_till'] = ts_to.strftime('%s')\nreturn [(i['clock'], self._typed_value(i['value'])) for i in self... | <|body_start_0|>
params = dict(output='extend', history=self.value_type.val, itemids=self.id, limit=limit, sortfield='clock', sortorder='DESC')
if ts_from:
params['time_from'] = ts_from.strftime('%s')
if ts_to:
params['time_till'] = ts_to.strftime('%s')
return [(i... | https://www.xibbaz.com/documentation/3.4/manual/api/reference/item/object | Item | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Item:
"""https://www.xibbaz.com/documentation/3.4/manual/api/reference/item/object"""
def history(self, ts_from=None, ts_to=None, limit=10):
"""`(ts, val)` for latest `limit` from `ts_from` until `ts_to`."""
<|body_0|>
def _typed_value(self, val):
"""Return `val`... | stack_v2_sparse_classes_36k_train_013029 | 9,815 | permissive | [
{
"docstring": "`(ts, val)` for latest `limit` from `ts_from` until `ts_to`.",
"name": "history",
"signature": "def history(self, ts_from=None, ts_to=None, limit=10)"
},
{
"docstring": "Return `val` with proper type based on this Item's `value_type`.",
"name": "_typed_value",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_012809 | Implement the Python class `Item` described below.
Class description:
https://www.xibbaz.com/documentation/3.4/manual/api/reference/item/object
Method signatures and docstrings:
- def history(self, ts_from=None, ts_to=None, limit=10): `(ts, val)` for latest `limit` from `ts_from` until `ts_to`.
- def _typed_value(sel... | Implement the Python class `Item` described below.
Class description:
https://www.xibbaz.com/documentation/3.4/manual/api/reference/item/object
Method signatures and docstrings:
- def history(self, ts_from=None, ts_to=None, limit=10): `(ts, val)` for latest `limit` from `ts_from` until `ts_to`.
- def _typed_value(sel... | 5c245ee516dcd7e6dbffac364c6a434bd13a69a4 | <|skeleton|>
class Item:
"""https://www.xibbaz.com/documentation/3.4/manual/api/reference/item/object"""
def history(self, ts_from=None, ts_to=None, limit=10):
"""`(ts, val)` for latest `limit` from `ts_from` until `ts_to`."""
<|body_0|>
def _typed_value(self, val):
"""Return `val`... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Item:
"""https://www.xibbaz.com/documentation/3.4/manual/api/reference/item/object"""
def history(self, ts_from=None, ts_to=None, limit=10):
"""`(ts, val)` for latest `limit` from `ts_from` until `ts_to`."""
params = dict(output='extend', history=self.value_type.val, itemids=self.id, limi... | the_stack_v2_python_sparse | xibbaz/objects/item.py | erik-stephens/xibbaz | train | 1 |
c5aa9c70754851c5259b7b9aeb8d1a06c538fa17 | [
"self._dataset = dataset\nself._split_name = split_name\nself._is_training = is_training\nself._model_variant = model_variant\nself._num_readers = 8\nself._num_threads = 64",
"data_provider = dataset_data_provider.DatasetDataProvider(self._dataset, num_readers=self._num_readers, shuffle=self._is_training, num_epo... | <|body_start_0|>
self._dataset = dataset
self._split_name = split_name
self._is_training = is_training
self._model_variant = model_variant
self._num_readers = 8
self._num_threads = 64
<|end_body_0|>
<|body_start_1|>
data_provider = dataset_data_provider.DatasetDa... | Prepares data for TPUEstimator. | InputReader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InputReader:
"""Prepares data for TPUEstimator."""
def __init__(self, dataset, split_name, is_training, model_variant):
"""Initializes slim Dataset etc. Args: dataset: slim Dataset. split_name: String, the name of train/eval/test split. is_training: Boolean, whether the data is used ... | stack_v2_sparse_classes_36k_train_013030 | 4,902 | permissive | [
{
"docstring": "Initializes slim Dataset etc. Args: dataset: slim Dataset. split_name: String, the name of train/eval/test split. is_training: Boolean, whether the data is used for training. model_variant: String, model variant for choosing how to mean-subtract the images.",
"name": "__init__",
"signatu... | 2 | stack_v2_sparse_classes_30k_val_000372 | Implement the Python class `InputReader` described below.
Class description:
Prepares data for TPUEstimator.
Method signatures and docstrings:
- def __init__(self, dataset, split_name, is_training, model_variant): Initializes slim Dataset etc. Args: dataset: slim Dataset. split_name: String, the name of train/eval/te... | Implement the Python class `InputReader` described below.
Class description:
Prepares data for TPUEstimator.
Method signatures and docstrings:
- def __init__(self, dataset, split_name, is_training, model_variant): Initializes slim Dataset etc. Args: dataset: slim Dataset. split_name: String, the name of train/eval/te... | 0f7adb97a93ec3e3485c261d030c507eb16b33e4 | <|skeleton|>
class InputReader:
"""Prepares data for TPUEstimator."""
def __init__(self, dataset, split_name, is_training, model_variant):
"""Initializes slim Dataset etc. Args: dataset: slim Dataset. split_name: String, the name of train/eval/test split. is_training: Boolean, whether the data is used ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InputReader:
"""Prepares data for TPUEstimator."""
def __init__(self, dataset, split_name, is_training, model_variant):
"""Initializes slim Dataset etc. Args: dataset: slim Dataset. split_name: String, the name of train/eval/test split. is_training: Boolean, whether the data is used for training.... | the_stack_v2_python_sparse | models/experimental/deeplab/data_pipeline.py | tensorflow/tpu | train | 5,627 |
9072795a2b2f7eb3656dbc4887a75a79b5ea0ac8 | [
"if not os.path.exists(DIRECTORY):\n os.mkdir(DIRECTORY)\nchangelog = requests.get('%s/latest/changelog' % URL)\ndates = [line for line in changelog.text.splitlines() if re.match('\\\\d{4}\\\\-\\\\d{2}\\\\-\\\\d{2}', line)]\ndates = sorted(dates)\nif maxdate:\n maxdate = datetime.strptime(maxdate, '%Y-%m-%d')... | <|body_start_0|>
if not os.path.exists(DIRECTORY):
os.mkdir(DIRECTORY)
changelog = requests.get('%s/latest/changelog' % URL)
dates = [line for line in changelog.text.splitlines() if re.match('\\d{4}\\-\\d{2}\\-\\d{2}', line)]
dates = sorted(dates)
if maxdate:
... | Transforms a list of metadata files into an entry-dates.csv file. | Entry | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Entry:
"""Transforms a list of metadata files into an entry-dates.csv file."""
def download(maxdate):
"""Downloads metadata files for the last day along with monthly versions. This method can filter to a view of entry dates for a specific day by setting the maxdate parameter. Args: m... | stack_v2_sparse_classes_36k_train_013031 | 4,145 | permissive | [
{
"docstring": "Downloads metadata files for the last day along with monthly versions. This method can filter to a view of entry dates for a specific day by setting the maxdate parameter. Args: maxdate: limits the max date to pull, if none pulls latest, can be used to pull entry dates at the time of a specific ... | 2 | stack_v2_sparse_classes_30k_train_018205 | Implement the Python class `Entry` described below.
Class description:
Transforms a list of metadata files into an entry-dates.csv file.
Method signatures and docstrings:
- def download(maxdate): Downloads metadata files for the last day along with monthly versions. This method can filter to a view of entry dates for... | Implement the Python class `Entry` described below.
Class description:
Transforms a list of metadata files into an entry-dates.csv file.
Method signatures and docstrings:
- def download(maxdate): Downloads metadata files for the last day along with monthly versions. This method can filter to a view of entry dates for... | 5b2737db07c88d0249c9768b67e6fa8eb344eb6d | <|skeleton|>
class Entry:
"""Transforms a list of metadata files into an entry-dates.csv file."""
def download(maxdate):
"""Downloads metadata files for the last day along with monthly versions. This method can filter to a view of entry dates for a specific day by setting the maxdate parameter. Args: m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Entry:
"""Transforms a list of metadata files into an entry-dates.csv file."""
def download(maxdate):
"""Downloads metadata files for the last day along with monthly versions. This method can filter to a view of entry dates for a specific day by setting the maxdate parameter. Args: maxdate: limit... | the_stack_v2_python_sparse | src/python/paperetl/cord19/entry.py | anilktechie/paperetl | train | 0 |
04164599d53bdbebca30700f26d746cfa9a95deb | [
"l = len(xy)\nif l != 3:\n s = '\\nxy: [(x0, y0), (x0+n_col*sp_col, y_0), (x_0, y0+n_row*sp_row)]'\n if l > 3:\n s = 'too many points provided' + s\n else:\n s = 'not enough points provided' + s\n raise Exception(s)\nself.sname = sname\nself.colrow = [n_col, n_row]\ntemp_xy = []\nfor point... | <|body_start_0|>
l = len(xy)
if l != 3:
s = '\nxy: [(x0, y0), (x0+n_col*sp_col, y_0), (x_0, y0+n_row*sp_row)]'
if l > 3:
s = 'too many points provided' + s
else:
s = 'not enough points provided' + s
raise Exception(s)
... | InstanceArray object for GDSIO | InstanceArray | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstanceArray:
"""InstanceArray object for GDSIO"""
def __init__(self, sname, n_col, n_row, xy, transform='R0'):
"""Initialize Instance Array object Parameters ---------- sname : str InstanceArray name n_col: int Number of columns n_row : int Number of rows xy : array xy coordinates ... | stack_v2_sparse_classes_36k_train_013032 | 18,791 | permissive | [
{
"docstring": "Initialize Instance Array object Parameters ---------- sname : str InstanceArray name n_col: int Number of columns n_row : int Number of rows xy : array xy coordinates for InstanceArray Object, should be organized as: [(x0, y0), (x0+n_col*sp_col, y_0), (x_0, y0+n_row*sp_row)] transform : str Tra... | 2 | null | Implement the Python class `InstanceArray` described below.
Class description:
InstanceArray object for GDSIO
Method signatures and docstrings:
- def __init__(self, sname, n_col, n_row, xy, transform='R0'): Initialize Instance Array object Parameters ---------- sname : str InstanceArray name n_col: int Number of colu... | Implement the Python class `InstanceArray` described below.
Class description:
InstanceArray object for GDSIO
Method signatures and docstrings:
- def __init__(self, sname, n_col, n_row, xy, transform='R0'): Initialize Instance Array object Parameters ---------- sname : str InstanceArray name n_col: int Number of colu... | 8f62ec1971480cb27cb592421fd97f590379cff9 | <|skeleton|>
class InstanceArray:
"""InstanceArray object for GDSIO"""
def __init__(self, sname, n_col, n_row, xy, transform='R0'):
"""Initialize Instance Array object Parameters ---------- sname : str InstanceArray name n_col: int Number of columns n_row : int Number of rows xy : array xy coordinates ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InstanceArray:
"""InstanceArray object for GDSIO"""
def __init__(self, sname, n_col, n_row, xy, transform='R0'):
"""Initialize Instance Array object Parameters ---------- sname : str InstanceArray name n_col: int Number of columns n_row : int Number of rows xy : array xy coordinates for InstanceA... | the_stack_v2_python_sparse | GDSIO.py | ucb-art/laygo | train | 24 |
4e51e781d90ddbe6c34db7dab7d79e64fe40cf8e | [
"explicit = copy(kwargs)\nwith_operator = {}\nfor key, value in kwargs.items():\n if '__' not in key:\n continue\n elif key.startswith('__') or key.endswith('__'):\n continue\n replacement = key.replace('__', '.')\n potential_operator = replacement[replacement.rfind('.') + 1:]\n if pote... | <|body_start_0|>
explicit = copy(kwargs)
with_operator = {}
for key, value in kwargs.items():
if '__' not in key:
continue
elif key.startswith('__') or key.endswith('__'):
continue
replacement = key.replace('__', '.')
... | CustomQuery | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomQuery:
def _convert_names_with_underlines_to_dots(cls, **kwargs):
"""Проверяем обращение к полям объекта с помощью __ в словаре"""
<|body_0|>
def filter_by(self, **kwargs):
"""Overload of standard function"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_013033 | 1,649 | no_license | [
{
"docstring": "Проверяем обращение к полям объекта с помощью __ в словаре",
"name": "_convert_names_with_underlines_to_dots",
"signature": "def _convert_names_with_underlines_to_dots(cls, **kwargs)"
},
{
"docstring": "Overload of standard function",
"name": "filter_by",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_011324 | Implement the Python class `CustomQuery` described below.
Class description:
Implement the CustomQuery class.
Method signatures and docstrings:
- def _convert_names_with_underlines_to_dots(cls, **kwargs): Проверяем обращение к полям объекта с помощью __ в словаре
- def filter_by(self, **kwargs): Overload of standard ... | Implement the Python class `CustomQuery` described below.
Class description:
Implement the CustomQuery class.
Method signatures and docstrings:
- def _convert_names_with_underlines_to_dots(cls, **kwargs): Проверяем обращение к полям объекта с помощью __ в словаре
- def filter_by(self, **kwargs): Overload of standard ... | 47fa74182db770aa93e2e554b2c9477f324506ec | <|skeleton|>
class CustomQuery:
def _convert_names_with_underlines_to_dots(cls, **kwargs):
"""Проверяем обращение к полям объекта с помощью __ в словаре"""
<|body_0|>
def filter_by(self, **kwargs):
"""Overload of standard function"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CustomQuery:
def _convert_names_with_underlines_to_dots(cls, **kwargs):
"""Проверяем обращение к полям объекта с помощью __ в словаре"""
explicit = copy(kwargs)
with_operator = {}
for key, value in kwargs.items():
if '__' not in key:
continue
... | the_stack_v2_python_sparse | snuff_utils/sqlalchemy_extras/custom_query.py | egorgvo/utils | train | 0 | |
d96da2272bf09122951c566ed4b921391d2c1901 | [
"super(ZipEncFile, self).__init__(pathname, 'rb')\nself.compressor = bz2.BZ2Compressor()\nself.encryptor = Encryptor.new(key)\nself.buffer = buffer_size",
"if read_length is None:\n read_length = self.buffer_size\ndata = super(ZipEncFile, self).read(read_length)\ngot_length = len(data)\ndata = self.compressor.... | <|body_start_0|>
super(ZipEncFile, self).__init__(pathname, 'rb')
self.compressor = bz2.BZ2Compressor()
self.encryptor = Encryptor.new(key)
self.buffer = buffer_size
<|end_body_0|>
<|body_start_1|>
if read_length is None:
read_length = self.buffer_size
data =... | A generator for the zipped encrypted file | ZipEncFile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZipEncFile:
"""A generator for the zipped encrypted file"""
def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH):
"""Initalizes the file object"""
<|body_0|>
def read(read_length=None):
"""Gets the next chunk of zipped, encrypted data."""
... | stack_v2_sparse_classes_36k_train_013034 | 1,879 | no_license | [
{
"docstring": "Initalizes the file object",
"name": "__init__",
"signature": "def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH)"
},
{
"docstring": "Gets the next chunk of zipped, encrypted data.",
"name": "read",
"signature": "def read(read_length=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007760 | Implement the Python class `ZipEncFile` described below.
Class description:
A generator for the zipped encrypted file
Method signatures and docstrings:
- def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH): Initalizes the file object
- def read(read_length=None): Gets the next chunk of zipped, encryp... | Implement the Python class `ZipEncFile` described below.
Class description:
A generator for the zipped encrypted file
Method signatures and docstrings:
- def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH): Initalizes the file object
- def read(read_length=None): Gets the next chunk of zipped, encryp... | a3da159883f205eec6e1af586ecbcc75187250f6 | <|skeleton|>
class ZipEncFile:
"""A generator for the zipped encrypted file"""
def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH):
"""Initalizes the file object"""
<|body_0|>
def read(read_length=None):
"""Gets the next chunk of zipped, encrypted data."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZipEncFile:
"""A generator for the zipped encrypted file"""
def __init__(self, pathname, key, buffer_size=DEFAULT_BUFFER_LENGTH):
"""Initalizes the file object"""
super(ZipEncFile, self).__init__(pathname, 'rb')
self.compressor = bz2.BZ2Compressor()
self.encryptor = Encryp... | the_stack_v2_python_sparse | python/rdes.py | DanielCasner/scripts | train | 1 |
0fb98998ddaeef5c4bbfdb856d3133c142f8a643 | [
"pk = kwargs.get('pk')\nobject = self.model.objects.filter(id=pk).first()\nif check_can_edit(object.qapp_approval.qapp, request.user):\n return render(request, self.template_name, {'object': object, 'form': self.form_class(instance=object), 'qapp_id': object.qapp_approval.qapp.id})\nreason = 'You cannot edit thi... | <|body_start_0|>
pk = kwargs.get('pk')
object = self.model.objects.filter(id=pk).first()
if check_can_edit(object.qapp_approval.qapp, request.user):
return render(request, self.template_name, {'object': object, 'form': self.form_class(instance=object), 'qapp_id': object.qapp_approval... | Class view for editing approval signatures. | ProjectApprovalSignatureEdit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectApprovalSignatureEdit:
"""Class view for editing approval signatures."""
def get(self, request, *args, **kwargs):
"""Override default GET request. Verify the user has edit privileges, either through super status or team membership."""
<|body_0|>
def post(self, req... | stack_v2_sparse_classes_36k_train_013035 | 36,787 | no_license | [
{
"docstring": "Override default GET request. Verify the user has edit privileges, either through super status or team membership.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Process the post request with a modified Existing Data form.",
"name":... | 2 | null | Implement the Python class `ProjectApprovalSignatureEdit` described below.
Class description:
Class view for editing approval signatures.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override default GET request. Verify the user has edit privileges, either through super status or team ... | Implement the Python class `ProjectApprovalSignatureEdit` described below.
Class description:
Class view for editing approval signatures.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override default GET request. Verify the user has edit privileges, either through super status or team ... | ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4 | <|skeleton|>
class ProjectApprovalSignatureEdit:
"""Class view for editing approval signatures."""
def get(self, request, *args, **kwargs):
"""Override default GET request. Verify the user has edit privileges, either through super status or team membership."""
<|body_0|>
def post(self, req... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectApprovalSignatureEdit:
"""Class view for editing approval signatures."""
def get(self, request, *args, **kwargs):
"""Override default GET request. Verify the user has edit privileges, either through super status or team membership."""
pk = kwargs.get('pk')
object = self.mod... | the_stack_v2_python_sparse | DataSearch/qar5/views.py | USEPA/FoodWaste | train | 1 |
041ce29749a553e3bd891766a0dc099afab7a515 | [
"jobs = self.jobs.filter(Job.type == Job.LONG).order_by(Job.end_time.desc())\nif jobs.count:\n return jobs.first()\nelse:\n return None",
"import datetime\nif not start_time:\n start_time = datetime.datetime.now()\nlast_long = self.last_long_job\njob = Job(host=self, start_time=start_time, file_path=path... | <|body_start_0|>
jobs = self.jobs.filter(Job.type == Job.LONG).order_by(Job.end_time.desc())
if jobs.count:
return jobs.first()
else:
return None
<|end_body_0|>
<|body_start_1|>
import datetime
if not start_time:
start_time = datetime.datetime... | This is the ORM mapping for the hosts table | Host | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Host:
"""This is the ORM mapping for the hosts table"""
def last_long_job(self):
"""Get the last long job"""
<|body_0|>
def new_job(self, start_time=None, path=''):
"""Create a job instance with correct parameters and return it"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_013036 | 1,624 | permissive | [
{
"docstring": "Get the last long job",
"name": "last_long_job",
"signature": "def last_long_job(self)"
},
{
"docstring": "Create a job instance with correct parameters and return it",
"name": "new_job",
"signature": "def new_job(self, start_time=None, path='')"
}
] | 2 | stack_v2_sparse_classes_30k_train_016971 | Implement the Python class `Host` described below.
Class description:
This is the ORM mapping for the hosts table
Method signatures and docstrings:
- def last_long_job(self): Get the last long job
- def new_job(self, start_time=None, path=''): Create a job instance with correct parameters and return it | Implement the Python class `Host` described below.
Class description:
This is the ORM mapping for the hosts table
Method signatures and docstrings:
- def last_long_job(self): Get the last long job
- def new_job(self, start_time=None, path=''): Create a job instance with correct parameters and return it
<|skeleton|>
... | 4db506369a0b3cac587f5a60e2ac18d16829f28e | <|skeleton|>
class Host:
"""This is the ORM mapping for the hosts table"""
def last_long_job(self):
"""Get the last long job"""
<|body_0|>
def new_job(self, start_time=None, path=''):
"""Create a job instance with correct parameters and return it"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Host:
"""This is the ORM mapping for the hosts table"""
def last_long_job(self):
"""Get the last long job"""
jobs = self.jobs.filter(Job.type == Job.LONG).order_by(Job.end_time.desc())
if jobs.count:
return jobs.first()
else:
return None
def ne... | the_stack_v2_python_sparse | suprabackup/models/host.py | quanta-computing/suprabackup | train | 0 |
1bb69a91efb77ee151f70f2ba35860b4a4cbaaea | [
"def always_true_indicator(_):\n return True\nos_walk_input_iter = (('a1', ['b1'], ['c1', 'd1']), ('a2', ['b2'], ['c2', 'd2']), ('a3', ['b3'], ['c3', 'd3']))\nfilter_fcn = da.lwc.search._dirname_filter(os_walk_input_iter, always_true_indicator)\nassert tuple(filter_fcn) == os_walk_input_iter",
"def always_true... | <|body_start_0|>
def always_true_indicator(_):
return True
os_walk_input_iter = (('a1', ['b1'], ['c1', 'd1']), ('a2', ['b2'], ['c2', 'd2']), ('a3', ['b3'], ['c3', 'd3']))
filter_fcn = da.lwc.search._dirname_filter(os_walk_input_iter, always_true_indicator)
assert tuple(filter... | Specify the da.lwc.search._dirname_filter function. | Specify_DirnameFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Specify_DirnameFilter:
"""Specify the da.lwc.search._dirname_filter function."""
def it_all_items_passed_through_filter_that_is_always_true(self):
"""Test that an always-true filter function passes all items."""
<|body_0|>
def it_more_than_one_item_passed_through_when_fi... | stack_v2_sparse_classes_36k_train_013037 | 29,518 | permissive | [
{
"docstring": "Test that an always-true filter function passes all items.",
"name": "it_all_items_passed_through_filter_that_is_always_true",
"signature": "def it_all_items_passed_through_filter_that_is_always_true(self)"
},
{
"docstring": "Test that an always-true filter function passes at lea... | 3 | null | Implement the Python class `Specify_DirnameFilter` described below.
Class description:
Specify the da.lwc.search._dirname_filter function.
Method signatures and docstrings:
- def it_all_items_passed_through_filter_that_is_always_true(self): Test that an always-true filter function passes all items.
- def it_more_than... | Implement the Python class `Specify_DirnameFilter` described below.
Class description:
Specify the da.lwc.search._dirname_filter function.
Method signatures and docstrings:
- def it_all_items_passed_through_filter_that_is_always_true(self): Test that an always-true filter function passes all items.
- def it_more_than... | 04a13be2792323e3f9fdb83fd236a8e9cfe6aa2d | <|skeleton|>
class Specify_DirnameFilter:
"""Specify the da.lwc.search._dirname_filter function."""
def it_all_items_passed_through_filter_that_is_always_true(self):
"""Test that an always-true filter function passes all items."""
<|body_0|>
def it_more_than_one_item_passed_through_when_fi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Specify_DirnameFilter:
"""Specify the da.lwc.search._dirname_filter function."""
def it_all_items_passed_through_filter_that_is_always_true(self):
"""Test that an always-true filter function passes all items."""
def always_true_indicator(_):
return True
os_walk_input_i... | the_stack_v2_python_sparse | a3_src/h70_internal/da/lwc/spec/spec_search.py | wtpayne/hiai | train | 5 |
76e85f1a3fb51f6362cef62f11ef2349da7e3f48 | [
"if not matrix or not matrix[0]:\n self.M = None\n return\nm, n = (len(matrix), len(matrix[0]))\nself.M = [[0] * n for _ in range(m)]\nfor r in range(m):\n self.M[r][0] = (self.M[r - 1][0] if r > 0 else 0) + matrix[r][0]\n for c in range(1, n):\n self.M[r][c] = self.M[r][c - 1] + (self.M[r - 1][c... | <|body_start_0|>
if not matrix or not matrix[0]:
self.M = None
return
m, n = (len(matrix), len(matrix[0]))
self.M = [[0] * n for _ in range(m)]
for r in range(m):
self.M[r][0] = (self.M[r - 1][0] if r > 0 else 0) + matrix[r][0]
for c in ran... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_013038 | 1,162 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int",
"name": "sumRegion",
"signature": "def sumRegion(self, row1, col1, row2, col2)"
... | 2 | null | 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 sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | 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 sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | 43a5e436b6ec8950c6952554329ae0314430afea | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
if not matrix or not matrix[0]:
self.M = None
return
m, n = (len(matrix), len(matrix[0]))
self.M = [[0] * n for _ in range(m)]
for r in range(m):
self.M[r][0] ... | the_stack_v2_python_sparse | problems/range_sum_query_2d_-_immutable/solution.py | dengl11/Leetcode | train | 0 | |
d1ed43bab6171c876b2ad9ef9db834ab8f9026d5 | [
"query = User.Q\nif 'status' in where.keys():\n query = query.filter(User.status == where['status'])\nelse:\n query = query.filter(User.status != -1)\npagelist_obj = query.paginate(page=page, per_page=per_page)\nreturn pagelist_obj",
"if not id:\n raise JsonError('ID不能为空')\nobj = User.Q.filter(User.id ==... | <|body_start_0|>
query = User.Q
if 'status' in where.keys():
query = query.filter(User.status == where['status'])
else:
query = query.filter(User.status != -1)
pagelist_obj = query.paginate(page=page, per_page=per_page)
return pagelist_obj
<|end_body_0|>
... | UserService | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserService:
def page_list(where, page, per_page):
"""列表记录 Arguments: where dict -- 查询条件 page int -- 当前页 per_page int -- 每页记录数 return: Paginate 对象 | None"""
<|body_0|>
def get(id):
"""获取单条记录 [description] Arguments: id int -- 主键 return: User Model 实例 | None"""
... | stack_v2_sparse_classes_36k_train_013039 | 2,701 | permissive | [
{
"docstring": "列表记录 Arguments: where dict -- 查询条件 page int -- 当前页 per_page int -- 每页记录数 return: Paginate 对象 | None",
"name": "page_list",
"signature": "def page_list(where, page, per_page)"
},
{
"docstring": "获取单条记录 [description] Arguments: id int -- 主键 return: User Model 实例 | None",
"name"... | 4 | stack_v2_sparse_classes_30k_train_009960 | Implement the Python class `UserService` described below.
Class description:
Implement the UserService class.
Method signatures and docstrings:
- def page_list(where, page, per_page): 列表记录 Arguments: where dict -- 查询条件 page int -- 当前页 per_page int -- 每页记录数 return: Paginate 对象 | None
- def get(id): 获取单条记录 [description... | Implement the Python class `UserService` described below.
Class description:
Implement the UserService class.
Method signatures and docstrings:
- def page_list(where, page, per_page): 列表记录 Arguments: where dict -- 查询条件 page int -- 当前页 per_page int -- 每页记录数 return: Paginate 对象 | None
- def get(id): 获取单条记录 [description... | 3300561c5686b674197ffc097cf781a931fd4787 | <|skeleton|>
class UserService:
def page_list(where, page, per_page):
"""列表记录 Arguments: where dict -- 查询条件 page int -- 当前页 per_page int -- 每页记录数 return: Paginate 对象 | None"""
<|body_0|>
def get(id):
"""获取单条记录 [description] Arguments: id int -- 主键 return: User Model 实例 | None"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserService:
def page_list(where, page, per_page):
"""列表记录 Arguments: where dict -- 查询条件 page int -- 当前页 per_page int -- 每页记录数 return: Paginate 对象 | None"""
query = User.Q
if 'status' in where.keys():
query = query.filter(User.status == where['status'])
else:
... | the_stack_v2_python_sparse | applications/admin/services/user.py | leeyisoft/py_admin | train | 17 | |
6e5bcd01ff8181a7a44fd225fa2039a2cc227653 | [
"sign = -1 if x < 0 else 1\nresult = str(abs(x))[::-1].lstrip('0')\nnum_result = int(result) if result else 0\nif num_result < self.MIN_INT or num_result > self.MAX_INT:\n num_result = 0\nreturn sign * num_result",
"from math import log10\n\ndef num_of_digits(num):\n return int(log10(num) + 1)\nif not x:\n ... | <|body_start_0|>
sign = -1 if x < 0 else 1
result = str(abs(x))[::-1].lstrip('0')
num_result = int(result) if result else 0
if num_result < self.MIN_INT or num_result > self.MAX_INT:
num_result = 0
return sign * num_result
<|end_body_0|>
<|body_start_1|>
from... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverse(self, x):
""":type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer."""
<|body_0|>
def reverse_math(self, x):... | stack_v2_sparse_classes_36k_train_013040 | 2,087 | no_license | [
{
"docstring": ":type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer.",
"name": "reverse",
"signature": "def reverse(self, x)"
},
{
"docstring": ":typ... | 2 | stack_v2_sparse_classes_30k_train_009885 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse(self, x): :type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Pyt... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverse(self, x): :type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Pyt... | 6e09d1bfe9eb7476125eb31d95616a115f2e6f7f | <|skeleton|>
class Solution:
def reverse(self, x):
""":type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer."""
<|body_0|>
def reverse_math(self, x):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def reverse(self, x):
""":type x: int :rtype: int Runtime: 24 ms, faster than 100.00% of Python online submissions for Reverse Integer. Memory Usage: 11.7 MB, less than 5.56% of Python online submissions for Reverse Integer."""
sign = -1 if x < 0 else 1
result = str(abs(x))[:... | the_stack_v2_python_sparse | reverse_integer.py | benjiaming/leetcode | train | 0 | |
aad62825532a836d6d44737d1c884e266b10396c | [
"Extractor.__init__(self, input_type=InputType.TEXT, category='dictionary', name=extractor_name)\nif case_sensitive and (not strip_key):\n self._decoding_dict = decoding_dict\nelse:\n new_dict = {}\n if not strip_key:\n for k in decoding_dict:\n new_dict[k.lower()] = decoding_dict[k]\n ... | <|body_start_0|>
Extractor.__init__(self, input_type=InputType.TEXT, category='dictionary', name=extractor_name)
if case_sensitive and (not strip_key):
self._decoding_dict = decoding_dict
else:
new_dict = {}
if not strip_key:
for k in decoding_... | **Description** This class takes a 'decoding_dict' as reference, decoding the input text based on the 'decoding_dict' Examples: :: decoding_dict = { 'CA': 'California', 'ny': 'New York', 'AZ': ' Arizona', ' TX ': 'Texas', ' fl': 'Florida', } decoding_value_extractor = DecodingValueExtractor(decoding_dict=decoding_dict,... | DecodingValueExtractor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DecodingValueExtractor:
"""**Description** This class takes a 'decoding_dict' as reference, decoding the input text based on the 'decoding_dict' Examples: :: decoding_dict = { 'CA': 'California', 'ny': 'New York', 'AZ': ' Arizona', ' TX ': 'Texas', ' fl': 'Florida', } decoding_value_extractor = D... | stack_v2_sparse_classes_36k_train_013041 | 4,224 | permissive | [
{
"docstring": "Args: decoding_dict: dict -> a python dictionary for decoding values extractor_name: str -> extractor name default_action: enum['delete'] -> what if the value not matched in dictionary case_sensitive: bool -> matching the key and value strictly or ignore cases strip_key: bool -> strip key and va... | 3 | stack_v2_sparse_classes_30k_train_016857 | Implement the Python class `DecodingValueExtractor` described below.
Class description:
**Description** This class takes a 'decoding_dict' as reference, decoding the input text based on the 'decoding_dict' Examples: :: decoding_dict = { 'CA': 'California', 'ny': 'New York', 'AZ': ' Arizona', ' TX ': 'Texas', ' fl': 'F... | Implement the Python class `DecodingValueExtractor` described below.
Class description:
**Description** This class takes a 'decoding_dict' as reference, decoding the input text based on the 'decoding_dict' Examples: :: decoding_dict = { 'CA': 'California', 'ny': 'New York', 'AZ': ' Arizona', ' TX ': 'Texas', ' fl': 'F... | 2084003ae70acc9b6751ddadc29db935c95a0a52 | <|skeleton|>
class DecodingValueExtractor:
"""**Description** This class takes a 'decoding_dict' as reference, decoding the input text based on the 'decoding_dict' Examples: :: decoding_dict = { 'CA': 'California', 'ny': 'New York', 'AZ': ' Arizona', ' TX ': 'Texas', ' fl': 'Florida', } decoding_value_extractor = D... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DecodingValueExtractor:
"""**Description** This class takes a 'decoding_dict' as reference, decoding the input text based on the 'decoding_dict' Examples: :: decoding_dict = { 'CA': 'California', 'ny': 'New York', 'AZ': ' Arizona', ' TX ': 'Texas', ' fl': 'Florida', } decoding_value_extractor = DecodingValueE... | the_stack_v2_python_sparse | etk/extractors/decoding_value_extractor.py | usc-isi-i2/etk | train | 82 |
e4737ac29219b4899a51c6d71edfc5c9ada48583 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('alyu_sharontj', 'alyu_sharontj')\nurl = 'http://datamechanics.io/data/alyu_sharontj/boston_taz.json'\nresponse = urllib.request.urlopen(url).read().decode('utf-8')\nr = json.loads(response)\ns = json.dum... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('alyu_sharontj', 'alyu_sharontj')
url = 'http://datamechanics.io/data/alyu_sharontj/boston_taz.json'
response = urllib.request.urlopen(url).read().... | TrafficMovement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrafficMovement:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everythi... | stack_v2_sparse_classes_36k_train_013042 | 3,529 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_003114 | Implement the Python class `TrafficMovement` described below.
Class description:
Implement the TrafficMovement class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=Non... | Implement the Python class `TrafficMovement` described below.
Class description:
Implement the TrafficMovement class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=Non... | b5ccaad97f6e35f9580e645ca764f36eb3406f43 | <|skeleton|>
class TrafficMovement:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everythi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrafficMovement:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('alyu_sharontj', 'alyu_sharontj')
... | the_stack_v2_python_sparse | alyu_sharontj/TrafficMovement.py | dwang1995/course-2018-spr-proj | train | 1 | |
6a05d3f6bfbb4dca10c7da10d0aed6d4cc334656 | [
"hero_name = {1: '曹操', 2: '张飞', 3: '刘备'}\nhero = hero_name[hero_number]\nreturn hero",
"fist = {1: '石头', 2: '剪刀', 3: '布'}\nweapon = fist[fist_number]\nreturn weapon",
"import random\nfist = {1: '石头', 2: '剪刀', 3: '布'}\nrandom_01 = random.randint(1, 3)\nquan = fist[random_01]\nreturn quan",
"victory = 0\nlose =... | <|body_start_0|>
hero_name = {1: '曹操', 2: '张飞', 3: '刘备'}
hero = hero_name[hero_number]
return hero
<|end_body_0|>
<|body_start_1|>
fist = {1: '石头', 2: '剪刀', 3: '布'}
weapon = fist[fist_number]
return weapon
<|end_body_1|>
<|body_start_2|>
import random
fi... | Game | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Game:
def hero_select(self, hero_number):
"""定义一个英雄 ,写一个字典,获取用户输入数字,来挑选英雄 记录用户选择的英雄,给下面函数使用"""
<|body_0|>
def hero_fist(self, fist_number):
"""拳, 定义拳,获取用户输入 写一个字典,获取用户输入数字,来挑选拳"""
<|body_1|>
def hrobot_fist(self):
"""记录电脑出拳 import random 随机数:rand... | stack_v2_sparse_classes_36k_train_013043 | 8,115 | no_license | [
{
"docstring": "定义一个英雄 ,写一个字典,获取用户输入数字,来挑选英雄 记录用户选择的英雄,给下面函数使用",
"name": "hero_select",
"signature": "def hero_select(self, hero_number)"
},
{
"docstring": "拳, 定义拳,获取用户输入 写一个字典,获取用户输入数字,来挑选拳",
"name": "hero_fist",
"signature": "def hero_fist(self, fist_number)"
},
{
"docstring": ... | 4 | null | Implement the Python class `Game` described below.
Class description:
Implement the Game class.
Method signatures and docstrings:
- def hero_select(self, hero_number): 定义一个英雄 ,写一个字典,获取用户输入数字,来挑选英雄 记录用户选择的英雄,给下面函数使用
- def hero_fist(self, fist_number): 拳, 定义拳,获取用户输入 写一个字典,获取用户输入数字,来挑选拳
- def hrobot_fist(self): 记录电脑出拳 i... | Implement the Python class `Game` described below.
Class description:
Implement the Game class.
Method signatures and docstrings:
- def hero_select(self, hero_number): 定义一个英雄 ,写一个字典,获取用户输入数字,来挑选英雄 记录用户选择的英雄,给下面函数使用
- def hero_fist(self, fist_number): 拳, 定义拳,获取用户输入 写一个字典,获取用户输入数字,来挑选拳
- def hrobot_fist(self): 记录电脑出拳 i... | cfadd3132c2c7c518c784589e0dab6510a662a6c | <|skeleton|>
class Game:
def hero_select(self, hero_number):
"""定义一个英雄 ,写一个字典,获取用户输入数字,来挑选英雄 记录用户选择的英雄,给下面函数使用"""
<|body_0|>
def hero_fist(self, fist_number):
"""拳, 定义拳,获取用户输入 写一个字典,获取用户输入数字,来挑选拳"""
<|body_1|>
def hrobot_fist(self):
"""记录电脑出拳 import random 随机数:rand... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Game:
def hero_select(self, hero_number):
"""定义一个英雄 ,写一个字典,获取用户输入数字,来挑选英雄 记录用户选择的英雄,给下面函数使用"""
hero_name = {1: '曹操', 2: '张飞', 3: '刘备'}
hero = hero_name[hero_number]
return hero
def hero_fist(self, fist_number):
"""拳, 定义拳,获取用户输入 写一个字典,获取用户输入数字,来挑选拳"""
fist =... | the_stack_v2_python_sparse | lemon/python22/lemon_12_190911_类和对象2/lemon_190911_作业.py | songyongzhuang/PythonCode_office | train | 0 | |
f976c2242466f0bb05e759080fbbf959bb7ef18e | [
"separate = [x.partition('T') for x in list]\nstrings = [x[0] for x in separate]\nclear = [i for i in strings if i != '--']\nintegers = [int(x) for x in clear]\nlngs = sorted(integers)\nif len(lngs) == 0:\n pass\nelse:\n return lngs[-1]",
"ints = DataTypes.integers(list)\nsorted_list = []\nfor i in ints:\n ... | <|body_start_0|>
separate = [x.partition('T') for x in list]
strings = [x[0] for x in separate]
clear = [i for i in strings if i != '--']
integers = [int(x) for x in clear]
lngs = sorted(integers)
if len(lngs) == 0:
pass
else:
return lngs[-... | Most of these functions are for the "Season Leaders" and "Season Stats" pages. | StatOrder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatOrder:
"""Most of these functions are for the "Season Leaders" and "Season Stats" pages."""
def lng(cls, list):
"""Returns the greatest value from a list of strings of lng data"""
<|body_0|>
def greatest_least(cls, list):
"""Parameter has to be list of string... | stack_v2_sparse_classes_36k_train_013044 | 48,979 | no_license | [
{
"docstring": "Returns the greatest value from a list of strings of lng data",
"name": "lng",
"signature": "def lng(cls, list)"
},
{
"docstring": "Parameter has to be list of strings that are integers",
"name": "greatest_least",
"signature": "def greatest_least(cls, list)"
},
{
... | 6 | stack_v2_sparse_classes_30k_test_000164 | Implement the Python class `StatOrder` described below.
Class description:
Most of these functions are for the "Season Leaders" and "Season Stats" pages.
Method signatures and docstrings:
- def lng(cls, list): Returns the greatest value from a list of strings of lng data
- def greatest_least(cls, list): Parameter has... | Implement the Python class `StatOrder` described below.
Class description:
Most of these functions are for the "Season Leaders" and "Season Stats" pages.
Method signatures and docstrings:
- def lng(cls, list): Returns the greatest value from a list of strings of lng data
- def greatest_least(cls, list): Parameter has... | 8004577bd11d60534d6106fb1893209431a70697 | <|skeleton|>
class StatOrder:
"""Most of these functions are for the "Season Leaders" and "Season Stats" pages."""
def lng(cls, list):
"""Returns the greatest value from a list of strings of lng data"""
<|body_0|>
def greatest_least(cls, list):
"""Parameter has to be list of string... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatOrder:
"""Most of these functions are for the "Season Leaders" and "Season Stats" pages."""
def lng(cls, list):
"""Returns the greatest value from a list of strings of lng data"""
separate = [x.partition('T') for x in list]
strings = [x[0] for x in separate]
clear = [i... | the_stack_v2_python_sparse | main/data_functions.py | ytrevor81/NFL-Stats-Library | train | 1 |
cd35bc9d28049344fd3cfaaf3b6885ad02ac5583 | [
"profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.feed.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Feed', self, '')\nself.activateFeed = settings.BooleanSetting().getFromValue('Activate Feed:', self,... | <|body_start_0|>
profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.feed.html', self)
self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Feed', self, '')
self.activateFeed = settings.BooleanSetting().ge... | A class to handle the feed settings. | FeedRepository | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeedRepository:
"""A class to handle the feed settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
<|body_0|>
def execute(self):
"""Feed button has been clicked."""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_013045 | 8,389 | no_license | [
{
"docstring": "Set the default settings, execute title & settings fileName.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Feed button has been clicked.",
"name": "execute",
"signature": "def execute(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003716 | Implement the Python class `FeedRepository` described below.
Class description:
A class to handle the feed settings.
Method signatures and docstrings:
- def __init__(self): Set the default settings, execute title & settings fileName.
- def execute(self): Feed button has been clicked. | Implement the Python class `FeedRepository` described below.
Class description:
A class to handle the feed settings.
Method signatures and docstrings:
- def __init__(self): Set the default settings, execute title & settings fileName.
- def execute(self): Feed button has been clicked.
<|skeleton|>
class FeedRepositor... | fd69d8e856780c826386dc973ceabcc03623f3e8 | <|skeleton|>
class FeedRepository:
"""A class to handle the feed settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
<|body_0|>
def execute(self):
"""Feed button has been clicked."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeedRepository:
"""A class to handle the feed settings."""
def __init__(self):
"""Set the default settings, execute title & settings fileName."""
profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.feed.html', self)
self.fileNameInput = settings.FileNameInput().g... | the_stack_v2_python_sparse | skeinforge_tools/craft_plugins/feed.py | bmander/skeinforge | train | 34 |
f3ca166e20d59428e7720e06a768f0abe1cc432d | [
"index = 1\nwhile index < len(nums):\n if nums[index - 1] == nums[index]:\n del nums[index]\n else:\n index += 1\nreturn len(nums)",
"index = 0\nwhile index < len(nums):\n if nums[index] == val:\n del nums[index]\n else:\n index += 1\nreturn len(nums)"
] | <|body_start_0|>
index = 1
while index < len(nums):
if nums[index - 1] == nums[index]:
del nums[index]
else:
index += 1
return len(nums)
<|end_body_0|>
<|body_start_1|>
index = 0
while index < len(nums):
if nums... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeElement(self, nums, val):
""":type nums: List[int] :type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
index = 1
... | stack_v2_sparse_classes_36k_train_013046 | 720 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates",
"signature": "def removeDuplicates(self, nums)"
},
{
"docstring": ":type nums: List[int] :type val: int :rtype: int",
"name": "removeElement",
"signature": "def removeElement(self, nums, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007253 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
- def removeElement(self, nums, val): :type nums: List[int] :type val: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
- def removeElement(self, nums, val): :type nums: List[int] :type val: int :rtype: int
<|skeleton|>
class Sol... | 0584b86642dff667f5bf6b7acfbbce86a41a55b6 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeElement(self, nums, val):
""":type nums: List[int] :type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
index = 1
while index < len(nums):
if nums[index - 1] == nums[index]:
del nums[index]
else:
index += 1
return len(nums)
def removeEle... | the_stack_v2_python_sparse | python_solution/021_030/RemoveDuplicates.py | CescWang1991/LeetCode-Python | train | 1 | |
a664a3b01600f45d5702037dfe2c19a9a9527b85 | [
"slug = 'hello-world'\nnew_slug = increment_slug(slug)\nself.assertEqual(new_slug, '%s-1' % slug)",
"slug = 'hello-world-1'\nnew_slug = increment_slug(slug)\nself.assertEqual(new_slug, 'hello-world-2')\nslug = 'hello-world-10'\nnew_slug = increment_slug(slug)\nself.assertEqual(new_slug, 'hello-world-11')"
] | <|body_start_0|>
slug = 'hello-world'
new_slug = increment_slug(slug)
self.assertEqual(new_slug, '%s-1' % slug)
<|end_body_0|>
<|body_start_1|>
slug = 'hello-world-1'
new_slug = increment_slug(slug)
self.assertEqual(new_slug, 'hello-world-2')
slug = 'hello-world-... | Test slug lib function | SlugTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlugTest:
"""Test slug lib function"""
def test_first_increment_slug(self):
"""First increment on a slug should append '-1' to the end"""
<|body_0|>
def test_increment_slug(self):
"""Incrementing a slug should increment the number at the end"""
<|body_1|>... | stack_v2_sparse_classes_36k_train_013047 | 36,257 | no_license | [
{
"docstring": "First increment on a slug should append '-1' to the end",
"name": "test_first_increment_slug",
"signature": "def test_first_increment_slug(self)"
},
{
"docstring": "Incrementing a slug should increment the number at the end",
"name": "test_increment_slug",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_012629 | Implement the Python class `SlugTest` described below.
Class description:
Test slug lib function
Method signatures and docstrings:
- def test_first_increment_slug(self): First increment on a slug should append '-1' to the end
- def test_increment_slug(self): Incrementing a slug should increment the number at the end | Implement the Python class `SlugTest` described below.
Class description:
Test slug lib function
Method signatures and docstrings:
- def test_first_increment_slug(self): First increment on a slug should append '-1' to the end
- def test_increment_slug(self): Incrementing a slug should increment the number at the end
... | 0ce87b644394dce3a933385c9c472aebdca036db | <|skeleton|>
class SlugTest:
"""Test slug lib function"""
def test_first_increment_slug(self):
"""First increment on a slug should append '-1' to the end"""
<|body_0|>
def test_increment_slug(self):
"""Incrementing a slug should increment the number at the end"""
<|body_1|>... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SlugTest:
"""Test slug lib function"""
def test_first_increment_slug(self):
"""First increment on a slug should append '-1' to the end"""
slug = 'hello-world'
new_slug = increment_slug(slug)
self.assertEqual(new_slug, '%s-1' % slug)
def test_increment_slug(self):
... | the_stack_v2_python_sparse | server/api/tests.py | brab/jotter | train | 0 |
ff6eff10d22e3e61b171d1ece536147a6a8ed011 | [
"self.param_name = kwargs.pop('param_name', None)\nself.plugin_type = kwargs.pop('plugin_type', None)\nself.previous = kwargs.pop('previous', None)\nsuper(StrParameterSerializer, self).__init__(*args, **kwargs)",
"if value and self.param_name and self.plugin_type and self.previous:\n if self.param_name == 'plu... | <|body_start_0|>
self.param_name = kwargs.pop('param_name', None)
self.plugin_type = kwargs.pop('plugin_type', None)
self.previous = kwargs.pop('previous', None)
super(StrParameterSerializer, self).__init__(*args, **kwargs)
<|end_body_0|>
<|body_start_1|>
if value and self.param... | StrParameterSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrParameterSerializer:
def __init__(self, *args, **kwargs):
"""Overriden to get the plugin parameter as a keyword argument at object creation."""
<|body_0|>
def validate_value(self, value):
"""Overriden to check that all the provided plugin instance ids exist in the... | stack_v2_sparse_classes_36k_train_013048 | 22,411 | permissive | [
{
"docstring": "Overriden to get the plugin parameter as a keyword argument at object creation.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Overriden to check that all the provided plugin instance ids exist in the DB and belong to the same feed for... | 2 | stack_v2_sparse_classes_30k_train_014462 | Implement the Python class `StrParameterSerializer` described below.
Class description:
Implement the StrParameterSerializer class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Overriden to get the plugin parameter as a keyword argument at object creation.
- def validate_value(self, value)... | Implement the Python class `StrParameterSerializer` described below.
Class description:
Implement the StrParameterSerializer class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Overriden to get the plugin parameter as a keyword argument at object creation.
- def validate_value(self, value)... | 20d3eedf20610af9182f6cca8db8f0b3546b5336 | <|skeleton|>
class StrParameterSerializer:
def __init__(self, *args, **kwargs):
"""Overriden to get the plugin parameter as a keyword argument at object creation."""
<|body_0|>
def validate_value(self, value):
"""Overriden to check that all the provided plugin instance ids exist in the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StrParameterSerializer:
def __init__(self, *args, **kwargs):
"""Overriden to get the plugin parameter as a keyword argument at object creation."""
self.param_name = kwargs.pop('param_name', None)
self.plugin_type = kwargs.pop('plugin_type', None)
self.previous = kwargs.pop('pre... | the_stack_v2_python_sparse | chris_backend/plugininstances/serializers.py | FNNDSC/ChRIS_ultron_backEnd | train | 36 | |
dfca459034470dab14ee1ccd030ffcd2ca8aa697 | [
"start_date = kwargs.get('start_date', None) or date.today() - relativedelta(months=1)\nend_date = kwargs.get('end_date', None) or date.today() + relativedelta(days=1)\nwith connection.cursor() as c:\n c.execute('SELECT * FROM get_aggregated_poregisers(%s, %s, %s)', [payment_object.guid, start_date.isoformat(), ... | <|body_start_0|>
start_date = kwargs.get('start_date', None) or date.today() - relativedelta(months=1)
end_date = kwargs.get('end_date', None) or date.today() + relativedelta(days=1)
with connection.cursor() as c:
c.execute('SELECT * FROM get_aggregated_poregisers(%s, %s, %s)', [paym... | PORegister model manager | PORegisterManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PORegisterManager:
"""PORegister model manager"""
def aggregate_by_days(self, payment_object, *args, **kwargs):
"""Implementation :return:"""
<|body_0|>
def update_register_values(self, payment_object_id, value, addition, start_date, end_date=None):
"""Update reg... | stack_v2_sparse_classes_36k_train_013049 | 2,465 | no_license | [
{
"docstring": "Implementation :return:",
"name": "aggregate_by_days",
"signature": "def aggregate_by_days(self, payment_object, *args, **kwargs)"
},
{
"docstring": "Update registers values from start_date to end_date :param payment_object_id: :param addition: :param value: :param start_date: :p... | 2 | stack_v2_sparse_classes_30k_train_020317 | Implement the Python class `PORegisterManager` described below.
Class description:
PORegister model manager
Method signatures and docstrings:
- def aggregate_by_days(self, payment_object, *args, **kwargs): Implementation :return:
- def update_register_values(self, payment_object_id, value, addition, start_date, end_d... | Implement the Python class `PORegisterManager` described below.
Class description:
PORegister model manager
Method signatures and docstrings:
- def aggregate_by_days(self, payment_object, *args, **kwargs): Implementation :return:
- def update_register_values(self, payment_object_id, value, addition, start_date, end_d... | a93e0eee39e1f45fa73de84514ca254e235a17bd | <|skeleton|>
class PORegisterManager:
"""PORegister model manager"""
def aggregate_by_days(self, payment_object, *args, **kwargs):
"""Implementation :return:"""
<|body_0|>
def update_register_values(self, payment_object_id, value, addition, start_date, end_date=None):
"""Update reg... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PORegisterManager:
"""PORegister model manager"""
def aggregate_by_days(self, payment_object, *args, **kwargs):
"""Implementation :return:"""
start_date = kwargs.get('start_date', None) or date.today() - relativedelta(months=1)
end_date = kwargs.get('end_date', None) or date.today... | the_stack_v2_python_sparse | cashapp_models/managers/PORegisterManager.py | dmitryshepelev/cashapp | train | 0 |
d6ad663f1a8334a2aadae0904b309e22d3ef6a45 | [
"self.hdfs_entity_id = hdfs_entity_id\nself.kerberos_principal = kerberos_principal\nself.metastore = metastore\nself.thrift_port = thrift_port",
"if dictionary is None:\n return None\nhdfs_entity_id = dictionary.get('hdfsEntityId')\nkerberos_principal = dictionary.get('kerberosPrincipal')\nmetastore = diction... | <|body_start_0|>
self.hdfs_entity_id = hdfs_entity_id
self.kerberos_principal = kerberos_principal
self.metastore = metastore
self.thrift_port = thrift_port
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
hdfs_entity_id = dictionary.get('hd... | Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos principal. metastore (string): Specifies the Hiv... | HiveConnectParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HiveConnectParams:
"""Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos pri... | stack_v2_sparse_classes_36k_train_013050 | 2,242 | permissive | [
{
"docstring": "Constructor for the HiveConnectParams class",
"name": "__init__",
"signature": "def __init__(self, hdfs_entity_id=None, kerberos_principal=None, metastore=None, thrift_port=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary)... | 2 | stack_v2_sparse_classes_30k_train_002470 | Implement the Python class `HiveConnectParams` described below.
Class description:
Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_princip... | Implement the Python class `HiveConnectParams` described below.
Class description:
Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_princip... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class HiveConnectParams:
"""Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos pri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HiveConnectParams:
"""Implementation of the 'HiveConnectParams' model. Specifies an Object containing information about a registered Hive source. Attributes: hdfs_entity_id (long|int): Specifies the entity id of the HDFS source for this Hive kerberos_principal (string): Specifies the kerberos principal. metas... | the_stack_v2_python_sparse | cohesity_management_sdk/models/hive_connect_params.py | cohesity/management-sdk-python | train | 24 |
3b4d3b106659403a0d2557c49ee876221767bc2c | [
"url = f'https://api.github.com/repos/{user}/{project}/releases/latest'\nresponse = request.get_file(url)\nif response:\n response = json.loads(response)\n return response.get('tag_name', '')\nelse:\n return None",
"url = f'https://api.github.com/repos/{user}/{project}/releases/tags/{tag_name}'\nresponse... | <|body_start_0|>
url = f'https://api.github.com/repos/{user}/{project}/releases/latest'
response = request.get_file(url)
if response:
response = json.loads(response)
return response.get('tag_name', '')
else:
return None
<|end_body_0|>
<|body_start_1|>... | Common methods for GitHub API Queries. https://developer.github.com/v3/repos/releases/ | GitHubUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GitHubUtils:
"""Common methods for GitHub API Queries. https://developer.github.com/v3/repos/releases/"""
def get_latest_release(user: str, project: str) -> str:
"""Get the tag of the latest release in a repository."""
<|body_0|>
def exists_release_in_repo(user: str, pro... | stack_v2_sparse_classes_36k_train_013051 | 21,227 | permissive | [
{
"docstring": "Get the tag of the latest release in a repository.",
"name": "get_latest_release",
"signature": "def get_latest_release(user: str, project: str) -> str"
},
{
"docstring": "Check if a tagged release exists in a repository.",
"name": "exists_release_in_repo",
"signature": "... | 4 | stack_v2_sparse_classes_30k_test_000098 | Implement the Python class `GitHubUtils` described below.
Class description:
Common methods for GitHub API Queries. https://developer.github.com/v3/repos/releases/
Method signatures and docstrings:
- def get_latest_release(user: str, project: str) -> str: Get the tag of the latest release in a repository.
- def exist... | Implement the Python class `GitHubUtils` described below.
Class description:
Common methods for GitHub API Queries. https://developer.github.com/v3/repos/releases/
Method signatures and docstrings:
- def get_latest_release(user: str, project: str) -> str: Get the tag of the latest release in a repository.
- def exist... | e6c8b06a43b310d2c1e58d7826239e259dd826d7 | <|skeleton|>
class GitHubUtils:
"""Common methods for GitHub API Queries. https://developer.github.com/v3/repos/releases/"""
def get_latest_release(user: str, project: str) -> str:
"""Get the tag of the latest release in a repository."""
<|body_0|>
def exists_release_in_repo(user: str, pro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GitHubUtils:
"""Common methods for GitHub API Queries. https://developer.github.com/v3/repos/releases/"""
def get_latest_release(user: str, project: str) -> str:
"""Get the tag of the latest release in a repository."""
url = f'https://api.github.com/repos/{user}/{project}/releases/latest'... | the_stack_v2_python_sparse | scar/utils.py | grycap/scar | train | 613 |
336257285bbd468119c7c20334053d9c851f564c | [
"paddle.set_default_dtype(np.float64)\nsuper(LinearNet, self).__init__()\nself.fc1 = paddle.nn.Linear(in_features=10, out_features=20, weight_attr=paddle.nn.initializer.Constant(value=0.5), bias_attr=paddle.nn.initializer.Constant(value=0.33))\nself.fc2 = paddle.nn.Linear(in_features=20, out_features=2, weight_attr... | <|body_start_0|>
paddle.set_default_dtype(np.float64)
super(LinearNet, self).__init__()
self.fc1 = paddle.nn.Linear(in_features=10, out_features=20, weight_attr=paddle.nn.initializer.Constant(value=0.5), bias_attr=paddle.nn.initializer.Constant(value=0.33))
self.fc2 = paddle.nn.Linear(in... | model | LinearNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearNet:
"""model"""
def __init__(self):
"""__init__"""
<|body_0|>
def forward(self, inputs):
"""forward"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
paddle.set_default_dtype(np.float64)
super(LinearNet, self).__init__()
sel... | stack_v2_sparse_classes_36k_train_013052 | 959 | no_license | [
{
"docstring": "__init__",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "forward",
"name": "forward",
"signature": "def forward(self, inputs)"
}
] | 2 | null | Implement the Python class `LinearNet` described below.
Class description:
model
Method signatures and docstrings:
- def __init__(self): __init__
- def forward(self, inputs): forward | Implement the Python class `LinearNet` described below.
Class description:
model
Method signatures and docstrings:
- def __init__(self): __init__
- def forward(self, inputs): forward
<|skeleton|>
class LinearNet:
"""model"""
def __init__(self):
"""__init__"""
<|body_0|>
def forward(self... | bd3790ce72a2a26611b5eda3901651b5a809348f | <|skeleton|>
class LinearNet:
"""model"""
def __init__(self):
"""__init__"""
<|body_0|>
def forward(self, inputs):
"""forward"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearNet:
"""model"""
def __init__(self):
"""__init__"""
paddle.set_default_dtype(np.float64)
super(LinearNet, self).__init__()
self.fc1 = paddle.nn.Linear(in_features=10, out_features=20, weight_attr=paddle.nn.initializer.Constant(value=0.5), bias_attr=paddle.nn.initiali... | the_stack_v2_python_sparse | framework/api/optimizer/linear_dygraph_model.py | PaddlePaddle/PaddleTest | train | 42 |
8fe1554343ed77790ae3856f2db4bc26df84de15 | [
"curator_pods = self.get_pods_for_component('curator')\nself.check_curator(curator_pods)\nreturn {}",
"if not pods:\n raise OpenShiftCheckException('MissingComponentPods', 'There are no Curator pods for the logging stack,\\nso nothing will prune Elasticsearch indexes.\\nIs Curator correctly deployed?')\nnot_ru... | <|body_start_0|>
curator_pods = self.get_pods_for_component('curator')
self.check_curator(curator_pods)
return {}
<|end_body_0|>
<|body_start_1|>
if not pods:
raise OpenShiftCheckException('MissingComponentPods', 'There are no Curator pods for the logging stack,\nso nothing ... | Check for an aggregated logging Curator deployment | Curator | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Curator:
"""Check for an aggregated logging Curator deployment"""
def run(self):
"""Check various things and gather errors. Returns: result as hash"""
<|body_0|>
def check_curator(self, pods):
"""Check to see if curator is up and working. Returns: error string"""... | stack_v2_sparse_classes_36k_train_013053 | 1,640 | permissive | [
{
"docstring": "Check various things and gather errors. Returns: result as hash",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Check to see if curator is up and working. Returns: error string",
"name": "check_curator",
"signature": "def check_curator(self, pods)"
}
] | 2 | null | Implement the Python class `Curator` described below.
Class description:
Check for an aggregated logging Curator deployment
Method signatures and docstrings:
- def run(self): Check various things and gather errors. Returns: result as hash
- def check_curator(self, pods): Check to see if curator is up and working. Ret... | Implement the Python class `Curator` described below.
Class description:
Check for an aggregated logging Curator deployment
Method signatures and docstrings:
- def run(self): Check various things and gather errors. Returns: result as hash
- def check_curator(self, pods): Check to see if curator is up and working. Ret... | e342f6659a4ef1a188ff403e2fc6b06ac6d119c7 | <|skeleton|>
class Curator:
"""Check for an aggregated logging Curator deployment"""
def run(self):
"""Check various things and gather errors. Returns: result as hash"""
<|body_0|>
def check_curator(self, pods):
"""Check to see if curator is up and working. Returns: error string"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Curator:
"""Check for an aggregated logging Curator deployment"""
def run(self):
"""Check various things and gather errors. Returns: result as hash"""
curator_pods = self.get_pods_for_component('curator')
self.check_curator(curator_pods)
return {}
def check_curator(se... | the_stack_v2_python_sparse | openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_health_checker/openshift_checks/logging/curator.py | openshift/openshift-tools | train | 170 |
30fdf58de803a41f72a93a342d1a50dc38dc6f73 | [
"if self.dialog is None:\n self.dialog = Test()\nreturn self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaulth=400, defaultw=400)",
"if self.dialog is None:\n self.dialog = Test()\nreturn self.dialog.Restore(pluginid=PLUGIN_ID, secret=sec_ref)"
] | <|body_start_0|>
if self.dialog is None:
self.dialog = Test()
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaulth=400, defaultw=400)
<|end_body_0|>
<|body_start_1|>
if self.dialog is None:
self.dialog = Test()
return self.dialog.Resto... | BitmapManagerCommandData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BitmapManagerCommandData:
def Execute(self, doc):
"""Just create the dialog when the user clicked on the entry in the plugins menu to open it."""
<|body_0|>
def RestoreLayout(self, sec_ref):
"""Same for this method. Just allocate it when the dialog is needed"""
... | stack_v2_sparse_classes_36k_train_013054 | 5,189 | permissive | [
{
"docstring": "Just create the dialog when the user clicked on the entry in the plugins menu to open it.",
"name": "Execute",
"signature": "def Execute(self, doc)"
},
{
"docstring": "Same for this method. Just allocate it when the dialog is needed",
"name": "RestoreLayout",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_014178 | Implement the Python class `BitmapManagerCommandData` described below.
Class description:
Implement the BitmapManagerCommandData class.
Method signatures and docstrings:
- def Execute(self, doc): Just create the dialog when the user clicked on the entry in the plugins menu to open it.
- def RestoreLayout(self, sec_re... | Implement the Python class `BitmapManagerCommandData` described below.
Class description:
Implement the BitmapManagerCommandData class.
Method signatures and docstrings:
- def Execute(self, doc): Just create the dialog when the user clicked on the entry in the plugins menu to open it.
- def RestoreLayout(self, sec_re... | 32b1d2b63fe28510c83c66065394042900000e92 | <|skeleton|>
class BitmapManagerCommandData:
def Execute(self, doc):
"""Just create the dialog when the user clicked on the entry in the plugins menu to open it."""
<|body_0|>
def RestoreLayout(self, sec_ref):
"""Same for this method. Just allocate it when the dialog is needed"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BitmapManagerCommandData:
def Execute(self, doc):
"""Just create the dialog when the user clicked on the entry in the plugins menu to open it."""
if self.dialog is None:
self.dialog = Test()
return self.dialog.Open(dlgtype=c4d.DLG_TYPE_ASYNC, pluginid=PLUGIN_ID, defaulth=40... | the_stack_v2_python_sparse | plugins/Py-MemoryViewer/Py-MemoryViewer.pyp | tdapper/cinema4d_py_sdk | train | 0 | |
4fa735c00f682b90027bc1f860a61ff9523ae780 | [
"if has_organization_management_level(self.datastore, self.user_id, OrganizationManagementLevel.CAN_MANAGE_USERS):\n return\nscope, scope_id = self.get_user_scope(instance['id'])\nif scope == UserScope.Committee:\n if not has_committee_management_level(self.datastore, self.user_id, CommitteeManagementLevel.CA... | <|body_start_0|>
if has_organization_management_level(self.datastore, self.user_id, OrganizationManagementLevel.CAN_MANAGE_USERS):
return
scope, scope_id = self.get_user_scope(instance['id'])
if scope == UserScope.Committee:
if not has_committee_management_level(self.data... | UserScopePermissionCheckMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserScopePermissionCheckMixin:
def check_permissions_for_scope(self, instance: Dict[str, Any]) -> None:
"""Checks the permissions for user-altering actions depending on the user scope."""
<|body_0|>
def get_user_scope(self, id: Optional[int]=None, instance: Optional[Dict[str... | stack_v2_sparse_classes_36k_train_013055 | 4,609 | permissive | [
{
"docstring": "Checks the permissions for user-altering actions depending on the user scope.",
"name": "check_permissions_for_scope",
"signature": "def check_permissions_for_scope(self, instance: Dict[str, Any]) -> None"
},
{
"docstring": "Returns the scope of the given user id together with th... | 2 | stack_v2_sparse_classes_30k_val_000295 | Implement the Python class `UserScopePermissionCheckMixin` described below.
Class description:
Implement the UserScopePermissionCheckMixin class.
Method signatures and docstrings:
- def check_permissions_for_scope(self, instance: Dict[str, Any]) -> None: Checks the permissions for user-altering actions depending on t... | Implement the Python class `UserScopePermissionCheckMixin` described below.
Class description:
Implement the UserScopePermissionCheckMixin class.
Method signatures and docstrings:
- def check_permissions_for_scope(self, instance: Dict[str, Any]) -> None: Checks the permissions for user-altering actions depending on t... | 418d5ae743b9e030b8f13c4ba5d4191e51ddeb7c | <|skeleton|>
class UserScopePermissionCheckMixin:
def check_permissions_for_scope(self, instance: Dict[str, Any]) -> None:
"""Checks the permissions for user-altering actions depending on the user scope."""
<|body_0|>
def get_user_scope(self, id: Optional[int]=None, instance: Optional[Dict[str... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserScopePermissionCheckMixin:
def check_permissions_for_scope(self, instance: Dict[str, Any]) -> None:
"""Checks the permissions for user-altering actions depending on the user scope."""
if has_organization_management_level(self.datastore, self.user_id, OrganizationManagementLevel.CAN_MANAGE_... | the_stack_v2_python_sparse | openslides_backend/action/actions/user/user_scope_permission_check_mixin.py | tsiegleauq/openslides-backend | train | 0 | |
0d7435c9c3f78fea8212d02288beb662458c31ff | [
"categories = get_list_or_404(Category)\nif request.GET.get('pagination'):\n pagination = request.GET.get('pagination')\n if pagination == 'true':\n paginator = AdministratorPagination()\n results = paginator.paginate_queryset(categories, request)\n serializer = CategorySerializer(results... | <|body_start_0|>
categories = get_list_or_404(Category)
if request.GET.get('pagination'):
pagination = request.GET.get('pagination')
if pagination == 'true':
paginator = AdministratorPagination()
results = paginator.paginate_queryset(categories, re... | CategoryList | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CategoryList:
def get(self, request, format=None):
"""List all categories --- parameters: - name: pagination required: false type: string paramType: query"""
<|body_0|>
def post(self, request, format=None):
"""Create new category --- serializer: administrator.seriali... | stack_v2_sparse_classes_36k_train_013056 | 30,608 | permissive | [
{
"docstring": "List all categories --- parameters: - name: pagination required: false type: string paramType: query",
"name": "get",
"signature": "def get(self, request, format=None)"
},
{
"docstring": "Create new category --- serializer: administrator.serializers.CategorySerializer",
"name... | 2 | stack_v2_sparse_classes_30k_train_015666 | Implement the Python class `CategoryList` described below.
Class description:
Implement the CategoryList class.
Method signatures and docstrings:
- def get(self, request, format=None): List all categories --- parameters: - name: pagination required: false type: string paramType: query
- def post(self, request, format... | Implement the Python class `CategoryList` described below.
Class description:
Implement the CategoryList class.
Method signatures and docstrings:
- def get(self, request, format=None): List all categories --- parameters: - name: pagination required: false type: string paramType: query
- def post(self, request, format... | 73728463badb3bfd4413aa0f7aeb44a9606fdfea | <|skeleton|>
class CategoryList:
def get(self, request, format=None):
"""List all categories --- parameters: - name: pagination required: false type: string paramType: query"""
<|body_0|>
def post(self, request, format=None):
"""Create new category --- serializer: administrator.seriali... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CategoryList:
def get(self, request, format=None):
"""List all categories --- parameters: - name: pagination required: false type: string paramType: query"""
categories = get_list_or_404(Category)
if request.GET.get('pagination'):
pagination = request.GET.get('pagination')
... | the_stack_v2_python_sparse | administrator/views.py | belatrix/BackendAllStars | train | 5 | |
e645e49f26189688bd61bc344b66bef161c9a3f8 | [
"self.assertEqual(address_transfer.resolve_path_to_actual_path('zhfs/A/yanbx/lib')[1], '/home/ubuntu/hhhh/yanbx/lib')\nself.assertEqual(address_transfer.resolve_path_to_actual_path('zhfs/A/B/heiheihei')[1], '/home/ubuntu/HHHH/heiheihei')\nself.assertEqual(address_transfer.resolve_path_to_actual_path('zhfs/wanghb/no... | <|body_start_0|>
self.assertEqual(address_transfer.resolve_path_to_actual_path('zhfs/A/yanbx/lib')[1], '/home/ubuntu/hhhh/yanbx/lib')
self.assertEqual(address_transfer.resolve_path_to_actual_path('zhfs/A/B/heiheihei')[1], '/home/ubuntu/HHHH/heiheihei')
self.assertEqual(address_transfer.resolve_p... | TestAddressTransfer用于测试路径解析模块的路径解析函数,测试结果与address_transfer.get_volume_relationship()相关。 单元测试类中模拟了get_volume_relationship的返回数据,与之进行了解耦 | TestAddressTransfer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAddressTransfer:
"""TestAddressTransfer用于测试路径解析模块的路径解析函数,测试结果与address_transfer.get_volume_relationship()相关。 单元测试类中模拟了get_volume_relationship的返回数据,与之进行了解耦"""
def test_path_transfer_to_actual_path(self):
"""测试 address_transfer.resolve_path_to_actual_path 的功能"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_013057 | 2,723 | no_license | [
{
"docstring": "测试 address_transfer.resolve_path_to_actual_path 的功能",
"name": "test_path_transfer_to_actual_path",
"signature": "def test_path_transfer_to_actual_path(self)"
},
{
"docstring": "测试 address_transfer.resolve_actual_path_to_path 的功能",
"name": "test_actual_path_transfer_to_path",
... | 2 | null | Implement the Python class `TestAddressTransfer` described below.
Class description:
TestAddressTransfer用于测试路径解析模块的路径解析函数,测试结果与address_transfer.get_volume_relationship()相关。 单元测试类中模拟了get_volume_relationship的返回数据,与之进行了解耦
Method signatures and docstrings:
- def test_path_transfer_to_actual_path(self): 测试 address_transfe... | Implement the Python class `TestAddressTransfer` described below.
Class description:
TestAddressTransfer用于测试路径解析模块的路径解析函数,测试结果与address_transfer.get_volume_relationship()相关。 单元测试类中模拟了get_volume_relationship的返回数据,与之进行了解耦
Method signatures and docstrings:
- def test_path_transfer_to_actual_path(self): 测试 address_transfe... | 5a4eca0758ad4e4814561c761aca6dfcc31a6c4c | <|skeleton|>
class TestAddressTransfer:
"""TestAddressTransfer用于测试路径解析模块的路径解析函数,测试结果与address_transfer.get_volume_relationship()相关。 单元测试类中模拟了get_volume_relationship的返回数据,与之进行了解耦"""
def test_path_transfer_to_actual_path(self):
"""测试 address_transfer.resolve_path_to_actual_path 的功能"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestAddressTransfer:
"""TestAddressTransfer用于测试路径解析模块的路径解析函数,测试结果与address_transfer.get_volume_relationship()相关。 单元测试类中模拟了get_volume_relationship的返回数据,与之进行了解耦"""
def test_path_transfer_to_actual_path(self):
"""测试 address_transfer.resolve_path_to_actual_path 的功能"""
self.assertEqual(address_... | the_stack_v2_python_sparse | common/test_address_transfer.py | 7venminutes/WebService | train | 0 |
57d658de3cd5a91ef154229145d54b8fa981f381 | [
"self.venue_id = venue_id\nself.timestamp_utc = timestamp_utc\nself.measurement_type = measurement_type\nself.operator = operator\nself.number_of_people = number_of_people\nself.metadata = metadata\nself._validate_input()",
"try:\n expected_type(str, self.venue_id, 'venue_id')\n expected_type(datetime.datet... | <|body_start_0|>
self.venue_id = venue_id
self.timestamp_utc = timestamp_utc
self.measurement_type = measurement_type
self.operator = operator
self.number_of_people = number_of_people
self.metadata = metadata
self._validate_input()
<|end_body_0|>
<|body_start_1|>... | Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents. | RawVenueMeasurement | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RawVenueMeasurement:
"""Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents."""
def __init__(self, venue_id, timestamp_utc, number_of_people, measurement_... | stack_v2_sparse_classes_36k_train_013058 | 4,101 | no_license | [
{
"docstring": ":param venue_id - the name of the venue. str. :param timestamp_utc - the UTC time at which the measurement was made. datetime :param measurement_type - the type of data - i.e. gyms send events, bibs send absolute number of people :type VenueStreamType :param number_of_people - the number of peop... | 2 | stack_v2_sparse_classes_30k_train_015658 | Implement the Python class `RawVenueMeasurement` described below.
Class description:
Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents.
Method signatures and docstrings:
- def __... | Implement the Python class `RawVenueMeasurement` described below.
Class description:
Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents.
Method signatures and docstrings:
- def __... | 49e23966fa8ae6b7b6b44d4b4465a658533b40ab | <|skeleton|>
class RawVenueMeasurement:
"""Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents."""
def __init__(self, venue_id, timestamp_utc, number_of_people, measurement_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RawVenueMeasurement:
"""Convenience data-class to hold a venue measurement. The purpose of this class is to encapsulate data that has just arrived at a gate, make it easy to searialize and deserialize the contents."""
def __init__(self, venue_id, timestamp_utc, number_of_people, measurement_type, operato... | the_stack_v2_python_sparse | thesis_common/incoming_pipeline/raw_venue_measurement.py | jorotenev/thesis_common | train | 0 |
3938f6d9f1d809225cd2a9e0722e6a46f20fea77 | [
"if self.is_empty():\n raise Empty('Queue is empty')\nreturn self._head._element",
"if self.is_empty():\n raise Empty('Queue is empty')\nanswer = self._head._element\nself._head = self._head._next\nself._size -= 1\nif self.is_empty():\n self._tail = None\nreturn answer",
"newest = self._Node(element, N... | <|body_start_0|>
if self.is_empty():
raise Empty('Queue is empty')
return self._head._element
<|end_body_0|>
<|body_start_1|>
if self.is_empty():
raise Empty('Queue is empty')
answer = self._head._element
self._head = self._head._next
self._size -... | FIFO (first in first out) queue implementation using a singly linked list for storage enqueue elements at the back and dequeue them from the front | LinkedQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkedQueue:
"""FIFO (first in first out) queue implementation using a singly linked list for storage enqueue elements at the back and dequeue them from the front"""
def first(self):
"""return __but do not remove__ the element at the front of the queue :return:"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_013059 | 4,149 | no_license | [
{
"docstring": "return __but do not remove__ the element at the front of the queue :return:",
"name": "first",
"signature": "def first(self)"
},
{
"docstring": "remove and return the first element of the queue FIFO (first in first out) raise empty exception if the queue is empty :return:",
"... | 5 | stack_v2_sparse_classes_30k_train_016760 | Implement the Python class `LinkedQueue` described below.
Class description:
FIFO (first in first out) queue implementation using a singly linked list for storage enqueue elements at the back and dequeue them from the front
Method signatures and docstrings:
- def first(self): return __but do not remove__ the element ... | Implement the Python class `LinkedQueue` described below.
Class description:
FIFO (first in first out) queue implementation using a singly linked list for storage enqueue elements at the back and dequeue them from the front
Method signatures and docstrings:
- def first(self): return __but do not remove__ the element ... | f79b08021cebbfe0ff32abcc8e9dd56af32e4aad | <|skeleton|>
class LinkedQueue:
"""FIFO (first in first out) queue implementation using a singly linked list for storage enqueue elements at the back and dequeue them from the front"""
def first(self):
"""return __but do not remove__ the element at the front of the queue :return:"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinkedQueue:
"""FIFO (first in first out) queue implementation using a singly linked list for storage enqueue elements at the back and dequeue them from the front"""
def first(self):
"""return __but do not remove__ the element at the front of the queue :return:"""
if self.is_empty():
... | the_stack_v2_python_sparse | exercises/ch08_trees/LinkedQueue.py | rarezhang/data_structures_and_algorithms_in_python | train | 0 |
ebfe3525b7dd4f9ec0f5ee73aa2f050d288677ca | [
"assert all((len(c) == 2 and isinstance(c[0], str) and isinstance(c[1], int) for c in columns)), columns\nself.use_cr_only = True\nself.unfinished_commands = set()\nself.start = time.time()\nself._last_printed_line = ''\nself._columns = [c[1] for c in columns]\nself._columns_lookup = dict(((c[0], i) for i, c in enu... | <|body_start_0|>
assert all((len(c) == 2 and isinstance(c[0], str) and isinstance(c[1], int) for c in columns)), columns
self.use_cr_only = True
self.unfinished_commands = set()
self.start = time.time()
self._last_printed_line = ''
self._columns = [c[1] for c in columns]
... | Prints progress and accepts updates thread-safely. | Progress | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Progress:
"""Prints progress and accepts updates thread-safely."""
def __init__(self, columns):
"""Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their init... | stack_v2_sparse_classes_36k_train_013060 | 27,770 | permissive | [
{
"docstring": "Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their initial values.",
"name": "__init__",
"signature": "def __init__(self, columns)"
},
{
"docstring": ... | 5 | stack_v2_sparse_classes_30k_test_000328 | Implement the Python class `Progress` described below.
Class description:
Prints progress and accepts updates thread-safely.
Method signatures and docstrings:
- def __init__(self, columns): Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initial... | Implement the Python class `Progress` described below.
Class description:
Prints progress and accepts updates thread-safely.
Method signatures and docstrings:
- def __init__(self, columns): Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initial... | 10cc5fdcca53e2a1690867acbe6fce099273f092 | <|skeleton|>
class Progress:
"""Prints progress and accepts updates thread-safely."""
def __init__(self, columns):
"""Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their init... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Progress:
"""Prints progress and accepts updates thread-safely."""
def __init__(self, columns):
"""Creates a Progress bar that will updates asynchronously from the worker threads. Arguments: columns: list of tuple(name, initialvalue), defines both the number of columns and their initial values.""... | the_stack_v2_python_sparse | client/utils/threading_utils.py | luci/luci-py | train | 84 |
7cd0512ec84193e1d7fef3f7256c1d00444e35ea | [
"super(SettingsController, self).__init__()\nself._project = project\nself.dialog = project_dialogs.ProjectSettingsDialog(None)\nself.UpdateDialog()\nself.MakeBindingsOKCancel()",
"self.dialog.app_name_text_ctrl.SetValue(self._project.name)\nself.dialog.app_path_text_ctrl.SetValue(self._project.path)\nself.dialog... | <|body_start_0|>
super(SettingsController, self).__init__()
self._project = project
self.dialog = project_dialogs.ProjectSettingsDialog(None)
self.UpdateDialog()
self.MakeBindingsOKCancel()
<|end_body_0|>
<|body_start_1|>
self.dialog.app_name_text_ctrl.SetValue(self._pro... | Controller for a project settings dialog. The controller is responsible for displaying the dialog, filling it in, and (if not cancelled) reading data back and filling in a project with changes. | SettingsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SettingsController:
"""Controller for a project settings dialog. The controller is responsible for displaying the dialog, filling it in, and (if not cancelled) reading data back and filling in a project with changes."""
def __init__(self, project):
"""Initialize a settings controller... | stack_v2_sparse_classes_36k_train_013061 | 4,272 | permissive | [
{
"docstring": "Initialize a settings controller. Args: project: a launcher.Project to view and edit",
"name": "__init__",
"signature": "def __init__(self, project)"
},
{
"docstring": "Update the dialog with values from our project.",
"name": "UpdateDialog",
"signature": "def UpdateDialo... | 5 | stack_v2_sparse_classes_30k_train_020448 | Implement the Python class `SettingsController` described below.
Class description:
Controller for a project settings dialog. The controller is responsible for displaying the dialog, filling it in, and (if not cancelled) reading data back and filling in a project with changes.
Method signatures and docstrings:
- def ... | Implement the Python class `SettingsController` described below.
Class description:
Controller for a project settings dialog. The controller is responsible for displaying the dialog, filling it in, and (if not cancelled) reading data back and filling in a project with changes.
Method signatures and docstrings:
- def ... | 55af8a64768212d3fe025adf4cad61b2099786ef | <|skeleton|>
class SettingsController:
"""Controller for a project settings dialog. The controller is responsible for displaying the dialog, filling it in, and (if not cancelled) reading data back and filling in a project with changes."""
def __init__(self, project):
"""Initialize a settings controller... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SettingsController:
"""Controller for a project settings dialog. The controller is responsible for displaying the dialog, filling it in, and (if not cancelled) reading data back and filling in a project with changes."""
def __init__(self, project):
"""Initialize a settings controller. Args: proje... | the_stack_v2_python_sparse | launcher/settings_controller.py | aykuttasil/google-appengine-wx-launcher | train | 0 |
865522c4fbc8a9b0cc486b75c0b8347c18ea0a34 | [
"self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'\nself.url_items = {}\nself.valid_keys = ('action', 'ID', 'PASSWORD', 'dateutc', 'winddir', 'windspeedmph', 'windgustmph', 'windgustdir', 'windspdmph_avg2m', 'winddir_avg2m', 'windgustmph_10m', 'windgustdir_10m', '... | <|body_start_0|>
self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'
self.url_items = {}
self.valid_keys = ('action', 'ID', 'PASSWORD', 'dateutc', 'winddir', 'windspeedmph', 'windgustmph', 'windgustdir', 'windspdmph_avg2m', 'winddir_avg2m', 'wind... | this class represents a weather under ground upload url | WUURL | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WUURL:
"""this class represents a weather under ground upload url"""
def __init__(self):
"""initialize a url"""
<|body_0|>
def __str__(self):
"""converst url to string"""
<|body_1|>
def add_item(self, key, value):
"""adds an item to url argum... | stack_v2_sparse_classes_36k_train_013062 | 7,715 | no_license | [
{
"docstring": "initialize a url",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "converst url to string",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "adds an item to url arguments: key: (string) value: (string)",
"name": "... | 4 | stack_v2_sparse_classes_30k_train_005635 | Implement the Python class `WUURL` described below.
Class description:
this class represents a weather under ground upload url
Method signatures and docstrings:
- def __init__(self): initialize a url
- def __str__(self): converst url to string
- def add_item(self, key, value): adds an item to url arguments: key: (str... | Implement the Python class `WUURL` described below.
Class description:
this class represents a weather under ground upload url
Method signatures and docstrings:
- def __init__(self): initialize a url
- def __str__(self): converst url to string
- def add_item(self, key, value): adds an item to url arguments: key: (str... | 95d0c102d649c5b028d262f5254106f997a7c77a | <|skeleton|>
class WUURL:
"""this class represents a weather under ground upload url"""
def __init__(self):
"""initialize a url"""
<|body_0|>
def __str__(self):
"""converst url to string"""
<|body_1|>
def add_item(self, key, value):
"""adds an item to url argum... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WUURL:
"""this class represents a weather under ground upload url"""
def __init__(self):
"""initialize a url"""
self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'
self.url_items = {}
self.valid_keys = ('action', 'ID', 'PAS... | the_stack_v2_python_sparse | wunder_formatter.py | rwspicer/csv_utilities | train | 1 |
ac86fe03c5f1049c633fa04c0d648c4246fdacbc | [
"page = create_test_page(title='First Page')\nself.assertIsNotNone(page.get_latest_revision())\nrelease = create_test_release()\nrelease_content = create_test_release_content(release, json.dumps(release.generate_fixed_content()))\nloaded_page_content = release_content.get_content_for(str(page.id))\nself.assertEqual... | <|body_start_0|>
page = create_test_page(title='First Page')
self.assertIsNotNone(page.get_latest_revision())
release = create_test_release()
release_content = create_test_release_content(release, json.dumps(release.generate_fixed_content()))
loaded_page_content = release_content... | ReleaseContentModelTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReleaseContentModelTests:
def test_release_content_can_return_a_requested_page(self, mock_file_service):
"""When a specific page is requested from the locked content it should be retrievable."""
<|body_0|>
def test_release_content_returns_none_if_the_requested_page_not_in_re... | stack_v2_sparse_classes_36k_train_013063 | 19,307 | no_license | [
{
"docstring": "When a specific page is requested from the locked content it should be retrievable.",
"name": "test_release_content_can_return_a_requested_page",
"signature": "def test_release_content_can_return_a_requested_page(self, mock_file_service)"
},
{
"docstring": "When a page is request... | 2 | null | Implement the Python class `ReleaseContentModelTests` described below.
Class description:
Implement the ReleaseContentModelTests class.
Method signatures and docstrings:
- def test_release_content_can_return_a_requested_page(self, mock_file_service): When a specific page is requested from the locked content it should... | Implement the Python class `ReleaseContentModelTests` described below.
Class description:
Implement the ReleaseContentModelTests class.
Method signatures and docstrings:
- def test_release_content_can_return_a_requested_page(self, mock_file_service): When a specific page is requested from the locked content it should... | 112d53662731636941629d35609e764c29038dc3 | <|skeleton|>
class ReleaseContentModelTests:
def test_release_content_can_return_a_requested_page(self, mock_file_service):
"""When a specific page is requested from the locked content it should be retrievable."""
<|body_0|>
def test_release_content_returns_none_if_the_requested_page_not_in_re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReleaseContentModelTests:
def test_release_content_can_return_a_requested_page(self, mock_file_service):
"""When a specific page is requested from the locked content it should be retrievable."""
page = create_test_page(title='First Page')
self.assertIsNotNone(page.get_latest_revision()... | the_stack_v2_python_sparse | oneYou2/release/tests.py | mattnicks/oneyoucms | train | 0 | |
82dc9e379474f7fba9e0ae9f7ac6aa83ed4611fd | [
"if max is None:\n max = min\n min = 0\nif max - min <= 0:\n return min\nreturn random.randint(min, max - 1)",
"if range is None:\n range = int(0.1 * value)\nmin = value - range\nmax = value + range\nreturn RandomInteger.next_integer(min, max)",
"max = max if max is not None else min\ncount = Random... | <|body_start_0|>
if max is None:
max = min
min = 0
if max - min <= 0:
return min
return random.randint(min, max - 1)
<|end_body_0|>
<|body_start_1|>
if range is None:
range = int(0.1 * value)
min = value - range
max = value... | Random generator for integer values. Example: .. code-block:: python value1 = RandomInteger.next_integer(5, 10) # Possible result: 7 value2 = RandomInteger.next_integer(10) # Possible result: 3 value3 = RandomInteger.update_integer(10, 3) # Possible result: 9 | RandomInteger | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomInteger:
"""Random generator for integer values. Example: .. code-block:: python value1 = RandomInteger.next_integer(5, 10) # Possible result: 7 value2 = RandomInteger.next_integer(10) # Possible result: 3 value3 = RandomInteger.update_integer(10, 3) # Possible result: 9"""
def next_in... | stack_v2_sparse_classes_36k_train_013064 | 2,553 | permissive | [
{
"docstring": "Generates a integer in the range ['min', 'max']. If 'max' is omitted, then the range will be set to [0, 'min']. :param min: minimum args of the integer that will be generated. If 'max' is omitted, then 'max' is set to 'min' and 'min' is set to 0. :param max: (optional) maximum args of the float ... | 3 | stack_v2_sparse_classes_30k_train_014408 | Implement the Python class `RandomInteger` described below.
Class description:
Random generator for integer values. Example: .. code-block:: python value1 = RandomInteger.next_integer(5, 10) # Possible result: 7 value2 = RandomInteger.next_integer(10) # Possible result: 3 value3 = RandomInteger.update_integer(10, 3) #... | Implement the Python class `RandomInteger` described below.
Class description:
Random generator for integer values. Example: .. code-block:: python value1 = RandomInteger.next_integer(5, 10) # Possible result: 7 value2 = RandomInteger.next_integer(10) # Possible result: 3 value3 = RandomInteger.update_integer(10, 3) #... | 17f8a231fb75684032ec57b24025c9a3ca3dcdd6 | <|skeleton|>
class RandomInteger:
"""Random generator for integer values. Example: .. code-block:: python value1 = RandomInteger.next_integer(5, 10) # Possible result: 7 value2 = RandomInteger.next_integer(10) # Possible result: 3 value3 = RandomInteger.update_integer(10, 3) # Possible result: 9"""
def next_in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomInteger:
"""Random generator for integer values. Example: .. code-block:: python value1 = RandomInteger.next_integer(5, 10) # Possible result: 7 value2 = RandomInteger.next_integer(10) # Possible result: 3 value3 = RandomInteger.update_integer(10, 3) # Possible result: 9"""
def next_integer(min: in... | the_stack_v2_python_sparse | pip_services3_commons/random/RandomInteger.py | pip-services3-python/pip-services3-commons-python | train | 0 |
9cfbc9dfa72cdbbf43b496a559894a2a864fbbaf | [
"super().__init__(app, pipeline, id=id, config=config)\nself.Connection = pipeline.locate_connection(app, connection)\nself.Index = self.Config['index']\nself.ScrollTimeout = self.Config['scroll_timeout']\nself.Paging = paging\nif request_body is not None:\n self.RequestBody = request_body\nelse:\n self.Reque... | <|body_start_0|>
super().__init__(app, pipeline, id=id, config=config)
self.Connection = pipeline.locate_connection(app, connection)
self.Index = self.Config['index']
self.ScrollTimeout = self.Config['scroll_timeout']
self.Paging = paging
if request_body is not None:
... | Description: | ElasticSearchSource | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElasticSearchSource:
"""Description:"""
def __init__(self, app, pipeline, connection, request_body=None, paging=True, id=None, config=None):
"""**Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pipeli... | stack_v2_sparse_classes_36k_train_013065 | 5,123 | permissive | [
{
"docstring": "**Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pipeline Name of the Pipeline. connection : Connection Information of the connection. request_body JSON, default = None Request body needed for the request API ca... | 2 | null | Implement the Python class `ElasticSearchSource` described below.
Class description:
Description:
Method signatures and docstrings:
- def __init__(self, app, pipeline, connection, request_body=None, paging=True, id=None, config=None): **Parameters** app : Application Name of the `Application <https://asab.readthedocs... | Implement the Python class `ElasticSearchSource` described below.
Class description:
Description:
Method signatures and docstrings:
- def __init__(self, app, pipeline, connection, request_body=None, paging=True, id=None, config=None): **Parameters** app : Application Name of the `Application <https://asab.readthedocs... | 11ee3689d0ff6e9b662deeb3fc5e18bb0aabc8f2 | <|skeleton|>
class ElasticSearchSource:
"""Description:"""
def __init__(self, app, pipeline, connection, request_body=None, paging=True, id=None, config=None):
"""**Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pipeli... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElasticSearchSource:
"""Description:"""
def __init__(self, app, pipeline, connection, request_body=None, paging=True, id=None, config=None):
"""**Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pipeline Name of th... | the_stack_v2_python_sparse | bspump/elasticsearch/source.py | LibertyAces/BitSwanPump | train | 24 |
c4d1abba88c6397a581c8c08aed90b11268f0bee | [
"resp = requests.get(url, params=params)\nif resp.status_code != 200:\n logging.error('get(%s) failed(%d)' % (url, resp.status_code))\n if resp.text is not None:\n logging.error('resp: %s' % resp.text)\n return None\nreturn json.loads(resp.text)",
"resp = requests.get(url)\nif resp.status_code != ... | <|body_start_0|>
resp = requests.get(url, params=params)
if resp.status_code != 200:
logging.error('get(%s) failed(%d)' % (url, resp.status_code))
if resp.text is not None:
logging.error('resp: %s' % resp.text)
return None
return json.loads(res... | http util | HttpUtil | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HttpUtil:
"""http util"""
def get(self, url, params=None):
"""get request :param str url: url :param set params: parameters :return: json object or json array"""
<|body_0|>
def get_raw(self, url):
"""get request :param str url: url :return: response text"""
... | stack_v2_sparse_classes_36k_train_013066 | 1,033 | permissive | [
{
"docstring": "get request :param str url: url :param set params: parameters :return: json object or json array",
"name": "get",
"signature": "def get(self, url, params=None)"
},
{
"docstring": "get request :param str url: url :return: response text",
"name": "get_raw",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_010341 | Implement the Python class `HttpUtil` described below.
Class description:
http util
Method signatures and docstrings:
- def get(self, url, params=None): get request :param str url: url :param set params: parameters :return: json object or json array
- def get_raw(self, url): get request :param str url: url :return: r... | Implement the Python class `HttpUtil` described below.
Class description:
http util
Method signatures and docstrings:
- def get(self, url, params=None): get request :param str url: url :param set params: parameters :return: json object or json array
- def get_raw(self, url): get request :param str url: url :return: r... | 2d66562f364d2407977dbdcfaeff69b2d20751b5 | <|skeleton|>
class HttpUtil:
"""http util"""
def get(self, url, params=None):
"""get request :param str url: url :param set params: parameters :return: json object or json array"""
<|body_0|>
def get_raw(self, url):
"""get request :param str url: url :return: response text"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HttpUtil:
"""http util"""
def get(self, url, params=None):
"""get request :param str url: url :param set params: parameters :return: json object or json array"""
resp = requests.get(url, params=params)
if resp.status_code != 200:
logging.error('get(%s) failed(%d)' % (u... | the_stack_v2_python_sparse | exchange/utils/http_util.py | kwaktai/pyexchange | train | 0 |
63baf4ae34a81d2efa875f074c6dd316f07a7b3f | [
"n, result = (x ^ y, 0)\nwhile n:\n result += 1 if n & 1 else 0\n n = n >> 1\nreturn result",
"n, result = (x ^ y, 0)\nwhile n:\n n = n & n - 1\n result += 1\nreturn result"
] | <|body_start_0|>
n, result = (x ^ y, 0)
while n:
result += 1 if n & 1 else 0
n = n >> 1
return result
<|end_body_0|>
<|body_start_1|>
n, result = (x ^ y, 0)
while n:
n = n & n - 1
result += 1
return result
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hammingDistance(self, x, y):
""":type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%"""
<|body_0|>
def hammingDistance1(s... | stack_v2_sparse_classes_36k_train_013067 | 2,400 | no_license | [
{
"docstring": ":type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%",
"name": "hammingDistance",
"signature": "def hammingDistance(self, x, y)"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_train_015537 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hammingDistance(self, x, y): :type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样... | 2dc982e690b153c33bc7e27a63604f754a0df90c | <|skeleton|>
class Solution:
def hammingDistance(self, x, y):
""":type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%"""
<|body_0|>
def hammingDistance1(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hammingDistance(self, x, y):
""":type x: int :type y: int :rtype: int 移位实现计数 我们可以不断地检查 s 的最低位,如果最低位为 1,那么令计数器加一 然后我们令 s 整体右移一位这样 s 的最低位将被舍去,原本的次低位就变成了新的最低位。 我们重复这个过程直到 s=0 为止。这样计数器中就累计了 s 的二进制表示中 1 的数量。 时间击败95.89%,内存击败43.84%"""
n, result = (x ^ y, 0)
while n:
... | the_stack_v2_python_sparse | 461_hamming-distance.py | 95275059/Algorithm | train | 0 | |
4a3d6d94cc46d45eba91cf9d356bc5399435f139 | [
"self.config = config\nself.config['outdir'] = preprocess_paths(self.config['outdir'])\nself.train_writer = tf.summary.create_file_writer(os.path.join(config['outdir'], 'tensorboard', 'train'))\nself.eval_writer = tf.summary.create_file_writer(os.path.join(config['outdir'], 'tensorboard', 'eval'))",
"assert stage... | <|body_start_0|>
self.config = config
self.config['outdir'] = preprocess_paths(self.config['outdir'])
self.train_writer = tf.summary.create_file_writer(os.path.join(config['outdir'], 'tensorboard', 'train'))
self.eval_writer = tf.summary.create_file_writer(os.path.join(config['outdir'], ... | Customized runner module for all models | BaseRunner | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseRunner:
"""Customized runner module for all models"""
def __init__(self, config: dict):
"""running_config: batch_size: 8 num_epochs: 20 outdir: ... log_interval_steps: 200 eval_interval_steps: 200 save_interval_steps: 200"""
<|body_0|>
def _write_to_tensorboard(self,... | stack_v2_sparse_classes_36k_train_013068 | 8,770 | permissive | [
{
"docstring": "running_config: batch_size: 8 num_epochs: 20 outdir: ... log_interval_steps: 200 eval_interval_steps: 200 save_interval_steps: 200",
"name": "__init__",
"signature": "def __init__(self, config: dict)"
},
{
"docstring": "Write variables to tensorboard.",
"name": "_write_to_ten... | 2 | null | Implement the Python class `BaseRunner` described below.
Class description:
Customized runner module for all models
Method signatures and docstrings:
- def __init__(self, config: dict): running_config: batch_size: 8 num_epochs: 20 outdir: ... log_interval_steps: 200 eval_interval_steps: 200 save_interval_steps: 200
-... | Implement the Python class `BaseRunner` described below.
Class description:
Customized runner module for all models
Method signatures and docstrings:
- def __init__(self, config: dict): running_config: batch_size: 8 num_epochs: 20 outdir: ... log_interval_steps: 200 eval_interval_steps: 200 save_interval_steps: 200
-... | 7eb37838e21bd0b8c9da7e00c03245cdedfd6c80 | <|skeleton|>
class BaseRunner:
"""Customized runner module for all models"""
def __init__(self, config: dict):
"""running_config: batch_size: 8 num_epochs: 20 outdir: ... log_interval_steps: 200 eval_interval_steps: 200 save_interval_steps: 200"""
<|body_0|>
def _write_to_tensorboard(self,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseRunner:
"""Customized runner module for all models"""
def __init__(self, config: dict):
"""running_config: batch_size: 8 num_epochs: 20 outdir: ... log_interval_steps: 200 eval_interval_steps: 200 save_interval_steps: 200"""
self.config = config
self.config['outdir'] = preproc... | the_stack_v2_python_sparse | trainer/base_runners.py | freefly518/TensorflowASR | train | 0 |
30397e328b08953b783db70f30c44d84905ccd71 | [
"self.sensors: list = []\nself.host = host\nself.username = username\nself.password = password\nself.serial: str\nself.services: list = []\nself.line_services: list = []\nself.call_direction: list = []\nself.pyobihai: PyObihai = None\nself.available: bool = True",
"if not self.pyobihai:\n self.pyobihai = valid... | <|body_start_0|>
self.sensors: list = []
self.host = host
self.username = username
self.password = password
self.serial: str
self.services: list = []
self.line_services: list = []
self.call_direction: list = []
self.pyobihai: PyObihai = None
... | Contains a list of Obihai Sensors. | ObihaiConnection | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObihaiConnection:
"""Contains a list of Obihai Sensors."""
def __init__(self, host: str, username: str=DEFAULT_USERNAME, password: str=DEFAULT_PASSWORD) -> None:
"""Store configuration."""
<|body_0|>
def update(self) -> bool:
"""Validate connection and retrieve a... | stack_v2_sparse_classes_36k_train_013069 | 1,800 | permissive | [
{
"docstring": "Store configuration.",
"name": "__init__",
"signature": "def __init__(self, host: str, username: str=DEFAULT_USERNAME, password: str=DEFAULT_PASSWORD) -> None"
},
{
"docstring": "Validate connection and retrieve a list of sensors.",
"name": "update",
"signature": "def upd... | 2 | null | Implement the Python class `ObihaiConnection` described below.
Class description:
Contains a list of Obihai Sensors.
Method signatures and docstrings:
- def __init__(self, host: str, username: str=DEFAULT_USERNAME, password: str=DEFAULT_PASSWORD) -> None: Store configuration.
- def update(self) -> bool: Validate conn... | Implement the Python class `ObihaiConnection` described below.
Class description:
Contains a list of Obihai Sensors.
Method signatures and docstrings:
- def __init__(self, host: str, username: str=DEFAULT_USERNAME, password: str=DEFAULT_PASSWORD) -> None: Store configuration.
- def update(self) -> bool: Validate conn... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class ObihaiConnection:
"""Contains a list of Obihai Sensors."""
def __init__(self, host: str, username: str=DEFAULT_USERNAME, password: str=DEFAULT_PASSWORD) -> None:
"""Store configuration."""
<|body_0|>
def update(self) -> bool:
"""Validate connection and retrieve a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ObihaiConnection:
"""Contains a list of Obihai Sensors."""
def __init__(self, host: str, username: str=DEFAULT_USERNAME, password: str=DEFAULT_PASSWORD) -> None:
"""Store configuration."""
self.sensors: list = []
self.host = host
self.username = username
self.passw... | the_stack_v2_python_sparse | homeassistant/components/obihai/connectivity.py | home-assistant/core | train | 35,501 |
7c4b2b3632767f64af8cf90292fb6b4a68d33f3b | [
"super().__init__()\nself.hass = hass\nself.discovery = Discovery(DISCOVERY_TIMEOUT)\nself.discovery.add_listener(self)\nhass.data[DOMAIN].setdefault(COORDINATORS, [])",
"device = Device(device_info)\ntry:\n await device.bind()\nexcept DeviceNotBoundError:\n _LOGGER.error('Unable to bind to gree device: %s'... | <|body_start_0|>
super().__init__()
self.hass = hass
self.discovery = Discovery(DISCOVERY_TIMEOUT)
self.discovery.add_listener(self)
hass.data[DOMAIN].setdefault(COORDINATORS, [])
<|end_body_0|>
<|body_start_1|>
device = Device(device_info)
try:
await... | Discovery event handler for gree devices. | DiscoveryService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscoveryService:
"""Discovery event handler for gree devices."""
def __init__(self, hass: HomeAssistant) -> None:
"""Initialize discovery service."""
<|body_0|>
async def device_found(self, device_info: DeviceInfo) -> None:
"""Handle new device found on the netw... | stack_v2_sparse_classes_36k_train_013070 | 3,990 | permissive | [
{
"docstring": "Initialize discovery service.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant) -> None"
},
{
"docstring": "Handle new device found on the network.",
"name": "device_found",
"signature": "async def device_found(self, device_info: DeviceInfo) -> N... | 3 | null | Implement the Python class `DiscoveryService` described below.
Class description:
Discovery event handler for gree devices.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant) -> None: Initialize discovery service.
- async def device_found(self, device_info: DeviceInfo) -> None: Handle new dev... | Implement the Python class `DiscoveryService` described below.
Class description:
Discovery event handler for gree devices.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant) -> None: Initialize discovery service.
- async def device_found(self, device_info: DeviceInfo) -> None: Handle new dev... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class DiscoveryService:
"""Discovery event handler for gree devices."""
def __init__(self, hass: HomeAssistant) -> None:
"""Initialize discovery service."""
<|body_0|>
async def device_found(self, device_info: DeviceInfo) -> None:
"""Handle new device found on the netw... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiscoveryService:
"""Discovery event handler for gree devices."""
def __init__(self, hass: HomeAssistant) -> None:
"""Initialize discovery service."""
super().__init__()
self.hass = hass
self.discovery = Discovery(DISCOVERY_TIMEOUT)
self.discovery.add_listener(self... | the_stack_v2_python_sparse | homeassistant/components/gree/bridge.py | home-assistant/core | train | 35,501 |
f4f3662aec9d7935f25fd46e940741a34de23866 | [
"self._api_user = api_user\nself._api_token = api_token\nsuper(LibratoMetricPublisher, self).__init__(source, period, flush_engine)",
"import librato\nfrom librato import Queue\nconnection = librato.connect(self._api_user, self._api_token)\nreturn Queue(connection)",
"try:\n logger.info('Publishing metrics t... | <|body_start_0|>
self._api_user = api_user
self._api_token = api_token
super(LibratoMetricPublisher, self).__init__(source, period, flush_engine)
<|end_body_0|>
<|body_start_1|>
import librato
from librato import Queue
connection = librato.connect(self._api_user, self._a... | Implementation of a MetricPublisher that publishes to Librato. | LibratoMetricPublisher | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LibratoMetricPublisher:
"""Implementation of a MetricPublisher that publishes to Librato."""
def __init__(self, api_user, api_token, source, period=60, flush_engine=ThreadFlushEngine):
"""Args: api_user - The API User for Librato. api_token - The API Token for Librato. source - The i... | stack_v2_sparse_classes_36k_train_013071 | 6,667 | permissive | [
{
"docstring": "Args: api_user - The API User for Librato. api_token - The API Token for Librato. source - The identifier to use as the source of the data when publishing. period - The period in seconds at which to publish metrics. flush_engine - The type or instance of a FlushEngine used to schedule publicatio... | 3 | stack_v2_sparse_classes_30k_train_009845 | Implement the Python class `LibratoMetricPublisher` described below.
Class description:
Implementation of a MetricPublisher that publishes to Librato.
Method signatures and docstrings:
- def __init__(self, api_user, api_token, source, period=60, flush_engine=ThreadFlushEngine): Args: api_user - The API User for Libra... | Implement the Python class `LibratoMetricPublisher` described below.
Class description:
Implementation of a MetricPublisher that publishes to Librato.
Method signatures and docstrings:
- def __init__(self, api_user, api_token, source, period=60, flush_engine=ThreadFlushEngine): Args: api_user - The API User for Libra... | 73a1e7086cc4dd171456f50724246a9261febaf8 | <|skeleton|>
class LibratoMetricPublisher:
"""Implementation of a MetricPublisher that publishes to Librato."""
def __init__(self, api_user, api_token, source, period=60, flush_engine=ThreadFlushEngine):
"""Args: api_user - The API User for Librato. api_token - The API Token for Librato. source - The i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LibratoMetricPublisher:
"""Implementation of a MetricPublisher that publishes to Librato."""
def __init__(self, api_user, api_token, source, period=60, flush_engine=ThreadFlushEngine):
"""Args: api_user - The API User for Librato. api_token - The API Token for Librato. source - The identifier to ... | the_stack_v2_python_sparse | tellapart/aurproxy/metrics/publisher.py | aurora-scheduler/aurproxy | train | 1 |
eab6719c4140ce06f9b200d99e53a89fd1dc3f26 | [
"super().clean()\nif not self.location:\n raise ValidationError('Affidavit needs a certification location.')",
"if self.location:\n affidavit_string = f'affidavit sworn {self.date_string} at {self.location.string} before {self.certifier}'\nelse:\n affidavit_string = f'affidavit sworn {self.date_string} b... | <|body_start_0|>
super().clean()
if not self.location:
raise ValidationError('Affidavit needs a certification location.')
<|end_body_0|>
<|body_start_1|>
if self.location:
affidavit_string = f'affidavit sworn {self.date_string} at {self.location.string} before {self.cert... | An affidavit. | Affidavit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Affidavit:
"""An affidavit."""
def clean(self):
"""Prepare the source to be saved."""
<|body_0|>
def __html__(self) -> str:
"""Return the source's HTML representation."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().clean()
if no... | stack_v2_sparse_classes_36k_train_013072 | 1,170 | no_license | [
{
"docstring": "Prepare the source to be saved.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Return the source's HTML representation.",
"name": "__html__",
"signature": "def __html__(self) -> str"
}
] | 2 | stack_v2_sparse_classes_30k_train_000438 | Implement the Python class `Affidavit` described below.
Class description:
An affidavit.
Method signatures and docstrings:
- def clean(self): Prepare the source to be saved.
- def __html__(self) -> str: Return the source's HTML representation. | Implement the Python class `Affidavit` described below.
Class description:
An affidavit.
Method signatures and docstrings:
- def clean(self): Prepare the source to be saved.
- def __html__(self) -> str: Return the source's HTML representation.
<|skeleton|>
class Affidavit:
"""An affidavit."""
def clean(self... | 8bbdc8eec3622af22c17214051c34e36bea8e05a | <|skeleton|>
class Affidavit:
"""An affidavit."""
def clean(self):
"""Prepare the source to be saved."""
<|body_0|>
def __html__(self) -> str:
"""Return the source's HTML representation."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Affidavit:
"""An affidavit."""
def clean(self):
"""Prepare the source to be saved."""
super().clean()
if not self.location:
raise ValidationError('Affidavit needs a certification location.')
def __html__(self) -> str:
"""Return the source's HTML representa... | the_stack_v2_python_sparse | apps/sources/models/sources/affidavit.py | abdulwahed-mansour/modularhistory | train | 1 |
59f59cd7eb4b35fc744f32446aa13862591a5c89 | [
"configuration = g.user.get_api().get_configuration(configuration)\nresult = configuration.to_json()\nreturn jsonify(result)",
"configuration = g.user.get_api().get_configuration(configuration)\nconfiguration.delete()\nreturn ('', 204)"
] | <|body_start_0|>
configuration = g.user.get_api().get_configuration(configuration)
result = configuration.to_json()
return jsonify(result)
<|end_body_0|>
<|body_start_1|>
configuration = g.user.get_api().get_configuration(configuration)
configuration.delete()
return ('',... | Configuration | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Configuration:
def get(self, configuration):
"""Get Configuration with specified name."""
<|body_0|>
def delete(self, configuration):
"""Delete Configuration with specified name."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
configuration = g.user... | stack_v2_sparse_classes_36k_train_013073 | 4,125 | permissive | [
{
"docstring": "Get Configuration with specified name.",
"name": "get",
"signature": "def get(self, configuration)"
},
{
"docstring": "Delete Configuration with specified name.",
"name": "delete",
"signature": "def delete(self, configuration)"
}
] | 2 | null | Implement the Python class `Configuration` described below.
Class description:
Implement the Configuration class.
Method signatures and docstrings:
- def get(self, configuration): Get Configuration with specified name.
- def delete(self, configuration): Delete Configuration with specified name. | Implement the Python class `Configuration` described below.
Class description:
Implement the Configuration class.
Method signatures and docstrings:
- def get(self, configuration): Get Configuration with specified name.
- def delete(self, configuration): Delete Configuration with specified name.
<|skeleton|>
class Co... | 60b36434e689c3ef852ab388ca2aae370e70c62d | <|skeleton|>
class Configuration:
def get(self, configuration):
"""Get Configuration with specified name."""
<|body_0|>
def delete(self, configuration):
"""Delete Configuration with specified name."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Configuration:
def get(self, configuration):
"""Get Configuration with specified name."""
configuration = g.user.get_api().get_configuration(configuration)
result = configuration.to_json()
return jsonify(result)
def delete(self, configuration):
"""Delete Configurat... | the_stack_v2_python_sparse | Community/rest_api/configuration_page.py | bluecatlabs/gateway-workflows | train | 45 | |
d80bdc24ace8de1b89bc4a8628e70a7e5dfacbe5 | [
"super(SelfAttention, self).__init__()\nself.W = tf.keras.layers.Dense(units=units)\nself.U = tf.keras.layers.Dense(units=units)\nself.V = tf.keras.layers.Dense(units=1)",
"s_newdims = self.W(tf.expand_dims(s_prev, axis=1))\nu = self.U(hidden_states)\ne = self.V(tf.tanh(u + s_newdims))\na = tf.nn.softmax(e, axis=... | <|body_start_0|>
super(SelfAttention, self).__init__()
self.W = tf.keras.layers.Dense(units=units)
self.U = tf.keras.layers.Dense(units=units)
self.V = tf.keras.layers.Dense(units=1)
<|end_body_0|>
<|body_start_1|>
s_newdims = self.W(tf.expand_dims(s_prev, axis=1))
u = s... | to calculate the attention | SelfAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
"""to calculate the attention"""
def __init__(self, units):
"""constructor"""
<|body_0|>
def call(self, s_prev, hidden_states):
"""calculate self-atention"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(SelfAttention, self).... | stack_v2_sparse_classes_36k_train_013074 | 730 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, units)"
},
{
"docstring": "calculate self-atention",
"name": "call",
"signature": "def call(self, s_prev, hidden_states)"
}
] | 2 | null | Implement the Python class `SelfAttention` described below.
Class description:
to calculate the attention
Method signatures and docstrings:
- def __init__(self, units): constructor
- def call(self, s_prev, hidden_states): calculate self-atention | Implement the Python class `SelfAttention` described below.
Class description:
to calculate the attention
Method signatures and docstrings:
- def __init__(self, units): constructor
- def call(self, s_prev, hidden_states): calculate self-atention
<|skeleton|>
class SelfAttention:
"""to calculate the attention"""
... | bda9efa60075afa834433ff1b5179db80f2487ae | <|skeleton|>
class SelfAttention:
"""to calculate the attention"""
def __init__(self, units):
"""constructor"""
<|body_0|>
def call(self, s_prev, hidden_states):
"""calculate self-atention"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelfAttention:
"""to calculate the attention"""
def __init__(self, units):
"""constructor"""
super(SelfAttention, self).__init__()
self.W = tf.keras.layers.Dense(units=units)
self.U = tf.keras.layers.Dense(units=units)
self.V = tf.keras.layers.Dense(units=1)
d... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/1-self_attention.py | vandeldiegoc/holbertonschool-machine_learning | train | 0 |
10ff50058d0a54fefb132ec2cb52a31da2926aff | [
"urls = super(InvitationAdmin, self).get_urls()\nupload_csv = UploadCSVView.as_view(modeladmin=self)\nreturn [url('^upload-csv/$', self.admin_site.admin_view(upload_csv), name='slakslakslak_invitation_upload')] + urls",
"sent = 0\ntotal = len(queryset)\nfor invitation in queryset:\n sent += invitation.send_inv... | <|body_start_0|>
urls = super(InvitationAdmin, self).get_urls()
upload_csv = UploadCSVView.as_view(modeladmin=self)
return [url('^upload-csv/$', self.admin_site.admin_view(upload_csv), name='slakslakslak_invitation_upload')] + urls
<|end_body_0|>
<|body_start_1|>
sent = 0
total ... | InvitationAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvitationAdmin:
def get_urls(self):
"""Add an "upload CSV" URL."""
<|body_0|>
def send_invite(self, request, queryset):
"""Admin action for sending invite email. Note: the email will be sent even if it's been sent before."""
<|body_1|>
def is_claimed(se... | stack_v2_sparse_classes_36k_train_013075 | 3,309 | no_license | [
{
"docstring": "Add an \"upload CSV\" URL.",
"name": "get_urls",
"signature": "def get_urls(self)"
},
{
"docstring": "Admin action for sending invite email. Note: the email will be sent even if it's been sent before.",
"name": "send_invite",
"signature": "def send_invite(self, request, q... | 3 | stack_v2_sparse_classes_30k_train_018956 | Implement the Python class `InvitationAdmin` described below.
Class description:
Implement the InvitationAdmin class.
Method signatures and docstrings:
- def get_urls(self): Add an "upload CSV" URL.
- def send_invite(self, request, queryset): Admin action for sending invite email. Note: the email will be sent even if... | Implement the Python class `InvitationAdmin` described below.
Class description:
Implement the InvitationAdmin class.
Method signatures and docstrings:
- def get_urls(self): Add an "upload CSV" URL.
- def send_invite(self, request, queryset): Admin action for sending invite email. Note: the email will be sent even if... | 834d0983d0a9c89ba24f1cc9947f78ee34cdcefe | <|skeleton|>
class InvitationAdmin:
def get_urls(self):
"""Add an "upload CSV" URL."""
<|body_0|>
def send_invite(self, request, queryset):
"""Admin action for sending invite email. Note: the email will be sent even if it's been sent before."""
<|body_1|>
def is_claimed(se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InvitationAdmin:
def get_urls(self):
"""Add an "upload CSV" URL."""
urls = super(InvitationAdmin, self).get_urls()
upload_csv = UploadCSVView.as_view(modeladmin=self)
return [url('^upload-csv/$', self.admin_site.admin_view(upload_csv), name='slakslakslak_invitation_upload')] + ... | the_stack_v2_python_sparse | slakslakslak/admin.py | djangounderthehood/duh-web | train | 3 | |
3ac7ff60666c3ac3478b1f1ab24da1f07554c38f | [
"only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality', 'healthInsurance', 'dateOfBirth', 'phoneNumbers']\npatient_schema = PatientSchema(many=True, exclude=PatientModel.relationship_keys, only=only)\npatients_query = PatientModel.query.order_by(PatientModel.clinicID).all()... | <|body_start_0|>
only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality', 'healthInsurance', 'dateOfBirth', 'phoneNumbers']
patient_schema = PatientSchema(many=True, exclude=PatientModel.relationship_keys, only=only)
patients_query = PatientModel.query.ord... | AllPatientResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllPatientResource:
def get(self):
"""List all patients"""
<|body_0|>
def post(self):
"""Add new patient"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality',... | stack_v2_sparse_classes_36k_train_013076 | 5,115 | no_license | [
{
"docstring": "List all patients",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Add new patient",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012706 | Implement the Python class `AllPatientResource` described below.
Class description:
Implement the AllPatientResource class.
Method signatures and docstrings:
- def get(self): List all patients
- def post(self): Add new patient | Implement the Python class `AllPatientResource` described below.
Class description:
Implement the AllPatientResource class.
Method signatures and docstrings:
- def get(self): List all patients
- def post(self): Add new patient
<|skeleton|>
class AllPatientResource:
def get(self):
"""List all patients"""... | 49fe5e4740736b2d4b34489065e29bc06cb1c0d2 | <|skeleton|>
class AllPatientResource:
def get(self):
"""List all patients"""
<|body_0|>
def post(self):
"""Add new patient"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AllPatientResource:
def get(self):
"""List all patients"""
only = ['id', 'hn', 'clinicID', 'governmentID', 'napID', 'name', 'sex', 'gender', 'nationality', 'healthInsurance', 'dateOfBirth', 'phoneNumbers']
patient_schema = PatientSchema(many=True, exclude=PatientModel.relationship_keys... | the_stack_v2_python_sparse | hivclinic/namespaces/patient/patient_resource.py | LedoKun/28hiv_clinic_backend | train | 0 | |
29fb92fea72b57ffec209da8be14747c69eede46 | [
"self.hhsearch_pdb70_runner = HHSearch(binary_path=hhsearch_binary_path, databases=[pdb70_database_path])\nself.template_featurizer = template_featurizer\nself.result_path = result_path\nself.use_env = use_env",
"with open(input_fasta_path) as f:\n input_fasta_str = f.read()\ninput_seqs, input_descs = parse_fa... | <|body_start_0|>
self.hhsearch_pdb70_runner = HHSearch(binary_path=hhsearch_binary_path, databases=[pdb70_database_path])
self.template_featurizer = template_featurizer
self.result_path = result_path
self.use_env = use_env
<|end_body_0|>
<|body_start_1|>
with open(input_fasta_pa... | Runs the alignment tools and assembles the input features. | DataPipeline | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataPipeline:
"""Runs the alignment tools and assembles the input features."""
def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False):
"""Constructs a feature dict for a given FASTA file."""
... | stack_v2_sparse_classes_36k_train_013077 | 8,009 | permissive | [
{
"docstring": "Constructs a feature dict for a given FASTA file.",
"name": "__init__",
"signature": "def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False)"
},
{
"docstring": "Runs alignment tools on the in... | 2 | stack_v2_sparse_classes_30k_val_001173 | Implement the Python class `DataPipeline` described below.
Class description:
Runs the alignment tools and assembles the input features.
Method signatures and docstrings:
- def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): ... | Implement the Python class `DataPipeline` described below.
Class description:
Runs the alignment tools and assembles the input features.
Method signatures and docstrings:
- def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False): ... | c72ce898482419117550ad16d93b38298f4306a1 | <|skeleton|>
class DataPipeline:
"""Runs the alignment tools and assembles the input features."""
def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False):
"""Constructs a feature dict for a given FASTA file."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataPipeline:
"""Runs the alignment tools and assembles the input features."""
def __init__(self, hhsearch_binary_path: str, pdb70_database_path: str, template_featurizer: TemplateHitFeaturizer, result_path, use_env=False):
"""Constructs a feature dict for a given FASTA file."""
self.hhse... | the_stack_v2_python_sparse | reproduce/AlphaFold2-Chinese/data/tools/data_process.py | mindspore-ai/community | train | 193 |
b1d3b33e39a95d60e38dd35818158476e4bfa24c | [
"if value is None:\n return UNKNOWN\nelse:\n return value",
"if isinstance(value, models.CharField):\n return value\nif value is None:\n return UNKNOWN\nreturn value",
"if value is UNKNOWN or value is '':\n return None\nelse:\n return value"
] | <|body_start_0|>
if value is None:
return UNKNOWN
else:
return value
<|end_body_0|>
<|body_start_1|>
if isinstance(value, models.CharField):
return value
if value is None:
return UNKNOWN
return value
<|end_body_1|>
<|body_start_2|... | Subclass of the CharField that allows empty strings to be stored as NULL. .. important: Empty strings are equal to empty strings for uniqueness checks. However, NULL values aren't. As such, the use of this custom field enables the ability to have multiple NULL values but unique non-NULL records. | CharNullField | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharNullField:
"""Subclass of the CharField that allows empty strings to be stored as NULL. .. important: Empty strings are equal to empty strings for uniqueness checks. However, NULL values aren't. As such, the use of this custom field enables the ability to have multiple NULL values but unique ... | stack_v2_sparse_classes_36k_train_013078 | 1,701 | permissive | [
{
"docstring": "Gets value right out of the db and changes it if its ``None``.",
"name": "from_db_value",
"signature": "def from_db_value(self, value, expression, connection, contex)"
},
{
"docstring": "Gets value right out of an instance, and changes it if its ``None``.",
"name": "to_python... | 3 | stack_v2_sparse_classes_30k_train_014914 | Implement the Python class `CharNullField` described below.
Class description:
Subclass of the CharField that allows empty strings to be stored as NULL. .. important: Empty strings are equal to empty strings for uniqueness checks. However, NULL values aren't. As such, the use of this custom field enables the ability t... | Implement the Python class `CharNullField` described below.
Class description:
Subclass of the CharField that allows empty strings to be stored as NULL. .. important: Empty strings are equal to empty strings for uniqueness checks. However, NULL values aren't. As such, the use of this custom field enables the ability t... | 89383f7854f9ff5ca075e591dd95c6089eb1e556 | <|skeleton|>
class CharNullField:
"""Subclass of the CharField that allows empty strings to be stored as NULL. .. important: Empty strings are equal to empty strings for uniqueness checks. However, NULL values aren't. As such, the use of this custom field enables the ability to have multiple NULL values but unique ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CharNullField:
"""Subclass of the CharField that allows empty strings to be stored as NULL. .. important: Empty strings are equal to empty strings for uniqueness checks. However, NULL values aren't. As such, the use of this custom field enables the ability to have multiple NULL values but unique non-NULL reco... | the_stack_v2_python_sparse | leukapp/apps/core/db.py | komalsrathi/leukapp | train | 0 |
ca97795f85583ac847f6272be6701639a1f9e743 | [
"rowSets = [set('QWERTYUIOP'), set('ASDFGHJKL'), set('ZXCVBNM')]\nres = []\nfor w in words:\n s = set(w.upper())\n for r in rowSets:\n if s <= r:\n res += [w]\nreturn res",
"sums = {}\nif not root:\n return []\n\ndef subSum(root, sums):\n if not root:\n return 0\n mySum = s... | <|body_start_0|>
rowSets = [set('QWERTYUIOP'), set('ASDFGHJKL'), set('ZXCVBNM')]
res = []
for w in words:
s = set(w.upper())
for r in rowSets:
if s <= r:
res += [w]
return res
<|end_body_0|>
<|body_start_1|>
sums = {}
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
<|body_0|>
def findFrequentTreeSum(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def findMaximizedCapital(self, k, W, Profits, Capital):
"... | stack_v2_sparse_classes_36k_train_013079 | 1,885 | no_license | [
{
"docstring": ":type words: List[str] :rtype: List[str]",
"name": "findWords",
"signature": "def findWords(self, words)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "findFrequentTreeSum",
"signature": "def findFrequentTreeSum(self, root)"
},
{
"docstring"... | 3 | stack_v2_sparse_classes_30k_train_011619 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findWords(self, words): :type words: List[str] :rtype: List[str]
- def findFrequentTreeSum(self, root): :type root: TreeNode :rtype: List[int]
- def findMaximizedCapital(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findWords(self, words): :type words: List[str] :rtype: List[str]
- def findFrequentTreeSum(self, root): :type root: TreeNode :rtype: List[int]
- def findMaximizedCapital(self... | a2841fdb624548fdc6ef430e23ca46f3300e0558 | <|skeleton|>
class Solution:
def findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
<|body_0|>
def findFrequentTreeSum(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def findMaximizedCapital(self, k, W, Profits, Capital):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findWords(self, words):
""":type words: List[str] :rtype: List[str]"""
rowSets = [set('QWERTYUIOP'), set('ASDFGHJKL'), set('ZXCVBNM')]
res = []
for w in words:
s = set(w.upper())
for r in rowSets:
if s <= r:
... | the_stack_v2_python_sparse | weeklyContest18A.py | sfeng77/myleetcode | train | 1 | |
a7a4453b3d2eada603c08cbad4fd2f027930c65d | [
"def helper(root):\n if root == None:\n return ''\n ret = str(root.val) + ' '\n if root.children:\n ret += '[ '\n for c in root.children:\n ret += helper(c)\n ret += '] '\n return ret\nret = helper(root)\nreturn ret.rstrip(' ')",
"def helper(idx, data):\n root... | <|body_start_0|>
def helper(root):
if root == None:
return ''
ret = str(root.val) + ' '
if root.children:
ret += '[ '
for c in root.children:
ret += helper(c)
ret += '] '
return re... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_013080 | 1,648 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 26c6ee936cdc1914dc3598c5dc74df64fa7960a1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
def helper(root):
if root == None:
return ''
ret = str(root.val) + ' '
if root.children:
ret += '[ '
for c... | the_stack_v2_python_sparse | 428-Serialize and Deserialize N-ary Tree.py | JinnieJJ/leetcode | train | 3 | |
b0851a16c5f80dd34dc0d5374b49545dae364c8e | [
"return_type = ClientResult(context, SiteSharingReportStatus())\nbinding_type = SiteSharingReportHelper(context)\nqry = ServiceOperationQuery(binding_type, 'CancelSharingReportJob', None, None, None, return_type, True)\ncontext.add_query(qry)\nreturn return_type",
"return_type = ClientResult(context, SiteSharingR... | <|body_start_0|>
return_type = ClientResult(context, SiteSharingReportStatus())
binding_type = SiteSharingReportHelper(context)
qry = ServiceOperationQuery(binding_type, 'CancelSharingReportJob', None, None, None, return_type, True)
context.add_query(qry)
return return_type
<|end... | SiteSharingReportHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiteSharingReportHelper:
def cancel_sharing_report_job(context):
""":type context: office365.sharepoint.client_context.ClientContext"""
<|body_0|>
def create_sharing_report_job(context, web_url, folder_url):
""":type context: office365.sharepoint.client_context.Clien... | stack_v2_sparse_classes_36k_train_013081 | 1,460 | permissive | [
{
"docstring": ":type context: office365.sharepoint.client_context.ClientContext",
"name": "cancel_sharing_report_job",
"signature": "def cancel_sharing_report_job(context)"
},
{
"docstring": ":type context: office365.sharepoint.client_context.ClientContext :param str web_url: :param str folder_... | 2 | stack_v2_sparse_classes_30k_train_005666 | Implement the Python class `SiteSharingReportHelper` described below.
Class description:
Implement the SiteSharingReportHelper class.
Method signatures and docstrings:
- def cancel_sharing_report_job(context): :type context: office365.sharepoint.client_context.ClientContext
- def create_sharing_report_job(context, we... | Implement the Python class `SiteSharingReportHelper` described below.
Class description:
Implement the SiteSharingReportHelper class.
Method signatures and docstrings:
- def cancel_sharing_report_job(context): :type context: office365.sharepoint.client_context.ClientContext
- def create_sharing_report_job(context, we... | cbd245d1af8d69e013c469cfc2a9851f51c91417 | <|skeleton|>
class SiteSharingReportHelper:
def cancel_sharing_report_job(context):
""":type context: office365.sharepoint.client_context.ClientContext"""
<|body_0|>
def create_sharing_report_job(context, web_url, folder_url):
""":type context: office365.sharepoint.client_context.Clien... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SiteSharingReportHelper:
def cancel_sharing_report_job(context):
""":type context: office365.sharepoint.client_context.ClientContext"""
return_type = ClientResult(context, SiteSharingReportStatus())
binding_type = SiteSharingReportHelper(context)
qry = ServiceOperationQuery(bin... | the_stack_v2_python_sparse | office365/sharepoint/sharing/site_sharing_report_helper.py | vgrem/Office365-REST-Python-Client | train | 1,006 | |
366f3f0d1f986e2295e98e43040a59f550e8ce43 | [
"path = urls.TRAIL_LOG['GET_ALL']\nparams = {'limit': limit, 'offset': offset}\nif username:\n params['username'] = username\nif start_time:\n params['start_time'] = start_time\nif end_time:\n params['end_time'] = end_time\nif description:\n params['description'] = description\nif target:\n params['t... | <|body_start_0|>
path = urls.TRAIL_LOG['GET_ALL']
params = {'limit': limit, 'offset': offset}
if username:
params['username'] = username
if start_time:
params['start_time'] = start_time
if end_time:
params['end_time'] = end_time
if desc... | Get the audit logs and event logs with the functions in this class. | Audit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Audit:
"""Get the audit logs and event logs with the functions in this class."""
def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None):
""... | stack_v2_sparse_classes_36k_train_013082 | 7,915 | permissive | [
{
"docstring": "Get audit logs, sort by time in in reverse chronological order. This API returns the first 10,000 results only. Please use filter in the API for more relevant results. MSP Customer Would see logs of MSP's and tenants as well. :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an... | 4 | stack_v2_sparse_classes_30k_train_021172 | Implement the Python class `Audit` described below.
Class description:
Get the audit logs and event logs with the functions in this class.
Method signatures and docstrings:
- def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification... | Implement the Python class `Audit` described below.
Class description:
Get the audit logs and event logs with the functions in this class.
Method signatures and docstrings:
- def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification... | d938396a18193473afbe54e6cc6697d2bd4954a7 | <|skeleton|>
class Audit:
"""Get the audit logs and event logs with the functions in this class."""
def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Audit:
"""Get the audit logs and event logs with the functions in this class."""
def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None):
"""Get audit lo... | the_stack_v2_python_sparse | pycentral/audit_logs.py | jayp193/pycentral | train | 0 |
3a73b9590b10239a559a0c7ba3196cf12cde12d6 | [
"cartitem = CartItem.query.filter_by(cartid=self.id, itemid=item.id).first()\nif cartitem:\n cartitem.quantity += 1\nelse:\n db.session.add(CartItem(cart=self, item=item, quantity=1))\ndb.session.commit()\nself.update_price()",
"cartitem = CartItem.query.filter_by(cartid=self.id, itemid=item.id).first()\nif... | <|body_start_0|>
cartitem = CartItem.query.filter_by(cartid=self.id, itemid=item.id).first()
if cartitem:
cartitem.quantity += 1
else:
db.session.add(CartItem(cart=self, item=item, quantity=1))
db.session.commit()
self.update_price()
<|end_body_0|>
<|body... | Cart defines the table of carts in the database. Every customer has one Cart. A customer's Cart is accessible through the .cart attribute on a User of type 'Customer' | Cart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cart:
"""Cart defines the table of carts in the database. Every customer has one Cart. A customer's Cart is accessible through the .cart attribute on a User of type 'Customer'"""
def add_item(self, item):
"""Add Item >item< to cart."""
<|body_0|>
def set_quantity(self, i... | stack_v2_sparse_classes_36k_train_013083 | 9,917 | no_license | [
{
"docstring": "Add Item >item< to cart.",
"name": "add_item",
"signature": "def add_item(self, item)"
},
{
"docstring": "Directly set a >quantity< of Item argument >item<. Doesn't work if the Item is not found in the Cart.",
"name": "set_quantity",
"signature": "def set_quantity(self, i... | 5 | stack_v2_sparse_classes_30k_train_006194 | Implement the Python class `Cart` described below.
Class description:
Cart defines the table of carts in the database. Every customer has one Cart. A customer's Cart is accessible through the .cart attribute on a User of type 'Customer'
Method signatures and docstrings:
- def add_item(self, item): Add Item >item< to ... | Implement the Python class `Cart` described below.
Class description:
Cart defines the table of carts in the database. Every customer has one Cart. A customer's Cart is accessible through the .cart attribute on a User of type 'Customer'
Method signatures and docstrings:
- def add_item(self, item): Add Item >item< to ... | e7252cb03d7b19044d641b24017d88fbaecc5821 | <|skeleton|>
class Cart:
"""Cart defines the table of carts in the database. Every customer has one Cart. A customer's Cart is accessible through the .cart attribute on a User of type 'Customer'"""
def add_item(self, item):
"""Add Item >item< to cart."""
<|body_0|>
def set_quantity(self, i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cart:
"""Cart defines the table of carts in the database. Every customer has one Cart. A customer's Cart is accessible through the .cart attribute on a User of type 'Customer'"""
def add_item(self, item):
"""Add Item >item< to cart."""
cartitem = CartItem.query.filter_by(cartid=self.id, i... | the_stack_v2_python_sparse | app/models.py | dcsp-lab-4/sellout-flask | train | 3 |
c22e962e6867c9d9fbfee30c56ec0de84bbed9dd | [
"smach.State.__init__(self, outcomes=['success', 'fail'])\nself.counter_ = 0\nself.success_probability_ = 0.6",
"self.counter_ += 1\nprint('cPicking')\nif np.random.rand() < self.success_probability_:\n return 'success'\nreturn 'fail'"
] | <|body_start_0|>
smach.State.__init__(self, outcomes=['success', 'fail'])
self.counter_ = 0
self.success_probability_ = 0.6
<|end_body_0|>
<|body_start_1|>
self.counter_ += 1
print('cPicking')
if np.random.rand() < self.success_probability_:
return 'success'
... | Example of smach state | cPicking | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class cPicking:
"""Example of smach state"""
def __init__(self):
"""How to construc an state. The inputs of a state constructor are: Definition (state outcomes): We call state outcomes all the possible returns from smach.State.execute. State outcomes are strings. - outcomes: (list of strin... | stack_v2_sparse_classes_36k_train_013084 | 2,366 | no_license | [
{
"docstring": "How to construc an state. The inputs of a state constructor are: Definition (state outcomes): We call state outcomes all the possible returns from smach.State.execute. State outcomes are strings. - outcomes: (list of strings) custom outcomes for this state. - input_keys: (list of strings) The us... | 2 | stack_v2_sparse_classes_30k_train_018842 | Implement the Python class `cPicking` described below.
Class description:
Example of smach state
Method signatures and docstrings:
- def __init__(self): How to construc an state. The inputs of a state constructor are: Definition (state outcomes): We call state outcomes all the possible returns from smach.State.execut... | Implement the Python class `cPicking` described below.
Class description:
Example of smach state
Method signatures and docstrings:
- def __init__(self): How to construc an state. The inputs of a state constructor are: Definition (state outcomes): We call state outcomes all the possible returns from smach.State.execut... | f1b47f72dd617d6f0d4a711cb934951295fe23dc | <|skeleton|>
class cPicking:
"""Example of smach state"""
def __init__(self):
"""How to construc an state. The inputs of a state constructor are: Definition (state outcomes): We call state outcomes all the possible returns from smach.State.execute. State outcomes are strings. - outcomes: (list of strin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class cPicking:
"""Example of smach state"""
def __init__(self):
"""How to construc an state. The inputs of a state constructor are: Definition (state outcomes): We call state outcomes all the possible returns from smach.State.execute. State outcomes are strings. - outcomes: (list of strings) custom ou... | the_stack_v2_python_sparse | smach/catkinws/src/statemachines/src/basic_example.py | rafaelrojasmiliani/rosignite | train | 1 |
4763bebac4d86b4e61cbce3d297de04ebbcc7d01 | [
"self.domain_obj = domains.ProdDiscreteNumericDomain([[4.3, 2.1, 9.8, 10], [11.2, -23.1, 19.8], [1123, 213, 1980, 1.1]])\nself.points = [[2.1, -23.1, 1980], (10, 11.2, 1.1), [9.8, 19.8, 1123]]\nself.non_points = [[2.1 - 13.1, 1980], ('kky', 11.2, 1.1), [9.8, 19.8, 1123, 21]]",
"self.report('Testing if exception i... | <|body_start_0|>
self.domain_obj = domains.ProdDiscreteNumericDomain([[4.3, 2.1, 9.8, 10], [11.2, -23.1, 19.8], [1123, 213, 1980, 1.1]])
self.points = [[2.1, -23.1, 1980], (10, 11.2, 1.1), [9.8, 19.8, 1123]]
self.non_points = [[2.1 - 13.1, 1980], ('kky', 11.2, 1.1), [9.8, 19.8, 1123, 21]]
<|end_... | ProdDiscreteDomain Domain. | ProdDiscreteNumericDomain | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProdDiscreteNumericDomain:
"""ProdDiscreteDomain Domain."""
def _child_set_up(self):
"""Child set up."""
<|body_0|>
def test_non_numeric_prod_discrete_domain(self):
"""Constructor."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.domain_obj ... | stack_v2_sparse_classes_36k_train_013085 | 5,755 | permissive | [
{
"docstring": "Child set up.",
"name": "_child_set_up",
"signature": "def _child_set_up(self)"
},
{
"docstring": "Constructor.",
"name": "test_non_numeric_prod_discrete_domain",
"signature": "def test_non_numeric_prod_discrete_domain(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000776 | Implement the Python class `ProdDiscreteNumericDomain` described below.
Class description:
ProdDiscreteDomain Domain.
Method signatures and docstrings:
- def _child_set_up(self): Child set up.
- def test_non_numeric_prod_discrete_domain(self): Constructor. | Implement the Python class `ProdDiscreteNumericDomain` described below.
Class description:
ProdDiscreteDomain Domain.
Method signatures and docstrings:
- def _child_set_up(self): Child set up.
- def test_non_numeric_prod_discrete_domain(self): Constructor.
<|skeleton|>
class ProdDiscreteNumericDomain:
"""ProdDis... | 3eef7d30bcc2e56f2221a624bd8ec7f933f81e40 | <|skeleton|>
class ProdDiscreteNumericDomain:
"""ProdDiscreteDomain Domain."""
def _child_set_up(self):
"""Child set up."""
<|body_0|>
def test_non_numeric_prod_discrete_domain(self):
"""Constructor."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProdDiscreteNumericDomain:
"""ProdDiscreteDomain Domain."""
def _child_set_up(self):
"""Child set up."""
self.domain_obj = domains.ProdDiscreteNumericDomain([[4.3, 2.1, 9.8, 10], [11.2, -23.1, 19.8], [1123, 213, 1980, 1.1]])
self.points = [[2.1, -23.1, 1980], (10, 11.2, 1.1), [9.8... | the_stack_v2_python_sparse | dragonfly/exd/unittest_domains.py | dragonfly/dragonfly | train | 868 |
dc82ddf62b30c74dd03f2fccb985af9bae859d9c | [
"if not self.instance.check_password(value):\n raise serializers.ValidationError('Password not correct')\nreturn value",
"try:\n password_validation.validate_password(value, self.instance)\nexcept ValidationError as exc:\n raise serializers.ValidationError(exc.messages[0])\nreturn value",
"instance.set... | <|body_start_0|>
if not self.instance.check_password(value):
raise serializers.ValidationError('Password not correct')
return value
<|end_body_0|>
<|body_start_1|>
try:
password_validation.validate_password(value, self.instance)
except ValidationError as exc:
... | A serializer used to change a user password. | AccountPasswordSerializer | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountPasswordSerializer:
"""A serializer used to change a user password."""
def validate_password(self, value):
"""Check password."""
<|body_0|>
def validate_new_password(self, value):
"""Check new password."""
<|body_1|>
def update(self, instance,... | stack_v2_sparse_classes_36k_train_013086 | 18,871 | permissive | [
{
"docstring": "Check password.",
"name": "validate_password",
"signature": "def validate_password(self, value)"
},
{
"docstring": "Check new password.",
"name": "validate_new_password",
"signature": "def validate_new_password(self, value)"
},
{
"docstring": "Set new password.",
... | 3 | null | Implement the Python class `AccountPasswordSerializer` described below.
Class description:
A serializer used to change a user password.
Method signatures and docstrings:
- def validate_password(self, value): Check password.
- def validate_new_password(self, value): Check new password.
- def update(self, instance, val... | Implement the Python class `AccountPasswordSerializer` described below.
Class description:
A serializer used to change a user password.
Method signatures and docstrings:
- def validate_password(self, value): Check password.
- def validate_new_password(self, value): Check new password.
- def update(self, instance, val... | df699aab0799ec1725b6b89be38e56285821c889 | <|skeleton|>
class AccountPasswordSerializer:
"""A serializer used to change a user password."""
def validate_password(self, value):
"""Check password."""
<|body_0|>
def validate_new_password(self, value):
"""Check new password."""
<|body_1|>
def update(self, instance,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountPasswordSerializer:
"""A serializer used to change a user password."""
def validate_password(self, value):
"""Check password."""
if not self.instance.check_password(value):
raise serializers.ValidationError('Password not correct')
return value
def validate_... | the_stack_v2_python_sparse | modoboa/admin/api/v1/serializers.py | modoboa/modoboa | train | 2,201 |
a5c8756f99ae47e9b7fc83f8cacb17d248f9dbcd | [
"self.ad_options = ad_options\nself.child_restore_task_ids = child_restore_task_ids\nself.enable_auto_sync = enable_auto_sync\nself.options = options\nself.oracle_options = oracle_options\nself.restore_task_id = restore_task_id\nself.sql_options = sql_options",
"if dictionary is None:\n return None\nad_options... | <|body_start_0|>
self.ad_options = ad_options
self.child_restore_task_ids = child_restore_task_ids
self.enable_auto_sync = enable_auto_sync
self.options = options
self.oracle_options = oracle_options
self.restore_task_id = restore_task_id
self.sql_options = sql_op... | Implementation of the 'UpdateRestoreTaskParams' model. UpdateRestoreTaskParams holds the information to update a Restore Task in Magneto. Attributes: ad_options (AdRestoreOptions): Specifies the Active Directory options to update the Restore Task with. child_restore_task_ids (list of long|int): Specifies the ID of the ... | UpdateRestoreTaskParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateRestoreTaskParams:
"""Implementation of the 'UpdateRestoreTaskParams' model. UpdateRestoreTaskParams holds the information to update a Restore Task in Magneto. Attributes: ad_options (AdRestoreOptions): Specifies the Active Directory options to update the Restore Task with. child_restore_ta... | stack_v2_sparse_classes_36k_train_013087 | 4,342 | permissive | [
{
"docstring": "Constructor for the UpdateRestoreTaskParams class",
"name": "__init__",
"signature": "def __init__(self, ad_options=None, child_restore_task_ids=None, enable_auto_sync=None, options=None, oracle_options=None, restore_task_id=None, sql_options=None)"
},
{
"docstring": "Creates an ... | 2 | stack_v2_sparse_classes_30k_train_021659 | Implement the Python class `UpdateRestoreTaskParams` described below.
Class description:
Implementation of the 'UpdateRestoreTaskParams' model. UpdateRestoreTaskParams holds the information to update a Restore Task in Magneto. Attributes: ad_options (AdRestoreOptions): Specifies the Active Directory options to update ... | Implement the Python class `UpdateRestoreTaskParams` described below.
Class description:
Implementation of the 'UpdateRestoreTaskParams' model. UpdateRestoreTaskParams holds the information to update a Restore Task in Magneto. Attributes: ad_options (AdRestoreOptions): Specifies the Active Directory options to update ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class UpdateRestoreTaskParams:
"""Implementation of the 'UpdateRestoreTaskParams' model. UpdateRestoreTaskParams holds the information to update a Restore Task in Magneto. Attributes: ad_options (AdRestoreOptions): Specifies the Active Directory options to update the Restore Task with. child_restore_ta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateRestoreTaskParams:
"""Implementation of the 'UpdateRestoreTaskParams' model. UpdateRestoreTaskParams holds the information to update a Restore Task in Magneto. Attributes: ad_options (AdRestoreOptions): Specifies the Active Directory options to update the Restore Task with. child_restore_task_ids (list ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/update_restore_task_params.py | cohesity/management-sdk-python | train | 24 |
42cec95db69deba76fb93253f7dc1674b4ef595a | [
"for i in range(0, len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return (i, j)\nreturn",
"hashmap = {}\nfor ind, num in enumerate(nums):\n hashmap[num] = ind\n print(hashmap)\nfor i, num in enumerate(nums):\n j = hashmap.get(target - num)\n if... | <|body_start_0|>
for i in range(0, len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return (i, j)
return
<|end_body_0|>
<|body_start_1|>
hashmap = {}
for ind, num in enumerate(nums):
hashmap[num] = ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":solution1 :type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum1(self, nums, target):
""":solution2 :param nums: :param target: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_013088 | 1,011 | no_license | [
{
"docstring": ":solution1 :type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":solution2 :param nums: :param target: :return:",
"name": "twoSum1",
"signature": "def twoSum1(self, nums, target)"
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :solution1 :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum1(self, nums, target): :solution2 :param nums: :param target: :re... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :solution1 :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum1(self, nums, target): :solution2 :param nums: :param target: :re... | 7f89c28917c9949fd4f19d3fbbb282abeec2f427 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":solution1 :type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum1(self, nums, target):
""":solution2 :param nums: :param target: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twoSum(self, nums, target):
""":solution1 :type nums: List[int] :type target: int :rtype: List[int]"""
for i in range(0, len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
return (i, j)
return
... | the_stack_v2_python_sparse | pycode/00_sum.py | xiaoguangjj/leetcode | train | 2 | |
77213be6d0dfa1945010b7ce2bd4e8489ce071f9 | [
"self.link_state = link_state\nself.mac_addr = mac_addr\nself.name = name\nself.slot = slot\nself.speed = speed\nself.stats = stats\nself.uplink_switch_info = uplink_switch_info",
"if dictionary is None:\n return None\nlink_state = dictionary.get('linkState')\nmac_addr = dictionary.get('macAddr')\nname = dicti... | <|body_start_0|>
self.link_state = link_state
self.mac_addr = mac_addr
self.name = name
self.slot = slot
self.speed = speed
self.stats = stats
self.uplink_switch_info = uplink_switch_info
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'BondSlaveInfo' model. TODO: type description here. Attributes: link_state (string): Bond seocondary link state. mac_addr (string): Mac address of the bond secondary interface. name (string): Bond secondary name. slot (string): Bond seocondarys slot info. speed (string): Bond seocondary Speed. sta... | BondSlaveInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BondSlaveInfo:
"""Implementation of the 'BondSlaveInfo' model. TODO: type description here. Attributes: link_state (string): Bond seocondary link state. mac_addr (string): Mac address of the bond secondary interface. name (string): Bond secondary name. slot (string): Bond seocondarys slot info. s... | stack_v2_sparse_classes_36k_train_013089 | 2,969 | permissive | [
{
"docstring": "Constructor for the BondSlaveInfo class",
"name": "__init__",
"signature": "def __init__(self, link_state=None, mac_addr=None, name=None, slot=None, speed=None, stats=None, uplink_switch_info=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dict... | 2 | null | Implement the Python class `BondSlaveInfo` described below.
Class description:
Implementation of the 'BondSlaveInfo' model. TODO: type description here. Attributes: link_state (string): Bond seocondary link state. mac_addr (string): Mac address of the bond secondary interface. name (string): Bond secondary name. slot ... | Implement the Python class `BondSlaveInfo` described below.
Class description:
Implementation of the 'BondSlaveInfo' model. TODO: type description here. Attributes: link_state (string): Bond seocondary link state. mac_addr (string): Mac address of the bond secondary interface. name (string): Bond secondary name. slot ... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class BondSlaveInfo:
"""Implementation of the 'BondSlaveInfo' model. TODO: type description here. Attributes: link_state (string): Bond seocondary link state. mac_addr (string): Mac address of the bond secondary interface. name (string): Bond secondary name. slot (string): Bond seocondarys slot info. s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BondSlaveInfo:
"""Implementation of the 'BondSlaveInfo' model. TODO: type description here. Attributes: link_state (string): Bond seocondary link state. mac_addr (string): Mac address of the bond secondary interface. name (string): Bond secondary name. slot (string): Bond seocondarys slot info. speed (string)... | the_stack_v2_python_sparse | cohesity_management_sdk/models/bond_slave_info.py | cohesity/management-sdk-python | train | 24 |
64ff187fbab08187fae5d9f16b9a692ff40b43d6 | [
"self.sub_task_tracer_list = sub_task_tracer_list\nself.total_task_num = total_task_num\nself.done_task_num = 0\nself.error_task_num = 0\nself.child_task_num = 0\nself._total_task_lock = Lock()\nself._total_task_lock.acquire()\nself._modify_lock = Lock()",
"self.total_task_num = total_task_num\nif self.done_task_... | <|body_start_0|>
self.sub_task_tracer_list = sub_task_tracer_list
self.total_task_num = total_task_num
self.done_task_num = 0
self.error_task_num = 0
self.child_task_num = 0
self._total_task_lock = Lock()
self._total_task_lock.acquire()
self._modify_lock =... | A tracer to trace the situation of completion of some tasks You can register a list sub tracers when you initialize a tracer so that this tracer can automatically inform all sub tracers of the total number of sub tasks these sub tracers are tracing when all tasks traced by this tracer are done. Attributes: sub_task_tra... | TaskTracer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskTracer:
"""A tracer to trace the situation of completion of some tasks You can register a list sub tracers when you initialize a tracer so that this tracer can automatically inform all sub tracers of the total number of sub tasks these sub tracers are tracing when all tasks traced by this tra... | stack_v2_sparse_classes_36k_train_013090 | 5,281 | no_license | [
{
"docstring": "Tracer constructor A tracer can be initialized with default empty sub tracer list and unknown total task num :param sub_task_tracer_list: list of sub tracers :type sub_task_tracer_list: list :param total_task_num: total number of tasks traced by this tracer :type total_task_num: int",
"name"... | 4 | stack_v2_sparse_classes_30k_train_001422 | Implement the Python class `TaskTracer` described below.
Class description:
A tracer to trace the situation of completion of some tasks You can register a list sub tracers when you initialize a tracer so that this tracer can automatically inform all sub tracers of the total number of sub tasks these sub tracers are tr... | Implement the Python class `TaskTracer` described below.
Class description:
A tracer to trace the situation of completion of some tasks You can register a list sub tracers when you initialize a tracer so that this tracer can automatically inform all sub tracers of the total number of sub tasks these sub tracers are tr... | e7d46e3196d218c07d3b63cf7d8de91c36f20df2 | <|skeleton|>
class TaskTracer:
"""A tracer to trace the situation of completion of some tasks You can register a list sub tracers when you initialize a tracer so that this tracer can automatically inform all sub tracers of the total number of sub tasks these sub tracers are tracing when all tasks traced by this tra... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskTracer:
"""A tracer to trace the situation of completion of some tasks You can register a list sub tracers when you initialize a tracer so that this tracer can automatically inform all sub tracers of the total number of sub tasks these sub tracers are tracing when all tasks traced by this tracer are done.... | the_stack_v2_python_sparse | bxwx_crawling_pj/utils/task_tracer.py | icecream154/crawler | train | 0 |
0218ac2d0666814c0f3156b3d96d6c375dd43e3a | [
"self.ps = PastaSauce()\nself.desired_capabilities['name'] = self.id()\nif not LOCAL_RUN:\n self.teacher = Teacher(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)\nelse:\n self.teacher = Teacher(use_env_vars=True)\nself.teacher.login()\nself.teacher.select_course(appearance='col... | <|body_start_0|>
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
if not LOCAL_RUN:
self.teacher = Teacher(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)
else:
self.teacher = Teacher(use_env_vars=True)
se... | TestViewClassScores | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestViewClassScores:
def setUp(self):
"""Pretest settings."""
<|body_0|>
def tearDown(self):
"""Test destructor."""
<|body_1|>
def TestExternalFromStudentScores(self):
"""Go to https://tutor-qa.openstax.org/ Click on the 'Login' button Enter the ... | stack_v2_sparse_classes_36k_train_013091 | 5,433 | no_license | [
{
"docstring": "Pretest settings.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test destructor.",
"name": "tearDown",
"signature": "def tearDown(self)"
},
{
"docstring": "Go to https://tutor-qa.openstax.org/ Click on the 'Login' button Enter the teacher us... | 3 | stack_v2_sparse_classes_30k_train_011372 | Implement the Python class `TestViewClassScores` described below.
Class description:
Implement the TestViewClassScores class.
Method signatures and docstrings:
- def setUp(self): Pretest settings.
- def tearDown(self): Test destructor.
- def TestExternalFromStudentScores(self): Go to https://tutor-qa.openstax.org/ Cl... | Implement the Python class `TestViewClassScores` described below.
Class description:
Implement the TestViewClassScores class.
Method signatures and docstrings:
- def setUp(self): Pretest settings.
- def tearDown(self): Test destructor.
- def TestExternalFromStudentScores(self): Go to https://tutor-qa.openstax.org/ Cl... | 39751799858ac30df90760b8bb753d338e8edc46 | <|skeleton|>
class TestViewClassScores:
def setUp(self):
"""Pretest settings."""
<|body_0|>
def tearDown(self):
"""Test destructor."""
<|body_1|>
def TestExternalFromStudentScores(self):
"""Go to https://tutor-qa.openstax.org/ Click on the 'Login' button Enter the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestViewClassScores:
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
if not LOCAL_RUN:
self.teacher = Teacher(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)
else:
... | the_stack_v2_python_sparse | tutor/TestRewrite/Tutor/External/Teacher/test_external_assignment_from_scores.py | openstax/test-automation | train | 4 | |
e321f0621df4d41d281db11b08a3131b3dca656a | [
"my_request = AccessRequest(id_card, name_surname, access_type, email_address, days)\nmy_request.store_request()\nreturn my_request.access_code",
"my_key = AccessKey.create_key_from_file(keyfile)\nmy_key.store_keys()\nreturn my_key.key",
"if AccessKey.create_key_from_id(key).is_valid() and AccessKey.create_key_... | <|body_start_0|>
my_request = AccessRequest(id_card, name_surname, access_type, email_address, days)
my_request.store_request()
return my_request.access_code
<|end_body_0|>
<|body_start_1|>
my_key = AccessKey.create_key_from_file(keyfile)
my_key.store_keys()
return my_ke... | Class for providing the methods for managing the access to a building | __AccessManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class __AccessManager:
"""Class for providing the methods for managing the access to a building"""
def request_access_code(id_card, name_surname, access_type, email_address, days):
"""this method give access to the building"""
<|body_0|>
def get_access_key(keyfile):
""... | stack_v2_sparse_classes_36k_train_013092 | 2,223 | no_license | [
{
"docstring": "this method give access to the building",
"name": "request_access_code",
"signature": "def request_access_code(id_card, name_surname, access_type, email_address, days)"
},
{
"docstring": "Returns the access key for the access code & dni received in a json file",
"name": "get_... | 4 | stack_v2_sparse_classes_30k_train_010281 | Implement the Python class `__AccessManager` described below.
Class description:
Class for providing the methods for managing the access to a building
Method signatures and docstrings:
- def request_access_code(id_card, name_surname, access_type, email_address, days): this method give access to the building
- def get... | Implement the Python class `__AccessManager` described below.
Class description:
Class for providing the methods for managing the access to a building
Method signatures and docstrings:
- def request_access_code(id_card, name_surname, access_type, email_address, days): this method give access to the building
- def get... | 113c49682a63736666b95d423d9b26ab3e35d980 | <|skeleton|>
class __AccessManager:
"""Class for providing the methods for managing the access to a building"""
def request_access_code(id_card, name_surname, access_type, email_address, days):
"""this method give access to the building"""
<|body_0|>
def get_access_key(keyfile):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class __AccessManager:
"""Class for providing the methods for managing the access to a building"""
def request_access_code(id_card, name_surname, access_type, email_address, days):
"""this method give access to the building"""
my_request = AccessRequest(id_card, name_surname, access_type, email... | the_stack_v2_python_sparse | src/main/python/secure_all/access_manager.py | ncoress/G80.T7.FP | train | 0 |
f042cc6a52f31a5fdd1850f3000a4d90bf0265df | [
"def serialize_completed_analysis() -> bytes:\n return legacy_pickle.dumps(self.completed_analysis.dict())\nserialized_completed_analysis = await anyio.to_thread.run_sync(serialize_completed_analysis, cancellable=True)\nreturn {'id': self.id, 'protocol_id': self.protocol_id, 'analyzer_version': self.analyzer_ver... | <|body_start_0|>
def serialize_completed_analysis() -> bytes:
return legacy_pickle.dumps(self.completed_analysis.dict())
serialized_completed_analysis = await anyio.to_thread.run_sync(serialize_completed_analysis, cancellable=True)
return {'id': self.id, 'protocol_id': self.protocol_... | A protocol analysis that's been completed, storable in a SQL database. See `CompletedAnalysisStore`. | CompletedAnalysisResource | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompletedAnalysisResource:
"""A protocol analysis that's been completed, storable in a SQL database. See `CompletedAnalysisStore`."""
async def to_sql_values(self) -> Dict[str, object]:
"""Return this data as a dict that can be passed to a SQLALchemy insert. This potentially involves... | stack_v2_sparse_classes_36k_train_013093 | 8,687 | permissive | [
{
"docstring": "Return this data as a dict that can be passed to a SQLALchemy insert. This potentially involves heavy serialization, so it's offloaded to a worker thread. Do not modify anything while serialization is ongoing in its worker thread. Avoid calling this from inside a SQL transaction, since it might ... | 2 | stack_v2_sparse_classes_30k_val_000249 | Implement the Python class `CompletedAnalysisResource` described below.
Class description:
A protocol analysis that's been completed, storable in a SQL database. See `CompletedAnalysisStore`.
Method signatures and docstrings:
- async def to_sql_values(self) -> Dict[str, object]: Return this data as a dict that can be... | Implement the Python class `CompletedAnalysisResource` described below.
Class description:
A protocol analysis that's been completed, storable in a SQL database. See `CompletedAnalysisStore`.
Method signatures and docstrings:
- async def to_sql_values(self) -> Dict[str, object]: Return this data as a dict that can be... | 026b523c8c9e5d45910c490efb89194d72595be9 | <|skeleton|>
class CompletedAnalysisResource:
"""A protocol analysis that's been completed, storable in a SQL database. See `CompletedAnalysisStore`."""
async def to_sql_values(self) -> Dict[str, object]:
"""Return this data as a dict that can be passed to a SQLALchemy insert. This potentially involves... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompletedAnalysisResource:
"""A protocol analysis that's been completed, storable in a SQL database. See `CompletedAnalysisStore`."""
async def to_sql_values(self) -> Dict[str, object]:
"""Return this data as a dict that can be passed to a SQLALchemy insert. This potentially involves heavy serial... | the_stack_v2_python_sparse | robot-server/robot_server/protocols/completed_analysis_store.py | Opentrons/opentrons | train | 326 |
a84baa9002eabe8017b4773f548faf847610e033 | [
"self.site = pywikibot.Site()\nself.page_title = page_title\nself.linkedpages = None",
"if page_title == self.page_title:\n return True\nif not self.site.family.name == 'wikisource':\n raise Exception('This is a wikisource rule')\nif not self.linkedpages:\n verbose_output('loading page links on ' + self.... | <|body_start_0|>
self.site = pywikibot.Site()
self.page_title = page_title
self.linkedpages = None
<|end_body_0|>
<|body_start_1|>
if page_title == self.page_title:
return True
if not self.site.family.name == 'wikisource':
raise Exception('This is a wikis... | Matches of page site title and linked pages title. | LinkedPagesRule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinkedPagesRule:
"""Matches of page site title and linked pages title."""
def __init__(self, page_title: str) -> None:
"""Initializer. :param page_title: The page title for this rule"""
<|body_0|>
def match(self, page_title) -> bool:
"""Match page_title to linked... | stack_v2_sparse_classes_36k_train_013094 | 16,618 | permissive | [
{
"docstring": "Initializer. :param page_title: The page title for this rule",
"name": "__init__",
"signature": "def __init__(self, page_title: str) -> None"
},
{
"docstring": "Match page_title to linkedpages elements.",
"name": "match",
"signature": "def match(self, page_title) -> bool"... | 2 | null | Implement the Python class `LinkedPagesRule` described below.
Class description:
Matches of page site title and linked pages title.
Method signatures and docstrings:
- def __init__(self, page_title: str) -> None: Initializer. :param page_title: The page title for this rule
- def match(self, page_title) -> bool: Match... | Implement the Python class `LinkedPagesRule` described below.
Class description:
Matches of page site title and linked pages title.
Method signatures and docstrings:
- def __init__(self, page_title: str) -> None: Initializer. :param page_title: The page title for this rule
- def match(self, page_title) -> bool: Match... | 5c01e6bfcd328bc6eae643e661f1a0ae57612808 | <|skeleton|>
class LinkedPagesRule:
"""Matches of page site title and linked pages title."""
def __init__(self, page_title: str) -> None:
"""Initializer. :param page_title: The page title for this rule"""
<|body_0|>
def match(self, page_title) -> bool:
"""Match page_title to linked... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinkedPagesRule:
"""Matches of page site title and linked pages title."""
def __init__(self, page_title: str) -> None:
"""Initializer. :param page_title: The page title for this rule"""
self.site = pywikibot.Site()
self.page_title = page_title
self.linkedpages = None
... | the_stack_v2_python_sparse | scripts/patrol.py | wikimedia/pywikibot | train | 432 |
f84bebefba42d7b187dd3dbeb73ab1dd8690fbd2 | [
"ld = cls()\nld.limit_keys = set(default_data.keys())\nld.update(default_data)\nreturn ld",
"if key in self.limit_keys:\n self.data[key] = value\nelse:\n raise AttributeError('{}没有属性{}!'.format(getattr(getattr(self, '__class__'), '__name__'), key))"
] | <|body_start_0|>
ld = cls()
ld.limit_keys = set(default_data.keys())
ld.update(default_data)
return ld
<|end_body_0|>
<|body_start_1|>
if key in self.limit_keys:
self.data[key] = value
else:
raise AttributeError('{}没有属性{}!'.format(getattr(getattr(... | 限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key | LimitDict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LimitDict:
"""限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key"""
def from_limit_keys(cls, default_data):
"""使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对... | stack_v2_sparse_classes_36k_train_013095 | 4,590 | no_license | [
{
"docstring": "使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对象",
"name": "from_limit_keys",
"signature": "def from_limit_keys(cls, default_data)"
},
{
"docstring": "重写设置key->value的方法,当key在初始key集合中时,允许本次修改, 否则,抛出AttributeError Args: key: 键 ... | 2 | stack_v2_sparse_classes_30k_train_013450 | Implement the Python class `LimitDict` described below.
Class description:
限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key
Method signatures and docstrings:
- def from_limit_keys(cls, default_data): 使用default_data创建并初始化字典对象 Args: default_data:默... | Implement the Python class `LimitDict` described below.
Class description:
限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key
Method signatures and docstrings:
- def from_limit_keys(cls, default_data): 使用default_data创建并初始化字典对象 Args: default_data:默... | 3f6158a76adde1ad6c0d1bf9c8afd4d657c2a653 | <|skeleton|>
class LimitDict:
"""限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key"""
def from_limit_keys(cls, default_data):
"""使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LimitDict:
"""限制了可选择key的字典 当使用`LimitDict.from_limit_keys(cls, default_data)`创建字典对象时, 将会使用default_data初始化字典对象,且字典对象只能修改现有key的值,不能添加新的key"""
def from_limit_keys(cls, default_data):
"""使用default_data创建并初始化字典对象 Args: default_data:默认映射对象,用以创建并初始化当前对象 Returns: LimitDict:一个限制了key的LimitDict对象"""
... | the_stack_v2_python_sparse | 00-ToolClass/requests_spider_model/item.py | liangqiu1015/ZSpider | train | 0 |
e11282775f59785e41cdaba54ca532913e52bbcf | [
"project_address = Address(project_root)\nself.is_aws = project_address.protocol == 's3'\nself.is_lan = project_address.protocol == 'smb'\nself.project_root = project_root\nself.path_project = os.path.join(cache, project_address.path)\nself.s3_sample_frame = s3_sample_frame\nself.s3_ignore_fullsize_color = s3_ignor... | <|body_start_0|>
project_address = Address(project_root)
self.is_aws = project_address.protocol == 's3'
self.is_lan = project_address.protocol == 'smb'
self.project_root = project_root
self.path_project = os.path.join(cache, project_address.path)
self.s3_sample_frame = s3... | Project class to interact with S3 | Project | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Project:
"""Project class to interact with S3"""
def __init__(self, project_root, cache, csv_path, s3_sample_frame, s3_ignore_fullsize_color, verbose):
"""Project class to interact with S3 Args: project_root (str): Path of the project. cache (str): Path of the local cache. csv_path (... | stack_v2_sparse_classes_36k_train_013096 | 2,656 | permissive | [
{
"docstring": "Project class to interact with S3 Args: project_root (str): Path of the project. cache (str): Path of the local cache. csv_path (str): Path to AWS credentials .csv file s3_sample_frame (str): Sample frame to donwload (empty = first found) s3_ignore_fullsize_color (bool): Boolean to ignore full-s... | 2 | stack_v2_sparse_classes_30k_train_003565 | Implement the Python class `Project` described below.
Class description:
Project class to interact with S3
Method signatures and docstrings:
- def __init__(self, project_root, cache, csv_path, s3_sample_frame, s3_ignore_fullsize_color, verbose): Project class to interact with S3 Args: project_root (str): Path of the ... | Implement the Python class `Project` described below.
Class description:
Project class to interact with S3
Method signatures and docstrings:
- def __init__(self, project_root, cache, csv_path, s3_sample_frame, s3_ignore_fullsize_color, verbose): Project class to interact with S3 Args: project_root (str): Path of the ... | 5826244049ed45e5e38d27bbc0af826c2caee286 | <|skeleton|>
class Project:
"""Project class to interact with S3"""
def __init__(self, project_root, cache, csv_path, s3_sample_frame, s3_ignore_fullsize_color, verbose):
"""Project class to interact with S3 Args: project_root (str): Path of the project. cache (str): Path of the local cache. csv_path (... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Project:
"""Project class to interact with S3"""
def __init__(self, project_root, cache, csv_path, s3_sample_frame, s3_ignore_fullsize_color, verbose):
"""Project class to interact with S3 Args: project_root (str): Path of the project. cache (str): Path of the local cache. csv_path (str): Path to... | the_stack_v2_python_sparse | scripts/ui/project.py | facebook/facebook360_dep | train | 248 |
e7da091e9fb09a3a7097c497c0c6e12e031fd769 | [
"super(HumanExpressionSum, self).__init__()\nself.threads = threads\nreturn",
"if self._thread_column is None:\n if self.threads > 1:\n thread = 'SUM'\n else:\n thread = bran.OPTIONAL_SPACES + bran.INTEGER\n self._thread_column = bran.L_BRACKET + thread + bran.R_BRACKET\nreturn self._thread... | <|body_start_0|>
super(HumanExpressionSum, self).__init__()
self.threads = threads
return
<|end_body_0|>
<|body_start_1|>
if self._thread_column is None:
if self.threads > 1:
thread = 'SUM'
else:
thread = bran.OPTIONAL_SPACES + bra... | Changes the thread-column regular expression to match SUMS if needed | HumanExpressionSum | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HumanExpressionSum:
"""Changes the thread-column regular expression to match SUMS if needed"""
def __init__(self, threads=4):
""":param: - `threads`: number of parallel threads"""
<|body_0|>
def thread_column(self):
""":return: expression to match the thread (sum... | stack_v2_sparse_classes_36k_train_013097 | 9,671 | permissive | [
{
"docstring": ":param: - `threads`: number of parallel threads",
"name": "__init__",
"signature": "def __init__(self, threads=4)"
},
{
"docstring": ":return: expression to match the thread (sum) column",
"name": "thread_column",
"signature": "def thread_column(self)"
}
] | 2 | null | Implement the Python class `HumanExpressionSum` described below.
Class description:
Changes the thread-column regular expression to match SUMS if needed
Method signatures and docstrings:
- def __init__(self, threads=4): :param: - `threads`: number of parallel threads
- def thread_column(self): :return: expression to ... | Implement the Python class `HumanExpressionSum` described below.
Class description:
Changes the thread-column regular expression to match SUMS if needed
Method signatures and docstrings:
- def __init__(self, threads=4): :param: - `threads`: number of parallel threads
- def thread_column(self): :return: expression to ... | 2007bf3fe66edfe704e485141c55caed54fe13aa | <|skeleton|>
class HumanExpressionSum:
"""Changes the thread-column regular expression to match SUMS if needed"""
def __init__(self, threads=4):
""":param: - `threads`: number of parallel threads"""
<|body_0|>
def thread_column(self):
""":return: expression to match the thread (sum... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HumanExpressionSum:
"""Changes the thread-column regular expression to match SUMS if needed"""
def __init__(self, threads=4):
""":param: - `threads`: number of parallel threads"""
super(HumanExpressionSum, self).__init__()
self.threads = threads
return
def thread_colu... | the_stack_v2_python_sparse | utils/iperflexer/sumparser.py | AndriyZabavskyy/taf | train | 0 |
8514ffadf3f73beb9d217ae4864215c31ff6d846 | [
"params_dict = dict(self.initparams)\nparams_dict['custid'] = ''\nstatus_error_code = EnumStatusCode.PARAM_ILLEGAL.value\nreturn (params_dict, status_error_code)",
"params_dict = dict(self.initparams)\nparams_dict['custid'] = '1298712'\nstatus_error_code = EnumStatusCode.CUSTID_NOT_FIND.value\nreturn (params_dict... | <|body_start_0|>
params_dict = dict(self.initparams)
params_dict['custid'] = ''
status_error_code = EnumStatusCode.PARAM_ILLEGAL.value
return (params_dict, status_error_code)
<|end_body_0|>
<|body_start_1|>
params_dict = dict(self.initparams)
params_dict['custid'] = '129... | Weixin_Get_Openid | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Weixin_Get_Openid:
def custid_empty(self):
"""custid为空"""
<|body_0|>
def custid_not_exist(self):
"""custid为空"""
<|body_1|>
def openid_not_exist(self):
"""custid 存在unionid 但在focus表中没有找到openid"""
<|body_2|>
def open_id_find_success(sel... | stack_v2_sparse_classes_36k_train_013098 | 2,228 | no_license | [
{
"docstring": "custid为空",
"name": "custid_empty",
"signature": "def custid_empty(self)"
},
{
"docstring": "custid为空",
"name": "custid_not_exist",
"signature": "def custid_not_exist(self)"
},
{
"docstring": "custid 存在unionid 但在focus表中没有找到openid",
"name": "openid_not_exist",
... | 4 | null | Implement the Python class `Weixin_Get_Openid` described below.
Class description:
Implement the Weixin_Get_Openid class.
Method signatures and docstrings:
- def custid_empty(self): custid为空
- def custid_not_exist(self): custid为空
- def openid_not_exist(self): custid 存在unionid 但在focus表中没有找到openid
- def open_id_find_su... | Implement the Python class `Weixin_Get_Openid` described below.
Class description:
Implement the Weixin_Get_Openid class.
Method signatures and docstrings:
- def custid_empty(self): custid为空
- def custid_not_exist(self): custid为空
- def openid_not_exist(self): custid 存在unionid 但在focus表中没有找到openid
- def open_id_find_su... | 7f5c78e083812b49d32a394dd81b55dc90ccf080 | <|skeleton|>
class Weixin_Get_Openid:
def custid_empty(self):
"""custid为空"""
<|body_0|>
def custid_not_exist(self):
"""custid为空"""
<|body_1|>
def openid_not_exist(self):
"""custid 存在unionid 但在focus表中没有找到openid"""
<|body_2|>
def open_id_find_success(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Weixin_Get_Openid:
def custid_empty(self):
"""custid为空"""
params_dict = dict(self.initparams)
params_dict['custid'] = ''
status_error_code = EnumStatusCode.PARAM_ILLEGAL.value
return (params_dict, status_error_code)
def custid_not_exist(self):
"""custid为空""... | the_stack_v2_python_sparse | testcase/Loginapi/Weixin_Get_Openid_test.py | gitchenping/apitest | train | 0 | |
ef10982b6e273e7456dff909c70456075cd34d19 | [
"logs.log_info('You are using the vgK channel: Kv1p5 ')\nself.time_unit = 1000.0\nself.vrev = -65\nself.m = 1.0 / (1 + np.exp((V - -6.0) / -6.4))\nself.h = 1.0 / (1 + np.exp((V - -25.3) / 3.5))\nself._mpower = 1\nself._hpower = 1",
"self._mInf = 1.0 / (1 + np.exp((V - -6.0) / -6.4))\nself._mTau = -0.1163 * V + 8.... | <|body_start_0|>
logs.log_info('You are using the vgK channel: Kv1p5 ')
self.time_unit = 1000.0
self.vrev = -65
self.m = 1.0 / (1 + np.exp((V - -6.0) / -6.4))
self.h = 1.0 / (1 + np.exp((V - -25.3) / 3.5))
self._mpower = 1
self._hpower = 1
<|end_body_0|>
<|body_s... | Kv1.5 model from This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Kv1.5 underlies the cardiac ultra-rapid delayed rectifier potassium current (IKur) in humans. In addition, Kv1.5 channels are also expressed in many other organs, such as pulmonary ar... | Kv1p5 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Kv1p5:
"""Kv1.5 model from This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Kv1.5 underlies the cardiac ultra-rapid delayed rectifier potassium current (IKur) in humans. In addition, Kv1.5 channels are also expressed in many o... | stack_v2_sparse_classes_36k_train_013099 | 24,227 | no_license | [
{
"docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.",
"name": "_init_state",
"signature": "def _init_state(self, V)"
},
{
"docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.",
... | 2 | null | Implement the Python class `Kv1p5` described below.
Class description:
Kv1.5 model from This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Kv1.5 underlies the cardiac ultra-rapid delayed rectifier potassium current (IKur) in humans. In addition, Kv1.... | Implement the Python class `Kv1p5` described below.
Class description:
Kv1.5 model from This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Kv1.5 underlies the cardiac ultra-rapid delayed rectifier potassium current (IKur) in humans. In addition, Kv1.... | dd03ff5e3df3ef48d887a6566a6286fcd168880b | <|skeleton|>
class Kv1p5:
"""Kv1.5 model from This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Kv1.5 underlies the cardiac ultra-rapid delayed rectifier potassium current (IKur) in humans. In addition, Kv1.5 channels are also expressed in many o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Kv1p5:
"""Kv1.5 model from This channel produces well behaved action-potentials with a variety of vgNa channels. Good general-purpose vgK channel. Kv1.5 underlies the cardiac ultra-rapid delayed rectifier potassium current (IKur) in humans. In addition, Kv1.5 channels are also expressed in many other organs, ... | the_stack_v2_python_sparse | betse/science/channels/vg_k.py | R-Stefano/betse-ml | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.