blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
788870a4181be993f9ead321217801caec97fcf7
[ "try:\n return Holding.objects.get(pk=key)\nexcept Holding.DoesNotExist:\n raise Http404", "holding = self.get_object(pk)\nholding_serializer = HoldingSerializer(holding)\nh_data = holding_serializer.data\nh_data['price'] = decimal.Decimal(h_data['price'])\nh_data['shares'] = decimal.Decimal(h_data['shares'...
<|body_start_0|> try: return Holding.objects.get(pk=key) except Holding.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> holding = self.get_object(pk) holding_serializer = HoldingSerializer(holding) h_data = holding_serializer.data h_da...
Get, update, or delete an individual holding Attributes: permission_classes (list): A list of the accepted permissions for this view
HoldingDetail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HoldingDetail: """Get, update, or delete an individual holding Attributes: permission_classes (list): A list of the accepted permissions for this view""" def get_object(self, key): """Query for a specific entry from the Holding table Arguments: key (int): The primary key for the data...
stack_v2_sparse_classes_75kplus_train_069400
12,376
no_license
[ { "docstring": "Query for a specific entry from the Holding table Arguments: key (int): The primary key for the database record Returns: Holding: An instance of the Holding model class Raises: Http404: If the specified database record is not found", "name": "get_object", "signature": "def get_object(sel...
4
stack_v2_sparse_classes_30k_train_019443
Implement the Python class `HoldingDetail` described below. Class description: Get, update, or delete an individual holding Attributes: permission_classes (list): A list of the accepted permissions for this view Method signatures and docstrings: - def get_object(self, key): Query for a specific entry from the Holding...
Implement the Python class `HoldingDetail` described below. Class description: Get, update, or delete an individual holding Attributes: permission_classes (list): A list of the accepted permissions for this view Method signatures and docstrings: - def get_object(self, key): Query for a specific entry from the Holding...
d30666ff678e38513d83245ab6dfa8657baa09c5
<|skeleton|> class HoldingDetail: """Get, update, or delete an individual holding Attributes: permission_classes (list): A list of the accepted permissions for this view""" def get_object(self, key): """Query for a specific entry from the Holding table Arguments: key (int): The primary key for the data...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HoldingDetail: """Get, update, or delete an individual holding Attributes: permission_classes (list): A list of the accepted permissions for this view""" def get_object(self, key): """Query for a specific entry from the Holding table Arguments: key (int): The primary key for the database record R...
the_stack_v2_python_sparse
fiscal/planning_tool/views.py
CIS-Projects-in-CS-S21/pro-fiscal
train
0
ff9d362034fd385df9997f0b2742eecb56a2bc0a
[ "for row in response.css('.row-fluid.text-left'):\n for plant in row.css('.fixsearchsmall'):\n url = plant.css('a::attr(href)').extract_first()\n yield response.follow(url, callback=self.parse_plant_details)", "title = response.css('.page-title h1 .plant-name')\nfeatures = response.css('.fieldgro...
<|body_start_0|> for row in response.css('.row-fluid.text-left'): for plant in row.css('.fixsearchsmall'): url = plant.css('a::attr(href)').extract_first() yield response.follow(url, callback=self.parse_plant_details) <|end_body_0|> <|body_start_1|> title = r...
PerennialsComPlants
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerennialsComPlants: def parse_grid(self, response): """Parse cols and rows for grid of results.""" <|body_0|> def parse_plant_details(self, response): """Parse cols and rows for grid of results.""" <|body_1|> def pagination(self, response): """E...
stack_v2_sparse_classes_75kplus_train_069401
3,956
permissive
[ { "docstring": "Parse cols and rows for grid of results.", "name": "parse_grid", "signature": "def parse_grid(self, response)" }, { "docstring": "Parse cols and rows for grid of results.", "name": "parse_plant_details", "signature": "def parse_plant_details(self, response)" }, { ...
4
stack_v2_sparse_classes_30k_train_006202
Implement the Python class `PerennialsComPlants` described below. Class description: Implement the PerennialsComPlants class. Method signatures and docstrings: - def parse_grid(self, response): Parse cols and rows for grid of results. - def parse_plant_details(self, response): Parse cols and rows for grid of results....
Implement the Python class `PerennialsComPlants` described below. Class description: Implement the PerennialsComPlants class. Method signatures and docstrings: - def parse_grid(self, response): Parse cols and rows for grid of results. - def parse_plant_details(self, response): Parse cols and rows for grid of results....
8515fcc4c86ef0a96f34278d90419e5fad2b48d3
<|skeleton|> class PerennialsComPlants: def parse_grid(self, response): """Parse cols and rows for grid of results.""" <|body_0|> def parse_plant_details(self, response): """Parse cols and rows for grid of results.""" <|body_1|> def pagination(self, response): """E...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PerennialsComPlants: def parse_grid(self, response): """Parse cols and rows for grid of results.""" for row in response.css('.row-fluid.text-left'): for plant in row.css('.fixsearchsmall'): url = plant.css('a::attr(href)').extract_first() yield respo...
the_stack_v2_python_sparse
plantstuff/scraping/scrapers/spiders/perennialscom.py
christabor/plantstuff
train
8
e52651a63d9b7e3346b6064bb1562f460a50e3d5
[ "self.leftheap = []\nself.rightheap = []\nself.left_size = 0\nself.right_size = 0", "if not self.rightheap:\n heappush(self.leftheap, -num)\n self.left_size += 1\nelif num >= self.rightheap[0]:\n heappush(self.rightheap, num)\n self.right_size += 1\nelse:\n heappush(self.leftheap, -num)\n self.l...
<|body_start_0|> self.leftheap = [] self.rightheap = [] self.left_size = 0 self.right_size = 0 <|end_body_0|> <|body_start_1|> if not self.rightheap: heappush(self.leftheap, -num) self.left_size += 1 elif num >= self.rightheap[0]: heap...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_069402
1,679
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_037767
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
14dcf9029486283b5e4685d95ebfe9979ade03c3
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.leftheap = [] self.rightheap = [] self.left_size = 0 self.right_size = 0 def addNum(self, num): """:type num: int :rtype: void""" if not self.rightheap: he...
the_stack_v2_python_sparse
295-FindMedianfromDataStream.py
dq-code/leetcode
train
0
86b4d576315d9603c2b98d08eb40655ff2e2695b
[ "if self.default:\n if not self.value:\n self.value = self.default\nelif not self.default and self.required:\n raise ValidationError('Required.')\nif type(self.value) is dict:\n try:\n json.dumps(self.value)\n except TypeError:\n raise ValidationError('Value must be a valid JSON dic...
<|body_start_0|> if self.default: if not self.value: self.value = self.default elif not self.default and self.required: raise ValidationError('Required.') if type(self.value) is dict: try: json.dumps(self.value) exce...
Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **Example:** :: from tethys_sdk.app_settings imp...
JSONCustomSetting
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONCustomSetting: """Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **E...
stack_v2_sparse_classes_75kplus_train_069403
45,827
permissive
[ { "docstring": "Validate prior to saving changes.", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Get the value", "name": "get_value", "signature": "def get_value(self)" } ]
2
stack_v2_sparse_classes_30k_train_048745
Implement the Python class `JSONCustomSetting` described below. Class description: Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string...
Implement the Python class `JSONCustomSetting` described below. Class description: Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string...
e9365fa55ec25d7658a75ca7fb0632013374d876
<|skeleton|> class JSONCustomSetting: """Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **E...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JSONCustomSetting: """Used to define a Custom Json Setting. Attributes: name(str): Unique name used to identify the setting. description(str): Short description of the setting. required(bool): A value will be required if True. default(str): Value as a string that may be provided as a default. **Example:** :: ...
the_stack_v2_python_sparse
tethys_apps/models.py
tethysplatform/tethys
train
95
6cd695182ddb461e393305aa0679fd6cd0cdd9f9
[ "self.workflow = kwargs.pop('workflow', None)\nsuper().__init__(*args, **kwargs)\nself.fields['name'].label = _('View name')\nself.fields['description_text'].label = _('View Description')\nself.fields['columns'].label = _('Columns to show')\nself.fields['columns'].queryset = self.workflow.columns.all()", "form_da...
<|body_start_0|> self.workflow = kwargs.pop('workflow', None) super().__init__(*args, **kwargs) self.fields['name'].label = _('View name') self.fields['description_text'].label = _('View Description') self.fields['columns'].label = _('Columns to show') self.fields['column...
Form to add a view.
ViewAddForm
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewAddForm: """Form to add a view.""" def __init__(self, *args, **kwargs): """Initialize the object, store the workflow and rename fields.""" <|body_0|> def clean(self) -> Dict: """Check if three properties in the form. 1) Number of columns is not empty 2) There...
stack_v2_sparse_classes_75kplus_train_069404
2,024
permissive
[ { "docstring": "Initialize the object, store the workflow and rename fields.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Check if three properties in the form. 1) Number of columns is not empty 2) There is at least one key column 3) There is no vie...
2
null
Implement the Python class `ViewAddForm` described below. Class description: Form to add a view. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the object, store the workflow and rename fields. - def clean(self) -> Dict: Check if three properties in the form. 1) Number of columns ...
Implement the Python class `ViewAddForm` described below. Class description: Form to add a view. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize the object, store the workflow and rename fields. - def clean(self) -> Dict: Check if three properties in the form. 1) Number of columns ...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ViewAddForm: """Form to add a view.""" def __init__(self, *args, **kwargs): """Initialize the object, store the workflow and rename fields.""" <|body_0|> def clean(self) -> Dict: """Check if three properties in the form. 1) Number of columns is not empty 2) There...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ViewAddForm: """Form to add a view.""" def __init__(self, *args, **kwargs): """Initialize the object, store the workflow and rename fields.""" self.workflow = kwargs.pop('workflow', None) super().__init__(*args, **kwargs) self.fields['name'].label = _('View name') ...
the_stack_v2_python_sparse
ontask/table/forms.py
abelardopardo/ontask_b
train
43
e48d4e52dc104d9ce8cd3e3b72a0896d88d8f4d7
[ "time_elements_tuple = self._GetValueFromStructure(structure, 'date_time')\n_, month, day_of_month, hours, minutes, seconds, year = time_elements_tuple\nmonth = timelib.MONTH_DICT.get(month.lower(), 0)\nreturn (year, month, day_of_month, hours, minutes, seconds)", "time_elements_tuple = self._GetTimeElementsTuple...
<|body_start_0|> time_elements_tuple = self._GetValueFromStructure(structure, 'date_time') _, month, day_of_month, hours, minutes, seconds, year = time_elements_tuple month = timelib.MONTH_DICT.get(month.lower(), 0) return (year, month, day_of_month, hours, minutes, seconds) <|end_body_0...
Parses a vsftpd log.
VsftpdLogParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VsftpdLogParser: """Parses a vsftpd log.""" def _GetTimeElementsTuple(self, structure): """Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int)...
stack_v2_sparse_classes_75kplus_train_069405
5,343
permissive
[ { "docstring": "Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int): year. month (int): month, where 1 represents January. day_of_month (int): day of month, where 1 is th...
4
stack_v2_sparse_classes_30k_train_029724
Implement the Python class `VsftpdLogParser` described below. Class description: Parses a vsftpd log. Method signatures and docstrings: - def _GetTimeElementsTuple(self, structure): Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of...
Implement the Python class `VsftpdLogParser` described below. Class description: Parses a vsftpd log. Method signatures and docstrings: - def _GetTimeElementsTuple(self, structure): Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of...
c69b2952b608cfce47ff8fd0d1409d856be35cb1
<|skeleton|> class VsftpdLogParser: """Parses a vsftpd log.""" def _GetTimeElementsTuple(self, structure): """Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VsftpdLogParser: """Parses a vsftpd log.""" def _GetTimeElementsTuple(self, structure): """Retrieves a time elements tuple from the structure. Args: structure (pyparsing.ParseResults): structure of tokens derived from a line of a vsftp log file. Returns: tuple: containing: year (int): year. month...
the_stack_v2_python_sparse
plaso/parsers/vsftpd.py
cyb3rfox/plaso
train
3
7f0b602394ac108148dbd8f3505bf5edfd82ed79
[ "driver = self.driver\ndriver.get(self.base_url)\nhomepage = HomePage(self.driver)\nhomepage.click_oa()\nhomepage.sleep(0.5)\nhomepage.click_itfw()\nhomepage.click_buglist()\nhomepage.sleep(0.1)\nhomepage.click_bug()\nhomepage.switch_frame(driver.find_element_by_xpath(\"//iframe[@src='http://gc.eascs.com/bug/bugman...
<|body_start_0|> driver = self.driver driver.get(self.base_url) homepage = HomePage(self.driver) homepage.click_oa() homepage.sleep(0.5) homepage.click_itfw() homepage.click_buglist() homepage.sleep(0.1) homepage.click_bug() homepage.switch...
BUG-LIST
Start
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Start: """BUG-LIST""" def test1_bug(self): """bug""" <|body_0|> def test2_bug(self): """版本""" <|body_1|> <|end_skeleton|> <|body_start_0|> driver = self.driver driver.get(self.base_url) homepage = HomePage(self.driver) ho...
stack_v2_sparse_classes_75kplus_train_069406
2,280
no_license
[ { "docstring": "bug", "name": "test1_bug", "signature": "def test1_bug(self)" }, { "docstring": "版本", "name": "test2_bug", "signature": "def test2_bug(self)" } ]
2
stack_v2_sparse_classes_30k_train_034079
Implement the Python class `Start` described below. Class description: BUG-LIST Method signatures and docstrings: - def test1_bug(self): bug - def test2_bug(self): 版本
Implement the Python class `Start` described below. Class description: BUG-LIST Method signatures and docstrings: - def test1_bug(self): bug - def test2_bug(self): 版本 <|skeleton|> class Start: """BUG-LIST""" def test1_bug(self): """bug""" <|body_0|> def test2_bug(self): """版本"""...
a90695147681163d45d4951f6a921eda816500bb
<|skeleton|> class Start: """BUG-LIST""" def test1_bug(self): """bug""" <|body_0|> def test2_bug(self): """版本""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Start: """BUG-LIST""" def test1_bug(self): """bug""" driver = self.driver driver.get(self.base_url) homepage = HomePage(self.driver) homepage.click_oa() homepage.sleep(0.5) homepage.click_itfw() homepage.click_buglist() homepage.slee...
the_stack_v2_python_sparse
oa_test_case/oa_buglist.py
shengli520/yyt
train
0
8f0dc3d2b9fe388325fe3670292bead9408a7c4e
[ "super(CDF, self).__init__(**kwargs)\nself.num_keypoints = num_keypoints\nself.units = units\nself.activation = activation\nself.reduction = reduction\nif input_scaling_init is None:\n self.input_scaling_init = float(num_keypoints)\nelse:\n self.input_scaling_init = float(input_scaling_init)\nself.input_scali...
<|body_start_0|> super(CDF, self).__init__(**kwargs) self.num_keypoints = num_keypoints self.units = units self.activation = activation self.reduction = reduction if input_scaling_init is None: self.input_scaling_init = float(num_keypoints) else: ...
Cumulative Distribution Function (CDF) layer. Layer takes input of shape `(batch_size, input_dim)` or `(batch_size, 1)` and transforms it using `input_dim` number of cumulative distribution functions, which are naturally monotonic and bounded to the range [0, 1]. If multi dimensional input is provided, each output will...
CDF
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CDF: """Cumulative Distribution Function (CDF) layer. Layer takes input of shape `(batch_size, input_dim)` or `(batch_size, 1)` and transforms it using `input_dim` number of cumulative distribution functions, which are naturally monotonic and bounded to the range [0, 1]. If multi dimensional inpu...
stack_v2_sparse_classes_75kplus_train_069407
11,547
permissive
[ { "docstring": "Initializes an instance of `Lattice`. Args: num_keypoints: The number of keypoints (i.e. step functions) to use for each of `units` CDF functions. units: The output dimension of the layer. activation: The activation function to use for the step functions. One of: - `'relu6'`: The `tf.nn.relu6` f...
4
stack_v2_sparse_classes_30k_train_022509
Implement the Python class `CDF` described below. Class description: Cumulative Distribution Function (CDF) layer. Layer takes input of shape `(batch_size, input_dim)` or `(batch_size, 1)` and transforms it using `input_dim` number of cumulative distribution functions, which are naturally monotonic and bounded to the ...
Implement the Python class `CDF` described below. Class description: Cumulative Distribution Function (CDF) layer. Layer takes input of shape `(batch_size, input_dim)` or `(batch_size, 1)` and transforms it using `input_dim` number of cumulative distribution functions, which are naturally monotonic and bounded to the ...
01215c0d057cdc73d4dd98301637c79b2a6f120f
<|skeleton|> class CDF: """Cumulative Distribution Function (CDF) layer. Layer takes input of shape `(batch_size, input_dim)` or `(batch_size, 1)` and transforms it using `input_dim` number of cumulative distribution functions, which are naturally monotonic and bounded to the range [0, 1]. If multi dimensional inpu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CDF: """Cumulative Distribution Function (CDF) layer. Layer takes input of shape `(batch_size, input_dim)` or `(batch_size, 1)` and transforms it using `input_dim` number of cumulative distribution functions, which are naturally monotonic and bounded to the range [0, 1]. If multi dimensional input is provided...
the_stack_v2_python_sparse
tensorflow_lattice/python/cdf_layer.py
tensorflow/lattice
train
540
1bcbbd4338be02e1676dbe9e7fe071e862e3b20a
[ "if model._meta.app_label in self.route_app_labels:\n return 'vendor_os'\nreturn None", "if model._meta.app_label in self.route_app_labels:\n return 'vendor_os'\nreturn None", "if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:\n return True\nreturn None"...
<|body_start_0|> if model._meta.app_label in self.route_app_labels: return 'vendor_os' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.route_app_labels: return 'vendor_os' return None <|end_body_1|> <|body_start_2|> if obj1._...
A router to control all database operations on models in the auth and contenttypes applications.
AuthRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth and contenttypes applications.""" def db_for_read(self, model, **hints): """Attempts to read auth and contenttypes models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints):...
stack_v2_sparse_classes_75kplus_train_069408
4,107
no_license
[ { "docstring": "Attempts to read auth and contenttypes models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth and contenttypes models go to auth_db.", "name": "db_for_write", "signature": "def db_for_w...
4
stack_v2_sparse_classes_30k_train_040172
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth and contenttypes applications. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth and contenttypes models go to auth_db. - def db_...
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth and contenttypes applications. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth and contenttypes models go to auth_db. - def db_...
667bf1e922c54f3406016f13c26e62c9f20ec1c9
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth and contenttypes applications.""" def db_for_read(self, model, **hints): """Attempts to read auth and contenttypes models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthRouter: """A router to control all database operations on models in the auth and contenttypes applications.""" def db_for_read(self, model, **hints): """Attempts to read auth and contenttypes models go to auth_db.""" if model._meta.app_label in self.route_app_labels: retur...
the_stack_v2_python_sparse
routers/db_routers.py
mwicwiri-bonface/varal-p-6
train
0
904ef3d679591c460965ec30cfe76dcc3a7a08fa
[ "super().__init__()\nself.batch_size = batch_size\nself.decoding_units = decoding_units\nself.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dimension)\nif gru:\n self.layer = tf.keras.layers.GRU(self.decoding_units, return_sequences=True, return_state=True, recurrent_initializer='glorot_uniform')\n...
<|body_start_0|> super().__init__() self.batch_size = batch_size self.decoding_units = decoding_units self.embedding = tf.keras.layers.Embedding(vocab_size, embedding_dimension) if gru: self.layer = tf.keras.layers.GRU(self.decoding_units, return_sequences=True, retur...
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: def __init__(self, vocab_size, embedding_dimension, decoding_units, batch_size, gru: bool=True): """decoder for attention model""" <|body_0|> def call(self, x, hidden, enc_output): """given vector, hidden, and encoding, return new vector, state, and weights"...
stack_v2_sparse_classes_75kplus_train_069409
2,408
permissive
[ { "docstring": "decoder for attention model", "name": "__init__", "signature": "def __init__(self, vocab_size, embedding_dimension, decoding_units, batch_size, gru: bool=True)" }, { "docstring": "given vector, hidden, and encoding, return new vector, state, and weights", "name": "call", ...
2
stack_v2_sparse_classes_30k_train_017295
Implement the Python class `Decoder` described below. Class description: Implement the Decoder class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dimension, decoding_units, batch_size, gru: bool=True): decoder for attention model - def call(self, x, hidden, enc_output): given vector, ...
Implement the Python class `Decoder` described below. Class description: Implement the Decoder class. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dimension, decoding_units, batch_size, gru: bool=True): decoder for attention model - def call(self, x, hidden, enc_output): given vector, ...
d1d4d485d1fac8743cdbbc2996792db249dcf389
<|skeleton|> class Decoder: def __init__(self, vocab_size, embedding_dimension, decoding_units, batch_size, gru: bool=True): """decoder for attention model""" <|body_0|> def call(self, x, hidden, enc_output): """given vector, hidden, and encoding, return new vector, state, and weights"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: def __init__(self, vocab_size, embedding_dimension, decoding_units, batch_size, gru: bool=True): """decoder for attention model""" super().__init__() self.batch_size = batch_size self.decoding_units = decoding_units self.embedding = tf.keras.layers.Embedding(vo...
the_stack_v2_python_sparse
assignment5/code/src/decoder.py
jschmidtnj/cs584
train
0
4bd06b7d927fab566904952819d50a67f8116483
[ "self.data_path = os.path.dirname(os.path.dirname(__file__)) + '/testData/data.xls'\nself.workbook = xlrd.open_workbook(self.data_path)\nself.worksheet = self.workbook.sheet_by_index(0)\nself.num = self.worksheet.nrows\nself.data_list = []", "key = self.worksheet.row_values(0)\nlogger.info(f'获取字典key成功,为{key}')\nf...
<|body_start_0|> self.data_path = os.path.dirname(os.path.dirname(__file__)) + '/testData/data.xls' self.workbook = xlrd.open_workbook(self.data_path) self.worksheet = self.workbook.sheet_by_index(0) self.num = self.worksheet.nrows self.data_list = [] <|end_body_0|> <|body_start...
ReadExcel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadExcel: def __init__(self): """定义基础属性""" <|body_0|> def readexcel(self): """处理测试数据""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.data_path = os.path.dirname(os.path.dirname(__file__)) + '/testData/data.xls' self.workbook = xlrd.ope...
stack_v2_sparse_classes_75kplus_train_069410
1,738
no_license
[ { "docstring": "定义基础属性", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "处理测试数据", "name": "readexcel", "signature": "def readexcel(self)" } ]
2
stack_v2_sparse_classes_30k_train_039856
Implement the Python class `ReadExcel` described below. Class description: Implement the ReadExcel class. Method signatures and docstrings: - def __init__(self): 定义基础属性 - def readexcel(self): 处理测试数据
Implement the Python class `ReadExcel` described below. Class description: Implement the ReadExcel class. Method signatures and docstrings: - def __init__(self): 定义基础属性 - def readexcel(self): 处理测试数据 <|skeleton|> class ReadExcel: def __init__(self): """定义基础属性""" <|body_0|> def readexcel(self...
17df174f8988a3b660e7220ba90347b806e92ea7
<|skeleton|> class ReadExcel: def __init__(self): """定义基础属性""" <|body_0|> def readexcel(self): """处理测试数据""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReadExcel: def __init__(self): """定义基础属性""" self.data_path = os.path.dirname(os.path.dirname(__file__)) + '/testData/data.xls' self.workbook = xlrd.open_workbook(self.data_path) self.worksheet = self.workbook.sheet_by_index(0) self.num = self.worksheet.nrows sel...
the_stack_v2_python_sparse
Interface_test/common/readExcel.py
kai-ally/TestStudy
train
0
bfb778affab7068402e6a065a7b89c81f40365c2
[ "service = code_clinic.startup()\nhome = os.path.expanduser('~')\nusername, email, name = code_clinic.get_credentials(home)\ntestdate = '01/01/01'\nwith patch('sys.stdin', StringIO(f'{testdate}\\n')):\n orig_stdout = sys.stdout\n new_string = StringIO()\n sys.stdout = new_string\n create.create(service,...
<|body_start_0|> service = code_clinic.startup() home = os.path.expanduser('~') username, email, name = code_clinic.get_credentials(home) testdate = '01/01/01' with patch('sys.stdin', StringIO(f'{testdate}\n')): orig_stdout = sys.stdout new_string = String...
TestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCase: def test_create_wrong_date(self): """Test Create function if the date is older than now""" <|body_0|> def test_create_y(self): """Test Create function for confirming the creation of an event for y""" <|body_1|> def test_create_n(self): ...
stack_v2_sparse_classes_75kplus_train_069411
3,063
no_license
[ { "docstring": "Test Create function if the date is older than now", "name": "test_create_wrong_date", "signature": "def test_create_wrong_date(self)" }, { "docstring": "Test Create function for confirming the creation of an event for y", "name": "test_create_y", "signature": "def test_c...
3
stack_v2_sparse_classes_30k_test_002225
Implement the Python class `TestCase` described below. Class description: Implement the TestCase class. Method signatures and docstrings: - def test_create_wrong_date(self): Test Create function if the date is older than now - def test_create_y(self): Test Create function for confirming the creation of an event for y...
Implement the Python class `TestCase` described below. Class description: Implement the TestCase class. Method signatures and docstrings: - def test_create_wrong_date(self): Test Create function if the date is older than now - def test_create_y(self): Test Create function for confirming the creation of an event for y...
c28f8dea37f0053502473f577a067413c6bb2fd4
<|skeleton|> class TestCase: def test_create_wrong_date(self): """Test Create function if the date is older than now""" <|body_0|> def test_create_y(self): """Test Create function for confirming the creation of an event for y""" <|body_1|> def test_create_n(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCase: def test_create_wrong_date(self): """Test Create function if the date is older than now""" service = code_clinic.startup() home = os.path.expanduser('~') username, email, name = code_clinic.get_credentials(home) testdate = '01/01/01' with patch('sys.st...
the_stack_v2_python_sparse
test_create.py
Kalesmat/gp1_code_clinic
train
0
63e373cb477237a43d2930dedf73be59198b2582
[ "if self.cleaned_data['sync_frequency'] < 60:\n raise forms.ValidationError(_('Minimum allowed value is 60s'))\nreturn self.cleaned_data['sync_frequency']", "super(UserSettings, self).save(*args, **kwargs)\nif not self.cleaned_data['enable_carddav_sync']:\n return\nabook = self.user.addressbook_set.first()\...
<|body_start_0|> if self.cleaned_data['sync_frequency'] < 60: raise forms.ValidationError(_('Minimum allowed value is 60s')) return self.cleaned_data['sync_frequency'] <|end_body_0|> <|body_start_1|> super(UserSettings, self).save(*args, **kwargs) if not self.cleaned_data['e...
User settings.
UserSettings
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSettings: """User settings.""" def clean_sync_frequency(self): """Make sure frequency is a positive integer.""" <|body_0|> def save(self, *args, **kwargs): """Create remote cal if necessary.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if...
stack_v2_sparse_classes_75kplus_train_069412
2,028
permissive
[ { "docstring": "Make sure frequency is a positive integer.", "name": "clean_sync_frequency", "signature": "def clean_sync_frequency(self)" }, { "docstring": "Create remote cal if necessary.", "name": "save", "signature": "def save(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_test_000554
Implement the Python class `UserSettings` described below. Class description: User settings. Method signatures and docstrings: - def clean_sync_frequency(self): Make sure frequency is a positive integer. - def save(self, *args, **kwargs): Create remote cal if necessary.
Implement the Python class `UserSettings` described below. Class description: User settings. Method signatures and docstrings: - def clean_sync_frequency(self): Make sure frequency is a positive integer. - def save(self, *args, **kwargs): Create remote cal if necessary. <|skeleton|> class UserSettings: """User s...
c26b893819288f3e718a46143c9aea9c9cad76e0
<|skeleton|> class UserSettings: """User settings.""" def clean_sync_frequency(self): """Make sure frequency is a positive integer.""" <|body_0|> def save(self, *args, **kwargs): """Create remote cal if necessary.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserSettings: """User settings.""" def clean_sync_frequency(self): """Make sure frequency is a positive integer.""" if self.cleaned_data['sync_frequency'] < 60: raise forms.ValidationError(_('Minimum allowed value is 60s')) return self.cleaned_data['sync_frequency'] ...
the_stack_v2_python_sparse
modoboa_contacts/forms.py
modoboa/modoboa-contacts
train
17
301fc3fda4326f60d447694cc9dbd65544c6dad6
[ "if isinstance(key, int):\n return FlowIDStatus(key)\nif key not in FlowIDStatus._member_map_:\n return extend_enum(FlowIDStatus, key, default)\nreturn FlowIDStatus[key]", "if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 1 <= v...
<|body_start_0|> if isinstance(key, int): return FlowIDStatus(key) if key not in FlowIDStatus._member_map_: return extend_enum(FlowIDStatus, key, default) return FlowIDStatus[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 25...
[FlowIDStatus] Flow Identification Mobility Option Status Codes
FlowIDStatus
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowIDStatus: """[FlowIDStatus] Flow Identification Mobility Option Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDStatus': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" ...
stack_v2_sparse_classes_75kplus_train_069413
2,702
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDStatus'" }, { "docstring": "Lookup function used when value is not found...
2
null
Implement the Python class `FlowIDStatus` described below. Class description: [FlowIDStatus] Flow Identification Mobility Option Status Codes Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDStatus': Backport support for original codes. Args: key: Key to get enum item. defaul...
Implement the Python class `FlowIDStatus` described below. Class description: [FlowIDStatus] Flow Identification Mobility Option Status Codes Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDStatus': Backport support for original codes. Args: key: Key to get enum item. defaul...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class FlowIDStatus: """[FlowIDStatus] Flow Identification Mobility Option Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDStatus': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlowIDStatus: """[FlowIDStatus] Flow Identification Mobility Option Status Codes""" def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDStatus': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance...
the_stack_v2_python_sparse
pcapkit/const/mh/flow_id_status.py
JarryShaw/PyPCAPKit
train
204
15cf2b112c003d861e51752b5b81467034054941
[ "super().setUp()\nself.plugin = Plugin()\nself.plugin.current_forecast = self.current_temperature_forecast_cube", "self.plugin.coefficients_cubelist = self.coeffs_from_mean\nscale_parameter = self.plugin._calculate_scale_parameter()\nself.assertCalibratedVariablesAlmostEqual(scale_parameter, self.expected_scale_p...
<|body_start_0|> super().setUp() self.plugin = Plugin() self.plugin.current_forecast = self.current_temperature_forecast_cube <|end_body_0|> <|body_start_1|> self.plugin.coefficients_cubelist = self.coeffs_from_mean scale_parameter = self.plugin._calculate_scale_parameter() ...
Test the _calculate_scale_parameter method.
Test__calculate_scale_parameter
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__calculate_scale_parameter: """Test the _calculate_scale_parameter method.""" def setUp(self): """Set-up the plugin for testing.""" <|body_0|> def test_basic(self): """Test the scale parameter is calculated correctly.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_069414
23,621
permissive
[ { "docstring": "Set-up the plugin for testing.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the scale parameter is calculated correctly.", "name": "test_basic", "signature": "def test_basic(self)" } ]
2
stack_v2_sparse_classes_30k_train_042769
Implement the Python class `Test__calculate_scale_parameter` described below. Class description: Test the _calculate_scale_parameter method. Method signatures and docstrings: - def setUp(self): Set-up the plugin for testing. - def test_basic(self): Test the scale parameter is calculated correctly.
Implement the Python class `Test__calculate_scale_parameter` described below. Class description: Test the _calculate_scale_parameter method. Method signatures and docstrings: - def setUp(self): Set-up the plugin for testing. - def test_basic(self): Test the scale parameter is calculated correctly. <|skeleton|> class...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__calculate_scale_parameter: """Test the _calculate_scale_parameter method.""" def setUp(self): """Set-up the plugin for testing.""" <|body_0|> def test_basic(self): """Test the scale parameter is calculated correctly.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__calculate_scale_parameter: """Test the _calculate_scale_parameter method.""" def setUp(self): """Set-up the plugin for testing.""" super().setUp() self.plugin = Plugin() self.plugin.current_forecast = self.current_temperature_forecast_cube def test_basic(self): ...
the_stack_v2_python_sparse
improver_tests/calibration/ensemble_calibration/test_CalibratedForecastDistributionParameters.py
metoppv/improver
train
101
7f38b4005a156acd239974c2aa1ee31a3a3e6dc4
[ "bot_messages = []\nbrian_bot = UserUtils.get_brian_bot()\nfor u1, u2 in [[user1, user2], [user2, user1]]:\n chat = ChatUtils.find_chat([brian_bot, u1])\n message = models.Message.objects.create(chat=chat, text=message_text.format(user1=u1.first_name, user2=u2.first_name), sender=brian_bot)\n bot_messages....
<|body_start_0|> bot_messages = [] brian_bot = UserUtils.get_brian_bot() for u1, u2 in [[user1, user2], [user2, user1]]: chat = ChatUtils.find_chat([brian_bot, u1]) message = models.Message.objects.create(chat=chat, text=message_text.format(user1=u1.first_name, user2=u2.f...
Utilities for chats.
ChatUtils
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChatUtils: """Utilities for chats.""" def create_bot_chat_creation_messages(user1, user2, message_text): """Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A ...
stack_v2_sparse_classes_75kplus_train_069415
2,787
permissive
[ { "docstring": "Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A user. :param message_text: The bot message to notify users of the new match. Can contain placeholders {user1} and {user2...
3
stack_v2_sparse_classes_30k_train_044930
Implement the Python class `ChatUtils` described below. Class description: Utilities for chats. Method signatures and docstrings: - def create_bot_chat_creation_messages(user1, user2, message_text): Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent ...
Implement the Python class `ChatUtils` described below. Class description: Utilities for chats. Method signatures and docstrings: - def create_bot_chat_creation_messages(user1, user2, message_text): Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent ...
90ed2592f30afcb454111148a8121e1b9820e507
<|skeleton|> class ChatUtils: """Utilities for chats.""" def create_bot_chat_creation_messages(user1, user2, message_text): """Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChatUtils: """Utilities for chats.""" def create_bot_chat_creation_messages(user1, user2, message_text): """Creates messages from Brian Bot to two users that a chat between them has been created. No push notifications are sent for these message. :param user1: A user. :param user2: A user. :param ...
the_stack_v2_python_sparse
friends/utilities/chat_utils.py
kairathmann/friends-backend
train
0
9d9ea77deacbdc363c9f88f616bbd4367d985ea4
[ "res = ApiResponse()\nschedules = Schedule.objects.all()\ndata = ScheduleSerializer(schedules, many=True).data\nres.update(True, 'Schedules fetched successfully', data)\nreturn res", "res = ApiResponse()\ncronElements = cron.split()\nif len(cronElements) != 5:\n res.update(False, 'Crontab must contain five ele...
<|body_start_0|> res = ApiResponse() schedules = Schedule.objects.all() data = ScheduleSerializer(schedules, many=True).data res.update(True, 'Schedules fetched successfully', data) return res <|end_body_0|> <|body_start_1|> res = ApiResponse() cronElements = cro...
ScheduleService
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleService: def getSchedules(): """Service to get all schedule objects""" <|body_0|> def addSchedule(cron: str, timezone: str=None, name: str=''): """Service to add Schedule :param cron: Crontab in string format :param timezone: Timezone string for which to conf...
stack_v2_sparse_classes_75kplus_train_069416
3,756
permissive
[ { "docstring": "Service to get all schedule objects", "name": "getSchedules", "signature": "def getSchedules()" }, { "docstring": "Service to add Schedule :param cron: Crontab in string format :param timezone: Timezone string for which to configure Schedule :param name: Name of schedule provided...
6
null
Implement the Python class `ScheduleService` described below. Class description: Implement the ScheduleService class. Method signatures and docstrings: - def getSchedules(): Service to get all schedule objects - def addSchedule(cron: str, timezone: str=None, name: str=''): Service to add Schedule :param cron: Crontab...
Implement the Python class `ScheduleService` described below. Class description: Implement the ScheduleService class. Method signatures and docstrings: - def getSchedules(): Service to get all schedule objects - def addSchedule(cron: str, timezone: str=None, name: str=''): Service to add Schedule :param cron: Crontab...
4c10cd804d6ca31a21d14d65670fa4c6b9a5d011
<|skeleton|> class ScheduleService: def getSchedules(): """Service to get all schedule objects""" <|body_0|> def addSchedule(cron: str, timezone: str=None, name: str=''): """Service to add Schedule :param cron: Crontab in string format :param timezone: Timezone string for which to conf...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScheduleService: def getSchedules(): """Service to get all schedule objects""" res = ApiResponse() schedules = Schedule.objects.all() data = ScheduleSerializer(schedules, many=True).data res.update(True, 'Schedules fetched successfully', data) return res de...
the_stack_v2_python_sparse
api/anomaly/services/schedules.py
Slach/CueObserve
train
0
da86ef7b92d36ebcfde763d4d96b1e11896e0960
[ "self.name = name\nself.bord = []\nfor i in range(0, 3):\n self.bord.append(Puzzle2Bord(definition[i:i + 2]))\nself.bord.append(Puzzle2Bord(definition[-1] + definition[0]))\nself.orientation = 0\nself.position = position\nself.numero = numero", "image = pygame.image.load(self.name)\nself.image = pygame.transfo...
<|body_start_0|> self.name = name self.bord = [] for i in range(0, 3): self.bord.append(Puzzle2Bord(definition[i:i + 2])) self.bord.append(Puzzle2Bord(definition[-1] + definition[0])) self.orientation = 0 self.position = position self.numero = numero <...
Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette information va donc bouger au fu...
Puzzle2Piece
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle...
stack_v2_sparse_classes_75kplus_train_069417
17,451
permissive
[ { "docstring": "On définit la pièce: :param name: nom de l'image représentant la pièce :param definition: chaîne de 4 caractères indiquant les quatre couleurs au quatre angles :param position: c'est la position initiale de la pièce, on suppose que l'orientation est nulle pour commencer :param numero: numéro de ...
4
stack_v2_sparse_classes_30k_train_044024
Implement the Python class `Puzzle2Piece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la pos...
Implement the Python class `Puzzle2Piece` described below. Class description: Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la pos...
2abbc7a20c7437f9ab91d1ec83a6aecdefceb028
<|skeleton|> class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Puzzle2Piece: """Définition d'une pièce du puzzle, celle-ci inclut : - **bord** : cette liste contient quatre objets de type Bord, cette liste ne changera plus - **position** : c'est la position de la pièce dans le puzzle, ce qui nous intéresse, c'est la position finale de la pièce dans le puzzle, cette infor...
the_stack_v2_python_sparse
src/ensae_teaching_cs/special/puzzle_2.py
Pandinosaurus/ensae_teaching_cs
train
1
ffac3cd8681fd6598f7cf1b63288d8bc338fa1d3
[ "n = len(s1)\ncount = [0 for _ in range(26)]\nif s1 == s2:\n return True\nfor i in range(n):\n count[ord(s1[i]) - ord('a')] += 1\n count[ord(s2[i]) - ord('a')] -= 1\nfor i in range(26):\n if count[i] != 0:\n return False\nfor i in range(1, n):\n if self.isScramble(s1[:i], s2[n - i:]) and self....
<|body_start_0|> n = len(s1) count = [0 for _ in range(26)] if s1 == s2: return True for i in range(n): count[ord(s1[i]) - ord('a')] += 1 count[ord(s2[i]) - ord('a')] -= 1 for i in range(26): if count[i] != 0: return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isScramble(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_0|> def isScramble0(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s1) count = ...
stack_v2_sparse_classes_75kplus_train_069418
2,163
no_license
[ { "docstring": ":type s1: str :type s2: str :rtype: bool", "name": "isScramble", "signature": "def isScramble(self, s1, s2)" }, { "docstring": ":type s1: str :type s2: str :rtype: bool", "name": "isScramble0", "signature": "def isScramble0(self, s1, s2)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isScramble(self, s1, s2): :type s1: str :type s2: str :rtype: bool - def isScramble0(self, s1, s2): :type s1: str :type s2: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isScramble(self, s1, s2): :type s1: str :type s2: str :rtype: bool - def isScramble0(self, s1, s2): :type s1: str :type s2: str :rtype: bool <|skeleton|> class Solution: ...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def isScramble(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_0|> def isScramble0(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isScramble(self, s1, s2): """:type s1: str :type s2: str :rtype: bool""" n = len(s1) count = [0 for _ in range(26)] if s1 == s2: return True for i in range(n): count[ord(s1[i]) - ord('a')] += 1 count[ord(s2[i]) - ord('a'...
the_stack_v2_python_sparse
PythonCode/src/0087_Scramble_String.py
oneyuan/CodeforFun
train
0
ae44db1c7842dec9a1c9fea9d5bc536b9573f7cf
[ "batch_sz, n_chans, img_y, img_x = self.input.shape\nn_kers, n_ker_chans, ker_x, ker_y = self.wts.shape\nker_sz = ker_x\nstride = 1\npad = int(np.ceil((ker_sz - 1) / 2))\nimg_y_p, img_x_p = (img_y + 2 * pad, img_x + 2 * pad)\nself.input_cols = im2col_cython.im2col_cython(self.input, ker_sz, ker_sz, pad, stride)\nse...
<|body_start_0|> batch_sz, n_chans, img_y, img_x = self.input.shape n_kers, n_ker_chans, ker_x, ker_y = self.wts.shape ker_sz = ker_x stride = 1 pad = int(np.ceil((ker_sz - 1) / 2)) img_y_p, img_x_p = (img_y + 2 * pad, img_x + 2 * pad) self.input_cols = im2col_cyt...
Conv2DAccel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv2DAccel: def compute_net_in(self): """Computes fast convolution net-in using the im2col algorithm, C-compiled via Cython""" <|body_0|> def backward_netIn_to_prevLayer_netAct(self, d_upstream): """Computes fast convolution backward pass using the im2col algorithm,...
stack_v2_sparse_classes_75kplus_train_069419
4,393
no_license
[ { "docstring": "Computes fast convolution net-in using the im2col algorithm, C-compiled via Cython", "name": "compute_net_in", "signature": "def compute_net_in(self)" }, { "docstring": "Computes fast convolution backward pass using the im2col algorithm, C-compiled via Cython Parameters: --------...
2
stack_v2_sparse_classes_30k_train_030451
Implement the Python class `Conv2DAccel` described below. Class description: Implement the Conv2DAccel class. Method signatures and docstrings: - def compute_net_in(self): Computes fast convolution net-in using the im2col algorithm, C-compiled via Cython - def backward_netIn_to_prevLayer_netAct(self, d_upstream): Com...
Implement the Python class `Conv2DAccel` described below. Class description: Implement the Conv2DAccel class. Method signatures and docstrings: - def compute_net_in(self): Computes fast convolution net-in using the im2col algorithm, C-compiled via Cython - def backward_netIn_to_prevLayer_netAct(self, d_upstream): Com...
924c5db8b7b7a70fae87d0fc30b28b6ce9cfa529
<|skeleton|> class Conv2DAccel: def compute_net_in(self): """Computes fast convolution net-in using the im2col algorithm, C-compiled via Cython""" <|body_0|> def backward_netIn_to_prevLayer_netAct(self, d_upstream): """Computes fast convolution backward pass using the im2col algorithm,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Conv2DAccel: def compute_net_in(self): """Computes fast convolution net-in using the im2col algorithm, C-compiled via Cython""" batch_sz, n_chans, img_y, img_x = self.input.shape n_kers, n_ker_chans, ker_x, ker_y = self.wts.shape ker_sz = ker_x stride = 1 pad = ...
the_stack_v2_python_sparse
CNN and Optimizer/accelerated_layer.py
luhangsnn/neuralnetworks
train
0
587f85f9fa9f4904c08bf411363d469b50af825d
[ "try:\n return_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 = ''\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_dat...
<|body_start_0|> try: return_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|> <|body_start_1|> try: retu...
RunManagerWorkFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManagerWorkFlow: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" <|body_0|> def get(self, request, nnid): """CRUD of workflow information --- ...
stack_v2_sparse_classes_75kplus_train_069420
2,065
permissive
[ { "docstring": "CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)", "name": "post", "signature": "def post(self, request, nnid)" }, { "docstring": "CRUD of workflow information --- # Class Name : RunManagerWorkFlo...
4
stack_v2_sparse_classes_30k_train_002888
Implement the Python class `RunManagerWorkFlow` described below. Class description: Implement the RunManagerWorkFlow class. Method signatures and docstrings: - def post(self, request, nnid): CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented...
Implement the Python class `RunManagerWorkFlow` described below. Class description: Implement the RunManagerWorkFlow class. Method signatures and docstrings: - def post(self, request, nnid): CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class RunManagerWorkFlow: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" <|body_0|> def get(self, request, nnid): """CRUD of workflow information --- ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RunManagerWorkFlow: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" try: return_data = '' return Response(json.dumps(return_data)) except Ex...
the_stack_v2_python_sparse
api/views/runmanager_workflow.py
yurimkoo/tensormsa
train
1
adb6b503ea1a19fa08bcabb198eee198d0f1acc3
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn BrowserSharedCookie()", "from .browser_shared_cookie_history import BrowserSharedCookieHistory\nfrom .browser_shared_cookie_source_environment import BrowserSharedCookieSourceEnvironment\nfrom .browser_shared_cookie_status import Brows...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return BrowserSharedCookie() <|end_body_0|> <|body_start_1|> from .browser_shared_cookie_history import BrowserSharedCookieHistory from .browser_shared_cookie_source_environment import BrowserS...
BrowserSharedCookie
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrowserSharedCookie: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookie: """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 ob...
stack_v2_sparse_classes_75kplus_train_069421
5,839
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: BrowserSharedCookie", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator...
3
stack_v2_sparse_classes_30k_train_008250
Implement the Python class `BrowserSharedCookie` described below. Class description: Implement the BrowserSharedCookie class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookie: Creates a new instance of the appropriate class based on d...
Implement the Python class `BrowserSharedCookie` described below. Class description: Implement the BrowserSharedCookie class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookie: Creates a new instance of the appropriate class based on d...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class BrowserSharedCookie: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookie: """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 ob...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BrowserSharedCookie: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> BrowserSharedCookie: """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: ...
the_stack_v2_python_sparse
msgraph/generated/models/browser_shared_cookie.py
microsoftgraph/msgraph-sdk-python
train
135
7ce23226482280dfe88e80666d921e0937f57430
[ "super(QuantileHead, self).__init__()\nlayer = NoiseLinearLayer if noise else nn.Linear\nblock = noise_block if noise else fc_block\nself.Q = nn.Sequential(MLP(hidden_size, hidden_size, hidden_size, layer_num, layer_fn=layer, activation=activation, norm_type=norm_type), block(hidden_size, output_size))\nself.num_qu...
<|body_start_0|> super(QuantileHead, self).__init__() layer = NoiseLinearLayer if noise else nn.Linear block = noise_block if noise else fc_block self.Q = nn.Sequential(MLP(hidden_size, hidden_size, hidden_size, layer_num, layer_fn=layer, activation=activation, norm_type=norm_type), bloc...
QuantileHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuantileHead: def __init__(self, hidden_size: int, output_size: int, layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, beta_function_type: Optional[str]='uniform', activation: Optional[nn.Module]=nn.ReLU(), norm_type: Optional[str]=None, noise: Optional[bool]=False) -> N...
stack_v2_sparse_classes_75kplus_train_069422
31,233
permissive
[ { "docstring": "Overview: Init the Head according to arguments. Arguments: - hidden_size (:obj:`int`): The ``hidden_size`` used before connected to ``DuelingHead`` - output_size (:obj:`int`): The num of output - layer_num (:obj:`int`): The num of layers used in the network to compute Q value output - activation...
3
stack_v2_sparse_classes_30k_train_024780
Implement the Python class `QuantileHead` described below. Class description: Implement the QuantileHead class. Method signatures and docstrings: - def __init__(self, hidden_size: int, output_size: int, layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, beta_function_type: Optional[str]='unifo...
Implement the Python class `QuantileHead` described below. Class description: Implement the QuantileHead class. Method signatures and docstrings: - def __init__(self, hidden_size: int, output_size: int, layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, beta_function_type: Optional[str]='unifo...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class QuantileHead: def __init__(self, hidden_size: int, output_size: int, layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, beta_function_type: Optional[str]='uniform', activation: Optional[nn.Module]=nn.ReLU(), norm_type: Optional[str]=None, noise: Optional[bool]=False) -> N...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuantileHead: def __init__(self, hidden_size: int, output_size: int, layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, beta_function_type: Optional[str]='uniform', activation: Optional[nn.Module]=nn.ReLU(), norm_type: Optional[str]=None, noise: Optional[bool]=False) -> None: "...
the_stack_v2_python_sparse
ding/model/common/head.py
shengxuesun/DI-engine
train
1
0274b01751006d51a8bc38374cbf35e82c018589
[ "W = np.array([[1.0, 0.0], [0.0, -1.0]])\nself.W = normalization_all(W)\nself.a = a", "z_layer = np.dot(self.W, x.T)\na_layer = sigmoid(z_layer)\nargmax = np.argmax(a_layer)\nreturn argmax", "self.W[argmax] = self.a * (x - self.W[argmax])\nself.W[argmax] = normalization(self.W[argmax])\nself.a -= self.decay", ...
<|body_start_0|> W = np.array([[1.0, 0.0], [0.0, -1.0]]) self.W = normalization_all(W) self.a = a <|end_body_0|> <|body_start_1|> z_layer = np.dot(self.W, x.T) a_layer = sigmoid(z_layer) argmax = np.argmax(a_layer) return argmax <|end_body_1|> <|body_start_2|> ...
competitive_network
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class competitive_network: def __init__(self, x_dim, output_num, a): """类参数初始化""" <|body_0|> def forward_propagation(self, x): """前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针""" <|body_1|> def back_propagation(self, argmax, x): ...
stack_v2_sparse_classes_75kplus_train_069423
3,412
no_license
[ { "docstring": "类参数初始化", "name": "__init__", "signature": "def __init__(self, x_dim, output_num, a)" }, { "docstring": "前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针", "name": "forward_propagation", "signature": "def forward_propagation(self, x)" }, { "d...
5
stack_v2_sparse_classes_30k_train_038209
Implement the Python class `competitive_network` described below. Class description: Implement the competitive_network class. Method signatures and docstrings: - def __init__(self, x_dim, output_num, a): 类参数初始化 - def forward_propagation(self, x): 前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针...
Implement the Python class `competitive_network` described below. Class description: Implement the competitive_network class. Method signatures and docstrings: - def __init__(self, x_dim, output_num, a): 类参数初始化 - def forward_propagation(self, x): 前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针...
97e69c71af972f22c38b714b659a374d04c08b84
<|skeleton|> class competitive_network: def __init__(self, x_dim, output_num, a): """类参数初始化""" <|body_0|> def forward_propagation(self, x): """前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针""" <|body_1|> def back_propagation(self, argmax, x): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class competitive_network: def __init__(self, x_dim, output_num, a): """类参数初始化""" W = np.array([[1.0, 0.0], [0.0, -1.0]]) self.W = normalization_all(W) self.a = a def forward_propagation(self, x): """前向传播 input:self(object):类参数 x(mat):一个训练样本 output:argmax(int):被激活的权重向量指针...
the_stack_v2_python_sparse
HW2/Letter_3.py
gavinatthu/ANN_course
train
3
fa62841e4604253c52f91eca580932b0c672c690
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn File()", "from .hashes import Hashes\nfrom .hashes import Hashes\nfields: Dict[str, Callable[[Any], None]] = {'hashes': lambda n: setattr(self, 'hashes', n.get_object_value(Hashes)), 'mimeType': lambda n: setattr(self, 'mime_type', n.g...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return File() <|end_body_0|> <|body_start_1|> from .hashes import Hashes from .hashes import Hashes fields: Dict[str, Callable[[Any], None]] = {'hashes': lambda n: setattr(self, 'hashes...
File
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class File: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: """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: File""" ...
stack_v2_sparse_classes_75kplus_train_069424
3,158
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: File", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
stack_v2_sparse_classes_30k_train_002815
Implement the Python class `File` described below. Class description: Implement the File class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `File` described below. Class description: Implement the File class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class File: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: """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: File""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class File: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> File: """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: File""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/file.py
microsoftgraph/msgraph-sdk-python
train
135
93b054b0c42ae4757f09c63efce071f1279a4e7f
[ "product_to_delete_id = self.cleaned_data['product_to_delete']\ntry:\n product_to_delete = Product.objects.get(id=product_to_delete_id)\nexcept Product.DoesNotExist:\n raise forms.ValidationError(\"Ce produit n'existe pas !\")\nreturn product_to_delete", "group_id = self.cleaned_data['group']\ntry:\n gro...
<|body_start_0|> product_to_delete_id = self.cleaned_data['product_to_delete'] try: product_to_delete = Product.objects.get(id=product_to_delete_id) except Product.DoesNotExist: raise forms.ValidationError("Ce produit n'existe pas !") return product_to_delete <|en...
ProductSuppressionForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductSuppressionForm: def clean_product_to_delete(self): """Return the Group object since the id input by user, if it exists""" <|body_0|> def clean_group(self): """Return the Group object since the id input by user, if it exists""" <|body_1|> def dele...
stack_v2_sparse_classes_75kplus_train_069425
1,863
no_license
[ { "docstring": "Return the Group object since the id input by user, if it exists", "name": "clean_product_to_delete", "signature": "def clean_product_to_delete(self)" }, { "docstring": "Return the Group object since the id input by user, if it exists", "name": "clean_group", "signature":...
3
stack_v2_sparse_classes_30k_test_000371
Implement the Python class `ProductSuppressionForm` described below. Class description: Implement the ProductSuppressionForm class. Method signatures and docstrings: - def clean_product_to_delete(self): Return the Group object since the id input by user, if it exists - def clean_group(self): Return the Group object s...
Implement the Python class `ProductSuppressionForm` described below. Class description: Implement the ProductSuppressionForm class. Method signatures and docstrings: - def clean_product_to_delete(self): Return the Group object since the id input by user, if it exists - def clean_group(self): Return the Group object s...
cf0b982a6df2b8b4318d12d344ef0827394eedfd
<|skeleton|> class ProductSuppressionForm: def clean_product_to_delete(self): """Return the Group object since the id input by user, if it exists""" <|body_0|> def clean_group(self): """Return the Group object since the id input by user, if it exists""" <|body_1|> def dele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductSuppressionForm: def clean_product_to_delete(self): """Return the Group object since the id input by user, if it exists""" product_to_delete_id = self.cleaned_data['product_to_delete'] try: product_to_delete = Product.objects.get(id=product_to_delete_id) exce...
the_stack_v2_python_sparse
product/forms.py
cleliofavoccia/Share
train
0
fa3444d6392e36d9dbd78be509675fcf97f9ba08
[ "self.__monitor_time = monitor_seconds\nself.__block_time = block_seconds\nself.__chances = chances\nself.__monitor = {}\nself.__block = {}", "is_blocked = False\nif host in self.__block:\n status = self.__block[host]\n delta_time = time_difference(status[self.__LAST_EVENT], time)\n if delta_time <= stat...
<|body_start_0|> self.__monitor_time = monitor_seconds self.__block_time = block_seconds self.__chances = chances self.__monitor = {} self.__block = {} <|end_body_0|> <|body_start_1|> is_blocked = False if host in self.__block: status = self.__block[h...
The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.
BlockedHosts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockedHosts: """The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.""" def __init__(self, monitor_seconds=20, block_seconds=300, chances=3): """Public variables: moni...
stack_v2_sparse_classes_75kplus_train_069426
7,735
no_license
[ { "docstring": "Public variables: monitor_time: the time period during which a number of failed login attempts will trigger the block event block_time: the time period to block the user chances: the number of attempts of failed login Private variables: __monitor_dict(dict): keep track the events after first fai...
4
stack_v2_sparse_classes_30k_val_000303
Implement the Python class `BlockedHosts` described below. Class description: The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window. Method signatures and docstrings: - def __init__(self, monitor_seconds=...
Implement the Python class `BlockedHosts` described below. Class description: The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window. Method signatures and docstrings: - def __init__(self, monitor_seconds=...
f99f15401955e8481e6c6b56b2f4afce0b0f81f7
<|skeleton|> class BlockedHosts: """The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.""" def __init__(self, monitor_seconds=20, block_seconds=300, chances=3): """Public variables: moni...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BlockedHosts: """The class that keeps track of the failed login and block further activities if a host fails to login for a number of times consecutively within a specified time window.""" def __init__(self, monitor_seconds=20, block_seconds=300, chances=3): """Public variables: monitor_time: the...
the_stack_v2_python_sparse
src/block_hosts.py
yulinghuhappy/NASA-Fan-Web-analytics
train
0
c00fe289eb2b02751a4404bf79361e1a4a5837bc
[ "try:\n sport = self.kwargs['sport']\nexcept KeyError:\n sport = 'nba'\nsite_sport_manager = sports.classes.SiteSportManager()\ninjury_serializer_class = site_sport_manager.get_tsxplayer_serializer_class(sport)\nreturn injury_serializer_class", "sport = self.kwargs['sport']\nsite_sport_manager = sports.clas...
<|body_start_0|> try: sport = self.kwargs['sport'] except KeyError: sport = 'nba' site_sport_manager = sports.classes.SiteSportManager() injury_serializer_class = site_sport_manager.get_tsxplayer_serializer_class(sport) return injury_serializer_class <|end...
gets the news for the sport
TsxPlayerNewsAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TsxPlayerNewsAPIView: """gets the news for the sport""" def get_serializer_class(self): """override for having to set the self.serializer_class""" <|body_0|> def get_queryset(self): """Return a QuerySet from the LobbyContest model.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_069427
26,966
no_license
[ { "docstring": "override for having to set the self.serializer_class", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Return a QuerySet from the LobbyContest model.", "name": "get_queryset", "signature": "def get_queryset(self)" } ]
2
stack_v2_sparse_classes_30k_train_045442
Implement the Python class `TsxPlayerNewsAPIView` described below. Class description: gets the news for the sport Method signatures and docstrings: - def get_serializer_class(self): override for having to set the self.serializer_class - def get_queryset(self): Return a QuerySet from the LobbyContest model.
Implement the Python class `TsxPlayerNewsAPIView` described below. Class description: gets the news for the sport Method signatures and docstrings: - def get_serializer_class(self): override for having to set the self.serializer_class - def get_queryset(self): Return a QuerySet from the LobbyContest model. <|skeleto...
4796fa9d88b56f80def011e2b043ce595bfce8c4
<|skeleton|> class TsxPlayerNewsAPIView: """gets the news for the sport""" def get_serializer_class(self): """override for having to set the self.serializer_class""" <|body_0|> def get_queryset(self): """Return a QuerySet from the LobbyContest model.""" <|body_1|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TsxPlayerNewsAPIView: """gets the news for the sport""" def get_serializer_class(self): """override for having to set the self.serializer_class""" try: sport = self.kwargs['sport'] except KeyError: sport = 'nba' site_sport_manager = sports.classes.S...
the_stack_v2_python_sparse
sports/views.py
nakamotohideyoshi/draftboard-web
train
0
98eb79ca1ba9175e18f884f14c13083c5fb0e78e
[ "def rserialize(root: 'TreeNode', string: str) -> str:\n if not root:\n string += 'None,'\n string += str(root.val) + ','\n string = rserialize(root.left, string)\n string = rserialize(root.right, string)\n return string\nreturn rserialize(root, '')", "def rdeserialize(tree: List[str]) -> 'T...
<|body_start_0|> def rserialize(root: 'TreeNode', string: str) -> str: if not root: string += 'None,' string += str(root.val) + ',' string = rserialize(root.left, string) string = rserialize(root.right, string) return string ret...
Approach: DFS Time Complexity: O(N) Space Complexity: O(N)
Tree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tree: """Approach: DFS Time Complexity: O(N) Space Complexity: O(N)""" def serialize(self, root: 'TreeNode') -> str: """Serializes given Binary Search Tree :param root: :return:""" <|body_0|> def deserialize(self, data: str) -> 'TreeNode': """Deserializes given s...
stack_v2_sparse_classes_75kplus_train_069428
1,379
no_license
[ { "docstring": "Serializes given Binary Search Tree :param root: :return:", "name": "serialize", "signature": "def serialize(self, root: 'TreeNode') -> str" }, { "docstring": "Deserializes given string into binary search. :param data: :return:", "name": "deserialize", "signature": "def d...
2
null
Implement the Python class `Tree` described below. Class description: Approach: DFS Time Complexity: O(N) Space Complexity: O(N) Method signatures and docstrings: - def serialize(self, root: 'TreeNode') -> str: Serializes given Binary Search Tree :param root: :return: - def deserialize(self, data: str) -> 'TreeNode':...
Implement the Python class `Tree` described below. Class description: Approach: DFS Time Complexity: O(N) Space Complexity: O(N) Method signatures and docstrings: - def serialize(self, root: 'TreeNode') -> str: Serializes given Binary Search Tree :param root: :return: - def deserialize(self, data: str) -> 'TreeNode':...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Tree: """Approach: DFS Time Complexity: O(N) Space Complexity: O(N)""" def serialize(self, root: 'TreeNode') -> str: """Serializes given Binary Search Tree :param root: :return:""" <|body_0|> def deserialize(self, data: str) -> 'TreeNode': """Deserializes given s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Tree: """Approach: DFS Time Complexity: O(N) Space Complexity: O(N)""" def serialize(self, root: 'TreeNode') -> str: """Serializes given Binary Search Tree :param root: :return:""" def rserialize(root: 'TreeNode', string: str) -> str: if not root: string += 'No...
the_stack_v2_python_sparse
revisited/trees/serialize_deserialize_bst.py
Shiv2157k/leet_code
train
1
f74120235cfced49f55798b4bf7d36fd68e3188f
[ "def preorder(root):\n if not root:\n return []\n return [root.val] + preorder(root.left) + preorder(root.right)\nreturn ' '.join([str(i) for i in preorder(root)])", "data = [int(i) for i in data.split()]\n\ndef buildTree(data):\n if not data:\n return None\n root = TreeNode(data[0])\n ...
<|body_start_0|> def preorder(root): if not root: return [] return [root.val] + preorder(root.left) + preorder(root.right) return ' '.join([str(i) for i in preorder(root)]) <|end_body_0|> <|body_start_1|> data = [int(i) for i in data.split()] def...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_069429
1,346
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_017305
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:...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preorder(root): if not root: return [] return [root.val] + preorder(root.left) + preorder(root.right) return ' '.join([str(i) for i in...
the_stack_v2_python_sparse
0449_Serialize_and_Deserialize_BST.py
bingli8802/leetcode
train
0
ba15fad56bd4f6c18272cfa531f6554ba3b2e985
[ "self.env = env\nself.buffer = buffer\nself.agent = agent\nself.maximize = maximize\nself.batch_size = batch_size", "terminal = False\nx = self.env.reset()\ncosts = []\ntraj = [x]\nus = []\ni = 0\nwhile i < episode_length:\n u = policy(x)\n x_next, cost, terminal, _ = self.env.step(u)\n if self.maximize:...
<|body_start_0|> self.env = env self.buffer = buffer self.agent = agent self.maximize = maximize self.batch_size = batch_size <|end_body_0|> <|body_start_1|> terminal = False x = self.env.reset() costs = [] traj = [x] us = [] i = 0...
A learner class to control DDPG training process.
DDPGLearner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DDPGLearner: """A learner class to control DDPG training process.""" def __init__(self, env, buffer, agent, maximize=False, batch_size=128): """Initialize learner object. Args: env: the environment; buffer: a ReplayBuffer instance; agent: a DPPGAgent instance; maximize: whether to ma...
stack_v2_sparse_classes_75kplus_train_069430
4,422
no_license
[ { "docstring": "Initialize learner object. Args: env: the environment; buffer: a ReplayBuffer instance; agent: a DPPGAgent instance; maximize: whether to maximize the reward sequence. If set True the learner would try to maximize the environment rewards, or the learner would minimize the cost; batch_size: sampl...
3
null
Implement the Python class `DDPGLearner` described below. Class description: A learner class to control DDPG training process. Method signatures and docstrings: - def __init__(self, env, buffer, agent, maximize=False, batch_size=128): Initialize learner object. Args: env: the environment; buffer: a ReplayBuffer insta...
Implement the Python class `DDPGLearner` described below. Class description: A learner class to control DDPG training process. Method signatures and docstrings: - def __init__(self, env, buffer, agent, maximize=False, batch_size=128): Initialize learner object. Args: env: the environment; buffer: a ReplayBuffer insta...
44eff6d17e4da0b0adc85e5e84cf4b8edb8a1bb8
<|skeleton|> class DDPGLearner: """A learner class to control DDPG training process.""" def __init__(self, env, buffer, agent, maximize=False, batch_size=128): """Initialize learner object. Args: env: the environment; buffer: a ReplayBuffer instance; agent: a DPPGAgent instance; maximize: whether to ma...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DDPGLearner: """A learner class to control DDPG training process.""" def __init__(self, env, buffer, agent, maximize=False, batch_size=128): """Initialize learner object. Args: env: the environment; buffer: a ReplayBuffer instance; agent: a DPPGAgent instance; maximize: whether to maximize the re...
the_stack_v2_python_sparse
Project/learners/ddpg_learner.py
peng00bo00/optlearningcontrol
train
0
1e413ecc1e6295cae223887a236bb81c47fbdbbc
[ "if not isinstance(estimator, PropensityEstimator):\n raise TypeError(f'PropensityPredictor must be initialized with PropensityEstimator. Received ({type(estimator)}) instead.')\nsuper().__init__(estimator)", "propensity = self.estimator.compute_propensity(X, a, treatment_values=a.max())\npropensity_matrix = s...
<|body_start_0|> if not isinstance(estimator, PropensityEstimator): raise TypeError(f'PropensityPredictor must be initialized with PropensityEstimator. Received ({type(estimator)}) instead.') super().__init__(estimator) <|end_body_0|> <|body_start_1|> propensity = self.estimator.com...
Generate evaluation predictions for PropensityEstimator models.
PropensityPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropensityPredictor: """Generate evaluation predictions for PropensityEstimator models.""" def __init__(self, estimator): """Args: estimator (PropensityEstimator):""" <|body_0|> def predict(self, X, a): """Predict on data. Args: X (pd.DataFrame): Covariates. a (p...
stack_v2_sparse_classes_75kplus_train_069431
8,664
permissive
[ { "docstring": "Args: estimator (PropensityEstimator):", "name": "__init__", "signature": "def __init__(self, estimator)" }, { "docstring": "Predict on data. Args: X (pd.DataFrame): Covariates. a (pd.Series): Target variable - treatment assignment Returns: PropensityEvaluatorPredictions", "n...
2
stack_v2_sparse_classes_30k_train_038426
Implement the Python class `PropensityPredictor` described below. Class description: Generate evaluation predictions for PropensityEstimator models. Method signatures and docstrings: - def __init__(self, estimator): Args: estimator (PropensityEstimator): - def predict(self, X, a): Predict on data. Args: X (pd.DataFra...
Implement the Python class `PropensityPredictor` described below. Class description: Generate evaluation predictions for PropensityEstimator models. Method signatures and docstrings: - def __init__(self, estimator): Args: estimator (PropensityEstimator): - def predict(self, X, a): Predict on data. Args: X (pd.DataFra...
9f0ddb4696d580cf0a529a6c6ce98b40b34e3796
<|skeleton|> class PropensityPredictor: """Generate evaluation predictions for PropensityEstimator models.""" def __init__(self, estimator): """Args: estimator (PropensityEstimator):""" <|body_0|> def predict(self, X, a): """Predict on data. Args: X (pd.DataFrame): Covariates. a (p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PropensityPredictor: """Generate evaluation predictions for PropensityEstimator models.""" def __init__(self, estimator): """Args: estimator (PropensityEstimator):""" if not isinstance(estimator, PropensityEstimator): raise TypeError(f'PropensityPredictor must be initialized w...
the_stack_v2_python_sparse
causallib/evaluation/predictor.py
vishalbelsare/causallib
train
0
4c6239f5ddb71c3de9b07c7505d6a31476befa3a
[ "try:\n filters = {'building': building, 'level': int(level), 'pos_x': int(pos_x), 'pos_y': int(pos_y)}\nexcept:\n return ({'message': 'Please input valid number for level, pos_x, and pos_y.'}, 404)\nnav_node = NavNodeModel.find_nav_node_by_pos(**filters)\nif nav_node:\n return ({'nav_node_result': nav_nod...
<|body_start_0|> try: filters = {'building': building, 'level': int(level), 'pos_x': int(pos_x), 'pos_y': int(pos_y)} except: return ({'message': 'Please input valid number for level, pos_x, and pos_y.'}, 404) nav_node = NavNodeModel.find_nav_node_by_pos(**filters) ...
NavNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NavNode: def get(self, building, level, pos_x, pos_y): """displays a nav point's details""" <|body_0|> def post(self, building, level, pos_x, pos_y): """adds a new nav point""" <|body_1|> def delete(self, building, level, pos_x, pos_y): """delete...
stack_v2_sparse_classes_75kplus_train_069432
18,826
permissive
[ { "docstring": "displays a nav point's details", "name": "get", "signature": "def get(self, building, level, pos_x, pos_y)" }, { "docstring": "adds a new nav point", "name": "post", "signature": "def post(self, building, level, pos_x, pos_y)" }, { "docstring": "deletes a location...
3
stack_v2_sparse_classes_30k_train_002974
Implement the Python class `NavNode` described below. Class description: Implement the NavNode class. Method signatures and docstrings: - def get(self, building, level, pos_x, pos_y): displays a nav point's details - def post(self, building, level, pos_x, pos_y): adds a new nav point - def delete(self, building, leve...
Implement the Python class `NavNode` described below. Class description: Implement the NavNode class. Method signatures and docstrings: - def get(self, building, level, pos_x, pos_y): displays a nav point's details - def post(self, building, level, pos_x, pos_y): adds a new nav point - def delete(self, building, leve...
6ad7616b5d5d3076a132b8ae68d5f8b3272877a0
<|skeleton|> class NavNode: def get(self, building, level, pos_x, pos_y): """displays a nav point's details""" <|body_0|> def post(self, building, level, pos_x, pos_y): """adds a new nav point""" <|body_1|> def delete(self, building, level, pos_x, pos_y): """delete...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NavNode: def get(self, building, level, pos_x, pos_y): """displays a nav point's details""" try: filters = {'building': building, 'level': int(level), 'pos_x': int(pos_x), 'pos_y': int(pos_y)} except: return ({'message': 'Please input valid number for level, pos...
the_stack_v2_python_sparse
flask_app/resources/navigation.py
alejwang/si699-si-hunt
train
2
23eff74093169f7840dd859b8c4942d820ed1ae2
[ "with h5py.File(self.reference_fname, 'r') as reference_fid, h5py.File(self.test_fname, 'r') as test_fid:\n ref_dset = reference_fid['slope']\n test_dset = test_fid['slope']\n npt.assert_almost_equal(test_dset, ref_dset, decimal=self.decimal_precision)", "with h5py.File(self.reference_fname, 'r') as refe...
<|body_start_0|> with h5py.File(self.reference_fname, 'r') as reference_fid, h5py.File(self.test_fname, 'r') as test_fid: ref_dset = reference_fid['slope'] test_dset = test_fid['slope'] npt.assert_almost_equal(test_dset, ref_dset, decimal=self.decimal_precision) <|end_body_0|...
Unittesting for the exiting angles computation found in `wagl.slope_aspect_arrays`. Unittests will occur for the following datasets: * slope * aspect We're not explicitly testing the function, but implicitly testing the function by comparing against an existing dataset.
TestSlopeAspect
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSlopeAspect: """Unittesting for the exiting angles computation found in `wagl.slope_aspect_arrays`. Unittests will occur for the following datasets: * slope * aspect We're not explicitly testing the function, but implicitly testing the function by comparing against an existing dataset.""" ...
stack_v2_sparse_classes_75kplus_train_069433
3,376
permissive
[ { "docstring": "Test the slope array.", "name": "test_slope", "signature": "def test_slope(self)" }, { "docstring": "Test the aspect array.", "name": "test_aspect", "signature": "def test_aspect(self)" } ]
2
null
Implement the Python class `TestSlopeAspect` described below. Class description: Unittesting for the exiting angles computation found in `wagl.slope_aspect_arrays`. Unittests will occur for the following datasets: * slope * aspect We're not explicitly testing the function, but implicitly testing the function by compar...
Implement the Python class `TestSlopeAspect` described below. Class description: Unittesting for the exiting angles computation found in `wagl.slope_aspect_arrays`. Unittests will occur for the following datasets: * slope * aspect We're not explicitly testing the function, but implicitly testing the function by compar...
4ae3670681b872530f59c57ab537a45d1b09c009
<|skeleton|> class TestSlopeAspect: """Unittesting for the exiting angles computation found in `wagl.slope_aspect_arrays`. Unittests will occur for the following datasets: * slope * aspect We're not explicitly testing the function, but implicitly testing the function by comparing against an existing dataset.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestSlopeAspect: """Unittesting for the exiting angles computation found in `wagl.slope_aspect_arrays`. Unittests will occur for the following datasets: * slope * aspect We're not explicitly testing the function, but implicitly testing the function by comparing against an existing dataset.""" def test_sl...
the_stack_v2_python_sparse
wagl/scripts/test_slope_aspect.py
GeoscienceAustralia/wagl
train
25
026ad6e94548ccffdc0ce6d63ef3bd9841dca258
[ "if group == -1:\n group = self.window.active_group()\nif group >= 0:\n persistent = is_persistent()\n views = self.window.views_in_group(int(group))\n if not persistent or force:\n for v in views:\n v.settings().erase('tabs_extra_sticky')", "if group == -1:\n group = self.window....
<|body_start_0|> if group == -1: group = self.window.active_group() if group >= 0: persistent = is_persistent() views = self.window.views_in_group(int(group)) if not persistent or force: for v in views: v.settings().eras...
Clear all sticky tabs.
TabsExtraClearAllStickyCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TabsExtraClearAllStickyCommand: """Clear all sticky tabs.""" def run(self, group=-1, force=False): """Clear all tab sticky states of current active group.""" <|body_0|> def is_visible(self, group=-1, force=False): """Show command if any tabs in active group are s...
stack_v2_sparse_classes_75kplus_train_069434
33,758
permissive
[ { "docstring": "Clear all tab sticky states of current active group.", "name": "run", "signature": "def run(self, group=-1, force=False)" }, { "docstring": "Show command if any tabs in active group are sticky.", "name": "is_visible", "signature": "def is_visible(self, group=-1, force=Fal...
2
null
Implement the Python class `TabsExtraClearAllStickyCommand` described below. Class description: Clear all sticky tabs. Method signatures and docstrings: - def run(self, group=-1, force=False): Clear all tab sticky states of current active group. - def is_visible(self, group=-1, force=False): Show command if any tabs ...
Implement the Python class `TabsExtraClearAllStickyCommand` described below. Class description: Clear all sticky tabs. Method signatures and docstrings: - def run(self, group=-1, force=False): Clear all tab sticky states of current active group. - def is_visible(self, group=-1, force=False): Show command if any tabs ...
fa9d29c3553d7e05e9cc25f3fdf3fc410944927d
<|skeleton|> class TabsExtraClearAllStickyCommand: """Clear all sticky tabs.""" def run(self, group=-1, force=False): """Clear all tab sticky states of current active group.""" <|body_0|> def is_visible(self, group=-1, force=False): """Show command if any tabs in active group are s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TabsExtraClearAllStickyCommand: """Clear all sticky tabs.""" def run(self, group=-1, force=False): """Clear all tab sticky states of current active group.""" if group == -1: group = self.window.active_group() if group >= 0: persistent = is_persistent() ...
the_stack_v2_python_sparse
tabs_extra.py
facelessuser/TabsExtra
train
84
2b893bd49218b84db13f2b67c48bef03fe32d801
[ "self.stime = stime\nself.etime = etime\nself.stype = stype\nself.beams = []\nreturn", "self.stime = self.beams[0].time\nself.etime = self.beams[-1].time\nif up:\n self._populate_avg_params()\nreturn", "f, nsky = ([], [])\nfor b in self.beams:\n f.append(getattr(b, 'tfreq'))\n nsky.append(getattr(b, 'n...
<|body_start_0|> self.stime = stime self.etime = etime self.stype = stype self.beams = [] return <|end_body_0|> <|body_start_1|> self.stime = self.beams[0].time self.etime = self.beams[-1].time if up: self._populate_avg_params() return...
Class to hold one scan (multiple beams)
Scan
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Scan: """Class to hold one scan (multiple beams)""" def __init__(self, stime=None, etime=None, stype='normal'): """initialize the parameters which will be stored stime: start time of scan etime: end time of scan stype: scan type""" <|body_0|> def update_time(self, up=Tru...
stack_v2_sparse_classes_75kplus_train_069435
14,009
permissive
[ { "docstring": "initialize the parameters which will be stored stime: start time of scan etime: end time of scan stype: scan type", "name": "__init__", "signature": "def __init__(self, stime=None, etime=None, stype='normal')" }, { "docstring": "Update stime and etime of the scan. up: Update aver...
4
stack_v2_sparse_classes_30k_train_019726
Implement the Python class `Scan` described below. Class description: Class to hold one scan (multiple beams) Method signatures and docstrings: - def __init__(self, stime=None, etime=None, stype='normal'): initialize the parameters which will be stored stime: start time of scan etime: end time of scan stype: scan typ...
Implement the Python class `Scan` described below. Class description: Class to hold one scan (multiple beams) Method signatures and docstrings: - def __init__(self, stime=None, etime=None, stype='normal'): initialize the parameters which will be stored stime: start time of scan etime: end time of scan stype: scan typ...
f11786cde6dfa156fd217fffb1f1bb17ffaa47f5
<|skeleton|> class Scan: """Class to hold one scan (multiple beams)""" def __init__(self, stime=None, etime=None, stype='normal'): """initialize the parameters which will be stored stime: start time of scan etime: end time of scan stype: scan type""" <|body_0|> def update_time(self, up=Tru...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Scan: """Class to hold one scan (multiple beams)""" def __init__(self, stime=None, etime=None, stype='normal'): """initialize the parameters which will be stored stime: start time of scan etime: end time of scan stype: scan type""" self.stime = stime self.etime = etime sel...
the_stack_v2_python_sparse
analysis/get_sd_data.py
shibaji7/clustering_superdarn_data
train
1
491d9b5d2f106627ac0a8fa63490b65a97d740f7
[ "self.original_nums = list(nums)\nfor idx, value in enumerate(nums):\n if idx == 0:\n continue\n nums[idx] += nums[idx - 1]\nself.nums = nums", "self.original_nums[i] = val\nprint(self.original_nums[i])\nprint(val)\nnew_nums = list(self.original_nums)\nif i != 0:\n new_nums[0:i - 1] = list(self.nu...
<|body_start_0|> self.original_nums = list(nums) for idx, value in enumerate(nums): if idx == 0: continue nums[idx] += nums[idx - 1] self.nums = nums <|end_body_0|> <|body_start_1|> self.original_nums[i] = val print(self.original_nums[i]) ...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_069436
2,318
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
1dec441f1975d402d093031569cfd301eb71d465
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.original_nums = list(nums) for idx, value in enumerate(nums): if idx == 0: continue nums[idx] += nums[idx - 1] self.nums = nums def update(self, i, val): ""...
the_stack_v2_python_sparse
307-range-sum-query-mutable.py
franktank/py-practice
train
1
a33d9ebca4a7476b41a3c0ab88702e913a5d60ba
[ "self.mode = mode\nself.allowed_urls = allowed_urls\nself.allowed_files = allowed_files", "if dictionary is None:\n return None\nmode = dictionary.get('mode')\nallowed_urls = None\nif dictionary.get('allowedUrls') != None:\n allowed_urls = list()\n for structure in dictionary.get('allowedUrls'):\n ...
<|body_start_0|> self.mode = mode self.allowed_urls = allowed_urls self.allowed_files = allowed_files <|end_body_0|> <|body_start_1|> if dictionary is None: return None mode = dictionary.get('mode') allowed_urls = None if dictionary.get('allowedUrls')...
Implementation of the 'updateNetworkSecurityMalwareSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled' allowed_urls (list of AllowedUrlModel): The urls that should be permitted by the malware detection engine. If omitted...
UpdateNetworkSecurityMalwareSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSecurityMalwareSettingsModel: """Implementation of the 'updateNetworkSecurityMalwareSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled' allowed_urls (list of AllowedUrlModel): The urls...
stack_v2_sparse_classes_75kplus_train_069437
3,077
permissive
[ { "docstring": "Constructor for the UpdateNetworkSecurityMalwareSettingsModel class", "name": "__init__", "signature": "def __init__(self, mode=None, allowed_urls=None, allowed_files=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A di...
2
stack_v2_sparse_classes_30k_train_019392
Implement the Python class `UpdateNetworkSecurityMalwareSettingsModel` described below. Class description: Implementation of the 'updateNetworkSecurityMalwareSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled' allowed_u...
Implement the Python class `UpdateNetworkSecurityMalwareSettingsModel` described below. Class description: Implementation of the 'updateNetworkSecurityMalwareSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled' allowed_u...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSecurityMalwareSettingsModel: """Implementation of the 'updateNetworkSecurityMalwareSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled' allowed_urls (list of AllowedUrlModel): The urls...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateNetworkSecurityMalwareSettingsModel: """Implementation of the 'updateNetworkSecurityMalwareSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'enabled' to enable malware prevention, otherwise 'disabled' allowed_urls (list of AllowedUrlModel): The urls that should ...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_security_malware_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
e75bc8dfd195bd24d42567033ec42a57f1c517f8
[ "try:\n the_data = json.dumps(self.decrypt_long_data(request.body), ensure_ascii=False)\n json_formated = json.loads(the_data)\n json_decoded = json.loads(json_formated)\n instance = self.get_object()\n instance.name = json_decoded['name']\n instance.description = json_decoded['description']\n ...
<|body_start_0|> try: the_data = json.dumps(self.decrypt_long_data(request.body), ensure_ascii=False) json_formated = json.loads(the_data) json_decoded = json.loads(json_formated) instance = self.get_object() instance.name = json_decoded['name'] ...
TaskRetrieveUpdateDestroyAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskRetrieveUpdateDestroyAPIView: def update(self, request, *args, **kwargs): """update model with pk""" <|body_0|> def destroy(self, request, *args, **kwargs): """delete object with id""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_75kplus_train_069438
7,130
no_license
[ { "docstring": "update model with pk", "name": "update", "signature": "def update(self, request, *args, **kwargs)" }, { "docstring": "delete object with id", "name": "destroy", "signature": "def destroy(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_014683
Implement the Python class `TaskRetrieveUpdateDestroyAPIView` described below. Class description: Implement the TaskRetrieveUpdateDestroyAPIView class. Method signatures and docstrings: - def update(self, request, *args, **kwargs): update model with pk - def destroy(self, request, *args, **kwargs): delete object with...
Implement the Python class `TaskRetrieveUpdateDestroyAPIView` described below. Class description: Implement the TaskRetrieveUpdateDestroyAPIView class. Method signatures and docstrings: - def update(self, request, *args, **kwargs): update model with pk - def destroy(self, request, *args, **kwargs): delete object with...
ddcaf61932588200f57cd9de246d45a4015eab24
<|skeleton|> class TaskRetrieveUpdateDestroyAPIView: def update(self, request, *args, **kwargs): """update model with pk""" <|body_0|> def destroy(self, request, *args, **kwargs): """delete object with id""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TaskRetrieveUpdateDestroyAPIView: def update(self, request, *args, **kwargs): """update model with pk""" try: the_data = json.dumps(self.decrypt_long_data(request.body), ensure_ascii=False) json_formated = json.loads(the_data) json_decoded = json.loads(json_...
the_stack_v2_python_sparse
admin_ext/api_views.py
BALPRES/BALPRES_BE
train
0
cb2d9a600cf46fd9cd5dfb93c3747bdee3c125ba
[ "email = self.cleaned_data.get('email')\nif User.objects.filter(email__iexact=email):\n message = 'Email already registered!'\n raise ValidationError(message)\nreturn email", "username = self.cleaned_data.get('username')\nif User.objects.filter(username__iexact=username):\n message = 'Username already re...
<|body_start_0|> email = self.cleaned_data.get('email') if User.objects.filter(email__iexact=email): message = 'Email already registered!' raise ValidationError(message) return email <|end_body_0|> <|body_start_1|> username = self.cleaned_data.get('username') ...
Extending UserCreationForm Performs case insensitive check for email and username to make sure they're not already registered.
UserRegistrationForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRegistrationForm: """Extending UserCreationForm Performs case insensitive check for email and username to make sure they're not already registered.""" def clean_email(self): """Check if email already registered (case insensitive check)""" <|body_0|> def clean_usernam...
stack_v2_sparse_classes_75kplus_train_069439
4,777
no_license
[ { "docstring": "Check if email already registered (case insensitive check)", "name": "clean_email", "signature": "def clean_email(self)" }, { "docstring": "Check if username already registered (case insensitive check)", "name": "clean_username", "signature": "def clean_username(self)" ...
2
stack_v2_sparse_classes_30k_train_036168
Implement the Python class `UserRegistrationForm` described below. Class description: Extending UserCreationForm Performs case insensitive check for email and username to make sure they're not already registered. Method signatures and docstrings: - def clean_email(self): Check if email already registered (case insens...
Implement the Python class `UserRegistrationForm` described below. Class description: Extending UserCreationForm Performs case insensitive check for email and username to make sure they're not already registered. Method signatures and docstrings: - def clean_email(self): Check if email already registered (case insens...
2673181f3b7fd95be4441a2171f1318f17dfd85e
<|skeleton|> class UserRegistrationForm: """Extending UserCreationForm Performs case insensitive check for email and username to make sure they're not already registered.""" def clean_email(self): """Check if email already registered (case insensitive check)""" <|body_0|> def clean_usernam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserRegistrationForm: """Extending UserCreationForm Performs case insensitive check for email and username to make sure they're not already registered.""" def clean_email(self): """Check if email already registered (case insensitive check)""" email = self.cleaned_data.get('email') ...
the_stack_v2_python_sparse
accounts/forms.py
faisalae/RTarchViz
train
0
396071bcdee9ab2b031b084f18bd2aea6abd682d
[ "self.fs_type = fs_type\nself.image = image\nself.keyring = keyring\nself.monitors = monitors\nself.pool = pool\nself.read_only = read_only\nself.secret_ref = secret_ref\nself.user = user", "if dictionary is None:\n return None\nfs_type = dictionary.get('fsType')\nimage = dictionary.get('image')\nkeyring = dic...
<|body_start_0|> self.fs_type = fs_type self.image = image self.keyring = keyring self.monitors = monitors self.pool = pool self.read_only = read_only self.secret_ref = secret_ref self.user = user <|end_body_0|> <|body_start_1|> if dictionary is N...
Implementation of the 'PodInfo_PodSpec_VolumeInfo_RBD' model. Represents a Rados Block Device mount that lasts the lifetime of a pod. Attributes: fs_type (string): TODO: Type description here. image (string): TODO: Type description here. keyring (string): TODO: Type description here. monitors (list of string): TODO: Ty...
PodInfo_PodSpec_VolumeInfo_RBD
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PodInfo_PodSpec_VolumeInfo_RBD: """Implementation of the 'PodInfo_PodSpec_VolumeInfo_RBD' model. Represents a Rados Block Device mount that lasts the lifetime of a pod. Attributes: fs_type (string): TODO: Type description here. image (string): TODO: Type description here. keyring (string): TODO: ...
stack_v2_sparse_classes_75kplus_train_069440
3,022
permissive
[ { "docstring": "Constructor for the PodInfo_PodSpec_VolumeInfo_RBD class", "name": "__init__", "signature": "def __init__(self, fs_type=None, image=None, keyring=None, monitors=None, pool=None, read_only=None, secret_ref=None, user=None)" }, { "docstring": "Creates an instance of this model from...
2
stack_v2_sparse_classes_30k_train_021596
Implement the Python class `PodInfo_PodSpec_VolumeInfo_RBD` described below. Class description: Implementation of the 'PodInfo_PodSpec_VolumeInfo_RBD' model. Represents a Rados Block Device mount that lasts the lifetime of a pod. Attributes: fs_type (string): TODO: Type description here. image (string): TODO: Type des...
Implement the Python class `PodInfo_PodSpec_VolumeInfo_RBD` described below. Class description: Implementation of the 'PodInfo_PodSpec_VolumeInfo_RBD' model. Represents a Rados Block Device mount that lasts the lifetime of a pod. Attributes: fs_type (string): TODO: Type description here. image (string): TODO: Type des...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PodInfo_PodSpec_VolumeInfo_RBD: """Implementation of the 'PodInfo_PodSpec_VolumeInfo_RBD' model. Represents a Rados Block Device mount that lasts the lifetime of a pod. Attributes: fs_type (string): TODO: Type description here. image (string): TODO: Type description here. keyring (string): TODO: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PodInfo_PodSpec_VolumeInfo_RBD: """Implementation of the 'PodInfo_PodSpec_VolumeInfo_RBD' model. Represents a Rados Block Device mount that lasts the lifetime of a pod. Attributes: fs_type (string): TODO: Type description here. image (string): TODO: Type description here. keyring (string): TODO: Type descript...
the_stack_v2_python_sparse
cohesity_management_sdk/models/pod_info_pod_spec_volume_info_rbd.py
cohesity/management-sdk-python
train
24
024dd4d041afd8f16c32f6309357eaec0c7e868d
[ "parts = expression.split()\nif parts[0] == 'help':\n if len(parts) == 2:\n return True\nreturn False", "target_name = expression.split()[1]\ntarget_command = commands.find(target_name)\nreturn target_command.description" ]
<|body_start_0|> parts = expression.split() if parts[0] == 'help': if len(parts) == 2: return True return False <|end_body_0|> <|body_start_1|> target_name = expression.split()[1] target_command = commands.find(target_name) return target_comma...
SpecificHelp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpecificHelp: def matches(self, expression): """>>> specific_help = SpecificHelp() >>> specific_help.matches('help foo') True >>> specific_help.matches(' help foo ') True Accept just one parameter for now >>> specific_help.matches('help foo bar') False""" <|body_0|> def exec...
stack_v2_sparse_classes_75kplus_train_069441
1,255
no_license
[ { "docstring": ">>> specific_help = SpecificHelp() >>> specific_help.matches('help foo') True >>> specific_help.matches(' help foo ') True Accept just one parameter for now >>> specific_help.matches('help foo bar') False", "name": "matches", "signature": "def matches(self, expression)" }, { "doc...
2
null
Implement the Python class `SpecificHelp` described below. Class description: Implement the SpecificHelp class. Method signatures and docstrings: - def matches(self, expression): >>> specific_help = SpecificHelp() >>> specific_help.matches('help foo') True >>> specific_help.matches(' help foo ') True Accept just one ...
Implement the Python class `SpecificHelp` described below. Class description: Implement the SpecificHelp class. Method signatures and docstrings: - def matches(self, expression): >>> specific_help = SpecificHelp() >>> specific_help.matches('help foo') True >>> specific_help.matches(' help foo ') True Accept just one ...
9fb74ff71c3a7cd5763145f4ed328647d0cd70bc
<|skeleton|> class SpecificHelp: def matches(self, expression): """>>> specific_help = SpecificHelp() >>> specific_help.matches('help foo') True >>> specific_help.matches(' help foo ') True Accept just one parameter for now >>> specific_help.matches('help foo bar') False""" <|body_0|> def exec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpecificHelp: def matches(self, expression): """>>> specific_help = SpecificHelp() >>> specific_help.matches('help foo') True >>> specific_help.matches(' help foo ') True Accept just one parameter for now >>> specific_help.matches('help foo bar') False""" parts = expression.split() if ...
the_stack_v2_python_sparse
placidity/part9/placidity/placidity/commands/specifichelp/specifichelp.py
bebraw/nixtu
train
0
a8c55b3ddd7df48597f06f47a0b647cc95e6dfdb
[ "pygame.sprite.Sprite.__init__(self)\nsprite_sheet = SpriteSheet('Golem.png')\nimage = sprite_sheet.get_image(262, 471, 272, 47)\nself.image = image\nself.rect = self.image.get_rect()\nself.rect.x = 400\nself.rect.y = -47\nself.change_y = 0\nself.bounce = 0\nself.count = 0\nself.beginCount = False", "if self.rect...
<|body_start_0|> pygame.sprite.Sprite.__init__(self) sprite_sheet = SpriteSheet('Golem.png') image = sprite_sheet.get_image(262, 471, 272, 47) self.image = image self.rect = self.image.get_rect() self.rect.x = 400 self.rect.y = -47 self.change_y = 0 ...
win
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class win: def __init__(self): """This initializes the boss Variables: sprite_sheet: The spritesheet to where the custom sprites came from image: Holds the custom self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite ...
stack_v2_sparse_classes_75kplus_train_069442
2,788
no_license
[ { "docstring": "This initializes the boss Variables: sprite_sheet: The spritesheet to where the custom sprites came from image: Holds the custom self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite self.rect.y: The y-position of the s...
2
stack_v2_sparse_classes_30k_train_010085
Implement the Python class `win` described below. Class description: Implement the win class. Method signatures and docstrings: - def __init__(self): This initializes the boss Variables: sprite_sheet: The spritesheet to where the custom sprites came from image: Holds the custom self.image: The sprite used to represen...
Implement the Python class `win` described below. Class description: Implement the win class. Method signatures and docstrings: - def __init__(self): This initializes the boss Variables: sprite_sheet: The spritesheet to where the custom sprites came from image: Holds the custom self.image: The sprite used to represen...
56fbcfc786dfc373f477270468f06e31b6271749
<|skeleton|> class win: def __init__(self): """This initializes the boss Variables: sprite_sheet: The spritesheet to where the custom sprites came from image: Holds the custom self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class win: def __init__(self): """This initializes the boss Variables: sprite_sheet: The spritesheet to where the custom sprites came from image: Holds the custom self.image: The sprite used to represent self.rect: This creates the shape of the sprite self.rect.x: The x-position of the sprite self.rect.y: T...
the_stack_v2_python_sparse
Doki Doki Island/winning.py
cashpop5000/DokiProject
train
0
7678c0146afcfe24fad1401d4474d098fa05d29c
[ "super(SourceDatasetSearchForm, self).__init__(*args, **kwargs)\nself.helper = FormHelper(self)\nself.helper.form_method = 'get'\nself.helper.form_class = 'form-horizontal'\nself.helper.label_class = 'col-sm-2'\nself.helper.field_class = 'col-sm-10'\nself.helper.layout = Layout(Row(Div(name_checkbox_layout, 'descri...
<|body_start_0|> super(SourceDatasetSearchForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.form_method = 'get' self.helper.form_class = 'form-horizontal' self.helper.label_class = 'col-sm-2' self.helper.field_class = 'col-sm-10' sel...
Form to handle django-watson searches for SourceDataset objects.
SourceDatasetSearchForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceDatasetSearchForm: """Form to handle django-watson searches for SourceDataset objects.""" def __init__(self, *args, **kwargs): """Initialize form with formatting and submit button.""" <|body_0|> def clean(self): """Perform additional multi-field cleaning to...
stack_v2_sparse_classes_75kplus_train_069443
19,577
permissive
[ { "docstring": "Initialize form with formatting and submit button.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Perform additional multi-field cleaning to make sure that either description or name is entered.", "name": "clean", "signature": ...
2
stack_v2_sparse_classes_30k_train_037797
Implement the Python class `SourceDatasetSearchForm` described below. Class description: Form to handle django-watson searches for SourceDataset objects. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize form with formatting and submit button. - def clean(self): Perform additional mu...
Implement the Python class `SourceDatasetSearchForm` described below. Class description: Form to handle django-watson searches for SourceDataset objects. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize form with formatting and submit button. - def clean(self): Perform additional mu...
89ae277f5ba1357580d78c3527f26200686308a6
<|skeleton|> class SourceDatasetSearchForm: """Form to handle django-watson searches for SourceDataset objects.""" def __init__(self, *args, **kwargs): """Initialize form with formatting and submit button.""" <|body_0|> def clean(self): """Perform additional multi-field cleaning to...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceDatasetSearchForm: """Form to handle django-watson searches for SourceDataset objects.""" def __init__(self, *args, **kwargs): """Initialize form with formatting and submit button.""" super(SourceDatasetSearchForm, self).__init__(*args, **kwargs) self.helper = FormHelper(sel...
the_stack_v2_python_sparse
trait_browser/forms.py
UW-GAC/pie
train
0
066e8d594f796f6fd355e45ad629baa9d50f38d9
[ "d = collections.defaultdict(int)\nd[0] = 1\nsum = 0\nans = 0\nfor n in nums:\n sum += n\n if sum - k in d:\n ans += d[sum - k]\n d[sum] += 1\nreturn ans", "d = {0: 1}\nsum, ans = (0, 0)\nfor n in nums:\n sum += n\n if sum - k in d:\n ans += d[sum - k]\n if sum in d:\n d[sum...
<|body_start_0|> d = collections.defaultdict(int) d[0] = 1 sum = 0 ans = 0 for n in nums: sum += n if sum - k in d: ans += d[sum - k] d[sum] += 1 return ans <|end_body_0|> <|body_start_1|> d = {0: 1} sum...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subarraySum1(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = collecti...
stack_v2_sparse_classes_75kplus_train_069444
984
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "subarraySum1", "signature": "def subarraySum1(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "subarraySum", "signature": "def subarraySum(self, nums, k)" } ]
2
stack_v2_sparse_classes_30k_train_023437
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum1(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subarraySum1(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int <|skeleton|> cla...
763674fcbe271af3d21eed790c3968c4d33f7b09
<|skeleton|> class Solution: def subarraySum1(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def subarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subarraySum1(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" d = collections.defaultdict(int) d[0] = 1 sum = 0 ans = 0 for n in nums: sum += n if sum - k in d: ans += d[sum - k] ...
the_stack_v2_python_sparse
560_subarray_sum_equals_k/560.py
guzhoudiaoke/leetcode_python3
train
0
614db3036f2f7ed0a3f09ba39e0b907fe1057a86
[ "self.attr_dict = {}\nfor key, val in attr_dict.iteritems():\n self.attr_dict[key] = list(val)", "try:\n newlist = [x for x in self.attr_dict[attr]]\n return newlist\nexcept KeyError:\n return []", "try:\n self.attr_dict[attr].remove(user)\nexcept ValueError:\n pass\nexcept KeyError:\n pass...
<|body_start_0|> self.attr_dict = {} for key, val in attr_dict.iteritems(): self.attr_dict[key] = list(val) <|end_body_0|> <|body_start_1|> try: newlist = [x for x in self.attr_dict[attr]] return newlist except KeyError: return [] <|end_bo...
Simple attribute store that references a static dictionary passed in at initialization. Fields: attr_dict : {string -> [string]} - a dictionary mapping attribute strings to lists of users.
LocalAttrUserMap
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocalAttrUserMap: """Simple attribute store that references a static dictionary passed in at initialization. Fields: attr_dict : {string -> [string]} - a dictionary mapping attribute strings to lists of users.""" def __init__(self, attr_dict): """Initialize the attribute-to-user map ...
stack_v2_sparse_classes_75kplus_train_069445
3,573
permissive
[ { "docstring": "Initialize the attribute-to-user map with a provided dictionary.", "name": "__init__", "signature": "def __init__(self, attr_dict)" }, { "docstring": "Return the list of all users who are currently authorized to read data with the given attribute. Arguments: attr : string - the a...
3
stack_v2_sparse_classes_30k_train_051207
Implement the Python class `LocalAttrUserMap` described below. Class description: Simple attribute store that references a static dictionary passed in at initialization. Fields: attr_dict : {string -> [string]} - a dictionary mapping attribute strings to lists of users. Method signatures and docstrings: - def __init_...
Implement the Python class `LocalAttrUserMap` described below. Class description: Simple attribute store that references a static dictionary passed in at initialization. Fields: attr_dict : {string -> [string]} - a dictionary mapping attribute strings to lists of users. Method signatures and docstrings: - def __init_...
eb61250886e51647bd1edb6d8f4fa7f83eb0bc81
<|skeleton|> class LocalAttrUserMap: """Simple attribute store that references a static dictionary passed in at initialization. Fields: attr_dict : {string -> [string]} - a dictionary mapping attribute strings to lists of users.""" def __init__(self, attr_dict): """Initialize the attribute-to-user map ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocalAttrUserMap: """Simple attribute store that references a static dictionary passed in at initialization. Fields: attr_dict : {string -> [string]} - a dictionary mapping attribute strings to lists of users.""" def __init__(self, attr_dict): """Initialize the attribute-to-user map with a provid...
the_stack_v2_python_sparse
pace/pki/attrusermap.py
Global-localhost/PACE-python
train
0
5f668d66c245ee150a4b78534839dc3a55f76cfa
[ "try:\n args = parser.parse_args()\n action = args['action']\n if action == 'rescan':\n DBSubdomainResult.delete_by_tid(tid)\n DBSubdomainTask.update_by_id(tid, {'date': int(time.time()), 'status': 'waiting', 'end_date': 0})\n cid = t_subdomain_task.delay(tid)\n DBSubdomainTask....
<|body_start_0|> try: args = parser.parse_args() action = args['action'] if action == 'rescan': DBSubdomainResult.delete_by_tid(tid) DBSubdomainTask.update_by_id(tid, {'date': int(time.time()), 'status': 'waiting', 'end_date': 0}) ...
SubdomainTaskManageV1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubdomainTaskManageV1: def put(self, tid): """task rescan""" <|body_0|> def delete(self, tid): """delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_75kplus_train_069446
8,221
permissive
[ { "docstring": "task rescan", "name": "put", "signature": "def put(self, tid)" }, { "docstring": "delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:", "name": "delete", "signature": "def delete(self, tid)" } ]
2
stack_v2_sparse_classes_30k_train_010508
Implement the Python class `SubdomainTaskManageV1` described below. Class description: Implement the SubdomainTaskManageV1 class. Method signatures and docstrings: - def put(self, tid): task rescan - def delete(self, tid): delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:
Implement the Python class `SubdomainTaskManageV1` described below. Class description: Implement the SubdomainTaskManageV1 class. Method signatures and docstrings: - def put(self, tid): task rescan - def delete(self, tid): delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return: <|sk...
fadb1136b8896fe2a0f7783627bda867d5e6fd98
<|skeleton|> class SubdomainTaskManageV1: def put(self, tid): """task rescan""" <|body_0|> def delete(self, tid): """delete task by task_id DELETE /api/v1/discovery/subdomain/task/<tid> :param tid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubdomainTaskManageV1: def put(self, tid): """task rescan""" try: args = parser.parse_args() action = args['action'] if action == 'rescan': DBSubdomainResult.delete_by_tid(tid) DBSubdomainTask.update_by_id(tid, {'date': int(ti...
the_stack_v2_python_sparse
fuxi/web/api/discovery/subdomain_api.py
Solotov/fuxi
train
0
67c3136048229d5169497fbaefa6e09455fa5af5
[ "goalking_qs = GoalKing.objects.by_season(season).select_related('member__user')\ngoalking_list = [x for x in goalking_qs if x.total_goals > 0]\nif len(goalking_list) > 0:\n m_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Male]\n l_list = [x for x in goalking_list if x.member.gender == ...
<|body_start_0|> goalking_qs = GoalKing.objects.by_season(season).select_related('member__user') goalking_list = [x for x in goalking_qs if x.total_goals > 0] if len(goalking_list) > 0: m_list = [x for x in goalking_list if x.member.gender == Member.GENDER.Male] l_list = ...
Provides useful methods for GoalKing related views
GoalKingMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GoalKingMixin: """Provides useful methods for GoalKing related views""" def get_goalking_list(self, season): """Returns a list of GoalKing items for the specified season""" <|body_0|> def apply_ranking(self, goalking_list): """Adds a rank attribute to each GoalKi...
stack_v2_sparse_classes_75kplus_train_069447
21,351
no_license
[ { "docstring": "Returns a list of GoalKing items for the specified season", "name": "get_goalking_list", "signature": "def get_goalking_list(self, season)" }, { "docstring": "Adds a rank attribute to each GoalKing instance in the given list based on the total number of goals scored by that perso...
2
stack_v2_sparse_classes_30k_train_011443
Implement the Python class `GoalKingMixin` described below. Class description: Provides useful methods for GoalKing related views Method signatures and docstrings: - def get_goalking_list(self, season): Returns a list of GoalKing items for the specified season - def apply_ranking(self, goalking_list): Adds a rank att...
Implement the Python class `GoalKingMixin` described below. Class description: Provides useful methods for GoalKing related views Method signatures and docstrings: - def get_goalking_list(self, season): Returns a list of GoalKing items for the specified season - def apply_ranking(self, goalking_list): Adds a rank att...
f38e1984064bdf81f05b86f4650824dd28946c19
<|skeleton|> class GoalKingMixin: """Provides useful methods for GoalKing related views""" def get_goalking_list(self, season): """Returns a list of GoalKing items for the specified season""" <|body_0|> def apply_ranking(self, goalking_list): """Adds a rank attribute to each GoalKi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GoalKingMixin: """Provides useful methods for GoalKing related views""" def get_goalking_list(self, season): """Returns a list of GoalKing items for the specified season""" goalking_qs = GoalKing.objects.by_season(season).select_related('member__user') goalking_list = [x for x in ...
the_stack_v2_python_sparse
cshcsite/matches/views.py
cshc/cshc_website
train
2
4ab7d129b91ba68b9da6fe093a628e80d0e7d202
[ "def find_path(node: TreeNode, target: TreeNode, path: List[TreeNode]) -> bool:\n \"\"\"Find the path to the specified node.\"\"\"\n if not node:\n return False\n path.append(node)\n if node == target:\n return True\n if find_path(node.left, target, path) or find_path(node.right, target...
<|body_start_0|> def find_path(node: TreeNode, target: TreeNode, path: List[TreeNode]) -> bool: """Find the path to the specified node.""" if not node: return False path.append(node) if node == target: return True if fin...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor_v1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """By finding paths from root to p and from root to q. Need to traverse the tree twice. Complexity: O(n) x 2""" <|body_0|> def lowestCommonAncestor_v2(self, root: TreeNode, p: ...
stack_v2_sparse_classes_75kplus_train_069448
5,303
no_license
[ { "docstring": "By finding paths from root to p and from root to q. Need to traverse the tree twice. Complexity: O(n) x 2", "name": "lowestCommonAncestor_v1", "signature": "def lowestCommonAncestor_v1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode" }, { "docstring": "Use one travers...
3
stack_v2_sparse_classes_30k_test_002208
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_v1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: By finding paths from root to p and from root to q. Need to traverse the tree twice. Comp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_v1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: By finding paths from root to p and from root to q. Need to traverse the tree twice. Comp...
97a2386f5e3adbd7138fd123810c3232bdf7f622
<|skeleton|> class Solution: def lowestCommonAncestor_v1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """By finding paths from root to p and from root to q. Need to traverse the tree twice. Complexity: O(n) x 2""" <|body_0|> def lowestCommonAncestor_v2(self, root: TreeNode, p: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lowestCommonAncestor_v1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """By finding paths from root to p and from root to q. Need to traverse the tree twice. Complexity: O(n) x 2""" def find_path(node: TreeNode, target: TreeNode, path: List[TreeNode]) -> bool: ...
the_stack_v2_python_sparse
python3/trees_and_graphs/lowest_common_ancestor_binary_tree.py
victorchu/algorithms
train
0
cca133a86e81e27e073a4969da73d6a2d35bbc39
[ "pulls_list = {'number': 79, 'created_at': '2018-08-12T05:31:14Z', 'state': 'open'}\nmock_res = PullsTest.MockRes(pulls_list, 200)\ntype(mock_response).return_value = mock.PropertyMock(return_value=mock_res)\ntype(mock_get).return_value = mock.PropertyMock(return_value=type(mock_response).return_value)\nfreezer = f...
<|body_start_0|> pulls_list = {'number': 79, 'created_at': '2018-08-12T05:31:14Z', 'state': 'open'} mock_res = PullsTest.MockRes(pulls_list, 200) type(mock_response).return_value = mock.PropertyMock(return_value=mock_res) type(mock_get).return_value = mock.PropertyMock(return_value=type(...
Test for Repository class inside repository package
PullsTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PullsTest: """Test for Repository class inside repository package""" def test_created_time(self, mock_get, mock_response): """Test for pulls class inside pulls package""" <|body_0|> def test_closed_pull_request_time(self, mock_get, mock_response): """Test for pul...
stack_v2_sparse_classes_75kplus_train_069449
4,498
no_license
[ { "docstring": "Test for pulls class inside pulls package", "name": "test_created_time", "signature": "def test_created_time(self, mock_get, mock_response)" }, { "docstring": "Test for pulls class inside pulls package", "name": "test_closed_pull_request_time", "signature": "def test_clos...
4
stack_v2_sparse_classes_30k_train_024687
Implement the Python class `PullsTest` described below. Class description: Test for Repository class inside repository package Method signatures and docstrings: - def test_created_time(self, mock_get, mock_response): Test for pulls class inside pulls package - def test_closed_pull_request_time(self, mock_get, mock_re...
Implement the Python class `PullsTest` described below. Class description: Test for Repository class inside repository package Method signatures and docstrings: - def test_created_time(self, mock_get, mock_response): Test for pulls class inside pulls package - def test_closed_pull_request_time(self, mock_get, mock_re...
4b31f2c7d87c3ad15c7ab8b71a94abdada1faf63
<|skeleton|> class PullsTest: """Test for Repository class inside repository package""" def test_created_time(self, mock_get, mock_response): """Test for pulls class inside pulls package""" <|body_0|> def test_closed_pull_request_time(self, mock_get, mock_response): """Test for pul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PullsTest: """Test for Repository class inside repository package""" def test_created_time(self, mock_get, mock_response): """Test for pulls class inside pulls package""" pulls_list = {'number': 79, 'created_at': '2018-08-12T05:31:14Z', 'state': 'open'} mock_res = PullsTest.MockRe...
the_stack_v2_python_sparse
unit_test/pulls_test.py
iamthebj/GitPred
train
0
e0c7cdf2a0e61f20341632eb84be7f031633a20f
[ "extension_path = os.path.join(util.GetUnittestDataDir(), 'foo')\noptions = options_for_unittests.GetCopy()\nself.assertRaises(extension_to_load.ExtensionPathNonExistentException, lambda: extension_to_load.ExtensionToLoad(extension_path, options.browser_type))", "extension_path = os.path.join(util.GetUnittestData...
<|body_start_0|> extension_path = os.path.join(util.GetUnittestDataDir(), 'foo') options = options_for_unittests.GetCopy() self.assertRaises(extension_to_load.ExtensionPathNonExistentException, lambda: extension_to_load.ExtensionToLoad(extension_path, options.browser_type)) <|end_body_0|> <|bod...
NonExistentExtensionTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NonExistentExtensionTest: def testNonExistentExtensionPath(self): """Test that a non-existent extension path will raise an exception.""" <|body_0|> def testExtensionNotLoaded(self): """Querying an extension that was not loaded will return None""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_069450
9,822
permissive
[ { "docstring": "Test that a non-existent extension path will raise an exception.", "name": "testNonExistentExtensionPath", "signature": "def testNonExistentExtensionPath(self)" }, { "docstring": "Querying an extension that was not loaded will return None", "name": "testExtensionNotLoaded", ...
2
stack_v2_sparse_classes_30k_train_008601
Implement the Python class `NonExistentExtensionTest` described below. Class description: Implement the NonExistentExtensionTest class. Method signatures and docstrings: - def testNonExistentExtensionPath(self): Test that a non-existent extension path will raise an exception. - def testExtensionNotLoaded(self): Query...
Implement the Python class `NonExistentExtensionTest` described below. Class description: Implement the NonExistentExtensionTest class. Method signatures and docstrings: - def testNonExistentExtensionPath(self): Test that a non-existent extension path will raise an exception. - def testExtensionNotLoaded(self): Query...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class NonExistentExtensionTest: def testNonExistentExtensionPath(self): """Test that a non-existent extension path will raise an exception.""" <|body_0|> def testExtensionNotLoaded(self): """Querying an extension that was not loaded will return None""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NonExistentExtensionTest: def testNonExistentExtensionPath(self): """Test that a non-existent extension path will raise an exception.""" extension_path = os.path.join(util.GetUnittestDataDir(), 'foo') options = options_for_unittests.GetCopy() self.assertRaises(extension_to_load...
the_stack_v2_python_sparse
third_party/catapult/telemetry/telemetry/internal/browser/extension_unittest.py
metux/chromium-suckless
train
5
0988a6e211cfd507eaa61f54490f69a41abb7fb7
[ "children = self.children\ninner = [e for e in children if e.tag != 'office:change-info']\nif no_header:\n new_inner = []\n for element in inner:\n if element.tag == 'text:h':\n children = element.children\n text = element.text\n para = Element.from_tag('text:p')\n ...
<|body_start_0|> children = self.children inner = [e for e in children if e.tag != 'office:change-info'] if no_header: new_inner = [] for element in inner: if element.tag == 'text:h': children = element.children text...
The TextDeletion "text:deletion" contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The TextDeletion element may also contain content that was deleted while change tra...
TextDeletion
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextDeletion: """The TextDeletion "text:deletion" contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The TextDeletion element may also contain c...
stack_v2_sparse_classes_75kplus_train_069451
21,593
permissive
[ { "docstring": "Get the deleted informations stored in the TextDeletion. If as_text is True: returns the text content. If no_header is True: existing Heading are changed in Paragraph Arguments: as_text -- boolean no_header -- boolean Return: Paragraph and Header list", "name": "get_deleted", "signature"...
3
stack_v2_sparse_classes_30k_train_048253
Implement the Python class `TextDeletion` described below. Class description: The TextDeletion "text:deletion" contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The ...
Implement the Python class `TextDeletion` described below. Class description: The TextDeletion "text:deletion" contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The ...
41554a07965af70cacc023a9a0a73c25b42d25a2
<|skeleton|> class TextDeletion: """The TextDeletion "text:deletion" contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The TextDeletion element may also contain c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TextDeletion: """The TextDeletion "text:deletion" contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more Paragraph which contains a comment on the deletion. The TextDeletion element may also contain content that w...
the_stack_v2_python_sparse
odfdo/tracked_changes.py
jdum/odfdo
train
30
3e3c4d72bbb3565e5655c6115ed64d7e84bdb1d1
[ "cache = getattr(self, MEMOIZE_CACHE_PROPERTY_NAME, {})\nif kwargs:\n keys = set(kwargs.keys())\nelse:\n keys = set(cache.keys())\nfor key in keys:\n cache.pop(key, None)\nreturn self", "cache = getattr(self, MEMOIZE_CACHE_PROPERTY_NAME, {})\nsetattr(self, MEMOIZE_CACHE_PROPERTY_NAME, cache)\ncache.updat...
<|body_start_0|> cache = getattr(self, MEMOIZE_CACHE_PROPERTY_NAME, {}) if kwargs: keys = set(kwargs.keys()) else: keys = set(cache.keys()) for key in keys: cache.pop(key, None) return self <|end_body_0|> <|body_start_1|> cache = getat...
MemoizeMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemoizeMixin: def clear_cache(self, **kwargs): """Allows to clear all or part of memoize cache on the object If called with no args, clears all cache. If passed with some named args, clears the cache for those named args. The value of passed named arg is irrelevant, as only the arg name ...
stack_v2_sparse_classes_75kplus_train_069452
4,724
permissive
[ { "docstring": "Allows to clear all or part of memoize cache on the object If called with no args, clears all cache. If passed with some named args, clears the cache for those named args. The value of passed named arg is irrelevant, as only the arg name is used. Self is returned for ease of chaining. Example:: ...
2
stack_v2_sparse_classes_30k_test_001435
Implement the Python class `MemoizeMixin` described below. Class description: Implement the MemoizeMixin class. Method signatures and docstrings: - def clear_cache(self, **kwargs): Allows to clear all or part of memoize cache on the object If called with no args, clears all cache. If passed with some named args, clea...
Implement the Python class `MemoizeMixin` described below. Class description: Implement the MemoizeMixin class. Method signatures and docstrings: - def clear_cache(self, **kwargs): Allows to clear all or part of memoize cache on the object If called with no args, clears all cache. If passed with some named args, clea...
550b90a303c880ae8c3dfd2801dc4f991a969f89
<|skeleton|> class MemoizeMixin: def clear_cache(self, **kwargs): """Allows to clear all or part of memoize cache on the object If called with no args, clears all cache. If passed with some named args, clears the cache for those named args. The value of passed named arg is irrelevant, as only the arg name ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MemoizeMixin: def clear_cache(self, **kwargs): """Allows to clear all or part of memoize cache on the object If called with no args, clears all cache. If passed with some named args, clears the cache for those named args. The value of passed named arg is irrelevant, as only the arg name is used. Self ...
the_stack_v2_python_sparse
common/memoize.py
panoramichq/data-collection-fb
train
0
004d0f006394d247fdc47d69ef759bc8ee95c919
[ "if name == 't2_file':\n return self.inputs.t1_file\nreturn None", "if name == 't2_file' and (not os.path.isfile(value)):\n print('Using T1 as T2 file')\n value = self.inputs.t1_file\nreturn super(LOGISMOSB, self)._format_arg(name, spec, value)", "outputs = self.output_spec().get()\noutputs['gmsurface_...
<|body_start_0|> if name == 't2_file': return self.inputs.t1_file return None <|end_body_0|> <|body_start_1|> if name == 't2_file' and (not os.path.isfile(value)): print('Using T1 as T2 file') value = self.inputs.t1_file return super(LOGISMOSB, self)....
This class represents a... :param CommandLine:
LOGISMOSB
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LOGISMOSB: """This class represents a... :param CommandLine:""" def _gen_filename(self, name): """This function... :param name: :return:""" <|body_0|> def _format_arg(self, name, spec, value): """This function... :param name: :param spec: :param value: :return:""...
stack_v2_sparse_classes_75kplus_train_069453
34,847
permissive
[ { "docstring": "This function... :param name: :return:", "name": "_gen_filename", "signature": "def _gen_filename(self, name)" }, { "docstring": "This function... :param name: :param spec: :param value: :return:", "name": "_format_arg", "signature": "def _format_arg(self, name, spec, val...
3
stack_v2_sparse_classes_30k_train_038307
Implement the Python class `LOGISMOSB` described below. Class description: This class represents a... :param CommandLine: Method signatures and docstrings: - def _gen_filename(self, name): This function... :param name: :return: - def _format_arg(self, name, spec, value): This function... :param name: :param spec: :pa...
Implement the Python class `LOGISMOSB` described below. Class description: This class represents a... :param CommandLine: Method signatures and docstrings: - def _gen_filename(self, name): This function... :param name: :return: - def _format_arg(self, name, spec, value): This function... :param name: :param spec: :pa...
64bb590918a188b660225e44ae54c1072f3a8056
<|skeleton|> class LOGISMOSB: """This class represents a... :param CommandLine:""" def _gen_filename(self, name): """This function... :param name: :return:""" <|body_0|> def _format_arg(self, name, spec, value): """This function... :param name: :param spec: :param value: :return:""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LOGISMOSB: """This class represents a... :param CommandLine:""" def _gen_filename(self, name): """This function... :param name: :return:""" if name == 't2_file': return self.inputs.t1_file return None def _format_arg(self, name, spec, value): """This funct...
the_stack_v2_python_sparse
AutoWorkup/logismosb/interfaces.py
BRAINSia/BRAINSTools
train
101
2c64fb78ad805b701d465dd3af7b7d3f5f16840f
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UnifiedRoleAssignmentScheduleInstance()", "from .unified_role_eligibility_schedule_instance import UnifiedRoleEligibilityScheduleInstance\nfrom .unified_role_schedule_instance_base import UnifiedRoleScheduleInstanceBase\nfrom .unified_...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return UnifiedRoleAssignmentScheduleInstance() <|end_body_0|> <|body_start_1|> from .unified_role_eligibility_schedule_instance import UnifiedRoleEligibilityScheduleInstance from .unified_role_...
UnifiedRoleAssignmentScheduleInstance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnifiedRoleAssignmentScheduleInstance: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleAssignmentScheduleInstance: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d...
stack_v2_sparse_classes_75kplus_train_069454
4,830
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: UnifiedRoleAssignmentScheduleInstance", "name": "create_from_discriminator_value", "signature": "def create_...
3
null
Implement the Python class `UnifiedRoleAssignmentScheduleInstance` described below. Class description: Implement the UnifiedRoleAssignmentScheduleInstance class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleAssignmentScheduleInstance: Crea...
Implement the Python class `UnifiedRoleAssignmentScheduleInstance` described below. Class description: Implement the UnifiedRoleAssignmentScheduleInstance class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleAssignmentScheduleInstance: Crea...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class UnifiedRoleAssignmentScheduleInstance: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleAssignmentScheduleInstance: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnifiedRoleAssignmentScheduleInstance: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UnifiedRoleAssignmentScheduleInstance: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator v...
the_stack_v2_python_sparse
msgraph/generated/models/unified_role_assignment_schedule_instance.py
microsoftgraph/msgraph-sdk-python
train
135
3e79601fb9582a89895752f4851208bac731fa8c
[ "allow_speech_tags = [as_text(item) for item in allow_speech_tags]\nself.default_speech_tag_filter = allow_speech_tags\nself.stop_words = set()\nself.stop_words_file = stopwords_path\nif type(stop_words_file) is str:\n self.stop_words_file = stop_words_file\nfor word in codecs.open(self.stop_words_file, 'r', 'ut...
<|body_start_0|> allow_speech_tags = [as_text(item) for item in allow_speech_tags] self.default_speech_tag_filter = allow_speech_tags self.stop_words = set() self.stop_words_file = stopwords_path if type(stop_words_file) is str: self.stop_words_file = stop_words_file ...
WordSegmentation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordSegmentation: def __init__(self, stop_words_file=None, allow_speech_tags=['an', 'n', 'nt', 'x', 'eng', 'nt', 'nz']): """Keyword arguments: stop_words_file -- 保存停止词的文件路径,utf8编码,每行一个停止词。若不是str类型,则使用默认的停止词 allow_speech_tags -- 词性列表,用于过滤""" <|body_0|> def segment(self, text,...
stack_v2_sparse_classes_75kplus_train_069455
20,624
no_license
[ { "docstring": "Keyword arguments: stop_words_file -- 保存停止词的文件路径,utf8编码,每行一个停止词。若不是str类型,则使用默认的停止词 allow_speech_tags -- 词性列表,用于过滤", "name": "__init__", "signature": "def __init__(self, stop_words_file=None, allow_speech_tags=['an', 'n', 'nt', 'x', 'eng', 'nt', 'nz'])" }, { "docstring": "对一段文本进行分...
3
stack_v2_sparse_classes_30k_train_016083
Implement the Python class `WordSegmentation` described below. Class description: Implement the WordSegmentation class. Method signatures and docstrings: - def __init__(self, stop_words_file=None, allow_speech_tags=['an', 'n', 'nt', 'x', 'eng', 'nt', 'nz']): Keyword arguments: stop_words_file -- 保存停止词的文件路径,utf8编码,每行一...
Implement the Python class `WordSegmentation` described below. Class description: Implement the WordSegmentation class. Method signatures and docstrings: - def __init__(self, stop_words_file=None, allow_speech_tags=['an', 'n', 'nt', 'x', 'eng', 'nt', 'nz']): Keyword arguments: stop_words_file -- 保存停止词的文件路径,utf8编码,每行一...
ca2cf55b4dbae09a3c85689c8dae104908060c86
<|skeleton|> class WordSegmentation: def __init__(self, stop_words_file=None, allow_speech_tags=['an', 'n', 'nt', 'x', 'eng', 'nt', 'nz']): """Keyword arguments: stop_words_file -- 保存停止词的文件路径,utf8编码,每行一个停止词。若不是str类型,则使用默认的停止词 allow_speech_tags -- 词性列表,用于过滤""" <|body_0|> def segment(self, text,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordSegmentation: def __init__(self, stop_words_file=None, allow_speech_tags=['an', 'n', 'nt', 'x', 'eng', 'nt', 'nz']): """Keyword arguments: stop_words_file -- 保存停止词的文件路径,utf8编码,每行一个停止词。若不是str类型,则使用默认的停止词 allow_speech_tags -- 词性列表,用于过滤""" allow_speech_tags = [as_text(item) for item in allow_...
the_stack_v2_python_sparse
owner/吴伟/keyword_extraction.py
dxcv/GsEnv
train
0
38735aec69e6aa4a51dbe460794c1d320df3b1ea
[ "n = len(self)\nif n != len(src):\n raise IndexError()\nfor i in range(0, n):\n self[i] = src[i]\nreturn self", "n = len(self)\nif n != len(dst):\n raise IndexError()\nfor i in range(0, n):\n dst[i] = self[i]\nreturn self" ]
<|body_start_0|> n = len(self) if n != len(src): raise IndexError() for i in range(0, n): self[i] = src[i] return self <|end_body_0|> <|body_start_1|> n = len(self) if n != len(dst): raise IndexError() for i in range(0, n): ...
Copy Elements mixin.
CopyEltsMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopyEltsMixin: """Copy Elements mixin.""" def copy_from(self, src): """Copy elements from src to self""" <|body_0|> def copy_to(self, dst): """Copy elements from self to dst""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(self) i...
stack_v2_sparse_classes_75kplus_train_069456
3,660
permissive
[ { "docstring": "Copy elements from src to self", "name": "copy_from", "signature": "def copy_from(self, src)" }, { "docstring": "Copy elements from self to dst", "name": "copy_to", "signature": "def copy_to(self, dst)" } ]
2
null
Implement the Python class `CopyEltsMixin` described below. Class description: Copy Elements mixin. Method signatures and docstrings: - def copy_from(self, src): Copy elements from src to self - def copy_to(self, dst): Copy elements from self to dst
Implement the Python class `CopyEltsMixin` described below. Class description: Copy Elements mixin. Method signatures and docstrings: - def copy_from(self, src): Copy elements from src to self - def copy_to(self, dst): Copy elements from self to dst <|skeleton|> class CopyEltsMixin: """Copy Elements mixin.""" ...
c4b8638ee609b62f597bd47943f2b375246b7e79
<|skeleton|> class CopyEltsMixin: """Copy Elements mixin.""" def copy_from(self, src): """Copy elements from src to self""" <|body_0|> def copy_to(self, dst): """Copy elements from self to dst""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CopyEltsMixin: """Copy Elements mixin.""" def copy_from(self, src): """Copy elements from src to self""" n = len(self) if n != len(src): raise IndexError() for i in range(0, n): self[i] = src[i] return self def copy_to(self, dst): ...
the_stack_v2_python_sparse
python/amino/mixin.py
dyalab/amino
train
0
0d0c0237816a85916e444af7d4029b518bdafe21
[ "if clients is None:\n clients = {}\nif 'ResourceStatusClient' in clients:\n self.rsClient = clients['ResourceStatusClient']\nelse:\n self.rsClient = ResourceStatusClient()\nif 'ResourceManagementClient' in clients:\n self.rmClient = clients['ResourceManagementClient']\nelse:\n self.rmClient = Resour...
<|body_start_0|> if clients is None: clients = {} if 'ResourceStatusClient' in clients: self.rsClient = clients['ResourceStatusClient'] else: self.rsClient = ResourceStatusClient() if 'ResourceManagementClient' in clients: self.rmClient = c...
PEP ( Policy Enforcement Point )
PEP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PEP: """PEP ( Policy Enforcement Point )""" def __init__(self, clients=None): """Constructor examples: >>> pep = PEP() >>> pep1 = PEP( { 'ResourceStatusClient' : ResourceStatusClient() } ) >>> pep2 = PEP( { 'ResourceStatusClient' : ResourceStatusClient(), 'ClientY' : None } ) :Parame...
stack_v2_sparse_classes_75kplus_train_069457
6,635
no_license
[ { "docstring": "Constructor examples: >>> pep = PEP() >>> pep1 = PEP( { 'ResourceStatusClient' : ResourceStatusClient() } ) >>> pep2 = PEP( { 'ResourceStatusClient' : ResourceStatusClient(), 'ClientY' : None } ) :Parameters: **clients** - [ None, `dict` ] dictionary with clients to be used in the commands issue...
3
null
Implement the Python class `PEP` described below. Class description: PEP ( Policy Enforcement Point ) Method signatures and docstrings: - def __init__(self, clients=None): Constructor examples: >>> pep = PEP() >>> pep1 = PEP( { 'ResourceStatusClient' : ResourceStatusClient() } ) >>> pep2 = PEP( { 'ResourceStatusClien...
Implement the Python class `PEP` described below. Class description: PEP ( Policy Enforcement Point ) Method signatures and docstrings: - def __init__(self, clients=None): Constructor examples: >>> pep = PEP() >>> pep1 = PEP( { 'ResourceStatusClient' : ResourceStatusClient() } ) >>> pep2 = PEP( { 'ResourceStatusClien...
fdfd852c92a56192b8ee9970b66f0136e6e0afff
<|skeleton|> class PEP: """PEP ( Policy Enforcement Point )""" def __init__(self, clients=None): """Constructor examples: >>> pep = PEP() >>> pep1 = PEP( { 'ResourceStatusClient' : ResourceStatusClient() } ) >>> pep2 = PEP( { 'ResourceStatusClient' : ResourceStatusClient(), 'ClientY' : None } ) :Parame...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PEP: """PEP ( Policy Enforcement Point )""" def __init__(self, clients=None): """Constructor examples: >>> pep = PEP() >>> pep1 = PEP( { 'ResourceStatusClient' : ResourceStatusClient() } ) >>> pep2 = PEP( { 'ResourceStatusClient' : ResourceStatusClient(), 'ClientY' : None } ) :Parameters: **clien...
the_stack_v2_python_sparse
src/DIRAC/ResourceStatusSystem/PolicySystem/PEP.py
bopopescu/bes3-jinr
train
0
9b2b1d9295531d376d8e7c2bef15aae118a171d1
[ "valid_ins = [(0, True), (1, False)]\ninvalid_ins = [(0, False), (1, True)]\nfor consumer_node_id, anonymous in valid_ins:\n msg = create_task_ins(consumer_node_id, anonymous, has_legacy_server_message=True)\n val_errors = validate_task_ins_or_res(msg)\n self.assertFalse(val_errors)\nfor consumer_node_id, ...
<|body_start_0|> valid_ins = [(0, True), (1, False)] invalid_ins = [(0, False), (1, True)] for consumer_node_id, anonymous in valid_ins: msg = create_task_ins(consumer_node_id, anonymous, has_legacy_server_message=True) val_errors = validate_task_ins_or_res(msg) ...
Test validation code in state.
ValidatorTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidatorTest: """Test validation code in state.""" def test_task_ins(self) -> None: """Test is_valid task_ins.""" <|body_0|> def test_is_valid_task_res(self) -> None: """Test is_valid task_res.""" <|body_1|> def test_task_ins_secure_aggregation(self...
stack_v2_sparse_classes_75kplus_train_069458
6,215
permissive
[ { "docstring": "Test is_valid task_ins.", "name": "test_task_ins", "signature": "def test_task_ins(self) -> None" }, { "docstring": "Test is_valid task_res.", "name": "test_is_valid_task_res", "signature": "def test_is_valid_task_res(self) -> None" }, { "docstring": "Test is_vali...
4
null
Implement the Python class `ValidatorTest` described below. Class description: Test validation code in state. Method signatures and docstrings: - def test_task_ins(self) -> None: Test is_valid task_ins. - def test_is_valid_task_res(self) -> None: Test is_valid task_res. - def test_task_ins_secure_aggregation(self) ->...
Implement the Python class `ValidatorTest` described below. Class description: Test validation code in state. Method signatures and docstrings: - def test_task_ins(self) -> None: Test is_valid task_ins. - def test_is_valid_task_res(self) -> None: Test is_valid task_res. - def test_task_ins_secure_aggregation(self) ->...
55be690535e5f3feb33c888c3e4a586b7bdbf489
<|skeleton|> class ValidatorTest: """Test validation code in state.""" def test_task_ins(self) -> None: """Test is_valid task_ins.""" <|body_0|> def test_is_valid_task_res(self) -> None: """Test is_valid task_res.""" <|body_1|> def test_task_ins_secure_aggregation(self...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidatorTest: """Test validation code in state.""" def test_task_ins(self) -> None: """Test is_valid task_ins.""" valid_ins = [(0, True), (1, False)] invalid_ins = [(0, False), (1, True)] for consumer_node_id, anonymous in valid_ins: msg = create_task_ins(cons...
the_stack_v2_python_sparse
src/py/flwr/server/utils/validator_test.py
adap/flower
train
2,999
09933c8f95b2ecb9305df7e2f59cb44424a8e78d
[ "start_urls = []\ntry:\n thing = int(input('你想爬取琉璃神社的哪类数据?请选择输入[1、动画,2、漫画,3、游戏,4、小说,5、壁纸/文章,6、全部]中的一个数字:'))\n start_urls.append(self.start_urls[thing - 1])\nexcept Exception:\n start_urls = self.start_urls\nfor url in start_urls:\n yield scrapy.Request(url=url, callback=self.parse)", "dataPath = os.pa...
<|body_start_0|> start_urls = [] try: thing = int(input('你想爬取琉璃神社的哪类数据?请选择输入[1、动画,2、漫画,3、游戏,4、小说,5、壁纸/文章,6、全部]中的一个数字:')) start_urls.append(self.start_urls[thing - 1]) except Exception: start_urls = self.start_urls for url in start_urls: yie...
GlazedshrineSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlazedshrineSpider: def start_requests(self): """在第一个请求开始之前,让用户选择要爬取的内容 :return:start_urls""" <|body_0|> def parse_page(self, response): """解析分页内的数据,即依据分页url解析帖子 :param response:响应文件 :return:item's url 和url""" <|body_1|> def parse_rsc(self, response): ...
stack_v2_sparse_classes_75kplus_train_069459
7,190
no_license
[ { "docstring": "在第一个请求开始之前,让用户选择要爬取的内容 :return:start_urls", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "解析分页内的数据,即依据分页url解析帖子 :param response:响应文件 :return:item's url 和url", "name": "parse_page", "signature": "def parse_page(self, response)" }, ...
3
stack_v2_sparse_classes_30k_test_001492
Implement the Python class `GlazedshrineSpider` described below. Class description: Implement the GlazedshrineSpider class. Method signatures and docstrings: - def start_requests(self): 在第一个请求开始之前,让用户选择要爬取的内容 :return:start_urls - def parse_page(self, response): 解析分页内的数据,即依据分页url解析帖子 :param response:响应文件 :return:item'...
Implement the Python class `GlazedshrineSpider` described below. Class description: Implement the GlazedshrineSpider class. Method signatures and docstrings: - def start_requests(self): 在第一个请求开始之前,让用户选择要爬取的内容 :return:start_urls - def parse_page(self, response): 解析分页内的数据,即依据分页url解析帖子 :param response:响应文件 :return:item'...
12963cccabcd3d51d66f94711c71f8908a16f281
<|skeleton|> class GlazedshrineSpider: def start_requests(self): """在第一个请求开始之前,让用户选择要爬取的内容 :return:start_urls""" <|body_0|> def parse_page(self, response): """解析分页内的数据,即依据分页url解析帖子 :param response:响应文件 :return:item's url 和url""" <|body_1|> def parse_rsc(self, response): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlazedshrineSpider: def start_requests(self): """在第一个请求开始之前,让用户选择要爬取的内容 :return:start_urls""" start_urls = [] try: thing = int(input('你想爬取琉璃神社的哪类数据?请选择输入[1、动画,2、漫画,3、游戏,4、小说,5、壁纸/文章,6、全部]中的一个数字:')) start_urls.append(self.start_urls[thing - 1]) except Exc...
the_stack_v2_python_sparse
06Shrine/Glazed_Shrine/Glazed_Shrine/spiders/GlazedShrine.py
ABBOOT/Scrapy_BackUp
train
0
641545540bcfb7496d5a8ce06bae2ef61738eee0
[ "tp = type(e)\ntb = e.__traceback__\ntraceback_str = 'Traceback (most recent call last):\\n' + ''.join(traceback.format_tb(tb))\ntry:\n attributes = e.get_attributes()\nexcept AttributeError:\n attributes = {}\nreturn (tp.__name__, traceback_str, sy.serde.msgpack.serde._simplify(worker, attributes))", "erro...
<|body_start_0|> tp = type(e) tb = e.__traceback__ traceback_str = 'Traceback (most recent call last):\n' + ''.join(traceback.format_tb(tb)) try: attributes = e.get_attributes() except AttributeError: attributes = {} return (tp.__name__, traceback_...
Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high
SendNotPermittedError
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SendNotPermittedError: """Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high""" def simplify(worker: 'sy.workers.AbstractWorker', e): """Serialize information about an Exception which was raised to forwa...
stack_v2_sparse_classes_75kplus_train_069460
15,166
permissive
[ { "docstring": "Serialize information about an Exception which was raised to forward it", "name": "simplify", "signature": "def simplify(worker: 'sy.workers.AbstractWorker', e)" }, { "docstring": "Detail and re-raise an Exception forwarded by another worker", "name": "detail", "signature...
2
stack_v2_sparse_classes_30k_train_045249
Implement the Python class `SendNotPermittedError` described below. Class description: Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high Method signatures and docstrings: - def simplify(worker: 'sy.workers.AbstractWorker', e): Serialize...
Implement the Python class `SendNotPermittedError` described below. Class description: Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high Method signatures and docstrings: - def simplify(worker: 'sy.workers.AbstractWorker', e): Serialize...
cc4765bed880ad38a02505834f63df39e0815328
<|skeleton|> class SendNotPermittedError: """Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high""" def simplify(worker: 'sy.workers.AbstractWorker', e): """Serialize information about an Exception which was raised to forwa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SendNotPermittedError: """Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high""" def simplify(worker: 'sy.workers.AbstractWorker', e): """Serialize information about an Exception which was raised to forward it""" ...
the_stack_v2_python_sparse
syft/exceptions.py
tudorcebere/PySyft
train
2
fa94c5408410bd46a65493293b49a41bcea37d59
[ "allowed = list(NORM_LOOKUP.keys()) + [None]\nif normalization not in allowed:\n raise ValueError(f'Illegal normalization. Got: {normalization}. Allowed: {allowed}')\nself.normalization = normalization\nself.mean = mean\nself.std = std\nself.model = model\nself.model.eval()\nweight_mat = compute_pyramid_patch_we...
<|body_start_0|> allowed = list(NORM_LOOKUP.keys()) + [None] if normalization not in allowed: raise ValueError(f'Illegal normalization. Got: {normalization}. Allowed: {allowed}') self.normalization = normalization self.mean = mean self.std = std self.model = m...
Predictor
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda') -> None: """Predict dense soft masks with this helper class. Includes a weight matrix that can assig...
stack_v2_sparse_classes_75kplus_train_069461
6,734
permissive
[ { "docstring": "Predict dense soft masks with this helper class. Includes a weight matrix that can assign bigger weight on pixels in center and less weight to pixels on image boundary. helps dealing with prediction artifacts on tile boundaries. Parameters ---------- model : nn.Module: nn.Module pytorch model pa...
3
stack_v2_sparse_classes_30k_train_048865
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda')...
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda')...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class Predictor: def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda') -> None: """Predict dense soft masks with this helper class. Includes a weight matrix that can assig...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Predictor: def __init__(self, model: nn.Module, patch_size: Tuple[int, int], normalization: str=None, mean: np.ndarray=None, std: np.ndarray=None, device: Union[str, torch.device]='cuda') -> None: """Predict dense soft masks with this helper class. Includes a weight matrix that can assign bigger weigh...
the_stack_v2_python_sparse
cellseg_models_pytorch/inference/predictor.py
okunator/cellseg_models.pytorch
train
43
042149d70a71466e13c388ab424f7e6260a4426a
[ "super(BarPlotter, self).__init__(parameter_dict)\nassert 'get_bar_data_fn' in self.parameters\nself.fig = plt.figure(frameon=False, figsize=self.parameters['figsize'])\nself.plot = self.fig.add_subplot(111)\nself.plot_surface = None\nmatplotlib.rc('font', **self.parameters['font'])", "self._setup_plot()\nnum_col...
<|body_start_0|> super(BarPlotter, self).__init__(parameter_dict) assert 'get_bar_data_fn' in self.parameters self.fig = plt.figure(frameon=False, figsize=self.parameters['figsize']) self.plot = self.fig.add_subplot(111) self.plot_surface = None matplotlib.rc('font', **se...
A Plotter for generating bar plots.
BarPlotter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BarPlotter: """A Plotter for generating bar plots.""" def __init__(self, parameter_dict=None): """Constructor for BarPlotter. This expects a callable 'get_bar_data_fn' in the parameters, which will return a list of distributions for each of the actions. Typically, this will be a call...
stack_v2_sparse_classes_75kplus_train_069462
3,889
permissive
[ { "docstring": "Constructor for BarPlotter. This expects a callable 'get_bar_data_fn' in the parameters, which will return a list of distributions for each of the actions. Typically, this will be a callback from the agent, which will return some useful information about its performance. Args: parameter_dict: No...
2
stack_v2_sparse_classes_30k_train_008305
Implement the Python class `BarPlotter` described below. Class description: A Plotter for generating bar plots. Method signatures and docstrings: - def __init__(self, parameter_dict=None): Constructor for BarPlotter. This expects a callable 'get_bar_data_fn' in the parameters, which will return a list of distribution...
Implement the Python class `BarPlotter` described below. Class description: A Plotter for generating bar plots. Method signatures and docstrings: - def __init__(self, parameter_dict=None): Constructor for BarPlotter. This expects a callable 'get_bar_data_fn' in the parameters, which will return a list of distribution...
44a51d0b2d484670637bf67f80be7f1ec31d8992
<|skeleton|> class BarPlotter: """A Plotter for generating bar plots.""" def __init__(self, parameter_dict=None): """Constructor for BarPlotter. This expects a callable 'get_bar_data_fn' in the parameters, which will return a list of distributions for each of the actions. Typically, this will be a call...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BarPlotter: """A Plotter for generating bar plots.""" def __init__(self, parameter_dict=None): """Constructor for BarPlotter. This expects a callable 'get_bar_data_fn' in the parameters, which will return a list of distributions for each of the actions. Typically, this will be a callback from the...
the_stack_v2_python_sparse
dopamine/utils/bar_plotter.py
fmxFranky/dopamine
train
2
94c4848ee9abfedf54b9bc281ac420e9cabe4e93
[ "zero = 0\nfor i, n in enumerate(nums):\n if n == 0:\n continue\n nums[zero], nums[i] = (nums[i], nums[zero])\n zero += 1", "snowball_size = 0\nfor i, n in enumerate(nums):\n if n == 0:\n snowball_size += 1\n else:\n nums[i], nums[i - snowball_size] = (0, n)" ]
<|body_start_0|> zero = 0 for i, n in enumerate(nums): if n == 0: continue nums[zero], nums[i] = (nums[i], nums[zero]) zero += 1 <|end_body_0|> <|body_start_1|> snowball_size = 0 for i, n in enumerate(nums): if n == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtyp""" <|body_0|> def move_zeroes_by_snowball(self, nums): """雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0""" <|body_1|> <|end_skeleton|> <|body_start_0|> zero = 0 ...
stack_v2_sparse_classes_75kplus_train_069463
1,055
no_license
[ { "docstring": ":type nums: List[int] :rtyp", "name": "move_zeroes", "signature": "def move_zeroes(self, nums)" }, { "docstring": "雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0", "name": "move_zeroes_by_snowball", "signature": "def move_zeroes_by_snowball(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007138
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def move_zeroes(self, nums): :type nums: List[int] :rtyp - def move_zeroes_by_snowball(self, nums): 雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def move_zeroes(self, nums): :type nums: List[int] :rtyp - def move_zeroes_by_snowball(self, nums): 雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0 <|skeleton|> class...
2b7f4a9fefbfd358f8ff31362d60e2007641ca29
<|skeleton|> class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtyp""" <|body_0|> def move_zeroes_by_snowball(self, nums): """雪球计数 数值为 0 时,雪球数量加 1;数值不为 0 时,将当前位置的值赋值给第一个雪球位置, 当前位置赋值为 0""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def move_zeroes(self, nums): """:type nums: List[int] :rtyp""" zero = 0 for i, n in enumerate(nums): if n == 0: continue nums[zero], nums[i] = (nums[i], nums[zero]) zero += 1 def move_zeroes_by_snowball(self, nums): ...
the_stack_v2_python_sparse
Week_01/G20190343020166/LeetCode_283_0166.py
algorithm005-class01/algorithm005-class01
train
27
1076d1fb3cfc811e4332d35630a5fae4d2bbde7c
[ "email = request.data.get('email')\nuser = User.objects.filter(email=email).all()\nif len(user) == 0:\n return Response({'status': 'fail', 'message': 'No user with this email address.'}, status=status.HTTP_404_NOT_FOUND)\nelse:\n user = user[0]\nif user.status == User.DISABLED:\n return Response({'status':...
<|body_start_0|> email = request.data.get('email') user = User.objects.filter(email=email).all() if len(user) == 0: return Response({'status': 'fail', 'message': 'No user with this email address.'}, status=status.HTTP_404_NOT_FOUND) else: user = user[0] if...
Send a password reset link to a user via email Will send a password eset link if no other request has been issued in the past X minutes. Password reset links are only valid for the number of minutes specified in the configuration file. Defaults to 30. Extends: views.APIView
ResetPasswordRequestView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetPasswordRequestView: """Send a password reset link to a user via email Will send a password eset link if no other request has been issued in the past X minutes. Password reset links are only valid for the number of minutes specified in the configuration file. Defaults to 30. Extends: views.A...
stack_v2_sparse_classes_75kplus_train_069464
19,096
permissive
[ { "docstring": "Create a new reset password request. Generates a new unique key which can be used to reset a users password. Sends an email containing a password reset link to the specified user.", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Check a...
5
stack_v2_sparse_classes_30k_train_036325
Implement the Python class `ResetPasswordRequestView` described below. Class description: Send a password reset link to a user via email Will send a password eset link if no other request has been issued in the past X minutes. Password reset links are only valid for the number of minutes specified in the configuration...
Implement the Python class `ResetPasswordRequestView` described below. Class description: Send a password reset link to a user via email Will send a password eset link if no other request has been issued in the past X minutes. Password reset links are only valid for the number of minutes specified in the configuration...
0db6cefc382f95acd3027c498dbfa4cfa63ea0e0
<|skeleton|> class ResetPasswordRequestView: """Send a password reset link to a user via email Will send a password eset link if no other request has been issued in the past X minutes. Password reset links are only valid for the number of minutes specified in the configuration file. Defaults to 30. Extends: views.A...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResetPasswordRequestView: """Send a password reset link to a user via email Will send a password eset link if no other request has been issued in the past X minutes. Password reset links are only valid for the number of minutes specified in the configuration file. Defaults to 30. Extends: views.APIView""" ...
the_stack_v2_python_sparse
agape-core/agape/authentication/views.py
Dandresfsoto/agape-django
train
0
c4d0ce26de6cf27c2bcf98233e19e12bb8b3b057
[ "super().__init__()\nself.image = pygame.Surface([10, 10])\nself.image.fill(color)\nself.color = color\nself.rect = self.image.get_rect()\nself.rect.x = shooter.rect.centerx\nself.rect.y = shooter.rect.centery\nself.floating_point_x = shooter.rect.centerx\nself.floating_point_y = shooter.rect.centery\nx_diff = dest...
<|body_start_0|> super().__init__() self.image = pygame.Surface([10, 10]) self.image.fill(color) self.color = color self.rect = self.image.get_rect() self.rect.x = shooter.rect.centerx self.rect.y = shooter.rect.centery self.floating_point_x = shooter.rect...
Classe d'une balle
Bullet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bullet: """Classe d'une balle""" def __init__(self, shooter, dest_x, dest_y, color): """Constructeur""" <|body_0|> def update(self): """Déplace la balle""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__() self.image = pyga...
stack_v2_sparse_classes_75kplus_train_069465
1,925
no_license
[ { "docstring": "Constructeur", "name": "__init__", "signature": "def __init__(self, shooter, dest_x, dest_y, color)" }, { "docstring": "Déplace la balle", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_val_000670
Implement the Python class `Bullet` described below. Class description: Classe d'une balle Method signatures and docstrings: - def __init__(self, shooter, dest_x, dest_y, color): Constructeur - def update(self): Déplace la balle
Implement the Python class `Bullet` described below. Class description: Classe d'une balle Method signatures and docstrings: - def __init__(self, shooter, dest_x, dest_y, color): Constructeur - def update(self): Déplace la balle <|skeleton|> class Bullet: """Classe d'une balle""" def __init__(self, shooter,...
ae1b8fda418191d6bb2ad10347b5f375a8373f1b
<|skeleton|> class Bullet: """Classe d'une balle""" def __init__(self, shooter, dest_x, dest_y, color): """Constructeur""" <|body_0|> def update(self): """Déplace la balle""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bullet: """Classe d'une balle""" def __init__(self, shooter, dest_x, dest_y, color): """Constructeur""" super().__init__() self.image = pygame.Surface([10, 10]) self.image.fill(color) self.color = color self.rect = self.image.get_rect() self.rect.x ...
the_stack_v2_python_sparse
Bullet.py
Heargo/LostColor
train
0
74c3c224392f4faa857ad26e700452a81b852bb2
[ "job_manager: 'JobManager' = self\njobs_by_id = {job.id: job for job in jobs if job.id is not None}\nfetched = job_manager.filter(id=list(jobs_by_id.keys()))\nfor api_job in fetched:\n assert api_job.id is not None and api_job._read_model is not None\n jobs_by_id[api_job.id]._refresh_from_dict(api_job._read_m...
<|body_start_0|> job_manager: 'JobManager' = self jobs_by_id = {job.id: job for job in jobs if job.id is not None} fetched = job_manager.filter(id=list(jobs_by_id.keys())) for api_job in fetched: assert api_job.id is not None and api_job._read_model is not None jo...
JobManagerBase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobManagerBase: def bulk_refresh(self, jobs: List['Job']) -> None: """Refresh the list of Jobs from the latest database state""" <|body_0|> def wait(self, jobs: List['Job'], timeout: Optional[float]=None, poll_interval: float=1.0, return_when: str='ALL_COMPLETED') -> JobWait...
stack_v2_sparse_classes_75kplus_train_069466
15,182
permissive
[ { "docstring": "Refresh the list of Jobs from the latest database state", "name": "bulk_refresh", "signature": "def bulk_refresh(self, jobs: List['Job']) -> None" }, { "docstring": "Block and periodically refresh jobs, until either all have completed (the default) or any have completed (return_w...
3
null
Implement the Python class `JobManagerBase` described below. Class description: Implement the JobManagerBase class. Method signatures and docstrings: - def bulk_refresh(self, jobs: List['Job']) -> None: Refresh the list of Jobs from the latest database state - def wait(self, jobs: List['Job'], timeout: Optional[float...
Implement the Python class `JobManagerBase` described below. Class description: Implement the JobManagerBase class. Method signatures and docstrings: - def bulk_refresh(self, jobs: List['Job']) -> None: Refresh the list of Jobs from the latest database state - def wait(self, jobs: List['Job'], timeout: Optional[float...
9af964d1e8994d597df391592af2015a27a34e66
<|skeleton|> class JobManagerBase: def bulk_refresh(self, jobs: List['Job']) -> None: """Refresh the list of Jobs from the latest database state""" <|body_0|> def wait(self, jobs: List['Job'], timeout: Optional[float]=None, poll_interval: float=1.0, return_when: str='ALL_COMPLETED') -> JobWait...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JobManagerBase: def bulk_refresh(self, jobs: List['Job']) -> None: """Refresh the list of Jobs from the latest database state""" job_manager: 'JobManager' = self jobs_by_id = {job.id: job for job in jobs if job.id is not None} fetched = job_manager.filter(id=list(jobs_by_id.key...
the_stack_v2_python_sparse
balsam/_api/bases.py
jtchilders/balsam
train
0
94181f1ac2d5aebad128ad24d09ea366d55a2e84
[ "self.rounds = int(rounds)\nself.filepath = filepath\nprint(filepath)\nprint('derka')\nself.all_questions = pd.read_csv(filepath, encoding='latin1')", "aqs = self.all_questions\nunanswered = aqs[aqs['Answer'].isnull()]\nassert len(unanswered) > self.rounds, 'Not enough new questions. Hotfix: Wipe the ques...
<|body_start_0|> self.rounds = int(rounds) self.filepath = filepath print(filepath) print('derka') self.all_questions = pd.read_csv(filepath, encoding='latin1') <|end_body_0|> <|body_start_1|> aqs = self.all_questions unanswered = aqs[aqs['Answer'].isnull()] ...
The engine for the questions. needs acess to a to a csv of questions ran from trader
qs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class qs: """The engine for the questions. needs acess to a to a csv of questions ran from trader""" def __init__(self, filepath, rounds): """intializes.""" <|body_0|> def play(self): """Game runner. Saves and updates.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_069467
926
no_license
[ { "docstring": "intializes.", "name": "__init__", "signature": "def __init__(self, filepath, rounds)" }, { "docstring": "Game runner. Saves and updates.", "name": "play", "signature": "def play(self)" } ]
2
stack_v2_sparse_classes_30k_train_035043
Implement the Python class `qs` described below. Class description: The engine for the questions. needs acess to a to a csv of questions ran from trader Method signatures and docstrings: - def __init__(self, filepath, rounds): intializes. - def play(self): Game runner. Saves and updates.
Implement the Python class `qs` described below. Class description: The engine for the questions. needs acess to a to a csv of questions ran from trader Method signatures and docstrings: - def __init__(self, filepath, rounds): intializes. - def play(self): Game runner. Saves and updates. <|skeleton|> class qs: "...
2d69df82911f728064dd41cd223a637702c7af80
<|skeleton|> class qs: """The engine for the questions. needs acess to a to a csv of questions ran from trader""" def __init__(self, filepath, rounds): """intializes.""" <|body_0|> def play(self): """Game runner. Saves and updates.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class qs: """The engine for the questions. needs acess to a to a csv of questions ran from trader""" def __init__(self, filepath, rounds): """intializes.""" self.rounds = int(rounds) self.filepath = filepath print(filepath) print('derka') self.all_questions = pd....
the_stack_v2_python_sparse
finance/trader/question_asker.py
rorygwozdz/coding
train
1
d244ece889197c6099474d8bcec2c02860ca2eb7
[ "fileName = inspect.getsourcefile(self.parent._create_widgets)\nself.master = master\nself.title('Source Code: ' + fileName)\ntxtFrame = ttk.Frame(self)\ntxtFrame.pack(side=TOP, fill=BOTH)\ntext = tk.Text(txtFrame, height=24, width=100, wrap=WORD, setgrid=1, highlightthickness=0, pady=2, padx=3)\nyscroll = ttk.Scro...
<|body_start_0|> fileName = inspect.getsourcefile(self.parent._create_widgets) self.master = master self.title('Source Code: ' + fileName) txtFrame = ttk.Frame(self) txtFrame.pack(side=TOP, fill=BOTH) text = tk.Text(txtFrame, height=24, width=100, wrap=WORD, setgrid=1, hi...
Create a modal dialog to display a demo's source code file.
CodeDialog
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeDialog: """Create a modal dialog to display a demo's source code file.""" def body(self, master: tk.Tk) -> None: """Overrides Dialog.body() to populate the dialog window with a scrolled text window and custom dialog buttons.""" <|body_0|> def buttonbox(self) -> None:...
stack_v2_sparse_classes_75kplus_train_069468
4,028
permissive
[ { "docstring": "Overrides Dialog.body() to populate the dialog window with a scrolled text window and custom dialog buttons.", "name": "body", "signature": "def body(self, master: tk.Tk) -> None" }, { "docstring": "Overrides Dialog.buttonbox() to create custom buttons for this dialog.", "nam...
2
stack_v2_sparse_classes_30k_train_046230
Implement the Python class `CodeDialog` described below. Class description: Create a modal dialog to display a demo's source code file. Method signatures and docstrings: - def body(self, master: tk.Tk) -> None: Overrides Dialog.body() to populate the dialog window with a scrolled text window and custom dialog buttons...
Implement the Python class `CodeDialog` described below. Class description: Create a modal dialog to display a demo's source code file. Method signatures and docstrings: - def body(self, master: tk.Tk) -> None: Overrides Dialog.body() to populate the dialog window with a scrolled text window and custom dialog buttons...
4672c6a6faa3e8ed31f0bbc1d8c8fdee8b8f928a
<|skeleton|> class CodeDialog: """Create a modal dialog to display a demo's source code file.""" def body(self, master: tk.Tk) -> None: """Overrides Dialog.body() to populate the dialog window with a scrolled text window and custom dialog buttons.""" <|body_0|> def buttonbox(self) -> None:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CodeDialog: """Create a modal dialog to display a demo's source code file.""" def body(self, master: tk.Tk) -> None: """Overrides Dialog.body() to populate the dialog window with a scrolled text window and custom dialog buttons.""" fileName = inspect.getsourcefile(self.parent._create_widg...
the_stack_v2_python_sparse
src/dmltk/panels.py
Yobmod/dmlmung
train
0
a260e3812ae7da77973c93fb8b612373603a5b8a
[ "self.test_check_available = {}\nself.test_check_status = {}\nself.test_check_response_code = {}\nfor metric in self.metrics:\n metric.clear_overrides()", "for metric in self.metrics:\n if metric.name == metric_name:\n return metric\nraise NameError('No metric named \"{0}\"!'.format(metric_name))", ...
<|body_start_0|> self.test_check_available = {} self.test_check_status = {} self.test_check_response_code = {} for metric in self.metrics: metric.clear_overrides() <|end_body_0|> <|body_start_1|> for metric in self.metrics: if metric.name == metric_name: ...
Data model for a MaaS check type (e.g., remote.ping).
CheckType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckType: """Data model for a MaaS check type (e.g., remote.ping).""" def clear_overrides(self): """Clears the overrides for test-checks and metrics.""" <|body_0|> def get_metric_by_name(self, metric_name): """Gets the metric on this check type. This method is u...
stack_v2_sparse_classes_75kplus_train_069469
37,899
permissive
[ { "docstring": "Clears the overrides for test-checks and metrics.", "name": "clear_overrides", "signature": "def clear_overrides(self)" }, { "docstring": "Gets the metric on this check type. This method is useful for setting and clearing overrides on the test metrics.", "name": "get_metric_b...
3
stack_v2_sparse_classes_30k_train_042003
Implement the Python class `CheckType` described below. Class description: Data model for a MaaS check type (e.g., remote.ping). Method signatures and docstrings: - def clear_overrides(self): Clears the overrides for test-checks and metrics. - def get_metric_by_name(self, metric_name): Gets the metric on this check t...
Implement the Python class `CheckType` described below. Class description: Data model for a MaaS check type (e.g., remote.ping). Method signatures and docstrings: - def clear_overrides(self): Clears the overrides for test-checks and metrics. - def get_metric_by_name(self, metric_name): Gets the metric on this check t...
8e7eeed84ec5ae97863f9330023298845623c639
<|skeleton|> class CheckType: """Data model for a MaaS check type (e.g., remote.ping).""" def clear_overrides(self): """Clears the overrides for test-checks and metrics.""" <|body_0|> def get_metric_by_name(self, metric_name): """Gets the metric on this check type. This method is u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheckType: """Data model for a MaaS check type (e.g., remote.ping).""" def clear_overrides(self): """Clears the overrides for test-checks and metrics.""" self.test_check_available = {} self.test_check_status = {} self.test_check_response_code = {} for metric in sel...
the_stack_v2_python_sparse
mimic/model/maas_objects.py
ranjithpeddi/mimic
train
1
4e610226822ab03c14273361ca96f0330a801234
[ "sensor = SunSensor(self.mudpi, config)\nif sensor:\n self.add_component(sensor)\nreturn True", "if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if not conf.get('key'):\n raise ConfigError('Missing `key` in sun sensor config.')\n latitude = conf.get('latitude')\n ...
<|body_start_0|> sensor = SunSensor(self.mudpi, config) if sensor: self.add_component(sensor) return True <|end_body_0|> <|body_start_1|> if not isinstance(config, list): config = [config] for conf in config: if not conf.get('key'): ...
Interface
[ "BSD-4-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interface: def load(self, config): """Load sensor component from configs""" <|body_0|> def validate(self, config): """Validate the sensor config""" <|body_1|> <|end_skeleton|> <|body_start_0|> sensor = SunSensor(self.mudpi, config) if sensor...
stack_v2_sparse_classes_75kplus_train_069470
6,745
permissive
[ { "docstring": "Load sensor component from configs", "name": "load", "signature": "def load(self, config)" }, { "docstring": "Validate the sensor config", "name": "validate", "signature": "def validate(self, config)" } ]
2
stack_v2_sparse_classes_30k_train_029548
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load sensor component from configs - def validate(self, config): Validate the sensor config
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load sensor component from configs - def validate(self, config): Validate the sensor config <|skeleton|> class Interface: def load(self, config): ...
fb206b1136f529c7197f1e6b29629ed05630d377
<|skeleton|> class Interface: def load(self, config): """Load sensor component from configs""" <|body_0|> def validate(self, config): """Validate the sensor config""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Interface: def load(self, config): """Load sensor component from configs""" sensor = SunSensor(self.mudpi, config) if sensor: self.add_component(sensor) return True def validate(self, config): """Validate the sensor config""" if not isinstance(c...
the_stack_v2_python_sparse
mudpi/extensions/sun/sensor.py
mistasp0ck/mudpi-core
train
0
e62e1cad1a77f3ca78c76ae643354ca8ee22cc12
[ "d = json.loads(getattr(self, field))\nd[key] = d.get(key, 0) + 1\nsetattr(self, field, json.dumps(d))", "d = json.loads(getattr(self, field))\nd[key] = d.get(key, 0) - 1\nsetattr(self, field, json.dumps(d))", "self.num_games = (self.num_games or 0) + 1\nself._incr_json_field('outcomes', 'active')\nself._incr_j...
<|body_start_0|> d = json.loads(getattr(self, field)) d[key] = d.get(key, 0) + 1 setattr(self, field, json.dumps(d)) <|end_body_0|> <|body_start_1|> d = json.loads(getattr(self, field)) d[key] = d.get(key, 0) - 1 setattr(self, field, json.dumps(d)) <|end_body_1|> <|body...
Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game language * ``first_time`` - DateTi...
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game la...
stack_v2_sparse_classes_75kplus_train_069471
7,142
no_license
[ { "docstring": "Increment the value of self.``field``[``key``] by one where ``field`` is a JSON text string. (Does not commit.)", "name": "_incr_json_field", "signature": "def _incr_json_field(self, field, key)" }, { "docstring": "Decrement the value of self.``field``[``key``] by one where ``fie...
4
stack_v2_sparse_classes_30k_train_027498
Implement the Python class `User` described below. Class description: Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSO...
Implement the Python class `User` described below. Class description: Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSO...
55871c1dd2ae9b79d82a21dd2b73746c77d0bc41
<|skeleton|> class User: """Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game la...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: """Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game language * ``fi...
the_stack_v2_python_sparse
server/langman_orm.py
socratecha/frapbook-v1.0-langman
train
2
20540b1c1b923160c6d7397a3cfef27f18ba1e07
[ "if n == 0:\n return 0\ni = len(str(n))\nj = i * 10 ** i * 9\nnumlist = ''\nfor x in xrange(j):\n numlist += str(x)\nreturn int(numlist[n:n + 1])", "m = n\nfor i in xrange(10):\n domain = 9 * 10 ** i\n if n <= domain * (i + 1):\n break\n print('{} digit has {} length number'.format(i + 1, do...
<|body_start_0|> if n == 0: return 0 i = len(str(n)) j = i * 10 ** i * 9 numlist = '' for x in xrange(j): numlist += str(x) return int(numlist[n:n + 1]) <|end_body_0|> <|body_start_1|> m = n for i in xrange(10): domain ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findNthDigit_TLE(self, n): """:type n: int :rtype: int""" <|body_0|> def findNthDigit(self, n): """:type n: int :rtype: int""" <|body_1|> def findNthDigit2(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus_train_069472
2,319
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "findNthDigit_TLE", "signature": "def findNthDigit_TLE(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "findNthDigit", "signature": "def findNthDigit(self, n)" }, { "docstring": ":type n: int :rtype: int", "na...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findNthDigit_TLE(self, n): :type n: int :rtype: int - def findNthDigit(self, n): :type n: int :rtype: int - def findNthDigit2(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findNthDigit_TLE(self, n): :type n: int :rtype: int - def findNthDigit(self, n): :type n: int :rtype: int - def findNthDigit2(self, n): :type n: int :rtype: int <|skeleton|>...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def findNthDigit_TLE(self, n): """:type n: int :rtype: int""" <|body_0|> def findNthDigit(self, n): """:type n: int :rtype: int""" <|body_1|> def findNthDigit2(self, n): """:type n: int :rtype: int""" <|body_2|> <|end_skeleton|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findNthDigit_TLE(self, n): """:type n: int :rtype: int""" if n == 0: return 0 i = len(str(n)) j = i * 10 ** i * 9 numlist = '' for x in xrange(j): numlist += str(x) return int(numlist[n:n + 1]) def findNthDigit(...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00400.Nth Digit.py
roger6blog/LeetCode
train
0
f0984e01d50f2417468bdd963cff481d203e30da
[ "num = input(f'Guess a number between {START} and {END}:')\nif not num:\n raise ValueError('Please enter a number')\nelse:\n try:\n num = int(num)\n except ValueError:\n raise ValueError('Should be a number')\n if not START <= num <= END:\n raise ValueError('Number not in range')\n ...
<|body_start_0|> num = input(f'Guess a number between {START} and {END}:') if not num: raise ValueError('Please enter a number') else: try: num = int(num) except ValueError: raise ValueError('Should be a number') if ...
Number guess class, make it callable to initiate game
Game
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Number guess class, make it callable to initiate game""" def guess(self): """Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good...
stack_v2_sparse_classes_75kplus_train_069473
2,696
no_license
[ { "docstring": "Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good, return the int", "name": "guess", "signature": "def guess(self)" }, { "docstring...
3
stack_v2_sparse_classes_30k_train_014884
Implement the Python class `Game` described below. Class description: Number guess class, make it callable to initiate game Method signatures and docstrings: - def guess(self): Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a nu...
Implement the Python class `Game` described below. Class description: Number guess class, make it callable to initiate game Method signatures and docstrings: - def guess(self): Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a nu...
a1eb0a5553e50e88d3568a36b275138d84d9fb46
<|skeleton|> class Game: """Number guess class, make it callable to initiate game""" def guess(self): """Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: """Number guess class, make it callable to initiate game""" def guess(self): """Ask user for input, convert to int, raise ValueError outputting the following errors when applicable: 'Please enter a number' 'Should be a number' 'Number not in range' 'Already guessed' If all good, return the ...
the_stack_v2_python_sparse
code_challenges/42/guess.py
dcribb19/bitesofpy
train
1
78404f605f4376d8af232cdc8b39db0694afee77
[ "assert operation in [self.CREATED, self.CHANGED, self.READ]\nassert isinstance(name, str)\nself.operation = operation\nself.name = name\nself.given_value = given_value\nself.new_value = new_value", "if self.operation in [self.CREATED, self.READ]:\n text = 'Attribute(operation=%(operation)s, name=%(name)s, val...
<|body_start_0|> assert operation in [self.CREATED, self.CHANGED, self.READ] assert isinstance(name, str) self.operation = operation self.name = name self.given_value = given_value self.new_value = new_value <|end_body_0|> <|body_start_1|> if self.operation in [s...
Represents mock attribute state for create, read and write and the relating values.
Attribute
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Attribute: """Represents mock attribute state for create, read and write and the relating values.""" def __init__(self, operation, name, given_value=None, new_value=None): """Storing attribute operation and relevant data. :param operation: CREATED, CHANGED or READ :param name: name o...
stack_v2_sparse_classes_75kplus_train_069474
3,654
permissive
[ { "docstring": "Storing attribute operation and relevant data. :param operation: CREATED, CHANGED or READ :param name: name of attribute :param given_value: value when created or the value you read :param new_value: new value when changing an attribute", "name": "__init__", "signature": "def __init__(se...
4
null
Implement the Python class `Attribute` described below. Class description: Represents mock attribute state for create, read and write and the relating values. Method signatures and docstrings: - def __init__(self, operation, name, given_value=None, new_value=None): Storing attribute operation and relevant data. :para...
Implement the Python class `Attribute` described below. Class description: Represents mock attribute state for create, read and write and the relating values. Method signatures and docstrings: - def __init__(self, operation, name, given_value=None, new_value=None): Storing attribute operation and relevant data. :para...
64e1f82de144f959cdf3c6dcf0f692bbc0ceb20f
<|skeleton|> class Attribute: """Represents mock attribute state for create, read and write and the relating values.""" def __init__(self, operation, name, given_value=None, new_value=None): """Storing attribute operation and relevant data. :param operation: CREATED, CHANGED or READ :param name: name o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Attribute: """Represents mock attribute state for create, read and write and the relating values.""" def __init__(self, operation, name, given_value=None, new_value=None): """Storing attribute operation and relevant data. :param operation: CREATED, CHANGED or READ :param name: name of attribute :...
the_stack_v2_python_sparse
concept/mock/attribute.py
Nachtfeuer/concept-py
train
2
c4398aca34a2c33ce5692b086914fdc1b32f6a8e
[ "super(BilinearSTNRegistrator, self).__init__()\nif atlas.type is np.ndarray:\n self.atlas = torch.from_numpy(atlas)\nelse:\n self.atlas = atlas\nself.atlas = self.atlas.to(device)\nself.atlas = Variable(self.atlas, requires_grad=True)\nself.localization_net = Type1Module()\nif device is None:\n device = t...
<|body_start_0|> super(BilinearSTNRegistrator, self).__init__() if atlas.type is np.ndarray: self.atlas = torch.from_numpy(atlas) else: self.atlas = atlas self.atlas = self.atlas.to(device) self.atlas = Variable(self.atlas, requires_grad=True) self...
3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin
BilinearSTNRegistrator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BilinearSTNRegistrator: """3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin""" def __init__(self, atlas, device=None): ...
stack_v2_sparse_classes_75kplus_train_069475
8,571
no_license
[ { "docstring": "Args: atlas: numpy array of size using_cuda(bool)", "name": "__init__", "signature": "def __init__(self, atlas, device=None)" }, { "docstring": "forward pass of the Bilinear STN registation using the atlas given in the constructor Args: x: Returns:", "name": "forward", "s...
2
stack_v2_sparse_classes_30k_train_043899
Implement the Python class `BilinearSTNRegistrator` described below. Class description: 3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin Method signa...
Implement the Python class `BilinearSTNRegistrator` described below. Class description: 3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin Method signa...
f525743a9728b6ac17fa651c4eef8dec265d778d
<|skeleton|> class BilinearSTNRegistrator: """3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin""" def __init__(self, atlas, device=None): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BilinearSTNRegistrator: """3D spatial transformer implementation using pytorch. the STN has 3 main parts: 1. The localization network (who is giving by to user at init level) 2. creating are transformation function. This could be affine, b-slin""" def __init__(self, atlas, device=None): """Args: ...
the_stack_v2_python_sparse
network.py
ADubinA/pytorch-morph
train
0
3312d41b2b904d966e01a9288d982c3b25edf5c9
[ "logging.basicConfig(format='%(levelname)s:%(asctime)s ||| %(message)s', level=loglevel, filename=logfile, datefmt='%Y-%m-%d,%H:%M:%S')\nself.config = config\nself.fm = fm\nself.iv = Inversion(self.config, self.fm)\nself.completed_spectra = 0\nself.hash_table = OrderedDict()\nself.hash_size = 500\nself.RT_state_fil...
<|body_start_0|> logging.basicConfig(format='%(levelname)s:%(asctime)s ||| %(message)s', level=loglevel, filename=logfile, datefmt='%Y-%m-%d,%H:%M:%S') self.config = config self.fm = fm self.iv = Inversion(self.config, self.fm) self.completed_spectra = 0 self.hash_table =...
Worker
[ "LicenseRef-scancode-proprietary-license", "CC0-1.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Worker: def __init__(self, config: configs.Config, fm: ForwardModel, RT_state_file: str, analytical_state_file: str, analytical_state_unc_file: str, rdn_file: str, loc_file: str, obs_file: str, loglevel: str, logfile: str, subs_state_file: str=None, lbl_file: str=None): """Worker class t...
stack_v2_sparse_classes_75kplus_train_069476
11,110
permissive
[ { "docstring": "Worker class to help run a subset of spectra. Args: forward_model: isofit forward_model loglevel: output logging level logfile: output logging file worker_id: worker ID for logging reference total_workers: the total number of workers running, for logging reference", "name": "__init__", "...
2
null
Implement the Python class `Worker` described below. Class description: Implement the Worker class. Method signatures and docstrings: - def __init__(self, config: configs.Config, fm: ForwardModel, RT_state_file: str, analytical_state_file: str, analytical_state_unc_file: str, rdn_file: str, loc_file: str, obs_file: s...
Implement the Python class `Worker` described below. Class description: Implement the Worker class. Method signatures and docstrings: - def __init__(self, config: configs.Config, fm: ForwardModel, RT_state_file: str, analytical_state_file: str, analytical_state_unc_file: str, rdn_file: str, loc_file: str, obs_file: s...
7680163bb5c75ce8e6ec817819362d63f0a28630
<|skeleton|> class Worker: def __init__(self, config: configs.Config, fm: ForwardModel, RT_state_file: str, analytical_state_file: str, analytical_state_unc_file: str, rdn_file: str, loc_file: str, obs_file: str, loglevel: str, logfile: str, subs_state_file: str=None, lbl_file: str=None): """Worker class t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Worker: def __init__(self, config: configs.Config, fm: ForwardModel, RT_state_file: str, analytical_state_file: str, analytical_state_unc_file: str, rdn_file: str, loc_file: str, obs_file: str, loglevel: str, logfile: str, subs_state_file: str=None, lbl_file: str=None): """Worker class to help run a s...
the_stack_v2_python_sparse
isofit/utils/analytical_line.py
isofit/isofit
train
67
603d7a72acdde774ad8a9edd696c4992b5624dd1
[ "for p in [region_name, cluster_name]:\n if p is None or p == '' or p == ' ':\n exit(1)\nelse:\n self.region_name = region_name\n self.cluster_name = cluster_name\n self.err = 0", "self.err = 0\nerrInfo = None\ntry:\n client = boto3.Session(region_name=self.region_name)\n self.msk_client ...
<|body_start_0|> for p in [region_name, cluster_name]: if p is None or p == '' or p == ' ': exit(1) else: self.region_name = region_name self.cluster_name = cluster_name self.err = 0 <|end_body_0|> <|body_start_1|> self.err = 0 ...
Class for exporting MSK Connection information - Brokers - Zookeepers - Connection Protocol - Trustostore
BackendConfig
[ "JSON" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackendConfig: """Class for exporting MSK Connection information - Brokers - Zookeepers - Connection Protocol - Trustostore""" def __init__(self, cluster_name, region_name): """:param region_name": Region Name for the AWS MSK Cluster :type region_name": string :param cluster_name: AW...
stack_v2_sparse_classes_75kplus_train_069477
4,994
permissive
[ { "docstring": ":param region_name\": Region Name for the AWS MSK Cluster :type region_name\": string :param cluster_name: AWS MSK Cluster Name :type cluster_name: string", "name": "__init__", "signature": "def __init__(self, cluster_name, region_name)" }, { "docstring": "Method that creates a M...
3
stack_v2_sparse_classes_30k_train_026832
Implement the Python class `BackendConfig` described below. Class description: Class for exporting MSK Connection information - Brokers - Zookeepers - Connection Protocol - Trustostore Method signatures and docstrings: - def __init__(self, cluster_name, region_name): :param region_name": Region Name for the AWS MSK C...
Implement the Python class `BackendConfig` described below. Class description: Class for exporting MSK Connection information - Brokers - Zookeepers - Connection Protocol - Trustostore Method signatures and docstrings: - def __init__(self, cluster_name, region_name): :param region_name": Region Name for the AWS MSK C...
a327a56d8722bc039a7250903098f4ac7613e5a2
<|skeleton|> class BackendConfig: """Class for exporting MSK Connection information - Brokers - Zookeepers - Connection Protocol - Trustostore""" def __init__(self, cluster_name, region_name): """:param region_name": Region Name for the AWS MSK Cluster :type region_name": string :param cluster_name: AW...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BackendConfig: """Class for exporting MSK Connection information - Brokers - Zookeepers - Connection Protocol - Trustostore""" def __init__(self, cluster_name, region_name): """:param region_name": Region Name for the AWS MSK Cluster :type region_name": string :param cluster_name: AWS MSK Cluster...
the_stack_v2_python_sparse
aws/eks/lambdas/backend_config.py
christafford/lenses-cloud-templates
train
0
af197217152ff07e55fa7de5e3ac70d90a5a143f
[ "row = len(matrix)\ncol = len(matrix[0])\ndp = [[0] * col for i in range(row)]\ndp[0][0] = matrix[0][0]\nfor i in range(1, col):\n dp[0][i] = dp[0][i - 1] + matrix[0][i]\nfor j in range(1, row):\n dp[j][0] = matrix[j - 1][0] + matrix[j][0]\nfor i in range(1, row):\n for j in range(1, col):\n dp[i][j...
<|body_start_0|> row = len(matrix) col = len(matrix[0]) dp = [[0] * col for i in range(row)] dp[0][0] = matrix[0][0] for i in range(1, col): dp[0][i] = dp[0][i - 1] + matrix[0][i] for j in range(1, row): dp[j][0] = matrix[j - 1][0] + matrix[j][0] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, matrix): """时间复杂度O(MN) 空间复杂度O(MN) :param matrix: :return:""" <|body_0|> def minPathSum2(self, matrix): """时间复杂度O(MN) 空间复杂度O(min{M,N}) :param matrix: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> row = len(ma...
stack_v2_sparse_classes_75kplus_train_069478
1,778
no_license
[ { "docstring": "时间复杂度O(MN) 空间复杂度O(MN) :param matrix: :return:", "name": "minPathSum", "signature": "def minPathSum(self, matrix)" }, { "docstring": "时间复杂度O(MN) 空间复杂度O(min{M,N}) :param matrix: :return:", "name": "minPathSum2", "signature": "def minPathSum2(self, matrix)" } ]
2
stack_v2_sparse_classes_30k_train_008782
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, matrix): 时间复杂度O(MN) 空间复杂度O(MN) :param matrix: :return: - def minPathSum2(self, matrix): 时间复杂度O(MN) 空间复杂度O(min{M,N}) :param matrix: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, matrix): 时间复杂度O(MN) 空间复杂度O(MN) :param matrix: :return: - def minPathSum2(self, matrix): 时间复杂度O(MN) 空间复杂度O(min{M,N}) :param matrix: :return: <|skeleton|> cla...
85ceaf8f3da0efd66b4394ef16669ea673218265
<|skeleton|> class Solution: def minPathSum(self, matrix): """时间复杂度O(MN) 空间复杂度O(MN) :param matrix: :return:""" <|body_0|> def minPathSum2(self, matrix): """时间复杂度O(MN) 空间复杂度O(min{M,N}) :param matrix: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minPathSum(self, matrix): """时间复杂度O(MN) 空间复杂度O(MN) :param matrix: :return:""" row = len(matrix) col = len(matrix[0]) dp = [[0] * col for i in range(row)] dp[0][0] = matrix[0][0] for i in range(1, col): dp[0][i] = dp[0][i - 1] + matrix[0...
the_stack_v2_python_sparse
程序员代码面试指南/4. 动态规划/3. 矩阵的最小路径和.py
alexkie007/offer
train
2
16783a5d0d80173b22d54273a121e0668f6d97c8
[ "self.action: t.Optional[t.Callable[[T], V]] = None\nself.last_request: float = 0\nself.result: t.Optional[V] = None", "self.last_request = time.time()\nwas_notified = True\nwhile not stop.is_set() and was_notified:\n logger.debug('%s, getting lock in loop', self)\n with condition:\n logger.debug('%s...
<|body_start_0|> self.action: t.Optional[t.Callable[[T], V]] = None self.last_request: float = 0 self.result: t.Optional[V] = None <|end_body_0|> <|body_start_1|> self.last_request = time.time() was_notified = True while not stop.is_set() and was_notified: lo...
Class that manages an instance of a context class.
Manager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manager: """Class that manages an instance of a context class.""" def post_init(self) -> None: """Run initialization logic after the default init. Provided to allow easy constant / default setting / etc without having to duplicate the init signature.""" <|body_0|> def bo...
stack_v2_sparse_classes_75kplus_train_069479
12,647
no_license
[ { "docstring": "Run initialization logic after the default init. Provided to allow easy constant / default setting / etc without having to duplicate the init signature.", "name": "post_init", "signature": "def post_init(self) -> None" }, { "docstring": "Method called on the context of an instanc...
4
stack_v2_sparse_classes_30k_train_022972
Implement the Python class `Manager` described below. Class description: Class that manages an instance of a context class. Method signatures and docstrings: - def post_init(self) -> None: Run initialization logic after the default init. Provided to allow easy constant / default setting / etc without having to duplic...
Implement the Python class `Manager` described below. Class description: Class that manages an instance of a context class. Method signatures and docstrings: - def post_init(self) -> None: Run initialization logic after the default init. Provided to allow easy constant / default setting / etc without having to duplic...
c33c4a522f746d6c6625970e4fda11484cdf46dc
<|skeleton|> class Manager: """Class that manages an instance of a context class.""" def post_init(self) -> None: """Run initialization logic after the default init. Provided to allow easy constant / default setting / etc without having to duplicate the init signature.""" <|body_0|> def bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Manager: """Class that manages an instance of a context class.""" def post_init(self) -> None: """Run initialization logic after the default init. Provided to allow easy constant / default setting / etc without having to duplicate the init signature.""" self.action: t.Optional[t.Callable[...
the_stack_v2_python_sparse
app/reader.py
Solarbotics/camstationv2
train
1
8bbcdf36c3b07dc491396affd825ba6774eed99a
[ "self.basic_block = basic_block\nself.bb_index = bb_index\nself.il = il\nself.written = {}\nself.read = {}", "ssa = getSSA()\nwritten, read = il_registers(self.il)\nprint(written, read, self.il, self.il.operation)\nin_variables = copy.deepcopy(in_variables)\nfor r in read:\n if r not in in_variables:\n ...
<|body_start_0|> self.basic_block = basic_block self.bb_index = bb_index self.il = il self.written = {} self.read = {} <|end_body_0|> <|body_start_1|> ssa = getSSA() written, read = il_registers(self.il) print(written, read, self.il, self.il.operation) ...
A meta-instruction which we do analysis over
InsAnalysis
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InsAnalysis: """A meta-instruction which we do analysis over""" def __init__(self, basic_block, bb_index, il): """Constructor for InsAnalysis @param basic_block The BBAnalysis this InsAnalysis belongs to. @param bb_index The index in BBAnalysis of this instruction.""" <|body_...
stack_v2_sparse_classes_75kplus_train_069480
4,768
permissive
[ { "docstring": "Constructor for InsAnalysis @param basic_block The BBAnalysis this InsAnalysis belongs to. @param bb_index The index in BBAnalysis of this instruction.", "name": "__init__", "signature": "def __init__(self, basic_block, bb_index, il)" }, { "docstring": "Takes a dict of identifier...
2
stack_v2_sparse_classes_30k_train_048029
Implement the Python class `InsAnalysis` described below. Class description: A meta-instruction which we do analysis over Method signatures and docstrings: - def __init__(self, basic_block, bb_index, il): Constructor for InsAnalysis @param basic_block The BBAnalysis this InsAnalysis belongs to. @param bb_index The in...
Implement the Python class `InsAnalysis` described below. Class description: A meta-instruction which we do analysis over Method signatures and docstrings: - def __init__(self, basic_block, bb_index, il): Constructor for InsAnalysis @param basic_block The BBAnalysis this InsAnalysis belongs to. @param bb_index The in...
d1e51e0226474a81d96de26f36ffc2d39065ba87
<|skeleton|> class InsAnalysis: """A meta-instruction which we do analysis over""" def __init__(self, basic_block, bb_index, il): """Constructor for InsAnalysis @param basic_block The BBAnalysis this InsAnalysis belongs to. @param bb_index The index in BBAnalysis of this instruction.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InsAnalysis: """A meta-instruction which we do analysis over""" def __init__(self, basic_block, bb_index, il): """Constructor for InsAnalysis @param basic_block The BBAnalysis this InsAnalysis belongs to. @param bb_index The index in BBAnalysis of this instruction.""" self.basic_block = b...
the_stack_v2_python_sparse
src/avd/core/sliceEngine/loopDetection.py
bkerler/zeno
train
1
f81d317919cf1ab1a2ae8e6daa0ed67ef221d2d2
[ "func_name = sys._getframe().f_code.co_name\nad_plan_info = self.get_request_data(func_name)\nexpect_errmsg = self.get_expect_result(func_name)\n'添加策略(不播放广告)'\nad_plan_info['playType'] = 1\nres = self.get_result(func_name, var_params=ad_plan_info)\nactual_errmsg = res[0].json()['errmsg']\nself.assertIn(actual_errms...
<|body_start_0|> func_name = sys._getframe().f_code.co_name ad_plan_info = self.get_request_data(func_name) expect_errmsg = self.get_expect_result(func_name) '添加策略(不播放广告)' ad_plan_info['playType'] = 1 res = self.get_result(func_name, var_params=ad_plan_info) actua...
StrategyManagementOfVideoEditionAdvertising
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StrategyManagementOfVideoEditionAdvertising: def test_urine_v2_adPlanInfo_saveAdPlan(self): """添加视频广告策略 :return:""" <|body_0|> def test_urine_v2_adPlanInfo_adPlanList(self): """查询策略列表 :return:""" <|body_1|> def test_urine_v2_adPlanInfo_canBeDelete(self):...
stack_v2_sparse_classes_75kplus_train_069481
3,341
no_license
[ { "docstring": "添加视频广告策略 :return:", "name": "test_urine_v2_adPlanInfo_saveAdPlan", "signature": "def test_urine_v2_adPlanInfo_saveAdPlan(self)" }, { "docstring": "查询策略列表 :return:", "name": "test_urine_v2_adPlanInfo_adPlanList", "signature": "def test_urine_v2_adPlanInfo_adPlanList(self)"...
4
stack_v2_sparse_classes_30k_train_047916
Implement the Python class `StrategyManagementOfVideoEditionAdvertising` described below. Class description: Implement the StrategyManagementOfVideoEditionAdvertising class. Method signatures and docstrings: - def test_urine_v2_adPlanInfo_saveAdPlan(self): 添加视频广告策略 :return: - def test_urine_v2_adPlanInfo_adPlanList(s...
Implement the Python class `StrategyManagementOfVideoEditionAdvertising` described below. Class description: Implement the StrategyManagementOfVideoEditionAdvertising class. Method signatures and docstrings: - def test_urine_v2_adPlanInfo_saveAdPlan(self): 添加视频广告策略 :return: - def test_urine_v2_adPlanInfo_adPlanList(s...
6837a07ff200b610e7ba799a52543493848b6026
<|skeleton|> class StrategyManagementOfVideoEditionAdvertising: def test_urine_v2_adPlanInfo_saveAdPlan(self): """添加视频广告策略 :return:""" <|body_0|> def test_urine_v2_adPlanInfo_adPlanList(self): """查询策略列表 :return:""" <|body_1|> def test_urine_v2_adPlanInfo_canBeDelete(self):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StrategyManagementOfVideoEditionAdvertising: def test_urine_v2_adPlanInfo_saveAdPlan(self): """添加视频广告策略 :return:""" func_name = sys._getframe().f_code.co_name ad_plan_info = self.get_request_data(func_name) expect_errmsg = self.get_expect_result(func_name) '添加策略(不播放广告)'...
the_stack_v2_python_sparse
run/operation_management/test_strategy_management_of_video_edition_advertising.py
liwei123a/APITestFrame
train
0
72de027ad380186edcd59b98e76f4f1eb3effbe9
[ "self.action_n = env.action_space.n\nself.obs_low = env.observation_space.low\nself.obs_scale = env.observation_space.high - env.observation_space.low\nself.encoder = GridCoder(dim_size_arr, self.obs_low, self.obs_scale)\nself.w = np.zeros((self.encoder.state_num, self.action_n))\nself.c = np.zeros_like(self.w)\nse...
<|body_start_0|> self.action_n = env.action_space.n self.obs_low = env.observation_space.low self.obs_scale = env.observation_space.high - env.observation_space.low self.encoder = GridCoder(dim_size_arr, self.obs_low, self.obs_scale) self.w = np.zeros((self.encoder.state_num, sel...
网格太细会带来训练速度慢的问题 本质是q值表更新的不充分 不能从临近的网格获取数据
SARSAAgent_grid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SARSAAgent_grid: """网格太细会带来训练速度慢的问题 本质是q值表更新的不充分 不能从临近的网格获取数据""" def __init__(self, env, dim_size_arr=[50, 50], gamma=1.0, learning_rate=0.03, epsilon=0.001): """学习函数 env 环境 dim_size_arr 各个维度上的网格数量 gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率""" <|body_0|> def decide...
stack_v2_sparse_classes_75kplus_train_069482
22,277
no_license
[ { "docstring": "学习函数 env 环境 dim_size_arr 各个维度上的网格数量 gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率", "name": "__init__", "signature": "def __init__(self, env, dim_size_arr=[50, 50], gamma=1.0, learning_rate=0.03, epsilon=0.001)" }, { "docstring": "决策函数 observation 状态观测值 (位置 速度 时间)", "name"...
3
stack_v2_sparse_classes_30k_train_005357
Implement the Python class `SARSAAgent_grid` described below. Class description: 网格太细会带来训练速度慢的问题 本质是q值表更新的不充分 不能从临近的网格获取数据 Method signatures and docstrings: - def __init__(self, env, dim_size_arr=[50, 50], gamma=1.0, learning_rate=0.03, epsilon=0.001): 学习函数 env 环境 dim_size_arr 各个维度上的网格数量 gamma 收益衰减速率 learning_rate 学习...
Implement the Python class `SARSAAgent_grid` described below. Class description: 网格太细会带来训练速度慢的问题 本质是q值表更新的不充分 不能从临近的网格获取数据 Method signatures and docstrings: - def __init__(self, env, dim_size_arr=[50, 50], gamma=1.0, learning_rate=0.03, epsilon=0.001): 学习函数 env 环境 dim_size_arr 各个维度上的网格数量 gamma 收益衰减速率 learning_rate 学习...
e6526e9e38fcb5be91b46cb40715c15242198a0b
<|skeleton|> class SARSAAgent_grid: """网格太细会带来训练速度慢的问题 本质是q值表更新的不充分 不能从临近的网格获取数据""" def __init__(self, env, dim_size_arr=[50, 50], gamma=1.0, learning_rate=0.03, epsilon=0.001): """学习函数 env 环境 dim_size_arr 各个维度上的网格数量 gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率""" <|body_0|> def decide...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SARSAAgent_grid: """网格太细会带来训练速度慢的问题 本质是q值表更新的不充分 不能从临近的网格获取数据""" def __init__(self, env, dim_size_arr=[50, 50], gamma=1.0, learning_rate=0.03, epsilon=0.001): """学习函数 env 环境 dim_size_arr 各个维度上的网格数量 gamma 收益衰减速率 learning_rate 学习速率 epsilon 执行探索策略概率""" self.action_n = env.action_space.n ...
the_stack_v2_python_sparse
mountain_car/function_approx.py
lwzswufe/gym_learning
train
0
d224323171d4506d05152eac4064243fb46ca701
[ "super(Method, self).__init__(model, evaluate, dtype=dtype, pos=pos)\nself.discriminator = domain_discriminator\nif domain_discriminator.loss != 'sparse_categorical_crossentropy':\n raise ValueError('domain_discriminator loss must be sparse_categorical_crossentropy')\nif domain_discriminator.output_shape[1] != 2...
<|body_start_0|> super(Method, self).__init__(model, evaluate, dtype=dtype, pos=pos) self.discriminator = domain_discriminator if domain_discriminator.loss != 'sparse_categorical_crossentropy': raise ValueError('domain_discriminator loss must be sparse_categorical_crossentropy') ...
Covariate shift baseline method.
Method
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Method: """Covariate shift baseline method.""" def __init__(self, model, domain_discriminator, evaluate=None, dtype=tf.float32, pos=None): """Constructor. Args: model: Compiled Keras model. Used to predict Y from X. domain_discriminator: Keras model used to discriminate source from t...
stack_v2_sparse_classes_75kplus_train_069483
4,175
permissive
[ { "docstring": "Constructor. Args: model: Compiled Keras model. Used to predict Y from X. domain_discriminator: Keras model used to discriminate source from target. Must have 'sparse_categorical_crossentropy' as a loss. evaluate: a tf.keras.metrics method. dtype: desired dtype (e.g. tf.float32). pos: config_dic...
3
null
Implement the Python class `Method` described below. Class description: Covariate shift baseline method. Method signatures and docstrings: - def __init__(self, model, domain_discriminator, evaluate=None, dtype=tf.float32, pos=None): Constructor. Args: model: Compiled Keras model. Used to predict Y from X. domain_disc...
Implement the Python class `Method` described below. Class description: Covariate shift baseline method. Method signatures and docstrings: - def __init__(self, model, domain_discriminator, evaluate=None, dtype=tf.float32, pos=None): Constructor. Args: model: Compiled Keras model. Used to predict Y from X. domain_disc...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class Method: """Covariate shift baseline method.""" def __init__(self, model, domain_discriminator, evaluate=None, dtype=tf.float32, pos=None): """Constructor. Args: model: Compiled Keras model. Used to predict Y from X. domain_discriminator: Keras model used to discriminate source from t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Method: """Covariate shift baseline method.""" def __init__(self, model, domain_discriminator, evaluate=None, dtype=tf.float32, pos=None): """Constructor. Args: model: Compiled Keras model. Used to predict Y from X. domain_discriminator: Keras model used to discriminate source from target. Must h...
the_stack_v2_python_sparse
latent_shift_adaptation/latent_shift_adaptation/methods/shift_correction/cov.py
Jimmy-INL/google-research
train
1
e0cf12f9fccfc16dc8c6c9ebeffc857869ab1f9f
[ "self.argument_spec = netapp_utils.na_ontap_host_argument_spec()\nself.argument_spec.update(dict(state=dict(required=False, choices=['present', 'absent'], default='present'), broadcast_domain=dict(required=True, type='str'), ipspace=dict(required=False, type='str'), mtu=dict(required=False, type='str'), ports=dict(...
<|body_start_0|> self.argument_spec = netapp_utils.na_ontap_host_argument_spec() self.argument_spec.update(dict(state=dict(required=False, choices=['present', 'absent'], default='present'), broadcast_domain=dict(required=True, type='str'), ipspace=dict(required=False, type='str'), mtu=dict(required=Fals...
Create, Modifies and Destroys a Broadcast domain
NetAppOntapBroadcastDomain
[ "MIT", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetAppOntapBroadcastDomain: """Create, Modifies and Destroys a Broadcast domain""" def __init__(self): """Initialize the ONTAP Broadcast Domain class""" <|body_0|> def get_broadcast_domain(self): """Return details about the broadcast domain :param: name : broadca...
stack_v2_sparse_classes_75kplus_train_069484
9,431
permissive
[ { "docstring": "Initialize the ONTAP Broadcast Domain class", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return details about the broadcast domain :param: name : broadcast domain name :return: Details about the broadcas domain. None if not found. :rtype: dict", ...
6
stack_v2_sparse_classes_30k_train_047918
Implement the Python class `NetAppOntapBroadcastDomain` described below. Class description: Create, Modifies and Destroys a Broadcast domain Method signatures and docstrings: - def __init__(self): Initialize the ONTAP Broadcast Domain class - def get_broadcast_domain(self): Return details about the broadcast domain :...
Implement the Python class `NetAppOntapBroadcastDomain` described below. Class description: Create, Modifies and Destroys a Broadcast domain Method signatures and docstrings: - def __init__(self): Initialize the ONTAP Broadcast Domain class - def get_broadcast_domain(self): Return details about the broadcast domain :...
0cd0c003884155ac922e3e301305ac202de7028c
<|skeleton|> class NetAppOntapBroadcastDomain: """Create, Modifies and Destroys a Broadcast domain""" def __init__(self): """Initialize the ONTAP Broadcast Domain class""" <|body_0|> def get_broadcast_domain(self): """Return details about the broadcast domain :param: name : broadca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetAppOntapBroadcastDomain: """Create, Modifies and Destroys a Broadcast domain""" def __init__(self): """Initialize the ONTAP Broadcast Domain class""" self.argument_spec = netapp_utils.na_ontap_host_argument_spec() self.argument_spec.update(dict(state=dict(required=False, choice...
the_stack_v2_python_sparse
ansible/my_env/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_broadcast_domain.py
otus-devops-2019-02/yyashkin_infra
train
0
62c3bd7535c3ee9495cb282facf5fad9213ec35f
[ "self.Data = Data\nself.K = K\nif weights is not None:\n self.weights = weights\nelse:\n self.weights = np.random.rand(self.K)\n self.weights /= np.sum(self.weights)\ncol = np.shape(self.Data)[1]\nif means is not None:\n self.means = means\nelse:\n self.means = []\n for i in range(self.K):\n ...
<|body_start_0|> self.Data = Data self.K = K if weights is not None: self.weights = weights else: self.weights = np.random.rand(self.K) self.weights /= np.sum(self.weights) col = np.shape(self.Data)[1] if means is not None: ...
GMM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GMM: def __init__(self, Data, K, weights=None, means=None, covars=None): """这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合""" <|body_0|> def Gaussian(self, x, mean, cov): """...
stack_v2_sparse_classes_75kplus_train_069485
7,656
no_license
[ { "docstring": "这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合", "name": "__init__", "signature": "def __init__(self, Data, K, weights=None, means=None, covars=None)" }, { "docstring": "这是自定义的高斯分布概率密度函数 ...
3
stack_v2_sparse_classes_30k_train_050194
Implement the Python class `GMM` described below. Class description: Implement the GMM class. Method signatures and docstrings: - def __init__(self, Data, K, weights=None, means=None, covars=None): 这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param c...
Implement the Python class `GMM` described below. Class description: Implement the GMM class. Method signatures and docstrings: - def __init__(self, Data, K, weights=None, means=None, covars=None): 这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param c...
728852edefecfaf3af61a90c1c0325ee4991b4fc
<|skeleton|> class GMM: def __init__(self, Data, K, weights=None, means=None, covars=None): """这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合""" <|body_0|> def Gaussian(self, x, mean, cov): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GMM: def __init__(self, Data, K, weights=None, means=None, covars=None): """这是GMM(高斯混合模型)类的构造函数 :param Data: 训练数据 :param K: 高斯分布的个数 :param weigths: 每个高斯分布的初始概率(权重) :param means: 高斯分布的均值向量 :param covars: 高斯分布的协方差矩阵集合""" self.Data = Data self.K = K if weights is not None: ...
the_stack_v2_python_sparse
GMM.py
mrachelyu/yolo3_auto_label-
train
1
91926f8d33018011014d4f998f1dad7f45bfdd16
[ "super(FeatureExtractor, self).__init__()\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nself.num_embeddings, self.embedding_dim = pretrained_mtx.shape\nself.token2idx_dict = token2idx_dict\nself.embedding = nn.Embedding.from_pretrained(torch.from_numpy(pretrained_mtx).float(), freeze=freeze_embeddi...
<|body_start_0|> super(FeatureExtractor, self).__init__() self.hidden_size = hidden_size self.num_layers = num_layers self.num_embeddings, self.embedding_dim = pretrained_mtx.shape self.token2idx_dict = token2idx_dict self.embedding = nn.Embedding.from_pretrained(torch.fr...
Feature extracter for each node in the graph.
FeatureExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureExtractor: """Feature extracter for each node in the graph.""" def __init__(self, token2idx_dict, pretrained_mtx, hidden_size, num_layers=1, freeze_embedding=True): """Args: -token2idx_dict: token_to_index dictionary. -pretrained_mtx: pretrained word representation matrix. -hi...
stack_v2_sparse_classes_75kplus_train_069486
4,830
no_license
[ { "docstring": "Args: -token2idx_dict: token_to_index dictionary. -pretrained_mtx: pretrained word representation matrix. -hidden_size: size of hidden state of LSTM, which is also the dim for each graph node. -num_layers: the number of LSTM layers for each step. -freeze_embedding: whether to continue to train t...
2
stack_v2_sparse_classes_30k_train_014544
Implement the Python class `FeatureExtractor` described below. Class description: Feature extracter for each node in the graph. Method signatures and docstrings: - def __init__(self, token2idx_dict, pretrained_mtx, hidden_size, num_layers=1, freeze_embedding=True): Args: -token2idx_dict: token_to_index dictionary. -p...
Implement the Python class `FeatureExtractor` described below. Class description: Feature extracter for each node in the graph. Method signatures and docstrings: - def __init__(self, token2idx_dict, pretrained_mtx, hidden_size, num_layers=1, freeze_embedding=True): Args: -token2idx_dict: token_to_index dictionary. -p...
bcef404ad1976706fffe08ea066f8fd1c2405f3b
<|skeleton|> class FeatureExtractor: """Feature extracter for each node in the graph.""" def __init__(self, token2idx_dict, pretrained_mtx, hidden_size, num_layers=1, freeze_embedding=True): """Args: -token2idx_dict: token_to_index dictionary. -pretrained_mtx: pretrained word representation matrix. -hi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeatureExtractor: """Feature extracter for each node in the graph.""" def __init__(self, token2idx_dict, pretrained_mtx, hidden_size, num_layers=1, freeze_embedding=True): """Args: -token2idx_dict: token_to_index dictionary. -pretrained_mtx: pretrained word representation matrix. -hidden_size: si...
the_stack_v2_python_sparse
models/feature_extractor.py
wll199566/KG2
train
5
a07e42c6c0007850394658455f3565be67e0fe20
[ "creator = kwargs.pop('creator', None)\nrecipients = kwargs.pop('recipients', None)\nalias = super().create(*args, **kwargs)\nif creator:\n alias.post_create(creator)\nif recipients:\n alias.set_recipients(recipients)\nreturn alias", "alias = self.get_queryset().filter(address=address, internal=False)\nif a...
<|body_start_0|> creator = kwargs.pop('creator', None) recipients = kwargs.pop('recipients', None) alias = super().create(*args, **kwargs) if creator: alias.post_create(creator) if recipients: alias.set_recipients(recipients) return alias <|end_bod...
Custom manager for Alias.
AliasManager
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliasManager: """Custom manager for Alias.""" def create(self, *args, **kwargs): """Custom create method.""" <|body_0|> def modify_or_create(self, address, recipients, creator, domain): """Add recipient if the alias already exists or create it.""" <|body_...
stack_v2_sparse_classes_75kplus_train_069487
10,712
permissive
[ { "docstring": "Custom create method.", "name": "create", "signature": "def create(self, *args, **kwargs)" }, { "docstring": "Add recipient if the alias already exists or create it.", "name": "modify_or_create", "signature": "def modify_or_create(self, address, recipients, creator, domai...
2
stack_v2_sparse_classes_30k_train_006758
Implement the Python class `AliasManager` described below. Class description: Custom manager for Alias. Method signatures and docstrings: - def create(self, *args, **kwargs): Custom create method. - def modify_or_create(self, address, recipients, creator, domain): Add recipient if the alias already exists or create i...
Implement the Python class `AliasManager` described below. Class description: Custom manager for Alias. Method signatures and docstrings: - def create(self, *args, **kwargs): Custom create method. - def modify_or_create(self, address, recipients, creator, domain): Add recipient if the alias already exists or create i...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class AliasManager: """Custom manager for Alias.""" def create(self, *args, **kwargs): """Custom create method.""" <|body_0|> def modify_or_create(self, address, recipients, creator, domain): """Add recipient if the alias already exists or create it.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AliasManager: """Custom manager for Alias.""" def create(self, *args, **kwargs): """Custom create method.""" creator = kwargs.pop('creator', None) recipients = kwargs.pop('recipients', None) alias = super().create(*args, **kwargs) if creator: alias.post...
the_stack_v2_python_sparse
modoboa/admin/models/alias.py
modoboa/modoboa
train
2,201
bcf1b9c13fa954c345b9ae9778b1cea8e402d049
[ "super(Proj, self).__init__()\nself.clamp_min = ClampMin()\nself.min_norm = min_norm\nself.norm_k = Norm(axis=-1, keep_dims=True)\nself.maxnorm = 1 - 0.004", "norm = self.clamp_min(self.norm_k(x), self.min_norm)\nmaxnorm = self.maxnorm / c ** 0.5\ncond = norm > maxnorm\nprojected = x / norm * maxnorm\nreturn mnp....
<|body_start_0|> super(Proj, self).__init__() self.clamp_min = ClampMin() self.min_norm = min_norm self.norm_k = Norm(axis=-1, keep_dims=True) self.maxnorm = 1 - 0.004 <|end_body_0|> <|body_start_1|> norm = self.clamp_min(self.norm_k(x), self.min_norm) maxnorm = ...
proj class
Proj
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Proj: """proj class""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, x, c): """class construction""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(Proj, self).__init__() self.clamp_min = ClampMin() ...
stack_v2_sparse_classes_75kplus_train_069488
8,596
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self, min_norm)" }, { "docstring": "class construction", "name": "construct", "signature": "def construct(self, x, c)" } ]
2
stack_v2_sparse_classes_30k_train_047708
Implement the Python class `Proj` described below. Class description: proj class Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, x, c): class construction
Implement the Python class `Proj` described below. Class description: proj class Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, x, c): class construction <|skeleton|> class Proj: """proj class""" def __init__(self, min_norm): """init fun""" <...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class Proj: """proj class""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, x, c): """class construction""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Proj: """proj class""" def __init__(self, min_norm): """init fun""" super(Proj, self).__init__() self.clamp_min = ClampMin() self.min_norm = min_norm self.norm_k = Norm(axis=-1, keep_dims=True) self.maxnorm = 1 - 0.004 def construct(self, x, c): ...
the_stack_v2_python_sparse
research/nlp/hypertext/src/poincare.py
mindspore-ai/models
train
301
84ce0722718cb2c9cbe8fdfb76aceea25c7a878f
[ "super().__init__()\nself.margin = margin\nself.average = average", "out1, out2 = input_\n_, _, target = targets\ndist = torch.norm(out1 - out2, p=2, dim=1)\ndist_sq = dist.pow(2)\nsim_img_loss = dist_sq\ndissim_img_loss = F.relu(self.margin ** 2 - dist_sq)\ny = target.float()\nlosses = y * sim_img_loss + (1.0 - ...
<|body_start_0|> super().__init__() self.margin = margin self.average = average <|end_body_0|> <|body_start_1|> out1, out2 = input_ _, _, target = targets dist = torch.norm(out1 - out2, p=2, dim=1) dist_sq = dist.pow(2) sim_img_loss = dist_sq diss...
Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise Notes: This is the implementation of eqn 1 in the paper
ContrastiveLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContrastiveLoss: """Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise Notes: This is the implementation of eqn 1 in the paper""" def __init__(self, margin, average=False): """Args: margin (float): aver...
stack_v2_sparse_classes_75kplus_train_069489
1,426
no_license
[ { "docstring": "Args: margin (float): average (bool): If taking average over batch, sum over batch otherwise", "name": "__init__", "signature": "def __init__(self, margin, average=False)" }, { "docstring": "Optimize later if performace is bad in computational graph using if", "name": "forwar...
2
null
Implement the Python class `ContrastiveLoss` described below. Class description: Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise Notes: This is the implementation of eqn 1 in the paper Method signatures and docstrings: - def __init__...
Implement the Python class `ContrastiveLoss` described below. Class description: Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise Notes: This is the implementation of eqn 1 in the paper Method signatures and docstrings: - def __init__...
0be07595b6484e91d25091680e0a9a5fc9e1f69f
<|skeleton|> class ContrastiveLoss: """Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise Notes: This is the implementation of eqn 1 in the paper""" def __init__(self, margin, average=False): """Args: margin (float): aver...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContrastiveLoss: """Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise Notes: This is the implementation of eqn 1 in the paper""" def __init__(self, margin, average=False): """Args: margin (float): average (bool): I...
the_stack_v2_python_sparse
utils/loss.py
Vivek-Chalumuri/Fashion-Image-Similarity
train
0
2359084c22a9704c96af5d7d58c5a961e34e0a72
[ "username = self.txtUsername.get()\npassword = self.txtPassword.get()\nusers = SystemToolKit.readFile(Config.UserFile)\nfor j, i in enumerate(users):\n userHash = users[i]['Password']\n salt = users[i]['Salt']\n TestUsername = users[i]['Username']\n if self.checkPassword(userHash, password, salt) == Tru...
<|body_start_0|> username = self.txtUsername.get() password = self.txtPassword.get() users = SystemToolKit.readFile(Config.UserFile) for j, i in enumerate(users): userHash = users[i]['Password'] salt = users[i]['Salt'] TestUsername = users[i]['Username...
Methods: CheckDetails Check Passwords Check Username
Login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: """Methods: CheckDetails Check Passwords Check Username""" def checkDetails(self): """Searches though the User file for any accounts that can met the login requirements These are: Check Password returns true Check Username returns true If these tests are passed the system then...
stack_v2_sparse_classes_75kplus_train_069490
9,033
no_license
[ { "docstring": "Searches though the User file for any accounts that can met the login requirements These are: Check Password returns true Check Username returns true If these tests are passed the system then goes on to check if the email used to register the account has been confirmed if not the Confirm Email F...
3
stack_v2_sparse_classes_30k_train_007184
Implement the Python class `Login` described below. Class description: Methods: CheckDetails Check Passwords Check Username Method signatures and docstrings: - def checkDetails(self): Searches though the User file for any accounts that can met the login requirements These are: Check Password returns true Check Userna...
Implement the Python class `Login` described below. Class description: Methods: CheckDetails Check Passwords Check Username Method signatures and docstrings: - def checkDetails(self): Searches though the User file for any accounts that can met the login requirements These are: Check Password returns true Check Userna...
6420f365540d935906178691fbb5e46b6a31c6b5
<|skeleton|> class Login: """Methods: CheckDetails Check Passwords Check Username""" def checkDetails(self): """Searches though the User file for any accounts that can met the login requirements These are: Check Password returns true Check Username returns true If these tests are passed the system then...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Login: """Methods: CheckDetails Check Passwords Check Username""" def checkDetails(self): """Searches though the User file for any accounts that can met the login requirements These are: Check Password returns true Check Username returns true If these tests are passed the system then goes on to c...
the_stack_v2_python_sparse
Login.py
Lamppost122/Controlled-assessment-Final
train
0
2bac48f158df5f8d072e4a6b378cc160569ff0b7
[ "super(FileObjectInputReader, self).__init__(encoding=encoding)\nself._errors = 'strict'\nself._file_object = file_object", "encoded_string = self._file_object.readline()\nif isinstance(encoded_string, str):\n return encoded_string\ntry:\n string = codecs.decode(encoded_string, self._encoding, self._errors)...
<|body_start_0|> super(FileObjectInputReader, self).__init__(encoding=encoding) self._errors = 'strict' self._file_object = file_object <|end_body_0|> <|body_start_1|> encoded_string = self._file_object.readline() if isinstance(encoded_string, str): return encoded_st...
File object command line interface input reader. This input reader relies on the file-like object having a readline method.
FileObjectInputReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileObjectInputReader: """File object command line interface input reader. This input reader relies on the file-like object having a readline method.""" def __init__(self, file_object, encoding='utf-8'): """Initializes a file object command line interface input reader. Args: file_obj...
stack_v2_sparse_classes_75kplus_train_069491
19,023
permissive
[ { "docstring": "Initializes a file object command line interface input reader. Args: file_object (file): file-like object to read from. encoding (Optional[str]): input encoding.", "name": "__init__", "signature": "def __init__(self, file_object, encoding='utf-8')" }, { "docstring": "Reads a stri...
2
stack_v2_sparse_classes_30k_train_044000
Implement the Python class `FileObjectInputReader` described below. Class description: File object command line interface input reader. This input reader relies on the file-like object having a readline method. Method signatures and docstrings: - def __init__(self, file_object, encoding='utf-8'): Initializes a file o...
Implement the Python class `FileObjectInputReader` described below. Class description: File object command line interface input reader. This input reader relies on the file-like object having a readline method. Method signatures and docstrings: - def __init__(self, file_object, encoding='utf-8'): Initializes a file o...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class FileObjectInputReader: """File object command line interface input reader. This input reader relies on the file-like object having a readline method.""" def __init__(self, file_object, encoding='utf-8'): """Initializes a file object command line interface input reader. Args: file_obj...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileObjectInputReader: """File object command line interface input reader. This input reader relies on the file-like object having a readline method.""" def __init__(self, file_object, encoding='utf-8'): """Initializes a file object command line interface input reader. Args: file_object (file): f...
the_stack_v2_python_sparse
plaso/cli/tools.py
log2timeline/plaso
train
1,506
150465317aa985a95567b7a23c1030e2b14fca8c
[ "self.setText('New version available')\nversion = session.query('select asset.name, version from AssetVersion where id is \"{0}\"'.format(self._event['parent_id'])).all()\nself.setText('Version <span style=\"color: #E6E6E6\">{1}</span> of <span style=\"color: #E6E6E6\">{0}</span> available.'.format(version[0]['asse...
<|body_start_0|> self.setText('New version available') version = session.query('select asset.name, version from AssetVersion where id is "{0}"'.format(self._event['parent_id'])).all() self.setText('Version <span style="color: #E6E6E6">{1}</span> of <span style="color: #E6E6E6">{0}</span> availab...
Represent version notification.
VersionNotification
[ "Apache-2.0", "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VersionNotification: """Represent version notification.""" def _load(self): """Internal load of data from event.""" <|body_0|> def value(self): """Override and add extra information.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.setText('...
stack_v2_sparse_classes_75kplus_train_069492
6,407
permissive
[ { "docstring": "Internal load of data from event.", "name": "_load", "signature": "def _load(self)" }, { "docstring": "Override and add extra information.", "name": "value", "signature": "def value(self)" } ]
2
stack_v2_sparse_classes_30k_train_010611
Implement the Python class `VersionNotification` described below. Class description: Represent version notification. Method signatures and docstrings: - def _load(self): Internal load of data from event. - def value(self): Override and add extra information.
Implement the Python class `VersionNotification` described below. Class description: Represent version notification. Method signatures and docstrings: - def _load(self): Internal load of data from event. - def value(self): Override and add extra information. <|skeleton|> class VersionNotification: """Represent v...
f55f52787484fcf931c4653e7e241791f052c04f
<|skeleton|> class VersionNotification: """Represent version notification.""" def _load(self): """Internal load of data from event.""" <|body_0|> def value(self): """Override and add extra information.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VersionNotification: """Represent version notification.""" def _load(self): """Internal load of data from event.""" self.setText('New version available') version = session.query('select asset.name, version from AssetVersion where id is "{0}"'.format(self._event['parent_id'])).all(...
the_stack_v2_python_sparse
source/ftrack_connect/ui/widget/notification_directive.py
IngenuityEngine/ftrack-connect
train
0
5e125abc4641e56c13202c46454d4d8b9c218772
[ "if dictionary is None and filename is not None:\n filename = os.path.join(os.path.dirname(__file__), 'prior_files', filename)\nsuper(CalibrationPriorDict, self).__init__(dictionary=dictionary, filename=filename)\nself.source = None", "PriorDict.to_file(self, outdir=outdir, label=label)\nif self.source is not ...
<|body_start_0|> if dictionary is None and filename is not None: filename = os.path.join(os.path.dirname(__file__), 'prior_files', filename) super(CalibrationPriorDict, self).__init__(dictionary=dictionary, filename=filename) self.source = None <|end_body_0|> <|body_start_1|> ...
CalibrationPriorDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalibrationPriorDict: def __init__(self, dictionary=None, filename=None): """Initialises a Prior set for Binary Black holes Parameters ---------- dictionary: dict, optional See superclass filename: str, optional See superclass""" <|body_0|> def to_file(self, outdir, label): ...
stack_v2_sparse_classes_75kplus_train_069493
30,339
permissive
[ { "docstring": "Initialises a Prior set for Binary Black holes Parameters ---------- dictionary: dict, optional See superclass filename: str, optional See superclass", "name": "__init__", "signature": "def __init__(self, dictionary=None, filename=None)" }, { "docstring": "Write the prior to file...
4
stack_v2_sparse_classes_30k_train_027151
Implement the Python class `CalibrationPriorDict` described below. Class description: Implement the CalibrationPriorDict class. Method signatures and docstrings: - def __init__(self, dictionary=None, filename=None): Initialises a Prior set for Binary Black holes Parameters ---------- dictionary: dict, optional See su...
Implement the Python class `CalibrationPriorDict` described below. Class description: Implement the CalibrationPriorDict class. Method signatures and docstrings: - def __init__(self, dictionary=None, filename=None): Initialises a Prior set for Binary Black holes Parameters ---------- dictionary: dict, optional See su...
29a34a347ee97a303767bbc32003e93cae96e0d9
<|skeleton|> class CalibrationPriorDict: def __init__(self, dictionary=None, filename=None): """Initialises a Prior set for Binary Black holes Parameters ---------- dictionary: dict, optional See superclass filename: str, optional See superclass""" <|body_0|> def to_file(self, outdir, label): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CalibrationPriorDict: def __init__(self, dictionary=None, filename=None): """Initialises a Prior set for Binary Black holes Parameters ---------- dictionary: dict, optional See superclass filename: str, optional See superclass""" if dictionary is None and filename is not None: file...
the_stack_v2_python_sparse
bilby/gw/prior.py
yi-fan-wang/bilby
train
2
1eb378f92879565898c3ac1f32e1f68b7c4acdf4
[ "if obj:\n return settings.REVEAL_OPENSRP_ACTIVE\nreturn None", "if obj and obj.parent:\n return obj.parent.id\nreturn None", "if obj:\n if obj.level == settings.REVEAL_DISTRICT:\n return settings.REVEAL_OPENSRP_DISTRICT\n if obj.level == settings.REVEAL_RHC:\n return settings.REVEAL_O...
<|body_start_0|> if obj: return settings.REVEAL_OPENSRP_ACTIVE return None <|end_body_0|> <|body_start_1|> if obj and obj.parent: return obj.parent.id return None <|end_body_1|> <|body_start_2|> if obj: if obj.level == settings.REVEAL_DISTRIC...
A class to serialize locations as OpenSRP GeoJSON compatible data
LocationSerializer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationSerializer: """A class to serialize locations as OpenSRP GeoJSON compatible data""" def get_status(self, obj): """get location_type""" <|body_0|> def get_parentId(self, obj): """get parentId""" <|body_1|> def get_geographicLevel(self, obj): ...
stack_v2_sparse_classes_75kplus_train_069494
2,106
permissive
[ { "docstring": "get location_type", "name": "get_status", "signature": "def get_status(self, obj)" }, { "docstring": "get parentId", "name": "get_parentId", "signature": "def get_parentId(self, obj)" }, { "docstring": "get geographicLevel", "name": "get_geographicLevel", ...
3
stack_v2_sparse_classes_30k_train_035361
Implement the Python class `LocationSerializer` described below. Class description: A class to serialize locations as OpenSRP GeoJSON compatible data Method signatures and docstrings: - def get_status(self, obj): get location_type - def get_parentId(self, obj): get parentId - def get_geographicLevel(self, obj): get g...
Implement the Python class `LocationSerializer` described below. Class description: A class to serialize locations as OpenSRP GeoJSON compatible data Method signatures and docstrings: - def get_status(self, obj): get location_type - def get_parentId(self, obj): get parentId - def get_geographicLevel(self, obj): get g...
b3e0f4b5855abbf0298de6b66f2e9f472f2bf838
<|skeleton|> class LocationSerializer: """A class to serialize locations as OpenSRP GeoJSON compatible data""" def get_status(self, obj): """get location_type""" <|body_0|> def get_parentId(self, obj): """get parentId""" <|body_1|> def get_geographicLevel(self, obj): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LocationSerializer: """A class to serialize locations as OpenSRP GeoJSON compatible data""" def get_status(self, obj): """get location_type""" if obj: return settings.REVEAL_OPENSRP_ACTIVE return None def get_parentId(self, obj): """get parentId""" ...
the_stack_v2_python_sparse
mspray/apps/reveal/serializers.py
Frazerbesa/mspray
train
0
be49cd072287ad54285e819bad7a3b0d5dc33250
[ "blogpost_key = db.Key.from_path('BlogPost', int(post_id))\nblogpost_post = db.get(blogpost_key)\ncontent = blogpost_post.content\ntitle = blogpost_post.title\npost_user = blogpost_post.user\nlike_qry_str = \"Select * from Likes where post = '{}'\".format(post_id)\nlike_qry = db.GqlQuery(like_qry_str)\nlikes = -1\n...
<|body_start_0|> blogpost_key = db.Key.from_path('BlogPost', int(post_id)) blogpost_post = db.get(blogpost_key) content = blogpost_post.content title = blogpost_post.title post_user = blogpost_post.user like_qry_str = "Select * from Likes where post = '{}'".format(post_id...
Class for permalink posts
PostPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostPage: """Class for permalink posts""" def get(self, post_id): """Get method for posts to be displayed at permalink""" <|body_0|> def post(self, post_id): """Comment post method""" <|body_1|> <|end_skeleton|> <|body_start_0|> blogpost_key = d...
stack_v2_sparse_classes_75kplus_train_069495
1,957
no_license
[ { "docstring": "Get method for posts to be displayed at permalink", "name": "get", "signature": "def get(self, post_id)" }, { "docstring": "Comment post method", "name": "post", "signature": "def post(self, post_id)" } ]
2
stack_v2_sparse_classes_30k_val_001059
Implement the Python class `PostPage` described below. Class description: Class for permalink posts Method signatures and docstrings: - def get(self, post_id): Get method for posts to be displayed at permalink - def post(self, post_id): Comment post method
Implement the Python class `PostPage` described below. Class description: Class for permalink posts Method signatures and docstrings: - def get(self, post_id): Get method for posts to be displayed at permalink - def post(self, post_id): Comment post method <|skeleton|> class PostPage: """Class for permalink post...
772be02396e5c6320b81ed0811ca2308a87f5190
<|skeleton|> class PostPage: """Class for permalink posts""" def get(self, post_id): """Get method for posts to be displayed at permalink""" <|body_0|> def post(self, post_id): """Comment post method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostPage: """Class for permalink posts""" def get(self, post_id): """Get method for posts to be displayed at permalink""" blogpost_key = db.Key.from_path('BlogPost', int(post_id)) blogpost_post = db.get(blogpost_key) content = blogpost_post.content title = blogpost...
the_stack_v2_python_sparse
username/handlers/postpage.py
Jbrown95/g-app-projects
train
0
1d100a9a04e53c02a8eae3c4fc2f9a5309ab5c44
[ "if s == '':\n return s\nans = ''\nfor i in range(len(s)):\n res1 = self.Expand(s, i, i)\n res2 = self.Expand(s, i, i + 1)\n temp = res1 if len(res1) > len(res2) else res2\n ans = temp if len(temp) > len(ans) else ans\nreturn ans", "while p >= 0 and q < len(s):\n if s[p] == s[q]:\n p -= 1...
<|body_start_0|> if s == '': return s ans = '' for i in range(len(s)): res1 = self.Expand(s, i, i) res2 = self.Expand(s, i, i + 1) temp = res1 if len(res1) > len(res2) else res2 ans = temp if len(temp) > len(ans) else ans return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def Expand(self, s, p, q): """s中p,g为起点,比较是否相同""" <|body_1|> <|end_skeleton|> <|body_start_0|> if s == '': return s ans = '' for i in rang...
stack_v2_sparse_classes_75kplus_train_069496
5,236
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": "s中p,g为起点,比较是否相同", "name": "Expand", "signature": "def Expand(self, s, p, q)" } ]
2
stack_v2_sparse_classes_30k_train_038874
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def Expand(self, s, p, q): s中p,g为起点,比较是否相同
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def Expand(self, s, p, q): s中p,g为起点,比较是否相同 <|skeleton|> class Solution: def longestPalindrome(self, s): "...
6046d535ebd139d1348e0f2eafdb4135b4e3f52e
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def Expand(self, s, p, q): """s中p,g为起点,比较是否相同""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if s == '': return s ans = '' for i in range(len(s)): res1 = self.Expand(s, i, i) res2 = self.Expand(s, i, i + 1) temp = res1 if len(res1) > len(res2) else r...
the_stack_v2_python_sparse
005. Longest Palindromic Substring/solution.py
Neilqdddd/LeetCode
train
1
611d8ee2b513ddb0011a5b1d75ae54d9edb4a5a7
[ "self.preprocessed_dataframe = preprocessed_data\nself.model_subset = pd.DataFrame()\nself.retrieval_subset = pd.DataFrame()\nself.model_dataset_index = pd.DataFrame()\nself.model_dataset = pd.DataFrame()\nself.retrieval_dataset = pd.DataFrame()\nself.retrieval_dataset_index = pd.DataFrame()", "try:\n self.mod...
<|body_start_0|> self.preprocessed_dataframe = preprocessed_data self.model_subset = pd.DataFrame() self.retrieval_subset = pd.DataFrame() self.model_dataset_index = pd.DataFrame() self.model_dataset = pd.DataFrame() self.retrieval_dataset = pd.DataFrame() self.re...
Class for creating datasets for training a supervised translation classifier and for crosslingual information retrieval. Attributes: preprocessed_dataframe (dataframe): Preprocessed parallel translations dataframe. model_subset (dataframe): Subset of preprocessed_dataframe for training a supervised translation classifi...
DataSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSet: """Class for creating datasets for training a supervised translation classifier and for crosslingual information retrieval. Attributes: preprocessed_dataframe (dataframe): Preprocessed parallel translations dataframe. model_subset (dataframe): Subset of preprocessed_dataframe for trainin...
stack_v2_sparse_classes_75kplus_train_069497
5,067
permissive
[ { "docstring": "Initialize class by importing preprocessed data. Args: preprocessed_data (dataframe): Preprocessed dataframe of parallel translations.", "name": "__init__", "signature": "def __init__(self, preprocessed_data)" }, { "docstring": "Split data into model dataset and retrieval dataset...
4
stack_v2_sparse_classes_30k_train_004287
Implement the Python class `DataSet` described below. Class description: Class for creating datasets for training a supervised translation classifier and for crosslingual information retrieval. Attributes: preprocessed_dataframe (dataframe): Preprocessed parallel translations dataframe. model_subset (dataframe): Subse...
Implement the Python class `DataSet` described below. Class description: Class for creating datasets for training a supervised translation classifier and for crosslingual information retrieval. Attributes: preprocessed_dataframe (dataframe): Preprocessed parallel translations dataframe. model_subset (dataframe): Subse...
2fcfea31ee0d5f8db2e8ecec669ea199b732ada9
<|skeleton|> class DataSet: """Class for creating datasets for training a supervised translation classifier and for crosslingual information retrieval. Attributes: preprocessed_dataframe (dataframe): Preprocessed parallel translations dataframe. model_subset (dataframe): Subset of preprocessed_dataframe for trainin...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataSet: """Class for creating datasets for training a supervised translation classifier and for crosslingual information retrieval. Attributes: preprocessed_dataframe (dataframe): Preprocessed parallel translations dataframe. model_subset (dataframe): Subset of preprocessed_dataframe for training a supervise...
the_stack_v2_python_sparse
src/data/dataset_class.py
NiklasSabel/crosslingual-information-retrieval
train
0
987ae6c835a0900db3aa68476a756d5ca97b8a74
[ "menu_item.MenuItem.__init__(self, main_menu, frame)\nself.create_menu_item_button('User Management')\nself.menu_item_button['command'] = self.get_user_management_window", "self.gui.active_window.hide()\nself.associated_window = user_management_window.UserManagementWindow(self.gui)\nself.gui.active_window = self....
<|body_start_0|> menu_item.MenuItem.__init__(self, main_menu, frame) self.create_menu_item_button('User Management') self.menu_item_button['command'] = self.get_user_management_window <|end_body_0|> <|body_start_1|> self.gui.active_window.hide() self.associated_window = user_man...
This class is used to create a button that will bring the user to the user management menu.
UserManagementMenuItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserManagementMenuItem: """This class is used to create a button that will bring the user to the user management menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the G...
stack_v2_sparse_classes_75kplus_train_069498
1,091
no_license
[ { "docstring": "Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window", "name": "__init__", "signature": "def __init__(self, main_menu, frame)" }, { "docstring": "This function will hide everything on the activ...
2
stack_v2_sparse_classes_30k_train_043634
Implement the Python class `UserManagementMenuItem` described below. Class description: This class is used to create a button that will bring the user to the user management menu. Method signatures and docstrings: - def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu b...
Implement the Python class `UserManagementMenuItem` described below. Class description: This class is used to create a button that will bring the user to the user management menu. Method signatures and docstrings: - def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu b...
e26d9450b98fa0f372bcdf6eaf251a2c9dcba44e
<|skeleton|> class UserManagementMenuItem: """This class is used to create a button that will bring the user to the user management menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the G...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserManagementMenuItem: """This class is used to create a button that will bring the user to the user management menu.""" def __init__(self, main_menu, frame): """Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active w...
the_stack_v2_python_sparse
user_interface/menu_items/user_management_menu_item.py
pucheng-tan/WordFlow
train
0
5a2861277aa647784d680d3c08c1c58aea55f4e2
[ "super().__init__('person', 'a person', loc)\nself.aggression = aggression\nself.seen_mouse = False\nself.path = ''\nself.home_room = loc", "room = level.room_dict[self.location]\nif room.inventory.check_inventory('casted_scare') and self.aggression < 3:\n pass\nelif room.get_character_by_type(Mouse) and (not ...
<|body_start_0|> super().__init__('person', 'a person', loc) self.aggression = aggression self.seen_mouse = False self.path = '' self.home_room = loc <|end_body_0|> <|body_start_1|> room = level.room_dict[self.location] if room.inventory.check_inventory('casted_s...
Person
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Person: def __init__(self, loc, aggression=randrange(1, 5)): """Instantiates a Person character.""" <|body_0|> def activate(self, level): """Determines how Person interacts with rooms, room invenstories (casted spells), and mouse in room.""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_069499
11,037
permissive
[ { "docstring": "Instantiates a Person character.", "name": "__init__", "signature": "def __init__(self, loc, aggression=randrange(1, 5))" }, { "docstring": "Determines how Person interacts with rooms, room invenstories (casted spells), and mouse in room.", "name": "activate", "signature"...
2
null
Implement the Python class `Person` described below. Class description: Implement the Person class. Method signatures and docstrings: - def __init__(self, loc, aggression=randrange(1, 5)): Instantiates a Person character. - def activate(self, level): Determines how Person interacts with rooms, room invenstories (cast...
Implement the Python class `Person` described below. Class description: Implement the Person class. Method signatures and docstrings: - def __init__(self, loc, aggression=randrange(1, 5)): Instantiates a Person character. - def activate(self, level): Determines how Person interacts with rooms, room invenstories (cast...
f8bf97e03586a83c860845a383a32162b9bea74c
<|skeleton|> class Person: def __init__(self, loc, aggression=randrange(1, 5)): """Instantiates a Person character.""" <|body_0|> def activate(self, level): """Determines how Person interacts with rooms, room invenstories (casted spells), and mouse in room.""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Person: def __init__(self, loc, aggression=randrange(1, 5)): """Instantiates a Person character.""" super().__init__('person', 'a person', loc) self.aggression = aggression self.seen_mouse = False self.path = '' self.home_room = loc def activate(self, level...
the_stack_v2_python_sparse
Python/danger_mouse_game/character.py
jastr945/PDXclass
train
0