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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
90a5de98399a0d1f2290d1976420b6ff5b454eca | [
"super().__init__()\nself.gate_nn = gate_nn\nself.message_nn = message_nn",
"gate = self.gate_nn(fea)\ngate = gate - scatter_max(gate, index, dim=0)[0][index]\ngate = gate.exp()\ngate = gate / (scatter_add(gate, index, dim=0)[index] + 1e-10)\nfea = self.message_nn(fea)\nout = scatter_add(gate * fea, index, dim=0)... | <|body_start_0|>
super().__init__()
self.gate_nn = gate_nn
self.message_nn = message_nn
<|end_body_0|>
<|body_start_1|>
gate = self.gate_nn(fea)
gate = gate - scatter_max(gate, index, dim=0)[0][index]
gate = gate.exp()
gate = gate / (scatter_add(gate, index, dim=... | Weighted softmax attention layer | AttentionPooling | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttentionPooling:
"""Weighted softmax attention layer"""
def __init__(self, gate_nn, message_nn):
"""Inputs ---------- gate_nn: Variable(nn.Module)"""
<|body_0|>
def forward(self, fea, index):
"""forward pass"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_007200 | 4,972 | permissive | [
{
"docstring": "Inputs ---------- gate_nn: Variable(nn.Module)",
"name": "__init__",
"signature": "def __init__(self, gate_nn, message_nn)"
},
{
"docstring": "forward pass",
"name": "forward",
"signature": "def forward(self, fea, index)"
}
] | 2 | null | Implement the Python class `AttentionPooling` described below.
Class description:
Weighted softmax attention layer
Method signatures and docstrings:
- def __init__(self, gate_nn, message_nn): Inputs ---------- gate_nn: Variable(nn.Module)
- def forward(self, fea, index): forward pass | Implement the Python class `AttentionPooling` described below.
Class description:
Weighted softmax attention layer
Method signatures and docstrings:
- def __init__(self, gate_nn, message_nn): Inputs ---------- gate_nn: Variable(nn.Module)
- def forward(self, fea, index): forward pass
<|skeleton|>
class AttentionPool... | e3eb7a1e118c291e3049198bcfc4d46177fcf119 | <|skeleton|>
class AttentionPooling:
"""Weighted softmax attention layer"""
def __init__(self, gate_nn, message_nn):
"""Inputs ---------- gate_nn: Variable(nn.Module)"""
<|body_0|>
def forward(self, fea, index):
"""forward pass"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttentionPooling:
"""Weighted softmax attention layer"""
def __init__(self, gate_nn, message_nn):
"""Inputs ---------- gate_nn: Variable(nn.Module)"""
super().__init__()
self.gate_nn = gate_nn
self.message_nn = message_nn
def forward(self, fea, index):
"""forw... | the_stack_v2_python_sparse | AGD_inverse_design/roost/roost/roost/segments.py | zankzeke/Active-Generative-Design | train | 0 |
79978628170f5e7a44f26808aade6ef3a32324a8 | [
"self.analysis_id = analysis_id\nself.user_mail = user_mail\nself.include_interactors = include_interactors\nself.include_disease = include_disease",
"dict_obj = {'analysis_id': self.analysis_id}\nif self.user_mail:\n dict_obj['user_mail'] = self.user_mail\nif self.include_interactors:\n dict_obj['include_i... | <|body_start_0|>
self.analysis_id = analysis_id
self.user_mail = user_mail
self.include_interactors = include_interactors
self.include_disease = include_disease
<|end_body_0|>
<|body_start_1|>
dict_obj = {'analysis_id': self.analysis_id}
if self.user_mail:
di... | ReportRequest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReportRequest:
def __init__(self, analysis_id: str, user_mail: str=None, include_interactors: bool=None, include_disease: bool=None):
"""Creates a new ReportRequest instance :param analysis_id: Analysis id :param user_mail: The user's e-mail address (if available) :param include_interact... | stack_v2_sparse_classes_75kplus_train_007201 | 2,163 | no_license | [
{
"docstring": "Creates a new ReportRequest instance :param analysis_id: Analysis id :param user_mail: The user's e-mail address (if available) :param include_interactors: Indicates whether interactors were included in the analysis. :param include_disease: Indicates whether disease pathways were included in the... | 2 | stack_v2_sparse_classes_30k_train_018682 | Implement the Python class `ReportRequest` described below.
Class description:
Implement the ReportRequest class.
Method signatures and docstrings:
- def __init__(self, analysis_id: str, user_mail: str=None, include_interactors: bool=None, include_disease: bool=None): Creates a new ReportRequest instance :param analy... | Implement the Python class `ReportRequest` described below.
Class description:
Implement the ReportRequest class.
Method signatures and docstrings:
- def __init__(self, analysis_id: str, user_mail: str=None, include_interactors: bool=None, include_disease: bool=None): Creates a new ReportRequest instance :param analy... | 281bb6ef6efa0153babe0399d5bbe846ed576c7f | <|skeleton|>
class ReportRequest:
def __init__(self, analysis_id: str, user_mail: str=None, include_interactors: bool=None, include_disease: bool=None):
"""Creates a new ReportRequest instance :param analysis_id: Analysis id :param user_mail: The user's e-mail address (if available) :param include_interact... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReportRequest:
def __init__(self, analysis_id: str, user_mail: str=None, include_interactors: bool=None, include_disease: bool=None):
"""Creates a new ReportRequest instance :param analysis_id: Analysis id :param user_mail: The user's e-mail address (if available) :param include_interactors: Indicates... | the_stack_v2_python_sparse | reactome_analysis_utils/reactome_analysis_utils/models/report_request.py | reactome/gsa-backend | train | 3 | |
c927819f63da710b53c2e4b716383ca819eacd52 | [
"super(SpikeTimesObjective, self).__init__(time_start, time_stop)\nif time_stop - time_start - time_buffer * 2 <= 0:\n raise Exception('Buffer time ({}) exceeds half of spike train time ({}) and therefore the inner window is empty'.format(buffer, time_stop - time_start))\nif isinstance(reference, neo.core.SpikeT... | <|body_start_0|>
super(SpikeTimesObjective, self).__init__(time_start, time_stop)
if time_stop - time_start - time_buffer * 2 <= 0:
raise Exception('Buffer time ({}) exceeds half of spike train time ({}) and therefore the inner window is empty'.format(buffer, time_stop - time_start))
... | The sum of squared time differences between all simulated spikes and the nearest spike in the reference set and vice versa. | SpikeTimesObjective | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpikeTimesObjective:
"""The sum of squared time differences between all simulated spikes and the nearest spike in the reference set and vice versa."""
def __init__(self, reference, time_start=500.0 * pq.ms, time_stop=2000.0 * pq.ms, time_buffer=250 * pq.ms):
"""`reference` -- referen... | stack_v2_sparse_classes_75kplus_train_007202 | 8,122 | no_license | [
{
"docstring": "`reference` -- reference signal or spike train [neo.AnalogSignal or neo.SpikeTrain] `time_start` -- time from which to start including spikes [float] `time_stop` -- length of time to run the simulation [float] `buffer` -- time buffer either side of the \"inner window\" in which spikes in the inn... | 2 | stack_v2_sparse_classes_30k_train_011676 | Implement the Python class `SpikeTimesObjective` described below.
Class description:
The sum of squared time differences between all simulated spikes and the nearest spike in the reference set and vice versa.
Method signatures and docstrings:
- def __init__(self, reference, time_start=500.0 * pq.ms, time_stop=2000.0 ... | Implement the Python class `SpikeTimesObjective` described below.
Class description:
The sum of squared time differences between all simulated spikes and the nearest spike in the reference set and vice versa.
Method signatures and docstrings:
- def __init__(self, reference, time_start=500.0 * pq.ms, time_stop=2000.0 ... | 30974ebe83da6c55f382312cf588a0d714c23f0c | <|skeleton|>
class SpikeTimesObjective:
"""The sum of squared time differences between all simulated spikes and the nearest spike in the reference set and vice versa."""
def __init__(self, reference, time_start=500.0 * pq.ms, time_stop=2000.0 * pq.ms, time_buffer=250 * pq.ms):
"""`reference` -- referen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpikeTimesObjective:
"""The sum of squared time differences between all simulated spikes and the nearest spike in the reference set and vice versa."""
def __init__(self, reference, time_start=500.0 * pq.ms, time_stop=2000.0 * pq.ms, time_buffer=250 * pq.ms):
"""`reference` -- reference signal or ... | the_stack_v2_python_sparse | neurotune/objective/spike.py | tclose/neurotune | train | 0 |
b1a624d72820bcb199f7aec710250b19ac043705 | [
"xyz['cx'] = xyz.u - cx\nxyz['cy'] = xyz.v - cy\nxyz['cr'] = np.hypot(xyz.cx, xyz.cy)\nxyz['cth'] = np.unwrap(constrain_angle(np.arctan2(-cy, -cx) - np.arctan2(xyz.cy, xyz.cx)), discont=1.8 * pi)\nif np.abs(xyz['cth'].min() - 2 * pi) < 5 * degrees:\n xyz['cth'] -= 2 * pi\nydata = xyz.cr * xyz.cth\nodrdata = odr.... | <|body_start_0|>
xyz['cx'] = xyz.u - cx
xyz['cy'] = xyz.v - cy
xyz['cr'] = np.hypot(xyz.cx, xyz.cy)
xyz['cth'] = np.unwrap(constrain_angle(np.arctan2(-cy, -cx) - np.arctan2(xyz.cy, xyz.cx)), discont=1.8 * pi)
if np.abs(xyz['cth'].min() - 2 * pi) < 5 * degrees:
xyz['ct... | Provides methods to perform a linear fit to the data to find an initial guess for the Monte Carlo parameters. Two methods are provided: 1) `linear_prefit` -- This calculates r-phi and performs the linear fit. 2) `guess_parameters` -- This uses the results of the linear fit to guess the starting point for the Monte Carl... | LinearPrefitMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearPrefitMixin:
"""Provides methods to perform a linear fit to the data to find an initial guess for the Monte Carlo parameters. Two methods are provided: 1) `linear_prefit` -- This calculates r-phi and performs the linear fit. 2) `guess_parameters` -- This uses the results of the linear fit t... | stack_v2_sparse_classes_75kplus_train_007203 | 11,898 | no_license | [
{
"docstring": "Performs the linear prefit. The linear fit is performed using the SciPy ODR library, which does orthogonal distance regression. This means that the minimized quantity is the orthogonal distance between the line and each data point, rather than the distance along one of the coordinate directions.... | 2 | stack_v2_sparse_classes_30k_train_040528 | Implement the Python class `LinearPrefitMixin` described below.
Class description:
Provides methods to perform a linear fit to the data to find an initial guess for the Monte Carlo parameters. Two methods are provided: 1) `linear_prefit` -- This calculates r-phi and performs the linear fit. 2) `guess_parameters` -- Th... | Implement the Python class `LinearPrefitMixin` described below.
Class description:
Provides methods to perform a linear fit to the data to find an initial guess for the Monte Carlo parameters. Two methods are provided: 1) `linear_prefit` -- This calculates r-phi and performs the linear fit. 2) `guess_parameters` -- Th... | 8809d26c8659a02cabe4735df732b6f0a4d647bf | <|skeleton|>
class LinearPrefitMixin:
"""Provides methods to perform a linear fit to the data to find an initial guess for the Monte Carlo parameters. Two methods are provided: 1) `linear_prefit` -- This calculates r-phi and performs the linear fit. 2) `guess_parameters` -- This uses the results of the linear fit t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinearPrefitMixin:
"""Provides methods to perform a linear fit to the data to find an initial guess for the Monte Carlo parameters. Two methods are provided: 1) `linear_prefit` -- This calculates r-phi and performs the linear fit. 2) `guess_parameters` -- This uses the results of the linear fit to guess the s... | the_stack_v2_python_sparse | pytpc/fitting/mixins.py | ATTPC/pytpc | train | 1 |
6c3e6efd1bac17674ead2b500120b8b6d8518ecb | [
"self.archive_task_uid = archive_task_uid\nself.end_time_usecs = end_time_usecs\nself.remote_protection_job_uid = remote_protection_job_uid\nself.start_time_usecs = start_time_usecs\nself.view_box_id = view_box_id",
"if dictionary is None:\n return None\narchive_task_uid = cohesity_management_sdk.models.univer... | <|body_start_0|>
self.archive_task_uid = archive_task_uid
self.end_time_usecs = end_time_usecs
self.remote_protection_job_uid = remote_protection_job_uid
self.start_time_usecs = start_time_usecs
self.view_box_id = view_box_id
<|end_body_0|>
<|body_start_1|>
if dictionary... | Implementation of the 'IndexAndSnapshots' model. Specifies settings required to restore the index and Snapshots of a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies a unique id of the Archive task that originally archived the object to the Vault. end_time_usecs (long|int): Specifies the end time a... | IndexAndSnapshots | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IndexAndSnapshots:
"""Implementation of the 'IndexAndSnapshots' model. Specifies settings required to restore the index and Snapshots of a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies a unique id of the Archive task that originally archived the object to the Vault. end_ti... | stack_v2_sparse_classes_75kplus_train_007204 | 3,586 | permissive | [
{
"docstring": "Constructor for the IndexAndSnapshots class",
"name": "__init__",
"signature": "def __init__(self, archive_task_uid=None, end_time_usecs=None, remote_protection_job_uid=None, start_time_usecs=None, view_box_id=None)"
},
{
"docstring": "Creates an instance of this model from a dic... | 2 | stack_v2_sparse_classes_30k_train_037735 | Implement the Python class `IndexAndSnapshots` described below.
Class description:
Implementation of the 'IndexAndSnapshots' model. Specifies settings required to restore the index and Snapshots of a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies a unique id of the Archive task that originally a... | Implement the Python class `IndexAndSnapshots` described below.
Class description:
Implementation of the 'IndexAndSnapshots' model. Specifies settings required to restore the index and Snapshots of a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies a unique id of the Archive task that originally a... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class IndexAndSnapshots:
"""Implementation of the 'IndexAndSnapshots' model. Specifies settings required to restore the index and Snapshots of a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies a unique id of the Archive task that originally archived the object to the Vault. end_ti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IndexAndSnapshots:
"""Implementation of the 'IndexAndSnapshots' model. Specifies settings required to restore the index and Snapshots of a Protection Job. Attributes: archive_task_uid (UniversalId): Specifies a unique id of the Archive task that originally archived the object to the Vault. end_time_usecs (lon... | the_stack_v2_python_sparse | cohesity_management_sdk/models/index_and_snapshots.py | cohesity/management-sdk-python | train | 24 |
7e2c123d337eea9fe1a82c2c64997e2f134106c0 | [
"MAX = 2147483647\nMIN = 2147483648\nmask = 4294967295\nprint(MIN, MAX)\nwhile b != 0:\n a, b = ((a ^ b) & mask, (a & b) << 1 & mask)\nreturn a if a <= MAX else ~(a ^ mask)",
"print('a: {:08b}'.format(a))\nprint('b: {:08b}'.format(b))\nprint('14: {:08b}'.format(14))\nprint('-14: {:08b}'.format(-14))\nwhile b !... | <|body_start_0|>
MAX = 2147483647
MIN = 2147483648
mask = 4294967295
print(MIN, MAX)
while b != 0:
a, b = ((a ^ b) & mask, (a & b) << 1 & mask)
return a if a <= MAX else ~(a ^ mask)
<|end_body_0|>
<|body_start_1|>
print('a: {:08b}'.format(a))
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getSum(self, a, b):
""":type a: int :type b: int :rtype: int"""
<|body_0|>
def getSumTLE(self, a, b):
""":type a: int :type b: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
MAX = 2147483647
MIN = 2147483648
... | stack_v2_sparse_classes_75kplus_train_007205 | 1,707 | no_license | [
{
"docstring": ":type a: int :type b: int :rtype: int",
"name": "getSum",
"signature": "def getSum(self, a, b)"
},
{
"docstring": ":type a: int :type b: int :rtype: int",
"name": "getSumTLE",
"signature": "def getSumTLE(self, a, b)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSum(self, a, b): :type a: int :type b: int :rtype: int
- def getSumTLE(self, a, b): :type a: int :type b: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSum(self, a, b): :type a: int :type b: int :rtype: int
- def getSumTLE(self, a, b): :type a: int :type b: int :rtype: int
<|skeleton|>
class Solution:
def getSum(sel... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def getSum(self, a, b):
""":type a: int :type b: int :rtype: int"""
<|body_0|>
def getSumTLE(self, a, b):
""":type a: int :type b: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def getSum(self, a, b):
""":type a: int :type b: int :rtype: int"""
MAX = 2147483647
MIN = 2147483648
mask = 4294967295
print(MIN, MAX)
while b != 0:
a, b = ((a ^ b) & mask, (a & b) << 1 & mask)
return a if a <= MAX else ~(a ^ mask)... | the_stack_v2_python_sparse | S/SumofTwoIntegers.py | bssrdf/pyleet | train | 2 | |
a3cbf372835466e3515f5c5f93ccf9b95bbf026d | [
"with patch('modules.exercises.mod_11_testing.process.MyConnection') as con_class:\n mock_db = MagicMock(name='db_mock')\n con_class.return_value = mock_db\n mock_db.get_book.side_effect = [{'book_id': '10', 'author_name': 'test__another_1', 'name': 'name_1'}, {'book_id': '11', 'author_name': 'test__anothe... | <|body_start_0|>
with patch('modules.exercises.mod_11_testing.process.MyConnection') as con_class:
mock_db = MagicMock(name='db_mock')
con_class.return_value = mock_db
mock_db.get_book.side_effect = [{'book_id': '10', 'author_name': 'test__another_1', 'name': 'name_1'}, {'boo... | Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking | TestGetAllBookAuthor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGetAllBookAuthor:
"""Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking"""
def test_get_all_books_work(self):
"""When database module is... | stack_v2_sparse_classes_75kplus_train_007206 | 3,022 | no_license | [
{
"docstring": "When database module is working we check that our process return a valid list",
"name": "test_get_all_books_work",
"signature": "def test_get_all_books_work(self)"
},
{
"docstring": "TEst that database error is handled in our process module and we dont raise any exception up",
... | 2 | stack_v2_sparse_classes_30k_train_047450 | Implement the Python class `TestGetAllBookAuthor` described below.
Class description:
Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking
Method signatures and docstrings:
- d... | Implement the Python class `TestGetAllBookAuthor` described below.
Class description:
Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking
Method signatures and docstrings:
- d... | 8f082201e24f0f2b991d9388500fdbf95d6f073d | <|skeleton|>
class TestGetAllBookAuthor:
"""Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking"""
def test_get_all_books_work(self):
"""When database module is... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestGetAllBookAuthor:
"""Test class for get_info_list method of GetBookAuthor. We will increase coverage of this method. We do not inheritate for TestCase as we dont want to be discovered by nosetests, just for checking"""
def test_get_all_books_work(self):
"""When database module is working we c... | the_stack_v2_python_sparse | modules/exercises/mod_11_testing/solution.py | garciacastano09/pycourse | train | 0 |
7ee1314c5b7a024d8d711f298c47a22e3eebe767 | [
"super(MySQLProgramsTable, self).__init__(db_dict, dbtype, verbose)\nself.connectdb(db_dict, verbose)\nself._load_table()",
"cursor = self.connection.cursor()\nsql = 'INSERT INTO Program (ProgramName, StartDate, EndDate) VALUES (%s, %s, %s)'\ndata = (program_name, start_date, end_date)\ntry:\n cursor.execute(s... | <|body_start_0|>
super(MySQLProgramsTable, self).__init__(db_dict, dbtype, verbose)
self.connectdb(db_dict, verbose)
self._load_table()
<|end_body_0|>
<|body_start_1|>
cursor = self.connection.cursor()
sql = 'INSERT INTO Program (ProgramName, StartDate, EndDate) VALUES (%s, %s, ... | Class representing the connection with a mysql database | MySQLProgramsTable | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MySQLProgramsTable:
"""Class representing the connection with a mysql database"""
def __init__(self, db_dict, dbtype, verbose):
"""Read the input file into a dictionary."""
<|body_0|>
def insert(self, program_name, start_date, end_date):
"""Write a new record to ... | stack_v2_sparse_classes_75kplus_train_007207 | 9,672 | permissive | [
{
"docstring": "Read the input file into a dictionary.",
"name": "__init__",
"signature": "def __init__(self, db_dict, dbtype, verbose)"
},
{
"docstring": "Write a new record to the programs table of the database at the end of the database. Exceptions: TODO",
"name": "insert",
"signature... | 3 | stack_v2_sparse_classes_30k_train_015790 | Implement the Python class `MySQLProgramsTable` described below.
Class description:
Class representing the connection with a mysql database
Method signatures and docstrings:
- def __init__(self, db_dict, dbtype, verbose): Read the input file into a dictionary.
- def insert(self, program_name, start_date, end_date): W... | Implement the Python class `MySQLProgramsTable` described below.
Class description:
Class representing the connection with a mysql database
Method signatures and docstrings:
- def __init__(self, db_dict, dbtype, verbose): Read the input file into a dictionary.
- def insert(self, program_name, start_date, end_date): W... | 9c60b3489f02592bd9099b8719ca23ae43a9eaa5 | <|skeleton|>
class MySQLProgramsTable:
"""Class representing the connection with a mysql database"""
def __init__(self, db_dict, dbtype, verbose):
"""Read the input file into a dictionary."""
<|body_0|>
def insert(self, program_name, start_date, end_date):
"""Write a new record to ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MySQLProgramsTable:
"""Class representing the connection with a mysql database"""
def __init__(self, db_dict, dbtype, verbose):
"""Read the input file into a dictionary."""
super(MySQLProgramsTable, self).__init__(db_dict, dbtype, verbose)
self.connectdb(db_dict, verbose)
... | the_stack_v2_python_sparse | smipyping/_programstable.py | KSchopmeyer/smipyping | train | 0 |
07e2da94704646ac1328a6ad17e5dded1f02556c | [
"R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)\nR2 = array([[0, 1, 0], [0, 0, 0], [0, 0, 0]], float64)\neR1 = array([[-1.242955024379687, -3.178944439554645, 6.804083368075889], [-6.545353831891249, -2.604941866769356, 1.228233941393001], [0.975355249080821, -7.711099455690256, -3.318642157729292]], flo... | <|body_start_0|>
R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)
R2 = array([[0, 1, 0], [0, 0, 0], [0, 0, 0]], float64)
eR1 = array([[-1.242955024379687, -3.178944439554645, 6.804083368075889], [-6.545353831891249, -2.604941866769356, 1.228233941393001], [0.975355249080821, -7.71109945... | Unit tests for the lib.linear_algebra.matrix_exponential relax module. | Test_matrix_exponential | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_matrix_exponential:
"""Unit tests for the lib.linear_algebra.matrix_exponential relax module."""
def test_matrix_exponential(self):
"""Test the matrix exponential function matrix_exponential() with real matrices."""
<|body_0|>
def test_matrix_exponential2(self):
... | stack_v2_sparse_classes_75kplus_train_007208 | 4,601 | no_license | [
{
"docstring": "Test the matrix exponential function matrix_exponential() with real matrices.",
"name": "test_matrix_exponential",
"signature": "def test_matrix_exponential(self)"
},
{
"docstring": "Test the matrix exponential function matrix_exponential() with complex matrices.",
"name": "t... | 2 | stack_v2_sparse_classes_30k_train_041912 | Implement the Python class `Test_matrix_exponential` described below.
Class description:
Unit tests for the lib.linear_algebra.matrix_exponential relax module.
Method signatures and docstrings:
- def test_matrix_exponential(self): Test the matrix exponential function matrix_exponential() with real matrices.
- def tes... | Implement the Python class `Test_matrix_exponential` described below.
Class description:
Unit tests for the lib.linear_algebra.matrix_exponential relax module.
Method signatures and docstrings:
- def test_matrix_exponential(self): Test the matrix exponential function matrix_exponential() with real matrices.
- def tes... | c317326ddeacd1a1c608128769676899daeae531 | <|skeleton|>
class Test_matrix_exponential:
"""Unit tests for the lib.linear_algebra.matrix_exponential relax module."""
def test_matrix_exponential(self):
"""Test the matrix exponential function matrix_exponential() with real matrices."""
<|body_0|>
def test_matrix_exponential2(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test_matrix_exponential:
"""Unit tests for the lib.linear_algebra.matrix_exponential relax module."""
def test_matrix_exponential(self):
"""Test the matrix exponential function matrix_exponential() with real matrices."""
R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)
R2... | the_stack_v2_python_sparse | test_suite/unit_tests/_lib/_linear_algebra/test_matrix_exponential.py | jlec/relax | train | 4 |
3c1ae498137ca0bb073c5755c2674f823f34626c | [
"serv_air_quality = self.add_preload_service(SERV_AIR_QUALITY_SENSOR, [CHAR_PM25_DENSITY])\nself.char_quality = serv_air_quality.configure_char(CHAR_AIR_QUALITY, value=0)\nself.char_density = serv_air_quality.configure_char(CHAR_PM25_DENSITY, value=0)",
"density = convert_to_float(new_state.state)\nif density is ... | <|body_start_0|>
serv_air_quality = self.add_preload_service(SERV_AIR_QUALITY_SENSOR, [CHAR_PM25_DENSITY])
self.char_quality = serv_air_quality.configure_char(CHAR_AIR_QUALITY, value=0)
self.char_density = serv_air_quality.configure_char(CHAR_PM25_DENSITY, value=0)
<|end_body_0|>
<|body_start_1... | Generate a PM25Sensor accessory as PM 2.5 sensor. | PM25Sensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PM25Sensor:
"""Generate a PM25Sensor accessory as PM 2.5 sensor."""
def create_services(self):
"""Override the init function for PM 2.5 Sensor."""
<|body_0|>
def async_update_state(self, new_state):
"""Update accessory after state change."""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_007209 | 17,041 | permissive | [
{
"docstring": "Override the init function for PM 2.5 Sensor.",
"name": "create_services",
"signature": "def create_services(self)"
},
{
"docstring": "Update accessory after state change.",
"name": "async_update_state",
"signature": "def async_update_state(self, new_state)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001477 | Implement the Python class `PM25Sensor` described below.
Class description:
Generate a PM25Sensor accessory as PM 2.5 sensor.
Method signatures and docstrings:
- def create_services(self): Override the init function for PM 2.5 Sensor.
- def async_update_state(self, new_state): Update accessory after state change. | Implement the Python class `PM25Sensor` described below.
Class description:
Generate a PM25Sensor accessory as PM 2.5 sensor.
Method signatures and docstrings:
- def create_services(self): Override the init function for PM 2.5 Sensor.
- def async_update_state(self, new_state): Update accessory after state change.
<|... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class PM25Sensor:
"""Generate a PM25Sensor accessory as PM 2.5 sensor."""
def create_services(self):
"""Override the init function for PM 2.5 Sensor."""
<|body_0|>
def async_update_state(self, new_state):
"""Update accessory after state change."""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PM25Sensor:
"""Generate a PM25Sensor accessory as PM 2.5 sensor."""
def create_services(self):
"""Override the init function for PM 2.5 Sensor."""
serv_air_quality = self.add_preload_service(SERV_AIR_QUALITY_SENSOR, [CHAR_PM25_DENSITY])
self.char_quality = serv_air_quality.configu... | the_stack_v2_python_sparse | homeassistant/components/homekit/type_sensors.py | home-assistant/core | train | 35,501 |
f413c10154c22b1bf608fa618d1ca85f7482bb58 | [
"self.randomSampling = []\nself.dataRange = dataRange\nself.tot = tot\nself.len = len",
"try:\n isLegalNumList(self.dataRange)\nexcept Exception as err:\n print('An exception happened: ' + str(err))\n sys.exit()\nself.randomSampling = []\nwhile len(self.randomSampling) != self.tot:\n it = iter(self.da... | <|body_start_0|>
self.randomSampling = []
self.dataRange = dataRange
self.tot = tot
self.len = len
<|end_body_0|>
<|body_start_1|>
try:
isLegalNumList(self.dataRange)
except Exception as err:
print('An exception happened: ' + str(err))
... | elementSamplingFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class elementSamplingFactory:
def __init__(self, dataRange, tot, len=6):
""":param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度"""
<|body_0|>
def randomIntSampling(self):
""":return: 生成数据"""
<|body_1|>
def randomFloatSampling(self):
""":retu... | stack_v2_sparse_classes_75kplus_train_007210 | 2,834 | no_license | [
{
"docstring": ":param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度",
"name": "__init__",
"signature": "def __init__(self, dataRange, tot, len=6)"
},
{
"docstring": ":return: 生成数据",
"name": "randomIntSampling",
"signature": "def randomIntSampling(self)"
},
{
"docstring... | 4 | stack_v2_sparse_classes_30k_train_012247 | Implement the Python class `elementSamplingFactory` described below.
Class description:
Implement the elementSamplingFactory class.
Method signatures and docstrings:
- def __init__(self, dataRange, tot, len=6): :param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度
- def randomIntSampling(self): :return: 生成数据... | Implement the Python class `elementSamplingFactory` described below.
Class description:
Implement the elementSamplingFactory class.
Method signatures and docstrings:
- def __init__(self, dataRange, tot, len=6): :param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度
- def randomIntSampling(self): :return: 生成数据... | 661dba7ea846859056fd6ee7a310d352ca178e98 | <|skeleton|>
class elementSamplingFactory:
def __init__(self, dataRange, tot, len=6):
""":param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度"""
<|body_0|>
def randomIntSampling(self):
""":return: 生成数据"""
<|body_1|>
def randomFloatSampling(self):
""":retu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class elementSamplingFactory:
def __init__(self, dataRange, tot, len=6):
""":param dataRange:数据范围 :param tot: 数据量 :param len: 若生成字符串,字符串长度"""
self.randomSampling = []
self.dataRange = dataRange
self.tot = tot
self.len = len
def randomIntSampling(self):
""":return... | the_stack_v2_python_sparse | 林一夫2017012923/平时作业1/Factory.py | wanghan79/2020_Python | train | 4 | |
d7bd582f19fca523ea8fb6c125588eea41f29403 | [
"self._request_msg = request_msg\nself._response_msg = response_msg\nhttp.HttpMessageWriter.__init__(self, sock, response_msg, write_timeout)",
"if self._request_msg.start_line:\n request_method = self._request_msg.start_line.method\nelse:\n request_method = None\nresponse_code = self._response_msg.start_li... | <|body_start_0|>
self._request_msg = request_msg
self._response_msg = response_msg
http.HttpMessageWriter.__init__(self, sock, response_msg, write_timeout)
<|end_body_0|>
<|body_start_1|>
if self._request_msg.start_line:
request_method = self._request_msg.start_line.method
... | Writes an HTTP response to client. | _HttpServerToClientMessageWriter | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _HttpServerToClientMessageWriter:
"""Writes an HTTP response to client."""
def __init__(self, sock, request_msg, response_msg, write_timeout):
"""Writes the response to the client. @type sock: socket @param sock: Target socket @type request_msg: http.HttpMessage @param request_msg: R... | stack_v2_sparse_classes_75kplus_train_007211 | 20,673 | permissive | [
{
"docstring": "Writes the response to the client. @type sock: socket @param sock: Target socket @type request_msg: http.HttpMessage @param request_msg: Request message, required to determine whether response may have a message body @type response_msg: http.HttpMessage @param response_msg: Response message @typ... | 2 | stack_v2_sparse_classes_30k_train_005738 | Implement the Python class `_HttpServerToClientMessageWriter` described below.
Class description:
Writes an HTTP response to client.
Method signatures and docstrings:
- def __init__(self, sock, request_msg, response_msg, write_timeout): Writes the response to the client. @type sock: socket @param sock: Target socket ... | Implement the Python class `_HttpServerToClientMessageWriter` described below.
Class description:
Writes an HTTP response to client.
Method signatures and docstrings:
- def __init__(self, sock, request_msg, response_msg, write_timeout): Writes the response to the client. @type sock: socket @param sock: Target socket ... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class _HttpServerToClientMessageWriter:
"""Writes an HTTP response to client."""
def __init__(self, sock, request_msg, response_msg, write_timeout):
"""Writes the response to the client. @type sock: socket @param sock: Target socket @type request_msg: http.HttpMessage @param request_msg: R... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _HttpServerToClientMessageWriter:
"""Writes an HTTP response to client."""
def __init__(self, sock, request_msg, response_msg, write_timeout):
"""Writes the response to the client. @type sock: socket @param sock: Target socket @type request_msg: http.HttpMessage @param request_msg: Request messag... | the_stack_v2_python_sparse | lib/http/server.py | ganeti/ganeti | train | 465 |
c07954632f02a0e80ce1a16fa245513d8c4c0c95 | [
"if isinstance(dst, Repository):\n return self.from_folds(dst, is_existing_deleted, **kwargs)\nelse:\n return self.from_folders(dst, is_existing_deleted, **kwargs)",
"dst = Path(dst)\nif is_existing_deleted:\n rmtree(dst, ignore_errors=True)\ndst.mkdir(mode=511, parents=True, exist_ok=True)\nfor csv, rea... | <|body_start_0|>
if isinstance(dst, Repository):
return self.from_folds(dst, is_existing_deleted, **kwargs)
else:
return self.from_folders(dst, is_existing_deleted, **kwargs)
<|end_body_0|>
<|body_start_1|>
dst = Path(dst)
if is_existing_deleted:
rmtr... | A device for collecting -- i.e. concatenating -- csv files across folders or folds. | Collect | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Collect:
"""A device for collecting -- i.e. concatenating -- csv files across folders or folds."""
def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any):
"""Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.ov... | stack_v2_sparse_classes_75kplus_train_007212 | 7,105 | permissive | [
{
"docstring": "Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.over_folds`` is called instead of ``self.over_folders``. Args: dst: The destination folder, to house ``self.csvs`` or ``self.folders``. is_existing_deleted: Whether to delete and recreate an existing ``dst``. **kw... | 4 | stack_v2_sparse_classes_30k_train_015609 | Implement the Python class `Collect` described below.
Class description:
A device for collecting -- i.e. concatenating -- csv files across folders or folds.
Method signatures and docstrings:
- def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any): Collect ``self.csvs`` into `... | Implement the Python class `Collect` described below.
Class description:
A device for collecting -- i.e. concatenating -- csv files across folders or folds.
Method signatures and docstrings:
- def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any): Collect ``self.csvs`` into `... | 7919befb620ed571dc71efe69f5312f82e1a9e6b | <|skeleton|>
class Collect:
"""A device for collecting -- i.e. concatenating -- csv files across folders or folds."""
def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any):
"""Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.ov... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Collect:
"""A device for collecting -- i.e. concatenating -- csv files across folders or folds."""
def __call__(self, dst: Union[Repository, Path, str], is_existing_deleted=False, **kwargs: Any):
"""Collect ``self.csvs`` into ``dst``. If and only if ``dst`` is a Repository, ``self.over_folds`` is... | the_stack_v2_python_sparse | romcomma/user/results.py | C-O-M-M-A/rom-comma | train | 2 |
754acbeab75b9b4efddca5e91182675e27f18af3 | [
"super(ConvTransformerEncoderBlock, self).__init__()\nself.d_v = d_v\nconv2d = SNConv2d if use_sn else nn.Conv2d\nself.batch_norm = nn.BatchNorm3d(d_v)\nself.mha_module = ConvMultiHeadAttention(num_heads, d_v, d_v, use_sn=use_sn)\nself.ff_module = nn.Sequential(conv2d(d_v, d_ff, 3, padding=1), nn.ReLU(inplace=True)... | <|body_start_0|>
super(ConvTransformerEncoderBlock, self).__init__()
self.d_v = d_v
conv2d = SNConv2d if use_sn else nn.Conv2d
self.batch_norm = nn.BatchNorm3d(d_v)
self.mha_module = ConvMultiHeadAttention(num_heads, d_v, d_v, use_sn=use_sn)
self.ff_module = nn.Sequential... | ConvTransformerEncoderBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvTransformerEncoderBlock:
def __init__(self, num_heads, d_v, d_ff, use_sn=False):
"""Constructor :param num_heads: The number of heads to use in multi-head attention :param d_v: Dimensionality (number of features) of the values :param d_ff: Intermediate dimensionality of the feed-forw... | stack_v2_sparse_classes_75kplus_train_007213 | 26,416 | no_license | [
{
"docstring": "Constructor :param num_heads: The number of heads to use in multi-head attention :param d_v: Dimensionality (number of features) of the values :param d_ff: Intermediate dimensionality of the feed-forward part of this encoder block",
"name": "__init__",
"signature": "def __init__(self, nu... | 3 | null | Implement the Python class `ConvTransformerEncoderBlock` described below.
Class description:
Implement the ConvTransformerEncoderBlock class.
Method signatures and docstrings:
- def __init__(self, num_heads, d_v, d_ff, use_sn=False): Constructor :param num_heads: The number of heads to use in multi-head attention :pa... | Implement the Python class `ConvTransformerEncoderBlock` described below.
Class description:
Implement the ConvTransformerEncoderBlock class.
Method signatures and docstrings:
- def __init__(self, num_heads, d_v, d_ff, use_sn=False): Constructor :param num_heads: The number of heads to use in multi-head attention :pa... | da2872999c38c3aab0357cb6e7e0db9100638505 | <|skeleton|>
class ConvTransformerEncoderBlock:
def __init__(self, num_heads, d_v, d_ff, use_sn=False):
"""Constructor :param num_heads: The number of heads to use in multi-head attention :param d_v: Dimensionality (number of features) of the values :param d_ff: Intermediate dimensionality of the feed-forw... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConvTransformerEncoderBlock:
def __init__(self, num_heads, d_v, d_ff, use_sn=False):
"""Constructor :param num_heads: The number of heads to use in multi-head attention :param d_v: Dimensionality (number of features) of the values :param d_ff: Intermediate dimensionality of the feed-forward part of th... | the_stack_v2_python_sparse | src/models/self_attention/submodules.py | MichiganCOG/video-frame-inpainting | train | 9 | |
a87f489ee977856857f6a2c7b93e787041ee56f5 | [
"if not data_kinds:\n data_kinds = [DataKind.WEIGHT_DIFF, DataKind.WEIGHTS]\nsuper().__init__(supported_data_kinds=[DataKind.WEIGHTS, DataKind.WEIGHT_DIFF], data_kinds_to_filter=data_kinds)\nself.percentile = percentile\nself.gamma = gamma",
"self.log_debug(fl_ctx, 'inside filter')\nself.logger.debug('check ga... | <|body_start_0|>
if not data_kinds:
data_kinds = [DataKind.WEIGHT_DIFF, DataKind.WEIGHTS]
super().__init__(supported_data_kinds=[DataKind.WEIGHTS, DataKind.WEIGHT_DIFF], data_kinds_to_filter=data_kinds)
self.percentile = percentile
self.gamma = gamma
<|end_body_0|>
<|body_st... | PercentilePrivacy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PercentilePrivacy:
def __init__(self, percentile=10, gamma=0.01, data_kinds: List[str]=None):
"""Implementation of "largest percentile to share" privacy preserving policy. Shokri and Shmatikov, Privacy-preserving deep learning, CCS '15 Args: percentile (int, optional): Only abs diff grea... | stack_v2_sparse_classes_75kplus_train_007214 | 3,902 | permissive | [
{
"docstring": "Implementation of \"largest percentile to share\" privacy preserving policy. Shokri and Shmatikov, Privacy-preserving deep learning, CCS '15 Args: percentile (int, optional): Only abs diff greater than this percentile is updated. Allowed range 0..100. Defaults to 10. gamma (float, optional): The... | 2 | stack_v2_sparse_classes_30k_train_045090 | Implement the Python class `PercentilePrivacy` described below.
Class description:
Implement the PercentilePrivacy class.
Method signatures and docstrings:
- def __init__(self, percentile=10, gamma=0.01, data_kinds: List[str]=None): Implementation of "largest percentile to share" privacy preserving policy. Shokri and... | Implement the Python class `PercentilePrivacy` described below.
Class description:
Implement the PercentilePrivacy class.
Method signatures and docstrings:
- def __init__(self, percentile=10, gamma=0.01, data_kinds: List[str]=None): Implementation of "largest percentile to share" privacy preserving policy. Shokri and... | 1433290c203bd23f34c29e11795ce592bc067888 | <|skeleton|>
class PercentilePrivacy:
def __init__(self, percentile=10, gamma=0.01, data_kinds: List[str]=None):
"""Implementation of "largest percentile to share" privacy preserving policy. Shokri and Shmatikov, Privacy-preserving deep learning, CCS '15 Args: percentile (int, optional): Only abs diff grea... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PercentilePrivacy:
def __init__(self, percentile=10, gamma=0.01, data_kinds: List[str]=None):
"""Implementation of "largest percentile to share" privacy preserving policy. Shokri and Shmatikov, Privacy-preserving deep learning, CCS '15 Args: percentile (int, optional): Only abs diff greater than this ... | the_stack_v2_python_sparse | nvflare/app_common/filters/percentile_privacy.py | NVIDIA/NVFlare | train | 442 | |
c8d54ea89460328406dd4644c2c28d5b2f74d3c7 | [
"self.x = x\nself.y = y\nself.canvas = canvas\nself.size = 100 * self.canvas.lock_scale\nself.state = 'locked'\nself.color = 'gold'\nself.canvas.create_rectangle(x, y + 0.8 * self.size, x + self.size, y + 1.8 * self.size, fill=self.color, outline='', tag='lock')\nself.movable_rectangle = self.canvas.create_rectangl... | <|body_start_0|>
self.x = x
self.y = y
self.canvas = canvas
self.size = 100 * self.canvas.lock_scale
self.state = 'locked'
self.color = 'gold'
self.canvas.create_rectangle(x, y + 0.8 * self.size, x + self.size, y + 1.8 * self.size, fill=self.color, outline='', tag... | Lock GUI item with onclick toggle. | Lock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lock:
"""Lock GUI item with onclick toggle."""
def __init__(self, canvas, x, y):
"""Draw the lock."""
<|body_0|>
def toggle(self, state=None):
"""Toggle the visual state of the lock."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.x = x
... | stack_v2_sparse_classes_75kplus_train_007215 | 46,294 | no_license | [
{
"docstring": "Draw the lock.",
"name": "__init__",
"signature": "def __init__(self, canvas, x, y)"
},
{
"docstring": "Toggle the visual state of the lock.",
"name": "toggle",
"signature": "def toggle(self, state=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011572 | Implement the Python class `Lock` described below.
Class description:
Lock GUI item with onclick toggle.
Method signatures and docstrings:
- def __init__(self, canvas, x, y): Draw the lock.
- def toggle(self, state=None): Toggle the visual state of the lock. | Implement the Python class `Lock` described below.
Class description:
Lock GUI item with onclick toggle.
Method signatures and docstrings:
- def __init__(self, canvas, x, y): Draw the lock.
- def toggle(self, state=None): Toggle the visual state of the lock.
<|skeleton|>
class Lock:
"""Lock GUI item with onclick... | 2127477f171afa536e77e83aaa8c3131916eb587 | <|skeleton|>
class Lock:
"""Lock GUI item with onclick toggle."""
def __init__(self, canvas, x, y):
"""Draw the lock."""
<|body_0|>
def toggle(self, state=None):
"""Toggle the visual state of the lock."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Lock:
"""Lock GUI item with onclick toggle."""
def __init__(self, canvas, x, y):
"""Draw the lock."""
self.x = x
self.y = y
self.canvas = canvas
self.size = 100 * self.canvas.lock_scale
self.state = 'locked'
self.color = 'gold'
self.canvas.c... | the_stack_v2_python_sparse | widgets/FlowPath.py | mathmauney/SAXSControl | train | 1 |
c54bbd2aa60523b84d556d164e27edeeb1b5f4b5 | [
"m = MATCH.match(string, start)\nif m is not None and (not fullmatch or m.end(0) == len(string)):\n return (split_channels(m.group('color')), m.end(0))\nreturn None",
"options = kwargs\na = parent.alpha(nans=False)\nshow_alpha = alpha is not False and (alpha is True or a < 1.0)\ntemplate = '&H{:02x}{:02x}{:02x... | <|body_start_0|>
m = MATCH.match(string, start)
if m is not None and (not fullmatch or m.end(0) == len(string)):
return (split_channels(m.group('color')), m.end(0))
return None
<|end_body_0|>
<|body_start_1|>
options = kwargs
a = parent.alpha(nans=False)
show... | ASS `ABGR` color space. | AssABGR | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssABGR:
"""ASS `ABGR` color space."""
def match(cls, string: str, start: int=0, fullmatch: bool=True):
"""Match a color string."""
<|body_0|>
def to_string(cls, parent, *, options=None, alpha=None, precision=None, fit=True, none=False, **kwargs):
"""Convert colo... | stack_v2_sparse_classes_75kplus_train_007216 | 2,708 | permissive | [
{
"docstring": "Match a color string.",
"name": "match",
"signature": "def match(cls, string: str, start: int=0, fullmatch: bool=True)"
},
{
"docstring": "Convert color to `&HAABBGGRR`.",
"name": "to_string",
"signature": "def to_string(cls, parent, *, options=None, alpha=None, precision... | 2 | stack_v2_sparse_classes_30k_train_040033 | Implement the Python class `AssABGR` described below.
Class description:
ASS `ABGR` color space.
Method signatures and docstrings:
- def match(cls, string: str, start: int=0, fullmatch: bool=True): Match a color string.
- def to_string(cls, parent, *, options=None, alpha=None, precision=None, fit=True, none=False, **... | Implement the Python class `AssABGR` described below.
Class description:
ASS `ABGR` color space.
Method signatures and docstrings:
- def match(cls, string: str, start: int=0, fullmatch: bool=True): Match a color string.
- def to_string(cls, parent, *, options=None, alpha=None, precision=None, fit=True, none=False, **... | ad4d779bff57a65b7c77cda0b79c10cf904eb817 | <|skeleton|>
class AssABGR:
"""ASS `ABGR` color space."""
def match(cls, string: str, start: int=0, fullmatch: bool=True):
"""Match a color string."""
<|body_0|>
def to_string(cls, parent, *, options=None, alpha=None, precision=None, fit=True, none=False, **kwargs):
"""Convert colo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AssABGR:
"""ASS `ABGR` color space."""
def match(cls, string: str, start: int=0, fullmatch: bool=True):
"""Match a color string."""
m = MATCH.match(string, start)
if m is not None and (not fullmatch or m.end(0) == len(string)):
return (split_channels(m.group('color')),... | the_stack_v2_python_sparse | custom/ass_abgr.py | facelessuser/ColorHelper | train | 279 |
638293bb91a64c81d1fa7ef98596fcd3257b48c5 | [
"n = len(nums)\nif n == 0:\n return 0\ndp = [1] * len(nums)\nfor i in range(1, n):\n for j in range(0, i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[j] + 1, dp[i])\nreturn max(dp)",
"d = []\nfor n in nums:\n if not d or n > d[-1]:\n d.append(n)\n else:\n l, r = (0, len(d... | <|body_start_0|>
n = len(nums)
if n == 0:
return 0
dp = [1] * len(nums)
for i in range(1, n):
for j in range(0, i):
if nums[i] > nums[j]:
dp[i] = max(dp[j] + 1, dp[i])
return max(dp)
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS_dp(self, nums):
"""1.定义dp[i]表示以第i个数字结尾的最长上升子序列的长度,注意 nums[i]必须被选取,最终答案为 max(dp) 2.定义dp[i]表示前i个数字中最长上升子序列的长度,注意 nums[i]不一定被选取,最终答案为 dp[-1] 以上有两种定义方式,这里选第一种: 在计算dp[i]之前,已经计算出 dp[0, 1, ……, i−1]的值,即考虑往dp[0, 1, ……, i−1]中最长的上升子序列后面再加一个 nums[i]. 由于dp[j]代表 nums[0, 1, ……... | stack_v2_sparse_classes_75kplus_train_007217 | 2,344 | no_license | [
{
"docstring": "1.定义dp[i]表示以第i个数字结尾的最长上升子序列的长度,注意 nums[i]必须被选取,最终答案为 max(dp) 2.定义dp[i]表示前i个数字中最长上升子序列的长度,注意 nums[i]不一定被选取,最终答案为 dp[-1] 以上有两种定义方式,这里选第一种: 在计算dp[i]之前,已经计算出 dp[0, 1, ……, i−1]的值,即考虑往dp[0, 1, ……, i−1]中最长的上升子序列后面再加一个 nums[i]. 由于dp[j]代表 nums[0, 1, ……, j]中以 nums[j]结尾的最长上升子序列, 所以如果能从 dp[j]状态转移到 dp[i], 那么... | 2 | stack_v2_sparse_classes_30k_train_020339 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS_dp(self, nums): 1.定义dp[i]表示以第i个数字结尾的最长上升子序列的长度,注意 nums[i]必须被选取,最终答案为 max(dp) 2.定义dp[i]表示前i个数字中最长上升子序列的长度,注意 nums[i]不一定被选取,最终答案为 dp[-1] 以上有两种定义方式,这里选第一种: 在计算dp[i]之... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS_dp(self, nums): 1.定义dp[i]表示以第i个数字结尾的最长上升子序列的长度,注意 nums[i]必须被选取,最终答案为 max(dp) 2.定义dp[i]表示前i个数字中最长上升子序列的长度,注意 nums[i]不一定被选取,最终答案为 dp[-1] 以上有两种定义方式,这里选第一种: 在计算dp[i]之... | 7dbd6da4cf42e422f1425a9de134ab31da52792a | <|skeleton|>
class Solution:
def lengthOfLIS_dp(self, nums):
"""1.定义dp[i]表示以第i个数字结尾的最长上升子序列的长度,注意 nums[i]必须被选取,最终答案为 max(dp) 2.定义dp[i]表示前i个数字中最长上升子序列的长度,注意 nums[i]不一定被选取,最终答案为 dp[-1] 以上有两种定义方式,这里选第一种: 在计算dp[i]之前,已经计算出 dp[0, 1, ……, i−1]的值,即考虑往dp[0, 1, ……, i−1]中最长的上升子序列后面再加一个 nums[i]. 由于dp[j]代表 nums[0, 1, ……... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lengthOfLIS_dp(self, nums):
"""1.定义dp[i]表示以第i个数字结尾的最长上升子序列的长度,注意 nums[i]必须被选取,最终答案为 max(dp) 2.定义dp[i]表示前i个数字中最长上升子序列的长度,注意 nums[i]不一定被选取,最终答案为 dp[-1] 以上有两种定义方式,这里选第一种: 在计算dp[i]之前,已经计算出 dp[0, 1, ……, i−1]的值,即考虑往dp[0, 1, ……, i−1]中最长的上升子序列后面再加一个 nums[i]. 由于dp[j]代表 nums[0, 1, ……, j]中以 nums[j]... | the_stack_v2_python_sparse | 查找计算/最长上升子序列.py | VixeruntR/leetcode | train | 1 | |
0e40e42aefc425c04d2ed1b148298d3cef920425 | [
"group = parser.add_mutually_exclusive_group(required=True)\ngroup.add_argument('-d', '--downgrade', action='store_true', help='downgrade the J-Link firmware')\ngroup.add_argument('-u', '--upgrade', action='store_true', help='upgrade the J-Link firmware')\nreturn self.add_common_arguments(parser, False)",
"jlink ... | <|body_start_0|>
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-d', '--downgrade', action='store_true', help='downgrade the J-Link firmware')
group.add_argument('-u', '--upgrade', action='store_true', help='upgrade the J-Link firmware')
return self.add_co... | Command for upgrading and downgrading J-Link firmware. | FirmwareCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FirmwareCommand:
"""Command for upgrading and downgrading J-Link firmware."""
def add_arguments(self, parser):
"""Adds the arguments for the firmware command. Args: self (FirmwareCommand): the ``FirmwareCommand`` instance parser (argparse.ArgumentParser): parser to add the commands t... | stack_v2_sparse_classes_75kplus_train_007218 | 20,264 | permissive | [
{
"docstring": "Adds the arguments for the firmware command. Args: self (FirmwareCommand): the ``FirmwareCommand`` instance parser (argparse.ArgumentParser): parser to add the commands to Returns: ``None``",
"name": "add_arguments",
"signature": "def add_arguments(self, parser)"
},
{
"docstring"... | 2 | null | Implement the Python class `FirmwareCommand` described below.
Class description:
Command for upgrading and downgrading J-Link firmware.
Method signatures and docstrings:
- def add_arguments(self, parser): Adds the arguments for the firmware command. Args: self (FirmwareCommand): the ``FirmwareCommand`` instance parse... | Implement the Python class `FirmwareCommand` described below.
Class description:
Command for upgrading and downgrading J-Link firmware.
Method signatures and docstrings:
- def add_arguments(self, parser): Adds the arguments for the firmware command. Args: self (FirmwareCommand): the ``FirmwareCommand`` instance parse... | f0d7cc9b0ce60a9de50c0f807c99d6824a706913 | <|skeleton|>
class FirmwareCommand:
"""Command for upgrading and downgrading J-Link firmware."""
def add_arguments(self, parser):
"""Adds the arguments for the firmware command. Args: self (FirmwareCommand): the ``FirmwareCommand`` instance parser (argparse.ArgumentParser): parser to add the commands t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FirmwareCommand:
"""Command for upgrading and downgrading J-Link firmware."""
def add_arguments(self, parser):
"""Adds the arguments for the firmware command. Args: self (FirmwareCommand): the ``FirmwareCommand`` instance parser (argparse.ArgumentParser): parser to add the commands to Returns: ``... | the_stack_v2_python_sparse | builder/frameworks/pylink/__main__.py | Wiz-IO/wizio-cc | train | 17 |
cb18606f5f6b731f5ab2c2a4ad57df89298e04f9 | [
"self.vertices = vertices\nself.faces = faces\nself.flip_normal = flip_normal\nif anatomy is None:\n anatomy = BrainStructure('unknown', None, 'both', 'surface')\nself.anatomy = anatomy\nassert self.ndim == 3",
"res = Mesh2D.read(gifti_filename)\ngifti_obj = nib.load(str(gifti_filename)) if isinstance(gifti_fi... | <|body_start_0|>
self.vertices = vertices
self.faces = faces
self.flip_normal = flip_normal
if anatomy is None:
anatomy = BrainStructure('unknown', None, 'both', 'surface')
self.anatomy = anatomy
assert self.ndim == 3
<|end_body_0|>
<|body_start_1|>
r... | Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file. | CorticalMesh | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CorticalMesh:
"""Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file."""
def __init__... | stack_v2_sparse_classes_75kplus_train_007219 | 8,869 | permissive | [
{
"docstring": "Creates a new CorticalMesh :param vertices: (M, N) array with the vertices of the curve in M-dimensional space. :param faces: (2, K) index array with all the line segments. :param flip_normal: flips the normal when it is computed (used by `Mesh2D.apply_affine`, should normally not be used) :para... | 5 | stack_v2_sparse_classes_30k_train_001537 | Implement the Python class `CorticalMesh` described below.
Class description:
Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading... | Implement the Python class `CorticalMesh` described below.
Class description:
Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading... | de00c15b946a99a048694f3d8b6ad822a835b299 | <|skeleton|>
class CorticalMesh:
"""Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file."""
def __init__... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CorticalMesh:
"""Describes a cortical mesh of a brain region Besides all the normal mesh operations defined in mesh.Mesh2D this object also contains information about the brain structure in the `anatomy` attribute This information is stored/used when reading/writing the file."""
def __init__(self, vertic... | the_stack_v2_python_sparse | mcot/core/surface/cortical_mesh.py | MichielCottaar/mcot.core | train | 1 |
6262597251cbf0fcd47aeca596f001d15ecaa173 | [
"if parcel_prioirty == 'volume':\n if parcel_order == 'non-decreasing':\n self._parcel_function = larger_volume\n if parcel_order == 'non-increasing':\n self._parcel_function = smaller_volume\n if truck_order == 'non-decreasing':\n self._truck_function = t_more_volume\n if truck_ord... | <|body_start_0|>
if parcel_prioirty == 'volume':
if parcel_order == 'non-decreasing':
self._parcel_function = larger_volume
if parcel_order == 'non-increasing':
self._parcel_function = smaller_volume
if truck_order == 'non-decreasing':
... | An algorithm to schedule parcels to trucks with criteria. | GreedyScheduler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GreedyScheduler:
"""An algorithm to schedule parcels to trucks with criteria."""
def __init__(self, parcel_order, truck_order, parcel_prioirty):
"""Intialize the order and priority of the parcel."""
<|body_0|>
def schedule(self, parcels, trucks, verbose=True):
""... | stack_v2_sparse_classes_75kplus_train_007220 | 9,375 | no_license | [
{
"docstring": "Intialize the order and priority of the parcel.",
"name": "__init__",
"signature": "def __init__(self, parcel_order, truck_order, parcel_prioirty)"
},
{
"docstring": "Schedule the given parcels onto the given trucks. @type self: GreedyScheduler @type parcels: list[Parcel] The par... | 2 | stack_v2_sparse_classes_30k_train_054528 | Implement the Python class `GreedyScheduler` described below.
Class description:
An algorithm to schedule parcels to trucks with criteria.
Method signatures and docstrings:
- def __init__(self, parcel_order, truck_order, parcel_prioirty): Intialize the order and priority of the parcel.
- def schedule(self, parcels, t... | Implement the Python class `GreedyScheduler` described below.
Class description:
An algorithm to schedule parcels to trucks with criteria.
Method signatures and docstrings:
- def __init__(self, parcel_order, truck_order, parcel_prioirty): Intialize the order and priority of the parcel.
- def schedule(self, parcels, t... | e00ae4246165e031b00cb7be0e9c0c1d60d49a75 | <|skeleton|>
class GreedyScheduler:
"""An algorithm to schedule parcels to trucks with criteria."""
def __init__(self, parcel_order, truck_order, parcel_prioirty):
"""Intialize the order and priority of the parcel."""
<|body_0|>
def schedule(self, parcels, trucks, verbose=True):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GreedyScheduler:
"""An algorithm to schedule parcels to trucks with criteria."""
def __init__(self, parcel_order, truck_order, parcel_prioirty):
"""Intialize the order and priority of the parcel."""
if parcel_prioirty == 'volume':
if parcel_order == 'non-decreasing':
... | the_stack_v2_python_sparse | python_class_proj/pycharm/csc148/teaching/scheduler.py | Mohan-Zhang-u/From_UofT | train | 0 |
3f6c99a6715e3c3deddb3c524a6824290a506c0b | [
"d = {'__class__': self.__class__.__name__}\nattrs = {}\nfor eachItem in self.__dict__.items():\n if isinstance(eachItem[1], MathObject):\n attrs[eachItem[0]] = eachItem[1].jsonEncode()\n else:\n attrs[eachItem[0]] = eachItem[1]\nd.update(attrs)\nreturn d",
"if jsonData['__class__'] != self.__... | <|body_start_0|>
d = {'__class__': self.__class__.__name__}
attrs = {}
for eachItem in self.__dict__.items():
if isinstance(eachItem[1], MathObject):
attrs[eachItem[0]] = eachItem[1].jsonEncode()
else:
attrs[eachItem[0]] = eachItem[1]
... | MathObject object. A base class for all math types | MathObject | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MathObject:
"""MathObject object. A base class for all math types"""
def jsonEncode(self):
"""Encodes object to JSON. Return: JSON string."""
<|body_0|>
def jsonDecode(self, jsonData, loader):
"""Encodes object to JSON. Return: True of the decode was successful""... | stack_v2_sparse_classes_75kplus_train_007221 | 1,299 | no_license | [
{
"docstring": "Encodes object to JSON. Return: JSON string.",
"name": "jsonEncode",
"signature": "def jsonEncode(self)"
},
{
"docstring": "Encodes object to JSON. Return: True of the decode was successful",
"name": "jsonDecode",
"signature": "def jsonDecode(self, jsonData, loader)"
}
... | 2 | stack_v2_sparse_classes_30k_train_053971 | Implement the Python class `MathObject` described below.
Class description:
MathObject object. A base class for all math types
Method signatures and docstrings:
- def jsonEncode(self): Encodes object to JSON. Return: JSON string.
- def jsonDecode(self, jsonData, loader): Encodes object to JSON. Return: True of the de... | Implement the Python class `MathObject` described below.
Class description:
MathObject object. A base class for all math types
Method signatures and docstrings:
- def jsonEncode(self): Encodes object to JSON. Return: JSON string.
- def jsonDecode(self, jsonData, loader): Encodes object to JSON. Return: True of the de... | 730a32f90d618e99a55084cf1442a86eaf4ebdf9 | <|skeleton|>
class MathObject:
"""MathObject object. A base class for all math types"""
def jsonEncode(self):
"""Encodes object to JSON. Return: JSON string."""
<|body_0|>
def jsonDecode(self, jsonData, loader):
"""Encodes object to JSON. Return: True of the decode was successful""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MathObject:
"""MathObject object. A base class for all math types"""
def jsonEncode(self):
"""Encodes object to JSON. Return: JSON string."""
d = {'__class__': self.__class__.__name__}
attrs = {}
for eachItem in self.__dict__.items():
if isinstance(eachItem[1],... | the_stack_v2_python_sparse | core/maths/math_object.py | jhodgson/Kraken | train | 0 |
175f177e97bd74a7df7b4bba3041b2eaa57ae342 | [
"nums.sort()\nn = len(nums)\nres = []\nfor i in range(n - 2):\n for j in range(i + 1, n - 1):\n for k in range(j + 1, n):\n if nums[i] + nums[j] + nums[k] == 0:\n res.append([nums[i], nums[j], nums[k]])\nres = list(set([tuple(t) for t in res]))\nres = [list(v) for v in res]\nretu... | <|body_start_0|>
nums.sort()
n = len(nums)
res = []
for i in range(n - 2):
for j in range(i + 1, n - 1):
for k in range(j + 1, n):
if nums[i] + nums[j] + nums[k] == 0:
res.append([nums[i], nums[j], nums[k]])
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum1(self, nums):
""":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^3),超时 空间复杂度:O(1),未使用额外空间"""
<|body_0|>
def threeSum2(self, nums):
""":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^2),超时 空间复杂度:O(n),使用哈希表空间换时间"""
<|body_... | stack_v2_sparse_classes_75kplus_train_007222 | 3,128 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^3),超时 空间复杂度:O(1),未使用额外空间",
"name": "threeSum1",
"signature": "def threeSum1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^2),超时 空间复杂度:O(n),使用哈希表空间换时间",
"name": "threeSum2",
"... | 3 | stack_v2_sparse_classes_30k_val_002689 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum1(self, nums): :type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^3),超时 空间复杂度:O(1),未使用额外空间
- def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum1(self, nums): :type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^3),超时 空间复杂度:O(1),未使用额外空间
- def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[i... | a2e5256f27dbfb23fc34119fc857cd9b00e28c03 | <|skeleton|>
class Solution:
def threeSum1(self, nums):
""":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^3),超时 空间复杂度:O(1),未使用额外空间"""
<|body_0|>
def threeSum2(self, nums):
""":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^2),超时 空间复杂度:O(n),使用哈希表空间换时间"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def threeSum1(self, nums):
""":type nums: List[int] :rtype: List[List[int]] 时间复杂度:O(n^3),超时 空间复杂度:O(1),未使用额外空间"""
nums.sort()
n = len(nums)
res = []
for i in range(n - 2):
for j in range(i + 1, n - 1):
for k in range(j + 1, n):
... | the_stack_v2_python_sparse | toTheMoon/leetcode_015_ThreeSum.py | jercas/offer66-leetcode-newcode | train | 0 | |
f7d89907cff987afc130332accfd777de62992ea | [
"if not 0.0 <= lr:\n raise ValueError('Invalid learning rate: {}'.format(lr))\nif not 0.0 <= betas[0] < 1.0:\n raise ValueError('Invalid beta parameter at index 0: {}'.format(betas[0]))\nif not 0.0 <= betas[1] < 1.0:\n raise ValueError('Invalid beta parameter at index 1: {}'.format(betas[1]))\ndefaults = d... | <|body_start_0|>
if not 0.0 <= lr:
raise ValueError('Invalid learning rate: {}'.format(lr))
if not 0.0 <= betas[0] < 1.0:
raise ValueError('Invalid beta parameter at index 0: {}'.format(betas[0]))
if not 0.0 <= betas[1] < 1.0:
raise ValueError('Invalid beta pa... | Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10. | Lion | [
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lion:
"""Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10."""
def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0001, betas: Tuple[float, float]=(0.9, 0.99), weight_decay: float=0.0... | stack_v2_sparse_classes_75kplus_train_007223 | 3,008 | permissive | [
{
"docstring": "Initialize the hyperparameters. :param params: Iterable of parameters to optimize or dicts defining parameter groups :param lr: Learning rate (default: 1e-4) :param betas: Coefficients used for computing running averages of gradient and its square (default: (0.9, 0.99)) :param weight_decay: Weig... | 2 | stack_v2_sparse_classes_30k_train_042257 | Implement the Python class `Lion` described below.
Class description:
Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10.
Method signatures and docstrings:
- def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0... | Implement the Python class `Lion` described below.
Class description:
Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10.
Method signatures and docstrings:
- def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0... | 7240726cf6425b53a26ed2faec03672f30fee6be | <|skeleton|>
class Lion:
"""Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10."""
def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0001, betas: Tuple[float, float]=(0.9, 0.99), weight_decay: float=0.0... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Lion:
"""Implements Lion algorithm. Generaly, it is recommended to divide lr used by AdamW by 10 and multiply the weight decay by 10."""
def __init__(self, params: Union[Iterable[torch.Tensor], Iterable[dict]], lr: float=0.0001, betas: Tuple[float, float]=(0.9, 0.99), weight_decay: float=0.0):
""... | the_stack_v2_python_sparse | src/super_gradients/training/utils/optimizers/lion.py | Deci-AI/super-gradients | train | 3,237 |
157b9753655758b659375f8192a150d9191e2fe8 | [
"self.aws_kms = aws_kms\nself.cryptsoft_kms = cryptsoft_kms\nself.id = id\nself.server_name = server_name\nself.server_type = server_type",
"if dictionary is None:\n return None\naws_kms = cohesity_management_sdk.models.aws_kms_configuration.AwsKmsConfiguration.from_dictionary(dictionary.get('awsKms')) if dict... | <|body_start_0|>
self.aws_kms = aws_kms
self.cryptsoft_kms = cryptsoft_kms
self.id = id
self.server_name = server_name
self.server_type = server_type
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
aws_kms = cohesity_management_sdk.... | Implementation of the 'KmsCreateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsConfiguration): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsConfiguration): Cryptsoft KMS config. id (int): The Id of a KMS server. server_name (string): Specifies the name given to ... | KmsCreateRequestParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KmsCreateRequestParameters:
"""Implementation of the 'KmsCreateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsConfiguration): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsConfiguration): Cryptsoft KMS config. id (int): The Id of a KMS serv... | stack_v2_sparse_classes_75kplus_train_007224 | 2,921 | permissive | [
{
"docstring": "Constructor for the KmsCreateRequestParameters class",
"name": "__init__",
"signature": "def __init__(self, aws_kms=None, cryptsoft_kms=None, id=None, server_name=None, server_type=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dic... | 2 | null | Implement the Python class `KmsCreateRequestParameters` described below.
Class description:
Implementation of the 'KmsCreateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsConfiguration): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsConfiguration): Cryptsoft KMS... | Implement the Python class `KmsCreateRequestParameters` described below.
Class description:
Implementation of the 'KmsCreateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsConfiguration): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsConfiguration): Cryptsoft KMS... | 0093194d125fc6746f55b8499da1270c64f473fc | <|skeleton|>
class KmsCreateRequestParameters:
"""Implementation of the 'KmsCreateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsConfiguration): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsConfiguration): Cryptsoft KMS config. id (int): The Id of a KMS serv... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KmsCreateRequestParameters:
"""Implementation of the 'KmsCreateRequestParameters' model. Request to create a KMS with specified configuration. Attributes: aws_kms (AwsKmsConfiguration): AWS KMS conifg. cryptsoft_kms (CryptsoftKmsConfiguration): Cryptsoft KMS config. id (int): The Id of a KMS server. server_na... | the_stack_v2_python_sparse | cohesity_management_sdk/models/kms_create_request_parameters.py | hsantoyo2/management-sdk-python | train | 0 |
e2bfccc5e25a7ea591fb31c4019eb4a45a244a94 | [
"xff = request.META.get('HTTP_X_FORWARDED_FOR')\nremote_addr = request.META.get('REMOTE_ADDR')\nnum_proxies = api_settings.NUM_PROXIES\nif num_proxies is not None:\n if num_proxies == 0 or xff is None:\n return remote_addr\n addrs = xff.split(',')\n client_addr = addrs[-min(num_proxies, len(addrs))]... | <|body_start_0|>
xff = request.META.get('HTTP_X_FORWARDED_FOR')
remote_addr = request.META.get('REMOTE_ADDR')
num_proxies = api_settings.NUM_PROXIES
if num_proxies is not None:
if num_proxies == 0 or xff is None:
return remote_addr
addrs = xff.spli... | TestThrottle | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestThrottle:
def get_ident(self, request):
"""根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_007225 | 3,502 | permissive | [
{
"docstring": "根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.",
"name": "get_ident",
"signature": "def get_ident(self, request)"
... | 3 | stack_v2_sparse_classes_30k_train_026992 | Implement the Python class `TestThrottle` described below.
Class description:
Implement the TestThrottle class.
Method signatures and docstrings:
- def get_ident(self, request): 根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If n... | Implement the Python class `TestThrottle` described below.
Class description:
Implement the TestThrottle class.
Method signatures and docstrings:
- def get_ident(self, request): 根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If n... | 58d7060ce255092c3ec9908dfa1810bd7a665365 | <|skeleton|>
class TestThrottle:
def get_ident(self, request):
"""根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestThrottle:
def get_ident(self, request):
"""根据用户IP和代理IP,当做请求者的唯一IP Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR."""
xff = request.META.get('H... | the_stack_v2_python_sparse | day08/views.py | jiawenquan/django_restful_demo | train | 0 | |
da48b22f9c55ac07cda75370a263c2be263d313c | [
"array = self.inorderTraversal(root)\nleft, right = (0, len(array) - 1)\nwhile left < right:\n total = array[left] + array[right]\n if total == k:\n return True\n elif total > k:\n right -= 1\n else:\n left += 1\nreturn False",
"results = []\nstack = []\nwhile root or stack != []:... | <|body_start_0|>
array = self.inorderTraversal(root)
left, right = (0, len(array) - 1)
while left < right:
total = array[left] + array[right]
if total == k:
return True
elif total > k:
right -= 1
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findTarget(self, root: TreeNode, k: int) -> bool:
"""Intuition: - Inorder Traversal of the BST yields a sorted array. - Use 2 pointers and a simple while loop, to determine if the sum exists. Time Complexity: O(n), since we visit each node once both in inorder and in two po... | stack_v2_sparse_classes_75kplus_train_007226 | 1,590 | no_license | [
{
"docstring": "Intuition: - Inorder Traversal of the BST yields a sorted array. - Use 2 pointers and a simple while loop, to determine if the sum exists. Time Complexity: O(n), since we visit each node once both in inorder and in two pointer. Making it O(n + n) => O(n) Space Complexity: O(n), to store all node... | 2 | stack_v2_sparse_classes_30k_train_047176 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTarget(self, root: TreeNode, k: int) -> bool: Intuition: - Inorder Traversal of the BST yields a sorted array. - Use 2 pointers and a simple while loop, to determine if t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findTarget(self, root: TreeNode, k: int) -> bool: Intuition: - Inorder Traversal of the BST yields a sorted array. - Use 2 pointers and a simple while loop, to determine if t... | 17f3fefa143db53d12a93df42d9cde186fa92318 | <|skeleton|>
class Solution:
def findTarget(self, root: TreeNode, k: int) -> bool:
"""Intuition: - Inorder Traversal of the BST yields a sorted array. - Use 2 pointers and a simple while loop, to determine if the sum exists. Time Complexity: O(n), since we visit each node once both in inorder and in two po... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findTarget(self, root: TreeNode, k: int) -> bool:
"""Intuition: - Inorder Traversal of the BST yields a sorted array. - Use 2 pointers and a simple while loop, to determine if the sum exists. Time Complexity: O(n), since we visit each node once both in inorder and in two pointer. Making ... | the_stack_v2_python_sparse | Problems/Leetcode/653_TwoSumIV-InputIsABST.py | suhassrivats/Data-Structures-And-Algorithms-Implementation | train | 3 | |
d6fbedb83b39047f310b7935ea33ca436583fe7c | [
"self.driver.get(self.url_ + '/')\ntitle_present = EC.text_to_be_present_in_element((By.XPATH, '//*[@id=\"main-nav\"]/div/div[1]/a'), 'Data Commons')\nWebDriverWait(self.driver, self.TIMEOUT_SEC).until(title_present)\nhero_msg = self.driver.find_elements_by_class_name('lead')[0]\nself.assertTrue(hero_msg.text.start... | <|body_start_0|>
self.driver.get(self.url_ + '/')
title_present = EC.text_to_be_present_in_element((By.XPATH, '//*[@id="main-nav"]/div/div[1]/a'), 'Data Commons')
WebDriverWait(self.driver, self.TIMEOUT_SEC).until(title_present)
hero_msg = self.driver.find_elements_by_class_name('lead')[... | Tests for Homepage. | TestPlaceLanding | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestPlaceLanding:
"""Tests for Homepage."""
def test_homepage_en(self):
"""Test homepage in EN."""
<|body_0|>
def test_homepage_it(self):
"""Test homepage in IT."""
<|body_1|>
def test_hero_all_langs(self):
"""Test hero message translation in... | stack_v2_sparse_classes_75kplus_train_007227 | 5,887 | permissive | [
{
"docstring": "Test homepage in EN.",
"name": "test_homepage_en",
"signature": "def test_homepage_en(self)"
},
{
"docstring": "Test homepage in IT.",
"name": "test_homepage_it",
"signature": "def test_homepage_it(self)"
},
{
"docstring": "Test hero message translation in *all* l... | 3 | stack_v2_sparse_classes_30k_train_016559 | Implement the Python class `TestPlaceLanding` described below.
Class description:
Tests for Homepage.
Method signatures and docstrings:
- def test_homepage_en(self): Test homepage in EN.
- def test_homepage_it(self): Test homepage in IT.
- def test_hero_all_langs(self): Test hero message translation in *all* language... | Implement the Python class `TestPlaceLanding` described below.
Class description:
Tests for Homepage.
Method signatures and docstrings:
- def test_homepage_en(self): Test homepage in EN.
- def test_homepage_it(self): Test homepage in IT.
- def test_hero_all_langs(self): Test hero message translation in *all* language... | 928625749a74dd9de473170b5683f62a4bbdbd15 | <|skeleton|>
class TestPlaceLanding:
"""Tests for Homepage."""
def test_homepage_en(self):
"""Test homepage in EN."""
<|body_0|>
def test_homepage_it(self):
"""Test homepage in IT."""
<|body_1|>
def test_hero_all_langs(self):
"""Test hero message translation in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestPlaceLanding:
"""Tests for Homepage."""
def test_homepage_en(self):
"""Test homepage in EN."""
self.driver.get(self.url_ + '/')
title_present = EC.text_to_be_present_in_element((By.XPATH, '//*[@id="main-nav"]/div/div[1]/a'), 'Data Commons')
WebDriverWait(self.driver, s... | the_stack_v2_python_sparse | server/webdriver_tests/homepage_test.py | localsite/website | train | 0 |
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e | [
"super(StandStill, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor",
"new_status = py_trees.common.Status.RUNNING\nvelocity = CarlaDataProvider.get_velocity(self._actor)\nif velocity < EPSILON:\n new_status = py_trees.common.Status.SUCCESS\nself.logger.de... | <|body_start_0|>
super(StandStill, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._actor = actor
<|end_body_0|>
<|body_start_1|>
new_status = py_trees.common.Status.RUNNING
velocity = CarlaDataProvider.get_velocity(self._actor)
if ... | This class contains a standstill behavior of a scenario | StandStill | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StandStill:
"""This class contains a standstill behavior of a scenario"""
def __init__(self, actor, name):
"""Setup actor"""
<|body_0|>
def update(self):
"""Check if the _actor stands still (v=0)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
s... | stack_v2_sparse_classes_75kplus_train_007228 | 25,380 | permissive | [
{
"docstring": "Setup actor",
"name": "__init__",
"signature": "def __init__(self, actor, name)"
},
{
"docstring": "Check if the _actor stands still (v=0)",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007240 | Implement the Python class `StandStill` described below.
Class description:
This class contains a standstill behavior of a scenario
Method signatures and docstrings:
- def __init__(self, actor, name): Setup actor
- def update(self): Check if the _actor stands still (v=0) | Implement the Python class `StandStill` described below.
Class description:
This class contains a standstill behavior of a scenario
Method signatures and docstrings:
- def __init__(self, actor, name): Setup actor
- def update(self): Check if the _actor stands still (v=0)
<|skeleton|>
class StandStill:
"""This cl... | 1d3e8339f8e60f7bdcaefeff49ec238b1746b047 | <|skeleton|>
class StandStill:
"""This class contains a standstill behavior of a scenario"""
def __init__(self, actor, name):
"""Setup actor"""
<|body_0|>
def update(self):
"""Check if the _actor stands still (v=0)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StandStill:
"""This class contains a standstill behavior of a scenario"""
def __init__(self, actor, name):
"""Setup actor"""
super(StandStill, self).__init__(name)
self.logger.debug('%s.__init__()' % self.__class__.__name__)
self._actor = actor
def update(self):
... | the_stack_v2_python_sparse | srunner/scenariomanager/atomic_scenario_behavior.py | chauvinSimon/scenario_runner | train | 2 |
963347e62527801fc81b171503a3463a225d8569 | [
"result = {'result': 'NG', 'content': []}\nif doc_id:\n tags = CtrlDSScene().get_tags_by_doc_id(doc_id)\n if tags:\n result['result'] = 'OK'\n result['content'] = tags\n micro_ver = CtrlDsDoc().get_doc_ver(doc_id)\n result['micro_ver'] = micro_ver\nreturn result",
"result = {'result': 'N... | <|body_start_0|>
result = {'result': 'NG', 'content': []}
if doc_id:
tags = CtrlDSScene().get_tags_by_doc_id(doc_id)
if tags:
result['result'] = 'OK'
result['content'] = tags
micro_ver = CtrlDsDoc().get_doc_ver(doc_id)
resul... | ApiDSTag | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用)"""
<|body_0|>
def post(self):
"""保存場景的模快下的考慮點 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'result': 'NG', 'content': []}
if doc_id:
tags = CtrlDSS... | stack_v2_sparse_classes_75kplus_train_007229 | 2,608 | no_license | [
{
"docstring": "获取设计文档关系的场景(场景的考虑点使用)",
"name": "get",
"signature": "def get(self, doc_id=0)"
},
{
"docstring": "保存場景的模快下的考慮點 :return:",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027748 | Implement the Python class `ApiDSTag` described below.
Class description:
Implement the ApiDSTag class.
Method signatures and docstrings:
- def get(self, doc_id=0): 获取设计文档关系的场景(场景的考虑点使用)
- def post(self): 保存場景的模快下的考慮點 :return: | Implement the Python class `ApiDSTag` described below.
Class description:
Implement the ApiDSTag class.
Method signatures and docstrings:
- def get(self, doc_id=0): 获取设计文档关系的场景(场景的考虑点使用)
- def post(self): 保存場景的模快下的考慮點 :return:
<|skeleton|>
class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用)"""
<|body_0|>
def post(self):
"""保存場景的模快下的考慮點 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApiDSTag:
def get(self, doc_id=0):
"""获取设计文档关系的场景(场景的考虑点使用)"""
result = {'result': 'NG', 'content': []}
if doc_id:
tags = CtrlDSScene().get_tags_by_doc_id(doc_id)
if tags:
result['result'] = 'OK'
result['content'] = tags
... | the_stack_v2_python_sparse | Source/collaboration_2/app/api_1_0/api_ds_scene.py | lsn1183/web_project | train | 0 | |
345a6dd679c156bc557e59abc07c110f35d5e271 | [
"if len(username) == 11 and re.match('1\\\\d{10}', username):\n if password1 == password2:\n if password1 is None:\n return False\n elif 6 < len(password1) < 17:\n data = [each for each in password1 if each in printable[:94]]\n '\\n 密码只能为英文状态下... | <|body_start_0|>
if len(username) == 11 and re.match('1\\d{10}', username):
if password1 == password2:
if password1 is None:
return False
elif 6 < len(password1) < 17:
data = [each for each in password1 if each in printable[:94]... | CheckArgs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckArgs:
def check_argument_reg(cls, username, password1, password2):
"""检查注册传入参数是否有误 :param username: 手机号码 :param password1: 输入密码 :param password2: 重复密码 :return:True or False"""
<|body_0|>
def check_argument_login(self, username, password):
"""检查登录参数 :param userna... | stack_v2_sparse_classes_75kplus_train_007230 | 2,727 | no_license | [
{
"docstring": "检查注册传入参数是否有误 :param username: 手机号码 :param password1: 输入密码 :param password2: 重复密码 :return:True or False",
"name": "check_argument_reg",
"signature": "def check_argument_reg(cls, username, password1, password2)"
},
{
"docstring": "检查登录参数 :param username: :param password: :return:",... | 3 | stack_v2_sparse_classes_30k_train_029680 | Implement the Python class `CheckArgs` described below.
Class description:
Implement the CheckArgs class.
Method signatures and docstrings:
- def check_argument_reg(cls, username, password1, password2): 检查注册传入参数是否有误 :param username: 手机号码 :param password1: 输入密码 :param password2: 重复密码 :return:True or False
- def check_... | Implement the Python class `CheckArgs` described below.
Class description:
Implement the CheckArgs class.
Method signatures and docstrings:
- def check_argument_reg(cls, username, password1, password2): 检查注册传入参数是否有误 :param username: 手机号码 :param password1: 输入密码 :param password2: 重复密码 :return:True or False
- def check_... | 37a983a18d9c8ab18c61b4cc2c60ccd137120bf4 | <|skeleton|>
class CheckArgs:
def check_argument_reg(cls, username, password1, password2):
"""检查注册传入参数是否有误 :param username: 手机号码 :param password1: 输入密码 :param password2: 重复密码 :return:True or False"""
<|body_0|>
def check_argument_login(self, username, password):
"""检查登录参数 :param userna... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CheckArgs:
def check_argument_reg(cls, username, password1, password2):
"""检查注册传入参数是否有误 :param username: 手机号码 :param password1: 输入密码 :param password2: 重复密码 :return:True or False"""
if len(username) == 11 and re.match('1\\d{10}', username):
if password1 == password2:
... | the_stack_v2_python_sparse | handler/home/lib.py | faith-python/exam-drive | train | 8 | |
a14a7e6eb05b67cd6ff79f4f59fd823cf5a8ffa0 | [
"l_obj = LocationData()\nl_obj.RiseSet = RiseSetData()\np_pyhouse_obj.House.Location = l_obj\ntry:\n l_xml = p_pyhouse_obj.Xml.XmlRoot.find('HouseDivision')\n if l_xml is None:\n return l_obj\n l_xml = l_xml.find('LocationSection')\n if l_xml is None:\n return l_obj\n l_obj.Street = Put... | <|body_start_0|>
l_obj = LocationData()
l_obj.RiseSet = RiseSetData()
p_pyhouse_obj.House.Location = l_obj
try:
l_xml = p_pyhouse_obj.Xml.XmlRoot.find('HouseDivision')
if l_xml is None:
return l_obj
l_xml = l_xml.find('LocationSection')... | Use the internal data to read / write an updated XML config file. | Xml | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Xml:
"""Use the internal data to read / write an updated XML config file."""
def read_location_xml(p_pyhouse_obj):
"""@param p_house_xml: is the config file xml for a house."""
<|body_0|>
def write_location_xml(p_location_obj):
"""Replace the data in the 'House/L... | stack_v2_sparse_classes_75kplus_train_007231 | 3,537 | permissive | [
{
"docstring": "@param p_house_xml: is the config file xml for a house.",
"name": "read_location_xml",
"signature": "def read_location_xml(p_pyhouse_obj)"
},
{
"docstring": "Replace the data in the 'House/Location' section with the current data.",
"name": "write_location_xml",
"signature... | 2 | stack_v2_sparse_classes_30k_train_041677 | Implement the Python class `Xml` described below.
Class description:
Use the internal data to read / write an updated XML config file.
Method signatures and docstrings:
- def read_location_xml(p_pyhouse_obj): @param p_house_xml: is the config file xml for a house.
- def write_location_xml(p_location_obj): Replace the... | Implement the Python class `Xml` described below.
Class description:
Use the internal data to read / write an updated XML config file.
Method signatures and docstrings:
- def read_location_xml(p_pyhouse_obj): @param p_house_xml: is the config file xml for a house.
- def write_location_xml(p_location_obj): Replace the... | 6444ed0b4c38ab59b9e419e4d54d65d598e6a54e | <|skeleton|>
class Xml:
"""Use the internal data to read / write an updated XML config file."""
def read_location_xml(p_pyhouse_obj):
"""@param p_house_xml: is the config file xml for a house."""
<|body_0|>
def write_location_xml(p_location_obj):
"""Replace the data in the 'House/L... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Xml:
"""Use the internal data to read / write an updated XML config file."""
def read_location_xml(p_pyhouse_obj):
"""@param p_house_xml: is the config file xml for a house."""
l_obj = LocationData()
l_obj.RiseSet = RiseSetData()
p_pyhouse_obj.House.Location = l_obj
... | the_stack_v2_python_sparse | src/Modules/Housing/location.py | bopopescu/PyHouse_1 | train | 0 |
cd529eeba7d13e770d0c16a5d23ad8e06c164aab | [
"if not nums:\n return False\nn = nums.__len__()\nif n > 1 and nums[0] == 0:\n return False\nfor i in range(n - 1, -1, -1):\n if nums[i] == 0:\n for j in range(i - 1, -1, -1):\n if nums[j] + j > i or nums[j] + j == n - 1:\n break\n if j == 0:\n ret... | <|body_start_0|>
if not nums:
return False
n = nums.__len__()
if n > 1 and nums[0] == 0:
return False
for i in range(n - 1, -1, -1):
if nums[i] == 0:
for j in range(i - 1, -1, -1):
if nums[j] + j > i or nums[j] + j =... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canJump1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
def canJump2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body... | stack_v2_sparse_classes_75kplus_train_007232 | 1,872 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canJump",
"signature": "def canJump(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canJump1",
"signature": "def canJump1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums): :type nums: List[int] :rtype: bool
- def canJump1(self, nums): :type nums: List[int] :rtype: bool
- def canJump2(self, nums): :type nums: List[int] :rtyp... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums): :type nums: List[int] :rtype: bool
- def canJump1(self, nums): :type nums: List[int] :rtype: bool
- def canJump2(self, nums): :type nums: List[int] :rtyp... | 472f780c3214aab5c713612812d834ccbe589434 | <|skeleton|>
class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canJump1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
def canJump2(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
if not nums:
return False
n = nums.__len__()
if n > 1 and nums[0] == 0:
return False
for i in range(n - 1, -1, -1):
if nums[i] == 0:
for j in ... | the_stack_v2_python_sparse | 3/55-Jump_Game.py | ChangXiaodong/Leetcode-solutions | train | 4 | |
e81dbb18f20b1c5e9f6ce318a8d21b7bce914afe | [
"super().__init__(answer, text)\nself.type = 'checkbox'\nself.alternatives = [alt1, alt2, alt3]",
"result = 0\nfor a in self.answer:\n if a in respons.getlist('answer'):\n result += 1\nreturn result"
] | <|body_start_0|>
super().__init__(answer, text)
self.type = 'checkbox'
self.alternatives = [alt1, alt2, alt3]
<|end_body_0|>
<|body_start_1|>
result = 0
for a in self.answer:
if a in respons.getlist('answer'):
result += 1
return result
<|end_b... | Questions Type 2 | QuestionType2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionType2:
"""Questions Type 2"""
def __init__(self, answer, text, alt1, alt2, alt3):
"""Init"""
<|body_0|>
def check_answer(self, respons):
"""Check for multiple points"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super().__init__(answer... | stack_v2_sparse_classes_75kplus_train_007233 | 1,454 | no_license | [
{
"docstring": "Init",
"name": "__init__",
"signature": "def __init__(self, answer, text, alt1, alt2, alt3)"
},
{
"docstring": "Check for multiple points",
"name": "check_answer",
"signature": "def check_answer(self, respons)"
}
] | 2 | stack_v2_sparse_classes_30k_train_025762 | Implement the Python class `QuestionType2` described below.
Class description:
Questions Type 2
Method signatures and docstrings:
- def __init__(self, answer, text, alt1, alt2, alt3): Init
- def check_answer(self, respons): Check for multiple points | Implement the Python class `QuestionType2` described below.
Class description:
Questions Type 2
Method signatures and docstrings:
- def __init__(self, answer, text, alt1, alt2, alt3): Init
- def check_answer(self, respons): Check for multiple points
<|skeleton|>
class QuestionType2:
"""Questions Type 2"""
d... | bf8750d14f699e97ea6d9274b16ba684c367d15f | <|skeleton|>
class QuestionType2:
"""Questions Type 2"""
def __init__(self, answer, text, alt1, alt2, alt3):
"""Init"""
<|body_0|>
def check_answer(self, respons):
"""Check for multiple points"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuestionType2:
"""Questions Type 2"""
def __init__(self, answer, text, alt1, alt2, alt3):
"""Init"""
super().__init__(answer, text)
self.type = 'checkbox'
self.alternatives = [alt1, alt2, alt3]
def check_answer(self, respons):
"""Check for multiple points"""
... | the_stack_v2_python_sparse | kmom02/questions/questions.py | pamo18/dbwebb-oopython | train | 0 |
89eda3da74e5dbc3b50d3c619fe0c0e9db991f61 | [
"self.month = month\nself.net = net\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nmonth = dictionary.get('month')\nnet = dictionary.get('net')\nfor key in cls._names.values():\n if key in dictionary:\n del dictionary[key]\nreturn cls(month, net, dictiona... | <|body_start_0|>
self.month = month
self.net = net
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
month = dictionary.get('month')
net = dictionary.get('net')
for key in cls._names.... | Implementation of the 'NetMonthly' model. TODO: type model description here. Attributes: month (long|int): Timestamp for the first day of this month net (float): Total income during the given month, across all income streams | NetMonthly | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetMonthly:
"""Implementation of the 'NetMonthly' model. TODO: type model description here. Attributes: month (long|int): Timestamp for the first day of this month net (float): Total income during the given month, across all income streams"""
def __init__(self, month=None, net=None, addition... | stack_v2_sparse_classes_75kplus_train_007234 | 1,874 | permissive | [
{
"docstring": "Constructor for the NetMonthly class",
"name": "__init__",
"signature": "def __init__(self, month=None, net=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the ob... | 2 | stack_v2_sparse_classes_30k_train_015668 | Implement the Python class `NetMonthly` described below.
Class description:
Implementation of the 'NetMonthly' model. TODO: type model description here. Attributes: month (long|int): Timestamp for the first day of this month net (float): Total income during the given month, across all income streams
Method signatures... | Implement the Python class `NetMonthly` described below.
Class description:
Implementation of the 'NetMonthly' model. TODO: type model description here. Attributes: month (long|int): Timestamp for the first day of this month net (float): Total income during the given month, across all income streams
Method signatures... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class NetMonthly:
"""Implementation of the 'NetMonthly' model. TODO: type model description here. Attributes: month (long|int): Timestamp for the first day of this month net (float): Total income during the given month, across all income streams"""
def __init__(self, month=None, net=None, addition... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NetMonthly:
"""Implementation of the 'NetMonthly' model. TODO: type model description here. Attributes: month (long|int): Timestamp for the first day of this month net (float): Total income during the given month, across all income streams"""
def __init__(self, month=None, net=None, additional_properties... | the_stack_v2_python_sparse | finicityapi/models/net_monthly.py | monarchmoney/finicity-python | train | 0 |
5841de63c5cb7bca5da9919e14ef93e6a2a52e4f | [
"super().__init__()\nif not is_sqrt(patch_size):\n raise ValueError(f'patch_size should be square number, got {patch_size}.')\nself.patch_size = ensure_tuple_rep(patch_size, spatial_dims)\nself.img_size = ensure_tuple_rep(img_size, spatial_dims)\nself.spatial_dims = spatial_dims\nfor m, p in zip(self.img_size, s... | <|body_start_0|>
super().__init__()
if not is_sqrt(patch_size):
raise ValueError(f'patch_size should be square number, got {patch_size}.')
self.patch_size = ensure_tuple_rep(patch_size, spatial_dims)
self.img_size = ensure_tuple_rep(img_size, spatial_dims)
self.spatia... | Vision Transformer (ViT), based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" Modified to also give same dimension outputs as the input size of the image | ViTAutoEnc | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViTAutoEnc:
"""Vision Transformer (ViT), based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" Modified to also give same dimension outputs as the input size of the image"""
def __init__(self, in_channels... | stack_v2_sparse_classes_75kplus_train_007235 | 5,739 | permissive | [
{
"docstring": "Args: in_channels: dimension of input channels or the number of channels for input. img_size: dimension of input image. patch_size: dimension of patch size out_channels: number of output channels. Defaults to 1. deconv_chns: number of channels for the deconvolution layers. Defaults to 16. hidden... | 2 | stack_v2_sparse_classes_30k_train_054643 | Implement the Python class `ViTAutoEnc` described below.
Class description:
Vision Transformer (ViT), based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" Modified to also give same dimension outputs as the input size of the image... | Implement the Python class `ViTAutoEnc` described below.
Class description:
Vision Transformer (ViT), based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" Modified to also give same dimension outputs as the input size of the image... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class ViTAutoEnc:
"""Vision Transformer (ViT), based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" Modified to also give same dimension outputs as the input size of the image"""
def __init__(self, in_channels... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ViTAutoEnc:
"""Vision Transformer (ViT), based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" Modified to also give same dimension outputs as the input size of the image"""
def __init__(self, in_channels: int, img_si... | the_stack_v2_python_sparse | monai/networks/nets/vitautoenc.py | Project-MONAI/MONAI | train | 4,805 |
b0a9b5c6755d7d9a1412ad1f0b23b31050b7ef8a | [
"params = {'part': enf_parts(resource='playlistItems', value=parts), 'maxResults': max_results, 'onBehalfOfContentOwner': on_behalf_of_content_owner, 'videoId': video_id, 'pageToken': page_token, **kwargs}\nif playlist_item_id is not None:\n params['id'] = enf_comma_separated(field='playlist_item_id', value=play... | <|body_start_0|>
params = {'part': enf_parts(resource='playlistItems', value=parts), 'maxResults': max_results, 'onBehalfOfContentOwner': on_behalf_of_content_owner, 'videoId': video_id, 'pageToken': page_token, **kwargs}
if playlist_item_id is not None:
params['id'] = enf_comma_separated(fi... | A playlistItem resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource is used in that playlist. References: https://developers.google.com/youtube/v3/docs/pla... | PlaylistItemsResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlaylistItemsResource:
"""A playlistItem resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource is used in that playlist. References: ... | stack_v2_sparse_classes_75kplus_train_007236 | 10,667 | permissive | [
{
"docstring": "Returns a collection of playlist items that match the API request parameters. Args: parts: Comma-separated list of one or more channel resource properties. Accepted values: id,contentDetails,snippet,snippet playlist_item_id: Specifies a comma-separated list of one or more unique playlist item ID... | 4 | stack_v2_sparse_classes_30k_train_017115 | Implement the Python class `PlaylistItemsResource` described below.
Class description:
A playlistItem resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource... | Implement the Python class `PlaylistItemsResource` described below.
Class description:
A playlistItem resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource... | 1ed2f67a55b8df75c5fab9aacd7d9ff4d460812a | <|skeleton|>
class PlaylistItemsResource:
"""A playlistItem resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource is used in that playlist. References: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlaylistItemsResource:
"""A playlistItem resource identifies another resource, such as a video, that is included in a playlist. In addition, the playlistItem resource contains details about the included resource that pertain specifically to how that resource is used in that playlist. References: https://devel... | the_stack_v2_python_sparse | pyyoutube/resources/playlist_items.py | sns-sdks/python-youtube | train | 249 |
60f460d3550fe6c7fb2b6ede0d4ada8e8bb210db | [
"IO_files = {}\nfile_names = set()\nfor fl in in_dir.files:\n if self.name not in fl.users:\n if utils.splitext(fl.name)[-1] in self.input_types:\n IO_files['-!i'] = os.path.join(in_dir.path, fl.name)\n command_ids = [utils.infer_path_id(IO_files['-!i'])]\n in_dir.use_file... | <|body_start_0|>
IO_files = {}
file_names = set()
for fl in in_dir.files:
if self.name not in fl.users:
if utils.splitext(fl.name)[-1] in self.input_types:
IO_files['-!i'] = os.path.join(in_dir.path, fl.name)
command_ids = [util... | Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name of the function. input_type: Inp... | tabix | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class tabix:
"""Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name... | stack_v2_sparse_classes_75kplus_train_007237 | 10,695 | permissive | [
{
"docstring": "Infers the input and output file paths. This method must keep the directory objects up to date of the file edits! Parameters: in_cmd: A dict containing the command line. in_dir: Input directory (instance of filetypes.Directory). out_dir: Output directory (instance of filetypes.Directory). Return... | 2 | stack_v2_sparse_classes_30k_train_027276 | Implement the Python class `tabix` described below.
Class description:
Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date a... | Implement the Python class `tabix` described below.
Class description:
Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date a... | fd83eee4be0bb78c67a111fd1c1c1dff4c16aefe | <|skeleton|>
class tabix:
"""Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class tabix:
"""Class for indexing .vcf files with bgzip & tabix. Parameters: in_cmd: String containing a command line in_dir: Directory object containing input files out_dir: Directory object containing output files NOTICE! Keep the directory objects up to date about file edits! Attributes: name: Name of the funct... | the_stack_v2_python_sparse | modules/tabix.py | tyrmi/STAPLER | train | 4 |
359a419f8d4a873d3bb3230456ff73e32fd929b1 | [
"user = request.user\nresult_list = []\ntextbook_id = request.GET.get('textbook_id', None)\nif textbook_id is None:\n return Response(rsp_msg_400('请传入教材id'))\ntopicqueryset = WrongTopic.objects.filter(~Q(master_level=6), publish_id=textbook_id, user_id=user.id)\nif topicqueryset.exists():\n for topic in topic... | <|body_start_0|>
user = request.user
result_list = []
textbook_id = request.GET.get('textbook_id', None)
if textbook_id is None:
return Response(rsp_msg_400('请传入教材id'))
topicqueryset = WrongTopic.objects.filter(~Q(master_level=6), publish_id=textbook_id, user_id=user.... | WrongTopicHisViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WrongTopicHisViewSet:
def wrongtopic_abstractpage(self, request):
"""错题本首页 :param request: {"textbook_id": } :return:"""
<|body_0|>
def abstractpage_pop(self, request):
"""错题本首页弹出 :param request: :return:"""
<|body_1|>
def update_abstractpage_pop(self, r... | stack_v2_sparse_classes_75kplus_train_007238 | 5,850 | no_license | [
{
"docstring": "错题本首页 :param request: {\"textbook_id\": } :return:",
"name": "wrongtopic_abstractpage",
"signature": "def wrongtopic_abstractpage(self, request)"
},
{
"docstring": "错题本首页弹出 :param request: :return:",
"name": "abstractpage_pop",
"signature": "def abstractpage_pop(self, req... | 4 | null | Implement the Python class `WrongTopicHisViewSet` described below.
Class description:
Implement the WrongTopicHisViewSet class.
Method signatures and docstrings:
- def wrongtopic_abstractpage(self, request): 错题本首页 :param request: {"textbook_id": } :return:
- def abstractpage_pop(self, request): 错题本首页弹出 :param request... | Implement the Python class `WrongTopicHisViewSet` described below.
Class description:
Implement the WrongTopicHisViewSet class.
Method signatures and docstrings:
- def wrongtopic_abstractpage(self, request): 错题本首页 :param request: {"textbook_id": } :return:
- def abstractpage_pop(self, request): 错题本首页弹出 :param request... | 4189fdcacc20795a4778b53c9d47d6fdd3e71811 | <|skeleton|>
class WrongTopicHisViewSet:
def wrongtopic_abstractpage(self, request):
"""错题本首页 :param request: {"textbook_id": } :return:"""
<|body_0|>
def abstractpage_pop(self, request):
"""错题本首页弹出 :param request: :return:"""
<|body_1|>
def update_abstractpage_pop(self, r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WrongTopicHisViewSet:
def wrongtopic_abstractpage(self, request):
"""错题本首页 :param request: {"textbook_id": } :return:"""
user = request.user
result_list = []
textbook_id = request.GET.get('textbook_id', None)
if textbook_id is None:
return Response(rsp_msg_4... | the_stack_v2_python_sparse | bigfish/apps/wrongtopic/views.py | hyu9999/bigfish | train | 0 | |
cf9b6aa84a82511f7e578b22594ab8d20ddf34ef | [
"if 'result' in response_json:\n return SuccessResponse.from_json(response_json)\nelif 'error' in response_json:\n return ErrorResponse.from_json(response_json)\nelse:\n raise InvalidRequestError('Either `result` or `error` must be presented in JSON-RPC ' + f'responses. Got {response_json}.')",
"try:\n ... | <|body_start_0|>
if 'result' in response_json:
return SuccessResponse.from_json(response_json)
elif 'error' in response_json:
return ErrorResponse.from_json(response_json)
else:
raise InvalidRequestError('Either `result` or `error` must be presented in JSON-RP... | Response | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Response:
def from_json(response_json: JSON) -> 'Response':
"""Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed."""
<|body_0|>
def from_string(response_string: str) -> 'Response':
"""Parse a given string into a J... | stack_v2_sparse_classes_75kplus_train_007239 | 11,537 | permissive | [
{
"docstring": "Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed.",
"name": "from_json",
"signature": "def from_json(response_json: JSON) -> 'Response'"
},
{
"docstring": "Parse a given string into a JSON-RPC response. Raises `ParseError` if... | 2 | stack_v2_sparse_classes_30k_test_002280 | Implement the Python class `Response` described below.
Class description:
Implement the Response class.
Method signatures and docstrings:
- def from_json(response_json: JSON) -> 'Response': Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed.
- def from_string(respo... | Implement the Python class `Response` described below.
Class description:
Implement the Response class.
Method signatures and docstrings:
- def from_json(response_json: JSON) -> 'Response': Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed.
- def from_string(respo... | fe8ccedc572cc1faa1fd01e9138f65e982875002 | <|skeleton|>
class Response:
def from_json(response_json: JSON) -> 'Response':
"""Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed."""
<|body_0|>
def from_string(response_string: str) -> 'Response':
"""Parse a given string into a J... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Response:
def from_json(response_json: JSON) -> 'Response':
"""Parse a given JSON into a JSON-RPC response. Raises `InvalidRequestError` if the JSON body is malformed."""
if 'result' in response_json:
return SuccessResponse.from_json(response_json)
elif 'error' in response_... | the_stack_v2_python_sparse | client/json_rpc.py | facebook/pyre-check | train | 6,703 | |
7937eab41ff5b687237bc2a7b6b9837ccb63c797 | [
"super().__init__(**kwargs)\nself.problem_reference = AlphaBetaAgentProblem\nself.problem = None",
"grid, remaining_gas = perception\nstate = (grid, self.player_number, remaining_gas, remaining_gas, 0, 0)\nreturn state",
"self.initial_state = self.__perception_to_state(perception)\nself.problem = self.problem_r... | <|body_start_0|>
super().__init__(**kwargs)
self.problem_reference = AlphaBetaAgentProblem
self.problem = None
<|end_body_0|>
<|body_start_1|>
grid, remaining_gas = perception
state = (grid, self.player_number, remaining_gas, remaining_gas, 0, 0)
return state
<|end_body_... | The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter. | AlphaBetaAgent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlphaBetaAgent:
"""The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter."""
def __init__(self, **kwargs):
"""Like some other agents we pr... | stack_v2_sparse_classes_75kplus_train_007240 | 44,047 | permissive | [
{
"docstring": "Like some other agents we provided, here we also initialize the reference to the problem and its instantiation that will be set by get_action.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Converts a perception into a start to be used by the... | 3 | stack_v2_sparse_classes_30k_train_010049 | Implement the Python class `AlphaBetaAgent` described below.
Class description:
The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter.
Method signatures and docstrings:
- d... | Implement the Python class `AlphaBetaAgent` described below.
Class description:
The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter.
Method signatures and docstrings:
- d... | 89b67b61817500aad359c64c7f43fcc2f1ef0698 | <|skeleton|>
class AlphaBetaAgent:
"""The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter."""
def __init__(self, **kwargs):
"""Like some other agents we pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlphaBetaAgent:
"""The AlphaBetaAgent class is a subclass of Agent that implements a specific adversarial agent that performs an Alpha/Beta search with cuttoff, where the cutoff test is based on the max_depth parameter."""
def __init__(self, **kwargs):
"""Like some other agents we provided, here ... | the_stack_v2_python_sparse | EP2/ep2.py | ricardokojo/MAC0425-2019 | train | 1 |
d208ca4db22c8cf8466a505e4ff0d86271a9748e | [
"BaseDustNode.__init__(self, xml_node)\nself._value = xml_node.text.strip()\nself._length = length\nself._columns = [Column(name=col_name, dtype='S' + str(length))]",
"base_string = BaseDustNode.__str__(self)\nstring = '[StringNode: ' + base_string + ', value: ' + self._value + ']'\nreturn string"
] | <|body_start_0|>
BaseDustNode.__init__(self, xml_node)
self._value = xml_node.text.strip()
self._length = length
self._columns = [Column(name=col_name, dtype='S' + str(length))]
<|end_body_0|>
<|body_start_1|>
base_string = BaseDustNode.__str__(self)
string = '[StringNod... | A node that contains text. | StringNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StringNode:
"""A node that contains text."""
def __init__(self, xml_node, col_name, length):
"""Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : ... | stack_v2_sparse_classes_75kplus_train_007241 | 41,056 | permissive | [
{
"docstring": "Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : int the size of the column associated with this item",
"name": "__init__",
"signature": "def __init_... | 2 | stack_v2_sparse_classes_30k_train_046066 | Implement the Python class `StringNode` described below.
Class description:
A node that contains text.
Method signatures and docstrings:
- def __init__(self, xml_node, col_name, length): Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str t... | Implement the Python class `StringNode` described below.
Class description:
A node that contains text.
Method signatures and docstrings:
- def __init__(self, xml_node, col_name, length): Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str t... | 51316d7417d7daf01a8b29d1df99037b9227c2bc | <|skeleton|>
class StringNode:
"""A node that contains text."""
def __init__(self, xml_node, col_name, length):
"""Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StringNode:
"""A node that contains text."""
def __init__(self, xml_node, col_name, length):
"""Parameters ---------- xml_node : `xml.etree.ElementTree` the xml node that provides the raw data for this DustNode col_name : str the name of the column associated with this item length : int the size ... | the_stack_v2_python_sparse | astroquery/ipac/irsa/irsa_dust/core.py | astropy/astroquery | train | 636 |
779f18702309bfdc9981b58850807a5c9594af85 | [
"if 'pix' in string_rep:\n return u.Quantity(string_rep[:-3], u.dimensionless_unscaled)\nif 'h' in string_rep or 'rad' in string_rep:\n return coordinates.Angle(string_rep)\nif len(string_rep.split('.')) >= 3:\n string_rep = string_rep.replace('.', ':', 2)\nreturn coordinates.Angle(string_rep, u.deg)",
"... | <|body_start_0|>
if 'pix' in string_rep:
return u.Quantity(string_rep[:-3], u.dimensionless_unscaled)
if 'h' in string_rep or 'rad' in string_rep:
return coordinates.Angle(string_rep)
if len(string_rep.split('.')) >= 3:
string_rep = string_rep.replace('.', ':'... | Helper class to structure coordinate parser | CoordinateParser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoordinateParser:
"""Helper class to structure coordinate parser"""
def parse_coordinate(string_rep):
"""Parse a single coordinate"""
<|body_0|>
def parse_angular_length_quantity(string_rep):
"""Given a string that is a number and a unit, return a Quantity of tha... | stack_v2_sparse_classes_75kplus_train_007242 | 18,136 | permissive | [
{
"docstring": "Parse a single coordinate",
"name": "parse_coordinate",
"signature": "def parse_coordinate(string_rep)"
},
{
"docstring": "Given a string that is a number and a unit, return a Quantity of that string.Raise an Error If there is no unit. e.g.: 50\" -> 50*u.arcsec 50 -> CRTFRegionPa... | 2 | stack_v2_sparse_classes_30k_train_037847 | Implement the Python class `CoordinateParser` described below.
Class description:
Helper class to structure coordinate parser
Method signatures and docstrings:
- def parse_coordinate(string_rep): Parse a single coordinate
- def parse_angular_length_quantity(string_rep): Given a string that is a number and a unit, ret... | Implement the Python class `CoordinateParser` described below.
Class description:
Helper class to structure coordinate parser
Method signatures and docstrings:
- def parse_coordinate(string_rep): Parse a single coordinate
- def parse_angular_length_quantity(string_rep): Given a string that is a number and a unit, ret... | 55cb07f3ae54759637ba26d35bfcdf6043b825fb | <|skeleton|>
class CoordinateParser:
"""Helper class to structure coordinate parser"""
def parse_coordinate(string_rep):
"""Parse a single coordinate"""
<|body_0|>
def parse_angular_length_quantity(string_rep):
"""Given a string that is a number and a unit, return a Quantity of tha... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CoordinateParser:
"""Helper class to structure coordinate parser"""
def parse_coordinate(string_rep):
"""Parse a single coordinate"""
if 'pix' in string_rep:
return u.Quantity(string_rep[:-3], u.dimensionless_unscaled)
if 'h' in string_rep or 'rad' in string_rep:
... | the_stack_v2_python_sparse | regions/io/crtf/read.py | kakirastern/regions | train | 1 |
f301bd4b9275179fe410e43e082b2e92434bc762 | [
"super().__init__()\nself.downsample = downsample\nif bottleneck is None:\n self.block = nn.Sequential(_conv2(channels_in, channels_out, 3), nn.BatchNorm2d(channels_out), nn.ReLU(inplace=True), _conv2_down(channels_out, channels_out, 3) if downsample else _conv2(channels_out, channels_out, 3), nn.BatchNorm2d(cha... | <|body_start_0|>
super().__init__()
self.downsample = downsample
if bottleneck is None:
self.block = nn.Sequential(_conv2(channels_in, channels_out, 3), nn.BatchNorm2d(channels_out), nn.ReLU(inplace=True), _conv2_down(channels_out, channels_out, 3) if downsample else _conv2(channels_... | A residual block consists of either two or three convolution operations followed by batch norm and relu activation together with an identity mapping connecting the input and the activation feeding into the last ReLU layer. | ResidualBlock | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResidualBlock:
"""A residual block consists of either two or three convolution operations followed by batch norm and relu activation together with an identity mapping connecting the input and the activation feeding into the last ReLU layer."""
def __init__(self, channels_in, channels_out, bo... | stack_v2_sparse_classes_75kplus_train_007243 | 7,285 | permissive | [
{
"docstring": "Create new convolution block. Args: channels_in: The number of input channels. channels_out: The number of output channels. bottleneck: Whether to apply a bottle neck to reduce the number of parameters. downsample: If true the image dimensions are reduced by a factor of two.",
"name": "__ini... | 2 | stack_v2_sparse_classes_30k_train_000056 | Implement the Python class `ResidualBlock` described below.
Class description:
A residual block consists of either two or three convolution operations followed by batch norm and relu activation together with an identity mapping connecting the input and the activation feeding into the last ReLU layer.
Method signature... | Implement the Python class `ResidualBlock` described below.
Class description:
A residual block consists of either two or three convolution operations followed by batch norm and relu activation together with an identity mapping connecting the input and the activation feeding into the last ReLU layer.
Method signature... | a27e329cd30337995c359160a0d878bf331c13fb | <|skeleton|>
class ResidualBlock:
"""A residual block consists of either two or three convolution operations followed by batch norm and relu activation together with an identity mapping connecting the input and the activation feeding into the last ReLU layer."""
def __init__(self, channels_in, channels_out, bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResidualBlock:
"""A residual block consists of either two or three convolution operations followed by batch norm and relu activation together with an identity mapping connecting the input and the activation feeding into the last ReLU layer."""
def __init__(self, channels_in, channels_out, bottleneck=None... | the_stack_v2_python_sparse | quantnn/models/pytorch/resnet.py | simonpf/quantnn | train | 7 |
b3aab33bf856bf71c4da7ca336d5481a0c46be0d | [
"self.connection = self.request\nself.rfile = socket._fileobject(self.request, 'rb', self.rbufsize)\nself.wfile = socket._fileobject(self.request, 'wb', self.wbufsize)",
"try:\n data = self.rfile.read(int(self.headers['content-length']))\n response = self.server._marshaled_dispatch(data, getattr(self, '_dis... | <|body_start_0|>
self.connection = self.request
self.rfile = socket._fileobject(self.request, 'rb', self.rbufsize)
self.wfile = socket._fileobject(self.request, 'wb', self.wbufsize)
<|end_body_0|>
<|body_start_1|>
try:
data = self.rfile.read(int(self.headers['content-length'... | Sets up the XML RPC handler to use SSL | SecureXMLRpcRequestHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecureXMLRpcRequestHandler:
"""Sets up the XML RPC handler to use SSL"""
def setup(self):
"""Set up SSL transport"""
<|body_0|>
def do_POST(self):
"""Handles the HTTPS post"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.connection = self.r... | stack_v2_sparse_classes_75kplus_train_007244 | 3,702 | permissive | [
{
"docstring": "Set up SSL transport",
"name": "setup",
"signature": "def setup(self)"
},
{
"docstring": "Handles the HTTPS post",
"name": "do_POST",
"signature": "def do_POST(self)"
}
] | 2 | null | Implement the Python class `SecureXMLRpcRequestHandler` described below.
Class description:
Sets up the XML RPC handler to use SSL
Method signatures and docstrings:
- def setup(self): Set up SSL transport
- def do_POST(self): Handles the HTTPS post | Implement the Python class `SecureXMLRpcRequestHandler` described below.
Class description:
Sets up the XML RPC handler to use SSL
Method signatures and docstrings:
- def setup(self): Set up SSL transport
- def do_POST(self): Handles the HTTPS post
<|skeleton|>
class SecureXMLRpcRequestHandler:
"""Sets up the XM... | 794b24a84cdc71067f709fcd48b9312c5847af31 | <|skeleton|>
class SecureXMLRpcRequestHandler:
"""Sets up the XML RPC handler to use SSL"""
def setup(self):
"""Set up SSL transport"""
<|body_0|>
def do_POST(self):
"""Handles the HTTPS post"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SecureXMLRpcRequestHandler:
"""Sets up the XML RPC handler to use SSL"""
def setup(self):
"""Set up SSL transport"""
self.connection = self.request
self.rfile = socket._fileobject(self.request, 'rb', self.rbufsize)
self.wfile = socket._fileobject(self.request, 'wb', self.w... | the_stack_v2_python_sparse | roster-server/roster_server/ssl_xml_rpc_lib.py | BackupGGCode/roster-dns-management | train | 0 |
b6f307b2963a7d055505435dd6344edd2415c940 | [
"mnist = input_data.read_data_sets('MNIST_data', one_hot=False)\nself.ins_images = []\nself.ins_labels = []\nfor img, lbl in zip(mnist.train.images, mnist.train.labels):\n if 2 <= lbl:\n continue\n self.ins_images.append(np.reshape(img, (28, 28))[:, 14])\n self.ins_labels.append(lbl)\nself.out_image... | <|body_start_0|>
mnist = input_data.read_data_sets('MNIST_data', one_hot=False)
self.ins_images = []
self.ins_labels = []
for img, lbl in zip(mnist.train.images, mnist.train.labels):
if 2 <= lbl:
continue
self.ins_images.append(np.reshape(img, (28,... | MNIST is a classic image-classification dataset containing 28x28 grayscale photographs of handwritten digits (0 through 9). This class provides access to MNIST via in-sample and out-of-sample batches. It allows us to sample from a training set potentially smaller than the the overall MNIST training set, and to sample w... | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""MNIST is a classic image-classification dataset containing 28x28 grayscale photographs of handwritten digits (0 through 9). This class provides access to MNIST via in-sample and out-of-sample batches. It allows us to sample from a training set potentially smaller than the the overall ... | stack_v2_sparse_classes_75kplus_train_007245 | 16,748 | no_license | [
{
"docstring": "Read MNIST, with labels one-hot.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "MNIST is a classic image-classification dataset. Its images are 28x28 grayscale photographs of handwritten digits (0 through 9). Note that we load labels as one-hot vectors... | 4 | null | Implement the Python class `Dataset` described below.
Class description:
MNIST is a classic image-classification dataset containing 28x28 grayscale photographs of handwritten digits (0 through 9). This class provides access to MNIST via in-sample and out-of-sample batches. It allows us to sample from a training set po... | Implement the Python class `Dataset` described below.
Class description:
MNIST is a classic image-classification dataset containing 28x28 grayscale photographs of handwritten digits (0 through 9). This class provides access to MNIST via in-sample and out-of-sample batches. It allows us to sample from a training set po... | 1fdc1965123523c24d9b48f2ad99db3224233841 | <|skeleton|>
class Dataset:
"""MNIST is a classic image-classification dataset containing 28x28 grayscale photographs of handwritten digits (0 through 9). This class provides access to MNIST via in-sample and out-of-sample batches. It allows us to sample from a training set potentially smaller than the the overall ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dataset:
"""MNIST is a classic image-classification dataset containing 28x28 grayscale photographs of handwritten digits (0 through 9). This class provides access to MNIST via in-sample and out-of-sample batches. It allows us to sample from a training set potentially smaller than the the overall MNIST trainin... | the_stack_v2_python_sparse | experiments/differentiate_deep17.py | bohrium/self-reg | train | 0 |
1ee381db9c658d3559f2f0c0f4492d55786b6280 | [
"super(ImportManifestParser, self).__init__(target)\nself._ignore = ['review_remote', 'default_remote_name', 'clone_url', 'review', 'urls', 'remotes']\nself._required = ['manifest']",
"self.target.project = self._root.get('manifest')\nif not self.target.project:\n raise ManifestError(\"Missing 'manifest' attri... | <|body_start_0|>
super(ImportManifestParser, self).__init__(target)
self._ignore = ['review_remote', 'default_remote_name', 'clone_url', 'review', 'urls', 'remotes']
self._required = ['manifest']
<|end_body_0|>
<|body_start_1|>
self.target.project = self._root.get('manifest')
if... | ImportManifestParser Class | ImportManifestParser | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImportManifestParser:
"""ImportManifestParser Class"""
def __init__(self, target):
"""ImportManifestParser Init"""
<|body_0|>
def _parse_attributes(self):
"""Parse Attributes"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(ImportManifestPa... | stack_v2_sparse_classes_75kplus_train_007246 | 16,477 | permissive | [
{
"docstring": "ImportManifestParser Init",
"name": "__init__",
"signature": "def __init__(self, target)"
},
{
"docstring": "Parse Attributes",
"name": "_parse_attributes",
"signature": "def _parse_attributes(self)"
}
] | 2 | null | Implement the Python class `ImportManifestParser` described below.
Class description:
ImportManifestParser Class
Method signatures and docstrings:
- def __init__(self, target): ImportManifestParser Init
- def _parse_attributes(self): Parse Attributes | Implement the Python class `ImportManifestParser` described below.
Class description:
ImportManifestParser Class
Method signatures and docstrings:
- def __init__(self, target): ImportManifestParser Init
- def _parse_attributes(self): Parse Attributes
<|skeleton|>
class ImportManifestParser:
"""ImportManifestPars... | efea6fa3744664348717fe5e8df708a3cf392072 | <|skeleton|>
class ImportManifestParser:
"""ImportManifestParser Class"""
def __init__(self, target):
"""ImportManifestParser Init"""
<|body_0|>
def _parse_attributes(self):
"""Parse Attributes"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImportManifestParser:
"""ImportManifestParser Class"""
def __init__(self, target):
"""ImportManifestParser Init"""
super(ImportManifestParser, self).__init__(target)
self._ignore = ['review_remote', 'default_remote_name', 'clone_url', 'review', 'urls', 'remotes']
self._req... | the_stack_v2_python_sparse | python/qisrc/manifest.py | aldebaran/qibuild | train | 60 |
472bba1a74947615fc1722a6c7ac0d6c209d0d4e | [
"super(BlueBossBullet, self).__init__(ai_settings, screen)\nself.image = pygame.image.load('images/blue_alien_bullet.png')\nself.rect = self.image.get_rect()\nself.rect.centerx = boss.rect.centerx\nself.rect.centery = boss.rect.centery\nself.x = float(self.rect.centerx)\nself.y = float(self.rect.centery)\nself.spee... | <|body_start_0|>
super(BlueBossBullet, self).__init__(ai_settings, screen)
self.image = pygame.image.load('images/blue_alien_bullet.png')
self.rect = self.image.get_rect()
self.rect.centerx = boss.rect.centerx
self.rect.centery = boss.rect.centery
self.x = float(self.rect... | Child class, which represents bullets of blue boss. | BlueBossBullet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlueBossBullet:
"""Child class, which represents bullets of blue boss."""
def __init__(self, ai_settings, screen, boss, angle):
"""Initialize bullet of blue boss. Args: :param ai_settings: Instance of Settings class. :param screen: Display Surface. :param boss: Instance of Boss class... | stack_v2_sparse_classes_75kplus_train_007247 | 10,645 | no_license | [
{
"docstring": "Initialize bullet of blue boss. Args: :param ai_settings: Instance of Settings class. :param screen: Display Surface. :param boss: Instance of Boss class. :param angle: Bullet shooting angle.",
"name": "__init__",
"signature": "def __init__(self, ai_settings, screen, boss, angle)"
},
... | 2 | stack_v2_sparse_classes_30k_train_012011 | Implement the Python class `BlueBossBullet` described below.
Class description:
Child class, which represents bullets of blue boss.
Method signatures and docstrings:
- def __init__(self, ai_settings, screen, boss, angle): Initialize bullet of blue boss. Args: :param ai_settings: Instance of Settings class. :param scr... | Implement the Python class `BlueBossBullet` described below.
Class description:
Child class, which represents bullets of blue boss.
Method signatures and docstrings:
- def __init__(self, ai_settings, screen, boss, angle): Initialize bullet of blue boss. Args: :param ai_settings: Instance of Settings class. :param scr... | 2a8e28ebbd89d328549dd2f7932e708510c5a8b0 | <|skeleton|>
class BlueBossBullet:
"""Child class, which represents bullets of blue boss."""
def __init__(self, ai_settings, screen, boss, angle):
"""Initialize bullet of blue boss. Args: :param ai_settings: Instance of Settings class. :param screen: Display Surface. :param boss: Instance of Boss class... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BlueBossBullet:
"""Child class, which represents bullets of blue boss."""
def __init__(self, ai_settings, screen, boss, angle):
"""Initialize bullet of blue boss. Args: :param ai_settings: Instance of Settings class. :param screen: Display Surface. :param boss: Instance of Boss class. :param angl... | the_stack_v2_python_sparse | alien_invasion/code/bosses_bullets.py | EvilSpeedcore/alien_invasion | train | 0 |
6b00b5033c630aeaa281211d55564eb1528409e6 | [
"user = kwargs.pop('user', None)\nsuper(self.__class__, self).__init__(*args, **kwargs)\nproject = kwargs.pop('instance', None)\nself.fields['business_unit'].queryset = BusinessUnit.objects.exclude(type__name='Customer').exclude(name='5G-CG').exclude(name='5G-PCG').exclude(name='5G-PDG').exclude(name='5G-PRG').excl... | <|body_start_0|>
user = kwargs.pop('user', None)
super(self.__class__, self).__init__(*args, **kwargs)
project = kwargs.pop('instance', None)
self.fields['business_unit'].queryset = BusinessUnit.objects.exclude(type__name='Customer').exclude(name='5G-CG').exclude(name='5G-PCG').exclude(n... | ProjectInitiationRequestForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectInitiationRequestForm:
def __init__(self, *args, **kwargs):
"""Overriden init method to have add project related data to fields"""
<|body_0|>
def save(self, schedules, is_approved, is_rejected, ex_approval, commit=True):
"""Overriden save method to save virtua... | stack_v2_sparse_classes_75kplus_train_007248 | 23,017 | no_license | [
{
"docstring": "Overriden init method to have add project related data to fields",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Overriden save method to save virtual field which are not displayed to user",
"name": "save",
"signature": "def sav... | 2 | stack_v2_sparse_classes_30k_train_039696 | Implement the Python class `ProjectInitiationRequestForm` described below.
Class description:
Implement the ProjectInitiationRequestForm class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Overriden init method to have add project related data to fields
- def save(self, schedules, is_appro... | Implement the Python class `ProjectInitiationRequestForm` described below.
Class description:
Implement the ProjectInitiationRequestForm class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Overriden init method to have add project related data to fields
- def save(self, schedules, is_appro... | 7a337e0e3a20180b9564de68ab22620dc9aa1a36 | <|skeleton|>
class ProjectInitiationRequestForm:
def __init__(self, *args, **kwargs):
"""Overriden init method to have add project related data to fields"""
<|body_0|>
def save(self, schedules, is_approved, is_rejected, ex_approval, commit=True):
"""Overriden save method to save virtua... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectInitiationRequestForm:
def __init__(self, *args, **kwargs):
"""Overriden init method to have add project related data to fields"""
user = kwargs.pop('user', None)
super(self.__class__, self).__init__(*args, **kwargs)
project = kwargs.pop('instance', None)
self.fi... | the_stack_v2_python_sparse | project_management/projects/formsfn.py | raveena17/ILASM | train | 0 | |
0bb3f99bd00d4dd913c9ad807c8ba7313258fcd2 | [
"if picking.state in ('cancel', 'done'):\n return True\nif picking.state in ('draft', 'confirmed', 'assigned'):\n self.validate_picking(cr, uid, [picking.id], context=context)\n return True\nreturn False",
"if picking.state == '2binvoiced':\n invoice_ids = self.action_invoice_create(cr, uid, [picking.... | <|body_start_0|>
if picking.state in ('cancel', 'done'):
return True
if picking.state in ('draft', 'confirmed', 'assigned'):
self.validate_picking(cr, uid, [picking.id], context=context)
return True
return False
<|end_body_0|>
<|body_start_1|>
if pick... | stock_picking | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class stock_picking:
def auto_wkf_validate(self, cr, uid, picking, context=None):
"""Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, Fal... | stack_v2_sparse_classes_75kplus_train_007249 | 15,477 | no_license | [
{
"docstring": "Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, False if not",
"name": "auto_wkf_validate",
"signature": "def auto_wkf_validate(se... | 2 | stack_v2_sparse_classes_30k_train_018951 | Implement the Python class `stock_picking` described below.
Class description:
Implement the stock_picking class.
Method signatures and docstrings:
- def auto_wkf_validate(self, cr, uid, picking, context=None): Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :para... | Implement the Python class `stock_picking` described below.
Class description:
Implement the stock_picking class.
Method signatures and docstrings:
- def auto_wkf_validate(self, cr, uid, picking, context=None): Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :para... | 73c8a29a182460e6a8f7a97bbc15f1847dbdd63e | <|skeleton|>
class stock_picking:
def auto_wkf_validate(self, cr, uid, picking, context=None):
"""Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, Fal... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class stock_picking:
def auto_wkf_validate(self, cr, uid, picking, context=None):
"""Interface method for the automatic worflow. Validate a picking in draft, confirmed or assigned state. :param browse_record picking: the picking to validate :return: True if the picking have been confirmed, False if not"""
... | the_stack_v2_python_sparse | base_sale_multichannels/workflow_job.py | GoContractPro/Odoo-GCP | train | 1 | |
ec3623a0674bd4ff205a37f51c4330167996328e | [
"for x in range(len(nums)):\n sub_nums = nums[x + 1:]\n if target - nums[x] in sub_nums:\n index = sub_nums.index(target - nums[x])\n print(x, index + x + 1)\n return [x, index + x + 1]",
"dict_buff = {}\nfor k, value in enumerate(nums):\n if value in dict_buff:\n return [dict... | <|body_start_0|>
for x in range(len(nums)):
sub_nums = nums[x + 1:]
if target - nums[x] in sub_nums:
index = sub_nums.index(target - nums[x])
print(x, index + x + 1)
return [x, index + x + 1]
<|end_body_0|>
<|body_start_1|>
dict_bu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减 字典保存"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus_train_007250 | 1,318 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减 字典保存",
"name": "twoSum2",
"signature": "def twoSum2(self,... | 2 | stack_v2_sparse_classes_30k_train_020710 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] 思路: 相减
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] 思路: 相减
- def twoSum2(self, nums, target): :type nums: List[int] :type target: int :rtype... | 1e7e395b1af7a90f50bf7bf1610e580acba0788e | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减"""
<|body_0|>
def twoSum2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减 字典保存"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twoSum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] 思路: 相减"""
for x in range(len(nums)):
sub_nums = nums[x + 1:]
if target - nums[x] in sub_nums:
index = sub_nums.index(target - nums[x])
... | the_stack_v2_python_sparse | code/1. 两数之和.py | t-dawei/leetcode | train | 4 | |
1da40abcc7caf561ac2a64892193e910f6916ceb | [
"hl = md5()\nhl.update(msg.encode('utf-8'))\nreturn hl.hexdigest()",
"sh = sha1()\nsh.update(msg.encode('utf-8'))\nreturn sh.hexdigest()",
"sh = SHA256.new()\nsh.update(msg.encode('utf-8'))\nreturn sh.hexdigest()",
"de = DES.new(key, DES.MODE_ECB)\nmss = msg + (8 - len(msg) % 8) * '='\ntext = de.encrypt(mss.e... | <|body_start_0|>
hl = md5()
hl.update(msg.encode('utf-8'))
return hl.hexdigest()
<|end_body_0|>
<|body_start_1|>
sh = sha1()
sh.update(msg.encode('utf-8'))
return sh.hexdigest()
<|end_body_1|>
<|body_start_2|>
sh = SHA256.new()
sh.update(msg.encode('utf-... | MyHash | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyHash:
def my_md5(self, msg):
"""md5 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符"""
<|body_0|>
def my_sha1(self, msg):
"""sha1 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符"""
<|body_1|>
def my_sha256(self, msg):
"""sha256 算法加密 :param msg: 需加密的字符串 :retu... | stack_v2_sparse_classes_75kplus_train_007251 | 2,376 | no_license | [
{
"docstring": "md5 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符",
"name": "my_md5",
"signature": "def my_md5(self, msg)"
},
{
"docstring": "sha1 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符",
"name": "my_sha1",
"signature": "def my_sha1(self, msg)"
},
{
"docstring": "sha256 算法加密 :param ... | 6 | stack_v2_sparse_classes_30k_train_012779 | Implement the Python class `MyHash` described below.
Class description:
Implement the MyHash class.
Method signatures and docstrings:
- def my_md5(self, msg): md5 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符
- def my_sha1(self, msg): sha1 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符
- def my_sha256(self, msg): sha256 算法加密 :p... | Implement the Python class `MyHash` described below.
Class description:
Implement the MyHash class.
Method signatures and docstrings:
- def my_md5(self, msg): md5 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符
- def my_sha1(self, msg): sha1 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符
- def my_sha256(self, msg): sha256 算法加密 :p... | 8dd873977444818d0515d51d6552db3e0c318bb2 | <|skeleton|>
class MyHash:
def my_md5(self, msg):
"""md5 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符"""
<|body_0|>
def my_sha1(self, msg):
"""sha1 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符"""
<|body_1|>
def my_sha256(self, msg):
"""sha256 算法加密 :param msg: 需加密的字符串 :retu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyHash:
def my_md5(self, msg):
"""md5 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符"""
hl = md5()
hl.update(msg.encode('utf-8'))
return hl.hexdigest()
def my_sha1(self, msg):
"""sha1 算法加密 :param msg: 需加密的字符串 :return: 加密后的字符"""
sh = sha1()
sh.update(msg.e... | the_stack_v2_python_sparse | Common/Hash.py | chenanming/API_Auto_Test | train | 0 | |
f1bffe26b7d85d6c697946ee01fbad8fb575e844 | [
"params = self.to_params()\nif 'tweet_id' in params:\n params['tweet_ids'] = [params['tweet_id']]\n del params['tweet_id']\nif self.id:\n raise HTTPError('Method PUT not allowed.')\nresource = self.RESOURCE_COLLECTION.format(account_id=self.account.id)\nresponse = Request(self.account.client, 'post', resou... | <|body_start_0|>
params = self.to_params()
if 'tweet_id' in params:
params['tweet_ids'] = [params['tweet_id']]
del params['tweet_id']
if self.id:
raise HTTPError('Method PUT not allowed.')
resource = self.RESOURCE_COLLECTION.format(account_id=self.acco... | PromotedTweet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PromotedTweet:
def save(self):
"""Saves or updates the current object instance depending on the presence of `object.id`."""
<|body_0|>
def attach(klass, account, **kwargs):
"""Associate one or more Tweets with the specified line item."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus_train_007252 | 22,436 | permissive | [
{
"docstring": "Saves or updates the current object instance depending on the presence of `object.id`.",
"name": "save",
"signature": "def save(self)"
},
{
"docstring": "Associate one or more Tweets with the specified line item.",
"name": "attach",
"signature": "def attach(klass, account... | 2 | stack_v2_sparse_classes_30k_train_040983 | Implement the Python class `PromotedTweet` described below.
Class description:
Implement the PromotedTweet class.
Method signatures and docstrings:
- def save(self): Saves or updates the current object instance depending on the presence of `object.id`.
- def attach(klass, account, **kwargs): Associate one or more Twe... | Implement the Python class `PromotedTweet` described below.
Class description:
Implement the PromotedTweet class.
Method signatures and docstrings:
- def save(self): Saves or updates the current object instance depending on the presence of `object.id`.
- def attach(klass, account, **kwargs): Associate one or more Twe... | a3dd5819341e77aa469d0b4b3399f0bcd028c80c | <|skeleton|>
class PromotedTweet:
def save(self):
"""Saves or updates the current object instance depending on the presence of `object.id`."""
<|body_0|>
def attach(klass, account, **kwargs):
"""Associate one or more Tweets with the specified line item."""
<|body_1|>
<|end_ske... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PromotedTweet:
def save(self):
"""Saves or updates the current object instance depending on the presence of `object.id`."""
params = self.to_params()
if 'tweet_id' in params:
params['tweet_ids'] = [params['tweet_id']]
del params['tweet_id']
if self.id:
... | the_stack_v2_python_sparse | twitter_ads/creative.py | twitterdev/twitter-python-ads-sdk | train | 194 | |
cc567d6ad9029768871840a98507447e7a9c35b8 | [
"Assertions.a_eui(dev_eui)\ninfo = db0.hgetall(ConstDB0.dev + hexlify(dev_eui).decode())\nLogger.info(info)\ntry:\n addr = info[b'addr']\n app_eui = info[b'app_eui']\n nwkskey = info[b'nwkskey']\n appskey = info.get(b'appskey', b'')\n fcnt_up = int(info[b'fcnt_up'])\n fcnt_down = int(info[b'fcnt_d... | <|body_start_0|>
Assertions.a_eui(dev_eui)
info = db0.hgetall(ConstDB0.dev + hexlify(dev_eui).decode())
Logger.info(info)
try:
addr = info[b'addr']
app_eui = info[b'app_eui']
nwkskey = info[b'nwkskey']
appskey = info.get(b'appskey', b'')
... | objects | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class objects:
def get(dev_eui):
""":param dev_eui: bytes :return:"""
<|body_0|>
def get_dev_class(dev_eui):
""":param dev_eui: bytes :return:"""
<|body_1|>
def get_device_by_addr(cls, addr):
""":param addr: bytes little endian :return:"""
<|bo... | stack_v2_sparse_classes_75kplus_train_007253 | 8,599 | permissive | [
{
"docstring": ":param dev_eui: bytes :return:",
"name": "get",
"signature": "def get(dev_eui)"
},
{
"docstring": ":param dev_eui: bytes :return:",
"name": "get_dev_class",
"signature": "def get_dev_class(dev_eui)"
},
{
"docstring": ":param addr: bytes little endian :return:",
... | 3 | stack_v2_sparse_classes_30k_train_015256 | Implement the Python class `objects` described below.
Class description:
Implement the objects class.
Method signatures and docstrings:
- def get(dev_eui): :param dev_eui: bytes :return:
- def get_dev_class(dev_eui): :param dev_eui: bytes :return:
- def get_device_by_addr(cls, addr): :param addr: bytes little endian ... | Implement the Python class `objects` described below.
Class description:
Implement the objects class.
Method signatures and docstrings:
- def get(dev_eui): :param dev_eui: bytes :return:
- def get_dev_class(dev_eui): :param dev_eui: bytes :return:
- def get_device_by_addr(cls, addr): :param addr: bytes little endian ... | 9c4324f81bae8b20f6c353447189f724a5cf54c6 | <|skeleton|>
class objects:
def get(dev_eui):
""":param dev_eui: bytes :return:"""
<|body_0|>
def get_dev_class(dev_eui):
""":param dev_eui: bytes :return:"""
<|body_1|>
def get_device_by_addr(cls, addr):
""":param addr: bytes little endian :return:"""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class objects:
def get(dev_eui):
""":param dev_eui: bytes :return:"""
Assertions.a_eui(dev_eui)
info = db0.hgetall(ConstDB0.dev + hexlify(dev_eui).decode())
Logger.info(info)
try:
addr = info[b'addr']
app_eui = info[b'app_eui']
nwkskey = in... | the_stack_v2_python_sparse | GServer/object/device.py | soybean217/lora-python | train | 0 | |
666eae0f22e37a21f98c9589783fb151f5bfc436 | [
"self.batch_size = batch_size\nself.optimizer = optimizer\nself.loss = loss\nself.validation_split = validation_split\nself.max_sequence_length = max_sequence_length\nself.max_nb_words = max_nb_words\nself.embedding_dim = embedding_dim\nself.activation = activation\nModelNN.__init__(self, loss=loss, optimizer=optim... | <|body_start_0|>
self.batch_size = batch_size
self.optimizer = optimizer
self.loss = loss
self.validation_split = validation_split
self.max_sequence_length = max_sequence_length
self.max_nb_words = max_nb_words
self.embedding_dim = embedding_dim
self.activ... | BidirectionalLSTM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BidirectionalLSTM:
def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, validation_split=0.2, optimizer='rmsprop', batch_size=32, activation='softmax', learning_rate=0.001, kernel_regularization... | stack_v2_sparse_classes_75kplus_train_007254 | 12,388 | no_license | [
{
"docstring": ":param loss: str, the name of the loss function :param epochs: int, the number of epochs :param decay: float, the decay :param momentum: float, momentum :param max_sequence_length: :param max_nb_words: :param embedding_dim: :param validation_split: float, the percentage of the validation split :... | 2 | stack_v2_sparse_classes_30k_train_029687 | Implement the Python class `BidirectionalLSTM` described below.
Class description:
Implement the BidirectionalLSTM class.
Method signatures and docstrings:
- def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, valid... | Implement the Python class `BidirectionalLSTM` described below.
Class description:
Implement the BidirectionalLSTM class.
Method signatures and docstrings:
- def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, valid... | bb2f1e350140c9d34865ed77f50d4475b515ea7b | <|skeleton|>
class BidirectionalLSTM:
def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, validation_split=0.2, optimizer='rmsprop', batch_size=32, activation='softmax', learning_rate=0.001, kernel_regularization... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BidirectionalLSTM:
def __init__(self, loss='categorical_crossentropy', epochs=10, decay=1e-06, momentum=0.9, max_sequence_length=1000, max_nb_words=20000, embedding_dim=100, validation_split=0.2, optimizer='rmsprop', batch_size=32, activation='softmax', learning_rate=0.001, kernel_regularization_params=('l2',... | the_stack_v2_python_sparse | app/lstm.py | agromanou/text-classification-with-nn | train | 0 | |
1bb5c3015096d225600b80362f1267296a69afcb | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=APUserManager.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email)\nuser.set_password(password)\nuser.is_admin = True\nuser.is_staff = True\nu... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=APUserManager.normalize_email(email))
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.cre... | APUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class APUserManager:
def create_user(self, email, password=None):
"""Creates a user, given an email and a password (optional)"""
<|body_0|>
def create_superuser(self, email, password):
"""Creates a super user, given an email and password (required)"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_007255 | 23,087 | no_license | [
{
"docstring": "Creates a user, given an email and a password (optional)",
"name": "create_user",
"signature": "def create_user(self, email, password=None)"
},
{
"docstring": "Creates a super user, given an email and password (required)",
"name": "create_superuser",
"signature": "def cre... | 2 | stack_v2_sparse_classes_30k_val_000814 | Implement the Python class `APUserManager` described below.
Class description:
Implement the APUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates a user, given an email and a password (optional)
- def create_superuser(self, email, password): Creates a super use... | Implement the Python class `APUserManager` described below.
Class description:
Implement the APUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates a user, given an email and a password (optional)
- def create_superuser(self, email, password): Creates a super use... | 0758da4a5e93115a369f7a9f34ea0a0f1a95f9ac | <|skeleton|>
class APUserManager:
def create_user(self, email, password=None):
"""Creates a user, given an email and a password (optional)"""
<|body_0|>
def create_superuser(self, email, password):
"""Creates a super user, given an email and password (required)"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class APUserManager:
def create_user(self, email, password=None):
"""Creates a user, given an email and a password (optional)"""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=APUserManager.normalize_email(email))
user.set_passw... | the_stack_v2_python_sparse | ap/accounts/models.py | finben/djattendance | train | 0 | |
68ef1223d3022307efa878db16af851897523fd7 | [
"batch = cls(name=name, on_weekdays=on_weekdays, on_weekends=on_weekends, clazz=clazz, target_year=target_year, target_exam=target_exam, type=type, other=other, batch_timings=batch_timings, institute_id=institute_id)\ndb.session.add(batch)\ntry:\n db.session.commit()\nexcept IntegrityError:\n db.session.rollb... | <|body_start_0|>
batch = cls(name=name, on_weekdays=on_weekdays, on_weekends=on_weekends, clazz=clazz, target_year=target_year, target_exam=target_exam, type=type, other=other, batch_timings=batch_timings, institute_id=institute_id)
db.session.add(batch)
try:
db.session.commit()
... | Batch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Batch:
def create(cls, name, on_weekdays, on_weekends, clazz, target_year, target_exam, type, other, batch_timings, institute_id):
"""Create a new batch :param name: :param on_weekdays: :param on_weekends: :param clazz: :param target_year: :param target_exam: :param type: :param other: s... | stack_v2_sparse_classes_75kplus_train_007256 | 4,381 | no_license | [
{
"docstring": "Create a new batch :param name: :param on_weekdays: :param on_weekends: :param clazz: :param target_year: :param target_exam: :param type: :param other: some text about batch :param batch_timings: string in the form ``h1:m1-h2:m2`` :param institute_id: :return:",
"name": "create",
"signa... | 3 | stack_v2_sparse_classes_30k_train_006560 | Implement the Python class `Batch` described below.
Class description:
Implement the Batch class.
Method signatures and docstrings:
- def create(cls, name, on_weekdays, on_weekends, clazz, target_year, target_exam, type, other, batch_timings, institute_id): Create a new batch :param name: :param on_weekdays: :param o... | Implement the Python class `Batch` described below.
Class description:
Implement the Batch class.
Method signatures and docstrings:
- def create(cls, name, on_weekdays, on_weekends, clazz, target_year, target_exam, type, other, batch_timings, institute_id): Create a new batch :param name: :param on_weekdays: :param o... | c8af233693cd6a97489a2d73a85646b15220389c | <|skeleton|>
class Batch:
def create(cls, name, on_weekdays, on_weekends, clazz, target_year, target_exam, type, other, batch_timings, institute_id):
"""Create a new batch :param name: :param on_weekdays: :param on_weekends: :param clazz: :param target_year: :param target_exam: :param type: :param other: s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Batch:
def create(cls, name, on_weekdays, on_weekends, clazz, target_year, target_exam, type, other, batch_timings, institute_id):
"""Create a new batch :param name: :param on_weekdays: :param on_weekends: :param clazz: :param target_year: :param target_exam: :param type: :param other: some text about... | the_stack_v2_python_sparse | exam_app/models/batch.py | GraphicalDot/testrocketbackend | train | 0 | |
dad74fa89cfd44bb2bcf7fa17afb49328662d2df | [
"file_presets = FilePreset.objects.filter(input_template=input_template)\nfile_preset_files = [x for x in project.files if FilePreset.match_any(x.filename, file_presets)]\nif len(file_preset_files) == 1 and input_template.unique:\n return [FileSetting.objects.get_or_create(file=x, input_template=input_template) ... | <|body_start_0|>
file_presets = FilePreset.objects.filter(input_template=input_template)
file_preset_files = [x for x in project.files if FilePreset.match_any(x.filename, file_presets)]
if len(file_preset_files) == 1 and input_template.unique:
return [FileSetting.objects.get_or_creat... | Class for adding Files to InputTemplates. | FileSetting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileSetting:
"""Class for adding Files to InputTemplates."""
def create_for_file_presets(input_template: InputTemplate, project: Project):
"""Create file settings automatically for the input template using the file presets."""
<|body_0|>
def create_for_input_template(inp... | stack_v2_sparse_classes_75kplus_train_007257 | 25,346 | no_license | [
{
"docstring": "Create file settings automatically for the input template using the file presets.",
"name": "create_for_file_presets",
"signature": "def create_for_file_presets(input_template: InputTemplate, project: Project)"
},
{
"docstring": "Create file settings automatically for the input t... | 2 | stack_v2_sparse_classes_30k_train_039271 | Implement the Python class `FileSetting` described below.
Class description:
Class for adding Files to InputTemplates.
Method signatures and docstrings:
- def create_for_file_presets(input_template: InputTemplate, project: Project): Create file settings automatically for the input template using the file presets.
- d... | Implement the Python class `FileSetting` described below.
Class description:
Class for adding Files to InputTemplates.
Method signatures and docstrings:
- def create_for_file_presets(input_template: InputTemplate, project: Project): Create file settings automatically for the input template using the file presets.
- d... | dfa60c9a812e52fa44f0d3cf1c201943574976df | <|skeleton|>
class FileSetting:
"""Class for adding Files to InputTemplates."""
def create_for_file_presets(input_template: InputTemplate, project: Project):
"""Create file settings automatically for the input template using the file presets."""
<|body_0|>
def create_for_input_template(inp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileSetting:
"""Class for adding Files to InputTemplates."""
def create_for_file_presets(input_template: InputTemplate, project: Project):
"""Create file settings automatically for the input template using the file presets."""
file_presets = FilePreset.objects.filter(input_template=input_... | the_stack_v2_python_sparse | equestria/processes/models.py | KiOui/CLST-2020 | train | 0 |
ba895f997106d4fd656ba44b2994b363a664f2d5 | [
"params = Response(job_id=job_id)\nlog.info('删除任务[params: %s]' % str(params))\nreturn params",
"params = Response(job_id=job_id)\nlog.info('获取任务[params: %s]' % str(params))\nreturn params",
"payload = get_payload()\nparams = Response(job_id=job_id, interface_id=int(payload.get('interface_id', 0)), job_name=payl... | <|body_start_0|>
params = Response(job_id=job_id)
log.info('删除任务[params: %s]' % str(params))
return params
<|end_body_0|>
<|body_start_1|>
params = Response(job_id=job_id)
log.info('获取任务[params: %s]' % str(params))
return params
<|end_body_1|>
<|body_start_2|>
p... | JobDetail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobDetail:
def delete(job_id):
"""删除任务"""
<|body_0|>
def get(job_id):
"""获取任务"""
<|body_1|>
def put(job_id):
"""修改任务"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
params = Response(job_id=job_id)
log.info('删除任务[params:... | stack_v2_sparse_classes_75kplus_train_007258 | 6,246 | no_license | [
{
"docstring": "删除任务",
"name": "delete",
"signature": "def delete(job_id)"
},
{
"docstring": "获取任务",
"name": "get",
"signature": "def get(job_id)"
},
{
"docstring": "修改任务",
"name": "put",
"signature": "def put(job_id)"
}
] | 3 | stack_v2_sparse_classes_30k_train_028552 | Implement the Python class `JobDetail` described below.
Class description:
Implement the JobDetail class.
Method signatures and docstrings:
- def delete(job_id): 删除任务
- def get(job_id): 获取任务
- def put(job_id): 修改任务 | Implement the Python class `JobDetail` described below.
Class description:
Implement the JobDetail class.
Method signatures and docstrings:
- def delete(job_id): 删除任务
- def get(job_id): 获取任务
- def put(job_id): 修改任务
<|skeleton|>
class JobDetail:
def delete(job_id):
"""删除任务"""
<|body_0|>
def ... | 0374684612a13af1e4d41dcd97ba8c80ecd89710 | <|skeleton|>
class JobDetail:
def delete(job_id):
"""删除任务"""
<|body_0|>
def get(job_id):
"""获取任务"""
<|body_1|>
def put(job_id):
"""修改任务"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JobDetail:
def delete(job_id):
"""删除任务"""
params = Response(job_id=job_id)
log.info('删除任务[params: %s]' % str(params))
return params
def get(job_id):
"""获取任务"""
params = Response(job_id=job_id)
log.info('获取任务[params: %s]' % str(params))
retur... | the_stack_v2_python_sparse | resources/job.py | ChanningWong/HCNDC-web | train | 0 | |
2e42a199b1f499615e7ec78c63fc2acac273d61e | [
"label_spec = self._base_model.get_label_specification(tf_estimator.ModeKeys.TRAIN)\nreward_shape = tuple(label_spec.reward.shape)\npose_shape = tuple(label_spec.target_pose.shape)\ndummy_reward = np.zeros(reward_shape).astype(np.float32)\ndummy_pose = np.zeros(pose_shape).astype(np.float32)\nreturn tensorspec_util... | <|body_start_0|>
label_spec = self._base_model.get_label_specification(tf_estimator.ModeKeys.TRAIN)
reward_shape = tuple(label_spec.reward.shape)
pose_shape = tuple(label_spec.target_pose.shape)
dummy_reward = np.zeros(reward_shape).astype(np.float32)
dummy_pose = np.zeros(pose_s... | MAML Regression environment for duck task. | PoseEnvRegressionModelMAML | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PoseEnvRegressionModelMAML:
"""MAML Regression environment for duck task."""
def _make_dummy_labels(self):
"""Helper function to make dummy labels for pack_labels."""
<|body_0|>
def _select_inference_output(self, predictions):
"""Inference output selection for re... | stack_v2_sparse_classes_75kplus_train_007259 | 4,249 | permissive | [
{
"docstring": "Helper function to make dummy labels for pack_labels.",
"name": "_make_dummy_labels",
"signature": "def _make_dummy_labels(self)"
},
{
"docstring": "Inference output selection for regression models.",
"name": "_select_inference_output",
"signature": "def _select_inference... | 3 | stack_v2_sparse_classes_30k_train_010024 | Implement the Python class `PoseEnvRegressionModelMAML` described below.
Class description:
MAML Regression environment for duck task.
Method signatures and docstrings:
- def _make_dummy_labels(self): Helper function to make dummy labels for pack_labels.
- def _select_inference_output(self, predictions): Inference ou... | Implement the Python class `PoseEnvRegressionModelMAML` described below.
Class description:
MAML Regression environment for duck task.
Method signatures and docstrings:
- def _make_dummy_labels(self): Helper function to make dummy labels for pack_labels.
- def _select_inference_output(self, predictions): Inference ou... | f93f378db3183cceaad1b96828b199cf40cad606 | <|skeleton|>
class PoseEnvRegressionModelMAML:
"""MAML Regression environment for duck task."""
def _make_dummy_labels(self):
"""Helper function to make dummy labels for pack_labels."""
<|body_0|>
def _select_inference_output(self, predictions):
"""Inference output selection for re... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PoseEnvRegressionModelMAML:
"""MAML Regression environment for duck task."""
def _make_dummy_labels(self):
"""Helper function to make dummy labels for pack_labels."""
label_spec = self._base_model.get_label_specification(tf_estimator.ModeKeys.TRAIN)
reward_shape = tuple(label_spec... | the_stack_v2_python_sparse | research/pose_env/pose_env_maml_models.py | google-research/tensor2robot | train | 539 |
7b2c416ede5c532af15b0cd434b11930247b345b | [
"super(UniSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs)\nself.nslice = 1\nself.slicePoints['sid'] = np.array([0], int)",
"self._runMaps(maps)\nsimDataCol = simData.dtype.names[0]\nself.indices = np.ones(len(simData[simDataCol]), dtype='bool')\n\n@wraps(self._sliceSimData)\ndef _slice... | <|body_start_0|>
super(UniSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs)
self.nslice = 1
self.slicePoints['sid'] = np.array([0], int)
<|end_body_0|>
<|body_start_1|>
self._runMaps(maps)
simDataCol = simData.dtype.names[0]
self.indices = np.on... | UniSlicer. | UniSlicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UniSlicer:
"""UniSlicer."""
def __init__(self, verbose=True, badval=-666, plotFuncs=None):
"""Instantiate unislicer."""
<|body_0|>
def setupSlicer(self, simData, maps=None):
"""Use simData to set indexes to return."""
<|body_1|>
def __eq__(self, othe... | stack_v2_sparse_classes_75kplus_train_007260 | 1,308 | no_license | [
{
"docstring": "Instantiate unislicer.",
"name": "__init__",
"signature": "def __init__(self, verbose=True, badval=-666, plotFuncs=None)"
},
{
"docstring": "Use simData to set indexes to return.",
"name": "setupSlicer",
"signature": "def setupSlicer(self, simData, maps=None)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_032883 | Implement the Python class `UniSlicer` described below.
Class description:
UniSlicer.
Method signatures and docstrings:
- def __init__(self, verbose=True, badval=-666, plotFuncs=None): Instantiate unislicer.
- def setupSlicer(self, simData, maps=None): Use simData to set indexes to return.
- def __eq__(self, otherSli... | Implement the Python class `UniSlicer` described below.
Class description:
UniSlicer.
Method signatures and docstrings:
- def __init__(self, verbose=True, badval=-666, plotFuncs=None): Instantiate unislicer.
- def setupSlicer(self, simData, maps=None): Use simData to set indexes to return.
- def __eq__(self, otherSli... | 2b0faebd60fb4387366954d3531ac4d9df8c6fc4 | <|skeleton|>
class UniSlicer:
"""UniSlicer."""
def __init__(self, verbose=True, badval=-666, plotFuncs=None):
"""Instantiate unislicer."""
<|body_0|>
def setupSlicer(self, simData, maps=None):
"""Use simData to set indexes to return."""
<|body_1|>
def __eq__(self, othe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UniSlicer:
"""UniSlicer."""
def __init__(self, verbose=True, badval=-666, plotFuncs=None):
"""Instantiate unislicer."""
super(UniSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs)
self.nslice = 1
self.slicePoints['sid'] = np.array([0], int)
de... | the_stack_v2_python_sparse | python/lsst/sims/maf/slicers/uniSlicer.py | nanchenchen/sims_maf | train | 0 |
e75e6d1f20fc138ff94ab0d7de5f05e9f1ab794f | [
"v = AppVersion(version='3.0.12b2')\nassert v.major == 3\nassert v.minor1 == 0\nassert v.minor2 == 12\nassert v.minor3 is None\nassert v.alpha == 'b'\nassert v.alpha_ver == 2\nv = AppVersion(version='3.6.1apre2+')\nassert v.major == 3\nassert v.minor1 == 6\nassert v.minor2 == 1\nassert v.alpha == 'a'\nassert v.pre ... | <|body_start_0|>
v = AppVersion(version='3.0.12b2')
assert v.major == 3
assert v.minor1 == 0
assert v.minor2 == 12
assert v.minor3 is None
assert v.alpha == 'b'
assert v.alpha_ver == 2
v = AppVersion(version='3.6.1apre2+')
assert v.major == 3
... | TestAppVersion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAppVersion:
def test_major_minor(self):
"""Check that major/minor/alpha is getting set."""
<|body_0|>
def test_unique_together_application_version(self):
"""Check that one can't add duplicate application-version pairs."""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_75kplus_train_007261 | 3,276 | permissive | [
{
"docstring": "Check that major/minor/alpha is getting set.",
"name": "test_major_minor",
"signature": "def test_major_minor(self)"
},
{
"docstring": "Check that one can't add duplicate application-version pairs.",
"name": "test_unique_together_application_version",
"signature": "def te... | 2 | stack_v2_sparse_classes_30k_train_043486 | Implement the Python class `TestAppVersion` described below.
Class description:
Implement the TestAppVersion class.
Method signatures and docstrings:
- def test_major_minor(self): Check that major/minor/alpha is getting set.
- def test_unique_together_application_version(self): Check that one can't add duplicate appl... | Implement the Python class `TestAppVersion` described below.
Class description:
Implement the TestAppVersion class.
Method signatures and docstrings:
- def test_major_minor(self): Check that major/minor/alpha is getting set.
- def test_unique_together_application_version(self): Check that one can't add duplicate appl... | 053f43d00fec71d8b9d3280ba9ef1ca46aae3aa6 | <|skeleton|>
class TestAppVersion:
def test_major_minor(self):
"""Check that major/minor/alpha is getting set."""
<|body_0|>
def test_unique_together_application_version(self):
"""Check that one can't add duplicate application-version pairs."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestAppVersion:
def test_major_minor(self):
"""Check that major/minor/alpha is getting set."""
v = AppVersion(version='3.0.12b2')
assert v.major == 3
assert v.minor1 == 0
assert v.minor2 == 12
assert v.minor3 is None
assert v.alpha == 'b'
assert ... | the_stack_v2_python_sparse | src/olympia/applications/tests.py | CSCD01/addons-server-team02 | train | 3 | |
28f8990ed2f9d24cb7f5eb1c467b4844917f9bbd | [
"curr = head\nprev = None\nwhile curr is not None:\n nextnode = curr.next\n curr.next = prev\n prev = curr\n curr = nextnode\nreturn prev",
"if head is None or head.next is None:\n return head\nrst = self.reverseList_recursive(head.next)\nhead.next.next = head\nhead = None\nreturn rst"
] | <|body_start_0|>
curr = head
prev = None
while curr is not None:
nextnode = curr.next
curr.next = prev
prev = curr
curr = nextnode
return prev
<|end_body_0|>
<|body_start_1|>
if head is None or head.next is None:
return... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseList_iterative(self, head):
""":type head: ListNode :rtype: ListNode :Algorithm: - Interate through the list - maintain a pointer indicating the next node - maintain a previous node, starting from None - make current node point to previous node - make previous node g... | stack_v2_sparse_classes_75kplus_train_007262 | 1,439 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode :Algorithm: - Interate through the list - maintain a pointer indicating the next node - maintain a previous node, starting from None - make current node point to previous node - make previous node goes to current node - make current node point to next node",... | 2 | stack_v2_sparse_classes_30k_train_004491 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList_iterative(self, head): :type head: ListNode :rtype: ListNode :Algorithm: - Interate through the list - maintain a pointer indicating the next node - maintain a pr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseList_iterative(self, head): :type head: ListNode :rtype: ListNode :Algorithm: - Interate through the list - maintain a pointer indicating the next node - maintain a pr... | 41365b549f1e6b04aac9f1632a66e71c1e05b322 | <|skeleton|>
class Solution:
def reverseList_iterative(self, head):
""":type head: ListNode :rtype: ListNode :Algorithm: - Interate through the list - maintain a pointer indicating the next node - maintain a previous node, starting from None - make current node point to previous node - make previous node g... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseList_iterative(self, head):
""":type head: ListNode :rtype: ListNode :Algorithm: - Interate through the list - maintain a pointer indicating the next node - maintain a previous node, starting from None - make current node point to previous node - make previous node goes to current... | the_stack_v2_python_sparse | python practice/LinkedList/e_reverseList.py | SuzyWu2014/coding-practice | train | 1 | |
4203e47b7b627b88fa8ae8fb8756724925e05ad2 | [
"self.d = {}\nfor i in range(0, len(words)):\n self.d[words[i]] = self.d.get(words[i], []) + [i]",
"l1 = self.d[word1]\nl2 = self.d[word2]\ni = j = 0\nans = float('inf')\nwhile i < len(l1) and j < len(l2):\n ans = min(ans, abs(l1[i] - l2[j]))\n if l1[i] > l2[j]:\n j += 1\n else:\n i += 1... | <|body_start_0|>
self.d = {}
for i in range(0, len(words)):
self.d[words[i]] = self.d.get(words[i], []) + [i]
<|end_body_0|>
<|body_start_1|>
l1 = self.d[word1]
l2 = self.d[word2]
i = j = 0
ans = float('inf')
while i < len(l1) and j < len(l2):
... | WordDistance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
"""Adds a word into the data structure. :type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus_train_007263 | 848 | no_license | [
{
"docstring": "initialize your data structure here. :type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": "Adds a word into the data structure. :type word1: str :type word2: str :rtype: int",
"name": "shortest",
"signature": "def shortes... | 2 | stack_v2_sparse_classes_30k_train_009292 | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): initialize your data structure here. :type words: List[str]
- def shortest(self, word1, word2): Adds a word into the data structure. :type word... | Implement the Python class `WordDistance` described below.
Class description:
Implement the WordDistance class.
Method signatures and docstrings:
- def __init__(self, words): initialize your data structure here. :type words: List[str]
- def shortest(self, word1, word2): Adds a word into the data structure. :type word... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
<|body_0|>
def shortest(self, word1, word2):
"""Adds a word into the data structure. :type word1: str :type word2: str :rtype: int"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WordDistance:
def __init__(self, words):
"""initialize your data structure here. :type words: List[str]"""
self.d = {}
for i in range(0, len(words)):
self.d[words[i]] = self.d.get(words[i], []) + [i]
def shortest(self, word1, word2):
"""Adds a word into the dat... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/lc-all-solutions/244.shortest-word-distance-ii/shortest-word-distance-ii.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
01d4256b4fad17f594b71d8aa983f6c744797115 | [
"print('Loading resources...')\nself.create_chitchat_bot()\nself.intent_recognizer = unpickle_file(Path(*paths['INTENT_RECOGNIZER']))\nself.tfidf_vectorizer = unpickle_file(Path(*paths['TFIDF_VECTORIZER']))\nself.ANSWER_TEMPLATE = 'I think its about {}\\nThis thread might help you: https://stackoverflow.com/questio... | <|body_start_0|>
print('Loading resources...')
self.create_chitchat_bot()
self.intent_recognizer = unpickle_file(Path(*paths['INTENT_RECOGNIZER']))
self.tfidf_vectorizer = unpickle_file(Path(*paths['TFIDF_VECTORIZER']))
self.ANSWER_TEMPLATE = 'I think its about {}\nThis thread mi... | Class for the dialogue manager | DialogueManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DialogueManager:
"""Class for the dialogue manager"""
def __init__(self, paths):
"""Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOve... | stack_v2_sparse_classes_75kplus_train_007264 | 6,341 | no_license | [
{
"docstring": "Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOverflow thread questions) Parameters ---------- paths : dict Where the keys are names, and the val... | 3 | stack_v2_sparse_classes_30k_train_015672 | Implement the Python class `DialogueManager` described below.
Class description:
Class for the dialogue manager
Method signatures and docstrings:
- def __init__(self, paths): Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vector... | Implement the Python class `DialogueManager` described below.
Class description:
Class for the dialogue manager
Method signatures and docstrings:
- def __init__(self, paths): Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vector... | 06ae79e02a1c528c50efa26c96efe0852e4bb795 | <|skeleton|>
class DialogueManager:
"""Class for the dialogue manager"""
def __init__(self, paths):
"""Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOve... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DialogueManager:
"""Class for the dialogue manager"""
def __init__(self, paths):
"""Constructor for the DialogueManager - Loads the intent recognizer (is this about programming, or just chit-chatting?) - Loads the tf-idf vectorizer (the vectorizer trained on the dialogue and StackOverflow thread ... | the_stack_v2_python_sparse | course_6_natural_language_processing/week5_dialog_systems/dialogue_manager.py | loeiten/coursera_advanced_machine_learning | train | 8 |
d20a2d818796ff592f18993d822b0b2e4f379736 | [
"o = OperatorCharStar()\nself.assertEqual(o.m_str, 'OperatorCharStar')\nself.assertIn('OperatorCharStar', repr(o))\no = OperatorConstCharStar()\nself.assertEqual(o.m_str, 'OperatorConstCharStar')\nself.assertIn('OperatorConstCharStar', repr(o))\no = OperatorInt()\no.m_int = -13\nself.assertEqual(o.m_int, -13)\nself... | <|body_start_0|>
o = OperatorCharStar()
self.assertEqual(o.m_str, 'OperatorCharStar')
self.assertIn('OperatorCharStar', repr(o))
o = OperatorConstCharStar()
self.assertEqual(o.m_str, 'OperatorConstCharStar')
self.assertIn('OperatorConstCharStar', repr(o))
o = Oper... | Cpp2ConverterOperatorsTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cpp2ConverterOperatorsTestCase:
def test1ExactTypes(self):
"""Test converter operators of exact types"""
<|body_0|>
def test2ApproximateTypes(self):
"""Test converter operators of approximate types"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
o =... | stack_v2_sparse_classes_75kplus_train_007265 | 5,582 | no_license | [
{
"docstring": "Test converter operators of exact types",
"name": "test1ExactTypes",
"signature": "def test1ExactTypes(self)"
},
{
"docstring": "Test converter operators of approximate types",
"name": "test2ApproximateTypes",
"signature": "def test2ApproximateTypes(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_045324 | Implement the Python class `Cpp2ConverterOperatorsTestCase` described below.
Class description:
Implement the Cpp2ConverterOperatorsTestCase class.
Method signatures and docstrings:
- def test1ExactTypes(self): Test converter operators of exact types
- def test2ApproximateTypes(self): Test converter operators of appr... | Implement the Python class `Cpp2ConverterOperatorsTestCase` described below.
Class description:
Implement the Cpp2ConverterOperatorsTestCase class.
Method signatures and docstrings:
- def test1ExactTypes(self): Test converter operators of exact types
- def test2ApproximateTypes(self): Test converter operators of appr... | 134508460915282a5d82d6cbbb6e6afa14653413 | <|skeleton|>
class Cpp2ConverterOperatorsTestCase:
def test1ExactTypes(self):
"""Test converter operators of exact types"""
<|body_0|>
def test2ApproximateTypes(self):
"""Test converter operators of approximate types"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Cpp2ConverterOperatorsTestCase:
def test1ExactTypes(self):
"""Test converter operators of exact types"""
o = OperatorCharStar()
self.assertEqual(o.m_str, 'OperatorCharStar')
self.assertIn('OperatorCharStar', repr(o))
o = OperatorConstCharStar()
self.assertEqual(... | the_stack_v2_python_sparse | python/basic/PyROOT_operatortests.py | root-project/roottest | train | 41 | |
6ea6b47414da6568e4429b4072423ee05bf268af | [
"self.business_name = business_name\nself.contact = contact\nself.business_address = business_address\nself.identity_documents = identity_documents",
"if dictionary is None:\n return None\ncontact = dictionary.get('contact')\nbusiness_name = dictionary.get('businessName')\nbusiness_address = Address.from_dicti... | <|body_start_0|>
self.business_name = business_name
self.contact = contact
self.business_address = business_address
self.identity_documents = identity_documents
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
contact = dictionary.get('conta... | Implementation of the 'CreatePayerRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. contact (object): TODO: type description here. business_address (Address): TODO: type description here. identity_documents (list of IdentityDocuments): TODO: type descrip... | CreatePayerRequest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreatePayerRequest:
"""Implementation of the 'CreatePayerRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. contact (object): TODO: type description here. business_address (Address): TODO: type description here. identity_documents (... | stack_v2_sparse_classes_75kplus_train_007266 | 2,693 | permissive | [
{
"docstring": "Constructor for the CreatePayerRequest class",
"name": "__init__",
"signature": "def __init__(self, contact=None, business_name=None, business_address=None, identity_documents=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictiona... | 2 | null | Implement the Python class `CreatePayerRequest` described below.
Class description:
Implementation of the 'CreatePayerRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. contact (object): TODO: type description here. business_address (Address): TODO: type... | Implement the Python class `CreatePayerRequest` described below.
Class description:
Implementation of the 'CreatePayerRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. contact (object): TODO: type description here. business_address (Address): TODO: type... | e1ca52116aabfcdb2f36c24ebd866cf00bb5c6c9 | <|skeleton|>
class CreatePayerRequest:
"""Implementation of the 'CreatePayerRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. contact (object): TODO: type description here. business_address (Address): TODO: type description here. identity_documents (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreatePayerRequest:
"""Implementation of the 'CreatePayerRequest' model. TODO: type model description here. Attributes: business_name (string): TODO: type description here. contact (object): TODO: type description here. business_address (Address): TODO: type description here. identity_documents (list of Ident... | the_stack_v2_python_sparse | plastiqpublicapi/models/create_payer_request.py | jeffkynaston/sdk-spike-python-apimatic | train | 0 |
184a439cb9211ffe1c6a0a9cbd78e290bb067ddb | [
"self.defaultElementWidth, self.defaultElementHeight = (50, 50)\nself.defaultLabelWidth, self.defaultLabelHeight = (30, 10)\nself.context = context\nself.context.new_path()",
"if alpha is None:\n context.set_source_rgb(float(r) / 255.0, float(g) / 255.0, float(b) / 255.0)\nelse:\n context.set_source_rgba(fl... | <|body_start_0|>
self.defaultElementWidth, self.defaultElementHeight = (50, 50)
self.defaultLabelWidth, self.defaultLabelHeight = (30, 10)
self.context = context
self.context.new_path()
<|end_body_0|>
<|body_start_1|>
if alpha is None:
context.set_source_rgb(float(r)... | Base class for drawing objects | CBaseDrawing | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CBaseDrawing:
"""Base class for drawing objects"""
def __init__(self, context):
"""Constructor @type context: CairoContext @param context: cairo context, will be painted on this context"""
<|body_0|>
def ChangeColor(self, context, r, g, b, alpha=None):
"""Change ... | stack_v2_sparse_classes_75kplus_train_007267 | 1,264 | no_license | [
{
"docstring": "Constructor @type context: CairoContext @param context: cairo context, will be painted on this context",
"name": "__init__",
"signature": "def __init__(self, context)"
},
{
"docstring": "Change color on given context @type context: CairoContext @param context: cairo context on wh... | 2 | stack_v2_sparse_classes_30k_train_026471 | Implement the Python class `CBaseDrawing` described below.
Class description:
Base class for drawing objects
Method signatures and docstrings:
- def __init__(self, context): Constructor @type context: CairoContext @param context: cairo context, will be painted on this context
- def ChangeColor(self, context, r, g, b,... | Implement the Python class `CBaseDrawing` described below.
Class description:
Base class for drawing objects
Method signatures and docstrings:
- def __init__(self, context): Constructor @type context: CairoContext @param context: cairo context, will be painted on this context
- def ChangeColor(self, context, r, g, b,... | eb050a93ef955b8fbc184a437cb0e6fae54264cd | <|skeleton|>
class CBaseDrawing:
"""Base class for drawing objects"""
def __init__(self, context):
"""Constructor @type context: CairoContext @param context: cairo context, will be painted on this context"""
<|body_0|>
def ChangeColor(self, context, r, g, b, alpha=None):
"""Change ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CBaseDrawing:
"""Base class for drawing objects"""
def __init__(self, context):
"""Constructor @type context: CairoContext @param context: cairo context, will be painted on this context"""
self.defaultElementWidth, self.defaultElementHeight = (50, 50)
self.defaultLabelWidth, self.... | the_stack_v2_python_sparse | plugin/gui/BaseDrawing.py | umlfri-old/addon_team | train | 0 |
352d0ca53d1c7c1b32f3cd737746d33863e7bc03 | [
"combine_fn = ApproximateQuantilesCombineFn.create(num_quantiles=10, max_num_elements=maxInputSize, epsilon=epsilon)\nself.assertEqual(expectedNumBuffers, combine_fn._spec.num_buffers, 'Number of buffers')\nself.assertEqual(expectedBufferSize, combine_fn._spec.buffer_size, 'Buffer size')",
"combine_fn = Approxima... | <|body_start_0|>
combine_fn = ApproximateQuantilesCombineFn.create(num_quantiles=10, max_num_elements=maxInputSize, epsilon=epsilon)
self.assertEqual(expectedNumBuffers, combine_fn._spec.num_buffers, 'Number of buffers')
self.assertEqual(expectedBufferSize, combine_fn._spec.buffer_size, 'Buffer ... | Approximate Quantiles Buffer Tests to ensure we are calculating the optimal buffers. | ApproximateQuantilesBufferTest | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-protobuf",
"Apache-2.0",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApproximateQuantilesBufferTest:
"""Approximate Quantiles Buffer Tests to ensure we are calculating the optimal buffers."""
def test_efficiency(self, epsilon, maxInputSize, expectedNumBuffers, expectedBufferSize):
"""Verify the buffers are efficiently calculated according to the refer... | stack_v2_sparse_classes_75kplus_train_007268 | 25,074 | permissive | [
{
"docstring": "Verify the buffers are efficiently calculated according to the reference table values.",
"name": "test_efficiency",
"signature": "def test_efficiency(self, epsilon, maxInputSize, expectedNumBuffers, expectedBufferSize)"
},
{
"docstring": "Verify that buffers are correct according... | 2 | null | Implement the Python class `ApproximateQuantilesBufferTest` described below.
Class description:
Approximate Quantiles Buffer Tests to ensure we are calculating the optimal buffers.
Method signatures and docstrings:
- def test_efficiency(self, epsilon, maxInputSize, expectedNumBuffers, expectedBufferSize): Verify the ... | Implement the Python class `ApproximateQuantilesBufferTest` described below.
Class description:
Approximate Quantiles Buffer Tests to ensure we are calculating the optimal buffers.
Method signatures and docstrings:
- def test_efficiency(self, epsilon, maxInputSize, expectedNumBuffers, expectedBufferSize): Verify the ... | 6d5048e05087ea54abc889ce402ae2a0abb9252b | <|skeleton|>
class ApproximateQuantilesBufferTest:
"""Approximate Quantiles Buffer Tests to ensure we are calculating the optimal buffers."""
def test_efficiency(self, epsilon, maxInputSize, expectedNumBuffers, expectedBufferSize):
"""Verify the buffers are efficiently calculated according to the refer... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApproximateQuantilesBufferTest:
"""Approximate Quantiles Buffer Tests to ensure we are calculating the optimal buffers."""
def test_efficiency(self, epsilon, maxInputSize, expectedNumBuffers, expectedBufferSize):
"""Verify the buffers are efficiently calculated according to the reference table va... | the_stack_v2_python_sparse | sdks/python/apache_beam/transforms/stats_test.py | apache/beam | train | 7,061 |
35eb14f18f7d14b130427e4c9492aa8f7a77a4b4 | [
"if lmax < abs(m):\n raise ValueError('lmax must be >= |m|')\nl = np.arange(abs(m), lmax + 1)\nsuper().__init__(self._ftheta, nf=len(l), nx=1, maxderiv=None, zlevel=None)\nself.l = l\nself.m = m\nreturn",
"nd, nvar = dfun.ndnvar(deriv, var, self.nx)\nif out is None:\n base_shape = X.shape[1:]\n out = np.... | <|body_start_0|>
if lmax < abs(m):
raise ValueError('lmax must be >= |m|')
l = np.arange(abs(m), lmax + 1)
super().__init__(self._ftheta, nf=len(l), nx=1, maxderiv=None, zlevel=None)
self.l = l
self.m = m
return
<|end_body_0|>
<|body_start_1|>
nd, nva... | Associated Legendre polynomials of a given order, :math:`m`, with :math:`\\cos \\theta` argument for :math:`\\theta \\in [0,\\pi]`. .. math:: F_\\ell^m(\\theta) = N^m_l P_l^{|m|}(\\cos \\theta), with :math:`m = 0, 1, 2, \\ldots` and :math:`\\ell = |m|, |m|+1, \\ldots, \\ell_\\text{max}`. (Negative :math:`m` is defined,... | LegendreLMCos | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LegendreLMCos:
"""Associated Legendre polynomials of a given order, :math:`m`, with :math:`\\cos \\theta` argument for :math:`\\theta \\in [0,\\pi]`. .. math:: F_\\ell^m(\\theta) = N^m_l P_l^{|m|}(\\cos \\theta), with :math:`m = 0, 1, 2, \\ldots` and :math:`\\ell = |m|, |m|+1, \\ldots, \\ell_\\te... | stack_v2_sparse_classes_75kplus_train_007269 | 39,055 | permissive | [
{
"docstring": "Create associated Legendre basis DFuns Parameters ---------- m : int The Legendre order. lmax : int The maximum value of :math:`\\\\ell`. This must be greater than or equal to :math:`|m|`.",
"name": "__init__",
"signature": "def __init__(self, m, lmax)"
},
{
"docstring": "basis e... | 2 | stack_v2_sparse_classes_30k_train_022190 | Implement the Python class `LegendreLMCos` described below.
Class description:
Associated Legendre polynomials of a given order, :math:`m`, with :math:`\\cos \\theta` argument for :math:`\\theta \\in [0,\\pi]`. .. math:: F_\\ell^m(\\theta) = N^m_l P_l^{|m|}(\\cos \\theta), with :math:`m = 0, 1, 2, \\ldots` and :math:`... | Implement the Python class `LegendreLMCos` described below.
Class description:
Associated Legendre polynomials of a given order, :math:`m`, with :math:`\\cos \\theta` argument for :math:`\\theta \\in [0,\\pi]`. .. math:: F_\\ell^m(\\theta) = N^m_l P_l^{|m|}(\\cos \\theta), with :math:`m = 0, 1, 2, \\ldots` and :math:`... | c6341a58331deef3728cc43c627c556139deb673 | <|skeleton|>
class LegendreLMCos:
"""Associated Legendre polynomials of a given order, :math:`m`, with :math:`\\cos \\theta` argument for :math:`\\theta \\in [0,\\pi]`. .. math:: F_\\ell^m(\\theta) = N^m_l P_l^{|m|}(\\cos \\theta), with :math:`m = 0, 1, 2, \\ldots` and :math:`\\ell = |m|, |m|+1, \\ldots, \\ell_\\te... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LegendreLMCos:
"""Associated Legendre polynomials of a given order, :math:`m`, with :math:`\\cos \\theta` argument for :math:`\\theta \\in [0,\\pi]`. .. math:: F_\\ell^m(\\theta) = N^m_l P_l^{|m|}(\\cos \\theta), with :math:`m = 0, 1, 2, \\ldots` and :math:`\\ell = |m|, |m|+1, \\ldots, \\ell_\\text{max}`. (Ne... | the_stack_v2_python_sparse | nitrogen/special.py | bchangala/nitrogen | train | 11 |
0da743e9fd2ee531cf516f7f91c5835232851ffa | [
"test, traceback = super(SetPulseModulationTask, self).check(*args, **kwargs)\nif test and self.switch:\n try:\n switch = self.format_and_eval_string(self.switch)\n except Exception:\n return (False, traceback)\n if switch not in ('Off', 'On', 0, 1):\n test = False\n traceback[s... | <|body_start_0|>
test, traceback = super(SetPulseModulationTask, self).check(*args, **kwargs)
if test and self.switch:
try:
switch = self.format_and_eval_string(self.switch)
except Exception:
return (False, traceback)
if switch not in (... | Switch on/off the pulse modulation of the source. | SetPulseModulationTask | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetPulseModulationTask:
"""Switch on/off the pulse modulation of the source."""
def check(self, *args, **kwargs):
"""Validate the value of the switch."""
<|body_0|>
def i_perform(self, switch=None):
"""Default interface behavior."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_75kplus_train_007270 | 7,840 | permissive | [
{
"docstring": "Validate the value of the switch.",
"name": "check",
"signature": "def check(self, *args, **kwargs)"
},
{
"docstring": "Default interface behavior.",
"name": "i_perform",
"signature": "def i_perform(self, switch=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_024045 | Implement the Python class `SetPulseModulationTask` described below.
Class description:
Switch on/off the pulse modulation of the source.
Method signatures and docstrings:
- def check(self, *args, **kwargs): Validate the value of the switch.
- def i_perform(self, switch=None): Default interface behavior. | Implement the Python class `SetPulseModulationTask` described below.
Class description:
Switch on/off the pulse modulation of the source.
Method signatures and docstrings:
- def check(self, *args, **kwargs): Validate the value of the switch.
- def i_perform(self, switch=None): Default interface behavior.
<|skeleton|... | b6f1f5b236c7a4e28d9a3bc8da9820c52d789309 | <|skeleton|>
class SetPulseModulationTask:
"""Switch on/off the pulse modulation of the source."""
def check(self, *args, **kwargs):
"""Validate the value of the switch."""
<|body_0|>
def i_perform(self, switch=None):
"""Default interface behavior."""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SetPulseModulationTask:
"""Switch on/off the pulse modulation of the source."""
def check(self, *args, **kwargs):
"""Validate the value of the switch."""
test, traceback = super(SetPulseModulationTask, self).check(*args, **kwargs)
if test and self.switch:
try:
... | the_stack_v2_python_sparse | exopy_hqc_legacy/tasks/tasks/instr/rf_tasks.py | Exopy/exopy_hqc_legacy | train | 0 |
9e9a5cbfdd434932d9742249705770a7d795518d | [
"if six.PY2:\n buf = io.BytesIO()\n try:\n json.dump(self.document, buf, cls=ProvJSONEncoder, **kwargs)\n buf.seek(0, 0)\n if isinstance(stream, io.TextIOBase):\n stream.write(buf.read().decode('utf-8'))\n else:\n stream.write(buf.read())\n finally:\n ... | <|body_start_0|>
if six.PY2:
buf = io.BytesIO()
try:
json.dump(self.document, buf, cls=ProvJSONEncoder, **kwargs)
buf.seek(0, 0)
if isinstance(stream, io.TextIOBase):
stream.write(buf.read().decode('utf-8'))
... | PROV-JSON serializer for :class:`~prov.model.ProvDocument` | ProvJSONSerializer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProvJSONSerializer:
"""PROV-JSON serializer for :class:`~prov.model.ProvDocument`"""
def serialize(self, stream, **kwargs):
"""Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the out... | stack_v2_sparse_classes_75kplus_train_007271 | 13,588 | permissive | [
{
"docstring": "Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the output.",
"name": "serialize",
"signature": "def serialize(self, stream, **kwargs)"
},
{
"docstring": "Deserialize from the `P... | 2 | stack_v2_sparse_classes_30k_train_040034 | Implement the Python class `ProvJSONSerializer` described below.
Class description:
PROV-JSON serializer for :class:`~prov.model.ProvDocument`
Method signatures and docstrings:
- def serialize(self, stream, **kwargs): Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.... | Implement the Python class `ProvJSONSerializer` described below.
Class description:
PROV-JSON serializer for :class:`~prov.model.ProvDocument`
Method signatures and docstrings:
- def serialize(self, stream, **kwargs): Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.... | 3c3acc55de8ba741e673063378e6cbaf10b64c7a | <|skeleton|>
class ProvJSONSerializer:
"""PROV-JSON serializer for :class:`~prov.model.ProvDocument`"""
def serialize(self, stream, **kwargs):
"""Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the out... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProvJSONSerializer:
"""PROV-JSON serializer for :class:`~prov.model.ProvDocument`"""
def serialize(self, stream, **kwargs):
"""Serializes a :class:`~prov.model.ProvDocument` instance to `PROV-JSON <https://provenance.ecs.soton.ac.uk/prov-json/>`_. :param stream: Where to save the output."""
... | the_stack_v2_python_sparse | env/lib/python3.6/site-packages/prov/serializers/provjson.py | Raniac/NEURO-LEARN | train | 9 |
b17721272acce2d518be993b5cca2ddfbde7c622 | [
"super().__init__()\nself.backbone = nn.Sequential(MLPConv(1, 48, 6, 2), MLPConv(48, 160, 5, 2), MLPConv(160, 512, 3, 2))\nself.feature_cube_side = 2\nself.partial_predictors = nn.ModuleList()\nfor i in range(8):\n self.partial_predictors.append(nn.Linear(512, n_classes))\nself.full_predictor = nn.Sequential(nn.... | <|body_start_0|>
super().__init__()
self.backbone = nn.Sequential(MLPConv(1, 48, 6, 2), MLPConv(48, 160, 5, 2), MLPConv(160, 512, 3, 2))
self.feature_cube_side = 2
self.partial_predictors = nn.ModuleList()
for i in range(8):
self.partial_predictors.append(nn.Linear(51... | 3DCNN Network as described in Section 4.2 / Fig. 3 of https://arxiv.org/pdf/1604.03265.pdf. However, inputs here are 32x32x32 in contrast to original figure. Note that architecture does not change inspite of this. | ThreeDeeCNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreeDeeCNN:
"""3DCNN Network as described in Section 4.2 / Fig. 3 of https://arxiv.org/pdf/1604.03265.pdf. However, inputs here are 32x32x32 in contrast to original figure. Note that architecture does not change inspite of this."""
def __init__(self, n_classes):
""":param n_classes:... | stack_v2_sparse_classes_75kplus_train_007272 | 4,085 | no_license | [
{
"docstring": ":param n_classes: Number of classes to classified, e.g. for our shapenet experiments we have a 13 class classification problem",
"name": "__init__",
"signature": "def __init__(self, n_classes)"
},
{
"docstring": ":param x: tensor of shape [B, C, D, H, W], where B = batch size, C ... | 2 | stack_v2_sparse_classes_30k_train_051308 | Implement the Python class `ThreeDeeCNN` described below.
Class description:
3DCNN Network as described in Section 4.2 / Fig. 3 of https://arxiv.org/pdf/1604.03265.pdf. However, inputs here are 32x32x32 in contrast to original figure. Note that architecture does not change inspite of this.
Method signatures and docst... | Implement the Python class `ThreeDeeCNN` described below.
Class description:
3DCNN Network as described in Section 4.2 / Fig. 3 of https://arxiv.org/pdf/1604.03265.pdf. However, inputs here are 32x32x32 in contrast to original figure. Note that architecture does not change inspite of this.
Method signatures and docst... | a98d61403017317eb2b5da9760f78a19c76622e4 | <|skeleton|>
class ThreeDeeCNN:
"""3DCNN Network as described in Section 4.2 / Fig. 3 of https://arxiv.org/pdf/1604.03265.pdf. However, inputs here are 32x32x32 in contrast to original figure. Note that architecture does not change inspite of this."""
def __init__(self, n_classes):
""":param n_classes:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThreeDeeCNN:
"""3DCNN Network as described in Section 4.2 / Fig. 3 of https://arxiv.org/pdf/1604.03265.pdf. However, inputs here are 32x32x32 in contrast to original figure. Note that architecture does not change inspite of this."""
def __init__(self, n_classes):
""":param n_classes: Number of cl... | the_stack_v2_python_sparse | E2/exercise_2/model/cnn3d.py | nazmicancalik/ml3d | train | 7 |
2e37d343c5800581dd8a087cdd226bb4f894b995 | [
"if not os.path.exists(directory):\n os.makedirs(directory)\ntry:\n with open(directory + '/' + filename, 'rb') as index_file:\n self._index = pickle.load(index_file)\nexcept:\n self._index = dict()\nself._filename = filename\nself._directory = directory",
"t_64bit_arr = np.vstack((t.times(), t.va... | <|body_start_0|>
if not os.path.exists(directory):
os.makedirs(directory)
try:
with open(directory + '/' + filename, 'rb') as index_file:
self._index = pickle.load(index_file)
except:
self._index = dict()
self._filename = filename
... | A file storage manager class that manages the persistent storage of our individual time series. Parameters ---------- filename: string (optional) Name of pickle file to stores the id and length of each time series. Default is 'ts_index.pkl'. directory: string (optional) Path to directory to which index file and time se... | FileStorageManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileStorageManager:
"""A file storage manager class that manages the persistent storage of our individual time series. Parameters ---------- filename: string (optional) Name of pickle file to stores the id and length of each time series. Default is 'ts_index.pkl'. directory: string (optional) Pat... | stack_v2_sparse_classes_75kplus_train_007273 | 6,548 | no_license | [
{
"docstring": "Constructor for FileStorageManager. Initializes FileStorageManager with a pointer to a filename that stores the id and length of each time series, and to a directory containing the aforesaid file as well as data files of stored time series Parameters ---------- filename: string (optional) Name o... | 5 | stack_v2_sparse_classes_30k_train_030338 | Implement the Python class `FileStorageManager` described below.
Class description:
A file storage manager class that manages the persistent storage of our individual time series. Parameters ---------- filename: string (optional) Name of pickle file to stores the id and length of each time series. Default is 'ts_index... | Implement the Python class `FileStorageManager` described below.
Class description:
A file storage manager class that manages the persistent storage of our individual time series. Parameters ---------- filename: string (optional) Name of pickle file to stores the id and length of each time series. Default is 'ts_index... | 2b2bd35bc62942f5ea53fe8788e279b071e32c9f | <|skeleton|>
class FileStorageManager:
"""A file storage manager class that manages the persistent storage of our individual time series. Parameters ---------- filename: string (optional) Name of pickle file to stores the id and length of each time series. Default is 'ts_index.pkl'. directory: string (optional) Pat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileStorageManager:
"""A file storage manager class that manages the persistent storage of our individual time series. Parameters ---------- filename: string (optional) Name of pickle file to stores the id and length of each time series. Default is 'ts_index.pkl'. directory: string (optional) Path to director... | the_stack_v2_python_sparse | timeseries/FileStorageManager.py | chinhuic/cs207project | train | 0 |
307e305ec4a99bce685c870c8fd1951888cfb2e6 | [
"from cepty.lib import load_api_data\nwith self.RESOURCE_DATA.open() as t:\n current_resource = json.load(t)\nwith self.USER_DATA.open() as r:\n current_client = json.load(r)\nresult_resource = load_api_data('resources')\nresult_clients = load_api_data('clients')\nself.assertEqual(type(result_resource), dict)... | <|body_start_0|>
from cepty.lib import load_api_data
with self.RESOURCE_DATA.open() as t:
current_resource = json.load(t)
with self.USER_DATA.open() as r:
current_client = json.load(r)
result_resource = load_api_data('resources')
result_clients = load_api_... | TestCase for actions_data module: operations on data | ActionsDataTestCase | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ActionsDataTestCase:
"""TestCase for actions_data module: operations on data"""
def test_lib_load_read_data(self):
"""Test load all API database"""
<|body_0|>
def test_lib_create_data_by_id(self):
"""Test create component of files database"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_007274 | 5,808 | permissive | [
{
"docstring": "Test load all API database",
"name": "test_lib_load_read_data",
"signature": "def test_lib_load_read_data(self)"
},
{
"docstring": "Test create component of files database",
"name": "test_lib_create_data_by_id",
"signature": "def test_lib_create_data_by_id(self)"
},
{... | 4 | null | Implement the Python class `ActionsDataTestCase` described below.
Class description:
TestCase for actions_data module: operations on data
Method signatures and docstrings:
- def test_lib_load_read_data(self): Test load all API database
- def test_lib_create_data_by_id(self): Test create component of files database
- ... | Implement the Python class `ActionsDataTestCase` described below.
Class description:
TestCase for actions_data module: operations on data
Method signatures and docstrings:
- def test_lib_load_read_data(self): Test load all API database
- def test_lib_create_data_by_id(self): Test create component of files database
- ... | e54ab10ef575ae8ef0347c7bb305d237d1bbf24c | <|skeleton|>
class ActionsDataTestCase:
"""TestCase for actions_data module: operations on data"""
def test_lib_load_read_data(self):
"""Test load all API database"""
<|body_0|>
def test_lib_create_data_by_id(self):
"""Test create component of files database"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ActionsDataTestCase:
"""TestCase for actions_data module: operations on data"""
def test_lib_load_read_data(self):
"""Test load all API database"""
from cepty.lib import load_api_data
with self.RESOURCE_DATA.open() as t:
current_resource = json.load(t)
with sel... | the_stack_v2_python_sparse | tests.py | xinyucindy/Techniques-web-INALCO-2020 | train | 0 |
e249de916a80f9caee58cf682e19414db49078f0 | [
"self.center = np.array(center)\nself.radius = radius\nself.x, self.y, self.z = self._coordinates_calculation(mesh_size)\nself.surface = self._draw_surface(surface_color)",
"theta = np.linspace(0, np.pi, mesh_size)\nphi = np.linspace(0, 2 * np.pi, mesh_size)\ntheta, phi = np.meshgrid(theta, phi)\nx = self.center[... | <|body_start_0|>
self.center = np.array(center)
self.radius = radius
self.x, self.y, self.z = self._coordinates_calculation(mesh_size)
self.surface = self._draw_surface(surface_color)
<|end_body_0|>
<|body_start_1|>
theta = np.linspace(0, np.pi, mesh_size)
phi = np.linsp... | Class for drawing spheres to use as monopoles. It inherits from the Surface abstract base class. ... Attributes ---------- center : numpy array x, y, z coordinates of the center. radius : float radius of the sphere. x, y, z : numpy array coordinates of the surface of the sphere. surface : list of a plotly go surface pl... | Sphere | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sphere:
"""Class for drawing spheres to use as monopoles. It inherits from the Surface abstract base class. ... Attributes ---------- center : numpy array x, y, z coordinates of the center. radius : float radius of the sphere. x, y, z : numpy array coordinates of the surface of the sphere. surfac... | stack_v2_sparse_classes_75kplus_train_007275 | 2,696 | permissive | [
{
"docstring": "Parameters ---------- center : list of float or numpy array x, y, z coordinates of the center. radius : float radius of the sphere. surface_color : str, optional rgb, rgba, hex, hsl, hsv, or named color string for the surface color, by default \"#636efa\". mesh_size : integer, optional size `n` ... | 2 | null | Implement the Python class `Sphere` described below.
Class description:
Class for drawing spheres to use as monopoles. It inherits from the Surface abstract base class. ... Attributes ---------- center : numpy array x, y, z coordinates of the center. radius : float radius of the sphere. x, y, z : numpy array coordinat... | Implement the Python class `Sphere` described below.
Class description:
Class for drawing spheres to use as monopoles. It inherits from the Surface abstract base class. ... Attributes ---------- center : numpy array x, y, z coordinates of the center. radius : float radius of the sphere. x, y, z : numpy array coordinat... | 3671086ef57c097fa055a908a65401eb6648c69a | <|skeleton|>
class Sphere:
"""Class for drawing spheres to use as monopoles. It inherits from the Surface abstract base class. ... Attributes ---------- center : numpy array x, y, z coordinates of the center. radius : float radius of the sphere. x, y, z : numpy array coordinates of the surface of the sphere. surfac... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Sphere:
"""Class for drawing spheres to use as monopoles. It inherits from the Surface abstract base class. ... Attributes ---------- center : numpy array x, y, z coordinates of the center. radius : float radius of the sphere. x, y, z : numpy array coordinates of the surface of the sphere. surface : list of a... | the_stack_v2_python_sparse | pyrodash/geometrics/sphere.py | Raudcu/pyrodash | train | 1 |
50dd9c5ce88580c36135c47cc841d18bd419fd56 | [
"assert read_limit is not None\nself.dialect = dialect\nself.fqfn = fqfn\nself.field_cnt: Optional[int] = None\nself.record_cnt: Optional[int] = None\nself.record_cnt_is_est: Optional[bool] = None\nself.read_limit: int = read_limit",
"if os.path.getsize(self.fqfn) == 0:\n raise IOErrorEmptyFile('Empty File')\n... | <|body_start_0|>
assert read_limit is not None
self.dialect = dialect
self.fqfn = fqfn
self.field_cnt: Optional[int] = None
self.record_cnt: Optional[int] = None
self.record_cnt_is_est: Optional[bool] = None
self.read_limit: int = read_limit
<|end_body_0|>
<|body... | Determines type of file - mostly using csv.Sniffer() Populates public variables: - format_type - dialect - record_cnt | FileTyper | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileTyper:
"""Determines type of file - mostly using csv.Sniffer() Populates public variables: - format_type - dialect - record_cnt"""
def __init__(self, dialect: csvhelper.Dialect, fqfn: str, read_limit: int=-1) -> None:
"""Arguments: - dialect = a csv dialect - should be valid, not... | stack_v2_sparse_classes_75kplus_train_007276 | 3,559 | permissive | [
{
"docstring": "Arguments: - dialect = a csv dialect - should be valid, not empty - fqfn = fully qualified file name - read_limit = default is -1, which means unlimited",
"name": "__init__",
"signature": "def __init__(self, dialect: csvhelper.Dialect, fqfn: str, read_limit: int=-1) -> None"
},
{
... | 3 | null | Implement the Python class `FileTyper` described below.
Class description:
Determines type of file - mostly using csv.Sniffer() Populates public variables: - format_type - dialect - record_cnt
Method signatures and docstrings:
- def __init__(self, dialect: csvhelper.Dialect, fqfn: str, read_limit: int=-1) -> None: Ar... | Implement the Python class `FileTyper` described below.
Class description:
Determines type of file - mostly using csv.Sniffer() Populates public variables: - format_type - dialect - record_cnt
Method signatures and docstrings:
- def __init__(self, dialect: csvhelper.Dialect, fqfn: str, read_limit: int=-1) -> None: Ar... | 133e927d150fa05317784246df69591dada648bb | <|skeleton|>
class FileTyper:
"""Determines type of file - mostly using csv.Sniffer() Populates public variables: - format_type - dialect - record_cnt"""
def __init__(self, dialect: csvhelper.Dialect, fqfn: str, read_limit: int=-1) -> None:
"""Arguments: - dialect = a csv dialect - should be valid, not... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileTyper:
"""Determines type of file - mostly using csv.Sniffer() Populates public variables: - format_type - dialect - record_cnt"""
def __init__(self, dialect: csvhelper.Dialect, fqfn: str, read_limit: int=-1) -> None:
"""Arguments: - dialect = a csv dialect - should be valid, not empty - fqfn... | the_stack_v2_python_sparse | datagristle/file_type.py | kenfar/DataGristle | train | 91 |
2be4fb5d6a21dbf800051e22d04de0fcb03e9c30 | [
"try:\n auth_token = decrypt_auth_token(request)\nexcept json.decoder.JSONDecodeError:\n return JsonResponse({'success': False, 'msg': 'Error: JSON could not be parsed'}, status=400)\nresult = AccountProcess.account_lookup(auth_token, account_no)\nif not result['success']:\n return JsonResponse({'success':... | <|body_start_0|>
try:
auth_token = decrypt_auth_token(request)
except json.decoder.JSONDecodeError:
return JsonResponse({'success': False, 'msg': 'Error: JSON could not be parsed'}, status=400)
result = AccountProcess.account_lookup(auth_token, account_no)
if not ... | AccountView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountView:
def get(self, request, account_no=None):
"""View method for retrieving account information"""
<|body_0|>
def post(self, request):
"""View method for creating (opening) a new bank account"""
<|body_1|>
def delete(self, request, account_no=Non... | stack_v2_sparse_classes_75kplus_train_007277 | 23,949 | no_license | [
{
"docstring": "View method for retrieving account information",
"name": "get",
"signature": "def get(self, request, account_no=None)"
},
{
"docstring": "View method for creating (opening) a new bank account",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring... | 3 | null | Implement the Python class `AccountView` described below.
Class description:
Implement the AccountView class.
Method signatures and docstrings:
- def get(self, request, account_no=None): View method for retrieving account information
- def post(self, request): View method for creating (opening) a new bank account
- d... | Implement the Python class `AccountView` described below.
Class description:
Implement the AccountView class.
Method signatures and docstrings:
- def get(self, request, account_no=None): View method for retrieving account information
- def post(self, request): View method for creating (opening) a new bank account
- d... | 5d105e624f3f31637834559b1760864606b43e61 | <|skeleton|>
class AccountView:
def get(self, request, account_no=None):
"""View method for retrieving account information"""
<|body_0|>
def post(self, request):
"""View method for creating (opening) a new bank account"""
<|body_1|>
def delete(self, request, account_no=Non... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccountView:
def get(self, request, account_no=None):
"""View method for retrieving account information"""
try:
auth_token = decrypt_auth_token(request)
except json.decoder.JSONDecodeError:
return JsonResponse({'success': False, 'msg': 'Error: JSON could not be ... | the_stack_v2_python_sparse | bankapi/views.py | CS160-Team2-Online-Banking/Gradient-Bank-Web-Application | train | 0 | |
78db40fb04392f1ed8f704f94d25b288d06de41f | [
"super().__init__()\nself.land_model_path = land_model_path\nself.sky_model_path = sky_model_path\nwith open(self.land_model_path, 'rb') as f:\n ckpt = pickle.load(f)\n self.ground = ckpt['G_ema'].eval()\n self.ground.rendering_kwargs['white_back'] = False\n if 'world2cam_poses' in ckpt:\n self.w... | <|body_start_0|>
super().__init__()
self.land_model_path = land_model_path
self.sky_model_path = sky_model_path
with open(self.land_model_path, 'rb') as f:
ckpt = pickle.load(f)
self.ground = ckpt['G_ema'].eval()
self.ground.rendering_kwargs['white_bac... | Extendable triplane wrapper. | ModelFull | [
"CC-BY-4.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelFull:
"""Extendable triplane wrapper."""
def __init__(self, land_model_path, sky_model_path):
"""Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containin... | stack_v2_sparse_classes_75kplus_train_007278 | 3,113 | permissive | [
{
"docstring": "Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containing the path to sky model",
"name": "__init__",
"signature": "def __init__(self, land_model_path, sky_model_... | 2 | stack_v2_sparse_classes_30k_train_029959 | Implement the Python class `ModelFull` described below.
Class description:
Extendable triplane wrapper.
Method signatures and docstrings:
- def __init__(self, land_model_path, sky_model_path): Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, ... | Implement the Python class `ModelFull` described below.
Class description:
Extendable triplane wrapper.
Method signatures and docstrings:
- def __init__(self, land_model_path, sky_model_path): Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, ... | c1ae273841592fce4c993bf35cdd0a6424e73da4 | <|skeleton|>
class ModelFull:
"""Extendable triplane wrapper."""
def __init__(self, land_model_path, sky_model_path):
"""Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelFull:
"""Extendable triplane wrapper."""
def __init__(self, land_model_path, sky_model_path):
"""Initialize wrapper for full model, consisting of land and sky. Args: land_model_path: str containing the path to land model, using the triplane backbone sky_model_path: str containing the path to... | the_stack_v2_python_sparse | persistent-nature/models/triplane/model_full.py | ishine/google-research | train | 0 |
e33c1d51dcdd56cec88fb87ea375a93e7bc3b41b | [
"from gui.main_form import MainForm\nself.main_form: MainForm = main_form\nself.menu = None\nself.file_menu = None\nself.report_menu = None\nself.scoring_menu = None",
"self.menu = tkinter.Menu(self.main_form.root)\nself.main_form.root.config(menu=self.menu)\nself.file_menu = tkinter.Menu(self.menu, tearoff=False... | <|body_start_0|>
from gui.main_form import MainForm
self.main_form: MainForm = main_form
self.menu = None
self.file_menu = None
self.report_menu = None
self.scoring_menu = None
<|end_body_0|>
<|body_start_1|>
self.menu = tkinter.Menu(self.main_form.root)
... | Menü-Leiste der MainForm | Menu | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Menu:
"""Menü-Leiste der MainForm"""
def __init__(self, main_form):
"""Konstruktor Args: main_form (MainForm): MainForm"""
<|body_0|>
def create(self):
"""Erstellen des Menüs"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from gui.main_form imp... | stack_v2_sparse_classes_75kplus_train_007279 | 3,055 | no_license | [
{
"docstring": "Konstruktor Args: main_form (MainForm): MainForm",
"name": "__init__",
"signature": "def __init__(self, main_form)"
},
{
"docstring": "Erstellen des Menüs",
"name": "create",
"signature": "def create(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004646 | Implement the Python class `Menu` described below.
Class description:
Menü-Leiste der MainForm
Method signatures and docstrings:
- def __init__(self, main_form): Konstruktor Args: main_form (MainForm): MainForm
- def create(self): Erstellen des Menüs | Implement the Python class `Menu` described below.
Class description:
Menü-Leiste der MainForm
Method signatures and docstrings:
- def __init__(self, main_form): Konstruktor Args: main_form (MainForm): MainForm
- def create(self): Erstellen des Menüs
<|skeleton|>
class Menu:
"""Menü-Leiste der MainForm"""
d... | 349aad3f5a71374f062a7a3b50d827dbf8e99bfe | <|skeleton|>
class Menu:
"""Menü-Leiste der MainForm"""
def __init__(self, main_form):
"""Konstruktor Args: main_form (MainForm): MainForm"""
<|body_0|>
def create(self):
"""Erstellen des Menüs"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Menu:
"""Menü-Leiste der MainForm"""
def __init__(self, main_form):
"""Konstruktor Args: main_form (MainForm): MainForm"""
from gui.main_form import MainForm
self.main_form: MainForm = main_form
self.menu = None
self.file_menu = None
self.report_menu = None... | the_stack_v2_python_sparse | gui/menu.py | RobFro96/Talentiadeverwaltung | train | 0 |
5d53b3ad19fb6f823367509a2aac29e7ab079f79 | [
"class widgets:\n pass\nself.mca = mca\nself.widgets = widgets()\nself.widgets.top = t = Pmw.Dialog(command=self.menu_ok_cancel, buttons=('OK', 'Apply', 'Cancel'), title='mcaControlPresets')\ntop = t.component('dialogchildsite')\nself.presets = self.mca.get_presets()\nrow = Frame(top)\nrow.pack()\nself.widgets.r... | <|body_start_0|>
class widgets:
pass
self.mca = mca
self.widgets = widgets()
self.widgets.top = t = Pmw.Dialog(command=self.menu_ok_cancel, buttons=('OK', 'Apply', 'Cancel'), title='mcaControlPresets')
top = t.component('dialogchildsite')
self.presets = self.m... | mcaControlPresets | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mcaControlPresets:
def __init__(self, mca):
"""Creates a new GUI window for calibrating energy for an Mca object. The preset live time, real time, start channel, end channel and total counts can be controlled. Inputs: mca: An Mca instance for which the presets are to be controlled."""
... | stack_v2_sparse_classes_75kplus_train_007280 | 3,323 | no_license | [
{
"docstring": "Creates a new GUI window for calibrating energy for an Mca object. The preset live time, real time, start channel, end channel and total counts can be controlled. Inputs: mca: An Mca instance for which the presets are to be controlled.",
"name": "__init__",
"signature": "def __init__(sel... | 2 | null | Implement the Python class `mcaControlPresets` described below.
Class description:
Implement the mcaControlPresets class.
Method signatures and docstrings:
- def __init__(self, mca): Creates a new GUI window for calibrating energy for an Mca object. The preset live time, real time, start channel, end channel and tota... | Implement the Python class `mcaControlPresets` described below.
Class description:
Implement the mcaControlPresets class.
Method signatures and docstrings:
- def __init__(self, mca): Creates a new GUI window for calibrating energy for an Mca object. The preset live time, real time, start channel, end channel and tota... | 676cb0f4b26661fcedf5cdf94fc1aa3d5d630666 | <|skeleton|>
class mcaControlPresets:
def __init__(self, mca):
"""Creates a new GUI window for calibrating energy for an Mca object. The preset live time, real time, start channel, end channel and total counts can be controlled. Inputs: mca: An Mca instance for which the presets are to be controlled."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class mcaControlPresets:
def __init__(self, mca):
"""Creates a new GUI window for calibrating energy for an Mca object. The preset live time, real time, start channel, end channel and total counts can be controlled. Inputs: mca: An Mca instance for which the presets are to be controlled."""
class wi... | the_stack_v2_python_sparse | gsecars/mcaControlPresets.py | jskinner53/epicsPython | train | 0 | |
b59c3ecadbce6c42e2171100fff4fc97271f77f3 | [
"ui.info(ui.green, '::', ui.reset, ui.bold, 'Reading', mpml_path, '\\n')\nself.worktree = worktree\nself.mpml_path = mpml_path\nself.meta_package = qipkg.metapackage.MetaPackage(self.worktree, self.mpml_path)\nself.pml_builders = list()\npml_paths = self.meta_package.pml_paths\nfor pml_path in pml_paths:\n pml_b... | <|body_start_0|>
ui.info(ui.green, '::', ui.reset, ui.bold, 'Reading', mpml_path, '\n')
self.worktree = worktree
self.mpml_path = mpml_path
self.meta_package = qipkg.metapackage.MetaPackage(self.worktree, self.mpml_path)
self.pml_builders = list()
pml_paths = self.meta_pa... | Build a meta package from a mpml file | MetaPMLBuilder | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetaPMLBuilder:
"""Build a meta package from a mpml file"""
def __init__(self, mpml_path, worktree=None):
"""MetaPMLBuilder Init"""
<|body_0|>
def configure(self):
"""Configure every project"""
<|body_1|>
def build(self):
"""Build every proje... | stack_v2_sparse_classes_75kplus_train_007281 | 3,314 | permissive | [
{
"docstring": "MetaPMLBuilder Init",
"name": "__init__",
"signature": "def __init__(self, mpml_path, worktree=None)"
},
{
"docstring": "Configure every project",
"name": "configure",
"signature": "def configure(self)"
},
{
"docstring": "Build every project",
"name": "build",... | 6 | stack_v2_sparse_classes_30k_train_017500 | Implement the Python class `MetaPMLBuilder` described below.
Class description:
Build a meta package from a mpml file
Method signatures and docstrings:
- def __init__(self, mpml_path, worktree=None): MetaPMLBuilder Init
- def configure(self): Configure every project
- def build(self): Build every project
- def instal... | Implement the Python class `MetaPMLBuilder` described below.
Class description:
Build a meta package from a mpml file
Method signatures and docstrings:
- def __init__(self, mpml_path, worktree=None): MetaPMLBuilder Init
- def configure(self): Configure every project
- def build(self): Build every project
- def instal... | efea6fa3744664348717fe5e8df708a3cf392072 | <|skeleton|>
class MetaPMLBuilder:
"""Build a meta package from a mpml file"""
def __init__(self, mpml_path, worktree=None):
"""MetaPMLBuilder Init"""
<|body_0|>
def configure(self):
"""Configure every project"""
<|body_1|>
def build(self):
"""Build every proje... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MetaPMLBuilder:
"""Build a meta package from a mpml file"""
def __init__(self, mpml_path, worktree=None):
"""MetaPMLBuilder Init"""
ui.info(ui.green, '::', ui.reset, ui.bold, 'Reading', mpml_path, '\n')
self.worktree = worktree
self.mpml_path = mpml_path
self.meta_... | the_stack_v2_python_sparse | python/qipkg/metabuilder.py | aldebaran/qibuild | train | 60 |
fb5d8f27cd7ebe851f0c81ee8e1e3a920d8e0eaf | [
"super(CrystalGraphConvNet, self).__init__()\nself.classification = classification\nself.embedding = nn.Linear(orig_atom_fea_len, atom_fea_len)\nself.convs = nn.ModuleList([ConvLayer(atom_fea_len=atom_fea_len, nbr_fea_len=nbr_fea_len) for _ in range(n_conv)])\nself.conv_to_fc = nn.Linear(atom_fea_len, h_fea_len)\ns... | <|body_start_0|>
super(CrystalGraphConvNet, self).__init__()
self.classification = classification
self.embedding = nn.Linear(orig_atom_fea_len, atom_fea_len)
self.convs = nn.ModuleList([ConvLayer(atom_fea_len=atom_fea_len, nbr_fea_len=nbr_fea_len) for _ in range(n_conv)])
self.co... | Create a crystal graph convolutional neural network for predicting total material properties. | CrystalGraphConvNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CrystalGraphConvNet:
"""Create a crystal graph convolutional neural network for predicting total material properties."""
def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea_len: int=128, n_h: int=1, classification: bool=False):
"""I... | stack_v2_sparse_classes_75kplus_train_007282 | 9,607 | permissive | [
{
"docstring": "Initialize CrystalGraphConvNet. Args: orig_atom_fea_len: int Number of atom features in the input. nbr_fea_len: int Number of bond features. atom_fea_len: int Number of hidden atom features in the convolutional layers. n_conv: int Number of convolutional layers. h_fea_len: int Number of hidden f... | 3 | stack_v2_sparse_classes_30k_train_036096 | Implement the Python class `CrystalGraphConvNet` described below.
Class description:
Create a crystal graph convolutional neural network for predicting total material properties.
Method signatures and docstrings:
- def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea... | Implement the Python class `CrystalGraphConvNet` described below.
Class description:
Create a crystal graph convolutional neural network for predicting total material properties.
Method signatures and docstrings:
- def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea... | 0b69b7d5b261f2f9af3984793c1295b9b80cd01a | <|skeleton|>
class CrystalGraphConvNet:
"""Create a crystal graph convolutional neural network for predicting total material properties."""
def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea_len: int=128, n_h: int=1, classification: bool=False):
"""I... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CrystalGraphConvNet:
"""Create a crystal graph convolutional neural network for predicting total material properties."""
def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea_len: int=128, n_h: int=1, classification: bool=False):
"""Initialize Cry... | the_stack_v2_python_sparse | src/gt4sd/frameworks/cgcnn/model.py | GT4SD/gt4sd-core | train | 239 |
56a32458e04eb10f005b4c94285b0608bb1a7ba5 | [
"curr = head\nwhile curr != None:\n stack.append(curr)\n if curr.child:\n self.flattenHelper(curr.child, stack)\n curr = curr.next",
"curr = head\nwhile curr != None:\n stack.append(curr)\n if curr.child:\n self.flatten(curr.child, stack)\n curr = curr.next",
"curr = head\nwhile ... | <|body_start_0|>
curr = head
while curr != None:
stack.append(curr)
if curr.child:
self.flattenHelper(curr.child, stack)
curr = curr.next
<|end_body_0|>
<|body_start_1|>
curr = head
while curr != None:
stack.append(curr)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def flattenHelper(self, head, stack):
""":type head: Node :rtype: Node"""
<|body_0|>
def flatten(self, head, stack):
""":type head: Node :rtype: Node"""
<|body_1|>
def printList(self, head):
""":type head: Node :rtype: Node"""
<... | stack_v2_sparse_classes_75kplus_train_007283 | 3,740 | no_license | [
{
"docstring": ":type head: Node :rtype: Node",
"name": "flattenHelper",
"signature": "def flattenHelper(self, head, stack)"
},
{
"docstring": ":type head: Node :rtype: Node",
"name": "flatten",
"signature": "def flatten(self, head, stack)"
},
{
"docstring": ":type head: Node :rt... | 3 | stack_v2_sparse_classes_30k_train_043988 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def flattenHelper(self, head, stack): :type head: Node :rtype: Node
- def flatten(self, head, stack): :type head: Node :rtype: Node
- def printList(self, head): :type head: Node ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def flattenHelper(self, head, stack): :type head: Node :rtype: Node
- def flatten(self, head, stack): :type head: Node :rtype: Node
- def printList(self, head): :type head: Node ... | 001c48f468b368f4e11d2cae6d134c3578d93550 | <|skeleton|>
class Solution:
def flattenHelper(self, head, stack):
""":type head: Node :rtype: Node"""
<|body_0|>
def flatten(self, head, stack):
""":type head: Node :rtype: Node"""
<|body_1|>
def printList(self, head):
""":type head: Node :rtype: Node"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def flattenHelper(self, head, stack):
""":type head: Node :rtype: Node"""
curr = head
while curr != None:
stack.append(curr)
if curr.child:
self.flattenHelper(curr.child, stack)
curr = curr.next
def flatten(self, head, ... | the_stack_v2_python_sparse | dll/flatten-muli-list.py | swapnesh-chaubal/algorithms | train | 0 | |
bb2b3cc6a66922612ff05e4ef2f2570d560087c1 | [
"if not is_exe(exe_path):\n msg = '{0} is not an executable'.format(exe_path)\n raise NotExecutableError(msg)\nself._exe_path = exe_path",
"self.__build_cmd(infile, outfile)\nif dry_run:\n results = Results(self._cmd, self._outfilename, None, None)\nelse:\n pipe = subprocess.run(self._cmd, shell=True,... | <|body_start_0|>
if not is_exe(exe_path):
msg = '{0} is not an executable'.format(exe_path)
raise NotExecutableError(msg)
self._exe_path = exe_path
<|end_body_0|>
<|body_start_1|>
self.__build_cmd(infile, outfile)
if dry_run:
results = Results(self._c... | Class for working with MUSCLE | Muscle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Muscle:
"""Class for working with MUSCLE"""
def __init__(self, exe_path):
"""Instantiate with location of executable"""
<|body_0|>
def run(self, infile, outfile=None, dry_run=False):
"""Run MUSCLE on the single passed file Writes the alignment result alongside th... | stack_v2_sparse_classes_75kplus_train_007284 | 2,375 | permissive | [
{
"docstring": "Instantiate with location of executable",
"name": "__init__",
"signature": "def __init__(self, exe_path)"
},
{
"docstring": "Run MUSCLE on the single passed file Writes the alignment result alongside the input file Returns a tuple of output file, and the STDOUT, STDERR returned b... | 3 | stack_v2_sparse_classes_30k_train_039126 | Implement the Python class `Muscle` described below.
Class description:
Class for working with MUSCLE
Method signatures and docstrings:
- def __init__(self, exe_path): Instantiate with location of executable
- def run(self, infile, outfile=None, dry_run=False): Run MUSCLE on the single passed file Writes the alignmen... | Implement the Python class `Muscle` described below.
Class description:
Class for working with MUSCLE
Method signatures and docstrings:
- def __init__(self, exe_path): Instantiate with location of executable
- def run(self, infile, outfile=None, dry_run=False): Run MUSCLE on the single passed file Writes the alignmen... | a3c64198aad3709a5c4d969f48ae0af11fdc25db | <|skeleton|>
class Muscle:
"""Class for working with MUSCLE"""
def __init__(self, exe_path):
"""Instantiate with location of executable"""
<|body_0|>
def run(self, infile, outfile=None, dry_run=False):
"""Run MUSCLE on the single passed file Writes the alignment result alongside th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Muscle:
"""Class for working with MUSCLE"""
def __init__(self, exe_path):
"""Instantiate with location of executable"""
if not is_exe(exe_path):
msg = '{0} is not an executable'.format(exe_path)
raise NotExecutableError(msg)
self._exe_path = exe_path
d... | the_stack_v2_python_sparse | metapy/pycits/muscle.py | peterthorpe5/public_scripts | train | 35 |
bdc6963a4cd8a0dce0b434bcbd93fb72337706ff | [
"if isinstance(dataset, lgb.Dataset):\n x = LGBMUtils.to_array(dataset=dataset.data)\n if dataset.label is None:\n return x\n y = LGBMUtils.to_array(dataset=dataset.label)\n return LGBMUtils.to_array(LGBMUtils.concatenate_x_y(x=x, y=y)[0])\ntry:\n return MLUtils.to_array(dataset=dataset)\nexce... | <|body_start_0|>
if isinstance(dataset, lgb.Dataset):
x = LGBMUtils.to_array(dataset=dataset.data)
if dataset.label is None:
return x
y = LGBMUtils.to_array(dataset=dataset.label)
return LGBMUtils.to_array(LGBMUtils.concatenate_x_y(x=x, y=y)[0])
... | Utilities functions for the LightGBM framework. | LGBMUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LGBMUtils:
"""Utilities functions for the LightGBM framework."""
def to_array(dataset: LGBMTypes.DatasetType) -> np.ndarray:
"""Convert the given dataset to np.ndarray. :param dataset: The dataset to convert. Must be one of {lgb.Dataset, pd.DataFrame, pd.Series, scipy.sparse.base.spm... | stack_v2_sparse_classes_75kplus_train_007285 | 8,278 | permissive | [
{
"docstring": "Convert the given dataset to np.ndarray. :param dataset: The dataset to convert. Must be one of {lgb.Dataset, pd.DataFrame, pd.Series, scipy.sparse.base.spmatrix, list, tuple, dict}. :return: The dataset as a ndarray. :raise MLRunInvalidArgumentError: If the dataset type is not supported.",
... | 3 | stack_v2_sparse_classes_30k_test_002354 | Implement the Python class `LGBMUtils` described below.
Class description:
Utilities functions for the LightGBM framework.
Method signatures and docstrings:
- def to_array(dataset: LGBMTypes.DatasetType) -> np.ndarray: Convert the given dataset to np.ndarray. :param dataset: The dataset to convert. Must be one of {lg... | Implement the Python class `LGBMUtils` described below.
Class description:
Utilities functions for the LightGBM framework.
Method signatures and docstrings:
- def to_array(dataset: LGBMTypes.DatasetType) -> np.ndarray: Convert the given dataset to np.ndarray. :param dataset: The dataset to convert. Must be one of {lg... | b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77 | <|skeleton|>
class LGBMUtils:
"""Utilities functions for the LightGBM framework."""
def to_array(dataset: LGBMTypes.DatasetType) -> np.ndarray:
"""Convert the given dataset to np.ndarray. :param dataset: The dataset to convert. Must be one of {lgb.Dataset, pd.DataFrame, pd.Series, scipy.sparse.base.spm... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LGBMUtils:
"""Utilities functions for the LightGBM framework."""
def to_array(dataset: LGBMTypes.DatasetType) -> np.ndarray:
"""Convert the given dataset to np.ndarray. :param dataset: The dataset to convert. Must be one of {lgb.Dataset, pd.DataFrame, pd.Series, scipy.sparse.base.spmatrix, list, ... | the_stack_v2_python_sparse | mlrun/frameworks/lgbm/utils.py | mlrun/mlrun | train | 1,093 |
b4355d694ceab4f5fff69081caa592522f000319 | [
"self.dic = {}\nfor i in dictionary:\n num = len(i) - 2\n if num > 0:\n keyi = i[0] + str(num) + i[-1]\n else:\n keyi = i\n if keyi in self.dic:\n self.dic[keyi].append(i)\n else:\n self.dic[keyi] = [i]",
"if len(word) >= 2:\n keyw = word[0] + str(len(word) - 2) + wor... | <|body_start_0|>
self.dic = {}
for i in dictionary:
num = len(i) - 2
if num > 0:
keyi = i[0] + str(num) + i[-1]
else:
keyi = i
if keyi in self.dic:
self.dic[keyi].append(i)
else:
s... | ValidWordAbbr | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
"""check if a word is unique. :type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_007286 | 955 | no_license | [
{
"docstring": "initialize your data structure here. :type dictionary: List[str]",
"name": "__init__",
"signature": "def __init__(self, dictionary)"
},
{
"docstring": "check if a word is unique. :type word: str :rtype: bool",
"name": "isUnique",
"signature": "def isUnique(self, word)"
... | 2 | stack_v2_sparse_classes_30k_train_035132 | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str]
- def isUnique(self, word): check if a word is unique. :type word: str ... | Implement the Python class `ValidWordAbbr` described below.
Class description:
Implement the ValidWordAbbr class.
Method signatures and docstrings:
- def __init__(self, dictionary): initialize your data structure here. :type dictionary: List[str]
- def isUnique(self, word): check if a word is unique. :type word: str ... | 853a6257e17f79a816f5e877843a9409f82a8c13 | <|skeleton|>
class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
<|body_0|>
def isUnique(self, word):
"""check if a word is unique. :type word: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ValidWordAbbr:
def __init__(self, dictionary):
"""initialize your data structure here. :type dictionary: List[str]"""
self.dic = {}
for i in dictionary:
num = len(i) - 2
if num > 0:
keyi = i[0] + str(num) + i[-1]
else:
... | the_stack_v2_python_sparse | uniquewordabbreviation.py | yibeihuang/LeetCode | train | 0 | |
1342c87f11545bc2335cb40008d6d7d532c13698 | [
"self.flavors_client.default_headers['Accept'] = 'application/xml'\nself.flavors_client.default_headers['Content-Type'] = 'application/json'\nresponse = self.flavors_client.list_flavors()\nself.assertEqual(response.status_code, 200, 'Unexpected status code returned. Expected: {0} Received: {1}'.format(200, response... | <|body_start_0|>
self.flavors_client.default_headers['Accept'] = 'application/xml'
self.flavors_client.default_headers['Content-Type'] = 'application/json'
response = self.flavors_client.list_flavors()
self.assertEqual(response.status_code, 200, 'Unexpected status code returned. Expected... | XMLDeprecationTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLDeprecationTest:
def test_get_request_accept_xml_ignored(self):
"""A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The follow... | stack_v2_sparse_classes_75kplus_train_007287 | 7,393 | permissive | [
{
"docstring": "A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The following assertions occur: - The response code is 200 - The response content does n... | 6 | stack_v2_sparse_classes_30k_train_042392 | Implement the Python class `XMLDeprecationTest` described below.
Class description:
Implement the XMLDeprecationTest class.
Method signatures and docstrings:
- def test_get_request_accept_xml_ignored(self): A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only... | Implement the Python class `XMLDeprecationTest` described below.
Class description:
Implement the XMLDeprecationTest class.
Method signatures and docstrings:
- def test_get_request_accept_xml_ignored(self): A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only... | 30f0e64672676c3f90b4a582fe90fac6621475b3 | <|skeleton|>
class XMLDeprecationTest:
def test_get_request_accept_xml_ignored(self):
"""A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The follow... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XMLDeprecationTest:
def test_get_request_accept_xml_ignored(self):
"""A GET request passing only the accept header as xml is ignored Request a list of available flavors passing only the accept header as xml and ensure that the header is ignored returning a valid json response. The following assertions... | the_stack_v2_python_sparse | cloudroast/compute/api/test_xml_deprecation.py | RULCSoft/cloudroast | train | 1 | |
ac1f8761686876816d006b6cdeae5ff47b601dc9 | [
"srvs = self.metadata.single_logout_service(idp_entity_id, binding, 'idpsso')\ndestination = destinations(srvs)[0]\nlogger.info('destination to provider: %s' % destination)\nstatus = samlp.Status(status_code=samlp.StatusCode(value=status_code, text='\\n'), status_message=samlp.StatusMessage(text='logout success'))\... | <|body_start_0|>
srvs = self.metadata.single_logout_service(idp_entity_id, binding, 'idpsso')
destination = destinations(srvs)[0]
logger.info('destination to provider: %s' % destination)
status = samlp.Status(status_code=samlp.StatusCode(value=status_code, text='\n'), status_message=saml... | extensions and changes for pysaml2.client.Saml2Client | Saml2Client | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Saml2Client:
"""extensions and changes for pysaml2.client.Saml2Client"""
def make_logout_response(self, idp_entity_id, request_id, status_code, binding=BINDING_HTTP_REDIRECT):
"""XXX There were issues with an explicit closing tag on StatusCode. Check wether we still need this. XXX Co... | stack_v2_sparse_classes_75kplus_train_007288 | 3,379 | no_license | [
{
"docstring": "XXX There were issues with an explicit closing tag on StatusCode. Check wether we still need this. XXX Constructs a LogoutResponse :param idp_entity_id: The entityid of the IdP that want to do the logout :param request_id: The Id of the request we are replying to :param status_code: The status c... | 2 | stack_v2_sparse_classes_30k_train_035145 | Implement the Python class `Saml2Client` described below.
Class description:
extensions and changes for pysaml2.client.Saml2Client
Method signatures and docstrings:
- def make_logout_response(self, idp_entity_id, request_id, status_code, binding=BINDING_HTTP_REDIRECT): XXX There were issues with an explicit closing t... | Implement the Python class `Saml2Client` described below.
Class description:
extensions and changes for pysaml2.client.Saml2Client
Method signatures and docstrings:
- def make_logout_response(self, idp_entity_id, request_id, status_code, binding=BINDING_HTTP_REDIRECT): XXX There were issues with an explicit closing t... | 2d0dc093ddf433e58c05d117f78f32d46949b915 | <|skeleton|>
class Saml2Client:
"""extensions and changes for pysaml2.client.Saml2Client"""
def make_logout_response(self, idp_entity_id, request_id, status_code, binding=BINDING_HTTP_REDIRECT):
"""XXX There were issues with an explicit closing tag on StatusCode. Check wether we still need this. XXX Co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Saml2Client:
"""extensions and changes for pysaml2.client.Saml2Client"""
def make_logout_response(self, idp_entity_id, request_id, status_code, binding=BINDING_HTTP_REDIRECT):
"""XXX There were issues with an explicit closing tag on StatusCode. Check wether we still need this. XXX Constructs a Lo... | the_stack_v2_python_sparse | hl/pas/samlplugin/client.py | Haufe-Lexware/hl.pas.samlplugin | train | 1 |
e3e256461538bec64d397dc7af8e3bd1fe5eb8fc | [
"super(RandomSamplingConfigurationGenerator, self).__init__(settings_path)\nself.min_inter_distance = min_inter_distance\nself.num_attempts = num_attempts\nif distribution is not None:\n self.distance_distribution = distribution\nelif logarithmic:\n self.distance_distribution = LogarithmicDistributionFunction... | <|body_start_0|>
super(RandomSamplingConfigurationGenerator, self).__init__(settings_path)
self.min_inter_distance = min_inter_distance
self.num_attempts = num_attempts
if distribution is not None:
self.distance_distribution = distribution
elif logarithmic:
... | Implementation of ConfigurationGenerator that generates configurations by randomly placing molecules within a sphere of a given radius. | RandomSamplingConfigurationGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomSamplingConfigurationGenerator:
"""Implementation of ConfigurationGenerator that generates configurations by randomly placing molecules within a sphere of a given radius."""
def __init__(self, settings_path, radius=10, min_inter_distance=0.8, num_attempts=100, logarithmic=False, distri... | stack_v2_sparse_classes_75kplus_train_007289 | 7,451 | no_license | [
{
"docstring": "Constructs a new RandomSamplingConfigurationGenerator. Args: settings_path - Local path to '.ini' settings file with all relevant settings. radius - Radius of the sphere to place molecules in. min_inter_distance - Minimum intermolecular distance is this times the sum of the van der walls radii o... | 3 | null | Implement the Python class `RandomSamplingConfigurationGenerator` described below.
Class description:
Implementation of ConfigurationGenerator that generates configurations by randomly placing molecules within a sphere of a given radius.
Method signatures and docstrings:
- def __init__(self, settings_path, radius=10,... | Implement the Python class `RandomSamplingConfigurationGenerator` described below.
Class description:
Implementation of ConfigurationGenerator that generates configurations by randomly placing molecules within a sphere of a given radius.
Method signatures and docstrings:
- def __init__(self, settings_path, radius=10,... | eb413191f865968f6d6e76292bca09a94e08bef7 | <|skeleton|>
class RandomSamplingConfigurationGenerator:
"""Implementation of ConfigurationGenerator that generates configurations by randomly placing molecules within a sphere of a given radius."""
def __init__(self, settings_path, radius=10, min_inter_distance=0.8, num_attempts=100, logarithmic=False, distri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomSamplingConfigurationGenerator:
"""Implementation of ConfigurationGenerator that generates configurations by randomly placing molecules within a sphere of a given radius."""
def __init__(self, settings_path, radius=10, min_inter_distance=0.8, num_attempts=100, logarithmic=False, distribution=None):... | the_stack_v2_python_sparse | mbfit/configurations/configuration_generator_nb.py | agoetz/MB-Fit | train | 1 |
1abe9da6a20bb1086c0837faf9fd4e7af63f03e8 | [
"self._payment_dates = payment_dates\nself._payment_steps = payment_steps\nself._maturity = payment_dates[len(payment_dates) - 1]\nself._steps = payment_steps[len(payment_steps) - 1]\nself._bond_tree = {}",
"if not hw_tree._is_built:\n hw_tree.hw_prob()\n hw_tree.calibrate()",
"self.build_hw_tree(hw_tree)... | <|body_start_0|>
self._payment_dates = payment_dates
self._payment_steps = payment_steps
self._maturity = payment_dates[len(payment_dates) - 1]
self._steps = payment_steps[len(payment_steps) - 1]
self._bond_tree = {}
<|end_body_0|>
<|body_start_1|>
if not hw_tree._is_bui... | Representation of a Zero Coupon Bond | ZCBond | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZCBond:
"""Representation of a Zero Coupon Bond"""
def __init__(self, payment_dates, payment_steps):
"""Initialize a Zero Coupon Bond object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment dates payment_steps : array_like of shape (1, ) with inte... | stack_v2_sparse_classes_75kplus_train_007290 | 6,090 | no_license | [
{
"docstring": "Initialize a Zero Coupon Bond object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment dates payment_steps : array_like of shape (1, ) with integer payment steps that corresponds to the tree coupon_rates : scalar or array_like of shape (1, ) with the coupon ra... | 3 | stack_v2_sparse_classes_30k_test_000445 | Implement the Python class `ZCBond` described below.
Class description:
Representation of a Zero Coupon Bond
Method signatures and docstrings:
- def __init__(self, payment_dates, payment_steps): Initialize a Zero Coupon Bond object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment ... | Implement the Python class `ZCBond` described below.
Class description:
Representation of a Zero Coupon Bond
Method signatures and docstrings:
- def __init__(self, payment_dates, payment_steps): Initialize a Zero Coupon Bond object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment ... | 9f710a8de56fb9b4456c6f98be91f4b22ef5ede5 | <|skeleton|>
class ZCBond:
"""Representation of a Zero Coupon Bond"""
def __init__(self, payment_dates, payment_steps):
"""Initialize a Zero Coupon Bond object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment dates payment_steps : array_like of shape (1, ) with inte... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZCBond:
"""Representation of a Zero Coupon Bond"""
def __init__(self, payment_dates, payment_steps):
"""Initialize a Zero Coupon Bond object Parameters ---------- payment_dates : array_like of shape (1, ) with datetime payment dates payment_steps : array_like of shape (1, ) with integer payment s... | the_stack_v2_python_sparse | Hull-White Model/simple_bond.py | jesusmramirez/Term-Structure-Models | train | 1 |
2275bb3ac505e1c2f83836bb1a13346cc516b341 | [
"self.headers = headers\nself.retries = retries\nself.proxies = proxies\nself.downder = Downder(headers, retries, proxies, delay, timeout)\nself.timeout = timeout",
"page = self.downder.download(url)\nsoup_all = BeautifulSoup(page, 'lxml')\ngl_item_list = soup_all.find_all('li', attrs={'class': 'gl-item'})\nrow_l... | <|body_start_0|>
self.headers = headers
self.retries = retries
self.proxies = proxies
self.downder = Downder(headers, retries, proxies, delay, timeout)
self.timeout = timeout
<|end_body_0|>
<|body_start_1|>
page = self.downder.download(url)
soup_all = BeautifulSo... | 爬虫类 | ItemSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemSpider:
"""爬虫类"""
def __init__(self, headers=None, retries=3, proxies=None, delay=3, timeout=30):
"""初始化"""
<|body_0|>
def find_all(self, url):
"""通过一个网址,爬取信息"""
<|body_1|>
def fetch_data(self, url, filename, page_start, page_end, page_offset, ca... | stack_v2_sparse_classes_75kplus_train_007291 | 6,930 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self, headers=None, retries=3, proxies=None, delay=3, timeout=30)"
},
{
"docstring": "通过一个网址,爬取信息",
"name": "find_all",
"signature": "def find_all(self, url)"
},
{
"docstring": "根据页数搜索所有信息",
"name": "fetch_d... | 3 | stack_v2_sparse_classes_30k_train_040589 | Implement the Python class `ItemSpider` described below.
Class description:
爬虫类
Method signatures and docstrings:
- def __init__(self, headers=None, retries=3, proxies=None, delay=3, timeout=30): 初始化
- def find_all(self, url): 通过一个网址,爬取信息
- def fetch_data(self, url, filename, page_start, page_end, page_offset, callba... | Implement the Python class `ItemSpider` described below.
Class description:
爬虫类
Method signatures and docstrings:
- def __init__(self, headers=None, retries=3, proxies=None, delay=3, timeout=30): 初始化
- def find_all(self, url): 通过一个网址,爬取信息
- def fetch_data(self, url, filename, page_start, page_end, page_offset, callba... | 173f3a5fa24176df4c53bd36771cc733a1221dfd | <|skeleton|>
class ItemSpider:
"""爬虫类"""
def __init__(self, headers=None, retries=3, proxies=None, delay=3, timeout=30):
"""初始化"""
<|body_0|>
def find_all(self, url):
"""通过一个网址,爬取信息"""
<|body_1|>
def fetch_data(self, url, filename, page_start, page_end, page_offset, ca... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ItemSpider:
"""爬虫类"""
def __init__(self, headers=None, retries=3, proxies=None, delay=3, timeout=30):
"""初始化"""
self.headers = headers
self.retries = retries
self.proxies = proxies
self.downder = Downder(headers, retries, proxies, delay, timeout)
self.timeo... | the_stack_v2_python_sparse | 0303system-yanchunwei/joker_work/core/down.py | Joker2018goon/myGitRepo | train | 1 |
fa23566dd807c395bfac9129e768adff19f6d205 | [
"if not citations:\n return 0\ntotal = len(citations)\ncount = 0\nleft, right = (0, total)\nwhile left < right:\n mid = left + (right - left) // 2\n count = total - mid\n if citations[mid] < count:\n left = mid + 1\n else:\n right = mid\nif left == len(citations):\n return 0\nelif ci... | <|body_start_0|>
if not citations:
return 0
total = len(citations)
count = 0
left, right = (0, total)
while left < right:
mid = left + (right - left) // 2
count = total - mid
if citations[mid] < count:
left = mid + 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hIndex_template2(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex_template3(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not citation... | stack_v2_sparse_classes_75kplus_train_007292 | 1,722 | no_license | [
{
"docstring": ":type citations: List[int] :rtype: int",
"name": "hIndex_template2",
"signature": "def hIndex_template2(self, citations)"
},
{
"docstring": ":type citations: List[int] :rtype: int",
"name": "hIndex_template3",
"signature": "def hIndex_template3(self, citations)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000683 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex_template2(self, citations): :type citations: List[int] :rtype: int
- def hIndex_template3(self, citations): :type citations: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hIndex_template2(self, citations): :type citations: List[int] :rtype: int
- def hIndex_template3(self, citations): :type citations: List[int] :rtype: int
<|skeleton|>
class ... | 1a3c1f4d6e9d3444039f087763b93241f4ba7892 | <|skeleton|>
class Solution:
def hIndex_template2(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex_template3(self, citations):
""":type citations: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hIndex_template2(self, citations):
""":type citations: List[int] :rtype: int"""
if not citations:
return 0
total = len(citations)
count = 0
left, right = (0, total)
while left < right:
mid = left + (right - left) // 2
... | the_stack_v2_python_sparse | Algorithm/275_H_Index_II.py | Gi1ia/TechNoteBook | train | 7 | |
f12aac6892c14d0d0aed6e6775306a655c95d434 | [
"super().__init__()\nself.conv = nn.Conv1d(c_in, c_out, kernel_size=K, padding=K // 2)\nself.dims = (c_out, b)\nM = np.prod(self.dims)\nself.out_layer = nn.Linear(M, n_neurons)\nnn.init.normal_(self.out_layer.weight, std=0.01)",
"s = s.unsqueeze(1)\na = self.conv(s)\na = a.view(-1, np.prod(self.dims))\ny = self.o... | <|body_start_0|>
super().__init__()
self.conv = nn.Conv1d(c_in, c_out, kernel_size=K, padding=K // 2)
self.dims = (c_out, b)
M = np.prod(self.dims)
self.out_layer = nn.Linear(M, n_neurons)
nn.init.normal_(self.out_layer.weight, std=0.01)
<|end_body_0|>
<|body_start_1|>
... | Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer | ConvFC | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvFC:
"""Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer"""
def __init__(self, n_neurons, c_in=1, c_out=8, K=9, b=60):
"""in... | stack_v2_sparse_classes_75kplus_train_007293 | 1,917 | permissive | [
{
"docstring": "initialize layer Args: c_in: number of input stimulus channels c_out: number of convolutional channels K: size of each convolutional filter h: number of stimulus bins, n_bins",
"name": "__init__",
"signature": "def __init__(self, n_neurons, c_in=1, c_out=8, K=9, b=60)"
},
{
"docs... | 2 | null | Implement the Python class `ConvFC` described below.
Class description:
Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer
Method signatures and docstrings:
- def ... | Implement the Python class `ConvFC` described below.
Class description:
Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer
Method signatures and docstrings:
- def ... | 977f4ddaaa4f33746672930ae01d5ea592dbbba0 | <|skeleton|>
class ConvFC:
"""Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer"""
def __init__(self, n_neurons, c_in=1, c_out=8, K=9, b=60):
"""in... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConvFC:
"""Deep network with one convolutional layer + one fully connected layer Attributes: conv (nn.Conv1d): convolutional layer dims (tuple): shape of convolutional layer output out_layer (nn.Linear): linear layer"""
def __init__(self, n_neurons, c_in=1, c_out=8, K=9, b=60):
"""initialize laye... | the_stack_v2_python_sparse | tutorials/W3D4_DeepLearning1/solutions/W3D4_Tutorial2_Solution_fda4c007.py | Andy-Dufrein/course-content | train | 1 |
8407d93c02ac5d813a7f0d786cf73735d8d0d23a | [
"if score and page and language and group and author and voter:\n self.score = score\n self.page_id = page.id\n self.language_id = language.id\n self.group_id = group.id\n self.author_id = author.id\n self.voter_id = voter.id",
"if page is None or language is None or group is None or (author is ... | <|body_start_0|>
if score and page and language and group and author and voter:
self.score = score
self.page_id = page.id
self.language_id = language.id
self.group_id = group.id
self.author_id = author.id
self.voter_id = voter.id
<|end_body... | Represents a vote in the database | Vote | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vote:
"""Represents a vote in the database"""
def __init__(self, score, page, language, group, author, voter):
"""Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter""... | stack_v2_sparse_classes_75kplus_train_007294 | 6,346 | permissive | [
{
"docstring": "Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter",
"name": "__init__",
"signature": "def __init__(self, score, page, language, group, author, voter)"
},
{
"docs... | 5 | stack_v2_sparse_classes_30k_train_051076 | Implement the Python class `Vote` described below.
Class description:
Represents a vote in the database
Method signatures and docstrings:
- def __init__(self, score, page, language, group, author, voter): Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the ... | Implement the Python class `Vote` described below.
Class description:
Represents a vote in the database
Method signatures and docstrings:
- def __init__(self, score, page, language, group, author, voter): Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the ... | 42678afaee6d4b57cfaddb402bc6f15b37fdd027 | <|skeleton|>
class Vote:
"""Represents a vote in the database"""
def __init__(self, score, page, language, group, author, voter):
"""Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vote:
"""Represents a vote in the database"""
def __init__(self, score, page, language, group, author, voter):
"""Initializes a vote :param score: the score :param page: the page :param language: the language :param group: the group :param author: the author :param voter: the voter"""
if ... | the_stack_v2_python_sparse | annotran/votes/models.py | BirkbeckCTP/annotran | train | 8 |
71433fddabb1371e401b0982ea36df44ebc84bae | [
"from_time = self.get_argument('from', None)\nto_time = self.get_argument('to', None)\nnow = arrow.utcnow()\ntry:\n if from_time is None:\n from_time = now.replace(days=-1)\n else:\n from_time = arrow.get(from_time)\n if to_time is None:\n to_time = now.replace(days=+1)\n else:\n ... | <|body_start_0|>
from_time = self.get_argument('from', None)
to_time = self.get_argument('to', None)
now = arrow.utcnow()
try:
if from_time is None:
from_time = now.replace(days=-1)
else:
from_time = arrow.get(from_time)
... | Responsible for returning ids of assets within time range | IdentifiersHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentifiersHandler:
"""Responsible for returning ids of assets within time range"""
def _get_time_arguments(self):
"""Get from_time and to_time from handler args and parse into valid format :return: (from_time, to_time)"""
<|body_0|>
def _get_page_arguments(self):
... | stack_v2_sparse_classes_75kplus_train_007295 | 8,641 | permissive | [
{
"docstring": "Get from_time and to_time from handler args and parse into valid format :return: (from_time, to_time)",
"name": "_get_time_arguments",
"signature": "def _get_time_arguments(self)"
},
{
"docstring": "Get page and paze_size arguments from handler and validate :return: (page, page_s... | 3 | null | Implement the Python class `IdentifiersHandler` described below.
Class description:
Responsible for returning ids of assets within time range
Method signatures and docstrings:
- def _get_time_arguments(self): Get from_time and to_time from handler args and parse into valid format :return: (from_time, to_time)
- def _... | Implement the Python class `IdentifiersHandler` described below.
Class description:
Responsible for returning ids of assets within time range
Method signatures and docstrings:
- def _get_time_arguments(self): Get from_time and to_time from handler args and parse into valid format :return: (from_time, to_time)
- def _... | b25ceaef87fbab0fb131a83ab288379ddf23c31c | <|skeleton|>
class IdentifiersHandler:
"""Responsible for returning ids of assets within time range"""
def _get_time_arguments(self):
"""Get from_time and to_time from handler args and parse into valid format :return: (from_time, to_time)"""
<|body_0|>
def _get_page_arguments(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IdentifiersHandler:
"""Responsible for returning ids of assets within time range"""
def _get_time_arguments(self):
"""Get from_time and to_time from handler args and parse into valid format :return: (from_time, to_time)"""
from_time = self.get_argument('from', None)
to_time = self... | the_stack_v2_python_sparse | repository/controllers/assets_handler.py | openpermissions/repository-srv | train | 2 |
51c6e33dfce0a53c6d825e110cb769a72cdd5c07 | [
"try:\n strike = self.strike\nexcept:\n pass\npaths = self.underlying.get_instrument_values(fixed_seed=fixed_seed)\ntime_grid = self.underlying.time_grid\ntry:\n time_index_start = int(np.where(time_grid == self.pricing_date)[0])\n time_index_end = int(np.where(time_grid == self.maturity)[0])\nexcept:\n... | <|body_start_0|>
try:
strike = self.strike
except:
pass
paths = self.underlying.get_instrument_values(fixed_seed=fixed_seed)
time_grid = self.underlying.time_grid
try:
time_index_start = int(np.where(time_grid == self.pricing_date)[0])
... | Class to value American options with arbitrary payoff by single-factor Monte Carlo simulation. Methods ======= generate_payoff : returns payoffs given the paths and the payoff function present_value : returns present value (LSM Monte Carlo estimator) according to Longstaff-Schwartz (2001) | valuation_mcs_american_single | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class valuation_mcs_american_single:
"""Class to value American options with arbitrary payoff by single-factor Monte Carlo simulation. Methods ======= generate_payoff : returns payoffs given the paths and the payoff function present_value : returns present value (LSM Monte Carlo estimator) according to... | stack_v2_sparse_classes_75kplus_train_007296 | 13,481 | no_license | [
{
"docstring": "Attributes ========== fixed_seed : use same/fixed seed for valuation",
"name": "generate_payoff",
"signature": "def generate_payoff(self, fixed_seed=False)"
},
{
"docstring": "Attributes ========== accuracy : int number of decimals in returned result fixed_seed : used same/fixed ... | 2 | stack_v2_sparse_classes_30k_train_052131 | Implement the Python class `valuation_mcs_american_single` described below.
Class description:
Class to value American options with arbitrary payoff by single-factor Monte Carlo simulation. Methods ======= generate_payoff : returns payoffs given the paths and the payoff function present_value : returns present value (... | Implement the Python class `valuation_mcs_american_single` described below.
Class description:
Class to value American options with arbitrary payoff by single-factor Monte Carlo simulation. Methods ======= generate_payoff : returns payoffs given the paths and the payoff function present_value : returns present value (... | 957c49300ae59571eda590ddf13e7e092fdd96aa | <|skeleton|>
class valuation_mcs_american_single:
"""Class to value American options with arbitrary payoff by single-factor Monte Carlo simulation. Methods ======= generate_payoff : returns payoffs given the paths and the payoff function present_value : returns present value (LSM Monte Carlo estimator) according to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class valuation_mcs_american_single:
"""Class to value American options with arbitrary payoff by single-factor Monte Carlo simulation. Methods ======= generate_payoff : returns payoffs given the paths and the payoff function present_value : returns present value (LSM Monte Carlo estimator) according to Longstaff-Sc... | the_stack_v2_python_sparse | dx/valuation/single_risk.py | mccarvik/python_for_finance | train | 3 |
f8aaa5786adbaf47777deeaca02f62276b675f0c | [
"try:\n payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=1, seconds=30), 'iat': datetime.datetime.utcnow(), 'id': user.id, 'email': user.email, 'username': user.username}\n return jwt.encode(payload, app.config.get('SECRET_KEY'), algorithm='HS256')\nexcept Exception as e:\n return e",... | <|body_start_0|>
try:
payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=1, seconds=30), 'iat': datetime.datetime.utcnow(), 'id': user.id, 'email': user.email, 'username': user.username}
return jwt.encode(payload, app.config.get('SECRET_KEY'), algorithm='HS256')
... | Auth | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth:
def encode_auth_token(user):
"""Gerando auth token :retun: string"""
<|body_0|>
def decode_auth_token(request):
"""Decodes um auth token :param: request: :return: string|boolean"""
<|body_1|>
def __verify_user(payload):
"""Implementação da ... | stack_v2_sparse_classes_75kplus_train_007297 | 1,879 | permissive | [
{
"docstring": "Gerando auth token :retun: string",
"name": "encode_auth_token",
"signature": "def encode_auth_token(user)"
},
{
"docstring": "Decodes um auth token :param: request: :return: string|boolean",
"name": "decode_auth_token",
"signature": "def decode_auth_token(request)"
},
... | 3 | stack_v2_sparse_classes_30k_train_001779 | Implement the Python class `Auth` described below.
Class description:
Implement the Auth class.
Method signatures and docstrings:
- def encode_auth_token(user): Gerando auth token :retun: string
- def decode_auth_token(request): Decodes um auth token :param: request: :return: string|boolean
- def __verify_user(payloa... | Implement the Python class `Auth` described below.
Class description:
Implement the Auth class.
Method signatures and docstrings:
- def encode_auth_token(user): Gerando auth token :retun: string
- def decode_auth_token(request): Decodes um auth token :param: request: :return: string|boolean
- def __verify_user(payloa... | 668e907c927f1c25b8dbcdb1a324d2e2d66d0819 | <|skeleton|>
class Auth:
def encode_auth_token(user):
"""Gerando auth token :retun: string"""
<|body_0|>
def decode_auth_token(request):
"""Decodes um auth token :param: request: :return: string|boolean"""
<|body_1|>
def __verify_user(payload):
"""Implementação da ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Auth:
def encode_auth_token(user):
"""Gerando auth token :retun: string"""
try:
payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=1, seconds=30), 'iat': datetime.datetime.utcnow(), 'id': user.id, 'email': user.email, 'username': user.username}
retur... | the_stack_v2_python_sparse | app/utils/oauth.py | RodrigoCursino/flask-estudo | train | 0 | |
b84cf40d1552ebb2333c97ce6a76ed2e113fd880 | [
"self._vm_id = vm_id\nself._model = create_package_listbox(vm_id, _listbox)\nself._window = window\nbind_click(install_button, self.install_packages)\nbind_click(uninstall_button, self.uninstall_packages)\nbind_click(refresh_button, self.refresh_package_list)\nself.refresh_package_list(False)",
"def wrapper(self)... | <|body_start_0|>
self._vm_id = vm_id
self._model = create_package_listbox(vm_id, _listbox)
self._window = window
bind_click(install_button, self.install_packages)
bind_click(uninstall_button, self.uninstall_packages)
bind_click(refresh_button, self.refresh_package_list)
... | The C in the MVC model. This is responsible for giving the view a title (the text indicates that what vm this package management window is for) , in the form of "Package Management for %s" % vm_id. Also needs to configure the buttons in the view. | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
"""The C in the MVC model. This is responsible for giving the view a title (the text indicates that what vm this package management window is for) , in the form of "Package Management for %s" % vm_id. Also needs to configure the buttons in the view."""
def __init__(self, _listbox... | stack_v2_sparse_classes_75kplus_train_007298 | 6,406 | no_license | [
{
"docstring": "@param _vm_id: id of the vm whose packages are to be managed. @param title: the title to be configured.",
"name": "__init__",
"signature": "def __init__(self, _listbox, install_button, uninstall_button, refresh_button, window=None, vm_id='6666')"
},
{
"docstring": "Decorator for ... | 5 | stack_v2_sparse_classes_30k_train_047665 | Implement the Python class `Controller` described below.
Class description:
The C in the MVC model. This is responsible for giving the view a title (the text indicates that what vm this package management window is for) , in the form of "Package Management for %s" % vm_id. Also needs to configure the buttons in the vi... | Implement the Python class `Controller` described below.
Class description:
The C in the MVC model. This is responsible for giving the view a title (the text indicates that what vm this package management window is for) , in the form of "Package Management for %s" % vm_id. Also needs to configure the buttons in the vi... | 95b4f21d9478d9245853873d11ea6533c2bf63b5 | <|skeleton|>
class Controller:
"""The C in the MVC model. This is responsible for giving the view a title (the text indicates that what vm this package management window is for) , in the form of "Package Management for %s" % vm_id. Also needs to configure the buttons in the view."""
def __init__(self, _listbox... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Controller:
"""The C in the MVC model. This is responsible for giving the view a title (the text indicates that what vm this package management window is for) , in the form of "Package Management for %s" % vm_id. Also needs to configure the buttons in the view."""
def __init__(self, _listbox, install_but... | the_stack_v2_python_sparse | vmanager/app/packages.py | blair1306/vmanager | train | 0 |
eb2fb13886fa0d62ccef5b20c684901b747506a8 | [
"serialized_data = LeaguesSerializer(league).data\nrsp = {'league': serialized_data}\nreturn Response(rsp)",
"if not request.data:\n return Response({'message': 'Body empty'}, status=status.HTTP_404_NOT_FOUND)\nelse:\n serializer = UpdateLeagueSerializer(league, data=request.data)\n if serializer.is_vali... | <|body_start_0|>
serialized_data = LeaguesSerializer(league).data
rsp = {'league': serialized_data}
return Response(rsp)
<|end_body_0|>
<|body_start_1|>
if not request.data:
return Response({'message': 'Body empty'}, status=status.HTTP_404_NOT_FOUND)
else:
... | Leagues By ID API Endpoints | LeaguesByIdAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeaguesByIdAPI:
"""Leagues By ID API Endpoints"""
def get(self, request, league_id, league, *args, **kwargs):
"""Gets the information of a certain league by it's ID"""
<|body_0|>
def put(self, request, league_id, league, *args, **kwargs):
"""Allows the update of ... | stack_v2_sparse_classes_75kplus_train_007299 | 5,729 | permissive | [
{
"docstring": "Gets the information of a certain league by it's ID",
"name": "get",
"signature": "def get(self, request, league_id, league, *args, **kwargs)"
},
{
"docstring": "Allows the update of a certain league details based on ID",
"name": "put",
"signature": "def put(self, request... | 3 | null | Implement the Python class `LeaguesByIdAPI` described below.
Class description:
Leagues By ID API Endpoints
Method signatures and docstrings:
- def get(self, request, league_id, league, *args, **kwargs): Gets the information of a certain league by it's ID
- def put(self, request, league_id, league, *args, **kwargs): ... | Implement the Python class `LeaguesByIdAPI` described below.
Class description:
Leagues By ID API Endpoints
Method signatures and docstrings:
- def get(self, request, league_id, league, *args, **kwargs): Gets the information of a certain league by it's ID
- def put(self, request, league_id, league, *args, **kwargs): ... | 961107acbcdd93551bcd1b4b0ecd877fb4a7d813 | <|skeleton|>
class LeaguesByIdAPI:
"""Leagues By ID API Endpoints"""
def get(self, request, league_id, league, *args, **kwargs):
"""Gets the information of a certain league by it's ID"""
<|body_0|>
def put(self, request, league_id, league, *args, **kwargs):
"""Allows the update of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LeaguesByIdAPI:
"""Leagues By ID API Endpoints"""
def get(self, request, league_id, league, *args, **kwargs):
"""Gets the information of a certain league by it's ID"""
serialized_data = LeaguesSerializer(league).data
rsp = {'league': serialized_data}
return Response(rsp)
... | the_stack_v2_python_sparse | footballleagues/views/leagues.py | RicardoSilveira23/TonicAppChallenge | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.