blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
f8e274a291b754904ab01f3bea241515df8796f3
[ "wheres = ''\nif data.data_type == 1:\n index_path = models.SSADataTag.objects.get(id=data.data_tag)\nelif data.data_type == 2:\n index_path = models.SECDataTag.objects.get(id=data.data_tag)\n wheres = 'where {} = {}'.format('event_source', data.data_tag)\nelse:\n return {}\nif not index_path:\n retu...
<|body_start_0|> wheres = '' if data.data_type == 1: index_path = models.SSADataTag.objects.get(id=data.data_tag) elif data.data_type == 2: index_path = models.SECDataTag.objects.get(id=data.data_tag) wheres = 'where {} = {}'.format('event_source', data.data_t...
报告元素
ReportCellList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportCellList: """报告元素""" def get_custom_data(self, userinfo, data): """封装自定义图表数据""" <|body_0|> def post(self, request): """报告元素""" <|body_1|> <|end_skeleton|> <|body_start_0|> wheres = '' if data.data_type == 1: index_path ...
stack_v2_sparse_classes_36k_train_027000
18,475
no_license
[ { "docstring": "封装自定义图表数据", "name": "get_custom_data", "signature": "def get_custom_data(self, userinfo, data)" }, { "docstring": "报告元素", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_019139
Implement the Python class `ReportCellList` described below. Class description: 报告元素 Method signatures and docstrings: - def get_custom_data(self, userinfo, data): 封装自定义图表数据 - def post(self, request): 报告元素
Implement the Python class `ReportCellList` described below. Class description: 报告元素 Method signatures and docstrings: - def get_custom_data(self, userinfo, data): 封装自定义图表数据 - def post(self, request): 报告元素 <|skeleton|> class ReportCellList: """报告元素""" def get_custom_data(self, userinfo, data): """封装...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class ReportCellList: """报告元素""" def get_custom_data(self, userinfo, data): """封装自定义图表数据""" <|body_0|> def post(self, request): """报告元素""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReportCellList: """报告元素""" def get_custom_data(self, userinfo, data): """封装自定义图表数据""" wheres = '' if data.data_type == 1: index_path = models.SSADataTag.objects.get(id=data.data_tag) elif data.data_type == 2: index_path = models.SECDataTag.objects.g...
the_stack_v2_python_sparse
soc_ssa/views/report_views.py
sundw2015/841
train
4
b712f3f8f18d50f8cbb888e980f048c91d3dacf1
[ "super().__init__()\nself.nhead = nhead\npoint_cloud_range = np.array(point_cloud_range)\npoint_cloud_range = point_cloud_range[3:6] - point_cloud_range[0:3]\npoint_cloud_range = (point_cloud_range ** 2).sum() ** 0.5\nself.max_len = int(point_cloud_range // quan_size + 1)\nself.grid_size = quan_size\nself.pos_embed...
<|body_start_0|> super().__init__() self.nhead = nhead point_cloud_range = np.array(point_cloud_range) point_cloud_range = point_cloud_range[3:6] - point_cloud_range[0:3] point_cloud_range = (point_cloud_range ** 2).sum() ** 0.5 self.max_len = int(point_cloud_range // qua...
RPE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RPE: def __init__(self, nhead, point_cloud_range, quan_size=0.02): """Args: point_cloud_range: (6), [xmin, ymin, zmin, xmax, ymax, zmax]""" <|body_0|> def forward(self, batch_rel_coords): """Args: batch_rel_coords: (B, N, 3) Returns pos_embedding: (B, N, nhead)""" ...
stack_v2_sparse_classes_36k_train_027001
1,449
no_license
[ { "docstring": "Args: point_cloud_range: (6), [xmin, ymin, zmin, xmax, ymax, zmax]", "name": "__init__", "signature": "def __init__(self, nhead, point_cloud_range, quan_size=0.02)" }, { "docstring": "Args: batch_rel_coords: (B, N, 3) Returns pos_embedding: (B, N, nhead)", "name": "forward", ...
2
stack_v2_sparse_classes_30k_train_016654
Implement the Python class `RPE` described below. Class description: Implement the RPE class. Method signatures and docstrings: - def __init__(self, nhead, point_cloud_range, quan_size=0.02): Args: point_cloud_range: (6), [xmin, ymin, zmin, xmax, ymax, zmax] - def forward(self, batch_rel_coords): Args: batch_rel_coor...
Implement the Python class `RPE` described below. Class description: Implement the RPE class. Method signatures and docstrings: - def __init__(self, nhead, point_cloud_range, quan_size=0.02): Args: point_cloud_range: (6), [xmin, ymin, zmin, xmax, ymax, zmax] - def forward(self, batch_rel_coords): Args: batch_rel_coor...
bbc78ca91e851f0f04459b1a8bbe96ab44bf41bc
<|skeleton|> class RPE: def __init__(self, nhead, point_cloud_range, quan_size=0.02): """Args: point_cloud_range: (6), [xmin, ymin, zmin, xmax, ymax, zmax]""" <|body_0|> def forward(self, batch_rel_coords): """Args: batch_rel_coords: (B, N, 3) Returns pos_embedding: (B, N, nhead)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RPE: def __init__(self, nhead, point_cloud_range, quan_size=0.02): """Args: point_cloud_range: (6), [xmin, ymin, zmin, xmax, ymax, zmax]""" super().__init__() self.nhead = nhead point_cloud_range = np.array(point_cloud_range) point_cloud_range = point_cloud_range[3:6] -...
the_stack_v2_python_sparse
EQNet/eqnet/positional_encoding/rpe.py
dvlab-research/DeepVision3D
train
94
d8e402bec02b52389841824559604658b8de599d
[ "self._async_add_entities = async_add_entities\nself._client = client\nself._hass = hass\nself._latitude = latitude\nself._longitude = longitude\nself._managed_strike_ids = set()\nself._radius = radius\nself._strikes = {}\nself._window = timedelta(seconds=window_seconds)\nself._unit_system = unit_system\nif unit_sy...
<|body_start_0|> self._async_add_entities = async_add_entities self._client = client self._hass = hass self._latitude = latitude self._longitude = longitude self._managed_strike_ids = set() self._radius = radius self._strikes = {} self._window = ti...
Define a class to handle WWLLN events.
WWLLNEventManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WWLLNEventManager: """Define a class to handle WWLLN events.""" def __init__(self, hass, async_add_entities, client, latitude, longitude, radius, window_seconds, unit_system): """Initialize.""" <|body_0|> def _create_events(self, ids_to_create): """Create new geo...
stack_v2_sparse_classes_36k_train_027002
6,978
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, hass, async_add_entities, client, latitude, longitude, radius, window_seconds, unit_system)" }, { "docstring": "Create new geo location events.", "name": "_create_events", "signature": "def _create_events(...
5
stack_v2_sparse_classes_30k_train_004143
Implement the Python class `WWLLNEventManager` described below. Class description: Define a class to handle WWLLN events. Method signatures and docstrings: - def __init__(self, hass, async_add_entities, client, latitude, longitude, radius, window_seconds, unit_system): Initialize. - def _create_events(self, ids_to_cr...
Implement the Python class `WWLLNEventManager` described below. Class description: Define a class to handle WWLLN events. Method signatures and docstrings: - def __init__(self, hass, async_add_entities, client, latitude, longitude, radius, window_seconds, unit_system): Initialize. - def _create_events(self, ids_to_cr...
10dd34f62248ee822b941ce7c707b774bbdff378
<|skeleton|> class WWLLNEventManager: """Define a class to handle WWLLN events.""" def __init__(self, hass, async_add_entities, client, latitude, longitude, radius, window_seconds, unit_system): """Initialize.""" <|body_0|> def _create_events(self, ids_to_create): """Create new geo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WWLLNEventManager: """Define a class to handle WWLLN events.""" def __init__(self, hass, async_add_entities, client, latitude, longitude, radius, window_seconds, unit_system): """Initialize.""" self._async_add_entities = async_add_entities self._client = client self._hass ...
the_stack_v2_python_sparse
homeassistant/components/wwlln/geo_location.py
peternijssen/home-assistant
train
2
1c97b39681d97a0e07772b633d3625a89aa4842f
[ "self.cleanup_error = cleanup_error\nself.data_migration_error = data_migration_error\nself.error = error\nself.finished = finished\nself.instant_recovery_finished = instant_recovery_finished\nself.migrate_task_moref = migrate_task_moref\nself.restore_disks_task_info_proto = restore_disks_task_info_proto\nself.slav...
<|body_start_0|> self.cleanup_error = cleanup_error self.data_migration_error = data_migration_error self.error = error self.finished = finished self.instant_recovery_finished = instant_recovery_finished self.migrate_task_moref = migrate_task_moref self.restore_di...
Implementation of the 'RecoverVirtualDiskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. RecoverVirtualDiskInfoProto extension Location =============================================================================...
RecoverVirtualDiskInfoProto
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecoverVirtualDiskInfoProto: """Implementation of the 'RecoverVirtualDiskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. RecoverVirtualDiskInfoProto extension Location ======================...
stack_v2_sparse_classes_36k_train_027003
5,669
permissive
[ { "docstring": "Constructor for the RecoverVirtualDiskInfoProto class", "name": "__init__", "signature": "def __init__(self, cleanup_error=None, data_migration_error=None, error=None, finished=None, instant_recovery_finished=None, migrate_task_moref=None, restore_disks_task_info_proto=None, slave_task_s...
2
stack_v2_sparse_classes_30k_train_009177
Implement the Python class `RecoverVirtualDiskInfoProto` described below. Class description: Implementation of the 'RecoverVirtualDiskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. RecoverVirtualDiskInfoProto ex...
Implement the Python class `RecoverVirtualDiskInfoProto` described below. Class description: Implementation of the 'RecoverVirtualDiskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. RecoverVirtualDiskInfoProto ex...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RecoverVirtualDiskInfoProto: """Implementation of the 'RecoverVirtualDiskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. RecoverVirtualDiskInfoProto extension Location ======================...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecoverVirtualDiskInfoProto: """Implementation of the 'RecoverVirtualDiskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. RecoverVirtualDiskInfoProto extension Location ===================================...
the_stack_v2_python_sparse
cohesity_management_sdk/models/recover_virtual_disk_info_proto.py
cohesity/management-sdk-python
train
24
654f32c87933ce7392df079e202bcd720ae4b000
[ "for left in range(len(s)):\n if self.is_huiwen(s, left, len(s) - 1):\n return s + s[:left][::-1]", "while left < right:\n if s[left] == s[right]:\n left += 1\n right -= 1\n else:\n return False\nreturn True" ]
<|body_start_0|> for left in range(len(s)): if self.is_huiwen(s, left, len(s) - 1): return s + s[:left][::-1] <|end_body_0|> <|body_start_1|> while left < right: if s[left] == s[right]: left += 1 right -= 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate_huiwen(self, s): """Args: s: str Return: str""" <|body_0|> def is_huiwen(self, s, left, right): """Args: s: str Return: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> for left in range(len(s)): if self.is_hui...
stack_v2_sparse_classes_36k_train_027004
696
no_license
[ { "docstring": "Args: s: str Return: str", "name": "generate_huiwen", "signature": "def generate_huiwen(self, s)" }, { "docstring": "Args: s: str Return: bool", "name": "is_huiwen", "signature": "def is_huiwen(self, s, left, right)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate_huiwen(self, s): Args: s: str Return: str - def is_huiwen(self, s, left, right): Args: s: str Return: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate_huiwen(self, s): Args: s: str Return: str - def is_huiwen(self, s, left, right): Args: s: str Return: bool <|skeleton|> class Solution: def generate_huiwen(sel...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def generate_huiwen(self, s): """Args: s: str Return: str""" <|body_0|> def is_huiwen(self, s, left, right): """Args: s: str Return: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generate_huiwen(self, s): """Args: s: str Return: str""" for left in range(len(s)): if self.is_huiwen(s, left, len(s) - 1): return s + s[:left][::-1] def is_huiwen(self, s, left, right): """Args: s: str Return: bool""" while left <...
the_stack_v2_python_sparse
秋招/网易/1.py
AiZhanghan/Leetcode
train
0
680b3b451cef16c3dc0ebe3fee2a2574722effb6
[ "point_map = zip(range(len(height)), height)\nmax_area = 0\nfor a, b in itertools.combinations(point_map, 2):\n area = abs(a[0] - b[0]) * min(a[1], b[1])\n max_area = area if area > max_area else max_area\nreturn max_area", "left = ans = 0\nright = len(height) - 1\nwhile left < right:\n ans = max(ans, (r...
<|body_start_0|> point_map = zip(range(len(height)), height) max_area = 0 for a, b in itertools.combinations(point_map, 2): area = abs(a[0] - b[0]) * min(a[1], b[1]) max_area = area if area > max_area else max_area return max_area <|end_body_0|> <|body_start_1|> ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> point_map = zip(range(len(height)), height) ...
stack_v2_sparse_classes_36k_train_027005
1,768
permissive
[ { "docstring": ":type height: List[int] :rtype: int", "name": "_maxArea", "signature": "def _maxArea(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _maxArea(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _maxArea(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def _maxArea(s...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _maxArea(self, height): """:type height: List[int] :rtype: int""" point_map = zip(range(len(height)), height) max_area = 0 for a, b in itertools.combinations(point_map, 2): area = abs(a[0] - b[0]) * min(a[1], b[1]) max_area = area if area >...
the_stack_v2_python_sparse
11.container-with-most-water.py
windard/leeeeee
train
0
3b3db13651e78609688a33e3532655c59b7abf38
[ "\"\"\"The states\"\"\"\nstates = ['Welcome state', 'Pure comment', 'Hybrid comment', 'Lulls comment']\nself.states = states\n'Dict states to index'\nself.states2idx = {k: i for i, k in enumerate(states)}\n'Dict index to state'\nself.id2st = {self.states2idx[k]: k for k in self.states2idx.keys()}\nself.n_states = l...
<|body_start_0|> """The states""" states = ['Welcome state', 'Pure comment', 'Hybrid comment', 'Lulls comment'] self.states = states 'Dict states to index' self.states2idx = {k: i for i, k in enumerate(states)} 'Dict index to state' self.id2st = {self.states2idx[k...
CommentAutomata
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentAutomata: def __init__(self): """Initialize the automata""" <|body_0|> def NextState(self): """Returns the next state""" <|body_1|> def DrawAutomata(self, fn='Commentator Automata.gv'): """Writes on file fn (default 'Commentator Automata.g...
stack_v2_sparse_classes_36k_train_027006
3,627
no_license
[ { "docstring": "Initialize the automata", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Returns the next state", "name": "NextState", "signature": "def NextState(self)" }, { "docstring": "Writes on file fn (default 'Commentator Automata.gv') representat...
3
stack_v2_sparse_classes_30k_train_001745
Implement the Python class `CommentAutomata` described below. Class description: Implement the CommentAutomata class. Method signatures and docstrings: - def __init__(self): Initialize the automata - def NextState(self): Returns the next state - def DrawAutomata(self, fn='Commentator Automata.gv'): Writes on file fn ...
Implement the Python class `CommentAutomata` described below. Class description: Implement the CommentAutomata class. Method signatures and docstrings: - def __init__(self): Initialize the automata - def NextState(self): Returns the next state - def DrawAutomata(self, fn='Commentator Automata.gv'): Writes on file fn ...
e2f42e511b42d82e4330d2afb7ecb172a3b5f7f5
<|skeleton|> class CommentAutomata: def __init__(self): """Initialize the automata""" <|body_0|> def NextState(self): """Returns the next state""" <|body_1|> def DrawAutomata(self, fn='Commentator Automata.gv'): """Writes on file fn (default 'Commentator Automata.g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommentAutomata: def __init__(self): """Initialize the automata""" """The states""" states = ['Welcome state', 'Pure comment', 'Hybrid comment', 'Lulls comment'] self.states = states 'Dict states to index' self.states2idx = {k: i for i, k in enumerate(states)} ...
the_stack_v2_python_sparse
CommentGenerator/src/Automaton.py
SmartAppUnipi/RoboComment
train
4
01fa8eeb26960dd9d4bb3f515972a0e609124d75
[ "self.dataset_name = dataset_name\nself.identifier = identifier if not identifier is None else get_unique_identifier()\nself.chart_name = chart_name if not chart_name is None else 'Chart'\nself.data = data if not data is None else list()\nself.x_axis = x_axis\nself.chart_type = chart_type if not chart_type is None ...
<|body_start_0|> self.dataset_name = dataset_name self.identifier = identifier if not identifier is None else get_unique_identifier() self.chart_name = chart_name if not chart_name is None else 'Chart' self.data = data if not data is None else list() self.x_axis = x_axis ...
Handle containing information about a user-defied chart view. This type of chart is a view on top of a dataset that is associated with a curation workflow. The dataset is identified by the name under which it is known in the workflow. Thus, the view can be evaluated for different version of the same dataset. Informatio...
ChartViewHandle
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChartViewHandle: """Handle containing information about a user-defied chart view. This type of chart is a view on top of a dataset that is associated with a curation workflow. The dataset is identified by the name under which it is known in the workflow. Thus, the view can be evaluated for differ...
stack_v2_sparse_classes_36k_train_027007
8,236
permissive
[ { "docstring": "Initialize the view handle. Parameters ---------- identifier: string Unique view identifier dataset_name: string Name used toreference a dataset in the curation workflow within which this view is defined chart_name: string Unique chart name for reference data: list(vizier.plot.view.DataSeriesHan...
5
null
Implement the Python class `ChartViewHandle` described below. Class description: Handle containing information about a user-defied chart view. This type of chart is a view on top of a dataset that is associated with a curation workflow. The dataset is identified by the name under which it is known in the workflow. Thu...
Implement the Python class `ChartViewHandle` described below. Class description: Handle containing information about a user-defied chart view. This type of chart is a view on top of a dataset that is associated with a curation workflow. The dataset is identified by the name under which it is known in the workflow. Thu...
e99f43df3df80ad5647f57d805c339257336ac73
<|skeleton|> class ChartViewHandle: """Handle containing information about a user-defied chart view. This type of chart is a view on top of a dataset that is associated with a curation workflow. The dataset is identified by the name under which it is known in the workflow. Thus, the view can be evaluated for differ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChartViewHandle: """Handle containing information about a user-defied chart view. This type of chart is a view on top of a dataset that is associated with a curation workflow. The dataset is identified by the name under which it is known in the workflow. Thus, the view can be evaluated for different version o...
the_stack_v2_python_sparse
vizier/view/chart.py
VizierDB/web-api-async
train
2
0d4f7d61f4a35c62f973ef175267e9b3999931d0
[ "self.kafo = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nself.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')\nself.bakery = Company.objects.create(name='bakery', caffe=self.kaf...
<|body_start_0|> self.kafo = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100') self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100') self.bakery = Company.objects.cr...
FullExpense model tests.
FullExpenseModelTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullExpenseModelTest: """FullExpense model tests.""" def setUp(self): """Test data setup.""" <|body_0|> def test_full_expense_validation(self): """Check if name is unique across one caffe.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.kaf...
stack_v2_sparse_classes_36k_train_027008
8,665
permissive
[ { "docstring": "Test data setup.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Check if name is unique across one caffe.", "name": "test_full_expense_validation", "signature": "def test_full_expense_validation(self)" } ]
2
stack_v2_sparse_classes_30k_train_010737
Implement the Python class `FullExpenseModelTest` described below. Class description: FullExpense model tests. Method signatures and docstrings: - def setUp(self): Test data setup. - def test_full_expense_validation(self): Check if name is unique across one caffe.
Implement the Python class `FullExpenseModelTest` described below. Class description: FullExpense model tests. Method signatures and docstrings: - def setUp(self): Test data setup. - def test_full_expense_validation(self): Check if name is unique across one caffe. <|skeleton|> class FullExpenseModelTest: """Full...
cdb7f5edb29255c7e874eaa6231621063210a8b0
<|skeleton|> class FullExpenseModelTest: """FullExpense model tests.""" def setUp(self): """Test data setup.""" <|body_0|> def test_full_expense_validation(self): """Check if name is unique across one caffe.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FullExpenseModelTest: """FullExpense model tests.""" def setUp(self): """Test data setup.""" self.kafo = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100') self.filtry = Caffe.objects.create(name='filtry', city='Warszawa'...
the_stack_v2_python_sparse
caffe/cash/test_models.py
VirrageS/io-kawiarnie
train
3
223d78897497accec00cb6f5e71957589096b382
[ "cur, check, count, cnt = (head, head, 0, 0)\nwhile count < k and check:\n check = check.next\n count += 1\nif count == k:\n prev, next_node = (None, None)\n for i in range(k):\n next_node = cur.next\n cur.next = prev\n prev = cur\n cur = next_node\n if next_node:\n ...
<|body_start_0|> cur, check, count, cnt = (head, head, 0, 0) while count < k and check: check = check.next count += 1 if count == k: prev, next_node = (None, None) for i in range(k): next_node = cur.next cur.next = p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def reverseKGroup1(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027009
1,546
no_license
[ { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup", "signature": "def reverseKGroup(self, head, k)" }, { "docstring": ":type head: ListNode :type k: int :rtype: ListNode", "name": "reverseKGroup1", "signature": "def reverseKGroup1(self, head, k)"...
2
stack_v2_sparse_classes_30k_train_004868
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def reverseKGroup1(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseKGroup(self, head, k): :type head: ListNode :type k: int :rtype: ListNode - def reverseKGroup1(self, head, k): :type head: ListNode :type k: int :rtype: ListNode <|sk...
b8ec1350e904665f1375c29a53f443ecf262d723
<|skeleton|> class Solution: def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_0|> def reverseKGroup1(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverseKGroup(self, head, k): """:type head: ListNode :type k: int :rtype: ListNode""" cur, check, count, cnt = (head, head, 0, 0) while count < k and check: check = check.next count += 1 if count == k: prev, next_node = (None, ...
the_stack_v2_python_sparse
leetcode/025k个一组翻转链表.py
ShawDa/Coding
train
0
51731af54c2afa0c4c44dc7606c5b83a8a184059
[ "self._node_dependencies = dict()\nfor event in events:\n for node in event.nodes:\n if not node.update_handler:\n node.update_handler = self\n if node.node_id not in self._node_dependencies:\n self._node_dependencies[node.node_id] = []\n self._node_dependencies[node.no...
<|body_start_0|> self._node_dependencies = dict() for event in events: for node in event.nodes: if not node.update_handler: node.update_handler = self if node.node_id not in self._node_dependencies: self._node_dependenci...
Handles node updates - when a node updates, handler propagates that change by finding every event that happens at that node and updates their state variables. Prevents having to recalculate state variables for all events on every timestep.
UpdateHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateHandler: """Handles node updates - when a node updates, handler propagates that change by finding every event that happens at that node and updates their state variables. Prevents having to recalculate state variables for all events on every timestep.""" def __init__(self, events): ...
stack_v2_sparse_classes_36k_train_027010
1,733
no_license
[ { "docstring": "Create a new event handler. :param events: List of all events", "name": "__init__", "signature": "def __init__(self, events)" }, { "docstring": "Given a node, update the state variables of the events that occur at that node (as its subpopulation has been altered) :param node: The...
2
null
Implement the Python class `UpdateHandler` described below. Class description: Handles node updates - when a node updates, handler propagates that change by finding every event that happens at that node and updates their state variables. Prevents having to recalculate state variables for all events on every timestep. ...
Implement the Python class `UpdateHandler` described below. Class description: Handles node updates - when a node updates, handler propagates that change by finding every event that happens at that node and updates their state variables. Prevents having to recalculate state variables for all events on every timestep. ...
46f25179f55e34aae3a40fef6826b60cf6cc816a
<|skeleton|> class UpdateHandler: """Handles node updates - when a node updates, handler propagates that change by finding every event that happens at that node and updates their state variables. Prevents having to recalculate state variables for all events on every timestep.""" def __init__(self, events): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateHandler: """Handles node updates - when a node updates, handler propagates that change by finding every event that happens at that node and updates their state variables. Prevents having to recalculate state variables for all events on every timestep.""" def __init__(self, events): """Creat...
the_stack_v2_python_sparse
ComMeN/Dynamics/UpdateHandler.py
iftikhar8/ComMeN
train
0
1bcc30a820d7bc38d7387ab645dfa02320fabb37
[ "self.last_results = []\nself.host = config[CONF_HOST]\nself.username = config[CONF_USERNAME]\nself.password = config[CONF_PASSWORD]\nself.success_init = True\ntry:\n self.fritz_box = FritzHosts(address=self.host, user=self.username, password=self.password)\nexcept (ValueError, TypeError):\n self.fritz_box = ...
<|body_start_0|> self.last_results = [] self.host = config[CONF_HOST] self.username = config[CONF_USERNAME] self.password = config[CONF_PASSWORD] self.success_init = True try: self.fritz_box = FritzHosts(address=self.host, user=self.username, password=self.pas...
This class queries a FRITZ!Box router.
FritzBoxScanner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FritzBoxScanner: """This class queries a FRITZ!Box router.""" def __init__(self, config): """Initialize the scanner.""" <|body_0|> def scan_devices(self): """Scan for new devices and return a list of found device ids.""" <|body_1|> def get_device_nam...
stack_v2_sparse_classes_36k_train_027011
3,266
permissive
[ { "docstring": "Initialize the scanner.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Scan for new devices and return a list of found device ids.", "name": "scan_devices", "signature": "def scan_devices(self)" }, { "docstring": "Return the nam...
5
null
Implement the Python class `FritzBoxScanner` described below. Class description: This class queries a FRITZ!Box router. Method signatures and docstrings: - def __init__(self, config): Initialize the scanner. - def scan_devices(self): Scan for new devices and return a list of found device ids. - def get_device_name(se...
Implement the Python class `FritzBoxScanner` described below. Class description: This class queries a FRITZ!Box router. Method signatures and docstrings: - def __init__(self, config): Initialize the scanner. - def scan_devices(self): Scan for new devices and return a list of found device ids. - def get_device_name(se...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class FritzBoxScanner: """This class queries a FRITZ!Box router.""" def __init__(self, config): """Initialize the scanner.""" <|body_0|> def scan_devices(self): """Scan for new devices and return a list of found device ids.""" <|body_1|> def get_device_nam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FritzBoxScanner: """This class queries a FRITZ!Box router.""" def __init__(self, config): """Initialize the scanner.""" self.last_results = [] self.host = config[CONF_HOST] self.username = config[CONF_USERNAME] self.password = config[CONF_PASSWORD] self.suc...
the_stack_v2_python_sparse
homeassistant/components/fritz/device_tracker.py
tchellomello/home-assistant
train
8
cfc4f47baa6c676f0068021e7627d42581e9fd85
[ "profile_ = Profile.objects.filter(user=request_user_obj).first()\narticle_ = self.model.objects.filter(slug=article_slug).first()\narticle_.favoritesCount = article_.favorites.count() + 1\narticle_.favorited = True\narticle_.favorites.add(profile_)\narticle_.save()\nreturn favorite_actions_messages.get('favorited'...
<|body_start_0|> profile_ = Profile.objects.filter(user=request_user_obj).first() article_ = self.model.objects.filter(slug=article_slug).first() article_.favoritesCount = article_.favorites.count() + 1 article_.favorited = True article_.favorites.add(profile_) article_.s...
ArticleManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleManager: def handle_favorite_actions(self, request_user_obj, article_slug): """Enales both favoriting of articles Args: request_user_obj: Django http request user article_slug: Article model instance""" <|body_0|> def handle_unfavorite(self, **kwargs): """Hand...
stack_v2_sparse_classes_36k_train_027012
5,634
permissive
[ { "docstring": "Enales both favoriting of articles Args: request_user_obj: Django http request user article_slug: Article model instance", "name": "handle_favorite_actions", "signature": "def handle_favorite_actions(self, request_user_obj, article_slug)" }, { "docstring": "Handles unfavoriting o...
2
null
Implement the Python class `ArticleManager` described below. Class description: Implement the ArticleManager class. Method signatures and docstrings: - def handle_favorite_actions(self, request_user_obj, article_slug): Enales both favoriting of articles Args: request_user_obj: Django http request user article_slug: A...
Implement the Python class `ArticleManager` described below. Class description: Implement the ArticleManager class. Method signatures and docstrings: - def handle_favorite_actions(self, request_user_obj, article_slug): Enales both favoriting of articles Args: request_user_obj: Django http request user article_slug: A...
60c830977fa39a7eea9ab978a9ba0c3beb0c4d88
<|skeleton|> class ArticleManager: def handle_favorite_actions(self, request_user_obj, article_slug): """Enales both favoriting of articles Args: request_user_obj: Django http request user article_slug: Article model instance""" <|body_0|> def handle_unfavorite(self, **kwargs): """Hand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArticleManager: def handle_favorite_actions(self, request_user_obj, article_slug): """Enales both favoriting of articles Args: request_user_obj: Django http request user article_slug: Article model instance""" profile_ = Profile.objects.filter(user=request_user_obj).first() article_ = ...
the_stack_v2_python_sparse
authors/apps/articles/models.py
andela/Ah-backend-xmen
train
4
2b896966bd93afb60e6662b5400c54aa3edef7ff
[ "full_layer_specs = []\nfor i, layer_spec in enumerate(layer_specs):\n stride = 2 if i == 0 else 1\n full_layer_spec = [3, layer_spec[0], layer_spec[1], stride]\n full_layer_specs.append(full_layer_spec)\nsuper().__init__(name=name, layer_specs=full_layer_specs, activation_fn=activation_fn, last_activation...
<|body_start_0|> full_layer_specs = [] for i, layer_spec in enumerate(layer_specs): stride = 2 if i == 0 else 1 full_layer_spec = [3, layer_spec[0], layer_spec[1], stride] full_layer_specs.append(full_layer_spec) super().__init__(name=name, layer_specs=full_la...
DownSamplingConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DownSamplingConnection: def __init__(self, name, layer_specs, activation_fn=leaky_relu, regularizer=None): """:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists of [nu...
stack_v2_sparse_classes_36k_train_027013
6,555
no_license
[ { "docstring": ":param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists of [num_output_features, dilation]. :param activation_fn: Tensorflow activation function. This will not be applied on the la...
2
stack_v2_sparse_classes_30k_train_006196
Implement the Python class `DownSamplingConnection` described below. Class description: Implement the DownSamplingConnection class. Method signatures and docstrings: - def __init__(self, name, layer_specs, activation_fn=leaky_relu, regularizer=None): :param name: Str. For variable scoping. :param layer_specs: Array o...
Implement the Python class `DownSamplingConnection` described below. Class description: Implement the DownSamplingConnection class. Method signatures and docstrings: - def __init__(self, name, layer_specs, activation_fn=leaky_relu, regularizer=None): :param name: Str. For variable scoping. :param layer_specs: Array o...
494d503c729ba018614fc742f1aee1e48d37127e
<|skeleton|> class DownSamplingConnection: def __init__(self, name, layer_specs, activation_fn=leaky_relu, regularizer=None): """:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists of [nu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DownSamplingConnection: def __init__(self, name, layer_specs, activation_fn=leaky_relu, regularizer=None): """:param name: Str. For variable scoping. :param layer_specs: Array of shape [num_layers, 2]. Constrained version of parent class' layer_specs. The second dimension consists of [num_output_featu...
the_stack_v2_python_sparse
context_interp/gridnet/connections/connections.py
NeedsMorePie/interpolator
train
2
e93e366ca062494ce59a1196eb02a3ae4e63152c
[ "super(ReactorStepwise, self).__init__(achem, mols)\nself.maxtime = 0.0\nself.time = 0.0\nif isinstance(rngseed, random.Random):\n self.rng = rngseed\nelse:\n self.rng = random.Random(rngseed)", "self.maxtime += time\nwhile self.time < self.maxtime:\n self.mols = tuple(self.rng.sample(self.mols, len(self...
<|body_start_0|> super(ReactorStepwise, self).__init__(achem, mols) self.maxtime = 0.0 self.time = 0.0 if isinstance(rngseed, random.Random): self.rng = rngseed else: self.rng = random.Random(rngseed) <|end_body_0|> <|body_start_1|> self.maxtime +...
Reactor object that reacts all molecules in parallel.
ReactorStepwise
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReactorStepwise: """Reactor object that reacts all molecules in parallel.""" def __init__(self, achem, mols, rngseed=None): """:param achem: :py:class:`achemkit.achem.AChem` object or equivalent. :param mols: Molecules to start from. :param rngseed: Instance of :py:class:`random.Rand...
stack_v2_sparse_classes_36k_train_027014
7,950
permissive
[ { "docstring": ":param achem: :py:class:`achemkit.achem.AChem` object or equivalent. :param mols: Molecules to start from. :param rngseed: Instance of :py:class:`random.Random` or seed for :py:class:`random.Random`", "name": "__init__", "signature": "def __init__(self, achem, mols, rngseed=None)" }, ...
2
stack_v2_sparse_classes_30k_train_019245
Implement the Python class `ReactorStepwise` described below. Class description: Reactor object that reacts all molecules in parallel. Method signatures and docstrings: - def __init__(self, achem, mols, rngseed=None): :param achem: :py:class:`achemkit.achem.AChem` object or equivalent. :param mols: Molecules to start...
Implement the Python class `ReactorStepwise` described below. Class description: Reactor object that reacts all molecules in parallel. Method signatures and docstrings: - def __init__(self, achem, mols, rngseed=None): :param achem: :py:class:`achemkit.achem.AChem` object or equivalent. :param mols: Molecules to start...
4800044693fdf8a228430eae5ee8b0283fde9920
<|skeleton|> class ReactorStepwise: """Reactor object that reacts all molecules in parallel.""" def __init__(self, achem, mols, rngseed=None): """:param achem: :py:class:`achemkit.achem.AChem` object or equivalent. :param mols: Molecules to start from. :param rngseed: Instance of :py:class:`random.Rand...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReactorStepwise: """Reactor object that reacts all molecules in parallel.""" def __init__(self, achem, mols, rngseed=None): """:param achem: :py:class:`achemkit.achem.AChem` object or equivalent. :param mols: Molecules to start from. :param rngseed: Instance of :py:class:`random.Random` or seed f...
the_stack_v2_python_sparse
achemkit/sim/simple.py
afaulconbridge/PyAChemKit
train
2
7fd6c314a5d1375382a41fb7fce969f51bed6ec7
[ "from math import floor, sqrt\nrt = []\nfor i in range(1, int(floor(target / 2)) + 1):\n n = (1 - 2 * i + sqrt((2 * i - 1) ** 2 + target * 8)) / 2\n if n % 1 == 0:\n rt.append([i + x for x in range(int(n))])\nreturn rt", "res = []\nfor n in range(2, target + 1):\n temp = target - n * (n - 1) // 2\...
<|body_start_0|> from math import floor, sqrt rt = [] for i in range(1, int(floor(target / 2)) + 1): n = (1 - 2 * i + sqrt((2 * i - 1) ** 2 + target * 8)) / 2 if n % 1 == 0: rt.append([i + x for x in range(int(n))]) return rt <|end_body_0|> <|body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findContinuousSequence(self, target): """:type target: int :rtype: List[List[int]] 执行用时 :120 ms, 在所有 Python 提交中击败了39.29%的用户 内存消耗 :13 MB, 在所有 Python 提交中击败了100.00%的用户""" <|body_0|> def findContinuousSequence2(self, target): """执行用时 :28 ms, 在所有 Python 提交中击...
stack_v2_sparse_classes_36k_train_027015
1,327
no_license
[ { "docstring": ":type target: int :rtype: List[List[int]] 执行用时 :120 ms, 在所有 Python 提交中击败了39.29%的用户 内存消耗 :13 MB, 在所有 Python 提交中击败了100.00%的用户", "name": "findContinuousSequence", "signature": "def findContinuousSequence(self, target)" }, { "docstring": "执行用时 :28 ms, 在所有 Python 提交中击败了92.86%的用户内存消耗 :...
2
stack_v2_sparse_classes_30k_train_020186
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findContinuousSequence(self, target): :type target: int :rtype: List[List[int]] 执行用时 :120 ms, 在所有 Python 提交中击败了39.29%的用户 内存消耗 :13 MB, 在所有 Python 提交中击败了100.00%的用户 - def findCo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findContinuousSequence(self, target): :type target: int :rtype: List[List[int]] 执行用时 :120 ms, 在所有 Python 提交中击败了39.29%的用户 内存消耗 :13 MB, 在所有 Python 提交中击败了100.00%的用户 - def findCo...
ce644a08dc7fd5efe8cc876dbbfe9be4e1371a15
<|skeleton|> class Solution: def findContinuousSequence(self, target): """:type target: int :rtype: List[List[int]] 执行用时 :120 ms, 在所有 Python 提交中击败了39.29%的用户 内存消耗 :13 MB, 在所有 Python 提交中击败了100.00%的用户""" <|body_0|> def findContinuousSequence2(self, target): """执行用时 :28 ms, 在所有 Python 提交中击...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findContinuousSequence(self, target): """:type target: int :rtype: List[List[int]] 执行用时 :120 ms, 在所有 Python 提交中击败了39.29%的用户 内存消耗 :13 MB, 在所有 Python 提交中击败了100.00%的用户""" from math import floor, sqrt rt = [] for i in range(1, int(floor(target / 2)) + 1): ...
the_stack_v2_python_sparse
leetcode - 副本/S0034_R57_findContinuousSequence.py
shcqupc/hankPylib
train
0
e03b51a3fc4941fce2cf4073d6237bc18194e2d5
[ "_trie = lambda: collections.defaultdict(_trie)\nself.__trie = _trie()\nfor weight, word in enumerate(words):\n word += '#'\n for i in xrange(len(word)):\n cur = self.__trie\n cur['_weight'] = weight\n for j in xrange(i, 2 * len(word) - 1):\n cur = cur[word[j % len(word)]]\n ...
<|body_start_0|> _trie = lambda: collections.defaultdict(_trie) self.__trie = _trie() for weight, word in enumerate(words): word += '#' for i in xrange(len(word)): cur = self.__trie cur['_weight'] = weight for j in xrange(i,...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> _trie = lambda: collections.defaultdict(_t...
stack_v2_sparse_classes_36k_train_027016
6,086
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
null
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordFilter: def __init__(self, words): """:type words: List[str]""" _trie = lambda: collections.defaultdict(_trie) self.__trie = _trie() for weight, word in enumerate(words): word += '#' for i in xrange(len(word)): cur = self.__trie ...
the_stack_v2_python_sparse
leetcode_python/Design/prefix-and-suffix-search.py
yennanliu/CS_basics
train
64
b69832fcc4f72576a6d96e138a8f4bc9a006f0be
[ "username = user.username\nsalt_bytes = str(random.random()).encode('utf-8')\nsalt = hashlib.sha1(salt_bytes).hexdigest()[:5]\nhash_input = (salt + username).encode('utf-8')\nactivation_key = hashlib.sha1(hash_input).hexdigest()\nreturn activation_key", "if not SHA1_RE.search(activation_key):\n return Response...
<|body_start_0|> username = user.username salt_bytes = str(random.random()).encode('utf-8') salt = hashlib.sha1(salt_bytes).hexdigest()[:5] hash_input = (salt + username).encode('utf-8') activation_key = hashlib.sha1(hash_input).hexdigest() return activation_key <|end_bod...
UserActivator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserActivator: def create_activation_key(user): """Create an activation key by using salt and SHA1.""" <|body_0|> def activate_user(uidb36, activation_key): """Validate an activation key and activate the corresponding user if valid. Parameters: * uidb36 * activation ...
stack_v2_sparse_classes_36k_train_027017
35,987
no_license
[ { "docstring": "Create an activation key by using salt and SHA1.", "name": "create_activation_key", "signature": "def create_activation_key(user)" }, { "docstring": "Validate an activation key and activate the corresponding user if valid. Parameters: * uidb36 * activation key Returns * 404 - E_U...
2
null
Implement the Python class `UserActivator` described below. Class description: Implement the UserActivator class. Method signatures and docstrings: - def create_activation_key(user): Create an activation key by using salt and SHA1. - def activate_user(uidb36, activation_key): Validate an activation key and activate t...
Implement the Python class `UserActivator` described below. Class description: Implement the UserActivator class. Method signatures and docstrings: - def create_activation_key(user): Create an activation key by using salt and SHA1. - def activate_user(uidb36, activation_key): Validate an activation key and activate t...
28d5f3fd0b4deb6909aeda97f17f2994eaffd48a
<|skeleton|> class UserActivator: def create_activation_key(user): """Create an activation key by using salt and SHA1.""" <|body_0|> def activate_user(uidb36, activation_key): """Validate an activation key and activate the corresponding user if valid. Parameters: * uidb36 * activation ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserActivator: def create_activation_key(user): """Create an activation key by using salt and SHA1.""" username = user.username salt_bytes = str(random.random()).encode('utf-8') salt = hashlib.sha1(salt_bytes).hexdigest()[:5] hash_input = (salt + username).encode('utf-8...
the_stack_v2_python_sparse
api/authMana/views.py
minhdo6487/api-proto
train
0
34d0ba54e7a1360bcfb5d4e13570bf273880857e
[ "the_dir = 'insightiq_export_1234567890'\nthe_file = '../somefile'\nactual = iiqtools_tar_to_zip.joinname(the_dir, the_file)\nexpected = 'insightiq_export_1234567890/somefile'\nself.assertEqual(actual, expected)", "the_dir = 'insightiq_export_1234567890'\nthe_file = '/datastore/somefile'\nactual = iiqtools_tar_to...
<|body_start_0|> the_dir = 'insightiq_export_1234567890' the_file = '../somefile' actual = iiqtools_tar_to_zip.joinname(the_dir, the_file) expected = 'insightiq_export_1234567890/somefile' self.assertEqual(actual, expected) <|end_body_0|> <|body_start_1|> the_dir = 'insi...
A suite of tests for the joinname function
TestJoinname
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestJoinname: """A suite of tests for the joinname function""" def test_relative_path(self): """joinname - works with relative paths""" <|body_0|> def test_absolute_path(self): """joinname - works with absolute paths""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_027018
7,801
permissive
[ { "docstring": "joinname - works with relative paths", "name": "test_relative_path", "signature": "def test_relative_path(self)" }, { "docstring": "joinname - works with absolute paths", "name": "test_absolute_path", "signature": "def test_absolute_path(self)" } ]
2
stack_v2_sparse_classes_30k_train_008013
Implement the Python class `TestJoinname` described below. Class description: A suite of tests for the joinname function Method signatures and docstrings: - def test_relative_path(self): joinname - works with relative paths - def test_absolute_path(self): joinname - works with absolute paths
Implement the Python class `TestJoinname` described below. Class description: A suite of tests for the joinname function Method signatures and docstrings: - def test_relative_path(self): joinname - works with relative paths - def test_absolute_path(self): joinname - works with absolute paths <|skeleton|> class TestJ...
a44a8ee9a299c7711b3abd69d21c24f55f2ae84e
<|skeleton|> class TestJoinname: """A suite of tests for the joinname function""" def test_relative_path(self): """joinname - works with relative paths""" <|body_0|> def test_absolute_path(self): """joinname - works with absolute paths""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestJoinname: """A suite of tests for the joinname function""" def test_relative_path(self): """joinname - works with relative paths""" the_dir = 'insightiq_export_1234567890' the_file = '../somefile' actual = iiqtools_tar_to_zip.joinname(the_dir, the_file) expecte...
the_stack_v2_python_sparse
iiqtools_tests/test_iiqtools_tar_to_zip.py
willnx/iiqtools
train
5
e7337b6e9dd27871838fb0bbd4b022abd2804d1c
[ "self.model_conf = model_conf\nself.inputs = inputs\nself.utils = utils\nself.layer = None", "with tf.keras.backend.name_scope('BiLSTM'):\n self.layer = tf.keras.layers.Bidirectional(layer=tf.keras.layers.CuDNNLSTM(units=self.model_conf.units_num, return_sequences=True))\n outputs = self.layer(self.inputs, ...
<|body_start_0|> self.model_conf = model_conf self.inputs = inputs self.utils = utils self.layer = None <|end_body_0|> <|body_start_1|> with tf.keras.backend.name_scope('BiLSTM'): self.layer = tf.keras.layers.Bidirectional(layer=tf.keras.layers.CuDNNLSTM(units=self.m...
BiLSTMcuDNN
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BiLSTMcuDNN: def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """同上""" <|body_0|> def build(self): """同上""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.model_conf = model_conf self.inputs = inputs ...
stack_v2_sparse_classes_36k_train_027019
3,290
permissive
[ { "docstring": "同上", "name": "__init__", "signature": "def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils)" }, { "docstring": "同上", "name": "build", "signature": "def build(self)" } ]
2
stack_v2_sparse_classes_30k_train_020845
Implement the Python class `BiLSTMcuDNN` described below. Class description: Implement the BiLSTMcuDNN class. Method signatures and docstrings: - def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): 同上 - def build(self): 同上
Implement the Python class `BiLSTMcuDNN` described below. Class description: Implement the BiLSTMcuDNN class. Method signatures and docstrings: - def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): 同上 - def build(self): 同上 <|skeleton|> class BiLSTMcuDNN: def __init__(self, model...
6fd35c0c789aaa43130de46d4c04622ec2948052
<|skeleton|> class BiLSTMcuDNN: def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """同上""" <|body_0|> def build(self): """同上""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BiLSTMcuDNN: def __init__(self, model_conf: ModelConfig, inputs: tf.Tensor, utils: NetworkUtils): """同上""" self.model_conf = model_conf self.inputs = inputs self.utils = utils self.layer = None def build(self): """同上""" with tf.keras.backend.name_sc...
the_stack_v2_python_sparse
network/LSTM.py
kerlomz/captcha_trainer
train
2,977
c372fa7fcdfdfbb04fe4dab3378a82e829ff7a10
[ "if isinstance(model, str):\n model = model.lower()\n if model.startswith('brownian'):\n model = msd.BrownianMotion\n elif model.startswith('anomalous'):\n model = msd.AnomalousDiffusion\n else:\n raise ValueError('Unknown model: ' + model)\nself.msd_fits = [model(md, **kwargs) for ...
<|body_start_0|> if isinstance(model, str): model = model.lower() if model.startswith('brownian'): model = msd.BrownianMotion elif model.startswith('anomalous'): model = msd.AnomalousDiffusion else: raise ValueError(...
Fit diffusion parameters to MSDs from square displacement dists
MsdDistFit
[ "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MsdDistFit: """Fit diffusion parameters to MSDs from square displacement dists""" def __init__(self, msd_data, model, weight_data, **kwargs): """Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {"brownia...
stack_v2_sparse_classes_36k_train_027020
29,188
permissive
[ { "docstring": "Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {\"brownian\", \"anomalous\", model class} Model to fit. If \"brownian\", use :py:class:`msd.BrownianMotion`. If \"anomalous\", use :py:class:`msd.AnomalousDiffusion`...
3
stack_v2_sparse_classes_30k_train_014075
Implement the Python class `MsdDistFit` described below. Class description: Fit diffusion parameters to MSDs from square displacement dists Method signatures and docstrings: - def __init__(self, msd_data, model, weight_data, **kwargs): Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance sh...
Implement the Python class `MsdDistFit` described below. Class description: Fit diffusion parameters to MSDs from square displacement dists Method signatures and docstrings: - def __init__(self, msd_data, model, weight_data, **kwargs): Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance sh...
2f953e553f32118c3ad1f244481e5a0ac6c533f0
<|skeleton|> class MsdDistFit: """Fit diffusion parameters to MSDs from square displacement dists""" def __init__(self, msd_data, model, weight_data, **kwargs): """Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {"brownia...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MsdDistFit: """Fit diffusion parameters to MSDs from square displacement dists""" def __init__(self, msd_data, model, weight_data, **kwargs): """Parameters ---------- msd_data : list of msd_base.MsdData Each MsdData instance should contain MSD data for one component model : {"brownian", "anomalou...
the_stack_v2_python_sparse
sdt/motion/msd_dist.py
schuetzgroup/sdt-python
train
31
7ce57df5ee0eb2a0ca584038fb26a54eb517a370
[ "try:\n return_data = AutoMlCommon().update_parm_obj(nnid, request.data)\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))", "try:\n return_data = AutoMlCommon().get_parm_obj(nnid)\n r...
<|body_start_0|> try: return_data = AutoMlCommon().update_parm_obj(nnid, request.data) return Response(json.dumps(return_data)) except Exception as e: return_data = {'status': '404', 'result': str(e)} return Response(json.dumps(return_data)) <|end_body_0|>...
RunManagerAutoParm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManagerAutoParm: def post(self, request, nnid): """Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data ...
stack_v2_sparse_classes_36k_train_027021
4,933
permissive
[ { "docstring": "Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data (3) Select Type of Anal algorithm (4) Select range of hyper pa...
4
null
Implement the Python class `RunManagerAutoParm` described below. Class description: Implement the RunManagerAutoParm class. Method signatures and docstrings: - def post(self, request, nnid): Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by...
Implement the Python class `RunManagerAutoParm` described below. Class description: Implement the RunManagerAutoParm class. Method signatures and docstrings: - def post(self, request, nnid): Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class RunManagerAutoParm: def post(self, request, nnid): """Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunManagerAutoParm: def post(self, request, nnid): """Manage hyperparameter for GA algorithm like eval, population, survive etc Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch) (1) Define AutoML Graph definition (2) Select Type of Data (3) Select Typ...
the_stack_v2_python_sparse
api/views/runmanager_auto_parm.py
yurimkoo/tensormsa
train
1
6a20795f2d81265cf43fd2abb76c313746df8e59
[ "command_name = 'ews-find-folders'\nraw_response = RAW_RESPONSES[command_name]\nexpected = COMMAND_OUTPUTS[command_name]\nclient = self.MockClient()\nclient.account.walk_res = raw_response\nres = find_folders(client)\nactual_ec = res[1]\nassert expected == actual_ec", "command_name = 'ews-get-searchable-mailboxes...
<|body_start_0|> command_name = 'ews-find-folders' raw_response = RAW_RESPONSES[command_name] expected = COMMAND_OUTPUTS[command_name] client = self.MockClient() client.account.walk_res = raw_response res = find_folders(client) actual_ec = res[1] assert ex...
The test class checks the following normal_commands: * ews-find-folders * ews-expand-group * ews-get-searchable-mailboxes * ews-expand-group
TestNormalCommands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNormalCommands: """The test class checks the following normal_commands: * ews-find-folders * ews-expand-group * ews-get-searchable-mailboxes * ews-expand-group""" def test_ews_find_folders(self): """This test checks the following normal_command: * ews-find-folders Using this meth...
stack_v2_sparse_classes_36k_train_027022
8,216
permissive
[ { "docstring": "This test checks the following normal_command: * ews-find-folders Using this method: Given: - command name is ews-find-folders - client function name to mock - expected raw result - expected command result When: - we want to execute the command function Then: - the expected result will be the sa...
3
null
Implement the Python class `TestNormalCommands` described below. Class description: The test class checks the following normal_commands: * ews-find-folders * ews-expand-group * ews-get-searchable-mailboxes * ews-expand-group Method signatures and docstrings: - def test_ews_find_folders(self): This test checks the fol...
Implement the Python class `TestNormalCommands` described below. Class description: The test class checks the following normal_commands: * ews-find-folders * ews-expand-group * ews-get-searchable-mailboxes * ews-expand-group Method signatures and docstrings: - def test_ews_find_folders(self): This test checks the fol...
82c82bbee7d428f0b14991a88c67672e2c02f5af
<|skeleton|> class TestNormalCommands: """The test class checks the following normal_commands: * ews-find-folders * ews-expand-group * ews-get-searchable-mailboxes * ews-expand-group""" def test_ews_find_folders(self): """This test checks the following normal_command: * ews-find-folders Using this meth...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNormalCommands: """The test class checks the following normal_commands: * ews-find-folders * ews-expand-group * ews-get-searchable-mailboxes * ews-expand-group""" def test_ews_find_folders(self): """This test checks the following normal_command: * ews-find-folders Using this method: Given: - ...
the_stack_v2_python_sparse
Packs/EWS/Integrations/EWSO365/EWSO365_test.py
EmersonElectricCo/content
train
2
878a24eb27ab552a816697767efb528bebb0be53
[ "true_pred = always_true()\nself.id_pred = true_pred\nself.value_pred = true_pred\nself.time_pred = true_pred\nif is_predicate(id_pred):\n self.id_pred = id_pred\nif is_predicate(value_pred):\n self.value_pred = value_pred\nif is_predicate(time_pred):\n self.time_pred = time_pred", "if not isinstance(tel...
<|body_start_0|> true_pred = always_true() self.id_pred = true_pred self.value_pred = true_pred self.time_pred = true_pred if is_predicate(id_pred): self.id_pred = id_pred if is_predicate(value_pred): self.value_pred = value_pred if is_pred...
telemetry_predicate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class telemetry_predicate: def __init__(self, id_pred=None, value_pred=None, time_pred=None): """A predicate for specifying a ChData object from data_types.ch_data. This predicate can be used to search a history. If arguments passed into this constructor are not subclasses of predicate, they w...
stack_v2_sparse_classes_36k_train_027023
19,146
permissive
[ { "docstring": "A predicate for specifying a ChData object from data_types.ch_data. This predicate can be used to search a history. If arguments passed into this constructor are not subclasses of predicate, they will be ignored.If an argument is unspecified, the predicate will ignore that field when evaluating ...
3
stack_v2_sparse_classes_30k_train_012263
Implement the Python class `telemetry_predicate` described below. Class description: Implement the telemetry_predicate class. Method signatures and docstrings: - def __init__(self, id_pred=None, value_pred=None, time_pred=None): A predicate for specifying a ChData object from data_types.ch_data. This predicate can be...
Implement the Python class `telemetry_predicate` described below. Class description: Implement the telemetry_predicate class. Method signatures and docstrings: - def __init__(self, id_pred=None, value_pred=None, time_pred=None): A predicate for specifying a ChData object from data_types.ch_data. This predicate can be...
aa663303327587146390dde67b83b9bf4e916d54
<|skeleton|> class telemetry_predicate: def __init__(self, id_pred=None, value_pred=None, time_pred=None): """A predicate for specifying a ChData object from data_types.ch_data. This predicate can be used to search a history. If arguments passed into this constructor are not subclasses of predicate, they w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class telemetry_predicate: def __init__(self, id_pred=None, value_pred=None, time_pred=None): """A predicate for specifying a ChData object from data_types.ch_data. This predicate can be used to search a history. If arguments passed into this constructor are not subclasses of predicate, they will be ignored...
the_stack_v2_python_sparse
Gds/src/fprime_gds/common/testing_fw/predicates.py
suriyaa/fprime
train
1
6c89dbc9f61c9fb734c5d383eabecfae4100c1d1
[ "with open(filename, newline='') as csvfile:\n dict_list = []\n csv_data = csv.reader(csvfile)\n headers = next(csv_data, None)\n if headers[0].startswith(''):\n headers[0] = headers[0][3:]\n for row in csv_data:\n row_dict = {}\n for index, column in enumerate(headers):\n ...
<|body_start_0|> with open(filename, newline='') as csvfile: dict_list = [] csv_data = csv.reader(csvfile) headers = next(csv_data, None) if headers[0].startswith(''): headers[0] = headers[0][3:] for row in csv_data: ...
Meta class
Database
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """Meta class""" def _import_csv(self, filename): """Returns a list of dictionaries.One dictionary for each row of data in a csv file. :return: list of dictionaries""" <|body_0|> def _add_bulk_data(self, collection, directory_name, filename): """If it w...
stack_v2_sparse_classes_36k_train_027024
7,786
no_license
[ { "docstring": "Returns a list of dictionaries.One dictionary for each row of data in a csv file. :return: list of dictionaries", "name": "_import_csv", "signature": "def _import_csv(self, filename)" }, { "docstring": "If it works properly, it will handle the bulk imports from the csv files", ...
6
stack_v2_sparse_classes_30k_val_001063
Implement the Python class `Database` described below. Class description: Meta class Method signatures and docstrings: - def _import_csv(self, filename): Returns a list of dictionaries.One dictionary for each row of data in a csv file. :return: list of dictionaries - def _add_bulk_data(self, collection, directory_nam...
Implement the Python class `Database` described below. Class description: Meta class Method signatures and docstrings: - def _import_csv(self, filename): Returns a list of dictionaries.One dictionary for each row of data in a csv file. :return: list of dictionaries - def _add_bulk_data(self, collection, directory_nam...
ac12beeae8aa57135bbcd03ac7a4f977fa3bdb56
<|skeleton|> class Database: """Meta class""" def _import_csv(self, filename): """Returns a list of dictionaries.One dictionary for each row of data in a csv file. :return: list of dictionaries""" <|body_0|> def _add_bulk_data(self, collection, directory_name, filename): """If it w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Database: """Meta class""" def _import_csv(self, filename): """Returns a list of dictionaries.One dictionary for each row of data in a csv file. :return: list of dictionaries""" with open(filename, newline='') as csvfile: dict_list = [] csv_data = csv.reader(csvfil...
the_stack_v2_python_sparse
students/Shirin_A/lesson10/assignment/src/database.py
UWPCE-PythonCert-ClassRepos/py220-online-201904-V2
train
1
62ce2b5f4bd57ee67ad5ee567cdb4febfc4e029e
[ "self.name = brickname\nself.ops = []\nself.trainable_weights = []", "description = self.name + '\\n'\ndescription += '-' * len(self.name) + '\\n'\nfor op in self.ops:\n description += op.__str__() + '\\n'\nreturn description", "w = []\nfor op in self.ops:\n w += op.trainable_weights\nreturn w", "with t...
<|body_start_0|> self.name = brickname self.ops = [] self.trainable_weights = [] <|end_body_0|> <|body_start_1|> description = self.name + '\n' description += '-' * len(self.name) + '\n' for op in self.ops: description += op.__str__() + '\n' return de...
Neuralizer elementary brick.
Brick
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Brick: """Neuralizer elementary brick.""" def __init__(self, brickname): """Arguments: - brickname: a string to create the namescope of the brick.""" <|body_0|> def __str__(self): """Returns string representation of operations in the brick.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027025
6,948
no_license
[ { "docstring": "Arguments: - brickname: a string to create the namescope of the brick.", "name": "__init__", "signature": "def __init__(self, brickname)" }, { "docstring": "Returns string representation of operations in the brick.", "name": "__str__", "signature": "def __str__(self)" }...
4
stack_v2_sparse_classes_30k_train_012392
Implement the Python class `Brick` described below. Class description: Neuralizer elementary brick. Method signatures and docstrings: - def __init__(self, brickname): Arguments: - brickname: a string to create the namescope of the brick. - def __str__(self): Returns string representation of operations in the brick. -...
Implement the Python class `Brick` described below. Class description: Neuralizer elementary brick. Method signatures and docstrings: - def __init__(self, brickname): Arguments: - brickname: a string to create the namescope of the brick. - def __str__(self): Returns string representation of operations in the brick. -...
fc49204441ea2de3496b1781e88d87dd74d47bd3
<|skeleton|> class Brick: """Neuralizer elementary brick.""" def __init__(self, brickname): """Arguments: - brickname: a string to create the namescope of the brick.""" <|body_0|> def __str__(self): """Returns string representation of operations in the brick.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Brick: """Neuralizer elementary brick.""" def __init__(self, brickname): """Arguments: - brickname: a string to create the namescope of the brick.""" self.name = brickname self.ops = [] self.trainable_weights = [] def __str__(self): """Returns string represent...
the_stack_v2_python_sparse
neuralyzer/archi/bricks.py
ArnaudAbreu/neuralyzer
train
2
ca7b7dd63bafccdf224096b922a3730f1d50aa78
[ "data = KlifsToKissimData.from_structure_klifs_id(structure_klifs_id, klifs_session)\nif data is None:\n logger.warning(f'{structure_klifs_id}: Empty fingerprint (data unaccessible).')\n fingerprint = None\nelse:\n fingerprint = cls.from_text(data.text, data.extension, data.residue_ids, data.residue_ixs, d...
<|body_start_0|> data = KlifsToKissimData.from_structure_klifs_id(structure_klifs_id, klifs_session) if data is None: logger.warning(f'{structure_klifs_id}: Empty fingerprint (data unaccessible).') fingerprint = None else: fingerprint = cls.from_text(data.text...
Fingerprint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fingerprint: def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or No...
stack_v2_sparse_classes_36k_train_027026
5,476
permissive
[ { "docstring": "Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or None Local or remote KLIFS session. If None (default), set up remote KLIFS session. Returns ------- ...
4
stack_v2_sparse_classes_30k_train_017450
Implement the Python class `Fingerprint` described below. Class description: Implement the Fingerprint class. Method signatures and docstrings: - def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structu...
Implement the Python class `Fingerprint` described below. Class description: Implement the Fingerprint class. Method signatures and docstrings: - def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structu...
8433bb64062ed785503b96b52f39bbdb02f66381
<|skeleton|> class Fingerprint: def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Fingerprint: def from_structure_klifs_id(cls, structure_klifs_id, klifs_session=None): """Calculate fingerprint for a KLIFS structure (by structure KLIFS ID). Parameters ---------- structure_klifs_id : int Structure KLIFS ID. klifs_session : opencadd.databases.klifs.session.Session or None Local or re...
the_stack_v2_python_sparse
kissim/encoding/fingerprint.py
volkamerlab/kissim
train
26
0cc0f26d552854e769a8aff3c5d5c1a7b49a719f
[ "args = parser.parse(self.neighbor_params, request)\nobj = get_object_or_404(self.resource_object, id)\nreturn obj.neighbors(**args)", "obj = get_object_or_404(self.resource_object, id)\nargs = request.json\nlinks = []\nfor link in args:\n target = self.resource_object.get(link['target']['id'])\n links.appe...
<|body_start_0|> args = parser.parse(self.neighbor_params, request) obj = get_object_or_404(self.resource_object, id) return obj.neighbors(**args) <|end_body_0|> <|body_start_1|> obj = get_object_or_404(self.resource_object, id) args = request.json links = [] for...
Class describing resources to manipulate Entity objects.
EntityResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntityResource: """Class describing resources to manipulate Entity objects.""" def neighbors(self, id): """Fetch objects an object is related to. A (relationships_list, objects_list) tuple is built, the first list representing all the relationship data for a given object, the second ...
stack_v2_sparse_classes_36k_train_027027
3,189
permissive
[ { "docstring": "Fetch objects an object is related to. A (relationships_list, objects_list) tuple is built, the first list representing all the relationship data for a given object, the second list is all the objects referenced by those relationships. Args: id: The object's primary ID. Returns: A JSON represent...
3
stack_v2_sparse_classes_30k_train_006281
Implement the Python class `EntityResource` described below. Class description: Class describing resources to manipulate Entity objects. Method signatures and docstrings: - def neighbors(self, id): Fetch objects an object is related to. A (relationships_list, objects_list) tuple is built, the first list representing ...
Implement the Python class `EntityResource` described below. Class description: Class describing resources to manipulate Entity objects. Method signatures and docstrings: - def neighbors(self, id): Fetch objects an object is related to. A (relationships_list, objects_list) tuple is built, the first list representing ...
902db77e0f9dce7b8870ed653a8f7670864d146d
<|skeleton|> class EntityResource: """Class describing resources to manipulate Entity objects.""" def neighbors(self, id): """Fetch objects an object is related to. A (relationships_list, objects_list) tuple is built, the first list representing all the relationship data for a given object, the second ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntityResource: """Class describing resources to manipulate Entity objects.""" def neighbors(self, id): """Fetch objects an object is related to. A (relationships_list, objects_list) tuple is built, the first list representing all the relationship data for a given object, the second list is all t...
the_stack_v2_python_sparse
yeti/web/api/entity.py
yeti-platform/TibetanBrownBear
train
11
d9d58dee5e863da84060d38c5f8a4b7da15dac24
[ "self.cells = cells\nself.defval = defval\nself.hash_table = [[] for i in range(cells)]\nself.entries = 0", "hash_num = 0\nfor i, char in enumerate(key):\n hash_num += 37 ** (len(key) - i - 1) * ord(char)\nhash_num = hash_num % self.cells\nreturn hash_num", "if hash_num + 1 == self.cells:\n new_hash_num =...
<|body_start_0|> self.cells = cells self.defval = defval self.hash_table = [[] for i in range(cells)] self.entries = 0 <|end_body_0|> <|body_start_1|> hash_num = 0 for i, char in enumerate(key): hash_num += 37 ** (len(key) - i - 1) * ord(char) hash_nu...
Hash_Table
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hash_Table: def __init__(self, cells, defval): """Construct a bnew hash table with a fixed number of cells equal to the parameter "cells", and which yields the value defval upon a lookup to a key that has not previously been inserted""" <|body_0|> def hash_f(self, key): ...
stack_v2_sparse_classes_36k_train_027028
4,483
no_license
[ { "docstring": "Construct a bnew hash table with a fixed number of cells equal to the parameter \"cells\", and which yields the value defval upon a lookup to a key that has not previously been inserted", "name": "__init__", "signature": "def __init__(self, cells, defval)" }, { "docstring": "Calc...
6
stack_v2_sparse_classes_30k_train_006214
Implement the Python class `Hash_Table` described below. Class description: Implement the Hash_Table class. Method signatures and docstrings: - def __init__(self, cells, defval): Construct a bnew hash table with a fixed number of cells equal to the parameter "cells", and which yields the value defval upon a lookup to...
Implement the Python class `Hash_Table` described below. Class description: Implement the Hash_Table class. Method signatures and docstrings: - def __init__(self, cells, defval): Construct a bnew hash table with a fixed number of cells equal to the parameter "cells", and which yields the value defval upon a lookup to...
58089645ffb482085638af3f80b9896ec477b856
<|skeleton|> class Hash_Table: def __init__(self, cells, defval): """Construct a bnew hash table with a fixed number of cells equal to the parameter "cells", and which yields the value defval upon a lookup to a key that has not previously been inserted""" <|body_0|> def hash_f(self, key): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Hash_Table: def __init__(self, cells, defval): """Construct a bnew hash table with a fixed number of cells equal to the parameter "cells", and which yields the value defval upon a lookup to a key that has not previously been inserted""" self.cells = cells self.defval = defval s...
the_stack_v2_python_sparse
lbvalcke-master-121/lbvalcke-master-565f464834310c9a92ae8a2002105223b27c8bf7/pa5/Hash_Table.py
lbvalcke/Classwork
train
0
79fdcabfaf2278cca8db53c224566a12dc3fb3ab
[ "self.conn = None\nif options:\n self.setup(**options)", "self.host = options.get('host')\nself.port = int(options.get('port', '5432'))\nself.dbname = options.get('dbname')\nself.user = options.get('user')\nself.password = options.get('password')\nself.uri = options.get('uri')", "if not self.conn:\n if se...
<|body_start_0|> self.conn = None if options: self.setup(**options) <|end_body_0|> <|body_start_1|> self.host = options.get('host') self.port = int(options.get('port', '5432')) self.dbname = options.get('dbname') self.user = options.get('user') self.p...
JobTracker logs job activity to a database.
JobTracker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobTracker: """JobTracker logs job activity to a database.""" def __init__(self, **options): """Initialize the job tracker.""" <|body_0|> def setup(self, **options): """Set the configuration for the job tracker.""" <|body_1|> def _connect(self) -> ps...
stack_v2_sparse_classes_36k_train_027029
5,073
permissive
[ { "docstring": "Initialize the job tracker.", "name": "__init__", "signature": "def __init__(self, **options)" }, { "docstring": "Set the configuration for the job tracker.", "name": "setup", "signature": "def setup(self, **options)" }, { "docstring": "Internal function to create...
6
null
Implement the Python class `JobTracker` described below. Class description: JobTracker logs job activity to a database. Method signatures and docstrings: - def __init__(self, **options): Initialize the job tracker. - def setup(self, **options): Set the configuration for the job tracker. - def _connect(self) -> psycop...
Implement the Python class `JobTracker` described below. Class description: JobTracker logs job activity to a database. Method signatures and docstrings: - def __init__(self, **options): Initialize the job tracker. - def setup(self, **options): Set the configuration for the job tracker. - def _connect(self) -> psycop...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class JobTracker: """JobTracker logs job activity to a database.""" def __init__(self, **options): """Initialize the job tracker.""" <|body_0|> def setup(self, **options): """Set the configuration for the job tracker.""" <|body_1|> def _connect(self) -> ps...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobTracker: """JobTracker logs job activity to a database.""" def __init__(self, **options): """Initialize the job tracker.""" self.conn = None if options: self.setup(**options) def setup(self, **options): """Set the configuration for the job tracker.""" ...
the_stack_v2_python_sparse
jobs/permanent/ppr-discharges-for-mhr/src/ppr_discharges_for_mhr/services/job_tracking/job_tracker.py
bcgov/ppr
train
4
7f001edfae9b7ece495014d399590655a5a88045
[ "self.op_class = op_class\nself.op_arity = op_arity\nself.init_interval = init_interval\nself.renorm_function = renorm_function\nself.output_precision = output_precision\nself.input_precisions = input_precisions\nself.bench_name = bench_name", "initial_inputs = [Constant(random.uniform(inf(self.init_interval), su...
<|body_start_0|> self.op_class = op_class self.op_arity = op_arity self.init_interval = init_interval self.renorm_function = renorm_function self.output_precision = output_precision self.input_precisions = input_precisions self.bench_name = bench_name <|end_body_0...
Operation Unitary Bench class
OpUnitBench
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpUnitBench: """Operation Unitary Bench class""" def __init__(self, op_class, bench_name, op_arity=2, init_interval=Interval(-0.5, 0.5), renorm_function=lambda x: x, output_precision=ML_Binary32, input_precisions=[ML_Binary32, ML_Binary32]): """OpUnitBench ctor""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_027030
15,074
permissive
[ { "docstring": "OpUnitBench ctor", "name": "__init__", "signature": "def __init__(self, op_class, bench_name, op_arity=2, init_interval=Interval(-0.5, 0.5), renorm_function=lambda x: x, output_precision=ML_Binary32, input_precisions=[ML_Binary32, ML_Binary32])" }, { "docstring": "generate perfor...
2
stack_v2_sparse_classes_30k_train_004285
Implement the Python class `OpUnitBench` described below. Class description: Operation Unitary Bench class Method signatures and docstrings: - def __init__(self, op_class, bench_name, op_arity=2, init_interval=Interval(-0.5, 0.5), renorm_function=lambda x: x, output_precision=ML_Binary32, input_precisions=[ML_Binary3...
Implement the Python class `OpUnitBench` described below. Class description: Operation Unitary Bench class Method signatures and docstrings: - def __init__(self, op_class, bench_name, op_arity=2, init_interval=Interval(-0.5, 0.5), renorm_function=lambda x: x, output_precision=ML_Binary32, input_precisions=[ML_Binary3...
f96b1bc33a1cffd14cc322a770835cc7435de599
<|skeleton|> class OpUnitBench: """Operation Unitary Bench class""" def __init__(self, op_class, bench_name, op_arity=2, init_interval=Interval(-0.5, 0.5), renorm_function=lambda x: x, output_precision=ML_Binary32, input_precisions=[ML_Binary32, ML_Binary32]): """OpUnitBench ctor""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpUnitBench: """Operation Unitary Bench class""" def __init__(self, op_class, bench_name, op_arity=2, init_interval=Interval(-0.5, 0.5), renorm_function=lambda x: x, output_precision=ML_Binary32, input_precisions=[ML_Binary32, ML_Binary32]): """OpUnitBench ctor""" self.op_class = op_class...
the_stack_v2_python_sparse
metalibm_functions/unit_bench.py
metalibm/metalibm
train
23
696074b315583c9f977c55e211a1699912f9b5a1
[ "timestamp = kwargs.get('timestamp', None)\nif timestamp is None:\n kwargs['timestamp'] = int(time.time())\nself.__dict__.update(kwargs)", "rtmp_stream.write_ulong(self.first or 0)\nrtmp_stream.write_ulong(self.second or 0)\nrtmp_stream.write(self.payload)", "self.first = rtmp_stream.read_ulong()\nself.secon...
<|body_start_0|> timestamp = kwargs.get('timestamp', None) if timestamp is None: kwargs['timestamp'] = int(time.time()) self.__dict__.update(kwargs) <|end_body_0|> <|body_start_1|> rtmp_stream.write_ulong(self.first or 0) rtmp_stream.write_ulong(self.second or 0) ...
An RTMP handshake chunk. @ivar first: The first 4 bytes of the packet, represented as an unsigned long. @type first: 32bit unsigned int. @ivar second: The second 4 bytes of the packet, represented as an unsigned long. @type second: 32bit unsigned int. @ivar payload: A blob of data which makes up the rest of the packet....
HandshakeChunk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandshakeChunk: """An RTMP handshake chunk. @ivar first: The first 4 bytes of the packet, represented as an unsigned long. @type first: 32bit unsigned int. @ivar second: The second 4 bytes of the packet, represented as an unsigned long. @type second: 32bit unsigned int. @ivar payload: A blob of d...
stack_v2_sparse_classes_36k_train_027031
1,862
no_license
[ { "docstring": ":param kwargs:", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Encodes this packet to the RTMP stream. :param rtmp_stream:", "name": "encode", "signature": "def encode(self, rtmp_stream)" }, { "docstring": "Decodes this packet ...
3
stack_v2_sparse_classes_30k_train_004732
Implement the Python class `HandshakeChunk` described below. Class description: An RTMP handshake chunk. @ivar first: The first 4 bytes of the packet, represented as an unsigned long. @type first: 32bit unsigned int. @ivar second: The second 4 bytes of the packet, represented as an unsigned long. @type second: 32bit u...
Implement the Python class `HandshakeChunk` described below. Class description: An RTMP handshake chunk. @ivar first: The first 4 bytes of the packet, represented as an unsigned long. @type first: 32bit unsigned int. @ivar second: The second 4 bytes of the packet, represented as an unsigned long. @type second: 32bit u...
2750a7586a7d1cae95e62740d9972e276f16bcc0
<|skeleton|> class HandshakeChunk: """An RTMP handshake chunk. @ivar first: The first 4 bytes of the packet, represented as an unsigned long. @type first: 32bit unsigned int. @ivar second: The second 4 bytes of the packet, represented as an unsigned long. @type second: 32bit unsigned int. @ivar payload: A blob of d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HandshakeChunk: """An RTMP handshake chunk. @ivar first: The first 4 bytes of the packet, represented as an unsigned long. @type first: 32bit unsigned int. @ivar second: The second 4 bytes of the packet, represented as an unsigned long. @type second: 32bit unsigned int. @ivar payload: A blob of data which mak...
the_stack_v2_python_sparse
qrtmp/formats/handshake.py
GoelBiju/Qrtmp
train
8
14ff2c08a4a7d86cb0fd11c1a99e6a40f6fe8b0b
[ "new_rids = self.fingerprint_helper(FINGERPRINT_RULES)\nif not new_rids:\n return False\nreturn True", "def missed_rel(link):\n \"\"\"\n Callback to handle cases where a transform wasn't found to match a link (by relationship) in the input model\n \"\"\"\n warnings.warn(f'Unknown, s...
<|body_start_0|> new_rids = self.fingerprint_helper(FINGERPRINT_RULES) if not new_rids: return False return True <|end_body_0|> <|body_start_1|> def missed_rel(link): """ Callback to handle cases where a transform wasn't found to match a link ...
csv_schema_pipeline
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class csv_schema_pipeline: def fingerprint(self): """Generates fingerprints from the source model Result of the fingerprinting phase is that the output model shows the presence of each resource of primary interest expected to result from the transformation, with minimal detail such as the reso...
stack_v2_sparse_classes_36k_train_027032
5,630
permissive
[ { "docstring": "Generates fingerprints from the source model Result of the fingerprinting phase is that the output model shows the presence of each resource of primary interest expected to result from the transformation, with minimal detail such as the resource type", "name": "fingerprint", "signature":...
3
stack_v2_sparse_classes_30k_train_003882
Implement the Python class `csv_schema_pipeline` described below. Class description: Implement the csv_schema_pipeline class. Method signatures and docstrings: - def fingerprint(self): Generates fingerprints from the source model Result of the fingerprinting phase is that the output model shows the presence of each r...
Implement the Python class `csv_schema_pipeline` described below. Class description: Implement the csv_schema_pipeline class. Method signatures and docstrings: - def fingerprint(self): Generates fingerprints from the source model Result of the fingerprinting phase is that the output model shows the presence of each r...
9fd34102d6c04eba8890c5bba1bcbfccecda097c
<|skeleton|> class csv_schema_pipeline: def fingerprint(self): """Generates fingerprints from the source model Result of the fingerprinting phase is that the output model shows the presence of each resource of primary interest expected to result from the transformation, with minimal detail such as the reso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class csv_schema_pipeline: def fingerprint(self): """Generates fingerprints from the source model Result of the fingerprinting phase is that the output model shows the presence of each resource of primary interest expected to result from the transformation, with minimal detail such as the resource type""" ...
the_stack_v2_python_sparse
demo/ingest/csv_to_schemaorg.py
uogbuji/versa
train
8
60a03e5b5fe81c9dc1e08ca8ed48f6f3e3442d15
[ "self.analyzer = analyzer\nself.running = True\nTealThread.__init__(self)\nreturn", "try:\n try:\n while self.running:\n func, item = self.analyzer.queue.get()\n try:\n func(item)\n except ThreadKilled:\n raise\n except:\n ...
<|body_start_0|> self.analyzer = analyzer self.running = True TealThread.__init__(self) return <|end_body_0|> <|body_start_1|> try: try: while self.running: func, item = self.analyzer.queue.get() try: ...
This class is used to spawn a separate thread to run the analyzer in
AnalyzerAsynch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnalyzerAsynch: """This class is used to spawn a separate thread to run the analyzer in""" def __init__(self, analyzer): """Constructor""" <|body_0|> def run(self): """Wait on the input queue""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_027033
24,649
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, analyzer)" }, { "docstring": "Wait on the input queue", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `AnalyzerAsynch` described below. Class description: This class is used to spawn a separate thread to run the analyzer in Method signatures and docstrings: - def __init__(self, analyzer): Constructor - def run(self): Wait on the input queue
Implement the Python class `AnalyzerAsynch` described below. Class description: This class is used to spawn a separate thread to run the analyzer in Method signatures and docstrings: - def __init__(self, analyzer): Constructor - def run(self): Wait on the input queue <|skeleton|> class AnalyzerAsynch: """This cl...
eba6c1489b503fdcf040a126942643b355867bcd
<|skeleton|> class AnalyzerAsynch: """This class is used to spawn a separate thread to run the analyzer in""" def __init__(self, analyzer): """Constructor""" <|body_0|> def run(self): """Wait on the input queue""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnalyzerAsynch: """This class is used to spawn a separate thread to run the analyzer in""" def __init__(self, analyzer): """Constructor""" self.analyzer = analyzer self.running = True TealThread.__init__(self) return def run(self): """Wait on the input...
the_stack_v2_python_sparse
src/ibm/teal/analyzer/analyzer.py
ppjsand/pyteal
train
1
88c7e50743a6b0f67ae7506091ebbd45da0c44d7
[ "try:\n offset = int(offset)\nexcept (TypeError, ValueError):\n raise OffsetNotAnInteger('That offset is not an integer')\nreturn offset", "number = self.validate_number(self.validate_offset(offset) // self.per_page + 1)\nbottom = (number - 1) * self.per_page\ntop = bottom + self.per_page\nif top + self.orp...
<|body_start_0|> try: offset = int(offset) except (TypeError, ValueError): raise OffsetNotAnInteger('That offset is not an integer') return offset <|end_body_0|> <|body_start_1|> number = self.validate_number(self.validate_offset(offset) // self.per_page + 1) ...
Paginator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Paginator: def validate_offset(self, offset): """Validates the given offset.""" <|body_0|> def page_by_offset(self, offset): """Returns a Page object for the given offset.""" <|body_1|> def page(self, number): """Returns a Page object for the giv...
stack_v2_sparse_classes_36k_train_027034
1,705
no_license
[ { "docstring": "Validates the given offset.", "name": "validate_offset", "signature": "def validate_offset(self, offset)" }, { "docstring": "Returns a Page object for the given offset.", "name": "page_by_offset", "signature": "def page_by_offset(self, offset)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_test_000402
Implement the Python class `Paginator` described below. Class description: Implement the Paginator class. Method signatures and docstrings: - def validate_offset(self, offset): Validates the given offset. - def page_by_offset(self, offset): Returns a Page object for the given offset. - def page(self, number): Returns...
Implement the Python class `Paginator` described below. Class description: Implement the Paginator class. Method signatures and docstrings: - def validate_offset(self, offset): Validates the given offset. - def page_by_offset(self, offset): Returns a Page object for the given offset. - def page(self, number): Returns...
65c9820308b09a6ae1086c265f8d49e36f3724b9
<|skeleton|> class Paginator: def validate_offset(self, offset): """Validates the given offset.""" <|body_0|> def page_by_offset(self, offset): """Returns a Page object for the given offset.""" <|body_1|> def page(self, number): """Returns a Page object for the giv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Paginator: def validate_offset(self, offset): """Validates the given offset.""" try: offset = int(offset) except (TypeError, ValueError): raise OffsetNotAnInteger('That offset is not an integer') return offset def page_by_offset(self, offset): ...
the_stack_v2_python_sparse
publication_backbone/utils/paginator.py
Excentrics/publication-backbone
train
6
1d65a7fa38d7d05a8293ab8fa6cd19c4b2613925
[ "self.id = id\nself.friends = self.generate_friends()\nself.motivation = 90\nself.aware = False\nself.care = False\nself.notified = 0\nself.message_sent = 0\nreturn", "friends = random.choices(community, k=5)\nfriends = list(set(friends))\nreturn friends", "self.notified += 1\nif self.notified > 1:\n self.mo...
<|body_start_0|> self.id = id self.friends = self.generate_friends() self.motivation = 90 self.aware = False self.care = False self.notified = 0 self.message_sent = 0 return <|end_body_0|> <|body_start_1|> friends = random.choices(community, k=5) ...
Person
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Person: def __init__(self, id=0) -> None: """base conditions of a person to start""" <|body_0|> def generate_friends(self) -> list: """generate a list of friends from the community""" <|body_1|> def update_person(self): """update the persons stat...
stack_v2_sparse_classes_36k_train_027035
3,480
no_license
[ { "docstring": "base conditions of a person to start", "name": "__init__", "signature": "def __init__(self, id=0) -> None" }, { "docstring": "generate a list of friends from the community", "name": "generate_friends", "signature": "def generate_friends(self) -> list" }, { "docstr...
4
null
Implement the Python class `Person` described below. Class description: Implement the Person class. Method signatures and docstrings: - def __init__(self, id=0) -> None: base conditions of a person to start - def generate_friends(self) -> list: generate a list of friends from the community - def update_person(self): ...
Implement the Python class `Person` described below. Class description: Implement the Person class. Method signatures and docstrings: - def __init__(self, id=0) -> None: base conditions of a person to start - def generate_friends(self) -> list: generate a list of friends from the community - def update_person(self): ...
c802145760eb029e32e9072b369f985f4584f3b5
<|skeleton|> class Person: def __init__(self, id=0) -> None: """base conditions of a person to start""" <|body_0|> def generate_friends(self) -> list: """generate a list of friends from the community""" <|body_1|> def update_person(self): """update the persons stat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Person: def __init__(self, id=0) -> None: """base conditions of a person to start""" self.id = id self.friends = self.generate_friends() self.motivation = 90 self.aware = False self.care = False self.notified = 0 self.message_sent = 0 ret...
the_stack_v2_python_sparse
rumour_dynamics.py
dlefcoe/daily-questions
train
3
8b36df1a9c4b2a4c9f6fe42a3773f9c834bc1e97
[ "if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0:\n self.opts.exclude += ('versions',)\nsuper().__init__(*args, **kwargs)", "if not many:\n for key in list(data):\n if key == 'versions':\n data.pop(key)\n return {key: value for key, value in data.items() if value ...
<|body_start_0|> if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0: self.opts.exclude += ('versions',) super().__init__(*args, **kwargs) <|end_body_0|> <|body_start_1|> if not many: for key in list(data): if key == 'versions': ...
Base Schema.
BaseSchema
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" <|body_0|> def _remove_empty(self, data, many): """Remove all empty values and versions from the dumped dict.""" ...
stack_v2_sparse_classes_36k_train_027036
2,211
permissive
[ { "docstring": "Excludes versions. Otherwise database will query <name>_versions table.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Remove all empty values and versions from the dumped dict.", "name": "_remove_empty", "signature": "def _rem...
2
stack_v2_sparse_classes_30k_train_020421
Implement the Python class `BaseSchema` described below. Class description: Base Schema. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Excludes versions. Otherwise database will query <name>_versions table. - def _remove_empty(self, data, many): Remove all empty values and versions from the...
Implement the Python class `BaseSchema` described below. Class description: Base Schema. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Excludes versions. Otherwise database will query <name>_versions table. - def _remove_empty(self, data, many): Remove all empty values and versions from the...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" <|body_0|> def _remove_empty(self, data, many): """Remove all empty values and versions from the dumped dict.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseSchema: """Base Schema.""" def __init__(self, *args, **kwargs): """Excludes versions. Otherwise database will query <name>_versions table.""" if hasattr(self.opts.model, 'versions') and len(self.opts.fields) == 0: self.opts.exclude += ('versions',) super().__init__...
the_stack_v2_python_sparse
auth-api/src/auth_api/schemas/base_schema.py
bcgov/sbc-auth
train
13
0d09a1f4deb3e205c81399405c5267fdd7c036ba
[ "self.stack = []\nself.currMin = float('inf')\nself.size = 0", "if x < self.currMin:\n self.currMin = x\nself.stack.append([x, self.currMin])\nself.size += 1", "if self.size > 0:\n self.stack.pop(-1)\n self.size -= 1\nif self.size == 0:\n self.currMin = float('inf')\nelse:\n self.currMin = self.s...
<|body_start_0|> self.stack = [] self.currMin = float('inf') self.size = 0 <|end_body_0|> <|body_start_1|> if x < self.currMin: self.currMin = x self.stack.append([x, self.currMin]) self.size += 1 <|end_body_1|> <|body_start_2|> if self.size > 0: ...
MinStack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinStack: def __init__(self): """Initializes the data structure here.""" <|body_0|> def push(self, x: int) -> None: """Purpose: Pushes item onto stack. Required complexity: O(1).""" <|body_1|> def pop(self) -> None: """Purpose: Removes but does n...
stack_v2_sparse_classes_36k_train_027037
1,544
no_license
[ { "docstring": "Initializes the data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Purpose: Pushes item onto stack. Required complexity: O(1).", "name": "push", "signature": "def push(self, x: int) -> None" }, { "docstring": "Purpose: ...
5
null
Implement the Python class `MinStack` described below. Class description: Implement the MinStack class. Method signatures and docstrings: - def __init__(self): Initializes the data structure here. - def push(self, x: int) -> None: Purpose: Pushes item onto stack. Required complexity: O(1). - def pop(self) -> None: Pu...
Implement the Python class `MinStack` described below. Class description: Implement the MinStack class. Method signatures and docstrings: - def __init__(self): Initializes the data structure here. - def push(self, x: int) -> None: Purpose: Pushes item onto stack. Required complexity: O(1). - def pop(self) -> None: Pu...
95a86cbbca28d0c0f6d72d28a2f1cb5a86327934
<|skeleton|> class MinStack: def __init__(self): """Initializes the data structure here.""" <|body_0|> def push(self, x: int) -> None: """Purpose: Pushes item onto stack. Required complexity: O(1).""" <|body_1|> def pop(self) -> None: """Purpose: Removes but does n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinStack: def __init__(self): """Initializes the data structure here.""" self.stack = [] self.currMin = float('inf') self.size = 0 def push(self, x: int) -> None: """Purpose: Pushes item onto stack. Required complexity: O(1).""" if x < self.currMin: ...
the_stack_v2_python_sparse
minstack_attribute.py
tashakim/puzzles_python
train
8
1923a27c2be1c4052b36a1c2736d7d15a07027f4
[ "login_client(self.client)\ncreate_region_and_services(self, 'serv1', 'loc1', 0.7)\nresponse = self.client.get('/regions/loc1/services/serv1/' + 'rates/current/')\nself.assertEqual(response.data['rate'], 0.7)", "login_client(self.client)\ncreate_region_and_services(self, 'serv1', 'loc1', 0.7)\nresponse = self.cli...
<|body_start_0|> login_client(self.client) create_region_and_services(self, 'serv1', 'loc1', 0.7) response = self.client.get('/regions/loc1/services/serv1/' + 'rates/current/') self.assertEqual(response.data['rate'], 0.7) <|end_body_0|> <|body_start_1|> login_client(self.client)...
Rate_detail_Tests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rate_detail_Tests: def test_get_current(self): """Checks that you are able to get the current rate for a service.""" <|body_0|> def test_get_future(self): """Checks that you are able to get the next rate for a service.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_027038
24,881
no_license
[ { "docstring": "Checks that you are able to get the current rate for a service.", "name": "test_get_current", "signature": "def test_get_current(self)" }, { "docstring": "Checks that you are able to get the next rate for a service.", "name": "test_get_future", "signature": "def test_get_...
2
stack_v2_sparse_classes_30k_train_017266
Implement the Python class `Rate_detail_Tests` described below. Class description: Implement the Rate_detail_Tests class. Method signatures and docstrings: - def test_get_current(self): Checks that you are able to get the current rate for a service. - def test_get_future(self): Checks that you are able to get the nex...
Implement the Python class `Rate_detail_Tests` described below. Class description: Implement the Rate_detail_Tests class. Method signatures and docstrings: - def test_get_current(self): Checks that you are able to get the current rate for a service. - def test_get_future(self): Checks that you are able to get the nex...
d6b288e632ccfcd7c8e88ff1e5f496fb8e525710
<|skeleton|> class Rate_detail_Tests: def test_get_current(self): """Checks that you are able to get the current rate for a service.""" <|body_0|> def test_get_future(self): """Checks that you are able to get the next rate for a service.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rate_detail_Tests: def test_get_current(self): """Checks that you are able to get the current rate for a service.""" login_client(self.client) create_region_and_services(self, 'serv1', 'loc1', 0.7) response = self.client.get('/regions/loc1/services/serv1/' + 'rates/current/') ...
the_stack_v2_python_sparse
clerk-vagrant-test/Clerk/clerk/tests_api.py
unexceptable/clerk
train
0
0b0b2d26074707f93294e1d1c1e3e268c0187c51
[ "media_root = '/var/akvo/rsr/mediaroot/'\ndirectory = 'db/org/%s/iati/' % org_id\nif not os.path.exists(media_root + directory):\n os.makedirs(media_root + directory)\nf = open(media_root + directory + filename, 'w')\nf.write(etree.tostring(self.iati_activities, pretty_print=True))\nf.close()\nreturn directory +...
<|body_start_0|> media_root = '/var/akvo/rsr/mediaroot/' directory = 'db/org/%s/iati/' % org_id if not os.path.exists(media_root + directory): os.makedirs(media_root + directory) f = open(media_root + directory + filename, 'w') f.write(etree.tostring(self.iati_activit...
IatiXML
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IatiXML: def save_file(self, org_id, filename): """Export the etree to a file. :param org: String of Organisation id :param filename: String of the file name :return: File object""" <|body_0|> def add_project(self, project): """Adds a project to the IATI XML. :param ...
stack_v2_sparse_classes_36k_train_027039
3,576
no_license
[ { "docstring": "Export the etree to a file. :param org: String of Organisation id :param filename: String of the file name :return: File object", "name": "save_file", "signature": "def save_file(self, org_id, filename)" }, { "docstring": "Adds a project to the IATI XML. :param project: Project o...
3
stack_v2_sparse_classes_30k_train_005615
Implement the Python class `IatiXML` described below. Class description: Implement the IatiXML class. Method signatures and docstrings: - def save_file(self, org_id, filename): Export the etree to a file. :param org: String of Organisation id :param filename: String of the file name :return: File object - def add_pro...
Implement the Python class `IatiXML` described below. Class description: Implement the IatiXML class. Method signatures and docstrings: - def save_file(self, org_id, filename): Export the etree to a file. :param org: String of Organisation id :param filename: String of the file name :return: File object - def add_pro...
8c2163320d4381e815524dc322c76602bea212c7
<|skeleton|> class IatiXML: def save_file(self, org_id, filename): """Export the etree to a file. :param org: String of Organisation id :param filename: String of the file name :return: File object""" <|body_0|> def add_project(self, project): """Adds a project to the IATI XML. :param ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IatiXML: def save_file(self, org_id, filename): """Export the etree to a file. :param org: String of Organisation id :param filename: String of the file name :return: File object""" media_root = '/var/akvo/rsr/mediaroot/' directory = 'db/org/%s/iati/' % org_id if not os.path.ex...
the_stack_v2_python_sparse
akvo/iati/exports/iati_export.py
supermari0/akvo-rsr
train
0
d315f7744accdf571b68c0d8225766667ea39ebb
[ "try:\n level = [level for level in (SeverityLevels.CRITICAL, SeverityLevels.HIGH, SeverityLevels.MEDIUM, SeverityLevels.LOW) if level.value == level_string][0]\nexcept IndexError:\n raise ValueError(\"String {} doesn't represent any of the severity levels\".format(level_string))\nelse:\n return level", ...
<|body_start_0|> try: level = [level for level in (SeverityLevels.CRITICAL, SeverityLevels.HIGH, SeverityLevels.MEDIUM, SeverityLevels.LOW) if level.value == level_string][0] except IndexError: raise ValueError("String {} doesn't represent any of the severity levels".format(level...
SeverityLevels
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeverityLevels: def from_string(level_string): """Get enum from string :type level_string: str :return:""" <|body_0|> def _compare_with_enum(self, level): """Check if greater than other provided violation severity level :type level: SeverityLevels :return:""" ...
stack_v2_sparse_classes_36k_train_027040
30,366
permissive
[ { "docstring": "Get enum from string :type level_string: str :return:", "name": "from_string", "signature": "def from_string(level_string)" }, { "docstring": "Check if greater than other provided violation severity level :type level: SeverityLevels :return:", "name": "_compare_with_enum", ...
3
stack_v2_sparse_classes_30k_train_021656
Implement the Python class `SeverityLevels` described below. Class description: Implement the SeverityLevels class. Method signatures and docstrings: - def from_string(level_string): Get enum from string :type level_string: str :return: - def _compare_with_enum(self, level): Check if greater than other provided viola...
Implement the Python class `SeverityLevels` described below. Class description: Implement the SeverityLevels class. Method signatures and docstrings: - def from_string(level_string): Get enum from string :type level_string: str :return: - def _compare_with_enum(self, level): Check if greater than other provided viola...
18a2f4510b2d9c43b24c4f7c41a143c2512ba1ce
<|skeleton|> class SeverityLevels: def from_string(level_string): """Get enum from string :type level_string: str :return:""" <|body_0|> def _compare_with_enum(self, level): """Check if greater than other provided violation severity level :type level: SeverityLevels :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeverityLevels: def from_string(level_string): """Get enum from string :type level_string: str :return:""" try: level = [level for level in (SeverityLevels.CRITICAL, SeverityLevels.HIGH, SeverityLevels.MEDIUM, SeverityLevels.LOW) if level.value == level_string][0] except In...
the_stack_v2_python_sparse
pytos/common/definitions/xml_tags.py
broadinstitute/pytos
train
0
a34f4f19b108ac0db77ea35a1031c9d6d5108b37
[ "self.reqparse_post = reqparse.RequestParser()\nself.reqparse_post.add_argument('data', help='data required', required=True, location=['form', 'json'])\nself.reqparse_post.add_argument('widget_id', required=False, store_missing=False, location=['form', 'json'])\nself.reqparse_post.add_argument('x', required=False, ...
<|body_start_0|> self.reqparse_post = reqparse.RequestParser() self.reqparse_post.add_argument('data', help='data required', required=True, location=['form', 'json']) self.reqparse_post.add_argument('widget_id', required=False, store_missing=False, location=['form', 'json']) self.reqpars...
Create or Update Widget
Widgets
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Widgets: """Create or Update Widget""" def __init__(self) -> None: """Initiate the reqparser""" <|body_0|> def post(self) -> (str, int): """Save or Update a Widget Parameters can be passed using a POST request. POST request JSON body parameters: :param data: Widg...
stack_v2_sparse_classes_36k_train_027041
5,969
permissive
[ { "docstring": "Initiate the reqparser", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Save or Update a Widget Parameters can be passed using a POST request. POST request JSON body parameters: :param data: Widget JSON data :param widgetID: Widget Id :param x: x...
4
stack_v2_sparse_classes_30k_train_012201
Implement the Python class `Widgets` described below. Class description: Create or Update Widget Method signatures and docstrings: - def __init__(self) -> None: Initiate the reqparser - def post(self) -> (str, int): Save or Update a Widget Parameters can be passed using a POST request. POST request JSON body paramete...
Implement the Python class `Widgets` described below. Class description: Create or Update Widget Method signatures and docstrings: - def __init__(self) -> None: Initiate the reqparser - def post(self) -> (str, int): Save or Update a Widget Parameters can be passed using a POST request. POST request JSON body paramete...
5d123691d1f25d0b85e20e4e8293266bf23c9f8a
<|skeleton|> class Widgets: """Create or Update Widget""" def __init__(self) -> None: """Initiate the reqparser""" <|body_0|> def post(self) -> (str, int): """Save or Update a Widget Parameters can be passed using a POST request. POST request JSON body parameters: :param data: Widg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Widgets: """Create or Update Widget""" def __init__(self) -> None: """Initiate the reqparser""" self.reqparse_post = reqparse.RequestParser() self.reqparse_post.add_argument('data', help='data required', required=True, location=['form', 'json']) self.reqparse_post.add_argu...
the_stack_v2_python_sparse
Analytics/resources/Widgets/save_widgets.py
thanosbnt/SharingCitiesDashboard
train
0
a6ffbe705b8f4a37fa1a0183785db88e655f6f89
[ "F = 0\nret = 0\nprev = -1\nfor i, a in enumerate(A):\n if L <= a <= R:\n F = i - prev\n ret += F\n elif a > R:\n F = 0\n prev = i\n else:\n ret += F\nreturn ret", "F = 0\nret = 0\nfor a in A:\n if L <= a <= R:\n F += 1\n ret += F\n elif a > R:\n ...
<|body_start_0|> F = 0 ret = 0 prev = -1 for i, a in enumerate(A): if L <= a <= R: F = i - prev ret += F elif a > R: F = 0 prev = i else: ret += F return ret <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayBoundedMax(self, A: List[int], L: int, R: int) -> int: """DP: Let F[i] be the num subarray with bounded max at A[i] if L <= A[i] <= R: F[i] = i - prev, where prev is previously invalid F[prev] = 0 if A[i] > R: F[i] = 0 if A[i] < L: F[i] = F[i-1] # append itself t...
stack_v2_sparse_classes_36k_train_027042
2,049
no_license
[ { "docstring": "DP: Let F[i] be the num subarray with bounded max at A[i] if L <= A[i] <= R: F[i] = i - prev, where prev is previously invalid F[prev] = 0 if A[i] > R: F[i] = 0 if A[i] < L: F[i] = F[i-1] # append itself to every array in F[i-1] memory optimization - one counter F is enough", "name": "numSub...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayBoundedMax(self, A: List[int], L: int, R: int) -> int: DP: Let F[i] be the num subarray with bounded max at A[i] if L <= A[i] <= R: F[i] = i - prev, where prev is ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayBoundedMax(self, A: List[int], L: int, R: int) -> int: DP: Let F[i] be the num subarray with bounded max at A[i] if L <= A[i] <= R: F[i] = i - prev, where prev is ...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Solution: def numSubarrayBoundedMax(self, A: List[int], L: int, R: int) -> int: """DP: Let F[i] be the num subarray with bounded max at A[i] if L <= A[i] <= R: F[i] = i - prev, where prev is previously invalid F[prev] = 0 if A[i] > R: F[i] = 0 if A[i] < L: F[i] = F[i-1] # append itself t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarrayBoundedMax(self, A: List[int], L: int, R: int) -> int: """DP: Let F[i] be the num subarray with bounded max at A[i] if L <= A[i] <= R: F[i] = i - prev, where prev is previously invalid F[prev] = 0 if A[i] > R: F[i] = 0 if A[i] < L: F[i] = F[i-1] # append itself to every array ...
the_stack_v2_python_sparse
_algorithms_challenges/leetcode/LeetCode/795 Number of Subarrays with Bounded Maximum.py
syurskyi/Algorithms_and_Data_Structure
train
4
75106ba0a0302156764fee6e8060d20aa0d08363
[ "all_subsets = []\ncurrent = []\nself.generate_subsets(nums, 0, all_subsets, current)\nreturn all_subsets", "print(current)\nall_subsets.append(current[:])\nfor i in range(index, len(nums)):\n current.append(nums[i])\n self.generate_subsets(nums, i + 1, all_subsets, current)\n current.pop()" ]
<|body_start_0|> all_subsets = [] current = [] self.generate_subsets(nums, 0, all_subsets, current) return all_subsets <|end_body_0|> <|body_start_1|> print(current) all_subsets.append(current[:]) for i in range(index, len(nums)): current.append(nums[...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def generate_subsets(self, nums, index, all_subsets, current): """Forms the all possible subsets of the given set of numbers""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_027043
1,182
permissive
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets", "signature": "def subsets(self, nums)" }, { "docstring": "Forms the all possible subsets of the given set of numbers", "name": "generate_subsets", "signature": "def generate_subsets(self, nums, index, all_...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def generate_subsets(self, nums, index, all_subsets, current): Forms the all possible subsets of the give...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] - def generate_subsets(self, nums, index, all_subsets, current): Forms the all possible subsets of the give...
547c200b627c774535bc22880b16d5390183aeba
<|skeleton|> class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def generate_subsets(self, nums, index, all_subsets, current): """Forms the all possible subsets of the given set of numbers""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subsets(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" all_subsets = [] current = [] self.generate_subsets(nums, 0, all_subsets, current) return all_subsets def generate_subsets(self, nums, index, all_subsets, current): """Fo...
the_stack_v2_python_sparse
medium/78_subsets.py
Sukhrobjon/leetcode
train
0
6258ee9266fca945a46f326c7ab015443bdb20ad
[ "code = form.cleaned_data['report_type']\nrepo = self.generator_repository(user=self.request.user)\ngenerator_cls = repo.get_generator(code)\nif not generator_cls:\n raise Http404()\ndownload = form.cleaned_data['download']\nformatter = 'CSV' if download else 'HTML'\nreturn generator_cls(start_date=form.cleaned_...
<|body_start_0|> code = form.cleaned_data['report_type'] repo = self.generator_repository(user=self.request.user) generator_cls = repo.get_generator(code) if not generator_cls: raise Http404() download = form.cleaned_data['download'] formatter = 'CSV' if downl...
IndexView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexView: def _get_generator(self, form): """We overwrite Oscar's function to pass user to the report to support multiple partners""" <|body_0|> def sort_queryset(self, request): """Sorts the queryset by one of allowed_sorts based on parameters 'sort' and 'dir' from...
stack_v2_sparse_classes_36k_train_027044
2,975
no_license
[ { "docstring": "We overwrite Oscar's function to pass user to the report to support multiple partners", "name": "_get_generator", "signature": "def _get_generator(self, form)" }, { "docstring": "Sorts the queryset by one of allowed_sorts based on parameters 'sort' and 'dir' from request", "n...
3
stack_v2_sparse_classes_30k_train_007869
Implement the Python class `IndexView` described below. Class description: Implement the IndexView class. Method signatures and docstrings: - def _get_generator(self, form): We overwrite Oscar's function to pass user to the report to support multiple partners - def sort_queryset(self, request): Sorts the queryset by ...
Implement the Python class `IndexView` described below. Class description: Implement the IndexView class. Method signatures and docstrings: - def _get_generator(self, form): We overwrite Oscar's function to pass user to the report to support multiple partners - def sort_queryset(self, request): Sorts the queryset by ...
8c3286e9a7da8f4ae0401a81c8037585b3bb7ba6
<|skeleton|> class IndexView: def _get_generator(self, form): """We overwrite Oscar's function to pass user to the report to support multiple partners""" <|body_0|> def sort_queryset(self, request): """Sorts the queryset by one of allowed_sorts based on parameters 'sort' and 'dir' from...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexView: def _get_generator(self, form): """We overwrite Oscar's function to pass user to the report to support multiple partners""" code = form.cleaned_data['report_type'] repo = self.generator_repository(user=self.request.user) generator_cls = repo.get_generator(code) ...
the_stack_v2_python_sparse
apps/dashboard/reports/views.py
embedded1/django-package-forwarding
train
0
5934023ef85ca3e13b143d882bedb7ade58503ac
[ "self.robot = robot\nself.jointPrefix = jointPrefix\nself.motors = []\nself.sensors = []\nself.timestep = int(robot.getBasicTimeStep())\nself.last_joint_states = None\nself.previousTime = 0\nself.previousPosition = []\nfor name in JointStatePublisher.jointNames:\n self.motors.append(robot.getDevice(name))\n s...
<|body_start_0|> self.robot = robot self.jointPrefix = jointPrefix self.motors = [] self.sensors = [] self.timestep = int(robot.getBasicTimeStep()) self.last_joint_states = None self.previousTime = 0 self.previousPosition = [] for name in JointStat...
Publish as a ROS topic the joint state.
JointStatePublisher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JointStatePublisher: """Publish as a ROS topic the joint state.""" def __init__(self, robot, jointPrefix, nodeName): """Initialize the motors, position sensors and the topic.""" <|body_0|> def publish(self): """Publish the 'joint_states' topic with up to date val...
stack_v2_sparse_classes_36k_train_027045
2,703
permissive
[ { "docstring": "Initialize the motors, position sensors and the topic.", "name": "__init__", "signature": "def __init__(self, robot, jointPrefix, nodeName)" }, { "docstring": "Publish the 'joint_states' topic with up to date value.", "name": "publish", "signature": "def publish(self)" ...
2
null
Implement the Python class `JointStatePublisher` described below. Class description: Publish as a ROS topic the joint state. Method signatures and docstrings: - def __init__(self, robot, jointPrefix, nodeName): Initialize the motors, position sensors and the topic. - def publish(self): Publish the 'joint_states' topi...
Implement the Python class `JointStatePublisher` described below. Class description: Publish as a ROS topic the joint state. Method signatures and docstrings: - def __init__(self, robot, jointPrefix, nodeName): Initialize the motors, position sensors and the topic. - def publish(self): Publish the 'joint_states' topi...
b3d6ce670cdf63469fc5766630eb295d67b3d788
<|skeleton|> class JointStatePublisher: """Publish as a ROS topic the joint state.""" def __init__(self, robot, jointPrefix, nodeName): """Initialize the motors, position sensors and the topic.""" <|body_0|> def publish(self): """Publish the 'joint_states' topic with up to date val...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JointStatePublisher: """Publish as a ROS topic the joint state.""" def __init__(self, robot, jointPrefix, nodeName): """Initialize the motors, position sensors and the topic.""" self.robot = robot self.jointPrefix = jointPrefix self.motors = [] self.sensors = [] ...
the_stack_v2_python_sparse
projects/python/control/single_demo_grasp/simulation_ws/src/single_demo_grasping_demo/scripts/joint_state_publisher.py
opendr-eu/opendr
train
535
77a35a8067d2fd9c466fff83a0ea2bf7ae5221d7
[ "length = len(nums)\nif length == 0:\n return sys.maxsize\nif length == 1:\n return nums[0]\nmid = length // 2\nleftMin = self.minSplit(nums[:mid])\nrightMin = self.minSplit(nums[mid:])\nif leftMin < rightMin:\n return leftMin\nreturn rightMin", "length = len(nums)\nif length == 1:\n return nums[0]\nm...
<|body_start_0|> length = len(nums) if length == 0: return sys.maxsize if length == 1: return nums[0] mid = length // 2 leftMin = self.minSplit(nums[:mid]) rightMin = self.minSplit(nums[mid:]) if leftMin < rightMin: return leftM...
RotatedArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RotatedArray: def minSplit(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def minBSearch(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def binarySearch(self, nums, target, start=0): """:type nums: List[int] :rty...
stack_v2_sparse_classes_36k_train_027046
2,022
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "minSplit", "signature": "def minSplit(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "minBSearch", "signature": "def minBSearch(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: ...
3
stack_v2_sparse_classes_30k_train_009996
Implement the Python class `RotatedArray` described below. Class description: Implement the RotatedArray class. Method signatures and docstrings: - def minSplit(self, nums): :type nums: List[int] :rtype: int - def minBSearch(self, nums): :type nums: List[int] :rtype: int - def binarySearch(self, nums, target, start=0...
Implement the Python class `RotatedArray` described below. Class description: Implement the RotatedArray class. Method signatures and docstrings: - def minSplit(self, nums): :type nums: List[int] :rtype: int - def minBSearch(self, nums): :type nums: List[int] :rtype: int - def binarySearch(self, nums, target, start=0...
6f62fa7449f4e6f76a68068ec36587fe426734be
<|skeleton|> class RotatedArray: def minSplit(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def minBSearch(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def binarySearch(self, nums, target, start=0): """:type nums: List[int] :rty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RotatedArray: def minSplit(self, nums): """:type nums: List[int] :rtype: int""" length = len(nums) if length == 0: return sys.maxsize if length == 1: return nums[0] mid = length // 2 leftMin = self.minSplit(nums[:mid]) rightMin = ...
the_stack_v2_python_sparse
Questions/RoatedArray.py
yojoecool/InterviewPrep
train
1
ac24005b755682207502677094ec755f52ade4b6
[ "self.find(By.ID, self._username).send_keys('维恩1')\nself.find(By.ID, 'memberAdd_acctid').send_keys('1112221')\nself.find(By.ID, 'memberAdd_phone').send_keys('13199991233')\nself.find(By.CSS_SELECTOR, '.js_btn_save').click()\nreturn Contact(self.driver)", "self.find(By.ID, self._username).send_keys('维恩2')\nself.fi...
<|body_start_0|> self.find(By.ID, self._username).send_keys('维恩1') self.find(By.ID, 'memberAdd_acctid').send_keys('1112221') self.find(By.ID, 'memberAdd_phone').send_keys('13199991233') self.find(By.CSS_SELECTOR, '.js_btn_save').click() return Contact(self.driver) <|end_body_0|> ...
AddMember
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMember: def add_member(self): """添加成员 :return:""" <|body_0|> def add_member_fail(self): """添加成员 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.find(By.ID, self._username).send_keys('维恩1') self.find(By.ID, 'memberAdd_acctid'...
stack_v2_sparse_classes_36k_train_027047
1,055
no_license
[ { "docstring": "添加成员 :return:", "name": "add_member", "signature": "def add_member(self)" }, { "docstring": "添加成员 :return:", "name": "add_member_fail", "signature": "def add_member_fail(self)" } ]
2
stack_v2_sparse_classes_30k_train_006889
Implement the Python class `AddMember` described below. Class description: Implement the AddMember class. Method signatures and docstrings: - def add_member(self): 添加成员 :return: - def add_member_fail(self): 添加成员 :return:
Implement the Python class `AddMember` described below. Class description: Implement the AddMember class. Method signatures and docstrings: - def add_member(self): 添加成员 :return: - def add_member_fail(self): 添加成员 :return: <|skeleton|> class AddMember: def add_member(self): """添加成员 :return:""" <|b...
e388800d432cd1d23ca5765abc1780d6394e1dbb
<|skeleton|> class AddMember: def add_member(self): """添加成员 :return:""" <|body_0|> def add_member_fail(self): """添加成员 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddMember: def add_member(self): """添加成员 :return:""" self.find(By.ID, self._username).send_keys('维恩1') self.find(By.ID, 'memberAdd_acctid').send_keys('1112221') self.find(By.ID, 'memberAdd_phone').send_keys('13199991233') self.find(By.CSS_SELECTOR, '.js_btn_save').click...
the_stack_v2_python_sparse
test_selenium/test_wework/page/add_member_page.py
ceshiren/HogwartsLG2
train
2
3d44111898dad01053a9a72e2f8e4d158fcbf5d7
[ "query = f'atbash {phrase}'\nanswer = await _duckduckgo(ctx, query=query)\nanswer = answer.replace('Atbash: ', '', 1)\nawait ctx.send(answer)", "query = f'base64 {phrase}'\nanswer = await _duckduckgo(ctx, query=query)\nanswer = answer.replace('Base64 encode d: ', '')\nawait ctx.send(answer)", "query = f'rot13 {...
<|body_start_0|> query = f'atbash {phrase}' answer = await _duckduckgo(ctx, query=query) answer = answer.replace('Atbash: ', '', 1) await ctx.send(answer) <|end_body_0|> <|body_start_1|> query = f'base64 {phrase}' answer = await _duckduckgo(ctx, query=query) answ...
Crypto
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crypto: async def atbash(self, ctx, *, phrase: str): """Convert text using a reversed alphabet. * phrase = The message to be encoded.""" <|body_0|> async def base64(self, ctx, *, phrase: str): """Convert a phrase into Base64. * phrase = The text to convert.""" ...
stack_v2_sparse_classes_36k_train_027048
4,354
permissive
[ { "docstring": "Convert text using a reversed alphabet. * phrase = The message to be encoded.", "name": "atbash", "signature": "async def atbash(self, ctx, *, phrase: str)" }, { "docstring": "Convert a phrase into Base64. * phrase = The text to convert.", "name": "base64", "signature": "...
4
stack_v2_sparse_classes_30k_train_011088
Implement the Python class `Crypto` described below. Class description: Implement the Crypto class. Method signatures and docstrings: - async def atbash(self, ctx, *, phrase: str): Convert text using a reversed alphabet. * phrase = The message to be encoded. - async def base64(self, ctx, *, phrase: str): Convert a ph...
Implement the Python class `Crypto` described below. Class description: Implement the Crypto class. Method signatures and docstrings: - async def atbash(self, ctx, *, phrase: str): Convert text using a reversed alphabet. * phrase = The message to be encoded. - async def base64(self, ctx, *, phrase: str): Convert a ph...
3a456ad06814181d13d4aabefc151756c55444f4
<|skeleton|> class Crypto: async def atbash(self, ctx, *, phrase: str): """Convert text using a reversed alphabet. * phrase = The message to be encoded.""" <|body_0|> async def base64(self, ctx, *, phrase: str): """Convert a phrase into Base64. * phrase = The text to convert.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crypto: async def atbash(self, ctx, *, phrase: str): """Convert text using a reversed alphabet. * phrase = The message to be encoded.""" query = f'atbash {phrase}' answer = await _duckduckgo(ctx, query=query) answer = answer.replace('Atbash: ', '', 1) await ctx.send(ans...
the_stack_v2_python_sparse
cogs/ddg.py
sokcheng/Kitsuchan-NG
train
1
c6821cc399b18b1224c26325a54e420991f0a043
[ "queue = deque()\nqueue.extend([root, root])\nwhile queue:\n l, r = (queue.popleft(), queue.popleft())\n if not l and (not r):\n continue\n if (not l or not r) or l.val != r.val:\n return False\n queue.extend([l.left, r.right])\n queue.extend([l.right, r.left])\nreturn True", "def dfs...
<|body_start_0|> queue = deque() queue.extend([root, root]) while queue: l, r = (queue.popleft(), queue.popleft()) if not l and (not r): continue if (not l or not r) or l.val != r.val: return False queue.extend([l.le...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def isSymmetric1(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> queue = deque() queue.extend([root, ro...
stack_v2_sparse_classes_36k_train_027049
1,474
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "isSymmetric", "signature": "def isSymmetric(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "isSymmetric1", "signature": "def isSymmetric1(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: int - def isSymmetric1(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isSymmetric(self, root): :type root: TreeNode :rtype: int - def isSymmetric1(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def isSymmetric(...
b7c59c826bcd17cb1333571eb9f13f5c2b89b4ee
<|skeleton|> class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def isSymmetric1(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isSymmetric(self, root): """:type root: TreeNode :rtype: int""" queue = deque() queue.extend([root, root]) while queue: l, r = (queue.popleft(), queue.popleft()) if not l and (not r): continue if (not l or not r)...
the_stack_v2_python_sparse
算法小抄/二叉树/对称二叉树.py
Asunqingwen/LeetCode
train
0
d7a5ea1b865323bba667f2abab89049495f8526b
[ "host_queryset: QuerySet = base.HostQuerySqlHelper.multiple_cond_sql(params={}, biz_scope=[scope['bk_biz_id'] for scope in scope_list], return_all_node_type=True)\nhost_queryset = base.HostQueryHelper.or_query_hosts(host_queryset, or_conditions=or_conditions)\nif limit_host_ids is not None:\n host_queryset = hos...
<|body_start_0|> host_queryset: QuerySet = base.HostQuerySqlHelper.multiple_cond_sql(params={}, biz_scope=[scope['bk_biz_id'] for scope in scope_list], return_all_node_type=True) host_queryset = base.HostQueryHelper.or_query_hosts(host_queryset, or_conditions=or_conditions) if limit_host_ids is ...
HostHandler
[ "MIT", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostHandler: def details_base(scope_list: types.ScopeList, or_conditions: typing.List[types.Condition], limit_host_ids: typing.Optional[typing.List[int]]=None) -> typing.List[types.FormatHostInfo]: """获取主机详情 :param scope_list: 资源范围数组 :param or_conditions: 逻辑或查询条件 :param limit_host_ids: 限...
stack_v2_sparse_classes_36k_train_027050
5,184
permissive
[ { "docstring": "获取主机详情 :param scope_list: 资源范围数组 :param or_conditions: 逻辑或查询条件 :param limit_host_ids: 限制检索的主机 ID 列表 :return:", "name": "details_base", "signature": "def details_base(scope_list: types.ScopeList, or_conditions: typing.List[types.Condition], limit_host_ids: typing.Optional[typing.List[int]...
3
null
Implement the Python class `HostHandler` described below. Class description: Implement the HostHandler class. Method signatures and docstrings: - def details_base(scope_list: types.ScopeList, or_conditions: typing.List[types.Condition], limit_host_ids: typing.Optional[typing.List[int]]=None) -> typing.List[types.Form...
Implement the Python class `HostHandler` described below. Class description: Implement the HostHandler class. Method signatures and docstrings: - def details_base(scope_list: types.ScopeList, or_conditions: typing.List[types.Condition], limit_host_ids: typing.Optional[typing.List[int]]=None) -> typing.List[types.Form...
72d2104783443bff26c752c5bd934a013b302b6d
<|skeleton|> class HostHandler: def details_base(scope_list: types.ScopeList, or_conditions: typing.List[types.Condition], limit_host_ids: typing.Optional[typing.List[int]]=None) -> typing.List[types.FormatHostInfo]: """获取主机详情 :param scope_list: 资源范围数组 :param or_conditions: 逻辑或查询条件 :param limit_host_ids: 限...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HostHandler: def details_base(scope_list: types.ScopeList, or_conditions: typing.List[types.Condition], limit_host_ids: typing.Optional[typing.List[int]]=None) -> typing.List[types.FormatHostInfo]: """获取主机详情 :param scope_list: 资源范围数组 :param or_conditions: 逻辑或查询条件 :param limit_host_ids: 限制检索的主机 ID 列表 :...
the_stack_v2_python_sparse
apps/core/ipchooser/handlers/host_handler.py
TencentBlueKing/bk-nodeman
train
54
70f6fad16a764b0c3b17b42309add006a4cb84cf
[ "self.images_paths = images_paths\nself.labels = labels\nself.args = args", "preparator = ImagePreparation(self.images_paths, self.args['model_type'])\nimages = preparator.apply_basic_processing()\nencoder = LabelClassifier(self.labels)\nlabels_cat, label_classes = encoder.get_categorical_labels()\nreturn (images...
<|body_start_0|> self.images_paths = images_paths self.labels = labels self.args = args <|end_body_0|> <|body_start_1|> preparator = ImagePreparation(self.images_paths, self.args['model_type']) images = preparator.apply_basic_processing() encoder = LabelClassifier(self.l...
Organize labels and images transformation Methods ------- apply_preprocessing
DataPreprocessing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataPreprocessing: """Organize labels and images transformation Methods ------- apply_preprocessing""" def __init__(self, images_paths: list, labels: list, args): """Class initialisation Parameters ---------- paths_images : list list of paths to selected images labels : list list of ...
stack_v2_sparse_classes_36k_train_027051
7,707
no_license
[ { "docstring": "Class initialisation Parameters ---------- paths_images : list list of paths to selected images labels : list list of labels (str) corresponding to the images paths args : arguments parser list of user arguments", "name": "__init__", "signature": "def __init__(self, images_paths: list, l...
2
null
Implement the Python class `DataPreprocessing` described below. Class description: Organize labels and images transformation Methods ------- apply_preprocessing Method signatures and docstrings: - def __init__(self, images_paths: list, labels: list, args): Class initialisation Parameters ---------- paths_images : lis...
Implement the Python class `DataPreprocessing` described below. Class description: Organize labels and images transformation Methods ------- apply_preprocessing Method signatures and docstrings: - def __init__(self, images_paths: list, labels: list, args): Class initialisation Parameters ---------- paths_images : lis...
227641cc02f5c3aef04f3c27cbfc316382041ae0
<|skeleton|> class DataPreprocessing: """Organize labels and images transformation Methods ------- apply_preprocessing""" def __init__(self, images_paths: list, labels: list, args): """Class initialisation Parameters ---------- paths_images : list list of paths to selected images labels : list list of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataPreprocessing: """Organize labels and images transformation Methods ------- apply_preprocessing""" def __init__(self, images_paths: list, labels: list, args): """Class initialisation Parameters ---------- paths_images : list list of paths to selected images labels : list list of labels (str) ...
the_stack_v2_python_sparse
yotta_p2/bj-computer-vision/masked_face/domain/data_preparation.py
j-bd/various_exs
train
0
ed9bce01c733bd25960b0d843d0f43fc6d89d6de
[ "self.ctxt.log.debug('Dumping text to STDERR')\nprint(msg.text, file=sys.stderr)\nreturn True", "self.ctxt.log.debug('Dumping raw text to STDERR')\nprint(msg.raw_text, file=sys.stderr)\nreturn True", "self.ctxt.log.debug('Dumping metadata to STDERR.')\nprint('Decoded Headers:', file=sys.stderr)\nfor header in m...
<|body_start_0|> self.ctxt.log.debug('Dumping text to STDERR') print(msg.text, file=sys.stderr) return True <|end_body_0|> <|body_start_1|> self.ctxt.log.debug('Dumping raw text to STDERR') print(msg.raw_text, file=sys.stderr) return True <|end_body_1|> <|body_start_2|>...
Similar to the SA DumpText demo plugin, useful for debugging rulesets.
DumpText
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpText: """Similar to the SA DumpText demo plugin, useful for debugging rulesets.""" def dump_text(self, msg, target=None): """Dump the decoded parsed text of the message to stderr.""" <|body_0|> def dump_raw_text(self, msg, target=None): """Dump the decoded ra...
stack_v2_sparse_classes_36k_train_027052
1,323
permissive
[ { "docstring": "Dump the decoded parsed text of the message to stderr.", "name": "dump_text", "signature": "def dump_text(self, msg, target=None)" }, { "docstring": "Dump the decoded raw text of the message to stderr.", "name": "dump_raw_text", "signature": "def dump_raw_text(self, msg, ...
3
null
Implement the Python class `DumpText` described below. Class description: Similar to the SA DumpText demo plugin, useful for debugging rulesets. Method signatures and docstrings: - def dump_text(self, msg, target=None): Dump the decoded parsed text of the message to stderr. - def dump_raw_text(self, msg, target=None)...
Implement the Python class `DumpText` described below. Class description: Similar to the SA DumpText demo plugin, useful for debugging rulesets. Method signatures and docstrings: - def dump_text(self, msg, target=None): Dump the decoded parsed text of the message to stderr. - def dump_raw_text(self, msg, target=None)...
86cab72a79f9d9151390a01f3efc372a2c658eef
<|skeleton|> class DumpText: """Similar to the SA DumpText demo plugin, useful for debugging rulesets.""" def dump_text(self, msg, target=None): """Dump the decoded parsed text of the message to stderr.""" <|body_0|> def dump_raw_text(self, msg, target=None): """Dump the decoded ra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DumpText: """Similar to the SA DumpText demo plugin, useful for debugging rulesets.""" def dump_text(self, msg, target=None): """Dump the decoded parsed text of the message to stderr.""" self.ctxt.log.debug('Dumping text to STDERR') print(msg.text, file=sys.stderr) return ...
the_stack_v2_python_sparse
oa/plugins/dump_text.py
SpamExperts/OrangeAssassin
train
59
8098ca3869d0106b282ccd0f47960027d4faf09d
[ "if not nums:\n return\nn = nums.__len__()\nnums.append(float('-inf'))\nfor i in range(1, n):\n if nums[i - 1] < nums[i] and nums[i] > nums[i + 1]:\n return i\nreturn 0", "if not nums:\n return\nhigh = nums.__len__() - 1\nlow = 0\nwhile low < high:\n mid1 = (low + high) / 2\n mid2 = mid1 + 1...
<|body_start_0|> if not nums: return n = nums.__len__() nums.append(float('-inf')) for i in range(1, n): if nums[i - 1] < nums[i] and nums[i] > nums[i + 1]: return i return 0 <|end_body_0|> <|body_start_1|> if not nums: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPeakElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return ...
stack_v2_sparse_classes_36k_train_027053
1,034
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findPeakElement", "signature": "def findPeakElement(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findPeakElement1", "signature": "def findPeakElement1(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement(self, nums): :type nums: List[int] :rtype: int - def findPeakElement1(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPeakElement(self, nums): :type nums: List[int] :rtype: int - def findPeakElement1(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def fi...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def findPeakElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findPeakElement1(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findPeakElement(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return n = nums.__len__() nums.append(float('-inf')) for i in range(1, n): if nums[i - 1] < nums[i] and nums[i] > nums[i + 1]: return ...
the_stack_v2_python_sparse
4/162-Find_Peak_Element.py
ChangXiaodong/Leetcode-solutions
train
4
093aacb473da3be69e6c5a6815f75b2437ba47f9
[ "queryset = super().get_queryset()\nqueryset = queryset.filter(users__contains=self.request.user.pk)\nreturn queryset", "user_to = request.data['userTo']\nnew_message = request.data['newMessage']\nuser_from = self.request.user\nuser_to = User.objects.filter(id=user_to).first()\nif not user_to:\n raise NotFound...
<|body_start_0|> queryset = super().get_queryset() queryset = queryset.filter(users__contains=self.request.user.pk) return queryset <|end_body_0|> <|body_start_1|> user_to = request.data['userTo'] new_message = request.data['newMessage'] user_from = self.request.user ...
Sent and Receive messages.
MessagesViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessagesViewSet: """Sent and Receive messages.""" def get_queryset(self: 'MessagesViewSet'): """Allowed to see chats with you only.""" <|body_0|> def send(self, request): """Send a new message.""" <|body_1|> def load(self, request, pk): """Lo...
stack_v2_sparse_classes_36k_train_027054
2,770
no_license
[ { "docstring": "Allowed to see chats with you only.", "name": "get_queryset", "signature": "def get_queryset(self: 'MessagesViewSet')" }, { "docstring": "Send a new message.", "name": "send", "signature": "def send(self, request)" }, { "docstring": "Load chat.", "name": "load...
3
null
Implement the Python class `MessagesViewSet` described below. Class description: Sent and Receive messages. Method signatures and docstrings: - def get_queryset(self: 'MessagesViewSet'): Allowed to see chats with you only. - def send(self, request): Send a new message. - def load(self, request, pk): Load chat.
Implement the Python class `MessagesViewSet` described below. Class description: Sent and Receive messages. Method signatures and docstrings: - def get_queryset(self: 'MessagesViewSet'): Allowed to see chats with you only. - def send(self, request): Send a new message. - def load(self, request, pk): Load chat. <|ske...
559844da111a448a372caa58ce4e2f14ceeb2660
<|skeleton|> class MessagesViewSet: """Sent and Receive messages.""" def get_queryset(self: 'MessagesViewSet'): """Allowed to see chats with you only.""" <|body_0|> def send(self, request): """Send a new message.""" <|body_1|> def load(self, request, pk): """Lo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessagesViewSet: """Sent and Receive messages.""" def get_queryset(self: 'MessagesViewSet'): """Allowed to see chats with you only.""" queryset = super().get_queryset() queryset = queryset.filter(users__contains=self.request.user.pk) return queryset def send(self, req...
the_stack_v2_python_sparse
home/api/v1/view/messages.py
SpiralMathAdmin/spiralmath-17663
train
0
f46874aae652fa3eb63244fb046e91dd42da42aa
[ "self.chap_file_name = chap_file_name\nself.epub = epub\nself.nlp: dict[str, Language] = self.epub.nlp\nself.pipe: dict[str, TranslationPipelineCache] = self.epub.pipe\nself.lang_orig: str = self.epub.lang_orig\nself.lang_dest: str = self.epub.lang_dest\nself.soup = BeautifulSoup(chap_content, features='html.parser...
<|body_start_0|> self.chap_file_name = chap_file_name self.epub = epub self.nlp: dict[str, Language] = self.epub.nlp self.pipe: dict[str, TranslationPipelineCache] = self.epub.pipe self.lang_orig: str = self.epub.lang_orig self.lang_dest: str = self.epub.lang_dest ...
Chapter class. Parse the chapter content to find the Paragraphs in <p> tags.
Chapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chapter: """Chapter class. Parse the chapter content to find the Paragraphs in <p> tags.""" def __init__(self, chap_content: bytes, chap_file_name: str, epub: 'EPub') -> None: """Initialize a chapter. TODO: Pass lang tags?""" <|body_0|> def build_index(self): """...
stack_v2_sparse_classes_36k_train_027055
10,849
no_license
[ { "docstring": "Initialize a chapter. TODO: Pass lang tags?", "name": "__init__", "signature": "def __init__(self, chap_content: bytes, chap_file_name: str, epub: 'EPub') -> None" }, { "docstring": "Build maps to go from ``sent_in_chap_id`` to ``(par_id, sent_in_par_id)`` and vice-versa.", "...
6
stack_v2_sparse_classes_30k_train_000687
Implement the Python class `Chapter` described below. Class description: Chapter class. Parse the chapter content to find the Paragraphs in <p> tags. Method signatures and docstrings: - def __init__(self, chap_content: bytes, chap_file_name: str, epub: 'EPub') -> None: Initialize a chapter. TODO: Pass lang tags? - de...
Implement the Python class `Chapter` described below. Class description: Chapter class. Parse the chapter content to find the Paragraphs in <p> tags. Method signatures and docstrings: - def __init__(self, chap_content: bytes, chap_file_name: str, epub: 'EPub') -> None: Initialize a chapter. TODO: Pass lang tags? - de...
1d7e5657014b00612cde87b78d5506a9e8b6adfc
<|skeleton|> class Chapter: """Chapter class. Parse the chapter content to find the Paragraphs in <p> tags.""" def __init__(self, chap_content: bytes, chap_file_name: str, epub: 'EPub') -> None: """Initialize a chapter. TODO: Pass lang tags?""" <|body_0|> def build_index(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chapter: """Chapter class. Parse the chapter content to find the Paragraphs in <p> tags.""" def __init__(self, chap_content: bytes, chap_file_name: str, epub: 'EPub') -> None: """Initialize a chapter. TODO: Pass lang tags?""" self.chap_file_name = chap_file_name self.epub = epub ...
the_stack_v2_python_sparse
python/streamlit-sample/align-epub/epub.py
Pitrified/snippet
train
2
ca18e59a8b2b8befdf011706548f98618cfb320e
[ "if lower.shape[0] == 1:\n raise RuntimeError('CMAES does not works in a one dimensional function space')\nsuper(CMAES, self).__init__(objective_function, lower, upper, rng)\nself.restarts = restarts\nself.verbose = verbose\nself.n_func_evals = n_func_evals", "verbose_level = -9\nif self.verbos...
<|body_start_0|> if lower.shape[0] == 1: raise RuntimeError('CMAES does not works in a one dimensional function space') super(CMAES, self).__init__(objective_function, lower, upper, rng) self.restarts = restarts self.verbose = verbose self.n_func_evals...
CMAES
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CMAES: def __init__(self, objective_function, lower, upper, verbose=True, restarts=0, n_func_evals=1000, rng=None): """Interface for the Covariance Matrix Adaptation Evolution Strategy python package Parameters ---------- objective_function: acquisition function The acquisition function ...
stack_v2_sparse_classes_36k_train_027056
2,649
permissive
[ { "docstring": "Interface for the Covariance Matrix Adaptation Evolution Strategy python package Parameters ---------- objective_function: acquisition function The acquisition function which will be maximized lower: np.ndarray (D) Lower bounds of the input space upper: np.ndarray (D) Upper bounds of the input s...
2
null
Implement the Python class `CMAES` described below. Class description: Implement the CMAES class. Method signatures and docstrings: - def __init__(self, objective_function, lower, upper, verbose=True, restarts=0, n_func_evals=1000, rng=None): Interface for the Covariance Matrix Adaptation Evolution Strategy python pa...
Implement the Python class `CMAES` described below. Class description: Implement the CMAES class. Method signatures and docstrings: - def __init__(self, objective_function, lower, upper, verbose=True, restarts=0, n_func_evals=1000, rng=None): Interface for the Covariance Matrix Adaptation Evolution Strategy python pa...
3f82d858f49c27d5ecb624cee555fb8fd47bf067
<|skeleton|> class CMAES: def __init__(self, objective_function, lower, upper, verbose=True, restarts=0, n_func_evals=1000, rng=None): """Interface for the Covariance Matrix Adaptation Evolution Strategy python package Parameters ---------- objective_function: acquisition function The acquisition function ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CMAES: def __init__(self, objective_function, lower, upper, verbose=True, restarts=0, n_func_evals=1000, rng=None): """Interface for the Covariance Matrix Adaptation Evolution Strategy python package Parameters ---------- objective_function: acquisition function The acquisition function which will be ...
the_stack_v2_python_sparse
autotf/tuner/maximizers/cmaes.py
DMALab/autotf
train
8
78dbc1d0a3c2cf1e91696612809497689ace5d18
[ "try:\n log.info('Executing shell command: %s', cmd_line)\n cmd_args = list(filter(None, shlex.split(cmd_line)))\n result = subprocess.check_output(cmd_args, **kwargs).decode('utf-8')\n log.info('Execution result: %s', result)\n return result.strip() if result else None\nexcept subprocess.CalledProce...
<|body_start_0|> try: log.info('Executing shell command: %s', cmd_line) cmd_args = list(filter(None, shlex.split(cmd_line))) result = subprocess.check_output(cmd_args, **kwargs).decode('utf-8') log.info('Execution result: %s', result) return result.str...
TODO
Terminal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Terminal: """TODO""" def shell_exec(cmd_line: str, **kwargs) -> Optional[str]: """TODO""" <|body_0|> def shell_poll(cmd_line: str, **kwargs) -> None: """TODO""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: log.info('Executing sh...
stack_v2_sparse_classes_36k_train_027057
2,222
permissive
[ { "docstring": "TODO", "name": "shell_exec", "signature": "def shell_exec(cmd_line: str, **kwargs) -> Optional[str]" }, { "docstring": "TODO", "name": "shell_poll", "signature": "def shell_poll(cmd_line: str, **kwargs) -> None" } ]
2
null
Implement the Python class `Terminal` described below. Class description: TODO Method signatures and docstrings: - def shell_exec(cmd_line: str, **kwargs) -> Optional[str]: TODO - def shell_poll(cmd_line: str, **kwargs) -> None: TODO
Implement the Python class `Terminal` described below. Class description: TODO Method signatures and docstrings: - def shell_exec(cmd_line: str, **kwargs) -> Optional[str]: TODO - def shell_poll(cmd_line: str, **kwargs) -> None: TODO <|skeleton|> class Terminal: """TODO""" def shell_exec(cmd_line: str, **kw...
c79a2c17e89fe21d00ccd9c1646a03407cd61839
<|skeleton|> class Terminal: """TODO""" def shell_exec(cmd_line: str, **kwargs) -> Optional[str]: """TODO""" <|body_0|> def shell_poll(cmd_line: str, **kwargs) -> None: """TODO""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Terminal: """TODO""" def shell_exec(cmd_line: str, **kwargs) -> Optional[str]: """TODO""" try: log.info('Executing shell command: %s', cmd_line) cmd_args = list(filter(None, shlex.split(cmd_line))) result = subprocess.check_output(cmd_args, **kwargs).de...
the_stack_v2_python_sparse
src/main/hspylib/modules/cli/vt100/terminal.py
TrendingTechnology/hspylib
train
0
0f5832a785e9f82faa0479006fd00f3f9115a17a
[ "if not isinstance(user_id_list, list):\n query = UserConsumerModel.query.filter_by(status=1).filter(or_(and_(UserConsumerModel.consumer_user_id == user_id, UserConsumerModel.user_id == user_id_list), and_(UserConsumerModel.user_id == user_id, UserConsumerModel.consumer_user_id == user_id_list))).first()\n if...
<|body_start_0|> if not isinstance(user_id_list, list): query = UserConsumerModel.query.filter_by(status=1).filter(or_(and_(UserConsumerModel.consumer_user_id == user_id, UserConsumerModel.user_id == user_id_list), and_(UserConsumerModel.user_id == user_id, UserConsumerModel.consumer_user_id == user...
UserConsumerModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserConsumerModel: def query_trade_relationship(user_id, user_id_list): """查询用户user_id与其它用户是否有交易关系 :param user_id: 要查询的用户id :param user_id_list: 其它用户 :return:""" <|body_0|> def query_relation_consumer_money(user_id, other_user_id): """查询对方为我消费的总金额 :param user_id: 我的i...
stack_v2_sparse_classes_36k_train_027058
2,853
permissive
[ { "docstring": "查询用户user_id与其它用户是否有交易关系 :param user_id: 要查询的用户id :param user_id_list: 其它用户 :return:", "name": "query_trade_relationship", "signature": "def query_trade_relationship(user_id, user_id_list)" }, { "docstring": "查询对方为我消费的总金额 :param user_id: 我的id :param other_user_id: 对方的id", "nam...
2
null
Implement the Python class `UserConsumerModel` described below. Class description: Implement the UserConsumerModel class. Method signatures and docstrings: - def query_trade_relationship(user_id, user_id_list): 查询用户user_id与其它用户是否有交易关系 :param user_id: 要查询的用户id :param user_id_list: 其它用户 :return: - def query_relation_co...
Implement the Python class `UserConsumerModel` described below. Class description: Implement the UserConsumerModel class. Method signatures and docstrings: - def query_trade_relationship(user_id, user_id_list): 查询用户user_id与其它用户是否有交易关系 :param user_id: 要查询的用户id :param user_id_list: 其它用户 :return: - def query_relation_co...
646eeaacea77e293c6eccc6dad82a04ece9294a3
<|skeleton|> class UserConsumerModel: def query_trade_relationship(user_id, user_id_list): """查询用户user_id与其它用户是否有交易关系 :param user_id: 要查询的用户id :param user_id_list: 其它用户 :return:""" <|body_0|> def query_relation_consumer_money(user_id, other_user_id): """查询对方为我消费的总金额 :param user_id: 我的i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserConsumerModel: def query_trade_relationship(user_id, user_id_list): """查询用户user_id与其它用户是否有交易关系 :param user_id: 要查询的用户id :param user_id_list: 其它用户 :return:""" if not isinstance(user_id_list, list): query = UserConsumerModel.query.filter_by(status=1).filter(or_(and_(UserConsumerM...
the_stack_v2_python_sparse
app/models/social/user_consumer.py
Eastwu5788/heron
train
7
3d5fd521edf9e83a15939ecbf580205c51330dae
[ "if not coins:\n return -1\nif not amount:\n return 0\ndp = [0] + [float('inf')] * amount\nfor i in xrange(1, amount + 1):\n dp[i] = min([dp[i - coin] if i >= coin else float('inf') for coin in coins]) + 1\nreturn dp[-1] if not dp[-1] == float('inf') else -1", "if not coins:\n return -1\nif not amount...
<|body_start_0|> if not coins: return -1 if not amount: return 0 dp = [0] + [float('inf')] * amount for i in xrange(1, amount + 1): dp[i] = min([dp[i - coin] if i >= coin else float('inf') for coin in coins]) + 1 return dp[-1] if not dp[-1] == ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_027059
2,071
no_license
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange2", "signature": "def coinChange2(self, coins, amou...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:...
18ed31a3edf20a3e5a0b7a0b56acca5b98939693
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChange2(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" if not coins: return -1 if not amount: return 0 dp = [0] + [float('inf')] * amount for i in xrange(1, amount + 1): dp[i] = min([...
the_stack_v2_python_sparse
exercises/dynamic-programming/coin_change.py
nahgnaw/data-structure
train
0
9d00c1db80998e218848b3d979a7069444acee64
[ "self.version = ''\nself.datafile = ''\nself.command = ''\nself.alphabet = None\nself.background = {}\nself.sequences = []", "if isinstance(key, str):\n for motif in self:\n if motif.name == key:\n return motif\nelse:\n return list.__getitem__(self, key)" ]
<|body_start_0|> self.version = '' self.datafile = '' self.command = '' self.alphabet = None self.background = {} self.sequences = [] <|end_body_0|> <|body_start_1|> if isinstance(key, str): for motif in self: if motif.name == key: ...
Class for holding the results of a minimal MEME run.
Record
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Record: """Class for holding the results of a minimal MEME run.""" def __init__(self): """Initialize record class values.""" <|body_0|> def __getitem__(self, key): """Return the motif of index key.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027060
5,717
permissive
[ { "docstring": "Initialize record class values.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return the motif of index key.", "name": "__getitem__", "signature": "def __getitem__(self, key)" } ]
2
stack_v2_sparse_classes_30k_train_006422
Implement the Python class `Record` described below. Class description: Class for holding the results of a minimal MEME run. Method signatures and docstrings: - def __init__(self): Initialize record class values. - def __getitem__(self, key): Return the motif of index key.
Implement the Python class `Record` described below. Class description: Class for holding the results of a minimal MEME run. Method signatures and docstrings: - def __init__(self): Initialize record class values. - def __getitem__(self, key): Return the motif of index key. <|skeleton|> class Record: """Class for...
595c5c46794ae08a1f19716636eac7430cededa1
<|skeleton|> class Record: """Class for holding the results of a minimal MEME run.""" def __init__(self): """Initialize record class values.""" <|body_0|> def __getitem__(self, key): """Return the motif of index key.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Record: """Class for holding the results of a minimal MEME run.""" def __init__(self): """Initialize record class values.""" self.version = '' self.datafile = '' self.command = '' self.alphabet = None self.background = {} self.sequences = [] de...
the_stack_v2_python_sparse
.venv/Lib/site-packages/Bio/motifs/minimal.py
abner-lucas/tp-cruzi-db
train
2
1be50c4218919e7e99394858e11dd86b923f2053
[ "for param in params:\n if param not in self.__info__['space']:\n print('Error: not supported parameters {}'.format(param))\nif self.dataset_type == PROBLEM.CLASSIFICATION:\n model = SVC(C=float(params['C']), kernel=params['Kernel'], gamma=params['Gamma'], coef0=float(params['Coef0']))\nelse:\n mode...
<|body_start_0|> for param in params: if param not in self.__info__['space']: print('Error: not supported parameters {}'.format(param)) if self.dataset_type == PROBLEM.CLASSIFICATION: model = SVC(C=float(params['C']), kernel=params['Kernel'], gamma=params['Gamma']...
Parameter accepted: - C: strength of regularization (it is inversely proportional to C). Must be strictly positive. - kernel: kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid' - gamma: kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’. - coef0: independent term in kernel fun...
SVM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SVM: """Parameter accepted: - C: strength of regularization (it is inversely proportional to C). Must be strictly positive. - kernel: kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid' - gamma: kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’. - coef0:...
stack_v2_sparse_classes_36k_train_027061
3,603
no_license
[ { "docstring": "Train the model with the given hyper-parameters. Args: :param params: dictionary of hyper-parameters. :return: trained model.", "name": "train", "signature": "def train(self, params)" }, { "docstring": "Classify the test set of the chosen dataset and produce the result correspond...
2
stack_v2_sparse_classes_30k_train_005850
Implement the Python class `SVM` described below. Class description: Parameter accepted: - C: strength of regularization (it is inversely proportional to C). Must be strictly positive. - kernel: kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid' - gamma: kernel coefficient fo...
Implement the Python class `SVM` described below. Class description: Parameter accepted: - C: strength of regularization (it is inversely proportional to C). Must be strictly positive. - kernel: kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid' - gamma: kernel coefficient fo...
27f861c09615aedfd96cffdebf7d9653f72b4d7b
<|skeleton|> class SVM: """Parameter accepted: - C: strength of regularization (it is inversely proportional to C). Must be strictly positive. - kernel: kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid' - gamma: kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’. - coef0:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SVM: """Parameter accepted: - C: strength of regularization (it is inversely proportional to C). Must be strictly positive. - kernel: kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid' - gamma: kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’. - coef0: independent ...
the_stack_v2_python_sparse
API/Metrics/SVM.py
AndreaCorsini1/Ahmet
train
1
9832431aae694797617335846311b4cba0f1642d
[ "tcr_id = Utils.get_basic_value(request, 'id')\nTierConfiguration._save_fulfillment_parameters(request, client)\nreturn Utils.approve_tier_config_request(request, tcr_id, client)", "tcr_id = Utils.get_basic_value(request, 'id')\npayload = {'params': [{'id': 'param_a', 'value': 'value for param_a in Vendor System'...
<|body_start_0|> tcr_id = Utils.get_basic_value(request, 'id') TierConfiguration._save_fulfillment_parameters(request, client) return Utils.approve_tier_config_request(request, tcr_id, client) <|end_body_0|> <|body_start_1|> tcr_id = Utils.get_basic_value(request, 'id') payload ...
Type TIER CONFIGURATION means, the request has required data for subscription provisioning from the Reseller/Tier1. This request type can be 'setup' (only the first time the reseller places a purchase request), or 'update' (each time the reseller needs to change any tier scope parameter value))
TierConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TierConfiguration: """Type TIER CONFIGURATION means, the request has required data for subscription provisioning from the Reseller/Tier1. This request type can be 'setup' (only the first time the reseller places a purchase request), or 'update' (each time the reseller needs to change any tier sco...
stack_v2_sparse_classes_36k_train_027062
3,858
permissive
[ { "docstring": "This method processes a tier configuration request in pending status for setup and update action.", "name": "process_request", "signature": "def process_request(request, client)" }, { "docstring": "This method saves the needed information of the reseller in the tier config reques...
2
stack_v2_sparse_classes_30k_train_008059
Implement the Python class `TierConfiguration` described below. Class description: Type TIER CONFIGURATION means, the request has required data for subscription provisioning from the Reseller/Tier1. This request type can be 'setup' (only the first time the reseller places a purchase request), or 'update' (each time th...
Implement the Python class `TierConfiguration` described below. Class description: Type TIER CONFIGURATION means, the request has required data for subscription provisioning from the Reseller/Tier1. This request type can be 'setup' (only the first time the reseller places a purchase request), or 'update' (each time th...
627143eb7efefb514f75bc18decfbad21fc91c84
<|skeleton|> class TierConfiguration: """Type TIER CONFIGURATION means, the request has required data for subscription provisioning from the Reseller/Tier1. This request type can be 'setup' (only the first time the reseller places a purchase request), or 'update' (each time the reseller needs to change any tier sco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TierConfiguration: """Type TIER CONFIGURATION means, the request has required data for subscription provisioning from the Reseller/Tier1. This request type can be 'setup' (only the first time the reseller places a purchase request), or 'update' (each time the reseller needs to change any tier scope parameter ...
the_stack_v2_python_sparse
{{cookiecutter.project_slug}}/connect_processor/app/tier_fulfillment.py
VTimofeenko/connect-processor-template-for-python
train
0
5fd0a5d0a424910e19bae9beecf0714fd241e6f0
[ "if len(s) < k:\n return 0\nc = min(set(s), key=s.count)\nif s.count(c) >= k:\n return len(s)\nreturn max((self.longestSubstring(t, k) for t in s.split(c)))", "for c in set(s):\n if s.count(c) < k:\n return max((self.longestSubstring(t, k) for t in s.split(c)))\nreturn len(s)", "if len(s) < k:\n...
<|body_start_0|> if len(s) < k: return 0 c = min(set(s), key=s.count) if s.count(c) >= k: return len(s) return max((self.longestSubstring(t, k) for t in s.split(c))) <|end_body_0|> <|body_start_1|> for c in set(s): if s.count(c) < k: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87768/4-lines-Python If every character appears at least k times, the whole string is ok. Otherwise split by a...
stack_v2_sparse_classes_36k_train_027063
3,250
no_license
[ { "docstring": ":type s: str :type k: int :rtype: int https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87768/4-lines-Python If every character appears at least k times, the whole string is ok. Otherwise split by a least frequent character (because it will always be to...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87768/4-lines...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87768/4-lines...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87768/4-lines-Python If every character appears at least k times, the whole string is ok. Otherwise split by a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/discuss/87768/4-lines-Python If every character appears at least k times, the whole string is ok. Otherwise split by a least frequen...
the_stack_v2_python_sparse
LeetCode/395_longest_substring_with_at_least_k_repeating_characters.py
yao23/Machine_Learning_Playground
train
12
3ecba5e53a0030b52cda723137f6b55a5e94134f
[ "stemmed = global_stemmer.stem(word)\nif stemmed not in cls.word_lookup:\n cls.word_lookup[stemmed] = {}\ncls.word_lookup[stemmed][word] = cls.word_lookup[stemmed].get(word, 0) + 1\nreturn stemmed", "if word in cls.word_lookup:\n return max(cls.word_lookup[word].keys(), key=lambda x: cls.word_lookup[word][x...
<|body_start_0|> stemmed = global_stemmer.stem(word) if stemmed not in cls.word_lookup: cls.word_lookup[stemmed] = {} cls.word_lookup[stemmed][word] = cls.word_lookup[stemmed].get(word, 0) + 1 return stemmed <|end_body_0|> <|body_start_1|> if word in cls.word_lookup:...
Class to aid the stemming process - from word to stemmed form, and vice versa. The 'original' form of a stemmed word will be returned as the form in which its been used the most number of times in the text.
StemmingHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StemmingHelper: """Class to aid the stemming process - from word to stemmed form, and vice versa. The 'original' form of a stemmed word will be returned as the form in which its been used the most number of times in the text.""" def stem(cls, word): """Stems a word and updates the re...
stack_v2_sparse_classes_36k_train_027064
3,980
no_license
[ { "docstring": "Stems a word and updates the reverse lookup.", "name": "stem", "signature": "def stem(cls, word)" }, { "docstring": "Returns original form of a word given the stemmed version, as stored in the word lookup.", "name": "original_form", "signature": "def original_form(cls, wo...
2
stack_v2_sparse_classes_30k_train_011135
Implement the Python class `StemmingHelper` described below. Class description: Class to aid the stemming process - from word to stemmed form, and vice versa. The 'original' form of a stemmed word will be returned as the form in which its been used the most number of times in the text. Method signatures and docstring...
Implement the Python class `StemmingHelper` described below. Class description: Class to aid the stemming process - from word to stemmed form, and vice versa. The 'original' form of a stemmed word will be returned as the form in which its been used the most number of times in the text. Method signatures and docstring...
a4247074004c77c078e6d4b7270b517753df51a5
<|skeleton|> class StemmingHelper: """Class to aid the stemming process - from word to stemmed form, and vice versa. The 'original' form of a stemmed word will be returned as the form in which its been used the most number of times in the text.""" def stem(cls, word): """Stems a word and updates the re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StemmingHelper: """Class to aid the stemming process - from word to stemmed form, and vice versa. The 'original' form of a stemmed word will be returned as the form in which its been used the most number of times in the text.""" def stem(cls, word): """Stems a word and updates the reverse lookup....
the_stack_v2_python_sparse
Programming/python/word2vec/word2vec_utitlity.py
PythEsc/Research_project2
train
2
b3b36ac73791afcdd0a65a650e929c9fad049b48
[ "super(BookingInitialForm, self).__init__(*args, **kwargs)\ncargo_types = CargoType.objects.all()\nself.cargo_fields = []\nself.fields['dir_from'].queryset = Terminal.objects.filter(id__in=[t.from_d.id for t in Direction.objects.all()])\nself.fields['dir_to'].queryset = Terminal.objects.filter(id__in=[t.to.id for t...
<|body_start_0|> super(BookingInitialForm, self).__init__(*args, **kwargs) cargo_types = CargoType.objects.all() self.cargo_fields = [] self.fields['dir_from'].queryset = Terminal.objects.filter(id__in=[t.from_d.id for t in Direction.objects.all()]) self.fields['dir_to'].queryset...
Booking form for main page - type: one way | round trip - dir_from: get value from directions 'from_d' terminals - dir_to: get value from directions 'to' terminals - departure_date: when have to leave terminal - return_date: if booking type round then get what return date should be
BookingInitialForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookingInitialForm: """Booking form for main page - type: one way | round trip - dir_from: get value from directions 'from_d' terminals - dir_to: get value from directions 'to' terminals - departure_date: when have to leave terminal - return_date: if booking type round then get what return date s...
stack_v2_sparse_classes_36k_train_027065
13,644
no_license
[ { "docstring": "Dinamically create cargo type", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Save form data to session", "name": "save", "signature": "def save(self, *args, **kwargs)" }, { "docstring": "Validate departure date", "n...
6
stack_v2_sparse_classes_30k_train_005710
Implement the Python class `BookingInitialForm` described below. Class description: Booking form for main page - type: one way | round trip - dir_from: get value from directions 'from_d' terminals - dir_to: get value from directions 'to' terminals - departure_date: when have to leave terminal - return_date: if booking...
Implement the Python class `BookingInitialForm` described below. Class description: Booking form for main page - type: one way | round trip - dir_from: get value from directions 'from_d' terminals - dir_to: get value from directions 'to' terminals - departure_date: when have to leave terminal - return_date: if booking...
e01ac10772f484e83209c47484a2af2ad595e7f1
<|skeleton|> class BookingInitialForm: """Booking form for main page - type: one way | round trip - dir_from: get value from directions 'from_d' terminals - dir_to: get value from directions 'to' terminals - departure_date: when have to leave terminal - return_date: if booking type round then get what return date s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookingInitialForm: """Booking form for main page - type: one way | round trip - dir_from: get value from directions 'from_d' terminals - dir_to: get value from directions 'to' terminals - departure_date: when have to leave terminal - return_date: if booking type round then get what return date should be""" ...
the_stack_v2_python_sparse
port_app/booking/forms.py
vugarrahim/vugarrahim.github.io
train
0
f1e13f61e172db31f48c1bbaf280d7f24ffb5310
[ "import math\nfor i in range(int(math.sqrt(c)) + 1):\n left, right = (0, int(math.sqrt(c - i ** 2)) + 1)\n while left < right:\n mid = left + right >> 1\n res = mid ** 2 + i ** 2\n if res > c:\n right = mid - 1\n elif res == c:\n return True\n else:\n ...
<|body_start_0|> import math for i in range(int(math.sqrt(c)) + 1): left, right = (0, int(math.sqrt(c - i ** 2)) + 1) while left < right: mid = left + right >> 1 res = mid ** 2 + i ** 2 if res > c: right = mid - ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def judgeSquareSum(self, c: int) -> bool: """双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:""" <|body_0|> def judgeSquareSum2(self, c: int) -> bool: """双指针 :param c: :return:""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_027066
1,521
no_license
[ { "docstring": "双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:", "name": "judgeSquareSum", "signature": "def judgeSquareSum(self, c: int) -> bool" }, { "docstring": "双指针 :param c: :return:", "name": "judgeSquareSum2", "signature": "def judgeSquareSum2(self, ...
2
stack_v2_sparse_classes_30k_test_000660
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum(self, c: int) -> bool: 双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return: - def judgeSquareSum2(self, c: int) -> bool: 双指针 :param c: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum(self, c: int) -> bool: 双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return: - def judgeSquareSum2(self, c: int) -> bool: 双指针 :param c: ...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def judgeSquareSum(self, c: int) -> bool: """双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:""" <|body_0|> def judgeSquareSum2(self, c: int) -> bool: """双指针 :param c: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def judgeSquareSum(self, c: int) -> bool: """双指针 + 二分查找,范围为 左指针范围[1, sqrt(c)] 右指针[1, sqrt(c - i ** 2)] :param c: :return:""" import math for i in range(int(math.sqrt(c)) + 1): left, right = (0, int(math.sqrt(c - i ** 2)) + 1) while left < right: ...
the_stack_v2_python_sparse
Interview_preparation/tencent/JudgeSquareSum.py
yinhuax/leet_code
train
0
6f8574699b6b41517f2d584830ef0d63cf108c7c
[ "params = {'action': 'process', 'json': 'true', 'page_size': PAGE_SIZE, 'page': page_number, 'fields': FIELDS_OF_PRODUCT, 'sort_by': 'unique_scans_n'}\nheaders = {'User-Agent': 'NameOfYourApp - Android - Version 1.0 - www.yourappwebsite.com'}\nresult = requests.get(API_BASE_URL, headers=headers, params=params)\nif ...
<|body_start_0|> params = {'action': 'process', 'json': 'true', 'page_size': PAGE_SIZE, 'page': page_number, 'fields': FIELDS_OF_PRODUCT, 'sort_by': 'unique_scans_n'} headers = {'User-Agent': 'NameOfYourApp - Android - Version 1.0 - www.yourappwebsite.com'} result = requests.get(API_BASE_URL, he...
OpenFoodApi class To manage Open Food Facts API data recovery
OpenFoodApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpenFoodApi: """OpenFoodApi class To manage Open Food Facts API data recovery""" def get_api_products(self, page_number): """We retrieve the raw data (products) from the api :return: json data :rtype: list()""" <|body_0|> def get_full_api_products(self): """We re...
stack_v2_sparse_classes_36k_train_027067
2,040
no_license
[ { "docstring": "We retrieve the raw data (products) from the api :return: json data :rtype: list()", "name": "get_api_products", "signature": "def get_api_products(self, page_number)" }, { "docstring": "We recover as many pages of raw data as defined in the application configuration (see setting...
2
stack_v2_sparse_classes_30k_train_008585
Implement the Python class `OpenFoodApi` described below. Class description: OpenFoodApi class To manage Open Food Facts API data recovery Method signatures and docstrings: - def get_api_products(self, page_number): We retrieve the raw data (products) from the api :return: json data :rtype: list() - def get_full_api_...
Implement the Python class `OpenFoodApi` described below. Class description: OpenFoodApi class To manage Open Food Facts API data recovery Method signatures and docstrings: - def get_api_products(self, page_number): We retrieve the raw data (products) from the api :return: json data :rtype: list() - def get_full_api_...
377deb35afe3749c8db8d09a55d4b69f8a8238a0
<|skeleton|> class OpenFoodApi: """OpenFoodApi class To manage Open Food Facts API data recovery""" def get_api_products(self, page_number): """We retrieve the raw data (products) from the api :return: json data :rtype: list()""" <|body_0|> def get_full_api_products(self): """We re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpenFoodApi: """OpenFoodApi class To manage Open Food Facts API data recovery""" def get_api_products(self, page_number): """We retrieve the raw data (products) from the api :return: json data :rtype: list()""" params = {'action': 'process', 'json': 'true', 'page_size': PAGE_SIZE, 'page':...
the_stack_v2_python_sparse
src/data/api/open_food_api.py
Githb-usr/substitution
train
0
22194b07d19eb1b7b8848e24d3f1436ed8d15636
[ "chart_options = document.chart_options\nlayers = chart_options.layers\nreturn cls._add_hover_tool(chart_layers=layers, plot=base_object)", "tooltips = []\nfor layer in chart_layers:\n axis = layer.axis\n cls._prepare_tooltip(tooltips=tooltips, axis=axis)\nif len(tooltips) > 0:\n hover_tool = HoverTool(t...
<|body_start_0|> chart_options = document.chart_options layers = chart_options.layers return cls._add_hover_tool(chart_layers=layers, plot=base_object) <|end_body_0|> <|body_start_1|> tooltips = [] for layer in chart_layers: axis = layer.axis cls._prepare...
Recipe for creating hover tool on the plot.
HoverToolRecipe
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HoverToolRecipe: """Recipe for creating hover tool on the plot.""" def create(cls, document: Chart, base_object: Figure) -> None: """Create a hover tool for a plot. :param document: (Chart) chart document object instance. :param base_object: (Figure) bokeh figure to create hover tool...
stack_v2_sparse_classes_36k_train_027068
9,655
no_license
[ { "docstring": "Create a hover tool for a plot. :param document: (Chart) chart document object instance. :param base_object: (Figure) bokeh figure to create hover tool for. :return: None", "name": "create", "signature": "def create(cls, document: Chart, base_object: Figure) -> None" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_007174
Implement the Python class `HoverToolRecipe` described below. Class description: Recipe for creating hover tool on the plot. Method signatures and docstrings: - def create(cls, document: Chart, base_object: Figure) -> None: Create a hover tool for a plot. :param document: (Chart) chart document object instance. :para...
Implement the Python class `HoverToolRecipe` described below. Class description: Recipe for creating hover tool on the plot. Method signatures and docstrings: - def create(cls, document: Chart, base_object: Figure) -> None: Create a hover tool for a plot. :param document: (Chart) chart document object instance. :para...
eae965a1eb6f53ec5bd5ab961ec0383737165ce4
<|skeleton|> class HoverToolRecipe: """Recipe for creating hover tool on the plot.""" def create(cls, document: Chart, base_object: Figure) -> None: """Create a hover tool for a plot. :param document: (Chart) chart document object instance. :param base_object: (Figure) bokeh figure to create hover tool...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HoverToolRecipe: """Recipe for creating hover tool on the plot.""" def create(cls, document: Chart, base_object: Figure) -> None: """Create a hover tool for a plot. :param document: (Chart) chart document object instance. :param base_object: (Figure) bokeh figure to create hover tool for. :return...
the_stack_v2_python_sparse
Visualiser/modules/charts/creators.py
RadoslawPotyka/DataVisualiser
train
0
030effe96e3d3a4d5649b8cc2905cd65dbd549a0
[ "level = SimpleQueue()\nlevel.put(root)\nlevel_count = 1 if root else 0\nres = []\nwhile level_count:\n next_level_count = 0\n next_level = SimpleQueue()\n while level.qsize():\n curr = level.get()\n if curr:\n val = str(curr.val)\n for node in [curr.left, curr.right]:\n...
<|body_start_0|> level = SimpleQueue() level.put(root) level_count = 1 if root else 0 res = [] while level_count: next_level_count = 0 next_level = SimpleQueue() while level.qsize(): curr = level.get() if curr: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_027069
2,587
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_005706
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
b17d53619c7b2cc5851cd2a02fa3e81f676914de
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" level = SimpleQueue() level.put(root) level_count = 1 if root else 0 res = [] while level_count: next_level_count = 0 next_level =...
the_stack_v2_python_sparse
non_optimal_solutions/codec.py
echrisinger/Blind-75
train
7
66f043977c9c6ebf9fda38a3b6b22bdbca87a951
[ "self.x = None\nself.x_pad = None\nself.w = None\nself.b = None\nself.stride = kwargs.get('stride', 1)\nself.pad = kwargs.get('pad', 0)", "pad, stride = (self.pad, self.stride)\nN, _, H, W = x.shape\nF, _, Hf, Wf = w.shape\npad_width = ((0, 0), (0, 0), (pad, pad), (pad, pad))\nself.x_pad = np.pad(x, pad_width=pad...
<|body_start_0|> self.x = None self.x_pad = None self.w = None self.b = None self.stride = kwargs.get('stride', 1) self.pad = kwargs.get('pad', 0) <|end_body_0|> <|body_start_1|> pad, stride = (self.pad, self.stride) N, _, H, W = x.shape F, _, Hf,...
Conv implements a network layer that performs convolution operation on input data Convolution expects an input consisting of N data points, each with C channels, height H and width W. It applies F different filters, where each filter spans all C channels and has height Hf and width Wf.
Conv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv: """Conv implements a network layer that performs convolution operation on input data Convolution expects an input consisting of N data points, each with C channels, height H and width W. It applies F different filters, where each filter spans all C channels and has height Hf and width Wf.""...
stack_v2_sparse_classes_36k_train_027070
5,045
no_license
[ { "docstring": "Keyword args: stride: The number of pixels between adjacent receptive fields in the horizontal and vertical directions pad: The number of pixels that will be used to zero-pad the input", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Naive impl...
3
null
Implement the Python class `Conv` described below. Class description: Conv implements a network layer that performs convolution operation on input data Convolution expects an input consisting of N data points, each with C channels, height H and width W. It applies F different filters, where each filter spans all C cha...
Implement the Python class `Conv` described below. Class description: Conv implements a network layer that performs convolution operation on input data Convolution expects an input consisting of N data points, each with C channels, height H and width W. It applies F different filters, where each filter spans all C cha...
7da789ef34d5e5bcf9033cfbe0ff5df607b2437a
<|skeleton|> class Conv: """Conv implements a network layer that performs convolution operation on input data Convolution expects an input consisting of N data points, each with C channels, height H and width W. It applies F different filters, where each filter spans all C channels and has height Hf and width Wf.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv: """Conv implements a network layer that performs convolution operation on input data Convolution expects an input consisting of N data points, each with C channels, height H and width W. It applies F different filters, where each filter spans all C channels and has height Hf and width Wf.""" def __...
the_stack_v2_python_sparse
convolutional_neural_networks/conv_net/layer/conv.py
calvinfeng/machine-learning-notebook
train
38
ac88a8dc489c850231c74a64c197c011485dfbf6
[ "self.table = []\nfor i in range(len(w)):\n self.table += [i] * w[i]", "total = len(self.table)\nrnd = random.randint(0, total - 1)\nreturn self.table[rnd]" ]
<|body_start_0|> self.table = [] for i in range(len(w)): self.table += [i] * w[i] <|end_body_0|> <|body_start_1|> total = len(self.table) rnd = random.randint(0, total - 1) return self.table[rnd] <|end_body_1|>
Solution_MLE
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_MLE: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.table = [] for i in range(len(w)): self.table += [i] * w[i] <|end_b...
stack_v2_sparse_classes_36k_train_027071
1,874
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
stack_v2_sparse_classes_30k_train_006482
Implement the Python class `Solution_MLE` described below. Class description: Implement the Solution_MLE class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution_MLE` described below. Class description: Implement the Solution_MLE class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution_MLE: def __init__(self, w): """:type w: List[int]""...
ce68f5af57f772185211f4e81952d0345a6d23cb
<|skeleton|> class Solution_MLE: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_MLE: def __init__(self, w): """:type w: List[int]""" self.table = [] for i in range(len(w)): self.table += [i] * w[i] def pickIndex(self): """:rtype: int""" total = len(self.table) rnd = random.randint(0, total - 1) return self....
the_stack_v2_python_sparse
Previous/528_Random_Pick_with_Weight.py
xizhang77/LeetCode
train
0
a5a80c8b69b152058ecded2ab89ad3c4f03981c4
[ "horizontal = ['.'] * n\nvertical = ['.'] * n\nleft_oblique = ['.'] * 2 * n\nright_oblique = ['.'] * 2 * n\nqueens = []\nboard = Board(horizontal, vertical, left_oblique, right_oblique, [], n)\nreturn self.put_queen(board, n)", "res = []\nif len(board.queens) == n:\n res.append(board.output())\n return res\...
<|body_start_0|> horizontal = ['.'] * n vertical = ['.'] * n left_oblique = ['.'] * 2 * n right_oblique = ['.'] * 2 * n queens = [] board = Board(horizontal, vertical, left_oblique, right_oblique, [], n) return self.put_queen(board, n) <|end_body_0|> <|body_start...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_0|> def put_queen(self, board, n): """put xth queen on the board""" <|body_1|> <|end_skeleton|> <|body_start_0|> horizontal = ['.'] * n vertical = ['.'] *...
stack_v2_sparse_classes_36k_train_027072
2,324
permissive
[ { "docstring": ":type n: int :rtype: List[List[str]]", "name": "solveNQueens", "signature": "def solveNQueens(self, n)" }, { "docstring": "put xth queen on the board", "name": "put_queen", "signature": "def put_queen(self, board, n)" } ]
2
stack_v2_sparse_classes_30k_train_006524
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] - def put_queen(self, board, n): put xth queen on the board
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def solveNQueens(self, n): :type n: int :rtype: List[List[str]] - def put_queen(self, board, n): put xth queen on the board <|skeleton|> class Solution: def solveNQueens(se...
7a072d453085e5830eeb597a36ab5e24f4821418
<|skeleton|> class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" <|body_0|> def put_queen(self, board, n): """put xth queen on the board""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def solveNQueens(self, n): """:type n: int :rtype: List[List[str]]""" horizontal = ['.'] * n vertical = ['.'] * n left_oblique = ['.'] * 2 * n right_oblique = ['.'] * 2 * n queens = [] board = Board(horizontal, vertical, left_oblique, right_obl...
the_stack_v2_python_sparse
n_queens.py
luozhaoyu/leetcode
train
0
09dc5b08544f1c579a47c0861aef266f7eb885f8
[ "if n < 3:\n return 0\nelse:\n num_list = [1] * n\n num_list[0], num_list[1] = (0, 0)\n for i in range(2, int(n ** 0.5 + 1)):\n if num_list[i] == 1:\n num_list[i * i:n:i] = [0] * len(num_list[i * i:n:i])\n return sum(num_list)", "pre = None\nwhile head:\n tmp = head.next\n h...
<|body_start_0|> if n < 3: return 0 else: num_list = [1] * n num_list[0], num_list[1] = (0, 0) for i in range(2, int(n ** 0.5 + 1)): if num_list[i] == 1: num_list[i * i:n:i] = [0] * len(num_list[i * i:n:i]) r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countPrimes(self, n): """:type n: int :rtype: int""" <|body_0|> def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 3: return 0 else: ...
stack_v2_sparse_classes_36k_train_027073
1,059
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "countPrimes", "signature": "def countPrimes(self, n)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_000972
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimes(self, n): :type n: int :rtype: int - def reverseList(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPrimes(self, n): :type n: int :rtype: int - def reverseList(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def countPrimes(self, n...
4251f7d8f4b5c30546424f823a0ec527a06dda5d
<|skeleton|> class Solution: def countPrimes(self, n): """:type n: int :rtype: int""" <|body_0|> def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countPrimes(self, n): """:type n: int :rtype: int""" if n < 3: return 0 else: num_list = [1] * n num_list[0], num_list[1] = (0, 0) for i in range(2, int(n ** 0.5 + 1)): if num_list[i] == 1: ...
the_stack_v2_python_sparse
leetcode/11-27-test.py
MaLei666/learngit
train
0
194a1abd2cf1e239502d52793b94d386d5390892
[ "today = timezone.now().date()\ncount = user.threads.filter(started__gte=today).count()\nreturn count", "timestamp = Negotiation.get_timestamp(timezone.now().date())\ncount = user.negotiations_made.filter(time__gte=timestamp).count()\nreturn count", "from scoop.messaging.models import Message\ntimestamp = Messa...
<|body_start_0|> today = timezone.now().date() count = user.threads.filter(started__gte=today).count() return count <|end_body_0|> <|body_start_1|> timestamp = Negotiation.get_timestamp(timezone.now().date()) count = user.negotiations_made.filter(time__gte=timestamp).count() ...
Manager des quotas
QuotaManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotaManager: """Manager des quotas""" def get_threads_today_by(self, user): """Renvoyer le nombre de fils créés aujourd'hui par un utilisateur""" <|body_0|> def get_negotiations_today_by(self, user): """Renvoyer le nombre de négociations envoyées aujourd'hui par...
stack_v2_sparse_classes_36k_train_027074
3,706
no_license
[ { "docstring": "Renvoyer le nombre de fils créés aujourd'hui par un utilisateur", "name": "get_threads_today_by", "signature": "def get_threads_today_by(self, user)" }, { "docstring": "Renvoyer le nombre de négociations envoyées aujourd'hui par un utilisateur", "name": "get_negotiations_toda...
5
null
Implement the Python class `QuotaManager` described below. Class description: Manager des quotas Method signatures and docstrings: - def get_threads_today_by(self, user): Renvoyer le nombre de fils créés aujourd'hui par un utilisateur - def get_negotiations_today_by(self, user): Renvoyer le nombre de négociations env...
Implement the Python class `QuotaManager` described below. Class description: Manager des quotas Method signatures and docstrings: - def get_threads_today_by(self, user): Renvoyer le nombre de fils créés aujourd'hui par un utilisateur - def get_negotiations_today_by(self, user): Renvoyer le nombre de négociations env...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class QuotaManager: """Manager des quotas""" def get_threads_today_by(self, user): """Renvoyer le nombre de fils créés aujourd'hui par un utilisateur""" <|body_0|> def get_negotiations_today_by(self, user): """Renvoyer le nombre de négociations envoyées aujourd'hui par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuotaManager: """Manager des quotas""" def get_threads_today_by(self, user): """Renvoyer le nombre de fils créés aujourd'hui par un utilisateur""" today = timezone.now().date() count = user.threads.filter(started__gte=today).count() return count def get_negotiations_t...
the_stack_v2_python_sparse
scoop/messaging/models/quota.py
artscoop/scoop
train
0
c7a7f5471973ac0f215bd6f89ea525ae42881c73
[ "unit = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas']\nresult = ' '\ntotal_terbilang = self.total_terbilang\nfor line in self:\n n = int(amount_total)\n if n >= 0 and n <= 11:\n result = result + unit[n]\n elif n < 20:\n result = to...
<|body_start_0|> unit = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas'] result = ' ' total_terbilang = self.total_terbilang for line in self: n = int(amount_total) if n >= 0 and n <= 11: re...
inherit model account.invoice
AccountInvoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountInvoice: """inherit model account.invoice""" def total_terbilang(self, amount_total): """function to converting amount total into word""" <|body_0|> def currency_word(self): """function to converting currency into word""" <|body_1|> def _prepa...
stack_v2_sparse_classes_36k_train_027075
3,798
no_license
[ { "docstring": "function to converting amount total into word", "name": "total_terbilang", "signature": "def total_terbilang(self, amount_total)" }, { "docstring": "function to converting currency into word", "name": "currency_word", "signature": "def currency_word(self)" }, { "d...
5
stack_v2_sparse_classes_30k_train_011793
Implement the Python class `AccountInvoice` described below. Class description: inherit model account.invoice Method signatures and docstrings: - def total_terbilang(self, amount_total): function to converting amount total into word - def currency_word(self): function to converting currency into word - def _prepare_r...
Implement the Python class `AccountInvoice` described below. Class description: inherit model account.invoice Method signatures and docstrings: - def total_terbilang(self, amount_total): function to converting amount total into word - def currency_word(self): function to converting currency into word - def _prepare_r...
976928395f3b600275f6ab53445605fe1167c6ba
<|skeleton|> class AccountInvoice: """inherit model account.invoice""" def total_terbilang(self, amount_total): """function to converting amount total into word""" <|body_0|> def currency_word(self): """function to converting currency into word""" <|body_1|> def _prepa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountInvoice: """inherit model account.invoice""" def total_terbilang(self, amount_total): """function to converting amount total into word""" unit = ['', 'Satu', 'Dua', 'Tiga', 'Empat', 'Lima', 'Enam', 'Tujuh', 'Delapan', 'Sembilan', 'Sepuluh', 'Sebelas'] result = ' ' t...
the_stack_v2_python_sparse
pn_account/models/account_invoice.py
detian08/pennyu
train
0
c990bee5f118d0e92d656691431d5ba43f7f8ab5
[ "uf = UnionFind(n + 1)\nfor u, v, _ in roads:\n uf.union(u, v)\nres = INF\nfor u, v, w in roads:\n if uf.isConnected(u, 1):\n res = min(res, w)\nreturn res", "adjList = [[] for _ in range(n)]\nfor u, v, w in roads:\n u, v = (u - 1, v - 1)\n adjList[u].append((v, w))\n adjList[v].append((u, w...
<|body_start_0|> uf = UnionFind(n + 1) for u, v, _ in roads: uf.union(u, v) res = INF for u, v, w in roads: if uf.isConnected(u, 1): res = min(res, w) return res <|end_body_0|> <|body_start_1|> adjList = [[] for _ in range(n)] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minScore(self, n: int, roads: List[List[int]]) -> int: """并查集""" <|body_0|> def minScore2(self, n: int, roads: List[List[int]]) -> int: """bfs求连通块最大边权""" <|body_1|> def minScore3(self, n: int, roads: List[List[int]]) -> int: """dfs求...
stack_v2_sparse_classes_36k_train_027076
3,079
no_license
[ { "docstring": "并查集", "name": "minScore", "signature": "def minScore(self, n: int, roads: List[List[int]]) -> int" }, { "docstring": "bfs求连通块最大边权", "name": "minScore2", "signature": "def minScore2(self, n: int, roads: List[List[int]]) -> int" }, { "docstring": "dfs求连通块最大边权", ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minScore(self, n: int, roads: List[List[int]]) -> int: 并查集 - def minScore2(self, n: int, roads: List[List[int]]) -> int: bfs求连通块最大边权 - def minScore3(self, n: int, roads: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minScore(self, n: int, roads: List[List[int]]) -> int: 并查集 - def minScore2(self, n: int, roads: List[List[int]]) -> int: bfs求连通块最大边权 - def minScore3(self, n: int, roads: List...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minScore(self, n: int, roads: List[List[int]]) -> int: """并查集""" <|body_0|> def minScore2(self, n: int, roads: List[List[int]]) -> int: """bfs求连通块最大边权""" <|body_1|> def minScore3(self, n: int, roads: List[List[int]]) -> int: """dfs求...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minScore(self, n: int, roads: List[List[int]]) -> int: """并查集""" uf = UnionFind(n + 1) for u, v, _ in roads: uf.union(u, v) res = INF for u, v, w in roads: if uf.isConnected(u, 1): res = min(res, w) return re...
the_stack_v2_python_sparse
14_并查集/6255. 两个城市间路径的最小分数.py
981377660LMT/algorithm-study
train
225
7a2042358fd7b844712b8bb31be745048b31da62
[ "denoms = data.groupby(Config.DATE_COL).sum()['Denominator']\nnums = data.groupby(Config.DATE_COL).sum()[Config.CLI_COLS + Config.FLU1_COL]\nX = np.zeros((nums.shape[0], 6 + nums.shape[0]))\nnot_sunday = np.where(nums.index.dayofweek != 6)[0]\nX[not_sunday, np.array(nums.index.dayofweek)[not_sunday]] = 1\nX[np.wher...
<|body_start_0|> denoms = data.groupby(Config.DATE_COL).sum()['Denominator'] nums = data.groupby(Config.DATE_COL).sum()[Config.CLI_COLS + Config.FLU1_COL] X = np.zeros((nums.shape[0], 6 + nums.shape[0])) not_sunday = np.where(nums.index.dayofweek != 6)[0] X[not_sunday, np.array(n...
Class to handle weekday effects.
Weekday
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Weekday: """Class to handle weekday effects.""" def get_params(data): """Correct a signal estimated as numerator/denominator for weekday effects. The ordinary estimate would be numerator_t/denominator_t for each time point t. Instead, model log(numerator_t/denominator_t) = alpha_{wd(...
stack_v2_sparse_classes_36k_train_027077
5,067
permissive
[ { "docstring": "Correct a signal estimated as numerator/denominator for weekday effects. The ordinary estimate would be numerator_t/denominator_t for each time point t. Instead, model log(numerator_t/denominator_t) = alpha_{wd(t)} + phi_t where alpha is a vector of fixed effects for each weekday. For identifiab...
2
null
Implement the Python class `Weekday` described below. Class description: Class to handle weekday effects. Method signatures and docstrings: - def get_params(data): Correct a signal estimated as numerator/denominator for weekday effects. The ordinary estimate would be numerator_t/denominator_t for each time point t. I...
Implement the Python class `Weekday` described below. Class description: Class to handle weekday effects. Method signatures and docstrings: - def get_params(data): Correct a signal estimated as numerator/denominator for weekday effects. The ordinary estimate would be numerator_t/denominator_t for each time point t. I...
0c0ca18f38892c850565edf8bed9d2acaf234354
<|skeleton|> class Weekday: """Class to handle weekday effects.""" def get_params(data): """Correct a signal estimated as numerator/denominator for weekday effects. The ordinary estimate would be numerator_t/denominator_t for each time point t. Instead, model log(numerator_t/denominator_t) = alpha_{wd(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Weekday: """Class to handle weekday effects.""" def get_params(data): """Correct a signal estimated as numerator/denominator for weekday effects. The ordinary estimate would be numerator_t/denominator_t for each time point t. Instead, model log(numerator_t/denominator_t) = alpha_{wd(t)} + phi_t w...
the_stack_v2_python_sparse
doctor_visits/delphi_doctor_visits/weekday.py
alexcoda/covidcast-indicators
train
0
fa92587ab29b36278f5d704907da294f8c5dafe4
[ "n = len(coins)\ndp = [[0] * (amount + 1) for _ in range(n + 1)]\nfor i in range(n + 1):\n dp[i][0] = 1\nfor i in range(1, n + 1):\n for j in range(1, amount + 1):\n dp[i][j] = dp[i - 1][j]\n if j >= coins[i - 1]:\n dp[i][j] = dp[i - 1][j] + dp[i][j - coins[i - 1]]\nreturn dp[-1][-1]"...
<|body_start_0|> n = len(coins) dp = [[0] * (amount + 1) for _ in range(n + 1)] for i in range(n + 1): dp[i][0] = 1 for i in range(1, n + 1): for j in range(1, amount + 1): dp[i][j] = dp[i - 1][j] if j >= coins[i - 1]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change1(self, amount: int, coins: List[int]) -> int: """1. 每个物品可以用无数次 2. dp[i][j]表示用硬币的前i个可以凑成金额j的个数""" <|body_0|> def change2(self, amount: int, coins: List[int]) -> int: """1. 每个物品可以用无数次 2. 每次会用到上面一层的结果,可以将上面dp[i-1][j]改为dp[j]""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_027078
1,814
no_license
[ { "docstring": "1. 每个物品可以用无数次 2. dp[i][j]表示用硬币的前i个可以凑成金额j的个数", "name": "change1", "signature": "def change1(self, amount: int, coins: List[int]) -> int" }, { "docstring": "1. 每个物品可以用无数次 2. 每次会用到上面一层的结果,可以将上面dp[i-1][j]改为dp[j]", "name": "change2", "signature": "def change2(self, amount: in...
2
stack_v2_sparse_classes_30k_train_020687
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change1(self, amount: int, coins: List[int]) -> int: 1. 每个物品可以用无数次 2. dp[i][j]表示用硬币的前i个可以凑成金额j的个数 - def change2(self, amount: int, coins: List[int]) -> int: 1. 每个物品可以用无数次 2. ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change1(self, amount: int, coins: List[int]) -> int: 1. 每个物品可以用无数次 2. dp[i][j]表示用硬币的前i个可以凑成金额j的个数 - def change2(self, amount: int, coins: List[int]) -> int: 1. 每个物品可以用无数次 2. ...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def change1(self, amount: int, coins: List[int]) -> int: """1. 每个物品可以用无数次 2. dp[i][j]表示用硬币的前i个可以凑成金额j的个数""" <|body_0|> def change2(self, amount: int, coins: List[int]) -> int: """1. 每个物品可以用无数次 2. 每次会用到上面一层的结果,可以将上面dp[i-1][j]改为dp[j]""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def change1(self, amount: int, coins: List[int]) -> int: """1. 每个物品可以用无数次 2. dp[i][j]表示用硬币的前i个可以凑成金额j的个数""" n = len(coins) dp = [[0] * (amount + 1) for _ in range(n + 1)] for i in range(n + 1): dp[i][0] = 1 for i in range(1, n + 1): for...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/背包问题/完全背包问题.py
yiming1012/MyLeetCode
train
2
b89b4bf56f9eb8406bd53a151aceab2d53a47718
[ "self.env.revert_snapshot('ready_with_3_slaves')\nself.prepare_plugin()\nself.helpers.create_cluster(name=self.__class__.__name__)\nself.activate_plugin()", "self.check_run('deploy_elasticsearch_kibana')\nself.env.revert_snapshot('ready_with_3_slaves')\nself.prepare_plugin()\nself.helpers.create_cluster(name=self...
<|body_start_0|> self.env.revert_snapshot('ready_with_3_slaves') self.prepare_plugin() self.helpers.create_cluster(name=self.__class__.__name__) self.activate_plugin() <|end_body_0|> <|body_start_1|> self.check_run('deploy_elasticsearch_kibana') self.env.revert_snapshot(...
Class for smoke testing the Elasticsearch/Kibana plugin.
TestElasticsearchPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestElasticsearchPlugin: """Class for smoke testing the Elasticsearch/Kibana plugin.""" def install_elasticsearch_kibana(self): """Install Elasticsearch/Kibana plugin and check it exists Scenario: 1. Upload the Elasticsearch/Kibana plugin to the master node 2. Install the plugin 3. C...
stack_v2_sparse_classes_36k_train_027079
5,554
no_license
[ { "docstring": "Install Elasticsearch/Kibana plugin and check it exists Scenario: 1. Upload the Elasticsearch/Kibana plugin to the master node 2. Install the plugin 3. Create a cluster 4. Check that the plugin can be enabled Duration 20m", "name": "install_elasticsearch_kibana", "signature": "def instal...
5
stack_v2_sparse_classes_30k_train_006370
Implement the Python class `TestElasticsearchPlugin` described below. Class description: Class for smoke testing the Elasticsearch/Kibana plugin. Method signatures and docstrings: - def install_elasticsearch_kibana(self): Install Elasticsearch/Kibana plugin and check it exists Scenario: 1. Upload the Elasticsearch/Ki...
Implement the Python class `TestElasticsearchPlugin` described below. Class description: Class for smoke testing the Elasticsearch/Kibana plugin. Method signatures and docstrings: - def install_elasticsearch_kibana(self): Install Elasticsearch/Kibana plugin and check it exists Scenario: 1. Upload the Elasticsearch/Ki...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestElasticsearchPlugin: """Class for smoke testing the Elasticsearch/Kibana plugin.""" def install_elasticsearch_kibana(self): """Install Elasticsearch/Kibana plugin and check it exists Scenario: 1. Upload the Elasticsearch/Kibana plugin to the master node 2. Install the plugin 3. C...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestElasticsearchPlugin: """Class for smoke testing the Elasticsearch/Kibana plugin.""" def install_elasticsearch_kibana(self): """Install Elasticsearch/Kibana plugin and check it exists Scenario: 1. Upload the Elasticsearch/Kibana plugin to the master node 2. Install the plugin 3. Create a clust...
the_stack_v2_python_sparse
stacklight_tests/elasticsearch_kibana/test_smoke_bvt.py
rkhozinov/stacklight-integration-tests
train
1
778fb8755ea8a1899219b17128acb489e8095a1d
[ "self.expdf = assign_rxn_types(selected_df.copy())\nself.expdf = add_interpreted_columns(self.expdf)\nif alldf is not None:\n self.alldf = assign_rxn_types(alldf.copy())\n self.alldf = add_interpreted_columns(self.alldf)\nif expname is not None:\n self.expname = expname\nelse:\n self.expname = str(self....
<|body_start_0|> self.expdf = assign_rxn_types(selected_df.copy()) self.expdf = add_interpreted_columns(self.expdf) if alldf is not None: self.alldf = assign_rxn_types(alldf.copy()) self.alldf = add_interpreted_columns(self.alldf) if expname is not None: ...
CAZyExperiment2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CAZyExperiment2: def __init__(self, selected_df, alldf=None, expname=None): """Takes a tecan dataframe, makes a copy and adds fields needed for activity calculations (inc baseline subtractions) Arguments: selected_df: the dataframe Kewyord arguments: alldf: the dataframe with all activit...
stack_v2_sparse_classes_36k_train_027080
17,357
no_license
[ { "docstring": "Takes a tecan dataframe, makes a copy and adds fields needed for activity calculations (inc baseline subtractions) Arguments: selected_df: the dataframe Kewyord arguments: alldf: the dataframe with all activities (default None) expname: name for this experiment (otherwise use date)- default None...
2
stack_v2_sparse_classes_30k_train_014431
Implement the Python class `CAZyExperiment2` described below. Class description: Implement the CAZyExperiment2 class. Method signatures and docstrings: - def __init__(self, selected_df, alldf=None, expname=None): Takes a tecan dataframe, makes a copy and adds fields needed for activity calculations (inc baseline subt...
Implement the Python class `CAZyExperiment2` described below. Class description: Implement the CAZyExperiment2 class. Method signatures and docstrings: - def __init__(self, selected_df, alldf=None, expname=None): Takes a tecan dataframe, makes a copy and adds fields needed for activity calculations (inc baseline subt...
458822d7f5221e04387bd53d6539d290b7e1630a
<|skeleton|> class CAZyExperiment2: def __init__(self, selected_df, alldf=None, expname=None): """Takes a tecan dataframe, makes a copy and adds fields needed for activity calculations (inc baseline subtractions) Arguments: selected_df: the dataframe Kewyord arguments: alldf: the dataframe with all activit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CAZyExperiment2: def __init__(self, selected_df, alldf=None, expname=None): """Takes a tecan dataframe, makes a copy and adds fields needed for activity calculations (inc baseline subtractions) Arguments: selected_df: the dataframe Kewyord arguments: alldf: the dataframe with all activities (default N...
the_stack_v2_python_sparse
tecanpack/tecandata.py
KirkVM/kdatapack
train
0
5f220c2a6892aa83215adf735ece983c76aff2ca
[ "self.text = text\nself.token_counts = FreqDist(normalized_tokens(text))\nself.id = id", "with open(filename, 'r') as myfile:\n text = myfile.read()\n while not text[0].isalpha():\n text = text[1:]\n while not text[-1].isalpha():\n text = text[:-1]\nreturn cls(text, filename)" ]
<|body_start_0|> self.text = text self.token_counts = FreqDist(normalized_tokens(text)) self.id = id <|end_body_0|> <|body_start_1|> with open(filename, 'r') as myfile: text = myfile.read() while not text[0].isalpha(): text = text[1:] ...
TextDocument
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextDocument: def __init__(self, text, id=None): """creates a TextDocument object with variables text, doc id and a frequency list""" <|body_0|> def from_file(cls, filename): """returns a TextDocument object with text read from the file(filename) and filename as the ...
stack_v2_sparse_classes_36k_train_027081
6,224
no_license
[ { "docstring": "creates a TextDocument object with variables text, doc id and a frequency list", "name": "__init__", "signature": "def __init__(self, text, id=None)" }, { "docstring": "returns a TextDocument object with text read from the file(filename) and filename as the doc id", "name": "...
2
stack_v2_sparse_classes_30k_train_009521
Implement the Python class `TextDocument` described below. Class description: Implement the TextDocument class. Method signatures and docstrings: - def __init__(self, text, id=None): creates a TextDocument object with variables text, doc id and a frequency list - def from_file(cls, filename): returns a TextDocument o...
Implement the Python class `TextDocument` described below. Class description: Implement the TextDocument class. Method signatures and docstrings: - def __init__(self, text, id=None): creates a TextDocument object with variables text, doc id and a frequency list - def from_file(cls, filename): returns a TextDocument o...
12f9f50b10771ec95e47e05f03dbe532e8f491d1
<|skeleton|> class TextDocument: def __init__(self, text, id=None): """creates a TextDocument object with variables text, doc id and a frequency list""" <|body_0|> def from_file(cls, filename): """returns a TextDocument object with text read from the file(filename) and filename as the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextDocument: def __init__(self, text, id=None): """creates a TextDocument object with variables text, doc id and a frequency list""" self.text = text self.token_counts = FreqDist(normalized_tokens(text)) self.id = id def from_file(cls, filename): """returns a Text...
the_stack_v2_python_sparse
hw4/Haotian/text_vectors.py
MingfeyZui/Smpro_Private
train
0
e69ee0076d8e34d16b10a37cdc5439f415cf0365
[ "self.num_points = num_points\nself.x_values = [0]\nself.y_values = [0]", "while len(self.x_values) < self.num_points:\n x_direction = choice([1, -1])\n x_distance = choice([0, 1, 2, 3, 4])\n x_step = x_direction * x_distance\n y_direction = choice([1, -1])\n y_distance = choice([0, 1, 2, 3, 4])\n ...
<|body_start_0|> self.num_points = num_points self.x_values = [0] self.y_values = [0] <|end_body_0|> <|body_start_1|> while len(self.x_values) < self.num_points: x_direction = choice([1, -1]) x_distance = choice([0, 1, 2, 3, 4]) x_step = x_direction *...
一个生成随机漫步数据的类
RandomWalk
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属行""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.num_points = num_points self.x_values = [0] ...
stack_v2_sparse_classes_36k_train_027082
9,654
permissive
[ { "docstring": "初始化随机漫步的属行", "name": "__init__", "signature": "def __init__(self, num_points=5000)" }, { "docstring": "计算随机漫步包含的所有点", "name": "fill_walk", "signature": "def fill_walk(self)" } ]
2
stack_v2_sparse_classes_30k_train_004666
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属行 - def fill_walk(self): 计算随机漫步包含的所有点
Implement the Python class `RandomWalk` described below. Class description: 一个生成随机漫步数据的类 Method signatures and docstrings: - def __init__(self, num_points=5000): 初始化随机漫步的属行 - def fill_walk(self): 计算随机漫步包含的所有点 <|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初...
3d3d32b5ad0affef76287b89bc87267fc551127d
<|skeleton|> class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属行""" <|body_0|> def fill_walk(self): """计算随机漫步包含的所有点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomWalk: """一个生成随机漫步数据的类""" def __init__(self, num_points=5000): """初始化随机漫步的属行""" self.num_points = num_points self.x_values = [0] self.y_values = [0] def fill_walk(self): """计算随机漫步包含的所有点""" while len(self.x_values) < self.num_points: x_...
the_stack_v2_python_sparse
python(第二次)/matplotlib/mpl_squares.py
AnatoleZho/Python3
train
0
d41799b35bc7373003cb120be4cad050abdb419f
[ "NTASKS = 30\nwith cls.lock:\n games = cls.redis._bulk_rpop(GAME_QUEUE, NTASKS)\n new_games = [g for g, is_old in cls.redis._intersect(GAME_SET, games) if not is_old]\n users = cls.redis._bulk_rpop(USER_QUEUE, NTASKS - len(new_games))\n if users:\n cls.redis.lpush(USER_QUEUE, *users)\n return ...
<|body_start_0|> NTASKS = 30 with cls.lock: games = cls.redis._bulk_rpop(GAME_QUEUE, NTASKS) new_games = [g for g, is_old in cls.redis._intersect(GAME_SET, games) if not is_old] users = cls.redis._bulk_rpop(USER_QUEUE, NTASKS - len(new_games)) if users: ...
Tasks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tasks: def get(cls): """Return a list of games and users to scrape""" <|body_0|> def add(cls, games, users): """Stack some new game IDs and user IDs onto Redis and store the number of games processed""" <|body_1|> def rollback(cls, games, users): ...
stack_v2_sparse_classes_36k_train_027083
9,165
no_license
[ { "docstring": "Return a list of games and users to scrape", "name": "get", "signature": "def get(cls)" }, { "docstring": "Stack some new game IDs and user IDs onto Redis and store the number of games processed", "name": "add", "signature": "def add(cls, games, users)" }, { "docs...
3
stack_v2_sparse_classes_30k_train_003774
Implement the Python class `Tasks` described below. Class description: Implement the Tasks class. Method signatures and docstrings: - def get(cls): Return a list of games and users to scrape - def add(cls, games, users): Stack some new game IDs and user IDs onto Redis and store the number of games processed - def rol...
Implement the Python class `Tasks` described below. Class description: Implement the Tasks class. Method signatures and docstrings: - def get(cls): Return a list of games and users to scrape - def add(cls, games, users): Stack some new game IDs and user IDs onto Redis and store the number of games processed - def rol...
4ed4b1c96c03fa72a9a9055214d61d19a41882e6
<|skeleton|> class Tasks: def get(cls): """Return a list of games and users to scrape""" <|body_0|> def add(cls, games, users): """Stack some new game IDs and user IDs onto Redis and store the number of games processed""" <|body_1|> def rollback(cls, games, users): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tasks: def get(cls): """Return a list of games and users to scrape""" NTASKS = 30 with cls.lock: games = cls.redis._bulk_rpop(GAME_QUEUE, NTASKS) new_games = [g for g, is_old in cls.redis._intersect(GAME_SET, games) if not is_old] users = cls.redis._...
the_stack_v2_python_sparse
riotscrape.py
blagarde/riotscrape
train
0
16a2dfa90a40ed0cbc19009ead06250deb7e7af2
[ "super().__init__()\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(vocab)", "units = s_prev.shape[1]\nattention = SelfAttention(units)\ncontext, w...
<|body_start_0|> super().__init__() self.embedding = tf.keras.layers.Embedding(vocab, embedding) self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True) self.F = tf.keras.layers.Dense(vocab) <|end_body_0|> <|body_start_1|> ...
class RNNDecoder
RNNDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDecoder: """class RNNDecoder""" def __init__(self, vocab, embedding, units, batch): """Constructor Params: vocab: integer representing the size of the output vocabulary embedding:integer representing the dimensionality of the embedding vector units:number of hidden units in the RN...
stack_v2_sparse_classes_36k_train_027084
2,606
no_license
[ { "docstring": "Constructor Params: vocab: integer representing the size of the output vocabulary embedding:integer representing the dimensionality of the embedding vector units:number of hidden units in the RNN cell batch:integer representing the batch size Sets the following public instance attributes: embedd...
2
null
Implement the Python class `RNNDecoder` described below. Class description: class RNNDecoder Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Constructor Params: vocab: integer representing the size of the output vocabulary embedding:integer representing the dimensionality of th...
Implement the Python class `RNNDecoder` described below. Class description: class RNNDecoder Method signatures and docstrings: - def __init__(self, vocab, embedding, units, batch): Constructor Params: vocab: integer representing the size of the output vocabulary embedding:integer representing the dimensionality of th...
ff1af62484620b599cc3813068770db03b37036d
<|skeleton|> class RNNDecoder: """class RNNDecoder""" def __init__(self, vocab, embedding, units, batch): """Constructor Params: vocab: integer representing the size of the output vocabulary embedding:integer representing the dimensionality of the embedding vector units:number of hidden units in the RN...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNDecoder: """class RNNDecoder""" def __init__(self, vocab, embedding, units, batch): """Constructor Params: vocab: integer representing the size of the output vocabulary embedding:integer representing the dimensionality of the embedding vector units:number of hidden units in the RNN cell batch:...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/2-rnn_decoder.py
paurbano/holbertonschool-machine_learning
train
0
fbe11380c1ba7e5614a4db72115398764c77f7d5
[ "WC.OpenClipboard()\nvalue = WC.GetClipboardData(win32con.CF_TEXT)\nWC.CloseClipboard()\nreturn value", "WC.OpenClipboard()\nWC.EmptyClipboard()\nWC.SetClipboardData(win32con.CF_UNICODETEXT, value)\nWC.CloseClipboard()" ]
<|body_start_0|> WC.OpenClipboard() value = WC.GetClipboardData(win32con.CF_TEXT) WC.CloseClipboard() return value <|end_body_0|> <|body_start_1|> WC.OpenClipboard() WC.EmptyClipboard() WC.SetClipboardData(win32con.CF_UNICODETEXT, value) WC.CloseClipboard...
设置剪切板内容和获取剪切板内容
ClipBoard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClipBoard: """设置剪切板内容和获取剪切板内容""" def getText(): """获取剪切板的内容""" <|body_0|> def setText(value): """设置剪切板的内容""" <|body_1|> <|end_skeleton|> <|body_start_0|> WC.OpenClipboard() value = WC.GetClipboardData(win32con.CF_TEXT) WC.CloseCl...
stack_v2_sparse_classes_36k_train_027085
1,115
no_license
[ { "docstring": "获取剪切板的内容", "name": "getText", "signature": "def getText()" }, { "docstring": "设置剪切板的内容", "name": "setText", "signature": "def setText(value)" } ]
2
stack_v2_sparse_classes_30k_train_000983
Implement the Python class `ClipBoard` described below. Class description: 设置剪切板内容和获取剪切板内容 Method signatures and docstrings: - def getText(): 获取剪切板的内容 - def setText(value): 设置剪切板的内容
Implement the Python class `ClipBoard` described below. Class description: 设置剪切板内容和获取剪切板内容 Method signatures and docstrings: - def getText(): 获取剪切板的内容 - def setText(value): 设置剪切板的内容 <|skeleton|> class ClipBoard: """设置剪切板内容和获取剪切板内容""" def getText(): """获取剪切板的内容""" <|body_0|> def setText(...
3028486f45695cc41761afdd7f890b5d4def72d8
<|skeleton|> class ClipBoard: """设置剪切板内容和获取剪切板内容""" def getText(): """获取剪切板的内容""" <|body_0|> def setText(value): """设置剪切板的内容""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClipBoard: """设置剪切板内容和获取剪切板内容""" def getText(): """获取剪切板的内容""" WC.OpenClipboard() value = WC.GetClipboardData(win32con.CF_TEXT) WC.CloseClipboard() return value def setText(value): """设置剪切板的内容""" WC.OpenClipboard() WC.EmptyClipboard() ...
the_stack_v2_python_sparse
util/clipboard.py
saraliuhou/PytestAutoTestFrameWork
train
1
881c55f489aba19f8be3a747b2017e60f5543df5
[ "if not isinstance(requires_filters, dict):\n requires_filters = {}\nif not isinstance(temporal_timeouts, dict):\n temporal_timeouts = {}\nif not requires_filters and (not temporal_timeouts):\n return configs\nnew_configs = {}\nfor field, config in configs.items():\n requirement, timeout = config\n e...
<|body_start_0|> if not isinstance(requires_filters, dict): requires_filters = {} if not isinstance(temporal_timeouts, dict): temporal_timeouts = {} if not requires_filters and (not temporal_timeouts): return configs new_configs = {} for field,...
Factory service for service registration handlers
_HandlerFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _HandlerFactory: """Factory service for service registration handlers""" def _prepare_configs(configs, requires_filters, temporal_timeouts): """Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :para...
stack_v2_sparse_classes_36k_train_027086
11,500
permissive
[ { "docstring": "Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_filters: Content of the 'requires.filter' component property (field → string) :param temporal_timeouts: Content of the 'temporal.timeouts' compon...
2
stack_v2_sparse_classes_30k_train_011727
Implement the Python class `_HandlerFactory` described below. Class description: Factory service for service registration handlers Method signatures and docstrings: - def _prepare_configs(configs, requires_filters, temporal_timeouts): Overrides the filters specified in the decorator with the given ones :param configs...
Implement the Python class `_HandlerFactory` described below. Class description: Factory service for service registration handlers Method signatures and docstrings: - def _prepare_configs(configs, requires_filters, temporal_timeouts): Overrides the filters specified in the decorator with the given ones :param configs...
1d0add361ca219da8fdf72bb9ba8cb0ade01ad2f
<|skeleton|> class _HandlerFactory: """Factory service for service registration handlers""" def _prepare_configs(configs, requires_filters, temporal_timeouts): """Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _HandlerFactory: """Factory service for service registration handlers""" def _prepare_configs(configs, requires_filters, temporal_timeouts): """Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_fi...
the_stack_v2_python_sparse
pelix/ipopo/handlers/temporal.py
tcalmant/ipopo
train
67
5d5b6af451342ee167eadfd89e9e23079211da7d
[ "self.assertDirectoryContents(['produce.ini', 'Makefile'])\nwith self.assertLogs(logger='produce', level='INFO') as l:\n self.produce('a.txt', 'b.txt', **{'-j': '3'})\nself.assertEqual(len(l.output), 4)\nself.assertDirectoryContents(['produce.ini', 'Makefile', 'a.txt', 'b.txt'])", "self.assertDirectoryContents...
<|body_start_0|> self.assertDirectoryContents(['produce.ini', 'Makefile']) with self.assertLogs(logger='produce', level='INFO') as l: self.produce('a.txt', 'b.txt', **{'-j': '3'}) self.assertEqual(len(l.output), 4) self.assertDirectoryContents(['produce.ini', 'Makefile', 'a.t...
Tests the handling of recipes with multiple outputs.
MultipleOutputsTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultipleOutputsTest: """Tests the handling of recipes with multiple outputs.""" def test_without(self): """Without the outputs attribute, the recipe is run twice, once for each target, thus two INFO messages are generated:""" <|body_0|> def test_with(self): """Wi...
stack_v2_sparse_classes_36k_train_027087
1,966
permissive
[ { "docstring": "Without the outputs attribute, the recipe is run twice, once for each target, thus two INFO messages are generated:", "name": "test_without", "signature": "def test_without(self)" }, { "docstring": "With the outputs attribute, the recipe is run only once:", "name": "test_with...
4
stack_v2_sparse_classes_30k_train_002416
Implement the Python class `MultipleOutputsTest` described below. Class description: Tests the handling of recipes with multiple outputs. Method signatures and docstrings: - def test_without(self): Without the outputs attribute, the recipe is run twice, once for each target, thus two INFO messages are generated: - de...
Implement the Python class `MultipleOutputsTest` described below. Class description: Tests the handling of recipes with multiple outputs. Method signatures and docstrings: - def test_without(self): Without the outputs attribute, the recipe is run twice, once for each target, thus two INFO messages are generated: - de...
fe4116d063b8820877b9f589e40cae29721511bf
<|skeleton|> class MultipleOutputsTest: """Tests the handling of recipes with multiple outputs.""" def test_without(self): """Without the outputs attribute, the recipe is run twice, once for each target, thus two INFO messages are generated:""" <|body_0|> def test_with(self): """Wi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultipleOutputsTest: """Tests the handling of recipes with multiple outputs.""" def test_without(self): """Without the outputs attribute, the recipe is run twice, once for each target, thus two INFO messages are generated:""" self.assertDirectoryContents(['produce.ini', 'Makefile']) ...
the_stack_v2_python_sparse
t/test_multiple_outputs.py
texttheater/produce
train
14
78ca57b0cd4b5e98763cc8cb9d1a436220c8082f
[ "if isinstance(infr_type, Infraction):\n return infr_type\nreturn Infraction[infr_type.replace(' ', '_').upper()]", "if self.infraction_type == Infraction.NONE and (ctx.dm_content or ctx.dm_embed):\n dm_content = ctx.dm_content\n dm_embed = ctx.dm_embed\nelse:\n dm_content = self.dm_content\n dm_em...
<|body_start_0|> if isinstance(infr_type, Infraction): return infr_type return Infraction[infr_type.replace(' ', '_').upper()] <|end_body_0|> <|body_start_1|> if self.infraction_type == Infraction.NONE and (ctx.dm_content or ctx.dm_embed): dm_content = ctx.dm_content ...
A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.
InfractionAndNotification
[ "MIT", "BSD-3-Clause", "Python-2.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfractionAndNotification: """A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.""" def convert_infraction_name(cls, infr_type: str | Infract...
stack_v2_sparse_classes_36k_train_027088
10,642
permissive
[ { "docstring": "Convert the string to an Infraction by name.", "name": "convert_infraction_name", "signature": "def convert_infraction_name(cls, infr_type: str | Infraction) -> Infraction" }, { "docstring": "Send the notification to the user.", "name": "send_message", "signature": "async...
4
stack_v2_sparse_classes_30k_train_000324
Implement the Python class `InfractionAndNotification` described below. Class description: A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together. Method signatures and doc...
Implement the Python class `InfractionAndNotification` described below. Class description: A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together. Method signatures and doc...
f2048684291cc6358565e96ef3562512fbeb2505
<|skeleton|> class InfractionAndNotification: """A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.""" def convert_infraction_name(cls, infr_type: str | Infract...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InfractionAndNotification: """A setting entry which specifies what infraction to issue and the notification to DM the user. Since a DM cannot be sent when a user is banned or kicked, these two functions need to be grouped together.""" def convert_infraction_name(cls, infr_type: str | Infraction) -> Infra...
the_stack_v2_python_sparse
bot/exts/filtering/_settings_types/actions/infraction_and_notification.py
python-discord/bot
train
1,479
37a8abc1fd6061a420eb48fc9df373716b2cb311
[ "self.db_engine = db_engine\nself.logger = logger.sub_logger(self.__class__.__name__)\nself.tick_dao = TickDataDao(db_engine, self.logger)", "try:\n factor_count = pd.read_sql('\\n SELECT count(1) as factor_count FROM \"{0}\".\"{1}\"\\n WHERE sub_factor_name=\\'{2}\\'\\n ...
<|body_start_0|> self.db_engine = db_engine self.logger = logger.sub_logger(self.__class__.__name__) self.tick_dao = TickDataDao(db_engine, self.logger) <|end_body_0|> <|body_start_1|> try: factor_count = pd.read_sql('\n SELECT count(1) as factor_count FROM "{...
FactorStatusDao
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FactorStatusDao: def __init__(self, db_engine, logger): """:param db_engine: a sqlalchemy database engine :param logger:""" <|body_0|> def __is_factor_exists_as_sub_factor(self, factor, conn): """Check weather factor exists as a sub factor :param factor: :return: err...
stack_v2_sparse_classes_36k_train_027089
4,383
permissive
[ { "docstring": ":param db_engine: a sqlalchemy database engine :param logger:", "name": "__init__", "signature": "def __init__(self, db_engine, logger)" }, { "docstring": "Check weather factor exists as a sub factor :param factor: :return: err_code, True if factor is a sub factor else False", ...
5
null
Implement the Python class `FactorStatusDao` described below. Class description: Implement the FactorStatusDao class. Method signatures and docstrings: - def __init__(self, db_engine, logger): :param db_engine: a sqlalchemy database engine :param logger: - def __is_factor_exists_as_sub_factor(self, factor, conn): Che...
Implement the Python class `FactorStatusDao` described below. Class description: Implement the FactorStatusDao class. Method signatures and docstrings: - def __init__(self, db_engine, logger): :param db_engine: a sqlalchemy database engine :param logger: - def __is_factor_exists_as_sub_factor(self, factor, conn): Che...
c4711c0691aed89b8f38ba47faabbfa40b18c74f
<|skeleton|> class FactorStatusDao: def __init__(self, db_engine, logger): """:param db_engine: a sqlalchemy database engine :param logger:""" <|body_0|> def __is_factor_exists_as_sub_factor(self, factor, conn): """Check weather factor exists as a sub factor :param factor: :return: err...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FactorStatusDao: def __init__(self, db_engine, logger): """:param db_engine: a sqlalchemy database engine :param logger:""" self.db_engine = db_engine self.logger = logger.sub_logger(self.__class__.__name__) self.tick_dao = TickDataDao(db_engine, self.logger) def __is_fact...
the_stack_v2_python_sparse
FactorKeeper/Core/DAO/FactorDao/FactorStatusDao.py
JayceSYH/FactorKeeper
train
0
5c4a99d14f7f70f4f3b18bd3de95055468f7c09e
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.deviceAndAppManagementRoleAssignment'.casef...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
The Role Assignment resource. Role assignments tie together a role definition with members and scopes. There can be one or more role assignments per role. This applies to custom and built-in roles.
RoleAssignment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleAssignment: """The Role Assignment resource. Role assignments tie together a role definition with members and scopes. There can be one or more role assignments per role. This applies to custom and built-in roles.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None...
stack_v2_sparse_classes_36k_train_027090
3,985
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: RoleAssignment", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
stack_v2_sparse_classes_30k_train_000220
Implement the Python class `RoleAssignment` described below. Class description: The Role Assignment resource. Role assignments tie together a role definition with members and scopes. There can be one or more role assignments per role. This applies to custom and built-in roles. Method signatures and docstrings: - def ...
Implement the Python class `RoleAssignment` described below. Class description: The Role Assignment resource. Role assignments tie together a role definition with members and scopes. There can be one or more role assignments per role. This applies to custom and built-in roles. Method signatures and docstrings: - def ...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class RoleAssignment: """The Role Assignment resource. Role assignments tie together a role definition with members and scopes. There can be one or more role assignments per role. This applies to custom and built-in roles.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoleAssignment: """The Role Assignment resource. Role assignments tie together a role definition with members and scopes. There can be one or more role assignments per role. This applies to custom and built-in roles.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RoleAssi...
the_stack_v2_python_sparse
msgraph/generated/models/role_assignment.py
microsoftgraph/msgraph-sdk-python
train
135
312d70f53ecf6b591bcd13b1f4bc2ca9edf4b5b6
[ "dict = {}\nfor i in range(len(nums)):\n if target - nums[i] in dict:\n return [dict[target - nums[i]], i]\n dict[nums[i]] = i", "a = 0\nb = len(nums) - 1\nwhile 1:\n if a > len(nums) or b < 0:\n return 'FAILED'\n if nums[a] + nums[b] == target:\n return [min(a, b), max(a, b)]\n ...
<|body_start_0|> dict = {} for i in range(len(nums)): if target - nums[i] in dict: return [dict[target - nums[i]], i] dict[nums[i]] = i <|end_body_0|> <|body_start_1|> a = 0 b = len(nums) - 1 while 1: if a > len(nums) or b < 0:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """nums是输入的数组,target是所求的和 这里的算法核心思想是:对于nums进行一次扫描,我们这里建了一个dict,扫描到数nums[i]时,如果target-nums[i]在dict里,就达到 了我们的目的,如果没有,就把nums[i]放入dict中。 ratio: 86.33% :param nums: :param target: :return:""" <|body_0|> def twoFlag(self, nums, target): ...
stack_v2_sparse_classes_36k_train_027091
1,343
no_license
[ { "docstring": "nums是输入的数组,target是所求的和 这里的算法核心思想是:对于nums进行一次扫描,我们这里建了一个dict,扫描到数nums[i]时,如果target-nums[i]在dict里,就达到 了我们的目的,如果没有,就把nums[i]放入dict中。 ratio: 86.33% :param nums: :param target: :return:", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": "两个指针扫描数组,要求数组为...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): nums是输入的数组,target是所求的和 这里的算法核心思想是:对于nums进行一次扫描,我们这里建了一个dict,扫描到数nums[i]时,如果target-nums[i]在dict里,就达到 了我们的目的,如果没有,就把nums[i]放入dict中。 ratio: 86.33% :p...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): nums是输入的数组,target是所求的和 这里的算法核心思想是:对于nums进行一次扫描,我们这里建了一个dict,扫描到数nums[i]时,如果target-nums[i]在dict里,就达到 了我们的目的,如果没有,就把nums[i]放入dict中。 ratio: 86.33% :p...
0fddcc61923d760faa5fc60311861cbe89a54ba9
<|skeleton|> class Solution: def twoSum(self, nums, target): """nums是输入的数组,target是所求的和 这里的算法核心思想是:对于nums进行一次扫描,我们这里建了一个dict,扫描到数nums[i]时,如果target-nums[i]在dict里,就达到 了我们的目的,如果没有,就把nums[i]放入dict中。 ratio: 86.33% :param nums: :param target: :return:""" <|body_0|> def twoFlag(self, nums, target): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """nums是输入的数组,target是所求的和 这里的算法核心思想是:对于nums进行一次扫描,我们这里建了一个dict,扫描到数nums[i]时,如果target-nums[i]在dict里,就达到 了我们的目的,如果没有,就把nums[i]放入dict中。 ratio: 86.33% :param nums: :param target: :return:""" dict = {} for i in range(len(nums)): if targe...
the_stack_v2_python_sparse
1.py
zenmeder/leetcode
train
0
a68b9565a97edec62497eafc94f3d89a1e5616cc
[ "Part = self.old_state.apps.get_model('part', 'part')\nCompany = self.old_state.apps.get_model('company', 'company')\nSupplierPart = self.old_state.apps.get_model('company', 'supplierpart')\npart = Part.objects.create(name='Screw', description='A single screw', level=0, tree_id=0, lft=0, rght=0)\nsupplier = Company...
<|body_start_0|> Part = self.old_state.apps.get_model('part', 'part') Company = self.old_state.apps.get_model('company', 'company') SupplierPart = self.old_state.apps.get_model('company', 'supplierpart') part = Part.objects.create(name='Screw', description='A single screw', level=0, tree...
Tests for migration 0019 which migrates from old 'manufacturer_name' field to new 'manufacturer' field.
TestManufacturerField
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestManufacturerField: """Tests for migration 0019 which migrates from old 'manufacturer_name' field to new 'manufacturer' field.""" def prepare(self): """Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart objec...
stack_v2_sparse_classes_36k_train_027092
12,626
permissive
[ { "docstring": "Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart object", "name": "prepare", "signature": "def prepare(self)" }, { "docstring": "Test that the new companies have been created successfully.", "name": "t...
2
null
Implement the Python class `TestManufacturerField` described below. Class description: Tests for migration 0019 which migrates from old 'manufacturer_name' field to new 'manufacturer' field. Method signatures and docstrings: - def prepare(self): Prepare the database by adding some test data 'before' the change: - Par...
Implement the Python class `TestManufacturerField` described below. Class description: Tests for migration 0019 which migrates from old 'manufacturer_name' field to new 'manufacturer' field. Method signatures and docstrings: - def prepare(self): Prepare the database by adding some test data 'before' the change: - Par...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class TestManufacturerField: """Tests for migration 0019 which migrates from old 'manufacturer_name' field to new 'manufacturer' field.""" def prepare(self): """Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart objec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestManufacturerField: """Tests for migration 0019 which migrates from old 'manufacturer_name' field to new 'manufacturer' field.""" def prepare(self): """Prepare the database by adding some test data 'before' the change: - Part object - Company object (supplier) - SupplierPart object""" ...
the_stack_v2_python_sparse
InvenTree/company/test_migrations.py
inventree/InvenTree
train
3,077
fdff787985bdf84b5b17729700ebc1ea950800c2
[ "ps = np.radians(pos.Rx) * self.Ly * 2\npd = np.radians(pos.Ry) * self.Lx\nreturn self.RealPosition(kz1=(ps + pd) / 2, kz2=(ps - pd) / 2, x=self.x.position, y=self.y.position)", "pRx = np.degrees((pos.kz1 - pos.kz2) / self.Lx)\npRy = np.degrees(0.5 * (pos.kz1 + pos.kz2) / self.Ly)\nreturn self.PseudoPosition(Rx=p...
<|body_start_0|> ps = np.radians(pos.Rx) * self.Ly * 2 pd = np.radians(pos.Ry) * self.Lx return self.RealPosition(kz1=(ps + pd) / 2, kz2=(ps - pd) / 2, x=self.x.position, y=self.y.position) <|end_body_0|> <|body_start_1|> pRx = np.degrees((pos.kz1 - pos.kz2) / self.Lx) pRy = np....
Microscope
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Microscope: def forward(self, pos): """pos is a self.PseudoPosition""" <|body_0|> def inverse(self, pos): """pos is self.RealPosition""" <|body_1|> <|end_skeleton|> <|body_start_0|> ps = np.radians(pos.Rx) * self.Ly * 2 pd = np.radians(pos.R...
stack_v2_sparse_classes_36k_train_027093
6,214
no_license
[ { "docstring": "pos is a self.PseudoPosition", "name": "forward", "signature": "def forward(self, pos)" }, { "docstring": "pos is self.RealPosition", "name": "inverse", "signature": "def inverse(self, pos)" } ]
2
stack_v2_sparse_classes_30k_train_013117
Implement the Python class `Microscope` described below. Class description: Implement the Microscope class. Method signatures and docstrings: - def forward(self, pos): pos is a self.PseudoPosition - def inverse(self, pos): pos is self.RealPosition
Implement the Python class `Microscope` described below. Class description: Implement the Microscope class. Method signatures and docstrings: - def forward(self, pos): pos is a self.PseudoPosition - def inverse(self, pos): pos is self.RealPosition <|skeleton|> class Microscope: def forward(self, pos): "...
086ccd69887b26cd121d63e4603cba8f28e43c64
<|skeleton|> class Microscope: def forward(self, pos): """pos is a self.PseudoPosition""" <|body_0|> def inverse(self, pos): """pos is self.RealPosition""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Microscope: def forward(self, pos): """pos is a self.PseudoPosition""" ps = np.radians(pos.Rx) * self.Ly * 2 pd = np.radians(pos.Ry) * self.Lx return self.RealPosition(kz1=(ps + pd) / 2, kz2=(ps - pd) / 2, x=self.x.position, y=self.y.position) def inverse(self, pos): ...
the_stack_v2_python_sparse
startup/10-motors.py
MikeHart85/LIX_profile_collection
train
0
8ed236b3786393e0614b3e3b51ebed760f928cfb
[ "self._model = dict()\nself._ngram = 1\nself._epsilon = sppasPerplexity.DEFAULT_EPSILON\nself.set_model(model)\nself.set_ngram(ngram)", "eps = float(eps)\nif eps < 0.0 or eps > 0.1:\n raise InsideIntervalError(eps, 0.0, 0.1)\nif self._model is not None:\n p_min = round(min((proba for proba in self._model.va...
<|body_start_0|> self._model = dict() self._ngram = 1 self._epsilon = sppasPerplexity.DEFAULT_EPSILON self.set_model(model) self.set_ngram(ngram) <|end_body_0|> <|body_start_1|> eps = float(eps) if eps < 0.0 or eps > 0.1: raise InsideIntervalError(eps...
Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution or probability model predicts a sample. Th...
sppasPerplexity
[ "MIT", "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasPerplexity: """Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution...
stack_v2_sparse_classes_36k_train_027094
6,620
permissive
[ { "docstring": "Create a Perplexity instance with a list of symbols. :param model: (dict) a dictionary with key=item, value=probability :param ngram: (int) the n value, in the range 1..8", "name": "__init__", "signature": "def __init__(self, model, ngram=1)" }, { "docstring": "Set a value for ep...
5
stack_v2_sparse_classes_30k_train_006727
Implement the Python class `sppasPerplexity` described below. Class description: Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement...
Implement the Python class `sppasPerplexity` described below. Class description: Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasPerplexity: """Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sppasPerplexity: """Perplexity estimator. :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi Perplexity is a measurement of how well a probability distribution or probabili...
the_stack_v2_python_sparse
sppas/sppas/src/calculus/infotheory/perplexity.py
mirfan899/MTTS
train
0
97f7abfcd6b16daa7fc082c01160cc04e44160fe
[ "ret = m\ndiff = n - m\ni = 0\nlast = 0\nx = 1\nwhile m != 0:\n if m % 2 == 1:\n last += x\n if x * 2 - last <= diff:\n ret -= x\n m >>= 1\n i += 1\n x *= 2\nreturn ret", "ret = m\nbuff = bin(ret)[-1::-1][:-2]\ni = 0\nlast = 0\nwhile i < len(buff):\n if buff[i] == '1':\n ...
<|body_start_0|> ret = m diff = n - m i = 0 last = 0 x = 1 while m != 0: if m % 2 == 1: last += x if x * 2 - last <= diff: ret -= x m >>= 1 i += 1 x *= 2 return ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = m diff = n - m...
stack_v2_sparse_classes_36k_train_027095
1,182
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd", "signature": "def rangeBitwiseAnd(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "rangeBitwiseAnd1", "signature": "def rangeBitwiseAnd1(self, m, n)" } ]
2
stack_v2_sparse_classes_30k_train_012317
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd1(self, m, n): :type m: int :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeBitwiseAnd(self, m, n): :type m: int :type n: int :rtype: int - def rangeBitwiseAnd1(self, m, n): :type m: int :type n: int :rtype: int <|skeleton|> class Solution: ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def rangeBitwiseAnd1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rangeBitwiseAnd(self, m, n): """:type m: int :type n: int :rtype: int""" ret = m diff = n - m i = 0 last = 0 x = 1 while m != 0: if m % 2 == 1: last += x if x * 2 - last <= diff: ...
the_stack_v2_python_sparse
python/leetcode/201_Bitwise_AND_of_Numbers_Range.py
bobcaoge/my-code
train
0
140f25c45243835ea346ef2d10da6fd36f2b3e45
[ "if user.is_anonymous:\n return False\nreturn SurveyAnswer.objects.filter(form=form, user=user).exists()", "if user:\n answers = SurveyAnswer.objects.filter(form=form, user=user)\nelse:\n answers = SurveyAnswer.objects.filter(form=form)\nresults = OrderedDict()\nnum_users = 0\nfor answer in answers:\n ...
<|body_start_0|> if user.is_anonymous: return False return SurveyAnswer.objects.filter(form=form, user=user).exists() <|end_body_0|> <|body_start_1|> if user: answers = SurveyAnswer.objects.filter(form=form, user=user) else: answers = SurveyAnswer.obj...
Model for the answers that a user gives for a particular form in a course .. pii: These are free-form questions asked by course authors. Types below are current as of Feb 2019, new ones could be added. "other" PII currently includes "company", "job title", and "work experience". .. pii_types: name, location, other .. p...
SurveyAnswer
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurveyAnswer: """Model for the answers that a user gives for a particular form in a course .. pii: These are free-form questions asked by course authors. Types below are current as of Feb 2019, new ones could be added. "other" PII currently includes "company", "job title", and "work experience". ...
stack_v2_sparse_classes_36k_train_027096
9,751
permissive
[ { "docstring": "Returns whether a user has any answers for a given SurveyForm for a course This can be used to determine if a user has taken a CourseSurvey.", "name": "do_survey_answers_exist", "signature": "def do_survey_answers_exist(cls, form, user)" }, { "docstring": "Returns all answers a u...
4
null
Implement the Python class `SurveyAnswer` described below. Class description: Model for the answers that a user gives for a particular form in a course .. pii: These are free-form questions asked by course authors. Types below are current as of Feb 2019, new ones could be added. "other" PII currently includes "company...
Implement the Python class `SurveyAnswer` described below. Class description: Model for the answers that a user gives for a particular form in a course .. pii: These are free-form questions asked by course authors. Types below are current as of Feb 2019, new ones could be added. "other" PII currently includes "company...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class SurveyAnswer: """Model for the answers that a user gives for a particular form in a course .. pii: These are free-form questions asked by course authors. Types below are current as of Feb 2019, new ones could be added. "other" PII currently includes "company", "job title", and "work experience". ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurveyAnswer: """Model for the answers that a user gives for a particular form in a course .. pii: These are free-form questions asked by course authors. Types below are current as of Feb 2019, new ones could be added. "other" PII currently includes "company", "job title", and "work experience". .. pii_types:...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/survey/models.py
luque/better-ways-of-thinking-about-software
train
3
517a66bfbe58b7bb86b7c03e9c1ed6a65815a7d0
[ "self.verbose = bool(verbose)\nif special is None:\n special = {'PetscOptionsBegin', 'PetscObjectOptionsBegin', 'PetscOptionsEnd', 'MatPreallocateInitialize', 'MatPreallocateFinalize', 'PetscDrawCollectiveBegin', 'PetscDrawCollectiveEnd'}\nself.special = special\nreturn", "if any(map(match.group(0).__contains_...
<|body_start_0|> self.verbose = bool(verbose) if special is None: special = {'PetscOptionsBegin', 'PetscObjectOptionsBegin', 'PetscOptionsEnd', 'MatPreallocateInitialize', 'MatPreallocateFinalize', 'PetscDrawCollectiveBegin', 'PetscDrawCollectiveEnd'} self.special = special r...
Replace
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Replace: def __init__(self, verbose, special=None): """verbose: (bool) verbosity level special: (set-like of strings) list of functions/symbols that will remain untouched""" <|body_0|> def __call__(self, match): """match: a match object from re.match containing 2 or ...
stack_v2_sparse_classes_36k_train_027097
11,101
permissive
[ { "docstring": "verbose: (bool) verbosity level special: (set-like of strings) list of functions/symbols that will remain untouched", "name": "__init__", "signature": "def __init__(self, verbose, special=None)" }, { "docstring": "match: a match object from re.match containing 2 or 3 groups", ...
2
null
Implement the Python class `Replace` described below. Class description: Implement the Replace class. Method signatures and docstrings: - def __init__(self, verbose, special=None): verbose: (bool) verbosity level special: (set-like of strings) list of functions/symbols that will remain untouched - def __call__(self, ...
Implement the Python class `Replace` described below. Class description: Implement the Replace class. Method signatures and docstrings: - def __init__(self, verbose, special=None): verbose: (bool) verbosity level special: (set-like of strings) list of functions/symbols that will remain untouched - def __call__(self, ...
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
<|skeleton|> class Replace: def __init__(self, verbose, special=None): """verbose: (bool) verbosity level special: (set-like of strings) list of functions/symbols that will remain untouched""" <|body_0|> def __call__(self, match): """match: a match object from re.match containing 2 or ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Replace: def __init__(self, verbose, special=None): """verbose: (bool) verbosity level special: (set-like of strings) list of functions/symbols that will remain untouched""" self.verbose = bool(verbose) if special is None: special = {'PetscOptionsBegin', 'PetscObjectOptions...
the_stack_v2_python_sparse
share/petsc/chkerrconvert.py
petsc/petsc
train
341
efe6adf707770e8c0724c69fc96c7c4b1ff96e4c
[ "self.buffers.restart = False\nself.buffers.max_restart_reached = False\nreturn None", "if S.status.first:\n self.buffers.max_restart_reached = S.status.restarts_in_a_row >= self.params.max_restarts\n if self.buffers.max_restart_reached and S.status.restart:\n if self.params.crash_after_max_restarts:...
<|body_start_0|> self.buffers.restart = False self.buffers.max_restart_reached = False return None <|end_body_0|> <|body_start_1|> if S.status.first: self.buffers.max_restart_reached = S.status.restarts_in_a_row >= self.params.max_restarts if self.buffers.max_res...
Non-MPI specific version of basic restarting
BasicRestartingNonMPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicRestartingNonMPI: """Non-MPI specific version of basic restarting""" def reset_buffers_nonMPI(self, controller, **kwargs): """Reset all variables with are used to simulate communication here Args: controller (pySDC.Controller): The controller Returns: None""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_027098
12,854
permissive
[ { "docstring": "Reset all variables with are used to simulate communication here Args: controller (pySDC.Controller): The controller Returns: None", "name": "reset_buffers_nonMPI", "signature": "def reset_buffers_nonMPI(self, controller, **kwargs)" }, { "docstring": "Restart all steps after the ...
3
null
Implement the Python class `BasicRestartingNonMPI` described below. Class description: Non-MPI specific version of basic restarting Method signatures and docstrings: - def reset_buffers_nonMPI(self, controller, **kwargs): Reset all variables with are used to simulate communication here Args: controller (pySDC.Control...
Implement the Python class `BasicRestartingNonMPI` described below. Class description: Non-MPI specific version of basic restarting Method signatures and docstrings: - def reset_buffers_nonMPI(self, controller, **kwargs): Reset all variables with are used to simulate communication here Args: controller (pySDC.Control...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class BasicRestartingNonMPI: """Non-MPI specific version of basic restarting""" def reset_buffers_nonMPI(self, controller, **kwargs): """Reset all variables with are used to simulate communication here Args: controller (pySDC.Controller): The controller Returns: None""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicRestartingNonMPI: """Non-MPI specific version of basic restarting""" def reset_buffers_nonMPI(self, controller, **kwargs): """Reset all variables with are used to simulate communication here Args: controller (pySDC.Controller): The controller Returns: None""" self.buffers.restart = F...
the_stack_v2_python_sparse
pySDC/implementations/convergence_controller_classes/basic_restarting.py
Parallel-in-Time/pySDC
train
30
8916bffadfc689aaf0bda96a4a5adfd85cb78d94
[ "orm.SliverDefaults.objects.filter(data_uri='').update(data_uri=None)\norm.SliverDefaults.objects.filter(data_sha256='').update(data_sha256=None)\norm.Sliver.objects.filter(data_uri__isnull='').update(data_uri=None)\norm.Sliver.objects.filter(data_sha256='').update(data_sha256=None)", "orm.SliverDefaults.objects....
<|body_start_0|> orm.SliverDefaults.objects.filter(data_uri='').update(data_uri=None) orm.SliverDefaults.objects.filter(data_sha256='').update(data_sha256=None) orm.Sliver.objects.filter(data_uri__isnull='').update(data_uri=None) orm.Sliver.objects.filter(data_sha256='').update(data_sha2...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Convert empty string to null.""" <|body_0|> def backwards(self, orm): """Convert null to empty string.""" <|body_1|> <|end_skeleton|> <|body_start_0|> orm.SliverDefaults.objects.filter(data_uri='').update(data_...
stack_v2_sparse_classes_36k_train_027099
10,962
no_license
[ { "docstring": "Convert empty string to null.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Convert null to empty string.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
null
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Convert empty string to null. - def backwards(self, orm): Convert null to empty string.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Convert empty string to null. - def backwards(self, orm): Convert null to empty string. <|skeleton|> class Migration: def forwards(self, orm): ...
dd798dc9bd3321b17007ff131e7b1288a2cd3c36
<|skeleton|> class Migration: def forwards(self, orm): """Convert empty string to null.""" <|body_0|> def backwards(self, orm): """Convert null to empty string.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Convert empty string to null.""" orm.SliverDefaults.objects.filter(data_uri='').update(data_uri=None) orm.SliverDefaults.objects.filter(data_sha256='').update(data_sha256=None) orm.Sliver.objects.filter(data_uri__isnull='').update(data_uri...
the_stack_v2_python_sparse
controller/apps/slices/migrations/0027_datamigration_b623_data_fields_empty_to_null.py
m00dy/vct-controller
train
2