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
eb1dae0ae5675024be34465338bfeeed1f504026
[ "super(CenterLoss, self).__init__()\nself.class_number = class_number\nself.feature_number = feature_number\n'将中心点定义为可以学习的参数'\nself.center_point = nn.Parameter(torch.randn(class_number, feature_number), requires_grad=True)\n'\\n [1,0],\\n [0.809016994374947424,0.587785252292],\\n [0...
<|body_start_0|> super(CenterLoss, self).__init__() self.class_number = class_number self.feature_number = feature_number '将中心点定义为可以学习的参数' self.center_point = nn.Parameter(torch.randn(class_number, feature_number), requires_grad=True) '\n [1,0],\n [0...
CenterLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CenterLoss: def __init__(self, feature_number, class_number): """初始化中心损失(center loss) :param feature_number:特征的数量 :param class_number:分类的数量""" <|body_0|> def forward(self, feature, target): """计算中心损失 :param feature: 特征向量。 :param target: 分类标签,未进行one_hot处理的。 :return: 损...
stack_v2_sparse_classes_36k_train_018800
1,967
no_license
[ { "docstring": "初始化中心损失(center loss) :param feature_number:特征的数量 :param class_number:分类的数量", "name": "__init__", "signature": "def __init__(self, feature_number, class_number)" }, { "docstring": "计算中心损失 :param feature: 特征向量。 :param target: 分类标签,未进行one_hot处理的。 :return: 损失", "name": "forward",...
2
stack_v2_sparse_classes_30k_train_002459
Implement the Python class `CenterLoss` described below. Class description: Implement the CenterLoss class. Method signatures and docstrings: - def __init__(self, feature_number, class_number): 初始化中心损失(center loss) :param feature_number:特征的数量 :param class_number:分类的数量 - def forward(self, feature, target): 计算中心损失 :par...
Implement the Python class `CenterLoss` described below. Class description: Implement the CenterLoss class. Method signatures and docstrings: - def __init__(self, feature_number, class_number): 初始化中心损失(center loss) :param feature_number:特征的数量 :param class_number:分类的数量 - def forward(self, feature, target): 计算中心损失 :par...
f13669f65a636d31a033681b7849bfebe0dc3e8c
<|skeleton|> class CenterLoss: def __init__(self, feature_number, class_number): """初始化中心损失(center loss) :param feature_number:特征的数量 :param class_number:分类的数量""" <|body_0|> def forward(self, feature, target): """计算中心损失 :param feature: 特征向量。 :param target: 分类标签,未进行one_hot处理的。 :return: 损...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CenterLoss: def __init__(self, feature_number, class_number): """初始化中心损失(center loss) :param feature_number:特征的数量 :param class_number:分类的数量""" super(CenterLoss, self).__init__() self.class_number = class_number self.feature_number = feature_number '将中心点定义为可以学习的参数' ...
the_stack_v2_python_sparse
Chapter03/C03CenterLoss.py
shituo123456/Learn-DeepLearning
train
0
1df7fac2136e02a60b597652e28fd3b08e48631a
[ "self._board = board\nEventHandler.__init__(self)\nself._window = win\nself._prevCard = None\nself._deck = self._board.getDeck()\nself._card = self._deck.getTop()\nself._card.addTo(win)\nself._button = Rectangle(100, 50, (800, 75))\nself._button.setFillColor('salmon')\nwin.add(self._button)\nself._button.addHandler...
<|body_start_0|> self._board = board EventHandler.__init__(self) self._window = win self._prevCard = None self._deck = self._board.getDeck() self._card = self._deck.getTop() self._card.addTo(win) self._button = Rectangle(100, 50, (800, 75)) self._b...
Creates a controller and adds an event handler to the button
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """Creates a controller and adds an event handler to the button""" def __init__(self, win, board): """Set up all objects on the window""" <|body_0|> def handleMouseRelease(self, event): """Creates an event handler that runs through a series of code wh...
stack_v2_sparse_classes_36k_train_018801
24,158
no_license
[ { "docstring": "Set up all objects on the window", "name": "__init__", "signature": "def __init__(self, win, board)" }, { "docstring": "Creates an event handler that runs through a series of code when the event occurs", "name": "handleMouseRelease", "signature": "def handleMouseRelease(s...
2
null
Implement the Python class `Controller` described below. Class description: Creates a controller and adds an event handler to the button Method signatures and docstrings: - def __init__(self, win, board): Set up all objects on the window - def handleMouseRelease(self, event): Creates an event handler that runs throug...
Implement the Python class `Controller` described below. Class description: Creates a controller and adds an event handler to the button Method signatures and docstrings: - def __init__(self, win, board): Set up all objects on the window - def handleMouseRelease(self, event): Creates an event handler that runs throug...
e5d96a65fc84481b85072cfb55dea9a0666634b5
<|skeleton|> class Controller: """Creates a controller and adds an event handler to the button""" def __init__(self, win, board): """Set up all objects on the window""" <|body_0|> def handleMouseRelease(self, event): """Creates an event handler that runs through a series of code wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """Creates a controller and adds an event handler to the button""" def __init__(self, win, board): """Set up all objects on the window""" self._board = board EventHandler.__init__(self) self._window = win self._prevCard = None self._deck = self....
the_stack_v2_python_sparse
Games-2017/40/Game.py
paulmagnus/CSPy
train
0
cae4470d231530af30d4884258712f55612b2a17
[ "self.temp = Temperature()\ntemp_label = Label(window, text='Temperature (in F):')\ntemp_label.grid(row=0, column=0, sticky=E)\nself._ftemp = IntVar()\ntemp_entry = Entry(window, textvariable=self._ftemp, width=5)\ntemp_entry.grid(row=0, column=1, sticky=W)\nconvert_button = Button(window, text='Convert to Celcius'...
<|body_start_0|> self.temp = Temperature() temp_label = Label(window, text='Temperature (in F):') temp_label.grid(row=0, column=0, sticky=E) self._ftemp = IntVar() temp_entry = Entry(window, textvariable=self._ftemp, width=5) temp_entry.grid(row=0, column=1, sticky=W) ...
This will create the GUI application class
Gui
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gui: """This will create the GUI application class""" def __init__(self, window): """This method will open up a window that converts a fahrenheit temperature to celcius""" <|body_0|> def convert_celcius(self): """This method is a command function for the conversi...
stack_v2_sparse_classes_36k_train_018802
2,217
no_license
[ { "docstring": "This method will open up a window that converts a fahrenheit temperature to celcius", "name": "__init__", "signature": "def __init__(self, window)" }, { "docstring": "This method is a command function for the conversion button to callback once the user presses the button", "n...
2
stack_v2_sparse_classes_30k_train_009424
Implement the Python class `Gui` described below. Class description: This will create the GUI application class Method signatures and docstrings: - def __init__(self, window): This method will open up a window that converts a fahrenheit temperature to celcius - def convert_celcius(self): This method is a command func...
Implement the Python class `Gui` described below. Class description: This will create the GUI application class Method signatures and docstrings: - def __init__(self, window): This method will open up a window that converts a fahrenheit temperature to celcius - def convert_celcius(self): This method is a command func...
3ba64a4beebc44eba44847655a77ce12f8152fee
<|skeleton|> class Gui: """This will create the GUI application class""" def __init__(self, window): """This method will open up a window that converts a fahrenheit temperature to celcius""" <|body_0|> def convert_celcius(self): """This method is a command function for the conversi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Gui: """This will create the GUI application class""" def __init__(self, window): """This method will open up a window that converts a fahrenheit temperature to celcius""" self.temp = Temperature() temp_label = Label(window, text='Temperature (in F):') temp_label.grid(row=...
the_stack_v2_python_sparse
homework11/gui.py
sinai228/cs108
train
0
563c01c3d02371200a5855583bc607df3f3df69b
[ "super(DeepFM, self).__init__()\nself.field_size = field_size\nself.embedding_size = embedding_size\nself.fm = FM(feature_size=feature_size, embedding_size=embedding_size, out_type='regression')\nself.fc_dims = fc_dims if fc_dims else [32, 32, 32]\nself.dnn = MLP(embedding_size * field_size, fc_dims=fc_dims, dropou...
<|body_start_0|> super(DeepFM, self).__init__() self.field_size = field_size self.embedding_size = embedding_size self.fm = FM(feature_size=feature_size, embedding_size=embedding_size, out_type='regression') self.fc_dims = fc_dims if fc_dims else [32, 32, 32] self.dnn = M...
DeepFM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepFM: def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 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_si...
stack_v2_sparse_classes_36k_train_018803
2,470
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, fc dims range :param dropout: float, dropout rate :param is_batch_norm: bool, use batch normaliz...
2
stack_v2_sparse_classes_30k_train_017080
Implement the Python class `DeepFM` described below. Class description: Implement the DeepFM class. Method signatures and docstrings: - def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): Init model :param feature_size: int, size o...
Implement the Python class `DeepFM` described below. Class description: Implement the DeepFM class. Method signatures and docstrings: - def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 32, 32], dropout=0.0, is_batch_norm=False, out_type='binary'): Init model :param feature_size: int, size o...
8437dea8baf0137ab3c07dd19c5f2bb8c15b4435
<|skeleton|> class DeepFM: def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 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_si...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeepFM: def __init__(self, feature_size, field_size, embedding_size=5, fc_dims=[32, 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_size: int, size ...
the_stack_v2_python_sparse
rater/models/ctr/deepfm.py
geziaka/rater
train
0
a7b80a8f81b7ecde370f3b96a072275c40133327
[ "filename = os.path.basename(model_path)\nprint('Loading imads model: %s' % filename)\nself.modeldict = self.load_model(model_path)\nself.core = core\nself.width = width\nself.kmers = kmers", "model = svmutil.svm_load_model(model_file)\nmodel_dict = {'model': model}\nif check_size:\n model_dict['size'] = len(m...
<|body_start_0|> filename = os.path.basename(model_path) print('Loading imads model: %s' % filename) self.modeldict = self.load_model(model_path) self.core = core self.width = width self.kmers = kmers <|end_body_0|> <|body_start_1|> model = svmutil.svm_load_model...
classdocs
iMADSModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iMADSModel: """classdocs""" def __init__(self, model_path, core, width, kmers): """Constructor""" <|body_0|> def load_model(self, model_file, check_size=True): """Taken from: https://github.com/Duke-GCB/Predict-TF-Binding Loads a svm model from a file and compute...
stack_v2_sparse_classes_36k_train_018804
2,925
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, model_path, core, width, kmers)" }, { "docstring": "Taken from: https://github.com/Duke-GCB/Predict-TF-Binding Loads a svm model from a file and computes its size :param model_file: The file name of the model to l...
3
null
Implement the Python class `iMADSModel` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, model_path, core, width, kmers): Constructor - def load_model(self, model_file, check_size=True): Taken from: https://github.com/Duke-GCB/Predict-TF-Binding Loads a svm model fr...
Implement the Python class `iMADSModel` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, model_path, core, width, kmers): Constructor - def load_model(self, model_file, check_size=True): Taken from: https://github.com/Duke-GCB/Predict-TF-Binding Loads a svm model fr...
6271b7ede0cacc8fea2b93798b46efb867971478
<|skeleton|> class iMADSModel: """classdocs""" def __init__(self, model_path, core, width, kmers): """Constructor""" <|body_0|> def load_model(self, model_file, check_size=True): """Taken from: https://github.com/Duke-GCB/Predict-TF-Binding Loads a svm model from a file and compute...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iMADSModel: """classdocs""" def __init__(self, model_path, core, width, kmers): """Constructor""" filename = os.path.basename(model_path) print('Loading imads model: %s' % filename) self.modeldict = self.load_model(model_path) self.core = core self.width = ...
the_stack_v2_python_sparse
chip2probe/probe_generator/src_v1/probefilter/sitesfinder/imadsmodel.py
vincentiusmartin/chip2probe
train
1
cafa95f5d7ce443c09a6109cd530b405caa1c870
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
RobotTtsServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RobotTtsServiceServicer: def Speak(self, request, context): """语音播报""" <|body_0|> def SendQa(self, request, context): """发送QA,包括问题和答案""" <|body_1|> <|end_skeleton|> <|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set...
stack_v2_sparse_classes_36k_train_018805
2,419
no_license
[ { "docstring": "语音播报", "name": "Speak", "signature": "def Speak(self, request, context)" }, { "docstring": "发送QA,包括问题和答案", "name": "SendQa", "signature": "def SendQa(self, request, context)" } ]
2
stack_v2_sparse_classes_30k_train_005153
Implement the Python class `RobotTtsServiceServicer` described below. Class description: Implement the RobotTtsServiceServicer class. Method signatures and docstrings: - def Speak(self, request, context): 语音播报 - def SendQa(self, request, context): 发送QA,包括问题和答案
Implement the Python class `RobotTtsServiceServicer` described below. Class description: Implement the RobotTtsServiceServicer class. Method signatures and docstrings: - def Speak(self, request, context): 语音播报 - def SendQa(self, request, context): 发送QA,包括问题和答案 <|skeleton|> class RobotTtsServiceServicer: def Spe...
be042a0ac5a44ca4148b4b3608a388519b268f6e
<|skeleton|> class RobotTtsServiceServicer: def Speak(self, request, context): """语音播报""" <|body_0|> def SendQa(self, request, context): """发送QA,包括问题和答案""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RobotTtsServiceServicer: def Speak(self, request, context): """语音播报""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def SendQa(self, request, context): """发送QA,包括...
the_stack_v2_python_sparse
protopb/robot_skill_api/robot_tts_api_pb2_grpc.py
zlfdtc1983/lfzhaotest
train
0
cd677f47704064da2555164268f595f8a97e2850
[ "input_json = request.data\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None]))\ntry:\n json_params = input_json['APIParams']\n json_params['profile_...
<|body_start_0|> input_json = request.data output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'SessionDetails', 'Payload'], [input_json['AvailabilityDetails'], input_json['AuthenticationDetails'], input_json['SessionDetails'], None])) try: json_params = input_jso...
This API will update notification status for a notification
UpdateNotificationStatusAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNotificationStatusAPI: """This API will update notification status for a notification""" def post(self, request): """Post function to update notification status for a notification""" <|body_0|> def update_notification_status_json(self, request): """This API...
stack_v2_sparse_classes_36k_train_018806
2,824
no_license
[ { "docstring": "Post function to update notification status for a notification", "name": "post", "signature": "def post(self, request)" }, { "docstring": "This API will update notification status for a notification :param request: { 'individual_notification_id':1, 'notification_status':3 } :retu...
2
null
Implement the Python class `UpdateNotificationStatusAPI` described below. Class description: This API will update notification status for a notification Method signatures and docstrings: - def post(self, request): Post function to update notification status for a notification - def update_notification_status_json(sel...
Implement the Python class `UpdateNotificationStatusAPI` described below. Class description: This API will update notification status for a notification Method signatures and docstrings: - def post(self, request): Post function to update notification status for a notification - def update_notification_status_json(sel...
36eb9931f330e64902354c6fc471be2adf4b7049
<|skeleton|> class UpdateNotificationStatusAPI: """This API will update notification status for a notification""" def post(self, request): """Post function to update notification status for a notification""" <|body_0|> def update_notification_status_json(self, request): """This API...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateNotificationStatusAPI: """This API will update notification status for a notification""" def post(self, request): """Post function to update notification status for a notification""" input_json = request.data output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDeta...
the_stack_v2_python_sparse
Generic/common/notifications_new/api/update_notification_status/views_update_notification_status.py
archiemb303/common_backend_django
train
0
1c07703a931c4fbfbc0faba73060113fb62c52fd
[ "curr, prev = (head, None)\nwhile curr is not None:\n curr.next, curr, prev = (prev, curr.next, curr)\nreturn prev", "if head is None or head.next is None:\n return head\nnew_head = self.reverseList(head.next)\nhead.next.next = head\nhead.next = None\nreturn new_head" ]
<|body_start_0|> curr, prev = (head, None) while curr is not None: curr.next, curr, prev = (prev, curr.next, curr) return prev <|end_body_0|> <|body_start_1|> if head is None or head.next is None: return head new_head = self.reverseList(head.next) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList2(self, head: ListNode) -> ListNode: """Iterative approach""" <|body_0|> def reverseList(self, head: ListNode) -> ListNode: """Recursive approach - problem""" <|body_1|> <|end_skeleton|> <|body_start_0|> curr, prev = (head, ...
stack_v2_sparse_classes_36k_train_018807
2,072
permissive
[ { "docstring": "Iterative approach", "name": "reverseList2", "signature": "def reverseList2(self, head: ListNode) -> ListNode" }, { "docstring": "Recursive approach - problem", "name": "reverseList", "signature": "def reverseList(self, head: ListNode) -> ListNode" } ]
2
stack_v2_sparse_classes_30k_test_000413
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList2(self, head: ListNode) -> ListNode: Iterative approach - def reverseList(self, head: ListNode) -> ListNode: Recursive approach - problem
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList2(self, head: ListNode) -> ListNode: Iterative approach - def reverseList(self, head: ListNode) -> ListNode: Recursive approach - problem <|skeleton|> class Solut...
8504db89a3f6a1596c0bb7343a4936884b44e6ea
<|skeleton|> class Solution: def reverseList2(self, head: ListNode) -> ListNode: """Iterative approach""" <|body_0|> def reverseList(self, head: ListNode) -> ListNode: """Recursive approach - problem""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList2(self, head: ListNode) -> ListNode: """Iterative approach""" curr, prev = (head, None) while curr is not None: curr.next, curr, prev = (prev, curr.next, curr) return prev def reverseList(self, head: ListNode) -> ListNode: """Re...
the_stack_v2_python_sparse
array_linked_list/L206.py
fimh/dsa-py
train
2
6ed00ebd1cbc3830c00bc91638f7626ffa4df326
[ "settings.addListsToRepository('skeinforge_tools.craft_plugins.export.html', '', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Export', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://www....
<|body_start_0|> settings.addListsToRepository('skeinforge_tools.craft_plugins.export.html', '', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Export', self, '') self.openWikiManualHelpPage = settings.HelpPage(...
A class to handle the export settings.
ExportRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExportRepository: """A class to handle the export settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Export button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_018808
13,406
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Export button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_015707
Implement the Python class `ExportRepository` described below. Class description: A class to handle the export settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Export button has been clicked.
Implement the Python class `ExportRepository` described below. Class description: A class to handle the export settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Export button has been clicked. <|skeleton|> class ExportR...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class ExportRepository: """A class to handle the export settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Export button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExportRepository: """A class to handle the export settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" settings.addListsToRepository('skeinforge_tools.craft_plugins.export.html', '', self) self.fileNameInput = settings.FileNameInput()...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/export.py
bmander/skeinforge
train
34
0c4c0da9c7bd22492357149030214fce661c7e25
[ "try:\n return Category.objects.get(pk=pk_category)\nexcept Category.DoesNotExist:\n raise Http404", "category = self.get_object(pk)\nresponse = self.serializer(category)\nreturn Response(response.data, status=status.HTTP_200_OK)", "category = self.get_object(pk)\nresponse = self.serializer(category, data...
<|body_start_0|> try: return Category.objects.get(pk=pk_category) except Category.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> category = self.get_object(pk) response = self.serializer(category) return Response(response.data, status=status....
...
VCategoryDetail
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VCategoryDetail: """...""" def get_object(self, pk_category: Union[int, str]): """...""" <|body_0|> def get(self, request, pk: Union[int, str], format=None): """...""" <|body_1|> def put(self, request, pk: Union[int, str], format=None): """.....
stack_v2_sparse_classes_36k_train_018809
2,534
permissive
[ { "docstring": "...", "name": "get_object", "signature": "def get_object(self, pk_category: Union[int, str])" }, { "docstring": "...", "name": "get", "signature": "def get(self, request, pk: Union[int, str], format=None)" }, { "docstring": "...", "name": "put", "signature...
4
stack_v2_sparse_classes_30k_train_021622
Implement the Python class `VCategoryDetail` described below. Class description: ... Method signatures and docstrings: - def get_object(self, pk_category: Union[int, str]): ... - def get(self, request, pk: Union[int, str], format=None): ... - def put(self, request, pk: Union[int, str], format=None): ... - def delete(...
Implement the Python class `VCategoryDetail` described below. Class description: ... Method signatures and docstrings: - def get_object(self, pk_category: Union[int, str]): ... - def get(self, request, pk: Union[int, str], format=None): ... - def put(self, request, pk: Union[int, str], format=None): ... - def delete(...
660664ba2321499e92c3c5c23719756db2569e90
<|skeleton|> class VCategoryDetail: """...""" def get_object(self, pk_category: Union[int, str]): """...""" <|body_0|> def get(self, request, pk: Union[int, str], format=None): """...""" <|body_1|> def put(self, request, pk: Union[int, str], format=None): """.....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VCategoryDetail: """...""" def get_object(self, pk_category: Union[int, str]): """...""" try: return Category.objects.get(pk=pk_category) except Category.DoesNotExist: raise Http404 def get(self, request, pk: Union[int, str], format=None): """....
the_stack_v2_python_sparse
apps/category/views/vcategory.py
magocod/djrepo
train
1
f17bc693587f8cf15c9c808117c8599155ca5f19
[ "self.dtype = torch.float16 if fp16 else torch.float32\nself.device = device\nself.use_keys = use_keys\nself.ignore_keys = ignore_keys", "valid_keys = _get_valid_keys(inputs.keys(), self.use_keys, self.ignore_keys)\nfor k in valid_keys:\n v = inputs[k]\n if isinstance(v, list) or isinstance(v, tuple):\n ...
<|body_start_0|> self.dtype = torch.float16 if fp16 else torch.float32 self.device = device self.use_keys = use_keys self.ignore_keys = ignore_keys <|end_body_0|> <|body_start_1|> valid_keys = _get_valid_keys(inputs.keys(), self.use_keys, self.ignore_keys) for k in valid...
Converts a 4D numpy.ndarray or a list of 3D numpy.ndarrays into a 4D torch.Tensor. If an input is of type uint8, then it is converted to float and its values are divided by 255.
ToTensor
[ "Apache-2.0", "CC-BY-NC-SA-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToTensor: """Converts a 4D numpy.ndarray or a list of 3D numpy.ndarrays into a 4D torch.Tensor. If an input is of type uint8, then it is converted to float and its values are divided by 255.""" def __init__(self, fp16: bool=False, device: Union[str, torch.device]='cpu', use_keys: Optional[Un...
stack_v2_sparse_classes_36k_train_018810
42,078
permissive
[ { "docstring": "Initialize ToTensor. Parameters ---------- fp16 : bool, default False If True, the tensors use have-precision floating point. device : Union[str, torch.device], default 'cpu' Name of the torch device where the tensors will be put in. use_keys : Optional[Union[KeysView, Sequence[str]]], optional ...
2
stack_v2_sparse_classes_30k_train_007363
Implement the Python class `ToTensor` described below. Class description: Converts a 4D numpy.ndarray or a list of 3D numpy.ndarrays into a 4D torch.Tensor. If an input is of type uint8, then it is converted to float and its values are divided by 255. Method signatures and docstrings: - def __init__(self, fp16: bool=...
Implement the Python class `ToTensor` described below. Class description: Converts a 4D numpy.ndarray or a list of 3D numpy.ndarrays into a 4D torch.Tensor. If an input is of type uint8, then it is converted to float and its values are divided by 255. Method signatures and docstrings: - def __init__(self, fp16: bool=...
d6582a0fd386517fdefbe2c347cef53150b5b1da
<|skeleton|> class ToTensor: """Converts a 4D numpy.ndarray or a list of 3D numpy.ndarrays into a 4D torch.Tensor. If an input is of type uint8, then it is converted to float and its values are divided by 255.""" def __init__(self, fp16: bool=False, device: Union[str, torch.device]='cpu', use_keys: Optional[Un...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToTensor: """Converts a 4D numpy.ndarray or a list of 3D numpy.ndarrays into a 4D torch.Tensor. If an input is of type uint8, then it is converted to float and its values are divided by 255.""" def __init__(self, fp16: bool=False, device: Union[str, torch.device]='cpu', use_keys: Optional[Union[KeysView,...
the_stack_v2_python_sparse
ptlflow/data/flow_transforms.py
hmorimitsu/ptlflow
train
140
a535b5415b2cb102dafd44a4135a7e282ea15348
[ "self.n_nodes: int = len(log_psis1)\nself.node_potentials: List[np.ndarray] = log_psis1\nself.edge_potentials: List[np.ndarray] = log_psis2\nself._forward_computed: bool = False\nself._backward_computed: bool = False\nself.forward_messages: List[np.ndarray] = [np.zeros(self.node_potentials[k + 1].shape) for k in ra...
<|body_start_0|> self.n_nodes: int = len(log_psis1) self.node_potentials: List[np.ndarray] = log_psis1 self.edge_potentials: List[np.ndarray] = log_psis2 self._forward_computed: bool = False self._backward_computed: bool = False self.forward_messages: List[np.ndarray] = [...
Class representing the graphical model of an undirected chain. Denoting by :math:`\\phi` the potentials, the joint probability of the nodes :math:`x_1, \\dots, x_n` is given by: .. math:: p(x) = \\frac1Z \\prod_{i=1}^n \\phi_i(x_i) \\prod_{i=1}^{n-1} \\phi_{i, i+1}(x_i, x_{i+1}) Everything is represented on the log-sca...
UndirectedChain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UndirectedChain: """Class representing the graphical model of an undirected chain. Denoting by :math:`\\phi` the potentials, the joint probability of the nodes :math:`x_1, \\dots, x_n` is given by: .. math:: p(x) = \\frac1Z \\prod_{i=1}^n \\phi_i(x_i) \\prod_{i=1}^{n-1} \\phi_{i, i+1}(x_i, x_{i+1...
stack_v2_sparse_classes_36k_train_018811
9,693
no_license
[ { "docstring": "Initialization of the undirected chain. Parameters ---------- log_psis1: list of arrays, len self.n_nodes The 1D-array indexed by i corresponds to the potential (function) of the node i. The arrays can have different sizes (that is why a list is used). log_psis2: list of arrays, len self.n_nodes...
4
stack_v2_sparse_classes_30k_train_014739
Implement the Python class `UndirectedChain` described below. Class description: Class representing the graphical model of an undirected chain. Denoting by :math:`\\phi` the potentials, the joint probability of the nodes :math:`x_1, \\dots, x_n` is given by: .. math:: p(x) = \\frac1Z \\prod_{i=1}^n \\phi_i(x_i) \\prod...
Implement the Python class `UndirectedChain` described below. Class description: Class representing the graphical model of an undirected chain. Denoting by :math:`\\phi` the potentials, the joint probability of the nodes :math:`x_1, \\dots, x_n` is given by: .. math:: p(x) = \\frac1Z \\prod_{i=1}^n \\phi_i(x_i) \\prod...
be41088f3036fb1eaef6b41ccc6be30b11d99a08
<|skeleton|> class UndirectedChain: """Class representing the graphical model of an undirected chain. Denoting by :math:`\\phi` the potentials, the joint probability of the nodes :math:`x_1, \\dots, x_n` is given by: .. math:: p(x) = \\frac1Z \\prod_{i=1}^n \\phi_i(x_i) \\prod_{i=1}^{n-1} \\phi_{i, i+1}(x_i, x_{i+1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UndirectedChain: """Class representing the graphical model of an undirected chain. Denoting by :math:`\\phi` the potentials, the joint probability of the nodes :math:`x_1, \\dots, x_n` is given by: .. math:: p(x) = \\frac1Z \\prod_{i=1}^n \\phi_i(x_i) \\prod_{i=1}^{n-1} \\phi_{i, i+1}(x_i, x_{i+1}) Everything...
the_stack_v2_python_sparse
probabilistic_graphical_models/HW2/src_ex2/undirected_chain.py
antoine-moulin/MVA
train
18
638672242061fa593c2f91ef81d24c19e27122e1
[ "if data['image_id'] < 0:\n raise ValidationError('Image id is incorrect.')\nreturn data['image_id']", "if data['organism_id'] < 0:\n raise ValidationError('Organism id is incorrect.')\nreturn data['organism_id']" ]
<|body_start_0|> if data['image_id'] < 0: raise ValidationError('Image id is incorrect.') return data['image_id'] <|end_body_0|> <|body_start_1|> if data['organism_id'] < 0: raise ValidationError('Organism id is incorrect.') return data['organism_id'] <|end_body_...
FormCleaningUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormCleaningUtil: def clean_image_id(data): """Cleans an image id ensuring that it is a positive integer.""" <|body_0|> def clean_organism_id(data): """Cleans an organism id ensuring that it is a positive integer.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_018812
6,553
no_license
[ { "docstring": "Cleans an image id ensuring that it is a positive integer.", "name": "clean_image_id", "signature": "def clean_image_id(data)" }, { "docstring": "Cleans an organism id ensuring that it is a positive integer.", "name": "clean_organism_id", "signature": "def clean_organism_...
2
stack_v2_sparse_classes_30k_train_019215
Implement the Python class `FormCleaningUtil` described below. Class description: Implement the FormCleaningUtil class. Method signatures and docstrings: - def clean_image_id(data): Cleans an image id ensuring that it is a positive integer. - def clean_organism_id(data): Cleans an organism id ensuring that it is a po...
Implement the Python class `FormCleaningUtil` described below. Class description: Implement the FormCleaningUtil class. Method signatures and docstrings: - def clean_image_id(data): Cleans an image id ensuring that it is a positive integer. - def clean_organism_id(data): Cleans an organism id ensuring that it is a po...
22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c
<|skeleton|> class FormCleaningUtil: def clean_image_id(data): """Cleans an image id ensuring that it is a positive integer.""" <|body_0|> def clean_organism_id(data): """Cleans an organism id ensuring that it is a positive integer.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormCleaningUtil: def clean_image_id(data): """Cleans an image id ensuring that it is a positive integer.""" if data['image_id'] < 0: raise ValidationError('Image id is incorrect.') return data['image_id'] def clean_organism_id(data): """Cleans an organism id e...
the_stack_v2_python_sparse
biodig/rest/v2/ImageOrganisms/forms.py
asmariyaz23/BioDIG
train
0
0719130cb571652b3662ee832271f8b78446c72a
[ "extents = self.get_dim_extents()\nendx = extents['x_max']\nstartx = extents['x_min']\nself.x_range = self._get_range('x', startx, endx)\nendy = extents['y_max']\nstarty = extents['y_min']\nself.y_range = self._get_range('y', starty, endy)\nif self.xlabel is None:\n if self.x.selection is not None:\n sele...
<|body_start_0|> extents = self.get_dim_extents() endx = extents['x_max'] startx = extents['x_min'] self.x_range = self._get_range('x', startx, endx) endy = extents['y_max'] starty = extents['y_min'] self.y_range = self._get_range('y', starty, endy) if sel...
Implements common functionality for XY Builders.
XYBuilder
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XYBuilder: """Implements common functionality for XY Builders.""" def set_ranges(self): """Calculate and set the x and y ranges.""" <|body_0|> def _get_range(self, dim, start, end): """Create a :class:`Range` for the :class:`Chart`. Args: dim (str): the name of t...
stack_v2_sparse_classes_36k_train_018813
24,703
permissive
[ { "docstring": "Calculate and set the x and y ranges.", "name": "set_ranges", "signature": "def set_ranges(self)" }, { "docstring": "Create a :class:`Range` for the :class:`Chart`. Args: dim (str): the name of the dimension, which is an attribute of the builder start: the starting value of the r...
2
null
Implement the Python class `XYBuilder` described below. Class description: Implements common functionality for XY Builders. Method signatures and docstrings: - def set_ranges(self): Calculate and set the x and y ranges. - def _get_range(self, dim, start, end): Create a :class:`Range` for the :class:`Chart`. Args: dim...
Implement the Python class `XYBuilder` described below. Class description: Implements common functionality for XY Builders. Method signatures and docstrings: - def set_ranges(self): Calculate and set the x and y ranges. - def _get_range(self, dim, start, end): Create a :class:`Range` for the :class:`Chart`. Args: dim...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class XYBuilder: """Implements common functionality for XY Builders.""" def set_ranges(self): """Calculate and set the x and y ranges.""" <|body_0|> def _get_range(self, dim, start, end): """Create a :class:`Range` for the :class:`Chart`. Args: dim (str): the name of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XYBuilder: """Implements common functionality for XY Builders.""" def set_ranges(self): """Calculate and set the x and y ranges.""" extents = self.get_dim_extents() endx = extents['x_max'] startx = extents['x_min'] self.x_range = self._get_range('x', startx, endx) ...
the_stack_v2_python_sparse
pkgs/bokeh-0.11.1-py27_0/lib/python2.7/site-packages/bokeh/charts/builder.py
wangyum/Anaconda
train
11
e3f75c7a3d881532bc8782e711f8a63f66ee200f
[ "size = len(nums)\nif not size:\n self.cum = []\n return\nself.cum = [0 for i in xrange(size)]\nself.cum[0] = nums[0]\nfor i in xrange(1, size):\n self.cum[i] = self.cum[i - 1] + nums[i]\nreturn", "if i < 0 or i >= len(self.cum) or j < 0 or (j >= len(self.cum)) or (i > j):\n return\nif i == 0:\n re...
<|body_start_0|> size = len(nums) if not size: self.cum = [] return self.cum = [0 for i in xrange(size)] self.cum[0] = nums[0] for i in xrange(1, size): self.cum[i] = self.cum[i - 1] + nums[i] return <|end_body_0|> <|body_start_1|> ...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> size = len(nums) if not size: self.cum ...
stack_v2_sparse_classes_36k_train_018814
891
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
6582b0f138a19f9d4a005eda298ecb1488eb0d2e
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" size = len(nums) if not size: self.cum = [] return self.cum = [0 for i in xrange(size)] self.cum[0] = nums[0] for i in xrange(1, size): self.cum[i] = self.cum[i -...
the_stack_v2_python_sparse
Array/303.py
ShangruZhong/leetcode
train
0
58a562ca3a21a8f19249454712500186291077b3
[ "try:\n if len(repeats) != len(sizes):\n raise ValueError('`repeats` must be parallel to `sizes`.')\n if not sizes:\n raise ValueError('`sizes` and `repeats` must not be empty.')\n if any([repeat <= 0 for repeat in repeats]):\n raise ValueError('All repeat values must be strictly posit...
<|body_start_0|> try: if len(repeats) != len(sizes): raise ValueError('`repeats` must be parallel to `sizes`.') if not sizes: raise ValueError('`sizes` and `repeats` must not be empty.') if any([repeat <= 0 for repeat in repeats]): ...
An increasing list of steps where the regularisation network is updated. Example EntropySchedule([3, 5, 10], [2, 4, 1]) => [0, 3, 6, 11, 16, 21, 26, 10] | 3 x2 | 5 x4 | 10 x1
EntropySchedule
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntropySchedule: """An increasing list of steps where the regularisation network is updated. Example EntropySchedule([3, 5, 10], [2, 4, 1]) => [0, 3, 6, 11, 16, 21, 26, 10] | 3 x2 | 5 x4 | 10 x1""" def __init__(self, *, sizes: Sequence[int], repeats: Sequence[int]): """Constructs a s...
stack_v2_sparse_classes_36k_train_018815
40,121
permissive
[ { "docstring": "Constructs a schedule of entropy iterations. Args: sizes: the list of iteration sizes. repeats: the list, parallel to sizes, with the number of times for each size from `sizes` to repeat.", "name": "__init__", "signature": "def __init__(self, *, sizes: Sequence[int], repeats: Sequence[in...
2
null
Implement the Python class `EntropySchedule` described below. Class description: An increasing list of steps where the regularisation network is updated. Example EntropySchedule([3, 5, 10], [2, 4, 1]) => [0, 3, 6, 11, 16, 21, 26, 10] | 3 x2 | 5 x4 | 10 x1 Method signatures and docstrings: - def __init__(self, *, size...
Implement the Python class `EntropySchedule` described below. Class description: An increasing list of steps where the regularisation network is updated. Example EntropySchedule([3, 5, 10], [2, 4, 1]) => [0, 3, 6, 11, 16, 21, 26, 10] | 3 x2 | 5 x4 | 10 x1 Method signatures and docstrings: - def __init__(self, *, size...
ee149736f7d85e16c119a463eee338c6d4c2ceb0
<|skeleton|> class EntropySchedule: """An increasing list of steps where the regularisation network is updated. Example EntropySchedule([3, 5, 10], [2, 4, 1]) => [0, 3, 6, 11, 16, 21, 26, 10] | 3 x2 | 5 x4 | 10 x1""" def __init__(self, *, sizes: Sequence[int], repeats: Sequence[int]): """Constructs a s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntropySchedule: """An increasing list of steps where the regularisation network is updated. Example EntropySchedule([3, 5, 10], [2, 4, 1]) => [0, 3, 6, 11, 16, 21, 26, 10] | 3 x2 | 5 x4 | 10 x1""" def __init__(self, *, sizes: Sequence[int], repeats: Sequence[int]): """Constructs a schedule of en...
the_stack_v2_python_sparse
open_spiel/python/algorithms/rnad/rnad.py
lanctot/open_spiel
train
1
1bf0320d40cd541a5258e1e34a6ac5af17dd792c
[ "if isinstance(node, list):\n for item in node:\n self.visit(item)\nelif isinstance(node, AST):\n method = 'visit_' + node.__class__.__name__\n visitor = getattr(self, method, self.generic_visit)\n visitor(node)", "for field in getattr(node, '_fields'):\n value = getattr(node, field, None)\n...
<|body_start_0|> if isinstance(node, list): for item in node: self.visit(item) elif isinstance(node, AST): method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) visitor(node) <|end_body_0|> <|body_...
Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for all nodes where there is no matching vi...
NodeVisitor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeVisitor: """Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for ...
stack_v2_sparse_classes_36k_train_018816
7,611
no_license
[ { "docstring": "Execute a method of the form visit_NodeName(node) where NodeName is the name of the class of a particular node.", "name": "visit", "signature": "def visit(self, node)" }, { "docstring": "Method executed if no applicable visit_ method can be found. This examines the node to see if...
3
null
Implement the Python class `NodeVisitor` described below. Class description: Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. Th...
Implement the Python class `NodeVisitor` described below. Class description: Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. Th...
cab2b2563b81036cf39a530fb3d7d5e756478beb
<|skeleton|> class NodeVisitor: """Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeVisitor: """Class for visiting nodes of the parse tree. This is modeled after a similar class in the standard library ast.NodeVisitor. For each node, the visit(node) method calls a method visit_NodeName(node) which should be implemented in subclasses. The generic_visit() method is called for all nodes whe...
the_stack_v2_python_sparse
compilers/goner/full/ast.py
CamDavidsonPilon/compilers
train
5
8c23ee5f2aa17d58a409f5b7a4827162405bcb6f
[ "super(ResidualBlock, self).__init__(name=name, **kwargs)\nif normalization_layer is None:\n normalization_layer = tf.keras.layers.LayerNormalization(axis=-1, epsilon=1e-12, name='layer_norm')\nif isinstance(normalization_layer, Sequence):\n normalization_layers = normalization_layer\nelse:\n normalization...
<|body_start_0|> super(ResidualBlock, self).__init__(name=name, **kwargs) if normalization_layer is None: normalization_layer = tf.keras.layers.LayerNormalization(axis=-1, epsilon=1e-12, name='layer_norm') if isinstance(normalization_layer, Sequence): normalization_layers...
Residual network block. This is a flexible residual block wrapper around a user-provided `inner_layer`, which is just a fully-connected 2-layer network by default. Normalization and dropout are applied in the following order by default (as used by the original Transformer layers in https://arxiv.org/abs/1706.03762): ou...
ResidualBlock
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualBlock: """Residual network block. This is a flexible residual block wrapper around a user-provided `inner_layer`, which is just a fully-connected 2-layer network by default. Normalization and dropout are applied in the following order by default (as used by the original Transformer layers...
stack_v2_sparse_classes_36k_train_018817
7,661
permissive
[ { "docstring": "Init. Args: inner_layer: Keras layer to apply as the inner layer in the residual block. The output of the layer must have the same shape as the input. By default, a 2-layer fully-connected network (via `DenseLayers`) is created based on the `inner_...` arguments below. normalization_layer: Norma...
3
null
Implement the Python class `ResidualBlock` described below. Class description: Residual network block. This is a flexible residual block wrapper around a user-provided `inner_layer`, which is just a fully-connected 2-layer network by default. Normalization and dropout are applied in the following order by default (as ...
Implement the Python class `ResidualBlock` described below. Class description: Residual network block. This is a flexible residual block wrapper around a user-provided `inner_layer`, which is just a fully-connected 2-layer network by default. Normalization and dropout are applied in the following order by default (as ...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ResidualBlock: """Residual network block. This is a flexible residual block wrapper around a user-provided `inner_layer`, which is just a fully-connected 2-layer network by default. Normalization and dropout are applied in the following order by default (as used by the original Transformer layers...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualBlock: """Residual network block. This is a flexible residual block wrapper around a user-provided `inner_layer`, which is just a fully-connected 2-layer network by default. Normalization and dropout are applied in the following order by default (as used by the original Transformer layers in https://a...
the_stack_v2_python_sparse
etcmodel/layers/wrappers.py
Jimmy-INL/google-research
train
1
c3bbba0867dbe181f55212ee9f2964073c43fcf2
[ "slowPointer = head\nfastPointer = head\nwhile slowPointer != None and fastPointer != None:\n slowPointer = slowPointer.next\n if fastPointer.next != None and fastPointer.next.next != None:\n fastPointer = fastPointer.next.next\n else:\n return False\n if slowPointer == fastPointer:\n ...
<|body_start_0|> slowPointer = head fastPointer = head while slowPointer != None and fastPointer != None: slowPointer = slowPointer.next if fastPointer.next != None and fastPointer.next.next != None: fastPointer = fastPointer.next.next else: ...
Two pointer AC
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Two pointer AC""" def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycleV1(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> slowPointer = head ...
stack_v2_sparse_classes_36k_train_018818
2,561
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycleV1", "signature": "def hasCycleV1(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_001406
Implement the Python class `Solution` described below. Class description: Two pointer AC Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycleV1(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Two pointer AC Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycleV1(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: """Two pointer AC""" def hasCy...
2e146808b2d3259965d9aa671f2956b130d43a7e
<|skeleton|> class Solution: """Two pointer AC""" def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycleV1(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Two pointer AC""" def hasCycle(self, head): """:type head: ListNode :rtype: bool""" slowPointer = head fastPointer = head while slowPointer != None and fastPointer != None: slowPointer = slowPointer.next if fastPointer.next != None and ...
the_stack_v2_python_sparse
easy/141_linkedListCycle.py
grapefruit623/leetcode
train
0
1e9cd7834cc161411638219dec8a3bbb8fab9953
[ "pos_markers = []\npix_markers = []\nfor box in boxes:\n (pt1_w, pt1_h), (pt2_w, pt2_h) = box\n pix_marker = ((pt1_w + pt2_w) // 2, max(pt1_h, pt2_h))\n pix_markers.append(pix_marker)\n pos_marker = np.array(pix_marker).reshape(1, 1, 2).astype('float32')\n pos_marker = cv2.perspectiveTransform(pos_ma...
<|body_start_0|> pos_markers = [] pix_markers = [] for box in boxes: (pt1_w, pt1_h), (pt2_w, pt2_h) = box pix_marker = ((pt1_w + pt2_w) // 2, max(pt1_h, pt2_h)) pix_markers.append(pix_marker) pos_marker = np.array(pix_marker).reshape(1, 1, 2).astyp...
A mixin to calculate distances between detected boxes/pedastrians
SocialDistancingMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SocialDistancingMixin: """A mixin to calculate distances between detected boxes/pedastrians""" def _calculate_distances(boxes, homography): """Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tup...
stack_v2_sparse_classes_36k_train_018819
9,664
permissive
[ { "docstring": "Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tuple of 2D points. homography (np.array): A 3x3 numpy array. Returns: pix_markers (list): A list of marker coordinates defined as tuples, distances (np.array...
5
stack_v2_sparse_classes_30k_train_014151
Implement the Python class `SocialDistancingMixin` described below. Class description: A mixin to calculate distances between detected boxes/pedastrians Method signatures and docstrings: - def _calculate_distances(boxes, homography): Calculate a reference marker for each box and calculate bird eye distances between b...
Implement the Python class `SocialDistancingMixin` described below. Class description: A mixin to calculate distances between detected boxes/pedastrians Method signatures and docstrings: - def _calculate_distances(boxes, homography): Calculate a reference marker for each box and calculate bird eye distances between b...
2e29ab2d3deb81fd999b74a2f6844c54a836c6d8
<|skeleton|> class SocialDistancingMixin: """A mixin to calculate distances between detected boxes/pedastrians""" def _calculate_distances(boxes, homography): """Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tup...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SocialDistancingMixin: """A mixin to calculate distances between detected boxes/pedastrians""" def _calculate_distances(boxes, homography): """Calculate a reference marker for each box and calculate bird eye distances between boxes Args: boxes (list): A list of boxes defined as a tuple of 2D poin...
the_stack_v2_python_sparse
service/mixins.py
ai404/esafe-platform
train
0
2e808586873dc7f567fb12d1b9e04ccf1368ea80
[ "elements = self.driver.find_elements(*AdminPageLocators.CATALOG)\nfor element in elements:\n if element.text == 'Catalog':\n catalog = element\n break\ncatalog.click()", "catalog_elements = self.driver.find_elements(*AdminPageLocators.CATALOG_ELEMENTS)\nfor catalog_element in catalog_elements:\n...
<|body_start_0|> elements = self.driver.find_elements(*AdminPageLocators.CATALOG) for element in elements: if element.text == 'Catalog': catalog = element break catalog.click() <|end_body_0|> <|body_start_1|> catalog_elements = self.driver.fin...
Admin page class
AdminPage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdminPage: """Admin page class""" def choose_catalog(self): """public method to choose catalog in menu""" <|body_0|> def choose_catalog_element(self, element_name): """public method to choose catalog element""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_36k_train_018820
5,320
permissive
[ { "docstring": "public method to choose catalog in menu", "name": "choose_catalog", "signature": "def choose_catalog(self)" }, { "docstring": "public method to choose catalog element", "name": "choose_catalog_element", "signature": "def choose_catalog_element(self, element_name)" } ]
2
stack_v2_sparse_classes_30k_train_001955
Implement the Python class `AdminPage` described below. Class description: Admin page class Method signatures and docstrings: - def choose_catalog(self): public method to choose catalog in menu - def choose_catalog_element(self, element_name): public method to choose catalog element
Implement the Python class `AdminPage` described below. Class description: Admin page class Method signatures and docstrings: - def choose_catalog(self): public method to choose catalog in menu - def choose_catalog_element(self, element_name): public method to choose catalog element <|skeleton|> class AdminPage: ...
9d7e31317857801735bad8c05e2c15757dab0ab1
<|skeleton|> class AdminPage: """Admin page class""" def choose_catalog(self): """public method to choose catalog in menu""" <|body_0|> def choose_catalog_element(self, element_name): """public method to choose catalog element""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdminPage: """Admin page class""" def choose_catalog(self): """public method to choose catalog in menu""" elements = self.driver.find_elements(*AdminPageLocators.CATALOG) for element in elements: if element.text == 'Catalog': catalog = element ...
the_stack_v2_python_sparse
lesson_8/pages.py
Sokolov85/otus-qa-course
train
0
1e0c11b8eb1a88a38c075905e824f20a2398871f
[ "FigureCanvasAgg.draw(self)\nself.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)\nself._isDrawn = True\nself.gui_repaint(drawDC=drawDC, origin='WXAgg')", "if bbox is None:\n self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)\n self.gui_repaint()\n return\nl, b, w, h = bbox....
<|body_start_0|> FigureCanvasAgg.draw(self) self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None) self._isDrawn = True self.gui_repaint(drawDC=drawDC, origin='WXAgg') <|end_body_0|> <|body_start_1|> if bbox is None: self.bitmap = _convert_agg_to_wx_bitma...
The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to control the displayed control size - but we give a hint as to our preferred minimum ...
FigureCanvasWxAgg
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FigureCanvasWxAgg: """The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to control the displayed control size - bu...
stack_v2_sparse_classes_36k_train_018821
4,326
permissive
[ { "docstring": "Render the figure using agg.", "name": "draw", "signature": "def draw(self, drawDC=None)" }, { "docstring": "Transfer the region of the agg buffer defined by bbox to the display. If bbox is None, the entire buffer is transferred.", "name": "blit", "signature": "def blit(s...
2
null
Implement the Python class `FigureCanvasWxAgg` described below. Class description: The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to ...
Implement the Python class `FigureCanvasWxAgg` described below. Class description: The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to ...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class FigureCanvasWxAgg: """The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to control the displayed control size - bu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FigureCanvasWxAgg: """The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to control the displayed control size - but we give a h...
the_stack_v2_python_sparse
contrib/python/matplotlib/py2/matplotlib/backends/backend_wxagg.py
catboost/catboost
train
8,012
a6fe4fceaeacd915c9e40ab1af13fc6f0518e332
[ "super(LineCtrl, self).__init__(parent, id_, u'', size=size, style=wx.TE_PROCESS_ENTER, validator=util.IntValidator(0, 65535))\nself._last = 0\nself.GetDoc = get_doc", "val = self.GetValue()\nif not val.isdigit():\n return\nval = int(val) - 1\ndoc = self.GetDoc()\nlines = doc.GetLineCount()\nif val > lines:\n ...
<|body_start_0|> super(LineCtrl, self).__init__(parent, id_, u'', size=size, style=wx.TE_PROCESS_ENTER, validator=util.IntValidator(0, 65535)) self._last = 0 self.GetDoc = get_doc <|end_body_0|> <|body_start_1|> val = self.GetValue() if not val.isdigit(): return ...
A custom int control for providing a go To line control for the Command Bar.
LineCtrl
[ "BSD-3-Clause", "LicenseRef-scancode-python-cwi", "GPL-1.0-or-later", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-free-unknown", "Python-2.0", "LGPL-2.0-or-later", "WxWindows-exception-3.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineCtrl: """A custom int control for providing a go To line control for the Command Bar.""" def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): """Initializes the LineCtrl control and its attributes. @param parent: Parent Window @param id_: Control ID @param get_doc: call...
stack_v2_sparse_classes_36k_train_018822
44,291
permissive
[ { "docstring": "Initializes the LineCtrl control and its attributes. @param parent: Parent Window @param id_: Control ID @param get_doc: callback method for retrieving a reference to the current document. @keyword size: Control Size (tuple)", "name": "__init__", "signature": "def __init__(self, parent, ...
3
stack_v2_sparse_classes_30k_train_008600
Implement the Python class `LineCtrl` described below. Class description: A custom int control for providing a go To line control for the Command Bar. Method signatures and docstrings: - def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): Initializes the LineCtrl control and its attributes. @param parent: ...
Implement the Python class `LineCtrl` described below. Class description: A custom int control for providing a go To line control for the Command Bar. Method signatures and docstrings: - def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): Initializes the LineCtrl control and its attributes. @param parent: ...
77d66c719b5746f37af51ad593e2941ed6fbba17
<|skeleton|> class LineCtrl: """A custom int control for providing a go To line control for the Command Bar.""" def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): """Initializes the LineCtrl control and its attributes. @param parent: Parent Window @param id_: Control ID @param get_doc: call...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LineCtrl: """A custom int control for providing a go To line control for the Command Bar.""" def __init__(self, parent, id_, get_doc, size=wx.DefaultSize): """Initializes the LineCtrl control and its attributes. @param parent: Parent Window @param id_: Control ID @param get_doc: callback method f...
the_stack_v2_python_sparse
base/lib/python2.7/site-packages/wx-3.0-gtk2/wx/tools/Editra/src/ed_cmdbar.py
jorgediazjr/dials-dev20191018
train
0
948f2ded80f4282bfba8f48950cb3c7b6a5f623f
[ "grid_indexing = stencil_factory.grid_indexing\nself._n_halo = grid_indexing.n_halo\nself._dx = grid_data.dx\nself._dy = grid_data.dy\nself._a11 = grid_data.a11\nself._a12 = grid_data.a12\nself._a21 = grid_data.a21\nself._a22 = grid_data.a22\nif order == 2:\n self._do_ord4 = False\n halos = (1, 1)\n func =...
<|body_start_0|> grid_indexing = stencil_factory.grid_indexing self._n_halo = grid_indexing.n_halo self._dx = grid_data.dx self._dy = grid_data.dy self._a11 = grid_data.a11 self._a12 = grid_data.a12 self._a21 = grid_data.a21 self._a22 = grid_data.a22 ...
Fortan name is c2l_ord2
CubedToLatLon
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CubedToLatLon: """Fortan name is c2l_ord2""" def __init__(self, state: fv3core.DycoreState, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, grid_data: GridData, order: int, comm: pace.util.CubedSphereCommunicator): """Initializes stencils to use either 2...
stack_v2_sparse_classes_36k_train_018823
5,666
permissive
[ { "docstring": "Initializes stencils to use either 2nd or 4th order of interpolation based on namelist setting Args: stencil_factory: creates stencils grid_data: object with metric terms order: Order of interpolation, must be 2 or 4", "name": "__init__", "signature": "def __init__(self, state: fv3core.D...
2
stack_v2_sparse_classes_30k_train_007384
Implement the Python class `CubedToLatLon` described below. Class description: Fortan name is c2l_ord2 Method signatures and docstrings: - def __init__(self, state: fv3core.DycoreState, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, grid_data: GridData, order: int, comm: pace.util.Cubed...
Implement the Python class `CubedToLatLon` described below. Class description: Fortan name is c2l_ord2 Method signatures and docstrings: - def __init__(self, state: fv3core.DycoreState, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, grid_data: GridData, order: int, comm: pace.util.Cubed...
c543e8ec478d46d88b48cdd3beaaa1717a95b935
<|skeleton|> class CubedToLatLon: """Fortan name is c2l_ord2""" def __init__(self, state: fv3core.DycoreState, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, grid_data: GridData, order: int, comm: pace.util.CubedSphereCommunicator): """Initializes stencils to use either 2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CubedToLatLon: """Fortan name is c2l_ord2""" def __init__(self, state: fv3core.DycoreState, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, grid_data: GridData, order: int, comm: pace.util.CubedSphereCommunicator): """Initializes stencils to use either 2nd or 4th ord...
the_stack_v2_python_sparse
stencils/pace/stencils/c2l_ord.py
ai2cm/pace
train
27
1df7481f58ae419b55022d098ccdef3075da33ca
[ "self.directory = directory\nself.locale = locale\nself.data = Config(os.path.join(directory, locale, 'locale.json'))", "fmt = I18nFormatter()\ndata = self.data\nlocal_key = data.get(key) if data.get(key) is not None else key\ntry:\n return fmt.format(local_key, *args)\nexcept (KeyError, IndexError, ValueError...
<|body_start_0|> self.directory = directory self.locale = locale self.data = Config(os.path.join(directory, locale, 'locale.json')) <|end_body_0|> <|body_start_1|> fmt = I18nFormatter() data = self.data local_key = data.get(key) if data.get(key) is not None else key ...
I18n manager of DelogX. Attributes: directory (str): Name of the i18n directory. locale (str): Current locale. data (Config): Message data of the current locale.
I18n
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I18n: """I18n manager of DelogX. Attributes: directory (str): Name of the i18n directory. locale (str): Current locale. data (Config): Message data of the current locale.""" def __init__(self, directory, locale): """Initialize i18n manager. Args: directory (str): Name of the i18n dir...
stack_v2_sparse_classes_36k_train_018824
2,355
permissive
[ { "docstring": "Initialize i18n manager. Args: directory (str): Name of the i18n directory. locale (str): Current locale.", "name": "__init__", "signature": "def __init__(self, directory, locale)" }, { "docstring": "Return a message by a message key. If no such message, return the key. Args: key...
2
stack_v2_sparse_classes_30k_test_000482
Implement the Python class `I18n` described below. Class description: I18n manager of DelogX. Attributes: directory (str): Name of the i18n directory. locale (str): Current locale. data (Config): Message data of the current locale. Method signatures and docstrings: - def __init__(self, directory, locale): Initialize ...
Implement the Python class `I18n` described below. Class description: I18n manager of DelogX. Attributes: directory (str): Name of the i18n directory. locale (str): Current locale. data (Config): Message data of the current locale. Method signatures and docstrings: - def __init__(self, directory, locale): Initialize ...
81739f9059c76d55ec22bcf841d28f3e817b361c
<|skeleton|> class I18n: """I18n manager of DelogX. Attributes: directory (str): Name of the i18n directory. locale (str): Current locale. data (Config): Message data of the current locale.""" def __init__(self, directory, locale): """Initialize i18n manager. Args: directory (str): Name of the i18n dir...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class I18n: """I18n manager of DelogX. Attributes: directory (str): Name of the i18n directory. locale (str): Current locale. data (Config): Message data of the current locale.""" def __init__(self, directory, locale): """Initialize i18n manager. Args: directory (str): Name of the i18n directory. local...
the_stack_v2_python_sparse
DelogX/utils/i18n.py
ClassicOldSong/DelogX
train
0
b27324aa6a42e2f7b2aafabd27a5f42895fda9a1
[ "products = response.css('.tt-product')\nfor item in products:\n url = item.css('a::attr(href)').get()\n yield response.follow(f'{url}.json', callback=self.parse_product)\nnext_page = response.css('a.autoscroll::attr(href)').get()\nif next_page:\n yield response.follow(next_page, self.parse)", "product =...
<|body_start_0|> products = response.css('.tt-product') for item in products: url = item.css('a::attr(href)').get() yield response.follow(f'{url}.json', callback=self.parse_product) next_page = response.css('a.autoscroll::attr(href)').get() if next_page: ...
TovLevSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TovLevSpider: def parse(self, response, **kwargs): """Grab product urls and go to next page @url https://tovlev.com/collections/all @returns requests 9 @request https://tovlev.com/collections/all?page=2""" <|body_0|> def parse_product(self, response): """Grabbing pro...
stack_v2_sparse_classes_36k_train_018825
2,487
no_license
[ { "docstring": "Grab product urls and go to next page @url https://tovlev.com/collections/all @returns requests 9 @request https://tovlev.com/collections/all?page=2", "name": "parse", "signature": "def parse(self, response, **kwargs)" }, { "docstring": "Grabbing product. @url https://tovlev.com/...
2
stack_v2_sparse_classes_30k_train_013549
Implement the Python class `TovLevSpider` described below. Class description: Implement the TovLevSpider class. Method signatures and docstrings: - def parse(self, response, **kwargs): Grab product urls and go to next page @url https://tovlev.com/collections/all @returns requests 9 @request https://tovlev.com/collect...
Implement the Python class `TovLevSpider` described below. Class description: Implement the TovLevSpider class. Method signatures and docstrings: - def parse(self, response, **kwargs): Grab product urls and go to next page @url https://tovlev.com/collections/all @returns requests 9 @request https://tovlev.com/collect...
025babe4a03553d720806828f89929c6e773d683
<|skeleton|> class TovLevSpider: def parse(self, response, **kwargs): """Grab product urls and go to next page @url https://tovlev.com/collections/all @returns requests 9 @request https://tovlev.com/collections/all?page=2""" <|body_0|> def parse_product(self, response): """Grabbing pro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TovLevSpider: def parse(self, response, **kwargs): """Grab product urls and go to next page @url https://tovlev.com/collections/all @returns requests 9 @request https://tovlev.com/collections/all?page=2""" products = response.css('.tt-product') for item in products: url = i...
the_stack_v2_python_sparse
data_scraping/gmd/spiders/tovlev.py
panky2202/scrapy-dev
train
1
2a489461457900919917f750a122549009d78a9e
[ "self.desired_backups = desired_backups\nself.interval = interval\nself.files_to_keep = []", "self.files_to_keep.append(new_filename)\nself.files_to_keep.sort()\nif len(self.files_to_keep) > self.desired_backups:\n prev_timestamp = None\n for file in self.files_to_keep:\n timestamp = extract_datetime...
<|body_start_0|> self.desired_backups = desired_backups self.interval = interval self.files_to_keep = [] <|end_body_0|> <|body_start_1|> self.files_to_keep.append(new_filename) self.files_to_keep.sort() if len(self.files_to_keep) > self.desired_backups: prev_...
Structure for defining and keeping track of desired backups
Desire
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Desire: """Structure for defining and keeping track of desired backups""" def __init__(self, desired_backups: int, interval: timedelta) -> None: """desired_backups: Number of backups desired interval: Desired interval (in days) between backups""" <|body_0|> def evaluate(...
stack_v2_sparse_classes_36k_train_018826
4,990
permissive
[ { "docstring": "desired_backups: Number of backups desired interval: Desired interval (in days) between backups", "name": "__init__", "signature": "def __init__(self, desired_backups: int, interval: timedelta) -> None" }, { "docstring": "Consider the file, and manage the list of files we're deci...
2
stack_v2_sparse_classes_30k_train_008095
Implement the Python class `Desire` described below. Class description: Structure for defining and keeping track of desired backups Method signatures and docstrings: - def __init__(self, desired_backups: int, interval: timedelta) -> None: desired_backups: Number of backups desired interval: Desired interval (in days)...
Implement the Python class `Desire` described below. Class description: Structure for defining and keeping track of desired backups Method signatures and docstrings: - def __init__(self, desired_backups: int, interval: timedelta) -> None: desired_backups: Number of backups desired interval: Desired interval (in days)...
0ba707b0eddc280240964efa481988df92046e6a
<|skeleton|> class Desire: """Structure for defining and keeping track of desired backups""" def __init__(self, desired_backups: int, interval: timedelta) -> None: """desired_backups: Number of backups desired interval: Desired interval (in days) between backups""" <|body_0|> def evaluate(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Desire: """Structure for defining and keeping track of desired backups""" def __init__(self, desired_backups: int, interval: timedelta) -> None: """desired_backups: Number of backups desired interval: Desired interval (in days) between backups""" self.desired_backups = desired_backups ...
the_stack_v2_python_sparse
openshift/s3-backup/docker/prune.py
bcgov/wps
train
35
6ead54789686b0fe9dface9f24d2437fc4d03690
[ "self.log = logger(self.__class__.__name__)\nself.storages = {}\nself.manager = SyncManager()\n\ndef ignore_signals():\n \"\"\"\n Ignores SIGINT and SIGTERM.\n We don't want them propagated to SyncManager, because\n we want to store its' state to disk on Agent shutdown.\n ...
<|body_start_0|> self.log = logger(self.__class__.__name__) self.storages = {} self.manager = SyncManager() def ignore_signals(): """ Ignores SIGINT and SIGTERM. We don't want them propagated to SyncManager, because ...
Manager for per sensor persistent storage. Uses `multiprocessing.managers.SyncManager` to give sensors access to a dict-like structure, which automagically synchronizes with the main process. Values are stored in sqlite as stringified JSON documents.
StorageManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageManager: """Manager for per sensor persistent storage. Uses `multiprocessing.managers.SyncManager` to give sensors access to a dict-like structure, which automagically synchronizes with the main process. Values are stored in sqlite as stringified JSON documents.""" def __init__(self, ...
stack_v2_sparse_classes_36k_train_018827
45,885
permissive
[ { "docstring": "Initializes sync manager and logger.", "name": "__init__", "signature": "def __init__(self, sqlite_factory)" }, { "docstring": "Retrieves storage for given name. If such storage doesn't exist, a new one, possibly with data got from sqlite, will be created. Note that name is not n...
3
stack_v2_sparse_classes_30k_train_005397
Implement the Python class `StorageManager` described below. Class description: Manager for per sensor persistent storage. Uses `multiprocessing.managers.SyncManager` to give sensors access to a dict-like structure, which automagically synchronizes with the main process. Values are stored in sqlite as stringified JSON...
Implement the Python class `StorageManager` described below. Class description: Manager for per sensor persistent storage. Uses `multiprocessing.managers.SyncManager` to give sensors access to a dict-like structure, which automagically synchronizes with the main process. Values are stored in sqlite as stringified JSON...
d3c36672bf444a4ab9a285f32c11a4ac3d2bda31
<|skeleton|> class StorageManager: """Manager for per sensor persistent storage. Uses `multiprocessing.managers.SyncManager` to give sensors access to a dict-like structure, which automagically synchronizes with the main process. Values are stored in sqlite as stringified JSON documents.""" def __init__(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorageManager: """Manager for per sensor persistent storage. Uses `multiprocessing.managers.SyncManager` to give sensors access to a dict-like structure, which automagically synchronizes with the main process. Values are stored in sqlite as stringified JSON documents.""" def __init__(self, sqlite_factor...
the_stack_v2_python_sparse
whmonit/client/agent.py
whitehats/monitowl-agent
train
1
f50baa610286c9e3016f5a42d07cf698a0736c39
[ "with self.schema.table('steps') as table:\n table.text('message').nullable().change()\n pass", "cols = ['message']\nwith self.schema.table('steps') as table:\n for col in enumerate(cols):\n if col in table.get_columns():\n table.text('message').change()\n pass" ]
<|body_start_0|> with self.schema.table('steps') as table: table.text('message').nullable().change() pass <|end_body_0|> <|body_start_1|> cols = ['message'] with self.schema.table('steps') as table: for col in enumerate(cols): if col in table....
AlterMessageStepsNullable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlterMessageStepsNullable: def up(self): """Run the migrations.""" <|body_0|> def down(self): """Revert the migrations.""" <|body_1|> <|end_skeleton|> <|body_start_0|> with self.schema.table('steps') as table: table.text('message').nulla...
stack_v2_sparse_classes_36k_train_018828
588
no_license
[ { "docstring": "Run the migrations.", "name": "up", "signature": "def up(self)" }, { "docstring": "Revert the migrations.", "name": "down", "signature": "def down(self)" } ]
2
stack_v2_sparse_classes_30k_train_018551
Implement the Python class `AlterMessageStepsNullable` described below. Class description: Implement the AlterMessageStepsNullable class. Method signatures and docstrings: - def up(self): Run the migrations. - def down(self): Revert the migrations.
Implement the Python class `AlterMessageStepsNullable` described below. Class description: Implement the AlterMessageStepsNullable class. Method signatures and docstrings: - def up(self): Run the migrations. - def down(self): Revert the migrations. <|skeleton|> class AlterMessageStepsNullable: def up(self): ...
8033c98d7dc13cf5b53e5e4293083db8419809d1
<|skeleton|> class AlterMessageStepsNullable: def up(self): """Run the migrations.""" <|body_0|> def down(self): """Revert the migrations.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlterMessageStepsNullable: def up(self): """Run the migrations.""" with self.schema.table('steps') as table: table.text('message').nullable().change() pass def down(self): """Revert the migrations.""" cols = ['message'] with self.schema.tabl...
the_stack_v2_python_sparse
migrations/2017_12_24_094219_alter_message_steps_nullable.py
nuraizatif/pavoGUI
train
0
0df622f37e173ae244585662e8082c9fc13cd16a
[ "measure_context = {'serialno': self._equipment['serno'], 'passthrough': passthrough, 'voltage': float(voltage), 'numsamples': samples, 'duration': int(duration), 'delay': int(delay)}\nmeasurer = measure.MonsoonCurrentMeasurer(measure_context)\nresult = measurer.measure(handlerclass=measure.AveragePowerHandler)\nre...
<|body_start_0|> measure_context = {'serialno': self._equipment['serno'], 'passthrough': passthrough, 'voltage': float(voltage), 'numsamples': samples, 'duration': int(duration), 'delay': int(delay)} measurer = measure.MonsoonCurrentMeasurer(measure_context) result = measurer.measure(handlerclas...
Provide power meter role controller. This one uses Monsoon device.
PowerMeterRole
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowerMeterRole: """Provide power meter role controller. This one uses Monsoon device.""" def measure_average_power(self, duration=10, samples=None, voltage=4.2, passthrough='auto', delay=0): """Measure and report average power over the span of time. Returns: devtest.devices.monsoon.c...
stack_v2_sparse_classes_36k_train_018829
3,149
permissive
[ { "docstring": "Measure and report average power over the span of time. Returns: devtest.devices.monsoon.core.MeasurementResult object.", "name": "measure_average_power", "signature": "def measure_average_power(self, duration=10, samples=None, voltage=4.2, passthrough='auto', delay=0)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_002378
Implement the Python class `PowerMeterRole` described below. Class description: Provide power meter role controller. This one uses Monsoon device. Method signatures and docstrings: - def measure_average_power(self, duration=10, samples=None, voltage=4.2, passthrough='auto', delay=0): Measure and report average power ...
Implement the Python class `PowerMeterRole` described below. Class description: Provide power meter role controller. This one uses Monsoon device. Method signatures and docstrings: - def measure_average_power(self, duration=10, samples=None, voltage=4.2, passthrough='auto', delay=0): Measure and report average power ...
9ec93045ba4bab5b20ce99dc61cebd5b5a234d01
<|skeleton|> class PowerMeterRole: """Provide power meter role controller. This one uses Monsoon device.""" def measure_average_power(self, duration=10, samples=None, voltage=4.2, passthrough='auto', delay=0): """Measure and report average power over the span of time. Returns: devtest.devices.monsoon.c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PowerMeterRole: """Provide power meter role controller. This one uses Monsoon device.""" def measure_average_power(self, duration=10, samples=None, voltage=4.2, passthrough='auto', delay=0): """Measure and report average power over the span of time. Returns: devtest.devices.monsoon.core.Measureme...
the_stack_v2_python_sparse
devtest/roles/powermeter.py
chaulaode1257/devtest
train
0
606b7039011ede155bde7a06af8f6a7d2bbfbb0c
[ "self.bar = None\nself.onBar = onBar\nself.xminBar = None\nself.xmin = xmin\nself.onXminBar = onXminBar\nself.lastTick = None", "newMinute = False\nif not self.bar:\n self.bar = VtBarData()\n newMinute = True\nelif self.bar.datetime.minute != tick.datetime.minute:\n self.bar.datetime = self.bar.datetime....
<|body_start_0|> self.bar = None self.onBar = onBar self.xminBar = None self.xmin = xmin self.onXminBar = onXminBar self.lastTick = None <|end_body_0|> <|body_start_1|> newMinute = False if not self.bar: self.bar = VtBarData() newM...
K线合成器,支持: 1. 基于Tick合成1分钟K线 2. 基于1分钟K线合成X分钟K线(X可以是2、3、5、10、15、30、60)
BarGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarGenerator: """K线合成器,支持: 1. 基于Tick合成1分钟K线 2. 基于1分钟K线合成X分钟K线(X可以是2、3、5、10、15、30、60)""" def __init__(self, onBar, xmin=0, onXminBar=None): """Constructor""" <|body_0|> def updateTick(self, tick): """TICK更新""" <|body_1|> def updateBar(self, bar): ...
stack_v2_sparse_classes_36k_train_018830
7,750
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, onBar, xmin=0, onXminBar=None)" }, { "docstring": "TICK更新", "name": "updateTick", "signature": "def updateTick(self, tick)" }, { "docstring": "1分钟K线更新", "name": "updateBar", "signature": "d...
3
stack_v2_sparse_classes_30k_train_016822
Implement the Python class `BarGenerator` described below. Class description: K线合成器,支持: 1. 基于Tick合成1分钟K线 2. 基于1分钟K线合成X分钟K线(X可以是2、3、5、10、15、30、60) Method signatures and docstrings: - def __init__(self, onBar, xmin=0, onXminBar=None): Constructor - def updateTick(self, tick): TICK更新 - def updateBar(self, bar): 1分钟K线更新
Implement the Python class `BarGenerator` described below. Class description: K线合成器,支持: 1. 基于Tick合成1分钟K线 2. 基于1分钟K线合成X分钟K线(X可以是2、3、5、10、15、30、60) Method signatures and docstrings: - def __init__(self, onBar, xmin=0, onXminBar=None): Constructor - def updateTick(self, tick): TICK更新 - def updateBar(self, bar): 1分钟K线更新 ...
4daa6bbf4d7ae7a386d8fb743217b7aec5c5fb5f
<|skeleton|> class BarGenerator: """K线合成器,支持: 1. 基于Tick合成1分钟K线 2. 基于1分钟K线合成X分钟K线(X可以是2、3、5、10、15、30、60)""" def __init__(self, onBar, xmin=0, onXminBar=None): """Constructor""" <|body_0|> def updateTick(self, tick): """TICK更新""" <|body_1|> def updateBar(self, bar): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BarGenerator: """K线合成器,支持: 1. 基于Tick合成1分钟K线 2. 基于1分钟K线合成X分钟K线(X可以是2、3、5、10、15、30、60)""" def __init__(self, onBar, xmin=0, onXminBar=None): """Constructor""" self.bar = None self.onBar = onBar self.xminBar = None self.xmin = xmin self.onXminBar = onXminBar ...
the_stack_v2_python_sparse
coind/utils/vtObject.py
cheatm/coind
train
1
9e9c94285ee380e89555d8769be2c15e8553f601
[ "queryset = request.user.following.all()\npaginated = self.paginate_queryset(queryset)\nreturn self.get_paginated_response(UserProfileSerializer(paginated, many=True).data)", "username = get_key_or_400(request, 'username')\ntry:\n user = AppUser.objects.get(username=username)\n request.user.following.add(us...
<|body_start_0|> queryset = request.user.following.all() paginated = self.paginate_queryset(queryset) return self.get_paginated_response(UserProfileSerializer(paginated, many=True).data) <|end_body_0|> <|body_start_1|> username = get_key_or_400(request, 'username') try: ...
FollowingView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowingView: def get(self, request, format=None): """List of all users followed by the current user""" <|body_0|> def post(self, request, format=None): """Follow another user""" <|body_1|> <|end_skeleton|> <|body_start_0|> queryset = request.user....
stack_v2_sparse_classes_36k_train_018831
4,100
permissive
[ { "docstring": "List of all users followed by the current user", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "Follow another user", "name": "post", "signature": "def post(self, request, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_015652
Implement the Python class `FollowingView` described below. Class description: Implement the FollowingView class. Method signatures and docstrings: - def get(self, request, format=None): List of all users followed by the current user - def post(self, request, format=None): Follow another user
Implement the Python class `FollowingView` described below. Class description: Implement the FollowingView class. Method signatures and docstrings: - def get(self, request, format=None): List of all users followed by the current user - def post(self, request, format=None): Follow another user <|skeleton|> class Foll...
e604cf2b9f9b3bfeed7468c668a71ae2ab48402b
<|skeleton|> class FollowingView: def get(self, request, format=None): """List of all users followed by the current user""" <|body_0|> def post(self, request, format=None): """Follow another user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FollowingView: def get(self, request, format=None): """List of all users followed by the current user""" queryset = request.user.following.all() paginated = self.paginate_queryset(queryset) return self.get_paginated_response(UserProfileSerializer(paginated, many=True).data) ...
the_stack_v2_python_sparse
server/authentication/api/views.py
wcreis/Real-World-App-Django-Sapper
train
0
2ae0f19d4a525f005350f221b653f33cf60bffc3
[ "v = 0\nfor i, n in enumerate(nums):\n v += i * n\nans = v\ns, l = (sum(nums), len(nums))\nfor n in nums:\n v = v + l * n - s\n ans = max(ans, v)\nreturn ans", "ans = None\nl = len(nums)\nfor k in range(len(nums)):\n v = 0\n for i, n in enumerate(nums):\n v += (i - k + l) % l * n\n ans = ...
<|body_start_0|> v = 0 for i, n in enumerate(nums): v += i * n ans = v s, l = (sum(nums), len(nums)) for n in nums: v = v + l * n - s ans = max(ans, v) return ans <|end_body_0|> <|body_start_1|> ans = None l = len(nums)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxRotateFunction(self, nums: list[int]) -> int: """>>> s = Solution() >>> s.maxRotateFunction([4,3,2,6]) 26 >>> s.maxRotateFunction([100]) 0 >>> s.maxRotateFunction([-1,-2]) -1 >>> s.maxRotateFunction([-8,5,-10]) 2""" <|body_0|> def maxRotateFunction2(self, nu...
stack_v2_sparse_classes_36k_train_018832
2,456
no_license
[ { "docstring": ">>> s = Solution() >>> s.maxRotateFunction([4,3,2,6]) 26 >>> s.maxRotateFunction([100]) 0 >>> s.maxRotateFunction([-1,-2]) -1 >>> s.maxRotateFunction([-8,5,-10]) 2", "name": "maxRotateFunction", "signature": "def maxRotateFunction(self, nums: list[int]) -> int" }, { "docstring": ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxRotateFunction(self, nums: list[int]) -> int: >>> s = Solution() >>> s.maxRotateFunction([4,3,2,6]) 26 >>> s.maxRotateFunction([100]) 0 >>> s.maxRotateFunction([-1,-2]) -1...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxRotateFunction(self, nums: list[int]) -> int: >>> s = Solution() >>> s.maxRotateFunction([4,3,2,6]) 26 >>> s.maxRotateFunction([100]) 0 >>> s.maxRotateFunction([-1,-2]) -1...
d2e8b2dca40fc955045eb62e576c776bad8ee5f1
<|skeleton|> class Solution: def maxRotateFunction(self, nums: list[int]) -> int: """>>> s = Solution() >>> s.maxRotateFunction([4,3,2,6]) 26 >>> s.maxRotateFunction([100]) 0 >>> s.maxRotateFunction([-1,-2]) -1 >>> s.maxRotateFunction([-8,5,-10]) 2""" <|body_0|> def maxRotateFunction2(self, nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxRotateFunction(self, nums: list[int]) -> int: """>>> s = Solution() >>> s.maxRotateFunction([4,3,2,6]) 26 >>> s.maxRotateFunction([100]) 0 >>> s.maxRotateFunction([-1,-2]) -1 >>> s.maxRotateFunction([-8,5,-10]) 2""" v = 0 for i, n in enumerate(nums): v += i...
the_stack_v2_python_sparse
rotate-function/solution.py
childe/leetcode
train
2
7e3b9d1b8d1c5a8e50ac01d602dc62352c28de9d
[ "self.client.force_login(self.team1_admin)\nresponse = self.client.get(self.list_url)\nself.assertContains(response, 'Contexts for %s' % self.team1.name, status_code=200)\nfor context in self.team1.contexts.all():\n self.assertContains(response, context.name)\n self.assertContains(response, context.descriptio...
<|body_start_0|> self.client.force_login(self.team1_admin) response = self.client.get(self.list_url) self.assertContains(response, 'Contexts for %s' % self.team1.name, status_code=200) for context in self.team1.contexts.all(): self.assertContains(response, context.name) ...
Test ContextListView
ContextListViewTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextListViewTest: """Test ContextListView""" def test_context_list_admin(self): """Assert that all contexts are listed for the team admin""" <|body_0|> def test_context_list_member(self): """Assert that all right contexts are listed for the team member""" ...
stack_v2_sparse_classes_36k_train_018833
9,319
permissive
[ { "docstring": "Assert that all contexts are listed for the team admin", "name": "test_context_list_admin", "signature": "def test_context_list_admin(self)" }, { "docstring": "Assert that all right contexts are listed for the team member", "name": "test_context_list_member", "signature":...
3
stack_v2_sparse_classes_30k_train_004764
Implement the Python class `ContextListViewTest` described below. Class description: Test ContextListView Method signatures and docstrings: - def test_context_list_admin(self): Assert that all contexts are listed for the team admin - def test_context_list_member(self): Assert that all right contexts are listed for th...
Implement the Python class `ContextListViewTest` described below. Class description: Test ContextListView Method signatures and docstrings: - def test_context_list_admin(self): Assert that all contexts are listed for the team admin - def test_context_list_member(self): Assert that all right contexts are listed for th...
b3a61462d46d33de25fb96c029b2bd822001b669
<|skeleton|> class ContextListViewTest: """Test ContextListView""" def test_context_list_admin(self): """Assert that all contexts are listed for the team admin""" <|body_0|> def test_context_list_member(self): """Assert that all right contexts are listed for the team member""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContextListViewTest: """Test ContextListView""" def test_context_list_admin(self): """Assert that all contexts are listed for the team admin""" self.client.force_login(self.team1_admin) response = self.client.get(self.list_url) self.assertContains(response, 'Contexts for %...
the_stack_v2_python_sparse
src/context/tests.py
tykling/socialrating
train
3
26d6e85f7b13b130ede56863634c91c837e7b67b
[ "if len(nums) <= 1:\n return nums\ni = j = len(nums) - 1\nwhile i >= 1 and nums[i] <= nums[i - 1]:\n i -= 1\ni -= 1\nif i >= 0:\n lo, hi = (i + 1, j + 1)\n while lo < hi:\n mid = (lo + hi) // 2\n if nums[mid] <= nums[i]:\n hi = mid\n else:\n lo = mid + 1\n l...
<|body_start_0|> if len(nums) <= 1: return nums i = j = len(nums) - 1 while i >= 1 and nums[i] <= nums[i - 1]: i -= 1 i -= 1 if i >= 0: lo, hi = (i + 1, j + 1) while lo < hi: mid = (lo + hi) // 2 if n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation1(self, nums: 'List[int]') -> None: """Do not return anything, modify nums in-place instead.""" ...
stack_v2_sparse_classes_36k_train_018834
2,494
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums)" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "nextPermutation1", "sig...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def nextPermutation1(self, nums: 'List[int]') -> None:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def nextPermutation1(self, nums: 'List[int]') -> None:...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation1(self, nums: 'List[int]') -> None: """Do not return anything, modify nums in-place instead.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" if len(nums) <= 1: return nums i = j = len(nums) - 1 while i >= 1 and nums[i] <= nums[i - 1]: i -= 1 i -= 1 ...
the_stack_v2_python_sparse
Array/q031_next_permutation.py
sevenhe716/LeetCode
train
0
85f47f0d3e6a9c0418d427d00de354e8fc2f4223
[ "self.plugin._regrid_and_populate(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube)\nplugin_cubes = [self.plugin.temperature, self.plugin.humidity, self.plugin.pressure, self.plugin.uwind, self.plugin.vwind, self.plugin.topography]\nfor cube in plugin_cubes:\n self.asse...
<|body_start_0|> self.plugin._regrid_and_populate(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube) plugin_cubes = [self.plugin.temperature, self.plugin.humidity, self.plugin.pressure, self.plugin.uwind, self.plugin.vwind, self.plugin.topography] for cu...
Test the _regrid_and_populate method
Test__regrid_and_populate
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__regrid_and_populate: """Test the _regrid_and_populate method""" def test_basic(self): """Test function populates class instance""" <|body_0|> def test_variables(self): """Test variable values are sensible""" <|body_1|> def test_vgradz(self): ...
stack_v2_sparse_classes_36k_train_018835
34,979
permissive
[ { "docstring": "Test function populates class instance", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test variable values are sensible", "name": "test_variables", "signature": "def test_variables(self)" }, { "docstring": "Test values of vgradz are...
3
stack_v2_sparse_classes_30k_train_004160
Implement the Python class `Test__regrid_and_populate` described below. Class description: Test the _regrid_and_populate method Method signatures and docstrings: - def test_basic(self): Test function populates class instance - def test_variables(self): Test variable values are sensible - def test_vgradz(self): Test v...
Implement the Python class `Test__regrid_and_populate` described below. Class description: Test the _regrid_and_populate method Method signatures and docstrings: - def test_basic(self): Test function populates class instance - def test_variables(self): Test variable values are sensible - def test_vgradz(self): Test v...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__regrid_and_populate: """Test the _regrid_and_populate method""" def test_basic(self): """Test function populates class instance""" <|body_0|> def test_variables(self): """Test variable values are sensible""" <|body_1|> def test_vgradz(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__regrid_and_populate: """Test the _regrid_and_populate method""" def test_basic(self): """Test function populates class instance""" self.plugin._regrid_and_populate(self.temperature, self.humidity, self.pressure, self.uwind, self.vwind, self.orography_cube) plugin_cubes = [se...
the_stack_v2_python_sparse
improver_tests/orographic_enhancement/test_OrographicEnhancement.py
metoppv/improver
train
101
3de18d906f6389066a9078b673c6d7dc78b0e573
[ "self.data = data\nself._attr_name = name\nself._attr_device_class = device_class\nself._attr_is_on = None\nself._payload_on = payload_on\nself._payload_off = payload_off\nself._value_template = value_template\nself._attr_unique_id = unique_id", "await self.hass.async_add_executor_job(self.data.update)\nvalue = s...
<|body_start_0|> self.data = data self._attr_name = name self._attr_device_class = device_class self._attr_is_on = None self._payload_on = payload_on self._payload_off = payload_off self._value_template = value_template self._attr_unique_id = unique_id <|e...
Representation of a command line binary sensor.
CommandBinarySensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandBinarySensor: """Representation of a command line binary sensor.""" def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None: """Initi...
stack_v2_sparse_classes_36k_train_018836
4,158
permissive
[ { "docstring": "Initialize the Command line binary sensor.", "name": "__init__", "signature": "def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None" }, {...
2
null
Implement the Python class `CommandBinarySensor` described below. Class description: Representation of a command line binary sensor. Method signatures and docstrings: - def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_templat...
Implement the Python class `CommandBinarySensor` described below. Class description: Representation of a command line binary sensor. Method signatures and docstrings: - def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_templat...
2e65b77b2b5c17919939481f327963abdfdc53f0
<|skeleton|> class CommandBinarySensor: """Representation of a command line binary sensor.""" def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None: """Initi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandBinarySensor: """Representation of a command line binary sensor.""" def __init__(self, data: CommandSensorData, name: str, device_class: BinarySensorDeviceClass | None, payload_on: str, payload_off: str, value_template: Template | None, unique_id: str | None) -> None: """Initialize the Com...
the_stack_v2_python_sparse
homeassistant/components/command_line/binary_sensor.py
konnected-io/home-assistant
train
24
77e6ef8c446011b837e612d1a412756f43a10c43
[ "nums1_copy = nums1[0:m]\nnums1[:] = []\np1, p2 = (0, 0)\nwhile p1 < m and p2 < n:\n if nums1_copy[p1] < nums2[p2]:\n nums1.append(nums1_copy[p1])\n p1 += 1\n else:\n nums1.append(nums2[p2])\n p2 += 1\nnums1[p1 + p2:] = nums2[p2:] if p2 < n else nums1_copy[p1:]", "p, p1, p2 = (m ...
<|body_start_0|> nums1_copy = nums1[0:m] nums1[:] = [] p1, p2 = (0, 0) while p1 < m and p2 < n: if nums1_copy[p1] < nums2[p2]: nums1.append(nums1_copy[p1]) p1 += 1 else: nums1.append(nums2[p2]) p2 += ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge1(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, mod...
stack_v2_sparse_classes_36k_train_018837
1,238
no_license
[ { "docstring": "Do not return anything, modify nums1 in-place instead.", "name": "merge1", "signature": "def merge1(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None" }, { "docstring": "Do not return anything, modify nums1 in-place instead.", "name": "merge", "signature":...
2
stack_v2_sparse_classes_30k_train_002323
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge1(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge(self, nums1: List[int], m: int, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge1(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge(self, nums1: List[int], m: int, n...
41fa7e7719c3573716c967a4307dd792263aa14d
<|skeleton|> class Solution: def merge1(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, mod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge1(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" nums1_copy = nums1[0:m] nums1[:] = [] p1, p2 = (0, 0) while p1 < m and p2 < n: if nums1_copy[p1] < nums2[p2]:...
the_stack_v2_python_sparse
python/88. 合并两个有序数组/leetcode.py
Sihaiyinan/leetcode-record
train
3
6ed48615e9255011ec0f1db018864ebb26fc3012
[ "query_params = request.query_params.copy()\nordering_query_params = query_params.getlist(self.ordering_param, [])\nordering_params_present = False\nfor query_param in ordering_query_params:\n __key = query_param.lstrip('-')\n if __key in view.ordering_fields:\n ordering_params_present = True\n ...
<|body_start_0|> query_params = request.query_params.copy() ordering_query_params = query_params.getlist(self.ordering_param, []) ordering_params_present = False for query_param in ordering_query_params: __key = query_param.lstrip('-') if __key in view.ordering_fi...
Default ordering filter backend for Elasticsearch. Make sure this is your last ordering backend. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> DefaultOrderingFilterBackend, >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet >>> >>> # Loca...
DefaultOrderingFilterBackend
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultOrderingFilterBackend: """Default ordering filter backend for Elasticsearch. Make sure this is your last ordering backend. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> DefaultOrderingFilterBackend, >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch...
stack_v2_sparse_classes_36k_train_018838
8,440
no_license
[ { "docstring": "Get ordering query params. :param request: Django REST framework request. :param view: View. :type request: rest_framework.request.Request :type view: rest_framework.viewsets.ReadOnlyModelViewSet :return: Ordering params to be used for ordering. :rtype: list", "name": "get_ordering_query_par...
3
stack_v2_sparse_classes_30k_train_017740
Implement the Python class `DefaultOrderingFilterBackend` described below. Class description: Default ordering filter backend for Elasticsearch. Make sure this is your last ordering backend. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> DefaultOrderingFilterBackend, >>> OrderingFilterBack...
Implement the Python class `DefaultOrderingFilterBackend` described below. Class description: Default ordering filter backend for Elasticsearch. Make sure this is your last ordering backend. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> DefaultOrderingFilterBackend, >>> OrderingFilterBack...
51d04b4fd0c201b543fde9c3c94d2dab6e7eee50
<|skeleton|> class DefaultOrderingFilterBackend: """Default ordering filter backend for Elasticsearch. Make sure this is your last ordering backend. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> DefaultOrderingFilterBackend, >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefaultOrderingFilterBackend: """Default ordering filter backend for Elasticsearch. Make sure this is your last ordering backend. Example: >>> from django_elasticsearch_dsl_drf.filter_backends import ( >>> DefaultOrderingFilterBackend, >>> OrderingFilterBackend >>> ) >>> from django_elasticsearch_dsl_drf.view...
the_stack_v2_python_sparse
book_es/src/django_elasticsearch_dsl_drf/filter_backends/ordering/common.py
kabrice/book-django
train
1
5030c685e861702610276e80de4493a32102488b
[ "extra_specs = flavor['extra_specs']\ndeploy_kernel = extra_specs.get('baremetal:deploy_kernel_id')\ndeploy_ramdisk = extra_specs.get('baremetal:deploy_ramdisk_id')\ndeploy_ids = {}\nif deploy_kernel and deploy_ramdisk:\n deploy_ids['pxe_deploy_kernel'] = deploy_kernel\n deploy_ids['pxe_deploy_ramdisk'] = dep...
<|body_start_0|> extra_specs = flavor['extra_specs'] deploy_kernel = extra_specs.get('baremetal:deploy_kernel_id') deploy_ramdisk = extra_specs.get('baremetal:deploy_ramdisk_id') deploy_ids = {} if deploy_kernel and deploy_ramdisk: deploy_ids['pxe_deploy_kernel'] = de...
PXEDriverFields
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PXEDriverFields: def _get_kernel_ramdisk_dict(self, flavor): """Get the deploy ramdisk and kernel IDs from the flavor. :param flavor: the flavor object. :returns: a dict with the pxe options for the deploy ramdisk and kernel if the IDs were found in the flavor, otherwise an empty dict is...
stack_v2_sparse_classes_36k_train_018839
6,532
permissive
[ { "docstring": "Get the deploy ramdisk and kernel IDs from the flavor. :param flavor: the flavor object. :returns: a dict with the pxe options for the deploy ramdisk and kernel if the IDs were found in the flavor, otherwise an empty dict is returned.", "name": "_get_kernel_ramdisk_dict", "signature": "d...
3
null
Implement the Python class `PXEDriverFields` described below. Class description: Implement the PXEDriverFields class. Method signatures and docstrings: - def _get_kernel_ramdisk_dict(self, flavor): Get the deploy ramdisk and kernel IDs from the flavor. :param flavor: the flavor object. :returns: a dict with the pxe o...
Implement the Python class `PXEDriverFields` described below. Class description: Implement the PXEDriverFields class. Method signatures and docstrings: - def _get_kernel_ramdisk_dict(self, flavor): Get the deploy ramdisk and kernel IDs from the flavor. :param flavor: the flavor object. :returns: a dict with the pxe o...
d01a4e54df558092702ffeae3cb4551bfb2d7707
<|skeleton|> class PXEDriverFields: def _get_kernel_ramdisk_dict(self, flavor): """Get the deploy ramdisk and kernel IDs from the flavor. :param flavor: the flavor object. :returns: a dict with the pxe options for the deploy ramdisk and kernel if the IDs were found in the flavor, otherwise an empty dict is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PXEDriverFields: def _get_kernel_ramdisk_dict(self, flavor): """Get the deploy ramdisk and kernel IDs from the flavor. :param flavor: the flavor object. :returns: a dict with the pxe options for the deploy ramdisk and kernel if the IDs were found in the flavor, otherwise an empty dict is returned.""" ...
the_stack_v2_python_sparse
nova/virt/ironic/patcher.py
projectcalico/calico-nova
train
7
5517b21befbc475c798db26286b46a79e8f7b66b
[ "self.N = ZZ(N)\nself.n = euler_phi(N)\nself.m = m\nself.__i = 0\nself.K = IntegerModRing(q)\nif self.n != D.n:\n raise ValueError('Noise distribution has dimensions %d != %d' % (D.n, self.n))\nself.D = D\nself.q = q\nif poly is not None:\n self.poly = poly\nelse:\n self.poly = cyclotomic_polynomial(self.N...
<|body_start_0|> self.N = ZZ(N) self.n = euler_phi(N) self.m = m self.__i = 0 self.K = IntegerModRing(q) if self.n != D.n: raise ValueError('Noise distribution has dimensions %d != %d' % (D.n, self.n)) self.D = D self.q = q if poly is n...
Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__
RingLWE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RingLWE: """Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): """Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``....
stack_v2_sparse_classes_36k_train_018840
31,769
no_license
[ { "docstring": "Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``N`` - index of cyclotomic polynomial (integer > 0, must be power of 2) - ``q`` - modulus typically > N (integer > 0) - ``D`` - an error distribution such as an instance of :...
3
stack_v2_sparse_classes_30k_train_012709
Implement the Python class `RingLWE` described below. Class description: Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__ Method signatures and docstrings: - def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): Construct a Ring-LWE oracle in dimension ``n=phi(N)`` ...
Implement the Python class `RingLWE` described below. Class description: Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__ Method signatures and docstrings: - def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): Construct a Ring-LWE oracle in dimension ``n=phi(N)`` ...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class RingLWE: """Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): """Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RingLWE: """Ring Learning with Errors oracle. .. automethod:: __init__ .. automethod:: __call__""" def __init__(self, N, q, D, poly=None, secret_dist='uniform', m=None): """Construct a Ring-LWE oracle in dimension ``n=phi(N)`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``N...
the_stack_v2_python_sparse
sage/src/sage/crypto/lwe.py
bopopescu/geosci
train
0
dc500f8b41005b0baff7bb35ca3ce25a8349a917
[ "if isinstance(script, GitScript):\n loader = ModuleFactory._load_module_from_git\n return loader(script)\nif isinstance(script, FileSystemScript):\n loader = ModuleFactory._load_module_from_file\n return loader(script.script_uri)\nraise ValueError(f'Script type not handled: {script.__class__.__name__}'...
<|body_start_0|> if isinstance(script, GitScript): loader = ModuleFactory._load_module_from_git return loader(script) if isinstance(script, FileSystemScript): loader = ModuleFactory._load_module_from_file return loader(script.script_uri) raise Valu...
Factory class used to return Python Module instances from a variety of storage back-ends.
ModuleFactory
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleFactory: """Factory class used to return Python Module instances from a variety of storage back-ends.""" def get_module(script: ExecutableScript): """Load Python code from storage, returning an executable Python module. :param script: Script object describing the script to load...
stack_v2_sparse_classes_36k_train_018841
34,691
permissive
[ { "docstring": "Load Python code from storage, returning an executable Python module. :param script: Script object describing the script to load :return: Python module", "name": "get_module", "signature": "def get_module(script: ExecutableScript)" }, { "docstring": "Load Python module from file ...
3
stack_v2_sparse_classes_30k_train_020801
Implement the Python class `ModuleFactory` described below. Class description: Factory class used to return Python Module instances from a variety of storage back-ends. Method signatures and docstrings: - def get_module(script: ExecutableScript): Load Python code from storage, returning an executable Python module. :...
Implement the Python class `ModuleFactory` described below. Class description: Factory class used to return Python Module instances from a variety of storage back-ends. Method signatures and docstrings: - def get_module(script: ExecutableScript): Load Python code from storage, returning an executable Python module. :...
cace7d3f3fe58e9711730893761cb8380bb7f598
<|skeleton|> class ModuleFactory: """Factory class used to return Python Module instances from a variety of storage back-ends.""" def get_module(script: ExecutableScript): """Load Python code from storage, returning an executable Python module. :param script: Script object describing the script to load...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModuleFactory: """Factory class used to return Python Module instances from a variety of storage back-ends.""" def get_module(script: ExecutableScript): """Load Python code from storage, returning an executable Python module. :param script: Script object describing the script to load :return: Pyt...
the_stack_v2_python_sparse
src/ska_oso_oet/procedure/domain.py
ska-telescope/observation-execution-tool
train
0
deb6f550e5ad9fbe2611a40371aeace4074f907d
[ "self.n, self.m = data.shape\nself.shmem_data = mp.RawArray(ctypes.c_double, self.n * self.m)\n_data = shmem_as_ndarray(self.shmem_data).reshape((self.n, self.m))\n_data[:, :] = data\nself.leafsize = leafsize\nself._nprocs = nprocs\nself._chunk = chunk\nself._schedule = schedule", "nx = x.shape[0]\nshmem_x = mp.R...
<|body_start_0|> self.n, self.m = data.shape self.shmem_data = mp.RawArray(ctypes.c_double, self.n * self.m) _data = shmem_as_ndarray(self.shmem_data).reshape((self.n, self.m)) _data[:, :] = data self.leafsize = leafsize self._nprocs = nprocs self._chunk = chunk ...
Multiprocessing cKDTree subclass, shared memory
cKDTree_MP
[ "GPL-2.0-only", "GPL-1.0-or-later", "LGPL-2.0-or-later", "LicenseRef-scancode-mit-old-style", "dtoa", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain-disclaimer", "Zlib", "LicenseRef-scancode-public-domain", "BSD-3-Clause", "LicenseRef-scancode-proprietary-lic...
stack_v2_sparse_python_classes_v1
<|skeleton|> class cKDTree_MP: """Multiprocessing cKDTree subclass, shared memory""" def __init__(self, data, leafsize=10, nprocs=2, chunk=None, schedule='guided'): """Same as cKDTree.__init__ except that an internal copy of data to shared memory is made. Extra keyword arguments: chunk : Minimum chunk ...
stack_v2_sparse_classes_36k_train_018842
10,163
permissive
[ { "docstring": "Same as cKDTree.__init__ except that an internal copy of data to shared memory is made. Extra keyword arguments: chunk : Minimum chunk size for the load balancer. schedule: Strategy for balancing work load ('static', 'dynamic' or 'guided').", "name": "__init__", "signature": "def __init_...
2
stack_v2_sparse_classes_30k_train_003245
Implement the Python class `cKDTree_MP` described below. Class description: Multiprocessing cKDTree subclass, shared memory Method signatures and docstrings: - def __init__(self, data, leafsize=10, nprocs=2, chunk=None, schedule='guided'): Same as cKDTree.__init__ except that an internal copy of data to shared memory...
Implement the Python class `cKDTree_MP` described below. Class description: Multiprocessing cKDTree subclass, shared memory Method signatures and docstrings: - def __init__(self, data, leafsize=10, nprocs=2, chunk=None, schedule='guided'): Same as cKDTree.__init__ except that an internal copy of data to shared memory...
930d26886fdf8591b51da9d53e2aca743bf128ba
<|skeleton|> class cKDTree_MP: """Multiprocessing cKDTree subclass, shared memory""" def __init__(self, data, leafsize=10, nprocs=2, chunk=None, schedule='guided'): """Same as cKDTree.__init__ except that an internal copy of data to shared memory is made. Extra keyword arguments: chunk : Minimum chunk ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class cKDTree_MP: """Multiprocessing cKDTree subclass, shared memory""" def __init__(self, data, leafsize=10, nprocs=2, chunk=None, schedule='guided'): """Same as cKDTree.__init__ except that an internal copy of data to shared memory is made. Extra keyword arguments: chunk : Minimum chunk size for the ...
the_stack_v2_python_sparse
3/amd64/envs/navigator/lib/python3.6/site-packages/pyresample/_spatial_mp.py
DFO-Ocean-Navigator/navigator-toolchain
train
0
c5adee643bbe9db8b815807dc9e4497a6beb0d8f
[ "address = ModelDelivereAdrressClient.query.filter_by(id=address_id).filter_by(client=client_id).first()\nif address:\n try:\n address.delete_address()\n return (jsonify({'message': 'address deleted'}), 200)\n except:\n return (jsonify({'message': 'Internal error'}), 500)\nreturn (jsonify...
<|body_start_0|> address = ModelDelivereAdrressClient.query.filter_by(id=address_id).filter_by(client=client_id).first() if address: try: address.delete_address() return (jsonify({'message': 'address deleted'}), 200) except: return ...
ClientAddressApi
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientAddressApi: def delete(self, client_id, address_id): """Deletar endereço de entrega cadastrado.""" <|body_0|> def put(self, client_id, address_id): """Atualiza endereço de entrega cadastrador""" <|body_1|> def patch(self, client_id, address_id): ...
stack_v2_sparse_classes_36k_train_018843
11,080
permissive
[ { "docstring": "Deletar endereço de entrega cadastrado.", "name": "delete", "signature": "def delete(self, client_id, address_id)" }, { "docstring": "Atualiza endereço de entrega cadastrador", "name": "put", "signature": "def put(self, client_id, address_id)" }, { "docstring": "S...
4
stack_v2_sparse_classes_30k_train_007016
Implement the Python class `ClientAddressApi` described below. Class description: Implement the ClientAddressApi class. Method signatures and docstrings: - def delete(self, client_id, address_id): Deletar endereço de entrega cadastrado. - def put(self, client_id, address_id): Atualiza endereço de entrega cadastrador ...
Implement the Python class `ClientAddressApi` described below. Class description: Implement the ClientAddressApi class. Method signatures and docstrings: - def delete(self, client_id, address_id): Deletar endereço de entrega cadastrado. - def put(self, client_id, address_id): Atualiza endereço de entrega cadastrador ...
d85e9eb6680e48bfa4a8ccba24c76fb8f5fbcc54
<|skeleton|> class ClientAddressApi: def delete(self, client_id, address_id): """Deletar endereço de entrega cadastrado.""" <|body_0|> def put(self, client_id, address_id): """Atualiza endereço de entrega cadastrador""" <|body_1|> def patch(self, client_id, address_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientAddressApi: def delete(self, client_id, address_id): """Deletar endereço de entrega cadastrado.""" address = ModelDelivereAdrressClient.query.filter_by(id=address_id).filter_by(client=client_id).first() if address: try: address.delete_address() ...
the_stack_v2_python_sparse
Api/resources/admin/clients.py
rodrigomota01/azulerosa
train
0
14c4bc9375274d83f0d9cdd9799505ba24934674
[ "assert isinstance(output_size, (int, tuple))\nassert isinstance(return_tensor, bool)\nassert isinstance(channel_first, bool)\nassert isinstance(interpolation, int)\nself.output_size = output_size\nself.return_tensor = return_tensor\nself.channel_first = channel_first\nself.interpolation = interpolation", "if sel...
<|body_start_0|> assert isinstance(output_size, (int, tuple)) assert isinstance(return_tensor, bool) assert isinstance(channel_first, bool) assert isinstance(interpolation, int) self.output_size = output_size self.return_tensor = return_tensor self.channel_first =...
Rescales a collection of images in a given sample, to a specified size.
BatchRescale
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchRescale: """Rescales a collection of images in a given sample, to a specified size.""" def __init__(self, output_size, return_tensor=True, channel_first=True, interpolation=cv2.INTER_LANCZOS4): """Instantiates a new BatchResize object. Parameters ---------- output_size : int or ...
stack_v2_sparse_classes_36k_train_018844
14,169
no_license
[ { "docstring": "Instantiates a new BatchResize object. Parameters ---------- output_size : int or tuple The output size of the image (height and width). If an integer is passed as input, then the output size of the image is determined by scaling the height and width of the original image. return_tensor : {True,...
2
stack_v2_sparse_classes_30k_val_000371
Implement the Python class `BatchRescale` described below. Class description: Rescales a collection of images in a given sample, to a specified size. Method signatures and docstrings: - def __init__(self, output_size, return_tensor=True, channel_first=True, interpolation=cv2.INTER_LANCZOS4): Instantiates a new BatchR...
Implement the Python class `BatchRescale` described below. Class description: Rescales a collection of images in a given sample, to a specified size. Method signatures and docstrings: - def __init__(self, output_size, return_tensor=True, channel_first=True, interpolation=cv2.INTER_LANCZOS4): Instantiates a new BatchR...
a7c30481822ecb945e3ff6ad184d104361a40ed1
<|skeleton|> class BatchRescale: """Rescales a collection of images in a given sample, to a specified size.""" def __init__(self, output_size, return_tensor=True, channel_first=True, interpolation=cv2.INTER_LANCZOS4): """Instantiates a new BatchResize object. Parameters ---------- output_size : int or ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchRescale: """Rescales a collection of images in a given sample, to a specified size.""" def __init__(self, output_size, return_tensor=True, channel_first=True, interpolation=cv2.INTER_LANCZOS4): """Instantiates a new BatchResize object. Parameters ---------- output_size : int or tuple The out...
the_stack_v2_python_sparse
cheapfake/contrib/transforms.py
hu-simon/cheapfake
train
0
3558bbb268d6a7cf6cab327fc781231d8d4c1608
[ "super().__init__()\nself.dropout_rate = dropout_rate\nself.device = device\nself.ff1 = torch.nn.Linear(input_size, hidden_size)\nself.ff2 = torch.nn.Linear(hidden_size, 1, bias=False)\nif dropout_rate is not None:\n self.model_drop = torch.nn.Dropout(dropout_rate)", "attn_ = torch.tanh(self.ff1(input_))\nattn...
<|body_start_0|> super().__init__() self.dropout_rate = dropout_rate self.device = device self.ff1 = torch.nn.Linear(input_size, hidden_size) self.ff2 = torch.nn.Linear(hidden_size, 1, bias=False) if dropout_rate is not None: self.model_drop = torch.nn.Dropout...
AttentionSelf
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttentionSelf: def __init__(self, input_size, hidden_size, dropout_rate=None, device=torch.device('cpu')): """implementation of self-attention.""" <|body_0|> def forward(self, input_, mask=None): """input vector: input_ output: attn_: attention weights ctx_vec: conte...
stack_v2_sparse_classes_36k_train_018845
1,556
permissive
[ { "docstring": "implementation of self-attention.", "name": "__init__", "signature": "def __init__(self, input_size, hidden_size, dropout_rate=None, device=torch.device('cpu'))" }, { "docstring": "input vector: input_ output: attn_: attention weights ctx_vec: context vector", "name": "forwar...
2
stack_v2_sparse_classes_30k_train_021194
Implement the Python class `AttentionSelf` described below. Class description: Implement the AttentionSelf class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, dropout_rate=None, device=torch.device('cpu')): implementation of self-attention. - def forward(self, input_, mask=None): in...
Implement the Python class `AttentionSelf` described below. Class description: Implement the AttentionSelf class. Method signatures and docstrings: - def __init__(self, input_size, hidden_size, dropout_rate=None, device=torch.device('cpu')): implementation of self-attention. - def forward(self, input_, mask=None): in...
4ca989e45c16aa39ea041c55a414ccd6917d940e
<|skeleton|> class AttentionSelf: def __init__(self, input_size, hidden_size, dropout_rate=None, device=torch.device('cpu')): """implementation of self-attention.""" <|body_0|> def forward(self, input_, mask=None): """input vector: input_ output: attn_: attention weights ctx_vec: conte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttentionSelf: def __init__(self, input_size, hidden_size, dropout_rate=None, device=torch.device('cpu')): """implementation of self-attention.""" super().__init__() self.dropout_rate = dropout_rate self.device = device self.ff1 = torch.nn.Linear(input_size, hidden_size...
the_stack_v2_python_sparse
LeafNATS/modules/attention/attention_self.py
tshi04/DMSC_FEDA
train
2
555c8a6f8091c7e47c2c87f6762c78fae3129f34
[ "super().__init__()\nif act == 'elu':\n act = nn.ELU\nelif act == 'relu':\n act = nn.ReLU\nelif act == 'prelu':\n act = nn.PReLU\nelif act == 'leakyrelu':\n act = nn.LeakyReLU\nelse:\n raise ValueError(f'Activation function {act} not supported. Please choose between ReLU, PReLU, LeakyReLU, ELU.')\nse...
<|body_start_0|> super().__init__() if act == 'elu': act = nn.ELU elif act == 'relu': act = nn.ReLU elif act == 'prelu': act = nn.PReLU elif act == 'leakyrelu': act = nn.LeakyReLU else: raise ValueError(f'Activat...
Implementation of the V-Net, as presented in Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. References ---------- .. Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation, 2016. https://arxiv.org/abs/1606.04797
VNet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VNet: """Implementation of the V-Net, as presented in Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. References ---------- .. Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation, 2016. https://arxiv.org/abs/...
stack_v2_sparse_classes_36k_train_018846
8,968
permissive
[ { "docstring": "Parameters ---------- in_chans : int Number of input channels. out_chans : int Number of output channels. act : nn.Module Activation function. drop_prob : float Dropout probability. bias : bool Whether to use bias.", "name": "__init__", "signature": "def __init__(self, in_chans: int=1, o...
2
stack_v2_sparse_classes_30k_train_015556
Implement the Python class `VNet` described below. Class description: Implementation of the V-Net, as presented in Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. References ---------- .. Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Seg...
Implement the Python class `VNet` described below. Class description: Implementation of the V-Net, as presented in Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. References ---------- .. Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Seg...
6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066
<|skeleton|> class VNet: """Implementation of the V-Net, as presented in Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. References ---------- .. Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation, 2016. https://arxiv.org/abs/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VNet: """Implementation of the V-Net, as presented in Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. References ---------- .. Fausto Milletari, Nassir Navab, Seyed-Ahmad Ahmadi. V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation, 2016. https://arxiv.org/abs/1606.04797"""...
the_stack_v2_python_sparse
mridc/collections/segmentation/models/vnet_base/vnet_block.py
wdika/mridc
train
40
a671de5e7d0773ccd423563a2673c2c94e89d840
[ "super(TaskFeeManager, self).__init__()\nself.getters.update({'task': 'get_foreign_key'})\nself.setters.update({'task': 'set_foreign_key'})\nself.my_django_model = facade.models.TaskFee", "if not optional_attributes:\n optional_attributes = dict()\nblame = facade.managers.BlameManager().create(auth_token)\ntas...
<|body_start_0|> super(TaskFeeManager, self).__init__() self.getters.update({'task': 'get_foreign_key'}) self.setters.update({'task': 'set_foreign_key'}) self.my_django_model = facade.models.TaskFee <|end_body_0|> <|body_start_1|> if not optional_attributes: optional...
Manage TaskFees in the Power Reg system
TaskFeeManager
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskFeeManager: """Manage TaskFees in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, sku, name, description, price, cost, task, optional_attributes=None): """Create a new TaskFee You should probably define 's...
stack_v2_sparse_classes_36k_train_018847
2,387
permissive
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create a new TaskFee You should probably define 'starting_quantity' in optional_attributes @param sku SKU, up to 32 characters @param name name of the Product, up to 127 characters @param descr...
2
null
Implement the Python class `TaskFeeManager` described below. Class description: Manage TaskFees in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, sku, name, description, price, cost, task, optional_attributes=None): Create a new TaskFee You shou...
Implement the Python class `TaskFeeManager` described below. Class description: Manage TaskFees in the Power Reg system Method signatures and docstrings: - def __init__(self): constructor - def create(self, auth_token, sku, name, description, price, cost, task, optional_attributes=None): Create a new TaskFee You shou...
a59457bc37f0501aea1f54d006a6de94ff80511c
<|skeleton|> class TaskFeeManager: """Manage TaskFees in the Power Reg system""" def __init__(self): """constructor""" <|body_0|> def create(self, auth_token, sku, name, description, price, cost, task, optional_attributes=None): """Create a new TaskFee You should probably define 's...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskFeeManager: """Manage TaskFees in the Power Reg system""" def __init__(self): """constructor""" super(TaskFeeManager, self).__init__() self.getters.update({'task': 'get_foreign_key'}) self.setters.update({'task': 'set_foreign_key'}) self.my_django_model = facad...
the_stack_v2_python_sparse
pr_services/event_system/task_fee_manager.py
ninemoreminutes/openassign-server
train
0
6e734dffea1543a81c128d2bfa03d811d700da8f
[ "print(exp_str)\nexp_split = exp_str.replace(' ', '')\nparent_stack = stack.Stack()\nexp_binary_tree = binary_tree_link.BinaryTree('')\nparent_stack.push(exp_binary_tree)\ncurrent_tree = exp_binary_tree\nfor s in exp_split:\n if s == '(':\n current_tree.insertLeft('')\n parent_stack.push(current_tr...
<|body_start_0|> print(exp_str) exp_split = exp_str.replace(' ', '') parent_stack = stack.Stack() exp_binary_tree = binary_tree_link.BinaryTree('') parent_stack.push(exp_binary_tree) current_tree = exp_binary_tree for s in exp_split: if s == '(': ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def expParseTree(self, exp_str): """将字符串表达式,转换为表达式解析树 :param exp_str: 字符串表达式 :return: 表达式解析树""" <|body_0|> def expEval(self, exp_binary_tree): """使用递归算法来求算数表达式 其实该过程是树的后序遍历 :param exp_binary_tree: 表达式解析树 :return:""" <|body_1|> def mathFunction(...
stack_v2_sparse_classes_36k_train_018848
3,654
no_license
[ { "docstring": "将字符串表达式,转换为表达式解析树 :param exp_str: 字符串表达式 :return: 表达式解析树", "name": "expParseTree", "signature": "def expParseTree(self, exp_str)" }, { "docstring": "使用递归算法来求算数表达式 其实该过程是树的后序遍历 :param exp_binary_tree: 表达式解析树 :return:", "name": "expEval", "signature": "def expEval(self, exp...
4
stack_v2_sparse_classes_30k_train_006997
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def expParseTree(self, exp_str): 将字符串表达式,转换为表达式解析树 :param exp_str: 字符串表达式 :return: 表达式解析树 - def expEval(self, exp_binary_tree): 使用递归算法来求算数表达式 其实该过程是树的后序遍历 :param exp_binary_tree:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def expParseTree(self, exp_str): 将字符串表达式,转换为表达式解析树 :param exp_str: 字符串表达式 :return: 表达式解析树 - def expEval(self, exp_binary_tree): 使用递归算法来求算数表达式 其实该过程是树的后序遍历 :param exp_binary_tree:...
97cc61fefe0bedf5161687aab92fb09b0df990e2
<|skeleton|> class Solution: def expParseTree(self, exp_str): """将字符串表达式,转换为表达式解析树 :param exp_str: 字符串表达式 :return: 表达式解析树""" <|body_0|> def expEval(self, exp_binary_tree): """使用递归算法来求算数表达式 其实该过程是树的后序遍历 :param exp_binary_tree: 表达式解析树 :return:""" <|body_1|> def mathFunction(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def expParseTree(self, exp_str): """将字符串表达式,转换为表达式解析树 :param exp_str: 字符串表达式 :return: 表达式解析树""" print(exp_str) exp_split = exp_str.replace(' ', '') parent_stack = stack.Stack() exp_binary_tree = binary_tree_link.BinaryTree('') parent_stack.push(exp_bin...
the_stack_v2_python_sparse
code/tree/expTreeEval.py
JiaXingBinggan/For_work
train
0
0e3cf994647639950a90ba77d55f474b43a9231e
[ "new_date = fields.datetime.today()\nif self.date < new_date:\n raise ValidationError(_('Configure expiry date greater than current date!'))", "emp_obj = self.env['hr.employee']\nobj_mail_server = self.env['ir.mail_server']\nuser = self.env.user\nmail_server_record = obj_mail_server.search([], limit=1)\nif not...
<|body_start_0|> new_date = fields.datetime.today() if self.date < new_date: raise ValidationError(_('Configure expiry date greater than current date!')) <|end_body_0|> <|body_start_1|> emp_obj = self.env['hr.employee'] obj_mail_server = self.env['ir.mail_server'] us...
Defining studen news.
StudentNews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentNews: """Defining studen news.""" def checknews_dates(self): """Check news date.""" <|body_0|> def news_update(self): """Method to send email to student for news update""" <|body_1|> <|end_skeleton|> <|body_start_0|> new_date = fields.dat...
stack_v2_sparse_classes_36k_train_018849
38,006
no_license
[ { "docstring": "Check news date.", "name": "checknews_dates", "signature": "def checknews_dates(self)" }, { "docstring": "Method to send email to student for news update", "name": "news_update", "signature": "def news_update(self)" } ]
2
stack_v2_sparse_classes_30k_train_015741
Implement the Python class `StudentNews` described below. Class description: Defining studen news. Method signatures and docstrings: - def checknews_dates(self): Check news date. - def news_update(self): Method to send email to student for news update
Implement the Python class `StudentNews` described below. Class description: Defining studen news. Method signatures and docstrings: - def checknews_dates(self): Check news date. - def news_update(self): Method to send email to student for news update <|skeleton|> class StudentNews: """Defining studen news.""" ...
6a9793f3a15da9eed40bf840b1d9a46457c5fd55
<|skeleton|> class StudentNews: """Defining studen news.""" def checknews_dates(self): """Check news date.""" <|body_0|> def news_update(self): """Method to send email to student for news update""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudentNews: """Defining studen news.""" def checknews_dates(self): """Check news date.""" new_date = fields.datetime.today() if self.date < new_date: raise ValidationError(_('Configure expiry date greater than current date!')) def news_update(self): """Me...
the_stack_v2_python_sparse
school/models/school.py
JayVora-SerpentCS/OdooEduERP
train
121
e7e56ff625331276f7cf4837fcff84b785f35e08
[ "super(statement, self).__init__(*args, **kwargs)\nself.id = msg.statement_id\nself.local_account = msg.local_account\ntry:\n self.date = str2date(msg.date, '%Y%m%d')\nexcept ValueError:\n self.date = str2date(msg.date, '%d-%m-%Y')\nself.start_balance = self.end_balance = 0\nself.import_transaction(msg)", "...
<|body_start_0|> super(statement, self).__init__(*args, **kwargs) self.id = msg.statement_id self.local_account = msg.local_account try: self.date = str2date(msg.date, '%Y%m%d') except ValueError: self.date = str2date(msg.date, '%d-%m-%Y') self.sta...
Implementation of bank_statement communication class of account_banking
statement
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class statement: """Implementation of bank_statement communication class of account_banking""" def __init__(self, msg, *args, **kwargs): """Set decent start values based on first transaction read""" <|body_0|> def import_transaction(self, msg): """Import a transaction ...
stack_v2_sparse_classes_36k_train_018850
11,174
no_license
[ { "docstring": "Set decent start values based on first transaction read", "name": "__init__", "signature": "def __init__(self, msg, *args, **kwargs)" }, { "docstring": "Import a transaction and keep some house holding in the mean time.", "name": "import_transaction", "signature": "def im...
2
stack_v2_sparse_classes_30k_train_020360
Implement the Python class `statement` described below. Class description: Implementation of bank_statement communication class of account_banking Method signatures and docstrings: - def __init__(self, msg, *args, **kwargs): Set decent start values based on first transaction read - def import_transaction(self, msg): ...
Implement the Python class `statement` described below. Class description: Implementation of bank_statement communication class of account_banking Method signatures and docstrings: - def __init__(self, msg, *args, **kwargs): Set decent start values based on first transaction read - def import_transaction(self, msg): ...
4efe5e48b1c995589c5f890b4ff6ad02b1eb84bd
<|skeleton|> class statement: """Implementation of bank_statement communication class of account_banking""" def __init__(self, msg, *args, **kwargs): """Set decent start values based on first transaction read""" <|body_0|> def import_transaction(self, msg): """Import a transaction ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class statement: """Implementation of bank_statement communication class of account_banking""" def __init__(self, msg, *args, **kwargs): """Set decent start values based on first transaction read""" super(statement, self).__init__(*args, **kwargs) self.id = msg.statement_id self...
the_stack_v2_python_sparse
account_banking_nl_ing/ing.py
credativUK/banking
train
0
c8ad25722d90594c3f25fae85e4407e2b8a6f8a4
[ "path = Path(utils.extract_tarbytes(file_bytes, path))\noutput = next(path.iterdir())\nreturn output", "if not utils.is_url(location):\n logger.debug(f'{self}: {location} not viable, skipping...')\n return location\ntmp_dir = tempfile.mkdtemp()\ntmp_path = Path(tmp_dir)\nfilename = utils.get_url_filename(lo...
<|body_start_0|> path = Path(utils.extract_tarbytes(file_bytes, path)) output = next(path.iterdir()) return output <|end_body_0|> <|body_start_1|> if not utils.is_url(location): logger.debug(f'{self}: {location} not viable, skipping...') return location t...
Stub Source for remote locations.
RemoteStubLocator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteStubLocator: """Stub Source for remote locations.""" def _unpack_archive(self, file_bytes: bytes, path: PathStr) -> PathStr: """Unpack archive from bytes buffer. Args: file_bytes (bytes): Byte array to extract from Must be from tarfile with gzip compression path (str): path to ...
stack_v2_sparse_classes_36k_train_018851
4,965
permissive
[ { "docstring": "Unpack archive from bytes buffer. Args: file_bytes (bytes): Byte array to extract from Must be from tarfile with gzip compression path (str): path to extract file to Returns: path: path extracted to", "name": "_unpack_archive", "signature": "def _unpack_archive(self, file_bytes: bytes, p...
2
stack_v2_sparse_classes_30k_train_010470
Implement the Python class `RemoteStubLocator` described below. Class description: Stub Source for remote locations. Method signatures and docstrings: - def _unpack_archive(self, file_bytes: bytes, path: PathStr) -> PathStr: Unpack archive from bytes buffer. Args: file_bytes (bytes): Byte array to extract from Must b...
Implement the Python class `RemoteStubLocator` described below. Class description: Stub Source for remote locations. Method signatures and docstrings: - def _unpack_archive(self, file_bytes: bytes, path: PathStr) -> PathStr: Unpack archive from bytes buffer. Args: file_bytes (bytes): Byte array to extract from Must b...
7223ea77b2a93241e4bc0bce16d0c11c37f1f678
<|skeleton|> class RemoteStubLocator: """Stub Source for remote locations.""" def _unpack_archive(self, file_bytes: bytes, path: PathStr) -> PathStr: """Unpack archive from bytes buffer. Args: file_bytes (bytes): Byte array to extract from Must be from tarfile with gzip compression path (str): path to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoteStubLocator: """Stub Source for remote locations.""" def _unpack_archive(self, file_bytes: bytes, path: PathStr) -> PathStr: """Unpack archive from bytes buffer. Args: file_bytes (bytes): Byte array to extract from Must be from tarfile with gzip compression path (str): path to extract file ...
the_stack_v2_python_sparse
micropy/stubs/source.py
BradenM/micropy-cli
train
292
be34b186c58ee1577f9f128215912b5341cb647d
[ "if browser is None:\n new_browser = webdriver.Firefox()\nelse:\n new_browser = browser\nnew_browser.get(self.url_homepage)\ntime.sleep(1)\ntarget = new_browser.find_element_by_xpath('/html/body/div[2]/div[1]/div/div/form/input[1]')\ntarget.clear()\ntarget.send_keys('%s' % name)\ntime.sleep(1)\nurl = ''\nstyl...
<|body_start_0|> if browser is None: new_browser = webdriver.Firefox() else: new_browser = browser new_browser.get(self.url_homepage) time.sleep(1) target = new_browser.find_element_by_xpath('/html/body/div[2]/div[1]/div/div/form/input[1]') target....
采集腾讯视频指数模块
Tencent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tencent: """采集腾讯视频指数模块""" def get_url_from_name(self, name, browser=None, DEBUG=False): """获取搜索内容为name的腾讯视频指数地址""" <|body_0|> def get_play_time_and_order(self, url, browser=None, DEBUG=False): """获取播放次数和排名""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_018852
2,393
no_license
[ { "docstring": "获取搜索内容为name的腾讯视频指数地址", "name": "get_url_from_name", "signature": "def get_url_from_name(self, name, browser=None, DEBUG=False)" }, { "docstring": "获取播放次数和排名", "name": "get_play_time_and_order", "signature": "def get_play_time_and_order(self, url, browser=None, DEBUG=False...
2
stack_v2_sparse_classes_30k_train_004491
Implement the Python class `Tencent` described below. Class description: 采集腾讯视频指数模块 Method signatures and docstrings: - def get_url_from_name(self, name, browser=None, DEBUG=False): 获取搜索内容为name的腾讯视频指数地址 - def get_play_time_and_order(self, url, browser=None, DEBUG=False): 获取播放次数和排名
Implement the Python class `Tencent` described below. Class description: 采集腾讯视频指数模块 Method signatures and docstrings: - def get_url_from_name(self, name, browser=None, DEBUG=False): 获取搜索内容为name的腾讯视频指数地址 - def get_play_time_and_order(self, url, browser=None, DEBUG=False): 获取播放次数和排名 <|skeleton|> class Tencent: """...
113136256d448e635227b16259eb237dd8617b78
<|skeleton|> class Tencent: """采集腾讯视频指数模块""" def get_url_from_name(self, name, browser=None, DEBUG=False): """获取搜索内容为name的腾讯视频指数地址""" <|body_0|> def get_play_time_and_order(self, url, browser=None, DEBUG=False): """获取播放次数和排名""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tencent: """采集腾讯视频指数模块""" def get_url_from_name(self, name, browser=None, DEBUG=False): """获取搜索内容为name的腾讯视频指数地址""" if browser is None: new_browser = webdriver.Firefox() else: new_browser = browser new_browser.get(self.url_homepage) time.slee...
the_stack_v2_python_sparse
GetAllOrder2/my project/Tencent.py
chenjiahustc/workspace
train
0
af3322ad957a08f4130ddcb02cf4667c40221731
[ "def dp(lo, hi, memo):\n if lo >= hi:\n return 0\n if (lo, hi) not in memo:\n ans = float('inf')\n for x in range(lo, hi + 1):\n ans = min(ans, x + max(dp(lo, x - 1, memo), dp(x + 1, hi, memo)))\n memo[lo, hi] = ans\n return memo[lo, hi]\nreturn dp(1, n, {})", "dp =...
<|body_start_0|> def dp(lo, hi, memo): if lo >= hi: return 0 if (lo, hi) not in memo: ans = float('inf') for x in range(lo, hi + 1): ans = min(ans, x + max(dp(lo, x - 1, memo), dp(x + 1, hi, memo))) memo[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getMoneyAmount(self, n: int) -> int: """intuition: we want to find out the minimum cost to gurantee a win. Initially we only know that the secret number is within 1 to n; as we progress in the game, the lower and higher bound of the secrete number is getting smaller and sma...
stack_v2_sparse_classes_36k_train_018853
3,662
no_license
[ { "docstring": "intuition: we want to find out the minimum cost to gurantee a win. Initially we only know that the secret number is within 1 to n; as we progress in the game, the lower and higher bound of the secrete number is getting smaller and smaller. Without lose generality, let's assume we want to find th...
2
stack_v2_sparse_classes_30k_train_009939
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMoneyAmount(self, n: int) -> int: intuition: we want to find out the minimum cost to gurantee a win. Initially we only know that the secret number is within 1 to n; as we ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getMoneyAmount(self, n: int) -> int: intuition: we want to find out the minimum cost to gurantee a win. Initially we only know that the secret number is within 1 to n; as we ...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def getMoneyAmount(self, n: int) -> int: """intuition: we want to find out the minimum cost to gurantee a win. Initially we only know that the secret number is within 1 to n; as we progress in the game, the lower and higher bound of the secrete number is getting smaller and sma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getMoneyAmount(self, n: int) -> int: """intuition: we want to find out the minimum cost to gurantee a win. Initially we only know that the secret number is within 1 to n; as we progress in the game, the lower and higher bound of the secrete number is getting smaller and smaller. Without ...
the_stack_v2_python_sparse
Leetcode 0375. Guess Number Higher or Lower II.py
Chaoran-sjsu/leetcode
train
0
2bc532086adf661bb286f7ea080cf6021e120ad0
[ "if not self.versions:\n return ''\nif language is None:\n try:\n language = c.lang\n except AttributeError:\n pass\nversion = self.get_version(language)\nif version is not None:\n return version.text\nversion = self.get_version(fallback)\nif version is not None:\n return version.text\n...
<|body_start_0|> if not self.versions: return '' if language is None: try: language = c.lang except AttributeError: pass version = self.get_version(language) if version is not None: return version.text ...
I18nText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I18nText: def get_text(self, language=None, fallback='en'): """Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.""" <|body_0|> def se...
stack_v2_sparse_classes_36k_train_018854
5,283
no_license
[ { "docstring": "Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.", "name": "get_text", "signature": "def get_text(self, language=None, fallback='en')" }, { ...
3
stack_v2_sparse_classes_30k_test_000013
Implement the Python class `I18nText` described below. Class description: Implement the I18nText class. Method signatures and docstrings: - def get_text(self, language=None, fallback='en'): Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language ...
Implement the Python class `I18nText` described below. Class description: Implement the I18nText class. Method signatures and docstrings: - def get_text(self, language=None, fallback='en'): Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language ...
e1f55f155761d7b350893fc0badb70c9c51c4b2f
<|skeleton|> class I18nText: def get_text(self, language=None, fallback='en'): """Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.""" <|body_0|> def se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class I18nText: def get_text(self, language=None, fallback='en'): """Get a text for a given language. If no language is specified, attempts to get it from context. Falls back to the given language or any other version. Returns empty string if no text is found.""" if not self.versions: re...
the_stack_v2_python_sparse
src/ututi/model/i18n.py
Ututi/ututi
train
0
4aef7d4115461f1d7ed065a0b8953108325a854d
[ "try:\n r = ResumableFile(self.request.GET, self.request.user)\n logger.debug('[GET] Resumable Upload file_name %s part_num %d' % (r.filename, r.part_num))\n if r.is_exist:\n logger.debug('[POST] file have exist')\n dict_resp = upload_complete(self.request.user, r.filename, r.src_filename, r....
<|body_start_0|> try: r = ResumableFile(self.request.GET, self.request.user) logger.debug('[GET] Resumable Upload file_name %s part_num %d' % (r.filename, r.part_num)) if r.is_exist: logger.debug('[POST] file have exist') dict_resp = upload_com...
ResumableUploadView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResumableUploadView: def get(self, *args, **kwargs): """Checks if chunk has allready been sended.""" <|body_0|> def post(self, *args, **kwargs): """Saves chunks.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: r = ResumableFile(self...
stack_v2_sparse_classes_36k_train_018855
4,314
no_license
[ { "docstring": "Checks if chunk has allready been sended.", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "Saves chunks.", "name": "post", "signature": "def post(self, *args, **kwargs)" } ]
2
null
Implement the Python class `ResumableUploadView` described below. Class description: Implement the ResumableUploadView class. Method signatures and docstrings: - def get(self, *args, **kwargs): Checks if chunk has allready been sended. - def post(self, *args, **kwargs): Saves chunks.
Implement the Python class `ResumableUploadView` described below. Class description: Implement the ResumableUploadView class. Method signatures and docstrings: - def get(self, *args, **kwargs): Checks if chunk has allready been sended. - def post(self, *args, **kwargs): Saves chunks. <|skeleton|> class ResumableUplo...
2ab79517f98de8183ff70faf33ede578986a173f
<|skeleton|> class ResumableUploadView: def get(self, *args, **kwargs): """Checks if chunk has allready been sended.""" <|body_0|> def post(self, *args, **kwargs): """Saves chunks.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResumableUploadView: def get(self, *args, **kwargs): """Checks if chunk has allready been sended.""" try: r = ResumableFile(self.request.GET, self.request.user) logger.debug('[GET] Resumable Upload file_name %s part_num %d' % (r.filename, r.part_num)) if r.i...
the_stack_v2_python_sparse
applications/upload_resumable/views.py
zptime/competition
train
0
eb8198f62e75890c7d3e745ec5a67b0990dffe56
[ "self._env = env\nself._text = text\nself._filename = filename\nself._defines = {}\nself._private = {}\nparser = TemplateParser(self, text)\nself._nodes = parser.parse()", "env = self._env\nscope = env._push_scope(True)\ntry:\n if not context is None:\n scope._local.update(context)\n scope._template[...
<|body_start_0|> self._env = env self._text = text self._filename = filename self._defines = {} self._private = {} parser = TemplateParser(self, text) self._nodes = parser.parse() <|end_body_0|> <|body_start_1|> env = self._env scope = env._push_s...
Simple template parser and renderer. Extended variable access: {{ expression }} For example: {{ value.subvalue }} {{ value.subvalue | upper }} Loops: {% for var in list %} {% endfor %} Conditions: {% if var %} {% elif var %} {% else %} {% endif %} Comments: {# This is a commend. #} Whitespace control. A "-" after an op...
Template
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Template: """Simple template parser and renderer. Extended variable access: {{ expression }} For example: {{ value.subvalue }} {{ value.subvalue | upper }} Loops: {% for var in list %} {% endfor %} Conditions: {% if var %} {% elif var %} {% else %} {% endif %} Comments: {# This is a commend. #} W...
stack_v2_sparse_classes_36k_train_018856
1,845
permissive
[ { "docstring": "Initialize a template with context variables.", "name": "__init__", "signature": "def __init__(self, env, text, filename)" }, { "docstring": "Render the template.", "name": "render", "signature": "def render(self, renderer, context=None, retvar=None)" } ]
2
stack_v2_sparse_classes_30k_train_008712
Implement the Python class `Template` described below. Class description: Simple template parser and renderer. Extended variable access: {{ expression }} For example: {{ value.subvalue }} {{ value.subvalue | upper }} Loops: {% for var in list %} {% endfor %} Conditions: {% if var %} {% elif var %} {% else %} {% endif ...
Implement the Python class `Template` described below. Class description: Simple template parser and renderer. Extended variable access: {{ expression }} For example: {{ value.subvalue }} {{ value.subvalue | upper }} Loops: {% for var in list %} {% endfor %} Conditions: {% if var %} {% elif var %} {% else %} {% endif ...
6aeee9b229d3f62aace98a51d9014781bbe6cb52
<|skeleton|> class Template: """Simple template parser and renderer. Extended variable access: {{ expression }} For example: {{ value.subvalue }} {{ value.subvalue | upper }} Loops: {% for var in list %} {% endfor %} Conditions: {% if var %} {% elif var %} {% else %} {% endif %} Comments: {# This is a commend. #} W...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Template: """Simple template parser and renderer. Extended variable access: {{ expression }} For example: {{ value.subvalue }} {{ value.subvalue | upper }} Loops: {% for var in list %} {% endfor %} Conditions: {% if var %} {% elif var %} {% else %} {% endif %} Comments: {# This is a commend. #} Whitespace con...
the_stack_v2_python_sparse
mrbaviirc/template/template.py
brianvanderburg2/mrbaviirc
train
0
8c95cc508bb0943266b64ece7f74f865e20c2a42
[ "self.assertTrue(type(self.s.c) is list)\nself.assertTrue(type(self.s.c[1]) is dict)\nself.assertTrue(type(self.p.c) is list)\nself.assertTrue(type(self.p.c[1]) is dict)\nself.assertTrue(type(self.p.m['k'][1][2]) is float)", "Z_0 = numpy.array([0.3, 0.2])\nX_eq, g_eq, phase_eq = phase_equilibrium_calculation(self...
<|body_start_0|> self.assertTrue(type(self.s.c) is list) self.assertTrue(type(self.s.c[1]) is dict) self.assertTrue(type(self.p.c) is list) self.assertTrue(type(self.p.c[1]) is dict) self.assertTrue(type(self.p.m['k'][1][2]) is float) <|end_body_0|> <|body_start_1|> Z_0 ...
Test ncomp functions
TestNcompFuncsTern
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNcompFuncsTern: """Test ncomp functions""" def test_t1(self): """State and data class definition""" <|body_0|> def test_t2(self): """Equil. Mitsos et al. (2007) test 2 tern""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.assertTrue(type...
stack_v2_sparse_classes_36k_train_018857
14,154
no_license
[ { "docstring": "State and data class definition", "name": "test_t1", "signature": "def test_t1(self)" }, { "docstring": "Equil. Mitsos et al. (2007) test 2 tern", "name": "test_t2", "signature": "def test_t2(self)" } ]
2
stack_v2_sparse_classes_30k_train_017188
Implement the Python class `TestNcompFuncsTern` described below. Class description: Test ncomp functions Method signatures and docstrings: - def test_t1(self): State and data class definition - def test_t2(self): Equil. Mitsos et al. (2007) test 2 tern
Implement the Python class `TestNcompFuncsTern` described below. Class description: Test ncomp functions Method signatures and docstrings: - def test_t1(self): State and data class definition - def test_t2(self): Equil. Mitsos et al. (2007) test 2 tern <|skeleton|> class TestNcompFuncsTern: """Test ncomp functio...
91ae76ae50cb46530545b69beaf0fbb4e20450fc
<|skeleton|> class TestNcompFuncsTern: """Test ncomp functions""" def test_t1(self): """State and data class definition""" <|body_0|> def test_t2(self): """Equil. Mitsos et al. (2007) test 2 tern""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNcompFuncsTern: """Test ncomp functions""" def test_t1(self): """State and data class definition""" self.assertTrue(type(self.s.c) is list) self.assertTrue(type(self.s.c[1]) is dict) self.assertTrue(type(self.p.c) is list) self.assertTrue(type(self.p.c[1]) is d...
the_stack_v2_python_sparse
ncomp_tests.py
Stefan-Endres/DWPM-Mixture-Model
train
5
188bb051c5b2ebdc2faba23f5ddf63ff2a856ed8
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing Cache Service resources.
CacheServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacheServiceServicer: """A set of methods for managing Cache Service resources.""" def Purge(self, request, context): """Removes specified files from the cache of the specified resource. For details about purging, see [documentation](/docs/cdn/concepts/caching#purge). Purging may tak...
stack_v2_sparse_classes_36k_train_018858
4,863
permissive
[ { "docstring": "Removes specified files from the cache of the specified resource. For details about purging, see [documentation](/docs/cdn/concepts/caching#purge). Purging may take up to 15 minutes.", "name": "Purge", "signature": "def Purge(self, request, context)" }, { "docstring": "Uploads sp...
2
null
Implement the Python class `CacheServiceServicer` described below. Class description: A set of methods for managing Cache Service resources. Method signatures and docstrings: - def Purge(self, request, context): Removes specified files from the cache of the specified resource. For details about purging, see [document...
Implement the Python class `CacheServiceServicer` described below. Class description: A set of methods for managing Cache Service resources. Method signatures and docstrings: - def Purge(self, request, context): Removes specified files from the cache of the specified resource. For details about purging, see [document...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class CacheServiceServicer: """A set of methods for managing Cache Service resources.""" def Purge(self, request, context): """Removes specified files from the cache of the specified resource. For details about purging, see [documentation](/docs/cdn/concepts/caching#purge). Purging may tak...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CacheServiceServicer: """A set of methods for managing Cache Service resources.""" def Purge(self, request, context): """Removes specified files from the cache of the specified resource. For details about purging, see [documentation](/docs/cdn/concepts/caching#purge). Purging may take up to 15 mi...
the_stack_v2_python_sparse
yandex/cloud/cdn/v1/cache_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
c3fd0c2b8cda7614eb66345f4411756675d544bb
[ "if len(ransomNote) > len(magazine):\n return False\nif not ransomNote:\n return True\ndic = defaultdict(int)\nfor i in ransomNote:\n dic[i] += 1\nfor k in dic.keys():\n if magazine.count(k) < dic[k]:\n return False\nreturn True", "a = dict(collections.Counter(ransomNote))\nfor k, v in a.items(...
<|body_start_0|> if len(ransomNote) > len(magazine): return False if not ransomNote: return True dic = defaultdict(int) for i in ransomNote: dic[i] += 1 for k in dic.keys(): if magazine.count(k) < dic[k]: return Fals...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_018859
869
no_license
[ { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct", "signature": "def canConstruct(self, ransomNote, magazine)" }, { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct", "signature": "def canConstruct(...
2
stack_v2_sparse_classes_30k_train_000398
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type m...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct(self, ransomNote, magazine): :type ransomNote: str :type m...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canConstruct(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" if len(ransomNote) > len(magazine): return False if not ransomNote: return True dic = defaultdict(int) for i in ransomNote: ...
the_stack_v2_python_sparse
0383_Ransom_Note.py
bingli8802/leetcode
train
0
b7680f91ee08ad2511d800185003dd2aa1478200
[ "if not strs:\n return ''\nidx = 0\nfor chars in zip(*strs):\n if len(set(chars)) != 1:\n return strs[0][:idx]\n idx += 1\nreturn strs[0][:idx]", "ret = ''\nfor chars in zip(*strs):\n if len(set(chars)) == 1:\n ret += chars[0]\n else:\n return ret\nreturn ret", "if not strs:\...
<|body_start_0|> if not strs: return '' idx = 0 for chars in zip(*strs): if len(set(chars)) != 1: return strs[0][:idx] idx += 1 return strs[0][:idx] <|end_body_0|> <|body_start_1|> ret = '' for chars in zip(*strs): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefixMe(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> def longestCommonPrefixOld(self, strs): """:type strs: Lis...
stack_v2_sparse_classes_36k_train_018860
1,218
no_license
[ { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefix", "signature": "def longestCommonPrefix(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: str", "name": "longestCommonPrefixMe", "signature": "def longestCommonPrefixMe(self, strs)" }, { ...
3
stack_v2_sparse_classes_30k_train_016718
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefixMe(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefixOld(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefixMe(self, strs): :type strs: List[str] :rtype: str - def longestCommonPrefixOld(sel...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" <|body_0|> def longestCommonPrefixMe(self, strs): """:type strs: List[str] :rtype: str""" <|body_1|> def longestCommonPrefixOld(self, strs): """:type strs: Lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestCommonPrefix(self, strs): """:type strs: List[str] :rtype: str""" if not strs: return '' idx = 0 for chars in zip(*strs): if len(set(chars)) != 1: return strs[0][:idx] idx += 1 return strs[0][:idx]...
the_stack_v2_python_sparse
cs_notes/string/longest_common_prefix.py
hwc1824/LeetCodeSolution
train
0
90315a0baf1c422e9797f94c4e0ed8ffed50c51d
[ "if not intervals:\n return []\nintervals.sort(key=lambda x: x.start)\noutput = []\ncurrent_interval = Interval(intervals[0].start, intervals[0].end)\nfor interval in intervals[1:]:\n if interval.start > current_interval.end:\n output.append(current_interval)\n current_interval = Interval(interv...
<|body_start_0|> if not intervals: return [] intervals.sort(key=lambda x: x.start) output = [] current_interval = Interval(intervals[0].start, intervals[0].end) for interval in intervals[1:]: if interval.start > current_interval.end: output...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_0|> def merge_verbose(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_018861
2,933
no_license
[ { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge", "signature": "def merge(self, intervals)" }, { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge_verbose", "signature": "def merge_verbose(self, intervals)" } ]
2
stack_v2_sparse_classes_30k_train_001965
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] - def merge_verbose(self, intervals): :type intervals: List[Interval] :rtype: List[Interval]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] - def merge_verbose(self, intervals): :type intervals: List[Interval] :rtype: List[Interval] <...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_0|> def merge_verbose(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" if not intervals: return [] intervals.sort(key=lambda x: x.start) output = [] current_interval = Interval(intervals[0].start, intervals[0].end) for int...
the_stack_v2_python_sparse
src/lt_56.py
oxhead/CodingYourWay
train
0
633424fd027137cd23d1f404febdc743bb0b682e
[ "super(SPP, self).__init__()\nac_type = cfg.SPP.ACTIVATION_FN\nself.conv1 = ConvBnActivation(1024, 512, 1, 1, 0, ac_type)\nself.conv2 = ConvBnActivation(512, 1024, 3, 1, 1, ac_type)\nself.conv3 = ConvBnActivation(1024, 512, 1, 1, 0, ac_type)\nself.pool1 = nn.MaxPool2d(kernel_size=5, stride=1, padding=2)\nself.pool2...
<|body_start_0|> super(SPP, self).__init__() ac_type = cfg.SPP.ACTIVATION_FN self.conv1 = ConvBnActivation(1024, 512, 1, 1, 0, ac_type) self.conv2 = ConvBnActivation(512, 1024, 3, 1, 1, ac_type) self.conv3 = ConvBnActivation(1024, 512, 1, 1, 0, ac_type) self.pool1 = nn.Ma...
空间金字塔池化
SPP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SPP: """空间金字塔池化""" def __init__(self, cfg): """Args: cfg: 配置文件""" <|body_0|> def forward(self, x1, x2, x3): """对尺寸最低的features进行三次池化, 对池化结果进行concat""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(SPP, self).__init__() ac_type = cfg....
stack_v2_sparse_classes_36k_train_018862
1,412
no_license
[ { "docstring": "Args: cfg: 配置文件", "name": "__init__", "signature": "def __init__(self, cfg)" }, { "docstring": "对尺寸最低的features进行三次池化, 对池化结果进行concat", "name": "forward", "signature": "def forward(self, x1, x2, x3)" } ]
2
stack_v2_sparse_classes_30k_train_012185
Implement the Python class `SPP` described below. Class description: 空间金字塔池化 Method signatures and docstrings: - def __init__(self, cfg): Args: cfg: 配置文件 - def forward(self, x1, x2, x3): 对尺寸最低的features进行三次池化, 对池化结果进行concat
Implement the Python class `SPP` described below. Class description: 空间金字塔池化 Method signatures and docstrings: - def __init__(self, cfg): Args: cfg: 配置文件 - def forward(self, x1, x2, x3): 对尺寸最低的features进行三次池化, 对池化结果进行concat <|skeleton|> class SPP: """空间金字塔池化""" def __init__(self, cfg): """Args: cfg: ...
b28636c6b13466049d1b21234e21781129c5f7a2
<|skeleton|> class SPP: """空间金字塔池化""" def __init__(self, cfg): """Args: cfg: 配置文件""" <|body_0|> def forward(self, x1, x2, x3): """对尺寸最低的features进行三次池化, 对池化结果进行concat""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SPP: """空间金字塔池化""" def __init__(self, cfg): """Args: cfg: 配置文件""" super(SPP, self).__init__() ac_type = cfg.SPP.ACTIVATION_FN self.conv1 = ConvBnActivation(1024, 512, 1, 1, 0, ac_type) self.conv2 = ConvBnActivation(512, 1024, 3, 1, 1, ac_type) self.conv3 = ...
the_stack_v2_python_sparse
yolo/neck/spp.py
YohannXu/pytorch_yolov4
train
1
ecbbbbc5678abdd8e0bad3100db233323baa7561
[ "rows, cols = (len(matrix), len(matrix[0]))\ndp = [[0 for j in range(cols)] for i in range(rows)]\ndp[0][0] = matrix[0][0]\nfor j in range(1, cols):\n dp[0][j] = dp[0][j - 1] + matrix[0][j]\nfor i in range(1, rows):\n dp[i][0] = dp[i][0] + matrix[i][0]\nfor i in range(1, rows):\n for j in range(1, cols):\n...
<|body_start_0|> rows, cols = (len(matrix), len(matrix[0])) dp = [[0 for j in range(cols)] for i in range(rows)] dp[0][0] = matrix[0][0] for j in range(1, cols): dp[0][j] = dp[0][j - 1] + matrix[0][j] for i in range(1, rows): dp[i][0] = dp[i][0] + matrix[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, matrix): """动态规划:自顶向下,建立二维矩阵""" <|body_0|> def minPathSum2(self, matrix): """动态规划:自顶向下,建立一维矩阵——节省内存消耗""" <|body_1|> <|end_skeleton|> <|body_start_0|> rows, cols = (len(matrix), len(matrix[0])) dp = [[0 for j in...
stack_v2_sparse_classes_36k_train_018863
2,507
no_license
[ { "docstring": "动态规划:自顶向下,建立二维矩阵", "name": "minPathSum", "signature": "def minPathSum(self, matrix)" }, { "docstring": "动态规划:自顶向下,建立一维矩阵——节省内存消耗", "name": "minPathSum2", "signature": "def minPathSum2(self, matrix)" } ]
2
stack_v2_sparse_classes_30k_train_000366
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, matrix): 动态规划:自顶向下,建立二维矩阵 - def minPathSum2(self, matrix): 动态规划:自顶向下,建立一维矩阵——节省内存消耗
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, matrix): 动态规划:自顶向下,建立二维矩阵 - def minPathSum2(self, matrix): 动态规划:自顶向下,建立一维矩阵——节省内存消耗 <|skeleton|> class Solution: def minPathSum(self, matrix): ...
4e4f739402b95691f6c91411da26d7d3bfe042b6
<|skeleton|> class Solution: def minPathSum(self, matrix): """动态规划:自顶向下,建立二维矩阵""" <|body_0|> def minPathSum2(self, matrix): """动态规划:自顶向下,建立一维矩阵——节省内存消耗""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minPathSum(self, matrix): """动态规划:自顶向下,建立二维矩阵""" rows, cols = (len(matrix), len(matrix[0])) dp = [[0 for j in range(cols)] for i in range(rows)] dp[0][0] = matrix[0][0] for j in range(1, cols): dp[0][j] = dp[0][j - 1] + matrix[0][j] for...
the_stack_v2_python_sparse
leetcode/64.最短路径和.py
hugechuanqi/Algorithms-and-Data-Structures
train
3
e78985733443a28033ee1b07d656ca07809b5506
[ "train_indices = np.where(train_mask)[0]\ntest_indices = np.where(test_mask)[0]\nval_indices = np.where(val_mask)[0]\nunlabeled_mask = np.logical_not(train_mask | test_mask | val_mask)\nunlabeled_indices = np.where(unlabeled_mask)[0]\nif row_normalize:\n features = PlanetoidDataset.preprocess_features(features)\...
<|body_start_0|> train_indices = np.where(train_mask)[0] test_indices = np.where(test_mask)[0] val_indices = np.where(val_mask)[0] unlabeled_mask = np.logical_not(train_mask | test_mask | val_mask) unlabeled_indices = np.where(unlabeled_mask)[0] if row_normalize: ...
Data container for Planetoid datasets.
PlanetoidDataset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanetoidDataset: """Data container for Planetoid datasets.""" def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): """Build from adjacency matrix.""" <|body_0|> def preprocess_features(features): """...
stack_v2_sparse_classes_36k_train_018864
32,682
permissive
[ { "docstring": "Build from adjacency matrix.", "name": "build_from_adjacency_matrix", "signature": "def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False)" }, { "docstring": "Row-normalize feature matrix.", "name": "preprocess_featu...
2
null
Implement the Python class `PlanetoidDataset` described below. Class description: Data container for Planetoid datasets. Method signatures and docstrings: - def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): Build from adjacency matrix. - def preprocess...
Implement the Python class `PlanetoidDataset` described below. Class description: Data container for Planetoid datasets. Method signatures and docstrings: - def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): Build from adjacency matrix. - def preprocess...
995064233479e806a3187ede8a395319520db75e
<|skeleton|> class PlanetoidDataset: """Data container for Planetoid datasets.""" def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): """Build from adjacency matrix.""" <|body_0|> def preprocess_features(features): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlanetoidDataset: """Data container for Planetoid datasets.""" def build_from_adjacency_matrix(name, adj, features, train_mask, val_mask, test_mask, labels, row_normalize=False): """Build from adjacency matrix.""" train_indices = np.where(train_mask)[0] test_indices = np.where(tes...
the_stack_v2_python_sparse
research/gam/gam/data/dataset.py
RubensZimbres/neural-structured-learning
train
1
d223d1b46c524734f9d1613f821b143e6909a891
[ "if stdin is None:\n stdin = sys.stdin.fileno()\nelif hasattr(stdin, 'fileno'):\n stdin = stdin.fileno()\nif stdout is None:\n stdout = sys.stdout.fileno()\nelif hasattr(stdout, 'fileno'):\n stdout = stdout.fileno()\nwith self._client() as podman:\n attach = podman.GetAttachSockets(self._id)\nio_sock...
<|body_start_0|> if stdin is None: stdin = sys.stdin.fileno() elif hasattr(stdin, 'fileno'): stdin = stdin.fileno() if stdout is None: stdout = sys.stdout.fileno() elif hasattr(stdout, 'fileno'): stdout = stdout.fileno() with self._...
Publish attach() for inclusion in Container class.
Mixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mixin: """Publish attach() for inclusion in Container class.""" def attach(self, eot=4, stdin=None, stdout=None): """Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().""" <|body_0|> def resize_handler(self): """Send...
stack_v2_sparse_classes_36k_train_018865
2,635
permissive
[ { "docstring": "Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().", "name": "attach", "signature": "def attach(self, eot=4, stdin=None, stdout=None)" }, { "docstring": "Send the new window size to conmon.", "name": "resize_handler", "signa...
3
stack_v2_sparse_classes_30k_test_000355
Implement the Python class `Mixin` described below. Class description: Publish attach() for inclusion in Container class. Method signatures and docstrings: - def attach(self, eot=4, stdin=None, stdout=None): Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start(). - def resiz...
Implement the Python class `Mixin` described below. Class description: Publish attach() for inclusion in Container class. Method signatures and docstrings: - def attach(self, eot=4, stdin=None, stdout=None): Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start(). - def resiz...
ce2a8734f8b4203ec38078207297062263c49f6f
<|skeleton|> class Mixin: """Publish attach() for inclusion in Container class.""" def attach(self, eot=4, stdin=None, stdout=None): """Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().""" <|body_0|> def resize_handler(self): """Send...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mixin: """Publish attach() for inclusion in Container class.""" def attach(self, eot=4, stdin=None, stdout=None): """Attach to container's PID1 stdin and stdout. stderr is ignored. PseudoTTY work is done in start().""" if stdin is None: stdin = sys.stdin.fileno() elif ...
the_stack_v2_python_sparse
tobiko/podman/_podman1/libs/_containers_attach.py
FedericoRessi/tobiko
train
1
c26dc6d34e53f270c2dc26db54fedc93cb92aa72
[ "self.label = label\nself.suggestion = suggestion\nself.key = key", "if isinstance(val, str):\n obj = JsonToObj(val)\nelse:\n assert isinstance(val, type)\n obj = val\nreturn SearchField(obj.label, obj.suggestion, obj.key)" ]
<|body_start_0|> self.label = label self.suggestion = suggestion self.key = key <|end_body_0|> <|body_start_1|> if isinstance(val, str): obj = JsonToObj(val) else: assert isinstance(val, type) obj = val return SearchField(obj.label, ob...
Object used for serializing search definitions.
SearchField
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchField: """Object used for serializing search definitions.""" def __init__(self, label=None, suggestion=None, key=None): """Inits SearchField object.""" <|body_0|> def Deserialize(val): """Deserializes value as SearchField object. Args: val: json formatted s...
stack_v2_sparse_classes_36k_train_018866
10,689
permissive
[ { "docstring": "Inits SearchField object.", "name": "__init__", "signature": "def __init__(self, label=None, suggestion=None, key=None)" }, { "docstring": "Deserializes value as SearchField object. Args: val: json formatted string or dictionary. Returns: SearchField object.", "name": "Deseri...
2
null
Implement the Python class `SearchField` described below. Class description: Object used for serializing search definitions. Method signatures and docstrings: - def __init__(self, label=None, suggestion=None, key=None): Inits SearchField object. - def Deserialize(val): Deserializes value as SearchField object. Args: ...
Implement the Python class `SearchField` described below. Class description: Object used for serializing search definitions. Method signatures and docstrings: - def __init__(self, label=None, suggestion=None, key=None): Inits SearchField object. - def Deserialize(val): Deserializes value as SearchField object. Args: ...
f7ea83f769485d9c28021b951fec8f15f641b16c
<|skeleton|> class SearchField: """Object used for serializing search definitions.""" def __init__(self, label=None, suggestion=None, key=None): """Inits SearchField object.""" <|body_0|> def Deserialize(val): """Deserializes value as SearchField object. Args: val: json formatted s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchField: """Object used for serializing search definitions.""" def __init__(self, label=None, suggestion=None, key=None): """Inits SearchField object.""" self.label = label self.suggestion = suggestion self.key = key def Deserialize(val): """Deserializes v...
the_stack_v2_python_sparse
earth_enterprise/src/server/wsgi/serve/basic_types.py
tst-ccamp/earthenterprise
train
2
ebd0e1f9feb865beb907970863d30739b7c3ab7a
[ "if len(results) == 0:\n return False\nelse:\n tempList = results[0].fetchall()\n final = []\n for i in tempList:\n final.append(listvalues(i)[0])\n return final", "if limitRows:\n extraSql = self.limit_sql % limitRows\nelse:\n extraSql = ''\nif state is None:\n result = self.dbi.pr...
<|body_start_0|> if len(results) == 0: return False else: tempList = results[0].fetchall() final = [] for i in tempList: final.append(listvalues(i)[0]) return final <|end_body_0|> <|body_start_1|> if limitRows: ...
_GetLocation_ Retrieve all files that are associated with the given job from the database.
GetAllJobs
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetAllJobs: """_GetLocation_ Retrieve all files that are associated with the given job from the database.""" def format(self, results): """_formatDict_ Cast the file attribute to an integer, and also handle changing the column name in Oracle from FILEID to FILE.""" <|body_0|>...
stack_v2_sparse_classes_36k_train_018867
2,550
permissive
[ { "docstring": "_formatDict_ Cast the file attribute to an integer, and also handle changing the column name in Oracle from FILEID to FILE.", "name": "format", "signature": "def format(self, results)" }, { "docstring": "_execute_ Execute the SQL for the given job ID and then format and return th...
2
null
Implement the Python class `GetAllJobs` described below. Class description: _GetLocation_ Retrieve all files that are associated with the given job from the database. Method signatures and docstrings: - def format(self, results): _formatDict_ Cast the file attribute to an integer, and also handle changing the column ...
Implement the Python class `GetAllJobs` described below. Class description: _GetLocation_ Retrieve all files that are associated with the given job from the database. Method signatures and docstrings: - def format(self, results): _formatDict_ Cast the file attribute to an integer, and also handle changing the column ...
de110ccf6fc63ef5589b4e871ef4d51d5bce7a25
<|skeleton|> class GetAllJobs: """_GetLocation_ Retrieve all files that are associated with the given job from the database.""" def format(self, results): """_formatDict_ Cast the file attribute to an integer, and also handle changing the column name in Oracle from FILEID to FILE.""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetAllJobs: """_GetLocation_ Retrieve all files that are associated with the given job from the database.""" def format(self, results): """_formatDict_ Cast the file attribute to an integer, and also handle changing the column name in Oracle from FILEID to FILE.""" if len(results) == 0: ...
the_stack_v2_python_sparse
src/python/WMCore/WMBS/MySQL/Jobs/GetAllJobs.py
vkuznet/WMCore
train
0
8d46ebc4d5c8160b8f352f3d26cd960d0422e4fe
[ "if file_resources is None:\n file_resources = {}\n file_resources['curated_gene_disease_associations.tsv'] = 'curated_gene_disease_associations.tsv.gz'\n file_resources['all_gene_disease_associations.tsv'] = 'all_gene_disease_associations.tsv.gz'\nself.curated = curated\nsuper().__init__(path, file_resour...
<|body_start_0|> if file_resources is None: file_resources = {} file_resources['curated_gene_disease_associations.tsv'] = 'curated_gene_disease_associations.tsv.gz' file_resources['all_gene_disease_associations.tsv'] = 'all_gene_disease_associations.tsv.gz' self.curat...
Loads the database from . Default path: . Default file_resources: { "": "", "": "", "": "", }
DisGeNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DisGeNet: """Loads the database from . Default path: . Default file_resources: { "": "", "": "", "": "", }""" def __init__(self, path='https://www.disgenet.org/static/disgenet_ap1/files/downloads/', file_resources=None, curated=True, col_rename=COLUMNS_RENAME_DICT, **kwargs): """Args...
stack_v2_sparse_classes_36k_train_018868
6,117
permissive
[ { "docstring": "Args: path: file_resources: curated: col_rename: **kwargs:", "name": "__init__", "signature": "def __init__(self, path='https://www.disgenet.org/static/disgenet_ap1/files/downloads/', file_resources=None, curated=True, col_rename=COLUMNS_RENAME_DICT, **kwargs)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_006633
Implement the Python class `DisGeNet` described below. Class description: Loads the database from . Default path: . Default file_resources: { "": "", "": "", "": "", } Method signatures and docstrings: - def __init__(self, path='https://www.disgenet.org/static/disgenet_ap1/files/downloads/', file_resources=None, cura...
Implement the Python class `DisGeNet` described below. Class description: Loads the database from . Default path: . Default file_resources: { "": "", "": "", "": "", } Method signatures and docstrings: - def __init__(self, path='https://www.disgenet.org/static/disgenet_ap1/files/downloads/', file_resources=None, cura...
35a0e00964c9b308f831263936f9507a69f52613
<|skeleton|> class DisGeNet: """Loads the database from . Default path: . Default file_resources: { "": "", "": "", "": "", }""" def __init__(self, path='https://www.disgenet.org/static/disgenet_ap1/files/downloads/', file_resources=None, curated=True, col_rename=COLUMNS_RENAME_DICT, **kwargs): """Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DisGeNet: """Loads the database from . Default path: . Default file_resources: { "": "", "": "", "": "", }""" def __init__(self, path='https://www.disgenet.org/static/disgenet_ap1/files/downloads/', file_resources=None, curated=True, col_rename=COLUMNS_RENAME_DICT, **kwargs): """Args: path: file_...
the_stack_v2_python_sparse
openomics/database/disease.py
JonnyTran/OpenOmics
train
8
3bd441f462a7eb76665697e83b18b49416109305
[ "if isinstance(node.op, ast.Or):\n return self.visit_mutation_site(node, len(node.values))\nreturn node", "if idx and len(node.values) > 2:\n left_list = node.values[:idx - 1]\n right_list = node.values[idx + 1:]\n left = node.values[idx - 1]\n right = node.values[idx]\n new_node = ast.BoolOp(op...
<|body_start_0|> if isinstance(node.op, ast.Or): return self.visit_mutation_site(node, len(node.values)) return node <|end_body_0|> <|body_start_1|> if idx and len(node.values) > 2: left_list = node.values[:idx - 1] right_list = node.values[idx + 1:] ...
An operator that swaps 'or' with 'and'.
ReplaceOrWithAnd
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplaceOrWithAnd: """An operator that swaps 'or' with 'and'.""" def visit_BoolOp(self, node): """http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp""" <|body_0|> def mutate(self, node, idx): """Replace OR with AND.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_018869
4,264
permissive
[ { "docstring": "http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp", "name": "visit_BoolOp", "signature": "def visit_BoolOp(self, node)" }, { "docstring": "Replace OR with AND.", "name": "mutate", "signature": "def mutate(self, node, idx)" } ]
2
stack_v2_sparse_classes_30k_val_000969
Implement the Python class `ReplaceOrWithAnd` described below. Class description: An operator that swaps 'or' with 'and'. Method signatures and docstrings: - def visit_BoolOp(self, node): http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp - def mutate(self, node, idx): Replace OR with AND.
Implement the Python class `ReplaceOrWithAnd` described below. Class description: An operator that swaps 'or' with 'and'. Method signatures and docstrings: - def visit_BoolOp(self, node): http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp - def mutate(self, node, idx): Replace OR with AND. <|skeleton|...
0d5ba9c773299385195f6c32e5bf4de55d3494a6
<|skeleton|> class ReplaceOrWithAnd: """An operator that swaps 'or' with 'and'.""" def visit_BoolOp(self, node): """http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp""" <|body_0|> def mutate(self, node, idx): """Replace OR with AND.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReplaceOrWithAnd: """An operator that swaps 'or' with 'and'.""" def visit_BoolOp(self, node): """http://greentreesnakes.readthedocs.io/en/latest/nodes.html#BoolOp""" if isinstance(node.op, ast.Or): return self.visit_mutation_site(node, len(node.values)) return node ...
the_stack_v2_python_sparse
cosmic_ray/operators/boolean_replacer.py
sobolevn/cosmic-ray
train
0
358a703907879d29cd734950e558ceb68d0284ff
[ "temp_method = ps7.StandardRobot.setRobotDirection\nself.count = 0\n\ndef custom_method(*args):\n self.count += 1\n return temp_method(*args)\nps7.StandardRobot.setRobotDirection = custom_method\nroom = ps7.RectangularRoom(8, 8)\nrobot = ps7.StandardRobot(room, 1.0)\nfor _ in range(room.getNumTiles()):\n r...
<|body_start_0|> temp_method = ps7.StandardRobot.setRobotDirection self.count = 0 def custom_method(*args): self.count += 1 return temp_method(*args) ps7.StandardRobot.setRobotDirection = custom_method room = ps7.RectangularRoom(8, 8) robot = ps7....
Problem_2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Problem_2: def test_1(self): """-Check if the direction is being changed a single time in updatePositionAndClean() method -Check if the setRobotDirection() method is being called on the updatePositionAndClean() method""" <|body_0|> def test_2(self): """-Check if the ...
stack_v2_sparse_classes_36k_train_018870
9,715
no_license
[ { "docstring": "-Check if the direction is being changed a single time in updatePositionAndClean() method -Check if the setRobotDirection() method is being called on the updatePositionAndClean() method", "name": "test_1", "signature": "def test_1(self)" }, { "docstring": "-Check if the robot is ...
3
null
Implement the Python class `Problem_2` described below. Class description: Implement the Problem_2 class. Method signatures and docstrings: - def test_1(self): -Check if the direction is being changed a single time in updatePositionAndClean() method -Check if the setRobotDirection() method is being called on the upda...
Implement the Python class `Problem_2` described below. Class description: Implement the Problem_2 class. Method signatures and docstrings: - def test_1(self): -Check if the direction is being changed a single time in updatePositionAndClean() method -Check if the setRobotDirection() method is being called on the upda...
5aa496a71d36ffb9892ee6e377bd9f5d0d8e03a0
<|skeleton|> class Problem_2: def test_1(self): """-Check if the direction is being changed a single time in updatePositionAndClean() method -Check if the setRobotDirection() method is being called on the updatePositionAndClean() method""" <|body_0|> def test_2(self): """-Check if the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Problem_2: def test_1(self): """-Check if the direction is being changed a single time in updatePositionAndClean() method -Check if the setRobotDirection() method is being called on the updatePositionAndClean() method""" temp_method = ps7.StandardRobot.setRobotDirection self.count = 0 ...
the_stack_v2_python_sparse
pstTestingCode.py
KarenWest/pythonClassProjects
train
1
a1985af3fd7ab6331761630e066f5825900bbe66
[ "ns1 = self.store('http://example.com/')\nns1.get_bboard('test')['flag'] = True\nns2 = self.store('http://example.com/')\nassert ns1.get_bboard('test')['flag'] == True", "must_have = [('', 'http://example.com/', 1000), ('', 'http://example.net/', 1000), ('', 'http://pythoninfo.wiki/', 1000)]\nresult = self.store....
<|body_start_0|> ns1 = self.store('http://example.com/') ns1.get_bboard('test')['flag'] = True ns2 = self.store('http://example.com/') assert ns1.get_bboard('test')['flag'] == True <|end_body_0|> <|body_start_1|> must_have = [('', 'http://example.com/', 1000), ('', 'http://examp...
Test the test namespace description Store. It feels a bit silly to test a test store, and perhaps it is. But there are other tests that are going to rely on the TestStore, and I want to make sure that it's actually working like I think it does. DOC DOC
StoreTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StoreTest: """Test the test namespace description Store. It feels a bit silly to test a test store, and perhaps it is. But there are other tests that are going to rely on the TestStore, and I want to make sure that it's actually working like I think it does. DOC DOC""" def testCaching(self):...
stack_v2_sparse_classes_36k_train_018871
34,773
no_license
[ { "docstring": "Make sure that the store is caching namespaces.", "name": "testCaching", "signature": "def testCaching(self)" }, { "docstring": "Make sure that get_cache_list works.", "name": "testCacheList", "signature": "def testCacheList(self)" } ]
2
stack_v2_sparse_classes_30k_train_018339
Implement the Python class `StoreTest` described below. Class description: Test the test namespace description Store. It feels a bit silly to test a test store, and perhaps it is. But there are other tests that are going to rely on the TestStore, and I want to make sure that it's actually working like I think it does....
Implement the Python class `StoreTest` described below. Class description: Test the test namespace description Store. It feels a bit silly to test a test store, and perhaps it is. But there are other tests that are going to rely on the TestStore, and I want to make sure that it's actually working like I think it does....
da65d948b346d3f455e79168a8753b2b16d8fc5f
<|skeleton|> class StoreTest: """Test the test namespace description Store. It feels a bit silly to test a test store, and perhaps it is. But there are other tests that are going to rely on the TestStore, and I want to make sure that it's actually working like I think it does. DOC DOC""" def testCaching(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StoreTest: """Test the test namespace description Store. It feels a bit silly to test a test store, and perhaps it is. But there are other tests that are going to rely on the TestStore, and I want to make sure that it's actually working like I think it does. DOC DOC""" def testCaching(self): """M...
the_stack_v2_python_sparse
pre2007/lncore/test.py
BackupTheBerlios/onebigsoup-svn
train
0
11a72443dfdce4db6dd71ccd35e37422d9a7c62d
[ "if value is self.field.missing_value:\n return []\nconverter = self._get_converter(self.field.value_type)\nreturn [converter.to_widget_value(v) for v in value]", "if len(value) == 0:\n return self.field.missing_value\nconverter = self._get_converter(self.field.value_type)\nvalues = [converter.to_field_valu...
<|body_start_0|> if value is self.field.missing_value: return [] converter = self._get_converter(self.field.value_type) return [converter.to_widget_value(v) for v in value] <|end_body_0|> <|body_start_1|> if len(value) == 0: return self.field.missing_value ...
Data converter for IMultiWidget.
MultiConverter
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiConverter: """Data converter for IMultiWidget.""" def to_widget_value(self, value): """Just dispatch it.""" <|body_0|> def to_field_value(self, value): """Just dispatch it.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if value is self.fi...
stack_v2_sparse_classes_36k_train_018872
16,755
permissive
[ { "docstring": "Just dispatch it.", "name": "to_widget_value", "signature": "def to_widget_value(self, value)" }, { "docstring": "Just dispatch it.", "name": "to_field_value", "signature": "def to_field_value(self, value)" } ]
2
null
Implement the Python class `MultiConverter` described below. Class description: Data converter for IMultiWidget. Method signatures and docstrings: - def to_widget_value(self, value): Just dispatch it. - def to_field_value(self, value): Just dispatch it.
Implement the Python class `MultiConverter` described below. Class description: Data converter for IMultiWidget. Method signatures and docstrings: - def to_widget_value(self, value): Just dispatch it. - def to_field_value(self, value): Just dispatch it. <|skeleton|> class MultiConverter: """Data converter for IM...
e83e2ce314355f98eaf66e90ad6feccbda7934f9
<|skeleton|> class MultiConverter: """Data converter for IMultiWidget.""" def to_widget_value(self, value): """Just dispatch it.""" <|body_0|> def to_field_value(self, value): """Just dispatch it.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiConverter: """Data converter for IMultiWidget.""" def to_widget_value(self, value): """Just dispatch it.""" if value is self.field.missing_value: return [] converter = self._get_converter(self.field.value_type) return [converter.to_widget_value(v) for v in...
the_stack_v2_python_sparse
src/pyams_form/converter.py
Py-AMS/pyams-form
train
0
8e22dc5fc37206bed3caa2dc815598852c1a32dd
[ "self.grad_U = None\nself.grad_W = None\nself.grad_b = None\nself.grad_V = None\nself.grad_c = None\nself.grad_U_2 = np.zeros((m, K))\nself.grad_W_2 = np.zeros((m, m))\nself.grad_b_2 = np.zeros((m, 1))\nself.grad_V_2 = np.zeros((K, m))\nself.grad_c_2 = np.zeros((K, 1))", "self.grad_U = grad_U\nself.grad_W = grad_...
<|body_start_0|> self.grad_U = None self.grad_W = None self.grad_b = None self.grad_V = None self.grad_c = None self.grad_U_2 = np.zeros((m, K)) self.grad_W_2 = np.zeros((m, m)) self.grad_b_2 = np.zeros((m, 1)) self.grad_V_2 = np.zeros((K, m)) ...
AdaGrad
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdaGrad: def __init__(self, K, m): """[AdaGrad initialization.] Arguments: K {[int]} -- [dimension of the output] m {[int]} -- [dimension of the hidden state]""" <|body_0|> def update(self, grad_U, grad_W, grad_b, grad_V, grad_c): """[Updates the states of Adagrad] A...
stack_v2_sparse_classes_36k_train_018873
19,053
no_license
[ { "docstring": "[AdaGrad initialization.] Arguments: K {[int]} -- [dimension of the output] m {[int]} -- [dimension of the hidden state]", "name": "__init__", "signature": "def __init__(self, K, m)" }, { "docstring": "[Updates the states of Adagrad] Arguments: grad_U {[mxJ]} -- [] grad_W {[mxm]}...
3
null
Implement the Python class `AdaGrad` described below. Class description: Implement the AdaGrad class. Method signatures and docstrings: - def __init__(self, K, m): [AdaGrad initialization.] Arguments: K {[int]} -- [dimension of the output] m {[int]} -- [dimension of the hidden state] - def update(self, grad_U, grad_W...
Implement the Python class `AdaGrad` described below. Class description: Implement the AdaGrad class. Method signatures and docstrings: - def __init__(self, K, m): [AdaGrad initialization.] Arguments: K {[int]} -- [dimension of the output] m {[int]} -- [dimension of the hidden state] - def update(self, grad_U, grad_W...
26de9802912415f5ecb85b8ede816cd5ede50e7b
<|skeleton|> class AdaGrad: def __init__(self, K, m): """[AdaGrad initialization.] Arguments: K {[int]} -- [dimension of the output] m {[int]} -- [dimension of the hidden state]""" <|body_0|> def update(self, grad_U, grad_W, grad_b, grad_V, grad_c): """[Updates the states of Adagrad] A...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdaGrad: def __init__(self, K, m): """[AdaGrad initialization.] Arguments: K {[int]} -- [dimension of the output] m {[int]} -- [dimension of the hidden state]""" self.grad_U = None self.grad_W = None self.grad_b = None self.grad_V = None self.grad_c = None ...
the_stack_v2_python_sparse
DD2424-Deep-Learning/Lab4/Code/Harry Potter and the Goblet of Fire/Lab4_basic_code.py
jotix16/Courses
train
0
5317b4c57bc71ded0332d2b864c2663a726d4f1d
[ "self.activity_id = activity_id\nself.object_id = object_id\nself.uri = uri", "result = {'activity_id': self.activity_id}\nif self.object_id:\n result['object_id'] = self.object_id\nif self.uri:\n result['uri'] = self.uri\nreturn result" ]
<|body_start_0|> self.activity_id = activity_id self.object_id = object_id self.uri = uri <|end_body_0|> <|body_start_1|> result = {'activity_id': self.activity_id} if self.object_id: result['object_id'] = self.object_id if self.uri: result['uri']...
Data structure storing simple activity metadata
ActivityHandle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActivityHandle: """Data structure storing simple activity metadata""" def __init__(self, activity_id=None, object_id=None, uri=None): """Initialise the handle from activity_id activity_id -- unique id for the activity to be created object_id -- identity of the journal object associat...
stack_v2_sparse_classes_36k_train_018874
2,577
no_license
[ { "docstring": "Initialise the handle from activity_id activity_id -- unique id for the activity to be created object_id -- identity of the journal object associated with the activity. It was used by the journal prototype implementation, might change when we do the real one. When you resume an activity from the...
2
null
Implement the Python class `ActivityHandle` described below. Class description: Data structure storing simple activity metadata Method signatures and docstrings: - def __init__(self, activity_id=None, object_id=None, uri=None): Initialise the handle from activity_id activity_id -- unique id for the activity to be cre...
Implement the Python class `ActivityHandle` described below. Class description: Data structure storing simple activity metadata Method signatures and docstrings: - def __init__(self, activity_id=None, object_id=None, uri=None): Initialise the handle from activity_id activity_id -- unique id for the activity to be cre...
6cc17391420b05fe64966a6c8b7ac709c0c0e7a2
<|skeleton|> class ActivityHandle: """Data structure storing simple activity metadata""" def __init__(self, activity_id=None, object_id=None, uri=None): """Initialise the handle from activity_id activity_id -- unique id for the activity to be created object_id -- identity of the journal object associat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActivityHandle: """Data structure storing simple activity metadata""" def __init__(self, activity_id=None, object_id=None, uri=None): """Initialise the handle from activity_id activity_id -- unique id for the activity to be created object_id -- identity of the journal object associated with the a...
the_stack_v2_python_sparse
olpc-sugar/activity/activityhandle.py
dannyiland/OLPC-Mesh-Messenger
train
2
d06b44f6940f883d1ada04dc338cc85d8bb4c616
[ "value = proposal['value']\nif self.base ** self.min > value or self.base ** self.max < value:\n value = min(max(value, self.base ** self.min), self.base ** self.max)\nreturn value", "min = proposal['value']\nif min > self.max:\n raise TraitError('Setting min > max')\nif self.base ** min > self.value:\n ...
<|body_start_0|> value = proposal['value'] if self.base ** self.min > value or self.base ** self.max < value: value = min(max(value, self.base ** self.min), self.base ** self.max) return value <|end_body_0|> <|body_start_1|> min = proposal['value'] if min > self.max:...
_BoundedLogFloat
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BoundedLogFloat: def _validate_value(self, proposal): """Cap and floor value""" <|body_0|> def _validate_min(self, proposal): """Enforce base ** min <= value <= base ** max""" <|body_1|> def _validate_max(self, proposal): """Enforce base ** min ...
stack_v2_sparse_classes_36k_train_018875
13,866
permissive
[ { "docstring": "Cap and floor value", "name": "_validate_value", "signature": "def _validate_value(self, proposal)" }, { "docstring": "Enforce base ** min <= value <= base ** max", "name": "_validate_min", "signature": "def _validate_min(self, proposal)" }, { "docstring": "Enforc...
3
null
Implement the Python class `_BoundedLogFloat` described below. Class description: Implement the _BoundedLogFloat class. Method signatures and docstrings: - def _validate_value(self, proposal): Cap and floor value - def _validate_min(self, proposal): Enforce base ** min <= value <= base ** max - def _validate_max(self...
Implement the Python class `_BoundedLogFloat` described below. Class description: Implement the _BoundedLogFloat class. Method signatures and docstrings: - def _validate_value(self, proposal): Cap and floor value - def _validate_min(self, proposal): Enforce base ** min <= value <= base ** max - def _validate_max(self...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class _BoundedLogFloat: def _validate_value(self, proposal): """Cap and floor value""" <|body_0|> def _validate_min(self, proposal): """Enforce base ** min <= value <= base ** max""" <|body_1|> def _validate_max(self, proposal): """Enforce base ** min ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _BoundedLogFloat: def _validate_value(self, proposal): """Cap and floor value""" value = proposal['value'] if self.base ** self.min > value or self.base ** self.max < value: value = min(max(value, self.base ** self.min), self.base ** self.max) return value def ...
the_stack_v2_python_sparse
contrib/python/ipywidgets/py2/ipywidgets/widgets/widget_float.py
catboost/catboost
train
8,012
31d142b3ee2571c70deef1173d4613ae32510c0a
[ "N = len(nums)\nl, r = (0, N - 1)\nwhile l <= r:\n m = (l + r) // 2\n if (m + 1 == N or (m + 1 < N and nums[m] != nums[m + 1])) and (m == 0 or (m - 1 >= 0 and nums[m] != nums[m - 1])):\n return nums[m]\n elif m + 1 < N and nums[m] == nums[m + 1]:\n if m % 2 == 0:\n l = m + 1\n ...
<|body_start_0|> N = len(nums) l, r = (0, N - 1) while l <= r: m = (l + r) // 2 if (m + 1 == N or (m + 1 < N and nums[m] != nums[m + 1])) and (m == 0 or (m - 1 >= 0 and nums[m] != nums[m - 1])): return nums[m] elif m + 1 < N and nums[m] == nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """binary search를 하되, 같은 값이 [짝수, 홀수]에 있는지 [홀수, 짝수] 에 있는지로 오른쪽, 왼쪾으로 이동.""" <|body_0|> def singleNonDuplicate1(self, nums: List[int]) -> int: """XOR 이용 O(N) / O(1)""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_018876
1,013
no_license
[ { "docstring": "binary search를 하되, 같은 값이 [짝수, 홀수]에 있는지 [홀수, 짝수] 에 있는지로 오른쪽, 왼쪾으로 이동.", "name": "singleNonDuplicate", "signature": "def singleNonDuplicate(self, nums: List[int]) -> int" }, { "docstring": "XOR 이용 O(N) / O(1)", "name": "singleNonDuplicate1", "signature": "def singleNonDupli...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNonDuplicate(self, nums: List[int]) -> int: binary search를 하되, 같은 값이 [짝수, 홀수]에 있는지 [홀수, 짝수] 에 있는지로 오른쪽, 왼쪾으로 이동. - def singleNonDuplicate1(self, nums: List[int]) -> int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNonDuplicate(self, nums: List[int]) -> int: binary search를 하되, 같은 값이 [짝수, 홀수]에 있는지 [홀수, 짝수] 에 있는지로 오른쪽, 왼쪾으로 이동. - def singleNonDuplicate1(self, nums: List[int]) -> int...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """binary search를 하되, 같은 값이 [짝수, 홀수]에 있는지 [홀수, 짝수] 에 있는지로 오른쪽, 왼쪾으로 이동.""" <|body_0|> def singleNonDuplicate1(self, nums: List[int]) -> int: """XOR 이용 O(N) / O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """binary search를 하되, 같은 값이 [짝수, 홀수]에 있는지 [홀수, 짝수] 에 있는지로 오른쪽, 왼쪾으로 이동.""" N = len(nums) l, r = (0, N - 1) while l <= r: m = (l + r) // 2 if (m + 1 == N or (m + 1 < N and nums[m] != nums[m +...
the_stack_v2_python_sparse
Leetcode/540.py
hanwgyu/algorithm_problem_solving
train
5
42d83fd5636215823c3572de4559f6486ba095a8
[ "self.pat = pat\nM = len(pat)\nR = 256\nself.dfa = [[0 for c in range(0, M)] for r in range(0, R)]\nself.dfa[ord(pat[0])][0] = 1\nX = 0\nfor j in range(1, M):\n for c in range(0, R):\n self.dfa[c][j] = self.dfa[c][X]\n self.dfa[ord(pat[j])][j] = j + 1\n X = self.dfa[ord(pat[j])][X]", "N = len(txt)...
<|body_start_0|> self.pat = pat M = len(pat) R = 256 self.dfa = [[0 for c in range(0, M)] for r in range(0, R)] self.dfa[ord(pat[0])][0] = 1 X = 0 for j in range(1, M): for c in range(0, R): self.dfa[c][j] = self.dfa[c][X] s...
KMP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KMP: def __init__(self, pat): """Preprocesses the pattern string. :param pat: the pattern string""" <|body_0|> def search(self, txt): """Returns the index of the first occurrrence of the pattern string in the text string. :param txt: the text string :return: the inde...
stack_v2_sparse_classes_36k_train_018877
1,997
no_license
[ { "docstring": "Preprocesses the pattern string. :param pat: the pattern string", "name": "__init__", "signature": "def __init__(self, pat)" }, { "docstring": "Returns the index of the first occurrrence of the pattern string in the text string. :param txt: the text string :return: the index of t...
2
stack_v2_sparse_classes_30k_train_008618
Implement the Python class `KMP` described below. Class description: Implement the KMP class. Method signatures and docstrings: - def __init__(self, pat): Preprocesses the pattern string. :param pat: the pattern string - def search(self, txt): Returns the index of the first occurrrence of the pattern string in the te...
Implement the Python class `KMP` described below. Class description: Implement the KMP class. Method signatures and docstrings: - def __init__(self, pat): Preprocesses the pattern string. :param pat: the pattern string - def search(self, txt): Returns the index of the first occurrrence of the pattern string in the te...
658e3a42b712fb79a4afc8c3acf24161bd5d6737
<|skeleton|> class KMP: def __init__(self, pat): """Preprocesses the pattern string. :param pat: the pattern string""" <|body_0|> def search(self, txt): """Returns the index of the first occurrrence of the pattern string in the text string. :param txt: the text string :return: the inde...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KMP: def __init__(self, pat): """Preprocesses the pattern string. :param pat: the pattern string""" self.pat = pat M = len(pat) R = 256 self.dfa = [[0 for c in range(0, M)] for r in range(0, R)] self.dfa[ord(pat[0])][0] = 1 X = 0 for j in range(1...
the_stack_v2_python_sparse
algs4/strings/kmp.py
bhavyaagg/python-test
train
0
2dfeee02ed519d4c88e7716b76907555f98d59da
[ "super(RNNDecoder, self).__init__()\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(vocab)", "attention = SelfAttention(s_prev.shape[1])\ncontext, ...
<|body_start_0|> super(RNNDecoder, self).__init__() self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) self.F = tf.keras.layers.Dense(vocab) <|end_body_0|> <...
RNNDecoder Class
RNNDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDecoder: """RNNDecoder Class""" def __init__(self, vocab, embedding, units, batch): """Class constructor :param vocab: int representing size of output vocabulary""" <|body_0|> def call(self, x, s_prev, hidden_states): """Public Instance method""" <|bod...
stack_v2_sparse_classes_36k_train_018878
1,289
no_license
[ { "docstring": "Class constructor :param vocab: int representing size of output vocabulary", "name": "__init__", "signature": "def __init__(self, vocab, embedding, units, batch)" }, { "docstring": "Public Instance method", "name": "call", "signature": "def call(self, x, s_prev, hidden_st...
2
stack_v2_sparse_classes_30k_train_018263
Implement the Python class `RNNDecoder` described below. Class description: RNNDecoder Class Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Class constructor :param vocab: int representing size of output vocabulary - def call(self, x, s_prev, hidden_states): Public Instance me...
Implement the Python class `RNNDecoder` described below. Class description: RNNDecoder Class Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Class constructor :param vocab: int representing size of output vocabulary - def call(self, x, s_prev, hidden_states): Public Instance me...
a51fbcb76dae9281ff34ace0fb762ef899b4c380
<|skeleton|> class RNNDecoder: """RNNDecoder Class""" def __init__(self, vocab, embedding, units, batch): """Class constructor :param vocab: int representing size of output vocabulary""" <|body_0|> def call(self, x, s_prev, hidden_states): """Public Instance method""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNDecoder: """RNNDecoder Class""" def __init__(self, vocab, embedding, units, batch): """Class constructor :param vocab: int representing size of output vocabulary""" super(RNNDecoder, self).__init__() self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/2-rnn_decoder.py
Diegokernel/holbertonschool-machine_learning
train
0
207e5648d6d02b56cc9c319062b487eeda4858e0
[ "if not id_tcr:\n raise ValueError('Invalid ID')\nresponse = self._api.post(path='{}/pend'.format(id_tcr))\nreturn response", "if not id_tcr:\n raise ValueError('Invalid ID')\nresponse = self._api.post(path='{}/inquire'.format(id_tcr))\nreturn response", "if not tcr_id:\n raise ValueError('Invalid ID')...
<|body_start_0|> if not id_tcr: raise ValueError('Invalid ID') response = self._api.post(path='{}/pend'.format(id_tcr)) return response <|end_body_0|> <|body_start_1|> if not id_tcr: raise ValueError('Invalid ID') response = self._api.post(path='{}/inquir...
Tier Config Request Resource.
TierConfigRequestResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TierConfigRequestResource: """Tier Config Request Resource.""" def pend(self, id_tcr): """Set a Tier Configuration Request to pend status. :param str id_tar: Primary key of the tier configuration request to set. :return: 204, Empty response""" <|body_0|> def inquire(self...
stack_v2_sparse_classes_36k_train_018879
3,281
permissive
[ { "docstring": "Set a Tier Configuration Request to pend status. :param str id_tar: Primary key of the tier configuration request to set. :return: 204, Empty response", "name": "pend", "signature": "def pend(self, id_tcr)" }, { "docstring": "Set a Tier Configuration Request to inquire status. :p...
6
null
Implement the Python class `TierConfigRequestResource` described below. Class description: Tier Config Request Resource. Method signatures and docstrings: - def pend(self, id_tcr): Set a Tier Configuration Request to pend status. :param str id_tar: Primary key of the tier configuration request to set. :return: 204, E...
Implement the Python class `TierConfigRequestResource` described below. Class description: Tier Config Request Resource. Method signatures and docstrings: - def pend(self, id_tcr): Set a Tier Configuration Request to pend status. :param str id_tar: Primary key of the tier configuration request to set. :return: 204, E...
656d653e4065637e2cc5768d7d554de17d0120eb
<|skeleton|> class TierConfigRequestResource: """Tier Config Request Resource.""" def pend(self, id_tcr): """Set a Tier Configuration Request to pend status. :param str id_tar: Primary key of the tier configuration request to set. :return: 204, Empty response""" <|body_0|> def inquire(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TierConfigRequestResource: """Tier Config Request Resource.""" def pend(self, id_tcr): """Set a Tier Configuration Request to pend status. :param str id_tar: Primary key of the tier configuration request to set. :return: 204, Empty response""" if not id_tcr: raise ValueError('...
the_stack_v2_python_sparse
connect/resources/tier_config_request.py
cloudblue/connect-python-sdk
train
13
f1e58c936b4258b55895310b80c3071fa46b50ec
[ "req = 'xbuddy/latest?for_update=true&return_dir=true'\nself.assertEqual(dev_server_wrapper.GenerateXbuddyRequest('latest', 'update'), req)\npath = 'xbuddy://remote/stumpy/version'\nreq = 'xbuddy/remote/stumpy/version?for_update=true&return_dir=true'\nself.assertEqual(dev_server_wrapper.GenerateXbuddyRequest(path, ...
<|body_start_0|> req = 'xbuddy/latest?for_update=true&return_dir=true' self.assertEqual(dev_server_wrapper.GenerateXbuddyRequest('latest', 'update'), req) path = 'xbuddy://remote/stumpy/version' req = 'xbuddy/remote/stumpy/version?for_update=true&return_dir=true' self.assertEqual...
Test xbuddy helper functions.
TestXbuddyHelpers
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestXbuddyHelpers: """Test xbuddy helper functions.""" def testGenerateXbuddyRequestForUpdate(self): """Test we generate correct xbuddy requests.""" <|body_0|> def testGenerateXbuddyRequestForImage(self): """Tests that we generate correct requests to get images."...
stack_v2_sparse_classes_36k_train_018880
4,351
permissive
[ { "docstring": "Test we generate correct xbuddy requests.", "name": "testGenerateXbuddyRequestForUpdate", "signature": "def testGenerateXbuddyRequestForUpdate(self)" }, { "docstring": "Tests that we generate correct requests to get images.", "name": "testGenerateXbuddyRequestForImage", "...
6
stack_v2_sparse_classes_30k_val_000090
Implement the Python class `TestXbuddyHelpers` described below. Class description: Test xbuddy helper functions. Method signatures and docstrings: - def testGenerateXbuddyRequestForUpdate(self): Test we generate correct xbuddy requests. - def testGenerateXbuddyRequestForImage(self): Tests that we generate correct req...
Implement the Python class `TestXbuddyHelpers` described below. Class description: Test xbuddy helper functions. Method signatures and docstrings: - def testGenerateXbuddyRequestForUpdate(self): Test we generate correct xbuddy requests. - def testGenerateXbuddyRequestForImage(self): Tests that we generate correct req...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class TestXbuddyHelpers: """Test xbuddy helper functions.""" def testGenerateXbuddyRequestForUpdate(self): """Test we generate correct xbuddy requests.""" <|body_0|> def testGenerateXbuddyRequestForImage(self): """Tests that we generate correct requests to get images."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestXbuddyHelpers: """Test xbuddy helper functions.""" def testGenerateXbuddyRequestForUpdate(self): """Test we generate correct xbuddy requests.""" req = 'xbuddy/latest?for_update=true&return_dir=true' self.assertEqual(dev_server_wrapper.GenerateXbuddyRequest('latest', 'update'),...
the_stack_v2_python_sparse
third_party/chromite/lib/dev_server_wrapper_unittest.py
metux/chromium-suckless
train
5
e8d69fea767187a015bf76b82bcbe1c1b3e012d7
[ "sample_n, feature_n = X.shape\nunused_features = np.ones(feature_n) == 1\nunclass_samples = np.ones(sample_n) == 1\nself.node = self._train_tree(X, Y, unused_features, unclass_samples)\nreturn self", "logger.debug('train node -> X : < {} > Y : < {} >'.format(str(train_data).replace('\\n', ''), str(train_la...
<|body_start_0|> sample_n, feature_n = X.shape unused_features = np.ones(feature_n) == 1 unclass_samples = np.ones(sample_n) == 1 self.node = self._train_tree(X, Y, unused_features, unclass_samples) return self <|end_body_0|> <|body_start_1|> logger.debug('train node -> ...
ID3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ID3: def fit(self, X, Y): """训练函数,X为二维array,Y为一维array""" <|body_0|> def _train_tree(self, train_data, train_labels, unused_features, unclass_samples): """递归调用用以创建树""" <|body_1|> def _find_split_feature(self, X, Y, unused_features, unclass_samples): ...
stack_v2_sparse_classes_36k_train_018881
4,988
no_license
[ { "docstring": "训练函数,X为二维array,Y为一维array", "name": "fit", "signature": "def fit(self, X, Y)" }, { "docstring": "递归调用用以创建树", "name": "_train_tree", "signature": "def _train_tree(self, train_data, train_labels, unused_features, unclass_samples)" }, { "docstring": "'寻找最优的拆分feature",...
4
stack_v2_sparse_classes_30k_train_014617
Implement the Python class `ID3` described below. Class description: Implement the ID3 class. Method signatures and docstrings: - def fit(self, X, Y): 训练函数,X为二维array,Y为一维array - def _train_tree(self, train_data, train_labels, unused_features, unclass_samples): 递归调用用以创建树 - def _find_split_feature(self, X, Y, unused_fe...
Implement the Python class `ID3` described below. Class description: Implement the ID3 class. Method signatures and docstrings: - def fit(self, X, Y): 训练函数,X为二维array,Y为一维array - def _train_tree(self, train_data, train_labels, unused_features, unclass_samples): 递归调用用以创建树 - def _find_split_feature(self, X, Y, unused_fe...
266f613fe2d5df3c0762061eb119386a9f6ea644
<|skeleton|> class ID3: def fit(self, X, Y): """训练函数,X为二维array,Y为一维array""" <|body_0|> def _train_tree(self, train_data, train_labels, unused_features, unclass_samples): """递归调用用以创建树""" <|body_1|> def _find_split_feature(self, X, Y, unused_features, unclass_samples): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ID3: def fit(self, X, Y): """训练函数,X为二维array,Y为一维array""" sample_n, feature_n = X.shape unused_features = np.ones(feature_n) == 1 unclass_samples = np.ones(sample_n) == 1 self.node = self._train_tree(X, Y, unused_features, unclass_samples) return self def _t...
the_stack_v2_python_sparse
ID3/id3.py
hxsylzpf/codes
train
0
999f4fc1dba89cfcc622091f1aba0e987be9ca56
[ "if value is None:\n return None\ntry:\n value = float(value)\n a = arrow.get(datetime.datetime.utcfromtimestamp(value))\n a = a.replace(tzinfo=TZ)\nexcept (ValueError, TypeError):\n try:\n a = arrow.get(value)\n a = a.to(TZ)\n except (arrow.parser.ParserError, TypeError):\n r...
<|body_start_0|> if value is None: return None try: value = float(value) a = arrow.get(datetime.datetime.utcfromtimestamp(value)) a = a.replace(tzinfo=TZ) except (ValueError, TypeError): try: a = arrow.get(value) ...
Custom DateTime parser on top of :mod:`arrow` to provide lossless dates
DateTime
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateTime: """Custom DateTime parser on top of :mod:`arrow` to provide lossless dates""" def parse(self, value): """Parse the value""" <|body_0|> def format(self, value): """Format the value""" <|body_1|> <|end_skeleton|> <|body_start_0|> if valu...
stack_v2_sparse_classes_36k_train_018882
2,860
permissive
[ { "docstring": "Parse the value", "name": "parse", "signature": "def parse(self, value)" }, { "docstring": "Format the value", "name": "format", "signature": "def format(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_006439
Implement the Python class `DateTime` described below. Class description: Custom DateTime parser on top of :mod:`arrow` to provide lossless dates Method signatures and docstrings: - def parse(self, value): Parse the value - def format(self, value): Format the value
Implement the Python class `DateTime` described below. Class description: Custom DateTime parser on top of :mod:`arrow` to provide lossless dates Method signatures and docstrings: - def parse(self, value): Parse the value - def format(self, value): Format the value <|skeleton|> class DateTime: """Custom DateTime...
2b8c6e09a4174f2ae3545fa048f59c55c4ae7dba
<|skeleton|> class DateTime: """Custom DateTime parser on top of :mod:`arrow` to provide lossless dates""" def parse(self, value): """Parse the value""" <|body_0|> def format(self, value): """Format the value""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DateTime: """Custom DateTime parser on top of :mod:`arrow` to provide lossless dates""" def parse(self, value): """Parse the value""" if value is None: return None try: value = float(value) a = arrow.get(datetime.datetime.utcfromtimestamp(value)...
the_stack_v2_python_sparse
burpui/api/custom/my_fields.py
ziirish/burp-ui
train
98
961ecb401c5bba15e1f9da0bc992c4ae8e3bd17a
[ "payload = request.json\nif category.upper() not in CATEGORY_MODEL_MAPPING:\n raise self.ValidationError('Invalid category')\nif len(post_id) != 24:\n return Response('', 204)\npost = CATEGORY_MODEL_MAPPING[category.upper()].objects(id=post_id).first()\nif not post:\n return Response('', 204)\npost.update(...
<|body_start_0|> payload = request.json if category.upper() not in CATEGORY_MODEL_MAPPING: raise self.ValidationError('Invalid category') if len(post_id) != 24: return Response('', 204) post = CATEGORY_MODEL_MAPPING[category.upper()].objects(id=post_id).first() ...
PostAlteration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostAlteration: def patch(self, category, post_id): """게시글 수정""" <|body_0|> def delete(self, category, post_id): """게시글 삭제""" <|body_1|> <|end_skeleton|> <|body_start_0|> payload = request.json if category.upper() not in CATEGORY_MODEL_MAPPI...
stack_v2_sparse_classes_36k_train_018883
2,352
permissive
[ { "docstring": "게시글 수정", "name": "patch", "signature": "def patch(self, category, post_id)" }, { "docstring": "게시글 삭제", "name": "delete", "signature": "def delete(self, category, post_id)" } ]
2
null
Implement the Python class `PostAlteration` described below. Class description: Implement the PostAlteration class. Method signatures and docstrings: - def patch(self, category, post_id): 게시글 수정 - def delete(self, category, post_id): 게시글 삭제
Implement the Python class `PostAlteration` described below. Class description: Implement the PostAlteration class. Method signatures and docstrings: - def patch(self, category, post_id): 게시글 수정 - def delete(self, category, post_id): 게시글 삭제 <|skeleton|> class PostAlteration: def patch(self, category, post_id): ...
de585fe904a2bf15f9fc74219eae176151a0f8ca
<|skeleton|> class PostAlteration: def patch(self, category, post_id): """게시글 수정""" <|body_0|> def delete(self, category, post_id): """게시글 삭제""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostAlteration: def patch(self, category, post_id): """게시글 수정""" payload = request.json if category.upper() not in CATEGORY_MODEL_MAPPING: raise self.ValidationError('Invalid category') if len(post_id) != 24: return Response('', 204) post = CATEG...
the_stack_v2_python_sparse
Server/app/views/v2/admin/post/post.py
miraedbswo/DMS-Backend
train
2
cf52af83d3664ceb10d66ddd5ebb85678b993254
[ "start = 0\nend = len(height) - 1\narea = 0\nwhile start < end:\n start_next = start\n end_next = end\n if height[start] < height[end]:\n area_new = height[start] * (end - start)\n while start_next < end_next:\n if height[start_next] > height[start]:\n break\n ...
<|body_start_0|> start = 0 end = len(height) - 1 area = 0 while start < end: start_next = start end_next = end if height[start] < height[end]: area_new = height[start] * (end - start) while start_next < end_next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea_my(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> start = 0 end = len(height) - 1 ...
stack_v2_sparse_classes_36k_train_018884
1,662
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea_my", "signature": "def maxArea_my(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_018691
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea_my(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea_my(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea_...
a3759acc09664a4fbf6af568b1cd9acc9b4c260f
<|skeleton|> class Solution: def maxArea_my(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea_my(self, height): """:type height: List[int] :rtype: int""" start = 0 end = len(height) - 1 area = 0 while start < end: start_next = start end_next = end if height[start] < height[end]: area_new =...
the_stack_v2_python_sparse
ContainerWithMostWater.py
SunJackson/algorithms
train
0
34515948bdfba1f78f70d16bcfd012cd0dad1678
[ "self.stack = []\nwhile root:\n self.stack.append(root)\n root = root.left", "if len(self.stack) > 0:\n return True\nreturn False", "node = self.stack.pop()\nnode_right = node.right\nwhile node_right:\n self.stack.append(node_right)\n node_right = node_right.left\nreturn node.val" ]
<|body_start_0|> self.stack = [] while root: self.stack.append(root) root = root.left <|end_body_0|> <|body_start_1|> if len(self.stack) > 0: return True return False <|end_body_1|> <|body_start_2|> node = self.stack.pop() node_right ...
BSTIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.stack = [] ...
stack_v2_sparse_classes_36k_train_018885
1,082
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasNext(self)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" } ]
3
null
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int <|skeleton|> class BSTIterator: def __init__(self, root...
f047810f01685d8bf513e8ee7dab9d15f1c04bbc
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSTIterator: def __init__(self, root): """:type root: TreeNode""" self.stack = [] while root: self.stack.append(root) root = root.left def hasNext(self): """:rtype: bool""" if len(self.stack) > 0: return True return False...
the_stack_v2_python_sparse
leetcode/company specific problems/Amazon/binary_search_tree_iterator.py
Gabrielatb/Interview-Prep
train
1
903599286c3d50f12d612940b8c46dc52e8ced77
[ "self.lowest_price = lowest_price\nself.highest_price = highest_price\nself.lowest_sale_price = lowest_sale_price\nself.highest_sale_price = highest_sale_price", "if dictionary is None:\n return None\nlowest_price = awsecommerceservice.models.price.Price.from_dictionary(dictionary.get('LowestPrice')) if dictio...
<|body_start_0|> self.lowest_price = lowest_price self.highest_price = highest_price self.lowest_sale_price = lowest_sale_price self.highest_sale_price = highest_sale_price <|end_body_0|> <|body_start_1|> if dictionary is None: return None lowest_price = awse...
Implementation of the 'VariationSummary' model. TODO: type model description here. Attributes: lowest_price (Price): TODO: type description here. highest_price (Price): TODO: type description here. lowest_sale_price (Price): TODO: type description here. highest_sale_price (Price): TODO: type description here.
VariationSummary
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariationSummary: """Implementation of the 'VariationSummary' model. TODO: type model description here. Attributes: lowest_price (Price): TODO: type description here. highest_price (Price): TODO: type description here. lowest_sale_price (Price): TODO: type description here. highest_sale_price (Pr...
stack_v2_sparse_classes_36k_train_018886
2,729
permissive
[ { "docstring": "Constructor for the VariationSummary class", "name": "__init__", "signature": "def __init__(self, lowest_price=None, highest_price=None, lowest_sale_price=None, highest_sale_price=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dict...
2
stack_v2_sparse_classes_30k_train_005308
Implement the Python class `VariationSummary` described below. Class description: Implementation of the 'VariationSummary' model. TODO: type model description here. Attributes: lowest_price (Price): TODO: type description here. highest_price (Price): TODO: type description here. lowest_sale_price (Price): TODO: type d...
Implement the Python class `VariationSummary` described below. Class description: Implementation of the 'VariationSummary' model. TODO: type model description here. Attributes: lowest_price (Price): TODO: type description here. highest_price (Price): TODO: type description here. lowest_sale_price (Price): TODO: type d...
26ea1019115a1de3b1b37a4b830525e164ac55ce
<|skeleton|> class VariationSummary: """Implementation of the 'VariationSummary' model. TODO: type model description here. Attributes: lowest_price (Price): TODO: type description here. highest_price (Price): TODO: type description here. lowest_sale_price (Price): TODO: type description here. highest_sale_price (Pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VariationSummary: """Implementation of the 'VariationSummary' model. TODO: type model description here. Attributes: lowest_price (Price): TODO: type description here. highest_price (Price): TODO: type description here. lowest_sale_price (Price): TODO: type description here. highest_sale_price (Price): TODO: t...
the_stack_v2_python_sparse
awsecommerceservice/models/variation_summary.py
nidaizamir/Test-PY
train
0
3e501b06d17a3d9af586673d5222d41f9d53bf12
[ "parser_id = kwargs.get('id', None)\nlogparser = LogParserModel.from_dict(kwargs)\nif parser_id is None:\n self.session.add(logparser)\n self.session.commit()\nelse:\n query = self.session.query(LogParserModel)\n old_parser = query.filter(LogParserModel.id == parser_id).first()\n if old_parser:\n ...
<|body_start_0|> parser_id = kwargs.get('id', None) logparser = LogParserModel.from_dict(kwargs) if parser_id is None: self.session.add(logparser) self.session.commit() else: query = self.session.query(LogParserModel) old_parser = query.fil...
LogParserCustDao
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogParserCustDao: def upsert_logparser(self, **kwargs): """如果参数中不包含id,则新增parser,包含id,则修改parser""" <|body_0|> def get_all_logparsers(self, name=None, host=None, url=None, status=None): """获得所有的logparser :param name: dest名称 :param host: terms中的host :param url: terms中的U...
stack_v2_sparse_classes_36k_train_018887
1,968
permissive
[ { "docstring": "如果参数中不包含id,则新增parser,包含id,则修改parser", "name": "upsert_logparser", "signature": "def upsert_logparser(self, **kwargs)" }, { "docstring": "获得所有的logparser :param name: dest名称 :param host: terms中的host :param url: terms中的URL :param status: logparser status :return:", "name": "get_...
3
null
Implement the Python class `LogParserCustDao` described below. Class description: Implement the LogParserCustDao class. Method signatures and docstrings: - def upsert_logparser(self, **kwargs): 如果参数中不包含id,则新增parser,包含id,则修改parser - def get_all_logparsers(self, name=None, host=None, url=None, status=None): 获得所有的logpar...
Implement the Python class `LogParserCustDao` described below. Class description: Implement the LogParserCustDao class. Method signatures and docstrings: - def upsert_logparser(self, **kwargs): 如果参数中不包含id,则新增parser,包含id,则修改parser - def get_all_logparsers(self, name=None, host=None, url=None, status=None): 获得所有的logpar...
2e32e6e7b225e0bd87ee8c847c22862f12c51bb1
<|skeleton|> class LogParserCustDao: def upsert_logparser(self, **kwargs): """如果参数中不包含id,则新增parser,包含id,则修改parser""" <|body_0|> def get_all_logparsers(self, name=None, host=None, url=None, status=None): """获得所有的logparser :param name: dest名称 :param host: terms中的host :param url: terms中的U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogParserCustDao: def upsert_logparser(self, **kwargs): """如果参数中不包含id,则新增parser,包含id,则修改parser""" parser_id = kwargs.get('id', None) logparser = LogParserModel.from_dict(kwargs) if parser_id is None: self.session.add(logparser) self.session.commit() ...
the_stack_v2_python_sparse
nebula/dao/logparser_dao.py
threathunterX/nebula_web
train
2
67693f345d3d4c20f977a29af559448263f9afda
[ "self.letters = letters\nself.score_dict = {chr(i): score[i - ord('a')] for i in range(ord('a'), ord('z') + 1)}\nself.word_instances = [self.create_word_instance(word, index) for index, word in enumerate(words)]", "word = Word(word, index)\nword.score = self.get_score(word.word)\nreturn word", "result = 0\nfor ...
<|body_start_0|> self.letters = letters self.score_dict = {chr(i): score[i - ord('a')] for i in range(ord('a'), ord('z') + 1)} self.word_instances = [self.create_word_instance(word, index) for index, word in enumerate(words)] <|end_body_0|> <|body_start_1|> word = Word(word, index) ...
执行用时: 40 ms , 在所有 Python3 提交中击败了 100.00% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 33.33% 的用户 思路一: 把words的所有子集挑选出来, 看子集是否能用所有letters进行表示, 找到分数最高的子集 耗时 2 ^ (words长) = 2 ^ 14 [w1, w2, w3], [w4] 最长 = [w1, w2, w3]分数 + [w1, w2, w3] 用去掉w4构成的分数 + w4的分数 难点: 动态规划要想速度快, 必须有缓存. letters子集来生成缓存 常用函数: 从letters取出一部分后计算 计算已有word的分数
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: """执行用时: 40 ms , 在所有 Python3 提交中击败了 100.00% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 33.33% 的用户 思路一: 把words的所有子集挑选出来, 看子集是否能用所有letters进行表示, 找到分数最高的子集 耗时 2 ^ (words长) = 2 ^ 14 [w1, w2, w3], [w4] 最长 = [w1, w2, w3]分数 + [w1, w2, w3] 用去掉w4构成的分数 + w4的分数 难点: 动态规划要想速度快, 必须有缓存. letters子集来生成缓存 常用函...
stack_v2_sparse_classes_36k_train_018888
4,628
no_license
[ { "docstring": "score: 26个字母的值", "name": "__init__", "signature": "def __init__(self, words, letters, score)" }, { "docstring": "把一个单词变成对象,加入Solution", "name": "create_word_instance", "signature": "def create_word_instance(self, word, index)" }, { "docstring": "获取一个单词word的分值", ...
5
stack_v2_sparse_classes_30k_train_003965
Implement the Python class `Solution1` described below. Class description: 执行用时: 40 ms , 在所有 Python3 提交中击败了 100.00% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 33.33% 的用户 思路一: 把words的所有子集挑选出来, 看子集是否能用所有letters进行表示, 找到分数最高的子集 耗时 2 ^ (words长) = 2 ^ 14 [w1, w2, w3], [w4] 最长 = [w1, w2, w3]分数 + [w1, w2, w3] 用去掉w4构成的分数 + w4的分数 难...
Implement the Python class `Solution1` described below. Class description: 执行用时: 40 ms , 在所有 Python3 提交中击败了 100.00% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 33.33% 的用户 思路一: 把words的所有子集挑选出来, 看子集是否能用所有letters进行表示, 找到分数最高的子集 耗时 2 ^ (words长) = 2 ^ 14 [w1, w2, w3], [w4] 最长 = [w1, w2, w3]分数 + [w1, w2, w3] 用去掉w4构成的分数 + w4的分数 难...
a5327f5fa0b2220ec79a822dd655fb5ad9a28be0
<|skeleton|> class Solution1: """执行用时: 40 ms , 在所有 Python3 提交中击败了 100.00% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 33.33% 的用户 思路一: 把words的所有子集挑选出来, 看子集是否能用所有letters进行表示, 找到分数最高的子集 耗时 2 ^ (words长) = 2 ^ 14 [w1, w2, w3], [w4] 最长 = [w1, w2, w3]分数 + [w1, w2, w3] 用去掉w4构成的分数 + w4的分数 难点: 动态规划要想速度快, 必须有缓存. letters子集来生成缓存 常用函...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: """执行用时: 40 ms , 在所有 Python3 提交中击败了 100.00% 的用户 内存消耗: 15.2 MB , 在所有 Python3 提交中击败了 33.33% 的用户 思路一: 把words的所有子集挑选出来, 看子集是否能用所有letters进行表示, 找到分数最高的子集 耗时 2 ^ (words长) = 2 ^ 14 [w1, w2, w3], [w4] 最长 = [w1, w2, w3]分数 + [w1, w2, w3] 用去掉w4构成的分数 + w4的分数 难点: 动态规划要想速度快, 必须有缓存. letters子集来生成缓存 常用函数: 从letters取出...
the_stack_v2_python_sparse
得分最高的单词集合.py
ramwin/leetcode
train
1
263325aadcbc83d4459656519e8b456483fd3453
[ "startTime = datetime.datetime.now()\nprint('Retrieving prop assessment... \\n', end='\\r')\nsys.stdout.write('\\x1b[F')\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('bkin18_cjoe_klovett_sbrz', 'bkin18_cjoe_klovett_sbrz')\nTRIAL_NUM = 1000 if trial else sys.maxsize\nproperty_as...
<|body_start_0|> startTime = datetime.datetime.now() print('Retrieving prop assessment... \n', end='\r') sys.stdout.write('\x1b[F') client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('bkin18_cjoe_klovett_sbrz', 'bkin18_cjoe_klovett_sbrz') ...
retrievePropertyAssessmentData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class retrievePropertyAssessmentData: def execute(trial=False): """Retrieve Boston property assessment data set.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in ...
stack_v2_sparse_classes_36k_train_018889
4,246
no_license
[ { "docstring": "Retrieve Boston property assessment data set.", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing that invocat...
2
null
Implement the Python class `retrievePropertyAssessmentData` described below. Class description: Implement the retrievePropertyAssessmentData class. Method signatures and docstrings: - def execute(trial=False): Retrieve Boston property assessment data set. - def provenance(doc=prov.model.ProvDocument(), startTime=None...
Implement the Python class `retrievePropertyAssessmentData` described below. Class description: Implement the retrievePropertyAssessmentData class. Method signatures and docstrings: - def execute(trial=False): Retrieve Boston property assessment data set. - def provenance(doc=prov.model.ProvDocument(), startTime=None...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class retrievePropertyAssessmentData: def execute(trial=False): """Retrieve Boston property assessment data set.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class retrievePropertyAssessmentData: def execute(trial=False): """Retrieve Boston property assessment data set.""" startTime = datetime.datetime.now() print('Retrieving prop assessment... \n', end='\r') sys.stdout.write('\x1b[F') client = dml.pymongo.MongoClient() ...
the_stack_v2_python_sparse
bkin18_cjoe_klovett_sbrz/retrievePropertyAssessmentData.py
ROODAY/course-2017-fal-proj
train
3
da86ef7b92d36ebcfde763d4d96b1e11896e0960
[ "self.name = name\nself.bord = []\nfor i in range(0, 3):\n self.bord.append(Puzzle2Bord(definition[i:i + 2]))\nself.bord.append(Puzzle2Bord(definition[-1] + definition[0]))\nself.orientation = 0\nself.position = position\nself.numero = numero", "image = pygame.image.load(self.name)\nself.image = pygame.transfo...
<|body_start_0|> self.name = name self.bord = [] for i in range(0, 3): self.bord.append(Puzzle2Bord(definition[i:i + 2])) self.bord.append(Puzzle2Bord(definition[-1] + definition[0])) self.orientation = 0 self.position = position self.numero = numero <...
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette information va donc bouger au fu...
Puzzle2Piece
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle...
stack_v2_sparse_classes_36k_train_018890
17,451
permissive
[ { "docstring": "On définit la pièce: :param name: nom de l'image représentant la pièce :param definition: chaîne de 4 caractères indiquant les quatre couleurs au quatre angles :param position: c'est la position initiale de la pièce, on suppose que l'orientation est nulle pour commencer :param numero: numéro de ...
4
stack_v2_sparse_classes_30k_train_007970
Implement the Python class `Puzzle2Piece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la pos...
Implement the Python class `Puzzle2Piece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la pos...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette infor...
the_stack_v2_python_sparse
src/ensae_teaching_cs/special/puzzle_2.py
Pandinosaurus/ensae_teaching_cs
train
1
c5bf409af63efa0db325b91f509bb4f49884bc30
[ "def wb(s):\n if s == '':\n return True\n for i in range(1, len(s) + 1):\n if s[:i] in wordDict and wb(s[i:]):\n return True\n return False\nreturn wb(s)", "if not s:\n return True\nwordSet = set(wordDict)\nvalid_positions = [0]\nn = len(s)\nfor j in range(1, n + 1):\n for ...
<|body_start_0|> def wb(s): if s == '': return True for i in range(1, len(s) + 1): if s[:i] in wordDict and wb(s[i:]): return True return False return wb(s) <|end_body_0|> <|body_start_1|> if not s: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak_v1(self, s: str, wordDict: List[str]) -> bool: """Recursion. The worst performance is trying all of the 2^(n-1) partitions. There are quite duplications in the pervious implementaiotn. E.g. + 'abcde' - 'bcde' -> ['cde', 'de', 'e', ''] - 'cde' - 'de' - 'e' - ''""" ...
stack_v2_sparse_classes_36k_train_018891
4,160
no_license
[ { "docstring": "Recursion. The worst performance is trying all of the 2^(n-1) partitions. There are quite duplications in the pervious implementaiotn. E.g. + 'abcde' - 'bcde' -> ['cde', 'de', 'e', ''] - 'cde' - 'de' - 'e' - ''", "name": "wordBreak_v1", "signature": "def wordBreak_v1(self, s: str, wordDi...
3
stack_v2_sparse_classes_30k_train_016617
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak_v1(self, s: str, wordDict: List[str]) -> bool: Recursion. The worst performance is trying all of the 2^(n-1) partitions. There are quite duplications in the perviou...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak_v1(self, s: str, wordDict: List[str]) -> bool: Recursion. The worst performance is trying all of the 2^(n-1) partitions. There are quite duplications in the perviou...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def wordBreak_v1(self, s: str, wordDict: List[str]) -> bool: """Recursion. The worst performance is trying all of the 2^(n-1) partitions. There are quite duplications in the pervious implementaiotn. E.g. + 'abcde' - 'bcde' -> ['cde', 'de', 'e', ''] - 'cde' - 'de' - 'e' - ''""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak_v1(self, s: str, wordDict: List[str]) -> bool: """Recursion. The worst performance is trying all of the 2^(n-1) partitions. There are quite duplications in the pervious implementaiotn. E.g. + 'abcde' - 'bcde' -> ['cde', 'de', 'e', ''] - 'cde' - 'de' - 'e' - ''""" def wb...
the_stack_v2_python_sparse
python3/dynamic_programming/word_break.py
victorchu/algorithms
train
0
af15dc2333d6fb9f33f8f7b9703e55149d65f034
[ "limit = 20000\nmocker.patch.object(demisto, 'getLastRun', return_value=None)\nmain(command='fetch-events', params=PARAMS | {'limit': limit})\nassert str(MAX_ALERTS_PAGE_SIZE) == requests_mock.request_history[0].qs['$top'][0]", "mocker.patch.object(Microsoft365DefenderEventCollector.DefenderGetEvents, 'run', side...
<|body_start_0|> limit = 20000 mocker.patch.object(demisto, 'getLastRun', return_value=None) main(command='fetch-events', params=PARAMS | {'limit': limit}) assert str(MAX_ALERTS_PAGE_SIZE) == requests_mock.request_history[0].qs['$top'][0] <|end_body_0|> <|body_start_1|> mocker.p...
TestFetchEventsEdgeCases
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFetchEventsEdgeCases: def test_fetch_events_with_high_limit(self, mocker, requests_mock): """Given - limit args > the max allowed MAX_ALERTS_PAGE_SIZE (10,000) When - call the main for the command fetch_events. Then - validate the `limit` value was set top 10,000 and passed as the `$...
stack_v2_sparse_classes_36k_train_018892
8,420
permissive
[ { "docstring": "Given - limit args > the max allowed MAX_ALERTS_PAGE_SIZE (10,000) When - call the main for the command fetch_events. Then - validate the `limit` value was set top 10,000 and passed as the `$top` query param", "name": "test_fetch_events_with_high_limit", "signature": "def test_fetch_even...
2
null
Implement the Python class `TestFetchEventsEdgeCases` described below. Class description: Implement the TestFetchEventsEdgeCases class. Method signatures and docstrings: - def test_fetch_events_with_high_limit(self, mocker, requests_mock): Given - limit args > the max allowed MAX_ALERTS_PAGE_SIZE (10,000) When - call...
Implement the Python class `TestFetchEventsEdgeCases` described below. Class description: Implement the TestFetchEventsEdgeCases class. Method signatures and docstrings: - def test_fetch_events_with_high_limit(self, mocker, requests_mock): Given - limit args > the max allowed MAX_ALERTS_PAGE_SIZE (10,000) When - call...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestFetchEventsEdgeCases: def test_fetch_events_with_high_limit(self, mocker, requests_mock): """Given - limit args > the max allowed MAX_ALERTS_PAGE_SIZE (10,000) When - call the main for the command fetch_events. Then - validate the `limit` value was set top 10,000 and passed as the `$...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFetchEventsEdgeCases: def test_fetch_events_with_high_limit(self, mocker, requests_mock): """Given - limit args > the max allowed MAX_ALERTS_PAGE_SIZE (10,000) When - call the main for the command fetch_events. Then - validate the `limit` value was set top 10,000 and passed as the `$top` query par...
the_stack_v2_python_sparse
Packs/MicrosoftDefenderAdvancedThreatProtection/Integrations/Microsoft365DefenderEventCollector/Microsoft365DefenderEventCollector_test.py
demisto/content
train
1,023
922b61af26afb104a6d1f9d64eb57143c33ed5c9
[ "if not features.has(READ_FEATURE, organization, actor=request.user):\n return Response(status=404)\nif isinstance(dashboard, dict):\n return self.respond(dashboard)\nreturn self.respond(serialize(dashboard, request.user))", "if not features.has(EDIT_FEATURE, organization, actor=request.user):\n return R...
<|body_start_0|> if not features.has(READ_FEATURE, organization, actor=request.user): return Response(status=404) if isinstance(dashboard, dict): return self.respond(dashboard) return self.respond(serialize(dashboard, request.user)) <|end_body_0|> <|body_start_1|> ...
OrganizationDashboardDetailsEndpoint
[ "Apache-2.0", "BUSL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationDashboardDetailsEndpoint: def get(self, request: Request, organization, dashboard) -> Response: """Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam Organization organization: the organi...
stack_v2_sparse_classes_36k_train_018893
6,053
permissive
[ { "docstring": "Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam Organization organization: the organization the dashboard belongs to. :pparam Dashboard dashboard: the dashboard object :auth: required", "name": "get",...
3
null
Implement the Python class `OrganizationDashboardDetailsEndpoint` described below. Class description: Implement the OrganizationDashboardDetailsEndpoint class. Method signatures and docstrings: - def get(self, request: Request, organization, dashboard) -> Response: Retrieve an Organization's Dashboard ```````````````...
Implement the Python class `OrganizationDashboardDetailsEndpoint` described below. Class description: Implement the OrganizationDashboardDetailsEndpoint class. Method signatures and docstrings: - def get(self, request: Request, organization, dashboard) -> Response: Retrieve an Organization's Dashboard ```````````````...
d9dd4f382f96b5c4576b64cbf015db651556c18b
<|skeleton|> class OrganizationDashboardDetailsEndpoint: def get(self, request: Request, organization, dashboard) -> Response: """Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam Organization organization: the organi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrganizationDashboardDetailsEndpoint: def get(self, request: Request, organization, dashboard) -> Response: """Retrieve an Organization's Dashboard ```````````````````````````````````` Return details on an individual organization's dashboard. :pparam Organization organization: the organization the das...
the_stack_v2_python_sparse
src/sentry/api/endpoints/organization_dashboard_details.py
nagyist/sentry
train
0
1a26e4dc0293ea5e61eba87cdc6247a267ac67c2
[ "max_profit = 0\nprev_price = prices[0]\nfor price in prices[1:]:\n if price > prev_price:\n max_profit += price - prev_price\n prev_price = price\nreturn max_profit", "n = len(prices)\ndp = [[None, None] for _ in range(n)]\ndp[0][0], dp[0][1] = (0, -prices[0])\nfor idx in range(1, n):\n dp[idx][0...
<|body_start_0|> max_profit = 0 prev_price = prices[0] for price in prices[1:]: if price > prev_price: max_profit += price - prev_price prev_price = price return max_profit <|end_body_0|> <|body_start_1|> n = len(prices) dp = [[Non...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """贪心""" <|body_0|> def maxProfitDP(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_1|> def maxProfitDPOPT(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_018894
2,597
no_license
[ { "docstring": "贪心", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "动态规划-二维数组", "name": "maxProfitDP", "signature": "def maxProfitDP(self, prices: List[int]) -> int" }, { "docstring": "动态规划-空间优化", "name": "maxProfitDPOPT",...
3
stack_v2_sparse_classes_30k_train_011719
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 贪心 - def maxProfitDP(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOPT(self, prices: List[int]) -> int: 动态规划-空间优化
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 贪心 - def maxProfitDP(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOPT(self, prices: List[int]) -> int: 动态规划-空间优化 <|...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """贪心""" <|body_0|> def maxProfitDP(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_1|> def maxProfitDPOPT(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """贪心""" max_profit = 0 prev_price = prices[0] for price in prices[1:]: if price > prev_price: max_profit += price - prev_price prev_price = price return max_profit def...
the_stack_v2_python_sparse
122.买卖股票的最佳时机II/solution.py
QtTao/daily_leetcode
train
0
c77c50153c757aae12552c1e1880a31ec1d9f9a1
[ "kwargs['add_start'] = True\nkwargs['add_end'] = True\nobs = TorchRankerAgent.vectorize(self, *args, **kwargs)\nreturn obs", "if 'add_start' in kwargs:\n kwargs['add_start'] = True\n kwargs['add_end'] = True\nreturn super()._vectorize_text(*args, **kwargs)", "obs = super()._set_text_vec(*args, **kwargs)\n...
<|body_start_0|> kwargs['add_start'] = True kwargs['add_end'] = True obs = TorchRankerAgent.vectorize(self, *args, **kwargs) return obs <|end_body_0|> <|body_start_1|> if 'add_start' in kwargs: kwargs['add_start'] = True kwargs['add_end'] = True r...
Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).
BiencoderAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiencoderAgent: """Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).""" def vectorize(self, *args, **kwargs): """Add the start and end token to the text.""" <|body_0|> def _vectorize_text(self, *arg...
stack_v2_sparse_classes_36k_train_018895
5,244
permissive
[ { "docstring": "Add the start and end token to the text.", "name": "vectorize", "signature": "def vectorize(self, *args, **kwargs)" }, { "docstring": "Override to add start end tokens. necessary for fixed cands.", "name": "_vectorize_text", "signature": "def _vectorize_text(self, *args, ...
3
stack_v2_sparse_classes_30k_train_008610
Implement the Python class `BiencoderAgent` described below. Class description: Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face). Method signatures and docstrings: - def vectorize(self, *args, **kwargs): Add the start and end token to the text. ...
Implement the Python class `BiencoderAgent` described below. Class description: Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face). Method signatures and docstrings: - def vectorize(self, *args, **kwargs): Add the start and end token to the text. ...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class BiencoderAgent: """Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).""" def vectorize(self, *args, **kwargs): """Add the start and end token to the text.""" <|body_0|> def _vectorize_text(self, *arg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BiencoderAgent: """Bi-encoder Transformer Agent. Equivalent of bert_ranker/biencoder but does not rely on an external library (hugging face).""" def vectorize(self, *args, **kwargs): """Add the start and end token to the text.""" kwargs['add_start'] = True kwargs['add_end'] = True...
the_stack_v2_python_sparse
parlai/agents/transformer/biencoder.py
facebookresearch/ParlAI
train
10,943
a873c31f705f7238e5aa8ea8aaeb61e7323a4fd6
[ "FunctionFieldMorphism.__init__(self, parent, im_gen, base_morphism)\nR = self.codomain()['X']\nv = parent.domain().polynomial().list()\nif base_morphism is not None:\n v = [base_morphism(a) for a in v]\nf = R(v)\nif f(im_gen):\n raise ValueError('invalid morphism')", "v = x.list()\nif self._base_morphism i...
<|body_start_0|> FunctionFieldMorphism.__init__(self, parent, im_gen, base_morphism) R = self.codomain()['X'] v = parent.domain().polynomial().list() if base_morphism is not None: v = [base_morphism(a) for a in v] f = R(v) if f(im_gen): raise Value...
Morphism from a finite extension of a function field to a function field. EXAMPLES:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^2 - x) sage: f = L.hom(-y); f Function Field endomorphism of Function field in y defined by y^2 - x Defn: y |--> -y
FunctionFieldMorphism_polymod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionFieldMorphism_polymod: """Morphism from a finite extension of a function field to a function field. EXAMPLES:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^2 - x) sage: f = L.hom(-y); f Function Field endomorphism of Function field in y defined by y^2 - x Defn:...
stack_v2_sparse_classes_36k_train_018896
18,835
no_license
[ { "docstring": "EXAMPLES:: sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] sage: L.<y> = K.extension(y^3 + 6*x^3 + x) sage: f = L.hom(y*2); f Function Field endomorphism of Function field in y defined by y^3 + 6*x^3 + x Defn: y |--> 2*y sage: type(f) <class 'sage.rings.function_field.maps.FunctionFieldMorphism_...
2
null
Implement the Python class `FunctionFieldMorphism_polymod` described below. Class description: Morphism from a finite extension of a function field to a function field. EXAMPLES:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^2 - x) sage: f = L.hom(-y); f Function Field endomorphism of Funct...
Implement the Python class `FunctionFieldMorphism_polymod` described below. Class description: Morphism from a finite extension of a function field to a function field. EXAMPLES:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^2 - x) sage: f = L.hom(-y); f Function Field endomorphism of Funct...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class FunctionFieldMorphism_polymod: """Morphism from a finite extension of a function field to a function field. EXAMPLES:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^2 - x) sage: f = L.hom(-y); f Function Field endomorphism of Function field in y defined by y^2 - x Defn:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionFieldMorphism_polymod: """Morphism from a finite extension of a function field to a function field. EXAMPLES:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^2 - x) sage: f = L.hom(-y); f Function Field endomorphism of Function field in y defined by y^2 - x Defn: y |--> -y"""...
the_stack_v2_python_sparse
sage/src/sage/rings/function_field/maps.py
bopopescu/geosci
train
0
cb551029c7d4842f5f0ecf73a092b44db105a69f
[ "response = self.client.get(endpoint, filters, format='json')\nself.assertEqual(response.status_code, status_code)\nreturn response.data", "user_as_owner = Owner.get_owner(self.user)\nself.assertEqual(type(user_as_owner), Owner)\ngroup_as_owner = Owner.get_owner(self.group)\nself.assertEqual(type(group_as_owner),...
<|body_start_0|> response = self.client.get(endpoint, filters, format='json') self.assertEqual(response.status_code, status_code) return response.data <|end_body_0|> <|body_start_1|> user_as_owner = Owner.get_owner(self.user) self.assertEqual(type(user_as_owner), Owner) ...
Some simplistic tests to ensure the Owner model is setup correctly.
OwnerModelTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" <|body_0|> def test_owner(self): """Tests for the 'owner' model""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_018897
9,692
permissive
[ { "docstring": "Perform an API request", "name": "do_request", "signature": "def do_request(self, endpoint, filters, status_code=200)" }, { "docstring": "Tests for the 'owner' model", "name": "test_owner", "signature": "def test_owner(self)" }, { "docstring": "Test user APIs.", ...
4
stack_v2_sparse_classes_30k_train_019157
Implement the Python class `OwnerModelTest` described below. Class description: Some simplistic tests to ensure the Owner model is setup correctly. Method signatures and docstrings: - def do_request(self, endpoint, filters, status_code=200): Perform an API request - def test_owner(self): Tests for the 'owner' model -...
Implement the Python class `OwnerModelTest` described below. Class description: Some simplistic tests to ensure the Owner model is setup correctly. Method signatures and docstrings: - def do_request(self, endpoint, filters, status_code=200): Perform an API request - def test_owner(self): Tests for the 'owner' model -...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" <|body_0|> def test_owner(self): """Tests for the 'owner' model""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OwnerModelTest: """Some simplistic tests to ensure the Owner model is setup correctly.""" def do_request(self, endpoint, filters, status_code=200): """Perform an API request""" response = self.client.get(endpoint, filters, format='json') self.assertEqual(response.status_code, stat...
the_stack_v2_python_sparse
InvenTree/users/tests.py
inventree/InvenTree
train
3,077
41c19c704636a503d3c460b975214970ed878edf
[ "if not sequence:\n with self.assertRaises(ValueError):\n isambard.ampal.specifications.DNADuplex.from_sequence(sequence)\nelse:\n dd = isambard.ampal.specifications.DNADuplex.from_sequence(sequence)\n self.assertEqual(len(dd), 2)\n self.assertEqual(len(dd[0]), len(sequence))\n self.assertEqua...
<|body_start_0|> if not sequence: with self.assertRaises(ValueError): isambard.ampal.specifications.DNADuplex.from_sequence(sequence) else: dd = isambard.ampal.specifications.DNADuplex.from_sequence(sequence) self.assertEqual(len(dd), 2) se...
TestDNADuplex
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDNADuplex: def test_hna_random_seq(self, sequence): """Test straight duplex building using random DNA sequences.""" <|body_0|> def test_dna_duplex_ints(self, start, end): """Test DNADuplex with random int start and end.""" <|body_1|> def test_dna_dup...
stack_v2_sparse_classes_36k_train_018898
8,451
permissive
[ { "docstring": "Test straight duplex building using random DNA sequences.", "name": "test_hna_random_seq", "signature": "def test_hna_random_seq(self, sequence)" }, { "docstring": "Test DNADuplex with random int start and end.", "name": "test_dna_duplex_ints", "signature": "def test_dna_...
4
stack_v2_sparse_classes_30k_train_019435
Implement the Python class `TestDNADuplex` described below. Class description: Implement the TestDNADuplex class. Method signatures and docstrings: - def test_hna_random_seq(self, sequence): Test straight duplex building using random DNA sequences. - def test_dna_duplex_ints(self, start, end): Test DNADuplex with ran...
Implement the Python class `TestDNADuplex` described below. Class description: Implement the TestDNADuplex class. Method signatures and docstrings: - def test_hna_random_seq(self, sequence): Test straight duplex building using random DNA sequences. - def test_dna_duplex_ints(self, start, end): Test DNADuplex with ran...
ebc33b48a28ad217e18f93b910dfba46e6e71e07
<|skeleton|> class TestDNADuplex: def test_hna_random_seq(self, sequence): """Test straight duplex building using random DNA sequences.""" <|body_0|> def test_dna_duplex_ints(self, start, end): """Test DNADuplex with random int start and end.""" <|body_1|> def test_dna_dup...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDNADuplex: def test_hna_random_seq(self, sequence): """Test straight duplex building using random DNA sequences.""" if not sequence: with self.assertRaises(ValueError): isambard.ampal.specifications.DNADuplex.from_sequence(sequence) else: dd ...
the_stack_v2_python_sparse
unit_tests/test_na_building.py
woolfson-group/isambard
train
7
02dbfab5e8f72aff8b7f8abdadee89db5638d48f
[ "profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.comb.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Comb', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://www....
<|body_start_0|> profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.comb.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Comb', self, '') self.openWikiManualHelpPage = settings.HelpPage(...
A class to handle the comb settings.
CombRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CombRepository: """A class to handle the comb settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Comb button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_018899
18,456
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Comb button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_013836
Implement the Python class `CombRepository` described below. Class description: A class to handle the comb settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Comb button has been clicked.
Implement the Python class `CombRepository` described below. Class description: A class to handle the comb settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Comb button has been clicked. <|skeleton|> class CombRepositor...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class CombRepository: """A class to handle the comb settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Comb button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CombRepository: """A class to handle the comb settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" profile.addListsToCraftTypeRepository('skeinforge_tools.craft_plugins.comb.html', self) self.fileNameInput = settings.FileNameInput().g...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/comb.py
bmander/skeinforge
train
34