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
9ecd0f30fa882e48d8ccf2fa684ec5047c70c450
[ "super(GilbertElliott, self).__init__(PacketLoss.__name__)\nif prhk is None:\n p = float(GilbertElliott.__DEFAULT_P)\n r = float(GilbertElliott.__DEFAULT_R)\n b = float(1.0 - GilbertElliott.__DEFAULT_H)\n g = float(1.0 - GilbertElliott.__DEFAULT_K)\nelse:\n for param in range(4):\n check_argum...
<|body_start_0|> super(GilbertElliott, self).__init__(PacketLoss.__name__) if prhk is None: p = float(GilbertElliott.__DEFAULT_P) r = float(GilbertElliott.__DEFAULT_R) b = float(1.0 - GilbertElliott.__DEFAULT_H) g = float(1.0 - GilbertElliott.__DEFAULT_K) ...
This class implements the Gilbert-Elliott packet loss model.
GilbertElliott
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GilbertElliott: """This class implements the Gilbert-Elliott packet loss model.""" def __init__(self, prhk=None): """*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\\leqslant 1`, respectively (each of type `float`). The pa...
stack_v2_sparse_classes_75kplus_train_069800
6,499
permissive
[ { "docstring": "*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\\\leqslant p,r,h,k\\\\leqslant 1`, respectively (each of type `float`). The parameters default to the following values: * :math:`p=0.00001333`, * :math:`r=0.00601795`, * :math:`h=0.55494900`, * :math:`k=...
2
stack_v2_sparse_classes_30k_train_014212
Implement the Python class `GilbertElliott` described below. Class description: This class implements the Gilbert-Elliott packet loss model. Method signatures and docstrings: - def __init__(self, prhk=None): *Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\...
Implement the Python class `GilbertElliott` described below. Class description: This class implements the Gilbert-Elliott packet loss model. Method signatures and docstrings: - def __init__(self, prhk=None): *Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\...
ed93d1e3067c569dd4194658b0d02da6b0ab4bed
<|skeleton|> class GilbertElliott: """This class implements the Gilbert-Elliott packet loss model.""" def __init__(self, prhk=None): """*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\\leqslant 1`, respectively (each of type `float`). The pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GilbertElliott: """This class implements the Gilbert-Elliott packet loss model.""" def __init__(self, prhk=None): """*Parameters*: - **prhk** (`tuple`): a `tuple` that contains four model parameters: :math:`0\\leqslant p,r,h,k\\leqslant 1`, respectively (each of type `float`). The parameters defa...
the_stack_v2_python_sparse
sim2net/packet_loss/gilbert_elliott.py
mkalewski/sim2net
train
14
21c7e669f0e518f3a8ed6f3c6b34e36540504332
[ "with np.errstate(divide='ignore', invalid='ignore'):\n powterm = 1 - gamma\n term = (1 + rad ** 2 / (2 * gamma * sigma ** 2)) ** powterm\n containment = 1 - term\nreturn containment", "with np.errstate(divide='ignore'):\n term1 = 1 / (2 * np.pi * sigma ** 2)\n term2 = 1 - 1 / gamma\n term3 = (1...
<|body_start_0|> with np.errstate(divide='ignore', invalid='ignore'): powterm = 1 - gamma term = (1 + rad ** 2 / (2 * gamma * sigma ** 2)) ** powterm containment = 1 - term return containment <|end_body_0|> <|body_start_1|> with np.errstate(divide='ignore'): ...
King profile analytical PSF depending on energy and offset. This PSF parametrisation and FITS data format is described here: :ref:`gadf:psf_king`. Parameters ---------- axes : list of `MapAxis` or `MapAxes` Data axes, required are ["energy_true", "offset"] meta : dict Meta data
PSFKing
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSFKing: """King profile analytical PSF depending on energy and offset. This PSF parametrisation and FITS data format is described here: :ref:`gadf:psf_king`. Parameters ---------- axes : list of `MapAxis` or `MapAxes` Data axes, required are ["energy_true", "offset"] meta : dict Meta data""" ...
stack_v2_sparse_classes_75kplus_train_069801
12,422
permissive
[ { "docstring": "Containment of the PSF at given axes coordinates Parameters ---------- rad : `~astropy.units.Quantity` Rad value gamma : `~astropy.units.Quantity` Gamma parameter sigma : `~astropy.units.Quantity` Sigma parameter Returns ------- containment : `~numpy.ndarray` Containment", "name": "evaluate_...
2
null
Implement the Python class `PSFKing` described below. Class description: King profile analytical PSF depending on energy and offset. This PSF parametrisation and FITS data format is described here: :ref:`gadf:psf_king`. Parameters ---------- axes : list of `MapAxis` or `MapAxes` Data axes, required are ["energy_true",...
Implement the Python class `PSFKing` described below. Class description: King profile analytical PSF depending on energy and offset. This PSF parametrisation and FITS data format is described here: :ref:`gadf:psf_king`. Parameters ---------- axes : list of `MapAxis` or `MapAxes` Data axes, required are ["energy_true",...
60f03adb8fc7851b9f3ca039512c03a669e3fe10
<|skeleton|> class PSFKing: """King profile analytical PSF depending on energy and offset. This PSF parametrisation and FITS data format is described here: :ref:`gadf:psf_king`. Parameters ---------- axes : list of `MapAxis` or `MapAxes` Data axes, required are ["energy_true", "offset"] meta : dict Meta data""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PSFKing: """King profile analytical PSF depending on energy and offset. This PSF parametrisation and FITS data format is described here: :ref:`gadf:psf_king`. Parameters ---------- axes : list of `MapAxis` or `MapAxes` Data axes, required are ["energy_true", "offset"] meta : dict Meta data""" def evaluat...
the_stack_v2_python_sparse
gammapy/irf/psf/parametric.py
gammapy/gammapy
train
204
75589832e7cd1bd996817b8b95afeaf37b5cf409
[ "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...
Status: experimental interface, will change before it is deemed production ready Query the Daml-LF packages supported by the ledger participant and upload DAR files. We use 'backing participant' to refer to this specific participant in the methods of this API.
PackageManagementServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageManagementServiceServicer: """Status: experimental interface, will change before it is deemed production ready Query the Daml-LF packages supported by the ledger participant and upload DAR files. We use 'backing participant' to refer to this specific participant in the methods of this API....
stack_v2_sparse_classes_75kplus_train_069802
6,681
permissive
[ { "docstring": "Returns the details of all Daml-LF packages known to the backing participant.", "name": "ListKnownPackages", "signature": "def ListKnownPackages(self, request, context)" }, { "docstring": "Upload a DAR file to the backing participant. Depending on the ledger implementation this m...
2
stack_v2_sparse_classes_30k_train_023388
Implement the Python class `PackageManagementServiceServicer` described below. Class description: Status: experimental interface, will change before it is deemed production ready Query the Daml-LF packages supported by the ledger participant and upload DAR files. We use 'backing participant' to refer to this specific ...
Implement the Python class `PackageManagementServiceServicer` described below. Class description: Status: experimental interface, will change before it is deemed production ready Query the Daml-LF packages supported by the ledger participant and upload DAR files. We use 'backing participant' to refer to this specific ...
efdbb00e54614c0af650d7440faaffbde92ad1f4
<|skeleton|> class PackageManagementServiceServicer: """Status: experimental interface, will change before it is deemed production ready Query the Daml-LF packages supported by the ledger participant and upload DAR files. We use 'backing participant' to refer to this specific participant in the methods of this API....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PackageManagementServiceServicer: """Status: experimental interface, will change before it is deemed production ready Query the Daml-LF packages supported by the ledger participant and upload DAR files. We use 'backing participant' to refer to this specific participant in the methods of this API.""" def ...
the_stack_v2_python_sparse
python/dazl/_gen/com/daml/ledger/api/v1/admin/package_management_service_pb2_grpc.py
digital-asset/dazl-client
train
12
fffed213ed11b43a5328b06caca1320208cf87be
[ "self.allowed_items = {}\nself.matches = {}\nself.allowed_items['Category'] = PartCategory.objects.all()\nself.matches['Category'] = ['name__contains']\nself.allowed_items['default_location'] = StockLocation.objects.all()\nself.matches['default_location'] = ['name__contains']\nself.allowed_items['default_supplier']...
<|body_start_0|> self.allowed_items = {} self.matches = {} self.allowed_items['Category'] = PartCategory.objects.all() self.matches['Category'] = ['name__contains'] self.allowed_items['default_location'] = StockLocation.objects.all() self.matches['default_location'] = ['n...
Part: Upload file, match to fields and import parts(using multi-Step form)
PartImport
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartImport: """Part: Upload file, match to fields and import parts(using multi-Step form)""" def get_field_selection(self): """Fill the form fields for step 3.""" <|body_0|> def done(self, form_list, **kwargs): """Create items.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_069803
28,283
permissive
[ { "docstring": "Fill the form fields for step 3.", "name": "get_field_selection", "signature": "def get_field_selection(self)" }, { "docstring": "Create items.", "name": "done", "signature": "def done(self, form_list, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_051463
Implement the Python class `PartImport` described below. Class description: Part: Upload file, match to fields and import parts(using multi-Step form) Method signatures and docstrings: - def get_field_selection(self): Fill the form fields for step 3. - def done(self, form_list, **kwargs): Create items.
Implement the Python class `PartImport` described below. Class description: Part: Upload file, match to fields and import parts(using multi-Step form) Method signatures and docstrings: - def get_field_selection(self): Fill the form fields for step 3. - def done(self, form_list, **kwargs): Create items. <|skeleton|> ...
5a08ef908dd5344b4433436a4679d122f7f99e41
<|skeleton|> class PartImport: """Part: Upload file, match to fields and import parts(using multi-Step form)""" def get_field_selection(self): """Fill the form fields for step 3.""" <|body_0|> def done(self, form_list, **kwargs): """Create items.""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PartImport: """Part: Upload file, match to fields and import parts(using multi-Step form)""" def get_field_selection(self): """Fill the form fields for step 3.""" self.allowed_items = {} self.matches = {} self.allowed_items['Category'] = PartCategory.objects.all() ...
the_stack_v2_python_sparse
InvenTree/part/views.py
onurtatli/InvenTree
train
0
b45fd94991794f96e03a16064c40a57b9f934757
[ "Container.__init__(self, child)\nself.link_target = link_target\nt = type(level)\nif isinstance(level, int) is False:\n raise TypeError(f'Expected level to be int, got {t}.')\nt = type(numbered)\nif isinstance(numbered, bool) is False:\n raise TypeError(f'Expected numbered to be bool, got {t}.')\nself.level ...
<|body_start_0|> Container.__init__(self, child) self.link_target = link_target t = type(level) if isinstance(level, int) is False: raise TypeError(f'Expected level to be int, got {t}.') t = type(numbered) if isinstance(numbered, bool) is False: ra...
This class represents a latex Section. Currently only section and subsection are implemented. Section(s) can be hyperlinked back to: Table of Contents: pass 'toc' to Section.link_target List of Figures: pass 'lof' to Section.link_target List of Tables: pass 'lot' to Section.link_target See init for more details.
Section
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Section: """This class represents a latex Section. Currently only section and subsection are implemented. Section(s) can be hyperlinked back to: Table of Contents: pass 'toc' to Section.link_target List of Figures: pass 'lof' to Section.link_target List of Tables: pass 'lot' to Section.link_targe...
stack_v2_sparse_classes_75kplus_train_069804
2,545
no_license
[ { "docstring": "Args ---- child: LatexPart A latexPart to be contained within the section. link_target: str A string signifying a cross-reference label to link the section to. Default labels include: toc (table of contents) lof (list of figures) lot (list of tables)", "name": "__init__", "signature": "d...
3
null
Implement the Python class `Section` described below. Class description: This class represents a latex Section. Currently only section and subsection are implemented. Section(s) can be hyperlinked back to: Table of Contents: pass 'toc' to Section.link_target List of Figures: pass 'lof' to Section.link_target List of T...
Implement the Python class `Section` described below. Class description: This class represents a latex Section. Currently only section and subsection are implemented. Section(s) can be hyperlinked back to: Table of Contents: pass 'toc' to Section.link_target List of Figures: pass 'lof' to Section.link_target List of T...
515ce39b6ce8fefde098cce16495e60fcef1c4d4
<|skeleton|> class Section: """This class represents a latex Section. Currently only section and subsection are implemented. Section(s) can be hyperlinked back to: Table of Contents: pass 'toc' to Section.link_target List of Figures: pass 'lof' to Section.link_target List of Tables: pass 'lot' to Section.link_targe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Section: """This class represents a latex Section. Currently only section and subsection are implemented. Section(s) can be hyperlinked back to: Table of Contents: pass 'toc' to Section.link_target List of Figures: pass 'lof' to Section.link_target List of Tables: pass 'lot' to Section.link_target See init fo...
the_stack_v2_python_sparse
easytex/classes/Section.py
JyuNyar/easytex
train
0
87a368408756c0dfec2f5f4fd0813045dbd19d0b
[ "self.num_units = num_units\nself.layer_norm = layer_norm\nself.recurrent_dropout = recurrent_dropout\nself.leak_factor = leak_factor", "with tf.variable_scope(scope or type(self).__name__):\n lstm_cell = rnn_cell.LayerNormBasicLeakLSTMCell(num_units=self.num_units, leak_factor=self.leak_factor, layer_norm=sel...
<|body_start_0|> self.num_units = num_units self.layer_norm = layer_norm self.recurrent_dropout = recurrent_dropout self.leak_factor = leak_factor <|end_body_0|> <|body_start_1|> with tf.variable_scope(scope or type(self).__name__): lstm_cell = rnn_cell.LayerNormBasi...
a leaky LSTM layer
LeakyLSTMLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeakyLSTMLayer: """a leaky LSTM layer""" def __init__(self, num_units, layer_norm=False, recurrent_dropout=1.0, leak_factor=1.0): """LeakyLSTMLayer constructor Args: num_units: The number of units in the one directon layer_norm: whether layer normalization should be applied recurrent...
stack_v2_sparse_classes_75kplus_train_069805
49,091
permissive
[ { "docstring": "LeakyLSTMLayer constructor Args: num_units: The number of units in the one directon layer_norm: whether layer normalization should be applied recurrent_dropout: the recurrent dropout keep probability leak_factor: the leak factor (if 1, there is no leakage)", "name": "__init__", "signatur...
2
null
Implement the Python class `LeakyLSTMLayer` described below. Class description: a leaky LSTM layer Method signatures and docstrings: - def __init__(self, num_units, layer_norm=False, recurrent_dropout=1.0, leak_factor=1.0): LeakyLSTMLayer constructor Args: num_units: The number of units in the one directon layer_norm...
Implement the Python class `LeakyLSTMLayer` described below. Class description: a leaky LSTM layer Method signatures and docstrings: - def __init__(self, num_units, layer_norm=False, recurrent_dropout=1.0, leak_factor=1.0): LeakyLSTMLayer constructor Args: num_units: The number of units in the one directon layer_norm...
5e862cbf846d45b8a317f87588533f3fde9f0726
<|skeleton|> class LeakyLSTMLayer: """a leaky LSTM layer""" def __init__(self, num_units, layer_norm=False, recurrent_dropout=1.0, leak_factor=1.0): """LeakyLSTMLayer constructor Args: num_units: The number of units in the one directon layer_norm: whether layer normalization should be applied recurrent...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LeakyLSTMLayer: """a leaky LSTM layer""" def __init__(self, num_units, layer_norm=False, recurrent_dropout=1.0, leak_factor=1.0): """LeakyLSTMLayer constructor Args: num_units: The number of units in the one directon layer_norm: whether layer normalization should be applied recurrent_dropout: the...
the_stack_v2_python_sparse
nabu/neuralnetworks/components/layer.py
JeroenZegers/Nabu-MSSS
train
19
1c6315bf1ee497701ab03a0319aa9cf1024b13f0
[ "url = '/booking/abort/'\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_code, 302)", "url = '/booking/abort/'\nself.client.login(username=self.adminUN, password='pass')\nresponse = self.client.get(url, HTTP_HOST='website.domain')\nself.assertEqual(response.status_co...
<|body_start_0|> url = '/booking/abort/' response = self.client.get(url, HTTP_HOST='website.domain') self.assertEqual(response.status_code, 302) <|end_body_0|> <|body_start_1|> url = '/booking/abort/' self.client.login(username=self.adminUN, password='pass') response = s...
This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ============================== 29/10/2018 SE.
BookingAbortTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookingAbortTestCase: """This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ===========...
stack_v2_sparse_classes_75kplus_train_069806
26,818
permissive
[ { "docstring": "Test that the booking abort view will display an error whilst not logged in and no booking.", "name": "test_not_logged_in_no_booking", "signature": "def test_not_logged_in_no_booking(self)" }, { "docstring": "Test that the booking abort view will display an error whilst logged in...
3
stack_v2_sparse_classes_30k_train_009096
Implement the Python class `BookingAbortTestCase` described below. Class description: This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the cu...
Implement the Python class `BookingAbortTestCase` described below. Class description: This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the cu...
37d2942efcbdaad072f7a06ac876a40e0f69f702
<|skeleton|> class BookingAbortTestCase: """This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ===========...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BookingAbortTestCase: """This does not seem to be working currently. The "Cancel in progress booking" button takes user to an unrelated (broken) URL. The user then has to manually 'back' to get to the moorings website, and refresh in order to see that the current booking is cancelled. ========================...
the_stack_v2_python_sparse
mooring/test_views.py
dbca-wa/moorings
train
0
493e6b898de91dbdeae4fe31d523d2de41e2ba2d
[ "day_of_year = [1, 10, 100, 365]\nexpected_result = [-23.1223537018, -22.1987731152, 7.20726681123, -23.2078460336]\nfor i, dayval in enumerate(day_of_year):\n result = calc_solar_declination(dayval)\n self.assertIsInstance(result, float)\n self.assertAlmostEqual(result, expected_result[i])", "day_of_yea...
<|body_start_0|> day_of_year = [1, 10, 100, 365] expected_result = [-23.1223537018, -22.1987731152, 7.20726681123, -23.2078460336] for i, dayval in enumerate(day_of_year): result = calc_solar_declination(dayval) self.assertIsInstance(result, float) self.assert...
Test Solar declination.
Test_calc_solar_declination
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_calc_solar_declination: """Test Solar declination.""" def test_basic_solar_declination(self): """Test the calc of declination for different days of the year""" <|body_0|> def test_solar_dec_raises_exception(self): """Test an exception is raised if day of yea...
stack_v2_sparse_classes_75kplus_train_069807
16,648
permissive
[ { "docstring": "Test the calc of declination for different days of the year", "name": "test_basic_solar_declination", "signature": "def test_basic_solar_declination(self)" }, { "docstring": "Test an exception is raised if day of year out of range", "name": "test_solar_dec_raises_exception", ...
2
stack_v2_sparse_classes_30k_val_002983
Implement the Python class `Test_calc_solar_declination` described below. Class description: Test Solar declination. Method signatures and docstrings: - def test_basic_solar_declination(self): Test the calc of declination for different days of the year - def test_solar_dec_raises_exception(self): Test an exception is...
Implement the Python class `Test_calc_solar_declination` described below. Class description: Test Solar declination. Method signatures and docstrings: - def test_basic_solar_declination(self): Test the calc of declination for different days of the year - def test_solar_dec_raises_exception(self): Test an exception is...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_calc_solar_declination: """Test Solar declination.""" def test_basic_solar_declination(self): """Test the calc of declination for different days of the year""" <|body_0|> def test_solar_dec_raises_exception(self): """Test an exception is raised if day of yea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_calc_solar_declination: """Test Solar declination.""" def test_basic_solar_declination(self): """Test the calc of declination for different days of the year""" day_of_year = [1, 10, 100, 365] expected_result = [-23.1223537018, -22.1987731152, 7.20726681123, -23.2078460336] ...
the_stack_v2_python_sparse
improver_tests/utilities/solar/test_solar.py
metoppv/improver
train
101
9ba47c987701be3cad3e1e5f6f7e8fc67312b596
[ "email = self.cleaned_data.get('email')\nuser = User.objects.filter(email=email)\nif user.exists():\n raise forms.ValidationError('Email is taken.Please enter some other value')\nreturn email", "cleaned_data = super().clean()\npassword1 = cleaned_data.get('password1')\npassword2 = cleaned_data.get('passwrod2')...
<|body_start_0|> email = self.cleaned_data.get('email') user = User.objects.filter(email=email) if user.exists(): raise forms.ValidationError('Email is taken.Please enter some other value') return email <|end_body_0|> <|body_start_1|> cleaned_data = super().clean() ...
The default
Registration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Registration: """The default""" def clean_email(self): """To varify email""" <|body_0|> def clean(self): """Verify both passwords match.""" <|body_1|> <|end_skeleton|> <|body_start_0|> email = self.cleaned_data.get('email') user = User.o...
stack_v2_sparse_classes_75kplus_train_069808
3,026
no_license
[ { "docstring": "To varify email", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Verify both passwords match.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_023321
Implement the Python class `Registration` described below. Class description: The default Method signatures and docstrings: - def clean_email(self): To varify email - def clean(self): Verify both passwords match.
Implement the Python class `Registration` described below. Class description: The default Method signatures and docstrings: - def clean_email(self): To varify email - def clean(self): Verify both passwords match. <|skeleton|> class Registration: """The default""" def clean_email(self): """To varify ...
2550cc03fff09a35d24d8b712040a445bbd198e8
<|skeleton|> class Registration: """The default""" def clean_email(self): """To varify email""" <|body_0|> def clean(self): """Verify both passwords match.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Registration: """The default""" def clean_email(self): """To varify email""" email = self.cleaned_data.get('email') user = User.objects.filter(email=email) if user.exists(): raise forms.ValidationError('Email is taken.Please enter some other value') ret...
the_stack_v2_python_sparse
LogInOut/user/forms.py
Kaushalkhokhar/django-modules
train
0
297ff7620da54b1c9ebd752947018bf34dec1ab7
[ "self.__k = k\nself.__min_heap = []\nfor n in nums:\n self.add(n)", "heapq.heappush(self.__min_heap, val)\nif len(self.__min_heap) > self.__k:\n heapq.heappop(self.__min_heap)\nreturn self.__min_heap[0]" ]
<|body_start_0|> self.__k = k self.__min_heap = [] for n in nums: self.add(n) <|end_body_0|> <|body_start_1|> heapq.heappush(self.__min_heap, val) if len(self.__min_heap) > self.__k: heapq.heappop(self.__min_heap) return self.__min_heap[0] <|end_b...
KthLargest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.__k = k self.__min_heap = [] for n in...
stack_v2_sparse_classes_75kplus_train_069809
550
permissive
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_034690
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
4dc4e6642dc92f1983c13564cc0fd99917cab358
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.__k = k self.__min_heap = [] for n in nums: self.add(n) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.__min_heap, val) if l...
the_stack_v2_python_sparse
Python/kth-largest-element-in-a-stream.py
kamyu104/LeetCode-Solutions
train
4,549
09b2b0a17afad38f545925f4d0406d5c7e87502e
[ "errorString = ''\nif id == -1:\n errorString += 'Invalid ID, must be an integer \\n'\nif len(title) == 0:\n errorString += 'The title cannot be empty \\n'\nif len(desc) == 0:\n errorString += 'The description cannot be empty \\n'\nif len(author) == 0:\n errorString += 'The author name cannot be empty \...
<|body_start_0|> errorString = '' if id == -1: errorString += 'Invalid ID, must be an integer \n' if len(title) == 0: errorString += 'The title cannot be empty \n' if len(desc) == 0: errorString += 'The description cannot be empty \n' if len(au...
Validator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validator: def validateNewBook(self, id, title, desc, author): """:param id: int :param title: string :param desc: string :param author: author :return: "" if the input data is correct, an error string otherwise""" <|body_0|> def validateNewClient(self, id, name): ""...
stack_v2_sparse_classes_75kplus_train_069810
1,162
no_license
[ { "docstring": ":param id: int :param title: string :param desc: string :param author: author :return: \"\" if the input data is correct, an error string otherwise", "name": "validateNewBook", "signature": "def validateNewBook(self, id, title, desc, author)" }, { "docstring": ":param id: int :pa...
2
stack_v2_sparse_classes_30k_train_033847
Implement the Python class `Validator` described below. Class description: Implement the Validator class. Method signatures and docstrings: - def validateNewBook(self, id, title, desc, author): :param id: int :param title: string :param desc: string :param author: author :return: "" if the input data is correct, an e...
Implement the Python class `Validator` described below. Class description: Implement the Validator class. Method signatures and docstrings: - def validateNewBook(self, id, title, desc, author): :param id: int :param title: string :param desc: string :param author: author :return: "" if the input data is correct, an e...
63ade23342e822c76bedde8385881c823920027c
<|skeleton|> class Validator: def validateNewBook(self, id, title, desc, author): """:param id: int :param title: string :param desc: string :param author: author :return: "" if the input data is correct, an error string otherwise""" <|body_0|> def validateNewClient(self, id, name): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Validator: def validateNewBook(self, id, title, desc, author): """:param id: int :param title: string :param desc: string :param author: author :return: "" if the input data is correct, an error string otherwise""" errorString = '' if id == -1: errorString += 'Invalid ID, m...
the_stack_v2_python_sparse
validation/validator.py
marian3525/Assignment05-07-08-09
train
0
63986f0297d48db3861456e49677712f25618874
[ "self._august_gateway = None\nself.user_auth_details = {}\nself._needs_reset = False\nsuper().__init__()", "if self._august_gateway is None:\n self._august_gateway = AugustGateway(self.hass)\nerrors = {}\nif user_input is not None:\n combined_inputs = {**self.user_auth_details, **user_input}\n await self...
<|body_start_0|> self._august_gateway = None self.user_auth_details = {} self._needs_reset = False super().__init__() <|end_body_0|> <|body_start_1|> if self._august_gateway is None: self._august_gateway = AugustGateway(self.hass) errors = {} if user_...
Handle a config flow for August.
AugustConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AugustConfigFlow: """Handle a config flow for August.""" def __init__(self): """Store an AugustGateway().""" <|body_0|> async def async_step_user(self, user_input=None): """Handle the initial step.""" <|body_1|> async def async_step_validation(self, ...
stack_v2_sparse_classes_75kplus_train_069811
5,668
permissive
[ { "docstring": "Store an AugustGateway().", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Handle the initial step.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Handle validation (2fa) st...
6
stack_v2_sparse_classes_30k_train_007872
Implement the Python class `AugustConfigFlow` described below. Class description: Handle a config flow for August. Method signatures and docstrings: - def __init__(self): Store an AugustGateway(). - async def async_step_user(self, user_input=None): Handle the initial step. - async def async_step_validation(self, user...
Implement the Python class `AugustConfigFlow` described below. Class description: Handle a config flow for August. Method signatures and docstrings: - def __init__(self): Store an AugustGateway(). - async def async_step_user(self, user_input=None): Handle the initial step. - async def async_step_validation(self, user...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class AugustConfigFlow: """Handle a config flow for August.""" def __init__(self): """Store an AugustGateway().""" <|body_0|> async def async_step_user(self, user_input=None): """Handle the initial step.""" <|body_1|> async def async_step_validation(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AugustConfigFlow: """Handle a config flow for August.""" def __init__(self): """Store an AugustGateway().""" self._august_gateway = None self.user_auth_details = {} self._needs_reset = False super().__init__() async def async_step_user(self, user_input=None): ...
the_stack_v2_python_sparse
homeassistant/components/august/config_flow.py
tchellomello/home-assistant
train
8
c6e2aa8ca41fe3c51bc0573524b5b518437caa76
[ "create_member_url = 'https://qyapi.weixin.qq.com/cgi-bin/user/create'\ndata = {'userid': member_info['userid'], 'name': member_info['name'], 'alias': member_info['alias'], 'mobile': member_info['mobile'], 'department': member_info['department']}\nr = self.send('POST', url=create_member_url, json=data)\nreturn r.js...
<|body_start_0|> create_member_url = 'https://qyapi.weixin.qq.com/cgi-bin/user/create' data = {'userid': member_info['userid'], 'name': member_info['name'], 'alias': member_info['alias'], 'mobile': member_info['mobile'], 'department': member_info['department']} r = self.send('POST', url=create_m...
Address
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Address: def create_member(self, member_info): """创建成员 :param member_info: yaml文件中的用户信息 :return:""" <|body_0|> def get_member(self, member_info): """获取成员 :param member_info: yaml文件中的用户信息 :return:""" <|body_1|> def update_member(self, member_info, new_nam...
stack_v2_sparse_classes_75kplus_train_069812
2,002
no_license
[ { "docstring": "创建成员 :param member_info: yaml文件中的用户信息 :return:", "name": "create_member", "signature": "def create_member(self, member_info)" }, { "docstring": "获取成员 :param member_info: yaml文件中的用户信息 :return:", "name": "get_member", "signature": "def get_member(self, member_info)" }, ...
4
stack_v2_sparse_classes_30k_train_043601
Implement the Python class `Address` described below. Class description: Implement the Address class. Method signatures and docstrings: - def create_member(self, member_info): 创建成员 :param member_info: yaml文件中的用户信息 :return: - def get_member(self, member_info): 获取成员 :param member_info: yaml文件中的用户信息 :return: - def updat...
Implement the Python class `Address` described below. Class description: Implement the Address class. Method signatures and docstrings: - def create_member(self, member_info): 创建成员 :param member_info: yaml文件中的用户信息 :return: - def get_member(self, member_info): 获取成员 :param member_info: yaml文件中的用户信息 :return: - def updat...
a36880bf669d2ab30eb601f6402dbc876a8cb7a2
<|skeleton|> class Address: def create_member(self, member_info): """创建成员 :param member_info: yaml文件中的用户信息 :return:""" <|body_0|> def get_member(self, member_info): """获取成员 :param member_info: yaml文件中的用户信息 :return:""" <|body_1|> def update_member(self, member_info, new_nam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Address: def create_member(self, member_info): """创建成员 :param member_info: yaml文件中的用户信息 :return:""" create_member_url = 'https://qyapi.weixin.qq.com/cgi-bin/user/create' data = {'userid': member_info['userid'], 'name': member_info['name'], 'alias': member_info['alias'], 'mobile': membe...
the_stack_v2_python_sparse
taskwork/stage10_live_request/wework/address.py
fatfatfatFatTiger/HogwartsLG6
train
0
8c5abc218898cad9bcf522a0ce89374cb063c380
[ "lenth = len(nums)\nfor i in range(lenth):\n for j in range(i + 1, lenth):\n if nums[i] + nums[j] == target:\n return [i, j]", "hashmap = {}\nfor index, value in enumerate(nums):\n hashmap[value] = index\nfor index, value in enumerate(nums):\n if target - value in hashmap:\n j = ...
<|body_start_0|> lenth = len(nums) for i in range(lenth): for j in range(i + 1, lenth): if nums[i] + nums[j] == target: return [i, j] <|end_body_0|> <|body_start_1|> hashmap = {} for index, value in enumerate(nums): hashmap[val...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum_01(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_02(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def twoSum_03(self, nums...
stack_v2_sparse_classes_75kplus_train_069813
1,504
permissive
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum_01", "signature": "def twoSum_01(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum_02", "signature": "def twoSum_02(self, nums, ta...
3
stack_v2_sparse_classes_30k_train_050933
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_01(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_02(self, nums, target): :type nums: List[int] :type target: int :rtype: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum_01(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_02(self, nums, target): :type nums: List[int] :type target: int :rtype: ...
4a6d46c179d7f52054c417b2aa21708331ac84c5
<|skeleton|> class Solution: def twoSum_01(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_02(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> def twoSum_03(self, nums...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum_01(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" lenth = len(nums) for i in range(lenth): for j in range(i + 1, lenth): if nums[i] + nums[j] == target: return [i, j] def two...
the_stack_v2_python_sparse
problems/哈希表/01. 两数之和/two-sum.py
HannibalXZX/LeetCode
train
1
77ee5f94df8b4f32597096daf0a2c5715d48c3f6
[ "result = []\nothers = [\"'s\", 'the', 'that', 'this', 'to', '-PRON-']\nfor sent in text:\n sent = str(sent).lower()\n sent = re.sub('facebook', 'social media', sent)\n sent = re.sub('twitter', 'social media', sent)\n sent = re.sub('instagram', 'social media', sent)\n sent = re.sub('whatsapp', 'socia...
<|body_start_0|> result = [] others = ["'s", 'the', 'that', 'this', 'to', '-PRON-'] for sent in text: sent = str(sent).lower() sent = re.sub('facebook', 'social media', sent) sent = re.sub('twitter', 'social media', sent) sent = re.sub('instagram',...
Preprocessing
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocessing: def general(self, text, min_token_len=2, irrelevant_pos=['PRON', 'SPACE', 'PUNCT', 'ADV', 'ADP', 'CCONJ', 'AUX', 'PRP'], avoid_entities=['PERSON', 'ORG', 'LOC', 'GPE']): """Function that identify sensible information, anonymize and transforms the data in a useful format fo...
stack_v2_sparse_classes_75kplus_train_069814
5,915
permissive
[ { "docstring": "Function that identify sensible information, anonymize and transforms the data in a useful format for using with tokens. Parameters ------------- text : (list) the list of text to be preprocessed irrelevant_pos : (list) a list of irrelevant 'pos' tags avoid_entities : (list) a list of entity lab...
2
stack_v2_sparse_classes_30k_train_050174
Implement the Python class `Preprocessing` described below. Class description: Implement the Preprocessing class. Method signatures and docstrings: - def general(self, text, min_token_len=2, irrelevant_pos=['PRON', 'SPACE', 'PUNCT', 'ADV', 'ADP', 'CCONJ', 'AUX', 'PRP'], avoid_entities=['PERSON', 'ORG', 'LOC', 'GPE'])...
Implement the Python class `Preprocessing` described below. Class description: Implement the Preprocessing class. Method signatures and docstrings: - def general(self, text, min_token_len=2, irrelevant_pos=['PRON', 'SPACE', 'PUNCT', 'ADV', 'ADP', 'CCONJ', 'AUX', 'PRP'], avoid_entities=['PERSON', 'ORG', 'LOC', 'GPE'])...
3a83cb05c0157639e84b1936a9b5656ae6b50e46
<|skeleton|> class Preprocessing: def general(self, text, min_token_len=2, irrelevant_pos=['PRON', 'SPACE', 'PUNCT', 'ADV', 'ADP', 'CCONJ', 'AUX', 'PRP'], avoid_entities=['PERSON', 'ORG', 'LOC', 'GPE']): """Function that identify sensible information, anonymize and transforms the data in a useful format fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Preprocessing: def general(self, text, min_token_len=2, irrelevant_pos=['PRON', 'SPACE', 'PUNCT', 'ADV', 'ADP', 'CCONJ', 'AUX', 'PRP'], avoid_entities=['PERSON', 'ORG', 'LOC', 'GPE']): """Function that identify sensible information, anonymize and transforms the data in a useful format for using with t...
the_stack_v2_python_sparse
src/data/preprocess.py
Sukriti1312/UBC_MDS_Capstone
train
0
b3a486a5572cf1997231f36f6b3148b1325be99c
[ "self.completion_percentage = completion_percentage\nself.error_message = error_message\nself.events = events\nself.in_progress = in_progress\nself.message = message\nself.seconds_remaining = seconds_remaining\nself.warnings_found = warnings_found", "if dictionary is None:\n return None\ncompletion_percentage ...
<|body_start_0|> self.completion_percentage = completion_percentage self.error_message = error_message self.events = events self.in_progress = in_progress self.message = message self.seconds_remaining = seconds_remaining self.warnings_found = warnings_found <|end_...
Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster creation process. error_message (string): Specifies a descri...
ClusterCreationProgressResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterCreationProgressResult: """Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster cre...
stack_v2_sparse_classes_75kplus_train_069815
3,737
permissive
[ { "docstring": "Constructor for the ClusterCreationProgressResult class", "name": "__init__", "signature": "def __init__(self, completion_percentage=None, error_message=None, events=None, in_progress=None, message=None, seconds_remaining=None, warnings_found=None)" }, { "docstring": "Creates an ...
2
stack_v2_sparse_classes_30k_train_008177
Implement the Python class `ClusterCreationProgressResult` described below. Class description: Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate co...
Implement the Python class `ClusterCreationProgressResult` described below. Class description: Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate co...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ClusterCreationProgressResult: """Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster cre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClusterCreationProgressResult: """Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster creation process...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cluster_creation_progress_result.py
cohesity/management-sdk-python
train
24
cee6b35a9d97b97eb65eb16746ee5bbcd2d71ab0
[ "self.criterion = nn.CrossEntropyLoss()\nself.num_epochs = num_epochs\nself.batch_size = batch_size\nself.weight_decay = weight_decay\nself.pretrained = pretrained\nself.model = model\nif model == 'CNN':\n self.net = CNN()\n self.optimizer = optim.Adamax(self.net.parameters(), weight_decay=0)\nelif model == '...
<|body_start_0|> self.criterion = nn.CrossEntropyLoss() self.num_epochs = num_epochs self.batch_size = batch_size self.weight_decay = weight_decay self.pretrained = pretrained self.model = model if model == 'CNN': self.net = CNN() self.opti...
NetTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetTrainer: def __init__(self, num_epochs, batch_size, weight_decay, model='TS', pretrained=False): """Initialization for the net trainer :param num_epochs: how many epochs of training :param batch_size: batch size dimension :param weight_decay: weight decay value :param model: model to ...
stack_v2_sparse_classes_75kplus_train_069816
6,985
no_license
[ { "docstring": "Initialization for the net trainer :param num_epochs: how many epochs of training :param batch_size: batch size dimension :param weight_decay: weight decay value :param model: model to train between [LSTM, LOG, CNN, TS] :param pretrained: parameter to load weights of pretrained network", "na...
3
stack_v2_sparse_classes_30k_train_036344
Implement the Python class `NetTrainer` described below. Class description: Implement the NetTrainer class. Method signatures and docstrings: - def __init__(self, num_epochs, batch_size, weight_decay, model='TS', pretrained=False): Initialization for the net trainer :param num_epochs: how many epochs of training :par...
Implement the Python class `NetTrainer` described below. Class description: Implement the NetTrainer class. Method signatures and docstrings: - def __init__(self, num_epochs, batch_size, weight_decay, model='TS', pretrained=False): Initialization for the net trainer :param num_epochs: how many epochs of training :par...
967f7ed64a65cbd687abf4224110684367f5caa1
<|skeleton|> class NetTrainer: def __init__(self, num_epochs, batch_size, weight_decay, model='TS', pretrained=False): """Initialization for the net trainer :param num_epochs: how many epochs of training :param batch_size: batch size dimension :param weight_decay: weight decay value :param model: model to ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetTrainer: def __init__(self, num_epochs, batch_size, weight_decay, model='TS', pretrained=False): """Initialization for the net trainer :param num_epochs: how many epochs of training :param batch_size: batch size dimension :param weight_decay: weight decay value :param model: model to train between ...
the_stack_v2_python_sparse
project1_bci/src/main/model/trainer.py
HongChen1995/bci_deeplearning
train
0
8c9ec614f83314eb3b68788a60ccd2359d719b59
[ "super(BaselineEarlyFusion, self).__init__()\ncfg.MODEL.FEATURE_FUSION = 'concat'\nself.multi_extractor = MultiExtractor(cfg)\nself.earyly_fusion = EarlyFusion(cfg)\nif cfg.MODEL.DEVICE == 'cuda':\n self.earyly_fusion = self.earyly_fusion.cuda()", "x = self.multi_extractor(x)\nout, hid_feature = self.earyly_fu...
<|body_start_0|> super(BaselineEarlyFusion, self).__init__() cfg.MODEL.FEATURE_FUSION = 'concat' self.multi_extractor = MultiExtractor(cfg) self.earyly_fusion = EarlyFusion(cfg) if cfg.MODEL.DEVICE == 'cuda': self.earyly_fusion = self.earyly_fusion.cuda() <|end_body_0...
BaselineEarlyFusion
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaselineEarlyFusion: def __init__(self, cfg): """:param num_class: :param requirements: Should not include class part.""" <|body_0|> def forward(self, x, return_feature=False): """:param x: A list of tensor :return:""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_069817
8,984
no_license
[ { "docstring": ":param num_class: :param requirements: Should not include class part.", "name": "__init__", "signature": "def __init__(self, cfg)" }, { "docstring": ":param x: A list of tensor :return:", "name": "forward", "signature": "def forward(self, x, return_feature=False)" } ]
2
stack_v2_sparse_classes_30k_train_009698
Implement the Python class `BaselineEarlyFusion` described below. Class description: Implement the BaselineEarlyFusion class. Method signatures and docstrings: - def __init__(self, cfg): :param num_class: :param requirements: Should not include class part. - def forward(self, x, return_feature=False): :param x: A lis...
Implement the Python class `BaselineEarlyFusion` described below. Class description: Implement the BaselineEarlyFusion class. Method signatures and docstrings: - def __init__(self, cfg): :param num_class: :param requirements: Should not include class part. - def forward(self, x, return_feature=False): :param x: A lis...
390acce96c8422fff1a6e14e86437b3cc2e414cb
<|skeleton|> class BaselineEarlyFusion: def __init__(self, cfg): """:param num_class: :param requirements: Should not include class part.""" <|body_0|> def forward(self, x, return_feature=False): """:param x: A list of tensor :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaselineEarlyFusion: def __init__(self, cfg): """:param num_class: :param requirements: Should not include class part.""" super(BaselineEarlyFusion, self).__init__() cfg.MODEL.FEATURE_FUSION = 'concat' self.multi_extractor = MultiExtractor(cfg) self.earyly_fusion = Earl...
the_stack_v2_python_sparse
libs/models/baseline.py
wkoa/Multimodal_USMC
train
0
4313442950ae89d79f8cbccda476142b88b93b91
[ "self.poly_degree = poly_degree\nself.ciph_modulus = ciph_modulus\nself.big_modulus = big_modulus\nself.scaling_factor = scaling_factor\nself.num_taylor_iterations = taylor_iterations\nself.hamming_weight = poly_degree // 4\nself.crt_context = None\nif prime_size:\n num_primes = 1 + int(1 + math.log(poly_degree,...
<|body_start_0|> self.poly_degree = poly_degree self.ciph_modulus = ciph_modulus self.big_modulus = big_modulus self.scaling_factor = scaling_factor self.num_taylor_iterations = taylor_iterations self.hamming_weight = poly_degree // 4 self.crt_context = None ...
An instance of parameters for the CKKS scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for bootstrapping. scaling_factor (float): Scaling factor to multiply by. hamming_weight...
CKKSParameters
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CKKSParameters: """An instance of parameters for the CKKS scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for bootstrapping. scaling_factor (float): Sca...
stack_v2_sparse_classes_75kplus_train_069818
2,815
permissive
[ { "docstring": "Inits Parameters with the given parameters. Args: poly_degree (int): Degree d of polynomial of ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for bootstrapping. scaling_factor (float): Scaling factor to multiply by. taylor_iterations (int): ...
2
null
Implement the Python class `CKKSParameters` described below. Class description: An instance of parameters for the CKKS scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for boo...
Implement the Python class `CKKSParameters` described below. Class description: An instance of parameters for the CKKS scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for boo...
be700505547b81671c37026e55c4eefbd44dcaae
<|skeleton|> class CKKSParameters: """An instance of parameters for the CKKS scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for bootstrapping. scaling_factor (float): Sca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CKKSParameters: """An instance of parameters for the CKKS scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. ciph_modulus (int): Coefficient modulus of ciphertexts. big_modulus (int): Large modulus used for bootstrapping. scaling_factor (float): Scaling factor t...
the_stack_v2_python_sparse
ckks/ckks_parameters.py
seounghwan-oh/py_FHE_for_homomorphic_encryption
train
3
ca317eabfa3f0a5b00ceff03b256a9eab98cde77
[ "super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for __ in range(self.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(input_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for __ in range(self....
Decoder for a transformer
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decoder for a transformer""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Public instance method""" ...
stack_v2_sparse_classes_75kplus_train_069819
1,600
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1)" }, { "docstring": "Public instance method", "name": "call", "signature": "def call(self, x, encoder_output, training, look_ahead_mask, padd...
2
stack_v2_sparse_classes_30k_train_033729
Implement the Python class `Decoder` described below. Class description: Decoder for a transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): Public i...
Implement the Python class `Decoder` described below. Class description: Decoder for a transformer Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): Public i...
c23deee331a71a089197547fcae4c1eefb8d24ef
<|skeleton|> class Decoder: """Decoder for a transformer""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Public instance method""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: """Decoder for a transformer""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """Class constructor""" super(Decoder, self).__init__() self.N = N self.dm = dm self.embedding = tf.keras.layers.Embedding(input_vocab, dm) ...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
YosriGFX/holbertonschool-machine_learning
train
0
03a97e2ddfc808a0c773b44ee47ef4948d02dbc9
[ "length = maximum = 0\nres = s[0] if s != '' else ''\nfor i, c in enumerate(s):\n for h in range(min(i, len(s) - i - 1)):\n if s[i - h - 1] == s[i + h + 1]:\n length = 2 * h + 3\n if length > maximum:\n res = s[i - h - 1:i + h + 2]\nreturn res", "max = 0\nres = '' if...
<|body_start_0|> length = maximum = 0 res = s[0] if s != '' else '' for i, c in enumerate(s): for h in range(min(i, len(s) - i - 1)): if s[i - h - 1] == s[i + h + 1]: length = 2 * h + 3 if length > maximum: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = maximum = 0 res = s[0] if s != '' else ...
stack_v2_sparse_classes_75kplus_train_069820
2,469
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome2", "signature": "def longestPalindrome2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_042389
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def longestPalindrome(self...
3dec0f75cb9c04c3eed05eb87eb59254ec0b379a
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" length = maximum = 0 res = s[0] if s != '' else '' for i, c in enumerate(s): for h in range(min(i, len(s) - i - 1)): if s[i - h - 1] == s[i + h + 1]: length ...
the_stack_v2_python_sparse
5.== Longest Palindromic Substring.py
cosJin/top100liked
train
0
c11272ce6271903bba6c7ec0e3d90bb09cb6c505
[ "self.user = user\nself.password = password\nif host:\n self.host = host", "if not from_addr:\n from_addr = self.user\ndata = 'From: %s\\nTo: %s\\nSubject: %s\\n\\n%s' % (from_addr, to_addrs, subject, message)\ntry:\n server = smtplib.SMTP(self.host)\n server.ehlo()\n server.starttls()\n server....
<|body_start_0|> self.user = user self.password = password if host: self.host = host <|end_body_0|> <|body_start_1|> if not from_addr: from_addr = self.user data = 'From: %s\nTo: %s\nSubject: %s\n\n%s' % (from_addr, to_addrs, subject, message) try...
Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])
Gmailer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gmailer: """Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])""" def __init__(self, user, password, host=None): """Set Google username and passsword. use: Gmailer(user, password[, host])""" <|body_0|> def s...
stack_v2_sparse_classes_75kplus_train_069821
1,781
no_license
[ { "docstring": "Set Google username and passsword. use: Gmailer(user, password[, host])", "name": "__init__", "signature": "def __init__(self, user, password, host=None)" }, { "docstring": "Set username and passsword use: send(to_addrs, subject, message[, from_addrs])", "name": "send", "...
2
stack_v2_sparse_classes_30k_val_001201
Implement the Python class `Gmailer` described below. Class description: Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs]) Method signatures and docstrings: - def __init__(self, user, password, host=None): Set Google username and passsword. use: Gmailer...
Implement the Python class `Gmailer` described below. Class description: Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs]) Method signatures and docstrings: - def __init__(self, user, password, host=None): Set Google username and passsword. use: Gmailer...
b02b9025add538a927538122558778c505a6c37b
<|skeleton|> class Gmailer: """Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])""" def __init__(self, user, password, host=None): """Set Google username and passsword. use: Gmailer(user, password[, host])""" <|body_0|> def s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Gmailer: """Send email through Gmail. use: Gmailer(user, password[, host]) use: send(to_addrs, subject, message[, from_addrs])""" def __init__(self, user, password, host=None): """Set Google username and passsword. use: Gmailer(user, password[, host])""" self.user = user self.pass...
the_stack_v2_python_sparse
libs/gmailer.py
yezooz/24goals
train
0
30040e46f6612422c1fc0ef6f18b770859b94e18
[ "super().__init__(flatten_flag=flatten_flag, n_pca_components=n_pca_components, extract_hog_flag=extract_hog_flag, type_cnn=type_cnn)\nself.segment_lungs_flag = segment_lungs_flag\nself.u_net_model_path = u_net_model_path\nself.u_net_weights_path = u_net_weights_path\nself.segment_lungs_method = segment_lungs_metho...
<|body_start_0|> super().__init__(flatten_flag=flatten_flag, n_pca_components=n_pca_components, extract_hog_flag=extract_hog_flag, type_cnn=type_cnn) self.segment_lungs_flag = segment_lungs_flag self.u_net_model_path = u_net_model_path self.u_net_weights_path = u_net_weights_path ...
Children Class of ImagePreProcessor. Used to transform 2D X-Ray Images only of the chest cavity.
ChestXRayPreProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChestXRayPreProcessor: """Children Class of ImagePreProcessor. Used to transform 2D X-Ray Images only of the chest cavity.""" def __init__(self, flatten_flag=False, n_pca_components=0, extract_hog_flag=False, type_cnn='', segment_lungs_flag=False, segment_lungs_method='', u_net_model_path=''...
stack_v2_sparse_classes_75kplus_train_069822
17,079
no_license
[ { "docstring": "Constructor of the class. :param flatten_flag: (bool) whether to express the numpy array of data with shape [n_samples, n_features] :param n_pca_components: (int) number of principal components that will be computed from the data \"x\". Must be an integer between 2 and 3. :param extract_hog_flag...
3
stack_v2_sparse_classes_30k_train_036226
Implement the Python class `ChestXRayPreProcessor` described below. Class description: Children Class of ImagePreProcessor. Used to transform 2D X-Ray Images only of the chest cavity. Method signatures and docstrings: - def __init__(self, flatten_flag=False, n_pca_components=0, extract_hog_flag=False, type_cnn='', se...
Implement the Python class `ChestXRayPreProcessor` described below. Class description: Children Class of ImagePreProcessor. Used to transform 2D X-Ray Images only of the chest cavity. Method signatures and docstrings: - def __init__(self, flatten_flag=False, n_pca_components=0, extract_hog_flag=False, type_cnn='', se...
c46f4b2ba7762420186cb710d2932adf00829d6f
<|skeleton|> class ChestXRayPreProcessor: """Children Class of ImagePreProcessor. Used to transform 2D X-Ray Images only of the chest cavity.""" def __init__(self, flatten_flag=False, n_pca_components=0, extract_hog_flag=False, type_cnn='', segment_lungs_flag=False, segment_lungs_method='', u_net_model_path=''...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChestXRayPreProcessor: """Children Class of ImagePreProcessor. Used to transform 2D X-Ray Images only of the chest cavity.""" def __init__(self, flatten_flag=False, n_pca_components=0, extract_hog_flag=False, type_cnn='', segment_lungs_flag=False, segment_lungs_method='', u_net_model_path='', u_net_weigh...
the_stack_v2_python_sparse
pre_processors.py
jonathand94/ML-Classifiers-Library
train
0
bcc675325ec9a1ad9fae9361a2baac1bef7dfd75
[ "url = 'https://www.zhihu.com'\nfor _ in range(2):\n async with self.client.get(url) as r:\n resp = await r.text()\n session_token = re.findall('session_token=(.*?)\\\\&', resp)\n if session_token:\n session_token = session_token[0]\n break\nelse:\n raise AssertionError('获取sessi...
<|body_start_0|> url = 'https://www.zhihu.com' for _ in range(2): async with self.client.get(url) as r: resp = await r.text() session_token = re.findall('session_token=(.*?)\\&', resp) if session_token: session_token = session_token...
文章相关
ArticleSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleSpider: """文章相关""" async def get_recommend_article(self) -> dict: """获取推荐文章 :return:""" <|body_0|> async def endorse_answer(self, uid: str, typ: str='up') -> dict: """赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:""" <|body_1|> a...
stack_v2_sparse_classes_75kplus_train_069823
4,388
permissive
[ { "docstring": "获取推荐文章 :return:", "name": "get_recommend_article", "signature": "async def get_recommend_article(self) -> dict" }, { "docstring": "赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:", "name": "endorse_answer", "signature": "async def endorse_answer(self, uid: st...
6
stack_v2_sparse_classes_30k_test_001627
Implement the Python class `ArticleSpider` described below. Class description: 文章相关 Method signatures and docstrings: - async def get_recommend_article(self) -> dict: 获取推荐文章 :return: - async def endorse_answer(self, uid: str, typ: str='up') -> dict: 赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return: - async...
Implement the Python class `ArticleSpider` described below. Class description: 文章相关 Method signatures and docstrings: - async def get_recommend_article(self) -> dict: 获取推荐文章 :return: - async def endorse_answer(self, uid: str, typ: str='up') -> dict: 赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return: - async...
bd8cbae26b0027eeffa78b8a4888b3b4aa4a84e0
<|skeleton|> class ArticleSpider: """文章相关""" async def get_recommend_article(self) -> dict: """获取推荐文章 :return:""" <|body_0|> async def endorse_answer(self, uid: str, typ: str='up') -> dict: """赞同回答 :param uid: :param typ: up赞同, down踩, neutral中立 :return:""" <|body_1|> a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArticleSpider: """文章相关""" async def get_recommend_article(self) -> dict: """获取推荐文章 :return:""" url = 'https://www.zhihu.com' for _ in range(2): async with self.client.get(url) as r: resp = await r.text() session_token = re.findall('sessi...
the_stack_v2_python_sparse
spider/article_spider.py
wf1314/zhihu-terminal
train
124
cc15e2111cd96a422debe0d6bf491ae7cdd6723a
[ "self.bot_id = kwargs.get('bot_id')\nself.position = kwargs.get('position')\nself.rotation = kwargs.get('rotation')\nself.waypoint_position = kwargs.get('waypoint_position')", "self.bot_id = kwargs['bot_id']\nself.position = kwargs['position']\nself.rotation = kwargs['rotation']\nself.waypoint_position = kwargs['...
<|body_start_0|> self.bot_id = kwargs.get('bot_id') self.position = kwargs.get('position') self.rotation = kwargs.get('rotation') self.waypoint_position = kwargs.get('waypoint_position') <|end_body_0|> <|body_start_1|> self.bot_id = kwargs['bot_id'] self.position = kwarg...
BotTransformSyncRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BotTransformSyncRequest: def __init__(self, **kwargs): """Params: bot_id: int position: Vector3 rotation: float waypoint_position: Vector3""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): ...
stack_v2_sparse_classes_75kplus_train_069824
26,590
no_license
[ { "docstring": "Params: bot_id: int position: Vector3 rotation: float waypoint_position: Vector3", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "load from dict Exception: KeyError", "name": "load", "signature": "def load(self, **kwargs)" }, { ...
3
stack_v2_sparse_classes_30k_train_009924
Implement the Python class `BotTransformSyncRequest` described below. Class description: Implement the BotTransformSyncRequest class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: bot_id: int position: Vector3 rotation: float waypoint_position: Vector3 - def load(self, **kwargs): load from...
Implement the Python class `BotTransformSyncRequest` described below. Class description: Implement the BotTransformSyncRequest class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: bot_id: int position: Vector3 rotation: float waypoint_position: Vector3 - def load(self, **kwargs): load from...
aa0b2697e295889e8c23a7104889ea95f2a4b6b1
<|skeleton|> class BotTransformSyncRequest: def __init__(self, **kwargs): """Params: bot_id: int position: Vector3 rotation: float waypoint_position: Vector3""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BotTransformSyncRequest: def __init__(self, **kwargs): """Params: bot_id: int position: Vector3 rotation: float waypoint_position: Vector3""" self.bot_id = kwargs.get('bot_id') self.position = kwargs.get('position') self.rotation = kwargs.get('rotation') self.waypoint_p...
the_stack_v2_python_sparse
message.py
songhui17/Server
train
0
4ca7cfd863d373a9f528b66a1e34984a41890c44
[ "flags.AddOptionalInstance(parser)\nparser.add_argument('--application-default-credential', action='store_true', help='Use application default credentials to generate the login token.')\nparser.display_info.AddFormat('value(token)')", "if args.application_default_credential:\n return generate_login_token_util....
<|body_start_0|> flags.AddOptionalInstance(parser) parser.add_argument('--application-default-credential', action='store_true', help='Use application default credentials to generate the login token.') parser.display_info.AddFormat('value(token)') <|end_body_0|> <|body_start_1|> if args....
Generate an IAM login token for Cloud SQL.
GenerateLoginToken
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenerateLoginToken: """Generate an IAM login token for Cloud SQL.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arg...
stack_v2_sparse_classes_75kplus_train_069825
3,101
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
null
Implement the Python class `GenerateLoginToken` described below. Class description: Generate an IAM login token for Cloud SQL. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that ...
Implement the Python class `GenerateLoginToken` described below. Class description: Generate an IAM login token for Cloud SQL. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that ...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class GenerateLoginToken: """Generate an IAM login token for Cloud SQL.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arg...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GenerateLoginToken: """Generate an IAM login token for Cloud SQL.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are al...
the_stack_v2_python_sparse
lib/surface/sql/generate_login_token.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
ba994f4fdf5d0dfa71708f22688c7ce41f3b5e69
[ "if kind != 'issue':\n raise NameError('Type not exists')\nself._check_labels(self._message['labels'])\nreturn self._mongofacade.get_match_labels(users, self._message['project_id'], self._message['labels'])", "project = self._message['project_id']\nlabel_project = self._mongofacade.get_label_project(project)\n...
<|body_start_0|> if kind != 'issue': raise NameError('Type not exists') self._check_labels(self._message['labels']) return self._mongofacade.get_match_labels(users, self._message['project_id'], self._message['labels']) <|end_body_0|> <|body_start_1|> project = self._message[...
Classe processore di Redmine
RedmineProcessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedmineProcessor: """Classe processore di Redmine""" def _filter_users_by_topic(self, users: list, kind: str) -> list: """Cerca gli utenti disponibili nella data della notifica iscritti ai topic della segnalazione :param users: lista di utenti appartenenti al progetto della segnalazi...
stack_v2_sparse_classes_75kplus_train_069826
4,397
no_license
[ { "docstring": "Cerca gli utenti disponibili nella data della notifica iscritti ai topic della segnalazione :param users: lista di utenti appartenenti al progetto della segnalazione e disponibili nel giorno della segnalazione :param kind: tipologia della segnalazione per redmine :return: lista di utenti iscritt...
2
stack_v2_sparse_classes_30k_train_038609
Implement the Python class `RedmineProcessor` described below. Class description: Classe processore di Redmine Method signatures and docstrings: - def _filter_users_by_topic(self, users: list, kind: str) -> list: Cerca gli utenti disponibili nella data della notifica iscritti ai topic della segnalazione :param users:...
Implement the Python class `RedmineProcessor` described below. Class description: Classe processore di Redmine Method signatures and docstrings: - def _filter_users_by_topic(self, users: list, kind: str) -> list: Cerca gli utenti disponibili nella data della notifica iscritti ai topic della segnalazione :param users:...
1a23278f386e2b914fb2dbca17f795d0edea78d8
<|skeleton|> class RedmineProcessor: """Classe processore di Redmine""" def _filter_users_by_topic(self, users: list, kind: str) -> list: """Cerca gli utenti disponibili nella data della notifica iscritti ai topic della segnalazione :param users: lista di utenti appartenenti al progetto della segnalazi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RedmineProcessor: """Classe processore di Redmine""" def _filter_users_by_topic(self, users: list, kind: str) -> list: """Cerca gli utenti disponibili nella data della notifica iscritti ai topic della segnalazione :param users: lista di utenti appartenenti al progetto della segnalazione e disponi...
the_stack_v2_python_sparse
Butterfly/gestore_personale/concrete_processor.py
alphasixteam/Butterfly
train
4
e4cac54191b6817a55b77f9c354faf792832c617
[ "from foyer.atomtyper import find_atomtypes\nfrom foyer.topology_graph import TopologyGraph\ntop_graph = TopologyGraph.from_openff_topology(topology)\ntype_map = find_atomtypes(top_graph, forcefield=force_field)\nfor key, val in type_map.items():\n top_key = TopologyKey(atom_indices=(key,))\n self.key_map[top...
<|body_start_0|> from foyer.atomtyper import find_atomtypes from foyer.topology_graph import TopologyGraph top_graph = TopologyGraph.from_openff_topology(topology) type_map = find_atomtypes(top_graph, forcefield=force_field) for key, val in type_map.items(): top_key =...
Handler storing vdW potentials as produced by a Foyer force field.
FoyerVDWHandler
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoyerVDWHandler: """Handler storing vdW potentials as produced by a Foyer force field.""" def store_matches(self, force_field: 'Forcefield', topology: 'Topology') -> None: """Populate self.key_map with key-val pairs of [TopologyKey, PotentialKey].""" <|body_0|> def store...
stack_v2_sparse_classes_75kplus_train_069827
3,394
permissive
[ { "docstring": "Populate self.key_map with key-val pairs of [TopologyKey, PotentialKey].", "name": "store_matches", "signature": "def store_matches(self, force_field: 'Forcefield', topology: 'Topology') -> None" }, { "docstring": "Extract specific force field potentials a Forcefield object.", ...
2
stack_v2_sparse_classes_30k_train_033205
Implement the Python class `FoyerVDWHandler` described below. Class description: Handler storing vdW potentials as produced by a Foyer force field. Method signatures and docstrings: - def store_matches(self, force_field: 'Forcefield', topology: 'Topology') -> None: Populate self.key_map with key-val pairs of [Topolog...
Implement the Python class `FoyerVDWHandler` described below. Class description: Handler storing vdW potentials as produced by a Foyer force field. Method signatures and docstrings: - def store_matches(self, force_field: 'Forcefield', topology: 'Topology') -> None: Populate self.key_map with key-val pairs of [Topolog...
4616f2cff477c18e2c6ca70ac4c74c28b283a4be
<|skeleton|> class FoyerVDWHandler: """Handler storing vdW potentials as produced by a Foyer force field.""" def store_matches(self, force_field: 'Forcefield', topology: 'Topology') -> None: """Populate self.key_map with key-val pairs of [TopologyKey, PotentialKey].""" <|body_0|> def store...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FoyerVDWHandler: """Handler storing vdW potentials as produced by a Foyer force field.""" def store_matches(self, force_field: 'Forcefield', topology: 'Topology') -> None: """Populate self.key_map with key-val pairs of [TopologyKey, PotentialKey].""" from foyer.atomtyper import find_atomt...
the_stack_v2_python_sparse
openff/interchange/foyer/_nonbonded.py
openforcefield/openff-interchange
train
39
af03ec9ac10d6e4388997034ccd9215a7e18a820
[ "self.language = language\nself.sum_eng = 0\nself.sum_fre = 0\nself.sum_ger = 0\nself.conn_eng = 0\nself.conn_fre = 0\nself.conn_ger = 0\nself.english_lang_percentage = None\nself.french_lang_percentage = None\nself.german_lang_percentage = None\nself.foreign_percentage = None", "total = self.sum_eng + self.sum_f...
<|body_start_0|> self.language = language self.sum_eng = 0 self.sum_fre = 0 self.sum_ger = 0 self.conn_eng = 0 self.conn_fre = 0 self.conn_ger = 0 self.english_lang_percentage = None self.french_lang_percentage = None self.german_lang_perce...
LanguageSum class
LanguageSum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageSum: """LanguageSum class""" def __init__(self, language): """Constructor""" <|body_0|> def calculate_language_percentages(self): """Calculate percentage for each language""" <|body_1|> def calculate_foreign_percentage(self): """Calcu...
stack_v2_sparse_classes_75kplus_train_069828
4,643
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, language)" }, { "docstring": "Calculate percentage for each language", "name": "calculate_language_percentages", "signature": "def calculate_language_percentages(self)" }, { "docstring": "Calculate...
4
stack_v2_sparse_classes_30k_train_024151
Implement the Python class `LanguageSum` described below. Class description: LanguageSum class Method signatures and docstrings: - def __init__(self, language): Constructor - def calculate_language_percentages(self): Calculate percentage for each language - def calculate_foreign_percentage(self): Calculate percentage...
Implement the Python class `LanguageSum` described below. Class description: LanguageSum class Method signatures and docstrings: - def __init__(self, language): Constructor - def calculate_language_percentages(self): Calculate percentage for each language - def calculate_foreign_percentage(self): Calculate percentage...
a717e6c0fa8d0b3a5787d1536a57c5875ffb5799
<|skeleton|> class LanguageSum: """LanguageSum class""" def __init__(self, language): """Constructor""" <|body_0|> def calculate_language_percentages(self): """Calculate percentage for each language""" <|body_1|> def calculate_foreign_percentage(self): """Calcu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LanguageSum: """LanguageSum class""" def __init__(self, language): """Constructor""" self.language = language self.sum_eng = 0 self.sum_fre = 0 self.sum_ger = 0 self.conn_eng = 0 self.conn_fre = 0 self.conn_ger = 0 self.english_lang_...
the_stack_v2_python_sparse
src/measures/cooccurrence/sum_languages.py
niutyut/author-topic-modeling-project
train
0
601f92dec65beefe5d0cdc00b202c756c69ae660
[ "official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', email='email@email.com', original='original', wechat='wechat')\nrule = Rule.manager.add(official_account=official_account, name='rule test', reply_pattern=Rule.REPLY_PATTERN_ALL)\nkeyword = Keyword.manager.add(rule, keyword=...
<|body_start_0|> official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', email='email@email.com', original='original', wechat='wechat') rule = Rule.manager.add(official_account=official_account, name='rule test', reply_pattern=Rule.REPLY_PATTERN_ALL) keyword = ...
KeywordTest
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordTest: def test_add_keyword(self): """测试添加关键字""" <|body_0|> def test_keyword_search(self): """测试关键字搜索""" <|body_1|> <|end_skeleton|> <|body_start_0|> official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', em...
stack_v2_sparse_classes_75kplus_train_069829
4,271
permissive
[ { "docstring": "测试添加关键字", "name": "test_add_keyword", "signature": "def test_add_keyword(self)" }, { "docstring": "测试关键字搜索", "name": "test_keyword_search", "signature": "def test_keyword_search(self)" } ]
2
stack_v2_sparse_classes_30k_train_014528
Implement the Python class `KeywordTest` described below. Class description: Implement the KeywordTest class. Method signatures and docstrings: - def test_add_keyword(self): 测试添加关键字 - def test_keyword_search(self): 测试关键字搜索
Implement the Python class `KeywordTest` described below. Class description: Implement the KeywordTest class. Method signatures and docstrings: - def test_add_keyword(self): 测试添加关键字 - def test_keyword_search(self): 测试关键字搜索 <|skeleton|> class KeywordTest: def test_add_keyword(self): """测试添加关键字""" ...
37a6cd54584a2e1229c943c569daed7227d9f318
<|skeleton|> class KeywordTest: def test_add_keyword(self): """测试添加关键字""" <|body_0|> def test_keyword_search(self): """测试关键字搜索""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KeywordTest: def test_add_keyword(self): """测试添加关键字""" official_account = OfficialAccount.manager.add(level=OfficialAccount.LEVEL_3, name='name', email='email@email.com', original='original', wechat='wechat') rule = Rule.manager.add(official_account=official_account, name='rule test', ...
the_stack_v2_python_sparse
wechat_platform/system/keyword/tests.py
qiyeboy/wechat-platform
train
1
4192c7eb5cf5d6b12824d203e00b1b7624b5eb5d
[ "elements = self.findElements(locator)\ngoods_titles = []\nfor good_element in elements:\n title = good_element.get_attribute(attribute)\n goods_titles.append(title)\nreturn goods_titles", "goods_titles = self.get_goods_title(locator, attribute)\ngoods_locators = []\nfor title in goods_titles:\n loc = ('...
<|body_start_0|> elements = self.findElements(locator) goods_titles = [] for good_element in elements: title = good_element.get_attribute(attribute) goods_titles.append(title) return goods_titles <|end_body_0|> <|body_start_1|> goods_titles = self.get_goo...
GoodsList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoodsList: def get_goods_title(self, locator, attribute): """获取商品列表的title :param locator: 元组--定位一组元素的定位器 :param attribute: 定位的元素中的属性 :return: goods_titles""" <|body_0|> def get_goods_loc(self, locator, attribute): """获取所有商品列表中所有商品的locator :param locator: 定位一组元素的定位器 :...
stack_v2_sparse_classes_75kplus_train_069830
3,622
no_license
[ { "docstring": "获取商品列表的title :param locator: 元组--定位一组元素的定位器 :param attribute: 定位的元素中的属性 :return: goods_titles", "name": "get_goods_title", "signature": "def get_goods_title(self, locator, attribute)" }, { "docstring": "获取所有商品列表中所有商品的locator :param locator: 定位一组元素的定位器 :param attribute: 定位的元素中的属性 ...
4
stack_v2_sparse_classes_30k_train_024217
Implement the Python class `GoodsList` described below. Class description: Implement the GoodsList class. Method signatures and docstrings: - def get_goods_title(self, locator, attribute): 获取商品列表的title :param locator: 元组--定位一组元素的定位器 :param attribute: 定位的元素中的属性 :return: goods_titles - def get_goods_loc(self, locator, ...
Implement the Python class `GoodsList` described below. Class description: Implement the GoodsList class. Method signatures and docstrings: - def get_goods_title(self, locator, attribute): 获取商品列表的title :param locator: 元组--定位一组元素的定位器 :param attribute: 定位的元素中的属性 :return: goods_titles - def get_goods_loc(self, locator, ...
d66b111e6e75998742d0215a475c66e74d9510e0
<|skeleton|> class GoodsList: def get_goods_title(self, locator, attribute): """获取商品列表的title :param locator: 元组--定位一组元素的定位器 :param attribute: 定位的元素中的属性 :return: goods_titles""" <|body_0|> def get_goods_loc(self, locator, attribute): """获取所有商品列表中所有商品的locator :param locator: 定位一组元素的定位器 :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GoodsList: def get_goods_title(self, locator, attribute): """获取商品列表的title :param locator: 元组--定位一组元素的定位器 :param attribute: 定位的元素中的属性 :return: goods_titles""" elements = self.findElements(locator) goods_titles = [] for good_element in elements: title = good_element.g...
the_stack_v2_python_sparse
page/goods_list_bak.py
dxiaodong/test_web
train
0
b56156379b43fe1b74e6676f88816ba81dbce9cb
[ "self.condset = condset\nself.label = label\nself.condsupCount, self.rulesupCount = self.calculate_supCount(data_list)\nself.confidence = self.calculate_confidence()\nself.support = self.calculate_support(data_list)", "condsupCount = 0\nrulesupCount = 0\nfor data in data_list:\n covered = True\n for index i...
<|body_start_0|> self.condset = condset self.label = label self.condsupCount, self.rulesupCount = self.calculate_supCount(data_list) self.confidence = self.calculate_confidence() self.support = self.calculate_support(data_list) <|end_body_0|> <|body_start_1|> condsupCoun...
Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence.
RuleItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleItem: """Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence.""" def _...
stack_v2_sparse_classes_75kplus_train_069831
2,557
no_license
[ { "docstring": "According to the paper, each frequent k-ruleitems consists of the following: condset: a dictiondary that has key-value pair {\"item name: value, item name: value...}, where the item name are name of the column attributes. condsupCount: the support count of condset rulesupCount: the support count...
4
stack_v2_sparse_classes_30k_train_049277
Implement the Python class `RuleItem` described below. Class description: Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount...
Implement the Python class `RuleItem` described below. Class description: Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount...
afe6e0df81c302ef57e2608ea371025366a64a5f
<|skeleton|> class RuleItem: """Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence.""" def _...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RuleItem: """Build the class RuleItem, including condset, class label y, condsupCount, rulesupCount, support and confidence. Input: condset which include a set of items, label and the data_list. Output: a ruleitem with the value of condsupCount, rulesupCount, support and confidence.""" def __init__(self,...
the_stack_v2_python_sparse
code/ruleitem.py
C190194/Data-Mining-Project-1
train
0
25ba6233707c919214e70d69c8e494349a78a6b3
[ "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...
Service responsible for tracking the catalog of available videos for playback
VideoCatalogServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoCatalogServiceServicer: """Service responsible for tracking the catalog of available videos for playback""" def SubmitUploadedVideo(self, request, context): """Submit an uploaded video to the catalog""" <|body_0|> def SubmitYouTubeVideo(self, request, context): ...
stack_v2_sparse_classes_75kplus_train_069832
6,834
permissive
[ { "docstring": "Submit an uploaded video to the catalog", "name": "SubmitUploadedVideo", "signature": "def SubmitUploadedVideo(self, request, context)" }, { "docstring": "Submit a YouTube video to the catalog", "name": "SubmitYouTubeVideo", "signature": "def SubmitYouTubeVideo(self, requ...
6
stack_v2_sparse_classes_30k_train_017027
Implement the Python class `VideoCatalogServiceServicer` described below. Class description: Service responsible for tracking the catalog of available videos for playback Method signatures and docstrings: - def SubmitUploadedVideo(self, request, context): Submit an uploaded video to the catalog - def SubmitYouTubeVid...
Implement the Python class `VideoCatalogServiceServicer` described below. Class description: Service responsible for tracking the catalog of available videos for playback Method signatures and docstrings: - def SubmitUploadedVideo(self, request, context): Submit an uploaded video to the catalog - def SubmitYouTubeVid...
55a610c97fd53c405edb2459c2722fc03857cb83
<|skeleton|> class VideoCatalogServiceServicer: """Service responsible for tracking the catalog of available videos for playback""" def SubmitUploadedVideo(self, request, context): """Submit an uploaded video to the catalog""" <|body_0|> def SubmitYouTubeVideo(self, request, context): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VideoCatalogServiceServicer: """Service responsible for tracking the catalog of available videos for playback""" def SubmitUploadedVideo(self, request, context): """Submit an uploaded video to the catalog""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Meth...
the_stack_v2_python_sparse
killrvideo/video_catalog/video_catalog_service_pb2_grpc.py
krzysztof-adamski/killrvideo-python
train
0
e0f920da3a83d2c2b10d4043c789f6ff55526800
[ "self.n_estimators = n_estimators\nself.max_depth = max_depth\nself.feature_subsample_size = feature_subsample_size", "if self.feature_subsample_size is None:\n self.feature_subsample_size = 1 / 3\nif X_val is None or y_val is None:\n train_size = int(0.7 * X.shape[0])\n X_train = X[:train_size, :]\n ...
<|body_start_0|> self.n_estimators = n_estimators self.max_depth = max_depth self.feature_subsample_size = feature_subsample_size <|end_body_0|> <|body_start_1|> if self.feature_subsample_size is None: self.feature_subsample_size = 1 / 3 if X_val is None or y_val is ...
RandomForestMSE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomForestMSE: def __init__(self, n_estimators, max_depth=None, feature_subsample_size=None, **trees_parameters): """n_estimators : int The number of trees in the forest. max_depth : int The maximum depth of the tree. If None then there is no limits. feature_subsample_size : float The ...
stack_v2_sparse_classes_75kplus_train_069833
2,740
no_license
[ { "docstring": "n_estimators : int The number of trees in the forest. max_depth : int The maximum depth of the tree. If None then there is no limits. feature_subsample_size : float The size of feature set for each tree. If None then use recommendations.", "name": "__init__", "signature": "def __init__(s...
3
null
Implement the Python class `RandomForestMSE` described below. Class description: Implement the RandomForestMSE class. Method signatures and docstrings: - def __init__(self, n_estimators, max_depth=None, feature_subsample_size=None, **trees_parameters): n_estimators : int The number of trees in the forest. max_depth :...
Implement the Python class `RandomForestMSE` described below. Class description: Implement the RandomForestMSE class. Method signatures and docstrings: - def __init__(self, n_estimators, max_depth=None, feature_subsample_size=None, **trees_parameters): n_estimators : int The number of trees in the forest. max_depth :...
a99cf29644ef9b2907054729c3c0204e61c34ee5
<|skeleton|> class RandomForestMSE: def __init__(self, n_estimators, max_depth=None, feature_subsample_size=None, **trees_parameters): """n_estimators : int The number of trees in the forest. max_depth : int The maximum depth of the tree. If None then there is no limits. feature_subsample_size : float The ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomForestMSE: def __init__(self, n_estimators, max_depth=None, feature_subsample_size=None, **trees_parameters): """n_estimators : int The number of trees in the forest. max_depth : int The maximum depth of the tree. If None then there is no limits. feature_subsample_size : float The size of featur...
the_stack_v2_python_sparse
ensembles/random_forest_mse.py
KachuraAlexandr/ml_algorithms
train
0
79418741c3bd76d3637383eccda33b311f0e6144
[ "self._schema = schema\nself._provider = provider\nself._provider_uuid = str(self._provider.uuid)\nself._manifest = manifest\nself._date_accessor = DateAccessor()", "infra_map = {}\nwith ProviderDBAccessor(self._provider.uuid) as provider_accessor:\n if self._provider.type == Provider.PROVIDER_OCP:\n in...
<|body_start_0|> self._schema = schema self._provider = provider self._provider_uuid = str(self._provider.uuid) self._manifest = manifest self._date_accessor = DateAccessor() <|end_body_0|> <|body_start_1|> infra_map = {} with ProviderDBAccessor(self._provider.uu...
Base class for OpenShift on cloud infrastructure operations.
OCPCloudUpdaterBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OCPCloudUpdaterBase: """Base class for OpenShift on cloud infrastructure operations.""" def __init__(self, schema, provider, manifest): """Initialize the class. Args: schema (str) The customer schema to associate with. provider (Provider db object) Database object for Provider. manif...
stack_v2_sparse_classes_75kplus_train_069834
7,325
permissive
[ { "docstring": "Initialize the class. Args: schema (str) The customer schema to associate with. provider (Provider db object) Database object for Provider. manifest (str) The manifest to work with. Returns: None", "name": "__init__", "signature": "def __init__(self, schema, provider, manifest)" }, {...
6
stack_v2_sparse_classes_30k_train_015725
Implement the Python class `OCPCloudUpdaterBase` described below. Class description: Base class for OpenShift on cloud infrastructure operations. Method signatures and docstrings: - def __init__(self, schema, provider, manifest): Initialize the class. Args: schema (str) The customer schema to associate with. provider...
Implement the Python class `OCPCloudUpdaterBase` described below. Class description: Base class for OpenShift on cloud infrastructure operations. Method signatures and docstrings: - def __init__(self, schema, provider, manifest): Initialize the class. Args: schema (str) The customer schema to associate with. provider...
0416e5216eb1ec4b41c8dd4999adde218b1ab2e1
<|skeleton|> class OCPCloudUpdaterBase: """Base class for OpenShift on cloud infrastructure operations.""" def __init__(self, schema, provider, manifest): """Initialize the class. Args: schema (str) The customer schema to associate with. provider (Provider db object) Database object for Provider. manif...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OCPCloudUpdaterBase: """Base class for OpenShift on cloud infrastructure operations.""" def __init__(self, schema, provider, manifest): """Initialize the class. Args: schema (str) The customer schema to associate with. provider (Provider db object) Database object for Provider. manifest (str) The...
the_stack_v2_python_sparse
koku/masu/processor/ocp/ocp_cloud_updater_base.py
project-koku/koku
train
225
cf220edcc0b38784d639e8c22fc16fae5eb008b0
[ "errors = {}\nuser = attrs['user']\nnew_email = attrs['new_email']\npassword = attrs.pop('password')\nif user.email == new_email:\n errors['email'] = 'Provided email address is same as your current one'\nelif User.objects.filter(email=new_email).exists():\n errors['email'] = 'Invalid email address'\nif errors...
<|body_start_0|> errors = {} user = attrs['user'] new_email = attrs['new_email'] password = attrs.pop('password') if user.email == new_email: errors['email'] = 'Provided email address is same as your current one' elif User.objects.filter(email=new_email).exist...
Serializer for starting a user email change
ChangeEmailRequestCreateSerializer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChangeEmailRequestCreateSerializer: """Serializer for starting a user email change""" def validate(self, attrs): """Validate the change request""" <|body_0|> def create(self, validated_data): """Create the email change request""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus_train_069835
16,669
permissive
[ { "docstring": "Validate the change request", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "Create the email change request", "name": "create", "signature": "def create(self, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_015963
Implement the Python class `ChangeEmailRequestCreateSerializer` described below. Class description: Serializer for starting a user email change Method signatures and docstrings: - def validate(self, attrs): Validate the change request - def create(self, validated_data): Create the email change request
Implement the Python class `ChangeEmailRequestCreateSerializer` described below. Class description: Serializer for starting a user email change Method signatures and docstrings: - def validate(self, attrs): Validate the change request - def create(self, validated_data): Create the email change request <|skeleton|> c...
c5d9cda4e1ed87463da74d7956f1e1f9258f365c
<|skeleton|> class ChangeEmailRequestCreateSerializer: """Serializer for starting a user email change""" def validate(self, attrs): """Validate the change request""" <|body_0|> def create(self, validated_data): """Create the email change request""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChangeEmailRequestCreateSerializer: """Serializer for starting a user email change""" def validate(self, attrs): """Validate the change request""" errors = {} user = attrs['user'] new_email = attrs['new_email'] password = attrs.pop('password') if user.email...
the_stack_v2_python_sparse
users/serializers.py
mitodl/mitxpro
train
12
a902cb7f01dee9967ab0b38ddfd4acaa4af4c307
[ "self.mean = []\nself.std = []\nself.d = []\nself.h = []\nself.w = []", "self.mean.append(mean)\nself.std.append(std)\nself.d.append(d)\nself.h.append(h)\nself.w.append(w)", "self.mean = np.median(np.array(self.mean))\nself.std = np.median(np.array(self.std))\nself.d = np.median(np.array(self.d))\nself.h = np.m...
<|body_start_0|> self.mean = [] self.std = [] self.d = [] self.h = [] self.w = [] <|end_body_0|> <|body_start_1|> self.mean.append(mean) self.std.append(std) self.d.append(d) self.h.append(h) self.w.append(w) <|end_body_1|> <|body_start_2...
A class collecting value distribution of preprocessed images in KiTS19 dataset Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collects depths of the preprocessed images h: collects heights of the preproces...
Stats
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Stats: """A class collecting value distribution of preprocessed images in KiTS19 dataset Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collects depths of the preprocessed images h: ...
stack_v2_sparse_classes_75kplus_train_069836
23,958
permissive
[ { "docstring": "Initiates all the attributes Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collects depths of the preprocessed images h: collects heights of the preprocessed images w: collects wid...
3
stack_v2_sparse_classes_30k_train_028419
Implement the Python class `Stats` described below. Class description: A class collecting value distribution of preprocessed images in KiTS19 dataset Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collect...
Implement the Python class `Stats` described below. Class description: A class collecting value distribution of preprocessed images in KiTS19 dataset Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collect...
c540fcc99eeacfb5c51de8daa0f8cca339f50799
<|skeleton|> class Stats: """A class collecting value distribution of preprocessed images in KiTS19 dataset Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collects depths of the preprocessed images h: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Stats: """A class collecting value distribution of preprocessed images in KiTS19 dataset Attributes ---------- mean: list collects average values in the preprocessed images std: list collects standard deviation of values in the preprocessed images d: collects depths of the preprocessed images h: collects heig...
the_stack_v2_python_sparse
vision/medical_imaging/3d-unet-kits19/preprocess.py
mlcommons/inference
train
575
3bd98f5a6fa74cb053cd96ea35c8e5802c83ea03
[ "super().__init__(dtype=dtype)\nself.dq_networks = dq_networks\nself.df = df", "states, acts, rewards, next_states, next_states_idx = batch\ntarget_values = torch.tensor(rewards, dtype=self.dtype)\nwith torch.no_grad():\n actions = self.dq_networks.predict_values(next_states).argmax(dim=1).unsqueeze(1)\n q_...
<|body_start_0|> super().__init__(dtype=dtype) self.dq_networks = dq_networks self.df = df <|end_body_0|> <|body_start_1|> states, acts, rewards, next_states, next_states_idx = batch target_values = torch.tensor(rewards, dtype=self.dtype) with torch.no_grad(): ...
Implementation of the Double Q Network technique for computing the targets.
DoubleQTargetComputer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoubleQTargetComputer: """Implementation of the Double Q Network technique for computing the targets.""" def __init__(self, dq_networks, df=0.99, dtype=torch.float): """Instantiate the double Q-learning target computer. Args: dq_networks (core.deepq.deepqnetworks.BaseDQNetworks): The...
stack_v2_sparse_classes_75kplus_train_069837
17,945
permissive
[ { "docstring": "Instantiate the double Q-learning target computer. Args: dq_networks (core.deepq.deepqnetworks.BaseDQNetworks): The DQNetworks object that will be used to compute the targets. df (float): The discount factor dtype (torch.dtype): Type to be used in computations.", "name": "__init__", "sig...
2
null
Implement the Python class `DoubleQTargetComputer` described below. Class description: Implementation of the Double Q Network technique for computing the targets. Method signatures and docstrings: - def __init__(self, dq_networks, df=0.99, dtype=torch.float): Instantiate the double Q-learning target computer. Args: d...
Implement the Python class `DoubleQTargetComputer` described below. Class description: Implementation of the Double Q Network technique for computing the targets. Method signatures and docstrings: - def __init__(self, dq_networks, df=0.99, dtype=torch.float): Instantiate the double Q-learning target computer. Args: d...
f03f0e68577d45ec1b8a355f79283c8483dc96fc
<|skeleton|> class DoubleQTargetComputer: """Implementation of the Double Q Network technique for computing the targets.""" def __init__(self, dq_networks, df=0.99, dtype=torch.float): """Instantiate the double Q-learning target computer. Args: dq_networks (core.deepq.deepqnetworks.BaseDQNetworks): The...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DoubleQTargetComputer: """Implementation of the Double Q Network technique for computing the targets.""" def __init__(self, dq_networks, df=0.99, dtype=torch.float): """Instantiate the double Q-learning target computer. Args: dq_networks (core.deepq.deepqnetworks.BaseDQNetworks): The DQNetworks o...
the_stack_v2_python_sparse
deepq/computations.py
fedetask/des-rl
train
0
9cd07baabf121b4308920111fcd06bf36cee3509
[ "super(CustomBatchNormManualModule, self).__init__()\nself.n_neurons = n_neurons\nself.eps = eps\nself.gamma = nn.Parameter(torch.ones(self.n_neurons))\nself.beta = nn.Parameter(torch.zeros(self.n_neurons))", "n_batch = n_neurons = input.shape\nassert n_neurons == self.n_neurons\nCBNMF = CustomBatchNormManualFunc...
<|body_start_0|> super(CustomBatchNormManualModule, self).__init__() self.n_neurons = n_neurons self.eps = eps self.gamma = nn.Parameter(torch.ones(self.n_neurons)) self.beta = nn.Parameter(torch.zeros(self.n_neurons)) <|end_body_0|> <|body_start_1|> n_batch = n_neurons ...
This nn.module implements a custom version of the batch norm operation for MLPs. In self.forward the functional version CustomBatchNormManualFunction.forward is called. The automatic differentiation of PyTorch calls the backward method of this function in the backward pass.
CustomBatchNormManualModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomBatchNormManualModule: """This nn.module implements a custom version of the batch norm operation for MLPs. In self.forward the functional version CustomBatchNormManualFunction.forward is called. The automatic differentiation of PyTorch calls the backward method of this function in the backw...
stack_v2_sparse_classes_75kplus_train_069838
9,723
no_license
[ { "docstring": "Initializes CustomBatchNormManualModule object. Args: n_neurons: int specifying the number of neurons eps: small float to be added to the variance for stability TODONE: Save parameters for the number of neurons and eps. Initialize parameters gamma and beta via nn.Parameter", "name": "__init_...
2
stack_v2_sparse_classes_30k_train_012050
Implement the Python class `CustomBatchNormManualModule` described below. Class description: This nn.module implements a custom version of the batch norm operation for MLPs. In self.forward the functional version CustomBatchNormManualFunction.forward is called. The automatic differentiation of PyTorch calls the backwa...
Implement the Python class `CustomBatchNormManualModule` described below. Class description: This nn.module implements a custom version of the batch norm operation for MLPs. In self.forward the functional version CustomBatchNormManualFunction.forward is called. The automatic differentiation of PyTorch calls the backwa...
3cbafe29793af1eb14b6b23b15d5e1d8a056be9c
<|skeleton|> class CustomBatchNormManualModule: """This nn.module implements a custom version of the batch norm operation for MLPs. In self.forward the functional version CustomBatchNormManualFunction.forward is called. The automatic differentiation of PyTorch calls the backward method of this function in the backw...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomBatchNormManualModule: """This nn.module implements a custom version of the batch norm operation for MLPs. In self.forward the functional version CustomBatchNormManualFunction.forward is called. The automatic differentiation of PyTorch calls the backward method of this function in the backward pass.""" ...
the_stack_v2_python_sparse
assignment_1/code/custom_batchnorm.py
sgraaf/uvadlc_practicals_2019
train
0
52e41a409888944d97dfbde4c3153b4bd5f89910
[ "pg = self.usr.getPage('http://www.neopets.com/haggle.phtml?obj_info_id=%s&stock_id=%s&brr=%s' % (self.id, self.stockid, self.brr))\nform = pg.form(name='haggleform')\nform['x'], form['y'] = self.crackOCR(StringIO.StringIO(self.usr.getPage('http://www.neopets.com' + form.image).content))\nform['current_offer'] = pr...
<|body_start_0|> pg = self.usr.getPage('http://www.neopets.com/haggle.phtml?obj_info_id=%s&stock_id=%s&brr=%s' % (self.id, self.stockid, self.brr)) form = pg.form(name='haggleform') form['x'], form['y'] = self.crackOCR(StringIO.StringIO(self.usr.getPage('http://www.neopets.com' + form.image).con...
Represents a main shop item Contains functionality for purchasing a main shop item including cracking it's associated OCR. Attributes stockid (str) -- The item's stock ID brr (str) -- Item's brr Initialization See Item Example >>> itm = MainShopItem("Green Apple") >>> itm.usr = usr >>> itm.stockid = "37483739" >>> itm....
MainShopItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainShopItem: """Represents a main shop item Contains functionality for purchasing a main shop item including cracking it's associated OCR. Attributes stockid (str) -- The item's stock ID brr (str) -- Item's brr Initialization See Item Example >>> itm = MainShopItem("Green Apple") >>> itm.usr = u...
stack_v2_sparse_classes_75kplus_train_069839
3,331
permissive
[ { "docstring": "Attempts to purchase a main shop item, returns result Uses the item's stock id and brr to navigate to the haggle page. Auotmatically downloads the OCR image from the haggle page and attempts to crack it. Submits the haggle form with the given price and returns if the item was successfully bought...
2
stack_v2_sparse_classes_30k_train_003106
Implement the Python class `MainShopItem` described below. Class description: Represents a main shop item Contains functionality for purchasing a main shop item including cracking it's associated OCR. Attributes stockid (str) -- The item's stock ID brr (str) -- Item's brr Initialization See Item Example >>> itm = Main...
Implement the Python class `MainShopItem` described below. Class description: Represents a main shop item Contains functionality for purchasing a main shop item including cracking it's associated OCR. Attributes stockid (str) -- The item's stock ID brr (str) -- Item's brr Initialization See Item Example >>> itm = Main...
38894157a8a3e64b6a15b3a6298490436198fc15
<|skeleton|> class MainShopItem: """Represents a main shop item Contains functionality for purchasing a main shop item including cracking it's associated OCR. Attributes stockid (str) -- The item's stock ID brr (str) -- Item's brr Initialization See Item Example >>> itm = MainShopItem("Green Apple") >>> itm.usr = u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MainShopItem: """Represents a main shop item Contains functionality for purchasing a main shop item including cracking it's associated OCR. Attributes stockid (str) -- The item's stock ID brr (str) -- Item's brr Initialization See Item Example >>> itm = MainShopItem("Green Apple") >>> itm.usr = usr >>> itm.st...
the_stack_v2_python_sparse
neolib/item/MainShopItem.py
HenryHoward/Neolib
train
0
4328f20147e7ecc239a45c870425bf0cc6010670
[ "self.__rutacen = monolib.validapath(rutafolder)\nself.__fecha = datetime.datetime.now()\nself._ruta7z = self.__rutacen + exefolder + '7z.exe'\nself.__debugmode = debugmode", "if not zipfile:\n zipfile = self.userftp\nself.arczip = self.comlib.nomarc(zipfile + '-', self.fecha, '.7z')\nself.resbdzip = self.arch...
<|body_start_0|> self.__rutacen = monolib.validapath(rutafolder) self.__fecha = datetime.datetime.now() self._ruta7z = self.__rutacen + exefolder + '7z.exe' self.__debugmode = debugmode <|end_body_0|> <|body_start_1|> if not zipfile: zipfile = self.userftp se...
Clase para comprimir los archivos en un archivo .7z
genzipfile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class genzipfile: """Clase para comprimir los archivos en un archivo .7z""" def __init__(self, rutafolder=None, exefolder='bin/', debugmode=False): """Metodo inicial de genzipfile""" <|body_0|> def zipfiles(self, orifile=None, zipfile=None, metodo='7z'): """Aqui se com...
stack_v2_sparse_classes_75kplus_train_069840
20,354
no_license
[ { "docstring": "Metodo inicial de genzipfile", "name": "__init__", "signature": "def __init__(self, rutafolder=None, exefolder='bin/', debugmode=False)" }, { "docstring": "Aqui se comprimen los archivos de una carpeta en un archivo .7z", "name": "zipfiles", "signature": "def zipfiles(sel...
2
stack_v2_sparse_classes_30k_train_004461
Implement the Python class `genzipfile` described below. Class description: Clase para comprimir los archivos en un archivo .7z Method signatures and docstrings: - def __init__(self, rutafolder=None, exefolder='bin/', debugmode=False): Metodo inicial de genzipfile - def zipfiles(self, orifile=None, zipfile=None, meto...
Implement the Python class `genzipfile` described below. Class description: Clase para comprimir los archivos en un archivo .7z Method signatures and docstrings: - def __init__(self, rutafolder=None, exefolder='bin/', debugmode=False): Metodo inicial de genzipfile - def zipfiles(self, orifile=None, zipfile=None, meto...
1d0fdee39a7fe85a7788a635c809377d27d76dd6
<|skeleton|> class genzipfile: """Clase para comprimir los archivos en un archivo .7z""" def __init__(self, rutafolder=None, exefolder='bin/', debugmode=False): """Metodo inicial de genzipfile""" <|body_0|> def zipfiles(self, orifile=None, zipfile=None, metodo='7z'): """Aqui se com...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class genzipfile: """Clase para comprimir los archivos en un archivo .7z""" def __init__(self, rutafolder=None, exefolder='bin/', debugmode=False): """Metodo inicial de genzipfile""" self.__rutacen = monolib.validapath(rutafolder) self.__fecha = datetime.datetime.now() self._rut...
the_stack_v2_python_sparse
lib/respaldo.py
wixard00/syncloud410
train
0
06187c02b36039b69d67b96df26d6161fbd02248
[ "n = len(ratings)\nres = [1] * n\nmin_index = ratings.index(min(ratings))\nfor i in range(min_index + 1, n):\n if ratings[i] > ratings[i - 1]:\n res[i] = res[i - 1] + 1\n else:\n j = i\n while ratings[j] < ratings[j - 1]:\n res[j - 1] = max(res[j - 1], res[j] + 1)\n ...
<|body_start_0|> n = len(ratings) res = [1] * n min_index = ratings.index(min(ratings)) for i in range(min_index + 1, n): if ratings[i] > ratings[i - 1]: res[i] = res[i - 1] + 1 else: j = i while ratings[j] < ratings...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def candy(self, ratings): """和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int""" <|body_0|> def candy3(self, ratings): """先给每个人一个糖,初始化tmp数组为额外糖果。 从左向右遍历,如果i+1分数高,tmp[i+1]=tmp[i]+1。 再从后往前遍历,如果i比i+1分数高,那么比较tm...
stack_v2_sparse_classes_75kplus_train_069841
2,881
no_license
[ { "docstring": "和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int", "name": "candy", "signature": "def candy(self, ratings)" }, { "docstring": "先给每个人一个糖,初始化tmp数组为额外糖果。 从左向右遍历,如果i+1分数高,tmp[i+1]=tmp[i]+1。 再从后往前遍历,如果i比i+1分数高,那么比较tmp[i]和tmp[i+1]+1,如果...
2
stack_v2_sparse_classes_30k_train_025307
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def candy(self, ratings): 和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int - def candy3(self, ratings): 先给每个人一个糖,初始化tmp数组为额外糖果。...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def candy(self, ratings): 和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int - def candy3(self, ratings): 先给每个人一个糖,初始化tmp数组为额外糖果。...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def candy(self, ratings): """和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int""" <|body_0|> def candy3(self, ratings): """先给每个人一个糖,初始化tmp数组为额外糖果。 从左向右遍历,如果i+1分数高,tmp[i+1]=tmp[i]+1。 再从后往前遍历,如果i比i+1分数高,那么比较tm...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def candy(self, ratings): """和字节跳动2019春招第一轮笔试第三题基本一样 还是要多刷leetcode 要是笔试做过这个就不拿到题的时候一脸懵逼了Orz :type ratings: List[int] :rtype: int""" n = len(ratings) res = [1] * n min_index = ratings.index(min(ratings)) for i in range(min_index + 1, n): if ratings[...
the_stack_v2_python_sparse
135_分发糖果.py
lovehhf/LeetCode
train
0
1875a85d9c666a213aee953439fe52d961adcdf5
[ "if root.left:\n self.helper(result, root.left)\nif root.right:\n self.helper(result, root.right)\nresult.append(root.val)", "result = []\nif not root:\n return result\nself.helper(result, root)\nreturn result" ]
<|body_start_0|> if root.left: self.helper(result, root.left) if root.right: self.helper(result, root.right) result.append(root.val) <|end_body_0|> <|body_start_1|> result = [] if not root: return result self.helper(result, root) ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def helper(self, result: List[int], root: TreeNode): """帮助方法 Args: result: 结果集 root: 根节点""" <|body_0|> def post_order_traversal(self, root: TreeNode) -> List[int]: """后序遍历 Args: res: 链表 root: 根节点""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_069842
1,876
permissive
[ { "docstring": "帮助方法 Args: result: 结果集 root: 根节点", "name": "helper", "signature": "def helper(self, result: List[int], root: TreeNode)" }, { "docstring": "后序遍历 Args: res: 链表 root: 根节点", "name": "post_order_traversal", "signature": "def post_order_traversal(self, root: TreeNode) -> List[i...
2
stack_v2_sparse_classes_30k_train_033016
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, result: List[int], root: TreeNode): 帮助方法 Args: result: 结果集 root: 根节点 - def post_order_traversal(self, root: TreeNode) -> List[int]: 后序遍历 Args: res: 链表 root: 根节点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, result: List[int], root: TreeNode): 帮助方法 Args: result: 结果集 root: 根节点 - def post_order_traversal(self, root: TreeNode) -> List[int]: 后序遍历 Args: res: 链表 root: 根节点 ...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def helper(self, result: List[int], root: TreeNode): """帮助方法 Args: result: 结果集 root: 根节点""" <|body_0|> def post_order_traversal(self, root: TreeNode) -> List[int]: """后序遍历 Args: res: 链表 root: 根节点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def helper(self, result: List[int], root: TreeNode): """帮助方法 Args: result: 结果集 root: 根节点""" if root.left: self.helper(result, root.left) if root.right: self.helper(result, root.right) result.append(root.val) def post_order_traversal(self, ...
the_stack_v2_python_sparse
src/leetcodepython/tree/postorder_traversal_145.py
zhangyu345293721/leetcode
train
101
4338349006b59381947f257b5f76d6141117adaa
[ "self.first_winter = {'u': Dataset(first_winter_u_name), 't': Dataset(first_winter_t_name)}\nn_days = len(self.first_winter['u']['time'][:].data)\nself.start_day = n_days - self.DAYS_BEFORE_START_DAY\nself.second_winter = {'u': Dataset(second_winter_u_name), 't': Dataset(second_winter_t_name)}", "winter = self.ge...
<|body_start_0|> self.first_winter = {'u': Dataset(first_winter_u_name), 't': Dataset(first_winter_t_name)} n_days = len(self.first_winter['u']['time'][:].data) self.start_day = n_days - self.DAYS_BEFORE_START_DAY self.second_winter = {'u': Dataset(second_winter_u_name), 't': Dataset(sec...
A class to preprocess the real data from the JRA-55 dataset. It takes two years from the dataset and returns the variables of interest for a whole winter.
PreprocessorReal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreprocessorReal: """A class to preprocess the real data from the JRA-55 dataset. It takes two years from the dataset and returns the variables of interest for a whole winter.""" def __init__(self, first_winter_u_name, second_winter_u_name, first_winter_t_name, second_winter_t_name): ...
stack_v2_sparse_classes_75kplus_train_069843
9,018
no_license
[ { "docstring": "Initializer for PreprocessorReal class. As we have separate files for each input feature, we need to specify a different file name for each feature and year. :param first_winter_u_name: The path of the .nc file of the first winter's wind (u component) :param second_winter_u_name: The path of the...
6
stack_v2_sparse_classes_30k_train_037132
Implement the Python class `PreprocessorReal` described below. Class description: A class to preprocess the real data from the JRA-55 dataset. It takes two years from the dataset and returns the variables of interest for a whole winter. Method signatures and docstrings: - def __init__(self, first_winter_u_name, secon...
Implement the Python class `PreprocessorReal` described below. Class description: A class to preprocess the real data from the JRA-55 dataset. It takes two years from the dataset and returns the variables of interest for a whole winter. Method signatures and docstrings: - def __init__(self, first_winter_u_name, secon...
d7e42676b64d177ded11d4731e11130c129d477b
<|skeleton|> class PreprocessorReal: """A class to preprocess the real data from the JRA-55 dataset. It takes two years from the dataset and returns the variables of interest for a whole winter.""" def __init__(self, first_winter_u_name, second_winter_u_name, first_winter_t_name, second_winter_t_name): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PreprocessorReal: """A class to preprocess the real data from the JRA-55 dataset. It takes two years from the dataset and returns the variables of interest for a whole winter.""" def __init__(self, first_winter_u_name, second_winter_u_name, first_winter_t_name, second_winter_t_name): """Initializ...
the_stack_v2_python_sparse
code/preprocessing/preprocessor_real.py
mcbuehler/ssw-prediction
train
1
bd2bd6913d3f04184a9419673d2fb8679b662072
[ "super(ServerSelectionFrame, self).__init__(parent)\nself.parent = parent\nTkinter.Label(self, text='Nickname:').grid(row=0, column=0)\nTkinter.Label(self, text='Servers:').grid(row=1, column=0)\nself.nickname_input = Tkinter.Entry(self, width=10)\nself.nickname_input.grid(row=0, column=1)\nself.servers_listbox = T...
<|body_start_0|> super(ServerSelectionFrame, self).__init__(parent) self.parent = parent Tkinter.Label(self, text='Nickname:').grid(row=0, column=0) Tkinter.Label(self, text='Servers:').grid(row=1, column=0) self.nickname_input = Tkinter.Entry(self, width=10) self.nicknam...
ServerSelectionFrame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerSelectionFrame: def __init__(self, parent): """Displays a list of available game servers. Allows to choose the nickname and join selected game server. Args: parent (RootWindow):""" <|body_0|> def toggle_join_button(self, event=None): """Disable/enable the join_...
stack_v2_sparse_classes_75kplus_train_069844
30,750
no_license
[ { "docstring": "Displays a list of available game servers. Allows to choose the nickname and join selected game server. Args: parent (RootWindow):", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Disable/enable the join_button", "name": "toggle_join_button",...
4
stack_v2_sparse_classes_30k_train_028759
Implement the Python class `ServerSelectionFrame` described below. Class description: Implement the ServerSelectionFrame class. Method signatures and docstrings: - def __init__(self, parent): Displays a list of available game servers. Allows to choose the nickname and join selected game server. Args: parent (RootWind...
Implement the Python class `ServerSelectionFrame` described below. Class description: Implement the ServerSelectionFrame class. Method signatures and docstrings: - def __init__(self, parent): Displays a list of available game servers. Allows to choose the nickname and join selected game server. Args: parent (RootWind...
e3a24f7449f8449c6d462cee13b135407d343608
<|skeleton|> class ServerSelectionFrame: def __init__(self, parent): """Displays a list of available game servers. Allows to choose the nickname and join selected game server. Args: parent (RootWindow):""" <|body_0|> def toggle_join_button(self, event=None): """Disable/enable the join_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ServerSelectionFrame: def __init__(self, parent): """Displays a list of available game servers. Allows to choose the nickname and join selected game server. Args: parent (RootWindow):""" super(ServerSelectionFrame, self).__init__(parent) self.parent = parent Tkinter.Label(self,...
the_stack_v2_python_sparse
src/client/gui.py
markus93/DSHomework2
train
0
4e3e9e8730cfd84c5ebcbb0e960f2edca827b38f
[ "super(STNLICls, self).__init__()\nself.enc = StarTransEnc(embed=embed, hidden_size=hidden_size, num_layers=num_layers, num_head=num_head, head_dim=head_dim, max_len=max_len, emb_dropout=emb_dropout, dropout=dropout)\nself.cls = _NLICls(hidden_size, num_cls, cls_hidden_size)", "mask1 = seq_len_to_mask(seq_len1)\n...
<|body_start_0|> super(STNLICls, self).__init__() self.enc = StarTransEnc(embed=embed, hidden_size=hidden_size, num_layers=num_layers, num_head=num_head, head_dim=head_dim, max_len=max_len, emb_dropout=emb_dropout, dropout=dropout) self.cls = _NLICls(hidden_size, num_cls, cls_hidden_size) <|end_...
用于自然语言推断(NLI)的Star-Transformer
STNLICls
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class STNLICls: """用于自然语言推断(NLI)的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大...
stack_v2_sparse_classes_75kplus_train_069845
11,601
permissive
[ { "docstring": ":param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以传入 nn.Embedding 对象, 此时就以传入的对象作为embedding :param num_cls: 输出类别个数 :param hidden_size: 模型中特征维度. Default: 300 :param num_layers: 模型层数. Default: 4 :param num_head: 模型中multi-head的head个数. Default: 8 :param head_d...
3
stack_v2_sparse_classes_30k_train_046073
Implement the Python class `STNLICls` described below. Class description: 用于自然语言推断(NLI)的Star-Transformer Method signatures and docstrings: - def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): :param embed: 单词词典, 可...
Implement the Python class `STNLICls` described below. Class description: 用于自然语言推断(NLI)的Star-Transformer Method signatures and docstrings: - def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): :param embed: 单词词典, 可...
dffc7a06cdbff2671a3ca73d2398159d91a4a7db
<|skeleton|> class STNLICls: """用于自然语言推断(NLI)的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class STNLICls: """用于自然语言推断(NLI)的Star-Transformer""" def __init__(self, embed, num_cls, hidden_size=300, num_layers=4, num_head=8, head_dim=32, max_len=512, cls_hidden_size=600, emb_dropout=0.1, dropout=0.1): """:param embed: 单词词典, 可以是 tuple, 包括(num_embedings, embedding_dim), 即 embedding的大小和每个词的维度. 也可以...
the_stack_v2_python_sparse
phenobert/utils/fastNLP/models/star_transformer.py
TianlabTech/PhenoBERT
train
2
d8aea79de87230b003b9173741bd87b8af94eef2
[ "book = xlrd.open_workbook(filepath)\ntable = book.sheet_by_name('任保玉')\nrow_Num = table.nrows\ncol_Num = table.ncols\ns = []\nkey = table.row_values(0)\nif row_Num <= 1:\n print('没数据')\nelse:\n j = 1\n for i in range(row_Num - 1):\n d = {}\n values = table.row_values(j)\n for x in ran...
<|body_start_0|> book = xlrd.open_workbook(filepath) table = book.sheet_by_name('任保玉') row_Num = table.nrows col_Num = table.ncols s = [] key = table.row_values(0) if row_Num <= 1: print('没数据') else: j = 1 for i in range...
ExcelGroup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExcelGroup: def readExcel(filepath): """打开excel表,读取数据并转换成数组对象""" <|body_0|> def merge_dict(detail_list): """根据手机号分组数据""" <|body_1|> def writeText(filePath, groupList): """把数据写入txt文件""" <|body_2|> def readText(filePath): """读取...
stack_v2_sparse_classes_75kplus_train_069846
2,496
no_license
[ { "docstring": "打开excel表,读取数据并转换成数组对象", "name": "readExcel", "signature": "def readExcel(filepath)" }, { "docstring": "根据手机号分组数据", "name": "merge_dict", "signature": "def merge_dict(detail_list)" }, { "docstring": "把数据写入txt文件", "name": "writeText", "signature": "def write...
4
stack_v2_sparse_classes_30k_test_000644
Implement the Python class `ExcelGroup` described below. Class description: Implement the ExcelGroup class. Method signatures and docstrings: - def readExcel(filepath): 打开excel表,读取数据并转换成数组对象 - def merge_dict(detail_list): 根据手机号分组数据 - def writeText(filePath, groupList): 把数据写入txt文件 - def readText(filePath): 读取txt文件内的数据
Implement the Python class `ExcelGroup` described below. Class description: Implement the ExcelGroup class. Method signatures and docstrings: - def readExcel(filepath): 打开excel表,读取数据并转换成数组对象 - def merge_dict(detail_list): 根据手机号分组数据 - def writeText(filePath, groupList): 把数据写入txt文件 - def readText(filePath): 读取txt文件内的数据...
069a895f2b98d3dc817be9eca74009f6bd668fbd
<|skeleton|> class ExcelGroup: def readExcel(filepath): """打开excel表,读取数据并转换成数组对象""" <|body_0|> def merge_dict(detail_list): """根据手机号分组数据""" <|body_1|> def writeText(filePath, groupList): """把数据写入txt文件""" <|body_2|> def readText(filePath): """读取...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExcelGroup: def readExcel(filepath): """打开excel表,读取数据并转换成数组对象""" book = xlrd.open_workbook(filepath) table = book.sheet_by_name('任保玉') row_Num = table.nrows col_Num = table.ncols s = [] key = table.row_values(0) if row_Num <= 1: print...
the_stack_v2_python_sparse
yunkufang/ykf_houTai/excel_group.py
lqrby/zhongfuan
train
0
90f428307e171c6d8fd2dd07b7e3f5e62735fd0c
[ "super(TeardownSession, self).__init__(*args, **kwargs)\nself.tools = tools\nreturn", "for tool in self.tools:\n tool.run()\nreturn" ]
<|body_start_0|> super(TeardownSession, self).__init__(*args, **kwargs) self.tools = tools return <|end_body_0|> <|body_start_1|> for tool in self.tools: tool.run() return <|end_body_1|>
The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.
TeardownSession
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeardownSession: """The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.""" def __init__(self, tools, *ar...
stack_v2_sparse_classes_75kplus_train_069847
780
permissive
[ { "docstring": ":param: - `tools`: a list of tools to run", "name": "__init__", "signature": "def __init__(self, tools, *args, **kwargs)" }, { "docstring": "Calls the run() method for each tool in `tools`", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_013619
Implement the Python class `TeardownSession` described below. Class description: The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm...
Implement the Python class `TeardownSession` described below. Class description: The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class TeardownSession: """The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.""" def __init__(self, tools, *ar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeardownSession: """The TearDown does whatever needs to be done after the test is completed. It iterates over the `tools` passed in to the constructor. Each tool's `run` method is called. Choosing tools and ordering them defines the TeardownSession algorithm.""" def __init__(self, tools, *args, **kwargs)...
the_stack_v2_python_sparse
apetools/proletarians/teardown.py
russell-n/oldape
train
0
91fcc26b519fc8fd45c43378fdfd4e1266d5f252
[ "exam_rec = self.env['exam.exam'].search([('standard_id', '=', standard_id.id), ('academic_year', '=', year.id), ('state', '=', 'finished')])\nexam_result_rec = []\nexam_result_pass_rec = []\nexam_result_fail_rec = []\nresult_obj = self.env['exam.result']\nfor rec in exam_rec:\n exam_result_rec += result_obj.sea...
<|body_start_0|> exam_rec = self.env['exam.exam'].search([('standard_id', '=', standard_id.id), ('academic_year', '=', year.id), ('state', '=', 'finished')]) exam_result_rec = [] exam_result_pass_rec = [] exam_result_fail_rec = [] result_obj = self.env['exam.result'] for ...
BatchExamReport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchExamReport: def pass_student(self, year, standard_id): """Method to determine students who pass the exam""" <|body_0|> def _get_report_values(self, docids, data=None): """Inherited method to get report values.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_069848
2,447
no_license
[ { "docstring": "Method to determine students who pass the exam", "name": "pass_student", "signature": "def pass_student(self, year, standard_id)" }, { "docstring": "Inherited method to get report values.", "name": "_get_report_values", "signature": "def _get_report_values(self, docids, d...
2
null
Implement the Python class `BatchExamReport` described below. Class description: Implement the BatchExamReport class. Method signatures and docstrings: - def pass_student(self, year, standard_id): Method to determine students who pass the exam - def _get_report_values(self, docids, data=None): Inherited method to get...
Implement the Python class `BatchExamReport` described below. Class description: Implement the BatchExamReport class. Method signatures and docstrings: - def pass_student(self, year, standard_id): Method to determine students who pass the exam - def _get_report_values(self, docids, data=None): Inherited method to get...
6a9793f3a15da9eed40bf840b1d9a46457c5fd55
<|skeleton|> class BatchExamReport: def pass_student(self, year, standard_id): """Method to determine students who pass the exam""" <|body_0|> def _get_report_values(self, docids, data=None): """Inherited method to get report values.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BatchExamReport: def pass_student(self, year, standard_id): """Method to determine students who pass the exam""" exam_rec = self.env['exam.exam'].search([('standard_id', '=', standard_id.id), ('academic_year', '=', year.id), ('state', '=', 'finished')]) exam_result_rec = [] exa...
the_stack_v2_python_sparse
exam/report/batch_result_report.py
JayVora-SerpentCS/OdooEduERP
train
121
2b5ed1a748aa4327a799be699fdc7ce8fc350a7a
[ "self.plugins = []\nself.plugin_class = plugin_class\nself.plugin_package = plugin_package\nself.reload_plugins()\nself._disable = False", "self.plugins = []\nself.seen_paths = []\nself.walk_package(self.plugin_package)", "if not isinstance(disable, bool):\n return\nself._disable = disable\nif self._disable:...
<|body_start_0|> self.plugins = [] self.plugin_class = plugin_class self.plugin_package = plugin_package self.reload_plugins() self._disable = False <|end_body_0|> <|body_start_1|> self.plugins = [] self.seen_paths = [] self.walk_package(self.plugin_packa...
Upon creation, this class will read the add-ons package for modules that contain a class definition that is inheriting from the given class
PluginCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginCollection: """Upon creation, this class will read the add-ons package for modules that contain a class definition that is inheriting from the given class""" def __init__(self, plugin_package, plugin_class): """Constructor that initiates the reading of all available plugins whe...
stack_v2_sparse_classes_75kplus_train_069849
3,369
permissive
[ { "docstring": "Constructor that initiates the reading of all available plugins when an instance of the PluginCollection object is created", "name": "__init__", "signature": "def __init__(self, plugin_package, plugin_class)" }, { "docstring": "Reset the list of all plugins and initiate the walk ...
4
stack_v2_sparse_classes_30k_train_012805
Implement the Python class `PluginCollection` described below. Class description: Upon creation, this class will read the add-ons package for modules that contain a class definition that is inheriting from the given class Method signatures and docstrings: - def __init__(self, plugin_package, plugin_class): Constructo...
Implement the Python class `PluginCollection` described below. Class description: Upon creation, this class will read the add-ons package for modules that contain a class definition that is inheriting from the given class Method signatures and docstrings: - def __init__(self, plugin_package, plugin_class): Constructo...
75d029ccecc69dc419474e095c472b576cb920ad
<|skeleton|> class PluginCollection: """Upon creation, this class will read the add-ons package for modules that contain a class definition that is inheriting from the given class""" def __init__(self, plugin_package, plugin_class): """Constructor that initiates the reading of all available plugins whe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PluginCollection: """Upon creation, this class will read the add-ons package for modules that contain a class definition that is inheriting from the given class""" def __init__(self, plugin_package, plugin_class): """Constructor that initiates the reading of all available plugins when an instance...
the_stack_v2_python_sparse
app/libs/plugin_collection.py
Vincannes/TradeFinance
train
1
9d98bef6556da0c0ef934ad3d7a2cc47a0cbbbf4
[ "json_str = request.body.decode('utf-8')\nif not json_str:\n return api_response(-1, 'post参数为空', {})\nrequest_data_dict = json.loads(json_str)\nworkflow_id = kwargs.get('workflow_id')\napp_name = request.META.get('HTTP_APPNAME')\nusername = request.user.username\nname = request_data_dict.get('name', '')\ntransit...
<|body_start_0|> json_str = request.body.decode('utf-8') if not json_str: return api_response(-1, 'post参数为空', {}) request_data_dict = json.loads(json_str) workflow_id = kwargs.get('workflow_id') app_name = request.META.get('HTTP_APPNAME') username = request.us...
WorkflowTransitionDetailView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowTransitionDetailView: def patch(self, request, *args, **kwargs): """编辑 :param request: :param args: :param kwargs: :return:""" <|body_0|> def delete(self, request, *args, **kwargs): """删除transition :param request: :param args: :param kwargs: :return:""" ...
stack_v2_sparse_classes_75kplus_train_069850
48,278
permissive
[ { "docstring": "编辑 :param request: :param args: :param kwargs: :return:", "name": "patch", "signature": "def patch(self, request, *args, **kwargs)" }, { "docstring": "删除transition :param request: :param args: :param kwargs: :return:", "name": "delete", "signature": "def delete(self, requ...
2
null
Implement the Python class `WorkflowTransitionDetailView` described below. Class description: Implement the WorkflowTransitionDetailView class. Method signatures and docstrings: - def patch(self, request, *args, **kwargs): 编辑 :param request: :param args: :param kwargs: :return: - def delete(self, request, *args, **kw...
Implement the Python class `WorkflowTransitionDetailView` described below. Class description: Implement the WorkflowTransitionDetailView class. Method signatures and docstrings: - def patch(self, request, *args, **kwargs): 编辑 :param request: :param args: :param kwargs: :return: - def delete(self, request, *args, **kw...
b0e236b314286c5f6cc6959622c9c8505e776443
<|skeleton|> class WorkflowTransitionDetailView: def patch(self, request, *args, **kwargs): """编辑 :param request: :param args: :param kwargs: :return:""" <|body_0|> def delete(self, request, *args, **kwargs): """删除transition :param request: :param args: :param kwargs: :return:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkflowTransitionDetailView: def patch(self, request, *args, **kwargs): """编辑 :param request: :param args: :param kwargs: :return:""" json_str = request.body.decode('utf-8') if not json_str: return api_response(-1, 'post参数为空', {}) request_data_dict = json.loads(jso...
the_stack_v2_python_sparse
apps/workflow/views.py
blackholll/loonflow
train
1,864
9278ebbc78817cec68dbf3e464603d529cdc78e6
[ "mat = self.read_file(fname)\nif data == 'all':\n data = ['H', 'IN', 'M']\nelif isinstance(data, str):\n data = [data]\nif 'IN' in data:\n self.IN = {}\n self.read_in(mat)\nif 'H' in data:\n self.H = {}\n self.read_h(mat)\nif 'M' in data:\n self.M = {}\n self.read_m(mat)\ndel mat", "if not...
<|body_start_0|> mat = self.read_file(fname) if data == 'all': data = ['H', 'IN', 'M'] elif isinstance(data, str): data = [data] if 'IN' in data: self.IN = {} self.read_in(mat) if 'H' in data: self.H = {} sel...
MenyData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MenyData: def __init__(self, fname, data='all'): """This class reads a menyanthes file. Parameters ---------- fname: str String with the filename and path to a menyanthes file.""" <|body_0|> def read_file(fname): """This method is used to read the file.""" <|...
stack_v2_sparse_classes_75kplus_train_069851
7,277
permissive
[ { "docstring": "This class reads a menyanthes file. Parameters ---------- fname: str String with the filename and path to a menyanthes file.", "name": "__init__", "signature": "def __init__(self, fname, data='all')" }, { "docstring": "This method is used to read the file.", "name": "read_fil...
5
null
Implement the Python class `MenyData` described below. Class description: Implement the MenyData class. Method signatures and docstrings: - def __init__(self, fname, data='all'): This class reads a menyanthes file. Parameters ---------- fname: str String with the filename and path to a menyanthes file. - def read_fil...
Implement the Python class `MenyData` described below. Class description: Implement the MenyData class. Method signatures and docstrings: - def __init__(self, fname, data='all'): This class reads a menyanthes file. Parameters ---------- fname: str String with the filename and path to a menyanthes file. - def read_fil...
5665170b4b211d896b13f6e03afd1140ed1a1415
<|skeleton|> class MenyData: def __init__(self, fname, data='all'): """This class reads a menyanthes file. Parameters ---------- fname: str String with the filename and path to a menyanthes file.""" <|body_0|> def read_file(fname): """This method is used to read the file.""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MenyData: def __init__(self, fname, data='all'): """This class reads a menyanthes file. Parameters ---------- fname: str String with the filename and path to a menyanthes file.""" mat = self.read_file(fname) if data == 'all': data = ['H', 'IN', 'M'] elif isinstance(...
the_stack_v2_python_sparse
pastas/read/menyanthes.py
EitvanderMeulen/pastas
train
2
0e5a14d238bc7cc34fd3aad87fc634e42a176871
[ "super(WordDatatype_iter_with_caching, self).__init__(parent, iter, length)\nself._data, self._gen = itertools.tee(self._data)\nself._list = []\nself._last_index = -1", "for a in self._list:\n yield a\nfor a in self._gen:\n self._list.append(a)\n self._last_index += 1\n yield a\nif self._len is None:\...
<|body_start_0|> super(WordDatatype_iter_with_caching, self).__init__(parent, iter, length) self._data, self._gen = itertools.tee(self._data) self._list = [] self._last_index = -1 <|end_body_0|> <|body_start_1|> for a in self._list: yield a for a in self._gen...
WordDatatype_iter_with_caching
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDatatype_iter_with_caching: def __init__(self, parent, iter, length=None): """INPUT: - ``parent`` - a parent - ``iter`` - an iterator - ``length`` - (default: ``None``) the length of the word EXAMPLES:: sage: import itertools sage: Word(itertools.cycle("abbabaab")) word: abbabaababba...
stack_v2_sparse_classes_75kplus_train_069852
39,600
no_license
[ { "docstring": "INPUT: - ``parent`` - a parent - ``iter`` - an iterator - ``length`` - (default: ``None``) the length of the word EXAMPLES:: sage: import itertools sage: Word(itertools.cycle(\"abbabaab\")) word: abbabaababbabaababbabaababbabaababbabaab... sage: w = Word(iter(\"abbabaab\"), length=\"finite\"); w...
5
stack_v2_sparse_classes_30k_train_008906
Implement the Python class `WordDatatype_iter_with_caching` described below. Class description: Implement the WordDatatype_iter_with_caching class. Method signatures and docstrings: - def __init__(self, parent, iter, length=None): INPUT: - ``parent`` - a parent - ``iter`` - an iterator - ``length`` - (default: ``None...
Implement the Python class `WordDatatype_iter_with_caching` described below. Class description: Implement the WordDatatype_iter_with_caching class. Method signatures and docstrings: - def __init__(self, parent, iter, length=None): INPUT: - ``parent`` - a parent - ``iter`` - an iterator - ``length`` - (default: ``None...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class WordDatatype_iter_with_caching: def __init__(self, parent, iter, length=None): """INPUT: - ``parent`` - a parent - ``iter`` - an iterator - ``length`` - (default: ``None``) the length of the word EXAMPLES:: sage: import itertools sage: Word(itertools.cycle("abbabaab")) word: abbabaababba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordDatatype_iter_with_caching: def __init__(self, parent, iter, length=None): """INPUT: - ``parent`` - a parent - ``iter`` - an iterator - ``length`` - (default: ``None``) the length of the word EXAMPLES:: sage: import itertools sage: Word(itertools.cycle("abbabaab")) word: abbabaababbabaababbabaabab...
the_stack_v2_python_sparse
sage/src/sage/combinat/words/word_infinite_datatypes.py
bopopescu/geosci
train
0
76d0a13df09e50012a3f63d8e8a9c83f89d58a48
[ "try:\n self.title = data['Title']\n self.actors = data['Actors'].split(',')\n self.plot = data['Plot']\nexcept Exception as ex:\n print('Error: ', ex)", "print('Movie name: ' + self.title)\nprint('Name of the actors: ' + ', '.join(self.actors))\nprint('The plot: ' + self.plot)" ]
<|body_start_0|> try: self.title = data['Title'] self.actors = data['Actors'].split(',') self.plot = data['Plot'] except Exception as ex: print('Error: ', ex) <|end_body_0|> <|body_start_1|> print('Movie name: ' + self.title) print('Name o...
Stores information about a movie.
MovieData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieData: """Stores information about a movie.""" def __init__(self, data): """Initialize the class with a movie data dictionary.""" <|body_0|> def print_data(self): """Prints the movie information.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_069853
1,449
permissive
[ { "docstring": "Initialize the class with a movie data dictionary.", "name": "__init__", "signature": "def __init__(self, data)" }, { "docstring": "Prints the movie information.", "name": "print_data", "signature": "def print_data(self)" } ]
2
null
Implement the Python class `MovieData` described below. Class description: Stores information about a movie. Method signatures and docstrings: - def __init__(self, data): Initialize the class with a movie data dictionary. - def print_data(self): Prints the movie information.
Implement the Python class `MovieData` described below. Class description: Stores information about a movie. Method signatures and docstrings: - def __init__(self, data): Initialize the class with a movie data dictionary. - def print_data(self): Prints the movie information. <|skeleton|> class MovieData: """Stor...
1d650e49950d1987d052028139fcdfcb0bbfcc70
<|skeleton|> class MovieData: """Stores information about a movie.""" def __init__(self, data): """Initialize the class with a movie data dictionary.""" <|body_0|> def print_data(self): """Prints the movie information.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MovieData: """Stores information about a movie.""" def __init__(self, data): """Initialize the class with a movie data dictionary.""" try: self.title = data['Title'] self.actors = data['Actors'].split(',') self.plot = data['Plot'] except Excepti...
the_stack_v2_python_sparse
03_Classes/movie_data.py
Rockfish/PythonCourse
train
0
f034d9cf11b174c80b6d9838085cd13788a88a17
[ "index_size, num_examples, batch_size = (32, 24, 8)\nindex = [{'hashed_id': str(i)} for i in range(index_size)]\nretriever = _MockEmbeddingBasedRetriever(index, batch_size=batch_size)\nexamples = [{'hashed_id': str(i)} for i in range(num_examples)]\nresults = list(retriever.retrieve_all(examples))\nself.assertLen(r...
<|body_start_0|> index_size, num_examples, batch_size = (32, 24, 8) index = [{'hashed_id': str(i)} for i in range(index_size)] retriever = _MockEmbeddingBasedRetriever(index, batch_size=batch_size) examples = [{'hashed_id': str(i)} for i in range(num_examples)] results = list(ret...
Tests EmbeddingBasedRetriever.
EmbeddingBasedRetrieverTest
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingBasedRetrieverTest: """Tests EmbeddingBasedRetriever.""" def test_batching_no_remainder(self): """Tests if batching does not drop any example.""" <|body_0|> def test_batching_has_remainder(self): """Tests if batching does not drop any example.""" ...
stack_v2_sparse_classes_75kplus_train_069854
7,300
permissive
[ { "docstring": "Tests if batching does not drop any example.", "name": "test_batching_no_remainder", "signature": "def test_batching_no_remainder(self)" }, { "docstring": "Tests if batching does not drop any example.", "name": "test_batching_has_remainder", "signature": "def test_batchin...
2
stack_v2_sparse_classes_30k_train_001386
Implement the Python class `EmbeddingBasedRetrieverTest` described below. Class description: Tests EmbeddingBasedRetriever. Method signatures and docstrings: - def test_batching_no_remainder(self): Tests if batching does not drop any example. - def test_batching_has_remainder(self): Tests if batching does not drop an...
Implement the Python class `EmbeddingBasedRetrieverTest` described below. Class description: Tests EmbeddingBasedRetriever. Method signatures and docstrings: - def test_batching_no_remainder(self): Tests if batching does not drop any example. - def test_batching_has_remainder(self): Tests if batching does not drop an...
ac9447064195e06de48cc91ff642f7fffa28ffe8
<|skeleton|> class EmbeddingBasedRetrieverTest: """Tests EmbeddingBasedRetriever.""" def test_batching_no_remainder(self): """Tests if batching does not drop any example.""" <|body_0|> def test_batching_has_remainder(self): """Tests if batching does not drop any example.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmbeddingBasedRetrieverTest: """Tests EmbeddingBasedRetriever.""" def test_batching_no_remainder(self): """Tests if batching does not drop any example.""" index_size, num_examples, batch_size = (32, 24, 8) index = [{'hashed_id': str(i)} for i in range(index_size)] retrieve...
the_stack_v2_python_sparse
language/casper/retrieve/query_retrievers_test.py
google-research/language
train
1,567
b2aaabb7f50141c641bfe37c688ef0453cb27676
[ "lo = 0\nhi = len(nums) - 1\nk = 0\nwhile k <= hi:\n print(k, lo, hi)\n if nums[k] == 0:\n nums[lo], nums[k] = (nums[k], nums[lo])\n k += 1\n lo += 1\n elif nums[k] == 2:\n nums[hi], nums[k] = (nums[k], nums[hi])\n hi -= 1\n else:\n k += 1", "count = [0] * 3\n...
<|body_start_0|> lo = 0 hi = len(nums) - 1 k = 0 while k <= hi: print(k, lo, hi) if nums[k] == 0: nums[lo], nums[k] = (nums[k], nums[lo]) k += 1 lo += 1 elif nums[k] == 2: nums[hi], nums[k...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors_2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_75kplus_train_069855
1,154
no_license
[ { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors", "signature": "def sortColors(self, nums)" }, { "docstring": "Do not return anything, modify nums in-place instead.", "name": "sortColors_2", "signature": "def sortColors_2(self, nums: List[int])...
2
stack_v2_sparse_classes_30k_train_041060
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums): Do not return anything, modify nums in-place instead. - def sortColors_2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sortColors(self, nums): Do not return anything, modify nums in-place instead. - def sortColors_2(self, nums: List[int]) -> None: Do not return anything, modify nums in-place ...
20a48021be5e5348d681e910c843e734df98b596
<|skeleton|> class Solution: def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" <|body_0|> def sortColors_2(self, nums: List[int]) -> None: """Do not return anything, modify nums in-place instead.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sortColors(self, nums): """Do not return anything, modify nums in-place instead.""" lo = 0 hi = len(nums) - 1 k = 0 while k <= hi: print(k, lo, hi) if nums[k] == 0: nums[lo], nums[k] = (nums[k], nums[lo]) ...
the_stack_v2_python_sparse
sort_colors/sort_colors.py
narnat/leetcode
train
0
d875cd8a89ee40608fe99b35121796a26f34229d
[ "self.database_copy_info_list = database_copy_info_list\nself.guid = guid\nself.name = name", "if dictionary is None:\n return None\ndatabase_copy_info_list = None\nif dictionary.get('databaseCopyInfoList') != None:\n database_copy_info_list = list()\n for structure in dictionary.get('databaseCopyInfoLis...
<|body_start_0|> self.database_copy_info_list = database_copy_info_list self.guid = guid self.name = name <|end_body_0|> <|body_start_1|> if dictionary is None: return None database_copy_info_list = None if dictionary.get('databaseCopyInfoList') != None: ...
Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include active and passive copy of the database. guid (...
ExchangeDAGDatabase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExchangeDAGDatabase: """Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include ...
stack_v2_sparse_classes_75kplus_train_069856
2,372
permissive
[ { "docstring": "Constructor for the ExchangeDAGDatabase class", "name": "__init__", "signature": "def __init__(self, database_copy_info_list=None, guid=None, name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representat...
2
stack_v2_sparse_classes_30k_train_023582
Implement the Python class `ExchangeDAGDatabase` described below. Class description: Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the cop...
Implement the Python class `ExchangeDAGDatabase` described below. Class description: Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the cop...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ExchangeDAGDatabase: """Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExchangeDAGDatabase: """Implementation of the 'ExchangeDAGDatabase' model. Specifies the information about all the copies of the database that is part of DAG. Attributes: database_copy_info_list (list of ExchangeDatabaseCopyInfo): Specifies about all the copies of this DAG database. This include active and pa...
the_stack_v2_python_sparse
cohesity_management_sdk/models/exchange_dag_database.py
cohesity/management-sdk-python
train
24
38e4bb009f7725220c811a6ef9dac6177a719701
[ "with open(os.path.join(settings.BASE_DIR, 'reviews/templates/reviews/instance-form.html')) as tf:\n template_content = tf.read()\n self.assertIn('{% load crispy_forms_tags %', template_content)\n self.assertIn('{% crispy form %}', template_content)\n self.assertNotIn('<form', template_content)\n sel...
<|body_start_0|> with open(os.path.join(settings.BASE_DIR, 'reviews/templates/reviews/instance-form.html')) as tf: template_content = tf.read() self.assertIn('{% load crispy_forms_tags %', template_content) self.assertIn('{% crispy form %}', template_content) self...
Activity1Test
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Activity1Test: def test_crispy_form_used_in_template(self): """Test that the {% crispy %} template tag is being used to render the form in search-results.html""" <|body_0|> def test_form_helper(self): """Test that InstanceForm has a helper with a submit button, the b...
stack_v2_sparse_classes_75kplus_train_069857
2,621
permissive
[ { "docstring": "Test that the {% crispy %} template tag is being used to render the form in search-results.html", "name": "test_crispy_form_used_in_template", "signature": "def test_crispy_form_used_in_template(self)" }, { "docstring": "Test that InstanceForm has a helper with a submit button, t...
3
stack_v2_sparse_classes_30k_train_044224
Implement the Python class `Activity1Test` described below. Class description: Implement the Activity1Test class. Method signatures and docstrings: - def test_crispy_form_used_in_template(self): Test that the {% crispy %} template tag is being used to render the form in search-results.html - def test_form_helper(self...
Implement the Python class `Activity1Test` described below. Class description: Implement the Activity1Test class. Method signatures and docstrings: - def test_crispy_form_used_in_template(self): Test that the {% crispy %} template tag is being used to render the form in search-results.html - def test_form_helper(self...
52e86a8f93cb38bf70d50e9b8d2c6d7dac416f62
<|skeleton|> class Activity1Test: def test_crispy_form_used_in_template(self): """Test that the {% crispy %} template tag is being used to render the form in search-results.html""" <|body_0|> def test_form_helper(self): """Test that InstanceForm has a helper with a submit button, the b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Activity1Test: def test_crispy_form_used_in_template(self): """Test that the {% crispy %} template tag is being used to render the form in search-results.html""" with open(os.path.join(settings.BASE_DIR, 'reviews/templates/reviews/instance-form.html')) as tf: template_content = tf....
the_stack_v2_python_sparse
Chapter15/final/bookr/reviews/tests.py
lmoshood/The-Django-Workshop
train
0
ec324da2547780e56e7fecc13d371667b7e91bf0
[ "super().handle_input(data_type)\npath = os.path.join(self.artifact.uri, DEFAULT_FILENAME)\nreturn tf.data.experimental.load(path)", "super().handle_return(dataset)\npath = os.path.join(self.artifact.uri, DEFAULT_FILENAME)\ntf.data.experimental.save(dataset, path, compression=None, shard_func=None)" ]
<|body_start_0|> super().handle_input(data_type) path = os.path.join(self.artifact.uri, DEFAULT_FILENAME) return tf.data.experimental.load(path) <|end_body_0|> <|body_start_1|> super().handle_return(dataset) path = os.path.join(self.artifact.uri, DEFAULT_FILENAME) tf.dat...
Materializer to read data to and from beam.
TensorflowDatasetMaterializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorflowDatasetMaterializer: """Materializer to read data to and from beam.""" def handle_input(self, data_type: Type[Any]) -> Any: """Reads data into tf.data.Dataset""" <|body_0|> def handle_return(self, dataset: tf.data.Dataset) -> None: """Persists a tf.data...
stack_v2_sparse_classes_75kplus_train_069858
1,509
permissive
[ { "docstring": "Reads data into tf.data.Dataset", "name": "handle_input", "signature": "def handle_input(self, data_type: Type[Any]) -> Any" }, { "docstring": "Persists a tf.data.Dataset object.", "name": "handle_return", "signature": "def handle_return(self, dataset: tf.data.Dataset) ->...
2
null
Implement the Python class `TensorflowDatasetMaterializer` described below. Class description: Materializer to read data to and from beam. Method signatures and docstrings: - def handle_input(self, data_type: Type[Any]) -> Any: Reads data into tf.data.Dataset - def handle_return(self, dataset: tf.data.Dataset) -> Non...
Implement the Python class `TensorflowDatasetMaterializer` described below. Class description: Materializer to read data to and from beam. Method signatures and docstrings: - def handle_input(self, data_type: Type[Any]) -> Any: Reads data into tf.data.Dataset - def handle_return(self, dataset: tf.data.Dataset) -> Non...
f1499e9c3fee00fd1d66de14cab66c4472c0085d
<|skeleton|> class TensorflowDatasetMaterializer: """Materializer to read data to and from beam.""" def handle_input(self, data_type: Type[Any]) -> Any: """Reads data into tf.data.Dataset""" <|body_0|> def handle_return(self, dataset: tf.data.Dataset) -> None: """Persists a tf.data...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TensorflowDatasetMaterializer: """Materializer to read data to and from beam.""" def handle_input(self, data_type: Type[Any]) -> Any: """Reads data into tf.data.Dataset""" super().handle_input(data_type) path = os.path.join(self.artifact.uri, DEFAULT_FILENAME) return tf.da...
the_stack_v2_python_sparse
src/zenml/integrations/tensorflow/materializers/tf_dataset_materializer.py
stefannica/zenml
train
0
7cd3e8f61b99ef9e8e8232a33358bfd1f2a463b9
[ "a = min(nums)\nres = 0\nfor i in range(len(nums)):\n cur = nums[i] - a\n res += cur\nreturn res", "nums.sort()\nres = 0\nfor i in range(len(nums)):\n cur = nums[i] - nums[0]\n res += cur\nreturn res", "nums.sort()\nres = 0\nlast_cur = 0\ncur_sum = 0\ni_max = len(nums) - 1\ni = 0\nwhile True:\n i...
<|body_start_0|> a = min(nums) res = 0 for i in range(len(nums)): cur = nums[i] - a res += cur return res <|end_body_0|> <|body_start_1|> nums.sort() res = 0 for i in range(len(nums)): cur = nums[i] - nums[0] res +=...
Ex453
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ex453: def minMoves0(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def minMoves0(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def minMoves(self, nums): """:type nums: List[int] :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_069859
1,375
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "minMoves0", "signature": "def minMoves0(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "minMoves0", "signature": "def minMoves0(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: ...
3
stack_v2_sparse_classes_30k_train_025549
Implement the Python class `Ex453` described below. Class description: Implement the Ex453 class. Method signatures and docstrings: - def minMoves0(self, nums): :type nums: List[int] :rtype: int - def minMoves0(self, nums): :type nums: List[int] :rtype: int - def minMoves(self, nums): :type nums: List[int] :rtype: in...
Implement the Python class `Ex453` described below. Class description: Implement the Ex453 class. Method signatures and docstrings: - def minMoves0(self, nums): :type nums: List[int] :rtype: int - def minMoves0(self, nums): :type nums: List[int] :rtype: int - def minMoves(self, nums): :type nums: List[int] :rtype: in...
8f9327a1879949f61b462cc6c82e00e7c27b8b07
<|skeleton|> class Ex453: def minMoves0(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def minMoves0(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def minMoves(self, nums): """:type nums: List[int] :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ex453: def minMoves0(self, nums): """:type nums: List[int] :rtype: int""" a = min(nums) res = 0 for i in range(len(nums)): cur = nums[i] - a res += cur return res def minMoves0(self, nums): """:type nums: List[int] :rtype: int""" ...
the_stack_v2_python_sparse
LeetCode/Ex400/Ex453.py
JasonVann/CrackingCodingInterview
train
0
92baa7a659351e7b65a740d822cbfd51ae1a6e03
[ "object = get_object_or_404(CallRegister, pk=id)\nform = CallRegisterForm(instance=object)\ncontext = {'object': object, 'form': form}\nreturn render(request, self.template_name, context)", "form = CallRegisterForm(request.POST or None)\nif form.is_valid():\n object = get_object_or_404(CallRegister, pk=id)\n ...
<|body_start_0|> object = get_object_or_404(CallRegister, pk=id) form = CallRegisterForm(instance=object) context = {'object': object, 'form': form} return render(request, self.template_name, context) <|end_body_0|> <|body_start_1|> form = CallRegisterForm(request.POST or None) ...
CallEditView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CallEditView: def get(self, request, id): """Returns single call data from db, appointment_date is passed into form to display as form only.""" <|body_0|> def post(self, request, id): """Overrides all existing details of specific call, similar to call register.""" ...
stack_v2_sparse_classes_75kplus_train_069860
8,699
no_license
[ { "docstring": "Returns single call data from db, appointment_date is passed into form to display as form only.", "name": "get", "signature": "def get(self, request, id)" }, { "docstring": "Overrides all existing details of specific call, similar to call register.", "name": "post", "sign...
2
stack_v2_sparse_classes_30k_train_031692
Implement the Python class `CallEditView` described below. Class description: Implement the CallEditView class. Method signatures and docstrings: - def get(self, request, id): Returns single call data from db, appointment_date is passed into form to display as form only. - def post(self, request, id): Overrides all e...
Implement the Python class `CallEditView` described below. Class description: Implement the CallEditView class. Method signatures and docstrings: - def get(self, request, id): Returns single call data from db, appointment_date is passed into form to display as form only. - def post(self, request, id): Overrides all e...
bdd7c5ca9f00ce33be31609e5be9c2ccfcd8743a
<|skeleton|> class CallEditView: def get(self, request, id): """Returns single call data from db, appointment_date is passed into form to display as form only.""" <|body_0|> def post(self, request, id): """Overrides all existing details of specific call, similar to call register.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CallEditView: def get(self, request, id): """Returns single call data from db, appointment_date is passed into form to display as form only.""" object = get_object_or_404(CallRegister, pk=id) form = CallRegisterForm(instance=object) context = {'object': object, 'form': form} ...
the_stack_v2_python_sparse
calls/views.py
mrmaheshrajput/htscrm
train
0
af5ff3636a9d98701999054ea8839c2fd5019561
[ "if not nums:\n return 0\nn, count = (len(nums), 0)\ndp = [[1] * n for _ in range(n)]\nfor i in range(n - 1, -1, -1):\n for j in range(i, n):\n if i == j:\n dp[i][j] = nums[i]\n else:\n dp[i][j] = dp[i][j - 1] * nums[j]\n if dp[i][j] < k:\n count += 1\nret...
<|body_start_0|> if not nums: return 0 n, count = (len(nums), 0) dp = [[1] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(i, n): if i == j: dp[i][j] = nums[i] else: dp[i]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: """思路: DP,超时""" <|body_0|> def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: """思路:滑动窗口 + 二分法 对于 每个 right, nums[left], nums[left + 1], nums[left +2] ... nu...
stack_v2_sparse_classes_75kplus_train_069861
1,955
no_license
[ { "docstring": "思路: DP,超时", "name": "numSubarrayProductLessThanK_dp", "signature": "def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int" }, { "docstring": "思路:滑动窗口 + 二分法 对于 每个 right, nums[left], nums[left + 1], nums[left +2] ... nums[right] [0, right] 是单调递增的,找到 最大 sub_max < ...
2
stack_v2_sparse_classes_30k_test_002632
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: 思路: DP,超时 - def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: 思路:滑动窗口 + 二分法 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: 思路: DP,超时 - def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: 思路:滑动窗口 + 二分法 ...
4994b8b19abcdbcc0bda2944350e325242fadfd1
<|skeleton|> class Solution: def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: """思路: DP,超时""" <|body_0|> def numSubarrayProductLessThanK_window(self, nums: List[int], k: int) -> int: """思路:滑动窗口 + 二分法 对于 每个 right, nums[left], nums[left + 1], nums[left +2] ... nu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSubarrayProductLessThanK_dp(self, nums: List[int], k: int) -> int: """思路: DP,超时""" if not nums: return 0 n, count = (len(nums), 0) dp = [[1] * n for _ in range(n)] for i in range(n - 1, -1, -1): for j in range(i, n): ...
the_stack_v2_python_sparse
Week_04/numSubarrayProductLessThanK.py
NanZhang715/AlgorithmCHUNZHAO
train
0
bc4e8379c4714b82b0b04c2cec8eed23b0daf369
[ "parameters = self.default\nparameters.update(kwargs)\ntry:\n parameters.update(self._from_settings(settings=project.settings))\nexcept AttributeError:\n pass\nif self.implementation:\n parameters.update(self._at_runtime(project=project))\nparameters.update(self.contents)\nif self.selected:\n self.conte...
<|body_start_0|> parameters = self.default parameters.update(kwargs) try: parameters.update(self._from_settings(settings=project.settings)) except AttributeError: pass if self.implementation: parameters.update(self._at_runtime(project=project))...
Creates and stores parameters for a Component. The use of Parameters is entirely optional, but it provides a handy tool for aggregating data from an array of sources, including those which only become apparent during execution of an amicus project, to create a unified set of implementation parameters. Parameters can be...
Parameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parameters: """Creates and stores parameters for a Component. The use of Parameters is entirely optional, but it provides a handy tool for aggregating data from an array of sources, including those which only become apparent during execution of an amicus project, to create a unified set of implem...
stack_v2_sparse_classes_75kplus_train_069862
43,953
permissive
[ { "docstring": "Combines and selects final parameters into 'contents'. Args: project (amicus.Project): instance from which implementation and settings parameters can be derived.", "name": "finalize", "signature": "def finalize(self, project: amicus.Project, **kwargs) -> None" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_051269
Implement the Python class `Parameters` described below. Class description: Creates and stores parameters for a Component. The use of Parameters is entirely optional, but it provides a handy tool for aggregating data from an array of sources, including those which only become apparent during execution of an amicus pro...
Implement the Python class `Parameters` described below. Class description: Creates and stores parameters for a Component. The use of Parameters is entirely optional, but it provides a handy tool for aggregating data from an array of sources, including those which only become apparent during execution of an amicus pro...
0de6d90c34b8402f4464dcba784349514b3b8e42
<|skeleton|> class Parameters: """Creates and stores parameters for a Component. The use of Parameters is entirely optional, but it provides a handy tool for aggregating data from an array of sources, including those which only become apparent during execution of an amicus project, to create a unified set of implem...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Parameters: """Creates and stores parameters for a Component. The use of Parameters is entirely optional, but it provides a handy tool for aggregating data from an array of sources, including those which only become apparent during execution of an amicus project, to create a unified set of implementation para...
the_stack_v2_python_sparse
amicus/project/nodes.py
WithPrecedent/amicus
train
1
344c8802e726c4f34c1b44a5ca96b12f859fb2cc
[ "match = {}\ngenerator = xml_root.iter()\nfor key in generator:\n if 'key' in key.tag and key_name in key.text:\n value_key = generator.next()\n value = ''\n for subkey in value_key.iter():\n if 'string' in subkey.tag:\n value = subkey.text\n match[key.text] ...
<|body_start_0|> match = {} generator = xml_root.iter() for key in generator: if 'key' in key.tag and key_name in key.text: value_key = generator.next() value = '' for subkey in value_key.iter(): if 'string' in subke...
Class that defines the Mac OS X XML plist preprocess plugin object.
MacXMLPlistPreprocess
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacXMLPlistPreprocess: """Class that defines the Mac OS X XML plist preprocess plugin object.""" def _GetKeys(self, xml_root, key_name): """Return a dict with the requested keys.""" <|body_0|> def ParseFile(self, file_entry, file_object): """Parse the file and re...
stack_v2_sparse_classes_75kplus_train_069863
17,383
permissive
[ { "docstring": "Return a dict with the requested keys.", "name": "_GetKeys", "signature": "def _GetKeys(self, xml_root, key_name)" }, { "docstring": "Parse the file and return parsed key. Args: file_entry: The file entry (instance of dfvfs.FileEntry). file_object: The file-like object. Returns: ...
2
stack_v2_sparse_classes_30k_train_033468
Implement the Python class `MacXMLPlistPreprocess` described below. Class description: Class that defines the Mac OS X XML plist preprocess plugin object. Method signatures and docstrings: - def _GetKeys(self, xml_root, key_name): Return a dict with the requested keys. - def ParseFile(self, file_entry, file_object): ...
Implement the Python class `MacXMLPlistPreprocess` described below. Class description: Class that defines the Mac OS X XML plist preprocess plugin object. Method signatures and docstrings: - def _GetKeys(self, xml_root, key_name): Return a dict with the requested keys. - def ParseFile(self, file_entry, file_object): ...
b4dc64b3a2d2906e8947824c493a2bc311d765c1
<|skeleton|> class MacXMLPlistPreprocess: """Class that defines the Mac OS X XML plist preprocess plugin object.""" def _GetKeys(self, xml_root, key_name): """Return a dict with the requested keys.""" <|body_0|> def ParseFile(self, file_entry, file_object): """Parse the file and re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MacXMLPlistPreprocess: """Class that defines the Mac OS X XML plist preprocess plugin object.""" def _GetKeys(self, xml_root, key_name): """Return a dict with the requested keys.""" match = {} generator = xml_root.iter() for key in generator: if 'key' in key.ta...
the_stack_v2_python_sparse
plaso/preprocessors/interface.py
iwm911/plaso
train
0
85dfd7318ed8eb3f68e1aad19c6fdd6f37e1e4f7
[ "gm_track = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing')\nexpected = ['HVAD', 'Pan Daijing']\nactual = gmspotify.get_gm_track_artists(gm_track)\nself.assertEqual(actual, expected)", "gm_track = gmusic.GMusicTrack(title='Stretch Deep (feat. Eve Essex)', artist='James K')\nexpected = ['Eve Esse...
<|body_start_0|> gm_track = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing') expected = ['HVAD', 'Pan Daijing'] actual = gmspotify.get_gm_track_artists(gm_track) self.assertEqual(actual, expected) <|end_body_0|> <|body_start_1|> gm_track = gmusic.GMusicTrack(tit...
TestGetGMTrackArtists
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetGMTrackArtists: def test_get_gm_track_artists_ampersand(self): """Given a GM Track with an artist string containing multiple artists Should return a list of those artists""" <|body_0|> def test_get_gm_track_artists_ft_1(self): """Given a GM Track with a title ...
stack_v2_sparse_classes_75kplus_train_069864
9,283
no_license
[ { "docstring": "Given a GM Track with an artist string containing multiple artists Should return a list of those artists", "name": "test_get_gm_track_artists_ampersand", "signature": "def test_get_gm_track_artists_ampersand(self)" }, { "docstring": "Given a GM Track with a title featuring an art...
3
stack_v2_sparse_classes_30k_train_012881
Implement the Python class `TestGetGMTrackArtists` described below. Class description: Implement the TestGetGMTrackArtists class. Method signatures and docstrings: - def test_get_gm_track_artists_ampersand(self): Given a GM Track with an artist string containing multiple artists Should return a list of those artists ...
Implement the Python class `TestGetGMTrackArtists` described below. Class description: Implement the TestGetGMTrackArtists class. Method signatures and docstrings: - def test_get_gm_track_artists_ampersand(self): Given a GM Track with an artist string containing multiple artists Should return a list of those artists ...
a29a9771ee1f03650b367b22d5a2bcbabc4d3990
<|skeleton|> class TestGetGMTrackArtists: def test_get_gm_track_artists_ampersand(self): """Given a GM Track with an artist string containing multiple artists Should return a list of those artists""" <|body_0|> def test_get_gm_track_artists_ft_1(self): """Given a GM Track with a title ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestGetGMTrackArtists: def test_get_gm_track_artists_ampersand(self): """Given a GM Track with an artist string containing multiple artists Should return a list of those artists""" gm_track = gmusic.GMusicTrack(title='Zhao Hua', artist='HVAD & Pan Daijing') expected = ['HVAD', 'Pan Dai...
the_stack_v2_python_sparse
test_gmspotify.py
jdheyburn/gmspotify
train
0
6dab96c3aa659f167a4e9ac7ed0a706235fab183
[ "Parametre.__init__(self, 'liste', 'list')\nself.aide_courte = 'liste les bannisements'\nself.aide_longue = 'Cette commande liste les bannissements actuels, temporaires ou prolongés, de joueurs, comptes ou adresses.'", "msg = 'Bannissements actuels :\\n'\ntemporaires = []\nmaintenant = datetime.now()\nfor joueur,...
<|body_start_0|> Parametre.__init__(self, 'liste', 'list') self.aide_courte = 'liste les bannisements' self.aide_longue = 'Cette commande liste les bannissements actuels, temporaires ou prolongés, de joueurs, comptes ou adresses.' <|end_body_0|> <|body_start_1|> msg = 'Bannissements act...
Commande 'bannir liste'.
PrmListe
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmListe: """Commande 'bannir liste'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__in...
stack_v2_sparse_classes_75kplus_train_069865
3,416
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_035007
Implement the Python class `PrmListe` described below. Class description: Commande 'bannir liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmListe` described below. Class description: Commande 'bannir liste'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmListe: """Commande 'bannir liste...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmListe: """Commande 'bannir liste'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmListe: """Commande 'bannir liste'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'liste', 'list') self.aide_courte = 'liste les bannisements' self.aide_longue = 'Cette commande liste les bannissements actuels, temporaires ou prolongés, ...
the_stack_v2_python_sparse
src/primaires/joueur/commandes/bannir/liste.py
vincent-lg/tsunami
train
5
7961ed9fccc54d98ae719f2fa5695615c3c71a09
[ "if not nums:\n return None\nelse:\n maxnum = nums[0]\n for i in range(len(nums)):\n num = nums[i]\n if num > maxnum:\n maxnum = num\n for j in range(i + 1, len(nums)):\n num += nums[j]\n if num > maxnum:\n maxnum = num\n return maxnum...
<|body_start_0|> if not nums: return None else: maxnum = nums[0] for i in range(len(nums)): num = nums[i] if num > maxnum: maxnum = num for j in range(i + 1, len(nums)): num += num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)""" <|body_0|> def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(...
stack_v2_sparse_classes_75kplus_train_069866
1,970
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(n) = max(f(n-1)...
3
stack_v2_sparse_classes_30k_train_035432
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2) - def maxSubArray1(self, nums): :type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2) - def maxSubArray1(self, nums): :type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],s...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)""" <|body_0|> def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)""" if not nums: return None else: maxnum = nums[0] for i in range(len(nums)): num = nums[i] if num > maxnum: ...
the_stack_v2_python_sparse
53_maximum-subarray.py
95275059/Algorithm
train
0
db5291bd94f5b45b7d05fbed6fdaac1a159b6e23
[ "w, h = (len(board), len(board[0]))\nboard_p = np.zeros((w + 2, h + 2))\nboard_p[1:w + 1, 1:h + 1] = board\nfor i in range(1, w + 1):\n for j in range(1, h + 1):\n value = self.conv2d(board_p, i, j)\n if value > 3 or value < 2:\n board[i - 1][j - 1] = 0\n elif value == 3:\n ...
<|body_start_0|> w, h = (len(board), len(board[0])) board_p = np.zeros((w + 2, h + 2)) board_p[1:w + 1, 1:h + 1] = board for i in range(1, w + 1): for j in range(1, h + 1): value = self.conv2d(board_p, i, j) if value > 3 or value < 2: ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def gameOfLife(self, board) -> None: """Do not return anything, modify board in-place instead.""" <|body_0|> def conv2d(self, board_p, i, j): """convolution implemention :para board_p: board after 0 padding(np.array) i,j : loction :output value_convolution"...
stack_v2_sparse_classes_75kplus_train_069867
3,141
permissive
[ { "docstring": "Do not return anything, modify board in-place instead.", "name": "gameOfLife", "signature": "def gameOfLife(self, board) -> None" }, { "docstring": "convolution implemention :para board_p: board after 0 padding(np.array) i,j : loction :output value_convolution", "name": "conv...
2
stack_v2_sparse_classes_30k_train_043904
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board) -> None: Do not return anything, modify board in-place instead. - def conv2d(self, board_p, i, j): convolution implemention :para board_p: board after...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def gameOfLife(self, board) -> None: Do not return anything, modify board in-place instead. - def conv2d(self, board_p, i, j): convolution implemention :para board_p: board after...
91c8b09c278f5abb67e90f0096fc83bef975647b
<|skeleton|> class Solution: def gameOfLife(self, board) -> None: """Do not return anything, modify board in-place instead.""" <|body_0|> def conv2d(self, board_p, i, j): """convolution implemention :para board_p: board after 0 padding(np.array) i,j : loction :output value_convolution"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def gameOfLife(self, board) -> None: """Do not return anything, modify board in-place instead.""" w, h = (len(board), len(board[0])) board_p = np.zeros((w + 2, h + 2)) board_p[1:w + 1, 1:h + 1] = board for i in range(1, w + 1): for j in range(1, h ...
the_stack_v2_python_sparse
289LifeGame/GameOfLife.py
Easonyesheng/CodePractice
train
0
2bc2f91c65f918e0cc9f711baf98910343997146
[ "if not root:\n return 'None,'\nreturn '{},'.format(root.val) + self.serialize(root.left) + self.serialize(root.right)", "def build_tree(data):\n if self.count >= len(data) or data[self.count] == 'None':\n self.count += 1\n return None\n node = TreeNode(int(data[self.count]))\n self.coun...
<|body_start_0|> if not root: return 'None,' return '{},'.format(root.val) + self.serialize(root.left) + self.serialize(root.right) <|end_body_0|> <|body_start_1|> def build_tree(data): if self.count >= len(data) or data[self.count] == 'None': self.count ...
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_069868
1,226
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_035728
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:...
9126c2089e41d4d7fd3a204115eba2b5074076ad
<|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""" if not root: return 'None,' return '{},'.format(root.val) + self.serialize(root.left) + self.serialize(root.right) def deserialize(self, data): """Decode...
the_stack_v2_python_sparse
297_Serialize and Deserialize Binary Tree.py
Shwan-Yu/Data_Structures_and_Algorithms
train
0
6ccfe03da52e0d15562f21b0ece8015c65b58b88
[ "self._ddt_sample, self._ddt_weights = (ddt_samples, ddt_weights)\nself._kappa_ext_mean, self._kappa_ext_sigma = (kappa_ext, kappa_ext_sigma)\nsuper(DdtKinConstraints, self).__init__(z_lens, z_source, theta_E, theta_E_error, gamma, gamma_error, r_eff, r_eff_error, sigma_v, sigma_v_error_independent, sigma_v_error_c...
<|body_start_0|> self._ddt_sample, self._ddt_weights = (ddt_samples, ddt_weights) self._kappa_ext_mean, self._kappa_ext_sigma = (kappa_ext, kappa_ext_sigma) super(DdtKinConstraints, self).__init__(z_lens, z_source, theta_E, theta_E_error, gamma, gamma_error, r_eff, r_eff_error, sigma_v, sigma_v_...
class for sampling Ds/Dds posteriors from imaging data and kinematic constraints with additional constraints on the time-delay distance Ddt
DdtKinConstraints
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DdtKinConstraints: """class for sampling Ds/Dds posteriors from imaging data and kinematic constraints with additional constraints on the time-delay distance Ddt""" def __init__(self, z_lens, z_source, ddt_samples, ddt_weights, theta_E, theta_E_error, gamma, gamma_error, r_eff, r_eff_error, ...
stack_v2_sparse_classes_75kplus_train_069869
5,870
permissive
[ { "docstring": ":param z_lens: lens redshift :param z_source: source redshift :param ddt_samples: numpy array with a sample reflecting the likelihood density in Ddt given imaging data and time delays. :param ddt_weights: None or lenght of ddt_samples, weights of individual ddt_samples :param sigma_v: numpy arra...
2
stack_v2_sparse_classes_30k_val_001831
Implement the Python class `DdtKinConstraints` described below. Class description: class for sampling Ds/Dds posteriors from imaging data and kinematic constraints with additional constraints on the time-delay distance Ddt Method signatures and docstrings: - def __init__(self, z_lens, z_source, ddt_samples, ddt_weigh...
Implement the Python class `DdtKinConstraints` described below. Class description: class for sampling Ds/Dds posteriors from imaging data and kinematic constraints with additional constraints on the time-delay distance Ddt Method signatures and docstrings: - def __init__(self, z_lens, z_source, ddt_samples, ddt_weigh...
1dc2be90f44f99e82ab7014f2027fbb077b14f98
<|skeleton|> class DdtKinConstraints: """class for sampling Ds/Dds posteriors from imaging data and kinematic constraints with additional constraints on the time-delay distance Ddt""" def __init__(self, z_lens, z_source, ddt_samples, ddt_weights, theta_E, theta_E_error, gamma, gamma_error, r_eff, r_eff_error, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DdtKinConstraints: """class for sampling Ds/Dds posteriors from imaging data and kinematic constraints with additional constraints on the time-delay distance Ddt""" def __init__(self, z_lens, z_source, ddt_samples, ddt_weights, theta_E, theta_E_error, gamma, gamma_error, r_eff, r_eff_error, sigma_v, sigm...
the_stack_v2_python_sparse
hierarc/LensPosterior/ddt_kin_constraints.py
LBJ-Wade/hierarc_SGL
train
0
bba765f632d586624cb3a7f9df1fb4dba3297e9b
[ "super(TempMediaMixin, self).setup_test_environment()\nself.__original_media_root = settings.MEDIA_ROOT\nself.__original_file_storage = settings.DEFAULT_FILE_STORAGE\nself.__temp_media = tempfile.mkdtemp()\nprint(\"Using temporary media root '{}'...\".format(self.__temp_media))\nsettings.MEDIA_ROOT = self.__temp_me...
<|body_start_0|> super(TempMediaMixin, self).setup_test_environment() self.__original_media_root = settings.MEDIA_ROOT self.__original_file_storage = settings.DEFAULT_FILE_STORAGE self.__temp_media = tempfile.mkdtemp() print("Using temporary media root '{}'...".format(self.__temp...
Mixin to create MEDIA_ROOT in temp and tear down when complete.
TempMediaMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempMediaMixin: """Mixin to create MEDIA_ROOT in temp and tear down when complete.""" def setup_test_environment(self): """Create temp directory and update MEDIA_ROOT and default storage.""" <|body_0|> def teardown_test_environment(self): """Delete temp storage."...
stack_v2_sparse_classes_75kplus_train_069870
1,412
permissive
[ { "docstring": "Create temp directory and update MEDIA_ROOT and default storage.", "name": "setup_test_environment", "signature": "def setup_test_environment(self)" }, { "docstring": "Delete temp storage.", "name": "teardown_test_environment", "signature": "def teardown_test_environment(...
2
stack_v2_sparse_classes_30k_train_046376
Implement the Python class `TempMediaMixin` described below. Class description: Mixin to create MEDIA_ROOT in temp and tear down when complete. Method signatures and docstrings: - def setup_test_environment(self): Create temp directory and update MEDIA_ROOT and default storage. - def teardown_test_environment(self): ...
Implement the Python class `TempMediaMixin` described below. Class description: Mixin to create MEDIA_ROOT in temp and tear down when complete. Method signatures and docstrings: - def setup_test_environment(self): Create temp directory and update MEDIA_ROOT and default storage. - def teardown_test_environment(self): ...
9baa530f2f3405322f74ccc145641148f253341b
<|skeleton|> class TempMediaMixin: """Mixin to create MEDIA_ROOT in temp and tear down when complete.""" def setup_test_environment(self): """Create temp directory and update MEDIA_ROOT and default storage.""" <|body_0|> def teardown_test_environment(self): """Delete temp storage."...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TempMediaMixin: """Mixin to create MEDIA_ROOT in temp and tear down when complete.""" def setup_test_environment(self): """Create temp directory and update MEDIA_ROOT and default storage.""" super(TempMediaMixin, self).setup_test_environment() self.__original_media_root = settings...
the_stack_v2_python_sparse
palvelutori/testrunner.py
City-of-Turku/munpalvelut_backend
train
0
ccf6961b45a4123f40407afc5fc110cc398a9c34
[ "self.noise_dir = noise_dir\nself.clean_noise_ratio = clean_noise_ratio\nself.aug_noises = []\nself.load_noises()", "noises = glob(os.path.join(self.noise_dir, '*.flac'))\nself.aug_noises = []\nfor file in noises:\n noise, _ = sf.read(file)\n self.aug_noises.append(noise)\n clean_sample = np.zeros_like(n...
<|body_start_0|> self.noise_dir = noise_dir self.clean_noise_ratio = clean_noise_ratio self.aug_noises = [] self.load_noises() <|end_body_0|> <|body_start_1|> noises = glob(os.path.join(self.noise_dir, '*.flac')) self.aug_noises = [] for file in noises: ...
NoiseInjection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NoiseInjection: def __init__(self, noise_dir, clean_noise_ratio=2): """define a list of clean and noisy samples used afterwards for augmentation :param noise_dir: directory that contains the noise samples :param clean_noise_ratio: for each noisy sample add "clean_noise_ratio" times clean...
stack_v2_sparse_classes_75kplus_train_069871
1,871
no_license
[ { "docstring": "define a list of clean and noisy samples used afterwards for augmentation :param noise_dir: directory that contains the noise samples :param clean_noise_ratio: for each noisy sample add \"clean_noise_ratio\" times clean samples, for example for 10 noisy samples and clean_noise_ratio == 2, aug_no...
3
null
Implement the Python class `NoiseInjection` described below. Class description: Implement the NoiseInjection class. Method signatures and docstrings: - def __init__(self, noise_dir, clean_noise_ratio=2): define a list of clean and noisy samples used afterwards for augmentation :param noise_dir: directory that contain...
Implement the Python class `NoiseInjection` described below. Class description: Implement the NoiseInjection class. Method signatures and docstrings: - def __init__(self, noise_dir, clean_noise_ratio=2): define a list of clean and noisy samples used afterwards for augmentation :param noise_dir: directory that contain...
bdae363d5f947ec2f07b468845026e6939c1671b
<|skeleton|> class NoiseInjection: def __init__(self, noise_dir, clean_noise_ratio=2): """define a list of clean and noisy samples used afterwards for augmentation :param noise_dir: directory that contains the noise samples :param clean_noise_ratio: for each noisy sample add "clean_noise_ratio" times clean...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NoiseInjection: def __init__(self, noise_dir, clean_noise_ratio=2): """define a list of clean and noisy samples used afterwards for augmentation :param noise_dir: directory that contains the noise samples :param clean_noise_ratio: for each noisy sample add "clean_noise_ratio" times clean samples, for ...
the_stack_v2_python_sparse
07_master_thesis_unsupervised_learning/src/data/augmentation.py
atefattia/data_science
train
1
04b339378556ec03d12f3abf842d9fd4260abbce
[ "super(PublicationFileInlineForm, self).__init__(*args, **kwargs)\nentity = getattr(self, 'entity', None)\navailable_choices = list(self.AVAILABLE_CHOICES)\nif entity and hasattr(entity, 'content'):\n try:\n for block in entity.content.contentitems.filter(instance_of=BlockItem):\n available_cho...
<|body_start_0|> super(PublicationFileInlineForm, self).__init__(*args, **kwargs) entity = getattr(self, 'entity', None) available_choices = list(self.AVAILABLE_CHOICES) if entity and hasattr(entity, 'content'): try: for block in entity.content.contentitems.fi...
Определяет форму и поля загрузчика файлов в публикациях
PublicationFileInlineForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicationFileInlineForm: """Определяет форму и поля загрузчика файлов в публикациях""" def __init__(self, *args, **kwargs): """Конструктор класса""" <|body_0|> def clean(self): """Словарь проверенных и нормализованных данных формы загрузки файлов в публикациях"...
stack_v2_sparse_classes_75kplus_train_069872
1,709
permissive
[ { "docstring": "Конструктор класса", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Словарь проверенных и нормализованных данных формы загрузки файлов в публикациях", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_012761
Implement the Python class `PublicationFileInlineForm` described below. Class description: Определяет форму и поля загрузчика файлов в публикациях Method signatures and docstrings: - def __init__(self, *args, **kwargs): Конструктор класса - def clean(self): Словарь проверенных и нормализованных данных формы загрузки ...
Implement the Python class `PublicationFileInlineForm` described below. Class description: Определяет форму и поля загрузчика файлов в публикациях Method signatures and docstrings: - def __init__(self, *args, **kwargs): Конструктор класса - def clean(self): Словарь проверенных и нормализованных данных формы загрузки ...
186c783b4e4ed58199db7165703253cac1189c5a
<|skeleton|> class PublicationFileInlineForm: """Определяет форму и поля загрузчика файлов в публикациях""" def __init__(self, *args, **kwargs): """Конструктор класса""" <|body_0|> def clean(self): """Словарь проверенных и нормализованных данных формы загрузки файлов в публикациях"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PublicationFileInlineForm: """Определяет форму и поля загрузчика файлов в публикациях""" def __init__(self, *args, **kwargs): """Конструктор класса""" super(PublicationFileInlineForm, self).__init__(*args, **kwargs) entity = getattr(self, 'entity', None) available_choices ...
the_stack_v2_python_sparse
edw_fluent/admin/forms/file.py
infolabs/django-edw-fluent
train
0
5777500799bbe37ab13f66dc6a19e8fcd6b8f654
[ "cls.TheLock.acquire()\nif '%' not in var_format:\n var_format += '%d'\nif var_format not in cls.indexes:\n cls.indexes[var_format] = 0\ni = cls.indexes[var_format]\ncls.indexes[var_format] += 1\ncls.TheLock.release()\nif var_format[0] in ['$', '?'] or var_format[0].islower() or (not auto_prefix):\n return...
<|body_start_0|> cls.TheLock.acquire() if '%' not in var_format: var_format += '%d' if var_format not in cls.indexes: cls.indexes[var_format] = 0 i = cls.indexes[var_format] cls.indexes[var_format] += 1 cls.TheLock.release() if var_format[0...
VarGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VarGenerator: def create_var(cls, var_format, auto_prefix=True): """Restituisce una nuova variabile nel formato indicato""" <|body_0|> def factory(cls, var_format, auto_prefix=True): """Restituisce una funzione che ad ogni chiamata restituisce una nuova variabile nel...
stack_v2_sparse_classes_75kplus_train_069873
1,346
no_license
[ { "docstring": "Restituisce una nuova variabile nel formato indicato", "name": "create_var", "signature": "def create_var(cls, var_format, auto_prefix=True)" }, { "docstring": "Restituisce una funzione che ad ogni chiamata restituisce una nuova variabile nel formato indicato.", "name": "fact...
2
null
Implement the Python class `VarGenerator` described below. Class description: Implement the VarGenerator class. Method signatures and docstrings: - def create_var(cls, var_format, auto_prefix=True): Restituisce una nuova variabile nel formato indicato - def factory(cls, var_format, auto_prefix=True): Restituisce una ...
Implement the Python class `VarGenerator` described below. Class description: Implement the VarGenerator class. Method signatures and docstrings: - def create_var(cls, var_format, auto_prefix=True): Restituisce una nuova variabile nel formato indicato - def factory(cls, var_format, auto_prefix=True): Restituisce una ...
8a8f98c7cd271797ed490de35320fb190f2fd347
<|skeleton|> class VarGenerator: def create_var(cls, var_format, auto_prefix=True): """Restituisce una nuova variabile nel formato indicato""" <|body_0|> def factory(cls, var_format, auto_prefix=True): """Restituisce una funzione che ad ogni chiamata restituisce una nuova variabile nel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VarGenerator: def create_var(cls, var_format, auto_prefix=True): """Restituisce una nuova variabile nel formato indicato""" cls.TheLock.acquire() if '%' not in var_format: var_format += '%d' if var_format not in cls.indexes: cls.indexes[var_format] = 0 ...
the_stack_v2_python_sparse
xuse/util/vargenerator.py
BackupTheBerlios/bak4-svn
train
0
d30b5973fb258f9858e68a2ad6a579556e19d1a3
[ "self.user1 = User.objects.create_user(username='testuser1', password='12345')\nself.user2 = User.objects.create_user(username='testuser2', password='23456')\nself.login = self.client.login(username='testuser1', password='12345')\ndata = {'PSCountry': 'UK'}\nresponse = self.client.post('/pscountries/', data, format...
<|body_start_0|> self.user1 = User.objects.create_user(username='testuser1', password='12345') self.user2 = User.objects.create_user(username='testuser2', password='23456') self.login = self.client.login(username='testuser1', password='12345') data = {'PSCountry': 'UK'} response ...
BackEnd_LoggedIn_DifferentUser_Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackEnd_LoggedIn_DifferentUser_Test: def setUp(self): """Within this class, create a user object, populate data, login as a different user and test permissions.""" <|body_0|> def test_put_pscountry(self): """Test putting the country""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_069874
15,689
no_license
[ { "docstring": "Within this class, create a user object, populate data, login as a different user and test permissions.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test putting the country", "name": "test_put_pscountry", "signature": "def test_put_pscountry(self)...
2
null
Implement the Python class `BackEnd_LoggedIn_DifferentUser_Test` described below. Class description: Implement the BackEnd_LoggedIn_DifferentUser_Test class. Method signatures and docstrings: - def setUp(self): Within this class, create a user object, populate data, login as a different user and test permissions. - d...
Implement the Python class `BackEnd_LoggedIn_DifferentUser_Test` described below. Class description: Implement the BackEnd_LoggedIn_DifferentUser_Test class. Method signatures and docstrings: - def setUp(self): Within this class, create a user object, populate data, login as a different user and test permissions. - d...
531679fb217eeb31dddce212f192f0dc05de3e3f
<|skeleton|> class BackEnd_LoggedIn_DifferentUser_Test: def setUp(self): """Within this class, create a user object, populate data, login as a different user and test permissions.""" <|body_0|> def test_put_pscountry(self): """Test putting the country""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BackEnd_LoggedIn_DifferentUser_Test: def setUp(self): """Within this class, create a user object, populate data, login as a different user and test permissions.""" self.user1 = User.objects.create_user(username='testuser1', password='12345') self.user2 = User.objects.create_user(userna...
the_stack_v2_python_sparse
5_RestBrokerData/apps/backend/tests.py
MarkyMark1000/AWS_Django_MultiProject
train
0
7f5fa07dfdf47d370aabd0df0809d47e09be453a
[ "q = [(i, j) for i, row in enumerate(rooms) for j, r in enumerate(row) if not r]\nfor i, j in q:\n for row_index, col_index in ((i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)):\n if 0 <= row_index < len(rooms) and 0 <= col_index < len(rooms[0]) and (rooms[row_index][col_index] > 2 ** 30):\n roo...
<|body_start_0|> q = [(i, j) for i, row in enumerate(rooms) for j, r in enumerate(row) if not r] for i, j in q: for row_index, col_index in ((i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)): if 0 <= row_index < len(rooms) and 0 <= col_index < len(rooms[0]) and (rooms[row_index...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wallsAndGates(self, rooms): """:type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead. BFS (start from gate who is r in the code and represented as 0) beats 78.90%""" <|body_0|> def wallsAndGates1(self, rooms): "...
stack_v2_sparse_classes_75kplus_train_069875
1,565
no_license
[ { "docstring": ":type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead. BFS (start from gate who is r in the code and represented as 0) beats 78.90%", "name": "wallsAndGates", "signature": "def wallsAndGates(self, rooms)" }, { "docstring": ":type rooms: L...
2
stack_v2_sparse_classes_30k_train_041377
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wallsAndGates(self, rooms): :type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead. BFS (start from gate who is r in the code and rep...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wallsAndGates(self, rooms): :type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead. BFS (start from gate who is r in the code and rep...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def wallsAndGates(self, rooms): """:type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead. BFS (start from gate who is r in the code and represented as 0) beats 78.90%""" <|body_0|> def wallsAndGates1(self, rooms): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def wallsAndGates(self, rooms): """:type rooms: List[List[int]] :rtype: void Do not return anything, modify rooms in-place instead. BFS (start from gate who is r in the code and represented as 0) beats 78.90%""" q = [(i, j) for i, row in enumerate(rooms) for j, r in enumerate(row) if...
the_stack_v2_python_sparse
LeetCode/286_walls_and_gates.py
yao23/Machine_Learning_Playground
train
12
23b05c29e736b822f673b1dd5246ae11126df428
[ "context = {}\ncontext['form'] = ClientForm()\nreturn render(self.request, self.template_name, context)", "form = ClientForm(self.request.POST, self.request.FILES, company=self.request.user.company)\nif form.is_valid():\n client = form.save(commit=False)\n client.owner = self.request.user\n client.compan...
<|body_start_0|> context = {} context['form'] = ClientForm() return render(self.request, self.template_name, context) <|end_body_0|> <|body_start_1|> form = ClientForm(self.request.POST, self.request.FILES, company=self.request.user.company) if form.is_valid(): clien...
Viewing for adding client
ClientAddView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientAddView: """Viewing for adding client""" def get(self, *args, **kwargs): """Display the client form""" <|body_0|> def post(self, *args, **kwargs): """Getting the filled form of client""" <|body_1|> <|end_skeleton|> <|body_start_0|> context...
stack_v2_sparse_classes_75kplus_train_069876
4,241
no_license
[ { "docstring": "Display the client form", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "Getting the filled form of client", "name": "post", "signature": "def post(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_050070
Implement the Python class `ClientAddView` described below. Class description: Viewing for adding client Method signatures and docstrings: - def get(self, *args, **kwargs): Display the client form - def post(self, *args, **kwargs): Getting the filled form of client
Implement the Python class `ClientAddView` described below. Class description: Viewing for adding client Method signatures and docstrings: - def get(self, *args, **kwargs): Display the client form - def post(self, *args, **kwargs): Getting the filled form of client <|skeleton|> class ClientAddView: """Viewing fo...
17615ea9bfb1edebe41d60dbf2e977f0018d5339
<|skeleton|> class ClientAddView: """Viewing for adding client""" def get(self, *args, **kwargs): """Display the client form""" <|body_0|> def post(self, *args, **kwargs): """Getting the filled form of client""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClientAddView: """Viewing for adding client""" def get(self, *args, **kwargs): """Display the client form""" context = {} context['form'] = ClientForm() return render(self.request, self.template_name, context) def post(self, *args, **kwargs): """Getting the fi...
the_stack_v2_python_sparse
clients/views.py
Swiftkind/invoice
train
0
bbb9048bb49bdfe6f3268a2a740a83d72c9a0315
[ "self.player = player\nself.matchPile = matchPile\nscreen = HitPileScreen(player, matchPile)\nConsoleController.__init__(self, screen, cancellable=True, commands={'1': self.tryToHitPile, '2': self.tryToHitPile, '3': self.tryToHitPile, '4': self.tryToHitPile, '5': self.tryToHitPile, '6': self.tryToHitPile, '7': self...
<|body_start_0|> self.player = player self.matchPile = matchPile screen = HitPileScreen(player, matchPile) ConsoleController.__init__(self, screen, cancellable=True, commands={'1': self.tryToHitPile, '2': self.tryToHitPile, '3': self.tryToHitPile, '4': self.tryToHitPile, '5': self.tryToH...
Controller for letting the player actually try to hit a match pile
HitPileController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HitPileController: """Controller for letting the player actually try to hit a match pile""" def __init__(self, player, matchPile): """Initialize the Controller""" <|body_0|> def tryToHitPile(self, event): """Try To Hit the pile with the card denoted by the event"...
stack_v2_sparse_classes_75kplus_train_069877
2,076
no_license
[ { "docstring": "Initialize the Controller", "name": "__init__", "signature": "def __init__(self, player, matchPile)" }, { "docstring": "Try To Hit the pile with the card denoted by the event", "name": "tryToHitPile", "signature": "def tryToHitPile(self, event)" } ]
2
null
Implement the Python class `HitPileController` described below. Class description: Controller for letting the player actually try to hit a match pile Method signatures and docstrings: - def __init__(self, player, matchPile): Initialize the Controller - def tryToHitPile(self, event): Try To Hit the pile with the card ...
Implement the Python class `HitPileController` described below. Class description: Controller for letting the player actually try to hit a match pile Method signatures and docstrings: - def __init__(self, player, matchPile): Initialize the Controller - def tryToHitPile(self, event): Try To Hit the pile with the card ...
c46f2e7809b4ffc6443b279ee86edb4a0ac99a09
<|skeleton|> class HitPileController: """Controller for letting the player actually try to hit a match pile""" def __init__(self, player, matchPile): """Initialize the Controller""" <|body_0|> def tryToHitPile(self, event): """Try To Hit the pile with the card denoted by the event"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HitPileController: """Controller for letting the player actually try to hit a match pile""" def __init__(self, player, matchPile): """Initialize the Controller""" self.player = player self.matchPile = matchPile screen = HitPileScreen(player, matchPile) ConsoleContr...
the_stack_v2_python_sparse
src/View/Console/Game/Player/hit_pile_controller.py
cloew/KaoPhaseTen
train
0
b9d915645b851fcd8035486f5f9c356ac8d6a9f1
[ "try:\n physical_devices = tf.config.list_physical_devices('GPU')\n tf.config.experimental.set_memory_growth(physical_devices[0], True)\nexcept:\n pass\nsuper(DenseLayer, self).__init__()\nif param_init == 'autograder':\n np.random.seed(137)\n param_init = dict(W=None, b=None)\n param_init['W'] = ...
<|body_start_0|> try: physical_devices = tf.config.list_physical_devices('GPU') tf.config.experimental.set_memory_growth(physical_devices[0], True) except: pass super(DenseLayer, self).__init__() if param_init == 'autograder': np.random.see...
Implement a dense layer
DenseLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenseLayer: """Implement a dense layer""" def __init__(self, input_dim, output_dim, activation='relu', reg_weight=1e-05, param_init=None): """Initialize weights of the DenseLayer. In Tensorflow's implementation, the weight matrix and bias term are initialized in the `build` function....
stack_v2_sparse_classes_75kplus_train_069878
11,511
permissive
[ { "docstring": "Initialize weights of the DenseLayer. In Tensorflow's implementation, the weight matrix and bias term are initialized in the `build` function. Here let's use the simple form. https://www.tensorflow.org/guide/keras/custom_layers_and_models args: input_dim: integer, the dimension of the input laye...
2
stack_v2_sparse_classes_30k_train_037852
Implement the Python class `DenseLayer` described below. Class description: Implement a dense layer Method signatures and docstrings: - def __init__(self, input_dim, output_dim, activation='relu', reg_weight=1e-05, param_init=None): Initialize weights of the DenseLayer. In Tensorflow's implementation, the weight matr...
Implement the Python class `DenseLayer` described below. Class description: Implement a dense layer Method signatures and docstrings: - def __init__(self, input_dim, output_dim, activation='relu', reg_weight=1e-05, param_init=None): Initialize weights of the DenseLayer. In Tensorflow's implementation, the weight matr...
59f48c0c3e7d746fb9b24daa8b9e62eacade4ee2
<|skeleton|> class DenseLayer: """Implement a dense layer""" def __init__(self, input_dim, output_dim, activation='relu', reg_weight=1e-05, param_init=None): """Initialize weights of the DenseLayer. In Tensorflow's implementation, the weight matrix and bias term are initialized in the `build` function....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DenseLayer: """Implement a dense layer""" def __init__(self, input_dim, output_dim, activation='relu', reg_weight=1e-05, param_init=None): """Initialize weights of the DenseLayer. In Tensorflow's implementation, the weight matrix and bias term are initialized in the `build` function. Here let's u...
the_stack_v2_python_sparse
HW2/implementation.py
mcdermatt/dnn
train
4
f18fc0fbfc739ef67c3daa42b6e9a54af8169401
[ "self._facility = facility\nself._option = option\nself._priority = priority", "title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)\nsyslog.openlog(title, self._option, self._facility)\nsyslog.syslog(self._priority, message)\nsyslog.closelog()" ]
<|body_start_0|> self._facility = facility self._option = option self._priority = priority <|end_body_0|> <|body_start_1|> title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT) syslog.openlog(title, self._option, self._facility) syslog.syslog(self._priority, message) ...
Implement the syslog notification service.
SyslogNotificationService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyslogNotificationService: """Implement the syslog notification service.""" def __init__(self, facility, option, priority): """Initialize the service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to syslog.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_069879
2,640
permissive
[ { "docstring": "Initialize the service.", "name": "__init__", "signature": "def __init__(self, facility, option, priority)" }, { "docstring": "Send a message to syslog.", "name": "send_message", "signature": "def send_message(self, message='', **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_001554
Implement the Python class `SyslogNotificationService` described below. Class description: Implement the syslog notification service. Method signatures and docstrings: - def __init__(self, facility, option, priority): Initialize the service. - def send_message(self, message='', **kwargs): Send a message to syslog.
Implement the Python class `SyslogNotificationService` described below. Class description: Implement the syslog notification service. Method signatures and docstrings: - def __init__(self, facility, option, priority): Initialize the service. - def send_message(self, message='', **kwargs): Send a message to syslog. <...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SyslogNotificationService: """Implement the syslog notification service.""" def __init__(self, facility, option, priority): """Initialize the service.""" <|body_0|> def send_message(self, message='', **kwargs): """Send a message to syslog.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SyslogNotificationService: """Implement the syslog notification service.""" def __init__(self, facility, option, priority): """Initialize the service.""" self._facility = facility self._option = option self._priority = priority def send_message(self, message='', **kwa...
the_stack_v2_python_sparse
homeassistant/components/syslog/notify.py
home-assistant/core
train
35,501
d84bd57e7fa0398b7d9e5527445e0f30c6951980
[ "if item in self:\n return super(_LoadedConfigs, self).__getitem__(item)\naddon = item.replace('_config', '')\nif addon in ValidAddons.all:\n import_path = 'gungame51.scripts.%s.%s.%s' % (ValidAddons.get_addon_type(addon), addon, item)\nelif _base_configs.joinpath(item + '.py').isfile():\n import_path = 'g...
<|body_start_0|> if item in self: return super(_LoadedConfigs, self).__getitem__(item) addon = item.replace('_config', '') if addon in ValidAddons.all: import_path = 'gungame51.scripts.%s.%s.%s' % (ValidAddons.get_addon_type(addon), addon, item) elif _base_configs...
Class used to store loaded config files
_LoadedConfigs
[ "Artistic-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _LoadedConfigs: """Class used to store loaded config files""" def __getitem__(self, item): """Verify that the given item is a config file instance and store it""" <|body_0|> def clear(self): """Unloads all configs within the dicionary""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_069880
2,849
permissive
[ { "docstring": "Verify that the given item is a config file instance and store it", "name": "__getitem__", "signature": "def __getitem__(self, item)" }, { "docstring": "Unloads all configs within the dicionary", "name": "clear", "signature": "def clear(self)" } ]
2
stack_v2_sparse_classes_30k_val_002217
Implement the Python class `_LoadedConfigs` described below. Class description: Class used to store loaded config files Method signatures and docstrings: - def __getitem__(self, item): Verify that the given item is a config file instance and store it - def clear(self): Unloads all configs within the dicionary
Implement the Python class `_LoadedConfigs` described below. Class description: Class used to store loaded config files Method signatures and docstrings: - def __getitem__(self, item): Verify that the given item is a config file instance and store it - def clear(self): Unloads all configs within the dicionary <|skel...
ebf4624626266f552189a32612b8d09cd5b4c5a3
<|skeleton|> class _LoadedConfigs: """Class used to store loaded config files""" def __getitem__(self, item): """Verify that the given item is a config file instance and store it""" <|body_0|> def clear(self): """Unloads all configs within the dicionary""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _LoadedConfigs: """Class used to store loaded config files""" def __getitem__(self, item): """Verify that the given item is a config file instance and store it""" if item in self: return super(_LoadedConfigs, self).__getitem__(item) addon = item.replace('_config', '') ...
the_stack_v2_python_sparse
cstrike/addons/eventscripts/gungame51/core/cfg/loaded.py
GunGame-Dev-Team/GunGame51
train
0
e6cccf92aaef0b704c9ea27d8f9dc7047e422668
[ "try:\n return get_all_companies()\nexcept Exception as e:\n api.abort(500)", "data = request.json\ntry:\n return save_new_company(data=data)\nexcept EonError as e:\n if e.code and e.message:\n api.abort(e.code, e.message)\n else:\n api.abort(500)" ]
<|body_start_0|> try: return get_all_companies() except Exception as e: api.abort(500) <|end_body_0|> <|body_start_1|> data = request.json try: return save_new_company(data=data) except EonError as e: if e.code and e.message: ...
CompanyList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompanyList: def get(self): """Returns companies, known by this node, in a list""" <|body_0|> def post(self): """Register a new Company""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: return get_all_companies() except Except...
stack_v2_sparse_classes_75kplus_train_069881
3,399
permissive
[ { "docstring": "Returns companies, known by this node, in a list", "name": "get", "signature": "def get(self)" }, { "docstring": "Register a new Company", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `CompanyList` described below. Class description: Implement the CompanyList class. Method signatures and docstrings: - def get(self): Returns companies, known by this node, in a list - def post(self): Register a new Company
Implement the Python class `CompanyList` described below. Class description: Implement the CompanyList class. Method signatures and docstrings: - def get(self): Returns companies, known by this node, in a list - def post(self): Register a new Company <|skeleton|> class CompanyList: def get(self): """Ret...
bc7f1cb0ef640662a04f0040603fde092cabe336
<|skeleton|> class CompanyList: def get(self): """Returns companies, known by this node, in a list""" <|body_0|> def post(self): """Register a new Company""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CompanyList: def get(self): """Returns companies, known by this node, in a list""" try: return get_all_companies() except Exception as e: api.abort(500) def post(self): """Register a new Company""" data = request.json try: ...
the_stack_v2_python_sparse
app/main/controller/company_controller.py
OdysseyMomentum/Cryptomice-Eonpeers
train
0
b55e14f3e6964f3000eed58ed95c45e527f88b4b
[ "self.exampleInterface = ExampleInterface(dataRemote=False)\nself.wsRemoteService = WsRemoteService(args, webSocketChannelName)\nself.wsRemoteService.addHandlerClass(ExampleInterface, self.exampleInterface)", "self.recvThread = threading.Thread(name='recvThread', target=self.wsRemoteService.runForever)\nself.recv...
<|body_start_0|> self.exampleInterface = ExampleInterface(dataRemote=False) self.wsRemoteService = WsRemoteService(args, webSocketChannelName) self.wsRemoteService.addHandlerClass(ExampleInterface, self.exampleInterface) <|end_body_0|> <|body_start_1|> self.recvThread = threading.Thread...
ExampleService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExampleService: def __init__(self, args, webSocketChannelName='wsData'): """Uses the WsRemoteService framework to parse connection-related args and establish a connection to a remote projectServer. Instantiates a local version of ExampleInterface to handle client requests coming from the...
stack_v2_sparse_classes_75kplus_train_069882
2,550
permissive
[ { "docstring": "Uses the WsRemoteService framework to parse connection-related args and establish a connection to a remote projectServer. Instantiates a local version of ExampleInterface to handle client requests coming from the projectServer connection. Args: args: Argparse args related to connecting to the re...
2
null
Implement the Python class `ExampleService` described below. Class description: Implement the ExampleService class. Method signatures and docstrings: - def __init__(self, args, webSocketChannelName='wsData'): Uses the WsRemoteService framework to parse connection-related args and establish a connection to a remote pr...
Implement the Python class `ExampleService` described below. Class description: Implement the ExampleService class. Method signatures and docstrings: - def __init__(self, args, webSocketChannelName='wsData'): Uses the WsRemoteService framework to parse connection-related args and establish a connection to a remote pr...
3eb181152e173d5e8e5e46c2d2faeab25f11f564
<|skeleton|> class ExampleService: def __init__(self, args, webSocketChannelName='wsData'): """Uses the WsRemoteService framework to parse connection-related args and establish a connection to a remote projectServer. Instantiates a local version of ExampleInterface to handle client requests coming from the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExampleService: def __init__(self, args, webSocketChannelName='wsData'): """Uses the WsRemoteService framework to parse connection-related args and establish a connection to a remote projectServer. Instantiates a local version of ExampleInterface to handle client requests coming from the projectServer...
the_stack_v2_python_sparse
rtCommon/exampleService.py
brainiak/rt-cloud
train
13
65623fc1d01f2c92a9b19569a22ea0f8d36900bb
[ "if obj:\n return int(obj * 100)\nreturn None", "if obj.budget:\n return obj.budget / 100.0\nreturn None", "if obj.current_costs:\n return obj.current_costs / 100.0\nreturn None" ]
<|body_start_0|> if obj: return int(obj * 100) return None <|end_body_0|> <|body_start_1|> if obj.budget: return obj.budget / 100.0 return None <|end_body_1|> <|body_start_2|> if obj.current_costs: return obj.current_costs / 100.0 ret...
Convert between euro and cent. Used to convert different fields when serializing and deserializing. As different parameters are passed depending on whether a VALUE is deserialized or an OBJECT is deserialized different method are required.
MoneyConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoneyConverter: """Convert between euro and cent. Used to convert different fields when serializing and deserializing. As different parameters are passed depending on whether a VALUE is deserialized or an OBJECT is deserialized different method are required.""" def to_cent(self, obj: Optiona...
stack_v2_sparse_classes_75kplus_train_069883
9,084
permissive
[ { "docstring": "Convert an amount in euro to cent.", "name": "to_cent", "signature": "def to_cent(self, obj: Optional[float]) -> Optional[int]" }, { "docstring": "Convert the 'budget' from cent to euro.", "name": "to_euro_budget", "signature": "def to_euro_budget(self, obj: Job) -> Optio...
3
stack_v2_sparse_classes_30k_train_034422
Implement the Python class `MoneyConverter` described below. Class description: Convert between euro and cent. Used to convert different fields when serializing and deserializing. As different parameters are passed depending on whether a VALUE is deserialized or an OBJECT is deserialized different method are required....
Implement the Python class `MoneyConverter` described below. Class description: Convert between euro and cent. Used to convert different fields when serializing and deserializing. As different parameters are passed depending on whether a VALUE is deserialized or an OBJECT is deserialized different method are required....
822dbd3ccee25180cc48efd2f891504b6b5edc14
<|skeleton|> class MoneyConverter: """Convert between euro and cent. Used to convert different fields when serializing and deserializing. As different parameters are passed depending on whether a VALUE is deserialized or an OBJECT is deserialized different method are required.""" def to_cent(self, obj: Optiona...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MoneyConverter: """Convert between euro and cent. Used to convert different fields when serializing and deserializing. As different parameters are passed depending on whether a VALUE is deserialized or an OBJECT is deserialized different method are required.""" def to_cent(self, obj: Optional[float]) -> ...
the_stack_v2_python_sparse
services/jobs/jobs/schema.py
Open-EO/openeo-eodc-driver
train
3
7948e7fe10a3184e3e9f68a3f7c45ac8e1fb4a89
[ "self.discriminator_filters = discriminator_filters\nself.discriminator_strides = discriminator_strides\nself.generator_filters = generator_filters\nself.generator_strides = generator_strides\nself.discriminator_strides = discriminator_strides\nself.relu_leakiness = relu_leakiness\nself.generator_activation = gener...
<|body_start_0|> self.discriminator_filters = discriminator_filters self.discriminator_strides = discriminator_strides self.generator_filters = generator_filters self.generator_strides = generator_strides self.discriminator_strides = discriminator_strides self.relu_leakin...
Convolutional Autoencoder This module builds a convolutional autoencoder with varying number of layers and hidden units.
DCGAN
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DCGAN: """Convolutional Autoencoder This module builds a convolutional autoencoder with varying number of layers and hidden units.""" def __init__(self, discriminator_filters=(64, 128, 256, 512), generator_filters=(512, 256, 128, 64, 1), discriminator_strides=((1, 1, 1), (2, 2, 2), (1, 1, 1)...
stack_v2_sparse_classes_75kplus_train_069884
7,336
permissive
[ { "docstring": "Deep Convolutional Generative Adversarial Network Parameters ---------- discriminator_filters : list or tuple list of filters used for the discriminator generator_filters : list or tuple list of filters used for the generator discriminator_strides : list or tuple list of strides used for the dis...
2
null
Implement the Python class `DCGAN` described below. Class description: Convolutional Autoencoder This module builds a convolutional autoencoder with varying number of layers and hidden units. Method signatures and docstrings: - def __init__(self, discriminator_filters=(64, 128, 256, 512), generator_filters=(512, 256,...
Implement the Python class `DCGAN` described below. Class description: Convolutional Autoencoder This module builds a convolutional autoencoder with varying number of layers and hidden units. Method signatures and docstrings: - def __init__(self, discriminator_filters=(64, 128, 256, 512), generator_filters=(512, 256,...
80d1a04dc163590aa44b62688b06aece78fb7fd6
<|skeleton|> class DCGAN: """Convolutional Autoencoder This module builds a convolutional autoencoder with varying number of layers and hidden units.""" def __init__(self, discriminator_filters=(64, 128, 256, 512), generator_filters=(512, 256, 128, 64, 1), discriminator_strides=((1, 1, 1), (2, 2, 2), (1, 1, 1)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DCGAN: """Convolutional Autoencoder This module builds a convolutional autoencoder with varying number of layers and hidden units.""" def __init__(self, discriminator_filters=(64, 128, 256, 512), generator_filters=(512, 256, 128, 64, 1), discriminator_strides=((1, 1, 1), (2, 2, 2), (1, 1, 1), (2, 2, 2)),...
the_stack_v2_python_sparse
dltk/models/gan/dcgan.py
pawni/DLTK-1
train
1
86f2c9a8fc1027670fc2e6c453ac470ec411bfef
[ "client = switch_to_mobile(REQUIRED_MOBILES[category])\nclient.connect_mobile()\nif reset:\n current_mobile().reset_app()\nreturn client", "client = switch_to_mobile(REQUIRED_MOBILES[category])\nclient.connect_mobile()\nif reset:\n current_mobile().reset_app()\nreturn client", "one_key = OneKeyLoginPage()...
<|body_start_0|> client = switch_to_mobile(REQUIRED_MOBILES[category]) client.connect_mobile() if reset: current_mobile().reset_app() return client <|end_body_0|> <|body_start_1|> client = switch_to_mobile(REQUIRED_MOBILES[category]) client.connect_mobile() ...
登录前置条件
LoginPreconditions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginPreconditions: """登录前置条件""" def select_mobile(category, reset=False): """选择手机""" <|body_0|> def switch_mobile(category, reset=False): """选择手机""" <|body_1|> def make_already_in_one_key_login_page(): """已经进入一键登录页""" <|body_2|> ...
stack_v2_sparse_classes_75kplus_train_069885
4,505
no_license
[ { "docstring": "选择手机", "name": "select_mobile", "signature": "def select_mobile(category, reset=False)" }, { "docstring": "选择手机", "name": "switch_mobile", "signature": "def switch_mobile(category, reset=False)" }, { "docstring": "已经进入一键登录页", "name": "make_already_in_one_key_l...
5
stack_v2_sparse_classes_30k_train_051127
Implement the Python class `LoginPreconditions` described below. Class description: 登录前置条件 Method signatures and docstrings: - def select_mobile(category, reset=False): 选择手机 - def switch_mobile(category, reset=False): 选择手机 - def make_already_in_one_key_login_page(): 已经进入一键登录页 - def login_by_one_key_login(): 从一键登录页面登录...
Implement the Python class `LoginPreconditions` described below. Class description: 登录前置条件 Method signatures and docstrings: - def select_mobile(category, reset=False): 选择手机 - def switch_mobile(category, reset=False): 选择手机 - def make_already_in_one_key_login_page(): 已经进入一键登录页 - def login_by_one_key_login(): 从一键登录页面登录...
f59cdef1bb458f661773268494694f30899331e6
<|skeleton|> class LoginPreconditions: """登录前置条件""" def select_mobile(category, reset=False): """选择手机""" <|body_0|> def switch_mobile(category, reset=False): """选择手机""" <|body_1|> def make_already_in_one_key_login_page(): """已经进入一键登录页""" <|body_2|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginPreconditions: """登录前置条件""" def select_mobile(category, reset=False): """选择手机""" client = switch_to_mobile(REQUIRED_MOBILES[category]) client.connect_mobile() if reset: current_mobile().reset_app() return client def switch_mobile(category, res...
the_stack_v2_python_sparse
preconditions/BasePreconditions.py
wangquansheng/appium-Demo
train
4
d8bea5461dd2a957e6be73adf6963a987dee95c5
[ "for child in self.children:\n if isinstance(child, VersionedExtraWhere) and (not child.params):\n _query = qn.query\n query_time = _query.querytime.time\n apply_query_time = _query.querytime.active\n alias_map = _query.alias_map\n self._set_child_joined_alias(child, alias_map)...
<|body_start_0|> for child in self.children: if isinstance(child, VersionedExtraWhere) and (not child.params): _query = qn.query query_time = _query.querytime.time apply_query_time = _query.querytime.active alias_map = _query.alias_map ...
VersionedWhereNode
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionedWhereNode: def as_sql(self, qn, connection): """This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions for those tables based on the VersionedQuery's querytime value. :param qn: In Django 1.7 & 1.8 this is a comp...
stack_v2_sparse_classes_75kplus_train_069886
16,300
permissive
[ { "docstring": "This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions for those tables based on the VersionedQuery's querytime value. :param qn: In Django 1.7 & 1.8 this is a compiler; in 1.6, it's an instance-method :param connection: A DB con...
3
stack_v2_sparse_classes_30k_train_049781
Implement the Python class `VersionedWhereNode` described below. Class description: Implement the VersionedWhereNode class. Method signatures and docstrings: - def as_sql(self, qn, connection): This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions fo...
Implement the Python class `VersionedWhereNode` described below. Class description: Implement the VersionedWhereNode class. Method signatures and docstrings: - def as_sql(self, qn, connection): This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions fo...
72d17580b901acdffd6b11b1dbb430a01fe7c02c
<|skeleton|> class VersionedWhereNode: def as_sql(self, qn, connection): """This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions for those tables based on the VersionedQuery's querytime value. :param qn: In Django 1.7 & 1.8 this is a comp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VersionedWhereNode: def as_sql(self, qn, connection): """This method identifies joined table aliases in order for VersionedExtraWhere.as_sql() to be able to add time restrictions for those tables based on the VersionedQuery's querytime value. :param qn: In Django 1.7 & 1.8 this is a compiler; in 1.6, ...
the_stack_v2_python_sparse
versions/fields.py
JoshLabs/cleanerversion
train
1
e8c0f085fa39f3b9d575fc02beae6805f67482f1
[ "self.bar = None\nself.last_bar = None\nself.upperBar = None\nself.aimFreq = aimFreq\nself.onUpperBar = onUpperBar\nif self.aimFreq.endswith('min'):\n self.type = 'min'\n self.type_num = int(''.join((x for x in self.aimFreq if x.isdigit())))\nelif self.aimFreq.endswith('day'):\n self.type = 'day'\n self...
<|body_start_0|> self.bar = None self.last_bar = None self.upperBar = None self.aimFreq = aimFreq self.onUpperBar = onUpperBar if self.aimFreq.endswith('min'): self.type = 'min' self.type_num = int(''.join((x for x in self.aimFreq if x.isdigit())))...
K线合成器,支持:n分钟K线合成Xn分钟K线
BarManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarManager: """K线合成器,支持:n分钟K线合成Xn分钟K线""" def __init__(self, aimFreq='1day', onUpperBar=None): """构造器, 输入的参数有: (1) aimFreq: 要合成的K线周期, 包括:"5min","30min","1hour","1day","1week","1month"等 (2) onUpperBar: 大级别K线的推送函数(在策略中定义好, 在这个实例中被调用)""" <|body_0|> def updateBar(self, bar): ...
stack_v2_sparse_classes_75kplus_train_069887
15,423
permissive
[ { "docstring": "构造器, 输入的参数有: (1) aimFreq: 要合成的K线周期, 包括:\"5min\",\"30min\",\"1hour\",\"1day\",\"1week\",\"1month\"等 (2) onUpperBar: 大级别K线的推送函数(在策略中定义好, 在这个实例中被调用)", "name": "__init__", "signature": "def __init__(self, aimFreq='1day', onUpperBar=None)" }, { "docstring": "x1分钟K线更新", "name": "up...
2
stack_v2_sparse_classes_30k_train_030626
Implement the Python class `BarManager` described below. Class description: K线合成器,支持:n分钟K线合成Xn分钟K线 Method signatures and docstrings: - def __init__(self, aimFreq='1day', onUpperBar=None): 构造器, 输入的参数有: (1) aimFreq: 要合成的K线周期, 包括:"5min","30min","1hour","1day","1week","1month"等 (2) onUpperBar: 大级别K线的推送函数(在策略中定义好, 在这个实例中被...
Implement the Python class `BarManager` described below. Class description: K线合成器,支持:n分钟K线合成Xn分钟K线 Method signatures and docstrings: - def __init__(self, aimFreq='1day', onUpperBar=None): 构造器, 输入的参数有: (1) aimFreq: 要合成的K线周期, 包括:"5min","30min","1hour","1day","1week","1month"等 (2) onUpperBar: 大级别K线的推送函数(在策略中定义好, 在这个实例中被...
7543c7ed5bae70b5b87342d9317517a12444b673
<|skeleton|> class BarManager: """K线合成器,支持:n分钟K线合成Xn分钟K线""" def __init__(self, aimFreq='1day', onUpperBar=None): """构造器, 输入的参数有: (1) aimFreq: 要合成的K线周期, 包括:"5min","30min","1hour","1day","1week","1month"等 (2) onUpperBar: 大级别K线的推送函数(在策略中定义好, 在这个实例中被调用)""" <|body_0|> def updateBar(self, bar): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BarManager: """K线合成器,支持:n分钟K线合成Xn分钟K线""" def __init__(self, aimFreq='1day', onUpperBar=None): """构造器, 输入的参数有: (1) aimFreq: 要合成的K线周期, 包括:"5min","30min","1hour","1day","1week","1month"等 (2) onUpperBar: 大级别K线的推送函数(在策略中定义好, 在这个实例中被调用)""" self.bar = None self.last_bar = None se...
the_stack_v2_python_sparse
backtest/object.py
dxcv/vnpyStockEngine
train
0
6a505393b08982f1b59fcd653d1bad95c616619c
[ "body = {'gremlin': query, 'bindings': {}, 'language': 'gremlin-groovy', 'aliases': {'graph': '%s' % _cfg.graph_name, 'g': '__g_%s' % _cfg.graph_name}}\nurl = '/gremlin'\ncode, res = Request(host=host, port=port, protocol=protocol, auth=auth).request(method='post', path=url, json=body)\nreturn (code, res)", "body...
<|body_start_0|> body = {'gremlin': query, 'bindings': {}, 'language': 'gremlin-groovy', 'aliases': {'graph': '%s' % _cfg.graph_name, 'g': '__g_%s' % _cfg.graph_name}} url = '/gremlin' code, res = Request(host=host, port=port, protocol=protocol, auth=auth).request(method='post', path=url, json=b...
gremlin 接口
Gremlin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Gremlin: """gremlin 接口""" def gremlin_post(self, query, host=None, port=None, protocol=None, auth=None): """同步的gremlin查询 :param protocol: :param port: :param host: :param auth: :param query: :return:""" <|body_0|> def gremlin_job(self, query, auth=None): """异步的gr...
stack_v2_sparse_classes_75kplus_train_069888
37,941
no_license
[ { "docstring": "同步的gremlin查询 :param protocol: :param port: :param host: :param auth: :param query: :return:", "name": "gremlin_post", "signature": "def gremlin_post(self, query, host=None, port=None, protocol=None, auth=None)" }, { "docstring": "异步的gremlin查询 :param auth: :param query: :return:",...
3
null
Implement the Python class `Gremlin` described below. Class description: gremlin 接口 Method signatures and docstrings: - def gremlin_post(self, query, host=None, port=None, protocol=None, auth=None): 同步的gremlin查询 :param protocol: :param port: :param host: :param auth: :param query: :return: - def gremlin_job(self, que...
Implement the Python class `Gremlin` described below. Class description: gremlin 接口 Method signatures and docstrings: - def gremlin_post(self, query, host=None, port=None, protocol=None, auth=None): 同步的gremlin查询 :param protocol: :param port: :param host: :param auth: :param query: :return: - def gremlin_job(self, que...
89e5b34ab925bcc0bbc4ad63302e96c62a420399
<|skeleton|> class Gremlin: """gremlin 接口""" def gremlin_post(self, query, host=None, port=None, protocol=None, auth=None): """同步的gremlin查询 :param protocol: :param port: :param host: :param auth: :param query: :return:""" <|body_0|> def gremlin_job(self, query, auth=None): """异步的gr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Gremlin: """gremlin 接口""" def gremlin_post(self, query, host=None, port=None, protocol=None, auth=None): """同步的gremlin查询 :param protocol: :param port: :param host: :param auth: :param query: :return:""" body = {'gremlin': query, 'bindings': {}, 'language': 'gremlin-groovy', 'aliases': {'g...
the_stack_v2_python_sparse
src/common/server_api.py
hugegraph/hugegraph-test
train
1
d0002796ecd2f66bcbc062445a12bc7099d327b4
[ "time_elements_structure = self._GetValueFromStructure(structure, 'date_time')\nbody = self._GetValueFromStructure(structure, 'body')\nreporter = self._GetValueFromStructure(structure, 'reporter')\nevent_data = None\nif reporter == 'CRON':\n event_data = self._ParseCronMessageBody(body)\nelif reporter == 'sshd':...
<|body_start_0|> time_elements_structure = self._GetValueFromStructure(structure, 'date_time') body = self._GetValueFromStructure(structure, 'body') reporter = self._GetValueFromStructure(structure, 'reporter') event_data = None if reporter == 'CRON': event_data = sel...
Text parser plugin for traditional syslog log files.
TraditionalSyslogTextPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TraditionalSyslogTextPlugin: """Text parser plugin for traditional syslog log files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such a...
stack_v2_sparse_classes_75kplus_train_069889
25,619
permissive
[ { "docstring": "Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. key (str): name of the parsed structure. structure (pyparsing.ParseResults): tokens from a parsed log line. Raises: ParseError: if the stru...
3
null
Implement the Python class `TraditionalSyslogTextPlugin` described below. Class description: Text parser plugin for traditional syslog log files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, key, structure): Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates ...
Implement the Python class `TraditionalSyslogTextPlugin` described below. Class description: Text parser plugin for traditional syslog log files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, key, structure): Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates ...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class TraditionalSyslogTextPlugin: """Text parser plugin for traditional syslog log files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TraditionalSyslogTextPlugin: """Text parser plugin for traditional syslog log files.""" def _ParseRecord(self, parser_mediator, key, structure): """Parses a pyparsing structure. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and...
the_stack_v2_python_sparse
plaso/parsers/text_plugins/syslog.py
log2timeline/plaso
train
1,506
849b955d175ef3c1c1cdae1d0ba1368d9fb09f41
[ "script = cls()\nif check_signature(signature):\n script.type = 'P2PK'\n script.content = script.serialize('<' + signature + '>')\nreturn script", "script = cls()\nif check_signature(signature) and check_public_key(pk):\n script.type = 'P2PKH'\n script.content = script.serialize('<' + signature + '> <...
<|body_start_0|> script = cls() if check_signature(signature): script.type = 'P2PK' script.content = script.serialize('<' + signature + '>') return script <|end_body_0|> <|body_start_1|> script = cls() if check_signature(signature) and check_public_key(pk...
Defines an InputScript (ScriptSig) class that inherits from script.
InputScript
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputScript: """Defines an InputScript (ScriptSig) class that inherits from script.""" def P2PK(cls, signature): """Pay-to-PubKey template 'constructor'. Builds a P2PK InputScript from a given signature. :param signature: Transaction signature. :type signature: hex str :return: A P2P...
stack_v2_sparse_classes_75kplus_train_069890
10,836
permissive
[ { "docstring": "Pay-to-PubKey template 'constructor'. Builds a P2PK InputScript from a given signature. :param signature: Transaction signature. :type signature: hex str :return: A P2PK sScriptSig built using the given signature. :rtype: hex str", "name": "P2PK", "signature": "def P2PK(cls, signature)" ...
4
stack_v2_sparse_classes_30k_train_039500
Implement the Python class `InputScript` described below. Class description: Defines an InputScript (ScriptSig) class that inherits from script. Method signatures and docstrings: - def P2PK(cls, signature): Pay-to-PubKey template 'constructor'. Builds a P2PK InputScript from a given signature. :param signature: Trans...
Implement the Python class `InputScript` described below. Class description: Defines an InputScript (ScriptSig) class that inherits from script. Method signatures and docstrings: - def P2PK(cls, signature): Pay-to-PubKey template 'constructor'. Builds a P2PK InputScript from a given signature. :param signature: Trans...
624663f2a9619ecf53715e8bf39404b5c035a9f2
<|skeleton|> class InputScript: """Defines an InputScript (ScriptSig) class that inherits from script.""" def P2PK(cls, signature): """Pay-to-PubKey template 'constructor'. Builds a P2PK InputScript from a given signature. :param signature: Transaction signature. :type signature: hex str :return: A P2P...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputScript: """Defines an InputScript (ScriptSig) class that inherits from script.""" def P2PK(cls, signature): """Pay-to-PubKey template 'constructor'. Builds a P2PK InputScript from a given signature. :param signature: Transaction signature. :type signature: hex str :return: A P2PK sScriptSig ...
the_stack_v2_python_sparse
bitcoin_tools/core/script.py
beiex/bitcoin_tools
train
0
9b958cd56d45f5aef82d63c7cc91211c5a9d090a
[ "timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_java_time.JavaTime(timestamp=timestamp)", "query_hash = hash(query)\nevent_data = AndroidWebViewCacheEventData()\nevent_data.content_length = self._GetRowValue(query_hash, row, 'contentlength')\n...
<|body_start_0|> timestamp = self._GetRowValue(query_hash, row, value_name) if timestamp is None: return None return dfdatetime_java_time.JavaTime(timestamp=timestamp) <|end_body_0|> <|body_start_1|> query_hash = hash(query) event_data = AndroidWebViewCacheEventData(...
SQLite parser plugin for Android WebviewCache database files.
AndroidWebViewCachePlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AndroidWebViewCachePlugin: """SQLite parser plugin for Android WebviewCache database files.""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query t...
stack_v2_sparse_classes_75kplus_train_069891
3,520
permissive
[ { "docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.JavaTime: date and time value or None if not available.", "name"...
2
null
Implement the Python class `AndroidWebViewCachePlugin` described below. Class description: SQLite parser plugin for Android WebviewCache database files. Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int)...
Implement the Python class `AndroidWebViewCachePlugin` described below. Class description: SQLite parser plugin for Android WebviewCache database files. Method signatures and docstrings: - def _GetDateTimeRowValue(self, query_hash, row, value_name): Retrieves a date and time value from the row. Args: query_hash (int)...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class AndroidWebViewCachePlugin: """SQLite parser plugin for Android WebviewCache database files.""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AndroidWebViewCachePlugin: """SQLite parser plugin for Android WebviewCache database files.""" def _GetDateTimeRowValue(self, query_hash, row, value_name): """Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced ...
the_stack_v2_python_sparse
plaso/parsers/sqlite_plugins/android_webviewcache.py
log2timeline/plaso
train
1,506
3f89dae91c71a98247aaf3fc00979abbfdd6931c
[ "input_doc = xml.dom.minidom.parse(filename)\npoint = point.process(input_doc.getElementsByTagName('Parameters')[0])\nrequests = self._handleRequests(input_doc.getElementsByTagName('Requests')[0])\nreturn (point, requests)", "requests = {}\nfor child in node.childNodes:\n if child.nodeType == node.ELEMENT_NODE...
<|body_start_0|> input_doc = xml.dom.minidom.parse(filename) point = point.process(input_doc.getElementsByTagName('Parameters')[0]) requests = self._handleRequests(input_doc.getElementsByTagName('Requests')[0]) return (point, requests) <|end_body_0|> <|body_start_1|> requests = ...
The reader/writer for the COLIN XML IO Formats
ColinXmlIO
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColinXmlIO: """The reader/writer for the COLIN XML IO Formats""" def read(self, filename, point): """Read a point and request information. This method returns a tuple: point, requests""" <|body_0|> def _handleRequests(self, node): """A function that processes the...
stack_v2_sparse_classes_75kplus_train_069892
2,928
permissive
[ { "docstring": "Read a point and request information. This method returns a tuple: point, requests", "name": "read", "signature": "def read(self, filename, point)" }, { "docstring": "A function that processes the requests", "name": "_handleRequests", "signature": "def _handleRequests(sel...
4
stack_v2_sparse_classes_30k_train_052264
Implement the Python class `ColinXmlIO` described below. Class description: The reader/writer for the COLIN XML IO Formats Method signatures and docstrings: - def read(self, filename, point): Read a point and request information. This method returns a tuple: point, requests - def _handleRequests(self, node): A functi...
Implement the Python class `ColinXmlIO` described below. Class description: The reader/writer for the COLIN XML IO Formats Method signatures and docstrings: - def read(self, filename, point): Read a point and request information. This method returns a tuple: point, requests - def _handleRequests(self, node): A functi...
ab4ada5a93aed570a6e6ca6161462e970cffe677
<|skeleton|> class ColinXmlIO: """The reader/writer for the COLIN XML IO Formats""" def read(self, filename, point): """Read a point and request information. This method returns a tuple: point, requests""" <|body_0|> def _handleRequests(self, node): """A function that processes the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ColinXmlIO: """The reader/writer for the COLIN XML IO Formats""" def read(self, filename, point): """Read a point and request information. This method returns a tuple: point, requests""" input_doc = xml.dom.minidom.parse(filename) point = point.process(input_doc.getElementsByTagNa...
the_stack_v2_python_sparse
pyomo/opt/plugins/colin_xml_io.py
qtothec/pyomo
train
3
e5df29c7af9c2c37732937ae4c1d4158f7a6872f
[ "self.id = id\nself.name = name\nself.extra = extra\nself.created = to_datetime_utc(created)\nself.modified = to_datetime_utc(modified)\nself.organisation = fetch_db_object(Organisation, organisation)\nself.telescope_type = fetch_db_object(TelescopeType, telescope_type)", "if name is not None:\n self.name = na...
<|body_start_0|> self.id = id self.name = name self.extra = extra self.created = to_datetime_utc(created) self.modified = to_datetime_utc(modified) self.organisation = fetch_db_object(Organisation, organisation) self.telescope_type = fetch_db_object(TelescopeType,...
Telescope
[ "MIT", "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Telescope: def __init__(self, id: int=None, name: str=None, extra: Dict=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None, organisation: Union[Organisation, Dict]=None, telescope_type: Union[TelescopeType, Dict]=None): """Construct a Telescope object. :param id: uni...
stack_v2_sparse_classes_75kplus_train_069893
12,117
permissive
[ { "docstring": "Construct a Telescope object. :param id: unique id. :param name: the telescope name. :param extra: additional metadata for a telescope, stored as JSON. :param created: datetime created in UTC. :param modified: datetime modified in UTC. :param organisation: the organisation associated with this t...
2
stack_v2_sparse_classes_30k_test_003013
Implement the Python class `Telescope` described below. Class description: Implement the Telescope class. Method signatures and docstrings: - def __init__(self, id: int=None, name: str=None, extra: Dict=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None, organisation: Union[Organisation, Dict]=No...
Implement the Python class `Telescope` described below. Class description: Implement the Telescope class. Method signatures and docstrings: - def __init__(self, id: int=None, name: str=None, extra: Dict=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None, organisation: Union[Organisation, Dict]=No...
64b62cba83110fea60e91506dff4a83ba9931ba9
<|skeleton|> class Telescope: def __init__(self, id: int=None, name: str=None, extra: Dict=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None, organisation: Union[Organisation, Dict]=None, telescope_type: Union[TelescopeType, Dict]=None): """Construct a Telescope object. :param id: uni...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Telescope: def __init__(self, id: int=None, name: str=None, extra: Dict=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None, organisation: Union[Organisation, Dict]=None, telescope_type: Union[TelescopeType, Dict]=None): """Construct a Telescope object. :param id: unique id. :param...
the_stack_v2_python_sparse
observatory-api/observatory/api/server/orm.py
kieranroberts/observatory-platform
train
0
6989e11b02f4b45798613b9cc8cded5612a701e0
[ "user = context.pop('user')\ncontext['username'] = user.get_username()\nsend_multi_alternatives_mail.send(subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None)", "email = self.cleaned_data['email']\nfor user in self.get_users(email):\n if not domain_override:...
<|body_start_0|> user = context.pop('user') context['username'] = user.get_username() send_multi_alternatives_mail.send(subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None) <|end_body_0|> <|body_start_1|> email = self.cleaned_data['em...
UMPasswordResetForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UMPasswordResetForm: def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None): """Function sending password reset email using Dramatiq""" <|body_0|> def save(self, domain_override=None, subject_template_nam...
stack_v2_sparse_classes_75kplus_train_069894
5,961
no_license
[ { "docstring": "Function sending password reset email using Dramatiq", "name": "send_mail", "signature": "def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None)" }, { "docstring": "Generate a one-use only link for resetting p...
2
stack_v2_sparse_classes_30k_train_021967
Implement the Python class `UMPasswordResetForm` described below. Class description: Implement the UMPasswordResetForm class. Method signatures and docstrings: - def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None): Function sending password res...
Implement the Python class `UMPasswordResetForm` described below. Class description: Implement the UMPasswordResetForm class. Method signatures and docstrings: - def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None): Function sending password res...
3046b7717e8e685e9afded1bc9c1cc64aefaf776
<|skeleton|> class UMPasswordResetForm: def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None): """Function sending password reset email using Dramatiq""" <|body_0|> def save(self, domain_override=None, subject_template_nam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UMPasswordResetForm: def send_mail(self, subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None): """Function sending password reset email using Dramatiq""" user = context.pop('user') context['username'] = user.get_username() se...
the_stack_v2_python_sparse
project/apps/user_management/forms.py
geosolutions-it/djam
train
0
e444343316310e0fb8ecfd6b1da217ddfb952b3d
[ "n = len(nums)\na = [num + i for i, num in enumerate(nums)]\nb = [num - i for i, num in enumerate(nums)]\nmax_score = 0\nmax_b = b[-1]\nfor i in reversed(range(n - 1)):\n max_score = max(max_score, a[i] + max_b)\n max_b = max(max_b, b[i])\nreturn max_score", "n = len(nums)\nmax_score = 0\nmax_b = nums[-1] -...
<|body_start_0|> n = len(nums) a = [num + i for i, num in enumerate(nums)] b = [num - i for i, num in enumerate(nums)] max_score = 0 max_b = b[-1] for i in reversed(range(n - 1)): max_score = max(max_score, a[i] + max_b) max_b = max(max_b, b[i]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxScoreSightseeingPair_1(self, nums: List[int]) -> int: """We want to maximize A[i] + A[j] + i - j with i < j Group the terms and derive two arrays: * B[i] = A[i] - indices * C[i] = A[i] + indices Then maximize B[i] + C[i]: * scan from right to left, keeping the highest C[...
stack_v2_sparse_classes_75kplus_train_069895
1,762
no_license
[ { "docstring": "We want to maximize A[i] + A[j] + i - j with i < j Group the terms and derive two arrays: * B[i] = A[i] - indices * C[i] = A[i] + indices Then maximize B[i] + C[i]: * scan from right to left, keeping the highest C[i] Time complexity: O(N) Space complexity: O(N) Beats 30% (596 ms)", "name": "...
2
stack_v2_sparse_classes_30k_train_006884
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxScoreSightseeingPair_1(self, nums: List[int]) -> int: We want to maximize A[i] + A[j] + i - j with i < j Group the terms and derive two arrays: * B[i] = A[i] - indices * C...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxScoreSightseeingPair_1(self, nums: List[int]) -> int: We want to maximize A[i] + A[j] + i - j with i < j Group the terms and derive two arrays: * B[i] = A[i] - indices * C...
3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8
<|skeleton|> class Solution: def maxScoreSightseeingPair_1(self, nums: List[int]) -> int: """We want to maximize A[i] + A[j] + i - j with i < j Group the terms and derive two arrays: * B[i] = A[i] - indices * C[i] = A[i] + indices Then maximize B[i] + C[i]: * scan from right to left, keeping the highest C[...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxScoreSightseeingPair_1(self, nums: List[int]) -> int: """We want to maximize A[i] + A[j] + i - j with i < j Group the terms and derive two arrays: * B[i] = A[i] - indices * C[i] = A[i] + indices Then maximize B[i] + C[i]: * scan from right to left, keeping the highest C[i] Time comple...
the_stack_v2_python_sparse
arrays/BestSightSeeingPair_Interesting.py
QuentinDuval/PythonExperiments
train
3
9ddeb37a4416a7cd3e266d097289605b14b22cc5
[ "self.verts = np.array(x)\nself.faces = np.array(f)\nself.dims = dims\nself.vert_normals = self.calc_all_n()\nself.quad_n = self.calc_all_quad_n()\nself.quad_hs = self.calc_all_quad_hs()\nself.surf_area = self.calc_surf_area()\nself.centroid = self.calc_mesh_centroid()\nself.center_mesh()\nself.mom_inertia = self.c...
<|body_start_0|> self.verts = np.array(x) self.faces = np.array(f) self.dims = dims self.vert_normals = self.calc_all_n() self.quad_n = self.calc_all_quad_n() self.quad_hs = self.calc_all_quad_hs() self.surf_area = self.calc_surf_area() self.centroid = sel...
Quad_Geo_Mesh_NV
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Quad_Geo_Mesh_NV: def __init__(self, dims, x, f): """Constructor for the simple_mesh object. Face numbers must be equivalent to potential mesh's. Parameters: dims: ellipsoidal dimensions (3,) x : verts in list-like object (Nv, 3) f : list-like with indices to verts of a triangle expectin...
stack_v2_sparse_classes_75kplus_train_069896
3,552
no_license
[ { "docstring": "Constructor for the simple_mesh object. Face numbers must be equivalent to potential mesh's. Parameters: dims: ellipsoidal dimensions (3,) x : verts in list-like object (Nv, 3) f : list-like with indices to verts of a triangle expecting 6 node curved triangles (Nf, 6) Indicies 0, 1, 2 should be ...
5
stack_v2_sparse_classes_30k_train_015203
Implement the Python class `Quad_Geo_Mesh_NV` described below. Class description: Implement the Quad_Geo_Mesh_NV class. Method signatures and docstrings: - def __init__(self, dims, x, f): Constructor for the simple_mesh object. Face numbers must be equivalent to potential mesh's. Parameters: dims: ellipsoidal dimensi...
Implement the Python class `Quad_Geo_Mesh_NV` described below. Class description: Implement the Quad_Geo_Mesh_NV class. Method signatures and docstrings: - def __init__(self, dims, x, f): Constructor for the simple_mesh object. Face numbers must be equivalent to potential mesh's. Parameters: dims: ellipsoidal dimensi...
36e424aa72d2e28ed61ea89e48d19e6b605e4578
<|skeleton|> class Quad_Geo_Mesh_NV: def __init__(self, dims, x, f): """Constructor for the simple_mesh object. Face numbers must be equivalent to potential mesh's. Parameters: dims: ellipsoidal dimensions (3,) x : verts in list-like object (Nv, 3) f : list-like with indices to verts of a triangle expectin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Quad_Geo_Mesh_NV: def __init__(self, dims, x, f): """Constructor for the simple_mesh object. Face numbers must be equivalent to potential mesh's. Parameters: dims: ellipsoidal dimensions (3,) x : verts in list-like object (Nv, 3) f : list-like with indices to verts of a triangle expecting 6 node curve...
the_stack_v2_python_sparse
rigid_DL/quad_geo_mesh_NV.py
CharlieL7/rigid_DL
train
0
fb0160eee3cdaf072a390a80cbebc6c22b58847e
[ "cls.require_notfound(path)\nNEW_SCRIPT_TEMPLATE = '\"\"\"%s\"\"\"\\n# Keep __doc__ to a single line\\nfrom pyClanSphere.upgrades.versions import *\\n\\n# use this or define your own if you need\\nmetadata = db.MetaData()\\n\\n# Define tables here\\n\\n\\n# Define the objects here\\n\\n\\ndef map_tables(mapper):\\n...
<|body_start_0|> cls.require_notfound(path) NEW_SCRIPT_TEMPLATE = '"""%s"""\n# Keep __doc__ to a single line\nfrom pyClanSphere.upgrades.versions import *\n\n# use this or define your own if you need\nmetadata = db.MetaData()\n\n# Define tables here\n\n\n# Define the objects here\n\n\ndef map_tables(map...
PythonScript
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PythonScript: def create(cls, path, **opts): """Create an empty migration script at specified path :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`""" <|body_0|> def run(self, engine, step): """Core method of Script file. Exectues ...
stack_v2_sparse_classes_75kplus_train_069897
8,942
permissive
[ { "docstring": "Create an empty migration script at specified path :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`", "name": "create", "signature": "def create(cls, path, **opts)" }, { "docstring": "Core method of Script file. Exectues :func:`update` or :func...
2
stack_v2_sparse_classes_30k_train_034654
Implement the Python class `PythonScript` described below. Class description: Implement the PythonScript class. Method signatures and docstrings: - def create(cls, path, **opts): Create an empty migration script at specified path :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>` - d...
Implement the Python class `PythonScript` described below. Class description: Implement the PythonScript class. Method signatures and docstrings: - def create(cls, path, **opts): Create an empty migration script at specified path :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>` - d...
03904b3de4ae2043c0ff2a68a50c5f916896b68d
<|skeleton|> class PythonScript: def create(cls, path, **opts): """Create an empty migration script at specified path :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`""" <|body_0|> def run(self, engine, step): """Core method of Script file. Exectues ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PythonScript: def create(cls, path, **opts): """Create an empty migration script at specified path :returns: :class:`PythonScript instance <migrate.versioning.script.py.PythonScript>`""" cls.require_notfound(path) NEW_SCRIPT_TEMPLATE = '"""%s"""\n# Keep __doc__ to a single line\nfrom p...
the_stack_v2_python_sparse
pyClanSphere/upgrades/customisation.py
jokey2k/pyClanSphere
train
1
2cb8b71027f3f5bad9a042acbd68ae0fdd57480c
[ "left = A[p:q + 1]\nright = A[q + 1:r + 1]\ni = 0\nj = 0\nk = p\nassert sorted(left)\nassert sorted(right)\nwhile i < len(left) and j < len(right):\n if left[i] < right[j]:\n A[k] = left[i]\n k += 1\n i += 1\n else:\n A[k] = right[j]\n j += 1\n k += 1\nwhile i < len(l...
<|body_start_0|> left = A[p:q + 1] right = A[q + 1:r + 1] i = 0 j = 0 k = p assert sorted(left) assert sorted(right) while i < len(left) and j < len(right): if left[i] < right[j]: A[k] = left[i] k += 1 ...
MergeSort
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MergeSort: def merge(self, A, p, q, r): """Function to Merge and sort the sub arrays""" <|body_0|> def sort(self, A, p, r): """Function to Divide the input Array into equal sub-arrays""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = A[p:q + 1]...
stack_v2_sparse_classes_75kplus_train_069898
1,363
permissive
[ { "docstring": "Function to Merge and sort the sub arrays", "name": "merge", "signature": "def merge(self, A, p, q, r)" }, { "docstring": "Function to Divide the input Array into equal sub-arrays", "name": "sort", "signature": "def sort(self, A, p, r)" } ]
2
stack_v2_sparse_classes_30k_train_007120
Implement the Python class `MergeSort` described below. Class description: Implement the MergeSort class. Method signatures and docstrings: - def merge(self, A, p, q, r): Function to Merge and sort the sub arrays - def sort(self, A, p, r): Function to Divide the input Array into equal sub-arrays
Implement the Python class `MergeSort` described below. Class description: Implement the MergeSort class. Method signatures and docstrings: - def merge(self, A, p, q, r): Function to Merge and sort the sub arrays - def sort(self, A, p, r): Function to Divide the input Array into equal sub-arrays <|skeleton|> class M...
a30008a7fa8ba15ee241bd7fc5df94cd68c80003
<|skeleton|> class MergeSort: def merge(self, A, p, q, r): """Function to Merge and sort the sub arrays""" <|body_0|> def sort(self, A, p, r): """Function to Divide the input Array into equal sub-arrays""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MergeSort: def merge(self, A, p, q, r): """Function to Merge and sort the sub arrays""" left = A[p:q + 1] right = A[q + 1:r + 1] i = 0 j = 0 k = p assert sorted(left) assert sorted(right) while i < len(left) and j < len(right): ...
the_stack_v2_python_sparse
MergeSort.py
vinayakasg18/algorithms
train
0
c45da8cbd584501b3d1207dda365be2780d620b6
[ "for ops, ress in self.knownOps:\n act = actions.parseline(ops, 0)\n self.assertEqual(str(act), ress)\n self.assertEqual(str(actions.parseline(ress, 0)), ress)", "act = actions.parseline('a: reject : log : faillog abc', 0)\nself.assertEqual(act['reject'], 1)\nself.assertEqual(act['log'], '')\nself.assert...
<|body_start_0|> for ops, ress in self.knownOps: act = actions.parseline(ops, 0) self.assertEqual(str(act), ress) self.assertEqual(str(actions.parseline(ress, 0)), ress) <|end_body_0|> <|body_start_1|> act = actions.parseline('a: reject : log : faillog abc', 0) ...
basicTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class basicTests: def testActionOperators(self): """Test that parseline recognizes and reproduces all of our operators.""" <|body_0|> def testDictAccess(self): """Test that action objects can be accessed like dictionaries.""" <|body_1|> def testFromfile(self):...
stack_v2_sparse_classes_75kplus_train_069899
21,863
no_license
[ { "docstring": "Test that parseline recognizes and reproduces all of our operators.", "name": "testActionOperators", "signature": "def testActionOperators(self)" }, { "docstring": "Test that action objects can be accessed like dictionaries.", "name": "testDictAccess", "signature": "def t...
4
stack_v2_sparse_classes_30k_train_045229
Implement the Python class `basicTests` described below. Class description: Implement the basicTests class. Method signatures and docstrings: - def testActionOperators(self): Test that parseline recognizes and reproduces all of our operators. - def testDictAccess(self): Test that action objects can be accessed like d...
Implement the Python class `basicTests` described below. Class description: Implement the basicTests class. Method signatures and docstrings: - def testActionOperators(self): Test that parseline recognizes and reproduces all of our operators. - def testDictAccess(self): Test that action objects can be accessed like d...
41341606e831a42ba36f8e64640e98f098bf0489
<|skeleton|> class basicTests: def testActionOperators(self): """Test that parseline recognizes and reproduces all of our operators.""" <|body_0|> def testDictAccess(self): """Test that action objects can be accessed like dictionaries.""" <|body_1|> def testFromfile(self):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class basicTests: def testActionOperators(self): """Test that parseline recognizes and reproduces all of our operators.""" for ops, ress in self.knownOps: act = actions.parseline(ops, 0) self.assertEqual(str(act), ress) self.assertEqual(str(actions.parseline(ress,...
the_stack_v2_python_sparse
test_actions.py
siebenmann/portnanny
train
2