blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
85c92667f174749c2d68e710f2fce59dc1338007
[ "self.plugin = OpticalFlow(iterations=20)\nself.plugin.data_smoothing_radius = 3\nself.plugin.boxsize = 3\nrainfall_block = np.array([[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0...
<|body_start_0|> self.plugin = OpticalFlow(iterations=20) self.plugin.data_smoothing_radius = 3 self.plugin.boxsize = 3 rainfall_block = np.array([[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 2.0, 2.0, 2.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 1.0], [1.0, 2.0, 3.0, 3.0, 2.0, 1.0,...
Test calculation of advection displacement vectors
Test_calculate_displacement_vectors
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_calculate_displacement_vectors: """Test calculation of advection displacement vectors""" def setUp(self): """Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sens...
stack_v2_sparse_classes_75kplus_train_072100
37,677
permissive
[ { "docstring": "Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sensibly.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test outputs are of the correct typ...
3
null
Implement the Python class `Test_calculate_displacement_vectors` described below. Class description: Test calculation of advection displacement vectors Method signatures and docstrings: - def setUp(self): Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zer...
Implement the Python class `Test_calculate_displacement_vectors` described below. Class description: Test calculation of advection displacement vectors Method signatures and docstrings: - def setUp(self): Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zer...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_calculate_displacement_vectors: """Test calculation of advection displacement vectors""" def setUp(self): """Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sens...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_calculate_displacement_vectors: """Test calculation of advection displacement vectors""" def setUp(self): """Set up plugin options and input rainfall-like matrices that produce non-singular outputs. Large matrices with zeros are needed for the smoothing algorithms to behave sensibly.""" ...
the_stack_v2_python_sparse
improver_tests/nowcasting/optical_flow/test_OpticalFlow.py
metoppv/improver
train
101
d58f11e5172c450c8744e65b400586f3f40cfeff
[ "self.stacks = []\nself.cap = capacity\nself.open_positions = []", "while self.open_positions and self.open_positions[0] < len(self.stacks) and (len(self.stacks[self.open_positions[0]]) == self.cap):\n heapq.heappop(self.open_positions)\nif not self.open_positions:\n heapq.heappush(self.open_positions, len(...
<|body_start_0|> self.stacks = [] self.cap = capacity self.open_positions = [] <|end_body_0|> <|body_start_1|> while self.open_positions and self.open_positions[0] < len(self.stacks) and (len(self.stacks[self.open_positions[0]]) == self.cap): heapq.heappop(self.open_position...
DinnerPlates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def push(self, val): """:type val: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def popAtStack(self, index): """:t...
stack_v2_sparse_classes_75kplus_train_072101
1,445
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type val: int :rtype: None", "name": "push", "signature": "def push(self, val)" }, { "docstring": ":rtype: int", "name": "pop", "signature": "def pop(...
4
stack_v2_sparse_classes_30k_val_001469
Implement the Python class `DinnerPlates` described below. Class description: Implement the DinnerPlates class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def push(self, val): :type val: int :rtype: None - def pop(self): :rtype: int - def popAtStack(self, index): :type ind...
Implement the Python class `DinnerPlates` described below. Class description: Implement the DinnerPlates class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def push(self, val): :type val: int :rtype: None - def pop(self): :rtype: int - def popAtStack(self, index): :type ind...
20623defecf65cbc35b194d8b60d8b211816ee4f
<|skeleton|> class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def push(self, val): """:type val: int :rtype: None""" <|body_1|> def pop(self): """:rtype: int""" <|body_2|> def popAtStack(self, index): """:t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DinnerPlates: def __init__(self, capacity): """:type capacity: int""" self.stacks = [] self.cap = capacity self.open_positions = [] def push(self, val): """:type val: int :rtype: None""" while self.open_positions and self.open_positions[0] < len(self.stacks...
the_stack_v2_python_sparse
in_Python/1172 Dinner Plate Stacks.py
YangLiyli131/Leetcode2020
train
0
77794aca06a8a3554f00d620a3f12e60353e90ff
[ "if self.action == 'retrieve':\n return VideoAnalyticsSerializer\nreturn super().get_serializer_class()", "queryset = super().get_queryset().filter(branch__course__in=self.request.user.courses).filter(branch__course=self.kwargs['course_id'])\nif self.action == 'list':\n queryset = queryset.order_by('lesson_...
<|body_start_0|> if self.action == 'retrieve': return VideoAnalyticsSerializer return super().get_serializer_class() <|end_body_0|> <|body_start_1|> queryset = super().get_queryset().filter(branch__course__in=self.request.user.courses).filter(branch__course=self.kwargs['course_id'])...
VideoAnalyticsViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoAnalyticsViewSet: def get_serializer_class(self): """Return VideoAnalyticsSerializer for single objects, VideoSerializer for multiple objects.""" <|body_0|> def get_queryset(self): """Return a queryset of videos that the current user has access to. Order by the ...
stack_v2_sparse_classes_75kplus_train_072102
9,654
no_license
[ { "docstring": "Return VideoAnalyticsSerializer for single objects, VideoSerializer for multiple objects.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Return a queryset of videos that the current user has access to. Order by the item order in...
2
stack_v2_sparse_classes_30k_train_052873
Implement the Python class `VideoAnalyticsViewSet` described below. Class description: Implement the VideoAnalyticsViewSet class. Method signatures and docstrings: - def get_serializer_class(self): Return VideoAnalyticsSerializer for single objects, VideoSerializer for multiple objects. - def get_queryset(self): Retu...
Implement the Python class `VideoAnalyticsViewSet` described below. Class description: Implement the VideoAnalyticsViewSet class. Method signatures and docstrings: - def get_serializer_class(self): Return VideoAnalyticsSerializer for single objects, VideoSerializer for multiple objects. - def get_queryset(self): Retu...
f701eee3e8ced9a839401e268031c2d497252e8a
<|skeleton|> class VideoAnalyticsViewSet: def get_serializer_class(self): """Return VideoAnalyticsSerializer for single objects, VideoSerializer for multiple objects.""" <|body_0|> def get_queryset(self): """Return a queryset of videos that the current user has access to. Order by the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VideoAnalyticsViewSet: def get_serializer_class(self): """Return VideoAnalyticsSerializer for single objects, VideoSerializer for multiple objects.""" if self.action == 'retrieve': return VideoAnalyticsSerializer return super().get_serializer_class() def get_queryset(s...
the_stack_v2_python_sparse
coursera/views.py
cornytrace/SEP-Autumn-2018-Group2-Coursera
train
0
e24408eaacadad5351b7586dd9456db3eda5c912
[ "if not is_basic_identifier(object_type.name):\n raise BadRequest('Invalid object_type name: %s' % object_type.name)\nif not is_yaml_string_valid(object_type.definition):\n raise BadRequest('Invalid YAML definition')\nobject_type_id, version = self.clients.resource_registry.create(object_type)\nreturn object_...
<|body_start_0|> if not is_basic_identifier(object_type.name): raise BadRequest('Invalid object_type name: %s' % object_type.name) if not is_yaml_string_valid(object_type.definition): raise BadRequest('Invalid YAML definition') object_type_id, version = self.clients.resou...
A service for defining and managing object types used as resource, messages, etc.
ObjectManagementService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectManagementService: """A service for defining and managing object types used as resource, messages, etc.""" def create_object_type(self, object_type=None): """Should receive an ObjectType object""" <|body_0|> def update_object_type(self, object_type=None): "...
stack_v2_sparse_classes_75kplus_train_072103
2,353
no_license
[ { "docstring": "Should receive an ObjectType object", "name": "create_object_type", "signature": "def create_object_type(self, object_type=None)" }, { "docstring": "Should receive an ObjectType object", "name": "update_object_type", "signature": "def update_object_type(self, object_type=...
4
stack_v2_sparse_classes_30k_val_001519
Implement the Python class `ObjectManagementService` described below. Class description: A service for defining and managing object types used as resource, messages, etc. Method signatures and docstrings: - def create_object_type(self, object_type=None): Should receive an ObjectType object - def update_object_type(se...
Implement the Python class `ObjectManagementService` described below. Class description: A service for defining and managing object types used as resource, messages, etc. Method signatures and docstrings: - def create_object_type(self, object_type=None): Should receive an ObjectType object - def update_object_type(se...
1693081ddaacd4e72c75ab47c0289a04f08ca6c9
<|skeleton|> class ObjectManagementService: """A service for defining and managing object types used as resource, messages, etc.""" def create_object_type(self, object_type=None): """Should receive an ObjectType object""" <|body_0|> def update_object_type(self, object_type=None): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObjectManagementService: """A service for defining and managing object types used as resource, messages, etc.""" def create_object_type(self, object_type=None): """Should receive an ObjectType object""" if not is_basic_identifier(object_type.name): raise BadRequest('Invalid ob...
the_stack_v2_python_sparse
ion/services/coi/object_management_service.py
sfoley/coi-services
train
1
e0b32925aee455ca49a8ba47f6d45a72e7d74ee0
[ "super().__init__()\nself.fc_1 = nn.Linear(hid_dim, pf_dim)\nself.fc_2 = nn.Linear(pf_dim, hid_dim)\nself.dropout = nn.Dropout(dropout)", "x = self.dropout(torch.relu(self.fc_1(x)))\nx = self.fc_2(x)\nreturn x" ]
<|body_start_0|> super().__init__() self.fc_1 = nn.Linear(hid_dim, pf_dim) self.fc_2 = nn.Linear(pf_dim, hid_dim) self.dropout = nn.Dropout(dropout) <|end_body_0|> <|body_start_1|> x = self.dropout(torch.relu(self.fc_1(x))) x = self.fc_2(x) return x <|end_body_1|...
Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value
PositionwiseFeedforwardLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionwiseFeedforwardLayer: """Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value""" def __init__(se...
stack_v2_sparse_classes_75kplus_train_072104
10,223
permissive
[ { "docstring": "Initialize model with params.", "name": "__init__", "signature": "def __init__(self, hid_dim, pf_dim, dropout)" }, { "docstring": "Run a forward pass of model over the data.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_val_002083
Implement the Python class `PositionwiseFeedforwardLayer` described below. Class description: Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: th...
Implement the Python class `PositionwiseFeedforwardLayer` described below. Class description: Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: th...
9cdbf270487751a0ad6862b2fea2ccc0e23a0b67
<|skeleton|> class PositionwiseFeedforwardLayer: """Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value""" def __init__(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PositionwiseFeedforwardLayer: """Fully connected feed-forward network consisting of two linear transformations with a ReLU activation in between. Args: hid_dim: the hidden size of the encoder pf_dim: the dimension of the feedforward network model dropout: the dropout value""" def __init__(self, hid_dim, ...
the_stack_v2_python_sparse
caspr/models/transformer.py
microsoft/CASPR
train
29
c2daa60062af0f947ca5adcfb6c793504d0d9f42
[ "login_page.LoginPage(self.driver).login()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).Iamlandlord()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).close_weiChat()\nsleep(2)\nlandlord_nav_page.LandlordNavPage(self.driver).microshopmanager()\npo = landlord_microshopmanager_page.LandlordMicro...
<|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).microsh...
房东微店
TestMicroshopManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改微店名称和微店介绍""" <|body_0|> def test_view_again(self): """查看房东说明""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_page.LoginPage(self.driver).login() sleep(2) ...
stack_v2_sparse_classes_75kplus_train_072105
1,748
permissive
[ { "docstring": "编辑微店,更改微店名称和微店介绍", "name": "test_edit_weidian", "signature": "def test_edit_weidian(self)" }, { "docstring": "查看房东说明", "name": "test_view_again", "signature": "def test_view_again(self)" } ]
2
stack_v2_sparse_classes_30k_train_016961
Implement the Python class `TestMicroshopManager` described below. Class description: 房东微店 Method signatures and docstrings: - def test_edit_weidian(self): 编辑微店,更改微店名称和微店介绍 - def test_view_again(self): 查看房东说明
Implement the Python class `TestMicroshopManager` described below. Class description: 房东微店 Method signatures and docstrings: - def test_edit_weidian(self): 编辑微店,更改微店名称和微店介绍 - def test_view_again(self): 查看房东说明 <|skeleton|> class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改...
192c70c49a8e9e072b9d0d0136f02c653c589410
<|skeleton|> class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改微店名称和微店介绍""" <|body_0|> def test_view_again(self): """查看房东说明""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestMicroshopManager: """房东微店""" def test_edit_weidian(self): """编辑微店,更改微店名称和微店介绍""" login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).clos...
the_stack_v2_python_sparse
mayi/test_case/test_landlord_microshopmanager.py
18701016443/mayi
train
0
dec15e3d57cee6d22de2450fa64d084bcd37e05d
[ "self.redirect_settings = redirect_settings\nself.signer_info = signer_info\nself.extra_info = extra_info\nself.ui = ui\nself.notifications = notifications\nself.tags = tags\nself.order = order\nself.required = required\nself.sign_url_expires = APIHelper.RFC3339DateTime(sign_url_expires) if sign_url_expires else No...
<|body_start_0|> self.redirect_settings = redirect_settings self.signer_info = signer_info self.extra_info = extra_info self.ui = ui self.notifications = notifications self.tags = tags self.order = order self.required = required self.sign_url_expir...
Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_info (ExtraInfoSignerRequest): Coming soon: Do ...
UpdateSignerRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateSignerRequest: """Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_...
stack_v2_sparse_classes_75kplus_train_072106
5,602
permissive
[ { "docstring": "Constructor for the UpdateSignerRequest class", "name": "__init__", "signature": "def __init__(self, redirect_settings=None, signer_info=None, extra_info=None, ui=None, notifications=None, tags=None, order=None, required=None, sign_url_expires=None, additional_properties={})" }, { ...
2
stack_v2_sparse_classes_30k_train_011539
Implement the Python class `UpdateSignerRequest` described below. Class description: Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and emai...
Implement the Python class `UpdateSignerRequest` described below. Class description: Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and emai...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class UpdateSignerRequest: """Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateSignerRequest: """Implementation of the 'UpdateSignerRequest' model. TODO: type model description here. Attributes: redirect_settings (RedirectSettings): Return urls and domain settings signer_info (SignerInfo): Define the signers name, mobile and email if you are using notifications extra_info (ExtraIn...
the_stack_v2_python_sparse
idfy_rest_client/models/update_signer_request.py
dealflowteam/Idfy
train
0
9fadff94a61ed2e9b2d4adc3033d76075982f68e
[ "body = M.ResolveNames({'ReturnFullContactData': 'true'}, *[M.UnresolvedEntry(x) for x in names])\nkwargs = {}\nif principal:\n kwargs['impersonation'] = principal\nsuper().__init__(body, **kwargs)", "resp = sess.soap(self)\nresolutions = resp.xpath('//t:Resolution', namespaces=NAMESPACES)\nreturn resolutions"...
<|body_start_0|> body = M.ResolveNames({'ReturnFullContactData': 'true'}, *[M.UnresolvedEntry(x) for x in names]) kwargs = {} if principal: kwargs['impersonation'] = principal super().__init__(body, **kwargs) <|end_body_0|> <|body_start_1|> resp = sess.soap(self) ...
An EWS request to resolve email addresses and display names.
ResolveNamesRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResolveNamesRequest: """An EWS request to resolve email addresses and display names.""" def __init__(self, names, principal=None): """Initialize the request. :param names: The list of names to resolve.""" <|body_0|> def send(self, sess): """Send the resolve reque...
stack_v2_sparse_classes_75kplus_train_072107
1,790
permissive
[ { "docstring": "Initialize the request. :param names: The list of names to resolve.", "name": "__init__", "signature": "def __init__(self, names, principal=None)" }, { "docstring": "Send the resolve request, and return a list of user info objects. :type sess: respa_exchange.session.ExchangeSessi...
2
null
Implement the Python class `ResolveNamesRequest` described below. Class description: An EWS request to resolve email addresses and display names. Method signatures and docstrings: - def __init__(self, names, principal=None): Initialize the request. :param names: The list of names to resolve. - def send(self, sess): S...
Implement the Python class `ResolveNamesRequest` described below. Class description: An EWS request to resolve email addresses and display names. Method signatures and docstrings: - def __init__(self, names, principal=None): Initialize the request. :param names: The list of names to resolve. - def send(self, sess): S...
e6ae93087dde0eb62f859da732ee19d0b6c5fccf
<|skeleton|> class ResolveNamesRequest: """An EWS request to resolve email addresses and display names.""" def __init__(self, names, principal=None): """Initialize the request. :param names: The list of names to resolve.""" <|body_0|> def send(self, sess): """Send the resolve reque...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResolveNamesRequest: """An EWS request to resolve email addresses and display names.""" def __init__(self, names, principal=None): """Initialize the request. :param names: The list of names to resolve.""" body = M.ResolveNames({'ReturnFullContactData': 'true'}, *[M.UnresolvedEntry(x) for ...
the_stack_v2_python_sparse
respa_exchange/ews/user.py
City-of-Helsinki/respa
train
69
09a2021dafc40470c5a853dc987d29047c04990e
[ "self.x_vel = self.y_vel = self.y_vel_i = 0\nself.grav = 20\nself.fall = False\nself.time = None", "if self.fall:\n time_now = pg.time.get_ticks()\n if not self.time:\n self.time = time_now\n self.y_vel = self.grav * ((time_now - self.time) / 1000.0) + self.y_vel_i\nelse:\n self.time = None\n ...
<|body_start_0|> self.x_vel = self.y_vel = self.y_vel_i = 0 self.grav = 20 self.fall = False self.time = None <|end_body_0|> <|body_start_1|> if self.fall: time_now = pg.time.get_ticks() if not self.time: self.time = time_now s...
A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.
_Physics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Physics: """A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.""" def __init__(self): """You can experiment with different gravity h...
stack_v2_sparse_classes_75kplus_train_072108
8,368
no_license
[ { "docstring": "You can experiment with different gravity here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "If the player is falling, calculate current y velocity.", "name": "physics_update", "signature": "def physics_update(self)" } ]
2
stack_v2_sparse_classes_30k_train_020766
Implement the Python class `_Physics` described below. Class description: A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself. Method signatures and docstrings: - def __...
Implement the Python class `_Physics` described below. Class description: A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself. Method signatures and docstrings: - def __...
7fc4e0d98d06b4e28b09844babb2452e229a603c
<|skeleton|> class _Physics: """A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.""" def __init__(self): """You can experiment with different gravity h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Physics: """A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.""" def __init__(self): """You can experiment with different gravity here.""" ...
the_stack_v2_python_sparse
meks-pygame-samples/platforming/fall_rotate.py
pk00749/Example_Python
train
1
add24ff3a68fc2f501bf20fd1ffecd35653c8553
[ "super(PrintCellLocations, self).__init__(experiment, name='PrintCellLocations', label=label)\nself.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0)\nself.epoch_end = self.experiment.config.getint(self.config_section, 'epoch_end', default=self.experiment.config.getint('Experiment',...
<|body_start_0|> super(PrintCellLocations, self).__init__(experiment, name='PrintCellLocations', label=label) self.epoch_start = self.experiment.config.getint(self.config_section, 'epoch_start', 0) self.epoch_end = self.experiment.config.getint(self.config_section, 'epoch_end', default=self.expe...
Write the x,y coordinates of each cell and its type Configuration parameters for this action are set in the [PrintCellLocations] section. Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end The epoch at which to stop executing (default: end of experiment) frequency The freque...
PrintCellLocations
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrintCellLocations: """Write the x,y coordinates of each cell and its type Configuration parameters for this action are set in the [PrintCellLocations] section. Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end The epoch at which to stop executing (de...
stack_v2_sparse_classes_75kplus_train_072109
3,422
permissive
[ { "docstring": "Initialize the PrintCellLocations Action", "name": "__init__", "signature": "def __init__(self, experiment, label=None)" }, { "docstring": "Execute the Action", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_022099
Implement the Python class `PrintCellLocations` described below. Class description: Write the x,y coordinates of each cell and its type Configuration parameters for this action are set in the [PrintCellLocations] section. Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end T...
Implement the Python class `PrintCellLocations` described below. Class description: Write the x,y coordinates of each cell and its type Configuration parameters for this action are set in the [PrintCellLocations] section. Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end T...
a114ac66e62a960e18127faf52cff9e48831e212
<|skeleton|> class PrintCellLocations: """Write the x,y coordinates of each cell and its type Configuration parameters for this action are set in the [PrintCellLocations] section. Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end The epoch at which to stop executing (de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrintCellLocations: """Write the x,y coordinates of each cell and its type Configuration parameters for this action are set in the [PrintCellLocations] section. Configuration Options: epoch_start The epoch at which to start executing (default: 0) epoch_end The epoch at which to stop executing (default: end of...
the_stack_v2_python_sparse
seeds/plugins/action/PrintCellLocations.py
namlehai/seeds
train
0
540cf245d71979eca721e76bc6857166d7ce46b0
[ "self.name = name\nself.control_state_dim = control_state_dim\nself.memory_size = memory_size\nself.memory_state_dim = memory_state_dim\nself.k_smallest = k_smallest\nself.gamma = gamma\nself.init_memory = mx.sym.Variable(self.name + ':init_memory') if init_memory is None else init_memory\nself.init_write_W_r_focus...
<|body_start_0|> self.name = name self.control_state_dim = control_state_dim self.memory_size = memory_size self.memory_state_dim = memory_state_dim self.k_smallest = k_smallest self.gamma = gamma self.init_memory = mx.sym.Variable(self.name + ':init_memory') if i...
LRUA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUA: def __init__(self, control_state_dim, memory_size, memory_state_dim, k_smallest, gamma, num_reads, num_writes, init_memory=None, init_read_W_r_focus=None, init_write_W_r_focus=None, init_write_W_w_focus=None, init_write_W_u_focus=None, name='LRUA'): """:param control_state_dim: :pa...
stack_v2_sparse_classes_75kplus_train_072110
14,452
no_license
[ { "docstring": ":param control_state_dim: :param memory_size: :param memory_state_dim: :param k_smallest: :param gamma: :param num_reads: :param num_writes: :param init_memory: Shape (batch_size, memory_size, memory_state_dim) :param init_write_W_r_focus: Shape (batch_size, num_write, memory_size) :param init_w...
3
stack_v2_sparse_classes_30k_train_027444
Implement the Python class `LRUA` described below. Class description: Implement the LRUA class. Method signatures and docstrings: - def __init__(self, control_state_dim, memory_size, memory_state_dim, k_smallest, gamma, num_reads, num_writes, init_memory=None, init_read_W_r_focus=None, init_write_W_r_focus=None, init...
Implement the Python class `LRUA` described below. Class description: Implement the LRUA class. Method signatures and docstrings: - def __init__(self, control_state_dim, memory_size, memory_state_dim, k_smallest, gamma, num_reads, num_writes, init_memory=None, init_read_W_r_focus=None, init_write_W_r_focus=None, init...
6ed303c10eaefd7e4ee52ab56b1ced6b773de244
<|skeleton|> class LRUA: def __init__(self, control_state_dim, memory_size, memory_state_dim, k_smallest, gamma, num_reads, num_writes, init_memory=None, init_read_W_r_focus=None, init_write_W_r_focus=None, init_write_W_w_focus=None, init_write_W_u_focus=None, name='LRUA'): """:param control_state_dim: :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUA: def __init__(self, control_state_dim, memory_size, memory_state_dim, k_smallest, gamma, num_reads, num_writes, init_memory=None, init_read_W_r_focus=None, init_write_W_r_focus=None, init_write_W_w_focus=None, init_write_W_u_focus=None, name='LRUA'): """:param control_state_dim: :param memory_siz...
the_stack_v2_python_sparse
arena/ops/lrua.py
flyers/Arena
train
0
12f1a10b58e738cf333837249ba81bb4dc30f4f0
[ "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...
Alpha services are services which are not supported and can be added/removed/changed anytime, without notice. Clients should not user them and build applications on top of this service
AlphaServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlphaServicer: """Alpha services are services which are not supported and can be added/removed/changed anytime, without notice. Clients should not user them and build applications on top of this service""" def Search(self, request, context): """you know, for search...""" <|bo...
stack_v2_sparse_classes_75kplus_train_072111
16,615
permissive
[ { "docstring": "you know, for search...", "name": "Search", "signature": "def Search(self, request, context)" }, { "docstring": "SearchSubscribe allows the client to request a live stream of updates based on client search request", "name": "SearchSubscribe", "signature": "def SearchSubsc...
2
stack_v2_sparse_classes_30k_train_035851
Implement the Python class `AlphaServicer` described below. Class description: Alpha services are services which are not supported and can be added/removed/changed anytime, without notice. Clients should not user them and build applications on top of this service Method signatures and docstrings: - def Search(self, r...
Implement the Python class `AlphaServicer` described below. Class description: Alpha services are services which are not supported and can be added/removed/changed anytime, without notice. Clients should not user them and build applications on top of this service Method signatures and docstrings: - def Search(self, r...
d93b5f66a00b1e3710257d607d62f9d43736304e
<|skeleton|> class AlphaServicer: """Alpha services are services which are not supported and can be added/removed/changed anytime, without notice. Clients should not user them and build applications on top of this service""" def Search(self, request, context): """you know, for search...""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlphaServicer: """Alpha services are services which are not supported and can be added/removed/changed anytime, without notice. Clients should not user them and build applications on top of this service""" def Search(self, request, context): """you know, for search...""" context.set_code(...
the_stack_v2_python_sparse
CVP_API/Snapshot_Utils/getSnapshots_Resource_API/cloudvision-python/cloudvision/Connector/gen/router_pb2_grpc.py
Hugh-Adams/Example_Scripts
train
4
15ed077d0c7468e1ea28732f7a454ad414d249dc
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
AppCallback V1 allows user application to interact with Dapr runtime. User application needs to implement AppCallback service if it needs to receive message from dapr runtime.
AppCallbackServicer
[ "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppCallbackServicer: """AppCallback V1 allows user application to interact with Dapr runtime. User application needs to implement AppCallback service if it needs to receive message from dapr runtime.""" def OnInvoke(self, request, context): """Invokes service method with InvokeReques...
stack_v2_sparse_classes_75kplus_train_072112
16,126
permissive
[ { "docstring": "Invokes service method with InvokeRequest.", "name": "OnInvoke", "signature": "def OnInvoke(self, request, context)" }, { "docstring": "Lists all topics subscribed by this app.", "name": "ListTopicSubscriptions", "signature": "def ListTopicSubscriptions(self, request, con...
5
stack_v2_sparse_classes_30k_test_001445
Implement the Python class `AppCallbackServicer` described below. Class description: AppCallback V1 allows user application to interact with Dapr runtime. User application needs to implement AppCallback service if it needs to receive message from dapr runtime. Method signatures and docstrings: - def OnInvoke(self, re...
Implement the Python class `AppCallbackServicer` described below. Class description: AppCallback V1 allows user application to interact with Dapr runtime. User application needs to implement AppCallback service if it needs to receive message from dapr runtime. Method signatures and docstrings: - def OnInvoke(self, re...
3337a98f1df05e6f12cefb2cfdfee8d19420de1f
<|skeleton|> class AppCallbackServicer: """AppCallback V1 allows user application to interact with Dapr runtime. User application needs to implement AppCallback service if it needs to receive message from dapr runtime.""" def OnInvoke(self, request, context): """Invokes service method with InvokeReques...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AppCallbackServicer: """AppCallback V1 allows user application to interact with Dapr runtime. User application needs to implement AppCallback service if it needs to receive message from dapr runtime.""" def OnInvoke(self, request, context): """Invokes service method with InvokeRequest.""" ...
the_stack_v2_python_sparse
dapr/proto/runtime/v1/appcallback_pb2_grpc.py
dapr/python-sdk
train
185
47ae6aae0321307823f97613e97d8a51af22d6e4
[ "max_shape = self._find_max_shape(self.fovlist)\nfig = plt.figure(figsize=(20, 16))\ngs = gridspec.GridSpec(max_shape[0], 16, figure=fig)\nself._plot_traces_with_cell_img(self.fovlist, gs, max_shape)", "shapes = []\nnum_of_labeled = 0\nfor fov in fovlist:\n shapes.append(fov.all_data.shape)\n try:\n ...
<|body_start_0|> max_shape = self._find_max_shape(self.fovlist) fig = plt.figure(figsize=(20, 16)) gs = gridspec.GridSpec(max_shape[0], 16, figure=fig) self._plot_traces_with_cell_img(self.fovlist, gs, max_shape) <|end_body_0|> <|body_start_1|> shapes = [] num_of_labeled...
Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.
ShowLabeledAndUnlabeled
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowLabeledAndUnlabeled: """Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.""" def run(self): """Main pipeline""" <|body_0|> def _find_max_shape(self, fovlist): """Iterate over the found files and decid...
stack_v2_sparse_classes_75kplus_train_072113
11,294
permissive
[ { "docstring": "Main pipeline", "name": "run", "signature": "def run(self)" }, { "docstring": "Iterate over the found files and decide upon the shape of the array that will hold the stacked data. This is useful when the number of measurements in each FOV was unequal.", "name": "_find_max_sha...
5
stack_v2_sparse_classes_30k_train_000617
Implement the Python class `ShowLabeledAndUnlabeled` described below. Class description: Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells. Method signatures and docstrings: - def run(self): Main pipeline - def _find_max_shape(self, fovlist): Iterate over the ...
Implement the Python class `ShowLabeledAndUnlabeled` described below. Class description: Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells. Method signatures and docstrings: - def run(self): Main pipeline - def _find_max_shape(self, fovlist): Iterate over the ...
87fcca6fd79f65122b4010d2225d10403450da7e
<|skeleton|> class ShowLabeledAndUnlabeled: """Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.""" def run(self): """Main pipeline""" <|body_0|> def _find_max_shape(self, fovlist): """Iterate over the found files and decid...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShowLabeledAndUnlabeled: """Plots a simple comparison of the dF/F traces that originated from the unlabeled cells and the labeled cells.""" def run(self): """Main pipeline""" max_shape = self._find_max_shape(self.fovlist) fig = plt.figure(figsize=(20, 16)) gs = gridspec.Gr...
the_stack_v2_python_sparse
calcium_bflow_analysis/colabeled_cells/compare_labeled_unlabeled.py
PBLab/ca-analysis-bloodflow
train
0
eddc8eb62a93f89b2879a81c80c054cfb626ec9a
[ "t = TableFu(self.csv_file, sorted_by={'Author': {'reverse': True}})\nself.table.pop(0)\nself.table.sort(key=lambda row: row[0], reverse=True)\nself.assertEqual(t[0].cells, self.table[0])", "t = TableFu(self.csv_file)\npages = t.values('Number of Pages')\npages = sorted(pages, reverse=True)\nt.sort('Number of Pag...
<|body_start_0|> t = TableFu(self.csv_file, sorted_by={'Author': {'reverse': True}}) self.table.pop(0) self.table.sort(key=lambda row: row[0], reverse=True) self.assertEqual(t[0].cells, self.table[0]) <|end_body_0|> <|body_start_1|> t = TableFu(self.csv_file) pages = t.v...
OptionsTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsTest: def test_sort_option_str(self): """Sort the table by a string field, Author""" <|body_0|> def test_sort_option_int(self): """Sorting the table by an int field, Number of Pages""" <|body_1|> <|end_skeleton|> <|body_start_0|> t = TableFu(...
stack_v2_sparse_classes_75kplus_train_072114
30,557
no_license
[ { "docstring": "Sort the table by a string field, Author", "name": "test_sort_option_str", "signature": "def test_sort_option_str(self)" }, { "docstring": "Sorting the table by an int field, Number of Pages", "name": "test_sort_option_int", "signature": "def test_sort_option_int(self)" ...
2
stack_v2_sparse_classes_30k_train_007603
Implement the Python class `OptionsTest` described below. Class description: Implement the OptionsTest class. Method signatures and docstrings: - def test_sort_option_str(self): Sort the table by a string field, Author - def test_sort_option_int(self): Sorting the table by an int field, Number of Pages
Implement the Python class `OptionsTest` described below. Class description: Implement the OptionsTest class. Method signatures and docstrings: - def test_sort_option_str(self): Sort the table by a string field, Author - def test_sort_option_int(self): Sorting the table by an int field, Number of Pages <|skeleton|> ...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class OptionsTest: def test_sort_option_str(self): """Sort the table by a string field, Author""" <|body_0|> def test_sort_option_int(self): """Sorting the table by an int field, Number of Pages""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptionsTest: def test_sort_option_str(self): """Sort the table by a string field, Author""" t = TableFu(self.csv_file, sorted_by={'Author': {'reverse': True}}) self.table.pop(0) self.table.sort(key=lambda row: row[0], reverse=True) self.assertEqual(t[0].cells, self.tabl...
the_stack_v2_python_sparse
repoData/eyeseast-python-tablefu/allPythonContent.py
aCoffeeYin/pyreco
train
0
146bdf8e2adb3efcd7e785903d1552757e82abba
[ "m = defaultdict(int)\nn = len(nums)\nres = 1\nfor i in range(n):\n for j in range(i):\n diff = nums[i] - nums[j]\n m[i, diff] = m[j, diff] + 1\n res = max(res, m[i, diff])\nreturn res + 1", "n = len(nums)\ndp = [[0] * 2000 for _ in range(n)]\nres = 1\nfor i in range(n):\n for j in rang...
<|body_start_0|> m = defaultdict(int) n = len(nums) res = 1 for i in range(n): for j in range(i): diff = nums[i] - nums[j] m[i, diff] = m[j, diff] + 1 res = max(res, m[i, diff]) return res + 1 <|end_body_0|> <|body_star...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestArithSeqLength(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestArithSeqLengthDP(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> m = defaultdict(int) ...
stack_v2_sparse_classes_75kplus_train_072115
2,814
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "longestArithSeqLength", "signature": "def longestArithSeqLength(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "longestArithSeqLengthDP", "signature": "def longestArithSeqLengthDP(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_041079
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestArithSeqLength(self, nums): :type nums: List[int] :rtype: int - def longestArithSeqLengthDP(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestArithSeqLength(self, nums): :type nums: List[int] :rtype: int - def longestArithSeqLengthDP(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def longestArithSeqLength(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def longestArithSeqLengthDP(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestArithSeqLength(self, nums): """:type nums: List[int] :rtype: int""" m = defaultdict(int) n = len(nums) res = 1 for i in range(n): for j in range(i): diff = nums[i] - nums[j] m[i, diff] = m[j, diff] + 1 ...
the_stack_v2_python_sparse
L/LongestArithmeticSubsequence.py
bssrdf/pyleet
train
2
93305daaac323b14a8f3131f62084a5cea006bfd
[ "if data is not None:\n if type(data) is not list:\n raise TypeError('data must be a list')\n if len(data) <= 2:\n raise ValueError('data must contain multiple values')\n self.mean = sum(data) / int(len(data))\n pre_var = []\n for i in data:\n pre_var.append((i - self.mean) ** 2)...
<|body_start_0|> if data is not None: if type(data) is not list: raise TypeError('data must be a list') if len(data) <= 2: raise ValueError('data must contain multiple values') self.mean = sum(data) / int(len(data)) pre_var = [] ...
doc
Binomial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """doc""" def __init__(self, data=None, n=1, p=0.5): """doc""" <|body_0|> def factorial(self, x): """doc""" <|body_1|> def pmf(self, k): """doc""" <|body_2|> def cdf(self, k): """doc""" <|body_3|> <|end...
stack_v2_sparse_classes_75kplus_train_072116
1,814
no_license
[ { "docstring": "doc", "name": "__init__", "signature": "def __init__(self, data=None, n=1, p=0.5)" }, { "docstring": "doc", "name": "factorial", "signature": "def factorial(self, x)" }, { "docstring": "doc", "name": "pmf", "signature": "def pmf(self, k)" }, { "doc...
4
stack_v2_sparse_classes_30k_train_023176
Implement the Python class `Binomial` described below. Class description: doc Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): doc - def factorial(self, x): doc - def pmf(self, k): doc - def cdf(self, k): doc
Implement the Python class `Binomial` described below. Class description: doc Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): doc - def factorial(self, x): doc - def pmf(self, k): doc - def cdf(self, k): doc <|skeleton|> class Binomial: """doc""" def __init__(self, data=None, ...
3bffd1391b3fc790f0137d0afbe90eb8e2f7d713
<|skeleton|> class Binomial: """doc""" def __init__(self, data=None, n=1, p=0.5): """doc""" <|body_0|> def factorial(self, x): """doc""" <|body_1|> def pmf(self, k): """doc""" <|body_2|> def cdf(self, k): """doc""" <|body_3|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Binomial: """doc""" def __init__(self, data=None, n=1, p=0.5): """doc""" if data is not None: if type(data) is not list: raise TypeError('data must be a list') if len(data) <= 2: raise ValueError('data must contain multiple values') ...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
pafuentess/holbertonschool-machine_learning
train
0
e40ff04e83b425bb0e4116a2b3307c82727f2117
[ "super(TransformerDecoder, self).__init__()\nself._hidden_size = opts.hidden_size\nself._output_size = opts.embedding_dim\nself.layers = nn.ModuleList([TransformerDecoderLayer(opts, size=opts.hidden_size, ff_size=opts.ff_size, num_heads=opts.num_heads, dropout=opts.dropout) for _ in range(opts.num_layers)])\nself.p...
<|body_start_0|> super(TransformerDecoder, self).__init__() self._hidden_size = opts.hidden_size self._output_size = opts.embedding_dim self.layers = nn.ModuleList([TransformerDecoderLayer(opts, size=opts.hidden_size, ff_size=opts.ff_size, num_heads=opts.num_heads, dropout=opts.dropout) ...
A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.
TransformerDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerDecoder: """A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.""" def __init__(self, opts, freeze: bool=False, **kwargs): """Initialize a Transformer decoder. :param num_layers: number of Transformer layer...
stack_v2_sparse_classes_75kplus_train_072117
4,320
no_license
[ { "docstring": "Initialize a Transformer decoder. :param num_layers: number of Transformer layers :param num_heads: number of heads for each layer :param hidden_size: hidden size :param ff_size: position-wise feed-forward size :param dropout: dropout probability (1-keep) :param emb_dropout: dropout probability ...
2
stack_v2_sparse_classes_30k_train_043598
Implement the Python class `TransformerDecoder` described below. Class description: A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future. Method signatures and docstrings: - def __init__(self, opts, freeze: bool=False, **kwargs): Initialize a Transforme...
Implement the Python class `TransformerDecoder` described below. Class description: A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future. Method signatures and docstrings: - def __init__(self, opts, freeze: bool=False, **kwargs): Initialize a Transforme...
e213665be8d3820fa2fc0aa9afe9949fd2e3d488
<|skeleton|> class TransformerDecoder: """A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.""" def __init__(self, opts, freeze: bool=False, **kwargs): """Initialize a Transformer decoder. :param num_layers: number of Transformer layer...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformerDecoder: """A transformer decoder with N masked layers. Decoder layers are masked so that an attention head cannot see the future.""" def __init__(self, opts, freeze: bool=False, **kwargs): """Initialize a Transformer decoder. :param num_layers: number of Transformer layers :param num_...
the_stack_v2_python_sparse
modules/transformer_decoder.py
zqp111/transformer_ar
train
1
40c484a642b254feeefc6e17420099821c655bd5
[ "self.hashdict = {}\nself.po = preorder\nfor i in range(len(inorder)):\n self.hashdict[inorder[i]] = i\nself.buildTreeByRoot(0, 0, len(inorder) - 1)", "if in_left > in_right:\n return\nroot = TreeNode(self.po[pre_root])\ni = self.hashdict[self.po[pre_root]]\nroot.left = self.buildTreeByRoot(pre_root + 1, in...
<|body_start_0|> self.hashdict = {} self.po = preorder for i in range(len(inorder)): self.hashdict[inorder[i]] = i self.buildTreeByRoot(0, 0, len(inorder) - 1) <|end_body_0|> <|body_start_1|> if in_left > in_right: return root = TreeNode(self.po[p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def RebuildBinaryTreeByPreAndMid(self, preorder: List[int], inorder: List[int]) -> TreeNode: """根据前序遍历和中序遍历重建二叉树 :param preorder: :param inorder: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(N)""" <|body_0|> def buildTreeByRoot(self, pre_root: int, in_left: int, in_right: int) ...
stack_v2_sparse_classes_75kplus_train_072118
3,653
no_license
[ { "docstring": "根据前序遍历和中序遍历重建二叉树 :param preorder: :param inorder: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(N)", "name": "RebuildBinaryTreeByPreAndMid", "signature": "def RebuildBinaryTreeByPreAndMid(self, preorder: List[int], inorder: List[int]) -> TreeNode" }, { "docstring": "根据根节点,左右字数边界递推 :param pre_r...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def RebuildBinaryTreeByPreAndMid(self, preorder: List[int], inorder: List[int]) -> TreeNode: 根据前序遍历和中序遍历重建二叉树 :param preorder: :param inorder: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(N) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def RebuildBinaryTreeByPreAndMid(self, preorder: List[int], inorder: List[int]) -> TreeNode: 根据前序遍历和中序遍历重建二叉树 :param preorder: :param inorder: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(N) ...
32941ee052d0985a9569441d314378700ff4d225
<|skeleton|> class Solution: def RebuildBinaryTreeByPreAndMid(self, preorder: List[int], inorder: List[int]) -> TreeNode: """根据前序遍历和中序遍历重建二叉树 :param preorder: :param inorder: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(N)""" <|body_0|> def buildTreeByRoot(self, pre_root: int, in_left: int, in_right: int) ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def RebuildBinaryTreeByPreAndMid(self, preorder: List[int], inorder: List[int]) -> TreeNode: """根据前序遍历和中序遍历重建二叉树 :param preorder: :param inorder: :return: 复杂度分析:时间复杂度O(N),空间复杂度O(N)""" self.hashdict = {} self.po = preorder for i in range(len(inorder)): self...
the_stack_v2_python_sparse
cecilia-python/剑指offer/chapter-4/RebuildBinaryTreeByPreAndMid.py
Cecilia520/algorithmic-learning-leetcode
train
7
e28302e637fe6c223cf456d6e9fdbba18ebdef25
[ "if not root:\n return\nself.flatten(root.left)\nself.flatten(root.right)\ntmp = root.right\nroot.right = root.left\nroot.left = None\nwhile root.right:\n root = root.right\nroot.right = tmp", "cur = root\nwhile cur:\n if cur.left:\n p = cur.left\n while p.right:\n p = p.right\n ...
<|body_start_0|> if not root: return self.flatten(root.left) self.flatten(root.right) tmp = root.right root.right = root.left root.left = None while root.right: root = root.right root.right = tmp <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """Do not return anything, modify root in-place instead.""" <|body_0|> def flatten(self, root) -> None: """Do not return anything, modify root in-place instead.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if no...
stack_v2_sparse_classes_75kplus_train_072119
841
no_license
[ { "docstring": "Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": "Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root) -> None" } ]
2
stack_v2_sparse_classes_30k_train_010592
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): Do not return anything, modify root in-place instead. - def flatten(self, root) -> None: Do not return anything, modify root in-place instead.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): Do not return anything, modify root in-place instead. - def flatten(self, root) -> None: Do not return anything, modify root in-place instead. <|skeleto...
18e6ac79573b3f535ca5e3eaa477eac0e60bf510
<|skeleton|> class Solution: def flatten(self, root): """Do not return anything, modify root in-place instead.""" <|body_0|> def flatten(self, root) -> None: """Do not return anything, modify root in-place instead.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def flatten(self, root): """Do not return anything, modify root in-place instead.""" if not root: return self.flatten(root.left) self.flatten(root.right) tmp = root.right root.right = root.left root.left = None while root.ri...
the_stack_v2_python_sparse
leetcode_树_二叉树展开为链表.py
cmychina/Leetcode
train
0
298efcb9bca28839396b1980075a94d298edb1a0
[ "frame_load = 10 * [['H'], ['T']]\nexpected = math.log(2)\nframe = self.context.frame.create(frame_load, schema=[('data', str)])\ncomputed_entropy = frame.entropy('data')\nself.assertAlmostEqual(computed_entropy, expected, delta=0.001)", "frame_load = [[0, 1], [1, 2], [2, 4], [4, 8]]\nexpected = 1.640223928941852...
<|body_start_0|> frame_load = 10 * [['H'], ['T']] expected = math.log(2) frame = self.context.frame.create(frame_load, schema=[('data', str)]) computed_entropy = frame.entropy('data') self.assertAlmostEqual(computed_entropy, expected, delta=0.001) <|end_body_0|> <|body_start_1|>...
EntropyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntropyTest: def test_entropy_coin_flip(self): """Get entropy on balanced coin flip.""" <|body_0|> def test_entropy_exponential(self): """Get entropy on exponential distribution.""" <|body_1|> <|end_skeleton|> <|body_start_0|> frame_load = 10 * [['H...
stack_v2_sparse_classes_75kplus_train_072120
2,228
permissive
[ { "docstring": "Get entropy on balanced coin flip.", "name": "test_entropy_coin_flip", "signature": "def test_entropy_coin_flip(self)" }, { "docstring": "Get entropy on exponential distribution.", "name": "test_entropy_exponential", "signature": "def test_entropy_exponential(self)" } ]
2
stack_v2_sparse_classes_30k_train_023639
Implement the Python class `EntropyTest` described below. Class description: Implement the EntropyTest class. Method signatures and docstrings: - def test_entropy_coin_flip(self): Get entropy on balanced coin flip. - def test_entropy_exponential(self): Get entropy on exponential distribution.
Implement the Python class `EntropyTest` described below. Class description: Implement the EntropyTest class. Method signatures and docstrings: - def test_entropy_coin_flip(self): Get entropy on balanced coin flip. - def test_entropy_exponential(self): Get entropy on exponential distribution. <|skeleton|> class Entr...
5548fc925b5c278263cbdebbd9e8c7593320c2f4
<|skeleton|> class EntropyTest: def test_entropy_coin_flip(self): """Get entropy on balanced coin flip.""" <|body_0|> def test_entropy_exponential(self): """Get entropy on exponential distribution.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntropyTest: def test_entropy_coin_flip(self): """Get entropy on balanced coin flip.""" frame_load = 10 * [['H'], ['T']] expected = math.log(2) frame = self.context.frame.create(frame_load, schema=[('data', str)]) computed_entropy = frame.entropy('data') self.as...
the_stack_v2_python_sparse
regression-tests/sparktkregtests/testcases/frames/entropy_test.py
trustedanalytics/spark-tk
train
35
8c1f20d35445bf12545fa6c9cd06ac6c9d1a0ae5
[ "tclasses = Class.objects.xall().filter(teachers__id=teacher_id, lps_version='3.0', class_type=Class.CLASS_TYPE_NORMAL, status=Class.STATUS_ONGOING, is_active=True)\nclass_list = list()\nfor tclass in tclasses:\n _students = tclass.students.all().filter(classstudents__status=ClassStudents.STATUS_NORMAL)\n csi...
<|body_start_0|> tclasses = Class.objects.xall().filter(teachers__id=teacher_id, lps_version='3.0', class_type=Class.CLASS_TYPE_NORMAL, status=Class.STATUS_ONGOING, is_active=True) class_list = list() for tclass in tclasses: _students = tclass.students.all().filter(classstudents__sta...
教师信息
TeacherOverview
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeacherOverview: """教师信息""" def processing_classes(teacher_id): """接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_cl...
stack_v2_sparse_classes_75kplus_train_072121
13,470
no_license
[ { "docstring": "接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_clmt': 即将开始的班会(见mz_lps3.functions_gt.get_classmeeting_list), 'class_begin_date': ...
3
stack_v2_sparse_classes_30k_train_041469
Implement the Python class `TeacherOverview` described below. Class description: 教师信息 Method signatures and docstrings: - def processing_classes(teacher_id): 接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int...
Implement the Python class `TeacherOverview` described below. Class description: 教师信息 Method signatures and docstrings: - def processing_classes(teacher_id): 接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int...
aec5d23bb412f7dfca374fb5c5b9988c1b817347
<|skeleton|> class TeacherOverview: """教师信息""" def processing_classes(teacher_id): """接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_cl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeacherOverview: """教师信息""" def processing_classes(teacher_id): """接口:一个老师所有进行中的班级 :param teacher_id: int :return: class_list = [ { 'class_total_done_tasks': 新增作业(int, N), 'class_id': 班级id(int, N+), 'class_left_days': 班级倒计时(int, N+ or -1(班级未开始时class_left_days为-1)), 'about_to_begin_clmt': 即将开始的班会(...
the_stack_v2_python_sparse
hotfix/apps/mz_usercenter/teacher/interface.py
az0ne/python
train
0
9ef10f62840fe87c63f72740b07a4416c0e72283
[ "address = self.transport.getAddress()\nlog.msg('Client %d login in.[%s,%d]' % (self.transport.sessionno, address[0], address[1]))\nself.factory.connmanager.addConnection(self)\nself.factory.doConnectionMade(self)", "log.msg('Client %d login out.' % self.transport.sessionno)\nself.factory.doConnectionLost(self)\n...
<|body_start_0|> address = self.transport.getAddress() log.msg('Client %d login in.[%s,%d]' % (self.transport.sessionno, address[0], address[1])) self.factory.connmanager.addConnection(self) self.factory.doConnectionMade(self) <|end_body_0|> <|body_start_1|> log.msg('Client %d l...
协议
LiberateProtocol
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LiberateProtocol: """协议""" def connectionMade(self): """连接建立处理""" <|body_0|> def connectionLost(self, reason): """连接断开处理""" <|body_1|> def safeToWriteData(self, data, command): """线程安全的向客户端发送数据 @param data: str 要向客户端写的数据""" <|body_2|>...
stack_v2_sparse_classes_75kplus_train_072122
4,082
no_license
[ { "docstring": "连接建立处理", "name": "connectionMade", "signature": "def connectionMade(self)" }, { "docstring": "连接断开处理", "name": "connectionLost", "signature": "def connectionLost(self, reason)" }, { "docstring": "线程安全的向客户端发送数据 @param data: str 要向客户端写的数据", "name": "safeToWriteD...
4
stack_v2_sparse_classes_30k_train_018772
Implement the Python class `LiberateProtocol` described below. Class description: 协议 Method signatures and docstrings: - def connectionMade(self): 连接建立处理 - def connectionLost(self, reason): 连接断开处理 - def safeToWriteData(self, data, command): 线程安全的向客户端发送数据 @param data: str 要向客户端写的数据 - def dataReceived(self, data): 数据到达...
Implement the Python class `LiberateProtocol` described below. Class description: 协议 Method signatures and docstrings: - def connectionMade(self): 连接建立处理 - def connectionLost(self, reason): 连接断开处理 - def safeToWriteData(self, data, command): 线程安全的向客户端发送数据 @param data: str 要向客户端写的数据 - def dataReceived(self, data): 数据到达...
d7a83a21287ed66aea690ecb6b73588569478be6
<|skeleton|> class LiberateProtocol: """协议""" def connectionMade(self): """连接建立处理""" <|body_0|> def connectionLost(self, reason): """连接断开处理""" <|body_1|> def safeToWriteData(self, data, command): """线程安全的向客户端发送数据 @param data: str 要向客户端写的数据""" <|body_2|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LiberateProtocol: """协议""" def connectionMade(self): """连接建立处理""" address = self.transport.getAddress() log.msg('Client %d login in.[%s,%d]' % (self.transport.sessionno, address[0], address[1])) self.factory.connmanager.addConnection(self) self.factory.doConnection...
the_stack_v2_python_sparse
gfirefly/netconnect/protoc.py
East196/diabloworld
train
3
d8234156f5dcae705d8a3a9adb8799f53d68b383
[ "self.league_name = league_name\nself.scraper = scraper\nself.parser = parser\nself.league_repository = league_repository\nself.team_repository = team_repository\nself.league_table_repository = league_table_repository", "league = self.league_repository.find_by_name(self.league_name)\nif league is None:\n loggi...
<|body_start_0|> self.league_name = league_name self.scraper = scraper self.parser = parser self.league_repository = league_repository self.team_repository = team_repository self.league_table_repository = league_table_repository <|end_body_0|> <|body_start_1|> le...
ScrapeLeagueTable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScrapeLeagueTable: def __init__(self, league_name, scraper: BaseScraper, parser: BaseParser, league_repository: BaseLeagueRepo, team_repository: BaseTeamRepo, league_table_repository: BaseLeagueTableRepo): """Constructor for ScrapeLeagueTable use case. :param league_name: Name of the lea...
stack_v2_sparse_classes_75kplus_train_072123
3,887
no_license
[ { "docstring": "Constructor for ScrapeLeagueTable use case. :param league_name: Name of the league to scrape the table. :param scraper: Scraper method to scrape league tables html :param parser: Parser method to parse the html scraped :param league_repository: Repository class of the leagues table :param team_r...
2
stack_v2_sparse_classes_30k_test_002168
Implement the Python class `ScrapeLeagueTable` described below. Class description: Implement the ScrapeLeagueTable class. Method signatures and docstrings: - def __init__(self, league_name, scraper: BaseScraper, parser: BaseParser, league_repository: BaseLeagueRepo, team_repository: BaseTeamRepo, league_table_reposit...
Implement the Python class `ScrapeLeagueTable` described below. Class description: Implement the ScrapeLeagueTable class. Method signatures and docstrings: - def __init__(self, league_name, scraper: BaseScraper, parser: BaseParser, league_repository: BaseLeagueRepo, team_repository: BaseTeamRepo, league_table_reposit...
02ed924429b41afb33c1cb2b0a8a6039c22a3a3e
<|skeleton|> class ScrapeLeagueTable: def __init__(self, league_name, scraper: BaseScraper, parser: BaseParser, league_repository: BaseLeagueRepo, team_repository: BaseTeamRepo, league_table_repository: BaseLeagueTableRepo): """Constructor for ScrapeLeagueTable use case. :param league_name: Name of the lea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScrapeLeagueTable: def __init__(self, league_name, scraper: BaseScraper, parser: BaseParser, league_repository: BaseLeagueRepo, team_repository: BaseTeamRepo, league_table_repository: BaseLeagueTableRepo): """Constructor for ScrapeLeagueTable use case. :param league_name: Name of the league to scrape ...
the_stack_v2_python_sparse
data/use_cases/scrape_league_table.py
danielsiles/Data-Mining-Project-1-ITC
train
1
386e07ffd35e8e0abafc0b950ed38ed17d9dc2e3
[ "def recursive(root, string):\n if not root:\n string += 'null,'\n else:\n string += str(root.val) + ','\n string = recursive(root.left, string)\n string = recursive(root.right, string)\n return string\nreturn recursive(root, '')", "def recursive(data):\n if data[0] == 'nul...
<|body_start_0|> def recursive(root, string): if not root: string += 'null,' else: string += str(root.val) + ',' string = recursive(root.left, string) string = recursive(root.right, string) return string ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_072124
5,096
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_053633
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
cc7740026c3774be21ab924b99ae7596ef20d0e4
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def recursive(root, string): if not root: string += 'null,' else: string += str(root.val) + ',' string = recursive...
the_stack_v2_python_sparse
HOT_100/094.py
yangtao0304/hands-on-programming-exercise
train
0
8b27247fac2a20f0e44aa58026368836d0551da9
[ "self.name = kwargs.get('name')\nself.project_name = kwargs.get('project_name')\nself.external_gateway = kwargs.get('external_gateway')\nself.admin_state_up = kwargs.get('admin_state_up', True)\nself.enable_snat = kwargs.get('enable_snat')\nif kwargs.get('internal_subnets'):\n self.internal_subnets = kwargs['int...
<|body_start_0|> self.name = kwargs.get('name') self.project_name = kwargs.get('project_name') self.external_gateway = kwargs.get('external_gateway') self.admin_state_up = kwargs.get('admin_state_up', True) self.enable_snat = kwargs.get('enable_snat') if kwargs.get('inter...
Class representing a router configuration
RouterConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouterConfig: """Class representing a router configuration""" def __init__(self, **kwargs): """Constructor - all parameters are optional :param name: The router name. :param project_name: The name of the project who owns the network. Only administrative users can specify a project ID...
stack_v2_sparse_classes_75kplus_train_072125
5,980
permissive
[ { "docstring": "Constructor - all parameters are optional :param name: The router name. :param project_name: The name of the project who owns the network. Only administrative users can specify a project ID other than their own. You cannot change this value through authorization policies. :param external_gateway...
2
stack_v2_sparse_classes_30k_train_044914
Implement the Python class `RouterConfig` described below. Class description: Class representing a router configuration Method signatures and docstrings: - def __init__(self, **kwargs): Constructor - all parameters are optional :param name: The router name. :param project_name: The name of the project who owns the ne...
Implement the Python class `RouterConfig` described below. Class description: Class representing a router configuration Method signatures and docstrings: - def __init__(self, **kwargs): Constructor - all parameters are optional :param name: The router name. :param project_name: The name of the project who owns the ne...
567cdf25e1319fbc8a1a874dd18d21f88948e67e
<|skeleton|> class RouterConfig: """Class representing a router configuration""" def __init__(self, **kwargs): """Constructor - all parameters are optional :param name: The router name. :param project_name: The name of the project who owns the network. Only administrative users can specify a project ID...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RouterConfig: """Class representing a router configuration""" def __init__(self, **kwargs): """Constructor - all parameters are optional :param name: The router name. :param project_name: The name of the project who owns the network. Only administrative users can specify a project ID other than t...
the_stack_v2_python_sparse
snaps/config/router.py
opnfv/snaps
train
2
15f785e873763bd0b559e7bd0053c42524230ffe
[ "super(SetUp, self).__init__(*args, **kwargs)\nself.arguments = arguments\nself._lexicographer = None\nself._builder = None\nreturn", "if self._lexicographer is None:\n glob = self.arguments.glob\n message = 'Building Lexicographer with glob ({0})'.format(glob)\n self.logger.debug(message)\n self._lex...
<|body_start_0|> super(SetUp, self).__init__(*args, **kwargs) self.arguments = arguments self._lexicographer = None self._builder = None return <|end_body_0|> <|body_start_1|> if self._lexicographer is None: glob = self.arguments.glob message = 'B...
The SetUp sets up the infrastructure
SetUp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetUp: """The SetUp sets up the infrastructure""" def __init__(self, arguments, *args, **kwargs): """:param: - `arguments`: An ArgumentParser Namespace""" <|body_0|> def lexicographer(self): """:return: Lexicographer that maps config-files""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_072126
1,568
permissive
[ { "docstring": ":param: - `arguments`: An ArgumentParser Namespace", "name": "__init__", "signature": "def __init__(self, arguments, *args, **kwargs)" }, { "docstring": ":return: Lexicographer that maps config-files", "name": "lexicographer", "signature": "def lexicographer(self)" }, ...
4
stack_v2_sparse_classes_30k_train_026253
Implement the Python class `SetUp` described below. Class description: The SetUp sets up the infrastructure Method signatures and docstrings: - def __init__(self, arguments, *args, **kwargs): :param: - `arguments`: An ArgumentParser Namespace - def lexicographer(self): :return: Lexicographer that maps config-files - ...
Implement the Python class `SetUp` described below. Class description: The SetUp sets up the infrastructure Method signatures and docstrings: - def __init__(self, arguments, *args, **kwargs): :param: - `arguments`: An ArgumentParser Namespace - def lexicographer(self): :return: Lexicographer that maps config-files - ...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class SetUp: """The SetUp sets up the infrastructure""" def __init__(self, arguments, *args, **kwargs): """:param: - `arguments`: An ArgumentParser Namespace""" <|body_0|> def lexicographer(self): """:return: Lexicographer that maps config-files""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SetUp: """The SetUp sets up the infrastructure""" def __init__(self, arguments, *args, **kwargs): """:param: - `arguments`: An ArgumentParser Namespace""" super(SetUp, self).__init__(*args, **kwargs) self.arguments = arguments self._lexicographer = None self._build...
the_stack_v2_python_sparse
apetools/proletarians/setuprun.py
russell-n/oldape
train
0
1ca2396c72164a52ed1b2f795deee85c27c5dbc6
[ "users = CRITsUser.objects(is_active=True, prefs__notify__email=True)\nnotifications = Notification.objects(status='new')\nfor user in users:\n includes = [x for x in notifications if user.username in x.users and user.username != x.analyst and (x.obj_id != None)]\n if len(includes):\n email = EmailNoti...
<|body_start_0|> users = CRITsUser.objects(is_active=True, prefs__notify__email=True) notifications = Notification.objects(status='new') for user in users: includes = [x for x in notifications if user.username in x.users and user.username != x.analyst and (x.obj_id != None)] ...
generate_notifications Django command
Command
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """generate_notifications Django command""" def handle(self, *args, **options): """Script Execution.""" <|body_0|> def process_notifications(self, notifications, users): """Set notifications to processed. Remove users from the list if they received an em...
stack_v2_sparse_classes_75kplus_train_072127
5,156
permissive
[ { "docstring": "Script Execution.", "name": "handle", "signature": "def handle(self, *args, **options)" }, { "docstring": "Set notifications to processed. Remove users from the list if they received an email. If any notification has 0 users left, remove it. Also remove any processed notification...
2
stack_v2_sparse_classes_30k_train_018004
Implement the Python class `Command` described below. Class description: generate_notifications Django command Method signatures and docstrings: - def handle(self, *args, **options): Script Execution. - def process_notifications(self, notifications, users): Set notifications to processed. Remove users from the list i...
Implement the Python class `Command` described below. Class description: generate_notifications Django command Method signatures and docstrings: - def handle(self, *args, **options): Script Execution. - def process_notifications(self, notifications, users): Set notifications to processed. Remove users from the list i...
81fc042efe61a252ee3433432f7bd7f0f11b217d
<|skeleton|> class Command: """generate_notifications Django command""" def handle(self, *args, **options): """Script Execution.""" <|body_0|> def process_notifications(self, notifications, users): """Set notifications to processed. Remove users from the list if they received an em...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Command: """generate_notifications Django command""" def handle(self, *args, **options): """Script Execution.""" users = CRITsUser.objects(is_active=True, prefs__notify__email=True) notifications = Notification.objects(status='new') for user in users: includes ...
the_stack_v2_python_sparse
crits/core/management/commands/generate_notifications.py
MITRECND/crits
train
22
2fefcc8b3acb3c0537d434c5b50a9de32dcdae4b
[ "self.train = []\nself.test = []\nself.k = k\nself.dataset_name = dataset_name\nwith open(url_train) as f:\n t = f.readlines()\n for x in range(len(t)):\n a = t[x].replace('\\n', '').split(',')\n self.train.append(a)\nwith open(url_test) as f:\n t = f.readlines()\n for x in range(len(t)):\...
<|body_start_0|> self.train = [] self.test = [] self.k = k self.dataset_name = dataset_name with open(url_train) as f: t = f.readlines() for x in range(len(t)): a = t[x].replace('\n', '').split(',') self.train.append(a) ...
This class implements the k-Nearest-Neighbor learner.
knn
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class knn: """This class implements the k-Nearest-Neighbor learner.""" def __init__(self, dataset_name='orig', url_train='data/spect-orig.train.csv', url_test='data/spect-orig.test.csv', k=5): """The constructor of the knn instance. :param url_train: the url for the train dataset file :par...
stack_v2_sparse_classes_75kplus_train_072128
4,167
permissive
[ { "docstring": "The constructor of the knn instance. :param url_train: the url for the train dataset file :param url_test: the url for the tst dataset file :param k: the k-th nearest neighbor", "name": "__init__", "signature": "def __init__(self, dataset_name='orig', url_train='data/spect-orig.train.csv...
5
stack_v2_sparse_classes_30k_train_019762
Implement the Python class `knn` described below. Class description: This class implements the k-Nearest-Neighbor learner. Method signatures and docstrings: - def __init__(self, dataset_name='orig', url_train='data/spect-orig.train.csv', url_test='data/spect-orig.test.csv', k=5): The constructor of the knn instance. ...
Implement the Python class `knn` described below. Class description: This class implements the k-Nearest-Neighbor learner. Method signatures and docstrings: - def __init__(self, dataset_name='orig', url_train='data/spect-orig.train.csv', url_test='data/spect-orig.test.csv', k=5): The constructor of the knn instance. ...
1da22b8560aa0426492288b243bb9d14397927f2
<|skeleton|> class knn: """This class implements the k-Nearest-Neighbor learner.""" def __init__(self, dataset_name='orig', url_train='data/spect-orig.train.csv', url_test='data/spect-orig.test.csv', k=5): """The constructor of the knn instance. :param url_train: the url for the train dataset file :par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class knn: """This class implements the k-Nearest-Neighbor learner.""" def __init__(self, dataset_name='orig', url_train='data/spect-orig.train.csv', url_test='data/spect-orig.test.csv', k=5): """The constructor of the knn instance. :param url_train: the url for the train dataset file :param url_test: ...
the_stack_v2_python_sparse
hw2/knn.py
ovimura/cs541-ai
train
0
a4ce95359fd52338a170a2bc0b1af9cec057deca
[ "super(LedDisplayEmulatorTask, self).__init__(actuatorName=ConfigConst.LED_ACTUATOR_NAME, actuatorType=ActuatorData.LED_DISPLAY_ACTUATOR_TYPE, simpleName='LED_Display')\nconfigUtil = ConfigUtil()\nif configUtil.getBoolean(ConfigConst.CONSTRAINED_DEVICE, ConfigConst.ENABLE_SENSE_HAT_KEY) is False:\n self.sh = Sen...
<|body_start_0|> super(LedDisplayEmulatorTask, self).__init__(actuatorName=ConfigConst.LED_ACTUATOR_NAME, actuatorType=ActuatorData.LED_DISPLAY_ACTUATOR_TYPE, simpleName='LED_Display') configUtil = ConfigUtil() if configUtil.getBoolean(ConfigConst.CONSTRAINED_DEVICE, ConfigConst.ENABLE_SENSE_HAT...
Shell representation of class for student implementation.
LedDisplayEmulatorTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LedDisplayEmulatorTask: """Shell representation of class for student implementation.""" def __init__(self): """Constructor check the configuration file to determine if use a emulator""" <|body_0|> def _handleActuation(self, cmd: int, val: float=0.0, stateData: str=None) ...
stack_v2_sparse_classes_75kplus_train_072129
1,982
permissive
[ { "docstring": "Constructor check the configuration file to determine if use a emulator", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Implement the function of showing related value on led screen cmd: int val: float = 0.0 stateData: str = None return int", "name"...
2
stack_v2_sparse_classes_30k_train_007086
Implement the Python class `LedDisplayEmulatorTask` described below. Class description: Shell representation of class for student implementation. Method signatures and docstrings: - def __init__(self): Constructor check the configuration file to determine if use a emulator - def _handleActuation(self, cmd: int, val: ...
Implement the Python class `LedDisplayEmulatorTask` described below. Class description: Shell representation of class for student implementation. Method signatures and docstrings: - def __init__(self): Constructor check the configuration file to determine if use a emulator - def _handleActuation(self, cmd: int, val: ...
26db6375a21ee9bdccba3d137e30d2e63ad6395c
<|skeleton|> class LedDisplayEmulatorTask: """Shell representation of class for student implementation.""" def __init__(self): """Constructor check the configuration file to determine if use a emulator""" <|body_0|> def _handleActuation(self, cmd: int, val: float=0.0, stateData: str=None) ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LedDisplayEmulatorTask: """Shell representation of class for student implementation.""" def __init__(self): """Constructor check the configuration file to determine if use a emulator""" super(LedDisplayEmulatorTask, self).__init__(actuatorName=ConfigConst.LED_ACTUATOR_NAME, actuatorType=A...
the_stack_v2_python_sparse
src/main/python/programmingtheiot/cda/emulated/LedDisplayEmulatorTask.py
Zhengrui-Liu/FireAlarmingSysCDA
train
0
e485d15ba9140bb22e30b9c72e18bd6fd5a8b19a
[ "self.quant_bit = quant_bit\nOperatorSerializable.__init__(self)\nModule.__init__(self)\nQuantConv2d.__init__(self, in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias, padding_mode=padding_mode)", "input = input....
<|body_start_0|> self.quant_bit = quant_bit OperatorSerializable.__init__(self) Module.__init__(self) QuantConv2d.__init__(self, in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias, paddi...
QuantizeConv2d Module inherit nn.Module.
QuantizeConv2d
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantizeConv2d: """QuantizeConv2d Module inherit nn.Module.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): """Construct Identity class.""" <|body_0|> def forward(s...
stack_v2_sparse_classes_75kplus_train_072130
25,894
permissive
[ { "docstring": "Construct Identity class.", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None)" }, { "docstring": "Do an inference on Identity.", "name": "for...
2
stack_v2_sparse_classes_30k_train_054146
Implement the Python class `QuantizeConv2d` described below. Class description: QuantizeConv2d Module inherit nn.Module. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): Construct...
Implement the Python class `QuantizeConv2d` described below. Class description: QuantizeConv2d Module inherit nn.Module. Method signatures and docstrings: - def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): Construct...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class QuantizeConv2d: """QuantizeConv2d Module inherit nn.Module.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): """Construct Identity class.""" <|body_0|> def forward(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuantizeConv2d: """QuantizeConv2d Module inherit nn.Module.""" def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros', quant_bit=None): """Construct Identity class.""" self.quant_bit = quant_bit Operato...
the_stack_v2_python_sparse
zeus/modules/operators/functions/pytorch_fn.py
huawei-noah/xingtian
train
308
eeffcc318b757bd95445d3f5a767835f6efe4f2a
[ "super(MovingAverage, self).__init__()\nself.window_size = window_size\nself.dimension = dimension", "ret = torch.cumsum(input_tensor, dim=self.dimension)\nret[:, self.window_size:] = ret[:, self.window_size:] - ret[:, :-self.window_size]\nreturn ret[:, self.window_size - 1:] / self.window_size" ]
<|body_start_0|> super(MovingAverage, self).__init__() self.window_size = window_size self.dimension = dimension <|end_body_0|> <|body_start_1|> ret = torch.cumsum(input_tensor, dim=self.dimension) ret[:, self.window_size:] = ret[:, self.window_size:] - ret[:, :-self.window_size...
MovingAverage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, window_size: int, dimension: int): """Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window""" <|body_0|> def forward(self, input_tensor: torch.Tensor): """Parameters ---------- ...
stack_v2_sparse_classes_75kplus_train_072131
1,792
permissive
[ { "docstring": "Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window", "name": "__init__", "signature": "def __init__(self, window_size: int, dimension: int)" }, { "docstring": "Parameters ---------- input_tensor: torch.Tensor of shape (B, ...
2
stack_v2_sparse_classes_30k_train_039106
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, window_size: int, dimension: int): Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window - def...
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, window_size: int, dimension: int): Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window - def...
8ac7ccb17de4aaeb40325deda952652b0fc107ef
<|skeleton|> class MovingAverage: def __init__(self, window_size: int, dimension: int): """Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window""" <|body_0|> def forward(self, input_tensor: torch.Tensor): """Parameters ---------- ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage: def __init__(self, window_size: int, dimension: int): """Parameters ---------- window_size: sliding windows size dimension: dimension we want to apply sliding window""" super(MovingAverage, self).__init__() self.window_size = window_size self.dimension = dimensio...
the_stack_v2_python_sparse
layers.py
Stress-Puppy/EMNLP2020
train
0
62f7a4927525f943b81257b58f9e58b8ca172b17
[ "self.k = k\nself.lossthreshold = lossthreshold\nself.lockthreshold = lockthreshold\nself.iFilter = filters.LowPassFilter(0.0247)\nself.qFilter = filters.LowPassFilter(0.0247)\nself.reset()", "self.losscount = 0\nself.lockcount = 0\nself.iFilter.reset(h=iMagnitude)\nself.qFilter.reset(h=qMagnitude)\nself.lock = l...
<|body_start_0|> self.k = k self.lossthreshold = lossthreshold self.lockthreshold = lockthreshold self.iFilter = filters.LowPassFilter(0.0247) self.qFilter = filters.LowPassFilter(0.0247) self.reset() <|end_body_0|> <|body_start_1|> self.losscount = 0 sel...
LockDetector instances are objects that can determine whether or not a particular tracking channel is locked or not. For more information: Kaplan and Hegarty pages 234-235 note to self: Consider implementing false phase lock detection (p. 235) in the LockDetector.update() function.
LockDetector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockDetector: """LockDetector instances are objects that can determine whether or not a particular tracking channel is locked or not. For more information: Kaplan and Hegarty pages 234-235 note to self: Consider implementing false phase lock detection (p. 235) in the LockDetector.update() functio...
stack_v2_sparse_classes_75kplus_train_072132
3,771
permissive
[ { "docstring": "Initialize the lock detector. @type N : int @param N : This is the number of previous samples to average over. @type k : float @param k : This is the scale factor (specifically, the divisor of the inphase prompt inputs) used for comparing the inphase and quadraphase inputs. A typical value is 1....
3
null
Implement the Python class `LockDetector` described below. Class description: LockDetector instances are objects that can determine whether or not a particular tracking channel is locked or not. For more information: Kaplan and Hegarty pages 234-235 note to self: Consider implementing false phase lock detection (p. 23...
Implement the Python class `LockDetector` described below. Class description: LockDetector instances are objects that can determine whether or not a particular tracking channel is locked or not. For more information: Kaplan and Hegarty pages 234-235 note to self: Consider implementing false phase lock detection (p. 23...
2420a859be9dfe68df62f6db3f7bbd6f151f2936
<|skeleton|> class LockDetector: """LockDetector instances are objects that can determine whether or not a particular tracking channel is locked or not. For more information: Kaplan and Hegarty pages 234-235 note to self: Consider implementing false phase lock detection (p. 235) in the LockDetector.update() functio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LockDetector: """LockDetector instances are objects that can determine whether or not a particular tracking channel is locked or not. For more information: Kaplan and Hegarty pages 234-235 note to self: Consider implementing false phase lock detection (p. 235) in the LockDetector.update() function.""" de...
the_stack_v2_python_sparse
pygnss/pythonreceiver/libgnss/lockdetector.py
GnssTao/NavLab-DPE-SDR
train
0
4f542fbdbc1ba5977b9b690da12c797a66ca1ec7
[ "self._display = display\nself._field = field\nself._ball = ball\nself._aim_line = aim_line\nself._score = Score(self._display)", "self._field.update(self._display)\nself.draw_aim()\nself._score.draw_score(score)\npygame.display.update()", "mouse_pos = pygame.mouse.get_pos()\ncurrent_x, current_y = (self._ball....
<|body_start_0|> self._display = display self._field = field self._ball = ball self._aim_line = aim_line self._score = Score(self._display) <|end_body_0|> <|body_start_1|> self._field.update(self._display) self.draw_aim() self._score.draw_score(score) ...
A class to handle rendering in pygame.
Renderer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Renderer: """A class to handle rendering in pygame.""" def __init__(self, display, field, ball, aim_line): """A constuctor that sets the pygame display and the field. Args: display (pygame display): The display object for the field. field (Field): A Field class object containing spri...
stack_v2_sparse_classes_75kplus_train_072133
1,255
no_license
[ { "docstring": "A constuctor that sets the pygame display and the field. Args: display (pygame display): The display object for the field. field (Field): A Field class object containing sprites. ball (Ball): The ball sprite that is on the field. aim_line (AimLine): The aiming line drawn from the ball.", "na...
3
stack_v2_sparse_classes_30k_train_050026
Implement the Python class `Renderer` described below. Class description: A class to handle rendering in pygame. Method signatures and docstrings: - def __init__(self, display, field, ball, aim_line): A constuctor that sets the pygame display and the field. Args: display (pygame display): The display object for the f...
Implement the Python class `Renderer` described below. Class description: A class to handle rendering in pygame. Method signatures and docstrings: - def __init__(self, display, field, ball, aim_line): A constuctor that sets the pygame display and the field. Args: display (pygame display): The display object for the f...
c0b4513cef6cebbc2db103d2d58f681a85a3f92b
<|skeleton|> class Renderer: """A class to handle rendering in pygame.""" def __init__(self, display, field, ball, aim_line): """A constuctor that sets the pygame display and the field. Args: display (pygame display): The display object for the field. field (Field): A Field class object containing spri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Renderer: """A class to handle rendering in pygame.""" def __init__(self, display, field, ball, aim_line): """A constuctor that sets the pygame display and the field. Args: display (pygame display): The display object for the field. field (Field): A Field class object containing sprites. ball (Ba...
the_stack_v2_python_sparse
minigolf-game/src/services/renderer.py
makeri89/Ohjelmistotekniikka
train
0
67ed960d956815c07bbc2ce3cbbfbc5b040720bb
[ "self.conv1 = nn.Conv2d(4, 32, 8, 4)\nself.conv2 = nn.Conv2d(32, 64, 4, 2)\nself.conv3 = nn.Conv2d(64, 64, 3, 1)\nshape = self.observation_space.shape[1:]\nfor c in [self.conv1, self.conv2, self.conv3]:\n shape = conv_out_shape(shape, c)\nself.nunits = 64 * np.prod(shape)\nself.fc = nn.Linear(self.nunits, 512)\n...
<|body_start_0|> self.conv1 = nn.Conv2d(4, 32, 8, 4) self.conv2 = nn.Conv2d(32, 64, 4, 2) self.conv3 = nn.Conv2d(64, 64, 3, 1) shape = self.observation_space.shape[1:] for c in [self.conv1, self.conv2, self.conv3]: shape = conv_out_shape(shape, c) self.nunits ...
Deep network from https://www.nature.com/articles/nature14236.
NatureDQN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NatureDQN: """Deep network from https://www.nature.com/articles/nature14236.""" def build(self): """Build network.""" <|body_0|> def forward(self, x): """Forward.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.conv1 = nn.Conv2d(4, 32, 8, 4...
stack_v2_sparse_classes_75kplus_train_072134
10,080
no_license
[ { "docstring": "Build network.", "name": "build", "signature": "def build(self)" }, { "docstring": "Forward.", "name": "forward", "signature": "def forward(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_015704
Implement the Python class `NatureDQN` described below. Class description: Deep network from https://www.nature.com/articles/nature14236. Method signatures and docstrings: - def build(self): Build network. - def forward(self, x): Forward.
Implement the Python class `NatureDQN` described below. Class description: Deep network from https://www.nature.com/articles/nature14236. Method signatures and docstrings: - def build(self): Build network. - def forward(self, x): Forward. <|skeleton|> class NatureDQN: """Deep network from https://www.nature.com/...
e71c4b12955b01bfb907aa31c91ded6bcd8aaec8
<|skeleton|> class NatureDQN: """Deep network from https://www.nature.com/articles/nature14236.""" def build(self): """Build network.""" <|body_0|> def forward(self, x): """Forward.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NatureDQN: """Deep network from https://www.nature.com/articles/nature14236.""" def build(self): """Build network.""" self.conv1 = nn.Conv2d(4, 32, 8, 4) self.conv2 = nn.Conv2d(32, 64, 4, 2) self.conv3 = nn.Conv2d(64, 64, 3, 1) shape = self.observation_space.shape[...
the_stack_v2_python_sparse
dl/rl/algorithms/ppo.py
cbschaff/dl
train
1
dbbf36b115b6e9653cd97537c8a9d2c8f095b357
[ "for i in range(len(matrix) // 2):\n start = i\n end = len(matrix) - i - 1\n for j in range(0, end - start):\n tmp = matrix[start][start + j]\n matrix[start][start + j] = matrix[end - j][start]\n matrix[end - j][start] = matrix[end][end - j]\n matrix[end][end - j] = matrix[start...
<|body_start_0|> for i in range(len(matrix) // 2): start = i end = len(matrix) - i - 1 for j in range(0, end - start): tmp = matrix[start][start + j] matrix[start][start + j] = matrix[end - j][start] matrix[end - j][start] = mat...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_072135
2,715
no_license
[ { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "name": "rotate2", "signature": "def rotate2(self, mat...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def rotate2(self, matrix: List[List[int]]) -> None: Do not return any...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. - def rotate2(self, matrix: List[List[int]]) -> None: Do not return any...
3fe8c2298a52a15fadec0693e00445d875c4b6ea
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_0|> def rotate2(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead.""" for i in range(len(matrix) // 2): start = i end = len(matrix) - i - 1 for j in range(0, end - start): tmp = matrix[star...
the_stack_v2_python_sparse
Rotate Image.py
huiyi999/leetcode_python
train
0
bcd6274c78cd2310492eb223698750d961085d5f
[ "task = {'targets': [out], 'actions': [(util.network.download, (url, out))], 'uptodate': [not overwrite]}\ntask.update(kwargs)\nreturn task", "task = {'file_dep': [file], 'targets': [dir], 'actions': [(util.compression.extract_zipfile, (file, dir))], 'clean': [(util.file.maybe_rmtree, (dir,))]}\ntask.update(kwarg...
<|body_start_0|> task = {'targets': [out], 'actions': [(util.network.download, (url, out))], 'uptodate': [not overwrite]} task.update(kwargs) return task <|end_body_0|> <|body_start_1|> task = {'file_dep': [file], 'targets': [dir], 'actions': [(util.compression.extract_zipfile, (file, d...
I help with the creation of tasks
TaskHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskHelper: """I help with the creation of tasks""" def download(url, out, overwrite=False, **kwargs): """Generate a task to download a file Note that, by default, downloads are never cleaned. You can change this behavior by sending clean=True along with the kwargs. Parameters ------...
stack_v2_sparse_classes_75kplus_train_072136
2,080
no_license
[ { "docstring": "Generate a task to download a file Note that, by default, downloads are never cleaned. You can change this behavior by sending clean=True along with the kwargs. Parameters ---------- url : str The url to download from. out : str or Path The output filename. overwrite : bool, default False If Tru...
2
stack_v2_sparse_classes_30k_train_025499
Implement the Python class `TaskHelper` described below. Class description: I help with the creation of tasks Method signatures and docstrings: - def download(url, out, overwrite=False, **kwargs): Generate a task to download a file Note that, by default, downloads are never cleaned. You can change this behavior by se...
Implement the Python class `TaskHelper` described below. Class description: I help with the creation of tasks Method signatures and docstrings: - def download(url, out, overwrite=False, **kwargs): Generate a task to download a file Note that, by default, downloads are never cleaned. You can change this behavior by se...
8e995e17c3e7ca63a588302ca72815f17603842e
<|skeleton|> class TaskHelper: """I help with the creation of tasks""" def download(url, out, overwrite=False, **kwargs): """Generate a task to download a file Note that, by default, downloads are never cleaned. You can change this behavior by sending clean=True along with the kwargs. Parameters ------...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskHelper: """I help with the creation of tasks""" def download(url, out, overwrite=False, **kwargs): """Generate a task to download a file Note that, by default, downloads are never cleaned. You can change this behavior by sending clean=True along with the kwargs. Parameters ---------- url : st...
the_stack_v2_python_sparse
cpe_help/util/doit_tasks.py
lowerthansound/kag-cpe
train
0
cf9eea68ada9eae96c874aa92d2242ea6ed4218c
[ "parser = reqparse.RequestParser()\nparser.add_argument('preference', location='json')\nparser.add_argument('category', location='json')\nargs = parser.parse_args()\ncategory = Categories(args['preference'], args['category'])\ndb.session.add(category)\ndb.session.commit()\napp.logger.debug('DEBUG : %s', category)\n...
<|body_start_0|> parser = reqparse.RequestParser() parser.add_argument('preference', location='json') parser.add_argument('category', location='json') args = parser.parse_args() category = Categories(args['preference'], args['category']) db.session.add(category) d...
Class for add preference category and get all preference category
CategoryResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryResource: """Class for add preference category and get all preference category""" def post(self): """method to add preference category""" <|body_0|> def get(self): """method to get all category from certain preferences""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus_train_072137
1,646
no_license
[ { "docstring": "method to add preference category", "name": "post", "signature": "def post(self)" }, { "docstring": "method to get all category from certain preferences", "name": "get", "signature": "def get(self)" } ]
2
null
Implement the Python class `CategoryResource` described below. Class description: Class for add preference category and get all preference category Method signatures and docstrings: - def post(self): method to add preference category - def get(self): method to get all category from certain preferences
Implement the Python class `CategoryResource` described below. Class description: Class for add preference category and get all preference category Method signatures and docstrings: - def post(self): method to add preference category - def get(self): method to get all category from certain preferences <|skeleton|> c...
dea983a0521aa2d53363014bc8541a4c4d035a60
<|skeleton|> class CategoryResource: """Class for add preference category and get all preference category""" def post(self): """method to add preference category""" <|body_0|> def get(self): """method to get all category from certain preferences""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CategoryResource: """Class for add preference category and get all preference category""" def post(self): """method to add preference category""" parser = reqparse.RequestParser() parser.add_argument('preference', location='json') parser.add_argument('category', location='...
the_stack_v2_python_sparse
blueprints/categories/resource.py
SyamsulAlterra/Evant_backend
train
0
99b867b40d914f669b441ae17446acef579e0eb0
[ "today = dt.date.today()\ndates_in_surrounding_months = [today + relativedelta(months=diff) for diff in xrange(-1, 5)]\nreturn list(chain.from_iterable([self.get_events_for_month(date.year, date.month) for date in dates_in_surrounding_months if date.year == today.year]))", "request_data = {'action': 'get_event_sh...
<|body_start_0|> today = dt.date.today() dates_in_surrounding_months = [today + relativedelta(months=diff) for diff in xrange(-1, 5)] return list(chain.from_iterable([self.get_events_for_month(date.year, date.month) for date in dates_in_surrounding_months if date.year == today.year])) <|end_body...
This scraper is used to scrape music shows from the OzenBar website.
OzenBarScraper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OzenBarScraper: """This scraper is used to scrape music shows from the OzenBar website.""" def scrape(self): """This method scrapes events (mostly music shows) from the OzenBar website. The OzenBar website exposes a php view, that receives a month and a year, and returns an html repr...
stack_v2_sparse_classes_75kplus_train_072138
5,520
no_license
[ { "docstring": "This method scrapes events (mostly music shows) from the OzenBar website. The OzenBar website exposes a php view, that receives a month and a year, and returns an html representation of a list of the events of that month. We send requests for three months back, and a year forward, parse the retu...
4
stack_v2_sparse_classes_30k_train_009334
Implement the Python class `OzenBarScraper` described below. Class description: This scraper is used to scrape music shows from the OzenBar website. Method signatures and docstrings: - def scrape(self): This method scrapes events (mostly music shows) from the OzenBar website. The OzenBar website exposes a php view, t...
Implement the Python class `OzenBarScraper` described below. Class description: This scraper is used to scrape music shows from the OzenBar website. Method signatures and docstrings: - def scrape(self): This method scrapes events (mostly music shows) from the OzenBar website. The OzenBar website exposes a php view, t...
b32df4c4d6d385732d76574985c71529cea050b8
<|skeleton|> class OzenBarScraper: """This scraper is used to scrape music shows from the OzenBar website.""" def scrape(self): """This method scrapes events (mostly music shows) from the OzenBar website. The OzenBar website exposes a php view, that receives a month and a year, and returns an html repr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OzenBarScraper: """This scraper is used to scrape music shows from the OzenBar website.""" def scrape(self): """This method scrapes events (mostly music shows) from the OzenBar website. The OzenBar website exposes a php view, that receives a month and a year, and returns an html representation of...
the_stack_v2_python_sparse
src/donight/event_finder/scrapers/ozen_bar.py
ehudhala/donight
train
1
bc7867a3e997939292ac0777ed17ead2a75c2a7c
[ "data = self.get_json()\nif 'obj_id' not in data:\n return self.error('Missing required parameter: obj_id')\nwith self.Session() as session:\n try:\n obj_id = post_thumbnail(data, self.associated_user_object.id, session)\n except Exception as e:\n return self.error(f'Thumbnail failed to post:...
<|body_start_0|> data = self.get_json() if 'obj_id' not in data: return self.error('Missing required parameter: obj_id') with self.Session() as session: try: obj_id = post_thumbnail(data, self.associated_user_object.id, session) except Exceptio...
ThumbnailHandler
[ "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThumbnailHandler: def post(self): """--- description: Upload thumbnails tags: - thumbnails requestBody: content: application/json: schema: type: object properties: obj_id: type: string description: ID of object associated with thumbnails. data: type: string format: byte description: base...
stack_v2_sparse_classes_75kplus_train_072139
22,926
permissive
[ { "docstring": "--- description: Upload thumbnails tags: - thumbnails requestBody: content: application/json: schema: type: object properties: obj_id: type: string description: ID of object associated with thumbnails. data: type: string format: byte description: base64-encoded PNG image file contents. Image siz...
4
stack_v2_sparse_classes_30k_train_007035
Implement the Python class `ThumbnailHandler` described below. Class description: Implement the ThumbnailHandler class. Method signatures and docstrings: - def post(self): --- description: Upload thumbnails tags: - thumbnails requestBody: content: application/json: schema: type: object properties: obj_id: type: strin...
Implement the Python class `ThumbnailHandler` described below. Class description: Implement the ThumbnailHandler class. Method signatures and docstrings: - def post(self): --- description: Upload thumbnails tags: - thumbnails requestBody: content: application/json: schema: type: object properties: obj_id: type: strin...
161d3532ba3ba059446addcdac58ca96f39e9636
<|skeleton|> class ThumbnailHandler: def post(self): """--- description: Upload thumbnails tags: - thumbnails requestBody: content: application/json: schema: type: object properties: obj_id: type: string description: ID of object associated with thumbnails. data: type: string format: byte description: base...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThumbnailHandler: def post(self): """--- description: Upload thumbnails tags: - thumbnails requestBody: content: application/json: schema: type: object properties: obj_id: type: string description: ID of object associated with thumbnails. data: type: string format: byte description: base64-encoded PNG...
the_stack_v2_python_sparse
skyportal/handlers/api/thumbnail.py
skyportal/skyportal
train
80
34734df296c33c6858c578e0fb8d59c173e38360
[ "try:\n lines = int(request.query.get('lines', 0))\nexcept ValueError:\n return Response(text='Invalid datetime', status=HTTP_BAD_REQUEST)\nhass = request.app['hass']\nresponse = await hass.async_add_executor_job(self._get_log, hass, lines)\nreturn Response(text='\\n'.join(response))", "logfilepath = hass.c...
<|body_start_0|> try: lines = int(request.query.get('lines', 0)) except ValueError: return Response(text='Invalid datetime', status=HTTP_BAD_REQUEST) hass = request.app['hass'] response = await hass.async_add_executor_job(self._get_log, hass, lines) return...
View to read the ZWave log file.
ZWaveLogView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZWaveLogView: """View to read the ZWave log file.""" async def get(self, request): """Retrieve the lines from ZWave log.""" <|body_0|> def _get_log(self, hass, lines): """Retrieve the logfile content.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_072140
9,288
permissive
[ { "docstring": "Retrieve the lines from ZWave log.", "name": "get", "signature": "async def get(self, request)" }, { "docstring": "Retrieve the logfile content.", "name": "_get_log", "signature": "def _get_log(self, hass, lines)" } ]
2
null
Implement the Python class `ZWaveLogView` described below. Class description: View to read the ZWave log file. Method signatures and docstrings: - async def get(self, request): Retrieve the lines from ZWave log. - def _get_log(self, hass, lines): Retrieve the logfile content.
Implement the Python class `ZWaveLogView` described below. Class description: View to read the ZWave log file. Method signatures and docstrings: - async def get(self, request): Retrieve the lines from ZWave log. - def _get_log(self, hass, lines): Retrieve the logfile content. <|skeleton|> class ZWaveLogView: """...
2fee32fce03bc49e86cf2e7b741a15621a97cce5
<|skeleton|> class ZWaveLogView: """View to read the ZWave log file.""" async def get(self, request): """Retrieve the lines from ZWave log.""" <|body_0|> def _get_log(self, hass, lines): """Retrieve the logfile content.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZWaveLogView: """View to read the ZWave log file.""" async def get(self, request): """Retrieve the lines from ZWave log.""" try: lines = int(request.query.get('lines', 0)) except ValueError: return Response(text='Invalid datetime', status=HTTP_BAD_REQUEST) ...
the_stack_v2_python_sparse
homeassistant/components/config/zwave.py
BenWoodford/home-assistant
train
11
caa0f6e81d8b6908bfa1eba5fbecc64271a56bd6
[ "hash_map = {}\nfor i, n in enumerate(nums):\n for d in range(t + 1):\n if n - d in hash_map and i - hash_map[abs(n - d)] <= k:\n return True\n elif n + d in hash_map and i - hash_map[n + d] <= k:\n return True\n hash_map[n] = i\nreturn False", "if k == 0:\n return Fal...
<|body_start_0|> hash_map = {} for i, n in enumerate(nums): for d in range(t + 1): if n - d in hash_map and i - hash_map[abs(n - d)] <= k: return True elif n + d in hash_map and i - hash_map[n + d] <= k: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_75kplus_train_072141
3,134
no_license
[ { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "containsNearbyAlmostDuplicate_TLE", "signature": "def containsNearbyAlmostDuplicate_TLE(self, nums, k, t)" }, { "docstring": ":type nums: List[int] :type k: int :type t: int :rtype: bool", "name": "contai...
2
stack_v2_sparse_classes_30k_train_015437
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate(self, nums, k, t): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): :type nums: List[int] :type k: int :type t: int :rtype: bool - def containsNearbyAlmostDuplicate(self, nums, k, t): :type...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" <|body_0|> def containsNearbyAlmostDuplicate(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsNearbyAlmostDuplicate_TLE(self, nums, k, t): """:type nums: List[int] :type k: int :type t: int :rtype: bool""" hash_map = {} for i, n in enumerate(nums): for d in range(t + 1): if n - d in hash_map and i - hash_map[abs(n - d)] <= k: ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00220.Contains Duplicate III.py
roger6blog/LeetCode
train
0
63bbb2e1ec2a2166a25ce951c8c51b2336c99504
[ "if not head:\n return None\nslow = head\nfast = head.next\nwhile fast != slow:\n if not fast or not fast.next:\n return None\n slow = slow.next\n fast = fast.next.next\nwhile head != slow.next:\n head = head.next\n slow = slow.next\nreturn head", "slow = fast = head\nwhile fast and fast....
<|body_start_0|> if not head: return None slow = head fast = head.next while fast != slow: if not fast or not fast.next: return None slow = slow.next fast = fast.next.next while head != slow.next: head = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return None ...
stack_v2_sparse_classes_75kplus_train_072142
1,734
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle", "signature": "def detectCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "detectCycle", "signature": "def detectCycle(self, head)" } ]
2
stack_v2_sparse_classes_30k_test_002980
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle(self, head): :type head: ListNode :rtype: ListNode - def detectCycle(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def detectCycle(self, head): :type head: ListNode :rtype: ListNode - def detectCycle(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def det...
a2cd0dc5e098080df87c4fb57d16877d21ca47a3
<|skeleton|> class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def detectCycle(self, head): """:type head: ListNode :rtype: ListNode""" if not head: return None slow = head fast = head.next while fast != slow: if not fast or not fast.next: return None slow = slow.next ...
the_stack_v2_python_sparse
0142_Linked_List_Cycle_II/solution.py
benjaminhuanghuang/ben-leetcode
train
1
e6c2feacac10e77d6342b77f4e816eb8add0b1f7
[ "self.lr_scheduler = lr_scheduler\nself.print_lr = print_lr\nself.logger = logging.getLogger(name)\nself.epoch_level = epoch_level\nif not callable(step_transform):\n raise TypeError(f'step_transform must be callable but is {type(step_transform).__name__}.')\nself.step_transform = step_transform\nself._name = na...
<|body_start_0|> self.lr_scheduler = lr_scheduler self.print_lr = print_lr self.logger = logging.getLogger(name) self.epoch_level = epoch_level if not callable(step_transform): raise TypeError(f'step_transform must be callable but is {type(step_transform).__name__}.')...
Ignite handler to update the Learning Rate based on PyTorch LR scheduler.
LrScheduleHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LrScheduleHandler: """Ignite handler to update the Learning Rate based on PyTorch LR scheduler.""" def __init__(self, lr_scheduler: _LRScheduler | ReduceLROnPlateau, print_lr: bool=True, name: str | None=None, epoch_level: bool=True, step_transform: Callable[[Engine], Any]=lambda engine: ())...
stack_v2_sparse_classes_75kplus_train_072143
3,575
permissive
[ { "docstring": "Args: lr_scheduler: typically, lr_scheduler should be PyTorch lr_scheduler object. If customized version, must have `step` and `get_last_lr` methods. print_lr: whether to print out the latest learning rate with logging. name: identifier of logging.logger to use, if None, defaulting to ``engine.l...
3
stack_v2_sparse_classes_30k_train_038541
Implement the Python class `LrScheduleHandler` described below. Class description: Ignite handler to update the Learning Rate based on PyTorch LR scheduler. Method signatures and docstrings: - def __init__(self, lr_scheduler: _LRScheduler | ReduceLROnPlateau, print_lr: bool=True, name: str | None=None, epoch_level: b...
Implement the Python class `LrScheduleHandler` described below. Class description: Ignite handler to update the Learning Rate based on PyTorch LR scheduler. Method signatures and docstrings: - def __init__(self, lr_scheduler: _LRScheduler | ReduceLROnPlateau, print_lr: bool=True, name: str | None=None, epoch_level: b...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class LrScheduleHandler: """Ignite handler to update the Learning Rate based on PyTorch LR scheduler.""" def __init__(self, lr_scheduler: _LRScheduler | ReduceLROnPlateau, print_lr: bool=True, name: str | None=None, epoch_level: bool=True, step_transform: Callable[[Engine], Any]=lambda engine: ())...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LrScheduleHandler: """Ignite handler to update the Learning Rate based on PyTorch LR scheduler.""" def __init__(self, lr_scheduler: _LRScheduler | ReduceLROnPlateau, print_lr: bool=True, name: str | None=None, epoch_level: bool=True, step_transform: Callable[[Engine], Any]=lambda engine: ()) -> None: ...
the_stack_v2_python_sparse
monai/handlers/lr_schedule_handler.py
Project-MONAI/MONAI
train
4,805
9991069a7e061c18f0b9e6455841b415aa480e63
[ "self.obs_dim = obs_dim\nself.act_dim = act_dim\nself.hidden_size = hidden_sizes\nself.hd_activation = hd_activation\nself.logger = logger\ntry:\n assert hd_activation in ['Linear', 'Tanh', 'Sigmoid', 'ReLU']\nexcept AssertionError as e:\n self.logger.to_warn('目前激活函数的类型尚不支持输入的类型:%s' % hd_activation)\n rais...
<|body_start_0|> self.obs_dim = obs_dim self.act_dim = act_dim self.hidden_size = hidden_sizes self.hd_activation = hd_activation self.logger = logger try: assert hd_activation in ['Linear', 'Tanh', 'Sigmoid', 'ReLU'] except AssertionError as e: ...
MLPContiModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLPContiModel: def __init__(self, obs_dim: int, act_dim: int, hidden_sizes: tuple, hd_activation: str, logger: Logger): """基于多层感知机的连续控制策略网络 :param obs_dim: int, 状态观测向量的长度 :param act_dim: int, 行动向量的长度 :param hidden_sizes: tuple, 隐藏层的层数和每一层的神经元个数 :param hd_activation: str, 隐藏层使用的激活函数 :para...
stack_v2_sparse_classes_75kplus_train_072144
8,909
permissive
[ { "docstring": "基于多层感知机的连续控制策略网络 :param obs_dim: int, 状态观测向量的长度 :param act_dim: int, 行动向量的长度 :param hidden_sizes: tuple, 隐藏层的层数和每一层的神经元个数 :param hd_activation: str, 隐藏层使用的激活函数 :param logger: Logger, 记录相关信息的日志对象", "name": "__init__", "signature": "def __init__(self, obs_dim: int, act_dim: int, hidden_siz...
2
stack_v2_sparse_classes_30k_train_034152
Implement the Python class `MLPContiModel` described below. Class description: Implement the MLPContiModel class. Method signatures and docstrings: - def __init__(self, obs_dim: int, act_dim: int, hidden_sizes: tuple, hd_activation: str, logger: Logger): 基于多层感知机的连续控制策略网络 :param obs_dim: int, 状态观测向量的长度 :param act_dim:...
Implement the Python class `MLPContiModel` described below. Class description: Implement the MLPContiModel class. Method signatures and docstrings: - def __init__(self, obs_dim: int, act_dim: int, hidden_sizes: tuple, hd_activation: str, logger: Logger): 基于多层感知机的连续控制策略网络 :param obs_dim: int, 状态观测向量的长度 :param act_dim:...
977b8360d9b1a58500148a7480b134537a2ed523
<|skeleton|> class MLPContiModel: def __init__(self, obs_dim: int, act_dim: int, hidden_sizes: tuple, hd_activation: str, logger: Logger): """基于多层感知机的连续控制策略网络 :param obs_dim: int, 状态观测向量的长度 :param act_dim: int, 行动向量的长度 :param hidden_sizes: tuple, 隐藏层的层数和每一层的神经元个数 :param hd_activation: str, 隐藏层使用的激活函数 :para...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MLPContiModel: def __init__(self, obs_dim: int, act_dim: int, hidden_sizes: tuple, hd_activation: str, logger: Logger): """基于多层感知机的连续控制策略网络 :param obs_dim: int, 状态观测向量的长度 :param act_dim: int, 行动向量的长度 :param hidden_sizes: tuple, 隐藏层的层数和每一层的神经元个数 :param hd_activation: str, 隐藏层使用的激活函数 :param logger: Logg...
the_stack_v2_python_sparse
TwinDelayedDDPG/model.py
xiaojianyang820/StandardRL
train
0
5fc2d820a7df8346d47946045b3c4c2652bbed0a
[ "if payload.get('password') != payload.get('confirm_password'):\n abort(400, 'Password does not match')\ncount, records = base_obj.get(COLLECTIONS['USERS'], {'email': payload['email']})\nif count > 0:\n abort(400, 'Email ID Already Exists')\npayload = custom_marshal(payload, user, 'create')\npayload['password...
<|body_start_0|> if payload.get('password') != payload.get('confirm_password'): abort(400, 'Password does not match') count, records = base_obj.get(COLLECTIONS['USERS'], {'email': payload['email']}) if count > 0: abort(400, 'Email ID Already Exists') payload = cus...
Service Class for User View
UserService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserService: """Service Class for User View""" def signup(self, payload): """signup function :return:""" <|body_0|> def activate(self, id): """Activate the user :param id: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if payload.get('...
stack_v2_sparse_classes_75kplus_train_072145
1,668
no_license
[ { "docstring": "signup function :return:", "name": "signup", "signature": "def signup(self, payload)" }, { "docstring": "Activate the user :param id: :return:", "name": "activate", "signature": "def activate(self, id)" } ]
2
stack_v2_sparse_classes_30k_train_048717
Implement the Python class `UserService` described below. Class description: Service Class for User View Method signatures and docstrings: - def signup(self, payload): signup function :return: - def activate(self, id): Activate the user :param id: :return:
Implement the Python class `UserService` described below. Class description: Service Class for User View Method signatures and docstrings: - def signup(self, payload): signup function :return: - def activate(self, id): Activate the user :param id: :return: <|skeleton|> class UserService: """Service Class for Use...
075cd9a9faaa2d24f1c7ea8507c115e6936aed04
<|skeleton|> class UserService: """Service Class for User View""" def signup(self, payload): """signup function :return:""" <|body_0|> def activate(self, id): """Activate the user :param id: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserService: """Service Class for User View""" def signup(self, payload): """signup function :return:""" if payload.get('password') != payload.get('confirm_password'): abort(400, 'Password does not match') count, records = base_obj.get(COLLECTIONS['USERS'], {'email': p...
the_stack_v2_python_sparse
app/users/service.py
nosqlly/Todo-App
train
3
51fd6a76068091ba345bcdc0c9ec1feb8a73a787
[ "if len(matrix) == 0:\n return False\nif len(matrix[0]) == 0:\n return False\nrow = self.vertical_search(matrix, target)\nreturn self.horizontal_search(matrix[row], target)", "low, high = (0, len(matrix) - 1)\nwhile low <= high:\n mid = (low + high) // 2\n if matrix[mid][0] <= target <= matrix[mid][-1...
<|body_start_0|> if len(matrix) == 0: return False if len(matrix[0]) == 0: return False row = self.vertical_search(matrix, target) return self.horizontal_search(matrix[row], target) <|end_body_0|> <|body_start_1|> low, high = (0, len(matrix) - 1) ...
Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.""" def searchMatrix(self, matrix, target): """Simple approach Args: matrix: 2D matrix to l...
stack_v2_sparse_classes_75kplus_train_072146
3,400
no_license
[ { "docstring": "Simple approach Args: matrix: 2D matrix to look a target from target: an integer value to look for Returns: bool: True if target exists in the matrix, otherwise False", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": "This determine...
3
stack_v2_sparse_classes_30k_train_043426
Implement the Python class `Solution` described below. Class description: Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix. Method signatures and docstrings: - def searchMatrix(self, matr...
Implement the Python class `Solution` described below. Class description: Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix. Method signatures and docstrings: - def searchMatrix(self, matr...
01fe893ba2e37c9bda79e3081c556698f0b6d2f0
<|skeleton|> class Solution: """Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.""" def searchMatrix(self, matrix, target): """Simple approach Args: matrix: 2D matrix to l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """Runtime: 36 ms, faster than 96.37% of Python3 online submissions for Search a 2D Matrix. Memory Usage: 14 MB, less than 33.84% of Python3 online submissions for Search a 2D Matrix.""" def searchMatrix(self, matrix, target): """Simple approach Args: matrix: 2D matrix to look a target ...
the_stack_v2_python_sparse
LeetCode/74_search_a_2d_matrix.py
KKosukeee/CodingQuestions
train
1
bd5da5c516f3a0003478b4d0713baf58782e5b5a
[ "parser = reqparse.RequestParser()\nparser.add_argument('meal_name', type=str, help='meal_name is a required field', required=True)\nparser.add_argument('price', help='Price is a required field', required=True)\nargs = parser.parse_args()\nmeal = Meal(meal_name=args['meal_name'], price=args['price'])\nvalidate = me...
<|body_start_0|> parser = reqparse.RequestParser() parser.add_argument('meal_name', type=str, help='meal_name is a required field', required=True) parser.add_argument('price', help='Price is a required field', required=True) args = parser.parse_args() meal = Meal(meal_name=args['...
mealsdb class
Mealsdb
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mealsdb: """mealsdb class""" def post(): """Allows authenticated admin to create a meal token is required to get admin Id""" <|body_0|> def get(): """Return all meals created by authenticated admin token is required to get admin Id""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_072147
4,258
no_license
[ { "docstring": "Allows authenticated admin to create a meal token is required to get admin Id", "name": "post", "signature": "def post()" }, { "docstring": "Return all meals created by authenticated admin token is required to get admin Id", "name": "get", "signature": "def get()" } ]
2
stack_v2_sparse_classes_30k_val_000348
Implement the Python class `Mealsdb` described below. Class description: mealsdb class Method signatures and docstrings: - def post(): Allows authenticated admin to create a meal token is required to get admin Id - def get(): Return all meals created by authenticated admin token is required to get admin Id
Implement the Python class `Mealsdb` described below. Class description: mealsdb class Method signatures and docstrings: - def post(): Allows authenticated admin to create a meal token is required to get admin Id - def get(): Return all meals created by authenticated admin token is required to get admin Id <|skeleto...
eef5f2802c94e428412e2f9814a5dac85575ed8e
<|skeleton|> class Mealsdb: """mealsdb class""" def post(): """Allows authenticated admin to create a meal token is required to get admin Id""" <|body_0|> def get(): """Return all meals created by authenticated admin token is required to get admin Id""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Mealsdb: """mealsdb class""" def post(): """Allows authenticated admin to create a meal token is required to get admin Id""" parser = reqparse.RequestParser() parser.add_argument('meal_name', type=str, help='meal_name is a required field', required=True) parser.add_argumen...
the_stack_v2_python_sparse
api/views/meal_views.py
magicmarie/book_a_meal
train
1
c6b22da551eb21565714b289562bbbe23eecdd02
[ "for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] + nums[j] == target:\n return [i, j]", "ht = {}\nfor i in range(len(nums)):\n ht[nums[i]] = i\nfor j in range(len(nums)):\n if target - nums[j] in ht and j != ht[target - nums[j]]:\n return [j, ht[target...
<|body_start_0|> for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return [i, j] <|end_body_0|> <|body_start_1|> ht = {} for i in range(len(nums)): ht[nums[i]] = i for j in range(len(n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_072148
836
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum1", "signature": "def twoSum1(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum2", "signature": "def twoSum2(self, nums, target)" ...
2
stack_v2_sparse_classes_30k_train_040250
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype: List...
8dfbb10a87d8a3fdde466ab16fff8b67503e41f4
<|skeleton|> class Solution: def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" for i in range(len(nums)): for j in range(i + 1, len(nums)): if nums[i] + nums[j] == target: return [i, j] def twoSum2(self, nums, tar...
the_stack_v2_python_sparse
easy/0001.two-sum.py
codershenghai/PyLeetcode
train
0
7566277fbe5b4aa47cb2e1ce09af0cf0711df3d1
[ "encoding = jnp.ones(shape=(self.bsz, self.seq_len, self.model_dim), dtype=self.dtype)\nattention_mask = jnp.ones(shape=(self.bsz, self.seq_len), dtype=self.dtype)\nmodel = transformer.TransformerLayer(model_dim=self.model_dim, intermediate_dim=self.intermediate_dim, num_heads=self.num_heads, dropout_rate=self.drop...
<|body_start_0|> encoding = jnp.ones(shape=(self.bsz, self.seq_len, self.model_dim), dtype=self.dtype) attention_mask = jnp.ones(shape=(self.bsz, self.seq_len), dtype=self.dtype) model = transformer.TransformerLayer(model_dim=self.model_dim, intermediate_dim=self.intermediate_dim, num_heads=self...
Transformer layer test.
TransformerTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerTest: """Transformer layer test.""" def test_transformer_layer_shape(self): """Testing transformer layer shape.""" <|body_0|> def test_transformer_block_shape(self): """Testing transformer block shape.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_072149
2,562
permissive
[ { "docstring": "Testing transformer layer shape.", "name": "test_transformer_layer_shape", "signature": "def test_transformer_layer_shape(self)" }, { "docstring": "Testing transformer block shape.", "name": "test_transformer_block_shape", "signature": "def test_transformer_block_shape(se...
2
stack_v2_sparse_classes_30k_train_029272
Implement the Python class `TransformerTest` described below. Class description: Transformer layer test. Method signatures and docstrings: - def test_transformer_layer_shape(self): Testing transformer layer shape. - def test_transformer_block_shape(self): Testing transformer block shape.
Implement the Python class `TransformerTest` described below. Class description: Transformer layer test. Method signatures and docstrings: - def test_transformer_layer_shape(self): Testing transformer layer shape. - def test_transformer_block_shape(self): Testing transformer block shape. <|skeleton|> class Transform...
ac9447064195e06de48cc91ff642f7fffa28ffe8
<|skeleton|> class TransformerTest: """Transformer layer test.""" def test_transformer_layer_shape(self): """Testing transformer layer shape.""" <|body_0|> def test_transformer_block_shape(self): """Testing transformer block shape.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TransformerTest: """Transformer layer test.""" def test_transformer_layer_shape(self): """Testing transformer layer shape.""" encoding = jnp.ones(shape=(self.bsz, self.seq_len, self.model_dim), dtype=self.dtype) attention_mask = jnp.ones(shape=(self.bsz, self.seq_len), dtype=self....
the_stack_v2_python_sparse
language/mentionmemory/modules/transformer_test.py
google-research/language
train
1,567
55c220872e0d725db6c14a2437ef6de197935f04
[ "testGroup = EmployeeGroup(name='test_group')\nself.assertEqual(testGroup.name, 'test_group')\ntestGroup.save()\ntestGroupFromDatabase = EmployeeGroup.objects.get(name='test_group')\nself.assertEqual(testGroup, testGroupFromDatabase)", "testGroup1 = EmployeeGroup(name='test_group_1')\ntestGroup2 = EmployeeGroup(n...
<|body_start_0|> testGroup = EmployeeGroup(name='test_group') self.assertEqual(testGroup.name, 'test_group') testGroup.save() testGroupFromDatabase = EmployeeGroup.objects.get(name='test_group') self.assertEqual(testGroup, testGroupFromDatabase) <|end_body_0|> <|body_start_1|> ...
EmployeeGroupTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeeGroupTestCase: def test_group_creation(self): """Tests the creation and saving of an employee group.""" <|body_0|> def test_root_group_property(self): """Tests that the root group property works as expected""" <|body_1|> def test_group_cannot_be_...
stack_v2_sparse_classes_75kplus_train_072150
2,103
no_license
[ { "docstring": "Tests the creation and saving of an employee group.", "name": "test_group_creation", "signature": "def test_group_creation(self)" }, { "docstring": "Tests that the root group property works as expected", "name": "test_root_group_property", "signature": "def test_root_grou...
4
stack_v2_sparse_classes_30k_train_046567
Implement the Python class `EmployeeGroupTestCase` described below. Class description: Implement the EmployeeGroupTestCase class. Method signatures and docstrings: - def test_group_creation(self): Tests the creation and saving of an employee group. - def test_root_group_property(self): Tests that the root group prope...
Implement the Python class `EmployeeGroupTestCase` described below. Class description: Implement the EmployeeGroupTestCase class. Method signatures and docstrings: - def test_group_creation(self): Tests the creation and saving of an employee group. - def test_root_group_property(self): Tests that the root group prope...
6396256f8e1d6203cb3b353492e3730af5e95474
<|skeleton|> class EmployeeGroupTestCase: def test_group_creation(self): """Tests the creation and saving of an employee group.""" <|body_0|> def test_root_group_property(self): """Tests that the root group property works as expected""" <|body_1|> def test_group_cannot_be_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmployeeGroupTestCase: def test_group_creation(self): """Tests the creation and saving of an employee group.""" testGroup = EmployeeGroup(name='test_group') self.assertEqual(testGroup.name, 'test_group') testGroup.save() testGroupFromDatabase = EmployeeGroup.objects.get...
the_stack_v2_python_sparse
groups/tests.py
JordanField/Bizzorg-Server
train
0
7dec43bdd0c78b382c2badc34c97723acc2771bc
[ "if not root:\n return 0\nfrom collections import deque\nq = deque()\nq.appendleft(root)\nn = 0\nwhile q:\n for _ in range(len(q)):\n cur_node = q.pop()\n n += 1\n if cur_node.left:\n q.appendleft(cur_node.left)\n if cur_node.right:\n q.appendleft(cur_node.rig...
<|body_start_0|> if not root: return 0 from collections import deque q = deque() q.appendleft(root) n = 0 while q: for _ in range(len(q)): cur_node = q.pop() n += 1 if cur_node.left: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countNodes(self, root: TreeNode) -> int: """爆搜方式,使用层次遍历 :param root: :return:""" <|body_0|> def countNodes1(self, root: TreeNode) -> int: """使用递归方式 :param root: :return:""" <|body_1|> def countNodes2(self, root: TreeNode) -> int: ""...
stack_v2_sparse_classes_75kplus_train_072151
2,999
no_license
[ { "docstring": "爆搜方式,使用层次遍历 :param root: :return:", "name": "countNodes", "signature": "def countNodes(self, root: TreeNode) -> int" }, { "docstring": "使用递归方式 :param root: :return:", "name": "countNodes1", "signature": "def countNodes1(self, root: TreeNode) -> int" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_029131
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNodes(self, root: TreeNode) -> int: 爆搜方式,使用层次遍历 :param root: :return: - def countNodes1(self, root: TreeNode) -> int: 使用递归方式 :param root: :return: - def countNodes2(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countNodes(self, root: TreeNode) -> int: 爆搜方式,使用层次遍历 :param root: :return: - def countNodes1(self, root: TreeNode) -> int: 使用递归方式 :param root: :return: - def countNodes2(self...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def countNodes(self, root: TreeNode) -> int: """爆搜方式,使用层次遍历 :param root: :return:""" <|body_0|> def countNodes1(self, root: TreeNode) -> int: """使用递归方式 :param root: :return:""" <|body_1|> def countNodes2(self, root: TreeNode) -> int: ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countNodes(self, root: TreeNode) -> int: """爆搜方式,使用层次遍历 :param root: :return:""" if not root: return 0 from collections import deque q = deque() q.appendleft(root) n = 0 while q: for _ in range(len(q)): ...
the_stack_v2_python_sparse
datastructure/binary_array/CountNodes.py
yinhuax/leet_code
train
0
857b11cbbd61df1f2ad0bd78895ce66f6c61d7a9
[ "if head is None or k <= 0:\n return None\nnode_front = head\nfor i in range(k - 1):\n if node_front.next is not None:\n node_front = node_front.next\n else:\n return None\nnode_behind = head\nwhile node_front.next is not None:\n node_front = node_front.next\n node_behind = node_behind....
<|body_start_0|> if head is None or k <= 0: return None node_front = head for i in range(k - 1): if node_front.next is not None: node_front = node_front.next else: return None node_behind = head while node_front....
题目要求:输入一个链表, 输出该链表的倒数第k个节点
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """题目要求:输入一个链表, 输出该链表的倒数第k个节点""" def FindKthToTail(self, head, k): """倒数第k个么就是正数的第(N-K+1)个。设置两个指针,初始时,front指向 (k-1), behind指向第1个(两个指针相距 k-1);然后两个 一起向前移动。当front到达链表结尾时front=n,behind刚好像指向第(n-k+1)""" <|body_0|> def FindKthToMiddel(self, head): """题目要求:求链表的...
stack_v2_sparse_classes_75kplus_train_072152
3,270
no_license
[ { "docstring": "倒数第k个么就是正数的第(N-K+1)个。设置两个指针,初始时,front指向 (k-1), behind指向第1个(两个指针相距 k-1);然后两个 一起向前移动。当front到达链表结尾时front=n,behind刚好像指向第(n-k+1)", "name": "FindKthToTail", "signature": "def FindKthToTail(self, head, k)" }, { "docstring": "题目要求:求链表的中间节点。如果长度是奇数,返回中间节点;是偶数的时候,返回中间两个的任意一个 思路:设置两个节点,slow...
3
stack_v2_sparse_classes_30k_train_011704
Implement the Python class `Solution` described below. Class description: 题目要求:输入一个链表, 输出该链表的倒数第k个节点 Method signatures and docstrings: - def FindKthToTail(self, head, k): 倒数第k个么就是正数的第(N-K+1)个。设置两个指针,初始时,front指向 (k-1), behind指向第1个(两个指针相距 k-1);然后两个 一起向前移动。当front到达链表结尾时front=n,behind刚好像指向第(n-k+1) - def FindKthToMiddel(s...
Implement the Python class `Solution` described below. Class description: 题目要求:输入一个链表, 输出该链表的倒数第k个节点 Method signatures and docstrings: - def FindKthToTail(self, head, k): 倒数第k个么就是正数的第(N-K+1)个。设置两个指针,初始时,front指向 (k-1), behind指向第1个(两个指针相距 k-1);然后两个 一起向前移动。当front到达链表结尾时front=n,behind刚好像指向第(n-k+1) - def FindKthToMiddel(s...
dfa21f6b9febc54073cec372ff6199cd6cc5ca4e
<|skeleton|> class Solution: """题目要求:输入一个链表, 输出该链表的倒数第k个节点""" def FindKthToTail(self, head, k): """倒数第k个么就是正数的第(N-K+1)个。设置两个指针,初始时,front指向 (k-1), behind指向第1个(两个指针相距 k-1);然后两个 一起向前移动。当front到达链表结尾时front=n,behind刚好像指向第(n-k+1)""" <|body_0|> def FindKthToMiddel(self, head): """题目要求:求链表的...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """题目要求:输入一个链表, 输出该链表的倒数第k个节点""" def FindKthToTail(self, head, k): """倒数第k个么就是正数的第(N-K+1)个。设置两个指针,初始时,front指向 (k-1), behind指向第1个(两个指针相距 k-1);然后两个 一起向前移动。当front到达链表结尾时front=n,behind刚好像指向第(n-k+1)""" if head is None or k <= 0: return None node_front = head ...
the_stack_v2_python_sparse
KthNodeFromEnd.py
zhang4ever/target_offer
train
1
6b7b878c6d116084a6d0db11eb25f635f85c3c56
[ "self.summary_type = ''\nself.source_ip = ''\nself.username = ''\nself.domain = ''\nself.first_seen = 0\nself.last_seen = 0\nself.first_auth = None\nself.successful_logins = []\nself.success_source_ips = set()\nself.success_usernames = set()\nself.summary = {}\nself.distinct_source_ip_count = 0\nself.distinct_usern...
<|body_start_0|> self.summary_type = '' self.source_ip = '' self.username = '' self.domain = '' self.first_seen = 0 self.last_seen = 0 self.first_auth = None self.successful_logins = [] self.success_source_ips = set() self.success_usernames...
Class for storing authentication summary. Attributes: summary_type (str): The keyword used in generating summary. Valid values are "source_ip" or "username". source_ip (str): IP address of the client. username (str): Username used in authentication. domain (str): Domain name. Only relevant for Windows. first_seen (int)...
AuthSummary
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthSummary: """Class for storing authentication summary. Attributes: summary_type (str): The keyword used in generating summary. Valid values are "source_ip" or "username". source_ip (str): IP address of the client. username (str): Username used in authentication. domain (str): Domain name. Only...
stack_v2_sparse_classes_75kplus_train_072153
33,481
permissive
[ { "docstring": "Initialize AuthSummary.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Convert and return dict. Returns: dict: A dictionary of selected fields in AuthSummary object.", "name": "to_dict", "signature": "def to_dict(self) -> dict" } ]
2
stack_v2_sparse_classes_30k_train_043992
Implement the Python class `AuthSummary` described below. Class description: Class for storing authentication summary. Attributes: summary_type (str): The keyword used in generating summary. Valid values are "source_ip" or "username". source_ip (str): IP address of the client. username (str): Username used in authenti...
Implement the Python class `AuthSummary` described below. Class description: Class for storing authentication summary. Attributes: summary_type (str): The keyword used in generating summary. Valid values are "source_ip" or "username". source_ip (str): IP address of the client. username (str): Username used in authenti...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class AuthSummary: """Class for storing authentication summary. Attributes: summary_type (str): The keyword used in generating summary. Valid values are "source_ip" or "username". source_ip (str): IP address of the client. username (str): Username used in authentication. domain (str): Domain name. Only...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthSummary: """Class for storing authentication summary. Attributes: summary_type (str): The keyword used in generating summary. Valid values are "source_ip" or "username". source_ip (str): IP address of the client. username (str): Username used in authentication. domain (str): Domain name. Only relevant for...
the_stack_v2_python_sparse
timesketch/lib/analyzers/authentication/utils.py
google/timesketch
train
2,263
6c170170e36a6827b7326eaf8854b34e333a0335
[ "self.config = parse_config(config_file)\nif scene_id is not None:\n self.config['scene_id'] = scene_id\nself.keep_doors_list = self.mapping.map_settings[self.config['scene_id']]['doors']\nself.remove_doors = self.config['remove_doors']\nself.mapping.load_miscellaneous_map(self.config['scene_id'])\nself.mode = s...
<|body_start_0|> self.config = parse_config(config_file) if scene_id is not None: self.config['scene_id'] = scene_id self.keep_doors_list = self.mapping.map_settings[self.config['scene_id']]['doors'] self.remove_doors = self.config['remove_doors'] self.mapping.load_mi...
Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented
BaseFunctions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseFunctions: """Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented""" def __init__(self, config_file, scene_id=None, render_to_tensor=False, device_idx=0): """:param config_file: config_file path :param sce...
stack_v2_sparse_classes_75kplus_train_072154
7,132
permissive
[ { "docstring": ":param config_file: config_file path :param scene_id: override scene_id in config file :param mode: headless or gui mode :param action_timestep: environment executes action per action_timestep second :param physics_timestep: physics timestep for pybullet :param device_idx: device_idx: which GPU ...
3
stack_v2_sparse_classes_30k_train_023995
Implement the Python class `BaseFunctions` described below. Class description: Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented Method signatures and docstrings: - def __init__(self, config_file, scene_id=None, render_to_tensor=False, devic...
Implement the Python class `BaseFunctions` described below. Class description: Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented Method signatures and docstrings: - def __init__(self, config_file, scene_id=None, render_to_tensor=False, devic...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class BaseFunctions: """Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented""" def __init__(self, config_file, scene_id=None, render_to_tensor=False, device_idx=0): """:param config_file: config_file path :param sce...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseFunctions: """Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented""" def __init__(self, config_file, scene_id=None, render_to_tensor=False, device_idx=0): """:param config_file: config_file path :param scene_id: overri...
the_stack_v2_python_sparse
src/opendr/control/multi_object_search/algorithm/igibson/env_functions.py
opendr-eu/opendr
train
535
c68ca9e3c6c23db3b19896b893703b652e4bb083
[ "self.config.update_config()\nquery = self.config.get_base_query()\nquery = self.validate_base_query(query)\nquery = query.filter(or_(and_(Task.predecessor == None, Task.successors == None), Task.client_id == get_client_id()))\nquery = self.extend_query_with_ordering(query)\nif self.config.filter_text:\n query =...
<|body_start_0|> self.config.update_config() query = self.config.get_base_query() query = self.validate_base_query(query) query = query.filter(or_(and_(Task.predecessor == None, Task.successors == None), Task.client_id == get_client_id())) query = self.extend_query_with_ordering(...
Source adapter for Tasks we got from SQL
GlobalTaskTableSource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlobalTaskTableSource: """Source adapter for Tasks we got from SQL""" def build_query(self): """Builds the query based on `get_base_query()` method of config. Returns the query object.""" <|body_0|> def extend_query_with_statefilter(self, query, open_state): """W...
stack_v2_sparse_classes_75kplus_train_072155
6,256
no_license
[ { "docstring": "Builds the query based on `get_base_query()` method of config. Returns the query object.", "name": "build_query", "signature": "def build_query(self)" }, { "docstring": "When a state filter is active, we add a filter which select just the open tasks", "name": "extend_query_wi...
2
stack_v2_sparse_classes_30k_train_033902
Implement the Python class `GlobalTaskTableSource` described below. Class description: Source adapter for Tasks we got from SQL Method signatures and docstrings: - def build_query(self): Builds the query based on `get_base_query()` method of config. Returns the query object. - def extend_query_with_statefilter(self, ...
Implement the Python class `GlobalTaskTableSource` described below. Class description: Source adapter for Tasks we got from SQL Method signatures and docstrings: - def build_query(self): Builds the query based on `get_base_query()` method of config. Returns the query object. - def extend_query_with_statefilter(self, ...
954964872f73c0d18d5b0e0ab2dbf603849e4e87
<|skeleton|> class GlobalTaskTableSource: """Source adapter for Tasks we got from SQL""" def build_query(self): """Builds the query based on `get_base_query()` method of config. Returns the query object.""" <|body_0|> def extend_query_with_statefilter(self, query, open_state): """W...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlobalTaskTableSource: """Source adapter for Tasks we got from SQL""" def build_query(self): """Builds the query based on `get_base_query()` method of config. Returns the query object.""" self.config.update_config() query = self.config.get_base_query() query = self.validat...
the_stack_v2_python_sparse
opengever/tabbedview/browser/tasklisting.py
hellfish2/opengever.core
train
1
a954c3aef430a362a62ed4957bc2050fedf28378
[ "dup, total, n = (0, 0, len(nums))\nfor num in nums:\n if nums[abs(num) - 1] < 0:\n dup = abs(num)\n else:\n nums[abs(num) - 1] *= -1\n total += abs(num)\nreturn [dup, (1 + n) * n // 2 - total + dup]", "sum1 = sum(nums)\nsum2 = sum((e * e for e in nums))\nn = len(nums)\nx = n * (n + 1) // 2...
<|body_start_0|> dup, total, n = (0, 0, len(nums)) for num in nums: if nums[abs(num) - 1] < 0: dup = abs(num) else: nums[abs(num) - 1] *= -1 total += abs(num) return [dup, (1 + n) * n // 2 - total + dup] <|end_body_0|> <|body_s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findErrorNums_MK1(self, nums: List[int]) -> List[int]: """Time complexity: O(n). Space complexity: O(1).""" <|body_0|> def findErrorNums_MK2(self, nums: List[int]) -> List[int]: """Time complexity: O(n) Space complexity: O(1)""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_072156
1,569
no_license
[ { "docstring": "Time complexity: O(n). Space complexity: O(1).", "name": "findErrorNums_MK1", "signature": "def findErrorNums_MK1(self, nums: List[int]) -> List[int]" }, { "docstring": "Time complexity: O(n) Space complexity: O(1)", "name": "findErrorNums_MK2", "signature": "def findErro...
3
stack_v2_sparse_classes_30k_train_016769
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findErrorNums_MK1(self, nums: List[int]) -> List[int]: Time complexity: O(n). Space complexity: O(1). - def findErrorNums_MK2(self, nums: List[int]) -> List[int]: Time comple...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findErrorNums_MK1(self, nums: List[int]) -> List[int]: Time complexity: O(n). Space complexity: O(1). - def findErrorNums_MK2(self, nums: List[int]) -> List[int]: Time comple...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def findErrorNums_MK1(self, nums: List[int]) -> List[int]: """Time complexity: O(n). Space complexity: O(1).""" <|body_0|> def findErrorNums_MK2(self, nums: List[int]) -> List[int]: """Time complexity: O(n) Space complexity: O(1)""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findErrorNums_MK1(self, nums: List[int]) -> List[int]: """Time complexity: O(n). Space complexity: O(1).""" dup, total, n = (0, 0, len(nums)) for num in nums: if nums[abs(num) - 1] < 0: dup = abs(num) else: nums[abs(...
the_stack_v2_python_sparse
0645. Set Mismatch/Solution.py
faterazer/LeetCode
train
4
6a21073c6b87e0473566944f21ffd2c3aa93d615
[ "self.schedulers = schedulers\nself.optimizer = optimizer\nself.init_values = dict()\nfor s in self.schedulers:\n self.init_values[s.key] = getattr(self.optimizer, s.key)", "for s in self.schedulers:\n new_val = self.init_values[s.key] * s.scale(n_iter)\n setattr(self.optimizer, s.key, new_val)" ]
<|body_start_0|> self.schedulers = schedulers self.optimizer = optimizer self.init_values = dict() for s in self.schedulers: self.init_values[s.key] = getattr(self.optimizer, s.key) <|end_body_0|> <|body_start_1|> for s in self.schedulers: new_val = self....
Chainer optimizer scheduler.
ChainerScheduler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChainerScheduler: """Chainer optimizer scheduler.""" def __init__(self, schedulers: List[SchedulerInterface], optimizer: Optimizer): """Initialize class.""" <|body_0|> def step(self, n_iter: int): """Update optimizer by scheduling.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_072157
781
permissive
[ { "docstring": "Initialize class.", "name": "__init__", "signature": "def __init__(self, schedulers: List[SchedulerInterface], optimizer: Optimizer)" }, { "docstring": "Update optimizer by scheduling.", "name": "step", "signature": "def step(self, n_iter: int)" } ]
2
null
Implement the Python class `ChainerScheduler` described below. Class description: Chainer optimizer scheduler. Method signatures and docstrings: - def __init__(self, schedulers: List[SchedulerInterface], optimizer: Optimizer): Initialize class. - def step(self, n_iter: int): Update optimizer by scheduling.
Implement the Python class `ChainerScheduler` described below. Class description: Chainer optimizer scheduler. Method signatures and docstrings: - def __init__(self, schedulers: List[SchedulerInterface], optimizer: Optimizer): Initialize class. - def step(self, n_iter: int): Update optimizer by scheduling. <|skeleto...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class ChainerScheduler: """Chainer optimizer scheduler.""" def __init__(self, schedulers: List[SchedulerInterface], optimizer: Optimizer): """Initialize class.""" <|body_0|> def step(self, n_iter: int): """Update optimizer by scheduling.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChainerScheduler: """Chainer optimizer scheduler.""" def __init__(self, schedulers: List[SchedulerInterface], optimizer: Optimizer): """Initialize class.""" self.schedulers = schedulers self.optimizer = optimizer self.init_values = dict() for s in self.schedulers: ...
the_stack_v2_python_sparse
espnet/scheduler/chainer.py
espnet/espnet
train
7,242
904c99628266beb1aaf97143309deea9557cb50d
[ "super(Spaceship, self).__init__(position, load_image_convert_alpha('spaceship-off.png'))\nself.image_on = load_image_convert_alpha('spaceship-on.png')\nself.direction = [0, -1]\nself.is_throttle_on = False\nself.angle = 0\nself.active_missiles = []", "if self.is_throttle_on:\n new_image, rect = rotate_center(...
<|body_start_0|> super(Spaceship, self).__init__(position, load_image_convert_alpha('spaceship-off.png')) self.image_on = load_image_convert_alpha('spaceship-on.png') self.direction = [0, -1] self.is_throttle_on = False self.angle = 0 self.active_missiles = [] <|end_body_...
Spaceship
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Spaceship: def __init__(self, position): """initializing an Spaceship object given it's position""" <|body_0|> def draw_on(self, screen): """Draw the spaceship on the screen""" <|body_1|> def move(self): """Do one frame's worth of updating for th...
stack_v2_sparse_classes_75kplus_train_072158
23,271
no_license
[ { "docstring": "initializing an Spaceship object given it's position", "name": "__init__", "signature": "def __init__(self, position)" }, { "docstring": "Draw the spaceship on the screen", "name": "draw_on", "signature": "def draw_on(self, screen)" }, { "docstring": "Do one frame...
4
stack_v2_sparse_classes_30k_train_012793
Implement the Python class `Spaceship` described below. Class description: Implement the Spaceship class. Method signatures and docstrings: - def __init__(self, position): initializing an Spaceship object given it's position - def draw_on(self, screen): Draw the spaceship on the screen - def move(self): Do one frame'...
Implement the Python class `Spaceship` described below. Class description: Implement the Spaceship class. Method signatures and docstrings: - def __init__(self, position): initializing an Spaceship object given it's position - def draw_on(self, screen): Draw the spaceship on the screen - def move(self): Do one frame'...
4e801ecd4834e4d3b8484e6cf33cf0e1a9197490
<|skeleton|> class Spaceship: def __init__(self, position): """initializing an Spaceship object given it's position""" <|body_0|> def draw_on(self, screen): """Draw the spaceship on the screen""" <|body_1|> def move(self): """Do one frame's worth of updating for th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Spaceship: def __init__(self, position): """initializing an Spaceship object given it's position""" super(Spaceship, self).__init__(position, load_image_convert_alpha('spaceship-off.png')) self.image_on = load_image_convert_alpha('spaceship-on.png') self.direction = [0, -1] ...
the_stack_v2_python_sparse
pygame-wasm/org.pygame.asteroids.py
pmp-p/pmp-p.github.io
train
5
219fe56326a795e8d12c015ec5f57b499df51462
[ "note = self.get_object()\nif not note.is_public and note.user != self.request.user:\n return redirect('notes')\nself.object = note\nreturn super().dispatch(request, *args, **kwargs)", "initial = super().get_initial()\nnote = self.get_object()\ninitial['title'] = note.title\ninitial['content'] = note.content\n...
<|body_start_0|> note = self.get_object() if not note.is_public and note.user != self.request.user: return redirect('notes') self.object = note return super().dispatch(request, *args, **kwargs) <|end_body_0|> <|body_start_1|> initial = super().get_initial() n...
View for User to make a clone of another Note. The Note's num_clones is incremented upon a sucessful clone.
CloneNoteView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloneNoteView: """View for User to make a clone of another Note. The Note's num_clones is incremented upon a sucessful clone.""" def dispatch(self, request, *args, **kwargs): """Can only clone Note if it is public or the requesting User is the creator of the Note.""" <|body_0...
stack_v2_sparse_classes_75kplus_train_072159
4,866
no_license
[ { "docstring": "Can only clone Note if it is public or the requesting User is the creator of the Note.", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Add the cloned Note's data to the form.", "name": "get_initial", "signature": "def g...
3
stack_v2_sparse_classes_30k_train_038506
Implement the Python class `CloneNoteView` described below. Class description: View for User to make a clone of another Note. The Note's num_clones is incremented upon a sucessful clone. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Can only clone Note if it is public or the reques...
Implement the Python class `CloneNoteView` described below. Class description: View for User to make a clone of another Note. The Note's num_clones is incremented upon a sucessful clone. Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Can only clone Note if it is public or the reques...
8476643e12548ac797c6e18e23b9654c43cebe77
<|skeleton|> class CloneNoteView: """View for User to make a clone of another Note. The Note's num_clones is incremented upon a sucessful clone.""" def dispatch(self, request, *args, **kwargs): """Can only clone Note if it is public or the requesting User is the creator of the Note.""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CloneNoteView: """View for User to make a clone of another Note. The Note's num_clones is incremented upon a sucessful clone.""" def dispatch(self, request, *args, **kwargs): """Can only clone Note if it is public or the requesting User is the creator of the Note.""" note = self.get_objec...
the_stack_v2_python_sparse
notes/views.py
gurupratap-matharu/code-atlas
train
0
d0b4772cdef01cfcdad35917e8a5f1edded17bb3
[ "def linearize(domains):\n trans_domains = domains\n for domain in domains:\n implied_domains = domain.implied_ids - domain\n if implied_domains:\n trans_domains |= linearize(implied_domains)\n return trans_domains\nfor domain in self:\n domain.trans_implied_ids = linearize(doma...
<|body_start_0|> def linearize(domains): trans_domains = domains for domain in domains: implied_domains = domain.implied_ids - domain if implied_domains: trans_domains |= linearize(implied_domains) return trans_domains ...
ProductConfigDomain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductConfigDomain: def _get_trans_implied(self): """Computes the transitive closure of relation implied_ids""" <|body_0|> def compute_domain(self): """Returns a list of domains defined on a product.config.domain_line_ids and all implied_ids""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_072160
41,575
no_license
[ { "docstring": "Computes the transitive closure of relation implied_ids", "name": "_get_trans_implied", "signature": "def _get_trans_implied(self)" }, { "docstring": "Returns a list of domains defined on a product.config.domain_line_ids and all implied_ids", "name": "compute_domain", "si...
2
stack_v2_sparse_classes_30k_train_023741
Implement the Python class `ProductConfigDomain` described below. Class description: Implement the ProductConfigDomain class. Method signatures and docstrings: - def _get_trans_implied(self): Computes the transitive closure of relation implied_ids - def compute_domain(self): Returns a list of domains defined on a pro...
Implement the Python class `ProductConfigDomain` described below. Class description: Implement the ProductConfigDomain class. Method signatures and docstrings: - def _get_trans_implied(self): Computes the transitive closure of relation implied_ids - def compute_domain(self): Returns a list of domains defined on a pro...
5a235827896e6d7bff420f85228d7609715a2efb
<|skeleton|> class ProductConfigDomain: def _get_trans_implied(self): """Computes the transitive closure of relation implied_ids""" <|body_0|> def compute_domain(self): """Returns a list of domains defined on a product.config.domain_line_ids and all implied_ids""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductConfigDomain: def _get_trans_implied(self): """Computes the transitive closure of relation implied_ids""" def linearize(domains): trans_domains = domains for domain in domains: implied_domains = domain.implied_ids - domain if impli...
the_stack_v2_python_sparse
product_configurator/models/product_config.py
AULODE/somafish_2019
train
1
e162c9181a2c111291cc299a896fd1f2761414fc
[ "if path is None:\n path = self.path(collection, prefix)\npath = Path(path)\noutput = dict()\nif collection._metadata and collection._metadata.get('processors'):\n processors = collection._metadata['processors']\n processors = [proc['name'].lower() for proc in processors]\n if 'sen2cor' in processors:\n...
<|body_start_0|> if path is None: path = self.path(collection, prefix) path = Path(path) output = dict() if collection._metadata and collection._metadata.get('processors'): processors = collection._metadata['processors'] processors = [proc['name'].lowe...
Define the base collection schema for Sentinel products.
SentinelCollection
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentinelCollection: """Define the base collection schema for Sentinel products.""" def get_files(self, collection: Collection, path=None, prefix=None): """List all files in the collection.""" <|body_0|> def compressed_file(self, collection, prefix=None): """Retri...
stack_v2_sparse_classes_75kplus_train_072161
4,383
permissive
[ { "docstring": "List all files in the collection.", "name": "get_files", "signature": "def get_files(self, collection: Collection, path=None, prefix=None)" }, { "docstring": "Retrieve path to the compressed scene (.zip) on local storage.", "name": "compressed_file", "signature": "def com...
4
null
Implement the Python class `SentinelCollection` described below. Class description: Define the base collection schema for Sentinel products. Method signatures and docstrings: - def get_files(self, collection: Collection, path=None, prefix=None): List all files in the collection. - def compressed_file(self, collection...
Implement the Python class `SentinelCollection` described below. Class description: Define the base collection schema for Sentinel products. Method signatures and docstrings: - def get_files(self, collection: Collection, path=None, prefix=None): List all files in the collection. - def compressed_file(self, collection...
c6c98176ffb76286d219919176868ea5e6afedec
<|skeleton|> class SentinelCollection: """Define the base collection schema for Sentinel products.""" def get_files(self, collection: Collection, path=None, prefix=None): """List all files in the collection.""" <|body_0|> def compressed_file(self, collection, prefix=None): """Retri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentinelCollection: """Define the base collection schema for Sentinel products.""" def get_files(self, collection: Collection, path=None, prefix=None): """List all files in the collection.""" if path is None: path = self.path(collection, prefix) path = Path(path) ...
the_stack_v2_python_sparse
bdc_collectors/scihub/base.py
RichardScottOZ/bdc-collectors
train
0
474461d7921f80bbae5fe8e0e143322cf12c9e56
[ "sale_detail = SaleDetail.objects.filter(sale=obj.id)\nserializer = PaymentSaleDetailSerializer(sale_detail, many=True)\nreturn serializer.data", "fee = get_next_fee_to_pay(obj.id)\nif fee:\n serializer = FeeSerializer(fee)\n return serializer.data\nelse:\n return None", "if type(obj) is dict:\n ret...
<|body_start_0|> sale_detail = SaleDetail.objects.filter(sale=obj.id) serializer = PaymentSaleDetailSerializer(sale_detail, many=True) return serializer.data <|end_body_0|> <|body_start_1|> fee = get_next_fee_to_pay(obj.id) if fee: serializer = FeeSerializer(fee) ...
Serializer del pago.
SaleContactoDetailSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaleContactoDetailSerializer: """Serializer del pago.""" def get_products(self, obj): """Devuelve sale detail.""" <|body_0|> def get_fee(self, obj): """Devuelve sale detail.""" <|body_1|> def get_created_at(self, obj): """Devuelve created_at....
stack_v2_sparse_classes_75kplus_train_072162
24,233
no_license
[ { "docstring": "Devuelve sale detail.", "name": "get_products", "signature": "def get_products(self, obj)" }, { "docstring": "Devuelve sale detail.", "name": "get_fee", "signature": "def get_fee(self, obj)" }, { "docstring": "Devuelve created_at.", "name": "get_created_at", ...
3
stack_v2_sparse_classes_30k_train_039347
Implement the Python class `SaleContactoDetailSerializer` described below. Class description: Serializer del pago. Method signatures and docstrings: - def get_products(self, obj): Devuelve sale detail. - def get_fee(self, obj): Devuelve sale detail. - def get_created_at(self, obj): Devuelve created_at.
Implement the Python class `SaleContactoDetailSerializer` described below. Class description: Serializer del pago. Method signatures and docstrings: - def get_products(self, obj): Devuelve sale detail. - def get_fee(self, obj): Devuelve sale detail. - def get_created_at(self, obj): Devuelve created_at. <|skeleton|> ...
3135a4142c38f367a152e1fc79fee8af8fca4bcc
<|skeleton|> class SaleContactoDetailSerializer: """Serializer del pago.""" def get_products(self, obj): """Devuelve sale detail.""" <|body_0|> def get_fee(self, obj): """Devuelve sale detail.""" <|body_1|> def get_created_at(self, obj): """Devuelve created_at....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SaleContactoDetailSerializer: """Serializer del pago.""" def get_products(self, obj): """Devuelve sale detail.""" sale_detail = SaleDetail.objects.filter(sale=obj.id) serializer = PaymentSaleDetailSerializer(sale_detail, many=True) return serializer.data def get_fee(s...
the_stack_v2_python_sparse
api/serializers/payment.py
darwinv/api-chat-lnk
train
0
833fb7d5b92c784ba2526bb95a2cfb32a6cede42
[ "self.__base_url = self.BASE_URL.format(tenant_domain, environment, company_id)\nself.__user_name = user_name\nself.__web_api_key = web_api_key\nself.vendors = Vendors()\nself.accounts = Accounts()\nself.purchase_invoices = PurchaseInvoices()\nself.purchase_invoice_line_items = PurchaseInvoiceLineItems()\nself.atta...
<|body_start_0|> self.__base_url = self.BASE_URL.format(tenant_domain, environment, company_id) self.__user_name = user_name self.__web_api_key = web_api_key self.vendors = Vendors() self.accounts = Accounts() self.purchase_invoices = PurchaseInvoices() self.purch...
The main class which creates a connection with Dynamics APIs.
Dynamics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dynamics: """The main class which creates a connection with Dynamics APIs.""" def __init__(self, user_name: str, web_api_key: str, tenant_domain: str, environment: str, company_id: str): """Constructor to initialize the SDK :param user_name: Dynamics Username :param web_api_key: Dyna...
stack_v2_sparse_classes_75kplus_train_072163
2,408
no_license
[ { "docstring": "Constructor to initialize the SDK :param user_name: Dynamics Username :param web_api_key: Dynamics Web API key :param tenant_domain: Dynamics Tenant Domain :param: environment: sandbox / production :param company_id: Dynamics Company Id", "name": "__init__", "signature": "def __init__(se...
4
null
Implement the Python class `Dynamics` described below. Class description: The main class which creates a connection with Dynamics APIs. Method signatures and docstrings: - def __init__(self, user_name: str, web_api_key: str, tenant_domain: str, environment: str, company_id: str): Constructor to initialize the SDK :pa...
Implement the Python class `Dynamics` described below. Class description: The main class which creates a connection with Dynamics APIs. Method signatures and docstrings: - def __init__(self, user_name: str, web_api_key: str, tenant_domain: str, environment: str, company_id: str): Constructor to initialize the SDK :pa...
fcdb44b9bb4ebc3c60782c1150d4186c88bda0eb
<|skeleton|> class Dynamics: """The main class which creates a connection with Dynamics APIs.""" def __init__(self, user_name: str, web_api_key: str, tenant_domain: str, environment: str, company_id: str): """Constructor to initialize the SDK :param user_name: Dynamics Username :param web_api_key: Dyna...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dynamics: """The main class which creates a connection with Dynamics APIs.""" def __init__(self, user_name: str, web_api_key: str, tenant_domain: str, environment: str, company_id: str): """Constructor to initialize the SDK :param user_name: Dynamics Username :param web_api_key: Dynamics Web API ...
the_stack_v2_python_sparse
venv/Lib/site-packages/dynamics/dynamics.py
pimshare/Sandbox
train
0
d3d98051af880684c54e6026c54a89101bda6041
[ "all_fields = (fields.EmailField(max_length=75), fields.EmailField(max_length=75, label=_('Verfiy Email Address')))\nlabel = kwargs.pop('label', '') + ' (Enter twice to verify)'\nlabel = _(label)\nsuper(EmailVerificationField, self).__init__(all_fields, *args, widget=EmailVerificationWidget(attrs={'class': 'form-co...
<|body_start_0|> all_fields = (fields.EmailField(max_length=75), fields.EmailField(max_length=75, label=_('Verfiy Email Address'))) label = kwargs.pop('label', '') + ' (Enter twice to verify)' label = _(label) super(EmailVerificationField, self).__init__(all_fields, *args, widget=EmailVe...
EmailVerificationField2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailVerificationField2: def __init__(self, attrs=None, *args, **kwargs): """Have to pass a list of field types to the constructor, else we won't get any data to our compress method.""" <|body_0|> def compress(self, data_list): """Takes the values from the MultiWidge...
stack_v2_sparse_classes_75kplus_train_072164
7,116
no_license
[ { "docstring": "Have to pass a list of field types to the constructor, else we won't get any data to our compress method.", "name": "__init__", "signature": "def __init__(self, attrs=None, *args, **kwargs)" }, { "docstring": "Takes the values from the MultiWidget and passes them as a list to thi...
2
stack_v2_sparse_classes_30k_train_046988
Implement the Python class `EmailVerificationField2` described below. Class description: Implement the EmailVerificationField2 class. Method signatures and docstrings: - def __init__(self, attrs=None, *args, **kwargs): Have to pass a list of field types to the constructor, else we won't get any data to our compress m...
Implement the Python class `EmailVerificationField2` described below. Class description: Implement the EmailVerificationField2 class. Method signatures and docstrings: - def __init__(self, attrs=None, *args, **kwargs): Have to pass a list of field types to the constructor, else we won't get any data to our compress m...
f2ac4ecc076b223c262f2cde4fa3b35b4a5cd54e
<|skeleton|> class EmailVerificationField2: def __init__(self, attrs=None, *args, **kwargs): """Have to pass a list of field types to the constructor, else we won't get any data to our compress method.""" <|body_0|> def compress(self, data_list): """Takes the values from the MultiWidge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmailVerificationField2: def __init__(self, attrs=None, *args, **kwargs): """Have to pass a list of field types to the constructor, else we won't get any data to our compress method.""" all_fields = (fields.EmailField(max_length=75), fields.EmailField(max_length=75, label=_('Verfiy Email Addre...
the_stack_v2_python_sparse
tendenci/apps/base/fields.py
chendong0444/ams
train
0
3e3f73c67dd3a0378837400162f78d5dab046cd8
[ "self._schema_name = schema_name\nself._provider = provider.removesuffix('-local')\nself._provider_uuid = provider_uuid\nself._date_accessor = DateAccessor()\nself._tracing_id = tracing_id", "sql_file = f'sql/reporting_{self._provider.lower()}_hcs_daily_summary.sql'\nwith HCSReportDBAccessor(self._schema_name) as...
<|body_start_0|> self._schema_name = schema_name self._provider = provider.removesuffix('-local') self._provider_uuid = provider_uuid self._date_accessor = DateAccessor() self._tracing_id = tracing_id <|end_body_0|> <|body_start_1|> sql_file = f'sql/reporting_{self._prov...
Class to write HCS daily report summary data.
ReportHCS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportHCS: """Class to write HCS daily report summary data.""" def __init__(self, schema_name, provider, provider_uuid, tracing_id): """Establish parquet summary processor.""" <|body_0|> def generate_report(self, start_date, end_date, finalize=False): """Generate...
stack_v2_sparse_classes_75kplus_train_072165
1,852
permissive
[ { "docstring": "Establish parquet summary processor.", "name": "__init__", "signature": "def __init__(self, schema_name, provider, provider_uuid, tracing_id)" }, { "docstring": "Generate HCS daily report :param start_date (str) The date to start populating the table :param end_date (str) The dat...
2
null
Implement the Python class `ReportHCS` described below. Class description: Class to write HCS daily report summary data. Method signatures and docstrings: - def __init__(self, schema_name, provider, provider_uuid, tracing_id): Establish parquet summary processor. - def generate_report(self, start_date, end_date, fina...
Implement the Python class `ReportHCS` described below. Class description: Class to write HCS daily report summary data. Method signatures and docstrings: - def __init__(self, schema_name, provider, provider_uuid, tracing_id): Establish parquet summary processor. - def generate_report(self, start_date, end_date, fina...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class ReportHCS: """Class to write HCS daily report summary data.""" def __init__(self, schema_name, provider, provider_uuid, tracing_id): """Establish parquet summary processor.""" <|body_0|> def generate_report(self, start_date, end_date, finalize=False): """Generate...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReportHCS: """Class to write HCS daily report summary data.""" def __init__(self, schema_name, provider, provider_uuid, tracing_id): """Establish parquet summary processor.""" self._schema_name = schema_name self._provider = provider.removesuffix('-local') self._provider_u...
the_stack_v2_python_sparse
koku/hcs/daily_report.py
project-koku/koku
train
225
bbdd5b58c83e55e9411b8425d21ee7c2c8c43076
[ "super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "...
<|body_start_0|> super(Decoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(target_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)] ...
create the decoder for a transformer:r
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """create the decoder for a transformer:r""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """initialize decoder"""...
stack_v2_sparse_classes_75kplus_train_072166
11,342
no_license
[ { "docstring": "constructor", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1)" }, { "docstring": "initialize decoder", "name": "call", "signature": "def call(self, x, encoder_output, training, look_ahead_mask, padding_mask)...
2
null
Implement the Python class `Decoder` described below. Class description: create the decoder for a transformer:r Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): ...
Implement the Python class `Decoder` described below. Class description: create the decoder for a transformer:r Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): ...
bda9efa60075afa834433ff1b5179db80f2487ae
<|skeleton|> class Decoder: """create the decoder for a transformer:r""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """initialize decoder"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """create the decoder for a transformer:r""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor""" super(Decoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(target_vocab, ...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-transformer..py
vandeldiegoc/holbertonschool-machine_learning
train
0
a4e6c40edc84e8456db7174d4b800489f8bd58d3
[ "self.A = A\nself.D = D\nif sigma is None:\n self.sigma = [1.0] * len(A)\nelse:\n self.sigma = sigma\nself.rules = None\nself.average_process_time = None\nself.is_classify = is_classify", "if len(params) < 1:\n raise RuntimeError('没有传入参数到BRB中')\nparams = np.array(params)\nindex = 0\nres = {'attr_weight':...
<|body_start_0|> self.A = A self.D = D if sigma is None: self.sigma = [1.0] * len(A) else: self.sigma = sigma self.rules = None self.average_process_time = None self.is_classify = is_classify <|end_body_0|> <|body_start_1|> if len(...
DBRBBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBRBBase: def __init__(self, A, D, sigma=None, is_classify=False): """:param A: 属性参考值 :param D: 评价结果等级 :param sigma: 属性权重""" <|body_0|> def partition_params(self, params): """划分参数训练后的数据 :param params: list n_sigma属性权重 + k_theta规则权重 + m_beta规则后件置信度 :return: res = {属性权...
stack_v2_sparse_classes_75kplus_train_072167
6,735
no_license
[ { "docstring": ":param A: 属性参考值 :param D: 评价结果等级 :param sigma: 属性权重", "name": "__init__", "signature": "def __init__(self, A, D, sigma=None, is_classify=False)" }, { "docstring": "划分参数训练后的数据 :param params: list n_sigma属性权重 + k_theta规则权重 + m_beta规则后件置信度 :return: res = {属性权重, 规则权重, 规则分布形式, 规则}", ...
6
stack_v2_sparse_classes_30k_train_029145
Implement the Python class `DBRBBase` described below. Class description: Implement the DBRBBase class. Method signatures and docstrings: - def __init__(self, A, D, sigma=None, is_classify=False): :param A: 属性参考值 :param D: 评价结果等级 :param sigma: 属性权重 - def partition_params(self, params): 划分参数训练后的数据 :param params: list ...
Implement the Python class `DBRBBase` described below. Class description: Implement the DBRBBase class. Method signatures and docstrings: - def __init__(self, A, D, sigma=None, is_classify=False): :param A: 属性参考值 :param D: 评价结果等级 :param sigma: 属性权重 - def partition_params(self, params): 划分参数训练后的数据 :param params: list ...
4c86d0e832aa6d734ef3df88a5affe9923cd2182
<|skeleton|> class DBRBBase: def __init__(self, A, D, sigma=None, is_classify=False): """:param A: 属性参考值 :param D: 评价结果等级 :param sigma: 属性权重""" <|body_0|> def partition_params(self, params): """划分参数训练后的数据 :param params: list n_sigma属性权重 + k_theta规则权重 + m_beta规则后件置信度 :return: res = {属性权...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DBRBBase: def __init__(self, A, D, sigma=None, is_classify=False): """:param A: 属性参考值 :param D: 评价结果等级 :param sigma: 属性权重""" self.A = A self.D = D if sigma is None: self.sigma = [1.0] * len(A) else: self.sigma = sigma self.rules = None ...
the_stack_v2_python_sparse
毕业论文材料/dbrb_code/DBRB_opt/dbrb.py
Fuzhou-U-ACM-Research-Group/YongyuLiu
train
0
01cda23f1541d885ff24899f2d840e19b88284b3
[ "result = []\nfor i in range(0, len(nums) + 1):\n result += self.combinationSolo(nums, i)\nreturn result", "nums = sorted(nums)\nif k == 0:\n return [[]]\nelif k == len(nums):\n return [nums]\nelif k == 1:\n result = []\n for i in nums:\n if [i] not in result:\n result.append([i])...
<|body_start_0|> result = [] for i in range(0, len(nums) + 1): result += self.combinationSolo(nums, i) return result <|end_body_0|> <|body_start_1|> nums = sorted(nums) if k == 0: return [[]] elif k == len(nums): return [nums] ...
Solution_B
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_B: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run""" <|body_0|> def combinationSolo(self, nums: List[int], k: int) -> ...
stack_v2_sparse_classes_75kplus_train_072168
4,175
permissive
[ { "docstring": "With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run", "name": "subsetsWithDup", "signature": "def subsetsWithDup(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "Helper for A1, refer to LC0...
2
stack_v2_sparse_classes_30k_train_044979
Implement the Python class `Solution_B` described below. Class description: Implement the Solution_B class. Method signatures and docstrings: - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove dupl...
Implement the Python class `Solution_B` described below. Class description: Implement the Solution_B class. Method signatures and docstrings: - def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove dupl...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_B: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run""" <|body_0|> def combinationSolo(self, nums: List[int], k: int) -> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution_B: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: """With the help from the combinationSolo from Leetcode LC077 no need to use tuple, direct use list and remove duplicated on the run""" result = [] for i in range(0, len(nums) + 1): result += self.com...
the_stack_v2_python_sparse
LeetCode/LC090_subsets_ii.py
jxie0755/Learning_Python
train
0
7a60a9eb60fc6e2149bedc1f8e4aa229a2b906f1
[ "self._strategy = strategy\nself._listener = listener\nself._telemetry_runtime_producer = telemetry_runtime_producer", "for_log, for_listener = self._strategy.process_impressions(impressions)\nif len(impressions) > len(for_log):\n self._telemetry_runtime_producer.record_impression_stats(telemetry.CounterConsta...
<|body_start_0|> self._strategy = strategy self._listener = listener self._telemetry_runtime_producer = telemetry_runtime_producer <|end_body_0|> <|body_start_1|> for_log, for_listener = self._strategy.process_impressions(impressions) if len(impressions) > len(for_log): ...
Impression manager.
Manager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: """Impression manager.""" def __init__(self, strategy, telemetry_runtime_producer, listener=None): """Construct a manger to track and forward impressions to the queue. :param listener: Optional impressions listener that will capture all seen impressions. :type listener: spli...
stack_v2_sparse_classes_75kplus_train_072169
2,373
permissive
[ { "docstring": "Construct a manger to track and forward impressions to the queue. :param listener: Optional impressions listener that will capture all seen impressions. :type listener: splitio.client.listener.ImpressionListenerWrapper :param strategy: Impressions stragetgy instance :type strategy: (BaseStrategy...
3
stack_v2_sparse_classes_30k_train_024892
Implement the Python class `Manager` described below. Class description: Impression manager. Method signatures and docstrings: - def __init__(self, strategy, telemetry_runtime_producer, listener=None): Construct a manger to track and forward impressions to the queue. :param listener: Optional impressions listener tha...
Implement the Python class `Manager` described below. Class description: Impression manager. Method signatures and docstrings: - def __init__(self, strategy, telemetry_runtime_producer, listener=None): Construct a manger to track and forward impressions to the queue. :param listener: Optional impressions listener tha...
523d2395d39d189772b1db1c944db0cf4ca5769a
<|skeleton|> class Manager: """Impression manager.""" def __init__(self, strategy, telemetry_runtime_producer, listener=None): """Construct a manger to track and forward impressions to the queue. :param listener: Optional impressions listener that will capture all seen impressions. :type listener: spli...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Manager: """Impression manager.""" def __init__(self, strategy, telemetry_runtime_producer, listener=None): """Construct a manger to track and forward impressions to the queue. :param listener: Optional impressions listener that will capture all seen impressions. :type listener: splitio.client.li...
the_stack_v2_python_sparse
splitio/engine/impressions/impressions.py
splitio/python-client
train
17
f09941b3dde314876689b7bf602b4425f36e0c67
[ "self.environment = environment\nself.num_objects_failed = num_objects_failed\nself.num_objects_failed_sla = num_objects_failed_sla\nself.num_objects_met_sla = num_objects_met_sla", "if dictionary is None:\n return None\nenvironment = dictionary.get('environment')\nnum_objects_failed = dictionary.get('numObjec...
<|body_start_0|> self.environment = environment self.num_objects_failed = num_objects_failed self.num_objects_failed_sla = num_objects_failed_sla self.num_objects_met_sla = num_objects_met_sla <|end_body_0|> <|body_start_1|> if dictionary is None: return None ...
Implementation of the 'LastProtectionRunStatsByEnv' model. Specifies the last Protection Run stats by env. Attributes: environment (EnvironmentLastProtectionRunStatsByEnvEnum): Specifies the environment. num_objects_failed (long|int): Specifies the count of objects that failed last Protection Run. num_objects_failed_sl...
LastProtectionRunStatsByEnv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LastProtectionRunStatsByEnv: """Implementation of the 'LastProtectionRunStatsByEnv' model. Specifies the last Protection Run stats by env. Attributes: environment (EnvironmentLastProtectionRunStatsByEnvEnum): Specifies the environment. num_objects_failed (long|int): Specifies the count of objects...
stack_v2_sparse_classes_75kplus_train_072170
2,527
permissive
[ { "docstring": "Constructor for the LastProtectionRunStatsByEnv class", "name": "__init__", "signature": "def __init__(self, environment=None, num_objects_failed=None, num_objects_failed_sla=None, num_objects_met_sla=None)" }, { "docstring": "Creates an instance of this model from a dictionary A...
2
stack_v2_sparse_classes_30k_train_004629
Implement the Python class `LastProtectionRunStatsByEnv` described below. Class description: Implementation of the 'LastProtectionRunStatsByEnv' model. Specifies the last Protection Run stats by env. Attributes: environment (EnvironmentLastProtectionRunStatsByEnvEnum): Specifies the environment. num_objects_failed (lo...
Implement the Python class `LastProtectionRunStatsByEnv` described below. Class description: Implementation of the 'LastProtectionRunStatsByEnv' model. Specifies the last Protection Run stats by env. Attributes: environment (EnvironmentLastProtectionRunStatsByEnvEnum): Specifies the environment. num_objects_failed (lo...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class LastProtectionRunStatsByEnv: """Implementation of the 'LastProtectionRunStatsByEnv' model. Specifies the last Protection Run stats by env. Attributes: environment (EnvironmentLastProtectionRunStatsByEnvEnum): Specifies the environment. num_objects_failed (long|int): Specifies the count of objects...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LastProtectionRunStatsByEnv: """Implementation of the 'LastProtectionRunStatsByEnv' model. Specifies the last Protection Run stats by env. Attributes: environment (EnvironmentLastProtectionRunStatsByEnvEnum): Specifies the environment. num_objects_failed (long|int): Specifies the count of objects that failed ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/last_protection_run_stats_by_env.py
cohesity/management-sdk-python
train
24
6449243f07327101a2eaa009506ec67d49b74395
[ "try:\n user = User.objects.get(pk=data)\nexcept User.DoesNotExist:\n raise serializers.ValidationError('Invalid passenger')\ncircle = self.context['circle']\ntry:\n membership = Membership.objects.get(user=user, circle=circle, is_active=True)\nexcept Membership.DoesNotExists:\n raise serializers.Valida...
<|body_start_0|> try: user = User.objects.get(pk=data) except User.DoesNotExist: raise serializers.ValidationError('Invalid passenger') circle = self.context['circle'] try: membership = Membership.objects.get(user=user, circle=circle, is_active=True) ...
Join Ride Serializer.
JoinRideSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinRideSerializer: """Join Ride Serializer.""" def validate_passenger(self, data): """Verify passenger exists and is a circle member.""" <|body_0|> def validate(self, data): """Verify rides allow new passengers.""" <|body_1|> def update(self, instan...
stack_v2_sparse_classes_75kplus_train_072171
5,840
permissive
[ { "docstring": "Verify passenger exists and is a circle member.", "name": "validate_passenger", "signature": "def validate_passenger(self, data)" }, { "docstring": "Verify rides allow new passengers.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_050891
Implement the Python class `JoinRideSerializer` described below. Class description: Join Ride Serializer. Method signatures and docstrings: - def validate_passenger(self, data): Verify passenger exists and is a circle member. - def validate(self, data): Verify rides allow new passengers. - def update(self, instance, ...
Implement the Python class `JoinRideSerializer` described below. Class description: Join Ride Serializer. Method signatures and docstrings: - def validate_passenger(self, data): Verify passenger exists and is a circle member. - def validate(self, data): Verify rides allow new passengers. - def update(self, instance, ...
642576deaf569663d5dbc0d5820cfbc49c17fd2e
<|skeleton|> class JoinRideSerializer: """Join Ride Serializer.""" def validate_passenger(self, data): """Verify passenger exists and is a circle member.""" <|body_0|> def validate(self, data): """Verify rides allow new passengers.""" <|body_1|> def update(self, instan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JoinRideSerializer: """Join Ride Serializer.""" def validate_passenger(self, data): """Verify passenger exists and is a circle member.""" try: user = User.objects.get(pk=data) except User.DoesNotExist: raise serializers.ValidationError('Invalid passenger') ...
the_stack_v2_python_sparse
cride/rides/serializers/rides.py
stalinch98/Advanced_Django
train
2
a41bfde2151cdab717ca936a9e06d45bfdcfad59
[ "super(SemanticDecoder, self).__init__()\nself.embed = nn.Embedding(vocab_size, p.embed_size)\nself.rnn = nn.GRU(input_size=p.embed_size * 2, hidden_size=p.hidden_size, num_layers=p.num_layers, batch_first=True, dropout=p.dropout)\nself.out = nn.Linear(p.hidden_size, vocab_size)\nself.feature_transformer = nn.Linea...
<|body_start_0|> super(SemanticDecoder, self).__init__() self.embed = nn.Embedding(vocab_size, p.embed_size) self.rnn = nn.GRU(input_size=p.embed_size * 2, hidden_size=p.hidden_size, num_layers=p.num_layers, batch_first=True, dropout=p.dropout) self.out = nn.Linear(p.hidden_size, vocab_s...
SemanticDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SemanticDecoder: def __init__(self, p, vocab_size, max_seq_length=40): """Set the hyper-parameters and build the layers.""" <|body_0|> def forward(self, context_vector, sequence_features, semantics, stories, lengths): """learn context vector and training story throug...
stack_v2_sparse_classes_75kplus_train_072172
7,885
permissive
[ { "docstring": "Set the hyper-parameters and build the layers.", "name": "__init__", "signature": "def __init__(self, p, vocab_size, max_seq_length=40)" }, { "docstring": "learn context vector and training story through teacher forcing. :param context_vector: images sequence context vectors (seq...
3
stack_v2_sparse_classes_30k_train_053031
Implement the Python class `SemanticDecoder` described below. Class description: Implement the SemanticDecoder class. Method signatures and docstrings: - def __init__(self, p, vocab_size, max_seq_length=40): Set the hyper-parameters and build the layers. - def forward(self, context_vector, sequence_features, semantic...
Implement the Python class `SemanticDecoder` described below. Class description: Implement the SemanticDecoder class. Method signatures and docstrings: - def __init__(self, p, vocab_size, max_seq_length=40): Set the hyper-parameters and build the layers. - def forward(self, context_vector, sequence_features, semantic...
dce17296493b969088b6f967e963cb3b23dc5f3e
<|skeleton|> class SemanticDecoder: def __init__(self, p, vocab_size, max_seq_length=40): """Set the hyper-parameters and build the layers.""" <|body_0|> def forward(self, context_vector, sequence_features, semantics, stories, lengths): """learn context vector and training story throug...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SemanticDecoder: def __init__(self, p, vocab_size, max_seq_length=40): """Set the hyper-parameters and build the layers.""" super(SemanticDecoder, self).__init__() self.embed = nn.Embedding(vocab_size, p.embed_size) self.rnn = nn.GRU(input_size=p.embed_size * 2, hidden_size=p.h...
the_stack_v2_python_sparse
sources/models/baseline.py
aalto-cbir/visual-storytelling
train
2
d9148bc5d567bb9a9f1501cdcc694605956400e3
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), firstname=firstname, lastname=lastname)\nuser.set_password(password)\nuser.acceptance = True\nuser.is_active = True\nuser.save(using=self._db)\nreturn user", "user = self.create_user(emai...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), firstname=firstname, lastname=lastname) user.set_password(password) user.acceptance = True user.is_active = True user.save(...
UserProfileManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserProfileManager: def create_user(self, email, firstname, lastname, password=None, is_active=False): """Creates and saves a User with the given email, firstname, lastname and password.""" <|body_0|> def create_superuser(self, email, firstname, lastname, password): ...
stack_v2_sparse_classes_75kplus_train_072173
4,275
no_license
[ { "docstring": "Creates and saves a User with the given email, firstname, lastname and password.", "name": "create_user", "signature": "def create_user(self, email, firstname, lastname, password=None, is_active=False)" }, { "docstring": "Creates and saves a superuser with the given email, date o...
2
stack_v2_sparse_classes_30k_val_000098
Implement the Python class `UserProfileManager` described below. Class description: Implement the UserProfileManager class. Method signatures and docstrings: - def create_user(self, email, firstname, lastname, password=None, is_active=False): Creates and saves a User with the given email, firstname, lastname and pass...
Implement the Python class `UserProfileManager` described below. Class description: Implement the UserProfileManager class. Method signatures and docstrings: - def create_user(self, email, firstname, lastname, password=None, is_active=False): Creates and saves a User with the given email, firstname, lastname and pass...
ed5640b76907832a21ae0dec98f2b6ef109a9dbd
<|skeleton|> class UserProfileManager: def create_user(self, email, firstname, lastname, password=None, is_active=False): """Creates and saves a User with the given email, firstname, lastname and password.""" <|body_0|> def create_superuser(self, email, firstname, lastname, password): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserProfileManager: def create_user(self, email, firstname, lastname, password=None, is_active=False): """Creates and saves a User with the given email, firstname, lastname and password.""" if not email: raise ValueError('Users must have an email address') user = self.model...
the_stack_v2_python_sparse
source/tos_web/models.py
jdalzatec/legacy-tos
train
0
4b67ade6c5c960c2aa6ab0fe9d328fb12adac929
[ "ne_id = int(frame.get_data())\nself.ne_id = ne_id\ntracelog.info('begin import NE(%d) data.' % ne_id)\nret = self.__decompress_data_file()\nif ret != 0:\n tracelog.error('decompress data file failed. NE id:%d' % self.ne_id)\n self.__change_ne_state_when_imp_failed()\n return\ntracelog.info('decompress dat...
<|body_start_0|> ne_id = int(frame.get_data()) self.ne_id = ne_id tracelog.info('begin import NE(%d) data.' % ne_id) ret = self.__decompress_data_file() if ret != 0: tracelog.error('decompress data file failed. NE id:%d' % self.ne_id) self.__change_ne_stat...
Class: SyncFullImpHandler Description: Ԫݵ뵽ݿhandler Base: Others:
SyncFullImpHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyncFullImpHandler: """Class: SyncFullImpHandler Description: Ԫݵ뵽ݿhandler Base: Others:""" def handle_cmd(self, frame): """Method: handle_cmd Description: Ϣ Parameter: frame: AppFrame Return: Others:""" <|body_0|> def __change_ne_state_when_imp_failed(self): """M...
stack_v2_sparse_classes_75kplus_train_072174
6,430
no_license
[ { "docstring": "Method: handle_cmd Description: Ϣ Parameter: frame: AppFrame Return: Others:", "name": "handle_cmd", "signature": "def handle_cmd(self, frame)" }, { "docstring": "Method: __change_ne_state_when_imp_failed Description: Ԫʧܵʱ޸Ԫ״̬ Parameter: Return: Others:", "name": "__change_ne...
6
stack_v2_sparse_classes_30k_train_034003
Implement the Python class `SyncFullImpHandler` described below. Class description: Class: SyncFullImpHandler Description: Ԫݵ뵽ݿhandler Base: Others: Method signatures and docstrings: - def handle_cmd(self, frame): Method: handle_cmd Description: Ϣ Parameter: frame: AppFrame Return: Others: - def __change_ne_state_whe...
Implement the Python class `SyncFullImpHandler` described below. Class description: Class: SyncFullImpHandler Description: Ԫݵ뵽ݿhandler Base: Others: Method signatures and docstrings: - def handle_cmd(self, frame): Method: handle_cmd Description: Ϣ Parameter: frame: AppFrame Return: Others: - def __change_ne_state_whe...
e78df71fbc5d73dd93ba9452d4b54183fe1e7e1f
<|skeleton|> class SyncFullImpHandler: """Class: SyncFullImpHandler Description: Ԫݵ뵽ݿhandler Base: Others:""" def handle_cmd(self, frame): """Method: handle_cmd Description: Ϣ Parameter: frame: AppFrame Return: Others:""" <|body_0|> def __change_ne_state_when_imp_failed(self): """M...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SyncFullImpHandler: """Class: SyncFullImpHandler Description: Ԫݵ뵽ݿhandler Base: Others:""" def handle_cmd(self, frame): """Method: handle_cmd Description: Ϣ Parameter: frame: AppFrame Return: Others:""" ne_id = int(frame.get_data()) self.ne_id = ne_id tracelog.info('begin ...
the_stack_v2_python_sparse
weixin/code/rfid_plt/db_sync/db_sync_update_app/sync_full_imp_handler.py
allenforrest/wxbiz
train
0
995b1e180890988d325dd5d11f0ab97c22349dae
[ "super().__init__(vacuum_bot, entity_descrption)\nself._event_type = event_type\nself._extract_value = extract_value", "await super().async_added_to_hass()\n\nasync def on_event(event: T) -> None:\n value = self._extract_value(event)\n if value is not None:\n self._attr_native_value = value\n ...
<|body_start_0|> super().__init__(vacuum_bot, entity_descrption) self._event_type = event_type self._extract_value = extract_value <|end_body_0|> <|body_start_1|> await super().async_added_to_hass() async def on_event(event: T) -> None: value = self._extract_value(e...
Deebot generic sensor.
DeebotGenericSensor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeebotGenericSensor: """Deebot generic sensor.""" def __init__(self, vacuum_bot: VacuumBot, entity_descrption: SensorEntityDescription, event_type: type[T], extract_value: Callable[[T], StateType]): """Initialize the Sensor.""" <|body_0|> async def async_added_to_hass(se...
stack_v2_sparse_classes_75kplus_train_072175
8,925
permissive
[ { "docstring": "Initialize the Sensor.", "name": "__init__", "signature": "def __init__(self, vacuum_bot: VacuumBot, entity_descrption: SensorEntityDescription, event_type: type[T], extract_value: Callable[[T], StateType])" }, { "docstring": "Set up the event listeners now that hass is ready.", ...
2
stack_v2_sparse_classes_30k_train_038745
Implement the Python class `DeebotGenericSensor` described below. Class description: Deebot generic sensor. Method signatures and docstrings: - def __init__(self, vacuum_bot: VacuumBot, entity_descrption: SensorEntityDescription, event_type: type[T], extract_value: Callable[[T], StateType]): Initialize the Sensor. - ...
Implement the Python class `DeebotGenericSensor` described below. Class description: Deebot generic sensor. Method signatures and docstrings: - def __init__(self, vacuum_bot: VacuumBot, entity_descrption: SensorEntityDescription, event_type: type[T], extract_value: Callable[[T], StateType]): Initialize the Sensor. - ...
9ab937028abf86a4f886cdf8b4231daa0fe6916b
<|skeleton|> class DeebotGenericSensor: """Deebot generic sensor.""" def __init__(self, vacuum_bot: VacuumBot, entity_descrption: SensorEntityDescription, event_type: type[T], extract_value: Callable[[T], StateType]): """Initialize the Sensor.""" <|body_0|> async def async_added_to_hass(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeebotGenericSensor: """Deebot generic sensor.""" def __init__(self, vacuum_bot: VacuumBot, entity_descrption: SensorEntityDescription, event_type: type[T], extract_value: Callable[[T], StateType]): """Initialize the Sensor.""" super().__init__(vacuum_bot, entity_descrption) self....
the_stack_v2_python_sparse
data/homeassistant/custom_components/deebot/sensor.py
Sanderhuisman/home-assistant-config
train
2
c07f07a6bb5a7a4268e8e0d6224f7fbe9f50a67e
[ "serializer = CounselDateSerializer(data=request.data)\nif serializer.is_valid():\n selected_client_email = request.data.get('client')\n client = User.objects.get(email=selected_client_email)\n counsel_date1 = RegisterCounselDate.objects.create(counselor=request.user, client=client)\n counsel_date_id = ...
<|body_start_0|> serializer = CounselDateSerializer(data=request.data) if serializer.is_valid(): selected_client_email = request.data.get('client') client = User.objects.get(email=selected_client_email) counsel_date1 = RegisterCounselDate.objects.create(counselor=requ...
CounselDate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CounselDate: def post(self, request): """상담 등록 --- # /counsels/date/ ## headers - Authorization : Token ## body parameter - client : 내담자 이메일 [ex> capstone4824@gmail.com] - counsel_date : 상담 날짜 [ex> 2020-10-30T20:38:59Z]""" <|body_0|> def get(self, request): """등록된 상담...
stack_v2_sparse_classes_75kplus_train_072176
10,484
no_license
[ { "docstring": "상담 등록 --- # /counsels/date/ ## headers - Authorization : Token ## body parameter - client : 내담자 이메일 [ex> capstone4824@gmail.com] - counsel_date : 상담 날짜 [ex> 2020-10-30T20:38:59Z]", "name": "post", "signature": "def post(self, request)" }, { "docstring": "등록된 상담 조회 --- # /counsels...
3
null
Implement the Python class `CounselDate` described below. Class description: Implement the CounselDate class. Method signatures and docstrings: - def post(self, request): 상담 등록 --- # /counsels/date/ ## headers - Authorization : Token ## body parameter - client : 내담자 이메일 [ex> capstone4824@gmail.com] - counsel_date : 상...
Implement the Python class `CounselDate` described below. Class description: Implement the CounselDate class. Method signatures and docstrings: - def post(self, request): 상담 등록 --- # /counsels/date/ ## headers - Authorization : Token ## body parameter - client : 내담자 이메일 [ex> capstone4824@gmail.com] - counsel_date : 상...
751f3a8d7ef139c5d6fa17bcfe59fd05fbe3818c
<|skeleton|> class CounselDate: def post(self, request): """상담 등록 --- # /counsels/date/ ## headers - Authorization : Token ## body parameter - client : 내담자 이메일 [ex> capstone4824@gmail.com] - counsel_date : 상담 날짜 [ex> 2020-10-30T20:38:59Z]""" <|body_0|> def get(self, request): """등록된 상담...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CounselDate: def post(self, request): """상담 등록 --- # /counsels/date/ ## headers - Authorization : Token ## body parameter - client : 내담자 이메일 [ex> capstone4824@gmail.com] - counsel_date : 상담 날짜 [ex> 2020-10-30T20:38:59Z]""" serializer = CounselDateSerializer(data=request.data) if serial...
the_stack_v2_python_sparse
findme/counsel/views.py
real-kk/findme-backend
train
4
b429ee539123e79bbbf54940a4fe9da8af128628
[ "request = pecan.request\ncontext = request.environ['context']\nrecord = self.central_api.get_record(context, zone_id, recordset_id, record_id)\nreturn self._view.show(context, request, record)", "request = pecan.request\ncontext = request.environ['context']\nmarker, limit, sort_key, sort_dir = self._get_paging_p...
<|body_start_0|> request = pecan.request context = request.environ['context'] record = self.central_api.get_record(context, zone_id, recordset_id, record_id) return self._view.show(context, request, record) <|end_body_0|> <|body_start_1|> request = pecan.request context ...
RecordsController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecordsController: def get_one(self, zone_id, recordset_id, record_id): """Get Record""" <|body_0|> def get_all(self, zone_id, recordset_id, **params): """List Records""" <|body_1|> def post_all(self, zone_id, recordset_id): """Create Record""" ...
stack_v2_sparse_classes_75kplus_train_072177
5,837
permissive
[ { "docstring": "Get Record", "name": "get_one", "signature": "def get_one(self, zone_id, recordset_id, record_id)" }, { "docstring": "List Records", "name": "get_all", "signature": "def get_all(self, zone_id, recordset_id, **params)" }, { "docstring": "Create Record", "name":...
5
stack_v2_sparse_classes_30k_train_003336
Implement the Python class `RecordsController` described below. Class description: Implement the RecordsController class. Method signatures and docstrings: - def get_one(self, zone_id, recordset_id, record_id): Get Record - def get_all(self, zone_id, recordset_id, **params): List Records - def post_all(self, zone_id,...
Implement the Python class `RecordsController` described below. Class description: Implement the RecordsController class. Method signatures and docstrings: - def get_one(self, zone_id, recordset_id, record_id): Get Record - def get_all(self, zone_id, recordset_id, **params): List Records - def post_all(self, zone_id,...
331ee1958271990ae383203e7f7970f8f41ca003
<|skeleton|> class RecordsController: def get_one(self, zone_id, recordset_id, record_id): """Get Record""" <|body_0|> def get_all(self, zone_id, recordset_id, **params): """List Records""" <|body_1|> def post_all(self, zone_id, recordset_id): """Create Record""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecordsController: def get_one(self, zone_id, recordset_id, record_id): """Get Record""" request = pecan.request context = request.environ['context'] record = self.central_api.get_record(context, zone_id, recordset_id, record_id) return self._view.show(context, request,...
the_stack_v2_python_sparse
designate/api/v2/controllers/records.py
NeCTAR-RC/designate
train
1
9ad687a235263b2dcdd782d71d47b89ff973d3a0
[ "self.list = []\nself.sum = 0\nself.capacity = size\nself.size = 0\nself.flag = 0", "if self.size < self.capacity:\n self.list.append(val)\n self.size += 1.0\n self.sum += val\n return self.sum / self.size\nelse:\n self.sum -= self.list[self.flag]\n self.flag += 1\n self.list.append(val)\n ...
<|body_start_0|> self.list = [] self.sum = 0 self.capacity = size self.size = 0 self.flag = 0 <|end_body_0|> <|body_start_1|> if self.size < self.capacity: self.list.append(val) self.size += 1.0 self.sum += val return self....
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.list = [] self.sum = 0 ...
stack_v2_sparse_classes_75kplus_train_072178
889
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_018340
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
6d361cad2821248350f1d8432fdfef86895ca281
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.list = [] self.sum = 0 self.capacity = size self.size = 0 self.flag = 0 def next(self, val): """:type val: int :rtype: float""" if self....
the_stack_v2_python_sparse
Design/movingAverage.py
tr1503/LeetCode
train
0
ac193c3bfc0480464070527a580fedd758c2abed
[ "self.path = Path(path)\nif not self.path.is_absolute():\n raise ValueError(f'PdfReader initialized with relative path {path}')", "if force_ocr:\n return self.ocr_text()\nwith open(self.path, 'rb') as file:\n try:\n pdf = pdftotext.PDF(file)\n except pdftotext.Error:\n if not (allow_ocr ...
<|body_start_0|> self.path = Path(path) if not self.path.is_absolute(): raise ValueError(f'PdfReader initialized with relative path {path}') <|end_body_0|> <|body_start_1|> if force_ocr: return self.ocr_text() with open(self.path, 'rb') as file: try: ...
PdfReader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PdfReader: def __init__(self, path: Union[Path, str]) -> None: """Construct PdfReader object. :param path: Absolute path to PDF document.""" <|body_0|> def read_text(self, *, allow_ocr: bool, force_ocr: bool=False) -> Optional[str]: """Return text content of PDF. :pa...
stack_v2_sparse_classes_75kplus_train_072179
6,213
permissive
[ { "docstring": "Construct PdfReader object. :param path: Absolute path to PDF document.", "name": "__init__", "signature": "def __init__(self, path: Union[Path, str]) -> None" }, { "docstring": "Return text content of PDF. :param allow_ocr: If text cant be extracted from PDF directly, since it d...
4
stack_v2_sparse_classes_30k_train_041888
Implement the Python class `PdfReader` described below. Class description: Implement the PdfReader class. Method signatures and docstrings: - def __init__(self, path: Union[Path, str]) -> None: Construct PdfReader object. :param path: Absolute path to PDF document. - def read_text(self, *, allow_ocr: bool, force_ocr:...
Implement the Python class `PdfReader` described below. Class description: Implement the PdfReader class. Method signatures and docstrings: - def __init__(self, path: Union[Path, str]) -> None: Construct PdfReader object. :param path: Absolute path to PDF document. - def read_text(self, *, allow_ocr: bool, force_ocr:...
5743b1d4c3fefa66fcaa4d283436d2a3f0490604
<|skeleton|> class PdfReader: def __init__(self, path: Union[Path, str]) -> None: """Construct PdfReader object. :param path: Absolute path to PDF document.""" <|body_0|> def read_text(self, *, allow_ocr: bool, force_ocr: bool=False) -> Optional[str]: """Return text content of PDF. :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PdfReader: def __init__(self, path: Union[Path, str]) -> None: """Construct PdfReader object. :param path: Absolute path to PDF document.""" self.path = Path(path) if not self.path.is_absolute(): raise ValueError(f'PdfReader initialized with relative path {path}') def ...
the_stack_v2_python_sparse
examiner/pdf.py
JakobGM/WikiLinks
train
7
923894e093acec0b949f90d4d0593357f880ea62
[ "the_terms = dict()\nfor NounClass in NOUN_CLASSES:\n for item in NounClass.objects.all():\n for noun in item.get_nouns():\n assert noun not in the_terms\n the_terms[noun] = item\nfor command in COMMANDS:\n for verb in command.verbs:\n assert verb not in the_terms\n ...
<|body_start_0|> the_terms = dict() for NounClass in NOUN_CLASSES: for item in NounClass.objects.all(): for noun in item.get_nouns(): assert noun not in the_terms the_terms[noun] = item for command in COMMANDS: for v...
A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts.
Context
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Context: """A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts.""" def terms(self): """A cached dictionary of known nouns and verbs.""" <|body_0|> def enrich_part(self, part): """Enriches a single part (...
stack_v2_sparse_classes_75kplus_train_072180
3,704
permissive
[ { "docstring": "A cached dictionary of known nouns and verbs.", "name": "terms", "signature": "def terms(self)" }, { "docstring": "Enriches a single part (which, well, might contain more than one actual word). :param part: A part(-of-speech) to enrich. :return: The part itself, or a model.", ...
3
stack_v2_sparse_classes_30k_train_052965
Implement the Python class `Context` described below. Class description: A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts. Method signatures and docstrings: - def terms(self): A cached dictionary of known nouns and verbs. - def enrich_part(self, part): Enr...
Implement the Python class `Context` described below. Class description: A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts. Method signatures and docstrings: - def terms(self): A cached dictionary of known nouns and verbs. - def enrich_part(self, part): Enr...
ab9ce59ef6d7a8db30d38740aba44855fe5e87e7
<|skeleton|> class Context: """A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts.""" def terms(self): """A cached dictionary of known nouns and verbs.""" <|body_0|> def enrich_part(self, part): """Enriches a single part (...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Context: """A Context contains the hot words for the current environment (project etc.) mapped to their model counterparts.""" def terms(self): """A cached dictionary of known nouns and verbs.""" the_terms = dict() for NounClass in NOUN_CLASSES: for item in NounClass.o...
the_stack_v2_python_sparse
wurst/cli/context.py
jyrama/wurst
train
0
2acdc3142cdfea3def580b1ce0bf3a77e348fdc0
[ "if request.method in self.safe_methods:\n return True\nif request.user.is_authenticated and hasattr(request.user, 'driver_profile'):\n return True\nreturn False", "if obj.account == request.user:\n return True\nreturn False" ]
<|body_start_0|> if request.method in self.safe_methods: return True if request.user.is_authenticated and hasattr(request.user, 'driver_profile'): return True return False <|end_body_0|> <|body_start_1|> if obj.account == request.user: return True ...
The Permission class used by DriverProfileView.
DriverProfilePermissions
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverProfilePermissions: """The Permission class used by DriverProfileView.""" def has_permission(self, request, view): """Checks if request is safe, if not it checks if the user is authenticated and has a valid driver profile, because that account may be other type like a regular u...
stack_v2_sparse_classes_75kplus_train_072181
1,905
permissive
[ { "docstring": "Checks if request is safe, if not it checks if the user is authenticated and has a valid driver profile, because that account may be other type like a regular user, shop or an admin.", "name": "has_permission", "signature": "def has_permission(self, request, view)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_007441
Implement the Python class `DriverProfilePermissions` described below. Class description: The Permission class used by DriverProfileView. Method signatures and docstrings: - def has_permission(self, request, view): Checks if request is safe, if not it checks if the user is authenticated and has a valid driver profile...
Implement the Python class `DriverProfilePermissions` described below. Class description: The Permission class used by DriverProfileView. Method signatures and docstrings: - def has_permission(self, request, view): Checks if request is safe, if not it checks if the user is authenticated and has a valid driver profile...
7c361a31c5225c6ad649fcf92e323bdb10cc4c16
<|skeleton|> class DriverProfilePermissions: """The Permission class used by DriverProfileView.""" def has_permission(self, request, view): """Checks if request is safe, if not it checks if the user is authenticated and has a valid driver profile, because that account may be other type like a regular u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DriverProfilePermissions: """The Permission class used by DriverProfileView.""" def has_permission(self, request, view): """Checks if request is safe, if not it checks if the user is authenticated and has a valid driver profile, because that account may be other type like a regular user, shop or ...
the_stack_v2_python_sparse
drivers/permissions.py
ahmed-alllam/Koshkie-Server
train
0
60eecbc9886dc6e7e022d5c87830e49e1975c31f
[ "self.quark = quark\nself.nucleon = nucleon\nself.ip = input_dict", "if self.nucleon == 'p':\n if self.quark == 'u':\n return self.ip['mu_at_2GeV'] * self.ip['gTu']\n if self.quark == 'd':\n return self.ip['md_at_2GeV'] * self.ip['gTd']\n if self.quark == 's':\n return self.ip['ms_at...
<|body_start_0|> self.quark = quark self.nucleon = nucleon self.ip = input_dict <|end_body_0|> <|body_start_1|> if self.nucleon == 'p': if self.quark == 'u': return self.ip['mu_at_2GeV'] * self.ip['gTu'] if self.quark == 'd': retur...
FT0
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FT0: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictio...
stack_v2_sparse_classes_75kplus_train_072182
18,337
permissive
[ { "docstring": "The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadronic input parameters (default is Num_input().input_...
2
stack_v2_sparse_classes_30k_train_031496
Implement the Python class `FT0` described below. Class description: Implement the FT0 class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, stra...
Implement the Python class `FT0` described below. Class description: Implement the FT0 class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, stra...
4a714e4701f817fdc96e10e461eef7c4756ef71d
<|skeleton|> class FT0: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictio...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FT0: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FT0 Return the nuclear form factor FT0 Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictionary of hadron...
the_stack_v2_python_sparse
directdm/num/single_nucleon_form_factors.py
DirectDM/directdm-py
train
6
1cb210b1d729c9b102ff45a691c33aa432b2bf17
[ "profile_data = validated_data.pop('profile', None)\nconsumer = Consumer.objects.create(**validated_data)\nif profile_data:\n profile = ConsumerProfile.objects.get(user=consumer)\n for attr, value in profile_data.items():\n setattr(profile, attr, value)\n profile.save()\nSchoolMember.objects.create(...
<|body_start_0|> profile_data = validated_data.pop('profile', None) consumer = Consumer.objects.create(**validated_data) if profile_data: profile = ConsumerProfile.objects.get(user=consumer) for attr, value in profile_data.items(): setattr(profile, attr, v...
ManageConsumersSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageConsumersSerializer: def create(self, validated_data): """create user, update profile, attach to school, invite user via email""" <|body_0|> def update(self, instance, validated_data): """update user & profile""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_072183
7,280
permissive
[ { "docstring": "create user, update profile, attach to school, invite user via email", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "update user & profile", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
null
Implement the Python class `ManageConsumersSerializer` described below. Class description: Implement the ManageConsumersSerializer class. Method signatures and docstrings: - def create(self, validated_data): create user, update profile, attach to school, invite user via email - def update(self, instance, validated_da...
Implement the Python class `ManageConsumersSerializer` described below. Class description: Implement the ManageConsumersSerializer class. Method signatures and docstrings: - def create(self, validated_data): create user, update profile, attach to school, invite user via email - def update(self, instance, validated_da...
46857dd79dc58f63c3afb9791ecf8adf853a6c57
<|skeleton|> class ManageConsumersSerializer: def create(self, validated_data): """create user, update profile, attach to school, invite user via email""" <|body_0|> def update(self, instance, validated_data): """update user & profile""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ManageConsumersSerializer: def create(self, validated_data): """create user, update profile, attach to school, invite user via email""" profile_data = validated_data.pop('profile', None) consumer = Consumer.objects.create(**validated_data) if profile_data: profile =...
the_stack_v2_python_sparse
server/server/users/api/serializers.py
Eyal-VR/connective
train
1
53685b4dccb641ea5d11ed199971c3222b883dc8
[ "while True:\n container = scan_q.get()\n self.process_container(container)\n scan_q.task_done()", "j = journal.Reader(path='/host/var/log/journal')\nj.log_level(journal.LOG_INFO)\nj.this_boot()\nj.add_match(_SYSTEMD_UNIT=u'atomic-openshift-node.service')\nj.seek_tail()\nj.get_previous()\npollobj = selec...
<|body_start_0|> while True: container = scan_q.get() self.process_container(container) scan_q.task_done() <|end_body_0|> <|body_start_1|> j = journal.Reader(path='/host/var/log/journal') j.log_level(journal.LOG_INFO) j.this_boot() j.add_match...
Class to receive and report scan results.
PlegEventListener
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlegEventListener: """Class to receive and report scan results.""" def scan_worker(self, scan_q): """Worker thread function.""" <|body_0|> def catch_creates(scan_q): """Watch the host node journal for creates.""" <|body_1|> def process_container(cont...
stack_v2_sparse_classes_75kplus_train_072184
3,450
permissive
[ { "docstring": "Worker thread function.", "name": "scan_worker", "signature": "def scan_worker(self, scan_q)" }, { "docstring": "Watch the host node journal for creates.", "name": "catch_creates", "signature": "def catch_creates(scan_q)" }, { "docstring": "Check if provided conta...
4
stack_v2_sparse_classes_30k_train_019651
Implement the Python class `PlegEventListener` described below. Class description: Class to receive and report scan results. Method signatures and docstrings: - def scan_worker(self, scan_q): Worker thread function. - def catch_creates(scan_q): Watch the host node journal for creates. - def process_container(containe...
Implement the Python class `PlegEventListener` described below. Class description: Class to receive and report scan results. Method signatures and docstrings: - def scan_worker(self, scan_q): Worker thread function. - def catch_creates(scan_q): Watch the host node journal for creates. - def process_container(containe...
e342f6659a4ef1a188ff403e2fc6b06ac6d119c7
<|skeleton|> class PlegEventListener: """Class to receive and report scan results.""" def scan_worker(self, scan_q): """Worker thread function.""" <|body_0|> def catch_creates(scan_q): """Watch the host node journal for creates.""" <|body_1|> def process_container(cont...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PlegEventListener: """Class to receive and report scan results.""" def scan_worker(self, scan_q): """Worker thread function.""" while True: container = scan_q.get() self.process_container(container) scan_q.task_done() def catch_creates(scan_q): ...
the_stack_v2_python_sparse
docker/oso-image-inspector/src/scripts/orchestrator
openshift/openshift-tools
train
170
46b16821eb4a4cd1181339fdc65b71ee8877c021
[ "if not root:\n return []\nres, temp, queue, flag = ([], [], [root], 1)\nwhile queue:\n for i in range(len(queue)):\n node = queue.pop(0)\n temp.append(node.val)\n if node.left:\n queue.append(node.left)\n if node.right:\n queue.append(node.right)\n res.app...
<|body_start_0|> if not root: return [] res, temp, queue, flag = ([], [], [root], 1) while queue: for i in range(len(queue)): node = queue.pop(0) temp.append(node.val) if node.left: queue.append(node.left...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def zigzagLevelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def zigzagLevelOrder_v0(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not roo...
stack_v2_sparse_classes_75kplus_train_072185
2,554
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "zigzagLevelOrder", "signature": "def zigzagLevelOrder(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[List[int]]", "name": "zigzagLevelOrder_v0", "signature": "def zigzagLevelOrder_v0(self, root)" ...
2
stack_v2_sparse_classes_30k_train_024688
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def zigzagLevelOrder_v0(self, root): :type root: TreeNode :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def zigzagLevelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] - def zigzagLevelOrder_v0(self, root): :type root: TreeNode :rtype: List[List[int]] <|skeleton|> c...
b5e09f24e8e96454dc99e20281e853fb9fcc85ed
<|skeleton|> class Solution: def zigzagLevelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_0|> def zigzagLevelOrder_v0(self, root): """:type root: TreeNode :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def zigzagLevelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]]""" if not root: return [] res, temp, queue, flag = ([], [], [root], 1) while queue: for i in range(len(queue)): node = queue.pop(0) ...
the_stack_v2_python_sparse
python/103_Binary_Tree_Zigzag_Level_Order_Traversal.py
Moby5/myleetcode
train
2
e37c7a2b403a5ea08a4c4dca7671bbb891921288
[ "super(Encoder, self).__init__()\nself.attention = Attention(hidden_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio)\nself.latent = LatentModule(hidden_size, interm_size)\nself.output = Output(interm_size, hidden_size, hidden_dropout_ratio)", "attention_temp = self.attention(hidden_states...
<|body_start_0|> super(Encoder, self).__init__() self.attention = Attention(hidden_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio) self.latent = LatentModule(hidden_size, interm_size) self.output = Output(interm_size, hidden_size, hidden_dropout_ratio) <|end_bod...
Encoder
Encoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder""" def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): """Initialization""" <|body_0|> def forward(self, hidden_states, attention_mask): """Encoder block""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus_train_072186
12,741
permissive
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio)" }, { "docstring": "Encoder block", "name": "forward", "signature": "def forward(self, hidden_states, attent...
2
stack_v2_sparse_classes_30k_train_039163
Implement the Python class `Encoder` described below. Class description: Encoder Method signatures and docstrings: - def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): Initialization - def forward(self, hidden_states, attention_mask): Encoder block
Implement the Python class `Encoder` described below. Class description: Encoder Method signatures and docstrings: - def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): Initialization - def forward(self, hidden_states, attention_mask): Encoder block <|ske...
e6ab0261eb719c21806bbadfd94001ecfe27de45
<|skeleton|> class Encoder: """Encoder""" def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): """Initialization""" <|body_0|> def forward(self, hidden_states, attention_mask): """Encoder block""" <|body_1|> <|en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: """Encoder""" def __init__(self, hidden_size, interm_size, num_attention_heads, attention_dropout_ratio, hidden_dropout_ratio): """Initialization""" super(Encoder, self).__init__() self.attention = Attention(hidden_size, num_attention_heads, attention_dropout_ratio, hidde...
the_stack_v2_python_sparse
apps/drug_target_interaction/moltrans_dti/double_towers.py
PaddlePaddle/PaddleHelix
train
771
adfc2b2c4eedced3b71d686ecc83badd78e4116e
[ "super(Plotter1d, self).__init__(method, axes)\nself.method = method\nself.style = style\nself.lopts = dict(linewidth=2)\nself.lopts.update(lopts)", "super(Plotter1d, self).__call__(field)\ndims = [0] * 4\ndimnames = ('time', 'lev', 'lat', 'lon')\ndimname = self.axes[0] if self.axes[1] == 'data' else self.axes[1]...
<|body_start_0|> super(Plotter1d, self).__init__(method, axes) self.method = method self.style = style self.lopts = dict(linewidth=2) self.lopts.update(lopts) <|end_body_0|> <|body_start_1|> super(Plotter1d, self).__call__(field) dims = [0] * 4 dimnames =...
For 1-d plots
Plotter1d
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Plotter1d: """For 1-d plots""" def __init__(self, method=pl.plot, axes=None, style='-', lopts={}): """method - a plotting function axes - dimension environment, by default inferred from field shape style - line style lopts - keyword arguments for plotting function""" <|body_0...
stack_v2_sparse_classes_75kplus_train_072187
10,557
permissive
[ { "docstring": "method - a plotting function axes - dimension environment, by default inferred from field shape style - line style lopts - keyword arguments for plotting function", "name": "__init__", "signature": "def __init__(self, method=pl.plot, axes=None, style='-', lopts={})" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_034229
Implement the Python class `Plotter1d` described below. Class description: For 1-d plots Method signatures and docstrings: - def __init__(self, method=pl.plot, axes=None, style='-', lopts={}): method - a plotting function axes - dimension environment, by default inferred from field shape style - line style lopts - ke...
Implement the Python class `Plotter1d` described below. Class description: For 1-d plots Method signatures and docstrings: - def __init__(self, method=pl.plot, axes=None, style='-', lopts={}): method - a plotting function axes - dimension environment, by default inferred from field shape style - line style lopts - ke...
4ddb3ecd7dc52c1de8a09123e6cd43d62f896755
<|skeleton|> class Plotter1d: """For 1-d plots""" def __init__(self, method=pl.plot, axes=None, style='-', lopts={}): """method - a plotting function axes - dimension environment, by default inferred from field shape style - line style lopts - keyword arguments for plotting function""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Plotter1d: """For 1-d plots""" def __init__(self, method=pl.plot, axes=None, style='-', lopts={}): """method - a plotting function axes - dimension environment, by default inferred from field shape style - line style lopts - keyword arguments for plotting function""" super(Plotter1d, self...
the_stack_v2_python_sparse
GEOS_Util/coupled_diagnostics/g5lib/plotters.py
geoschem/GMAO_Shared
train
0
e54bb50c6c78967f3c42a85554dde95aa58826da
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
HTTPStorageServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listHTTPStorage(self, request, context): """Storage""" <|body_0|> def getHTTPStorage(self, request, context): """Missing associated documentation comment in .proto file...
stack_v2_sparse_classes_75kplus_train_072188
9,754
permissive
[ { "docstring": "Storage", "name": "listHTTPStorage", "signature": "def listHTTPStorage(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "getHTTPStorage", "signature": "def getHTTPStorage(self, request, context)" }, { "...
5
stack_v2_sparse_classes_30k_train_036291
Implement the Python class `HTTPStorageServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def listHTTPStorage(self, request, context): Storage - def getHTTPStorage(self, request, context): Missing associated documentation c...
Implement the Python class `HTTPStorageServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def listHTTPStorage(self, request, context): Storage - def getHTTPStorage(self, request, context): Missing associated documentation c...
c69e14b409add099d151434b9add711e41f41b20
<|skeleton|> class HTTPStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listHTTPStorage(self, request, context): """Storage""" <|body_0|> def getHTTPStorage(self, request, context): """Missing associated documentation comment in .proto file...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HTTPStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listHTTPStorage(self, request, context): """Storage""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('M...
the_stack_v2_python_sparse
python-sdk/src/airavata_mft_sdk/http/HTTPStorageService_pb2_grpc.py
apache/airavata-mft
train
23
133be947298895642de03f00daed94311d956a94
[ "if not self.processed:\n self.player.status = self.new_status\n self.processed = True\n self.player.save()\n print('{} processed from {} to {}.'.format(self.player, self.get_current_status_display(), self.get_new_status_display()))", "if self.processed:\n self.player.status = self.current_status\n...
<|body_start_0|> if not self.processed: self.player.status = self.new_status self.processed = True self.player.save() print('{} processed from {} to {}.'.format(self.player, self.get_current_status_display(), self.get_new_status_display())) <|end_body_0|> <|body_...
Model for registering a squad/line-up change.
SquadChange
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SquadChange: """Model for registering a squad/line-up change.""" def process(self): """Process the change. Only takes effect if the change has not been processed. Validation of the resulting line-up is the responsibility of the caller If validation fails `self.reverse()` should be us...
stack_v2_sparse_classes_75kplus_train_072189
25,065
no_license
[ { "docstring": "Process the change. Only takes effect if the change has not been processed. Validation of the resulting line-up is the responsibility of the caller If validation fails `self.reverse()` should be used to undo the change.", "name": "process", "signature": "def process(self)" }, { "...
2
stack_v2_sparse_classes_30k_train_042616
Implement the Python class `SquadChange` described below. Class description: Model for registering a squad/line-up change. Method signatures and docstrings: - def process(self): Process the change. Only takes effect if the change has not been processed. Validation of the resulting line-up is the responsibility of the...
Implement the Python class `SquadChange` described below. Class description: Model for registering a squad/line-up change. Method signatures and docstrings: - def process(self): Process the change. Only takes effect if the change has not been processed. Validation of the resulting line-up is the responsibility of the...
d6c53b4da98657eec275bb4d15e000c42e44d36c
<|skeleton|> class SquadChange: """Model for registering a squad/line-up change.""" def process(self): """Process the change. Only takes effect if the change has not been processed. Validation of the resulting line-up is the responsibility of the caller If validation fails `self.reverse()` should be us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SquadChange: """Model for registering a squad/line-up change.""" def process(self): """Process the change. Only takes effect if the change has not been processed. Validation of the resulting line-up is the responsibility of the caller If validation fails `self.reverse()` should be used to undo th...
the_stack_v2_python_sparse
ffooty/models.py
danj1974/ffooty
train
0
bb602474d0647a3a18c239c87672bfa308f4d1ac
[ "self.consumer_id = consumer_id\nself.consumer_ssn = consumer_ssn\nself.event_name = event_name\nself.id = id\nself.status = status\nself.mtype = mtype\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\nconsumer_id = dictionary.get('consumerId')\nconsumer_ssn = diction...
<|body_start_0|> self.consumer_id = consumer_id self.consumer_ssn = consumer_ssn self.event_name = event_name self.id = id self.status = status self.mtype = mtype self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictio...
Implementation of the 'ReportNotification' model. TODO: type model description here. Attributes: consumer_id (string): Finicity’s consumer ID. This field is optional and may not always return. consumer_ssn (string): The last four of the consumer’s social security number. This field is optional and may not always return...
ReportNotification
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportNotification: """Implementation of the 'ReportNotification' model. TODO: type model description here. Attributes: consumer_id (string): Finicity’s consumer ID. This field is optional and may not always return. consumer_ssn (string): The last four of the consumer’s social security number. Th...
stack_v2_sparse_classes_75kplus_train_072190
3,117
permissive
[ { "docstring": "Constructor for the ReportNotification class", "name": "__init__", "signature": "def __init__(self, consumer_id=None, consumer_ssn=None, event_name=None, id=None, status=None, mtype=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dicti...
2
stack_v2_sparse_classes_30k_train_036239
Implement the Python class `ReportNotification` described below. Class description: Implementation of the 'ReportNotification' model. TODO: type model description here. Attributes: consumer_id (string): Finicity’s consumer ID. This field is optional and may not always return. consumer_ssn (string): The last four of th...
Implement the Python class `ReportNotification` described below. Class description: Implementation of the 'ReportNotification' model. TODO: type model description here. Attributes: consumer_id (string): Finicity’s consumer ID. This field is optional and may not always return. consumer_ssn (string): The last four of th...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class ReportNotification: """Implementation of the 'ReportNotification' model. TODO: type model description here. Attributes: consumer_id (string): Finicity’s consumer ID. This field is optional and may not always return. consumer_ssn (string): The last four of the consumer’s social security number. Th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReportNotification: """Implementation of the 'ReportNotification' model. TODO: type model description here. Attributes: consumer_id (string): Finicity’s consumer ID. This field is optional and may not always return. consumer_ssn (string): The last four of the consumer’s social security number. This field is o...
the_stack_v2_python_sparse
finicityapi/models/report_notification.py
monarchmoney/finicity-python
train
0
28aa59c69a49f80feb0d7819bf8da704def57da3
[ "self.actions = actions\nself.player_id = player_id\nself.goal_states = goal_states", "play_cost = []\ndraft_cost = []\nplay_set = []\ndraft_set = []\ntry:\n for action in self.actions:\n if (action['play_card'], action['coords']) in play_set:\n continue\n play_set.append((action['play...
<|body_start_0|> self.actions = actions self.player_id = player_id self.goal_states = goal_states <|end_body_0|> <|body_start_1|> play_cost = [] draft_cost = [] play_set = [] draft_set = [] try: for action in self.actions: if (...
Class for local search algorithms
SearchProblem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchProblem: """Class for local search algorithms""" def __init__(self, player_id, goal_states, actions): """game_state: the current board in list of list format goal_state: Object BoardList""" <|body_0|> def GreedyAlgorithm(self, heuristic='simple'): """Greedy...
stack_v2_sparse_classes_75kplus_train_072191
1,748
no_license
[ { "docstring": "game_state: the current board in list of list format goal_state: Object BoardList", "name": "__init__", "signature": "def __init__(self, player_id, goal_states, actions)" }, { "docstring": "Greedy heuristic search (local constraint)", "name": "GreedyAlgorithm", "signature...
2
stack_v2_sparse_classes_30k_train_044077
Implement the Python class `SearchProblem` described below. Class description: Class for local search algorithms Method signatures and docstrings: - def __init__(self, player_id, goal_states, actions): game_state: the current board in list of list format goal_state: Object BoardList - def GreedyAlgorithm(self, heuris...
Implement the Python class `SearchProblem` described below. Class description: Class for local search algorithms Method signatures and docstrings: - def __init__(self, player_id, goal_states, actions): game_state: the current board in list of list format goal_state: Object BoardList - def GreedyAlgorithm(self, heuris...
1ac842505adcf5abf37ef0cd1bbd24b8ce87984f
<|skeleton|> class SearchProblem: """Class for local search algorithms""" def __init__(self, player_id, goal_states, actions): """game_state: the current board in list of list format goal_state: Object BoardList""" <|body_0|> def GreedyAlgorithm(self, heuristic='simple'): """Greedy...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SearchProblem: """Class for local search algorithms""" def __init__(self, player_id, goal_states, actions): """game_state: the current board in list of list format goal_state: Object BoardList""" self.actions = actions self.player_id = player_id self.goal_states = goal_sta...
the_stack_v2_python_sparse
agents/group13/hs_utils/search_problem.py
hmooy/Sequence-COMP90054
train
0
854f3461dc624b371440b85174499ddd4c4e9ef7
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(username=username, email=self.normalize_email(email), first_name=first_name, last_name=last_name, referral=referral)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(username=...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(username=username, email=self.normalize_email(email), first_name=first_name, last_name=last_name, referral=referral) user.set_password(password) user.save(using=self._db) ...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): """Creates and saves a User with the given email, first name, last name and password.""" <|body_0|> def create_superuser(self, username, email, pas...
stack_v2_sparse_classes_75kplus_train_072192
7,301
no_license
[ { "docstring": "Creates and saves a User with the given email, first name, last name and password.", "name": "create_user", "signature": "def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None)" }, { "docstring": "Creates and saves a superu...
2
stack_v2_sparse_classes_30k_train_008367
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): Creates and saves a User with the given email, first na...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): Creates and saves a User with the given email, first na...
726e99153ad36d0aa38141822285f79feb910c06
<|skeleton|> class MyUserManager: def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): """Creates and saves a User with the given email, first name, last name and password.""" <|body_0|> def create_superuser(self, username, email, pas...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyUserManager: def create_user(self, username=None, email=None, first_name=None, last_name=None, password=None, referral=None): """Creates and saves a User with the given email, first name, last name and password.""" if not email: raise ValueError('Users must have an email address'...
the_stack_v2_python_sparse
src/accounts/models.py
rcmiskin10/university-marketplace
train
0
db1928696a2ee619a07967c95d83dc7acdfe8756
[ "assert isinstance(limits['polygon'], Polygon)\nself.limits = limits['polygon']\nself.upper_depth = limits['upper_depth']\nself.lower_depth = limits['lower_depth']\nself.source_model = sources\nself.rates = 0.0\nself.area_discretisation = area_discretisation", "src_mesh = Mesh.from_points_list([source.location])\...
<|body_start_0|> assert isinstance(limits['polygon'], Polygon) self.limits = limits['polygon'] self.upper_depth = limits['upper_depth'] self.lower_depth = limits['lower_depth'] self.source_model = sources self.rates = 0.0 self.area_discretisation = area_discretisa...
Calculates the rate of events within a polygon :param limits: Polygon as instance of :class: openquake.hazardlib.geo.polygon.Polygon :param float upper_depth: Upper seismic depth of the polygon (km) :param float lower_depth: Lower seismic depth of the polygon (km) :param list source_model: List of seismic sources :para...
RatePolygon
[ "AGPL-3.0-only", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RatePolygon: """Calculates the rate of events within a polygon :param limits: Polygon as instance of :class: openquake.hazardlib.geo.polygon.Polygon :param float upper_depth: Upper seismic depth of the polygon (km) :param float lower_depth: Lower seismic depth of the polygon (km) :param list sour...
stack_v2_sparse_classes_75kplus_train_072193
13,994
permissive
[ { "docstring": "Instantiate class with grid configurations :param dict limits: Configuration as dictionary containing: * polygon - OpenQuake Polygon * uppper_depth - upper seismogenic depth (km) * lower_depth - lower seismogenic depth (km)", "name": "__init__", "signature": "def __init__(self, limits, s...
3
null
Implement the Python class `RatePolygon` described below. Class description: Calculates the rate of events within a polygon :param limits: Polygon as instance of :class: openquake.hazardlib.geo.polygon.Polygon :param float upper_depth: Upper seismic depth of the polygon (km) :param float lower_depth: Lower seismic dep...
Implement the Python class `RatePolygon` described below. Class description: Calculates the rate of events within a polygon :param limits: Polygon as instance of :class: openquake.hazardlib.geo.polygon.Polygon :param float upper_depth: Upper seismic depth of the polygon (km) :param float lower_depth: Lower seismic dep...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class RatePolygon: """Calculates the rate of events within a polygon :param limits: Polygon as instance of :class: openquake.hazardlib.geo.polygon.Polygon :param float upper_depth: Upper seismic depth of the polygon (km) :param float lower_depth: Lower seismic depth of the polygon (km) :param list sour...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RatePolygon: """Calculates the rate of events within a polygon :param limits: Polygon as instance of :class: openquake.hazardlib.geo.polygon.Polygon :param float upper_depth: Upper seismic depth of the polygon (km) :param float lower_depth: Lower seismic depth of the polygon (km) :param list source_model: Lis...
the_stack_v2_python_sparse
openquake/hmtk/comparison/rate_grids.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
6a5213458c196a2b2e09cf6b58f3d8ecd91d6c33
[ "self.degrees = degrees\nself.translate = translate\nself.scale = scale\nself.shear = shear\nself.fillcolor = fillcolor", "center = (image.shape[1] / 2, image.shape[0] / 2)\nangle = np.random.uniform(low=self.degrees[0], high=self.degrees[1])\nscale = np.random.uniform(low=self.scale[0], high=self.scale[1])\nR = ...
<|body_start_0|> self.degrees = degrees self.translate = translate self.scale = scale self.shear = shear self.fillcolor = fillcolor <|end_body_0|> <|body_start_1|> center = (image.shape[1] / 2, image.shape[0] / 2) angle = np.random.uniform(low=self.degrees[0], hi...
RandomAffine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomAffine: def __init__(self, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-2, 2), fillcolor=(127, 127, 127)): """随机的仿射变换. 参数 ---- degrees : 旋转角度采样范围. translate: 平移量采样范围. 该参数为图像宽度和高度的百分比. scale : 缩放系数采样范围. shear : 剪切量采样范围. fillcolor: 无定义区域填充色.""" <|body_0|...
stack_v2_sparse_classes_75kplus_train_072194
10,684
permissive
[ { "docstring": "随机的仿射变换. 参数 ---- degrees : 旋转角度采样范围. translate: 平移量采样范围. 该参数为图像宽度和高度的百分比. scale : 缩放系数采样范围. shear : 剪切量采样范围. fillcolor: 无定义区域填充色.", "name": "__init__", "signature": "def __init__(self, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-2, 2), fillcolor=(127, 127, 127))" ...
2
stack_v2_sparse_classes_30k_train_014169
Implement the Python class `RandomAffine` described below. Class description: Implement the RandomAffine class. Method signatures and docstrings: - def __init__(self, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-2, 2), fillcolor=(127, 127, 127)): 随机的仿射变换. 参数 ---- degrees : 旋转角度采样范围. translate: 平...
Implement the Python class `RandomAffine` described below. Class description: Implement the RandomAffine class. Method signatures and docstrings: - def __init__(self, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-2, 2), fillcolor=(127, 127, 127)): 随机的仿射变换. 参数 ---- degrees : 旋转角度采样范围. translate: 平...
599bd6de74fc3794694bf1e3baca741d2b517e0e
<|skeleton|> class RandomAffine: def __init__(self, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-2, 2), fillcolor=(127, 127, 127)): """随机的仿射变换. 参数 ---- degrees : 旋转角度采样范围. translate: 平移量采样范围. 该参数为图像宽度和高度的百分比. scale : 缩放系数采样范围. shear : 剪切量采样范围. fillcolor: 无定义区域填充色.""" <|body_0|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomAffine: def __init__(self, degrees=(-10, 10), translate=(0.1, 0.1), scale=(0.9, 1.1), shear=(-2, 2), fillcolor=(127, 127, 127)): """随机的仿射变换. 参数 ---- degrees : 旋转角度采样范围. translate: 平移量采样范围. 该参数为图像宽度和高度的百分比. scale : 缩放系数采样范围. shear : 剪切量采样范围. fillcolor: 无定义区域填充色.""" self.degrees = degrees ...
the_stack_v2_python_sparse
transforms.py
CnybTseng/JDE
train
29
a75efe7a24a32985f3352c4f13126d07660fea28
[ "start = 0\nstop = 0\nlength = len(nums)\nif length == 1:\n return sum(nums)\nlargest_sum = nums[0]\nfor i in range(0, length):\n max_sum = nums[0]\n for j in range(i, length):\n ij_sum = sum(nums[i:j + 1])\n if ij_sum > max_sum:\n stop = j\n max_sum = ij_sum\n if max...
<|body_start_0|> start = 0 stop = 0 length = len(nums) if length == 1: return sum(nums) largest_sum = nums[0] for i in range(0, length): max_sum = nums[0] for j in range(i, length): ij_sum = sum(nums[i:j + 1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray2(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_0|> def maxSubArray(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> start = 0 ...
stack_v2_sparse_classes_75kplus_train_072195
1,598
no_license
[ { "docstring": "计算列表中连续子数组的最大和 :param nums: list[int] :return: int", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums)" }, { "docstring": "计算列表中连续子数组的最大和 :param nums: list[int] :return: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_039121
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray2(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int - def maxSubArray(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray2(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int - def maxSubArray(self, nums): 计算列表中连续子数组的最大和 :param nums: list[int] :return: int <|skeleton|> c...
c756fe54e8e17e9ba0bfdab5fccc24ac89263d90
<|skeleton|> class Solution: def maxSubArray2(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_0|> def maxSubArray(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubArray2(self, nums): """计算列表中连续子数组的最大和 :param nums: list[int] :return: int""" start = 0 stop = 0 length = len(nums) if length == 1: return sum(nums) largest_sum = nums[0] for i in range(0, length): max_sum = num...
the_stack_v2_python_sparse
easy/maximum_subarray.py
EarthChen/LeetCode_Record
train
0
67b7e27747d56a06758c079e8c42866fc1f3abf3
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
LocalStorageServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listLocalStorage(self, request, context): """Storage""" <|body_0|> def getLocalStorage(self, request, context): """Missing associated documentation comment in .proto f...
stack_v2_sparse_classes_75kplus_train_072196
9,909
permissive
[ { "docstring": "Storage", "name": "listLocalStorage", "signature": "def listLocalStorage(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "getLocalStorage", "signature": "def getLocalStorage(self, request, context)" }, { ...
5
stack_v2_sparse_classes_30k_train_037051
Implement the Python class `LocalStorageServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def listLocalStorage(self, request, context): Storage - def getLocalStorage(self, request, context): Missing associated documentatio...
Implement the Python class `LocalStorageServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def listLocalStorage(self, request, context): Storage - def getLocalStorage(self, request, context): Missing associated documentatio...
c69e14b409add099d151434b9add711e41f41b20
<|skeleton|> class LocalStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listLocalStorage(self, request, context): """Storage""" <|body_0|> def getLocalStorage(self, request, context): """Missing associated documentation comment in .proto f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocalStorageServiceServicer: """Missing associated documentation comment in .proto file.""" def listLocalStorage(self, request, context): """Storage""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError(...
the_stack_v2_python_sparse
python-sdk/src/airavata_mft_sdk/local/LocalStorageService_pb2_grpc.py
apache/airavata-mft
train
23
ee784c97399fc869d0612e28b1a3982bc5bda07f
[ "self._use_percent = use_percent\nself._classifier_name = classifier_name\nself._matrix, self._labels, correct_rate = self._getConfusionMatrix(assigned_array, truth_array)\nself._correct_rate_string = str(int(10000.0 * correct_rate) / 10000.0)", "np.set_printoptions(suppress=True)\nheader = self._classifier_name ...
<|body_start_0|> self._use_percent = use_percent self._classifier_name = classifier_name self._matrix, self._labels, correct_rate = self._getConfusionMatrix(assigned_array, truth_array) self._correct_rate_string = str(int(10000.0 * correct_rate) / 10000.0) <|end_body_0|> <|body_start_1|...
Analyzes labels assigned to feature vectors by a classifier, relative to true class labels, in order to generate a matrix helpful for identifying the underlying reasons behind classification results.
ConfusionMatrix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfusionMatrix: """Analyzes labels assigned to feature vectors by a classifier, relative to true class labels, in order to generate a matrix helpful for identifying the underlying reasons behind classification results.""" def __init__(self, assigned_array: np.ndarray, truth_array: np.ndarra...
stack_v2_sparse_classes_75kplus_train_072197
3,903
permissive
[ { "docstring": ":param assigned_array: Array of class labels assigned by a classifier. :param truth_array: Array of true class labels, against which ``assigned_labels`` will be evaluated. :param use_percent: If True, then the confusion matrix will be presented in terms of percentages, rather than raw occurrence...
4
stack_v2_sparse_classes_30k_train_049051
Implement the Python class `ConfusionMatrix` described below. Class description: Analyzes labels assigned to feature vectors by a classifier, relative to true class labels, in order to generate a matrix helpful for identifying the underlying reasons behind classification results. Method signatures and docstrings: - d...
Implement the Python class `ConfusionMatrix` described below. Class description: Analyzes labels assigned to feature vectors by a classifier, relative to true class labels, in order to generate a matrix helpful for identifying the underlying reasons behind classification results. Method signatures and docstrings: - d...
e1fcad12b5cac2136785c2e5725f9ea1292e8560
<|skeleton|> class ConfusionMatrix: """Analyzes labels assigned to feature vectors by a classifier, relative to true class labels, in order to generate a matrix helpful for identifying the underlying reasons behind classification results.""" def __init__(self, assigned_array: np.ndarray, truth_array: np.ndarra...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfusionMatrix: """Analyzes labels assigned to feature vectors by a classifier, relative to true class labels, in order to generate a matrix helpful for identifying the underlying reasons behind classification results.""" def __init__(self, assigned_array: np.ndarray, truth_array: np.ndarray, use_percen...
the_stack_v2_python_sparse
confusion_matrix.py
nswachow/SCST_Python
train
1
2215e290fc9bdbf13a8e9a0264c7438048d75eb8
[ "serializer = self.change_password_serializer(data=request.data)\nif not serializer.is_valid():\n return self.json_failed_response(errors=serializer.errors)\ndata_from_request = serializer.data\nif not self.__is_user_password_change_allowed(request, **kwargs):\n return self.json_forbidden_response(errors={SIG...
<|body_start_0|> serializer = self.change_password_serializer(data=request.data) if not serializer.is_valid(): return self.json_failed_response(errors=serializer.errors) data_from_request = serializer.data if not self.__is_user_password_change_allowed(request, **kwargs): ...
View for user password change
ChangePasswordView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangePasswordView: """View for user password change""" def post(self, request: Request, *args, **kwargs) -> Response: """in kwargs must by signed dict with user id this id must be the same as user id in request request params: - password :return: json response http response codes: 2...
stack_v2_sparse_classes_75kplus_train_072198
2,556
no_license
[ { "docstring": "in kwargs must by signed dict with user id this id must be the same as user id in request request params: - password :return: json response http response codes: 200 - ok, password changed 400 - password validation error, view errors key for details 403 - signature failed or invalid user id keys:...
3
null
Implement the Python class `ChangePasswordView` described below. Class description: View for user password change Method signatures and docstrings: - def post(self, request: Request, *args, **kwargs) -> Response: in kwargs must by signed dict with user id this id must be the same as user id in request request params:...
Implement the Python class `ChangePasswordView` described below. Class description: View for user password change Method signatures and docstrings: - def post(self, request: Request, *args, **kwargs) -> Response: in kwargs must by signed dict with user id this id must be the same as user id in request request params:...
bab909324aa2e4c1c8fff72093d3fcf44aaf4963
<|skeleton|> class ChangePasswordView: """View for user password change""" def post(self, request: Request, *args, **kwargs) -> Response: """in kwargs must by signed dict with user id this id must be the same as user id in request request params: - password :return: json response http response codes: 2...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChangePasswordView: """View for user password change""" def post(self, request: Request, *args, **kwargs) -> Response: """in kwargs must by signed dict with user id this id must be the same as user id in request request params: - password :return: json response http response codes: 200 - ok, pass...
the_stack_v2_python_sparse
crm/views/change_password/change_password_view.py
vovapasko/crm
train
0
881b990daf1d7e913a1d67e1001b3b861dfa706e
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_direction = choice([1, -1]) x_distance = choice([0, 1, 2, 3, 4]) x_step = x_direction *...
a class which generate random walking data
RandomWalk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """a class which generate random walking data""" def __init__(self, num_points=20): """initial the attribute of random walking""" <|body_0|> def fill_walk(self): """calculate all points belong to random walking""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_072199
1,083
no_license
[ { "docstring": "initial the attribute of random walking", "name": "__init__", "signature": "def __init__(self, num_points=20)" }, { "docstring": "calculate all points belong to random walking", "name": "fill_walk", "signature": "def fill_walk(self)" } ]
2
stack_v2_sparse_classes_30k_train_000963
Implement the Python class `RandomWalk` described below. Class description: a class which generate random walking data Method signatures and docstrings: - def __init__(self, num_points=20): initial the attribute of random walking - def fill_walk(self): calculate all points belong to random walking
Implement the Python class `RandomWalk` described below. Class description: a class which generate random walking data Method signatures and docstrings: - def __init__(self, num_points=20): initial the attribute of random walking - def fill_walk(self): calculate all points belong to random walking <|skeleton|> class...
9134f5d3525a48811893790303b1b5eabc29fd50
<|skeleton|> class RandomWalk: """a class which generate random walking data""" def __init__(self, num_points=20): """initial the attribute of random walking""" <|body_0|> def fill_walk(self): """calculate all points belong to random walking""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomWalk: """a class which generate random walking data""" def __init__(self, num_points=20): """initial the attribute of random walking""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """calculate all points belo...
the_stack_v2_python_sparse
random_walk.py
douzhenjun/python_work
train
1