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
3d715a9906517175e9b55ec47ae2e3efe802548b
[ "if rowIndex <= 0:\n return []\ncur_row = []\nfor n in range(rowIndex + 1):\n new_row = [None for _ in range(n + 1)]\n new_row[0], new_row[-1] = (1, 1)\n for j in range(1, n):\n new_row[j] = cur_row[j - 1] + cur_row[j]\n cur_row = new_row\nreturn cur_row", "res = [1]\nfor i in range(1, row_n...
<|body_start_0|> if rowIndex <= 0: return [] cur_row = [] for n in range(rowIndex + 1): new_row = [None for _ in range(n + 1)] new_row[0], new_row[-1] = (1, 1) for j in range(1, n): new_row[j] = cur_row[j - 1] + cur_row[j] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getRow(self, rowIndex: int): """根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:""" <|body_0|> def getRow_2(self, row_nums): """根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nums: 给定行数 :return: res:list 该行元素""" <|body_1|> de...
stack_v2_sparse_classes_36k_train_028400
2,416
no_license
[ { "docstring": "根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:", "name": "getRow", "signature": "def getRow(self, rowIndex: int)" }, { "docstring": "根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nums: 给定行数 :return: res:list 该行元素", "name": "getRow_2", "signature": "def g...
3
stack_v2_sparse_classes_30k_train_019775
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex: int): 根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return: - def getRow_2(self, row_nums): 根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nu...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getRow(self, rowIndex: int): 根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return: - def getRow_2(self, row_nums): 根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nu...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def getRow(self, rowIndex: int): """根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:""" <|body_0|> def getRow_2(self, row_nums): """根据给定行数返回杨辉三角该行元素。 相比上一方法的改进之处是复用了当前列。 以时间换空间。 :param row_nums: 给定行数 :return: res:list 该行元素""" <|body_1|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getRow(self, rowIndex: int): """根据给定的行数,生成杨辉三角该行元素。 :param rowIndex:杨辉三角的层数。 :return:""" if rowIndex <= 0: return [] cur_row = [] for n in range(rowIndex + 1): new_row = [None for _ in range(n + 1)] new_row[0], new_row[-1] = (1,...
the_stack_v2_python_sparse
leetcode/solved/119_.py
usnnu/python_foundation
train
0
936b76be550bf0940c281e860949bb51e2b1f8ad
[ "self.logger = logger\nself.is_trained = False\nself.supported_formats = ['pkl', 'onnx', 'pmml']\nself.name = 'Kmeans'\nself.centroids = None", "dists = dists = np.sqrt(np.abs(-2 * np.dot(self.centroids, X_b.T) + np.sum(X_b ** 2, axis=1) + np.sum(self.centroids ** 2, axis=1)[:, np.newaxis]))\nmin_dists = np.min(d...
<|body_start_0|> self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmml'] self.name = 'Kmeans' self.centroids = None <|end_body_0|> <|body_start_1|> dists = dists = np.sqrt(np.abs(-2 * np.dot(self.centroids, X_b.T) + np.sum(X_b ** 2, ...
This class contains the Kmeans model.
Kmeans_model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kmeans_model: """This class contains the Kmeans model.""" def __init__(self, logger): """Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def predict(self, X_b): """Uses the Km...
stack_v2_sparse_classes_36k_train_028401
23,712
permissive
[ { "docstring": "Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.", "name": "__init__", "signature": "def __init__(self, logger)" }, { "docstring": "Uses the Kmeans model to predict new outputs given the inputs. Parameters -...
2
stack_v2_sparse_classes_30k_val_000755
Implement the Python class `Kmeans_model` described below. Class description: This class contains the Kmeans model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - def predict(se...
Implement the Python class `Kmeans_model` described below. Class description: This class contains the Kmeans model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - def predict(se...
ccc0a7674a04ae0d00bedc38893b33184c5f68c6
<|skeleton|> class Kmeans_model: """This class contains the Kmeans model.""" def __init__(self, logger): """Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def predict(self, X_b): """Uses the Km...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kmeans_model: """This class contains the Kmeans model.""" def __init__(self, logger): """Create a :class:`Kmeans_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" self.logger = logger self.is_trained = False self.supported...
the_stack_v2_python_sparse
MMLL/models/POM3/Kmeans/Kmeans.py
Musketeer-H2020/MMLL-Robust
train
0
5159b0301198e69b3831e1e7d9e740a5defbcf32
[ "data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_calibratorConcentrations(data.data)\ndata.clear_data()", "data_O = []\nif met_ids_I:\n met_ids = met_ids_I\nelse:\n met_ids = []\n met_ids = self.get_metIDs_calibratorConcentrations()\nfor met_id in met_ids:\n rows = []\n...
<|body_start_0|> data = base_importData() data.read_csv(filename) data.format_data() self.add_calibratorConcentrations(data.data) data.clear_data() <|end_body_0|> <|body_start_1|> data_O = [] if met_ids_I: met_ids = met_ids_I else: ...
lims_calibratorsAndMixes_io
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class lims_calibratorsAndMixes_io: def import_calibratorConcentrations_add(self, filename): """table adds""" <|body_0|> def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]): """export calibrator concentrations""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_028402
1,217
permissive
[ { "docstring": "table adds", "name": "import_calibratorConcentrations_add", "signature": "def import_calibratorConcentrations_add(self, filename)" }, { "docstring": "export calibrator concentrations", "name": "export_calibratorConcentrations_csv", "signature": "def export_calibratorConce...
2
stack_v2_sparse_classes_30k_train_010161
Implement the Python class `lims_calibratorsAndMixes_io` described below. Class description: Implement the lims_calibratorsAndMixes_io class. Method signatures and docstrings: - def import_calibratorConcentrations_add(self, filename): table adds - def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]):...
Implement the Python class `lims_calibratorsAndMixes_io` described below. Class description: Implement the lims_calibratorsAndMixes_io class. Method signatures and docstrings: - def import_calibratorConcentrations_add(self, filename): table adds - def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]):...
5dfd73689674953345d523178a67b8dda10e6d47
<|skeleton|> class lims_calibratorsAndMixes_io: def import_calibratorConcentrations_add(self, filename): """table adds""" <|body_0|> def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]): """export calibrator concentrations""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class lims_calibratorsAndMixes_io: def import_calibratorConcentrations_add(self, filename): """table adds""" data = base_importData() data.read_csv(filename) data.format_data() self.add_calibratorConcentrations(data.data) data.clear_data() def export_calibratorCo...
the_stack_v2_python_sparse
SBaaS_LIMS/lims_calibratorsAndMixes_io.py
dmccloskey/SBaaS_LIMS
train
0
da3adc973fbca8c76783c53a490c50de6462e53d
[ "self.characters = characters\nself.combinationLength = combinationLength\nself.position = 0\nself.gene = list(combinations(characters, combinationLength))", "res = self.gene[self.position]\nansw = ''\nfor obj in res:\n answ += obj\nself.position += 1\nreturn answ", "if self.position <= len(self.gene) - 1:\n...
<|body_start_0|> self.characters = characters self.combinationLength = combinationLength self.position = 0 self.gene = list(combinations(characters, combinationLength)) <|end_body_0|> <|body_start_1|> res = self.gene[self.position] answ = '' for obj in res: ...
CombinationIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CombinationIterator: def __init__(self, characters: str, combinationLength: int): """A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.""" <|body_0|> def next(self) -> str: """A funct...
stack_v2_sparse_classes_36k_train_028403
1,447
no_license
[ { "docstring": "A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.", "name": "__init__", "signature": "def __init__(self, characters: str, combinationLength: int)" }, { "docstring": "A function next() that return...
3
null
Implement the Python class `CombinationIterator` described below. Class description: Implement the CombinationIterator class. Method signatures and docstrings: - def __init__(self, characters: str, combinationLength: int): A constructor that takes a string characters of sorted distinct lowercase English letters and a...
Implement the Python class `CombinationIterator` described below. Class description: Implement the CombinationIterator class. Method signatures and docstrings: - def __init__(self, characters: str, combinationLength: int): A constructor that takes a string characters of sorted distinct lowercase English letters and a...
9a960a9cc193e724696016aebbe5a55bdf5422f4
<|skeleton|> class CombinationIterator: def __init__(self, characters: str, combinationLength: int): """A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.""" <|body_0|> def next(self) -> str: """A funct...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CombinationIterator: def __init__(self, characters: str, combinationLength: int): """A constructor that takes a string characters of sorted distinct lowercase English letters and a number combinationLength as arguments.""" self.characters = characters self.combinationLength = combinati...
the_stack_v2_python_sparse
contests2019/Leetcode20191214biweekly/IteratorClass.py
BradleyPelton/Leetcode-Solutions
train
1
3eb7607bc9f8e763415a3290bcb21389307eaf27
[ "shell = eii.Parameter('shell')\ndialogCaption = 'Capture rejection reason'\ninitialComment = 'My reason for rejecting the authorization process.'\nreason = acm.UX().Dialogs().GetTextInput(shell, dialogCaption, initialComment)\nif reason and len(reason) > 0:\n parameters = acm.FDictionary()\n parameters.AtPut...
<|body_start_0|> shell = eii.Parameter('shell') dialogCaption = 'Capture rejection reason' initialComment = 'My reason for rejecting the authorization process.' reason = acm.UX().Dialogs().GetTextInput(shell, dialogCaption, initialComment) if reason and len(reason) > 0: ...
MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.
DenyMandateMenuItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenyMandateMenuItem: """MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.""" def _Deny(self, eii): """Deny the mandate. This method captures the reason why the user denied / rejected the specific mandate. It pops up a display prompti...
stack_v2_sparse_classes_36k_train_028404
27,405
no_license
[ { "docstring": "Deny the mandate. This method captures the reason why the user denied / rejected the specific mandate. It pops up a display prompting the user to capture a comment. :param eii: FExtensionInvokationInfo", "name": "_Deny", "signature": "def _Deny(self, eii)" }, { "docstring": "OnCl...
4
null
Implement the Python class `DenyMandateMenuItem` described below. Class description: MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate. Method signatures and docstrings: - def _Deny(self, eii): Deny the mandate. This method captures the reason why the user denied / re...
Implement the Python class `DenyMandateMenuItem` described below. Class description: MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate. Method signatures and docstrings: - def _Deny(self, eii): Deny the mandate. This method captures the reason why the user denied / re...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class DenyMandateMenuItem: """MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.""" def _Deny(self, eii): """Deny the mandate. This method captures the reason why the user denied / rejected the specific mandate. It pops up a display prompti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DenyMandateMenuItem: """MenuItem on Business Process Sheet used to view a historical version of a specific breached mandate.""" def _Deny(self, eii): """Deny the mandate. This method captures the reason why the user denied / rejected the specific mandate. It pops up a display prompting the user t...
the_stack_v2_python_sparse
Extensions/GenericMandates/FPythonCode/GenericMandatesMenu.py
webclinic017/fa-absa-py3
train
0
eebdc26acca3c256d2e89eda60bb90bbf6538125
[ "super(AllImageLSTM, self).__init__()\nargs.wrap_model = False\nself.args = args\nself.lstm = nn.LSTM(input_size=args.hidden_dim, hidden_size=args.hidden_dim // 2, num_layers=1, bias=True, batch_first=True, dropout=args.dropout, bidirectional=True)\nself.view_bn = nn.BatchNorm1d(args.hidden_dim * 2)\nself.view_fc =...
<|body_start_0|> super(AllImageLSTM, self).__init__() args.wrap_model = False self.args = args self.lstm = nn.LSTM(input_size=args.hidden_dim, hidden_size=args.hidden_dim // 2, num_layers=1, bias=True, batch_first=True, dropout=args.dropout, bidirectional=True) self.view_bn = nn....
AllImageLSTM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllImageLSTM: def __init__(self, args): """Given some a patch model, add add some FC layers and a shortcut to make whole image prediction""" <|body_0|> def forward(self, x): """param x: a batch of image tensors, in the order of: [Cu L CC, Pr L CC, Cu L MLO, Pr L MLO,...
stack_v2_sparse_classes_36k_train_028405
5,214
permissive
[ { "docstring": "Given some a patch model, add add some FC layers and a shortcut to make whole image prediction", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "param x: a batch of image tensors, in the order of: [Cu L CC, Pr L CC, Cu L MLO, Pr L MLO, Cu R CC, Pr R...
2
stack_v2_sparse_classes_30k_train_014167
Implement the Python class `AllImageLSTM` described below. Class description: Implement the AllImageLSTM class. Method signatures and docstrings: - def __init__(self, args): Given some a patch model, add add some FC layers and a shortcut to make whole image prediction - def forward(self, x): param x: a batch of image...
Implement the Python class `AllImageLSTM` described below. Class description: Implement the AllImageLSTM class. Method signatures and docstrings: - def __init__(self, args): Given some a patch model, add add some FC layers and a shortcut to make whole image prediction - def forward(self, x): param x: a batch of image...
12bace8fd6ce9c5bb129fd0d30a46a00a2f7b054
<|skeleton|> class AllImageLSTM: def __init__(self, args): """Given some a patch model, add add some FC layers and a shortcut to make whole image prediction""" <|body_0|> def forward(self, x): """param x: a batch of image tensors, in the order of: [Cu L CC, Pr L CC, Cu L MLO, Pr L MLO,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllImageLSTM: def __init__(self, args): """Given some a patch model, add add some FC layers and a shortcut to make whole image prediction""" super(AllImageLSTM, self).__init__() args.wrap_model = False self.args = args self.lstm = nn.LSTM(input_size=args.hidden_dim, hid...
the_stack_v2_python_sparse
onconet/models/aggregate_hiddens.py
yala/Mirai
train
66
bdf40f88103183110b6408bd9b2b330427601a58
[ "self.right_now = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')\nself.new_logs_folder_name = 'logs_' + self.right_now\nself.project_logs_folder_path = os.getcwd()\nself.project_root_dir = os.path.abspath(os.pardir)\nself.project_results_folder_path = os.path.join(self.project_root_dir, 'results')\nself.new_logs...
<|body_start_0|> self.right_now = datetime.datetime.now().strftime('%Y%m%d_%H%M%S') self.new_logs_folder_name = 'logs_' + self.right_now self.project_logs_folder_path = os.getcwd() self.project_root_dir = os.path.abspath(os.pardir) self.project_results_folder_path = os.path.join(...
Class definition
GatherAllLogFiles
[ "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GatherAllLogFiles: """Class definition""" def __init__(self): """Constructor""" <|body_0|> def _copy_result_logs(self, result_root, dst_folder): """Helper function for copying""" <|body_1|> def populate_lists(self): """make lists of the file ...
stack_v2_sparse_classes_36k_train_028406
7,726
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Helper function for copying", "name": "_copy_result_logs", "signature": "def _copy_result_logs(self, result_root, dst_folder)" }, { "docstring": "make lists of the file paths to...
5
null
Implement the Python class `GatherAllLogFiles` described below. Class description: Class definition Method signatures and docstrings: - def __init__(self): Constructor - def _copy_result_logs(self, result_root, dst_folder): Helper function for copying - def populate_lists(self): make lists of the file paths to be cop...
Implement the Python class `GatherAllLogFiles` described below. Class description: Class definition Method signatures and docstrings: - def __init__(self): Constructor - def _copy_result_logs(self, result_root, dst_folder): Helper function for copying - def populate_lists(self): make lists of the file paths to be cop...
bc7a05e04c7901f477fe553c59e478a837116d92
<|skeleton|> class GatherAllLogFiles: """Class definition""" def __init__(self): """Constructor""" <|body_0|> def _copy_result_logs(self, result_root, dst_folder): """Helper function for copying""" <|body_1|> def populate_lists(self): """make lists of the file ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GatherAllLogFiles: """Class definition""" def __init__(self): """Constructor""" self.right_now = datetime.datetime.now().strftime('%Y%m%d_%H%M%S') self.new_logs_folder_name = 'logs_' + self.right_now self.project_logs_folder_path = os.getcwd() self.project_root_dir...
the_stack_v2_python_sparse
src/CyPhyMasterInterpreter/Resources/gather_all_logfiles.py
metamorph-inc/meta-core
train
25
df2f2f5a5d5565089a18aa43077b99ef08dce518
[ "self.atr = list(atr)\nself.mask = mask\nif mask is None:\n self.maskedatr = self.atr\nelse:\n if len(self.atr) != len(self.mask):\n raise InvalidATRMaskLengthException(toHexString(mask))\n self.maskedatr = list(map(lambda x, y: x & y, self.atr, self.mask))", "if len(atr) != len(self.atr):\n re...
<|body_start_0|> self.atr = list(atr) self.mask = mask if mask is None: self.maskedatr = self.atr else: if len(self.atr) != len(self.mask): raise InvalidATRMaskLengthException(toHexString(mask)) self.maskedatr = list(map(lambda x, y: x ...
The ATRCardType defines a card from an ATR and a mask.
ATRCardType
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ATRCardType: """The ATRCardType defines a card from an ATR and a mask.""" def __init__(self, atr, mask=None): """ATRCardType constructor. @param atr: the ATR of the CardType @param mask: an optional mask to be applied to the ATR for L{CardType} matching default is None""" <|b...
stack_v2_sparse_classes_36k_train_028407
3,654
permissive
[ { "docstring": "ATRCardType constructor. @param atr: the ATR of the CardType @param mask: an optional mask to be applied to the ATR for L{CardType} matching default is None", "name": "__init__", "signature": "def __init__(self, atr, mask=None)" }, { "docstring": "Returns true if the atr matches ...
2
stack_v2_sparse_classes_30k_train_016084
Implement the Python class `ATRCardType` described below. Class description: The ATRCardType defines a card from an ATR and a mask. Method signatures and docstrings: - def __init__(self, atr, mask=None): ATRCardType constructor. @param atr: the ATR of the CardType @param mask: an optional mask to be applied to the AT...
Implement the Python class `ATRCardType` described below. Class description: The ATRCardType defines a card from an ATR and a mask. Method signatures and docstrings: - def __init__(self, atr, mask=None): ATRCardType constructor. @param atr: the ATR of the CardType @param mask: an optional mask to be applied to the AT...
a145345f9bb91bccb2bd67b349af8cfc4ec9e290
<|skeleton|> class ATRCardType: """The ATRCardType defines a card from an ATR and a mask.""" def __init__(self, atr, mask=None): """ATRCardType constructor. @param atr: the ATR of the CardType @param mask: an optional mask to be applied to the ATR for L{CardType} matching default is None""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ATRCardType: """The ATRCardType defines a card from an ATR and a mask.""" def __init__(self, atr, mask=None): """ATRCardType constructor. @param atr: the ATR of the CardType @param mask: an optional mask to be applied to the ATR for L{CardType} matching default is None""" self.atr = list(...
the_stack_v2_python_sparse
EnrollmentStation/Binaries/YubikeyManager/pymodules/smartcard/CardType.py
jnsgsbz/EnrollmentStation
train
2
1c2ceb54816dc8b38c3d2bf30b5f3a6eeef95a93
[ "if len(A) <= 0:\n return 0\nans_max_L = 0\nres_L = {}\nans_max_M = 0\nfor i in range(len(A) - L + 1):\n val = sum(A[i:i + L])\n if val > ans_max_L:\n ans_max_L = val\n res_L[val] = i\nindex_L = res_L.get(ans_max_L)\nA = A[0:index_L] + A[index_L + L:]\nfor j in range(len(A) - M + 1):\n val...
<|body_start_0|> if len(A) <= 0: return 0 ans_max_L = 0 res_L = {} ans_max_M = 0 for i in range(len(A) - L + 1): val = sum(A[i:i + L]) if val > ans_max_L: ans_max_L = val res_L[val] = i index_L = res_L.ge...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSumTwoNoOverlap(self, A, L, M): """wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int""" <|body_0|> def maxSumTwoNoOverlap1(self, A, L, M): """use DP step1:find cursum of A step2:two case about location of maxL & maxM-...
stack_v2_sparse_classes_36k_train_028408
1,893
no_license
[ { "docstring": "wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int", "name": "maxSumTwoNoOverlap", "signature": "def maxSumTwoNoOverlap(self, A, L, M)" }, { "docstring": "use DP step1:find cursum of A step2:two case about location of maxL & maxM--- one possible ca...
2
stack_v2_sparse_classes_30k_train_009782
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSumTwoNoOverlap(self, A, L, M): wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int - def maxSumTwoNoOverlap1(self, A, L, M): use DP step1:f...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSumTwoNoOverlap(self, A, L, M): wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int - def maxSumTwoNoOverlap1(self, A, L, M): use DP step1:f...
18c06a96bb14688e4a1d5fb6baf235a6b53bd3ae
<|skeleton|> class Solution: def maxSumTwoNoOverlap(self, A, L, M): """wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int""" <|body_0|> def maxSumTwoNoOverlap1(self, A, L, M): """use DP step1:find cursum of A step2:two case about location of maxL & maxM-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSumTwoNoOverlap(self, A, L, M): """wrong--局部最优,要找的是两个子序列的和最优 :type A: List[int] :type L: int :type M: int :rtype: int""" if len(A) <= 0: return 0 ans_max_L = 0 res_L = {} ans_max_M = 0 for i in range(len(A) - L + 1): val ...
the_stack_v2_python_sparse
medium/others/maximum-sum-of-two-non-overlapping-subarrays.py
congyingTech/Basic-Algorithm
train
10
1685004e4fc9ab680723247e09eea555598ad07c
[ "common_templates_dir: Text = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.sep + '..' + os.sep + 'templates')\ntemplates: List = list()\nif isinstance(templates_dir, list):\n templates.extend(templates_dir)\n templates.append(common_templates_dir)\nelse:\n templates.append(templates_dir...
<|body_start_0|> common_templates_dir: Text = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + os.sep + '..' + os.sep + 'templates') templates: List = list() if isinstance(templates_dir, list): templates.extend(templates_dir) templates.append(common_templates...
Class for writing files based on Jinja2 templates.
Jinja2TemplateRenderer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Jinja2TemplateRenderer: """Class for writing files based on Jinja2 templates.""" def __init__(self, templates_dir: Union[Text, List]='templates') -> None: """Constructor for Jinja2TemplateRenderer. :param templates_dir: The directory containing templates.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_028409
3,297
permissive
[ { "docstring": "Constructor for Jinja2TemplateRenderer. :param templates_dir: The directory containing templates.", "name": "__init__", "signature": "def __init__(self, templates_dir: Union[Text, List]='templates') -> None" }, { "docstring": "Renders and writes html templates. :param template_na...
2
stack_v2_sparse_classes_30k_train_003951
Implement the Python class `Jinja2TemplateRenderer` described below. Class description: Class for writing files based on Jinja2 templates. Method signatures and docstrings: - def __init__(self, templates_dir: Union[Text, List]='templates') -> None: Constructor for Jinja2TemplateRenderer. :param templates_dir: The dir...
Implement the Python class `Jinja2TemplateRenderer` described below. Class description: Class for writing files based on Jinja2 templates. Method signatures and docstrings: - def __init__(self, templates_dir: Union[Text, List]='templates') -> None: Constructor for Jinja2TemplateRenderer. :param templates_dir: The dir...
eac1deadc0fe793539e24d5843d4ab552bab833b
<|skeleton|> class Jinja2TemplateRenderer: """Class for writing files based on Jinja2 templates.""" def __init__(self, templates_dir: Union[Text, List]='templates') -> None: """Constructor for Jinja2TemplateRenderer. :param templates_dir: The directory containing templates.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Jinja2TemplateRenderer: """Class for writing files based on Jinja2 templates.""" def __init__(self, templates_dir: Union[Text, List]='templates') -> None: """Constructor for Jinja2TemplateRenderer. :param templates_dir: The directory containing templates.""" common_templates_dir: Text = o...
the_stack_v2_python_sparse
viya_ark_library/jinja2/sas_jinja2.py
framhc/viya4-ark
train
0
fab05cb37308ede0c4fd5f4b37a5b98ae5487725
[ "if not str_A:\n return 0\nstr_A = str_A.strip()\nstr_arr = list(str_A)\nres = []\nflag = 1\nfor ind, val in enumerate(str_arr):\n if val == '+' and ind == 0:\n flag = 1\n continue\n if val == '-' and ind == 0:\n flag = -1\n continue\n if val in [str(i) for i in list(range(0,...
<|body_start_0|> if not str_A: return 0 str_A = str_A.strip() str_arr = list(str_A) res = [] flag = 1 for ind, val in enumerate(str_arr): if val == '+' and ind == 0: flag = 1 continue if val == '-' and in...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def myAtoi(self, str_A): """:type str: str :rtype: int""" <|body_0|> def myAtoi2(self, s): """:type str: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not str_A: return 0 str_A = str_A.strip() ...
stack_v2_sparse_classes_36k_train_028410
2,304
no_license
[ { "docstring": ":type str: str :rtype: int", "name": "myAtoi", "signature": "def myAtoi(self, str_A)" }, { "docstring": ":type str: str :rtype: int", "name": "myAtoi2", "signature": "def myAtoi2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myAtoi(self, str_A): :type str: str :rtype: int - def myAtoi2(self, s): :type str: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myAtoi(self, str_A): :type str: str :rtype: int - def myAtoi2(self, s): :type str: str :rtype: int <|skeleton|> class Solution: def myAtoi(self, str_A): """:typ...
beabfd31379f44ffd767fc676912db5022495b53
<|skeleton|> class Solution: def myAtoi(self, str_A): """:type str: str :rtype: int""" <|body_0|> def myAtoi2(self, s): """:type str: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def myAtoi(self, str_A): """:type str: str :rtype: int""" if not str_A: return 0 str_A = str_A.strip() str_arr = list(str_A) res = [] flag = 1 for ind, val in enumerate(str_arr): if val == '+' and ind == 0: ...
the_stack_v2_python_sparse
leetCode/top50/008StringtoInteger.py
fatezy/Algorithm
train
1
c91b5275a9fe06c4aea878982c9309ba23598782
[ "self.obj = obj\nfor arg in alias_names:\n self.register_key(arg)", "if isinstance(key, str):\n key = sys.intern(key)\nself[key] = self.obj" ]
<|body_start_0|> self.obj = obj for arg in alias_names: self.register_key(arg) <|end_body_0|> <|body_start_1|> if isinstance(key, str): key = sys.intern(key) self[key] = self.obj <|end_body_1|>
AliasDict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliasDict: def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: """AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to""" ...
stack_v2_sparse_classes_36k_train_028411
1,034
no_license
[ { "docstring": "AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to", "name": "__init__", "signature": "def __init__(self, alias_names: Iterable[Hashable], obj: o...
2
stack_v2_sparse_classes_30k_train_021432
Implement the Python class `AliasDict` described below. Class description: Implement the AliasDict class. Method signatures and docstrings: - def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to...
Implement the Python class `AliasDict` described below. Class description: Implement the AliasDict class. Method signatures and docstrings: - def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to...
c8690379dd9ca383cf3257a281094e4851677faa
<|skeleton|> class AliasDict: def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: """AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AliasDict: def __init__(self, alias_names: Iterable[Hashable], obj: object) -> None: """AliasDict Create a dictionary of pointers to an object Args: alias_names (Iterable[Hashable]): keys to be used, assumed to be immutable i.e. hashable obj (object): object the keys must point to""" self.obj ...
the_stack_v2_python_sparse
pymethods/utils/alias_dict.py
IFF-0303/pymethods
train
0
2eb0c0e123dd47ece3e80d85d120740c1320289d
[ "study_id = filter_params.pop('study_id', None)\nq = ReadGroupGenomicFile.query.filter_by(**filter_params)\nfrom dataservice.api.participant.models import Participant\nfrom dataservice.api.biospecimen.models import Biospecimen\nfrom dataservice.api.genomic_file.models import GenomicFile\nfrom dataservice.api.biospe...
<|body_start_0|> study_id = filter_params.pop('study_id', None) q = ReadGroupGenomicFile.query.filter_by(**filter_params) from dataservice.api.participant.models import Participant from dataservice.api.biospecimen.models import Biospecimen from dataservice.api.genomic_file.models...
ReadGroupGenomicFile List API
ReadGroupGenomicFileListAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadGroupGenomicFileListAPI: """ReadGroupGenomicFile List API""" def get(self, filter_params, after, limit): """Get a paginated read_group_genomic_files --- template: path: get_list.yml properties: resource: ReadGroupGenomicFile""" <|body_0|> def post(self): """C...
stack_v2_sparse_classes_36k_train_028412
5,383
permissive
[ { "docstring": "Get a paginated read_group_genomic_files --- template: path: get_list.yml properties: resource: ReadGroupGenomicFile", "name": "get", "signature": "def get(self, filter_params, after, limit)" }, { "docstring": "Create a new read_group_genomic_file --- template: path: new_resource...
2
null
Implement the Python class `ReadGroupGenomicFileListAPI` described below. Class description: ReadGroupGenomicFile List API Method signatures and docstrings: - def get(self, filter_params, after, limit): Get a paginated read_group_genomic_files --- template: path: get_list.yml properties: resource: ReadGroupGenomicFil...
Implement the Python class `ReadGroupGenomicFileListAPI` described below. Class description: ReadGroupGenomicFile List API Method signatures and docstrings: - def get(self, filter_params, after, limit): Get a paginated read_group_genomic_files --- template: path: get_list.yml properties: resource: ReadGroupGenomicFil...
36ee3fc3d1ba9d1a177274d051fb175c56dd898e
<|skeleton|> class ReadGroupGenomicFileListAPI: """ReadGroupGenomicFile List API""" def get(self, filter_params, after, limit): """Get a paginated read_group_genomic_files --- template: path: get_list.yml properties: resource: ReadGroupGenomicFile""" <|body_0|> def post(self): """C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadGroupGenomicFileListAPI: """ReadGroupGenomicFile List API""" def get(self, filter_params, after, limit): """Get a paginated read_group_genomic_files --- template: path: get_list.yml properties: resource: ReadGroupGenomicFile""" study_id = filter_params.pop('study_id', None) q ...
the_stack_v2_python_sparse
dataservice/api/read_group_genomic_file/resources.py
kids-first/kf-api-dataservice
train
9
53db8120db5decfdf113fa370870572bbbbadc84
[ "ne_ref = [] if ne_ref is None else ne_ref\njson = {'name': name, 'ne_ref': ne_ref, 'operator': operator}\nreturn json", "sub_expression = [] if sub_expression is None else [sub_expression]\njson = {'name': name, 'operator': operator, 'ne_ref': ne_ref, 'sub_expression': sub_expression, 'comment': comment}\nreturn...
<|body_start_0|> ne_ref = [] if ne_ref is None else ne_ref json = {'name': name, 'ne_ref': ne_ref, 'operator': operator} return json <|end_body_0|> <|body_start_1|> sub_expression = [] if sub_expression is None else [sub_expression] json = {'name': name, 'operator': operator, 'n...
Expressions are used to build boolean like objects used in policy. For example, if you wanted to create an expression that negates a specific set of network elements to use in a "NOT" rule, an expression would be the element type. For example, adding a rule that negates (network A or network B):: sub_expression = Expre...
Expression
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Expression: """Expressions are used to build boolean like objects used in policy. For example, if you wanted to create an expression that negates a specific set of network elements to use in a "NOT" rule, an expression would be the element type. For example, adding a rule that negates (network A ...
stack_v2_sparse_classes_36k_train_028413
24,780
permissive
[ { "docstring": "Static method to build and return the proper json for a sub-expression. A sub-expression would be the grouping of network elements used as a target match. For example, (network A or network B) would be considered a sub-expression. This can be used to compound sub-expressions before calling creat...
2
null
Implement the Python class `Expression` described below. Class description: Expressions are used to build boolean like objects used in policy. For example, if you wanted to create an expression that negates a specific set of network elements to use in a "NOT" rule, an expression would be the element type. For example,...
Implement the Python class `Expression` described below. Class description: Expressions are used to build boolean like objects used in policy. For example, if you wanted to create an expression that negates a specific set of network elements to use in a "NOT" rule, an expression would be the element type. For example,...
54386c8a710727cc1acf69334a57b155d2f5408c
<|skeleton|> class Expression: """Expressions are used to build boolean like objects used in policy. For example, if you wanted to create an expression that negates a specific set of network elements to use in a "NOT" rule, an expression would be the element type. For example, adding a rule that negates (network A ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Expression: """Expressions are used to build boolean like objects used in policy. For example, if you wanted to create an expression that negates a specific set of network elements to use in a "NOT" rule, an expression would be the element type. For example, adding a rule that negates (network A or network B)...
the_stack_v2_python_sparse
smc/elements/network.py
gabstopper/smc-python
train
31
a3a777a18022111b81a565503bf9a2246dd90bbb
[ "super().__init__()\nself.normalizer = normalizer\nif self.normalizer is None:\n self.fitted = True\nif aggregator is None:\n aggregator = AverageAggregator()\nself.aggregator = aggregator", "if self.normalizer is not None:\n x = self.normalizer(x)\nx = self.aggregator(x)\nreturn x", "if self.normalize...
<|body_start_0|> super().__init__() self.normalizer = normalizer if self.normalizer is None: self.fitted = True if aggregator is None: aggregator = AverageAggregator() self.aggregator = aggregator <|end_body_0|> <|body_start_1|> if self.normalizer...
Ensembler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ensembler: def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): """An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` objec...
stack_v2_sparse_classes_36k_train_028414
9,337
permissive
[ { "docstring": "An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` object to normalize the scores. If ``None`` then no normalization is applied. aggregator `BaseTransformTorch` object to aggregate t...
3
stack_v2_sparse_classes_30k_train_009336
Implement the Python class `Ensembler` described below. Class description: Implement the Ensembler class. Method signatures and docstrings: - def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): An Ensembler applies normalization and aggregation operations to the sco...
Implement the Python class `Ensembler` described below. Class description: Implement the Ensembler class. Method signatures and docstrings: - def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): An Ensembler applies normalization and aggregation operations to the sco...
4a1b4f74a8590117965421e86c2295bff0f33e89
<|skeleton|> class Ensembler: def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): """An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` objec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ensembler: def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): """An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` object to normalize...
the_stack_v2_python_sparse
alibi_detect/od/pytorch/ensemble.py
SeldonIO/alibi-detect
train
1,922
0df4bde1b6f4554f89f6ec69b315fe2a45f0786a
[ "self.intent_type = intent_type\nself.domain = domain\nself.service = service\nself.speech = speech", "hass = intent_obj.hass\nslots = self.async_validate_slots(intent_obj.slots)\nstate = async_match_state(hass, slots['name']['value'])\nawait hass.services.async_call(self.domain, self.service, {ATTR_ENTITY_ID: st...
<|body_start_0|> self.intent_type = intent_type self.domain = domain self.service = service self.speech = speech <|end_body_0|> <|body_start_1|> hass = intent_obj.hass slots = self.async_validate_slots(intent_obj.slots) state = async_match_state(hass, slots['name...
Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.
ServiceIntentHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServiceIntentHandler: """Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.""" def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: """Create Service Intent Handler.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_028415
8,241
permissive
[ { "docstring": "Create Service Intent Handler.", "name": "__init__", "signature": "def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None" }, { "docstring": "Handle the hass intent.", "name": "async_handle", "signature": "async def async_handle(self, intent_...
2
stack_v2_sparse_classes_30k_train_013185
Implement the Python class `ServiceIntentHandler` described below. Class description: Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id. Method signatures and docstrings: - def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: C...
Implement the Python class `ServiceIntentHandler` described below. Class description: Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id. Method signatures and docstrings: - def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: C...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ServiceIntentHandler: """Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.""" def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: """Create Service Intent Handler.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServiceIntentHandler: """Service Intent handler registration. Service specific intent handler that calls a service by name/entity_id.""" def __init__(self, intent_type: str, domain: str, service: str, speech: str) -> None: """Create Service Intent Handler.""" self.intent_type = intent_typ...
the_stack_v2_python_sparse
homeassistant/helpers/intent.py
BenWoodford/home-assistant
train
11
f03ac6f1c5b3195905159d7351005912baf91630
[ "assert in_channels % 2 == 0, 'in_channels should be divisible by 2'\nsuper().__init__()\nself.half_channels = in_channels // 2\nself.use_only_mean = use_only_mean\nself.input_conv = nn.Conv1D(self.half_channels, hidden_channels, 1)\nself.encoder = WaveNet(in_channels=-1, out_channels=-1, kernel_size=kernel_size, l...
<|body_start_0|> assert in_channels % 2 == 0, 'in_channels should be divisible by 2' super().__init__() self.half_channels = in_channels // 2 self.use_only_mean = use_only_mean self.input_conv = nn.Conv1D(self.half_channels, hidden_channels, 1) self.encoder = WaveNet(in_c...
Residual affine coupling layer.
ResidualAffineCouplingLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualAffineCouplingLayer: """Residual affine coupling layer.""" def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: int=-1, dropout_rate: float=0.0, use_weight_norm: bool=True, bias: bo...
stack_v2_sparse_classes_36k_train_028416
9,159
permissive
[ { "docstring": "Initialzie ResidualAffineCouplingLayer module. Args: in_channels (int): Number of input channels. hidden_channels (int): Number of hidden channels. kernel_size (int): Kernel size for WaveNet. base_dilation (int): Base dilation factor for WaveNet. layers (int): Number of layers of WaveNet. stacks...
2
null
Implement the Python class `ResidualAffineCouplingLayer` described below. Class description: Residual affine coupling layer. Method signatures and docstrings: - def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: i...
Implement the Python class `ResidualAffineCouplingLayer` described below. Class description: Residual affine coupling layer. Method signatures and docstrings: - def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: i...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class ResidualAffineCouplingLayer: """Residual affine coupling layer.""" def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: int=-1, dropout_rate: float=0.0, use_weight_norm: bool=True, bias: bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualAffineCouplingLayer: """Residual affine coupling layer.""" def __init__(self, in_channels: int=192, hidden_channels: int=192, kernel_size: int=5, base_dilation: int=1, layers: int=5, stacks: int=1, global_channels: int=-1, dropout_rate: float=0.0, use_weight_norm: bool=True, bias: bool=True, use_...
the_stack_v2_python_sparse
paddlespeech/t2s/models/vits/residual_coupling.py
anniyanvr/DeepSpeech-1
train
0
67a1c4bd52df576b0ffbb7180ccd00fcc7f6ec34
[ "if self.singledot is not None and self.doubledot is not None and (self.dotregime is not None):\n return True\nelse:\n return False", "if self.pinchoff is not None:\n return True\nelse:\n return False" ]
<|body_start_0|> if self.singledot is not None and self.doubledot is not None and (self.dotregime is not None): return True else: return False <|end_body_0|> <|body_start_1|> if self.pinchoff is not None: return True else: return False <|e...
Class grouping binary classifiers required for tuning. Parameters: pinchoff (optional nt.Classifier): pre-trained pinch-off classifier. singledot (optional nt.Classifier): pre-trained single dot classifier. doubledot (optional nt.Classifier): pre-trained double dot classifier. dotregime (optional nt.Classifier): pre-tr...
Classifiers
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Classifiers: """Class grouping binary classifiers required for tuning. Parameters: pinchoff (optional nt.Classifier): pre-trained pinch-off classifier. singledot (optional nt.Classifier): pre-trained single dot classifier. doubledot (optional nt.Classifier): pre-trained double dot classifier. dot...
stack_v2_sparse_classes_36k_train_028417
7,268
permissive
[ { "docstring": "Checks if dot classifiers are specified/not None. If so, the `Classifiers` instance can be used in a dot tuning algorithm.", "name": "is_dot_classifier", "signature": "def is_dot_classifier(self) -> bool" }, { "docstring": "Checks if pinch-off classifier is specified/not None. If...
2
stack_v2_sparse_classes_30k_train_012730
Implement the Python class `Classifiers` described below. Class description: Class grouping binary classifiers required for tuning. Parameters: pinchoff (optional nt.Classifier): pre-trained pinch-off classifier. singledot (optional nt.Classifier): pre-trained single dot classifier. doubledot (optional nt.Classifier):...
Implement the Python class `Classifiers` described below. Class description: Class grouping binary classifiers required for tuning. Parameters: pinchoff (optional nt.Classifier): pre-trained pinch-off classifier. singledot (optional nt.Classifier): pre-trained single dot classifier. doubledot (optional nt.Classifier):...
caf50f78c335cd1af4ed11e02c100ddf8d6755a5
<|skeleton|> class Classifiers: """Class grouping binary classifiers required for tuning. Parameters: pinchoff (optional nt.Classifier): pre-trained pinch-off classifier. singledot (optional nt.Classifier): pre-trained single dot classifier. doubledot (optional nt.Classifier): pre-trained double dot classifier. dot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Classifiers: """Class grouping binary classifiers required for tuning. Parameters: pinchoff (optional nt.Classifier): pre-trained pinch-off classifier. singledot (optional nt.Classifier): pre-trained single dot classifier. doubledot (optional nt.Classifier): pre-trained double dot classifier. dotregime (optio...
the_stack_v2_python_sparse
nanotune/tuningstages/settings.py
picarro-yren/nanotune
train
0
13322461e8e0238b7b5b14f835abcbe5fad75e0b
[ "self.courseID = courseID\nself.jobID = jobID\nself.submissionLanguage = submissionLanguage\nself.directoryFormat = directoryFormat\nself.baseFile = baseFile\nself.userEmail = userEmail\nself.toggleEmail = toggleEmail\nself.fRoot = fRoot\nself.fOut = fOut", "path = os.path.join(dirname, 'folderizer.py')\nprint('s...
<|body_start_0|> self.courseID = courseID self.jobID = jobID self.submissionLanguage = submissionLanguage self.directoryFormat = directoryFormat self.baseFile = baseFile self.userEmail = userEmail self.toggleEmail = toggleEmail self.fRoot = fRoot s...
The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.
jobRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class jobRequest: """The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.""" def __init__(self, courseID, jobID, submissionLanguage, directoryFormat, baseF...
stack_v2_sparse_classes_36k_train_028418
6,136
no_license
[ { "docstring": "Constructor of the Job Request that we submit to the MOSS server The job object takes 8 parameters namely: CourseID(course associated with user account) jobID(unique identifier of submitted job) submissionLanguage - Coding language utilised for code file submissions to MOSS directoryFormat - For...
6
stack_v2_sparse_classes_30k_train_005339
Implement the Python class `jobRequest` described below. Class description: The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server. Method signatures and docstrings: - def __init...
Implement the Python class `jobRequest` described below. Class description: The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server. Method signatures and docstrings: - def __init...
2c0d408a5ff930c34be669737ff4b6d0ae13da2f
<|skeleton|> class jobRequest: """The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.""" def __init__(self, courseID, jobID, submissionLanguage, directoryFormat, baseF...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class jobRequest: """The function of the jobRequest class is to unzip submission files, form the appropriate MOSS shell command, exceute it and receive output. The class handles the various states of the MOSS server.""" def __init__(self, courseID, jobID, submissionLanguage, directoryFormat, baseFile, userEmai...
the_stack_v2_python_sparse
backend/SSRG/Jobs/MossBackendJobs/jobRequest.py
Suvanth/SSRG-Django-Website
train
0
2fade3223644e7be5d016bfe25bf763879696566
[ "if root == None:\n return False\nelif root.left == None and root.right == None:\n if sum == root.val:\n return True\n else:\n return False\nelse:\n return self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)", "if root is None:\n return False\nsta...
<|body_start_0|> if root == None: return False elif root.left == None and root.right == None: if sum == root.val: return True else: return False else: return self.hasPathSum(root.left, sum - root.val) or self.hasPath...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root...
stack_v2_sparse_classes_36k_train_028419
1,258
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" }, { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool <|skeleton|...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" if root == None: return False elif root.left == None and root.right == None: if sum == root.val: return True else: retur...
the_stack_v2_python_sparse
code/112#Path Sum.py
EachenKuang/LeetCode
train
28
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/admissions-cost/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/admissions-cost/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.statu...
<|body_start_0|> url = '/admissions-cost/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/admissions-cost/' self.client.login(username=self.adminUN, password='pass') response...
AdmissionsCostTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdmissionsCostTestCase: def test_not_logged_in(self): """Test that the admissions costs view will not load whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the admissions costs view will load whilst logged in as admin.""" <|bod...
stack_v2_sparse_classes_36k_train_028420
26,818
permissive
[ { "docstring": "Test that the admissions costs view will not load whilst not logged in.", "name": "test_not_logged_in", "signature": "def test_not_logged_in(self)" }, { "docstring": "Test that the admissions costs view will load whilst logged in as admin.", "name": "test_logged_in_admin", ...
3
null
Implement the Python class `AdmissionsCostTestCase` described below. Class description: Implement the AdmissionsCostTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the admissions costs view will not load whilst not logged in. - def test_logged_in_admin(self): Test that the ...
Implement the Python class `AdmissionsCostTestCase` described below. Class description: Implement the AdmissionsCostTestCase class. Method signatures and docstrings: - def test_not_logged_in(self): Test that the admissions costs view will not load whilst not logged in. - def test_logged_in_admin(self): Test that the ...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class AdmissionsCostTestCase: def test_not_logged_in(self): """Test that the admissions costs view will not load whilst not logged in.""" <|body_0|> def test_logged_in_admin(self): """Test that the admissions costs view will load whilst logged in as admin.""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdmissionsCostTestCase: def test_not_logged_in(self): """Test that the admissions costs view will not load whilst not logged in.""" url = '/admissions-cost/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) def test_lo...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
1941dca737d2baaef65cf0b403cb3cb0fb67b085
[ "self.cumhelper = CUMHelper(commu_ip, commu_port)\nself.cumhelper.chvolume(commu_volume)\nself.debug_handler = debug_handler\nrospy.loginfo('CommUWrapper instance created.')", "rospy.loginfo(\"Saying '%s' in %s..\", utterance, 'English' if english else 'Japanese')\nif self.debug_handler is not None:\n self.deb...
<|body_start_0|> self.cumhelper = CUMHelper(commu_ip, commu_port) self.cumhelper.chvolume(commu_volume) self.debug_handler = debug_handler rospy.loginfo('CommUWrapper instance created.') <|end_body_0|> <|body_start_1|> rospy.loginfo("Saying '%s' in %s..", utterance, 'English' if...
CommUWrapper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommUWrapper: def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): """Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU ...
stack_v2_sparse_classes_36k_train_028421
3,119
no_license
[ { "docstring": "Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU to control. :param commu_port: The port of the CommUManager on the CommU. :param commu_volume: The volume of the CommU. P...
3
stack_v2_sparse_classes_30k_train_000672
Implement the Python class `CommUWrapper` described below. Class description: Implement the CommUWrapper class. Method signatures and docstrings: - def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): Instantiates a new CommUWrapper instance. This wraps all the functions of ...
Implement the Python class `CommUWrapper` described below. Class description: Implement the CommUWrapper class. Method signatures and docstrings: - def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): Instantiates a new CommUWrapper instance. This wraps all the functions of ...
53aedca77d1f61437a22d0c52093555fb815d79b
<|skeleton|> class CommUWrapper: def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): """Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommUWrapper: def __init__(self, commu_ip='127.0.0.1', commu_port=6019, commu_volume=10, debug_handler=None): """Instantiates a new CommUWrapper instance. This wraps all the functions of the CommU Helper python library, found under ./helper/. :param commu_ip: The ip address of the CommU to control. :p...
the_stack_v2_python_sparse
src/commu_wrapper/src/wrapper.py
mgmeedendorp/ros-commu
train
2
c8b1c1b2d2ab18f52a9460373d356f84e597c542
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(username=username, email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username, email, password=password)\nuser.is_admin = True\nuser.is_staff...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_36k_train_028422
3,320
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, username, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name"...
2
stack_v2_sparse_classes_30k_train_002922
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, username,...
8b33a29e60d84853f8c1e92d7a4ca88c6ee349b4
<|skeleton|> class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, username, email, password): """Creates and saves a superuser with the given em...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, username, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normaliz...
the_stack_v2_python_sparse
accounts/models.py
falbellaihi1/BST
train
0
0ab3d46aa9155999d1bccc5fb25b5041d5be5896
[ "super().setUpClass()\ncls.application = 'mysql-innodb-cluster'\ncls.test_config = lifecycle_utils.get_charm_config(fatal=False)\ncls.states = cls.test_config.get('target_deploy_status', {})", "logging.info('Scale in test: remove leader')\nleader, nons = generic_utils.get_leaders_and_non_leaders(self.application_...
<|body_start_0|> super().setUpClass() cls.application = 'mysql-innodb-cluster' cls.test_config = lifecycle_utils.get_charm_config(fatal=False) cls.states = cls.test_config.get('target_deploy_status', {}) <|end_body_0|> <|body_start_1|> logging.info('Scale in test: remove leader'...
Percona Cluster cold start tests.
MySQLInnoDBClusterScaleTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLInnoDBClusterScaleTest: """Percona Cluster cold start tests.""" def setUpClass(cls): """Run class setup for running mysql-innodb-cluster scale tests.""" <|body_0|> def test_800_remove_leader(self): """Remove leader node. We start with a three node cluster, r...
stack_v2_sparse_classes_36k_train_028423
45,009
permissive
[ { "docstring": "Run class setup for running mysql-innodb-cluster scale tests.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Remove leader node. We start with a three node cluster, remove one, down to two. The cluster will be in waiting state.", "name": "test_8...
5
null
Implement the Python class `MySQLInnoDBClusterScaleTest` described below. Class description: Percona Cluster cold start tests. Method signatures and docstrings: - def setUpClass(cls): Run class setup for running mysql-innodb-cluster scale tests. - def test_800_remove_leader(self): Remove leader node. We start with a ...
Implement the Python class `MySQLInnoDBClusterScaleTest` described below. Class description: Percona Cluster cold start tests. Method signatures and docstrings: - def setUpClass(cls): Run class setup for running mysql-innodb-cluster scale tests. - def test_800_remove_leader(self): Remove leader node. We start with a ...
3b17ad9d97c57b6e62797d4e3333e4b83e43a447
<|skeleton|> class MySQLInnoDBClusterScaleTest: """Percona Cluster cold start tests.""" def setUpClass(cls): """Run class setup for running mysql-innodb-cluster scale tests.""" <|body_0|> def test_800_remove_leader(self): """Remove leader node. We start with a three node cluster, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQLInnoDBClusterScaleTest: """Percona Cluster cold start tests.""" def setUpClass(cls): """Run class setup for running mysql-innodb-cluster scale tests.""" super().setUpClass() cls.application = 'mysql-innodb-cluster' cls.test_config = lifecycle_utils.get_charm_config(fa...
the_stack_v2_python_sparse
zaza/openstack/charm_tests/mysql/tests.py
openstack-charmers/zaza-openstack-tests
train
7
786f0d598dd75e66c4184f07bc00043bfd2af4fc
[ "super().__init__()\nself.linear1 = nn.Linear(in_channels, in_channels // r)\nself.linear2 = nn.Linear(in_channels // r, in_channels)", "input_x = x\nx = x.view(*x.shape[:-2], -1).mean(-1)\nx = F.relu(self.linear1(x), inplace=True)\nx = self.linear2(x)\nx = x.unsqueeze(-1).unsqueeze(-1)\nx = torch.sigmoid(x)\nx =...
<|body_start_0|> super().__init__() self.linear1 = nn.Linear(in_channels, in_channels // r) self.linear2 = nn.Linear(in_channels // r, in_channels) <|end_body_0|> <|body_start_1|> input_x = x x = x.view(*x.shape[:-2], -1).mean(-1) x = F.relu(self.linear1(x), inplace=True...
The channel-wise SE (Squeeze and Excitation) block from the `Squeeze-and-Excitation Networks`__ paper. Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178 Shape: - Input: (batch, channels, height, width)...
cSE
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cSE: """The channel-wise SE (Squeeze and Excitation) block from the `Squeeze-and-Excitation Networks`__ paper. Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178 Shape: - Input: (...
stack_v2_sparse_classes_36k_train_028424
3,491
permissive
[ { "docstring": "Args: in_channels: The number of channels in the feature map of the input. r: The reduction ratio of the intermediate channels. Default: 16.", "name": "__init__", "signature": "def __init__(self, in_channels: int, r: int=16)" }, { "docstring": "Forward call.", "name": "forwar...
2
null
Implement the Python class `cSE` described below. Class description: The channel-wise SE (Squeeze and Excitation) block from the `Squeeze-and-Excitation Networks`__ paper. Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-chall...
Implement the Python class `cSE` described below. Class description: The channel-wise SE (Squeeze and Excitation) block from the `Squeeze-and-Excitation Networks`__ paper. Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-chall...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class cSE: """The channel-wise SE (Squeeze and Excitation) block from the `Squeeze-and-Excitation Networks`__ paper. Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178 Shape: - Input: (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cSE: """The channel-wise SE (Squeeze and Excitation) block from the `Squeeze-and-Excitation Networks`__ paper. Adapted from https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/65939 and https://www.kaggle.com/c/tgs-salt-identification-challenge/discussion/66178 Shape: - Input: (batch, channe...
the_stack_v2_python_sparse
catalyst/contrib/layers/se.py
catalyst-team/catalyst
train
3,038
a52cd2eea3173b51848685de09680f67ad60bcdf
[ "cursor = connection.cursor()\nparent_ad_rep_id = None\nif ad_rep_dict.get('parent_ad_rep_id'):\n try:\n parent_ad_rep_id = AdRep.objects.get(id=ad_rep_dict.get('parent_ad_rep_id')).id\n except AdRep.DoesNotExist:\n pass\ncursor.execute('\\n INSERT INTO firestorm_adrep(consumer_ptr_id...
<|body_start_0|> cursor = connection.cursor() parent_ad_rep_id = None if ad_rep_dict.get('parent_ad_rep_id'): try: parent_ad_rep_id = AdRep.objects.get(id=ad_rep_dict.get('parent_ad_rep_id')).id except AdRep.DoesNotExist: pass curso...
Manager class of AdRep,
AdRepManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdRepManager: """Manager class of AdRep,""" def create_ad_rep_from_consumer(self, consumer_id, ad_rep_dict): """Create an ad_rep for an existing consumer.""" <|body_0|> def create_ad_rep_from_ad_rep_lead(self, consumer_id, ad_rep_dict): """Convert ad ad_rep_lead ...
stack_v2_sparse_classes_36k_train_028425
28,242
no_license
[ { "docstring": "Create an ad_rep for an existing consumer.", "name": "create_ad_rep_from_consumer", "signature": "def create_ad_rep_from_consumer(self, consumer_id, ad_rep_dict)" }, { "docstring": "Convert ad ad_rep_lead into an ad_rep.", "name": "create_ad_rep_from_ad_rep_lead", "signat...
3
null
Implement the Python class `AdRepManager` described below. Class description: Manager class of AdRep, Method signatures and docstrings: - def create_ad_rep_from_consumer(self, consumer_id, ad_rep_dict): Create an ad_rep for an existing consumer. - def create_ad_rep_from_ad_rep_lead(self, consumer_id, ad_rep_dict): Co...
Implement the Python class `AdRepManager` described below. Class description: Manager class of AdRep, Method signatures and docstrings: - def create_ad_rep_from_consumer(self, consumer_id, ad_rep_dict): Create an ad_rep for an existing consumer. - def create_ad_rep_from_ad_rep_lead(self, consumer_id, ad_rep_dict): Co...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class AdRepManager: """Manager class of AdRep,""" def create_ad_rep_from_consumer(self, consumer_id, ad_rep_dict): """Create an ad_rep for an existing consumer.""" <|body_0|> def create_ad_rep_from_ad_rep_lead(self, consumer_id, ad_rep_dict): """Convert ad ad_rep_lead ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdRepManager: """Manager class of AdRep,""" def create_ad_rep_from_consumer(self, consumer_id, ad_rep_dict): """Create an ad_rep for an existing consumer.""" cursor = connection.cursor() parent_ad_rep_id = None if ad_rep_dict.get('parent_ad_rep_id'): try: ...
the_stack_v2_python_sparse
firestorm/models.py
wcirillo/ten
train
0
62ef813b1adc90b6faf9187825ff5c0c6204b629
[ "process_dic = {}\nfor key, value in request.GET.items():\n process_dic[key] = value\nsign = process_dic.pop('sign', None)\nalipay = AliPay(appid='2016091800536621', app_notify_url='http://47.106.211.59:8008/alipay/return/', app_private_key_path=private_key_path, alipay_public_key_path=ali_pub_path, debug=True, ...
<|body_start_0|> process_dic = {} for key, value in request.GET.items(): process_dic[key] = value sign = process_dic.pop('sign', None) alipay = AliPay(appid='2016091800536621', app_notify_url='http://47.106.211.59:8008/alipay/return/', app_private_key_path=private_key_path, a...
支付宝接口
AlipayView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlipayView: """支付宝接口""" def get(self, request): """处理return_url返回 :param request: :return:""" <|body_0|> def post(self, request): """处理notify_url :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> process_dic = {} f...
stack_v2_sparse_classes_36k_train_028426
6,734
no_license
[ { "docstring": "处理return_url返回 :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "处理notify_url :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_007866
Implement the Python class `AlipayView` described below. Class description: 支付宝接口 Method signatures and docstrings: - def get(self, request): 处理return_url返回 :param request: :return: - def post(self, request): 处理notify_url :param request: :return:
Implement the Python class `AlipayView` described below. Class description: 支付宝接口 Method signatures and docstrings: - def get(self, request): 处理return_url返回 :param request: :return: - def post(self, request): 处理notify_url :param request: :return: <|skeleton|> class AlipayView: """支付宝接口""" def get(self, requ...
3ccc9bd50653ee38d59a5b8c4f4fa19d19f0b874
<|skeleton|> class AlipayView: """支付宝接口""" def get(self, request): """处理return_url返回 :param request: :return:""" <|body_0|> def post(self, request): """处理notify_url :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlipayView: """支付宝接口""" def get(self, request): """处理return_url返回 :param request: :return:""" process_dic = {} for key, value in request.GET.items(): process_dic[key] = value sign = process_dic.pop('sign', None) alipay = AliPay(appid='2016091800536621',...
the_stack_v2_python_sparse
apps/trade/views.py
LYQCOOL/Vueshops
train
1
7e2642811b17392adf07f375f495fd57aeb24639
[ "super().__init__()\nself.last_batch = data.get('last_batch', None)\nself.batch_size: Optional[int] = data.get('batch_size')\nself.dataset: Optional[Dataset] = None\nif data.get('dataset'):\n self.set_dataset(data.get('dataset', {}))\nself.transform: OrderedDict = OrderedDict()\nif data.get('transform'):\n fo...
<|body_start_0|> super().__init__() self.last_batch = data.get('last_batch', None) self.batch_size: Optional[int] = data.get('batch_size') self.dataset: Optional[Dataset] = None if data.get('dataset'): self.set_dataset(data.get('dataset', {})) self.transform: ...
Configuration Dataloader class.
Dataloader
[ "MIT", "Intel", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataloader: """Configuration Dataloader class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Dataloader class.""" <|body_0|> def set_dataset(self, dataset_data: Dict[str, Any]) -> None: """Set dataset for dataloader.""" ...
stack_v2_sparse_classes_36k_train_028427
4,560
permissive
[ { "docstring": "Initialize Configuration Dataloader class.", "name": "__init__", "signature": "def __init__(self, data: Dict[str, Any]={}) -> None" }, { "docstring": "Set dataset for dataloader.", "name": "set_dataset", "signature": "def set_dataset(self, dataset_data: Dict[str, Any]) ->...
3
stack_v2_sparse_classes_30k_train_005833
Implement the Python class `Dataloader` described below. Class description: Configuration Dataloader class. Method signatures and docstrings: - def __init__(self, data: Dict[str, Any]={}) -> None: Initialize Configuration Dataloader class. - def set_dataset(self, dataset_data: Dict[str, Any]) -> None: Set dataset for...
Implement the Python class `Dataloader` described below. Class description: Configuration Dataloader class. Method signatures and docstrings: - def __init__(self, data: Dict[str, Any]={}) -> None: Initialize Configuration Dataloader class. - def set_dataset(self, dataset_data: Dict[str, Any]) -> None: Set dataset for...
3976edc4215398e69ce0213f87ec295f5dc96e0e
<|skeleton|> class Dataloader: """Configuration Dataloader class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Dataloader class.""" <|body_0|> def set_dataset(self, dataset_data: Dict[str, Any]) -> None: """Set dataset for dataloader.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataloader: """Configuration Dataloader class.""" def __init__(self, data: Dict[str, Any]={}) -> None: """Initialize Configuration Dataloader class.""" super().__init__() self.last_batch = data.get('last_batch', None) self.batch_size: Optional[int] = data.get('batch_size')...
the_stack_v2_python_sparse
neural_compressor/ux/utils/workload/dataloader.py
Skp80/neural-compressor
train
0
654656ad224f1759df6d1e43b28e57c958ef5c41
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. In addition to usin...
AlertPolicyServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlertPolicyServiceServicer: """The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify pe...
stack_v2_sparse_classes_36k_train_028428
7,568
permissive
[ { "docstring": "Lists the existing alerting policies for the project.", "name": "ListAlertPolicies", "signature": "def ListAlertPolicies(self, request, context)" }, { "docstring": "Gets a single alerting policy.", "name": "GetAlertPolicy", "signature": "def GetAlertPolicy(self, request, ...
5
stack_v2_sparse_classes_30k_train_008361
Implement the Python class `AlertPolicyServiceServicer` described below. Class description: The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to b...
Implement the Python class `AlertPolicyServiceServicer` described below. Class description: The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to b...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class AlertPolicyServiceServicer: """The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify pe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlertPolicyServiceServicer: """The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or servi...
the_stack_v2_python_sparse
monitoring/google/cloud/monitoring_v3/proto/alert_service_pb2_grpc.py
tswast/google-cloud-python
train
1
c04d96fa29b707d39bf204ba32c9791d7af2db15
[ "super(WaitForPersonState, self).__init__(outcomes=['done', 'failure'])\nself._target_sub_topic = target_sub_topic\nself._persons = None\nself._start_sec = 0\nself._start_nsec = 0\nself._sub = ProxySubscriberCached({self._target_sub_topic: MinimalHumans})", "self._persons = self._sub.get_last_msg(self._target_sub...
<|body_start_0|> super(WaitForPersonState, self).__init__(outcomes=['done', 'failure']) self._target_sub_topic = target_sub_topic self._persons = None self._start_sec = 0 self._start_nsec = 0 self._sub = ProxySubscriberCached({self._target_sub_topic: MinimalHumans}) <|end...
Implements a state that returns true if there is a face published on the given topic. -- target_sub_topic String The topic for the coordinates where to gaze. <= done There is a person. <= failure Something bad happend.
WaitForPersonState
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WaitForPersonState: """Implements a state that returns true if there is a face published on the given topic. -- target_sub_topic String The topic for the coordinates where to gaze. <= done There is a person. <= failure Something bad happend.""" def __init__(self, target_sub_topic='/hace/peop...
stack_v2_sparse_classes_36k_train_028429
1,815
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, target_sub_topic='/hace/people')" }, { "docstring": "Execute this state", "name": "execute", "signature": "def execute(self, userdata)" }, { "docstring": "Upon entering the state, save the start ti...
3
stack_v2_sparse_classes_30k_train_013069
Implement the Python class `WaitForPersonState` described below. Class description: Implements a state that returns true if there is a face published on the given topic. -- target_sub_topic String The topic for the coordinates where to gaze. <= done There is a person. <= failure Something bad happend. Method signatur...
Implement the Python class `WaitForPersonState` described below. Class description: Implements a state that returns true if there is a face published on the given topic. -- target_sub_topic String The topic for the coordinates where to gaze. <= done There is a person. <= failure Something bad happend. Method signatur...
12af38bbb13b4da70c41cf397bde4d79e21a6d28
<|skeleton|> class WaitForPersonState: """Implements a state that returns true if there is a face published on the given topic. -- target_sub_topic String The topic for the coordinates where to gaze. <= done There is a person. <= failure Something bad happend.""" def __init__(self, target_sub_topic='/hace/peop...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WaitForPersonState: """Implements a state that returns true if there is a face published on the given topic. -- target_sub_topic String The topic for the coordinates where to gaze. <= done There is a person. <= failure Something bad happend.""" def __init__(self, target_sub_topic='/hace/people'): ...
the_stack_v2_python_sparse
meka_flexbe_states/src/meka_flexbe_states/WaitForPerson.py
CentralLabFacilities/meka_behaviors
train
0
8b49d0aff9689bdd4a533f118287fd64aa426859
[ "m = len(matrix)\nn = len(matrix[0])\nlow = 0\nhigh = m * n - 1\nwhile low <= high:\n mid = (low + high) // 2\n if matrix[mid // n][mid % n] > target:\n high = mid - 1\n elif matrix[mid // n][mid % n] < target:\n low = mid + 1\n else:\n return True\nreturn False", "m = len(matrix)...
<|body_start_0|> m = len(matrix) n = len(matrix[0]) low = 0 high = m * n - 1 while low <= high: mid = (low + high) // 2 if matrix[mid // n][mid % n] > target: high = mid - 1 elif matrix[mid // n][mid % n] < target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: """74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找""" <|body_0|> def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """240. 搜索二维矩阵 II 行升序,列升序 从左下角开始遍历""" ...
stack_v2_sparse_classes_36k_train_028430
3,089
no_license
[ { "docstring": "74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找", "name": "searchMatrix74", "signature": "def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool" }, { "docstring": "240. 搜索二维矩阵 II 行升序,列升序 从左下角开始遍历", "name": "searchMatrix", "signature": "def searchMatr...
3
stack_v2_sparse_classes_30k_train_003032
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: 74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找 - def searchMatrix(self, matrix: List[List[int]], tar...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: 74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找 - def searchMatrix(self, matrix: List[List[int]], tar...
3fd69b85f52af861ff7e2c74d8aacc515b192615
<|skeleton|> class Solution: def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: """74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找""" <|body_0|> def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: """240. 搜索二维矩阵 II 行升序,列升序 从左下角开始遍历""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix74(self, matrix: List[List[int]], target: int) -> bool: """74. 搜索二维矩阵 行升序,每行的第一个整数大于前一行的最后一个整数 映射为一个升序数组,一次二分查找""" m = len(matrix) n = len(matrix[0]) low = 0 high = m * n - 1 while low <= high: mid = (low + high) // 2 ...
the_stack_v2_python_sparse
Array/Array_search_74_240_81.py
helloprogram6/leetcode_Cookbook_python
train
0
0bf6bdb6674094afc967ed5f99f7d3559e2129e2
[ "if 'tag' in self.request.GET:\n return self.model.objects.filter(tags__title=self.request.GET['tag']).order_by('date_created')\nreturn self.model.objects.all().order_by('date_created')", "context = super().get_context_data(**kwargs)\nquery_params = self.request.GET.copy()\nquery_params.pop('page', None)\ncont...
<|body_start_0|> if 'tag' in self.request.GET: return self.model.objects.filter(tags__title=self.request.GET['tag']).order_by('date_created') return self.model.objects.all().order_by('date_created') <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) ...
Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews
ListingList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListingList: """Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews""" def get_queryset(self) -> QuerySet[Listing]: """Filters by tag if "tag" is in query_params. Order by '...
stack_v2_sparse_classes_36k_train_028431
4,095
no_license
[ { "docstring": "Filters by tag if \"tag\" is in query_params. Order by 'date_created'", "name": "get_queryset", "signature": "def get_queryset(self) -> QuerySet[Listing]" }, { "docstring": "Cleans 'page' query param between requests for pagination", "name": "get_context_data", "signature...
2
stack_v2_sparse_classes_30k_train_012497
Implement the Python class `ListingList` described below. Class description: Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews Method signatures and docstrings: - def get_queryset(self) -> QuerySet[Listing...
Implement the Python class `ListingList` described below. Class description: Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews Method signatures and docstrings: - def get_queryset(self) -> QuerySet[Listing...
c71b81757e4fe2ec58b70e6434ad252032ae55ee
<|skeleton|> class ListingList: """Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews""" def get_queryset(self) -> QuerySet[Listing]: """Filters by tag if "tag" is in query_params. Order by '...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListingList: """Base class for displaying a list of listings :param model: Listing subclass :param paginate_by: pagination limit :param template_name: base template for listviews""" def get_queryset(self) -> QuerySet[Listing]: """Filters by tag if "tag" is in query_params. Order by 'date_created'...
the_stack_v2_python_sparse
ecom_website/listings/views/base.py
ivanmclennon/e-commerce
train
0
d5d5a5ef94395dafa56ab9300a52d0266ad518f7
[ "super().__init__()\nself._dfetcher1 = BaselineDirectoryFetcher(dpath1)\nself._dfetcher2 = BaselineDirectoryFetcher(dpath2)\nself._tests = tests\nself._kernels = kernels\nself._codenames = codenames", "result = {'source': self._dfetcher1.dpath, 'target': self._dfetcher2.dpath}\nfor test in self._tests:\n for k...
<|body_start_0|> super().__init__() self._dfetcher1 = BaselineDirectoryFetcher(dpath1) self._dfetcher2 = BaselineDirectoryFetcher(dpath2) self._tests = tests self._kernels = kernels self._codenames = codenames <|end_body_0|> <|body_start_1|> result = {'source': s...
Class for comparing baselines between directories
DirectoryComparator
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectoryComparator: """Class for comparing baselines between directories""" def __init__(self, dpath1, dpath2, tests, kernels, codenames): """Initialize 2 BaselineDirectoryFetcher""" <|body_0|> def compare(self, auxiliary=False): """Compare data between director...
stack_v2_sparse_classes_36k_train_028432
10,002
permissive
[ { "docstring": "Initialize 2 BaselineDirectoryFetcher", "name": "__init__", "signature": "def __init__(self, dpath1, dpath2, tests, kernels, codenames)" }, { "docstring": "Compare data between directories", "name": "compare", "signature": "def compare(self, auxiliary=False)" } ]
2
stack_v2_sparse_classes_30k_train_019735
Implement the Python class `DirectoryComparator` described below. Class description: Class for comparing baselines between directories Method signatures and docstrings: - def __init__(self, dpath1, dpath2, tests, kernels, codenames): Initialize 2 BaselineDirectoryFetcher - def compare(self, auxiliary=False): Compare ...
Implement the Python class `DirectoryComparator` described below. Class description: Class for comparing baselines between directories Method signatures and docstrings: - def __init__(self, dpath1, dpath2, tests, kernels, codenames): Initialize 2 BaselineDirectoryFetcher - def compare(self, auxiliary=False): Compare ...
028ace17e73dabb40601ecca95fea28bb6da4b4a
<|skeleton|> class DirectoryComparator: """Class for comparing baselines between directories""" def __init__(self, dpath1, dpath2, tests, kernels, codenames): """Initialize 2 BaselineDirectoryFetcher""" <|body_0|> def compare(self, auxiliary=False): """Compare data between director...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirectoryComparator: """Class for comparing baselines between directories""" def __init__(self, dpath1, dpath2, tests, kernels, codenames): """Initialize 2 BaselineDirectoryFetcher""" super().__init__() self._dfetcher1 = BaselineDirectoryFetcher(dpath1) self._dfetcher2 = B...
the_stack_v2_python_sparse
tools/compare_baselines/utils/comparator.py
firecracker-microvm/firecracker
train
22,629
a1a395007d8647610334b0fa4c1d0a8bbcd872c0
[ "if not builder:\n raise ValueError('Quorum Server Builder is not specified')\nif not endpointReporter:\n raise ValueError('End-point reporter is not specified')\nself.__builder = builder\nself.__endpointReporter = endpointReporter", "if not server:\n raise ValueError('Quorum Server is not specified')\ni...
<|body_start_0|> if not builder: raise ValueError('Quorum Server Builder is not specified') if not endpointReporter: raise ValueError('End-point reporter is not specified') self.__builder = builder self.__endpointReporter = endpointReporter <|end_body_0|> <|body_...
QuorumServerReporter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuorumServerReporter: def __init__(self, builder, endpointReporter): """@types: QuorumServerBuilder, netutils.EndpointReporter @raise ValueError: Quorum Server Builder is not specified @raise ValueError: End-point reporter is not specified""" <|body_0|> def reportServer(self...
stack_v2_sparse_classes_36k_train_028433
23,160
no_license
[ { "docstring": "@types: QuorumServerBuilder, netutils.EndpointReporter @raise ValueError: Quorum Server Builder is not specified @raise ValueError: End-point reporter is not specified", "name": "__init__", "signature": "def __init__(self, builder, endpointReporter)" }, { "docstring": "@types: Qu...
3
stack_v2_sparse_classes_30k_train_017929
Implement the Python class `QuorumServerReporter` described below. Class description: Implement the QuorumServerReporter class. Method signatures and docstrings: - def __init__(self, builder, endpointReporter): @types: QuorumServerBuilder, netutils.EndpointReporter @raise ValueError: Quorum Server Builder is not spec...
Implement the Python class `QuorumServerReporter` described below. Class description: Implement the QuorumServerReporter class. Method signatures and docstrings: - def __init__(self, builder, endpointReporter): @types: QuorumServerBuilder, netutils.EndpointReporter @raise ValueError: Quorum Server Builder is not spec...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class QuorumServerReporter: def __init__(self, builder, endpointReporter): """@types: QuorumServerBuilder, netutils.EndpointReporter @raise ValueError: Quorum Server Builder is not specified @raise ValueError: End-point reporter is not specified""" <|body_0|> def reportServer(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuorumServerReporter: def __init__(self, builder, endpointReporter): """@types: QuorumServerBuilder, netutils.EndpointReporter @raise ValueError: Quorum Server Builder is not specified @raise ValueError: End-point reporter is not specified""" if not builder: raise ValueError('Quoru...
the_stack_v2_python_sparse
reference/ucmdb/discovery/service_guard.py
madmonkyang/cda-record
train
0
a637cbf19281f4d3af850234113a151b93c77ff4
[ "d = collections.defaultdict(int)\nfor n in nums:\n d[n] += 1\ncounts = [[] for i in range(len(nums) + 1)]\nfor key in d:\n if d[key]:\n counts[d[key]].append(key)\nans = []\nc = len(nums)\nwhile len(ans) < k:\n if counts[c]:\n ans += counts[c]\n c -= 1\nreturn ans[:k]", "d = collections...
<|body_start_0|> d = collections.defaultdict(int) for n in nums: d[n] += 1 counts = [[] for i in range(len(nums) + 1)] for key in d: if d[key]: counts[d[key]].append(key) ans = [] c = len(nums) while len(ans) < k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def topKFrequent1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def topKFrequent2(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> def topKFrequent(self, nums, k): ...
stack_v2_sparse_classes_36k_train_028434
1,796
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "topKFrequent1", "signature": "def topKFrequent1(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "topKFrequent2", "signature": "def topKFrequent2(self, nums, k...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequent1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def topKFrequent2(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequent1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def topKFrequent2(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - ...
763674fcbe271af3d21eed790c3968c4d33f7b09
<|skeleton|> class Solution: def topKFrequent1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def topKFrequent2(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> def topKFrequent(self, nums, k): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def topKFrequent1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" d = collections.defaultdict(int) for n in nums: d[n] += 1 counts = [[] for i in range(len(nums) + 1)] for key in d: if d[key]: ...
the_stack_v2_python_sparse
347_topk_frequent_elements/347.py
guzhoudiaoke/leetcode_python3
train
0
df5aae72c2b7cb7c3de4c2736d228c58523f3b9f
[ "self.eof_index = -1\nself.timeout_index = -1\nself._strings = []\nself.longest_string = 0\nfor n, s in enumerate(strings):\n if s is EOF:\n self.eof_index = n\n continue\n if s is TIMEOUT:\n self.timeout_index = n\n continue\n self._strings.append((n, s))\n if len(s) > self....
<|body_start_0|> self.eof_index = -1 self.timeout_index = -1 self._strings = [] self.longest_string = 0 for n, s in enumerate(strings): if s is EOF: self.eof_index = n continue if s is TIMEOUT: self.timeout_i...
This is a plain string search helper for the spawn.expect_any() method. This helper class is for speed. For more powerful regex patterns see the helper class, searcher_re. Attributes: eof_index - index of EOF, or -1 timeout_index - index of TIMEOUT, or -1 After a successful match by the search() method the following at...
searcher_string
[ "ISC", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-other-copyleft", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class searcher_string: """This is a plain string search helper for the spawn.expect_any() method. This helper class is for speed. For more powerful regex patterns see the helper class, searcher_re. Attributes: eof_index - index of EOF, or -1 timeout_index - index of TIMEOUT, or -1 After a successful ma...
stack_v2_sparse_classes_36k_train_028435
13,827
permissive
[ { "docstring": "This creates an instance of searcher_string. This argument 'strings' may be a list; a sequence of strings; or the EOF or TIMEOUT types.", "name": "__init__", "signature": "def __init__(self, strings)" }, { "docstring": "This returns a human-readable string that represents the sta...
3
null
Implement the Python class `searcher_string` described below. Class description: This is a plain string search helper for the spawn.expect_any() method. This helper class is for speed. For more powerful regex patterns see the helper class, searcher_re. Attributes: eof_index - index of EOF, or -1 timeout_index - index ...
Implement the Python class `searcher_string` described below. Class description: This is a plain string search helper for the spawn.expect_any() method. This helper class is for speed. For more powerful regex patterns see the helper class, searcher_re. Attributes: eof_index - index of EOF, or -1 timeout_index - index ...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class searcher_string: """This is a plain string search helper for the spawn.expect_any() method. This helper class is for speed. For more powerful regex patterns see the helper class, searcher_re. Attributes: eof_index - index of EOF, or -1 timeout_index - index of TIMEOUT, or -1 After a successful ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class searcher_string: """This is a plain string search helper for the spawn.expect_any() method. This helper class is for speed. For more powerful regex patterns see the helper class, searcher_re. Attributes: eof_index - index of EOF, or -1 timeout_index - index of TIMEOUT, or -1 After a successful match by the se...
the_stack_v2_python_sparse
contrib/python/pexpect/pexpect/expect.py
catboost/catboost
train
8,012
b5b5b22f8fe0931962d950b57199771fdde231f3
[ "self.eps_init = eps_init\nself.eps_mid = eps_mid\nself.eps_final = eps_final\nself.eps_eval = eps_eval\nself.init2mid_annealing_episode = init2mid_annealing_episode\nself.start_episode = start_episode\nself.mid_episode = self.start_episode + self.init2mid_annealing_episode\nself.max_episode = max_episode\nself.slo...
<|body_start_0|> self.eps_init = eps_init self.eps_mid = eps_mid self.eps_final = eps_final self.eps_eval = eps_eval self.init2mid_annealing_episode = init2mid_annealing_episode self.start_episode = start_episode self.mid_episode = self.start_episode + self.init2m...
Exploration and exploitation compromise calculates epsilon value depending on parameters and current episode number
ExplorationExploitationClass
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExplorationExploitationClass: """Exploration and exploitation compromise calculates epsilon value depending on parameters and current episode number""" def __init__(self, eps_init=1, eps_mid=0.2, eps_final=0.01, eps_eval=0, init2mid_annealing_episode=500, start_episode=0, max_episode=5000): ...
stack_v2_sparse_classes_36k_train_028436
2,862
permissive
[ { "docstring": "From eps_init decay to eps_mid within period start_episode to start_episode+init2mid_annealing_episode, Then, from eps_mid decay to eps_final within period start_episode+init2mid_annealing_episode to max_episode. Args: eps_init: Float, Exploration probability for the first episode eps_mid: Float...
2
stack_v2_sparse_classes_30k_train_001819
Implement the Python class `ExplorationExploitationClass` described below. Class description: Exploration and exploitation compromise calculates epsilon value depending on parameters and current episode number Method signatures and docstrings: - def __init__(self, eps_init=1, eps_mid=0.2, eps_final=0.01, eps_eval=0, ...
Implement the Python class `ExplorationExploitationClass` described below. Class description: Exploration and exploitation compromise calculates epsilon value depending on parameters and current episode number Method signatures and docstrings: - def __init__(self, eps_init=1, eps_mid=0.2, eps_final=0.01, eps_eval=0, ...
334df1e8afbfff3544413ade46fb12f03556014b
<|skeleton|> class ExplorationExploitationClass: """Exploration and exploitation compromise calculates epsilon value depending on parameters and current episode number""" def __init__(self, eps_init=1, eps_mid=0.2, eps_final=0.01, eps_eval=0, init2mid_annealing_episode=500, start_episode=0, max_episode=5000): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExplorationExploitationClass: """Exploration and exploitation compromise calculates epsilon value depending on parameters and current episode number""" def __init__(self, eps_init=1, eps_mid=0.2, eps_final=0.01, eps_eval=0, init2mid_annealing_episode=500, start_episode=0, max_episode=5000): """Fr...
the_stack_v2_python_sparse
utils/expl_expt.py
Abluceli/HRG-SAC
train
7
4b5138967c1399153a6017b312fffa391e733bdc
[ "cycletime = '20171122T0000Z'\ndt = 419808.0\nresult = cycletime_to_number(cycletime)\nself.assertIsInstance(result, float)\nself.assertAlmostEqual(result, dt)", "cycletime = '201711220000'\ndt = 419808.0\nresult = cycletime_to_number(cycletime, cycletime_format='%Y%m%d%H%M')\nself.assertAlmostEqual(result, dt)",...
<|body_start_0|> cycletime = '20171122T0000Z' dt = 419808.0 result = cycletime_to_number(cycletime) self.assertIsInstance(result, float) self.assertAlmostEqual(result, dt) <|end_body_0|> <|body_start_1|> cycletime = '201711220000' dt = 419808.0 result = c...
Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a numeric time value.
Test_cycletime_to_number
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_cycletime_to_number: """Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a numeric time value.""" def test_basic(self): """Test that a number is returned of the expected value.""" <|body_0|> def test_cycletime_format_defined(self): ...
stack_v2_sparse_classes_36k_train_028437
19,622
permissive
[ { "docstring": "Test that a number is returned of the expected value.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test when a cycletime is defined.", "name": "test_cycletime_format_defined", "signature": "def test_cycletime_format_defined(self)" }, ...
4
null
Implement the Python class `Test_cycletime_to_number` described below. Class description: Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a numeric time value. Method signatures and docstrings: - def test_basic(self): Test that a number is returned of the expected value. - def test_cycletim...
Implement the Python class `Test_cycletime_to_number` described below. Class description: Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a numeric time value. Method signatures and docstrings: - def test_basic(self): Test that a number is returned of the expected value. - def test_cycletim...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_cycletime_to_number: """Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a numeric time value.""" def test_basic(self): """Test that a number is returned of the expected value.""" <|body_0|> def test_cycletime_format_defined(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_cycletime_to_number: """Test that a cycletime of a format such as YYYYMMDDTHHMMZ is converted into a numeric time value.""" def test_basic(self): """Test that a number is returned of the expected value.""" cycletime = '20171122T0000Z' dt = 419808.0 result = cycletime_...
the_stack_v2_python_sparse
improver_tests/utilities/temporal/test_temporal.py
metoppv/improver
train
101
3a31009a3d6a71eeda31ed4d942766d16d687c47
[ "if model.confirmed_at:\n return '已验证'\nmail_url = url_for('.send_mail_view')\n_html = '\\n <form action=\"{mail_url}\" method=\"POST\">\\n <input id=\"user_id\" name=\"user_id\" type=\"hidden\" value=\"{user_id}\">\\n <button class=\"btn btn-info\" type=\\'submit\\'>发送邮...
<|body_start_0|> if model.confirmed_at: return '已验证' mail_url = url_for('.send_mail_view') _html = '\n <form action="{mail_url}" method="POST">\n <input id="user_id" name="user_id" type="hidden" value="{user_id}">\n <button class="btn btn-inf...
用户管理 由于权限和用户是viewonly属性,所以权限只能是查看
UserModelView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserModelView: """用户管理 由于权限和用户是viewonly属性,所以权限只能是查看""" def _send_mail(self, _, model, __): """验证邮件栏目""" <|body_0|> def send_mail_view(self): """发送验证邮件""" <|body_1|> def on_model_change(self, form, model, is_created): """创建新账户时设置密码""" ...
stack_v2_sparse_classes_36k_train_028438
5,835
permissive
[ { "docstring": "验证邮件栏目", "name": "_send_mail", "signature": "def _send_mail(self, _, model, __)" }, { "docstring": "发送验证邮件", "name": "send_mail_view", "signature": "def send_mail_view(self)" }, { "docstring": "创建新账户时设置密码", "name": "on_model_change", "signature": "def on_m...
3
null
Implement the Python class `UserModelView` described below. Class description: 用户管理 由于权限和用户是viewonly属性,所以权限只能是查看 Method signatures and docstrings: - def _send_mail(self, _, model, __): 验证邮件栏目 - def send_mail_view(self): 发送验证邮件 - def on_model_change(self, form, model, is_created): 创建新账户时设置密码
Implement the Python class `UserModelView` described below. Class description: 用户管理 由于权限和用户是viewonly属性,所以权限只能是查看 Method signatures and docstrings: - def _send_mail(self, _, model, __): 验证邮件栏目 - def send_mail_view(self): 发送验证邮件 - def on_model_change(self, form, model, is_created): 创建新账户时设置密码 <|skeleton|> class UserMo...
4f866b2264e224389c99bbbdb4521f4b0799b2a3
<|skeleton|> class UserModelView: """用户管理 由于权限和用户是viewonly属性,所以权限只能是查看""" def _send_mail(self, _, model, __): """验证邮件栏目""" <|body_0|> def send_mail_view(self): """发送验证邮件""" <|body_1|> def on_model_change(self, form, model, is_created): """创建新账户时设置密码""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserModelView: """用户管理 由于权限和用户是viewonly属性,所以权限只能是查看""" def _send_mail(self, _, model, __): """验证邮件栏目""" if model.confirmed_at: return '已验证' mail_url = url_for('.send_mail_view') _html = '\n <form action="{mail_url}" method="POST">\n <i...
the_stack_v2_python_sparse
admin/views/users.py
ssfdust/full-stack-flask-smorest
train
39
39b90b767a0c2e78d513c660f0f122879701b22c
[ "self.build_settings = build_settings\nself.images_requested = images_requested\nself.tag = tag\nself.images_to_build = {}\nself.images_provided = {}\nfor name, di in images_requested.items():\n identifier = di['identifier']\n build_config = di['build_config']\n if build_config is None:\n self.image...
<|body_start_0|> self.build_settings = build_settings self.images_requested = images_requested self.tag = tag self.images_to_build = {} self.images_provided = {} for name, di in images_requested.items(): identifier = di['identifier'] build_config =...
Manages the following: 1) Figure out what docker images need to be built 2) Build (and push) them
SurrealDockerBuilder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurrealDockerBuilder: """Manages the following: 1) Figure out what docker images need to be built 2) Build (and push) them""" def __init__(self, build_settings, images_requested, tag, push=False): """Figures out what docker images need to be built Populates self.images_provided which...
stack_v2_sparse_classes_36k_train_028439
2,893
permissive
[ { "docstring": "Figures out what docker images need to be built Populates self.images_provided which computes {name: identifier} for all images Args: build_settings (dict): {build_settings_name: {<docker build setting accepted by symphony.addons.DockerBuilder.from_dict>}} images_requested (dict): { image_name: ...
2
stack_v2_sparse_classes_30k_train_009271
Implement the Python class `SurrealDockerBuilder` described below. Class description: Manages the following: 1) Figure out what docker images need to be built 2) Build (and push) them Method signatures and docstrings: - def __init__(self, build_settings, images_requested, tag, push=False): Figures out what docker ima...
Implement the Python class `SurrealDockerBuilder` described below. Class description: Manages the following: 1) Figure out what docker images need to be built 2) Build (and push) them Method signatures and docstrings: - def __init__(self, build_settings, images_requested, tag, push=False): Figures out what docker ima...
2556bd9c362a53e0a94da914ba59b5d4621c4081
<|skeleton|> class SurrealDockerBuilder: """Manages the following: 1) Figure out what docker images need to be built 2) Build (and push) them""" def __init__(self, build_settings, images_requested, tag, push=False): """Figures out what docker images need to be built Populates self.images_provided which...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurrealDockerBuilder: """Manages the following: 1) Figure out what docker images need to be built 2) Build (and push) them""" def __init__(self, build_settings, images_requested, tag, push=False): """Figures out what docker images need to be built Populates self.images_provided which computes {na...
the_stack_v2_python_sparse
surreal/launch/build_images.py
PeihongYu/surreal
train
0
86606bc769437f84b37de8eb1be2a52e0111826a
[ "dct = self._base_map(no_owner)\nif '.' in self.parser:\n sch, pars = self.parser.split('.')\n if sch == self.schema:\n dct['parser'] = pars\nreturn dct", "clauses = []\nclauses.append('PARSER = %s' % self.parser)\nreturn ['CREATE TEXT SEARCH CONFIGURATION %s (\\n %s)' % (self.qualname(), ',\\n ...
<|body_start_0|> dct = self._base_map(no_owner) if '.' in self.parser: sch, pars = self.parser.split('.') if sch == self.schema: dct['parser'] = pars return dct <|end_body_0|> <|body_start_1|> clauses = [] clauses.append('PARSER = %s' % se...
A text search configuration definition
TSConfiguration
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TSConfiguration: """A text search configuration definition""" def to_map(self, no_owner): """Convert a text search configuration to a YAML-suitable format :return: dictionary""" <|body_0|> def create(self): """Return SQL statements to CREATE the configuration :re...
stack_v2_sparse_classes_36k_train_028440
15,925
permissive
[ { "docstring": "Convert a text search configuration to a YAML-suitable format :return: dictionary", "name": "to_map", "signature": "def to_map(self, no_owner)" }, { "docstring": "Return SQL statements to CREATE the configuration :return: SQL statements", "name": "create", "signature": "d...
2
stack_v2_sparse_classes_30k_train_021090
Implement the Python class `TSConfiguration` described below. Class description: A text search configuration definition Method signatures and docstrings: - def to_map(self, no_owner): Convert a text search configuration to a YAML-suitable format :return: dictionary - def create(self): Return SQL statements to CREATE ...
Implement the Python class `TSConfiguration` described below. Class description: A text search configuration definition Method signatures and docstrings: - def to_map(self, no_owner): Convert a text search configuration to a YAML-suitable format :return: dictionary - def create(self): Return SQL statements to CREATE ...
0133f3bc522890e0564d27de6791824acb4d2773
<|skeleton|> class TSConfiguration: """A text search configuration definition""" def to_map(self, no_owner): """Convert a text search configuration to a YAML-suitable format :return: dictionary""" <|body_0|> def create(self): """Return SQL statements to CREATE the configuration :re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TSConfiguration: """A text search configuration definition""" def to_map(self, no_owner): """Convert a text search configuration to a YAML-suitable format :return: dictionary""" dct = self._base_map(no_owner) if '.' in self.parser: sch, pars = self.parser.split('.') ...
the_stack_v2_python_sparse
pyrseas/dbobject/textsearch.py
vayerx/Pyrseas
train
1
5fa73a8ebf6fd62932240b5afa1b959a7d194915
[ "self.key = key\nself.count = count\nself.is_cluster = False\nself.children = None", "if self.children is None:\n self.children = dict()\nkey, count = values[pos]\nif key not in self.children:\n self.children[key] = Node(key=key, count=count)\nnode = self.children[key]\nif len(values) == pos + 1:\n resul...
<|body_start_0|> self.key = key self.count = count self.is_cluster = False self.children = None <|end_body_0|> <|body_start_1|> if self.children is None: self.children = dict() key, count = values[pos] if key not in self.children: self.chi...
Node in the cluster index.
Node
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: """Node in the cluster index.""" def __init__(self, key: str, count: int): """Initialize the node key and frequency count. Parameters ---------- key: string Value in a cluster. count: int Frequency of the value.""" <|body_0|> def add(self, values: List[Tuple[str, i...
stack_v2_sparse_classes_36k_train_028441
2,787
permissive
[ { "docstring": "Initialize the node key and frequency count. Parameters ---------- key: string Value in a cluster. count: int Frequency of the value.", "name": "__init__", "signature": "def __init__(self, key: str, count: int)" }, { "docstring": "Add the values in the given list starting from ``...
2
null
Implement the Python class `Node` described below. Class description: Node in the cluster index. Method signatures and docstrings: - def __init__(self, key: str, count: int): Initialize the node key and frequency count. Parameters ---------- key: string Value in a cluster. count: int Frequency of the value. - def add...
Implement the Python class `Node` described below. Class description: Node in the cluster index. Method signatures and docstrings: - def __init__(self, key: str, count: int): Initialize the node key and frequency count. Parameters ---------- key: string Value in a cluster. count: int Frequency of the value. - def add...
e3d0e04f90468c49f29ca53edc2feb12465c24d5
<|skeleton|> class Node: """Node in the cluster index.""" def __init__(self, key: str, count: int): """Initialize the node key and frequency count. Parameters ---------- key: string Value in a cluster. count: int Frequency of the value.""" <|body_0|> def add(self, values: List[Tuple[str, i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: """Node in the cluster index.""" def __init__(self, key: str, count: int): """Initialize the node key and frequency count. Parameters ---------- key: string Value in a cluster. count: int Frequency of the value.""" self.key = key self.count = count self.is_cluster = ...
the_stack_v2_python_sparse
openclean/cluster/index.py
Denisfench/openclean-core
train
0
d212b6c73ece8e4a11261fbf50c893dddbce2086
[ "def canShip(m):\n t, days = (0, 0)\n for w in weights:\n if t + w > m:\n days += 1\n t = w\n else:\n t += w\n return days + 1 <= D\nl, r = (max(weights), sum(weights))\nwhile l < r:\n mid = l + (r - l) // 2\n if canShip(mid):\n r = mid\n else:...
<|body_start_0|> def canShip(m): t, days = (0, 0) for w in weights: if t + w > m: days += 1 t = w else: t += w return days + 1 <= D l, r = (max(weights), sum(weights)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_0|> def shipWithinDays(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_028442
3,083
no_license
[ { "docstring": ":type weights: List[int] :type D: int :rtype: int", "name": "shipWithinDaysAC", "signature": "def shipWithinDaysAC(self, weights, D)" }, { "docstring": ":type weights: List[int] :type D: int :rtype: int", "name": "shipWithinDays", "signature": "def shipWithinDays(self, we...
2
stack_v2_sparse_classes_30k_train_001595
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shipWithinDaysAC(self, weights, D): :type weights: List[int] :type D: int :rtype: int - def shipWithinDays(self, weights, D): :type weights: List[int] :type D: int :rtype: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shipWithinDaysAC(self, weights, D): :type weights: List[int] :type D: int :rtype: int - def shipWithinDays(self, weights, D): :type weights: List[int] :type D: int :rtype: in...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_0|> def shipWithinDays(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shipWithinDaysAC(self, weights, D): """:type weights: List[int] :type D: int :rtype: int""" def canShip(m): t, days = (0, 0) for w in weights: if t + w > m: days += 1 t = w else: ...
the_stack_v2_python_sparse
C/CapacityToShipPackagesWithinDDays.py
bssrdf/pyleet
train
2
9f701c10f6583d335e057396be8593465301dff5
[ "client_ip, is_routable = get_client_ip(self.request)\nobject = get_object_or_404(Production, slug=slug)\nself.check_object_permissions(request, object)\nread_serializer = ProductionRetrieveSerializer(object, many=False, context={'authenticated_by': request.user, 'authenticated_from': client_ip, 'authenticated_from...
<|body_start_0|> client_ip, is_routable = get_client_ip(self.request) object = get_object_or_404(Production, slug=slug) self.check_object_permissions(request, object) read_serializer = ProductionRetrieveSerializer(object, many=False, context={'authenticated_by': request.user, 'authentica...
ProductionRetrieveUpdateAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductionRetrieveUpdateAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|> <|body_start_0|> client_ip, is_routable = get_client_ip(self.request) o...
stack_v2_sparse_classes_36k_train_028443
3,226
permissive
[ { "docstring": "Retrieve", "name": "get", "signature": "def get(self, request, slug=None)" }, { "docstring": "Update", "name": "put", "signature": "def put(self, request, slug=None)" } ]
2
null
Implement the Python class `ProductionRetrieveUpdateAPIView` described below. Class description: Implement the ProductionRetrieveUpdateAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update
Implement the Python class `ProductionRetrieveUpdateAPIView` described below. Class description: Implement the ProductionRetrieveUpdateAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update <|skeleton|> class ProductionRetrieveUpdate...
98e1ff8bab7dda3492e5ff637bf5aafd111c840c
<|skeleton|> class ProductionRetrieveUpdateAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductionRetrieveUpdateAPIView: def get(self, request, slug=None): """Retrieve""" client_ip, is_routable = get_client_ip(self.request) object = get_object_or_404(Production, slug=slug) self.check_object_permissions(request, object) read_serializer = ProductionRetrieveS...
the_stack_v2_python_sparse
mikaponics/production/views/resource_views/production_retrieve_update_view.py
mikaponics/mikaponics-back
train
4
8e32ba5baf6f91b4f865ee937cd5284d503a14fc
[ "N = len(nums)\nans = [1] * N\nfor i in range(1, N):\n ans[i] = nums[i - 1] * ans[i - 1]\nright = 1\nfor i in range(N - 1, -1, -1):\n ans[i] *= right\n right = right * nums[i]\nreturn ans", "N = len(nums)\nL = [1] * N\nR = [1] * N\nans = [1] * N\nfor i in range(1, N):\n L[i] = nums[i - 1] * L[i - 1]\n...
<|body_start_0|> N = len(nums) ans = [1] * N for i in range(1, N): ans[i] = nums[i - 1] * ans[i - 1] right = 1 for i in range(N - 1, -1, -1): ans[i] *= right right = right * nums[i] return ans <|end_body_0|> <|body_start_1|> N ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def productExceptSelfO1Space(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> N = len(nums) ...
stack_v2_sparse_classes_36k_train_028444
1,592
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelfO1Space", "signature": "def productExceptSelfO1Space(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "productExceptSelf", "signature": "def productExceptSelf(self, nums)"...
2
stack_v2_sparse_classes_30k_train_006926
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelfO1Space(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def productExceptSelfO1Space(self, nums): :type nums: List[int] :rtype: List[int] - def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] <|skeleton|> class...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def productExceptSelfO1Space(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def productExceptSelf(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def productExceptSelfO1Space(self, nums): """:type nums: List[int] :rtype: List[int]""" N = len(nums) ans = [1] * N for i in range(1, N): ans[i] = nums[i - 1] * ans[i - 1] right = 1 for i in range(N - 1, -1, -1): ans[i] *= right...
the_stack_v2_python_sparse
P/ProductofArrayExceptSelf.py
bssrdf/pyleet
train
2
025193f000837a77cf88b95b37d345daddd2cfc4
[ "S = S.upper()\nl = len(S)\ndicts = {char: [[], 0] for char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'}\nfor i, char in enumerate(S):\n dicts[char][0].append(i)\nans = 0\nprint(dicts)\nfor i, char in enumerate(S):\n pos = dicts[char][1]\n if pos - 1 >= 0:\n left = dicts[char][0][pos - 1]\n else:\n le...
<|body_start_0|> S = S.upper() l = len(S) dicts = {char: [[], 0] for char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'} for i, char in enumerate(S): dicts[char][0].append(i) ans = 0 print(dicts) for i, char in enumerate(S): pos = dicts[char][1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniqueLetterString(self, S): """:type S: str :rtype: int 517 ms""" <|body_0|> def uniqueLetterString_1(self, S): """136ms :param S: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> S = S.upper() l = len(S) dicts...
stack_v2_sparse_classes_36k_train_028445
2,560
no_license
[ { "docstring": ":type S: str :rtype: int 517 ms", "name": "uniqueLetterString", "signature": "def uniqueLetterString(self, S)" }, { "docstring": "136ms :param S: :return:", "name": "uniqueLetterString_1", "signature": "def uniqueLetterString_1(self, S)" } ]
2
stack_v2_sparse_classes_30k_train_004237
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniqueLetterString(self, S): :type S: str :rtype: int 517 ms - def uniqueLetterString_1(self, S): 136ms :param S: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniqueLetterString(self, S): :type S: str :rtype: int 517 ms - def uniqueLetterString_1(self, S): 136ms :param S: :return: <|skeleton|> class Solution: def uniqueLetter...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def uniqueLetterString(self, S): """:type S: str :rtype: int 517 ms""" <|body_0|> def uniqueLetterString_1(self, S): """136ms :param S: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def uniqueLetterString(self, S): """:type S: str :rtype: int 517 ms""" S = S.upper() l = len(S) dicts = {char: [[], 0] for char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'} for i, char in enumerate(S): dicts[char][0].append(i) ans = 0 print(dic...
the_stack_v2_python_sparse
UniqueLetterString_HARD_828.py
953250587/leetcode-python
train
2
5e6fd7af273e4b69cdadb9c3324341d542123d57
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Authentication()", "from .authentication_method import AuthenticationMethod\nfrom .email_authentication_method import EmailAuthenticationMethod\nfrom .entity import Entity\nfrom .fido2_authentication_method import Fido2AuthenticationMe...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Authentication() <|end_body_0|> <|body_start_1|> from .authentication_method import AuthenticationMethod from .email_authentication_method import EmailAuthenticationMethod from ....
Authentication
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authentication: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: """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 Retur...
stack_v2_sparse_classes_36k_train_028446
8,427
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: Authentication", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
stack_v2_sparse_classes_30k_train_018650
Implement the Python class `Authentication` described below. Class description: Implement the Authentication class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `Authentication` described below. Class description: Implement the Authentication class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Authentication: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: """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 Retur...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Authentication: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Authentication: """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: Authentica...
the_stack_v2_python_sparse
msgraph/generated/models/authentication.py
microsoftgraph/msgraph-sdk-python
train
135
e2102c8b12d07505bba1a538198dc2624663b616
[ "super().__init__(sdc_values=sdc_values, version=version, properties=properties, inputs=inputs, category=category, subcategory=subcategory)\nself.name: str = name or 'ONAP-test-PNF'\nself.vendor: Vendor = vendor\nself.vsp: Vsp = vsp", "if not self.vsp and (not self.vendor):\n raise ParameterError('Neither Vsp ...
<|body_start_0|> super().__init__(sdc_values=sdc_values, version=version, properties=properties, inputs=inputs, category=category, subcategory=subcategory) self.name: str = name or 'ONAP-test-PNF' self.vendor: Vendor = vendor self.vsp: Vsp = vsp <|end_body_0|> <|body_start_1|> i...
ONAP PNF Object used for SDC operations. Attributes: name (str): the name of the pnf. Defaults to "ONAP-test-PNF". identifier (str): the unique ID of the pnf from SDC. status (str): the status of the pnf from SDC. version (str): the version ID of the vendor from SDC. uuid (str): the UUID of the PNF (which is different ...
Pnf
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pnf: """ONAP PNF Object used for SDC operations. Attributes: name (str): the name of the pnf. Defaults to "ONAP-test-PNF". identifier (str): the unique ID of the pnf from SDC. status (str): the status of the pnf from SDC. version (str): the version ID of the vendor from SDC. uuid (str): the UUID ...
stack_v2_sparse_classes_36k_train_028447
2,481
permissive
[ { "docstring": "Initialize pnf object. Args: name (optional): the name of the pnf version (str, optional): the version of a PNF object", "name": "__init__", "signature": "def __init__(self, name: str=None, version: str=None, vendor: Vendor=None, sdc_values: Dict[str, str]=None, vsp: Vsp=None, properties...
3
null
Implement the Python class `Pnf` described below. Class description: ONAP PNF Object used for SDC operations. Attributes: name (str): the name of the pnf. Defaults to "ONAP-test-PNF". identifier (str): the unique ID of the pnf from SDC. status (str): the status of the pnf from SDC. version (str): the version ID of the...
Implement the Python class `Pnf` described below. Class description: ONAP PNF Object used for SDC operations. Attributes: name (str): the name of the pnf. Defaults to "ONAP-test-PNF". identifier (str): the unique ID of the pnf from SDC. status (str): the status of the pnf from SDC. version (str): the version ID of the...
b204aa63043825290d4c0a940edd7e9241f6c0ee
<|skeleton|> class Pnf: """ONAP PNF Object used for SDC operations. Attributes: name (str): the name of the pnf. Defaults to "ONAP-test-PNF". identifier (str): the unique ID of the pnf from SDC. status (str): the status of the pnf from SDC. version (str): the version ID of the vendor from SDC. uuid (str): the UUID ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pnf: """ONAP PNF Object used for SDC operations. Attributes: name (str): the name of the pnf. Defaults to "ONAP-test-PNF". identifier (str): the unique ID of the pnf from SDC. status (str): the status of the pnf from SDC. version (str): the version ID of the vendor from SDC. uuid (str): the UUID of the PNF (w...
the_stack_v2_python_sparse
src/onapsdk/sdc/pnf.py
Orange-OpenSource/python-onapsdk
train
4
d6833695726151d1b0c10394847b834dcd352173
[ "super(Model, self).__init__()\nself._input_shape = [-1, 28, 28, 1]\nself.conv1 = layers.Conv2D(32, 5, padding='same', data_format=data_format, activation=nn.relu)\nself.conv2 = layers.Conv2D(64, 5, padding='same', data_format=data_format, activation=nn.relu)\nself.fc1 = layers.Dense(1024, activation=nn.relu)\nself...
<|body_start_0|> super(Model, self).__init__() self._input_shape = [-1, 28, 28, 1] self.conv1 = layers.Conv2D(32, 5, padding='same', data_format=data_format, activation=nn.relu) self.conv2 = layers.Conv2D(64, 5, padding='same', data_format=data_format, activation=nn.relu) self.fc...
Model to recognize digits in the MNIST dataset. Train and export savedmodel, used for testOnflyTrainMnistSavedModel Network structure is equivalent to: https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_deep.py and https://github.com/tensorflow/models/blob/master/tutorials/imag...
Model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """Model to recognize digits in the MNIST dataset. Train and export savedmodel, used for testOnflyTrainMnistSavedModel Network structure is equivalent to: https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_deep.py and https://github.com/tensorflow/...
stack_v2_sparse_classes_36k_train_028448
10,776
permissive
[ { "docstring": "Creates a model for classifying a hand-written digit. Args: data_format: Either \"channels_first\" or \"channels_last\". \"channels_first\" is typically faster on GPUs while \"channels_last\" is typically faster on CPUs. See https://www.tensorflow.org/performance/performance_guide#data_formats",...
2
stack_v2_sparse_classes_30k_test_001168
Implement the Python class `Model` described below. Class description: Model to recognize digits in the MNIST dataset. Train and export savedmodel, used for testOnflyTrainMnistSavedModel Network structure is equivalent to: https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_dee...
Implement the Python class `Model` described below. Class description: Model to recognize digits in the MNIST dataset. Train and export savedmodel, used for testOnflyTrainMnistSavedModel Network structure is equivalent to: https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_dee...
181bc2b37aa8a3eeb11a942d8f330b04abc804b3
<|skeleton|> class Model: """Model to recognize digits in the MNIST dataset. Train and export savedmodel, used for testOnflyTrainMnistSavedModel Network structure is equivalent to: https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_deep.py and https://github.com/tensorflow/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: """Model to recognize digits in the MNIST dataset. Train and export savedmodel, used for testOnflyTrainMnistSavedModel Network structure is equivalent to: https://github.com/tensorflow/tensorflow/blob/r1.5/tensorflow/examples/tutorials/mnist/mnist_deep.py and https://github.com/tensorflow/models/blob/m...
the_stack_v2_python_sparse
tensorflow/contrib/lite/python/convert_saved_model_test.py
zylo117/tensorflow-gpu-macosx
train
116
b24e3c863e48554ff311e98e5fbd9828f15ac5e4
[ "super(DecoderBlock, self).__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(units=dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\ns...
<|body_start_0|> super(DecoderBlock, self).__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(units=dm) self.layernorm1...
Class to create an decoder block for a transformer
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """Class to create an decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor :param dm: an integer representing the dimensionality of the model :param h: an integer representing the number of heads :param hidden: the nu...
stack_v2_sparse_classes_36k_train_028449
2,864
no_license
[ { "docstring": "Class constructor :param dm: an integer representing the dimensionality of the model :param h: an integer representing the number of heads :param hidden: the number of hidden units in the fully connected layer :param drop_rate: the dropout rate", "name": "__init__", "signature": "def __i...
2
null
Implement the Python class `DecoderBlock` described below. Class description: Class to create an decoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor :param dm: an integer representing the dimensionality of the model :param h: an integ...
Implement the Python class `DecoderBlock` described below. Class description: Class to create an decoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor :param dm: an integer representing the dimensionality of the model :param h: an integ...
856ee36006c2ff656877d592c2ddb7c941d63780
<|skeleton|> class DecoderBlock: """Class to create an decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor :param dm: an integer representing the dimensionality of the model :param h: an integer representing the number of heads :param hidden: the nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """Class to create an decoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor :param dm: an integer representing the dimensionality of the model :param h: an integer representing the number of heads :param hidden: the number of hidde...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/8-transformer_decoder_block.py
garimasinghgryffindor/holbertonschool-machine_learning
train
0
dabeaf7d14cd918d5ae92e58ae0a128fa0efe0f6
[ "self.width = width\nself.height = height\nself.food = deque(food)\nself.snake = deque([[0, 0]])\nself.direct = {'U': [-1, 0], 'L': [0, -1], 'R': [0, +1], 'D': [1, 0]}\nprint('start from: 0, 0')", "r0, c0 = self.snake[0]\nr1, c1 = self.direct[direction]\nnew_head = [r0 + r1, c0 + c1]\nif new_head[0] < 0 or new_he...
<|body_start_0|> self.width = width self.height = height self.food = deque(food) self.snake = deque([[0, 0]]) self.direct = {'U': [-1, 0], 'L': [0, -1], 'R': [0, +1], 'D': [1, 0]} print('start from: 0, 0') <|end_body_0|> <|body_start_1|> r0, c0 = self.snake[0] ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k_train_028450
2,136
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]", ...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E...
bf98c8fa31043a45b3d21cfe78d4e08f9cac9de6
<|skeleton|> class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width, height, food): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :...
the_stack_v2_python_sparse
interviews/Palantir/353_design_snake_game.py
mistrydarshan99/Leetcode-3
train
0
2054fc0ee98ac268f71744f7c2d8933d67eabee9
[ "self.resultList = [None] * len(deferredList)\nDeferred.__init__(self)\nif len(deferredList) == 0 and (not fireOnOneCallback):\n self.callback(self.resultList)\nself.fireOnOneCallback = fireOnOneCallback\nself.fireOnOneErrback = fireOnOneErrback\nself.consumeErrors = consumeErrors\nself.finishedCount = 0\nindex ...
<|body_start_0|> self.resultList = [None] * len(deferredList) Deferred.__init__(self) if len(deferredList) == 0 and (not fireOnOneCallback): self.callback(self.resultList) self.fireOnOneCallback = fireOnOneCallback self.fireOnOneErrback = fireOnOneErrback self...
I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it in a DeferredList. For example, you can...
DeferredList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeferredList: """I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it...
stack_v2_sparse_classes_36k_train_028451
3,907
permissive
[ { "docstring": "Initialize a DeferredList. @type deferredList: C{list} of L{Deferred}s @param deferredList: The list of deferreds to track. @param fireOnOneCallback: (keyword param) a flag indicating that only one callback needs to be fired for me to call my callback @param fireOnOneErrback: (keyword param) a f...
2
stack_v2_sparse_classes_30k_train_014847
Implement the Python class `DeferredList` described below. Class description: I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can s...
Implement the Python class `DeferredList` described below. Class description: I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can s...
bf9c26051e8dfd1325bdc63aab1c560dbad7f6b7
<|skeleton|> class DeferredList: """I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeferredList: """I combine a group of deferreds into one callback. I track a list of L{Deferred}s for their callbacks, and make a single callback when they have all completed, a list of (success, result) tuples, 'success' being a boolean. Note that you can still use a L{Deferred} after putting it in a Deferre...
the_stack_v2_python_sparse
Vertex/vertex/_unfortunate_defer_hack.py
feitianyiren/divmod.org
train
0
e4ee08938bd9106e6c0f1d1ca0d18a06a202bbbd
[ "if type(self.nburn) in [float, int]:\n logger.info(f'Discarding {self.nburn} steps for burn-in')\nelif self.result.max_autocorrelation_time is None:\n logger.info(f'Autocorrelation time not calculated, discarding {self.nburn} steps for burn-in')\nelse:\n logger.info(f'Discarding {self.nburn} steps for bur...
<|body_start_0|> if type(self.nburn) in [float, int]: logger.info(f'Discarding {self.nburn} steps for burn-in') elif self.result.max_autocorrelation_time is None: logger.info(f'Autocorrelation time not calculated, discarding {self.nburn} steps for burn-in') else: ...
MCMCSampler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MCMCSampler: def print_nburn_logging_info(self): """Prints logging info as to how nburn was calculated""" <|body_0|> def calculate_autocorrelation(self, samples, c=3): """Uses the `emcee.autocorr` module to estimate the autocorrelation Parameters ========== samples: ...
stack_v2_sparse_classes_36k_train_028452
36,082
permissive
[ { "docstring": "Prints logging info as to how nburn was calculated", "name": "print_nburn_logging_info", "signature": "def print_nburn_logging_info(self)" }, { "docstring": "Uses the `emcee.autocorr` module to estimate the autocorrelation Parameters ========== samples: array_like A chain of samp...
2
stack_v2_sparse_classes_30k_train_020393
Implement the Python class `MCMCSampler` described below. Class description: Implement the MCMCSampler class. Method signatures and docstrings: - def print_nburn_logging_info(self): Prints logging info as to how nburn was calculated - def calculate_autocorrelation(self, samples, c=3): Uses the `emcee.autocorr` module...
Implement the Python class `MCMCSampler` described below. Class description: Implement the MCMCSampler class. Method signatures and docstrings: - def print_nburn_logging_info(self): Prints logging info as to how nburn was calculated - def calculate_autocorrelation(self, samples, c=3): Uses the `emcee.autocorr` module...
9c1dda6cc1510692ce4ac75c608de5fae53e971c
<|skeleton|> class MCMCSampler: def print_nburn_logging_info(self): """Prints logging info as to how nburn was calculated""" <|body_0|> def calculate_autocorrelation(self, samples, c=3): """Uses the `emcee.autocorr` module to estimate the autocorrelation Parameters ========== samples: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MCMCSampler: def print_nburn_logging_info(self): """Prints logging info as to how nburn was calculated""" if type(self.nburn) in [float, int]: logger.info(f'Discarding {self.nburn} steps for burn-in') elif self.result.max_autocorrelation_time is None: logger.inf...
the_stack_v2_python_sparse
bilby/core/sampler/base_sampler.py
khunsang/bilby
train
0
688e4ff0f0c1c6dd0ea62cbcc21c85b52de289e2
[ "super().__init__()\nself.repository = repository\nself.commit_only = commit_only\nself.brain = Brain(repository)", "if '/.' in event.src_path:\n return\nupdated_file = os.path.relpath(event.src_path, self.repository.original_path)\nif not updated_file or updated_file in self.repository.ignored_files or (not u...
<|body_start_0|> super().__init__() self.repository = repository self.commit_only = commit_only self.brain = Brain(repository) <|end_body_0|> <|body_start_1|> if '/.' in event.src_path: return updated_file = os.path.relpath(event.src_path, self.repository.ori...
Is notified every time an event occurs on the fileystem and will snapshot the change
ChangeWatchdog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangeWatchdog: """Is notified every time an event occurs on the fileystem and will snapshot the change""" def __init__(self, repository, commit_only: bool): """Create a ChangeWatchdog instance""" <|body_0|> def on_any_event(self, event): """Catches all events"""...
stack_v2_sparse_classes_36k_train_028453
4,518
no_license
[ { "docstring": "Create a ChangeWatchdog instance", "name": "__init__", "signature": "def __init__(self, repository, commit_only: bool)" }, { "docstring": "Catches all events", "name": "on_any_event", "signature": "def on_any_event(self, event)" } ]
2
stack_v2_sparse_classes_30k_train_021501
Implement the Python class `ChangeWatchdog` described below. Class description: Is notified every time an event occurs on the fileystem and will snapshot the change Method signatures and docstrings: - def __init__(self, repository, commit_only: bool): Create a ChangeWatchdog instance - def on_any_event(self, event): ...
Implement the Python class `ChangeWatchdog` described below. Class description: Is notified every time an event occurs on the fileystem and will snapshot the change Method signatures and docstrings: - def __init__(self, repository, commit_only: bool): Create a ChangeWatchdog instance - def on_any_event(self, event): ...
b669eab9abecfaf8310f0668a7e5f95b2308d885
<|skeleton|> class ChangeWatchdog: """Is notified every time an event occurs on the fileystem and will snapshot the change""" def __init__(self, repository, commit_only: bool): """Create a ChangeWatchdog instance""" <|body_0|> def on_any_event(self, event): """Catches all events"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChangeWatchdog: """Is notified every time an event occurs on the fileystem and will snapshot the change""" def __init__(self, repository, commit_only: bool): """Create a ChangeWatchdog instance""" super().__init__() self.repository = repository self.commit_only = commit_on...
the_stack_v2_python_sparse
bug_buddy/watcher.py
NathanBWaters/bug_buddy
train
0
a4600be0a16ad03e0b8c064d10dda43288b92713
[ "phone = validated_data.get('phone')\ntry:\n self.User.objects.get(phone=phone)\n return Response(response_code.user_existed, status=status.HTTP_400_BAD_REQUEST)\nexcept self.User.DoesNotExist:\n code_status = self.redis.check_code(phone, validated_data.get('code'))\n if not code_status:\n return...
<|body_start_0|> phone = validated_data.get('phone') try: self.User.objects.get(phone=phone) return Response(response_code.user_existed, status=status.HTTP_400_BAD_REQUEST) except self.User.DoesNotExist: code_status = self.redis.check_code(phone, validated_dat...
用户注册
RegisterAPIView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterAPIView: """用户注册""" def register_phone(self, validated_data): """手机注册""" <|body_0|> def register_email(self, validated_data): """邮箱注册""" <|body_1|> def factory(self, validated_data): """简单工厂管理用户不同注册方式""" <|body_2|> def po...
stack_v2_sparse_classes_36k_train_028454
6,225
permissive
[ { "docstring": "手机注册", "name": "register_phone", "signature": "def register_phone(self, validated_data)" }, { "docstring": "邮箱注册", "name": "register_email", "signature": "def register_email(self, validated_data)" }, { "docstring": "简单工厂管理用户不同注册方式", "name": "factory", "sig...
4
null
Implement the Python class `RegisterAPIView` described below. Class description: 用户注册 Method signatures and docstrings: - def register_phone(self, validated_data): 手机注册 - def register_email(self, validated_data): 邮箱注册 - def factory(self, validated_data): 简单工厂管理用户不同注册方式 - def post(self, request): 用户注册
Implement the Python class `RegisterAPIView` described below. Class description: 用户注册 Method signatures and docstrings: - def register_phone(self, validated_data): 手机注册 - def register_email(self, validated_data): 邮箱注册 - def factory(self, validated_data): 简单工厂管理用户不同注册方式 - def post(self, request): 用户注册 <|skeleton|> cl...
13cb59130d15e782f78bc5148409bef0f1c516e0
<|skeleton|> class RegisterAPIView: """用户注册""" def register_phone(self, validated_data): """手机注册""" <|body_0|> def register_email(self, validated_data): """邮箱注册""" <|body_1|> def factory(self, validated_data): """简单工厂管理用户不同注册方式""" <|body_2|> def po...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterAPIView: """用户注册""" def register_phone(self, validated_data): """手机注册""" phone = validated_data.get('phone') try: self.User.objects.get(phone=phone) return Response(response_code.user_existed, status=status.HTTP_400_BAD_REQUEST) except self....
the_stack_v2_python_sparse
user_app/views/login_register_api.py
lmyfzx/Django-Mall
train
0
e44a3f6dea27e0939e6d592d5fb05a558662f25f
[ "loader = ProductItemLoader(ProductItem(), response)\nloader.add_xpath('id', '//input[@name=\"product_id\"]/@value')\nloader.add_css('name', '.title-product')\nloader.add_css('category', '.breadcrumb > li:not(:first-child) > a')\nloader.add_css('price', '#thisIsOriginal')\nloader.add_css('description', '#tab-descri...
<|body_start_0|> loader = ProductItemLoader(ProductItem(), response) loader.add_xpath('id', '//input[@name="product_id"]/@value') loader.add_css('name', '.title-product') loader.add_css('category', '.breadcrumb > li:not(:first-child) > a') loader.add_css('price', '#thisIsOriginal...
EssentialNaturalOils Products Spider
EssentialNaturalOilsProductsSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EssentialNaturalOilsProductsSpider: """EssentialNaturalOils Products Spider""" def parse_product(self, response): """Extract product details @url https://www.essentialnaturaloils.com/natural-essential-oils/silver-fir-needle-essential-oil-abies-alba-oil @returns requests 1 1""" ...
stack_v2_sparse_classes_36k_train_028455
4,735
no_license
[ { "docstring": "Extract product details @url https://www.essentialnaturaloils.com/natural-essential-oils/silver-fir-needle-essential-oil-abies-alba-oil @returns requests 1 1", "name": "parse_product", "signature": "def parse_product(self, response)" }, { "docstring": "Extract product reviews @ur...
2
stack_v2_sparse_classes_30k_train_010794
Implement the Python class `EssentialNaturalOilsProductsSpider` described below. Class description: EssentialNaturalOils Products Spider Method signatures and docstrings: - def parse_product(self, response): Extract product details @url https://www.essentialnaturaloils.com/natural-essential-oils/silver-fir-needle-ess...
Implement the Python class `EssentialNaturalOilsProductsSpider` described below. Class description: EssentialNaturalOils Products Spider Method signatures and docstrings: - def parse_product(self, response): Extract product details @url https://www.essentialnaturaloils.com/natural-essential-oils/silver-fir-needle-ess...
67eeb08962725fd3aff8c8cb7e16360ffd651f06
<|skeleton|> class EssentialNaturalOilsProductsSpider: """EssentialNaturalOils Products Spider""" def parse_product(self, response): """Extract product details @url https://www.essentialnaturaloils.com/natural-essential-oils/silver-fir-needle-essential-oil-abies-alba-oil @returns requests 1 1""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EssentialNaturalOilsProductsSpider: """EssentialNaturalOils Products Spider""" def parse_product(self, response): """Extract product details @url https://www.essentialnaturaloils.com/natural-essential-oils/silver-fir-needle-essential-oil-abies-alba-oil @returns requests 1 1""" loader = Pr...
the_stack_v2_python_sparse
pipeline/pipeline/spiders/essentialnaturaloils.py
DataRetrieval/pipeline
train
1
f2bd0590aefc85d347cb33fb308221e2b72ce902
[ "self._business_one = business_one\nself._business_two = business_two\nself._business_three = business_three", "report_list = [self._business_one, self._business_two, self._business_three]\nrandom.shuffle(report_list)\nreport_list = report_list[0:random.randint(0, len(report_list))]\nreturn report_list" ]
<|body_start_0|> self._business_one = business_one self._business_two = business_two self._business_three = business_three <|end_body_0|> <|body_start_1|> report_list = [self._business_one, self._business_two, self._business_three] random.shuffle(report_list) report_list...
Assemble
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Assemble: def __init__(self, business_one, business_two, business_three): """接受修改好的数据 :param business_one: :param business_two: :param business_three:""" <|body_0|> def single_element(self): """生成最终的上报数据 :return:""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_028456
785
no_license
[ { "docstring": "接受修改好的数据 :param business_one: :param business_two: :param business_three:", "name": "__init__", "signature": "def __init__(self, business_one, business_two, business_three)" }, { "docstring": "生成最终的上报数据 :return:", "name": "single_element", "signature": "def single_element...
2
stack_v2_sparse_classes_30k_train_000190
Implement the Python class `Assemble` described below. Class description: Implement the Assemble class. Method signatures and docstrings: - def __init__(self, business_one, business_two, business_three): 接受修改好的数据 :param business_one: :param business_two: :param business_three: - def single_element(self): 生成最终的上报数据 :r...
Implement the Python class `Assemble` described below. Class description: Implement the Assemble class. Method signatures and docstrings: - def __init__(self, business_one, business_two, business_three): 接受修改好的数据 :param business_one: :param business_two: :param business_three: - def single_element(self): 生成最终的上报数据 :r...
9dc610c68a2c6e3026725c1bb98c017edb51e2b9
<|skeleton|> class Assemble: def __init__(self, business_one, business_two, business_three): """接受修改好的数据 :param business_one: :param business_two: :param business_three:""" <|body_0|> def single_element(self): """生成最终的上报数据 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Assemble: def __init__(self, business_one, business_two, business_three): """接受修改好的数据 :param business_one: :param business_two: :param business_three:""" self._business_one = business_one self._business_two = business_two self._business_three = business_three def single_el...
the_stack_v2_python_sparse
hugh/simulat_probe/report_data/data_assemble/assemble.py
windorchidwarm/py_test_project
train
0
7d2bf70a1736b50409a315ef6f4f601f3d63e250
[ "super(Matern32, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name)\nlogger.debug('Initializing %s kernel.' % self.name)\nself.variance = np.float64(variance)\nself.lengthscale = np.float64(lengthscale)\nself.parameter_list = ['variance', 'lengthscale']\nself.constraint_map = {'variance': '+ve', 'len...
<|body_start_0|> super(Matern32, self).__init__(n_dims=n_dims, active_dims=active_dims, name=name) logger.debug('Initializing %s kernel.' % self.name) self.variance = np.float64(variance) self.lengthscale = np.float64(lengthscale) self.parameter_list = ['variance', 'lengthscale']...
Matern32
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Matern32: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specif...
stack_v2_sparse_classes_36k_train_028457
9,047
no_license
[ { "docstring": "squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified", "name": "__init__", "signature": "def __init__(self, n_dims, variance=1.0, lengthscale=1.0, act...
2
stack_v2_sparse_classes_30k_train_021561
Implement the Python class `Matern32` described below. Class description: Implement the Matern32 class. Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel varianc...
Implement the Python class `Matern32` described below. Class description: Implement the Matern32 class. Method signatures and docstrings: - def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel varianc...
1bed882b8a94ee58fd0bde6920ee85f81ffb77bb
<|skeleton|> class Matern32: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specif...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Matern32: def __init__(self, n_dims, variance=1.0, lengthscale=1.0, active_dims=None, name=None): """squared exponential kernel Inputs: n_dims : number of dimensions variance : kernel variance lengthscale : kernel lengthscale active_dims : all dims active by default, subset can be specified""" ...
the_stack_v2_python_sparse
gp_grief/kern/stationary.py
scwolof/gp_grief
train
2
c641e64d4c9f91e85b7e8a0ceeaf350f8b219c50
[ "config.setdefault('password', None)\nconfig.setdefault('private_key', None)\nconfig.setdefault('private_key_pass', None)\nconfig.setdefault('host_key', None)\nconfig.setdefault('dirs', ['.'])\nreturn config", "config = cls.prepare_config(config)\nfiles_only: bool = config['files_only']\ndirs_only: bool = config[...
<|body_start_0|> config.setdefault('password', None) config.setdefault('private_key', None) config.setdefault('private_key_pass', None) config.setdefault('host_key', None) config.setdefault('dirs', ['.']) return config <|end_body_0|> <|body_start_1|> config = cls...
Generate entries from SFTP. This plugin requires the pysftp Python module and its dependencies. Configuration: host: Host to connect to. port: Port the remote SSH server is listening on (default 22). username: Username to log in as. password: The password to use. Optional if a private key is provided. private_key: Path...
SftpList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SftpList: """Generate entries from SFTP. This plugin requires the pysftp Python module and its dependencies. Configuration: host: Host to connect to. port: Port the remote SSH server is listening on (default 22). username: Username to log in as. password: The password to use. Optional if a privat...
stack_v2_sparse_classes_36k_train_028458
15,674
permissive
[ { "docstring": "Sets defaults for the provided configuration", "name": "prepare_config", "signature": "def prepare_config(config: dict) -> dict" }, { "docstring": "Input task handler", "name": "on_task_input", "signature": "def on_task_input(cls, task: Task, config: dict) -> List[Entry]"...
2
stack_v2_sparse_classes_30k_train_019470
Implement the Python class `SftpList` described below. Class description: Generate entries from SFTP. This plugin requires the pysftp Python module and its dependencies. Configuration: host: Host to connect to. port: Port the remote SSH server is listening on (default 22). username: Username to log in as. password: Th...
Implement the Python class `SftpList` described below. Class description: Generate entries from SFTP. This plugin requires the pysftp Python module and its dependencies. Configuration: host: Host to connect to. port: Port the remote SSH server is listening on (default 22). username: Username to log in as. password: Th...
2b7e8314d103c94cf4552bd0152699eeca0ad159
<|skeleton|> class SftpList: """Generate entries from SFTP. This plugin requires the pysftp Python module and its dependencies. Configuration: host: Host to connect to. port: Port the remote SSH server is listening on (default 22). username: Username to log in as. password: The password to use. Optional if a privat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SftpList: """Generate entries from SFTP. This plugin requires the pysftp Python module and its dependencies. Configuration: host: Host to connect to. port: Port the remote SSH server is listening on (default 22). username: Username to log in as. password: The password to use. Optional if a private key is prov...
the_stack_v2_python_sparse
flexget/components/ftp/sftp.py
BrutuZ/Flexget
train
1
201496e5694d4607e3ddba735373ef19957571fc
[ "ents: Tuple[str, int, Tuple[int, int]] = []\ndoc: FeatureDocument\nfor six, (cls, doc) in enumerate(zip(classes, docs)):\n tok: FeatureToken\n start_ix = None\n start_lab = None\n ent: str\n for stix, (ent, tok) in enumerate(zip(cls, doc.tokens)):\n pos: int = ent.find('-')\n bio, lab ...
<|body_start_0|> ents: Tuple[str, int, Tuple[int, int]] = [] doc: FeatureDocument for six, (cls, doc) in enumerate(zip(classes, docs)): tok: FeatureToken start_ix = None start_lab = None ent: str for stix, (ent, tok) in enumerate(zip(cl...
Matches feature documents/tokens with spaCy document/tokens and entity labels.
BioSequenceAnnotationMapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BioSequenceAnnotationMapper: """Matches feature documents/tokens with spaCy document/tokens and entity labels.""" def _map_entities(self, classes: Tuple[List[str]], docs: Tuple[FeatureDocument]) -> Tuple[str, int, Tuple[int, int]]: """Map BIO entities and documents to a pairing of bo...
stack_v2_sparse_classes_36k_train_028459
7,916
permissive
[ { "docstring": "Map BIO entities and documents to a pairing of both. :param classes: the clases (labels, or usually, predictions) :param docs: the feature documents to assign labels :return: a tuple of label, sentence index and lexical feature document index interval of tokens", "name": "_map_entities", ...
3
stack_v2_sparse_classes_30k_train_008825
Implement the Python class `BioSequenceAnnotationMapper` described below. Class description: Matches feature documents/tokens with spaCy document/tokens and entity labels. Method signatures and docstrings: - def _map_entities(self, classes: Tuple[List[str]], docs: Tuple[FeatureDocument]) -> Tuple[str, int, Tuple[int,...
Implement the Python class `BioSequenceAnnotationMapper` described below. Class description: Matches feature documents/tokens with spaCy document/tokens and entity labels. Method signatures and docstrings: - def _map_entities(self, classes: Tuple[List[str]], docs: Tuple[FeatureDocument]) -> Tuple[str, int, Tuple[int,...
d2735848199741e818a49efb5197eb4a716fd96f
<|skeleton|> class BioSequenceAnnotationMapper: """Matches feature documents/tokens with spaCy document/tokens and entity labels.""" def _map_entities(self, classes: Tuple[List[str]], docs: Tuple[FeatureDocument]) -> Tuple[str, int, Tuple[int, int]]: """Map BIO entities and documents to a pairing of bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BioSequenceAnnotationMapper: """Matches feature documents/tokens with spaCy document/tokens and entity labels.""" def _map_entities(self, classes: Tuple[List[str]], docs: Tuple[FeatureDocument]) -> Tuple[str, int, Tuple[int, int]]: """Map BIO entities and documents to a pairing of both. :param cl...
the_stack_v2_python_sparse
src/python/zensols/deepnlp/model/sequence.py
plandes/deepnlp
train
9
19d9f9b11a6aed5c2e6d70303378a9655551e521
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Interface exported by the server.
TrainingCoordinatorServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingCoordinatorServicer: """Interface exported by the server.""" def Train(self, request, context): """Train a model""" <|body_0|> def GetStatus(self, request, context): """Get status of training job""" <|body_1|> def GetEvaluations(self, request...
stack_v2_sparse_classes_36k_train_028460
10,496
no_license
[ { "docstring": "Train a model", "name": "Train", "signature": "def Train(self, request, context)" }, { "docstring": "Get status of training job", "name": "GetStatus", "signature": "def GetStatus(self, request, context)" }, { "docstring": "Get evaluation metrics for the training j...
6
stack_v2_sparse_classes_30k_train_020589
Implement the Python class `TrainingCoordinatorServicer` described below. Class description: Interface exported by the server. Method signatures and docstrings: - def Train(self, request, context): Train a model - def GetStatus(self, request, context): Get status of training job - def GetEvaluations(self, request, co...
Implement the Python class `TrainingCoordinatorServicer` described below. Class description: Interface exported by the server. Method signatures and docstrings: - def Train(self, request, context): Train a model - def GetStatus(self, request, context): Get status of training job - def GetEvaluations(self, request, co...
49dc92036e71ca758cc35e8851a803b89d76ef52
<|skeleton|> class TrainingCoordinatorServicer: """Interface exported by the server.""" def Train(self, request, context): """Train a model""" <|body_0|> def GetStatus(self, request, context): """Get status of training job""" <|body_1|> def GetEvaluations(self, request...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainingCoordinatorServicer: """Interface exported by the server.""" def Train(self, request, context): """Train a model""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') ...
the_stack_v2_python_sparse
proto/trainer/trainer_pb2_grpc.py
selwynClarifai/video-manager
train
2
2949e51fec5fd32e3ab9a9417dccb84f67bb43da
[ "super(mpich, self).__init__(**kwargs)\nself.__baseurl = kwargs.pop('baseurl', 'https://www.mpich.org/static/downloads')\nself.__check = kwargs.pop('check', False)\nself.__configure_opts = kwargs.pop('configure_opts', [])\nself.__ospackages = kwargs.pop('ospackages', [])\nself.__prefix = kwargs.pop('prefix', '/usr/...
<|body_start_0|> super(mpich, self).__init__(**kwargs) self.__baseurl = kwargs.pop('baseurl', 'https://www.mpich.org/static/downloads') self.__check = kwargs.pop('check', False) self.__configure_opts = kwargs.pop('configure_opts', []) self.__ospackages = kwargs.pop('ospackages', ...
The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Parameters annotate: Boolean flag to s...
mpich
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mpich: """The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Param...
stack_v2_sparse_classes_36k_train_028461
8,511
permissive
[ { "docstring": "Initialize building block", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Setup configure options based on user parameters", "name": "__configure", "signature": "def __configure(self)" }, { "docstring": "Based on the Linux dist...
4
stack_v2_sparse_classes_30k_train_014878
Implement the Python class `mpich` described below. Class description: The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build u...
Implement the Python class `mpich` described below. Class description: The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build u...
60fd2a51c171258a6b3f93c2523101cb7018ba1b
<|skeleton|> class mpich: """The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mpich: """The `mpich` building block configures, builds, and installs the [MPICH](https://www.mpich.org) component. As a side effect, a toolchain is created containing the MPI compiler wrappers. The tool can be passed to other operations that want to build using the MPI compiler wrappers. # Parameters annotat...
the_stack_v2_python_sparse
hpccm/building_blocks/mpich.py
NVIDIA/hpc-container-maker
train
419
aef530f2e9879c8e8228768f445778d78e6aa473
[ "c = [core.Commit('f123', 'desc', nomination_type=core.NominationType.FIXES, because_sha='abcd'), core.Commit('abcd', 'desc', True)]\nawait core.resolve_fixes(c, [])\nassert c[1].nominated", "c = [core.Commit('f123', 'desc', nomination_type=core.NominationType.FIXES, because_sha='abcd'), core.Commit('abcd', 'desc...
<|body_start_0|> c = [core.Commit('f123', 'desc', nomination_type=core.NominationType.FIXES, because_sha='abcd'), core.Commit('abcd', 'desc', True)] await core.resolve_fixes(c, []) assert c[1].nominated <|end_body_0|> <|body_start_1|> c = [core.Commit('f123', 'desc', nomination_type=cor...
TestResolveFixes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestResolveFixes: async def test_in_new(self): """Because commit abcd is nominated, so f123 should be as well.""" <|body_0|> async def test_not_in_new(self): """Because commit abcd is not nominated, commit f123 shouldn't be either.""" <|body_1|> async de...
stack_v2_sparse_classes_36k_train_028462
18,255
no_license
[ { "docstring": "Because commit abcd is nominated, so f123 should be as well.", "name": "test_in_new", "signature": "async def test_in_new(self)" }, { "docstring": "Because commit abcd is not nominated, commit f123 shouldn't be either.", "name": "test_not_in_new", "signature": "async def ...
4
stack_v2_sparse_classes_30k_train_015723
Implement the Python class `TestResolveFixes` described below. Class description: Implement the TestResolveFixes class. Method signatures and docstrings: - async def test_in_new(self): Because commit abcd is nominated, so f123 should be as well. - async def test_not_in_new(self): Because commit abcd is not nominated,...
Implement the Python class `TestResolveFixes` described below. Class description: Implement the TestResolveFixes class. Method signatures and docstrings: - async def test_in_new(self): Because commit abcd is nominated, so f123 should be as well. - async def test_not_in_new(self): Because commit abcd is not nominated,...
b10df64ea1ff051768f367e321b4a3368de89397
<|skeleton|> class TestResolveFixes: async def test_in_new(self): """Because commit abcd is nominated, so f123 should be as well.""" <|body_0|> async def test_not_in_new(self): """Because commit abcd is not nominated, commit f123 shouldn't be either.""" <|body_1|> async de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestResolveFixes: async def test_in_new(self): """Because commit abcd is nominated, so f123 should be as well.""" c = [core.Commit('f123', 'desc', nomination_type=core.NominationType.FIXES, because_sha='abcd'), core.Commit('abcd', 'desc', True)] await core.resolve_fixes(c, []) ...
the_stack_v2_python_sparse
bin/pick/core_test.py
maurossi/mesa
train
20
e26f900b6dd9620dd2dd3d2cdd4d2e612dcf66fa
[ "m = len(grid)\nn = len(grid[0]) if m else 0\nif n == 0:\n return []\ni, j = (0, n)\nmaxCnt, res = (0, [])\nwhile i < m:\n if 0 <= j < n and grid[i][j] == 0:\n i += 1\n continue\n while j - 1 >= 0 and grid[i][j - 1] == 1:\n j -= 1\n if n - j != 0 and n - j == maxCnt:\n res.ap...
<|body_start_0|> m = len(grid) n = len(grid[0]) if m else 0 if n == 0: return [] i, j = (0, n) maxCnt, res = (0, []) while i < m: if 0 <= j < n and grid[i][j] == 0: i += 1 continue while j - 1 >= 0 and gr...
Solutions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solutions: def problem1(self, grid): """include most 1, start from top-right, when meet 1, go left, when meet 0, go down Time complexity: O(m + n) # m: rows, n: cols Space complexity: O(1) # not create space param: grid: list[list[int]] rtype: list[int]""" <|body_0|> def pro...
stack_v2_sparse_classes_36k_train_028463
4,073
no_license
[ { "docstring": "include most 1, start from top-right, when meet 1, go left, when meet 0, go down Time complexity: O(m + n) # m: rows, n: cols Space complexity: O(1) # not create space param: grid: list[list[int]] rtype: list[int]", "name": "problem1", "signature": "def problem1(self, grid)" }, { ...
4
null
Implement the Python class `Solutions` described below. Class description: Implement the Solutions class. Method signatures and docstrings: - def problem1(self, grid): include most 1, start from top-right, when meet 1, go left, when meet 0, go down Time complexity: O(m + n) # m: rows, n: cols Space complexity: O(1) #...
Implement the Python class `Solutions` described below. Class description: Implement the Solutions class. Method signatures and docstrings: - def problem1(self, grid): include most 1, start from top-right, when meet 1, go left, when meet 0, go down Time complexity: O(m + n) # m: rows, n: cols Space complexity: O(1) #...
e16702d2b3ec4e5054baad56f4320bc3b31676ad
<|skeleton|> class Solutions: def problem1(self, grid): """include most 1, start from top-right, when meet 1, go left, when meet 0, go down Time complexity: O(m + n) # m: rows, n: cols Space complexity: O(1) # not create space param: grid: list[list[int]] rtype: list[int]""" <|body_0|> def pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solutions: def problem1(self, grid): """include most 1, start from top-right, when meet 1, go left, when meet 0, go down Time complexity: O(m + n) # m: rows, n: cols Space complexity: O(1) # not create space param: grid: list[list[int]] rtype: list[int]""" m = len(grid) n = len(grid[0]...
the_stack_v2_python_sparse
interview_exam/pinduoduo/problems.py
SuperMartinYang/learning_algorithm
train
0
da93e0746aaedfb7d36cd653f0e250c0b86fe8cd
[ "Instrument.__init__(self, cle)\nself.emplacement = 'mains'\nself.positions = (1, 2)\nself.precision = 10\nself.calcul = 60\nself.etendre_editeur('r', 'précision', Uniligne, self, 'precision')\nself.etendre_editeur('ca', 'temps de calcul', Uniligne, self, 'calcul')", "precision = enveloppes['r']\nprecision.apercu...
<|body_start_0|> Instrument.__init__(self, cle) self.emplacement = 'mains' self.positions = (1, 2) self.precision = 10 self.calcul = 60 self.etendre_editeur('r', 'précision', Uniligne, self, 'precision') self.etendre_editeur('ca', 'temps de calcul', Uniligne, self...
Type d'objet: sextant.
Sextant
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sextant: """Type d'objet: sextant.""" def __init__(self, cle=''): """Constructeur de l'objet""" <|body_0|> def travailler_enveloppes(self, enveloppes): """Travail sur les enveloppes""" <|body_1|> def regarder(self, personnage): """Quand on re...
stack_v2_sparse_classes_36k_train_028464
3,821
permissive
[ { "docstring": "Constructeur de l'objet", "name": "__init__", "signature": "def __init__(self, cle='')" }, { "docstring": "Travail sur les enveloppes", "name": "travailler_enveloppes", "signature": "def travailler_enveloppes(self, enveloppes)" }, { "docstring": "Quand on regarde ...
3
stack_v2_sparse_classes_30k_test_000296
Implement the Python class `Sextant` described below. Class description: Type d'objet: sextant. Method signatures and docstrings: - def __init__(self, cle=''): Constructeur de l'objet - def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes - def regarder(self, personnage): Quand on regarde la sextan...
Implement the Python class `Sextant` described below. Class description: Type d'objet: sextant. Method signatures and docstrings: - def __init__(self, cle=''): Constructeur de l'objet - def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes - def regarder(self, personnage): Quand on regarde la sextan...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class Sextant: """Type d'objet: sextant.""" def __init__(self, cle=''): """Constructeur de l'objet""" <|body_0|> def travailler_enveloppes(self, enveloppes): """Travail sur les enveloppes""" <|body_1|> def regarder(self, personnage): """Quand on re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sextant: """Type d'objet: sextant.""" def __init__(self, cle=''): """Constructeur de l'objet""" Instrument.__init__(self, cle) self.emplacement = 'mains' self.positions = (1, 2) self.precision = 10 self.calcul = 60 self.etendre_editeur('r', 'précisi...
the_stack_v2_python_sparse
src/secondaires/navigation/types/sextant.py
vincent-lg/tsunami
train
5
be3ad784cd8c97e97ec274d958d39f6e8bdaea91
[ "self.num_bits = num_bits\nself.num_hash_fn = num_hash_fn\nself.bits = [0] * num_bits\nself.primes = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]\nself.hash_fns = []\nfor i in xrange(num_hash_fn):\n prime = random.choice(self.primes)\n self.primes.remove(prime)\n self.hash_fns.append(self.generate...
<|body_start_0|> self.num_bits = num_bits self.num_hash_fn = num_hash_fn self.bits = [0] * num_bits self.primes = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47] self.hash_fns = [] for i in xrange(num_hash_fn): prime = random.choice(self.primes) ...
Models a bloom filter data structure. A bloom filter holds an array of bytes and a small set of hash functions. Attributes: num_bits: int, the size of the memory the datastructure uses. num_hash_fn: int, how many hash function to use to store data. bits: list, the container for the stored data. primes: list, a list of ...
BloomFilter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BloomFilter: """Models a bloom filter data structure. A bloom filter holds an array of bytes and a small set of hash functions. Attributes: num_bits: int, the size of the memory the datastructure uses. num_hash_fn: int, how many hash function to use to store data. bits: list, the container for th...
stack_v2_sparse_classes_36k_train_028465
2,204
permissive
[ { "docstring": "Initialize a bloom filter by giving the size of the storage array. Params: num_bits: size of the internal array num_hash_fn: number of hash functions to generate to store data.", "name": "__init__", "signature": "def __init__(self, num_bits, num_hash_fn)" }, { "docstring": "Gener...
4
null
Implement the Python class `BloomFilter` described below. Class description: Models a bloom filter data structure. A bloom filter holds an array of bytes and a small set of hash functions. Attributes: num_bits: int, the size of the memory the datastructure uses. num_hash_fn: int, how many hash function to use to store...
Implement the Python class `BloomFilter` described below. Class description: Models a bloom filter data structure. A bloom filter holds an array of bytes and a small set of hash functions. Attributes: num_bits: int, the size of the memory the datastructure uses. num_hash_fn: int, how many hash function to use to store...
1c5b1433c3d6bfd834df35dee08607fcbdd9f4e3
<|skeleton|> class BloomFilter: """Models a bloom filter data structure. A bloom filter holds an array of bytes and a small set of hash functions. Attributes: num_bits: int, the size of the memory the datastructure uses. num_hash_fn: int, how many hash function to use to store data. bits: list, the container for th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BloomFilter: """Models a bloom filter data structure. A bloom filter holds an array of bytes and a small set of hash functions. Attributes: num_bits: int, the size of the memory the datastructure uses. num_hash_fn: int, how many hash function to use to store data. bits: list, the container for the stored data...
the_stack_v2_python_sparse
python/algo/src/bloom_filter.py
topliceanu/learn
train
26
1bb69a91efb77ee151f70f2ba35860b4a4cbaaea
[ "incl = ['a', 'b']\nexcl = ['b', 'c']\nfcn = da.lwc.search._get_dual_regex_indicator_fcn(incl, excl)\nassert fcn('a')\nassert not fcn('b')\nassert not fcn('c')\nassert not fcn('d')", "incl = ['a', 'b']\nfcn = da.lwc.search._get_dual_regex_indicator_fcn(incl, excl=None)\nassert fcn('a')\nassert fcn('b')\nassert no...
<|body_start_0|> incl = ['a', 'b'] excl = ['b', 'c'] fcn = da.lwc.search._get_dual_regex_indicator_fcn(incl, excl) assert fcn('a') assert not fcn('b') assert not fcn('c') assert not fcn('d') <|end_body_0|> <|body_start_1|> incl = ['a', 'b'] fcn = ...
Specify the _get_dual_regex_indicator_fcn.
Specify_GetDualRegexIndicatorFcn
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Specify_GetDualRegexIndicatorFcn: """Specify the _get_dual_regex_indicator_fcn.""" def it_detects_items_in_include_list_but_not_those_in_exclude_list(self): """Test that items in include list return true unless in the exclude list.""" <|body_0|> def it_nothing_is_exclude...
stack_v2_sparse_classes_36k_train_028466
29,518
permissive
[ { "docstring": "Test that items in include list return true unless in the exclude list.", "name": "it_detects_items_in_include_list_but_not_those_in_exclude_list", "signature": "def it_detects_items_in_include_list_but_not_those_in_exclude_list(self)" }, { "docstring": "Test that no include item...
4
null
Implement the Python class `Specify_GetDualRegexIndicatorFcn` described below. Class description: Specify the _get_dual_regex_indicator_fcn. Method signatures and docstrings: - def it_detects_items_in_include_list_but_not_those_in_exclude_list(self): Test that items in include list return true unless in the exclude l...
Implement the Python class `Specify_GetDualRegexIndicatorFcn` described below. Class description: Specify the _get_dual_regex_indicator_fcn. Method signatures and docstrings: - def it_detects_items_in_include_list_but_not_those_in_exclude_list(self): Test that items in include list return true unless in the exclude l...
04a13be2792323e3f9fdb83fd236a8e9cfe6aa2d
<|skeleton|> class Specify_GetDualRegexIndicatorFcn: """Specify the _get_dual_regex_indicator_fcn.""" def it_detects_items_in_include_list_but_not_those_in_exclude_list(self): """Test that items in include list return true unless in the exclude list.""" <|body_0|> def it_nothing_is_exclude...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Specify_GetDualRegexIndicatorFcn: """Specify the _get_dual_regex_indicator_fcn.""" def it_detects_items_in_include_list_but_not_those_in_exclude_list(self): """Test that items in include list return true unless in the exclude list.""" incl = ['a', 'b'] excl = ['b', 'c'] fc...
the_stack_v2_python_sparse
a3_src/h70_internal/da/lwc/spec/spec_search.py
wtpayne/hiai
train
5
567c1b7258acf3cdba3fbf1bb6a97be31e4b58e1
[ "i = 1\nret = [0] * num_people\nwhile candies > i:\n ret[(i - 1) % num_people] += i\n candies -= i\n i += 1\nret[(i - 1) % num_people] += candies\nreturn ret", "n = int(math.sqrt(2 * candies + 0.25) - 0.5)\nrows, cols = divmod(n, num_people)\nret = [0] * num_people\nfor i in range(num_people):\n ret[i...
<|body_start_0|> i = 1 ret = [0] * num_people while candies > i: ret[(i - 1) % num_people] += i candies -= i i += 1 ret[(i - 1) % num_people] += candies return ret <|end_body_0|> <|body_start_1|> n = int(math.sqrt(2 * candies + 0.25) -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def distributeCandies_MK1(self, candies: int, num_people: int) -> List[int]: """BF.""" <|body_0|> def distributeCandies_MK2(self, candies: int, num_people: int) -> List[int]: """Math.""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 1 ...
stack_v2_sparse_classes_36k_train_028467
896
no_license
[ { "docstring": "BF.", "name": "distributeCandies_MK1", "signature": "def distributeCandies_MK1(self, candies: int, num_people: int) -> List[int]" }, { "docstring": "Math.", "name": "distributeCandies_MK2", "signature": "def distributeCandies_MK2(self, candies: int, num_people: int) -> Li...
2
stack_v2_sparse_classes_30k_train_002656
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distributeCandies_MK1(self, candies: int, num_people: int) -> List[int]: BF. - def distributeCandies_MK2(self, candies: int, num_people: int) -> List[int]: Math.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def distributeCandies_MK1(self, candies: int, num_people: int) -> List[int]: BF. - def distributeCandies_MK2(self, candies: int, num_people: int) -> List[int]: Math. <|skeleton|...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def distributeCandies_MK1(self, candies: int, num_people: int) -> List[int]: """BF.""" <|body_0|> def distributeCandies_MK2(self, candies: int, num_people: int) -> List[int]: """Math.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def distributeCandies_MK1(self, candies: int, num_people: int) -> List[int]: """BF.""" i = 1 ret = [0] * num_people while candies > i: ret[(i - 1) % num_people] += i candies -= i i += 1 ret[(i - 1) % num_people] += candies ...
the_stack_v2_python_sparse
1103. Distribute Candies to People/Solution.py
faterazer/LeetCode
train
4
500e8ca776184cac5ece24ee08aa1b26a15bee2a
[ "points.sort()\nif len(points) < 4:\n return 0\nMAX = 10000\ndict_X = set()\nres = float('inf')\nfor i in range(len(points)):\n for j in range(len(points)):\n if points[i][0] == points[j][0] or points[i][1] == points[j][1]:\n continue\n if points[i][0] * MAX + points[j][1] in dict_X a...
<|body_start_0|> points.sort() if len(points) < 4: return 0 MAX = 10000 dict_X = set() res = float('inf') for i in range(len(points)): for j in range(len(points)): if points[i][0] == points[j][0] or points[i][1] == points[j][1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minAreaRect(self, points): """:type points: List[List[int]] :rtype: int""" <|body_0|> def minAreaRect2(self, points): """:type points: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> points.sort() if...
stack_v2_sparse_classes_36k_train_028468
1,437
no_license
[ { "docstring": ":type points: List[List[int]] :rtype: int", "name": "minAreaRect", "signature": "def minAreaRect(self, points)" }, { "docstring": ":type points: List[List[int]] :rtype: int", "name": "minAreaRect2", "signature": "def minAreaRect2(self, points)" } ]
2
stack_v2_sparse_classes_30k_train_000946
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaRect(self, points): :type points: List[List[int]] :rtype: int - def minAreaRect2(self, points): :type points: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaRect(self, points): :type points: List[List[int]] :rtype: int - def minAreaRect2(self, points): :type points: List[List[int]] :rtype: int <|skeleton|> class Solution:...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def minAreaRect(self, points): """:type points: List[List[int]] :rtype: int""" <|body_0|> def minAreaRect2(self, points): """:type points: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minAreaRect(self, points): """:type points: List[List[int]] :rtype: int""" points.sort() if len(points) < 4: return 0 MAX = 10000 dict_X = set() res = float('inf') for i in range(len(points)): for j in range(len(poin...
the_stack_v2_python_sparse
minAreaRect.py
NeilWangziyu/Leetcode_py
train
2
45a7a36584c056c15650a48c18cc037e73ebb62f
[ "driver.find_element_by_css_selector('.start-webinar').click()\nwindows = driver.window_handles\ndriver.switch_to.window(windows[1])\nsleep(2)\ndriver.find_element_by_link_text('发起直播').click()\ndriver.switch_to.window(windows[1])\nelement = WebDriverWait(driver, 20, 1).until(EC.presence_of_element_located((By.CSS_S...
<|body_start_0|> driver.find_element_by_css_selector('.start-webinar').click() windows = driver.window_handles driver.switch_to.window(windows[1]) sleep(2) driver.find_element_by_link_text('发起直播').click() driver.switch_to.window(windows[1]) element = WebDriverWait...
Test_case_03_toolsAB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_case_03_toolsAB: def test_03_startVideo(self): """开始直播""" <|body_0|> def test_04_questionnaire(self): """发起问卷""" <|body_1|> def test_05_signIn(self): """发起签到""" <|body_2|> def test_06_QandA(self): """开启问答""" <|bo...
stack_v2_sparse_classes_36k_train_028469
3,477
no_license
[ { "docstring": "开始直播", "name": "test_03_startVideo", "signature": "def test_03_startVideo(self)" }, { "docstring": "发起问卷", "name": "test_04_questionnaire", "signature": "def test_04_questionnaire(self)" }, { "docstring": "发起签到", "name": "test_05_signIn", "signature": "def...
6
null
Implement the Python class `Test_case_03_toolsAB` described below. Class description: Implement the Test_case_03_toolsAB class. Method signatures and docstrings: - def test_03_startVideo(self): 开始直播 - def test_04_questionnaire(self): 发起问卷 - def test_05_signIn(self): 发起签到 - def test_06_QandA(self): 开启问答 - def test_07_...
Implement the Python class `Test_case_03_toolsAB` described below. Class description: Implement the Test_case_03_toolsAB class. Method signatures and docstrings: - def test_03_startVideo(self): 开始直播 - def test_04_questionnaire(self): 发起问卷 - def test_05_signIn(self): 发起签到 - def test_06_QandA(self): 开启问答 - def test_07_...
a47c6afe7734037695e397052cf189510e816f9e
<|skeleton|> class Test_case_03_toolsAB: def test_03_startVideo(self): """开始直播""" <|body_0|> def test_04_questionnaire(self): """发起问卷""" <|body_1|> def test_05_signIn(self): """发起签到""" <|body_2|> def test_06_QandA(self): """开启问答""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_case_03_toolsAB: def test_03_startVideo(self): """开始直播""" driver.find_element_by_css_selector('.start-webinar').click() windows = driver.window_handles driver.switch_to.window(windows[1]) sleep(2) driver.find_element_by_link_text('发起直播').click() dri...
the_stack_v2_python_sparse
Test_vhall/vhall_unittest/test_case/test_case_03_toolsAB.py
1065865483/python_script
train
0
45c2183425132b43255f633e938adef96e1c3146
[ "self.stop = stop\nself.route = route\nself.info = None", "bridge = BizkaibusData(self.stop, self.route)\nbridge.getNextBus()\nself.info = bridge.info" ]
<|body_start_0|> self.stop = stop self.route = route self.info = None <|end_body_0|> <|body_start_1|> bridge = BizkaibusData(self.stop, self.route) bridge.getNextBus() self.info = bridge.info <|end_body_1|>
The class for handling the data retrieval.
Bizkaibus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bizkaibus: """The class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" <|body_0|> def update(self): """Retrieve the information from API.""" <|body_1|> <|end_skeleton|> <|body_start_0|> sel...
stack_v2_sparse_classes_36k_train_028470
2,206
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, stop, route)" }, { "docstring": "Retrieve the information from API.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_010601
Implement the Python class `Bizkaibus` described below. Class description: The class for handling the data retrieval. Method signatures and docstrings: - def __init__(self, stop, route): Initialize the data object. - def update(self): Retrieve the information from API.
Implement the Python class `Bizkaibus` described below. Class description: The class for handling the data retrieval. Method signatures and docstrings: - def __init__(self, stop, route): Initialize the data object. - def update(self): Retrieve the information from API. <|skeleton|> class Bizkaibus: """The class ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class Bizkaibus: """The class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" <|body_0|> def update(self): """Retrieve the information from API.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bizkaibus: """The class for handling the data retrieval.""" def __init__(self, stop, route): """Initialize the data object.""" self.stop = stop self.route = route self.info = None def update(self): """Retrieve the information from API.""" bridge = Bizk...
the_stack_v2_python_sparse
homeassistant/components/bizkaibus/sensor.py
home-assistant/core
train
35,501
7b0847d9aad677cc871f5d2b890469a2f52ae1c8
[ "logger.debug('cleaned_data %s' % self.cleaned_data)\nif self.files:\n self.key_str = self.files['key_file'].read()\n if not self.key_str or not self.key_str.startswith('ssh-rsa '):\n raise forms.ValidationError('Provided file does not seem to contain a valid public SSH key. Please check and try again....
<|body_start_0|> logger.debug('cleaned_data %s' % self.cleaned_data) if self.files: self.key_str = self.files['key_file'].read() if not self.key_str or not self.key_str.startswith('ssh-rsa '): raise forms.ValidationError('Provided file does not seem to contain a v...
Form to upload a public SSH key.
UploadKeyForm
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadKeyForm: """Form to upload a public SSH key.""" def clean(self): """Perform minimal sanity check""" <|body_0|> def save(self, user): """Update the SSH keys @param user: the user to update SSH keys for. @type user: C{django.contrib.auth.models.User}""" ...
stack_v2_sparse_classes_36k_train_028471
6,630
permissive
[ { "docstring": "Perform minimal sanity check", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Update the SSH keys @param user: the user to update SSH keys for. @type user: C{django.contrib.auth.models.User}", "name": "save", "signature": "def save(self, user)" } ]
2
null
Implement the Python class `UploadKeyForm` described below. Class description: Form to upload a public SSH key. Method signatures and docstrings: - def clean(self): Perform minimal sanity check - def save(self, user): Update the SSH keys @param user: the user to update SSH keys for. @type user: C{django.contrib.auth....
Implement the Python class `UploadKeyForm` described below. Class description: Form to upload a public SSH key. Method signatures and docstrings: - def clean(self): Perform minimal sanity check - def save(self, user): Update the SSH keys @param user: the user to update SSH keys for. @type user: C{django.contrib.auth....
059ed2b3308bda2af5e1942dc9967e6573dd6a53
<|skeleton|> class UploadKeyForm: """Form to upload a public SSH key.""" def clean(self): """Perform minimal sanity check""" <|body_0|> def save(self, user): """Update the SSH keys @param user: the user to update SSH keys for. @type user: C{django.contrib.auth.models.User}""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UploadKeyForm: """Form to upload a public SSH key.""" def clean(self): """Perform minimal sanity check""" logger.debug('cleaned_data %s' % self.cleaned_data) if self.files: self.key_str = self.files['key_file'].read() if not self.key_str or not self.key_str...
the_stack_v2_python_sparse
expedient/src/python/expedient/clearinghouse/geni/forms.py
dana-i2cat/felix
train
4
e449e7d1c34871c58ccdbb9e7564c4d0e664f25d
[ "if x == 0:\n return 0\nleft = 1\nright = x // 2\nwhile left < right:\n mid = left + right + 1 >> 1\n square = mid * mid\n if square > x:\n right = mid - 1\n else:\n left = mid\nreturn left", "if x == 0:\n return 0\ncur = 1\nwhile True:\n pre = cur\n cur = (cur + x / cur) / 2...
<|body_start_0|> if x == 0: return 0 left = 1 right = x // 2 while left < right: mid = left + right + 1 >> 1 square = mid * mid if square > x: right = mid - 1 else: left = mid return left ...
# 二分法
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """# 二分法""" def mySqrt1(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrt(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x == 0: return 0 left = 1 right...
stack_v2_sparse_classes_36k_train_028472
1,468
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "mySqrt1", "signature": "def mySqrt1(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "mySqrt", "signature": "def mySqrt(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_003475
Implement the Python class `Solution` described below. Class description: # 二分法 Method signatures and docstrings: - def mySqrt1(self, x): :type x: int :rtype: int - def mySqrt(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: # 二分法 Method signatures and docstrings: - def mySqrt1(self, x): :type x: int :rtype: int - def mySqrt(self, x): :type x: int :rtype: int <|skeleton|> class Solution: """# 二分法""" def mySqrt1(self, x): """:type x: int :rtype: in...
f831fd9603592ae5bee3679924f962a3ebce381c
<|skeleton|> class Solution: """# 二分法""" def mySqrt1(self, x): """:type x: int :rtype: int""" <|body_0|> def mySqrt(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """# 二分法""" def mySqrt1(self, x): """:type x: int :rtype: int""" if x == 0: return 0 left = 1 right = x // 2 while left < right: mid = left + right + 1 >> 1 square = mid * mid if square > x: ...
the_stack_v2_python_sparse
old/t20190918_mySqrt/mySqrt.py
GongFuXiong/leetcode
train
0
e7b91c67ce5a1b9010dab5622d105c843d05faec
[ "self.num = num\nself.proc = subprocess.Popen(['python', '-u', './DASP/system/initial.py', str(self.num)], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nself.printdata = printdata\nprint('[node{}]pid:{}'.format(num, self.proc.pid))\nself.thread = threading.Thread(target=self.getprintdata, args=(mode...
<|body_start_0|> self.num = num self.proc = subprocess.Popen(['python', '-u', './DASP/system/initial.py', str(self.num)], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.printdata = printdata print('[node{}]pid:{}'.format(num, self.proc.pid)) self.thread = threa...
节点类 用于多进程开启任务节点 属性: num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 proc: 节点进程 thread: 节点获取输出数据线程
Node
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Node: """节点类 用于多进程开启任务节点 属性: num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 proc: 节点进程 thread: 节点获取输出数据线程""" def __init__(self, num, mode, printdata): """num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据""" <|body_0|> def getprintdata(self, mode=False): ""...
stack_v2_sparse_classes_36k_train_028473
2,119
no_license
[ { "docstring": "num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据", "name": "__init__", "signature": "def __init__(self, num, mode, printdata)" }, { "docstring": "获取输出数据", "name": "getprintdata", "signature": "def getprintdata(self, mode=False)" }, { "docstring": "杀死节点进程", ...
3
stack_v2_sparse_classes_30k_train_019344
Implement the Python class `Node` described below. Class description: 节点类 用于多进程开启任务节点 属性: num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 proc: 节点进程 thread: 节点获取输出数据线程 Method signatures and docstrings: - def __init__(self, num, mode, printdata): num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 - def getprintda...
Implement the Python class `Node` described below. Class description: 节点类 用于多进程开启任务节点 属性: num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 proc: 节点进程 thread: 节点获取输出数据线程 Method signatures and docstrings: - def __init__(self, num, mode, printdata): num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 - def getprintda...
b6d056551d1323fd418f870b6340d8e9b906dc0f
<|skeleton|> class Node: """节点类 用于多进程开启任务节点 属性: num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 proc: 节点进程 thread: 节点获取输出数据线程""" def __init__(self, num, mode, printdata): """num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据""" <|body_0|> def getprintdata(self, mode=False): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Node: """节点类 用于多进程开启任务节点 属性: num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据 proc: 节点进程 thread: 节点获取输出数据线程""" def __init__(self, num, mode, printdata): """num: 节点ID编号 从1开始 mode: 是否直接打印输出数据 printdata: 节点输出数据""" self.num = num self.proc = subprocess.Popen(['python', '-u', './DAS...
the_stack_v2_python_sparse
树莓派节点/分布式平台/DSP3.0/DASP/module/DaspNode.py
Wales-Wyf/Mingze_Project
train
1
49e2858afaf4c77f2c5c2c655e6a5efa9cf9eca0
[ "self.name = name\nself.type = type\nself.required = required\nself.default = default\nself.ignore = ignore\nself.choices = choices\nself.nullable = nullable\nself.location = location\nself.discard = discard\nself.help = help", "if self.location and hasattr(request, self.location):\n req_data = getattr(request...
<|body_start_0|> self.name = name self.type = type self.required = required self.default = default self.ignore = ignore self.choices = choices self.nullable = nullable self.location = location self.discard = discard self.help = help <|end_b...
Param
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Param: def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): """请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool)...
stack_v2_sparse_classes_36k_train_028474
3,546
no_license
[ { "docstring": "请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool): 是否忽略类型 choices (tuple): 可选值 location (str): 访问数据源 args, json, form 默认 GET: args, POST: json discard (bool): 不存在 key, 是否不解析参数 help (str): 参数不匹配时, 返回提示", "name": ...
2
stack_v2_sparse_classes_30k_train_012240
Implement the Python class `Param` described below. Class description: Implement the Param class. Method signatures and docstrings: - def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): 请求参数对象 Args: name (str): 字段名 type (c...
Implement the Python class `Param` described below. Class description: Implement the Param class. Method signatures and docstrings: - def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): 请求参数对象 Args: name (str): 字段名 type (c...
7877724c7875fad0297f7801910f162d80c5d695
<|skeleton|> class Param: def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): """请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Param: def __init__(self, name, type=str, required=False, default=None, nullable=True, ignore=False, choices=None, location=None, discard=False, help=''): """请求参数对象 Args: name (str): 字段名 type (class): 类型 required (bool): 是否必填 default (any): 默认值 (必填时无效) nullable (bool): 是否非空 ignore (bool): 是否忽略类型 choic...
the_stack_v2_python_sparse
base/params.py
HeyManLean/RedisApp
train
0
67448b3f2fbd09bb0e9fa61935aead5048c3879d
[ "response = self.client.get(reverse('index_rango'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'There are no categories present.')\nself.assertQuerysetEqual(response.context['categories'], [])", "add_cat('test', 1, 1)\nadd_cat('temp', 1, 1)\nadd_cat('tmp', 1, 1)\nadd_cat('tmp test...
<|body_start_0|> response = self.client.get(reverse('index_rango')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There are no categories present.') self.assertQuerysetEqual(response.context['categories'], []) <|end_body_0|> <|body_start_1|> add_cat(...
IndexViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexViewTests: def test_index_view_with_no_categories(self): """Если не существует категорий, то должно выводиться соответствующее сообщение.""" <|body_0|> def test_index_view_with_categories(self): """Если не существует категорий, то должно выводиться соответствующ...
stack_v2_sparse_classes_36k_train_028475
2,626
no_license
[ { "docstring": "Если не существует категорий, то должно выводиться соответствующее сообщение.", "name": "test_index_view_with_no_categories", "signature": "def test_index_view_with_no_categories(self)" }, { "docstring": "Если не существует категорий, то должно выводиться соответствующее сообщени...
2
stack_v2_sparse_classes_30k_train_012916
Implement the Python class `IndexViewTests` described below. Class description: Implement the IndexViewTests class. Method signatures and docstrings: - def test_index_view_with_no_categories(self): Если не существует категорий, то должно выводиться соответствующее сообщение. - def test_index_view_with_categories(self...
Implement the Python class `IndexViewTests` described below. Class description: Implement the IndexViewTests class. Method signatures and docstrings: - def test_index_view_with_no_categories(self): Если не существует категорий, то должно выводиться соответствующее сообщение. - def test_index_view_with_categories(self...
80f1a6bcbe2e0448b844e1352ebd1ae3c5f5e858
<|skeleton|> class IndexViewTests: def test_index_view_with_no_categories(self): """Если не существует категорий, то должно выводиться соответствующее сообщение.""" <|body_0|> def test_index_view_with_categories(self): """Если не существует категорий, то должно выводиться соответствующ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexViewTests: def test_index_view_with_no_categories(self): """Если не существует категорий, то должно выводиться соответствующее сообщение.""" response = self.client.get(reverse('index_rango')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There ...
the_stack_v2_python_sparse
rango/tests.py
blazer-05/tangotest
train
1
987c5813c7ee342ddd161b86fecf1fbb2183a3e6
[ "kwargs['pid_value'] = record['id']\nkwargs['status'] = cls.default_status\nkwargs['object_type'] = cls.object_type\nkwargs['object_uuid'] = record.model.id\nreturn super(CommunitiesIdProvider, cls).create(**kwargs)", "try:\n existing_pid = cls.get(new_value).pid\nexcept PIDDoesNotExistError:\n pass\nelse:\...
<|body_start_0|> kwargs['pid_value'] = record['id'] kwargs['status'] = cls.default_status kwargs['object_type'] = cls.object_type kwargs['object_uuid'] = record.model.id return super(CommunitiesIdProvider, cls).create(**kwargs) <|end_body_0|> <|body_start_1|> try: ...
Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.
CommunitiesIdProvider
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommunitiesIdProvider: """Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.""" def create(cls, record, **kwargs): """Create a new commuinity identifier. For more information abou...
stack_v2_sparse_classes_36k_train_028476
2,431
permissive
[ { "docstring": "Create a new commuinity identifier. For more information about parameters, see :meth:`invenio_pidstore.providers.base.BaseProvider.create`. :param record: The community record. :param kwargs: dict to hold generated pid_value and status. See :meth:`invenio_pidstore.providers.base.BaseProvider.cre...
2
stack_v2_sparse_classes_30k_train_003997
Implement the Python class `CommunitiesIdProvider` described below. Class description: Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier. Method signatures and docstrings: - def create(cls, record, **kwargs): Crea...
Implement the Python class `CommunitiesIdProvider` described below. Class description: Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier. Method signatures and docstrings: - def create(cls, record, **kwargs): Crea...
e6e032960abd5d4062a63824d6d349a6158339af
<|skeleton|> class CommunitiesIdProvider: """Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.""" def create(cls, record, **kwargs): """Create a new commuinity identifier. For more information abou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommunitiesIdProvider: """Community identifier provider. This is the recommended community id provider. It uses the value of the 'id' present in our data to generate the identifier.""" def create(cls, record, **kwargs): """Create a new commuinity identifier. For more information about parameters,...
the_stack_v2_python_sparse
invenio_communities/communities/records/providers.py
lnielsen/invenio-communities
train
0
3415448113694a52f93b776484738952f2803d20
[ "if len(nums) == 1 or nums is None:\n return\nif k >= len(nums):\n k = k - len(nums)\nif k < len(nums) / 2:\n sub = nums[-k:]\n print(sub)\n for i in range(len(nums) - 1, k - 1, -1):\n nums[i] = nums[i - k]\n for i in range(k):\n nums[i] = sub[i]\nelse:\n k = len(nums) - k\n su...
<|body_start_0|> if len(nums) == 1 or nums is None: return if k >= len(nums): k = k - len(nums) if k < len(nums) / 2: sub = nums[-k:] print(sub) for i in range(len(nums) - 1, k - 1, -1): nums[i] = nums[i - k] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, nums, k) -> None: """Do not return anything, modify nums in-place instead. 方案:向右移动k等于把末尾k个元素放到开头""" <|body_0|> def rotate_(self, nums, k) -> None: """三步翻转法:但是不是原地算法需要返回值""" <|body_1|> <|end_skeleton|> <|body_start_0|> if l...
stack_v2_sparse_classes_36k_train_028477
2,096
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead. 方案:向右移动k等于把末尾k个元素放到开头", "name": "rotate", "signature": "def rotate(self, nums, k) -> None" }, { "docstring": "三步翻转法:但是不是原地算法需要返回值", "name": "rotate_", "signature": "def rotate_(self, nums, k) -> None" } ]
2
stack_v2_sparse_classes_30k_val_000614
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k) -> None: Do not return anything, modify nums in-place instead. 方案:向右移动k等于把末尾k个元素放到开头 - def rotate_(self, nums, k) -> None: 三步翻转法:但是不是原地算法需要返回值
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k) -> None: Do not return anything, modify nums in-place instead. 方案:向右移动k等于把末尾k个元素放到开头 - def rotate_(self, nums, k) -> None: 三步翻转法:但是不是原地算法需要返回值 <|skelet...
2e81b871bf1db7ea7432d1ebf889c72066e64753
<|skeleton|> class Solution: def rotate(self, nums, k) -> None: """Do not return anything, modify nums in-place instead. 方案:向右移动k等于把末尾k个元素放到开头""" <|body_0|> def rotate_(self, nums, k) -> None: """三步翻转法:但是不是原地算法需要返回值""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, nums, k) -> None: """Do not return anything, modify nums in-place instead. 方案:向右移动k等于把末尾k个元素放到开头""" if len(nums) == 1 or nums is None: return if k >= len(nums): k = k - len(nums) if k < len(nums) / 2: sub = nums[-k:...
the_stack_v2_python_sparse
array/rotateArray.py
NextNight/LeetCodeAndStructAndAlgorithm
train
0
5f3e797d27a35f3f3047f3069842179bf35eebc9
[ "self.model_name = model_name\nself.ckpt_path = ckpt_path\nself.params = hparams_config.get_detection_config(model_name).as_dict()\nif model_params:\n self.params.update(model_params)\nself.params.update(dict(is_training_bn=False))\nself.label_map = self.params.get('label_map', None)", "params = copy.deepcopy(...
<|body_start_0|> self.model_name = model_name self.ckpt_path = ckpt_path self.params = hparams_config.get_detection_config(model_name).as_dict() if model_params: self.params.update(model_params) self.params.update(dict(is_training_bn=False)) self.label_map = s...
A driver for doing batch inference. Example usage: driver = inference.InferenceDriver('efficientdet-d0', '/tmp/efficientdet-d0') driver.inference('/tmp/*.jpg', '/tmp/outputdir')
InferenceDriver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InferenceDriver: """A driver for doing batch inference. Example usage: driver = inference.InferenceDriver('efficientdet-d0', '/tmp/efficientdet-d0') driver.inference('/tmp/*.jpg', '/tmp/outputdir')""" def __init__(self, model_name: Text, ckpt_path: Text, model_params: Dict[Text, Any]=None): ...
stack_v2_sparse_classes_36k_train_028478
26,168
permissive
[ { "docstring": "Initialize the inference driver. Args: model_name: target model name, such as efficientdet-d0. ckpt_path: checkpoint path, such as /tmp/efficientdet-d0/. model_params: model parameters for overriding the config.", "name": "__init__", "signature": "def __init__(self, model_name: Text, ckp...
2
stack_v2_sparse_classes_30k_val_000636
Implement the Python class `InferenceDriver` described below. Class description: A driver for doing batch inference. Example usage: driver = inference.InferenceDriver('efficientdet-d0', '/tmp/efficientdet-d0') driver.inference('/tmp/*.jpg', '/tmp/outputdir') Method signatures and docstrings: - def __init__(self, mode...
Implement the Python class `InferenceDriver` described below. Class description: A driver for doing batch inference. Example usage: driver = inference.InferenceDriver('efficientdet-d0', '/tmp/efficientdet-d0') driver.inference('/tmp/*.jpg', '/tmp/outputdir') Method signatures and docstrings: - def __init__(self, mode...
c7392f2bab3165244d1c565b66409fa11fa82367
<|skeleton|> class InferenceDriver: """A driver for doing batch inference. Example usage: driver = inference.InferenceDriver('efficientdet-d0', '/tmp/efficientdet-d0') driver.inference('/tmp/*.jpg', '/tmp/outputdir')""" def __init__(self, model_name: Text, ckpt_path: Text, model_params: Dict[Text, Any]=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InferenceDriver: """A driver for doing batch inference. Example usage: driver = inference.InferenceDriver('efficientdet-d0', '/tmp/efficientdet-d0') driver.inference('/tmp/*.jpg', '/tmp/outputdir')""" def __init__(self, model_name: Text, ckpt_path: Text, model_params: Dict[Text, Any]=None): """In...
the_stack_v2_python_sparse
efficientdet/inference.py
google/automl
train
6,415
10f4e30ee07d0a9a9a3741e18f3ea963d89d1122
[ "wall_placed_locs = []\nif right:\n locations = [[starting_location[0] + i, starting_location[1]] for i in range(length)]\n for loc in locations:\n if game_state.can_spawn(unit_enum_map['WALL'], loc):\n succ = game_state.attempt_spawn(unit_enum_map['WALL'], loc)\n if succ == 1:\n ...
<|body_start_0|> wall_placed_locs = [] if right: locations = [[starting_location[0] + i, starting_location[1]] for i in range(length)] for loc in locations: if game_state.can_spawn(unit_enum_map['WALL'], loc): succ = game_state.attempt_spawn(un...
Contains builder/simulator for a line of horizontal walls
DefensiveWallStrat
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefensiveWallStrat: """Contains builder/simulator for a line of horizontal walls""" def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=True) -> [[int]]: """Used for placing a horizontal line of wa...
stack_v2_sparse_classes_36k_train_028479
6,790
no_license
[ { "docstring": "Used for placing a horizontal line of walls @param game_state: GameState object containing current gamestate info unit_enum_map (dict): Maps NAME to unit enum @param starting_location: (x, y) or [[x, y]] @param length: duh @param right: whether the wall goes right or left of the starting locatio...
2
stack_v2_sparse_classes_30k_train_009315
Implement the Python class `DefensiveWallStrat` described below. Class description: Contains builder/simulator for a line of horizontal walls Method signatures and docstrings: - def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=T...
Implement the Python class `DefensiveWallStrat` described below. Class description: Contains builder/simulator for a line of horizontal walls Method signatures and docstrings: - def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=T...
e9439191d44f644c55752abadda6882eeb75671f
<|skeleton|> class DefensiveWallStrat: """Contains builder/simulator for a line of horizontal walls""" def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=True) -> [[int]]: """Used for placing a horizontal line of wa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefensiveWallStrat: """Contains builder/simulator for a line of horizontal walls""" def build_h_wall_line(self, game_state: GameState, unit_enum_map: dict, starting_location: (int, int) or [[int]], length: int, right: bool=True) -> [[int]]: """Used for placing a horizontal line of walls @param ga...
the_stack_v2_python_sparse
algos/bruh_moment/defensive_building_functions.py
echudov/terminal
train
0
3fb888b4254b0087c5b8a3ef0656a9349a554e9b
[ "if data is None:\n data = {}\ndata['reference_id'] = reference_id\nurl = f'{self.session.root_url}/study/api/study/'\nreturn self.session.post(url, data).json()", "url = f'{self.session.root_url}/study/api/study/?assessment_id={assessment_id}'\nresponse_json = self.session.get(url).json()\nreturn pd.DataFrame...
<|body_start_0|> if data is None: data = {} data['reference_id'] = reference_id url = f'{self.session.root_url}/study/api/study/' return self.session.post(url, data).json() <|end_body_0|> <|body_start_1|> url = f'{self.session.root_url}/study/api/study/?assessment_id...
Client class for study requests.
StudyClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudyClient: """Client class for study requests.""" def create(self, reference_id: int, data: dict | None=None) -> dict: """Creates a study using a given reference ID. Args: reference_id (int): Reference ID to create study from. data (dict, optional): Dict containing any additional f...
stack_v2_sparse_classes_36k_train_028480
3,384
permissive
[ { "docstring": "Creates a study using a given reference ID. Args: reference_id (int): Reference ID to create study from. data (dict, optional): Dict containing any additional field/value pairings for the study. Possible pairings are: short_citation (str): Short study citation, can be used as identifier. full_ci...
3
stack_v2_sparse_classes_30k_train_000850
Implement the Python class `StudyClient` described below. Class description: Client class for study requests. Method signatures and docstrings: - def create(self, reference_id: int, data: dict | None=None) -> dict: Creates a study using a given reference ID. Args: reference_id (int): Reference ID to create study from...
Implement the Python class `StudyClient` described below. Class description: Client class for study requests. Method signatures and docstrings: - def create(self, reference_id: int, data: dict | None=None) -> dict: Creates a study using a given reference ID. Args: reference_id (int): Reference ID to create study from...
51177c6fb9354cd028f7099fc10d83b1051fd50d
<|skeleton|> class StudyClient: """Client class for study requests.""" def create(self, reference_id: int, data: dict | None=None) -> dict: """Creates a study using a given reference ID. Args: reference_id (int): Reference ID to create study from. data (dict, optional): Dict containing any additional f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudyClient: """Client class for study requests.""" def create(self, reference_id: int, data: dict | None=None) -> dict: """Creates a study using a given reference ID. Args: reference_id (int): Reference ID to create study from. data (dict, optional): Dict containing any additional field/value pa...
the_stack_v2_python_sparse
client/hawc_client/study.py
shapiromatron/hawc
train
25
fe16fb2b1ef95e286403584f8427bd9d371095b8
[ "super(NFM, self).__init__()\nself.embedding_size = embedding_size\nself.feature_size = feature_size\nself.field_size = field_size\nself.emb_layer = nn.Embedding(num_embeddings=feature_size, embedding_dim=embedding_size)\nnn.init.xavier_uniform_(self.emb_layer.weight)\nself.bi_intaraction_layer = BiInteractionLayer...
<|body_start_0|> super(NFM, self).__init__() self.embedding_size = embedding_size self.feature_size = feature_size self.field_size = field_size self.emb_layer = nn.Embedding(num_embeddings=feature_size, embedding_dim=embedding_size) nn.init.xavier_uniform_(self.emb_layer....
NFM Network
NFM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NFM: """NFM Network""" def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): """Init model :param feature_size: int, size of the feature dictionary :param field_size: int, size of the feature fields :par...
stack_v2_sparse_classes_36k_train_028481
3,142
permissive
[ { "docstring": "Init model :param feature_size: int, size of the feature dictionary :param field_size: int, size of the feature fields :param embedding_size: int, size of the feature embedding :param fc_dims: range, sizes of fc dims :param dropout: float, dropout rate :param is_batch_norm: bool, use batch norma...
2
stack_v2_sparse_classes_30k_train_010769
Implement the Python class `NFM` described below. Class description: NFM Network Method signatures and docstrings: - def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): Init model :param feature_size: int, size of the feature dictionar...
Implement the Python class `NFM` described below. Class description: NFM Network Method signatures and docstrings: - def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): Init model :param feature_size: int, size of the feature dictionar...
8437dea8baf0137ab3c07dd19c5f2bb8c15b4435
<|skeleton|> class NFM: """NFM Network""" def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): """Init model :param feature_size: int, size of the feature dictionary :param field_size: int, size of the feature fields :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NFM: """NFM Network""" def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): """Init model :param feature_size: int, size of the feature dictionary :param field_size: int, size of the feature fields :param embedding_...
the_stack_v2_python_sparse
rater/models/ctr/nfm.py
geziaka/rater
train
0
28f89265d622d85c05a5957d6facab3c688aba38
[ "self.inactive = inactive\nif method == 'random':\n self.sampler = RandomOverSampler()\nelif method == 'smote':\n self.sampler = SMOTE()\nelif method == 'adasyn':\n self.sampler = ADASYN()\nelse:\n raise TypeError(f\"The choice '{method}' for the argument 'method' is not available.\")", "if self.inact...
<|body_start_0|> self.inactive = inactive if method == 'random': self.sampler = RandomOverSampler() elif method == 'smote': self.sampler = SMOTE() elif method == 'adasyn': self.sampler = ADASYN() else: raise TypeError(f"The choice '...
Performs oversampling on imbalanced classes. Methods ------- __init__ fit_resample
OverSampler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OverSampler: """Performs oversampling on imbalanced classes. Methods ------- __init__ fit_resample""" def __init__(self, method='random', inactive=False): """Initilization of OverSampler instances. Parameters ---------- method: str, default "random" Select on oversampling method inac...
stack_v2_sparse_classes_36k_train_028482
1,472
no_license
[ { "docstring": "Initilization of OverSampler instances. Parameters ---------- method: str, default \"random\" Select on oversampling method inactive bool, default False Bypass oversampling", "name": "__init__", "signature": "def __init__(self, method='random', inactive=False)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_003090
Implement the Python class `OverSampler` described below. Class description: Performs oversampling on imbalanced classes. Methods ------- __init__ fit_resample Method signatures and docstrings: - def __init__(self, method='random', inactive=False): Initilization of OverSampler instances. Parameters ---------- method:...
Implement the Python class `OverSampler` described below. Class description: Performs oversampling on imbalanced classes. Methods ------- __init__ fit_resample Method signatures and docstrings: - def __init__(self, method='random', inactive=False): Initilization of OverSampler instances. Parameters ---------- method:...
227641cc02f5c3aef04f3c27cbfc316382041ae0
<|skeleton|> class OverSampler: """Performs oversampling on imbalanced classes. Methods ------- __init__ fit_resample""" def __init__(self, method='random', inactive=False): """Initilization of OverSampler instances. Parameters ---------- method: str, default "random" Select on oversampling method inac...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OverSampler: """Performs oversampling on imbalanced classes. Methods ------- __init__ fit_resample""" def __init__(self, method='random', inactive=False): """Initilization of OverSampler instances. Parameters ---------- method: str, default "random" Select on oversampling method inactive bool, de...
the_stack_v2_python_sparse
yotta_p1/old-version/forecast/domain/over_sampling.py
j-bd/various_exs
train
0
44ae87db978a052dd86ee549c48c28b84f95ed0c
[ "unique = {}\nfor item in items:\n arr = unique.get(item['name'], [])\n arr.append(item)\n unique[item['name']] = arr\nstrings = []\nfor name, arr in unique.items():\n if len(arr) == 1:\n strings.append(name)\n else:\n strings.append(f'{ItemFormatter.DEDUP_MARKER}{name}')\nreturn '\\n'....
<|body_start_0|> unique = {} for item in items: arr = unique.get(item['name'], []) arr.append(item) unique[item['name']] = arr strings = [] for name, arr in unique.items(): if len(arr) == 1: strings.append(name) ...
Formatter converting bw item lists to lists of strings for Rofi
ItemFormatter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemFormatter: """Formatter converting bw item lists to lists of strings for Rofi""" def unique_format(items): """Return a list of items names, and group duplicates items by name""" <|body_0|> def group_format(items, converter): """Return a list of numbered items...
stack_v2_sparse_classes_36k_train_028483
2,460
permissive
[ { "docstring": "Return a list of items names, and group duplicates items by name", "name": "unique_format", "signature": "def unique_format(items)" }, { "docstring": "Return a list of numbered items transformed by a converter", "name": "group_format", "signature": "def group_format(items...
2
stack_v2_sparse_classes_30k_val_000491
Implement the Python class `ItemFormatter` described below. Class description: Formatter converting bw item lists to lists of strings for Rofi Method signatures and docstrings: - def unique_format(items): Return a list of items names, and group duplicates items by name - def group_format(items, converter): Return a l...
Implement the Python class `ItemFormatter` described below. Class description: Formatter converting bw item lists to lists of strings for Rofi Method signatures and docstrings: - def unique_format(items): Return a list of items names, and group duplicates items by name - def group_format(items, converter): Return a l...
2312452b7c56b1c534c4f3874f162b9dc0df92c3
<|skeleton|> class ItemFormatter: """Formatter converting bw item lists to lists of strings for Rofi""" def unique_format(items): """Return a list of items names, and group duplicates items by name""" <|body_0|> def group_format(items, converter): """Return a list of numbered items...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemFormatter: """Formatter converting bw item lists to lists of strings for Rofi""" def unique_format(items): """Return a list of items names, and group duplicates items by name""" unique = {} for item in items: arr = unique.get(item['name'], []) arr.appen...
the_stack_v2_python_sparse
bitwarden_pyro/util/formatter.py
mihalea/bitwarden-pyro
train
8
271a9b156211331a53efbf7d15818f3d1f9835e2
[ "Reference.__init__(self, reference_tokens)\nself.n = n\nself._reference_length = len(self._reference_tokens)\nself._reference_ngrams = self._get_ngrams(self._reference_tokens, self.n)", "n_grams = []\nfor n in range(1, max_n + 1):\n n_grams.append(defaultdict(int))\n for n_gram in zip(*[tokens[i:] for i in...
<|body_start_0|> Reference.__init__(self, reference_tokens) self.n = n self._reference_length = len(self._reference_tokens) self._reference_ngrams = self._get_ngrams(self._reference_tokens, self.n) <|end_body_0|> <|body_start_1|> n_grams = [] for n in range(1, max_n + 1)...
Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).
SentenceBleuReference
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentenceBleuReference: """Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).""" def __init__(self, reference_tokens, n=4): """@param reference the reference translation that hypotheses shall be scored against. Must ...
stack_v2_sparse_classes_36k_train_028484
3,952
permissive
[ { "docstring": "@param reference the reference translation that hypotheses shall be scored against. Must be an iterable of tokens (any type). @param n maximum n-gram order to consider.", "name": "__init__", "signature": "def __init__(self, reference_tokens, n=4)" }, { "docstring": "Extracts all ...
3
null
Implement the Python class `SentenceBleuReference` described below. Class description: Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014). Method signatures and docstrings: - def __init__(self, reference_tokens, n=4): @param reference the reference t...
Implement the Python class `SentenceBleuReference` described below. Class description: Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014). Method signatures and docstrings: - def __init__(self, reference_tokens, n=4): @param reference the reference t...
49d050863bc9644b8c0a9d9ab6e54ccd30f927dd
<|skeleton|> class SentenceBleuReference: """Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).""" def __init__(self, reference_tokens, n=4): """@param reference the reference translation that hypotheses shall be scored against. Must ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentenceBleuReference: """Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).""" def __init__(self, reference_tokens, n=4): """@param reference the reference translation that hypotheses shall be scored against. Must be an iterabl...
the_stack_v2_python_sparse
nematus/metrics/sentence_bleu.py
EdinburghNLP/nematus
train
598
4c82c1c9d0216bb8450b7ef5ccc5505b0010b5a9
[ "super(self.__class__, self).__init__(**kwargs)\nself.columns = columns\nself.css_class = css_class", "if value is None:\n value = []\nhas_id = attrs and 'id' in attrs\nfinal_attrs = self.build_attrs(attrs, name=name)\nchoices_enum = list(enumerate(chain(self.choices, choices)))\ncolumn_sizes = columnize(len(c...
<|body_start_0|> super(self.__class__, self).__init__(**kwargs) self.columns = columns self.css_class = css_class <|end_body_0|> <|body_start_1|> if value is None: value = [] has_id = attrs and 'id' in attrs final_attrs = self.build_attrs(attrs, name=name) ...
Contrôle Multiselect affichant les choix en plusieurs colonnes Chaque colonne est contenue dans un <ul>. Le constructeur accepte columns et css_class
ColumnCheckboxSelectMultiple
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColumnCheckboxSelectMultiple: """Contrôle Multiselect affichant les choix en plusieurs colonnes Chaque colonne est contenue dans un <ul>. Le constructeur accepte columns et css_class""" def __init__(self, columns=2, css_class=None, **kwargs): """Initialiser le widget""" <|bod...
stack_v2_sparse_classes_36k_train_028485
8,234
no_license
[ { "docstring": "Initialiser le widget", "name": "__init__", "signature": "def __init__(self, columns=2, css_class=None, **kwargs)" }, { "docstring": "Rendre le widget", "name": "render", "signature": "def render(self, name, value, attrs=None, choices=())" } ]
2
null
Implement the Python class `ColumnCheckboxSelectMultiple` described below. Class description: Contrôle Multiselect affichant les choix en plusieurs colonnes Chaque colonne est contenue dans un <ul>. Le constructeur accepte columns et css_class Method signatures and docstrings: - def __init__(self, columns=2, css_clas...
Implement the Python class `ColumnCheckboxSelectMultiple` described below. Class description: Contrôle Multiselect affichant les choix en plusieurs colonnes Chaque colonne est contenue dans un <ul>. Le constructeur accepte columns et css_class Method signatures and docstrings: - def __init__(self, columns=2, css_clas...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class ColumnCheckboxSelectMultiple: """Contrôle Multiselect affichant les choix en plusieurs colonnes Chaque colonne est contenue dans un <ul>. Le constructeur accepte columns et css_class""" def __init__(self, columns=2, css_class=None, **kwargs): """Initialiser le widget""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ColumnCheckboxSelectMultiple: """Contrôle Multiselect affichant les choix en plusieurs colonnes Chaque colonne est contenue dans un <ul>. Le constructeur accepte columns et css_class""" def __init__(self, columns=2, css_class=None, **kwargs): """Initialiser le widget""" super(self.__class...
the_stack_v2_python_sparse
scoop/core/util/model/widgets.py
artscoop/scoop
train
0
dd0390c1f124d104adb0c5a2e1252f04d8726f55
[ "logging.info(self.fit.__name__)\nfor i in range(n_iter):\n logging.info('Epoch {}'.format(i + 1))\n grad = self.compute_gradient()\n self.gradient_step(grad, eta)\nreturn self.params", "logging.info(self.compute_gradient.__name__)\nlogging.debug('self.x shape: {}'.format(self.x.shape))\npred = self.pred...
<|body_start_0|> logging.info(self.fit.__name__) for i in range(n_iter): logging.info('Epoch {}'.format(i + 1)) grad = self.compute_gradient() self.gradient_step(grad, eta) return self.params <|end_body_0|> <|body_start_1|> logging.info(self.compute_g...
Run linear regression either with local data or by gradient steps, where gradients can be sent from a remote host.
LinearRegression
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearRegression: """Run linear regression either with local data or by gradient steps, where gradients can be sent from a remote host.""" def fit(self, n_iter, eta=0.01): """Fit the model""" <|body_0|> def compute_gradient(self): """Return the gradient computed ...
stack_v2_sparse_classes_36k_train_028486
2,007
no_license
[ { "docstring": "Fit the model", "name": "fit", "signature": "def fit(self, n_iter, eta=0.01)" }, { "docstring": "Return the gradient computed for the current model on all training data", "name": "compute_gradient", "signature": "def compute_gradient(self)" }, { "docstring": "Upda...
4
stack_v2_sparse_classes_30k_train_008066
Implement the Python class `LinearRegression` described below. Class description: Run linear regression either with local data or by gradient steps, where gradients can be sent from a remote host. Method signatures and docstrings: - def fit(self, n_iter, eta=0.01): Fit the model - def compute_gradient(self): Return t...
Implement the Python class `LinearRegression` described below. Class description: Run linear regression either with local data or by gradient steps, where gradients can be sent from a remote host. Method signatures and docstrings: - def fit(self, n_iter, eta=0.01): Fit the model - def compute_gradient(self): Return t...
b2a1733a914e3c43d4ab7393fea30515389bf8a4
<|skeleton|> class LinearRegression: """Run linear regression either with local data or by gradient steps, where gradients can be sent from a remote host.""" def fit(self, n_iter, eta=0.01): """Fit the model""" <|body_0|> def compute_gradient(self): """Return the gradient computed ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinearRegression: """Run linear regression either with local data or by gradient steps, where gradients can be sent from a remote host.""" def fit(self, n_iter, eta=0.01): """Fit the model""" logging.info(self.fit.__name__) for i in range(n_iter): logging.info('Epoch {...
the_stack_v2_python_sparse
linear_regression.py
markmo/federated_trainer
train
0
66617fa2583b9f290ef6cc0b8dfbc3de79e900a8
[ "print('setUp')\nself.item_code = 654\nself.market_price = 800", "print('test_get_latest_price')\nactual_price = market_prices.get_latest_price(654)\nexpected_price = 24\nself.assertEqual(actual_price, expected_price)", "print('test_mock_get_latest_price')\nmock = MagicMock(return_value=800)\nactual_price = moc...
<|body_start_0|> print('setUp') self.item_code = 654 self.market_price = 800 <|end_body_0|> <|body_start_1|> print('test_get_latest_price') actual_price = market_prices.get_latest_price(654) expected_price = 24 self.assertEqual(actual_price, expected_price) <|end...
Perform tests on market_prices module.
MarketPricesTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MarketPricesTests: """Perform tests on market_prices module.""" def setUp(self): """Define set up characteristics of Market Price tests.""" <|body_0|> def test_get_latest_price(self): """Test get_latest_price module using MagicMock.""" <|body_1|> def...
stack_v2_sparse_classes_36k_train_028487
10,660
no_license
[ { "docstring": "Define set up characteristics of Market Price tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test get_latest_price module using MagicMock.", "name": "test_get_latest_price", "signature": "def test_get_latest_price(self)" }, { "docstrin...
3
null
Implement the Python class `MarketPricesTests` described below. Class description: Perform tests on market_prices module. Method signatures and docstrings: - def setUp(self): Define set up characteristics of Market Price tests. - def test_get_latest_price(self): Test get_latest_price module using MagicMock. - def tes...
Implement the Python class `MarketPricesTests` described below. Class description: Perform tests on market_prices module. Method signatures and docstrings: - def setUp(self): Define set up characteristics of Market Price tests. - def test_get_latest_price(self): Test get_latest_price module using MagicMock. - def tes...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class MarketPricesTests: """Perform tests on market_prices module.""" def setUp(self): """Define set up characteristics of Market Price tests.""" <|body_0|> def test_get_latest_price(self): """Test get_latest_price module using MagicMock.""" <|body_1|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MarketPricesTests: """Perform tests on market_prices module.""" def setUp(self): """Define set up characteristics of Market Price tests.""" print('setUp') self.item_code = 654 self.market_price = 800 def test_get_latest_price(self): """Test get_latest_price mo...
the_stack_v2_python_sparse
students/Reem_Alqaysi/Lesson_01/test_unit.py
JavaRod/SP_Python220B_2019
train
1
599af88d2b0bed14370bf53769fdee1cd092246a
[ "nums1, nums2 = (sorted(nums1), sorted(nums2))\ni, j = (0, 0)\nres = []\nwhile i < len(nums1) and j < len(nums2):\n if nums1[i] < nums2[j]:\n i += 1\n elif nums1[i] > nums2[j]:\n j += 1\n else:\n res.append(nums1[i])\n i += 1\n j += 1\nreturn res", "if len(nums1) > len(...
<|body_start_0|> nums1, nums2 = (sorted(nums1), sorted(nums2)) i, j = (0, 0) res = [] while i < len(nums1) and j < len(nums2): if nums1[i] < nums2[j]: i += 1 elif nums1[i] > nums2[j]: j += 1 else: res.app...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect0(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_028488
1,227
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect", "signature": "def intersect(self, nums1, nums2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "intersect0", "signature": "def intersect0(...
2
stack_v2_sparse_classes_30k_train_013645
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect0(self, nums1, nums2): :type nums1: List[int] :type nums2: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] - def intersect0(self, nums1, nums2): :type nums1: List[int] :type nums2: List[...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_0|> def intersect0(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" nums1, nums2 = (sorted(nums1), sorted(nums2)) i, j = (0, 0) res = [] while i < len(nums1) and j < len(nums2): if nums1[i] < nums2[j]: ...
the_stack_v2_python_sparse
out/production/leetcode/350.两个数组的交集-ii.py
yangyuxiang1996/leetcode
train
0
09c15b34fc1ebb4dee9252980e9fb49bcfc335f4
[ "PygameScreen.__init__(self)\nself.menuView = MenuWithBackgroundWidget(menu, self.width * 0.4, self.height)\nself.lastScreen = lastScreen", "screenSurface = self.lastScreen.draw()\nself.drawOnSurface(screenSurface, left=0, top=0)\nmenuSurface = self.menuView.draw()\nself.drawOnSurface(menuSurface, right=1, top=0)...
<|body_start_0|> PygameScreen.__init__(self) self.menuView = MenuWithBackgroundWidget(menu, self.width * 0.4, self.height) self.lastScreen = lastScreen <|end_body_0|> <|body_start_1|> screenSurface = self.lastScreen.draw() self.drawOnSurface(screenSurface, left=0, top=0) ...
Represents the screen for the Zone Menu
ZoneMenuScreen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZoneMenuScreen: """Represents the screen for the Zone Menu""" def __init__(self, menu, lastScreen): """Initialize the screen""" <|body_0|> def drawSurface(self): """Draws the screen""" <|body_1|> <|end_skeleton|> <|body_start_0|> PygameScreen.__...
stack_v2_sparse_classes_36k_train_028489
768
no_license
[ { "docstring": "Initialize the screen", "name": "__init__", "signature": "def __init__(self, menu, lastScreen)" }, { "docstring": "Draws the screen", "name": "drawSurface", "signature": "def drawSurface(self)" } ]
2
stack_v2_sparse_classes_30k_train_005916
Implement the Python class `ZoneMenuScreen` described below. Class description: Represents the screen for the Zone Menu Method signatures and docstrings: - def __init__(self, menu, lastScreen): Initialize the screen - def drawSurface(self): Draws the screen
Implement the Python class `ZoneMenuScreen` described below. Class description: Represents the screen for the Zone Menu Method signatures and docstrings: - def __init__(self, menu, lastScreen): Initialize the screen - def drawSurface(self): Draws the screen <|skeleton|> class ZoneMenuScreen: """Represents the sc...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class ZoneMenuScreen: """Represents the screen for the Zone Menu""" def __init__(self, menu, lastScreen): """Initialize the screen""" <|body_0|> def drawSurface(self): """Draws the screen""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZoneMenuScreen: """Represents the screen for the Zone Menu""" def __init__(self, menu, lastScreen): """Initialize the screen""" PygameScreen.__init__(self) self.menuView = MenuWithBackgroundWidget(menu, self.width * 0.4, self.height) self.lastScreen = lastScreen def d...
the_stack_v2_python_sparse
src/Screen/Pygame/Menu/ZoneMenu/zone_menu_screen.py
sgtnourry/Pokemon-Project
train
0
74feaa5bc2b7f188fe1ccb62c12a7e9381a925b6
[ "self.max_read_throughput = max_read_throughput\nself.max_write_throughput = max_write_throughput\nself.read_throughput_samples = read_throughput_samples\nself.write_throughput_samples = write_throughput_samples", "if dictionary is None:\n return None\nmax_read_throughput = dictionary.get('maxReadThroughput')\...
<|body_start_0|> self.max_read_throughput = max_read_throughput self.max_write_throughput = max_write_throughput self.read_throughput_samples = read_throughput_samples self.write_throughput_samples = write_throughput_samples <|end_body_0|> <|body_start_1|> if dictionary is None:...
Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of Sample): Read throughput samples taken for...
ThroughputTile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThroughputTile: """Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of ...
stack_v2_sparse_classes_36k_train_028490
3,283
permissive
[ { "docstring": "Constructor for the ThroughputTile class", "name": "__init__", "signature": "def __init__(self, max_read_throughput=None, max_write_throughput=None, read_throughput_samples=None, write_throughput_samples=None)" }, { "docstring": "Creates an instance of this model from a dictionar...
2
stack_v2_sparse_classes_30k_train_018703
Implement the Python class `ThroughputTile` described below. Class description: Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 h...
Implement the Python class `ThroughputTile` described below. Class description: Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 h...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ThroughputTile: """Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThroughputTile: """Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of Sample): Read...
the_stack_v2_python_sparse
cohesity_management_sdk/models/throughput_tile.py
cohesity/management-sdk-python
train
24
f0406cb197e032a72ddf1641254ff9bf5c4c2e4a
[ "Arme.__init__(self, cle)\nself.peut_depecer = False\nself.emplacement = ''\nself.positions = ()", "evt_atteint = self.script.creer_evenement('atteint')\nevt_atteint.aide_courte = 'le projectile atteint une cible'\nevt_atteint.aide_longue = \"Cet évènement est appelé quand le projectile vient d'atteindre une cibl...
<|body_start_0|> Arme.__init__(self, cle) self.peut_depecer = False self.emplacement = '' self.positions = () <|end_body_0|> <|body_start_1|> evt_atteint = self.script.creer_evenement('atteint') evt_atteint.aide_courte = 'le projectile atteint une cible' evt_atte...
Type d'objet: projectile.
Projectile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Projectile: """Type d'objet: projectile.""" def __init__(self, cle=''): """Constructeur de l'objet""" <|body_0|> def etendre_script(self): """Extension du scripting.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Arme.__init__(self, cle) ...
stack_v2_sparse_classes_36k_train_028491
3,007
permissive
[ { "docstring": "Constructeur de l'objet", "name": "__init__", "signature": "def __init__(self, cle='')" }, { "docstring": "Extension du scripting.", "name": "etendre_script", "signature": "def etendre_script(self)" } ]
2
null
Implement the Python class `Projectile` described below. Class description: Type d'objet: projectile. Method signatures and docstrings: - def __init__(self, cle=''): Constructeur de l'objet - def etendre_script(self): Extension du scripting.
Implement the Python class `Projectile` described below. Class description: Type d'objet: projectile. Method signatures and docstrings: - def __init__(self, cle=''): Constructeur de l'objet - def etendre_script(self): Extension du scripting. <|skeleton|> class Projectile: """Type d'objet: projectile.""" def...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class Projectile: """Type d'objet: projectile.""" def __init__(self, cle=''): """Constructeur de l'objet""" <|body_0|> def etendre_script(self): """Extension du scripting.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Projectile: """Type d'objet: projectile.""" def __init__(self, cle=''): """Constructeur de l'objet""" Arme.__init__(self, cle) self.peut_depecer = False self.emplacement = '' self.positions = () def etendre_script(self): """Extension du scripting.""" ...
the_stack_v2_python_sparse
src/primaires/combat/types/projectile.py
vincent-lg/tsunami
train
5
0a5b89f0b86a8831e5291a270d789161ea7f8056
[ "keep = (input,)\nctx.num_classes = num_classes\nctx.dim = dim\ndata = input[:, :-num_classes]\nsegmentation = input[:, -num_classes:]\nclass_index = torch.argmax(segmentation, dim=1)\nbatch_indices = torch.unique(data[:, dim])\nkeep += (class_index, batch_indices)\noutput = []\nfor b in batch_indices:\n batch_i...
<|body_start_0|> keep = (input,) ctx.num_classes = num_classes ctx.dim = dim data = input[:, :-num_classes] segmentation = input[:, -num_classes:] class_index = torch.argmax(segmentation, dim=1) batch_indices = torch.unique(data[:, dim]) keep += (class_ind...
DBScanFunction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBScanFunction: def forward(ctx, input, epsilon, minPoints, num_classes, dim): """input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D""" <|body_0|> def backward(ctx, *g...
stack_v2_sparse_classes_36k_train_028492
12,354
no_license
[ { "docstring": "input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D", "name": "forward", "signature": "def forward(ctx, input, epsilon, minPoints, num_classes, dim)" }, { "docstring": "len(...
2
stack_v2_sparse_classes_30k_train_017236
Implement the Python class `DBScanFunction` described below. Class description: Implement the DBScanFunction class. Method signatures and docstrings: - def forward(ctx, input, epsilon, minPoints, num_classes, dim): input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan n...
Implement the Python class `DBScanFunction` described below. Class description: Implement the DBScanFunction class. Method signatures and docstrings: - def forward(ctx, input, epsilon, minPoints, num_classes, dim): input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan n...
9f022c9204741273ae451e8b3ed40385e676c6e8
<|skeleton|> class DBScanFunction: def forward(ctx, input, epsilon, minPoints, num_classes, dim): """input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D""" <|body_0|> def backward(ctx, *g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DBScanFunction: def forward(ctx, input, epsilon, minPoints, num_classes, dim): """input.shape = (N, dim + batch_index + feature + num_classes) epsilon, minPoints: parameters of DBScan num_classes: semantic segmentation classes dim: 2D or 3D""" keep = (input,) ctx.num_classes = num_clas...
the_stack_v2_python_sparse
mlreco/models/layers/dbscan.py
francois-drielsma/lartpc_mlreco3d
train
0
41b7649873ec0e4890a883ade215fe493c730512
[ "if self.driver.owner != self.name:\n self.driver.owner = self.name\nsweep_modes = {'SA': 'Spectrum Analyzer', 'SPEC': 'Basic Spectrum Analyzer', 'WAV': 'Waveform'}\nd = self.driver\nheader = cleandoc('Start freq {}, Stop freq {}, Span freq {},\\n Center freq {}, Average number {}, Resol...
<|body_start_0|> if self.driver.owner != self.name: self.driver.owner = self.name sweep_modes = {'SA': 'Spectrum Analyzer', 'SPEC': 'Basic Spectrum Analyzer', 'WAV': 'Waveform'} d = self.driver header = cleandoc('Start freq {}, Stop freq {}, Span freq {},\n ...
Get the trace displayed on the Power Spectrum Analyzer.
PSAGetTrace
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSAGetTrace: """Get the trace displayed on the Power Spectrum Analyzer.""" def perform(self): """Get the specified trace from the instrument.""" <|body_0|> def check(self, *args, **kwargs): """Validate the provided trace number.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_028493
11,298
permissive
[ { "docstring": "Get the specified trace from the instrument.", "name": "perform", "signature": "def perform(self)" }, { "docstring": "Validate the provided trace number.", "name": "check", "signature": "def check(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_000135
Implement the Python class `PSAGetTrace` described below. Class description: Get the trace displayed on the Power Spectrum Analyzer. Method signatures and docstrings: - def perform(self): Get the specified trace from the instrument. - def check(self, *args, **kwargs): Validate the provided trace number.
Implement the Python class `PSAGetTrace` described below. Class description: Get the trace displayed on the Power Spectrum Analyzer. Method signatures and docstrings: - def perform(self): Get the specified trace from the instrument. - def check(self, *args, **kwargs): Validate the provided trace number. <|skeleton|>...
b6f1f5b236c7a4e28d9a3bc8da9820c52d789309
<|skeleton|> class PSAGetTrace: """Get the trace displayed on the Power Spectrum Analyzer.""" def perform(self): """Get the specified trace from the instrument.""" <|body_0|> def check(self, *args, **kwargs): """Validate the provided trace number.""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PSAGetTrace: """Get the trace displayed on the Power Spectrum Analyzer.""" def perform(self): """Get the specified trace from the instrument.""" if self.driver.owner != self.name: self.driver.owner = self.name sweep_modes = {'SA': 'Spectrum Analyzer', 'SPEC': 'Basic Sp...
the_stack_v2_python_sparse
exopy_hqc_legacy/tasks/tasks/instr/psa_tasks.py
Exopy/exopy_hqc_legacy
train
0
830fdd57965002c33b9f60be7d82ded88b8b23f1
[ "response: ResponseData = auth_service.list_users(session.get('token'))\nWebUtils.flash_response_messages(response)\nif response.get_content() is not None and isinstance(response.get_content(), list):\n return list(response.get_content())\nreturn []", "response: ResponseData = auth_service.create_user(session....
<|body_start_0|> response: ResponseData = auth_service.list_users(session.get('token')) WebUtils.flash_response_messages(response) if response.get_content() is not None and isinstance(response.get_content(), list): return list(response.get_content()) return [] <|end_body_0|> ...
Monostate class responsible of the user operation utilities.
WebUser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebUser: """Monostate class responsible of the user operation utilities.""" def list_users(auth_service: AuthService) -> List: """Gets the list of users from the authentication service. Args: - auth_service (AuthService): The authentication service. Returns: - List: A list of user da...
stack_v2_sparse_classes_36k_train_028494
3,230
no_license
[ { "docstring": "Gets the list of users from the authentication service. Args: - auth_service (AuthService): The authentication service. Returns: - List: A list of user data dictionaries (the list may be empty)", "name": "list_users", "signature": "def list_users(auth_service: AuthService) -> List" }, ...
4
stack_v2_sparse_classes_30k_train_019121
Implement the Python class `WebUser` described below. Class description: Monostate class responsible of the user operation utilities. Method signatures and docstrings: - def list_users(auth_service: AuthService) -> List: Gets the list of users from the authentication service. Args: - auth_service (AuthService): The a...
Implement the Python class `WebUser` described below. Class description: Monostate class responsible of the user operation utilities. Method signatures and docstrings: - def list_users(auth_service: AuthService) -> List: Gets the list of users from the authentication service. Args: - auth_service (AuthService): The a...
d7d50f84e93914d388ccd084b3bee7e02c9e717b
<|skeleton|> class WebUser: """Monostate class responsible of the user operation utilities.""" def list_users(auth_service: AuthService) -> List: """Gets the list of users from the authentication service. Args: - auth_service (AuthService): The authentication service. Returns: - List: A list of user da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebUser: """Monostate class responsible of the user operation utilities.""" def list_users(auth_service: AuthService) -> List: """Gets the list of users from the authentication service. Args: - auth_service (AuthService): The authentication service. Returns: - List: A list of user data dictionari...
the_stack_v2_python_sparse
components/dms2122frontend/dms2122frontend/presentation/web/webuser.py
Kencho/practica-dms-2021-2022
train
0
fe6133b057ca146dfd8c8446bb3a4c85bb58d49e
[ "self.upper_num = 320\nself.x = np.random.randint(-1, self.upper_num, size=(6000, 200)).astype('int64')\nself.out = count(self.x, self.upper_num)\nself.place = paddle.CUDAPlace(0)", "paddle.enable_static()\nwith paddle.static.program_guard(paddle.static.Program()):\n x = paddle.static.data('x', self.x.shape, d...
<|body_start_0|> self.upper_num = 320 self.x = np.random.randint(-1, self.upper_num, size=(6000, 200)).astype('int64') self.out = count(self.x, self.upper_num) self.place = paddle.CUDAPlace(0) <|end_body_0|> <|body_start_1|> paddle.enable_static() with paddle.static.prog...
TestNumberCountAPI
TestNumberCountAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNumberCountAPI: """TestNumberCountAPI""" def setUp(self): """setUp""" <|body_0|> def test_MoE_number_count_static(self): """test_MoE_number_count_static""" <|body_1|> def test_MoE_number_count_dygraph(self): """test_MoE_number_count_dygra...
stack_v2_sparse_classes_36k_train_028495
2,365
no_license
[ { "docstring": "setUp", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "test_MoE_number_count_static", "name": "test_MoE_number_count_static", "signature": "def test_MoE_number_count_static(self)" }, { "docstring": "test_MoE_number_count_dygraph", "name": "...
3
stack_v2_sparse_classes_30k_train_006959
Implement the Python class `TestNumberCountAPI` described below. Class description: TestNumberCountAPI Method signatures and docstrings: - def setUp(self): setUp - def test_MoE_number_count_static(self): test_MoE_number_count_static - def test_MoE_number_count_dygraph(self): test_MoE_number_count_dygraph
Implement the Python class `TestNumberCountAPI` described below. Class description: TestNumberCountAPI Method signatures and docstrings: - def setUp(self): setUp - def test_MoE_number_count_static(self): test_MoE_number_count_static - def test_MoE_number_count_dygraph(self): test_MoE_number_count_dygraph <|skeleton|...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class TestNumberCountAPI: """TestNumberCountAPI""" def setUp(self): """setUp""" <|body_0|> def test_MoE_number_count_static(self): """test_MoE_number_count_static""" <|body_1|> def test_MoE_number_count_dygraph(self): """test_MoE_number_count_dygra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNumberCountAPI: """TestNumberCountAPI""" def setUp(self): """setUp""" self.upper_num = 320 self.x = np.random.randint(-1, self.upper_num, size=(6000, 200)).astype('int64') self.out = count(self.x, self.upper_num) self.place = paddle.CUDAPlace(0) def test_M...
the_stack_v2_python_sparse
distributed/CE_API/case/dist_MoE_number_count.py
PaddlePaddle/PaddleTest
train
42
cb45201393807138cd6afb8704970b72f6b2267a
[ "self.source: str = source\nself.content: str = content\nself.is_error: bool = is_error", "pad = len(self.source) if len(self.source) > source_len else source_len\ncolor_code = '\\x1b[31;1m' if self.is_error and colorize else ''\nreset_code = '\\x1b[0m' if self.is_error and colorize else ''\nreturn f'[ {self.sour...
<|body_start_0|> self.source: str = source self.content: str = content self.is_error: bool = is_error <|end_body_0|> <|body_start_1|> pad = len(self.source) if len(self.source) > source_len else source_len color_code = '\x1b[31;1m' if self.is_error and colorize else '' r...
Helper class for managing messages.
Message
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: """Helper class for managing messages.""" def __init__(self, source: str, content: str, is_error: bool=False) -> None: """Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: T...
stack_v2_sparse_classes_36k_train_028496
17,020
permissive
[ { "docstring": "Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: True if the message is an error message, False otherwise.", "name": "__init__", "signature": "def __init__(self, source: str, content: s...
2
stack_v2_sparse_classes_30k_train_019191
Implement the Python class `Message` described below. Class description: Helper class for managing messages. Method signatures and docstrings: - def __init__(self, source: str, content: str, is_error: bool=False) -> None: Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runti...
Implement the Python class `Message` described below. Class description: Helper class for managing messages. Method signatures and docstrings: - def __init__(self, source: str, content: str, is_error: bool=False) -> None: Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runti...
bcea85b1ce7a0feb2aa28b5be4fc6ae124e8ca3c
<|skeleton|> class Message: """Helper class for managing messages.""" def __init__(self, source: str, content: str, is_error: bool=False) -> None: """Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Message: """Helper class for managing messages.""" def __init__(self, source: str, content: str, is_error: bool=False) -> None: """Initialize a Message object. Args: source: The source of the message, eg 'dftimewolf' or a runtime name. content: The content of the message. is_error: True if the me...
the_stack_v2_python_sparse
dftimewolf/cli/curses_display_manager.py
log2timeline/dftimewolf
train
248
435b2f192cd22e0af748734c701b465bcc46ee9f
[ "agent = request.user.userinfo.agent\nobj = SetPay.objects.get_or_create(agent=agent)[0]\nmydata = model_to_dict(obj)\nuser = request.user\ncrm = Crm(user=user)\ndata = crm.get_agent_info()\nif data['status'] == 200:\n mydata['pay_online'] = int(mydata['pay_online'])\n mydata['pay_outline'] = int(mydata['pay_...
<|body_start_0|> agent = request.user.userinfo.agent obj = SetPay.objects.get_or_create(agent=agent)[0] mydata = model_to_dict(obj) user = request.user crm = Crm(user=user) data = crm.get_agent_info() if data['status'] == 200: mydata['pay_online'] = in...
支付信息
Finance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Finance: """支付信息""" def get(self, request): """获取财务设置信息 包括在线支付离线支付""" <|body_0|> def put(self, request): """修改财务信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> agent = request.user.userinfo.agent obj = SetPay.objects.get_or_create(age...
stack_v2_sparse_classes_36k_train_028497
32,690
no_license
[ { "docstring": "获取财务设置信息 包括在线支付离线支付", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改财务信息", "name": "put", "signature": "def put(self, request)" } ]
2
null
Implement the Python class `Finance` described below. Class description: 支付信息 Method signatures and docstrings: - def get(self, request): 获取财务设置信息 包括在线支付离线支付 - def put(self, request): 修改财务信息
Implement the Python class `Finance` described below. Class description: 支付信息 Method signatures and docstrings: - def get(self, request): 获取财务设置信息 包括在线支付离线支付 - def put(self, request): 修改财务信息 <|skeleton|> class Finance: """支付信息""" def get(self, request): """获取财务设置信息 包括在线支付离线支付""" <|body_0|> ...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class Finance: """支付信息""" def get(self, request): """获取财务设置信息 包括在线支付离线支付""" <|body_0|> def put(self, request): """修改财务信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Finance: """支付信息""" def get(self, request): """获取财务设置信息 包括在线支付离线支付""" agent = request.user.userinfo.agent obj = SetPay.objects.get_or_create(agent=agent)[0] mydata = model_to_dict(obj) user = request.user crm = Crm(user=user) data = crm.get_agent_in...
the_stack_v2_python_sparse
soc_system/views/set_views.py
sundw2015/841
train
4
9948a0726f7a8ac952d193426f00b0befa4c3166
[ "self.nx = config['nx']\ndx = config['dx']\nxbgn, xend = config['x_limits']\nxpos = position - xbgn\nixs = max(1, int(np.ceil(xpos / dx)))\nfrac = ixs - xpos / dx\nfrac = 0.0 if ixs == 1 else frac\nfrac = 1.0 if ixs == self.nx - 1 else frac\nself.ixs = ixs\nself.frac = frac", "f = torch.zeros([self.nx]).to(device...
<|body_start_0|> self.nx = config['nx'] dx = config['dx'] xbgn, xend = config['x_limits'] xpos = position - xbgn ixs = max(1, int(np.ceil(xpos / dx))) frac = ixs - xpos / dx frac = 0.0 if ixs == 1 else frac frac = 1.0 if ixs == self.nx - 1 else frac ...
Point_Source
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Point_Source: def __init__(self, position, config): """Configures interpolation of source in sampling grid""" <|body_0|> def set(self, value): """Sets amplitude at source point for current time""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nx...
stack_v2_sparse_classes_36k_train_028498
20,893
no_license
[ { "docstring": "Configures interpolation of source in sampling grid", "name": "__init__", "signature": "def __init__(self, position, config)" }, { "docstring": "Sets amplitude at source point for current time", "name": "set", "signature": "def set(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_018456
Implement the Python class `Point_Source` described below. Class description: Implement the Point_Source class. Method signatures and docstrings: - def __init__(self, position, config): Configures interpolation of source in sampling grid - def set(self, value): Sets amplitude at source point for current time
Implement the Python class `Point_Source` described below. Class description: Implement the Point_Source class. Method signatures and docstrings: - def __init__(self, position, config): Configures interpolation of source in sampling grid - def set(self, value): Sets amplitude at source point for current time <|skele...
b7477f7659126da69b9a1bab0377f12c595ffbfb
<|skeleton|> class Point_Source: def __init__(self, position, config): """Configures interpolation of source in sampling grid""" <|body_0|> def set(self, value): """Sets amplitude at source point for current time""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Point_Source: def __init__(self, position, config): """Configures interpolation of source in sampling grid""" self.nx = config['nx'] dx = config['dx'] xbgn, xend = config['x_limits'] xpos = position - xbgn ixs = max(1, int(np.ceil(xpos / dx))) frac = ixs...
the_stack_v2_python_sparse
fwi-dl/Wave1D_AGfunc.py
lhuang-pvamu/pytorch-examples
train
1
74c3d40ebce98239fdf97bb088898407e971718f
[ "connect = Operate_datebase_table('adv_spider_article_link')\nurl = connect.selectTable('(url,source_id,id)', 'fetched=0')\nif url != ():\n for url_one in url:\n data_connect = Operate_datebase_table('adv_spider_source')\n datas = data_connect.selectTable('(extract_tittle_rule,extract_content_rule)...
<|body_start_0|> connect = Operate_datebase_table('adv_spider_article_link') url = connect.selectTable('(url,source_id,id)', 'fetched=0') if url != (): for url_one in url: data_connect = Operate_datebase_table('adv_spider_source') datas = data_connect....
SpiderSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpiderSpider: def start_requests(self): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:""" <|body_0|> def parse(self, response): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :...
stack_v2_sparse_classes_36k_train_028499
3,065
no_license
[ { "docstring": "flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:", ...
2
stack_v2_sparse_classes_30k_train_008938
Implement the Python class `SpiderSpider` described below. Class description: Implement the SpiderSpider class. Method signatures and docstrings: - def start_requests(self): flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return: - def parse(self, response): flag 标志位:是否已经爬取 title...
Implement the Python class `SpiderSpider` described below. Class description: Implement the SpiderSpider class. Method signatures and docstrings: - def start_requests(self): flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return: - def parse(self, response): flag 标志位:是否已经爬取 title...
206fa55b1a0b471478beaad06a09f6718cbeb00f
<|skeleton|> class SpiderSpider: def start_requests(self): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:""" <|body_0|> def parse(self, response): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpiderSpider: def start_requests(self): """flag 标志位:是否已经爬取 title 标题:文章标题 content 内容:文章的内容 author 作者:文章的作者 creat_time 时间:文章发表的时间 :return:""" connect = Operate_datebase_table('adv_spider_article_link') url = connect.selectTable('(url,source_id,id)', 'fetched=0') if url != (): ...
the_stack_v2_python_sparse
spider_system/spider_list/spider_list/spiders/spider_page.py
logonmy/colely
train
0