blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
e5f2d4eae3fea02c3a0c597cd7f4143a12753406
[ "role_filterbackend = []\nif hasattr(view, 'get_roles_filterbackends'):\n roles_filterbackends = view.get_roles_filterbackends()\nelse:\n roles_filterbackends = getattr(view, 'roles_filterbackends', [])\nreturn roles_filterbackends", "roles_filterbackends_name = []\nfilterbackend_ids = []\napi = self.get_ap...
<|body_start_0|> role_filterbackend = [] if hasattr(view, 'get_roles_filterbackends'): roles_filterbackends = view.get_roles_filterbackends() else: roles_filterbackends = getattr(view, 'roles_filterbackends', []) return roles_filterbackends <|end_body_0|> <|body_...
RestFilterGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestFilterGenerator: def get_roles_filterbackends(self, view): """Return the `FilterSet` class used to filter the queryset.""" <|body_0|> def update_roleFilterModel(self, request=None, public=False): """Generate a `rest permissions` into RestPermisson model.""" ...
stack_v2_sparse_classes_36k_train_017600
2,439
no_license
[ { "docstring": "Return the `FilterSet` class used to filter the queryset.", "name": "get_roles_filterbackends", "signature": "def get_roles_filterbackends(self, view)" }, { "docstring": "Generate a `rest permissions` into RestPermisson model.", "name": "update_roleFilterModel", "signatur...
2
null
Implement the Python class `RestFilterGenerator` described below. Class description: Implement the RestFilterGenerator class. Method signatures and docstrings: - def get_roles_filterbackends(self, view): Return the `FilterSet` class used to filter the queryset. - def update_roleFilterModel(self, request=None, public=...
Implement the Python class `RestFilterGenerator` described below. Class description: Implement the RestFilterGenerator class. Method signatures and docstrings: - def get_roles_filterbackends(self, view): Return the `FilterSet` class used to filter the queryset. - def update_roleFilterModel(self, request=None, public=...
3d0dbcf92642fe42293736f8bdf812d43e0cb67b
<|skeleton|> class RestFilterGenerator: def get_roles_filterbackends(self, view): """Return the `FilterSet` class used to filter the queryset.""" <|body_0|> def update_roleFilterModel(self, request=None, public=False): """Generate a `rest permissions` into RestPermisson model.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestFilterGenerator: def get_roles_filterbackends(self, view): """Return the `FilterSet` class used to filter the queryset.""" role_filterbackend = [] if hasattr(view, 'get_roles_filterbackends'): roles_filterbackends = view.get_roles_filterbackends() else: ...
the_stack_v2_python_sparse
permissions/filterregist.py
catding/trainserver
train
0
046c73e02c5cb0f54fc4c07286ebcd28e470b6d9
[ "self._total_size = None\nself.total_processed = 0\nself.total_elapsed = 0", "col_width = 15\ncomplete_col_width = 60\nfile_elapsed = max(sys.float_info.epsilon, file_elapsed)\nif file_processed != file_size:\n elapsed = self.total_elapsed + file_elapsed\n processed = self.total_processed + file_processed\n...
<|body_start_0|> self._total_size = None self.total_processed = 0 self.total_elapsed = 0 <|end_body_0|> <|body_start_1|> col_width = 15 complete_col_width = 60 file_elapsed = max(sys.float_info.epsilon, file_elapsed) if file_processed != file_size: el...
ConsoleProgress
[ "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsoleProgress: def __init__(self): """ConsoleProgress constructor.""" <|body_0|> def __call__(self, file_path, file_processed, file_size, file_elapsed): """Callback for shaone_b64. Args: file_path (str): File absolute path. file_processed (int): Bytes processed for...
stack_v2_sparse_classes_36k_train_017601
7,138
permissive
[ { "docstring": "ConsoleProgress constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Callback for shaone_b64. Args: file_path (str): File absolute path. file_processed (int): Bytes processed for the current file file_size (int): Size of the current file file_el...
2
null
Implement the Python class `ConsoleProgress` described below. Class description: Implement the ConsoleProgress class. Method signatures and docstrings: - def __init__(self): ConsoleProgress constructor. - def __call__(self, file_path, file_processed, file_size, file_elapsed): Callback for shaone_b64. Args: file_path ...
Implement the Python class `ConsoleProgress` described below. Class description: Implement the ConsoleProgress class. Method signatures and docstrings: - def __init__(self): ConsoleProgress constructor. - def __call__(self, file_path, file_processed, file_size, file_elapsed): Callback for shaone_b64. Args: file_path ...
676698ae55a9123f5e6ac3669ef8f8cf1b100dac
<|skeleton|> class ConsoleProgress: def __init__(self): """ConsoleProgress constructor.""" <|body_0|> def __call__(self, file_path, file_processed, file_size, file_elapsed): """Callback for shaone_b64. Args: file_path (str): File absolute path. file_processed (int): Bytes processed for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConsoleProgress: def __init__(self): """ConsoleProgress constructor.""" self._total_size = None self.total_processed = 0 self.total_elapsed = 0 def __call__(self, file_path, file_processed, file_size, file_elapsed): """Callback for shaone_b64. Args: file_path (str)...
the_stack_v2_python_sparse
clairmeta/utils/file.py
Ymagis/ClairMeta
train
74
fb39332873cc47ce7bf2663492d3a110359ef1d5
[ "s = sessionmanage(self.driver)\ns.open_sessionmanage()\nself.assertEqual(s.verify(), True)\ns.delete_obj()\nself.assertEqual(s.result(), '您确定要删除这条信息吗')\ns.confirm()\nself.assertEqual(s.reason(), '无权删除')\nfunction.screenshot(self.driver, 'session_delete.jpg')", "s = sessionmanage(self.driver)\ns.open_sessionmanag...
<|body_start_0|> s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqual(s.verify(), True) s.delete_obj() self.assertEqual(s.result(), '您确定要删除这条信息吗') s.confirm() self.assertEqual(s.reason(), '无权删除') function.screenshot(self.driver, 'session_...
Test048_Session_Delete_P1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test048_Session_Delete_P1: def test_session_delete(self): """删除会话""" <|body_0|> def test_session_delete_cancle(self): """取消删除会话""" <|body_1|> <|end_skeleton|> <|body_start_0|> s = sessionmanage(self.driver) s.open_sessionmanage() sel...
stack_v2_sparse_classes_36k_train_017602
1,111
no_license
[ { "docstring": "删除会话", "name": "test_session_delete", "signature": "def test_session_delete(self)" }, { "docstring": "取消删除会话", "name": "test_session_delete_cancle", "signature": "def test_session_delete_cancle(self)" } ]
2
stack_v2_sparse_classes_30k_train_014822
Implement the Python class `Test048_Session_Delete_P1` described below. Class description: Implement the Test048_Session_Delete_P1 class. Method signatures and docstrings: - def test_session_delete(self): 删除会话 - def test_session_delete_cancle(self): 取消删除会话
Implement the Python class `Test048_Session_Delete_P1` described below. Class description: Implement the Test048_Session_Delete_P1 class. Method signatures and docstrings: - def test_session_delete(self): 删除会话 - def test_session_delete_cancle(self): 取消删除会话 <|skeleton|> class Test048_Session_Delete_P1: def test_...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test048_Session_Delete_P1: def test_session_delete(self): """删除会话""" <|body_0|> def test_session_delete_cancle(self): """取消删除会话""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test048_Session_Delete_P1: def test_session_delete(self): """删除会话""" s = sessionmanage(self.driver) s.open_sessionmanage() self.assertEqual(s.verify(), True) s.delete_obj() self.assertEqual(s.result(), '您确定要删除这条信息吗') s.confirm() self.assertEqual(...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Session/Test048_session_delete_P1.py
rrmiracle/GlxssLive
train
0
d6caca973b4a6afbcfce6986451f8096d03f83d6
[ "for row in rows:\n if str(row.product_code) == product and str(row.activity) == state:\n if chart_type == 'order':\n product_data.append(int(row.orders))\n else:\n product_data.append(int(row.units))\n break\nelse:\n product_data.append(0)", "product_data.append(0...
<|body_start_0|> for row in rows: if str(row.product_code) == product and str(row.activity) == state: if chart_type == 'order': product_data.append(int(row.orders)) else: product_data.append(int(row.units)) break...
Gathers data for the various pipeline related charts that show progress through the workflow for all products.
PipelineChartProc
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineChartProc: """Gathers data for the various pipeline related charts that show progress through the workflow for all products.""" def _appendAggregate(self, rows, product, state, chart_type, product_data): """Append the aggregate for the requested product / state combo to the l...
stack_v2_sparse_classes_36k_train_017603
3,498
no_license
[ { "docstring": "Append the aggregate for the requested product / state combo to the list of data for the current product.", "name": "_appendAggregate", "signature": "def _appendAggregate(self, rows, product, state, chart_type, product_data)" }, { "docstring": "Append sum of the aggregates for th...
3
stack_v2_sparse_classes_30k_train_017664
Implement the Python class `PipelineChartProc` described below. Class description: Gathers data for the various pipeline related charts that show progress through the workflow for all products. Method signatures and docstrings: - def _appendAggregate(self, rows, product, state, chart_type, product_data): Append the a...
Implement the Python class `PipelineChartProc` described below. Class description: Gathers data for the various pipeline related charts that show progress through the workflow for all products. Method signatures and docstrings: - def _appendAggregate(self, rows, product, state, chart_type, product_data): Append the a...
a0edcc220f5c950838c0d0a5e42ee06bb7f2c6ad
<|skeleton|> class PipelineChartProc: """Gathers data for the various pipeline related charts that show progress through the workflow for all products.""" def _appendAggregate(self, rows, product, state, chart_type, product_data): """Append the aggregate for the requested product / state combo to the l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PipelineChartProc: """Gathers data for the various pipeline related charts that show progress through the workflow for all products.""" def _appendAggregate(self, rows, product, state, chart_type, product_data): """Append the aggregate for the requested product / state combo to the list of data f...
the_stack_v2_python_sparse
pipelinechartproc.py
ryanlowe0/misc-python
train
0
a7669150fc762245c8fb0d68f8df6901ff0b2d8d
[ "storage = get_storage()\nsite = storage.read_site(site_id)\nreturn jsonify(SiteResponseSchema().dump(site))", "data = request.get_json()\ntry:\n changes = SiteUpdateSchema().load(data)\nexcept ValidationError as err:\n raise BadAPIRequest(err.messages)\nstorage = get_storage()\nchanges.update(changes.pop('...
<|body_start_0|> storage = get_storage() site = storage.read_site(site_id) return jsonify(SiteResponseSchema().dump(site)) <|end_body_0|> <|body_start_1|> data = request.get_json() try: changes = SiteUpdateSchema().load(data) except ValidationError as err: ...
SiteView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SiteView: def get(self, site_id, *args): """--- summary: Get site metadata tags: - Sites parameters: - site_id responses: 200: description: Successfully retrieved site metadata. content: application/json: schema: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#/components/response...
stack_v2_sparse_classes_36k_train_017604
10,882
permissive
[ { "docstring": "--- summary: Get site metadata tags: - Sites parameters: - site_id responses: 200: description: Successfully retrieved site metadata. content: application/json: schema: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#/components/responses/401-Unauthorized' 404: $ref: '#/components/respons...
3
stack_v2_sparse_classes_30k_train_011434
Implement the Python class `SiteView` described below. Class description: Implement the SiteView class. Method signatures and docstrings: - def get(self, site_id, *args): --- summary: Get site metadata tags: - Sites parameters: - site_id responses: 200: description: Successfully retrieved site metadata. content: appl...
Implement the Python class `SiteView` described below. Class description: Implement the SiteView class. Method signatures and docstrings: - def get(self, site_id, *args): --- summary: Get site metadata tags: - Sites parameters: - site_id responses: 200: description: Successfully retrieved site metadata. content: appl...
280800c73eb7cfd49029462b352887e78f1ff91b
<|skeleton|> class SiteView: def get(self, site_id, *args): """--- summary: Get site metadata tags: - Sites parameters: - site_id responses: 200: description: Successfully retrieved site metadata. content: application/json: schema: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#/components/response...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SiteView: def get(self, site_id, *args): """--- summary: Get site metadata tags: - Sites parameters: - site_id responses: 200: description: Successfully retrieved site metadata. content: application/json: schema: $ref: '#/components/schemas/SiteMetadata' 401: $ref: '#/components/responses/401-Unauthor...
the_stack_v2_python_sparse
sfa_api/sites.py
SolarArbiter/solarforecastarbiter-api
train
9
38513bd6052296cccc1385f3a921f76e6da53ccd
[ "self.value = None\nself.trigger_time = None\nself.triggered = False", "self.value = value\nself.trigger_time = time.time()\nself.triggered = True", "self.value = value\nself.trigger_time = None\nself.triggered = False" ]
<|body_start_0|> self.value = None self.trigger_time = None self.triggered = False <|end_body_0|> <|body_start_1|> self.value = value self.trigger_time = time.time() self.triggered = True <|end_body_1|> <|body_start_2|> self.value = value self.trigger_ti...
Signal
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Signal: def __init__(self): """Init the Signal. Used to signal between and within FL Components.""" <|body_0|> def trigger(self, value): """Trigger the Signal. Args: value: set the value of the signal""" <|body_1|> def reset(self, value=None): ""...
stack_v2_sparse_classes_36k_train_017605
1,322
permissive
[ { "docstring": "Init the Signal. Used to signal between and within FL Components.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Trigger the Signal. Args: value: set the value of the signal", "name": "trigger", "signature": "def trigger(self, value)" }, { ...
3
null
Implement the Python class `Signal` described below. Class description: Implement the Signal class. Method signatures and docstrings: - def __init__(self): Init the Signal. Used to signal between and within FL Components. - def trigger(self, value): Trigger the Signal. Args: value: set the value of the signal - def r...
Implement the Python class `Signal` described below. Class description: Implement the Signal class. Method signatures and docstrings: - def __init__(self): Init the Signal. Used to signal between and within FL Components. - def trigger(self, value): Trigger the Signal. Args: value: set the value of the signal - def r...
1433290c203bd23f34c29e11795ce592bc067888
<|skeleton|> class Signal: def __init__(self): """Init the Signal. Used to signal between and within FL Components.""" <|body_0|> def trigger(self, value): """Trigger the Signal. Args: value: set the value of the signal""" <|body_1|> def reset(self, value=None): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Signal: def __init__(self): """Init the Signal. Used to signal between and within FL Components.""" self.value = None self.trigger_time = None self.triggered = False def trigger(self, value): """Trigger the Signal. Args: value: set the value of the signal""" ...
the_stack_v2_python_sparse
nvflare/apis/signal.py
NVIDIA/NVFlare
train
442
a7df9d3f14650330b23cde961bf59f203eeaed4c
[ "send_key(KEYCODE_POWER, LONG_PRESS)\nif search_text(notificationBar.get_value('airplanemodeon')):\n goback()\n return True\nelse:\n goback()\n return False", "send_key(KEYCODE_POWER, LONG_PRESS)\nif search_text(notificationBar.get_value('airplanemodeon')):\n click_textview_by_text(notificationBar....
<|body_start_0|> send_key(KEYCODE_POWER, LONG_PRESS) if search_text(notificationBar.get_value('airplanemodeon')): goback() return True else: goback() return False <|end_body_0|> <|body_start_1|> send_key(KEYCODE_POWER, LONG_PRESS) ...
test_suit_airplanemode_case2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_suit_airplanemode_case2: def IS_AirplaneMode_on(self): """This function get the airplan mode. @rtype: boolean @return: True -airplan mode on, False-airplan mode off""" <|body_0|> def AirplaneMode_turnoff(self): """This function set the airplan mode off. @return:...
stack_v2_sparse_classes_36k_train_017606
4,192
no_license
[ { "docstring": "This function get the airplan mode. @rtype: boolean @return: True -airplan mode on, False-airplan mode off", "name": "IS_AirplaneMode_on", "signature": "def IS_AirplaneMode_on(self)" }, { "docstring": "This function set the airplan mode off. @return: none", "name": "AirplaneM...
5
null
Implement the Python class `test_suit_airplanemode_case2` described below. Class description: Implement the test_suit_airplanemode_case2 class. Method signatures and docstrings: - def IS_AirplaneMode_on(self): This function get the airplan mode. @rtype: boolean @return: True -airplan mode on, False-airplan mode off -...
Implement the Python class `test_suit_airplanemode_case2` described below. Class description: Implement the test_suit_airplanemode_case2 class. Method signatures and docstrings: - def IS_AirplaneMode_on(self): This function get the airplan mode. @rtype: boolean @return: True -airplan mode on, False-airplan mode off -...
a04b717ae437511abae1e7e9e399373c161a7b65
<|skeleton|> class test_suit_airplanemode_case2: def IS_AirplaneMode_on(self): """This function get the airplan mode. @rtype: boolean @return: True -airplan mode on, False-airplan mode off""" <|body_0|> def AirplaneMode_turnoff(self): """This function set the airplan mode off. @return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_suit_airplanemode_case2: def IS_AirplaneMode_on(self): """This function get the airplan mode. @rtype: boolean @return: True -airplan mode on, False-airplan mode off""" send_key(KEYCODE_POWER, LONG_PRESS) if search_text(notificationBar.get_value('airplanemodeon')): goba...
the_stack_v2_python_sparse
test_env/test_suit_airplanemode/test_suit_airplanemode_case2.py
wwlwwlqaz/Qualcomm
train
1
f4338a955716d3a72a9fd7f3b4ca11cfdc04fe17
[ "user = get_current_user()\nuser_info = UserInfo.query.filter_by(user_id=user.id).first()\nuser_info_schema = UserInfoSchema()\nuser_schema = UserSchema()\nresponse_data = user_info_schema.dump(user_info).data\nresponse_data.update(user_schema.dump(user).data)\nreturn json_response(response_data, message='ok')", ...
<|body_start_0|> user = get_current_user() user_info = UserInfo.query.filter_by(user_id=user.id).first() user_info_schema = UserInfoSchema() user_schema = UserSchema() response_data = user_info_schema.dump(user_info).data response_data.update(user_schema.dump(user).data) ...
UserInfoResource
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserInfoResource: def get(self): """获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signature": "", "email": ""}, "message": "ok"}""" <|body_0|> def put(self, **kwargs): """...
stack_v2_sparse_classes_36k_train_017607
10,463
permissive
[ { "docstring": "获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {\"data\": {\"name\": \"\", \"signature\": \"\", \"email\": \"\"}, \"message\": \"ok\"}", "name": "get", "signature": "def get(self)" }, { "docstring": "修改用户信息 -...
2
stack_v2_sparse_classes_30k_train_019513
Implement the Python class `UserInfoResource` described below. Class description: Implement the UserInfoResource class. Method signatures and docstrings: - def get(self): 获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signa...
Implement the Python class `UserInfoResource` described below. Class description: Implement the UserInfoResource class. Method signatures and docstrings: - def get(self): 获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signa...
de894e8f8c163cb5aafe360dc146d1a4ded20ddb
<|skeleton|> class UserInfoResource: def get(self): """获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signature": "", "email": ""}, "message": "ok"}""" <|body_0|> def put(self, **kwargs): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserInfoResource: def get(self): """获取用户基本信息 --- tags: - 用户 responses: 200: description: A list of colors (may be filtered by palette) examples: response: {"data": {"name": "", "signature": "", "email": ""}, "message": "ok"}""" user = get_current_user() user_info = UserInfo.query.filte...
the_stack_v2_python_sparse
arrplat/resources/user/views.py
zhengdeding/tefact-engine
train
0
68009ffe17ed207a579cdf3f777e0aaa3a10fc42
[ "if len(tokens) == 1:\n return tokens[0] + ' ' * (maxWidth - len(tokens[0]))\nnumSpaces = maxWidth - sum((len(t) for t in tokens))\ngapLength = numSpaces / (len(tokens) - 1)\nextraSpaces = numSpaces % (len(tokens) - 1)\nleftGap = gapLength\nif extraSpaces != 0:\n res = ''\n for i in range(extraSpaces):\n ...
<|body_start_0|> if len(tokens) == 1: return tokens[0] + ' ' * (maxWidth - len(tokens[0])) numSpaces = maxWidth - sum((len(t) for t in tokens)) gapLength = numSpaces / (len(tokens) - 1) extraSpaces = numSpaces % (len(tokens) - 1) leftGap = gapLength if extraSp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reorderSpaces(self, tokens, maxWidth): """:type text: str :rtype: str""" <|body_0|> def fullJustify(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_017608
1,963
no_license
[ { "docstring": ":type text: str :rtype: str", "name": "reorderSpaces", "signature": "def reorderSpaces(self, tokens, maxWidth)" }, { "docstring": ":type words: List[str] :type maxWidth: int :rtype: List[str]", "name": "fullJustify", "signature": "def fullJustify(self, words, maxWidth)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderSpaces(self, tokens, maxWidth): :type text: str :rtype: str - def fullJustify(self, words, maxWidth): :type words: List[str] :type maxWidth: int :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reorderSpaces(self, tokens, maxWidth): :type text: str :rtype: str - def fullJustify(self, words, maxWidth): :type words: List[str] :type maxWidth: int :rtype: List[str] <|s...
0821af55eca60084b503b5f751301048c55e4381
<|skeleton|> class Solution: def reorderSpaces(self, tokens, maxWidth): """:type text: str :rtype: str""" <|body_0|> def fullJustify(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reorderSpaces(self, tokens, maxWidth): """:type text: str :rtype: str""" if len(tokens) == 1: return tokens[0] + ' ' * (maxWidth - len(tokens[0])) numSpaces = maxWidth - sum((len(t) for t in tokens)) gapLength = numSpaces / (len(tokens) - 1) ex...
the_stack_v2_python_sparse
Hard/LC68.py
shuowenwei/LeetCodePython
train
2
330beae971f451d968e900b5576ae4d54a8d6f18
[ "res = []\n\ndef traverse(root):\n if root is None:\n res.append('#')\n else:\n res.append(str(root.val))\n traverse(root.left)\n traverse(root.right)\ntraverse(root)\nreturn ','.join(res)", "if data is None:\n return None\n\ndef constructTree():\n try:\n val = vals....
<|body_start_0|> res = [] def traverse(root): if root is None: res.append('#') else: res.append(str(root.val)) traverse(root.left) traverse(root.right) traverse(root) return ','.join(res) <|end_body_...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_017609
1,325
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_016505
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:...
56e33dff3918e371f14d6f7ef03f8951056cc273
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] def traverse(root): if root is None: res.append('#') else: res.append(str(root.val)) traverse(ro...
the_stack_v2_python_sparse
accepted/Serialize and Deserialize Binary Tree.py
hustlrr/leetcode
train
4
2a344cde064c4f6dc55cc8913569fddb19537382
[ "self.color = color\nif fill is None:\n fill = color\nself.fill = fill\nself.length = length\nif width is None:\n width = length / 2\nself.width = width\nself.rotation = rotation", "table_str = f'Ball2dTable:{self.color}'\ntable_str += f' length:{self.length} x {self.width} ft'\nreturn table_str" ]
<|body_start_0|> self.color = color if fill is None: fill = color self.fill = fill self.length = length if width is None: width = length / 2 self.width = width self.rotation = rotation <|end_body_0|> <|body_start_1|> table_str = f'...
Ball2dTable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ball2dTable: def __init__(self, color='green', fill=None, length=9, width=None, rotation=None): """Define/Setup Tables's attributes :color: table's color default: green :fill: table fill color default: same as color :length: length in feet default: 9 :width: width in feet default: length...
stack_v2_sparse_classes_36k_train_017610
1,423
no_license
[ { "docstring": "Define/Setup Tables's attributes :color: table's color default: green :fill: table fill color default: same as color :length: length in feet default: 9 :width: width in feet default: length/2 :rotation: length orientation in degrees default: No rotation", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_val_000844
Implement the Python class `Ball2dTable` described below. Class description: Implement the Ball2dTable class. Method signatures and docstrings: - def __init__(self, color='green', fill=None, length=9, width=None, rotation=None): Define/Setup Tables's attributes :color: table's color default: green :fill: table fill c...
Implement the Python class `Ball2dTable` described below. Class description: Implement the Ball2dTable class. Method signatures and docstrings: - def __init__(self, color='green', fill=None, length=9, width=None, rotation=None): Define/Setup Tables's attributes :color: table's color default: green :fill: table fill c...
bedc16eb5f6db0ad3b313355df6d51b5161c3835
<|skeleton|> class Ball2dTable: def __init__(self, color='green', fill=None, length=9, width=None, rotation=None): """Define/Setup Tables's attributes :color: table's color default: green :fill: table fill color default: same as color :length: length in feet default: 9 :width: width in feet default: length...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ball2dTable: def __init__(self, color='green', fill=None, length=9, width=None, rotation=None): """Define/Setup Tables's attributes :color: table's color default: green :fill: table fill color default: same as color :length: length in feet default: 9 :width: width in feet default: length/2 :rotation: ...
the_stack_v2_python_sparse
exercises/classes/ball_classes/ball_2d_table.py
raysmith619/Introduction-To-Programming
train
3
9677618f7e10d1b0a8472e4d5fb7f9e9cc540474
[ "super(TunnelInterface, self).__init__(vrf_name=vrf_name, if_name=if_name)\nself.uni_if_name = uni_if_name\nself.uni_vlan_id = uni_vlan_id\nself.tunnel_source = tunnel_source", "parame = self._get_param()\ncomm_txt = 'interface %(if_name)s'\nself._append_add_command(comm_txt, parame)\ncomm_txt = 'vrf forwarding %...
<|body_start_0|> super(TunnelInterface, self).__init__(vrf_name=vrf_name, if_name=if_name) self.uni_if_name = uni_if_name self.uni_vlan_id = uni_vlan_id self.tunnel_source = tunnel_source <|end_body_0|> <|body_start_1|> parame = self._get_param() comm_txt = 'interface %(...
Parts Class for ASR driver tunnel interface configuration
TunnelInterface
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TunnelInterface: """Parts Class for ASR driver tunnel interface configuration""" def __init__(self, vrf_name=None, if_name=None, uni_if_name=None, uni_vlan_id=None, tunnel_source=None): """Costructor""" <|body_0|> def output_add_command(self): """Command line to ...
stack_v2_sparse_classes_36k_train_017611
2,544
permissive
[ { "docstring": "Costructor", "name": "__init__", "signature": "def __init__(self, vrf_name=None, if_name=None, uni_if_name=None, uni_vlan_id=None, tunnel_source=None)" }, { "docstring": "Command line to add configuration is output.", "name": "output_add_command", "signature": "def output...
3
stack_v2_sparse_classes_30k_train_003279
Implement the Python class `TunnelInterface` described below. Class description: Parts Class for ASR driver tunnel interface configuration Method signatures and docstrings: - def __init__(self, vrf_name=None, if_name=None, uni_if_name=None, uni_vlan_id=None, tunnel_source=None): Costructor - def output_add_command(se...
Implement the Python class `TunnelInterface` described below. Class description: Parts Class for ASR driver tunnel interface configuration Method signatures and docstrings: - def __init__(self, vrf_name=None, if_name=None, uni_if_name=None, uni_vlan_id=None, tunnel_source=None): Costructor - def output_add_command(se...
e550d1b5ec9419f1fb3eb6e058ce46b57c92ee2f
<|skeleton|> class TunnelInterface: """Parts Class for ASR driver tunnel interface configuration""" def __init__(self, vrf_name=None, if_name=None, uni_if_name=None, uni_vlan_id=None, tunnel_source=None): """Costructor""" <|body_0|> def output_add_command(self): """Command line to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TunnelInterface: """Parts Class for ASR driver tunnel interface configuration""" def __init__(self, vrf_name=None, if_name=None, uni_if_name=None, uni_vlan_id=None, tunnel_source=None): """Costructor""" super(TunnelInterface, self).__init__(vrf_name=vrf_name, if_name=if_name) self...
the_stack_v2_python_sparse
lib/SeparateDriver/ASRDriverParts/TunnelInterface.py
lixiaochun/element-manager
train
0
5bd95bcc51b394f57115924fdfd730e0f6226a53
[ "self.classifier = classifier\nself.regressor = regressor\nself.classFields = classFields\nself.regFields = regFields", "y = np.ravel(y)\nposYInd = y > 0\nbinaryY = copy(y)\nbinaryY[posYInd] = 1\nx_classify = X[:, self.classFields]\ny_classify = binaryY\nif sample_weight is not None and 'sample_weight' in self.cl...
<|body_start_0|> self.classifier = classifier self.regressor = regressor self.classFields = classFields self.regFields = regFields <|end_body_0|> <|body_start_1|> y = np.ravel(y) posYInd = y > 0 binaryY = copy(y) binaryY[posYInd] = 1 x_classify = ...
First use classification to figure out which y's are positive. Then use regression to figure out the actual values of the positive y's.
ClassifyThenRegress
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassifyThenRegress: """First use classification to figure out which y's are positive. Then use regression to figure out the actual values of the positive y's.""" def __init__(self, classifier, regressor, classFields, regFields): """:param classifier: :param regressor: :param classFi...
stack_v2_sparse_classes_36k_train_017612
2,216
no_license
[ { "docstring": ":param classifier: :param regressor: :param classFields: array of column indicators used for classification :param regFields: array of column indicators used for regression :return:", "name": "__init__", "signature": "def __init__(self, classifier, regressor, classFields, regFields)" }...
3
stack_v2_sparse_classes_30k_train_010837
Implement the Python class `ClassifyThenRegress` described below. Class description: First use classification to figure out which y's are positive. Then use regression to figure out the actual values of the positive y's. Method signatures and docstrings: - def __init__(self, classifier, regressor, classFields, regFie...
Implement the Python class `ClassifyThenRegress` described below. Class description: First use classification to figure out which y's are positive. Then use regression to figure out the actual values of the positive y's. Method signatures and docstrings: - def __init__(self, classifier, regressor, classFields, regFie...
35d20eeef168f69586b49bd87db30cbf2839beb4
<|skeleton|> class ClassifyThenRegress: """First use classification to figure out which y's are positive. Then use regression to figure out the actual values of the positive y's.""" def __init__(self, classifier, regressor, classFields, regFields): """:param classifier: :param regressor: :param classFi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClassifyThenRegress: """First use classification to figure out which y's are positive. Then use regression to figure out the actual values of the positive y's.""" def __init__(self, classifier, regressor, classFields, regFields): """:param classifier: :param regressor: :param classFields: array o...
the_stack_v2_python_sparse
Fire/ClassifyThenRegress.py
j-planet/Kaggle
train
0
eed95ae6f4d8b99017743000c4ef8ed20e112582
[ "if not hasattr(filename, 'read'):\n raise ParseError('Item to parse must be a file-like object.')\nf = codecs.getreader('utf-8')(filename)\nself.file = f\nself.buffer = ''\nwhile True:\n self.line = self.readline()\n if self.line is None:\n break\n if self.line == '':\n raise ParseError(f...
<|body_start_0|> if not hasattr(filename, 'read'): raise ParseError('Item to parse must be a file-like object.') f = codecs.getreader('utf-8')(filename) self.file = f self.buffer = '' while True: self.line = self.readline() if self.line is None...
This class is an extension to ``rdflib.plugins.parsers.ntriples.W3CNTriplesParser`` that parses N-Triples and yields triples.
CustomNTriplesParser
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomNTriplesParser: """This class is an extension to ``rdflib.plugins.parsers.ntriples.W3CNTriplesParser`` that parses N-Triples and yields triples.""" def parse(self, filename: str) -> Generator: """Parses an N-Triples file and yields triples. Parameters ---------- filename: str T...
stack_v2_sparse_classes_36k_train_017613
2,156
permissive
[ { "docstring": "Parses an N-Triples file and yields triples. Parameters ---------- filename: str The filename to parse Returns ------- Generator A generator for triples", "name": "parse", "signature": "def parse(self, filename: str) -> Generator" }, { "docstring": "Parse each line and yield trip...
2
stack_v2_sparse_classes_30k_train_013494
Implement the Python class `CustomNTriplesParser` described below. Class description: This class is an extension to ``rdflib.plugins.parsers.ntriples.W3CNTriplesParser`` that parses N-Triples and yields triples. Method signatures and docstrings: - def parse(self, filename: str) -> Generator: Parses an N-Triples file ...
Implement the Python class `CustomNTriplesParser` described below. Class description: This class is an extension to ``rdflib.plugins.parsers.ntriples.W3CNTriplesParser`` that parses N-Triples and yields triples. Method signatures and docstrings: - def parse(self, filename: str) -> Generator: Parses an N-Triples file ...
24349ca4931734301bd3c45e17a6a0a27a3a42ad
<|skeleton|> class CustomNTriplesParser: """This class is an extension to ``rdflib.plugins.parsers.ntriples.W3CNTriplesParser`` that parses N-Triples and yields triples.""" def parse(self, filename: str) -> Generator: """Parses an N-Triples file and yields triples. Parameters ---------- filename: str T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomNTriplesParser: """This class is an extension to ``rdflib.plugins.parsers.ntriples.W3CNTriplesParser`` that parses N-Triples and yields triples.""" def parse(self, filename: str) -> Generator: """Parses an N-Triples file and yields triples. Parameters ---------- filename: str The filename t...
the_stack_v2_python_sparse
kgx/parsers/ntriples_parser.py
biolink/kgx
train
64
87da29dba6340ec4955cc8c858e6108d0a19d6ed
[ "super(LMLossLayer, self).__init__(**kwargs)\nself.n_token = n_token\nself.d_model = d_model\nself.initializer = initializer\nself.tie_weight = tie_weight\nself.bi_data = bi_data\nself.use_tpu = use_tpu\nself.use_proj = use_proj", "if self.use_proj:\n self.proj_layer = tf.keras.layers.Dense(units=self.d_model,...
<|body_start_0|> super(LMLossLayer, self).__init__(**kwargs) self.n_token = n_token self.d_model = d_model self.initializer = initializer self.tie_weight = tie_weight self.bi_data = bi_data self.use_tpu = use_tpu self.use_proj = use_proj <|end_body_0|> <|...
Layer computing cross entropy loss for language modeling.
LMLossLayer
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LMLossLayer: """Layer computing cross entropy loss for language modeling.""" def __init__(self, n_token, d_model, initializer, tie_weight=False, bi_data=True, use_tpu=False, use_proj=False, **kwargs): """Constructs LMLoss layer. Args: n_token: Number of tokens in vocabulary. d_model:...
stack_v2_sparse_classes_36k_train_017614
46,062
permissive
[ { "docstring": "Constructs LMLoss layer. Args: n_token: Number of tokens in vocabulary. d_model: The dimension of model hidden state. initializer: Initializer used for parameters. tie_weight: Whether to share weights between embedding lookup layer and next-token prediction layer. bi_data: Whether to use bidirec...
3
stack_v2_sparse_classes_30k_train_007089
Implement the Python class `LMLossLayer` described below. Class description: Layer computing cross entropy loss for language modeling. Method signatures and docstrings: - def __init__(self, n_token, d_model, initializer, tie_weight=False, bi_data=True, use_tpu=False, use_proj=False, **kwargs): Constructs LMLoss layer...
Implement the Python class `LMLossLayer` described below. Class description: Layer computing cross entropy loss for language modeling. Method signatures and docstrings: - def __init__(self, n_token, d_model, initializer, tie_weight=False, bi_data=True, use_tpu=False, use_proj=False, **kwargs): Constructs LMLoss layer...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class LMLossLayer: """Layer computing cross entropy loss for language modeling.""" def __init__(self, n_token, d_model, initializer, tie_weight=False, bi_data=True, use_tpu=False, use_proj=False, **kwargs): """Constructs LMLoss layer. Args: n_token: Number of tokens in vocabulary. d_model:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LMLossLayer: """Layer computing cross entropy loss for language modeling.""" def __init__(self, n_token, d_model, initializer, tie_weight=False, bi_data=True, use_tpu=False, use_proj=False, **kwargs): """Constructs LMLoss layer. Args: n_token: Number of tokens in vocabulary. d_model: The dimensio...
the_stack_v2_python_sparse
models/official/nlp/xlnet/xlnet_modeling.py
finnickniu/tensorflow_object_detection_tflite
train
60
beacdd2c2d395d1cf2a58654fe73a5ff4286b64f
[ "counter = 0\nlength = len(height)\nfor i in range(1, length - 1):\n j = i\n max_left = max_right = 0\n while j >= 0:\n max_left = max(max_left, height[j])\n j -= 1\n j = i\n while j < length:\n max_right = max(max_right, height[j])\n j += 1\n counter += min(max_left, m...
<|body_start_0|> counter = 0 length = len(height) for i in range(1, length - 1): j = i max_left = max_right = 0 while j >= 0: max_left = max(max_left, height[j]) j -= 1 j = i while j < length: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap2(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> counter = 0 length = len(height) f...
stack_v2_sparse_classes_36k_train_017615
1,495
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "trap", "signature": "def trap(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "trap2", "signature": "def trap2(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_021435
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int - def trap2(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def trap(self, height): :type height: List[int] :rtype: int - def trap2(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def trap(self, heigh...
a8b59573dc201438ebd5a5ab64e9ac61255a4abd
<|skeleton|> class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def trap2(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def trap(self, height): """:type height: List[int] :rtype: int""" counter = 0 length = len(height) for i in range(1, length - 1): j = i max_left = max_right = 0 while j >= 0: max_left = max(max_left, height[j]) ...
the_stack_v2_python_sparse
summer/2018_07_11/trapping_rain_water.py
shaheming/leecode
train
0
c5840b6b6333b2b9b1e2de5721f60b86db05dec1
[ "in_straight_section = not train.current_head_section.is_turnout()\nall_next_sections_blocked = all((dispatcher.is_section_occupied(section, train.is_reversed) for section in dispatcher.sections_mapper.get_next_sections(train.current_head_section, train.is_reversed)))\nreturn len(dispatcher.sections_mapper.get_next...
<|body_start_0|> in_straight_section = not train.current_head_section.is_turnout() all_next_sections_blocked = all((dispatcher.is_section_occupied(section, train.is_reversed) for section in dispatcher.sections_mapper.get_next_sections(train.current_head_section, train.is_reversed))) return len(d...
ReverseAction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReverseAction: def is_applicable(dispatcher, train): """Overrides the parent action to define the criteria for ReverseAction application""" <|body_0|> def execute(self, dispatcher, train): """Overrides the base action execution to perform the train action of wait for...
stack_v2_sparse_classes_36k_train_017616
2,712
no_license
[ { "docstring": "Overrides the parent action to define the criteria for ReverseAction application", "name": "is_applicable", "signature": "def is_applicable(dispatcher, train)" }, { "docstring": "Overrides the base action execution to perform the train action of wait for crossing", "name": "e...
2
stack_v2_sparse_classes_30k_train_020929
Implement the Python class `ReverseAction` described below. Class description: Implement the ReverseAction class. Method signatures and docstrings: - def is_applicable(dispatcher, train): Overrides the parent action to define the criteria for ReverseAction application - def execute(self, dispatcher, train): Overrides...
Implement the Python class `ReverseAction` described below. Class description: Implement the ReverseAction class. Method signatures and docstrings: - def is_applicable(dispatcher, train): Overrides the parent action to define the criteria for ReverseAction application - def execute(self, dispatcher, train): Overrides...
4650433f7f860df3de1f7502cb052891c410618d
<|skeleton|> class ReverseAction: def is_applicable(dispatcher, train): """Overrides the parent action to define the criteria for ReverseAction application""" <|body_0|> def execute(self, dispatcher, train): """Overrides the base action execution to perform the train action of wait for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReverseAction: def is_applicable(dispatcher, train): """Overrides the parent action to define the criteria for ReverseAction application""" in_straight_section = not train.current_head_section.is_turnout() all_next_sections_blocked = all((dispatcher.is_section_occupied(section, train.i...
the_stack_v2_python_sparse
code/app/simulation/action/reverse.py
ferdn4ndo/the-train-app
train
0
c90f6d07747be45cbd54cb35939ca888b7be9e95
[ "if not s and (not pattern):\n return True\nif s and (not pattern):\n return False\nif not s and pattern:\n if len(pattern) > 1 and pattern[1] == '*':\n return self.match(s, pattern[2:])\n else:\n return False\nif len(pattern) > 1 and pattern[1] == '*':\n if s[0] != pattern[0] and patte...
<|body_start_0|> if not s and (not pattern): return True if s and (not pattern): return False if not s and pattern: if len(pattern) > 1 and pattern[1] == '*': return self.match(s, pattern[2:]) else: return False ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def match(self, s, pattern): """递归回溯""" <|body_0|> def match2(self, s, pattern): """动态规划 定义状态 i 和 j,分别表示 s中前i个字符和pattern中前j个字符是否匹配,就是求dp[i][j] 假设已知 dp[i-1][j-1],根据目前的s[i] 和 pattern[j],求出dp[i][j] 初始状态中:dp[0][0] = True 1. s[i] == pattern[j] or pattern[j] == '...
stack_v2_sparse_classes_36k_train_017617
5,729
no_license
[ { "docstring": "递归回溯", "name": "match", "signature": "def match(self, s, pattern)" }, { "docstring": "动态规划 定义状态 i 和 j,分别表示 s中前i个字符和pattern中前j个字符是否匹配,就是求dp[i][j] 假设已知 dp[i-1][j-1],根据目前的s[i] 和 pattern[j],求出dp[i][j] 初始状态中:dp[0][0] = True 1. s[i] == pattern[j] or pattern[j] == '.' 此时由于两个元素能匹配上,所以 dp...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def match(self, s, pattern): 递归回溯 - def match2(self, s, pattern): 动态规划 定义状态 i 和 j,分别表示 s中前i个字符和pattern中前j个字符是否匹配,就是求dp[i][j] 假设已知 dp[i-1][j-1],根据目前的s[i] 和 pattern[j],求出dp[i][j] 初...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def match(self, s, pattern): 递归回溯 - def match2(self, s, pattern): 动态规划 定义状态 i 和 j,分别表示 s中前i个字符和pattern中前j个字符是否匹配,就是求dp[i][j] 假设已知 dp[i-1][j-1],根据目前的s[i] 和 pattern[j],求出dp[i][j] 初...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def match(self, s, pattern): """递归回溯""" <|body_0|> def match2(self, s, pattern): """动态规划 定义状态 i 和 j,分别表示 s中前i个字符和pattern中前j个字符是否匹配,就是求dp[i][j] 假设已知 dp[i-1][j-1],根据目前的s[i] 和 pattern[j],求出dp[i][j] 初始状态中:dp[0][0] = True 1. s[i] == pattern[j] or pattern[j] == '...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def match(self, s, pattern): """递归回溯""" if not s and (not pattern): return True if s and (not pattern): return False if not s and pattern: if len(pattern) > 1 and pattern[1] == '*': return self.match(s, pattern[2:]) ...
the_stack_v2_python_sparse
algorithm/牛客网/52-正则表达式匹配.py
lxconfig/UbuntuCode_bak
train
0
29151565280226ecfcc515cbbbc28d62cf956deb
[ "with Database() as db:\n if id_hazardous_material is None and is_active is None:\n data = db.query(Table).all()\n elif id_hazardous_material is None:\n data = db.query(Table).filter(Table.is_active == is_active).all()\n else:\n data = db.query(Table).get(id_hazardous_material)\nreturn...
<|body_start_0|> with Database() as db: if id_hazardous_material is None and is_active is None: data = db.query(Table).all() elif id_hazardous_material is None: data = db.query(Table).filter(Table.is_active == is_active).all() else: ...
HazardousMaterial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HazardousMaterial: def get(self, id_hazardous_material=None, is_active=None): """Return all information for hazardous material :param id_hazardous_material: UUID :param is_active: BOOLEAN""" <|body_0|> def create(self, body): """Create a new hazardous material :param...
stack_v2_sparse_classes_36k_train_017618
3,514
no_license
[ { "docstring": "Return all information for hazardous material :param id_hazardous_material: UUID :param is_active: BOOLEAN", "name": "get", "signature": "def get(self, id_hazardous_material=None, is_active=None)" }, { "docstring": "Create a new hazardous material :param body: { number: STRING, n...
4
null
Implement the Python class `HazardousMaterial` described below. Class description: Implement the HazardousMaterial class. Method signatures and docstrings: - def get(self, id_hazardous_material=None, is_active=None): Return all information for hazardous material :param id_hazardous_material: UUID :param is_active: BO...
Implement the Python class `HazardousMaterial` described below. Class description: Implement the HazardousMaterial class. Method signatures and docstrings: - def get(self, id_hazardous_material=None, is_active=None): Return all information for hazardous material :param id_hazardous_material: UUID :param is_active: BO...
43bd57c466a5cd3b133ddc437cb4a6b9f007d267
<|skeleton|> class HazardousMaterial: def get(self, id_hazardous_material=None, is_active=None): """Return all information for hazardous material :param id_hazardous_material: UUID :param is_active: BOOLEAN""" <|body_0|> def create(self, body): """Create a new hazardous material :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HazardousMaterial: def get(self, id_hazardous_material=None, is_active=None): """Return all information for hazardous material :param id_hazardous_material: UUID :param is_active: BOOLEAN""" with Database() as db: if id_hazardous_material is None and is_active is None: ...
the_stack_v2_python_sparse
resturls/hazardousmaterial.py
CAUCA-9-1-1/survip-api
train
1
9a4362ecc22fc9c986529a2e8d13720fd8200e55
[ "total = 0\nst = set()\npremod = 0\nfor i, n in enumerate(nums):\n total += n\n remain = total % k if k else total\n if i > 0:\n if remain in st:\n return True\n st.add(premod)\n premod = remain\nreturn False", "modset = set()\ntotal = 0\nprevious_remain = 0\nfor i, n in enumerate...
<|body_start_0|> total = 0 st = set() premod = 0 for i, n in enumerate(nums): total += n remain = total % k if k else total if i > 0: if remain in st: return True st.add(premod) premod = remai...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的 module 必為 0 , 則這兩個差的和可以整除k""" <|body_0|> def rewrite(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的modu...
stack_v2_sparse_classes_36k_train_017619
3,215
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的 module 必為 0 , 則這兩個差的和可以整除k", "name": "checkSubarraySum", "signature": "def checkSubarraySum(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的module 必為 0 ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的 module 必為 0 , 則這兩個差的和可以整除k - def rewrite(self, nums, k): :type nums: L...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkSubarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的 module 必為 0 , 則這兩個差的和可以整除k - def rewrite(self, nums, k): :type nums: L...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的 module 必為 0 , 則這兩個差的和可以整除k""" <|body_0|> def rewrite(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的modu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def checkSubarraySum(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool 原因? 因為! 只要這個的和 - 之前的和的 module 必為 0 , 則這兩個差的和可以整除k""" total = 0 st = set() premod = 0 for i, n in enumerate(nums): total += n remain = total % k if k...
the_stack_v2_python_sparse
co_fb/523_Continuous_Subarray_Sum.py
vsdrun/lc_public
train
6
5d234754d472f370ae42ef7dc53672e56728e603
[ "self.plugin = ResolveWindComponents()\nwind_speed = 10.0 * np.ones((4, 4), dtype=np.float32)\nwind_angle = np.array([[0.0, 30.0, 45.0, 60.0], [90.0, 120.0, 135.0, 150.0], [180.0, 210.0, 225.0, 240.0], [270.0, 300.0, 315.0, 330.0]], dtype=np.float32)\nself.wind_cube = set_up_cube(wind_speed, 'wind_speed', 'knots')\...
<|body_start_0|> self.plugin = ResolveWindComponents() wind_speed = 10.0 * np.ones((4, 4), dtype=np.float32) wind_angle = np.array([[0.0, 30.0, 45.0, 60.0], [90.0, 120.0, 135.0, 150.0], [180.0, 210.0, 225.0, 240.0], [270.0, 300.0, 315.0, 330.0]], dtype=np.float32) self.wind_cube = set_up...
Tests the resolve_wind_components method
Test_resolve_wind_components
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_resolve_wind_components: """Tests the resolve_wind_components method""" def setUp(self): """Set up some arrays to convert""" <|body_0|> def test_basic(self): """Test function returns correct type""" <|body_1|> def test_values(self): """T...
stack_v2_sparse_classes_36k_train_017620
11,161
permissive
[ { "docstring": "Set up some arrays to convert", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test function returns correct type", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test correct values are returned for well-behaved a...
3
null
Implement the Python class `Test_resolve_wind_components` described below. Class description: Tests the resolve_wind_components method Method signatures and docstrings: - def setUp(self): Set up some arrays to convert - def test_basic(self): Test function returns correct type - def test_values(self): Test correct val...
Implement the Python class `Test_resolve_wind_components` described below. Class description: Tests the resolve_wind_components method Method signatures and docstrings: - def setUp(self): Set up some arrays to convert - def test_basic(self): Test function returns correct type - def test_values(self): Test correct val...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_resolve_wind_components: """Tests the resolve_wind_components method""" def setUp(self): """Set up some arrays to convert""" <|body_0|> def test_basic(self): """Test function returns correct type""" <|body_1|> def test_values(self): """T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_resolve_wind_components: """Tests the resolve_wind_components method""" def setUp(self): """Set up some arrays to convert""" self.plugin = ResolveWindComponents() wind_speed = 10.0 * np.ones((4, 4), dtype=np.float32) wind_angle = np.array([[0.0, 30.0, 45.0, 60.0], [90...
the_stack_v2_python_sparse
improver_tests/wind_calculations/wind_components/test_ResolveWindComponents.py
metoppv/improver
train
101
6ecf34203786a82cdb3426efc7f51ca34580021e
[ "event.reviewed = True\nevent.save()\nmsg = f'用户 {user} 将培训活动 {event} 标记为已审核'\nprod_logger.info(msg)", "if re.search('[\\\\\\'\\\\\"%()<>;+-]|script|meta', validated_data['name'], re.I):\n raise BadRequest('活动名称中含有特殊符号或者脚本关键字!')\nwith transaction.atomic():\n campus_event = CampusEvent.objects.create(**valid...
<|body_start_0|> event.reviewed = True event.save() msg = f'用户 {user} 将培训活动 {event} 标记为已审核' prod_logger.info(msg) <|end_body_0|> <|body_start_1|> if re.search('[\\\'\\"%()<>;+-]|script|meta', validated_data['name'], re.I): raise BadRequest('活动名称中含有特殊符号或者脚本关键字!') ...
Provide services for CampusEvent.
CampusEventService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampusEventService: """Provide services for CampusEvent.""" def review_campus_event(event, user): """Review a campus event.""" <|body_0|> def create_campus_event(validated_data, coefficients, context=None): """Create a CampusEvent with ObjectPermission. Parametse...
stack_v2_sparse_classes_36k_train_017621
8,615
no_license
[ { "docstring": "Review a campus event.", "name": "review_campus_event", "signature": "def review_campus_event(event, user)" }, { "docstring": "Create a CampusEvent with ObjectPermission. Parametsers ---------- validated_data: dict This dict should have full information needed to create an Campus...
3
null
Implement the Python class `CampusEventService` described below. Class description: Provide services for CampusEvent. Method signatures and docstrings: - def review_campus_event(event, user): Review a campus event. - def create_campus_event(validated_data, coefficients, context=None): Create a CampusEvent with Object...
Implement the Python class `CampusEventService` described below. Class description: Provide services for CampusEvent. Method signatures and docstrings: - def review_campus_event(event, user): Review a campus event. - def create_campus_event(validated_data, coefficients, context=None): Create a CampusEvent with Object...
48cccddbe8347167cb6120a1cd7d61f9fc57cc7c
<|skeleton|> class CampusEventService: """Provide services for CampusEvent.""" def review_campus_event(event, user): """Review a campus event.""" <|body_0|> def create_campus_event(validated_data, coefficients, context=None): """Create a CampusEvent with ObjectPermission. Parametse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CampusEventService: """Provide services for CampusEvent.""" def review_campus_event(event, user): """Review a campus event.""" event.reviewed = True event.save() msg = f'用户 {user} 将培训活动 {event} 标记为已审核' prod_logger.info(msg) def create_campus_event(validated_da...
the_stack_v2_python_sparse
training_event/services.py
DLUT-SIE/TMSFTT-BE
train
1
429f2606ad61f74f38e020b9a380f5626b843b2a
[ "super(LSTMModule, self).__init__()\nself.batch_size = batch_size\nself.num_layers = num_layers\nself.input_size = n_in\nself.hidden_size = n_hidden\nself.lstm = nn.LSTM(input_size=n_in, hidden_size=n_hidden, num_layers=num_layers, batch_first=True)", "h0 = Variable(torch.randn(self.num_layers, self.batch_size, s...
<|body_start_0|> super(LSTMModule, self).__init__() self.batch_size = batch_size self.num_layers = num_layers self.input_size = n_in self.hidden_size = n_hidden self.lstm = nn.LSTM(input_size=n_in, hidden_size=n_hidden, num_layers=num_layers, batch_first=True) <|end_body_...
qa lstm module.
LSTMModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMModule: """qa lstm module.""" def __init__(self, batch_size, n_in, n_hidden, num_layers=1): """lstm module init. :param batch_size: mini_batch size :param n_in: input size for lstm :param n_hidden: hidden size for rnn :param num_layers: num of layers""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_017622
6,002
permissive
[ { "docstring": "lstm module init. :param batch_size: mini_batch size :param n_in: input size for lstm :param n_hidden: hidden size for rnn :param num_layers: num of layers", "name": "__init__", "signature": "def __init__(self, batch_size, n_in, n_hidden, num_layers=1)" }, { "docstring": "state(h...
3
stack_v2_sparse_classes_30k_train_017592
Implement the Python class `LSTMModule` described below. Class description: qa lstm module. Method signatures and docstrings: - def __init__(self, batch_size, n_in, n_hidden, num_layers=1): lstm module init. :param batch_size: mini_batch size :param n_in: input size for lstm :param n_hidden: hidden size for rnn :para...
Implement the Python class `LSTMModule` described below. Class description: qa lstm module. Method signatures and docstrings: - def __init__(self, batch_size, n_in, n_hidden, num_layers=1): lstm module init. :param batch_size: mini_batch size :param n_in: input size for lstm :param n_hidden: hidden size for rnn :para...
56b0a320e4641f46e80db78039d4ca79e9037d7e
<|skeleton|> class LSTMModule: """qa lstm module.""" def __init__(self, batch_size, n_in, n_hidden, num_layers=1): """lstm module init. :param batch_size: mini_batch size :param n_in: input size for lstm :param n_hidden: hidden size for rnn :param num_layers: num of layers""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTMModule: """qa lstm module.""" def __init__(self, batch_size, n_in, n_hidden, num_layers=1): """lstm module init. :param batch_size: mini_batch size :param n_in: input size for lstm :param n_hidden: hidden size for rnn :param num_layers: num of layers""" super(LSTMModule, self).__init_...
the_stack_v2_python_sparse
torch_models/qa_rnn.py
companionrobot/DBQA
train
0
863777be6a8136dd8144abda04eea8a9265533b8
[ "if not data:\n return b'\\x00'\nreturn data.replace('\\x00', '').encode('utf-8') + b'\\x00'", "tmp = payload.split(b'\\x00', 1)\nif len(tmp) < 2:\n return (payload, None)\nreturn (tmp[1], tmp[0].decode('utf-8'))" ]
<|body_start_0|> if not data: return b'\x00' return data.replace('\x00', '').encode('utf-8') + b'\x00' <|end_body_0|> <|body_start_1|> tmp = payload.split(b'\x00', 1) if len(tmp) < 2: return (payload, None) return (tmp[1], tmp[0].decode('utf-8')) <|end_bo...
Null terminated string.
SMPayloadTypeNT
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMPayloadTypeNT: """Null terminated string.""" def encode(data, _opt=None): """Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("unicode_string") b'unicode_string\\x00'""" <|body_0...
stack_v2_sparse_classes_36k_train_017623
14,049
permissive
[ { "docstring": "Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode(\"unicode_string\") b'unicode_string\\\\x00'", "name": "encode", "signature": "def encode(data, _opt=None)" }, { "docstring": "Decode n...
2
stack_v2_sparse_classes_30k_train_008202
Implement the Python class `SMPayloadTypeNT` described below. Class description: Null terminated string. Method signatures and docstrings: - def encode(data, _opt=None): Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("un...
Implement the Python class `SMPayloadTypeNT` described below. Class description: Null terminated string. Method signatures and docstrings: - def encode(data, _opt=None): Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("un...
cf20b363ed3d7bcb75101b17870e876a857ecd66
<|skeleton|> class SMPayloadTypeNT: """Null terminated string.""" def encode(data, _opt=None): """Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("unicode_string") b'unicode_string\\x00'""" <|body_0...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SMPayloadTypeNT: """Null terminated string.""" def encode(data, _opt=None): """Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("unicode_string") b'unicode_string\\x00'""" if not data: ...
the_stack_v2_python_sparse
smserver/smutils/smpacket/smencoder.py
Moutix/stepmania-server
train
4
4e994443698c5c7521e81d1ed8659e97c3de7666
[ "super(CommonRunCmd, self).do_treatcards(line, amcatnlo)\nkeepwidth = False\nif '--keepwidth' in line:\n keepwidth = True\n line = line.replace('--keepwidth', '')\nargs = self.split_arg(line)\nmode, opt = self.check_treatcards(args)\nif amcatnlo and mode in ['all', 'param'] and (not keepwidth):\n if os.pat...
<|body_start_0|> super(CommonRunCmd, self).do_treatcards(line, amcatnlo) keepwidth = False if '--keepwidth' in line: keepwidth = True line = line.replace('--keepwidth', '') args = self.split_arg(line) mode, opt = self.check_treatcards(args) if amca...
CommonRunCmd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommonRunCmd: def do_treatcards(self, line, amcatnlo=False): """call the mother, then, if the param_card has to be updated, write it again""" <|body_0|> def replace_widths_in_paramcard_inc(self, decay_to_keep, param_inc): """replace the widths passed in decay_to_keep...
stack_v2_sparse_classes_36k_train_017624
4,818
no_license
[ { "docstring": "call the mother, then, if the param_card has to be updated, write it again", "name": "do_treatcards", "signature": "def do_treatcards(self, line, amcatnlo=False)" }, { "docstring": "replace the widths passed in decay_to_keep inside param_inc and force them to be zero", "name"...
3
stack_v2_sparse_classes_30k_train_003064
Implement the Python class `CommonRunCmd` described below. Class description: Implement the CommonRunCmd class. Method signatures and docstrings: - def do_treatcards(self, line, amcatnlo=False): call the mother, then, if the param_card has to be updated, write it again - def replace_widths_in_paramcard_inc(self, deca...
Implement the Python class `CommonRunCmd` described below. Class description: Implement the CommonRunCmd class. Method signatures and docstrings: - def do_treatcards(self, line, amcatnlo=False): call the mother, then, if the param_card has to be updated, write it again - def replace_widths_in_paramcard_inc(self, deca...
dd3d3a3826343d4f75ec36b4662b6e9ff1f270f4
<|skeleton|> class CommonRunCmd: def do_treatcards(self, line, amcatnlo=False): """call the mother, then, if the param_card has to be updated, write it again""" <|body_0|> def replace_widths_in_paramcard_inc(self, decay_to_keep, param_inc): """replace the widths passed in decay_to_keep...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommonRunCmd: def do_treatcards(self, line, amcatnlo=False): """call the mother, then, if the param_card has to be updated, write it again""" super(CommonRunCmd, self).do_treatcards(line, amcatnlo) keepwidth = False if '--keepwidth' in line: keepwidth = True ...
the_stack_v2_python_sparse
bin/MadGraph5_aMCatNLO/PLUGIN/MadSTR/common_run_interface.py
cms-sw/genproductions
train
69
c2135d848f3f8217e39450f315f2cd5057342b24
[ "self._ownercol = None\nself._idxname = idxname\nself._is_asc: bool = True\nif isinstance(is_asc, bool):\n self._is_asc = is_asc\nself._initialed_conns: dict = {}\nself._initialed_conns_locker = threading.RLock()", "if col is None:\n raise Exception('Invalid SqliteColumn object')\nself._ownercol = col", "...
<|body_start_0|> self._ownercol = None self._idxname = idxname self._is_asc: bool = True if isinstance(is_asc, bool): self._is_asc = is_asc self._initialed_conns: dict = {} self._initialed_conns_locker = threading.RLock() <|end_body_0|> <|body_start_1|> ...
represents a sqlite column index ownercol: the owner SqliteColumn object of current SqliteIndex object idxname: the name of current index, if this is None, will automatically generate an unique index name
SqliteIndex
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqliteIndex: """represents a sqlite column index ownercol: the owner SqliteColumn object of current SqliteIndex object idxname: the name of current index, if this is None, will automatically generate an unique index name""" def __init__(self, idxname: str=None, is_asc: bool=True): ""...
stack_v2_sparse_classes_36k_train_017625
17,742
permissive
[ { "docstring": "index name can be None", "name": "__init__", "signature": "def __init__(self, idxname: str=None, is_asc: bool=True)" }, { "docstring": "为当前SqliteIndex索引设置所属SqliteColumn列", "name": "set_owner_column", "signature": "def set_owner_column(self, col)" }, { "docstring":...
3
null
Implement the Python class `SqliteIndex` described below. Class description: represents a sqlite column index ownercol: the owner SqliteColumn object of current SqliteIndex object idxname: the name of current index, if this is None, will automatically generate an unique index name Method signatures and docstrings: - ...
Implement the Python class `SqliteIndex` described below. Class description: represents a sqlite column index ownercol: the owner SqliteColumn object of current SqliteIndex object idxname: the name of current index, if this is None, will automatically generate an unique index name Method signatures and docstrings: - ...
8f05a6b91fc205960edd57f9076facec04f49a1a
<|skeleton|> class SqliteIndex: """represents a sqlite column index ownercol: the owner SqliteColumn object of current SqliteIndex object idxname: the name of current index, if this is None, will automatically generate an unique index name""" def __init__(self, idxname: str=None, is_asc: bool=True): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SqliteIndex: """represents a sqlite column index ownercol: the owner SqliteColumn object of current SqliteIndex object idxname: the name of current index, if this is None, will automatically generate an unique index name""" def __init__(self, idxname: str=None, is_asc: bool=True): """index name c...
the_stack_v2_python_sparse
savecode/pythonpackages/commonbaby/sql/sqlite/sqlitetable.py
cbbbbbbbb/sspywork
train
0
c2ded16394084586691bbba425ee7e8a6c62b477
[ "super().__init__(status)\nself._attr_name = name\nself._actions = actions", "attr = {}\nif self._actions:\n attr['actions_enabled'] = self._actions.enabled\n if self._actions.last_finished != EMPTY_TIME:\n attr['actions_last_finished'] = self._actions.last_finished\n if self._actions.last_run != ...
<|body_start_0|> super().__init__(status) self._attr_name = name self._actions = actions <|end_body_0|> <|body_start_1|> attr = {} if self._actions: attr['actions_enabled'] = self._actions.enabled if self._actions.last_finished != EMPTY_TIME: ...
Representation of an ISY program base.
ISYProgramEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ISYProgramEntity: """Representation of an ISY program base.""" def __init__(self, name: str, status: Program, actions: Program=None) -> None: """Initialize the ISY program-based entity.""" <|body_0|> def extra_state_attributes(self) -> dict: """Get the state attr...
stack_v2_sparse_classes_36k_train_017626
10,000
permissive
[ { "docstring": "Initialize the ISY program-based entity.", "name": "__init__", "signature": "def __init__(self, name: str, status: Program, actions: Program=None) -> None" }, { "docstring": "Get the state attributes for the device.", "name": "extra_state_attributes", "signature": "def ex...
2
stack_v2_sparse_classes_30k_train_007756
Implement the Python class `ISYProgramEntity` described below. Class description: Representation of an ISY program base. Method signatures and docstrings: - def __init__(self, name: str, status: Program, actions: Program=None) -> None: Initialize the ISY program-based entity. - def extra_state_attributes(self) -> dic...
Implement the Python class `ISYProgramEntity` described below. Class description: Representation of an ISY program base. Method signatures and docstrings: - def __init__(self, name: str, status: Program, actions: Program=None) -> None: Initialize the ISY program-based entity. - def extra_state_attributes(self) -> dic...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ISYProgramEntity: """Representation of an ISY program base.""" def __init__(self, name: str, status: Program, actions: Program=None) -> None: """Initialize the ISY program-based entity.""" <|body_0|> def extra_state_attributes(self) -> dict: """Get the state attr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ISYProgramEntity: """Representation of an ISY program base.""" def __init__(self, name: str, status: Program, actions: Program=None) -> None: """Initialize the ISY program-based entity.""" super().__init__(status) self._attr_name = name self._actions = actions def ext...
the_stack_v2_python_sparse
homeassistant/components/isy994/entity.py
home-assistant/core
train
35,501
cf1de06b0935cf2ab5697386ecd7429329621527
[ "self.__cache = {}\nself.__func = None\nself.__defaultKey = '_memoize_noargs_'\nself.__setFunction(*args, **kwargs)", "if len(args) + len(kwargs) == 0:\n self.__cache = {}\nelse:\n key = self.__makeKey(*args, **kwargs)\n try:\n self.__cache.pop(key)\n except KeyError:\n pass", "if self...
<|body_start_0|> self.__cache = {} self.__func = None self.__defaultKey = '_memoize_noargs_' self.__setFunction(*args, **kwargs) <|end_body_0|> <|body_start_1|> if len(args) + len(kwargs) == 0: self.__cache = {} else: key = self.__makeKey(*args, *...
Decorator which can be used to memoize a function or method. Use like so:: @memoize def myfunc(*a, **kwa): ... @memoize() def otherfunc(*a, **kwax): ... A ``Memoize`` instance maintains a cache which contains ``{args : value}`` mappings, where ``args`` are the input arguments to the function, and ``value`` is the value...
Memoize
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Memoize: """Decorator which can be used to memoize a function or method. Use like so:: @memoize def myfunc(*a, **kwa): ... @memoize() def otherfunc(*a, **kwax): ... A ``Memoize`` instance maintains a cache which contains ``{args : value}`` mappings, where ``args`` are the input arguments to the f...
stack_v2_sparse_classes_36k_train_017627
9,155
permissive
[ { "docstring": "Create a ``Memoize`` object.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Clears the internal cache. If no arguments are given, the entire cache is cleared. Otherwise, only the cached value for the provided arguments is cleared.", ...
5
null
Implement the Python class `Memoize` described below. Class description: Decorator which can be used to memoize a function or method. Use like so:: @memoize def myfunc(*a, **kwa): ... @memoize() def otherfunc(*a, **kwax): ... A ``Memoize`` instance maintains a cache which contains ``{args : value}`` mappings, where ``...
Implement the Python class `Memoize` described below. Class description: Decorator which can be used to memoize a function or method. Use like so:: @memoize def myfunc(*a, **kwa): ... @memoize() def otherfunc(*a, **kwax): ... A ``Memoize`` instance maintains a cache which contains ``{args : value}`` mappings, where ``...
13d55095a72a13a627736d0b65fd83049826c9cb
<|skeleton|> class Memoize: """Decorator which can be used to memoize a function or method. Use like so:: @memoize def myfunc(*a, **kwa): ... @memoize() def otherfunc(*a, **kwax): ... A ``Memoize`` instance maintains a cache which contains ``{args : value}`` mappings, where ``args`` are the input arguments to the f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Memoize: """Decorator which can be used to memoize a function or method. Use like so:: @memoize def myfunc(*a, **kwa): ... @memoize() def otherfunc(*a, **kwax): ... A ``Memoize`` instance maintains a cache which contains ``{args : value}`` mappings, where ``args`` are the input arguments to the function, and ...
the_stack_v2_python_sparse
fsl/utils/memoize.py
pauldmccarthy/fslpy
train
7
1bebf5d0ceac2ebb9379f272ee52d5b9dac018d6
[ "key = LibraryUsageLocatorV2.from_string(usage_key_str)\napi.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY)\nxml_str = api.get_library_block_olx(key)\nreturn Response(LibraryXBlockOlxSerializer({'olx': xml_str}).data)", "key = LibraryUsageLocatorV2.from_st...
<|body_start_0|> key = LibraryUsageLocatorV2.from_string(usage_key_str) api.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THIS_CONTENT_LIBRARY) xml_str = api.get_library_block_olx(key) return Response(LibraryXBlockOlxSerializer({'olx': xml_str}).data)...
Views to work with an existing XBlock's OLX
LibraryBlockOlxView
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LibraryBlockOlxView: """Views to work with an existing XBlock's OLX""" def get(self, request, usage_key_str): """Get the block's OLX""" <|body_0|> def post(self, request, usage_key_str): """Replace the block's OLX. This API is only meant for use by developers or ...
stack_v2_sparse_classes_36k_train_017628
42,120
permissive
[ { "docstring": "Get the block's OLX", "name": "get", "signature": "def get(self, request, usage_key_str)" }, { "docstring": "Replace the block's OLX. This API is only meant for use by developers or API client applications. Very little validation is done.", "name": "post", "signature": "d...
2
null
Implement the Python class `LibraryBlockOlxView` described below. Class description: Views to work with an existing XBlock's OLX Method signatures and docstrings: - def get(self, request, usage_key_str): Get the block's OLX - def post(self, request, usage_key_str): Replace the block's OLX. This API is only meant for ...
Implement the Python class `LibraryBlockOlxView` described below. Class description: Views to work with an existing XBlock's OLX Method signatures and docstrings: - def get(self, request, usage_key_str): Get the block's OLX - def post(self, request, usage_key_str): Replace the block's OLX. This API is only meant for ...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class LibraryBlockOlxView: """Views to work with an existing XBlock's OLX""" def get(self, request, usage_key_str): """Get the block's OLX""" <|body_0|> def post(self, request, usage_key_str): """Replace the block's OLX. This API is only meant for use by developers or ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LibraryBlockOlxView: """Views to work with an existing XBlock's OLX""" def get(self, request, usage_key_str): """Get the block's OLX""" key = LibraryUsageLocatorV2.from_string(usage_key_str) api.require_permission_for_library_key(key.lib_key, request.user, permissions.CAN_VIEW_THI...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/content_libraries/views.py
luque/better-ways-of-thinking-about-software
train
3
2f69b666fe6a9cd58b03dbb76c6d3b5a12c40086
[ "ans = [nums]\norig = nums[:]\nself.nextPermutation(nums)\nwhile nums != orig:\n ans.append(nums[:])\n self.nextPermutation(nums)\nreturn ans", "if len(nums) <= 1:\n return\nslow = len(nums) - 1\nfast = len(nums) - 2\nwhile nums[fast] == nums[slow] and fast > 0:\n slow -= 1\n fast -= 1\nif nums[fas...
<|body_start_0|> ans = [nums] orig = nums[:] self.nextPermutation(nums) while nums != orig: ans.append(nums[:]) self.nextPermutation(nums) return ans <|end_body_0|> <|body_start_1|> if len(nums) <= 1: return slow = len(nums) - ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_017629
1,615
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "def permuteUnique(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]] - def nextPermutation(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify ...
8cda0518440488992d7e2c70cb8555ec7b34083f
<|skeleton|> class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" ans = [nums] orig = nums[:] self.nextPermutation(nums) while nums != orig: ans.append(nums[:]) self.nextPermutation(nums) return ans def nex...
the_stack_v2_python_sparse
47/main.py
szhongren/leetcode
train
0
1a88cd684399087a06b46b89deca5a94739453ac
[ "self.dim_input = dim_input\nself.dim_output = dim_output\nself.batchsize = batchsize\nself.precision = precision\nself.activation_fct = activation_fct\nself.opt = optimizer\nself.devlist = devlist", "datatype = eval('tf.float%d' % self.precision)\nact = eval(self.activation_fct)\ng = tf.Graph()\nwith g.as_defaul...
<|body_start_0|> self.dim_input = dim_input self.dim_output = dim_output self.batchsize = batchsize self.precision = precision self.activation_fct = activation_fct self.opt = optimizer self.devlist = devlist <|end_body_0|> <|body_start_1|> datatype = eval...
Class for gerenating the benchmark operations
dense_layer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dense_layer: """Class for gerenating the benchmark operations""" def __init__(self, dim_input, dim_output, batchsize, precision, activation_fct, optimizer, devlist): """Initialize gemm Args: dim_input: Size of input vector / number of input features (int) dim_output: Size of output v...
stack_v2_sparse_classes_36k_train_017630
3,292
permissive
[ { "docstring": "Initialize gemm Args: dim_input: Size of input vector / number of input features (int) dim_output: Size of output vector / number of output features (int) batchsize: (int) precision: bit depth (16/32/64) optimizer: (string) devlist: List of GPUs / CPUs (list)", "name": "__init__", "signa...
3
stack_v2_sparse_classes_30k_train_014740
Implement the Python class `dense_layer` described below. Class description: Class for gerenating the benchmark operations Method signatures and docstrings: - def __init__(self, dim_input, dim_output, batchsize, precision, activation_fct, optimizer, devlist): Initialize gemm Args: dim_input: Size of input vector / nu...
Implement the Python class `dense_layer` described below. Class description: Class for gerenating the benchmark operations Method signatures and docstrings: - def __init__(self, dim_input, dim_output, batchsize, precision, activation_fct, optimizer, devlist): Initialize gemm Args: dim_input: Size of input vector / nu...
c177ed3b01b3849de2d0266a3dd673c47bd754f8
<|skeleton|> class dense_layer: """Class for gerenating the benchmark operations""" def __init__(self, dim_input, dim_output, batchsize, precision, activation_fct, optimizer, devlist): """Initialize gemm Args: dim_input: Size of input vector / number of input features (int) dim_output: Size of output v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class dense_layer: """Class for gerenating the benchmark operations""" def __init__(self, dim_input, dim_output, batchsize, precision, activation_fct, optimizer, devlist): """Initialize gemm Args: dim_input: Size of input vector / number of input features (int) dim_output: Size of output vector / numbe...
the_stack_v2_python_sparse
prediction_model_tf2/Generate_train_data/benchmark_dense.py
profnote/ml-performance-prediction
train
0
1a556f92f4cbf571bca3ac9e5cbc4976555802ad
[ "from aiida.common import exceptions\nsuper().__init__(sub_classes=sub_classes)\nself._process_classes = []\nif process_classes is not None:\n if not isinstance(process_classes, tuple):\n raise TypeError('process_classes should be a tuple of entry point strings')\n for entry_point_string in process_cla...
<|body_start_0|> from aiida.common import exceptions super().__init__(sub_classes=sub_classes) self._process_classes = [] if process_classes is not None: if not isinstance(process_classes, tuple): raise TypeError('process_classes should be a tuple of entry poi...
The ParamType for identifying WorkflowNode entities or its subclasses. Filter the ``process_class`` by the ``self._prcess_classes``.
FilteredWorkflowParamType
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilteredWorkflowParamType: """The ParamType for identifying WorkflowNode entities or its subclasses. Filter the ``process_class`` by the ``self._prcess_classes``.""" def __init__(self, sub_classes=None, process_classes: ty.Sequence[str]=None): """Initialize. :param process_classes: v...
stack_v2_sparse_classes_36k_train_017631
2,787
permissive
[ { "docstring": "Initialize. :param process_classes: valid entry points for ``aiida.workflows``, defaults to None :type process_classes: ty.Sequence[str], optional", "name": "__init__", "signature": "def __init__(self, sub_classes=None, process_classes: ty.Sequence[str]=None)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_009188
Implement the Python class `FilteredWorkflowParamType` described below. Class description: The ParamType for identifying WorkflowNode entities or its subclasses. Filter the ``process_class`` by the ``self._prcess_classes``. Method signatures and docstrings: - def __init__(self, sub_classes=None, process_classes: ty.S...
Implement the Python class `FilteredWorkflowParamType` described below. Class description: The ParamType for identifying WorkflowNode entities or its subclasses. Filter the ``process_class`` by the ``self._prcess_classes``. Method signatures and docstrings: - def __init__(self, sub_classes=None, process_classes: ty.S...
aeceb3519ffd1cd071d5b98f81888052fff58163
<|skeleton|> class FilteredWorkflowParamType: """The ParamType for identifying WorkflowNode entities or its subclasses. Filter the ``process_class`` by the ``self._prcess_classes``.""" def __init__(self, sub_classes=None, process_classes: ty.Sequence[str]=None): """Initialize. :param process_classes: v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilteredWorkflowParamType: """The ParamType for identifying WorkflowNode entities or its subclasses. Filter the ``process_class`` by the ``self._prcess_classes``.""" def __init__(self, sub_classes=None, process_classes: ty.Sequence[str]=None): """Initialize. :param process_classes: valid entry po...
the_stack_v2_python_sparse
src/aiida_wannier90_workflows/cli/params.py
aiidateam/aiida-wannier90-workflows
train
5
a6b53bbce22d2a29aa6059f3beb983ced413a94a
[ "y = np.array(y)\ny = np.argmax(y, axis=2)[:, 0]\nreturn ''.join([Config.LABEL_LIST[x] for x in y])", "x = np.zeros((1, height, width, channel), dtype=np.float32)\nimage = Image.open(BytesIO(imageByte)).convert('RGB')\nimage = ConvertFormat.convertImageFormat(image)\nimage = image.resize((width, height), Image.AN...
<|body_start_0|> y = np.array(y) y = np.argmax(y, axis=2)[:, 0] return ''.join([Config.LABEL_LIST[x] for x in y]) <|end_body_0|> <|body_start_1|> x = np.zeros((1, height, width, channel), dtype=np.float32) image = Image.open(BytesIO(imageByte)).convert('RGB') image = Con...
PreprocessingCaptcha
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PreprocessingCaptcha: def decode(cls, y: list) -> str: """decode np array predict result to string""" <|body_0|> def loadData(cls, imageByte: bytes, height: int, width: int, channel: int): """load data from image byte to np array""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_017632
1,102
permissive
[ { "docstring": "decode np array predict result to string", "name": "decode", "signature": "def decode(cls, y: list) -> str" }, { "docstring": "load data from image byte to np array", "name": "loadData", "signature": "def loadData(cls, imageByte: bytes, height: int, width: int, channel: i...
2
stack_v2_sparse_classes_30k_train_020176
Implement the Python class `PreprocessingCaptcha` described below. Class description: Implement the PreprocessingCaptcha class. Method signatures and docstrings: - def decode(cls, y: list) -> str: decode np array predict result to string - def loadData(cls, imageByte: bytes, height: int, width: int, channel: int): lo...
Implement the Python class `PreprocessingCaptcha` described below. Class description: Implement the PreprocessingCaptcha class. Method signatures and docstrings: - def decode(cls, y: list) -> str: decode np array predict result to string - def loadData(cls, imageByte: bytes, height: int, width: int, channel: int): lo...
c03550dc5583b435192f220f871c71cabadd3e39
<|skeleton|> class PreprocessingCaptcha: def decode(cls, y: list) -> str: """decode np array predict result to string""" <|body_0|> def loadData(cls, imageByte: bytes, height: int, width: int, channel: int): """load data from image byte to np array""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PreprocessingCaptcha: def decode(cls, y: list) -> str: """decode np array predict result to string""" y = np.array(y) y = np.argmax(y, axis=2)[:, 0] return ''.join([Config.LABEL_LIST[x] for x in y]) def loadData(cls, imageByte: bytes, height: int, width: int, channel: int)...
the_stack_v2_python_sparse
controller/PreprocessingCaptcha.py
wudinaonao/FlaskMark12306Captcha
train
1
d4c7287da9c7f7a1d4c44674d05fc68356f05ac1
[ "if not has_image(self):\n return None\nview = self.unrestrictedTraverse('@@images')\nreturn view.scale(fieldname='image', scale='thumb').index_html()", "if not has_image(self):\n return ''\nview = self.unrestrictedTraverse('@@images')\nreturn view.tag(fieldname='image', scale=scale, css_class=css_class, **...
<|body_start_0|> if not has_image(self): return None view = self.unrestrictedTraverse('@@images') return view.scale(fieldname='image', scale='thumb').index_html() <|end_body_0|> <|body_start_1|> if not has_image(self): return '' view = self.unrestrictedTr...
A Sponsor
Sponsor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sponsor: """A Sponsor""" def image_thumb(self): """Return a thumbnail""" <|body_0|> def tag(self, scale='thumb', css_class='tileImage', **kw): """Return a tag to the image""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not has_image(self): ...
stack_v2_sparse_classes_36k_train_017633
2,714
no_license
[ { "docstring": "Return a thumbnail", "name": "image_thumb", "signature": "def image_thumb(self)" }, { "docstring": "Return a tag to the image", "name": "tag", "signature": "def tag(self, scale='thumb', css_class='tileImage', **kw)" } ]
2
stack_v2_sparse_classes_30k_train_013406
Implement the Python class `Sponsor` described below. Class description: A Sponsor Method signatures and docstrings: - def image_thumb(self): Return a thumbnail - def tag(self, scale='thumb', css_class='tileImage', **kw): Return a tag to the image
Implement the Python class `Sponsor` described below. Class description: A Sponsor Method signatures and docstrings: - def image_thumb(self): Return a thumbnail - def tag(self, scale='thumb', css_class='tileImage', **kw): Return a tag to the image <|skeleton|> class Sponsor: """A Sponsor""" def image_thumb(...
9f6672ce51cc95fd05e3d6a55c99d029342e4f4e
<|skeleton|> class Sponsor: """A Sponsor""" def image_thumb(self): """Return a thumbnail""" <|body_0|> def tag(self, scale='thumb', css_class='tileImage', **kw): """Return a tag to the image""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sponsor: """A Sponsor""" def image_thumb(self): """Return a thumbnail""" if not has_image(self): return None view = self.unrestrictedTraverse('@@images') return view.scale(fieldname='image', scale='thumb').index_html() def tag(self, scale='thumb', css_clas...
the_stack_v2_python_sparse
src/apyb/conference/content/sponsor.py
pythonbrasil/apyb.conference
train
0
2afbdbc7f802745654e42bf01d145e0904d4a2e5
[ "self.y = torch.LongTensor(np.where(self.one_hot_encode(y))[1])\nx = sp.csr_matrix(x, dtype=np.float32)\nself.x = torch.FloatTensor(np.array(self.normalize(x).todense()))\nn = x.shape[0]\nadj = sp.coo_matrix((edges[:, 2], (edges[:, 0], edges[:, 1])), shape=(n, n), dtype=np.float32)\nif is_undirected:\n adj = adj...
<|body_start_0|> self.y = torch.LongTensor(np.where(self.one_hot_encode(y))[1]) x = sp.csr_matrix(x, dtype=np.float32) self.x = torch.FloatTensor(np.array(self.normalize(x).todense())) n = x.shape[0] adj = sp.coo_matrix((edges[:, 2], (edges[:, 0], edges[:, 1])), shape=(n, n), dty...
GCNData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GCNData: def __init__(self, x, y, edges, is_undirected=True): """edge format: a n*3 numpy array with columns representing fr, to and weight between fr and to""" <|body_0|> def one_hot_encode(self, labels): """One-hot encode categorical labels""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_017634
1,836
no_license
[ { "docstring": "edge format: a n*3 numpy array with columns representing fr, to and weight between fr and to", "name": "__init__", "signature": "def __init__(self, x, y, edges, is_undirected=True)" }, { "docstring": "One-hot encode categorical labels", "name": "one_hot_encode", "signatur...
4
stack_v2_sparse_classes_30k_train_020695
Implement the Python class `GCNData` described below. Class description: Implement the GCNData class. Method signatures and docstrings: - def __init__(self, x, y, edges, is_undirected=True): edge format: a n*3 numpy array with columns representing fr, to and weight between fr and to - def one_hot_encode(self, labels)...
Implement the Python class `GCNData` described below. Class description: Implement the GCNData class. Method signatures and docstrings: - def __init__(self, x, y, edges, is_undirected=True): edge format: a n*3 numpy array with columns representing fr, to and weight between fr and to - def one_hot_encode(self, labels)...
4483877b528fb2397b68078996daeaac35018522
<|skeleton|> class GCNData: def __init__(self, x, y, edges, is_undirected=True): """edge format: a n*3 numpy array with columns representing fr, to and weight between fr and to""" <|body_0|> def one_hot_encode(self, labels): """One-hot encode categorical labels""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GCNData: def __init__(self, x, y, edges, is_undirected=True): """edge format: a n*3 numpy array with columns representing fr, to and weight between fr and to""" self.y = torch.LongTensor(np.where(self.one_hot_encode(y))[1]) x = sp.csr_matrix(x, dtype=np.float32) self.x = torch....
the_stack_v2_python_sparse
algorithms/graph_convolution_network/gcn_data.py
SweeRoty/fintell_app
train
0
826f7b6144c46fe75c373c7a2d52eeb8c7a67373
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the keyword plan campaign service. Service to manage Keyword Plan campaigns.
KeywordPlanCampaignServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordPlanCampaignServiceServicer: """Proto file describing the keyword plan campaign service. Service to manage Keyword Plan campaigns.""" def GetKeywordPlanCampaign(self, request, context): """Returns the requested Keyword Plan campaign in full detail.""" <|body_0|> d...
stack_v2_sparse_classes_36k_train_017635
5,992
permissive
[ { "docstring": "Returns the requested Keyword Plan campaign in full detail.", "name": "GetKeywordPlanCampaign", "signature": "def GetKeywordPlanCampaign(self, request, context)" }, { "docstring": "Creates, updates, or removes Keyword Plan campaigns. Operation statuses are returned.", "name":...
2
null
Implement the Python class `KeywordPlanCampaignServiceServicer` described below. Class description: Proto file describing the keyword plan campaign service. Service to manage Keyword Plan campaigns. Method signatures and docstrings: - def GetKeywordPlanCampaign(self, request, context): Returns the requested Keyword P...
Implement the Python class `KeywordPlanCampaignServiceServicer` described below. Class description: Proto file describing the keyword plan campaign service. Service to manage Keyword Plan campaigns. Method signatures and docstrings: - def GetKeywordPlanCampaign(self, request, context): Returns the requested Keyword P...
969eff5b6c3cec59d21191fa178cffb6270074c3
<|skeleton|> class KeywordPlanCampaignServiceServicer: """Proto file describing the keyword plan campaign service. Service to manage Keyword Plan campaigns.""" def GetKeywordPlanCampaign(self, request, context): """Returns the requested Keyword Plan campaign in full detail.""" <|body_0|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeywordPlanCampaignServiceServicer: """Proto file describing the keyword plan campaign service. Service to manage Keyword Plan campaigns.""" def GetKeywordPlanCampaign(self, request, context): """Returns the requested Keyword Plan campaign in full detail.""" context.set_code(grpc.StatusCo...
the_stack_v2_python_sparse
google/ads/google_ads/v6/proto/services/keyword_plan_campaign_service_pb2_grpc.py
VincentFritzsche/google-ads-python
train
0
2af44d959cd916b3a4586387fec74419ae45680b
[ "parser.add_argument('pool', help='Replica pool name.')\nparser.add_argument('--template', required=True, help='Path to YAML or JSON file containing the Replica pool template.')\nparser.add_argument('--size', required=True, help='Initial number of replicas in replica pool')\nparser.add_argument('--description', hel...
<|body_start_0|> parser.add_argument('pool', help='Replica pool name.') parser.add_argument('--template', required=True, help='Path to YAML or JSON file containing the Replica pool template.') parser.add_argument('--size', required=True, help='Initial number of replicas in replica pool') ...
Insert (Create) a replica pool.
Create
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Insert (Create) a replica pool.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" ...
stack_v2_sparse_classes_36k_train_017636
3,651
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstring"...
2
null
Implement the Python class `Create` described below. Class description: Insert (Create) a replica pool. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line ...
Implement the Python class `Create` described below. Class description: Insert (Create) a replica pool. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line ...
1f9b424c40a87b46656fc9f5e2e9c81895c7e614
<|skeleton|> class Create: """Insert (Create) a replica pool.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Create: """Insert (Create) a replica pool.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command. Positional arguments are allowed.""" parse...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/replica_pools/create.py
twistedpair/google-cloud-sdk
train
58
d6a6126ae433e99f481fda9cc158072c6694b040
[ "super().__init__(*args, **kwargs)\nattr_key = None\nattr_category = None\nattr_value = None\nattr_type = None\nattr_lockstring = None\nif hasattr(self.instance, 'attribute'):\n attr_key = self.instance.attribute.db_key\n attr_category = self.instance.attribute.db_category\n attr_value = self.instance.attr...
<|body_start_0|> super().__init__(*args, **kwargs) attr_key = None attr_category = None attr_value = None attr_type = None attr_lockstring = None if hasattr(self.instance, 'attribute'): attr_key = self.instance.attribute.db_key attr_categor...
This form overrides the base behavior of the ModelForm that would be used for a Attribute-through-model. Since the through-models only have access to the foreignkeys of the Attribute and the Object that they're attached to, we need to spoof the behavior of it being a form that would correspond to its Attribute, or the ...
AttributeForm
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttributeForm: """This form overrides the base behavior of the ModelForm that would be used for a Attribute-through-model. Since the through-models only have access to the foreignkeys of the Attribute and the Object that they're attached to, we need to spoof the behavior of it being a form that w...
stack_v2_sparse_classes_36k_train_017637
8,627
permissive
[ { "docstring": "If we have an Attribute, then we'll prepopulate our instance with the fields we'd expect it to have based on the Attribute. attr_key, attr_category, attr_value, attr_type, and attr_lockstring all refer to the corresponding Attribute fields. The initial data of the form fields will similarly be p...
3
null
Implement the Python class `AttributeForm` described below. Class description: This form overrides the base behavior of the ModelForm that would be used for a Attribute-through-model. Since the through-models only have access to the foreignkeys of the Attribute and the Object that they're attached to, we need to spoof...
Implement the Python class `AttributeForm` described below. Class description: This form overrides the base behavior of the ModelForm that would be used for a Attribute-through-model. Since the through-models only have access to the foreignkeys of the Attribute and the Object that they're attached to, we need to spoof...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class AttributeForm: """This form overrides the base behavior of the ModelForm that would be used for a Attribute-through-model. Since the through-models only have access to the foreignkeys of the Attribute and the Object that they're attached to, we need to spoof the behavior of it being a form that w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttributeForm: """This form overrides the base behavior of the ModelForm that would be used for a Attribute-through-model. Since the through-models only have access to the foreignkeys of the Attribute and the Object that they're attached to, we need to spoof the behavior of it being a form that would correspo...
the_stack_v2_python_sparse
evennia/web/admin/attributes.py
evennia/evennia
train
1,781
d6b65b6bffc5b0a58a5bec5cc0b150e2ba349eb0
[ "faster = lower = head\nfor _ in range(n):\n faster = faster.next\nif not faster:\n return head.next\nwhile faster:\n faster = faster.next\n if not faster:\n break\n lower = lower.next\nlower.next = lower.next.next\nreturn head", "length = 0\nsource = head\nwhile head:\n head = head.next\...
<|body_start_0|> faster = lower = head for _ in range(n): faster = faster.next if not faster: return head.next while faster: faster = faster.next if not faster: break lower = lower.next lower.next = lower...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_017638
2,050
permissive
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "_removeNthFromEnd", "signature": "def _removeNthFromEnd(self, head, n)" }, { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(sel...
2
stack_v2_sparse_classes_30k_train_021319
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" faster = lower = head for _ in range(n): faster = faster.next if not faster: return head.next while faster: faster = faster.next ...
the_stack_v2_python_sparse
19.remove-nth-node-from-end-of-list.py
windard/leeeeee
train
0
745ceddda99a5aaac486cec07dcd3158aeef69a2
[ "if request.args.get('merchant_code'):\n instance = self.model.objects(merchant_code=request.args.get('merchant_code')).first()\n if instance:\n return self.detail_schema.dump(instance).data\nreturn {}", "if not request.json.get('id'):\n return super().post()\nreturn super().put()" ]
<|body_start_0|> if request.args.get('merchant_code'): instance = self.model.objects(merchant_code=request.args.get('merchant_code')).first() if instance: return self.detail_schema.dump(instance).data return {} <|end_body_0|> <|body_start_1|> if not reque...
租户签章管理
CFCASealCodeAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CFCASealCodeAPI: """租户签章管理""" def get(self): """根据bid查询租户签章信息""" <|body_0|> def put(self): """更新租户签章配置""" <|body_1|> <|end_skeleton|> <|body_start_0|> if request.args.get('merchant_code'): instance = self.model.objects(merchant_code=...
stack_v2_sparse_classes_36k_train_017639
6,478
no_license
[ { "docstring": "根据bid查询租户签章信息", "name": "get", "signature": "def get(self)" }, { "docstring": "更新租户签章配置", "name": "put", "signature": "def put(self)" } ]
2
null
Implement the Python class `CFCASealCodeAPI` described below. Class description: 租户签章管理 Method signatures and docstrings: - def get(self): 根据bid查询租户签章信息 - def put(self): 更新租户签章配置
Implement the Python class `CFCASealCodeAPI` described below. Class description: 租户签章管理 Method signatures and docstrings: - def get(self): 根据bid查询租户签章信息 - def put(self): 更新租户签章配置 <|skeleton|> class CFCASealCodeAPI: """租户签章管理""" def get(self): """根据bid查询租户签章信息""" <|body_0|> def put(self)...
9f4553a6ea6d703f0ff3e330b090ee10e2b9a12a
<|skeleton|> class CFCASealCodeAPI: """租户签章管理""" def get(self): """根据bid查询租户签章信息""" <|body_0|> def put(self): """更新租户签章配置""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CFCASealCodeAPI: """租户签章管理""" def get(self): """根据bid查询租户签章信息""" if request.args.get('merchant_code'): instance = self.model.objects(merchant_code=request.args.get('merchant_code')).first() if instance: return self.detail_schema.dump(instance).data ...
the_stack_v2_python_sparse
xxw/support/src/modules/contract.py
GSIL-Monitor/xxw
train
0
4ff3f3e0aed1dfa6f71844a9c7491bf8af53424d
[ "user = get_user_model().objects.create(username='test_user', password='test')\nself.client.force_authenticate(user=user)\nresponse = self.get_user_info()\ndata = json.loads(response.content)\nself.assertEqual(response.status_code, status.HTTP_200_OK, 'Server did not return Status Code: 200')\nself.assertEqual(data...
<|body_start_0|> user = get_user_model().objects.create(username='test_user', password='test') self.client.force_authenticate(user=user) response = self.get_user_info() data = json.loads(response.content) self.assertEqual(response.status_code, status.HTTP_200_OK, 'Server did not ...
AuthenticationTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationTestCase: def test_get_user_info(self): """We can retrieve User info using API""" <|body_0|> def test_unauthorized_requests(self): """Verifies that no endpoint can be accessed without authentication""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_017640
5,402
no_license
[ { "docstring": "We can retrieve User info using API", "name": "test_get_user_info", "signature": "def test_get_user_info(self)" }, { "docstring": "Verifies that no endpoint can be accessed without authentication", "name": "test_unauthorized_requests", "signature": "def test_unauthorized_...
2
stack_v2_sparse_classes_30k_train_007029
Implement the Python class `AuthenticationTestCase` described below. Class description: Implement the AuthenticationTestCase class. Method signatures and docstrings: - def test_get_user_info(self): We can retrieve User info using API - def test_unauthorized_requests(self): Verifies that no endpoint can be accessed wi...
Implement the Python class `AuthenticationTestCase` described below. Class description: Implement the AuthenticationTestCase class. Method signatures and docstrings: - def test_get_user_info(self): We can retrieve User info using API - def test_unauthorized_requests(self): Verifies that no endpoint can be accessed wi...
04713113ce141d7e12a2ddb9e85aac5e50388f80
<|skeleton|> class AuthenticationTestCase: def test_get_user_info(self): """We can retrieve User info using API""" <|body_0|> def test_unauthorized_requests(self): """Verifies that no endpoint can be accessed without authentication""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticationTestCase: def test_get_user_info(self): """We can retrieve User info using API""" user = get_user_model().objects.create(username='test_user', password='test') self.client.force_authenticate(user=user) response = self.get_user_info() data = json.loads(resp...
the_stack_v2_python_sparse
curriculum_algorithm/tests.py
Joshuacruzc/CurriculumAlgorithm
train
1
fb5d8f27cd7ebe851f0c81ee8e1e3a920d8e0eaf
[ "super(CrystalGraphConvNet, self).__init__()\nself.classification = classification\nself.embedding = nn.Linear(orig_atom_fea_len, atom_fea_len)\nself.convs = nn.ModuleList([ConvLayer(atom_fea_len=atom_fea_len, nbr_fea_len=nbr_fea_len) for _ in range(n_conv)])\nself.conv_to_fc = nn.Linear(atom_fea_len, h_fea_len)\ns...
<|body_start_0|> super(CrystalGraphConvNet, self).__init__() self.classification = classification self.embedding = nn.Linear(orig_atom_fea_len, atom_fea_len) self.convs = nn.ModuleList([ConvLayer(atom_fea_len=atom_fea_len, nbr_fea_len=nbr_fea_len) for _ in range(n_conv)]) self.co...
Create a crystal graph convolutional neural network for predicting total material properties.
CrystalGraphConvNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrystalGraphConvNet: """Create a crystal graph convolutional neural network for predicting total material properties.""" def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea_len: int=128, n_h: int=1, classification: bool=False): """I...
stack_v2_sparse_classes_36k_train_017641
9,607
permissive
[ { "docstring": "Initialize CrystalGraphConvNet. Args: orig_atom_fea_len: int Number of atom features in the input. nbr_fea_len: int Number of bond features. atom_fea_len: int Number of hidden atom features in the convolutional layers. n_conv: int Number of convolutional layers. h_fea_len: int Number of hidden f...
3
null
Implement the Python class `CrystalGraphConvNet` described below. Class description: Create a crystal graph convolutional neural network for predicting total material properties. Method signatures and docstrings: - def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea...
Implement the Python class `CrystalGraphConvNet` described below. Class description: Create a crystal graph convolutional neural network for predicting total material properties. Method signatures and docstrings: - def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class CrystalGraphConvNet: """Create a crystal graph convolutional neural network for predicting total material properties.""" def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea_len: int=128, n_h: int=1, classification: bool=False): """I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrystalGraphConvNet: """Create a crystal graph convolutional neural network for predicting total material properties.""" def __init__(self, orig_atom_fea_len: int, nbr_fea_len: int, atom_fea_len: int=64, n_conv: int=3, h_fea_len: int=128, n_h: int=1, classification: bool=False): """Initialize Cry...
the_stack_v2_python_sparse
src/gt4sd/frameworks/cgcnn/model.py
GT4SD/gt4sd-core
train
239
d0dc059f717ff4cd9b1e0e706d4f6a8f211cd88e
[ "jobs = sorted(zip(startTime, endTime, profit), key=lambda v: v[1])\ndp = [[0, 0]]\nfor start, end, profit in jobs:\n i = bisect.bisect(dp, [start + 1]) - 1\n if dp[i][1] + profit > dp[-1][1]:\n dp.append([end, dp[i][1] + profit])\nreturn dp[-1][1]", "jobs = sorted(zip(startTime, endTime, profit), ke...
<|body_start_0|> jobs = sorted(zip(startTime, endTime, profit), key=lambda v: v[1]) dp = [[0, 0]] for start, end, profit in jobs: i = bisect.bisect(dp, [start + 1]) - 1 if dp[i][1] + profit > dp[-1][1]: dp.append([end, dp[i][1] + profit]) return dp...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def jobScheduling(self, startTime: list[int], endTime: list[int], profit: list[int]) -> int: """https://leetcode.com/problems/maximum-profit-in-job-scheduling/discuss/409009/JavaC%2B%2BPython-DP-Solution dynamic programming Time O(NlogN) for sorting Time O(NlogN) for binary sea...
stack_v2_sparse_classes_36k_train_017642
2,115
no_license
[ { "docstring": "https://leetcode.com/problems/maximum-profit-in-job-scheduling/discuss/409009/JavaC%2B%2BPython-DP-Solution dynamic programming Time O(NlogN) for sorting Time O(NlogN) for binary search for each job Space O(N)", "name": "jobScheduling", "signature": "def jobScheduling(self, startTime: li...
2
stack_v2_sparse_classes_30k_train_004447
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jobScheduling(self, startTime: list[int], endTime: list[int], profit: list[int]) -> int: https://leetcode.com/problems/maximum-profit-in-job-scheduling/discuss/409009/JavaC%2...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jobScheduling(self, startTime: list[int], endTime: list[int], profit: list[int]) -> int: https://leetcode.com/problems/maximum-profit-in-job-scheduling/discuss/409009/JavaC%2...
e50dc0642f087f37ab3234390be3d8a0ed48fe62
<|skeleton|> class Solution: def jobScheduling(self, startTime: list[int], endTime: list[int], profit: list[int]) -> int: """https://leetcode.com/problems/maximum-profit-in-job-scheduling/discuss/409009/JavaC%2B%2BPython-DP-Solution dynamic programming Time O(NlogN) for sorting Time O(NlogN) for binary sea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def jobScheduling(self, startTime: list[int], endTime: list[int], profit: list[int]) -> int: """https://leetcode.com/problems/maximum-profit-in-job-scheduling/discuss/409009/JavaC%2B%2BPython-DP-Solution dynamic programming Time O(NlogN) for sorting Time O(NlogN) for binary search for each j...
the_stack_v2_python_sparse
Leetcode/ByteDance/1235. Maximum Profit in Job Scheduling.py
brlala/Educative-Grokking-Coding-Exercise
train
3
7d15c584f0ab635e7a0d7799c049fd24c0975909
[ "if self._is_red:\n return Red_Knight\nelse:\n return BLACK_Knight", "pre_moves = [(+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1)]\nblocks = [(self._x, self._y + 1), (self._x, self._y - 1), (self._x, self._y + 1), (self._x, self._y + 1), (self._x + 1, self._y), (self._x + 1, ...
<|body_start_0|> if self._is_red: return Red_Knight else: return BLACK_Knight <|end_body_0|> <|body_start_1|> pre_moves = [(+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1)] blocks = [(self._x, self._y + 1), (self._x, self._y - 1), (s...
马类
Knight
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Knight: """马类""" def image(self): """获取棋子图像""" <|body_0|> def get_moves(self, pieces: dict): """获取能移动的位置""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self._is_red: return Red_Knight else: return BLACK_Knight...
stack_v2_sparse_classes_36k_train_017643
1,373
permissive
[ { "docstring": "获取棋子图像", "name": "image", "signature": "def image(self)" }, { "docstring": "获取能移动的位置", "name": "get_moves", "signature": "def get_moves(self, pieces: dict)" } ]
2
stack_v2_sparse_classes_30k_train_014459
Implement the Python class `Knight` described below. Class description: 马类 Method signatures and docstrings: - def image(self): 获取棋子图像 - def get_moves(self, pieces: dict): 获取能移动的位置
Implement the Python class `Knight` described below. Class description: 马类 Method signatures and docstrings: - def image(self): 获取棋子图像 - def get_moves(self, pieces: dict): 获取能移动的位置 <|skeleton|> class Knight: """马类""" def image(self): """获取棋子图像""" <|body_0|> def get_moves(self, pieces: d...
af9aa36d9f46452b38433580253c7e2853bb6478
<|skeleton|> class Knight: """马类""" def image(self): """获取棋子图像""" <|body_0|> def get_moves(self, pieces: dict): """获取能移动的位置""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Knight: """马类""" def image(self): """获取棋子图像""" if self._is_red: return Red_Knight else: return BLACK_Knight def get_moves(self, pieces: dict): """获取能移动的位置""" pre_moves = [(+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, ...
the_stack_v2_python_sparse
chess/chessman/knight.py
kimi9527/chess-yi
train
0
e4715605ab6de7acba601bddfbb0111395d30023
[ "self._annot_table.itemSelectionChanged.connect(self._fcn_annot_goto)\nself._annot_table.cellChanged.connect(self._fcn_text_edited)\nself._annot_txtsz.valueChanged.connect(self._fcn_annot_appear)\nself._annot_marksz.valueChanged.connect(self._fcn_annot_appear)\nself._annot_color.editingFinished.connect(self._fcn_an...
<|body_start_0|> self._annot_table.itemSelectionChanged.connect(self._fcn_annot_goto) self._annot_table.cellChanged.connect(self._fcn_text_edited) self._annot_txtsz.valueChanged.connect(self._fcn_annot_appear) self._annot_marksz.valueChanged.connect(self._fcn_annot_appear) self._...
Annotations interactions.
UiAnnotations
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UiAnnotations: """Annotations interactions.""" def __init__(self): """Init.""" <|body_0|> def _annotate_event(self, signal, coord, text='Enter annotation'): """Annotate event.""" <|body_1|> def _fcn_annot_goto(self): """Select the annotation....
stack_v2_sparse_classes_36k_train_017644
4,395
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Annotate event.", "name": "_annotate_event", "signature": "def _annotate_event(self, signal, coord, text='Enter annotation')" }, { "docstring": "Select the annotation.", "name": "...
6
stack_v2_sparse_classes_30k_train_020556
Implement the Python class `UiAnnotations` described below. Class description: Annotations interactions. Method signatures and docstrings: - def __init__(self): Init. - def _annotate_event(self, signal, coord, text='Enter annotation'): Annotate event. - def _fcn_annot_goto(self): Select the annotation. - def _fcn_tex...
Implement the Python class `UiAnnotations` described below. Class description: Annotations interactions. Method signatures and docstrings: - def __init__(self): Init. - def _annotate_event(self, signal, coord, text='Enter annotation'): Annotate event. - def _fcn_annot_goto(self): Select the annotation. - def _fcn_tex...
be096aa8a7058c329e7120d0bdb45d3c9eb8be42
<|skeleton|> class UiAnnotations: """Annotations interactions.""" def __init__(self): """Init.""" <|body_0|> def _annotate_event(self, signal, coord, text='Enter annotation'): """Annotate event.""" <|body_1|> def _fcn_annot_goto(self): """Select the annotation....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UiAnnotations: """Annotations interactions.""" def __init__(self): """Init.""" self._annot_table.itemSelectionChanged.connect(self._fcn_annot_goto) self._annot_table.cellChanged.connect(self._fcn_text_edited) self._annot_txtsz.valueChanged.connect(self._fcn_annot_appear) ...
the_stack_v2_python_sparse
visbrain/gui/signal/ui_elements/ui_annotations.py
lassemadsen/visbrain
train
0
7a150a72e85d60b65b4ff07e99ddc0b79e39d054
[ "QTreeWidgetItem.__init__(self, parent)\nself.taskData = task\nself.taskId = task['id']\nself.taskState = None\nself.setText(COL_RUNNING_ID, str(task['id']))\nself.setText(COL_RUNNING_PROJECT, instance().getProjectName(task['project-id']))\nself.setText(COL_RUNNING_NAME, str(task['name']))\nself.setText(COL_RUNNING...
<|body_start_0|> QTreeWidgetItem.__init__(self, parent) self.taskData = task self.taskId = task['id'] self.taskState = None self.setText(COL_RUNNING_ID, str(task['id'])) self.setText(COL_RUNNING_PROJECT, instance().getProjectName(task['project-id'])) self.setText(...
Treewidget item for task running
TaskRunningItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskRunningItem: """Treewidget item for task running""" def __init__(self, task, parent=None): """Constructs TaskItem widget item @param task: @type task: list @param parent: @type parent:""" <|body_0|> def setStateIcon(self, state): """Set the icon state""" ...
stack_v2_sparse_classes_36k_train_017645
49,955
permissive
[ { "docstring": "Constructs TaskItem widget item @param task: @type task: list @param parent: @type parent:", "name": "__init__", "signature": "def __init__(self, task, parent=None)" }, { "docstring": "Set the icon state", "name": "setStateIcon", "signature": "def setStateIcon(self, state...
2
stack_v2_sparse_classes_30k_train_002379
Implement the Python class `TaskRunningItem` described below. Class description: Treewidget item for task running Method signatures and docstrings: - def __init__(self, task, parent=None): Constructs TaskItem widget item @param task: @type task: list @param parent: @type parent: - def setStateIcon(self, state): Set t...
Implement the Python class `TaskRunningItem` described below. Class description: Treewidget item for task running Method signatures and docstrings: - def __init__(self, task, parent=None): Constructs TaskItem widget item @param task: @type task: list @param parent: @type parent: - def setStateIcon(self, state): Set t...
66f65dd6e4a48909120f63239f630147c733df3f
<|skeleton|> class TaskRunningItem: """Treewidget item for task running""" def __init__(self, task, parent=None): """Constructs TaskItem widget item @param task: @type task: list @param parent: @type parent:""" <|body_0|> def setStateIcon(self, state): """Set the icon state""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskRunningItem: """Treewidget item for task running""" def __init__(self, task, parent=None): """Constructs TaskItem widget item @param task: @type task: list @param parent: @type parent:""" QTreeWidgetItem.__init__(self, parent) self.taskData = task self.taskId = task['i...
the_stack_v2_python_sparse
ServerExplorer/TestManager.py
ExtensiveAutomation/extensiveautomation-appclient
train
2
be138294136758c22557003984d14c84323874b3
[ "timer = pv.Timer()\npoints = TEST_POINTS_5D\ntimer.mark('Tree Build Start')\nkdtree = FLANNTree(points)\ntimer.mark('Tree Build Time')\nknn = KNearestNeighbors(points)\ntimer.mark('Linear Build Time')\ntimer.mark('Query Start')\nfdist, _ = kdtree.query([0.05, 0.3, 0.9, 0.6, 0.2], k=4)\ntimer.mark('KDTree Query')\n...
<|body_start_0|> timer = pv.Timer() points = TEST_POINTS_5D timer.mark('Tree Build Start') kdtree = FLANNTree(points) timer.mark('Tree Build Time') knn = KNearestNeighbors(points) timer.mark('Linear Build Time') timer.mark('Query Start') fdist, _ =...
AKNNTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AKNNTest: def testLargeTree(self): """Tests using a large tree.""" <|body_0|> def testReallyLargeTree(self): """Tests using a really large tree.""" <|body_1|> def testHighDim(self): """test using high dimensions""" <|body_2|> def tes...
stack_v2_sparse_classes_36k_train_017646
39,118
permissive
[ { "docstring": "Tests using a large tree.", "name": "testLargeTree", "signature": "def testLargeTree(self)" }, { "docstring": "Tests using a really large tree.", "name": "testReallyLargeTree", "signature": "def testReallyLargeTree(self)" }, { "docstring": "test using high dimensi...
4
null
Implement the Python class `AKNNTest` described below. Class description: Implement the AKNNTest class. Method signatures and docstrings: - def testLargeTree(self): Tests using a large tree. - def testReallyLargeTree(self): Tests using a really large tree. - def testHighDim(self): test using high dimensions - def tes...
Implement the Python class `AKNNTest` described below. Class description: Implement the AKNNTest class. Method signatures and docstrings: - def testLargeTree(self): Tests using a large tree. - def testReallyLargeTree(self): Tests using a really large tree. - def testHighDim(self): test using high dimensions - def tes...
caa4e0254f55c5c8f3464807556b9414ea731293
<|skeleton|> class AKNNTest: def testLargeTree(self): """Tests using a large tree.""" <|body_0|> def testReallyLargeTree(self): """Tests using a really large tree.""" <|body_1|> def testHighDim(self): """test using high dimensions""" <|body_2|> def tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AKNNTest: def testLargeTree(self): """Tests using a large tree.""" timer = pv.Timer() points = TEST_POINTS_5D timer.mark('Tree Build Start') kdtree = FLANNTree(points) timer.mark('Tree Build Time') knn = KNearestNeighbors(points) timer.mark('Line...
the_stack_v2_python_sparse
src/pyvision/ml/knn.py
bolme/pyvision
train
47
89eada8540f136577f80e6c2e797c3d17d958a9c
[ "self.switch_profiles = switch_profiles\nself.switches = switches\nself.stacks = stacks\nself.stp_priority = stp_priority", "if dictionary is None:\n return None\nstp_priority = dictionary.get('stpPriority')\nswitch_profiles = dictionary.get('switchProfiles')\nswitches = dictionary.get('switches')\nstacks = di...
<|body_start_0|> self.switch_profiles = switch_profiles self.switches = switches self.stacks = stacks self.stp_priority = stp_priority <|end_body_0|> <|body_start_1|> if dictionary is None: return None stp_priority = dictionary.get('stpPriority') swit...
Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority (int): STP priority for switch, stacks, or switch ...
StpBridgePriorityModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StpBridgePriorityModel: """Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority ...
stack_v2_sparse_classes_36k_train_017647
2,255
permissive
[ { "docstring": "Constructor for the StpBridgePriorityModel class", "name": "__init__", "signature": "def __init__(self, stp_priority=None, switch_profiles=None, switches=None, stacks=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A di...
2
stack_v2_sparse_classes_30k_train_013512
Implement the Python class `StpBridgePriorityModel` described below. Class description: Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of s...
Implement the Python class `StpBridgePriorityModel` described below. Class description: Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of s...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class StpBridgePriorityModel: """Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StpBridgePriorityModel: """Implementation of the 'StpBridgePriority' model. TODO: type model description here. Attributes: switch_profiles (list of string): List of switch profile IDs switches (list of string): List of switch serial numbers stacks (list of string): List of stack IDs stp_priority (int): STP pr...
the_stack_v2_python_sparse
meraki/models/stp_bridge_priority_model.py
RaulCatalano/meraki-python-sdk
train
1
81f3bfc03d0609d6f20c9ac1e8bd4e537c3f9c6e
[ "new_data = []\nfor data in data_list:\n repo_data = repo[data]\n for row in repo_data.find():\n element = {}\n element['facility_type'] = data[17:]\n element['coordinates'] = row['geometry']['coordinates'][::-1]\n new_data.append(element)\nreturn new_data", "startTime = datetime...
<|body_start_0|> new_data = [] for data in data_list: repo_data = repo[data] for row in repo_data.find(): element = {} element['facility_type'] = data[17:] element['coordinates'] = row['geometry']['coordinates'][::-1] ...
boston_fire_facility_transformation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class boston_fire_facility_transformation: def merge_data(data_list, repo): """:param data_list: The data list of mongodb as input :param repo: Mongodb repo :return: merged data which includes Boston Fire Hydrants, Fire Department, Fire Alarm Boxes with their coordinates and zipcode""" ...
stack_v2_sparse_classes_36k_train_017648
5,696
no_license
[ { "docstring": ":param data_list: The data list of mongodb as input :param repo: Mongodb repo :return: merged data which includes Boston Fire Hydrants, Fire Department, Fire Alarm Boxes with their coordinates and zipcode", "name": "merge_data", "signature": "def merge_data(data_list, repo)" }, { ...
3
null
Implement the Python class `boston_fire_facility_transformation` described below. Class description: Implement the boston_fire_facility_transformation class. Method signatures and docstrings: - def merge_data(data_list, repo): :param data_list: The data list of mongodb as input :param repo: Mongodb repo :return: merg...
Implement the Python class `boston_fire_facility_transformation` described below. Class description: Implement the boston_fire_facility_transformation class. Method signatures and docstrings: - def merge_data(data_list, repo): :param data_list: The data list of mongodb as input :param repo: Mongodb repo :return: merg...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class boston_fire_facility_transformation: def merge_data(data_list, repo): """:param data_list: The data list of mongodb as input :param repo: Mongodb repo :return: merged data which includes Boston Fire Hydrants, Fire Department, Fire Alarm Boxes with their coordinates and zipcode""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class boston_fire_facility_transformation: def merge_data(data_list, repo): """:param data_list: The data list of mongodb as input :param repo: Mongodb repo :return: merged data which includes Boston Fire Hydrants, Fire Department, Fire Alarm Boxes with their coordinates and zipcode""" new_data = []...
the_stack_v2_python_sparse
liweixi_mogujzhu/boston_fire_facility_transformation.py
maximega/course-2019-spr-proj
train
2
d17b356c49fa061238cd547dd0bc0693e654ecef
[ "self.w = w\nself.total_weights = sum(self.w)\nfor i in range(1, len(self.w)):\n self.w[i] += self.w[i - 1]", "rand = random.randint(1, self.total_weights)\nl, r = (0, len(self.w) - 1)\nwhile l < r:\n mid = (l + r) // 2\n if rand <= self.w[mid]:\n r = mid\n else:\n l = mid + 1\nreturn l"...
<|body_start_0|> self.w = w self.total_weights = sum(self.w) for i in range(1, len(self.w)): self.w[i] += self.w[i - 1] <|end_body_0|> <|body_start_1|> rand = random.randint(1, self.total_weights) l, r = (0, len(self.w) - 1) while l < r: mid = (l ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.w = w self.total_weights = sum(self.w) for i in range(1, len(self.w)): ...
stack_v2_sparse_classes_36k_train_017649
1,227
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
9126c2089e41d4d7fd3a204115eba2b5074076ad
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.w = w self.total_weights = sum(self.w) for i in range(1, len(self.w)): self.w[i] += self.w[i - 1] def pickIndex(self): """:rtype: int""" rand = random.randint(1, self.total_weights) ...
the_stack_v2_python_sparse
528_Random Pick with Weight.py
Shwan-Yu/Data_Structures_and_Algorithms
train
0
ed3f26ef057ede9e7ce35e66e0fbffe3705fce9a
[ "super(ButtonTab, self).__init__(*args, **kwargs)\nself.setCheckable(True)\nself.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)\nself.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)", "key = event.key()\nif key in [Qt.Key_Enter, Qt.Key_Return]:\n self.animateClick()\nsuper(ButtonTab, self).keyPres...
<|body_start_0|> super(ButtonTab, self).__init__(*args, **kwargs) self.setCheckable(True) self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) <|end_body_0|> <|body_start_1|> key = event.key() if key in [Qt...
Button used in custom tab bar for CSS styling.
ButtonTab
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ButtonTab: """Button used in custom tab bar for CSS styling.""" def __init__(self, *args, **kwargs): """Button used in custom tab bar for CSS styling.""" <|body_0|> def keyPressEvent(self, event): """Override Qt method.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_017650
9,075
permissive
[ { "docstring": "Button used in custom tab bar for CSS styling.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Override Qt method.", "name": "keyPressEvent", "signature": "def keyPressEvent(self, event)" } ]
2
null
Implement the Python class `ButtonTab` described below. Class description: Button used in custom tab bar for CSS styling. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Button used in custom tab bar for CSS styling. - def keyPressEvent(self, event): Override Qt method.
Implement the Python class `ButtonTab` described below. Class description: Button used in custom tab bar for CSS styling. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Button used in custom tab bar for CSS styling. - def keyPressEvent(self, event): Override Qt method. <|skeleton|> class Bu...
4c38b112f5c40b43d6ec126e415b609c7fdc1f39
<|skeleton|> class ButtonTab: """Button used in custom tab bar for CSS styling.""" def __init__(self, *args, **kwargs): """Button used in custom tab bar for CSS styling.""" <|body_0|> def keyPressEvent(self, event): """Override Qt method.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ButtonTab: """Button used in custom tab bar for CSS styling.""" def __init__(self, *args, **kwargs): """Button used in custom tab bar for CSS styling.""" super(ButtonTab, self).__init__(*args, **kwargs) self.setCheckable(True) self.setToolButtonStyle(Qt.ToolButtonTextBesid...
the_stack_v2_python_sparse
lib/python2.7/site-packages/anaconda_navigator/widgets/tabs/tabwidget.py
sunnyweilai/Finding-Theme-Color-Palettes
train
1
165d411bf20925e51cbbf2bb65c510e470e28659
[ "BlenderBot2RagAgent.add_cmdline_args(parser, partial_opt)\nmbot_group = parser.add_argument_group('Memory Agent Args')\nmbot_group.set_defaults(knowledge_access_method=KnowledgeAccessMethod.MEMORY_ONLY.value)\nmbot_group.set_defaults(memory_key='full_text')\nmbot_group.add_argument('--memory-extractor-phrases', ty...
<|body_start_0|> BlenderBot2RagAgent.add_cmdline_args(parser, partial_opt) mbot_group = parser.add_argument_group('Memory Agent Args') mbot_group.set_defaults(knowledge_access_method=KnowledgeAccessMethod.MEMORY_ONLY.value) mbot_group.set_defaults(memory_key='full_text') mbot_gro...
Subclass BlenderBot2RagAgent to provide MemoryModel with appropriate inputs (specifically, memory vectors).
MemoryRagAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemoryRagAgent: """Subclass BlenderBot2RagAgent to provide MemoryModel with appropriate inputs (specifically, memory vectors).""" def add_cmdline_args(cls, parser: ParlaiParser, partial_opt: Optional[Opt]=None) -> ParlaiParser: """Add Memory Agent Args.""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_017651
9,358
permissive
[ { "docstring": "Add Memory Agent Args.", "name": "add_cmdline_args", "signature": "def add_cmdline_args(cls, parser: ParlaiParser, partial_opt: Optional[Opt]=None) -> ParlaiParser" }, { "docstring": "Override RAG.set_query_vec to optionally filter keys.", "name": "_set_query_vec", "signa...
3
null
Implement the Python class `MemoryRagAgent` described below. Class description: Subclass BlenderBot2RagAgent to provide MemoryModel with appropriate inputs (specifically, memory vectors). Method signatures and docstrings: - def add_cmdline_args(cls, parser: ParlaiParser, partial_opt: Optional[Opt]=None) -> ParlaiPars...
Implement the Python class `MemoryRagAgent` described below. Class description: Subclass BlenderBot2RagAgent to provide MemoryModel with appropriate inputs (specifically, memory vectors). Method signatures and docstrings: - def add_cmdline_args(cls, parser: ParlaiParser, partial_opt: Optional[Opt]=None) -> ParlaiPars...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class MemoryRagAgent: """Subclass BlenderBot2RagAgent to provide MemoryModel with appropriate inputs (specifically, memory vectors).""" def add_cmdline_args(cls, parser: ParlaiParser, partial_opt: Optional[Opt]=None) -> ParlaiParser: """Add Memory Agent Args.""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemoryRagAgent: """Subclass BlenderBot2RagAgent to provide MemoryModel with appropriate inputs (specifically, memory vectors).""" def add_cmdline_args(cls, parser: ParlaiParser, partial_opt: Optional[Opt]=None) -> ParlaiParser: """Add Memory Agent Args.""" BlenderBot2RagAgent.add_cmdline_...
the_stack_v2_python_sparse
projects/msc/agents/memory_agent.py
facebookresearch/ParlAI
train
10,943
55d72c67ad38d7dae4f05c6d1cb7e56ae730e236
[ "c0 = Coordinates()\nself.assertIsNot(c0, None)\nself.assertIsInstance(c0, Coordinates)", "c0 = Coordinates([1])\nself.assertIsNot(c0, None)\nself.assertIsInstance(c0, Coordinates)\nc1 = Coordinates([1, 2, 3])\nself.assertIsNot(c1, None)\nself.assertIsInstance(c1, Coordinates)\nc2 = Coordinates('xyz')\nc3 = Coord...
<|body_start_0|> c0 = Coordinates() self.assertIsNot(c0, None) self.assertIsInstance(c0, Coordinates) <|end_body_0|> <|body_start_1|> c0 = Coordinates([1]) self.assertIsNot(c0, None) self.assertIsInstance(c0, Coordinates) c1 = Coordinates([1, 2, 3]) self....
Test Coordinate class calls
TestConstructor_Coordinate
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConstructor_Coordinate: """Test Coordinate class calls""" def test_none(self): """Calling Coordinates class with no key (kay = None)""" <|body_0|> def test_iterable(self): """Calling Coordinates class with key conaining simple types""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_017652
6,423
permissive
[ { "docstring": "Calling Coordinates class with no key (kay = None)", "name": "test_none", "signature": "def test_none(self)" }, { "docstring": "Calling Coordinates class with key conaining simple types", "name": "test_iterable", "signature": "def test_iterable(self)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_007579
Implement the Python class `TestConstructor_Coordinate` described below. Class description: Test Coordinate class calls Method signatures and docstrings: - def test_none(self): Calling Coordinates class with no key (kay = None) - def test_iterable(self): Calling Coordinates class with key conaining simple types - def...
Implement the Python class `TestConstructor_Coordinate` described below. Class description: Test Coordinate class calls Method signatures and docstrings: - def test_none(self): Calling Coordinates class with no key (kay = None) - def test_iterable(self): Calling Coordinates class with key conaining simple types - def...
f9b00a39bc16aea4abac60c0dd0aab2acac5adcf
<|skeleton|> class TestConstructor_Coordinate: """Test Coordinate class calls""" def test_none(self): """Calling Coordinates class with no key (kay = None)""" <|body_0|> def test_iterable(self): """Calling Coordinates class with key conaining simple types""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestConstructor_Coordinate: """Test Coordinate class calls""" def test_none(self): """Calling Coordinates class with no key (kay = None)""" c0 = Coordinates() self.assertIsNot(c0, None) self.assertIsInstance(c0, Coordinates) def test_iterable(self): """Calling...
the_stack_v2_python_sparse
_BACKUPS_v3/v3_1/LightPicture_Test.py
nagame/LightPicture
train
0
031d8fa3af0b4fe49a3f09f41d414480858b05f6
[ "writer.write(indent + '<' + self.tagName)\nattrs = self._get_attributes()\nfor a_name in attrs.keys():\n writer.write(' %s=\"' % a_name)\n self.write_data(writer, attrs[a_name].value)\n writer.write('\"')\nif self.childNodes:\n writer.write('>')\n if len(self.childNodes) == 1 and self.childNodes[0]....
<|body_start_0|> writer.write(indent + '<' + self.tagName) attrs = self._get_attributes() for a_name in attrs.keys(): writer.write(' %s="' % a_name) self.write_data(writer, attrs[a_name].value) writer.write('"') if self.childNodes: writer.w...
NElement
[ "MIT", "GPL-3.0-only", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NElement: def writexml(self, writer, indent='', add_indent='', new_line=''): """Overridden specifically for neutrino for more correct [&apos; -> optional] xml attrs generation.""" <|body_0|> def write_data(writer, data): """Writes data chars to writer.""" <|b...
stack_v2_sparse_classes_36k_train_017653
4,467
permissive
[ { "docstring": "Overridden specifically for neutrino for more correct [&apos; -> optional] xml attrs generation.", "name": "writexml", "signature": "def writexml(self, writer, indent='', add_indent='', new_line='')" }, { "docstring": "Writes data chars to writer.", "name": "write_data", ...
2
stack_v2_sparse_classes_30k_train_004489
Implement the Python class `NElement` described below. Class description: Implement the NElement class. Method signatures and docstrings: - def writexml(self, writer, indent='', add_indent='', new_line=''): Overridden specifically for neutrino for more correct [&apos; -> optional] xml attrs generation. - def write_da...
Implement the Python class `NElement` described below. Class description: Implement the NElement class. Method signatures and docstrings: - def writexml(self, writer, indent='', add_indent='', new_line=''): Overridden specifically for neutrino for more correct [&apos; -> optional] xml attrs generation. - def write_da...
917e184486ff212b4a19b36ab726343f900da8b7
<|skeleton|> class NElement: def writexml(self, writer, indent='', add_indent='', new_line=''): """Overridden specifically for neutrino for more correct [&apos; -> optional] xml attrs generation.""" <|body_0|> def write_data(writer, data): """Writes data chars to writer.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NElement: def writexml(self, writer, indent='', add_indent='', new_line=''): """Overridden specifically for neutrino for more correct [&apos; -> optional] xml attrs generation.""" writer.write(indent + '<' + self.tagName) attrs = self._get_attributes() for a_name in attrs.keys(...
the_stack_v2_python_sparse
app/eparser/neutrino/nxml.py
DYefremov/DemonEditor
train
105
b0a5170e600d915e8edab2378afcb5f17b9fc8d9
[ "super().__init__()\nself.device = device\nself.tok_embedding = nn.Embedding(num_embeddings=output_dim, embedding_dim=hid_dim)\nself.pos_embedding = nn.Embedding(num_embeddings=max_length, embedding_dim=hid_dim)\nself.layers = nn.ModuleList([GatedDecoderLayer(hid_dim, n_heads, pf_dim, dropout, device) for _ in rang...
<|body_start_0|> super().__init__() self.device = device self.tok_embedding = nn.Embedding(num_embeddings=output_dim, embedding_dim=hid_dim) self.pos_embedding = nn.Embedding(num_embeddings=max_length, embedding_dim=hid_dim) self.layers = nn.ModuleList([GatedDecoderLayer(hid_dim,...
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: def __init__(self, output_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): """Decoder class for Gated Transformer which is similar to the Encoder but also has + mask multi-head attention layer over target sequence + ...
stack_v2_sparse_classes_36k_train_017654
8,786
permissive
[ { "docstring": "Decoder class for Gated Transformer which is similar to the Encoder but also has + mask multi-head attention layer over target sequence + multi-head attention layer which uses the decoder representation as the query zand the encoder representation as the key and value Parameters ---------- outpu...
2
stack_v2_sparse_classes_30k_train_003381
Implement the Python class `Decoder` described below. Class description: Implement the Decoder class. Method signatures and docstrings: - def __init__(self, output_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): Decoder class for Gated Transformer which ...
Implement the Python class `Decoder` described below. Class description: Implement the Decoder class. Method signatures and docstrings: - def __init__(self, output_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): Decoder class for Gated Transformer which ...
a6c870d4ed0788f15cfdf58c85ed5201dff60ee9
<|skeleton|> class Decoder: def __init__(self, output_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): """Decoder class for Gated Transformer which is similar to the Encoder but also has + mask multi-head attention layer over target sequence + ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: def __init__(self, output_dim: int, hid_dim: int, n_layers: int, n_heads: int, pf_dim: int, dropout: float, device: str, max_length=100): """Decoder class for Gated Transformer which is similar to the Encoder but also has + mask multi-head attention layer over target sequence + multi-head att...
the_stack_v2_python_sparse
src/gated_transformers_nlp/utils/gated_transformers/decoder.py
mnguyen0226/gated_transformers_nlp
train
2
cce0f67b87846269b34157ed7dcfaa0853fd1fda
[ "self.logger = logger\nself.is_trained = False\nself.supported_formats = ['pkl', 'onnx', 'pmml']\nself.name = 'SVM'\nself.centroids = None\nself.sigma = None\nself.weights = None", "sqrtDists = cdist(setDim1, setDim2, 'euclidean')\ngamma = 1 / self.sigma ** 2\nreturn np.exp(-gamma * np.power(sqrtDists, 2))", "K...
<|body_start_0|> self.logger = logger self.is_trained = False self.supported_formats = ['pkl', 'onnx', 'pmml'] self.name = 'SVM' self.centroids = None self.sigma = None self.weights = None <|end_body_0|> <|body_start_1|> sqrtDists = cdist(setDim1, setDim2...
This class contains the Semiparametric SVM model.
SVM_model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SVM_model: """This class contains the Semiparametric SVM model.""" def __init__(self, logger): """Create a :class:`SVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def kernelMatrix(self, setDim1, setDim2)...
stack_v2_sparse_classes_36k_train_017655
17,644
permissive
[ { "docstring": "Create a :class:`SVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.", "name": "__init__", "signature": "def __init__(self, logger)" }, { "docstring": "Computes a kernel matrix given two datasets. Parameters ---------- setDim1: nd...
3
null
Implement the Python class `SVM_model` described below. Class description: This class contains the Semiparametric SVM model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`SVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - def kern...
Implement the Python class `SVM_model` described below. Class description: This class contains the Semiparametric SVM model. Method signatures and docstrings: - def __init__(self, logger): Create a :class:`SVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance. - def kern...
ccc0a7674a04ae0d00bedc38893b33184c5f68c6
<|skeleton|> class SVM_model: """This class contains the Semiparametric SVM model.""" def __init__(self, logger): """Create a :class:`SVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" <|body_0|> def kernelMatrix(self, setDim1, setDim2)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SVM_model: """This class contains the Semiparametric SVM model.""" def __init__(self, logger): """Create a :class:`SVM_model` instance. Parameters ---------- logger: :class:`mylogging.Logger` Logging object instance.""" self.logger = logger self.is_trained = False self.sup...
the_stack_v2_python_sparse
MMLL/models/POM2/SVM/SVM.py
Musketeer-H2020/MMLL-Robust
train
0
fa4721cc5fa36a2bcd723fd2cb3798967a496985
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Calendar()", "from .calendar_color import CalendarColor\nfrom .calendar_permission import CalendarPermission\nfrom .email_address import EmailAddress\nfrom .entity import Entity\nfrom .event import Event\nfrom .multi_value_legacy_exten...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Calendar() <|end_body_0|> <|body_start_1|> from .calendar_color import CalendarColor from .calendar_permission import CalendarPermission from .email_address import EmailAddress ...
Calendar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Calendar: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Calendar: """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: Calendar...
stack_v2_sparse_classes_36k_train_017656
10,062
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: Calendar", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(pars...
3
null
Implement the Python class `Calendar` described below. Class description: Implement the Calendar class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Calendar: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
Implement the Python class `Calendar` described below. Class description: Implement the Calendar class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Calendar: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Calendar: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Calendar: """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: Calendar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Calendar: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Calendar: """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: Calendar""" if...
the_stack_v2_python_sparse
msgraph/generated/models/calendar.py
microsoftgraph/msgraph-sdk-python
train
135
7f0b936f620be94e04564f0ad3abbe602dfae87b
[ "super(LuongAttention, self).__init__()\nself._hidden_size = hidden_size\nself._dense_memory = tf.keras.layers.Dense(self._hidden_size, use_bias=False, kernel_initializer='glorot_uniform')\nself._dense_attention = tf.keras.layers.Dense(self._hidden_size, use_bias=False, kernel_initializer='glorot_uniform')", "bat...
<|body_start_0|> super(LuongAttention, self).__init__() self._hidden_size = hidden_size self._dense_memory = tf.keras.layers.Dense(self._hidden_size, use_bias=False, kernel_initializer='glorot_uniform') self._dense_attention = tf.keras.layers.Dense(self._hidden_size, use_bias=False, kern...
Luong-style multiplicative attention mechanism.
LuongAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LuongAttention: """Luong-style multiplicative attention mechanism.""" def __init__(self, hidden_size): """Constructor. Args: hidden_size: int scalar, the hidden size of continuous representation.""" <|body_0|> def call(self, query, encoder_outputs, padding_mask): ...
stack_v2_sparse_classes_36k_train_017657
20,679
no_license
[ { "docstring": "Constructor. Args: hidden_size: int scalar, the hidden size of continuous representation.", "name": "__init__", "signature": "def __init__(self, hidden_size)" }, { "docstring": "Computes the outputs of Luong-style attention mechanism. Args: query: float tensor of shape [batch_siz...
2
stack_v2_sparse_classes_30k_train_020286
Implement the Python class `LuongAttention` described below. Class description: Luong-style multiplicative attention mechanism. Method signatures and docstrings: - def __init__(self, hidden_size): Constructor. Args: hidden_size: int scalar, the hidden size of continuous representation. - def call(self, query, encoder...
Implement the Python class `LuongAttention` described below. Class description: Luong-style multiplicative attention mechanism. Method signatures and docstrings: - def __init__(self, hidden_size): Constructor. Args: hidden_size: int scalar, the hidden size of continuous representation. - def call(self, query, encoder...
63cd17dd38234d47d5d992930d8136e2c30f5de7
<|skeleton|> class LuongAttention: """Luong-style multiplicative attention mechanism.""" def __init__(self, hidden_size): """Constructor. Args: hidden_size: int scalar, the hidden size of continuous representation.""" <|body_0|> def call(self, query, encoder_outputs, padding_mask): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LuongAttention: """Luong-style multiplicative attention mechanism.""" def __init__(self, hidden_size): """Constructor. Args: hidden_size: int scalar, the hidden size of continuous representation.""" super(LuongAttention, self).__init__() self._hidden_size = hidden_size sel...
the_stack_v2_python_sparse
model.py
chao-ji/tf-seq2seq
train
3
22d154c881092876501f6f849f1ef3f34d4871a8
[ "self.raw_text = raw_text\nself.keyness = pd.DataFrame(None)\ncv = CountVectorizer(max_features=max_features)\nself.wfm = cv.fit_transform(self.raw_text)\nself.vocab = np.array(cv.get_feature_names())\nself.rates = np.asarray(1000 * self.wfm / np.sum(self.wfm, axis=1))", "a_rates = np.asarray(self.rates[0])\nb_ra...
<|body_start_0|> self.raw_text = raw_text self.keyness = pd.DataFrame(None) cv = CountVectorizer(max_features=max_features) self.wfm = cv.fit_transform(self.raw_text) self.vocab = np.array(cv.get_feature_names()) self.rates = np.asarray(1000 * self.wfm / np.sum(self.wfm, ...
Parent class for finding the distinctive words between two corpuses of text
DistinctiveWords
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistinctiveWords: """Parent class for finding the distinctive words between two corpuses of text""" def __init__(self, raw_text, max_features=10000): """:param raw_text: A 2 element list with each corpus as a string occupying 1 element :param max_features: The maximum number of featu...
stack_v2_sparse_classes_36k_train_017658
8,319
permissive
[ { "docstring": ":param raw_text: A 2 element list with each corpus as a string occupying 1 element :param max_features: The maximum number of features to analyse", "name": "__init__", "signature": "def __init__(self, raw_text, max_features=10000)" }, { "docstring": "Returns a dataframe of the wo...
4
stack_v2_sparse_classes_30k_train_020432
Implement the Python class `DistinctiveWords` described below. Class description: Parent class for finding the distinctive words between two corpuses of text Method signatures and docstrings: - def __init__(self, raw_text, max_features=10000): :param raw_text: A 2 element list with each corpus as a string occupying 1...
Implement the Python class `DistinctiveWords` described below. Class description: Parent class for finding the distinctive words between two corpuses of text Method signatures and docstrings: - def __init__(self, raw_text, max_features=10000): :param raw_text: A 2 element list with each corpus as a string occupying 1...
b810c6e1a93a2ecaa9d6351449239d0a1833f971
<|skeleton|> class DistinctiveWords: """Parent class for finding the distinctive words between two corpuses of text""" def __init__(self, raw_text, max_features=10000): """:param raw_text: A 2 element list with each corpus as a string occupying 1 element :param max_features: The maximum number of featu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DistinctiveWords: """Parent class for finding the distinctive words between two corpuses of text""" def __init__(self, raw_text, max_features=10000): """:param raw_text: A 2 element list with each corpus as a string occupying 1 element :param max_features: The maximum number of features to analys...
the_stack_v2_python_sparse
usherwood_ds/nlp/distinctive_words.py
Usherwood/usherwood_ds
train
2
63e6cd5ca7a04228a1430aa16b9982f98bd82e5e
[ "self.__screen = screen\nself.__selectedDisks = selectedDisks\nself.__partitioner = partitioner\ndisks = ','.join([temp.name for temp in self.__selectedDisks])\npvs = self.__partitioner.getDelPvs()\nvgs = self.__partitioner.getDelVgs()\nself.__msg = TextboxReflowed(60, ARE_YOU_SURE_YOU_WANTO_TO.localize() % (disks,...
<|body_start_0|> self.__screen = screen self.__selectedDisks = selectedDisks self.__partitioner = partitioner disks = ','.join([temp.name for temp in self.__selectedDisks]) pvs = self.__partitioner.getDelPvs() vgs = self.__partitioner.getDelVgs() self.__msg = Text...
Confirm the last option
Confirmation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Confirmation: """Confirm the last option""" def __init__(self, screen, selectedDisks, partitioner): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def run(self): """Draws the screen @rtype: boolean @returns: sucess stat...
stack_v2_sparse_classes_36k_train_017659
1,508
no_license
[ { "docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance", "name": "__init__", "signature": "def __init__(self, screen, selectedDisks, partitioner)" }, { "docstring": "Draws the screen @rtype: boolean @returns: sucess status", "name": "run", "signature": ...
2
stack_v2_sparse_classes_30k_train_016159
Implement the Python class `Confirmation` described below. Class description: Confirm the last option Method signatures and docstrings: - def __init__(self, screen, selectedDisks, partitioner): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def run(self): Draws the screen @rtype: boolean ...
Implement the Python class `Confirmation` described below. Class description: Confirm the last option Method signatures and docstrings: - def __init__(self, screen, selectedDisks, partitioner): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def run(self): Draws the screen @rtype: boolean ...
1c738fd5e6ee3f8fd4f47acf2207038f20868212
<|skeleton|> class Confirmation: """Confirm the last option""" def __init__(self, screen, selectedDisks, partitioner): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def run(self): """Draws the screen @rtype: boolean @returns: sucess stat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Confirmation: """Confirm the last option""" def __init__(self, screen, selectedDisks, partitioner): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" self.__screen = screen self.__selectedDisks = selectedDisks self.__partitioner = partitioner ...
the_stack_v2_python_sparse
zfrobisher-installer/src/viewer/newt/confirmation.py
fedosu85nce/work
train
2
e75ead4ba0a43d26c83292025beaabcefea02dd7
[ "def helper(root):\n if root:\n result.append(str(root.val))\n helper(root.left)\n helper(root.right)\n else:\n result.append('#')\nresult = []\nhelper(root)\nreturn result", "def helper():\n c = next(arr)\n if c == '#':\n return None\n newNode = TreeNode(int(c))\...
<|body_start_0|> def helper(root): if root: result.append(str(root.val)) helper(root.left) helper(root.right) else: result.append('#') result = [] helper(root) return result <|end_body_0|> <|body_sta...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_017660
1,225
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_010925
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:...
6d361cad2821248350f1d8432fdfef86895ca281
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def helper(root): if root: result.append(str(root.val)) helper(root.left) helper(root.right) else: ...
the_stack_v2_python_sparse
Design/serializeBST.py
tr1503/LeetCode
train
0
902a508bb50e33743acd449ec72818141f49bfba
[ "s_len, p_len = (len(string), len(pattern))\ns_idx = p_idx = 0\nstar_idx = star_temp_idx = -1\nwhile s_idx < s_len:\n if p_idx < p_len and pattern[p_idx] in ['?', string[s_idx]]:\n s_idx += 1\n p_idx += 1\n elif p_idx < p_len and pattern[p_idx] == '*':\n star_idx = p_idx\n star_tem...
<|body_start_0|> s_len, p_len = (len(string), len(pattern)) s_idx = p_idx = 0 star_idx = star_temp_idx = -1 while s_idx < s_len: if p_idx < p_len and pattern[p_idx] in ['?', string[s_idx]]: s_idx += 1 p_idx += 1 elif p_idx < p_len a...
PatternMatcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatternMatcher: def is_match(self, string: str, pattern: str) -> bool: """Approach: Back tracking Time Complexity: O(N) Space Complexity: O(1) :param string: :param pattern: :return:""" <|body_0|> def is_match_(self, string: str, pattern: str) -> bool: """Approach: D...
stack_v2_sparse_classes_36k_train_017661
2,232
no_license
[ { "docstring": "Approach: Back tracking Time Complexity: O(N) Space Complexity: O(1) :param string: :param pattern: :return:", "name": "is_match", "signature": "def is_match(self, string: str, pattern: str) -> bool" }, { "docstring": "Approach: Dynamic Programming Time Complexity: O(SP) Space Co...
2
null
Implement the Python class `PatternMatcher` described below. Class description: Implement the PatternMatcher class. Method signatures and docstrings: - def is_match(self, string: str, pattern: str) -> bool: Approach: Back tracking Time Complexity: O(N) Space Complexity: O(1) :param string: :param pattern: :return: - ...
Implement the Python class `PatternMatcher` described below. Class description: Implement the PatternMatcher class. Method signatures and docstrings: - def is_match(self, string: str, pattern: str) -> bool: Approach: Back tracking Time Complexity: O(N) Space Complexity: O(1) :param string: :param pattern: :return: - ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class PatternMatcher: def is_match(self, string: str, pattern: str) -> bool: """Approach: Back tracking Time Complexity: O(N) Space Complexity: O(1) :param string: :param pattern: :return:""" <|body_0|> def is_match_(self, string: str, pattern: str) -> bool: """Approach: D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatternMatcher: def is_match(self, string: str, pattern: str) -> bool: """Approach: Back tracking Time Complexity: O(N) Space Complexity: O(1) :param string: :param pattern: :return:""" s_len, p_len = (len(string), len(pattern)) s_idx = p_idx = 0 star_idx = star_temp_idx = -1 ...
the_stack_v2_python_sparse
math_and_srings/wildcard_matching.py
Shiv2157k/leet_code
train
1
a9a573e919d561e51833e3167cab7b5ca9e4c5b1
[ "url = urlparse(file_or_url)\nif url.scheme:\n path = Path(url.path)\n self.url = file_or_url\n self.url_parsed = url\n self.path = None\n self.is_url = True\nelse:\n path = Path(file_or_url)\n self.url = None\n self.path = path\n self.is_url = False\nif self.is_url and cache_dir is not N...
<|body_start_0|> url = urlparse(file_or_url) if url.scheme: path = Path(url.path) self.url = file_or_url self.url_parsed = url self.path = None self.is_url = True else: path = Path(file_or_url) self.url = None ...
Loads data from an URL, optionally caching it.
CachedFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedFile: """Loads data from an URL, optionally caching it.""" def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): """Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file....
stack_v2_sparse_classes_36k_train_017662
14,435
no_license
[ { "docstring": "Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file. If absent, don’t cache.", "name": "__init__", "signature": "def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None)" }, { ...
2
stack_v2_sparse_classes_30k_train_007902
Implement the Python class `CachedFile` described below. Class description: Loads data from an URL, optionally caching it. Method signatures and docstrings: - def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load ca...
Implement the Python class `CachedFile` described below. Class description: Loads data from an URL, optionally caching it. Method signatures and docstrings: - def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load ca...
118403f233e2ddd1f91da78dc73b45f19aa6e232
<|skeleton|> class CachedFile: """Loads data from an URL, optionally caching it.""" def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): """Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CachedFile: """Loads data from an URL, optionally caching it.""" def __init__(self, file_or_url: str, cache_dir: Optional[Path]=None): """Creates a cacheing file loader. Args: file_or_url: the url or path to the file to load cache_dir: if present, a directory where to cache the file. If absent, d...
the_stack_v2_python_sparse
src/macrogen/config.py
faustedition/faust-macrogen
train
0
0ab3d46aa9155999d1bccc5fb25b5041d5be5896
[ "super().setUpClass(application_name=application_name)\ncls.application = application_name\ncls.services = ['mysqlrouter']\ncls.conf_file = '/var/lib/mysql/{}-mysql-router/mysqlrouter.conf'.format(application_name)", "set_default = {'ttl': '.5'}\nset_alternate = {'ttl': '7'}\nlogging.info('Setting TTL ...')\nself...
<|body_start_0|> super().setUpClass(application_name=application_name) cls.application = application_name cls.services = ['mysqlrouter'] cls.conf_file = '/var/lib/mysql/{}-mysql-router/mysqlrouter.conf'.format(application_name) <|end_body_0|> <|body_start_1|> set_default = {'ttl...
MySQL Router Tests.
MySQLRouterTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MySQLRouterTests: """MySQL Router Tests.""" def setUpClass(cls, application_name='keystone-mysql-router'): """Run class setup for running mysql-router tests.""" <|body_0|> def test_910_restart_on_config_change(self): """Checking restart happens on config change. ...
stack_v2_sparse_classes_36k_train_017663
45,009
permissive
[ { "docstring": "Run class setup for running mysql-router tests.", "name": "setUpClass", "signature": "def setUpClass(cls, application_name='keystone-mysql-router')" }, { "docstring": "Checking restart happens on config change. Change max connections and assert that change propagates to the corre...
2
null
Implement the Python class `MySQLRouterTests` described below. Class description: MySQL Router Tests. Method signatures and docstrings: - def setUpClass(cls, application_name='keystone-mysql-router'): Run class setup for running mysql-router tests. - def test_910_restart_on_config_change(self): Checking restart happe...
Implement the Python class `MySQLRouterTests` described below. Class description: MySQL Router Tests. Method signatures and docstrings: - def setUpClass(cls, application_name='keystone-mysql-router'): Run class setup for running mysql-router tests. - def test_910_restart_on_config_change(self): Checking restart happe...
3b17ad9d97c57b6e62797d4e3333e4b83e43a447
<|skeleton|> class MySQLRouterTests: """MySQL Router Tests.""" def setUpClass(cls, application_name='keystone-mysql-router'): """Run class setup for running mysql-router tests.""" <|body_0|> def test_910_restart_on_config_change(self): """Checking restart happens on config change. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MySQLRouterTests: """MySQL Router Tests.""" def setUpClass(cls, application_name='keystone-mysql-router'): """Run class setup for running mysql-router tests.""" super().setUpClass(application_name=application_name) cls.application = application_name cls.services = ['mysqlr...
the_stack_v2_python_sparse
zaza/openstack/charm_tests/mysql/tests.py
openstack-charmers/zaza-openstack-tests
train
7
622c20658f5afefc7a9176e2641575443538c387
[ "super().__init__(host, password)\nself._suffix = '/ # '\nself._aqara_property = True", "self.write(b'\\n')\nself.read_until(b'login: ', timeout=1)\npassword = self._password\nif self._password is None:\n password = '\\n'\ncommand = 'root'\nself.write(command.encode() + b'\\n')\nif password:\n self.read_unt...
<|body_start_0|> super().__init__(host, password) self._suffix = '/ # ' self._aqara_property = True <|end_body_0|> <|body_start_1|> self.write(b'\n') self.read_until(b'login: ', timeout=1) password = self._password if self._password is None: password ...
Telnet Shell
TelnetShellG3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelnetShellG3: """Telnet Shell""" def __init__(self, host: str, password=None): """init""" <|body_0|> def login(self): """login function""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(host, password) self._suffix = '/ #...
stack_v2_sparse_classes_36k_train_017664
4,540
no_license
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, host: str, password=None)" }, { "docstring": "login function", "name": "login", "signature": "def login(self)" } ]
2
stack_v2_sparse_classes_30k_train_017673
Implement the Python class `TelnetShellG3` described below. Class description: Telnet Shell Method signatures and docstrings: - def __init__(self, host: str, password=None): init - def login(self): login function
Implement the Python class `TelnetShellG3` described below. Class description: Telnet Shell Method signatures and docstrings: - def __init__(self, host: str, password=None): init - def login(self): login function <|skeleton|> class TelnetShellG3: """Telnet Shell""" def __init__(self, host: str, password=Non...
3988d204908478996fffa433faffa9ea20f42562
<|skeleton|> class TelnetShellG3: """Telnet Shell""" def __init__(self, host: str, password=None): """init""" <|body_0|> def login(self): """login function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TelnetShellG3: """Telnet Shell""" def __init__(self, host: str, password=None): """init""" super().__init__(host, password) self._suffix = '/ # ' self._aqara_property = True def login(self): """login function""" self.write(b'\n') self.read_unti...
the_stack_v2_python_sparse
certificates/custom_components/aqara_camera/core/shell.py
hellad/hass-config
train
3
619a5db0ba63b8cfe232c97cf010a50fa10f8cbe
[ "ht = hash_table.HashTable()\nht.put(1, 's')\nactual = ht.get(1)\nexpected = 's'\nself.assertEqual(actual, expected)", "ht = hash_table.HashTable()\nht.put(1, 's')\nactual = ht.get(10)\nexpected = None\nself.assertEqual(actual, expected)", "ht = hash_table.HashTable()\nactual = ht.get(1)\nexpected = None\nself....
<|body_start_0|> ht = hash_table.HashTable() ht.put(1, 's') actual = ht.get(1) expected = 's' self.assertEqual(actual, expected) <|end_body_0|> <|body_start_1|> ht = hash_table.HashTable() ht.put(1, 's') actual = ht.get(10) expected = None ...
Unit test class for basic hash table functionality. Tests get, put, and remove methods in a hash_table class.
TestHashTable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestHashTable: """Unit test class for basic hash table functionality. Tests get, put, and remove methods in a hash_table class.""" def test_hash_table_1(self): """Puts one k, v pait and checks to see that get returns v""" <|body_0|> def test_hash_table_2(self): "...
stack_v2_sparse_classes_36k_train_017665
2,047
no_license
[ { "docstring": "Puts one k, v pait and checks to see that get returns v", "name": "test_hash_table_1", "signature": "def test_hash_table_1(self)" }, { "docstring": "Puts then gets a different key.", "name": "test_hash_table_2", "signature": "def test_hash_table_2(self)" }, { "doc...
6
stack_v2_sparse_classes_30k_train_011014
Implement the Python class `TestHashTable` described below. Class description: Unit test class for basic hash table functionality. Tests get, put, and remove methods in a hash_table class. Method signatures and docstrings: - def test_hash_table_1(self): Puts one k, v pait and checks to see that get returns v - def te...
Implement the Python class `TestHashTable` described below. Class description: Unit test class for basic hash table functionality. Tests get, put, and remove methods in a hash_table class. Method signatures and docstrings: - def test_hash_table_1(self): Puts one k, v pait and checks to see that get returns v - def te...
955f26b27667a075f8d156e645527b162b87a0b0
<|skeleton|> class TestHashTable: """Unit test class for basic hash table functionality. Tests get, put, and remove methods in a hash_table class.""" def test_hash_table_1(self): """Puts one k, v pait and checks to see that get returns v""" <|body_0|> def test_hash_table_2(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestHashTable: """Unit test class for basic hash table functionality. Tests get, put, and remove methods in a hash_table class.""" def test_hash_table_1(self): """Puts one k, v pait and checks to see that get returns v""" ht = hash_table.HashTable() ht.put(1, 's') actual =...
the_stack_v2_python_sparse
test_hash_table.py
ctimaeus/practice
train
0
78d6cb5464c50b3c76d1bd0237c3e3b30d3d26f5
[ "if rules is None:\n settings = current.deployment_settings\n self.source = os.path.join(current.request.folder, 'modules', 'templates', 'RLP', settings.get_custom('poolrules'))\nelse:\n self.source = str(rules)\nself._rules = None", "if self._rules is None:\n try:\n tree = etree.parse(self.sou...
<|body_start_0|> if rules is None: settings = current.deployment_settings self.source = os.path.join(current.request.folder, 'modules', 'templates', 'RLP', settings.get_custom('poolrules')) else: self.source = str(rules) self._rules = None <|end_body_0|> <|bo...
Helper object to represent pool assignment rules
PoolRules
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PoolRules: """Helper object to represent pool assignment rules""" def __init__(self, rules=None): """Constructor Args: rules: the path to the rules file, using default path if omitted""" <|body_0|> def rules(self): """The root element of the pool assignment rules...
stack_v2_sparse_classes_36k_train_017666
6,109
permissive
[ { "docstring": "Constructor Args: rules: the path to the rules file, using default path if omitted", "name": "__init__", "signature": "def __init__(self, rules=None)" }, { "docstring": "The root element of the pool assignment rules - lazy-parses the rules XML file Returns: the root Element", ...
6
null
Implement the Python class `PoolRules` described below. Class description: Helper object to represent pool assignment rules Method signatures and docstrings: - def __init__(self, rules=None): Constructor Args: rules: the path to the rules file, using default path if omitted - def rules(self): The root element of the ...
Implement the Python class `PoolRules` described below. Class description: Helper object to represent pool assignment rules Method signatures and docstrings: - def __init__(self, rules=None): Constructor Args: rules: the path to the rules file, using default path if omitted - def rules(self): The root element of the ...
7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6
<|skeleton|> class PoolRules: """Helper object to represent pool assignment rules""" def __init__(self, rules=None): """Constructor Args: rules: the path to the rules file, using default path if omitted""" <|body_0|> def rules(self): """The root element of the pool assignment rules...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PoolRules: """Helper object to represent pool assignment rules""" def __init__(self, rules=None): """Constructor Args: rules: the path to the rules file, using default path if omitted""" if rules is None: settings = current.deployment_settings self.source = os.path...
the_stack_v2_python_sparse
modules/templates/RLP/poolrules.py
nursix/drkcm
train
3
8e73fe7b8dd0aceaaa4c0739085c488d2649a286
[ "new_car = Car(name=validated_data.get('name'), url=validated_data.get('url'), car_type=validated_data.get('car_type'))\nnew_car.save()\nreturn new_car", "instance.name = validated_data.get('name', instance.name)\ninstance.url = validated_data.get('url', instance.url)\ninstance.car_type = validated_data.get('car_...
<|body_start_0|> new_car = Car(name=validated_data.get('name'), url=validated_data.get('url'), car_type=validated_data.get('car_type')) new_car.save() return new_car <|end_body_0|> <|body_start_1|> instance.name = validated_data.get('name', instance.name) instance.url = validate...
CarSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CarSerializer: def create(self, validated_data): """create and return new 'Car' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Car` instance""" <|body_1|> <|end_skeleton|> <|body_start_0|> new_ca...
stack_v2_sparse_classes_36k_train_017667
6,342
no_license
[ { "docstring": "create and return new 'Car' instance", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "Update and return an existing `Car` instance", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
stack_v2_sparse_classes_30k_train_010640
Implement the Python class `CarSerializer` described below. Class description: Implement the CarSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Car' instance - def update(self, instance, validated_data): Update and return an existing `Car` instance
Implement the Python class `CarSerializer` described below. Class description: Implement the CarSerializer class. Method signatures and docstrings: - def create(self, validated_data): create and return new 'Car' instance - def update(self, instance, validated_data): Update and return an existing `Car` instance <|ske...
dba8d1fdb96889e41328e792816a4968cbeb1ed4
<|skeleton|> class CarSerializer: def create(self, validated_data): """create and return new 'Car' instance""" <|body_0|> def update(self, instance, validated_data): """Update and return an existing `Car` instance""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CarSerializer: def create(self, validated_data): """create and return new 'Car' instance""" new_car = Car(name=validated_data.get('name'), url=validated_data.get('url'), car_type=validated_data.get('car_type')) new_car.save() return new_car def update(self, instance, valid...
the_stack_v2_python_sparse
cars_web/cars_app/serializers.py
Ignisor/cars_scrapper
train
0
773807d27a30e542bed433a5aebb0f31ce7e9e22
[ "if game.num_players() != 2:\n raise ValueError('Game {} does not have {} players.'.format(game, 2))\nassert game.get_type().dynamics == pyspiel.GameType.Dynamics.SEQUENTIAL, \"CFR requires sequential games. If you're trying to run it \" + 'on a simultaneous (or normal-form) game, please first transform it ' + '...
<|body_start_0|> if game.num_players() != 2: raise ValueError('Game {} does not have {} players.'.format(game, 2)) assert game.get_type().dynamics == pyspiel.GameType.Dynamics.SEQUENTIAL, "CFR requires sequential games. If you're trying to run it " + 'on a simultaneous (or normal-form) game,...
Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI12-cfrbr.pdf). The algorithm computes an...
CFRBRSolver
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CFRBRSolver: """Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI1...
stack_v2_sparse_classes_36k_train_017668
5,293
permissive
[ { "docstring": "Initializer. Args: game: The `pyspiel.Game` to run on. linear_averaging: Whether to use linear averaging, i.e. cumulative_policy[info_state][action] += ( iteration_number * reach_prob * action_prob) or not: cumulative_policy[info_state][action] += reach_prob * action_prob regret_matching_plus: W...
3
stack_v2_sparse_classes_30k_train_008024
Implement the Python class `CFRBRSolver` described below. Class description: Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://...
Implement the Python class `CFRBRSolver` described below. Class description: Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://...
6f3551fd990053cf2287b380fb9ad0b2a2607c18
<|skeleton|> class CFRBRSolver: """Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CFRBRSolver: """Implements the Counterfactual Regret Minimization (CFR-BR) algorithm. This is Counterfactual Regret Minimization against Best Response, from Michael Johanson and al., 2012, Finding Optimal Abstract Strategies in Extensive-Form Games, https://poker.cs.ualberta.ca/publications/AAAI12-cfrbr.pdf)....
the_stack_v2_python_sparse
open_spiel/python/algorithms/cfr_br.py
sarahperrin/open_spiel
train
3
f67ca6bb1bdc7852837abf341caa7b029eb7a35f
[ "if nums == []:\n return 0\n'This problems needs to considers the following dynamical programming approach\\n to solve. Otherwise still exceed time limit.\\n ref: http://bookshadow.com/weblog/2017/01/22/leetcode-target-sum/\\n This turns to time complexity O(n*l) \\n '\ndp = ...
<|body_start_0|> if nums == []: return 0 'This problems needs to considers the following dynamical programming approach\n to solve. Otherwise still exceed time limit.\n ref: http://bookshadow.com/weblog/2017/01/22/leetcode-target-sum/\n This turns to time comple...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findTargetSumWays(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_0|> def DFS(self, depth, nums, sum, S): """this method regards the problem as a binary tree, "+" like left and "-" like right. The time complexity is O(2**n). ...
stack_v2_sparse_classes_36k_train_017669
2,891
no_license
[ { "docstring": ":type nums: List[int] :type S: int :rtype: int", "name": "findTargetSumWays", "signature": "def findTargetSumWays(self, nums, S)" }, { "docstring": "this method regards the problem as a binary tree, \"+\" like left and \"-\" like right. The time complexity is O(2**n). But this me...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums, S): :type nums: List[int] :type S: int :rtype: int - def DFS(self, depth, nums, sum, S): this method regards the problem as a binary tree, "+" l...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findTargetSumWays(self, nums, S): :type nums: List[int] :type S: int :rtype: int - def DFS(self, depth, nums, sum, S): this method regards the problem as a binary tree, "+" l...
54d777e11b91c5debe49c1aef723234c66a5d2cc
<|skeleton|> class Solution: def findTargetSumWays(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" <|body_0|> def DFS(self, depth, nums, sum, S): """this method regards the problem as a binary tree, "+" like left and "-" like right. The time complexity is O(2**n). ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findTargetSumWays(self, nums, S): """:type nums: List[int] :type S: int :rtype: int""" if nums == []: return 0 'This problems needs to considers the following dynamical programming approach\n to solve. Otherwise still exceed time limit.\n r...
the_stack_v2_python_sparse
leetcode_solution/dynamical programming/#494.Target_Sum.py
HsiangHung/Code-Challenges
train
0
9a5dbc727fc9964b0caf645d871ee4f4fb224824
[ "self.module_name = module_name\nself.mail_templates = mail_templates\nsuper(Logic, self).__init__(model=model, base_model=base_model, scope_logic=scope_logic)", "current_status = record.status\nif current_status == 'pre-accepted':\n new_status = 'accepted'\nelif current_status == 'pre-rejected':\n new_stat...
<|body_start_0|> self.module_name = module_name self.mail_templates = mail_templates super(Logic, self).__init__(model=model, base_model=base_model, scope_logic=scope_logic) <|end_body_0|> <|body_start_1|> current_status = record.status if current_status == 'pre-accepted': ...
Logic class for OrgAppRecord.
Logic
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logic: """Logic class for OrgAppRecord.""" def __init__(self, model=org_app_model, base_model=SurveyRecord, scope_logic=None, module_name=None, mail_templates=None): """Defines the name, key_name and model for this entity.""" <|body_0|> def processRecord(self, record): ...
stack_v2_sparse_classes_36k_train_017670
2,779
permissive
[ { "docstring": "Defines the name, key_name and model for this entity.", "name": "__init__", "signature": "def __init__(self, model=org_app_model, base_model=SurveyRecord, scope_logic=None, module_name=None, mail_templates=None)" }, { "docstring": "Processes an OrgAppRecord that is in the pre-acc...
3
stack_v2_sparse_classes_30k_train_021025
Implement the Python class `Logic` described below. Class description: Logic class for OrgAppRecord. Method signatures and docstrings: - def __init__(self, model=org_app_model, base_model=SurveyRecord, scope_logic=None, module_name=None, mail_templates=None): Defines the name, key_name and model for this entity. - de...
Implement the Python class `Logic` described below. Class description: Logic class for OrgAppRecord. Method signatures and docstrings: - def __init__(self, model=org_app_model, base_model=SurveyRecord, scope_logic=None, module_name=None, mail_templates=None): Defines the name, key_name and model for this entity. - de...
9bd45c168f8ddb5c0e6c04eacdcaeafd61908be7
<|skeleton|> class Logic: """Logic class for OrgAppRecord.""" def __init__(self, model=org_app_model, base_model=SurveyRecord, scope_logic=None, module_name=None, mail_templates=None): """Defines the name, key_name and model for this entity.""" <|body_0|> def processRecord(self, record): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logic: """Logic class for OrgAppRecord.""" def __init__(self, model=org_app_model, base_model=SurveyRecord, scope_logic=None, module_name=None, mail_templates=None): """Defines the name, key_name and model for this entity.""" self.module_name = module_name self.mail_templates = ma...
the_stack_v2_python_sparse
app/soc/logic/models/org_app_record.py
pombredanne/Melange-1
train
0
755255c69d0b3ad69661f23f52c4a13708d5ef82
[ "self.dim = dim\nif length_str.endswith('%'):\n self.relunits = True\n self.rellength = 0.01 * float(length_str[:-1])\n self.length = None\nelif length_str.endswith('px'):\n self.relunits = False\n self.rellength = None\n self.length = int(length_str[:-2])\nelse:\n raise TypeError(\"Expected '<...
<|body_start_0|> self.dim = dim if length_str.endswith('%'): self.relunits = True self.rellength = 0.01 * float(length_str[:-1]) self.length = None elif length_str.endswith('px'): self.relunits = False self.rellength = None ...
Represents a length along a specified dimension of an image as a relative percentage or an absolute pixel count.
Length
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Length: """Represents a length along a specified dimension of an image as a relative percentage or an absolute pixel count.""" def __init__(self, length_str, dim): """Builds a Length object. Args: length_str: a string of the form '<float>%' or '<int>px' describing a relative or absol...
stack_v2_sparse_classes_36k_train_017671
21,423
permissive
[ { "docstring": "Builds a Length object. Args: length_str: a string of the form '<float>%' or '<int>px' describing a relative or absolute length, respectively dim: the dimension to measure length along", "name": "__init__", "signature": "def __init__(self, length_str, dim)" }, { "docstring": "Ret...
2
stack_v2_sparse_classes_30k_train_012449
Implement the Python class `Length` described below. Class description: Represents a length along a specified dimension of an image as a relative percentage or an absolute pixel count. Method signatures and docstrings: - def __init__(self, length_str, dim): Builds a Length object. Args: length_str: a string of the fo...
Implement the Python class `Length` described below. Class description: Represents a length along a specified dimension of an image as a relative percentage or an absolute pixel count. Method signatures and docstrings: - def __init__(self, length_str, dim): Builds a Length object. Args: length_str: a string of the fo...
f2bab5c5c767584dd33bc9a689370db532ba899a
<|skeleton|> class Length: """Represents a length along a specified dimension of an image as a relative percentage or an absolute pixel count.""" def __init__(self, length_str, dim): """Builds a Length object. Args: length_str: a string of the form '<float>%' or '<int>px' describing a relative or absol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Length: """Represents a length along a specified dimension of an image as a relative percentage or an absolute pixel count.""" def __init__(self, length_str, dim): """Builds a Length object. Args: length_str: a string of the form '<float>%' or '<int>px' describing a relative or absolute length, r...
the_stack_v2_python_sparse
eta/eta/core/image.py
grohup/eecs504
train
0
52f55ee2fbace2001aa5d70c5c4b027a191aa9f5
[ "self.surface_id = self._none_if_emtpy_otherwise_value(surface_id)\nself.channel_id = self._none_if_emtpy_otherwise_value(channel_id)\nself.text = self._none_if_emtpy_otherwise_value(text)", "if string is None:\n return None\nelif isinstance(string, str):\n return None if not (string and string.strip()) els...
<|body_start_0|> self.surface_id = self._none_if_emtpy_otherwise_value(surface_id) self.channel_id = self._none_if_emtpy_otherwise_value(channel_id) self.text = self._none_if_emtpy_otherwise_value(text) <|end_body_0|> <|body_start_1|> if string is None: return None e...
Represents a message that can be sent through an interaction surface
SurfaceMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurfaceMessage: """Represents a message that can be sent through an interaction surface""" def __init__(self, surface_id: Optional[str], channel_id: Optional[str], text: Optional[str]) -> None: """Creates a new message :param surface_id: the surface name originating the message :type...
stack_v2_sparse_classes_36k_train_017672
1,894
permissive
[ { "docstring": "Creates a new message :param surface_id: the surface name originating the message :type surface_id: str :param channel_id: the channel_id where to send the message, if any :type channel_id: str :param text: the text to send :type text: str", "name": "__init__", "signature": "def __init__...
2
stack_v2_sparse_classes_30k_train_003148
Implement the Python class `SurfaceMessage` described below. Class description: Represents a message that can be sent through an interaction surface Method signatures and docstrings: - def __init__(self, surface_id: Optional[str], channel_id: Optional[str], text: Optional[str]) -> None: Creates a new message :param s...
Implement the Python class `SurfaceMessage` described below. Class description: Represents a message that can be sent through an interaction surface Method signatures and docstrings: - def __init__(self, surface_id: Optional[str], channel_id: Optional[str], text: Optional[str]) -> None: Creates a new message :param s...
1dac7d312fce78127cac45f17da526c6a66be36a
<|skeleton|> class SurfaceMessage: """Represents a message that can be sent through an interaction surface""" def __init__(self, surface_id: Optional[str], channel_id: Optional[str], text: Optional[str]) -> None: """Creates a new message :param surface_id: the surface name originating the message :type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurfaceMessage: """Represents a message that can be sent through an interaction surface""" def __init__(self, surface_id: Optional[str], channel_id: Optional[str], text: Optional[str]) -> None: """Creates a new message :param surface_id: the surface name originating the message :type surface_id: ...
the_stack_v2_python_sparse
bot/src/yellowbot/surfaces/surfacemessage.py
rainbowbreeze/yellowbutler
train
0
fbcbbd9b115f242b7c156c4a03939329de36dc2e
[ "super(MultiDiceLoss, self).__init__()\nself.num_class = num_class\nassert len(weights) == self.num_class, 'the length of weight must equal to num_class'\nself.weights = torch.FloatTensor(weights)\nself.weights = self.weights / self.weights.sum()\nself.weights = self.weights.cuda()", "dice_losses = []\nweight_dic...
<|body_start_0|> super(MultiDiceLoss, self).__init__() self.num_class = num_class assert len(weights) == self.num_class, 'the length of weight must equal to num_class' self.weights = torch.FloatTensor(weights) self.weights = self.weights / self.weights.sum() self.weights ...
Dice Loss for egmentation(include binary segmentation and multi label segmentation) This class is generalization of BinaryDiceLoss
MultiDiceLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiDiceLoss: """Dice Loss for egmentation(include binary segmentation and multi label segmentation) This class is generalization of BinaryDiceLoss""" def __init__(self, weights, num_class): """:param weights: weight for each class dice loss :param num_class: the number of class""" ...
stack_v2_sparse_classes_36k_train_017673
3,068
no_license
[ { "docstring": ":param weights: weight for each class dice loss :param num_class: the number of class", "name": "__init__", "signature": "def __init__(self, weights, num_class)" }, { "docstring": ":param input_tensor: network output tensor :param target: ground truth :return: weighted dice loss ...
2
stack_v2_sparse_classes_30k_train_021661
Implement the Python class `MultiDiceLoss` described below. Class description: Dice Loss for egmentation(include binary segmentation and multi label segmentation) This class is generalization of BinaryDiceLoss Method signatures and docstrings: - def __init__(self, weights, num_class): :param weights: weight for each ...
Implement the Python class `MultiDiceLoss` described below. Class description: Dice Loss for egmentation(include binary segmentation and multi label segmentation) This class is generalization of BinaryDiceLoss Method signatures and docstrings: - def __init__(self, weights, num_class): :param weights: weight for each ...
23e3b76db48dd14ef4da6f51c253e9ea583a3e17
<|skeleton|> class MultiDiceLoss: """Dice Loss for egmentation(include binary segmentation and multi label segmentation) This class is generalization of BinaryDiceLoss""" def __init__(self, weights, num_class): """:param weights: weight for each class dice loss :param num_class: the number of class""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiDiceLoss: """Dice Loss for egmentation(include binary segmentation and multi label segmentation) This class is generalization of BinaryDiceLoss""" def __init__(self, weights, num_class): """:param weights: weight for each class dice loss :param num_class: the number of class""" super...
the_stack_v2_python_sparse
loss/MultiDiceLoss.py
simonsf/RTP-Net
train
31
b2fbdc572174b4974b0cc4bfee1c8f6203e9fe5d
[ "IPAddress.__init__(self)\nif not self.IsValid(address):\n raise errors.IPAddressError('IPv4 Address %s invalid' % address)\nself.address = address", "address_int = 0\nparts = address.split('.')\nassert len(parts) == 4\nfor part in parts:\n address_int = address_int << 8 | int(part)\nreturn address_int" ]
<|body_start_0|> IPAddress.__init__(self) if not self.IsValid(address): raise errors.IPAddressError('IPv4 Address %s invalid' % address) self.address = address <|end_body_0|> <|body_start_1|> address_int = 0 parts = address.split('.') assert len(parts) == 4 ...
IPv4 address class.
IP4Address
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IP4Address: """IPv4 address class.""" def __init__(self, address): """Constructor for IPv4 address. @type address: str @param address: IP address @raises errors.IPAddressError: if address invalid""" <|body_0|> def _GetIPIntFromString(address): """Get integer valu...
stack_v2_sparse_classes_36k_train_017674
20,645
permissive
[ { "docstring": "Constructor for IPv4 address. @type address: str @param address: IP address @raises errors.IPAddressError: if address invalid", "name": "__init__", "signature": "def __init__(self, address)" }, { "docstring": "Get integer value of IPv4 address. @type address: str @param address: ...
2
null
Implement the Python class `IP4Address` described below. Class description: IPv4 address class. Method signatures and docstrings: - def __init__(self, address): Constructor for IPv4 address. @type address: str @param address: IP address @raises errors.IPAddressError: if address invalid - def _GetIPIntFromString(addre...
Implement the Python class `IP4Address` described below. Class description: IPv4 address class. Method signatures and docstrings: - def __init__(self, address): Constructor for IPv4 address. @type address: str @param address: IP address @raises errors.IPAddressError: if address invalid - def _GetIPIntFromString(addre...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class IP4Address: """IPv4 address class.""" def __init__(self, address): """Constructor for IPv4 address. @type address: str @param address: IP address @raises errors.IPAddressError: if address invalid""" <|body_0|> def _GetIPIntFromString(address): """Get integer valu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IP4Address: """IPv4 address class.""" def __init__(self, address): """Constructor for IPv4 address. @type address: str @param address: IP address @raises errors.IPAddressError: if address invalid""" IPAddress.__init__(self) if not self.IsValid(address): raise errors.IP...
the_stack_v2_python_sparse
lib/netutils.py
ganeti/ganeti
train
465
80c2eaddcd0ec49f6763834b695024faf6c9aa13
[ "self.create_review_group(name='devgroup')\nself.create_review_group(name='emptygroup')\nself.create_review_group(name='newgroup')\nself.create_review_group(name='privgroup')\nresponse = self.client.get('/groups/')\nself.assertEqual(response.status_code, 200)\ndatagrid = self._get_context_var(response, 'datagrid')\...
<|body_start_0|> self.create_review_group(name='devgroup') self.create_review_group(name='emptygroup') self.create_review_group(name='newgroup') self.create_review_group(name='privgroup') response = self.client.get('/groups/') self.assertEqual(response.status_code, 200) ...
Unit tests for the group_list view.
GroupListViewTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupListViewTests: """Unit tests for the group_list view.""" def test_with_access(self): """Testing group_list view""" <|body_0|> def test_as_anonymous_and_redirect(self): """Testing group_list view with site-wide login enabled""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_017675
49,494
permissive
[ { "docstring": "Testing group_list view", "name": "test_with_access", "signature": "def test_with_access(self)" }, { "docstring": "Testing group_list view with site-wide login enabled", "name": "test_as_anonymous_and_redirect", "signature": "def test_as_anonymous_and_redirect(self)" } ...
2
null
Implement the Python class `GroupListViewTests` described below. Class description: Unit tests for the group_list view. Method signatures and docstrings: - def test_with_access(self): Testing group_list view - def test_as_anonymous_and_redirect(self): Testing group_list view with site-wide login enabled
Implement the Python class `GroupListViewTests` described below. Class description: Unit tests for the group_list view. Method signatures and docstrings: - def test_with_access(self): Testing group_list view - def test_as_anonymous_and_redirect(self): Testing group_list view with site-wide login enabled <|skeleton|>...
563c1e8d4dfd860f372281dc0f380a0809f6ae15
<|skeleton|> class GroupListViewTests: """Unit tests for the group_list view.""" def test_with_access(self): """Testing group_list view""" <|body_0|> def test_as_anonymous_and_redirect(self): """Testing group_list view with site-wide login enabled""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupListViewTests: """Unit tests for the group_list view.""" def test_with_access(self): """Testing group_list view""" self.create_review_group(name='devgroup') self.create_review_group(name='emptygroup') self.create_review_group(name='newgroup') self.create_revie...
the_stack_v2_python_sparse
reviewboard/datagrids/tests.py
LloydFinch/reviewboard
train
2
0b85ce45981cc201a1ac040b1d665b07c600d32d
[ "self.end_game = False\nself.username = username\nself.screen = screen\nself.is_left = is_left\nself.solo = solo\nself.screenWidth, self.screenHeight = pygame.display.get_surface().get_size()\nself.game_window_width = self.screenWidth if self.solo else self.screenWidth / 2\nself.game_window_height = self.screenHeig...
<|body_start_0|> self.end_game = False self.username = username self.screen = screen self.is_left = is_left self.solo = solo self.screenWidth, self.screenHeight = pygame.display.get_surface().get_size() self.game_window_width = self.screenWidth if self.solo else s...
PlayGame class used for solo and duo mode. One user plays in one PlayGame object
PlayGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlayGame: """PlayGame class used for solo and duo mode. One user plays in one PlayGame object""" def __init__(self, screen: pygame.Surface, username: str=None, solo: bool=True, is_left: bool=True): """Initialize the player's game. :param screen: surface to display game :param usernam...
stack_v2_sparse_classes_36k_train_017676
5,033
no_license
[ { "docstring": "Initialize the player's game. :param screen: surface to display game :param username: player's username :param solo: True if single player False if multi players :param is_left: True if solo and if multi player and player 1", "name": "__init__", "signature": "def __init__(self, screen: p...
5
stack_v2_sparse_classes_30k_train_008910
Implement the Python class `PlayGame` described below. Class description: PlayGame class used for solo and duo mode. One user plays in one PlayGame object Method signatures and docstrings: - def __init__(self, screen: pygame.Surface, username: str=None, solo: bool=True, is_left: bool=True): Initialize the player's ga...
Implement the Python class `PlayGame` described below. Class description: PlayGame class used for solo and duo mode. One user plays in one PlayGame object Method signatures and docstrings: - def __init__(self, screen: pygame.Surface, username: str=None, solo: bool=True, is_left: bool=True): Initialize the player's ga...
40042d99f847f37d142e305d4cd8563bf9639356
<|skeleton|> class PlayGame: """PlayGame class used for solo and duo mode. One user plays in one PlayGame object""" def __init__(self, screen: pygame.Surface, username: str=None, solo: bool=True, is_left: bool=True): """Initialize the player's game. :param screen: surface to display game :param usernam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PlayGame: """PlayGame class used for solo and duo mode. One user plays in one PlayGame object""" def __init__(self, screen: pygame.Surface, username: str=None, solo: bool=True, is_left: bool=True): """Initialize the player's game. :param screen: surface to display game :param username: player's u...
the_stack_v2_python_sparse
src/playgame.py
bastiendlf/FlapUFO_IA
train
0
aa9d56bc710b5079229c14ed8db5ca34a28e85b1
[ "node = TreeNode(5)\nleftNode = TreeNode(4)\nrightNode = TreeNode(5)\nnode.left = leftNode\nnode.right = rightNode\nthirdLevelLeftNode1 = TreeNode(1)\nthirdLevelLeftNode2 = TreeNode(1)\nthirdLevelRightNode1 = TreeNode(5)\nleftNode.left = thirdLevelLeftNode1\nleftNode.right = thirdLevelLeftNode2\nrightNode.right = t...
<|body_start_0|> node = TreeNode(5) leftNode = TreeNode(4) rightNode = TreeNode(5) node.left = leftNode node.right = rightNode thirdLevelLeftNode1 = TreeNode(1) thirdLevelLeftNode2 = TreeNode(1) thirdLevelRightNode1 = TreeNode(5) leftNode.left = th...
TestSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSolution: def test_LongestUnivalueCase1(self): """5 / 4 5 / \\ / 1 1 5""" <|body_0|> def test_LongestUnivalueCase2(self): """1 / 4 5 / \\ / 4 4 5""" <|body_1|> def test_LongestUnivalueCase3(self): """5 / 5 5 / \\ / 5 4 5""" <|body_2|>...
stack_v2_sparse_classes_36k_train_017677
2,303
no_license
[ { "docstring": "5 / 4 5 / \\\\ / 1 1 5", "name": "test_LongestUnivalueCase1", "signature": "def test_LongestUnivalueCase1(self)" }, { "docstring": "1 / 4 5 / \\\\ / 4 4 5", "name": "test_LongestUnivalueCase2", "signature": "def test_LongestUnivalueCase2(self)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_008230
Implement the Python class `TestSolution` described below. Class description: Implement the TestSolution class. Method signatures and docstrings: - def test_LongestUnivalueCase1(self): 5 / 4 5 / \\ / 1 1 5 - def test_LongestUnivalueCase2(self): 1 / 4 5 / \\ / 4 4 5 - def test_LongestUnivalueCase3(self): 5 / 5 5 / \\ ...
Implement the Python class `TestSolution` described below. Class description: Implement the TestSolution class. Method signatures and docstrings: - def test_LongestUnivalueCase1(self): 5 / 4 5 / \\ / 1 1 5 - def test_LongestUnivalueCase2(self): 1 / 4 5 / \\ / 4 4 5 - def test_LongestUnivalueCase3(self): 5 / 5 5 / \\ ...
7fa160362ebb58e7286b490012542baa2d51e5c9
<|skeleton|> class TestSolution: def test_LongestUnivalueCase1(self): """5 / 4 5 / \\ / 1 1 5""" <|body_0|> def test_LongestUnivalueCase2(self): """1 / 4 5 / \\ / 4 4 5""" <|body_1|> def test_LongestUnivalueCase3(self): """5 / 5 5 / \\ / 5 4 5""" <|body_2|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSolution: def test_LongestUnivalueCase1(self): """5 / 4 5 / \\ / 1 1 5""" node = TreeNode(5) leftNode = TreeNode(4) rightNode = TreeNode(5) node.left = leftNode node.right = rightNode thirdLevelLeftNode1 = TreeNode(1) thirdLevelLeftNode2 = Tr...
the_stack_v2_python_sparse
tree/test_longestUnivaluePath.py
gerrycfchang/leetcode-python
train
2
4d2b16d984f666c8f889f4220e454810707c341b
[ "super().__init__()\nself.margin = margin\nself.reduction = reduction or 'none'", "device = embeddings_pred.device\npairwise_similarity = torch.einsum('se,ae->sa', embeddings_pred, embeddings_true)\nbs = embeddings_pred.shape[0]\nbatch_idx = torch.arange(bs, device=device)\nnegative_similarity = pairwise_similari...
<|body_start_0|> super().__init__() self.margin = margin self.reduction = reduction or 'none' <|end_body_0|> <|body_start_1|> device = embeddings_pred.device pairwise_similarity = torch.einsum('se,ae->sa', embeddings_pred, embeddings_true) bs = embeddings_pred.shape[0] ...
TripletPairwiseEmbeddingLoss – proof of concept criterion. Still work in progress. @TODO: Docs. Contribution is welcome.
TripletPairwiseEmbeddingLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TripletPairwiseEmbeddingLoss: """TripletPairwiseEmbeddingLoss – proof of concept criterion. Still work in progress. @TODO: Docs. Contribution is welcome.""" def __init__(self, margin: float=0.3, reduction: str='mean'): """Args: margin: margin parameter reduction: criterion reduction ...
stack_v2_sparse_classes_36k_train_017678
10,393
permissive
[ { "docstring": "Args: margin: margin parameter reduction: criterion reduction type", "name": "__init__", "signature": "def __init__(self, margin: float=0.3, reduction: str='mean')" }, { "docstring": "Work in progress. Args: embeddings_pred: predicted embeddings with shape [batch_size, embedding_...
2
null
Implement the Python class `TripletPairwiseEmbeddingLoss` described below. Class description: TripletPairwiseEmbeddingLoss – proof of concept criterion. Still work in progress. @TODO: Docs. Contribution is welcome. Method signatures and docstrings: - def __init__(self, margin: float=0.3, reduction: str='mean'): Args:...
Implement the Python class `TripletPairwiseEmbeddingLoss` described below. Class description: TripletPairwiseEmbeddingLoss – proof of concept criterion. Still work in progress. @TODO: Docs. Contribution is welcome. Method signatures and docstrings: - def __init__(self, margin: float=0.3, reduction: str='mean'): Args:...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class TripletPairwiseEmbeddingLoss: """TripletPairwiseEmbeddingLoss – proof of concept criterion. Still work in progress. @TODO: Docs. Contribution is welcome.""" def __init__(self, margin: float=0.3, reduction: str='mean'): """Args: margin: margin parameter reduction: criterion reduction ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TripletPairwiseEmbeddingLoss: """TripletPairwiseEmbeddingLoss – proof of concept criterion. Still work in progress. @TODO: Docs. Contribution is welcome.""" def __init__(self, margin: float=0.3, reduction: str='mean'): """Args: margin: margin parameter reduction: criterion reduction type""" ...
the_stack_v2_python_sparse
catalyst/contrib/losses/triplet.py
catalyst-team/catalyst
train
3,038
138fc0c8c81448148c05c338b856b8dc1a3bd749
[ "assert 'service_key' in event_info\nassert isinstance(event_info['service_key'], basestring)\nassert 'event_type' in event_info\nassert event_info['event_type'] in cls.EVENT_TYPES\nif event_info['event_type'] != cls.EVENT_TYPES[0]:\n assert 'incident_key' in event_info\n assert isinstance(event_info['inciden...
<|body_start_0|> assert 'service_key' in event_info assert isinstance(event_info['service_key'], basestring) assert 'event_type' in event_info assert event_info['event_type'] in cls.EVENT_TYPES if event_info['event_type'] != cls.EVENT_TYPES[0]: assert 'incident_key' i...
Event
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Event: def validate(cls, event_info): """Validate that provided event information is valid.""" <|body_0|> def create(cls, data=None, api_key=None, endpoint=None, add_headers=None, **kwargs): """Create an event on your PagerDuty account.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k_train_017679
1,812
permissive
[ { "docstring": "Validate that provided event information is valid.", "name": "validate", "signature": "def validate(cls, event_info)" }, { "docstring": "Create an event on your PagerDuty account.", "name": "create", "signature": "def create(cls, data=None, api_key=None, endpoint=None, ad...
2
stack_v2_sparse_classes_30k_train_018755
Implement the Python class `Event` described below. Class description: Implement the Event class. Method signatures and docstrings: - def validate(cls, event_info): Validate that provided event information is valid. - def create(cls, data=None, api_key=None, endpoint=None, add_headers=None, **kwargs): Create an event...
Implement the Python class `Event` described below. Class description: Implement the Event class. Method signatures and docstrings: - def validate(cls, event_info): Validate that provided event information is valid. - def create(cls, data=None, api_key=None, endpoint=None, add_headers=None, **kwargs): Create an event...
5e5abbfb59f5b99fa90c79907fa1eb023aa08e9c
<|skeleton|> class Event: def validate(cls, event_info): """Validate that provided event information is valid.""" <|body_0|> def create(cls, data=None, api_key=None, endpoint=None, add_headers=None, **kwargs): """Create an event on your PagerDuty account.""" <|body_1|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Event: def validate(cls, event_info): """Validate that provided event information is valid.""" assert 'service_key' in event_info assert isinstance(event_info['service_key'], basestring) assert 'event_type' in event_info assert event_info['event_type'] in cls.EVENT_TYPE...
the_stack_v2_python_sparse
pypd/models/event.py
ryplo/helpme
train
2
e5642d9095ad361adb4cd0215cd2291610b34fac
[ "self.A = A\nself.B = B\nself.R = R\nself.C = C\nself.Q = Q", "mu_exp = np.dot(self.A, mu_prev) + np.dot(self.B, control)\ncov_exp = np.dot(np.dot(self.A, cov_prev), self.A.T) + self.R\ntemp = np.linalg.inv(np.dot(np.dot(self.C, cov_exp), self.C.T) + self.Q)\nK = np.dot(np.dot(cov_exp, self.C.T), temp)\nmu = mu_e...
<|body_start_0|> self.A = A self.B = B self.R = R self.C = C self.Q = Q <|end_body_0|> <|body_start_1|> mu_exp = np.dot(self.A, mu_prev) + np.dot(self.B, control) cov_exp = np.dot(np.dot(self.A, cov_prev), self.A.T) + self.R temp = np.linalg.inv(np.dot(np...
A class that contains the mathmatics for a kalman filter. The state transistions, measurment predictions and parameter covariances need to be set, then predictions can be made about the state of data.
Kalman_Filter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kalman_Filter: """A class that contains the mathmatics for a kalman filter. The state transistions, measurment predictions and parameter covariances need to be set, then predictions can be made about the state of data.""" def __init__(self, A, B, R, C, Q): """Initialize the parameter...
stack_v2_sparse_classes_36k_train_017680
1,737
permissive
[ { "docstring": "Initialize the parameter matrices for state transistions, measurement predictions, and parameter covariances. Parameters: A:", "name": "__init__", "signature": "def __init__(self, A, B, R, C, Q)" }, { "docstring": "Perform the Kalman Filter provided the previous state estimation,...
2
stack_v2_sparse_classes_30k_train_003554
Implement the Python class `Kalman_Filter` described below. Class description: A class that contains the mathmatics for a kalman filter. The state transistions, measurment predictions and parameter covariances need to be set, then predictions can be made about the state of data. Method signatures and docstrings: - de...
Implement the Python class `Kalman_Filter` described below. Class description: A class that contains the mathmatics for a kalman filter. The state transistions, measurment predictions and parameter covariances need to be set, then predictions can be made about the state of data. Method signatures and docstrings: - de...
26b476e1c8743f422c5affea744234e6322d4f59
<|skeleton|> class Kalman_Filter: """A class that contains the mathmatics for a kalman filter. The state transistions, measurment predictions and parameter covariances need to be set, then predictions can be made about the state of data.""" def __init__(self, A, B, R, C, Q): """Initialize the parameter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kalman_Filter: """A class that contains the mathmatics for a kalman filter. The state transistions, measurment predictions and parameter covariances need to be set, then predictions can be made about the state of data.""" def __init__(self, A, B, R, C, Q): """Initialize the parameter matrices for...
the_stack_v2_python_sparse
Sub/Src/Helpers/Kalman_Filter.py
senseishafi/mechatronics-2019
train
0
0db3134f21783599aca7066349ac9eae5728671a
[ "self.table = dj_model\nself.fields = None\nself.values = []\nself.count = 0", "if not self.fields:\n self.fields = kwargs.keys()\nassert set(self.fields) == set(kwargs.keys())\nfor k in self.fields:\n self.values.append(kwargs[k])\nself.count += 1", "if not self.values:\n return\nalias = router.db_for...
<|body_start_0|> self.table = dj_model self.fields = None self.values = [] self.count = 0 <|end_body_0|> <|body_start_1|> if not self.fields: self.fields = kwargs.keys() assert set(self.fields) == set(kwargs.keys()) for k in self.fields: s...
Handle bulk object insertion
BulkInserter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BulkInserter: """Handle bulk object insertion""" def __init__(self, dj_model): """Create a new bulk inserter for a Django model class :param dj_model: Django model :type dj_model: :class:`django.db.models.Model`""" <|body_0|> def add_entry(self, **kwargs): """Add...
stack_v2_sparse_classes_36k_train_017681
8,535
no_license
[ { "docstring": "Create a new bulk inserter for a Django model class :param dj_model: Django model :type dj_model: :class:`django.db.models.Model`", "name": "__init__", "signature": "def __init__(self, dj_model)" }, { "docstring": "Add a new entry to be inserted The first time the method is calle...
3
stack_v2_sparse_classes_30k_train_006139
Implement the Python class `BulkInserter` described below. Class description: Handle bulk object insertion Method signatures and docstrings: - def __init__(self, dj_model): Create a new bulk inserter for a Django model class :param dj_model: Django model :type dj_model: :class:`django.db.models.Model` - def add_entry...
Implement the Python class `BulkInserter` described below. Class description: Handle bulk object insertion Method signatures and docstrings: - def __init__(self, dj_model): Create a new bulk inserter for a Django model class :param dj_model: Django model :type dj_model: :class:`django.db.models.Model` - def add_entry...
d253f09d7848e6cf32e8c7756551436da413176b
<|skeleton|> class BulkInserter: """Handle bulk object insertion""" def __init__(self, dj_model): """Create a new bulk inserter for a Django model class :param dj_model: Django model :type dj_model: :class:`django.db.models.Model`""" <|body_0|> def add_entry(self, **kwargs): """Add...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BulkInserter: """Handle bulk object insertion""" def __init__(self, dj_model): """Create a new bulk inserter for a Django model class :param dj_model: Django model :type dj_model: :class:`django.db.models.Model`""" self.table = dj_model self.fields = None self.values = [] ...
the_stack_v2_python_sparse
python-oq/openquake/writer.py
arbeit/openquake-packages
train
1
856eb70491de521d081d517835c6ed17bc7f3f13
[ "self.token = {'access_token': Mytest.access_token}\ntag_name = {'tag': {'name': '150KKk789004'}}\nhost = 'https://api.weixin.qq.com/cgi-bin/tags/create'\nr6 = ApiDefine().createtagname(self.session, host, params=self.token, data=json.dumps(tag_name))\ntime.sleep(2)\nprint('创建标签', r6.text)", "self.token = {'acces...
<|body_start_0|> self.token = {'access_token': Mytest.access_token} tag_name = {'tag': {'name': '150KKk789004'}} host = 'https://api.weixin.qq.com/cgi-bin/tags/create' r6 = ApiDefine().createtagname(self.session, host, params=self.token, data=json.dumps(tag_name)) time.sleep(2) ...
Mytest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mytest: def test_createtag(self): """创建标签""" <|body_0|> def test_createtag_30(self): """标签名字长度超过30个字符""" <|body_1|> def test_gettag(self): """获取标签""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.token = {'access_token': Myt...
stack_v2_sparse_classes_36k_train_017682
1,604
no_license
[ { "docstring": "创建标签", "name": "test_createtag", "signature": "def test_createtag(self)" }, { "docstring": "标签名字长度超过30个字符", "name": "test_createtag_30", "signature": "def test_createtag_30(self)" }, { "docstring": "获取标签", "name": "test_gettag", "signature": "def test_gett...
3
null
Implement the Python class `Mytest` described below. Class description: Implement the Mytest class. Method signatures and docstrings: - def test_createtag(self): 创建标签 - def test_createtag_30(self): 标签名字长度超过30个字符 - def test_gettag(self): 获取标签
Implement the Python class `Mytest` described below. Class description: Implement the Mytest class. Method signatures and docstrings: - def test_createtag(self): 创建标签 - def test_createtag_30(self): 标签名字长度超过30个字符 - def test_gettag(self): 获取标签 <|skeleton|> class Mytest: def test_createtag(self): """创建标签""...
7b790f675419224bfdbe1542eddc5a638982e68a
<|skeleton|> class Mytest: def test_createtag(self): """创建标签""" <|body_0|> def test_createtag_30(self): """标签名字长度超过30个字符""" <|body_1|> def test_gettag(self): """获取标签""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mytest: def test_createtag(self): """创建标签""" self.token = {'access_token': Mytest.access_token} tag_name = {'tag': {'name': '150KKk789004'}} host = 'https://api.weixin.qq.com/cgi-bin/tags/create' r6 = ApiDefine().createtagname(self.session, host, params=self.token, data...
the_stack_v2_python_sparse
老师の课堂代码/weixin_apitest/testcases/weixin_createtagname.py
liousAlready/NewDream_learning
train
0
4445625b986212c39ba1bb94ae9d43ed6d63e12c
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email), name=name)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password, name=name)\nuser.is_admin = True\nuser.save(using=self...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), name=name) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.c...
MyUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyUserManager: def create_user(self, email, name, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, name, password): """Creates and saves a superuser with the given email, dat...
stack_v2_sparse_classes_36k_train_017683
3,144
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, name, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name": "c...
2
stack_v2_sparse_classes_30k_train_015762
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, name, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, name, ...
Implement the Python class `MyUserManager` described below. Class description: Implement the MyUserManager class. Method signatures and docstrings: - def create_user(self, email, name, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, name, ...
c00c48719a5ff9a0d9fe562c53bfb378f33cf82b
<|skeleton|> class MyUserManager: def create_user(self, email, name, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, name, password): """Creates and saves a superuser with the given email, dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyUserManager: def create_user(self, email, name, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(email=self.normalize_email(email), name=na...
the_stack_v2_python_sparse
UserManager/models.py
namaiwa/CRM
train
0
e5df29c7af9c2c37732937ae4c1d4158f7a6872f
[ "self.id = id\nself.name = name\nself.gcp_project_id = gcp_project_id\nself.gcp_download_bucket = gcp_download_bucket\nself.gcp_transform_bucket = gcp_transform_bucket\nself.created = to_datetime_utc(created)\nself.modified = to_datetime_utc(modified)", "if name is not None:\n self.name = name\nif gcp_project_...
<|body_start_0|> self.id = id self.name = name self.gcp_project_id = gcp_project_id self.gcp_download_bucket = gcp_download_bucket self.gcp_transform_bucket = gcp_transform_bucket self.created = to_datetime_utc(created) self.modified = to_datetime_utc(modified) <|...
Organisation
[ "MIT", "BSD-2-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Organisation: def __init__(self, id: int=None, name: str=None, gcp_project_id: str=None, gcp_download_bucket: str=None, gcp_transform_bucket: str=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None): """Construct an Organisation object, which contains information abou...
stack_v2_sparse_classes_36k_train_017684
12,117
permissive
[ { "docstring": "Construct an Organisation object, which contains information about what Google Cloud project an organisation uses, what are it's download and transform buckets and what telescopes does it have. The maximum lengths of the gcp_project_id, gcp_download_bucket and gcp_transform_bucket come from the ...
2
null
Implement the Python class `Organisation` described below. Class description: Implement the Organisation class. Method signatures and docstrings: - def __init__(self, id: int=None, name: str=None, gcp_project_id: str=None, gcp_download_bucket: str=None, gcp_transform_bucket: str=None, created: pendulum.DateTime=None,...
Implement the Python class `Organisation` described below. Class description: Implement the Organisation class. Method signatures and docstrings: - def __init__(self, id: int=None, name: str=None, gcp_project_id: str=None, gcp_download_bucket: str=None, gcp_transform_bucket: str=None, created: pendulum.DateTime=None,...
64b62cba83110fea60e91506dff4a83ba9931ba9
<|skeleton|> class Organisation: def __init__(self, id: int=None, name: str=None, gcp_project_id: str=None, gcp_download_bucket: str=None, gcp_transform_bucket: str=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None): """Construct an Organisation object, which contains information abou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Organisation: def __init__(self, id: int=None, name: str=None, gcp_project_id: str=None, gcp_download_bucket: str=None, gcp_transform_bucket: str=None, created: pendulum.DateTime=None, modified: pendulum.DateTime=None): """Construct an Organisation object, which contains information about what Google ...
the_stack_v2_python_sparse
observatory-api/observatory/api/server/orm.py
kieranroberts/observatory-platform
train
0
6ad0c7e954ef31d126d5e6007ca0e212d1c01f42
[ "self.lazy_load = lazy_load\nself.fully_loaded = False\nif not pop_directory:\n pop_directory = DEFAULT_POP_DIR\ntiff_path = glob.glob(os.path.join(pop_directory, '*.tif'))\nif not tiff_path:\n raise ValueError('No TIFF file name in directory: %s' % pop_directory)\nself._tiff_path = tiff_path[0]\nself._raster...
<|body_start_0|> self.lazy_load = lazy_load self.fully_loaded = False if not pop_directory: pop_directory = DEFAULT_POP_DIR tiff_path = glob.glob(os.path.join(pop_directory, '*.tif')) if not tiff_path: raise ValueError('No TIFF file name in directory: %s' ...
USGS Population Raster driver. This class manages the reading of population raster data provided by USGS at: https://www.sciencebase.gov/catalog/item/57753ebee4b07dd077c70868
UsgsPopDriver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsgsPopDriver: """USGS Population Raster driver. This class manages the reading of population raster data provided by USGS at: https://www.sciencebase.gov/catalog/item/57753ebee4b07dd077c70868""" def __init__(self, pop_directory=None, lazy_load=False): """Initializes the driver. Args...
stack_v2_sparse_classes_36k_train_017685
9,295
permissive
[ { "docstring": "Initializes the driver. Args: pop_directory: The directory holding the USGS population raster. If None, use the default location. lazy_load: If True, then lazy population loading done (as needed).", "name": "__init__", "signature": "def __init__(self, pop_directory=None, lazy_load=False)...
3
stack_v2_sparse_classes_30k_train_011183
Implement the Python class `UsgsPopDriver` described below. Class description: USGS Population Raster driver. This class manages the reading of population raster data provided by USGS at: https://www.sciencebase.gov/catalog/item/57753ebee4b07dd077c70868 Method signatures and docstrings: - def __init__(self, pop_direc...
Implement the Python class `UsgsPopDriver` described below. Class description: USGS Population Raster driver. This class manages the reading of population raster data provided by USGS at: https://www.sciencebase.gov/catalog/item/57753ebee4b07dd077c70868 Method signatures and docstrings: - def __init__(self, pop_direc...
19f2ae9c1a1844e2f2ca2ceddd07f392249741e6
<|skeleton|> class UsgsPopDriver: """USGS Population Raster driver. This class manages the reading of population raster data provided by USGS at: https://www.sciencebase.gov/catalog/item/57753ebee4b07dd077c70868""" def __init__(self, pop_directory=None, lazy_load=False): """Initializes the driver. Args...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsgsPopDriver: """USGS Population Raster driver. This class manages the reading of population raster data provided by USGS at: https://www.sciencebase.gov/catalog/item/57753ebee4b07dd077c70868""" def __init__(self, pop_directory=None, lazy_load=False): """Initializes the driver. Args: pop_directo...
the_stack_v2_python_sparse
src/lib/usgs_pop/usgs_pop_driver.py
Wireless-Innovation-Forum/Spectrum-Access-System
train
64
f9253e6a9ac773fb0e52eee3ed8bc848ce0e7e0d
[ "self.first_name = first_name\nself.last_name = last_name\nself.middle_name = middle_name\nself.fullname = fullname\nself.address = address\nself.address_2 = address_2\nself.city = city\nself.postal_code = postal_code\nself.gender = gender\nself.raw_json = raw_json\nself.request_id = request_id\nself.additional_pro...
<|body_start_0|> self.first_name = first_name self.last_name = last_name self.middle_name = middle_name self.fullname = fullname self.address = address self.address_2 = address_2 self.city = city self.postal_code = postal_code self.gender = gender ...
Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type description here. fullname (string): TODO: type description here. addres...
PersonOfficialPersonRegistryResponse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersonOfficialPersonRegistryResponse: """Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type descript...
stack_v2_sparse_classes_36k_train_017686
4,269
permissive
[ { "docstring": "Constructor for the PersonOfficialPersonRegistryResponse class", "name": "__init__", "signature": "def __init__(self, first_name=None, last_name=None, middle_name=None, fullname=None, address=None, address_2=None, city=None, postal_code=None, gender=None, raw_json=None, request_id=None, ...
2
null
Implement the Python class `PersonOfficialPersonRegistryResponse` described below. Class description: Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. mi...
Implement the Python class `PersonOfficialPersonRegistryResponse` described below. Class description: Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. mi...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class PersonOfficialPersonRegistryResponse: """Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type descript...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersonOfficialPersonRegistryResponse: """Implementation of the 'Person.OfficialPersonRegistryResponse' model. TODO: type model description here. Attributes: first_name (string): TODO: type description here. last_name (string): TODO: type description here. middle_name (string): TODO: type description here. ful...
the_stack_v2_python_sparse
idfy_rest_client/models/person_official_person_registry_response.py
dealflowteam/Idfy
train
0
7611739327781b333d6475c253304e417f433892
[ "if not root:\n return path\nif root.left is None and root.right is None:\n path.append(root.val)\nif root.left:\n self.helper(root.left, path)\nif root.right:\n self.helper(root.right, path)", "path1, path2 = ([], [])\nself.helper(root1, path1)\nself.helper(root2, path2)\nif path1 == path2:\n retu...
<|body_start_0|> if not root: return path if root.left is None and root.right is None: path.append(root.val) if root.left: self.helper(root.left, path) if root.right: self.helper(root.right, path) <|end_body_0|> <|body_start_1|> pa...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def helper(self, root, path): """:type path: list :type root: TreeNode""" <|body_0|> def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not ro...
stack_v2_sparse_classes_36k_train_017687
927
no_license
[ { "docstring": ":type path: list :type root: TreeNode", "name": "helper", "signature": "def helper(self, root, path)" }, { "docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool", "name": "leafSimilar", "signature": "def leafSimilar(self, root1, root2)" } ]
2
stack_v2_sparse_classes_30k_train_020017
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, root, path): :type path: list :type root: TreeNode - def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def helper(self, root, path): :type path: list :type root: TreeNode - def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool <|skeleton|> ...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def helper(self, root, path): """:type path: list :type root: TreeNode""" <|body_0|> def leafSimilar(self, root1, root2): """:type root1: TreeNode :type root2: TreeNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def helper(self, root, path): """:type path: list :type root: TreeNode""" if not root: return path if root.left is None and root.right is None: path.append(root.val) if root.left: self.helper(root.left, path) if root.right: ...
the_stack_v2_python_sparse
leetcode/leafSimilar-872.py
pittcat/Algorithm_Practice
train
0
8331995802c9cb17e59f8d65befe3d519d5f4c44
[ "def time_difference(profile):\n if profile.installed_on is None:\n return timedelta.max.total_seconds()\n return abs((given_time - profile.installed_on).total_seconds())\nreturn min(queryset, key=time_difference)", "serializer = ReferralForIpSerializer(data=request.query_params)\nserializer.is_valid...
<|body_start_0|> def time_difference(profile): if profile.installed_on is None: return timedelta.max.total_seconds() return abs((given_time - profile.installed_on).total_seconds()) return min(queryset, key=time_difference) <|end_body_0|> <|body_start_1|> ...
ReferrerForIp
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReferrerForIp: def get_closest_profile_installation(self, queryset, given_time): """Return the minimum difference in time between entries and the given time, transformed by a key function.""" <|body_0|> def get(self, request, *args, **kwargs): """Return the referrer ...
stack_v2_sparse_classes_36k_train_017688
2,024
no_license
[ { "docstring": "Return the minimum difference in time between entries and the given time, transformed by a key function.", "name": "get_closest_profile_installation", "signature": "def get_closest_profile_installation(self, queryset, given_time)" }, { "docstring": "Return the referrer name who b...
2
stack_v2_sparse_classes_30k_train_000641
Implement the Python class `ReferrerForIp` described below. Class description: Implement the ReferrerForIp class. Method signatures and docstrings: - def get_closest_profile_installation(self, queryset, given_time): Return the minimum difference in time between entries and the given time, transformed by a key functio...
Implement the Python class `ReferrerForIp` described below. Class description: Implement the ReferrerForIp class. Method signatures and docstrings: - def get_closest_profile_installation(self, queryset, given_time): Return the minimum difference in time between entries and the given time, transformed by a key functio...
1ff73f41af005506d1787847bbb5c0f7f1c7e74d
<|skeleton|> class ReferrerForIp: def get_closest_profile_installation(self, queryset, given_time): """Return the minimum difference in time between entries and the given time, transformed by a key function.""" <|body_0|> def get(self, request, *args, **kwargs): """Return the referrer ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReferrerForIp: def get_closest_profile_installation(self, queryset, given_time): """Return the minimum difference in time between entries and the given time, transformed by a key function.""" def time_difference(profile): if profile.installed_on is None: return time...
the_stack_v2_python_sparse
tappil/referrers/views.py
dangerfarms/tappil
train
0
7686d6bb42e57f535ab7deced8b2acaf32e1bd0d
[ "self.name = name\nself.charge = charge\nself.radius = radius\nself.resname = resname\nself.group = group", "try:\n item = getattr(self, name)\n return item\nexcept AttributeError:\n message = 'Unable to access object \"%s\" in class ForcefieldAtom' % name\n raise ValueError(message)", "txt = '%s:\\...
<|body_start_0|> self.name = name self.charge = charge self.radius = radius self.resname = resname self.group = group <|end_body_0|> <|body_start_1|> try: item = getattr(self, name) return item except AttributeError: message = ...
ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level
ForcefieldAtom
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForcefieldAtom: """ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level""" def __init__(self, name, charge, radius, resname, group=''): """Initialize the object Parameters name: The atom name (string) charge: The charge o...
stack_v2_sparse_classes_36k_train_017689
36,720
permissive
[ { "docstring": "Initialize the object Parameters name: The atom name (string) charge: The charge on the atom (float) radius: The radius of the atom (float) resname: The residue name (string) group: The group name (string)", "name": "__init__", "signature": "def __init__(self, name, charge, radius, resna...
3
stack_v2_sparse_classes_30k_train_004885
Implement the Python class `ForcefieldAtom` described below. Class description: ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level Method signatures and docstrings: - def __init__(self, name, charge, radius, resname, group=''): Initialize the object Par...
Implement the Python class `ForcefieldAtom` described below. Class description: ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level Method signatures and docstrings: - def __init__(self, name, charge, radius, resname, group=''): Initialize the object Par...
f4eaad40eebefafa25b3aa77493499deb1a72cc4
<|skeleton|> class ForcefieldAtom: """ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level""" def __init__(self, name, charge, radius, resname, group=''): """Initialize the object Parameters name: The atom name (string) charge: The charge o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForcefieldAtom: """ForcefieldAtom class The ForcefieldAtom object contains fields that are related to the forcefield at the atom level""" def __init__(self, name, charge, radius, resname, group=''): """Initialize the object Parameters name: The atom name (string) charge: The charge on the atom (f...
the_stack_v2_python_sparse
bin/pdb2pqr-1.6/src/forcefield.py
MonZop/BioBlender21
train
0
09a2021dafc40470c5a853dc987d29047c04990e
[ "self.x_vel = self.y_vel = self.y_vel_i = 0\nself.grav = 20\nself.fall = False\nself.time = None", "if self.fall:\n time_now = pg.time.get_ticks()\n if not self.time:\n self.time = time_now\n self.y_vel = self.grav * ((time_now - self.time) / 1000.0) + self.y_vel_i\nelse:\n self.time = None\n ...
<|body_start_0|> self.x_vel = self.y_vel = self.y_vel_i = 0 self.grav = 20 self.fall = False self.time = None <|end_body_0|> <|body_start_1|> if self.fall: time_now = pg.time.get_ticks() if not self.time: self.time = time_now s...
A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.
_Physics
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Physics: """A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.""" def __init__(self): """You can experiment with different gravity h...
stack_v2_sparse_classes_36k_train_017690
8,368
no_license
[ { "docstring": "You can experiment with different gravity here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "If the player is falling, calculate current y velocity.", "name": "physics_update", "signature": "def physics_update(self)" } ]
2
null
Implement the Python class `_Physics` described below. Class description: A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself. Method signatures and docstrings: - def __...
Implement the Python class `_Physics` described below. Class description: A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself. Method signatures and docstrings: - def __...
7fc4e0d98d06b4e28b09844babb2452e229a603c
<|skeleton|> class _Physics: """A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.""" def __init__(self): """You can experiment with different gravity h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Physics: """A simplified physics class. Using a 'real' gravity function here, though it is questionable whether or not it is worth the effort. Compare to the effect of gravity in fall_rect and decide for yourself.""" def __init__(self): """You can experiment with different gravity here.""" ...
the_stack_v2_python_sparse
meks-pygame-samples/platforming/fall_rotate.py
pk00749/Example_Python
train
1
7fa1f11e0ed3ad74d66fb62d86a4720ed925e146
[ "bad_lines = []\nif not content:\n raise SkipComponent('Empty content.')\nif len(content) < 5:\n raise ParseException(\"Wrong content in table: '{0}'.\".format(content))\ndata = {}\nfor _l in content[3:-1]:\n l = _l.strip()\n if not (l.startswith('|') and l.endswith('|')):\n bad_lines.append(_l)\...
<|body_start_0|> bad_lines = [] if not content: raise SkipComponent('Empty content.') if len(content) < 5: raise ParseException("Wrong content in table: '{0}'.".format(content)) data = {} for _l in content[3:-1]: l = _l.strip() if n...
The output of command ``/bin/mysqladmin variables`` is in mysql table format, contains 'Variable_name' and 'Value' two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored in the ``bad_lines`` property list. Example: >>> output.get('version') '5.5.56-Mar...
MysqladminVars
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MysqladminVars: """The output of command ``/bin/mysqladmin variables`` is in mysql table format, contains 'Variable_name' and 'Value' two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored in the ``bad_lines`` property list. Exam...
stack_v2_sparse_classes_36k_train_017691
4,351
permissive
[ { "docstring": "Parse output content table of command ``/bin/mysqladmin variables``. Set each variable as an class attribute.", "name": "parse_content", "signature": "def parse_content(self, content)" }, { "docstring": "Get value for specified keyword, use default if keyword not found. Example: ...
2
stack_v2_sparse_classes_30k_train_017312
Implement the Python class `MysqladminVars` described below. Class description: The output of command ``/bin/mysqladmin variables`` is in mysql table format, contains 'Variable_name' and 'Value' two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored i...
Implement the Python class `MysqladminVars` described below. Class description: The output of command ``/bin/mysqladmin variables`` is in mysql table format, contains 'Variable_name' and 'Value' two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored i...
b0ea07fc3f4dd8801b505fe70e9b36e628152c4a
<|skeleton|> class MysqladminVars: """The output of command ``/bin/mysqladmin variables`` is in mysql table format, contains 'Variable_name' and 'Value' two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored in the ``bad_lines`` property list. Exam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MysqladminVars: """The output of command ``/bin/mysqladmin variables`` is in mysql table format, contains 'Variable_name' and 'Value' two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored in the ``bad_lines`` property list. Example: >>> outp...
the_stack_v2_python_sparse
insights/parsers/mysqladmin.py
RedHatInsights/insights-core
train
144
6731c1d7b9275bf8364ee4f2c2af3919903dc619
[ "super().__init__(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background)\nself.min_spot_size = min_spot_size\nself.max_spot_size = max_spot_size\nself.filter_spots = filter_spots", "num_panels = len(self.imageset.get_detector())\npixel_labeller = [PixelListLabe...
<|body_start_0|> super().__init__(imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background) self.min_spot_size = min_spot_size self.max_spot_size = max_spot_size self.filter_spots = filter_spots <|end_body_0|> <|body_start_1|> nu...
A class to extract pixels from a single image
ExtractPixelsFromImage2DNoShoeboxes
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractPixelsFromImage2DNoShoeboxes: """A class to extract pixels from a single image""" def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots): """Initialise the class...
stack_v2_sparse_classes_36k_train_017692
29,989
permissive
[ { "docstring": "Initialise the class :param imageset: The imageset to extract from :param threshold_function: The function to threshold with :param mask: The image mask :param region_of_interest: A region of interest to process :param max_strong_pixel_fraction: The maximum fraction of pixels allowed", "name...
2
stack_v2_sparse_classes_30k_val_000646
Implement the Python class `ExtractPixelsFromImage2DNoShoeboxes` described below. Class description: A class to extract pixels from a single image Method signatures and docstrings: - def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot...
Implement the Python class `ExtractPixelsFromImage2DNoShoeboxes` described below. Class description: A class to extract pixels from a single image Method signatures and docstrings: - def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class ExtractPixelsFromImage2DNoShoeboxes: """A class to extract pixels from a single image""" def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots): """Initialise the class...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExtractPixelsFromImage2DNoShoeboxes: """A class to extract pixels from a single image""" def __init__(self, imageset, threshold_function, mask, region_of_interest, max_strong_pixel_fraction, compute_mean_background, min_spot_size, max_spot_size, filter_spots): """Initialise the class :param image...
the_stack_v2_python_sparse
src/dials/algorithms/spot_finding/finder.py
dials/dials
train
71
3522d507ac363021815a9c9d49e9bb52a0cf409a
[ "l, r = (0, len(height) - 1)\nmax_c = 0\nwhile l != r:\n l_h = height[l]\n r_h = height[r]\n tem = min(l_h, r_h) * (r - l)\n max_c = max(max_c, tem)\n if l_h < r_h:\n l += 1\n else:\n r -= 1\nreturn max_c", "i, j = (0, len(height) - 1)\nv = (j - i) * min(height[i], height[j])\nwhil...
<|body_start_0|> l, r = (0, len(height) - 1) max_c = 0 while l != r: l_h = height[l] r_h = height[r] tem = min(l_h, r_h) * (r - l) max_c = max(max_c, tem) if l_h < r_h: l += 1 else: r -= 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> l, r = (0, len(height) - 1) max_c = 0...
stack_v2_sparse_classes_36k_train_017693
888
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_005994
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea(sel...
bd8df12c0d4afd048cf1b58b04c27fa1f3622769
<|skeleton|> class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height): """:type height: List[int] :rtype: int""" l, r = (0, len(height) - 1) max_c = 0 while l != r: l_h = height[l] r_h = height[r] tem = min(l_h, r_h) * (r - l) max_c = max(max_c, tem) i...
the_stack_v2_python_sparse
11_container_with_most_water.py
aojugg/leetcode
train
0
b691b6457e83c1a829090ccae968fce304849d2e
[ "object.__init__(self)\nself._timeouts = iter(self._TIMEOUT_PER_ATTEMPT)\nself._time_fn = _time_fn\nself._random_fn = _random_fn", "try:\n timeout = next(self._timeouts)\nexcept StopIteration:\n timeout = None\nif timeout is not None:\n variation_range = timeout * 0.1\n timeout += self._random_fn() * ...
<|body_start_0|> object.__init__(self) self._timeouts = iter(self._TIMEOUT_PER_ATTEMPT) self._time_fn = _time_fn self._random_fn = _random_fn <|end_body_0|> <|body_start_1|> try: timeout = next(self._timeouts) except StopIteration: timeout = None ...
Class with lock acquire timeout strategy.
LockAttemptTimeoutStrategy
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockAttemptTimeoutStrategy: """Class with lock acquire timeout strategy.""" def __init__(self, _time_fn=time.time, _random_fn=random.random): """Initializes this class. @param _time_fn: Time function for unittests @param _random_fn: Random number generator for unittests""" <|...
stack_v2_sparse_classes_36k_train_017694
25,079
permissive
[ { "docstring": "Initializes this class. @param _time_fn: Time function for unittests @param _random_fn: Random number generator for unittests", "name": "__init__", "signature": "def __init__(self, _time_fn=time.time, _random_fn=random.random)" }, { "docstring": "Returns the timeout for the next ...
2
null
Implement the Python class `LockAttemptTimeoutStrategy` described below. Class description: Class with lock acquire timeout strategy. Method signatures and docstrings: - def __init__(self, _time_fn=time.time, _random_fn=random.random): Initializes this class. @param _time_fn: Time function for unittests @param _rando...
Implement the Python class `LockAttemptTimeoutStrategy` described below. Class description: Class with lock acquire timeout strategy. Method signatures and docstrings: - def __init__(self, _time_fn=time.time, _random_fn=random.random): Initializes this class. @param _time_fn: Time function for unittests @param _rando...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class LockAttemptTimeoutStrategy: """Class with lock acquire timeout strategy.""" def __init__(self, _time_fn=time.time, _random_fn=random.random): """Initializes this class. @param _time_fn: Time function for unittests @param _random_fn: Random number generator for unittests""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockAttemptTimeoutStrategy: """Class with lock acquire timeout strategy.""" def __init__(self, _time_fn=time.time, _random_fn=random.random): """Initializes this class. @param _time_fn: Time function for unittests @param _random_fn: Random number generator for unittests""" object.__init__...
the_stack_v2_python_sparse
lib/mcpu.py
ganeti/ganeti
train
465
d90dd151e51e79badec0aaa67470bb5c62e6428b
[ "if allauth_settings.EMAIL_VERIFICATION == allauth_settings.EmailVerificationMethod.MANDATORY:\n return {'detail': 'Verification e-mail sent.'}\nreturn TokenSerializer({'user': user, 'token': self.token}).data", "user = serializer.save(self.request)\nself.token = create_knox_token(self.token_model, user, None)...
<|body_start_0|> if allauth_settings.EMAIL_VERIFICATION == allauth_settings.EmailVerificationMethod.MANDATORY: return {'detail': 'Verification e-mail sent.'} return TokenSerializer({'user': user, 'token': self.token}).data <|end_body_0|> <|body_start_1|> user = serializer.save(self....
Enables registration of users into the system
RegisterView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterView: """Enables registration of users into the system""" def get_response_data(self, user): """Send authentication data to the client""" <|body_0|> def perform_create(self, serializer): """Create and instance of the user to the database and perform post ...
stack_v2_sparse_classes_36k_train_017695
4,981
permissive
[ { "docstring": "Send authentication data to the client", "name": "get_response_data", "signature": "def get_response_data(self, user)" }, { "docstring": "Create and instance of the user to the database and perform post registration processed These processed include sending activation email and s...
2
null
Implement the Python class `RegisterView` described below. Class description: Enables registration of users into the system Method signatures and docstrings: - def get_response_data(self, user): Send authentication data to the client - def perform_create(self, serializer): Create and instance of the user to the datab...
Implement the Python class `RegisterView` described below. Class description: Enables registration of users into the system Method signatures and docstrings: - def get_response_data(self, user): Send authentication data to the client - def perform_create(self, serializer): Create and instance of the user to the datab...
6b080039398fb4099a34335317d649dd67783f63
<|skeleton|> class RegisterView: """Enables registration of users into the system""" def get_response_data(self, user): """Send authentication data to the client""" <|body_0|> def perform_create(self, serializer): """Create and instance of the user to the database and perform post ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterView: """Enables registration of users into the system""" def get_response_data(self, user): """Send authentication data to the client""" if allauth_settings.EMAIL_VERIFICATION == allauth_settings.EmailVerificationMethod.MANDATORY: return {'detail': 'Verification e-mai...
the_stack_v2_python_sparse
accounts/views.py
daniel-waruo/e-commerse-api
train
6
1977e5bc5f765b35a9cfaf773ad9cf978bd40b22
[ "if item:\n self.root = Node(item)\nelse:\n self.root = None", "if self:\n if self.root:\n self.root + item\n else:\n self.root = Node(item)", "if self:\n if self.root:\n if item in self.root:\n return True\nreturn False", "lst = []\nif self:\n if self.root:\n...
<|body_start_0|> if item: self.root = Node(item) else: self.root = None <|end_body_0|> <|body_start_1|> if self: if self.root: self.root + item else: self.root = Node(item) <|end_body_1|> <|body_start_2|> i...
BST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BST: def __init__(self, item=None): """This constructor takes an item with the default value of None and sets self.root to None if item is None else sets it to Node of item.""" <|body_0|> def __add__(self, item): """This magic method inserts a new item into self.""" ...
stack_v2_sparse_classes_36k_train_017696
4,969
no_license
[ { "docstring": "This constructor takes an item with the default value of None and sets self.root to None if item is None else sets it to Node of item.", "name": "__init__", "signature": "def __init__(self, item=None)" }, { "docstring": "This magic method inserts a new item into self.", "name...
6
stack_v2_sparse_classes_30k_train_008260
Implement the Python class `BST` described below. Class description: Implement the BST class. Method signatures and docstrings: - def __init__(self, item=None): This constructor takes an item with the default value of None and sets self.root to None if item is None else sets it to Node of item. - def __add__(self, it...
Implement the Python class `BST` described below. Class description: Implement the BST class. Method signatures and docstrings: - def __init__(self, item=None): This constructor takes an item with the default value of None and sets self.root to None if item is None else sets it to Node of item. - def __add__(self, it...
e773e87668af057c8adb1e012aa5d81f42c70f2a
<|skeleton|> class BST: def __init__(self, item=None): """This constructor takes an item with the default value of None and sets self.root to None if item is None else sets it to Node of item.""" <|body_0|> def __add__(self, item): """This magic method inserts a new item into self.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BST: def __init__(self, item=None): """This constructor takes an item with the default value of None and sets self.root to None if item is None else sets it to Node of item.""" if item: self.root = Node(item) else: self.root = None def __add__(self, item): ...
the_stack_v2_python_sparse
HW/HW5/hw5.py
SiddhantBhardwaj2018/ISTA-350
train
0
69824654e35c61f2ccc415e647a04a23fdc4edf7
[ "count = 1\nfor k in range(2, int(math.sqrt(2 * N)) + 1):\n if (N - k * (k - 1) / 2) % k == 0:\n count += 1\nreturn count", "count, k = (1, 2)\nwhile N > k * (k - 1) // 2:\n if (N - k * (k - 1) / 2) % k == 0:\n count += 1\n k += 1\nreturn count" ]
<|body_start_0|> count = 1 for k in range(2, int(math.sqrt(2 * N)) + 1): if (N - k * (k - 1) / 2) % k == 0: count += 1 return count <|end_body_0|> <|body_start_1|> count, k = (1, 2) while N > k * (k - 1) // 2: if (N - k * (k - 1) / 2) % k ...
The thought process goes like this- Given a number N, we can possibly write it as a sum of 2 numbers, 3 numbers, 4 numbers and so on. Let's assume the fist number in this series be x. Hence, we should have x + (x+1) + (x+2)+...+ k terms = N kx + k*(k-1)/2 = N implies kx = N - k*(k-1)/2 So, we can calculate the RHS for ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """The thought process goes like this- Given a number N, we can possibly write it as a sum of 2 numbers, 3 numbers, 4 numbers and so on. Let's assume the fist number in this series be x. Hence, we should have x + (x+1) + (x+2)+...+ k terms = N kx + k*(k-1)/2 = N implies kx = N - k*(k-1)...
stack_v2_sparse_classes_36k_train_017697
1,644
no_license
[ { "docstring": ":type N: int :rtype: int", "name": "consecutiveNumbersSum", "signature": "def consecutiveNumbersSum(self, N)" }, { "docstring": ":type N: int :rtype: int", "name": "consecutiveNumbersSum", "signature": "def consecutiveNumbersSum(self, N)" } ]
2
stack_v2_sparse_classes_30k_train_009267
Implement the Python class `Solution` described below. Class description: The thought process goes like this- Given a number N, we can possibly write it as a sum of 2 numbers, 3 numbers, 4 numbers and so on. Let's assume the fist number in this series be x. Hence, we should have x + (x+1) + (x+2)+...+ k terms = N kx +...
Implement the Python class `Solution` described below. Class description: The thought process goes like this- Given a number N, we can possibly write it as a sum of 2 numbers, 3 numbers, 4 numbers and so on. Let's assume the fist number in this series be x. Hence, we should have x + (x+1) + (x+2)+...+ k terms = N kx +...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: """The thought process goes like this- Given a number N, we can possibly write it as a sum of 2 numbers, 3 numbers, 4 numbers and so on. Let's assume the fist number in this series be x. Hence, we should have x + (x+1) + (x+2)+...+ k terms = N kx + k*(k-1)/2 = N implies kx = N - k*(k-1)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """The thought process goes like this- Given a number N, we can possibly write it as a sum of 2 numbers, 3 numbers, 4 numbers and so on. Let's assume the fist number in this series be x. Hence, we should have x + (x+1) + (x+2)+...+ k terms = N kx + k*(k-1)/2 = N implies kx = N - k*(k-1)/2 So, we can...
the_stack_v2_python_sparse
python_leetcode_2020/Python_Leetcode_2020/829_consecutive_numbers_sum.py
xiangcao/Leetcode
train
0
b24bc996a6cadcfdf626a2b94047cd4a7ae1827b
[ "import functools\nl_num = len(nums)\nnums = list(map(str, nums))\ncmp = lambda a, b: -1 if a + b > b + a else 1 if a + b < b + a else 0\nnums.sort(key=functools.cmp_to_key(cmp))\nreturn str(int(''.join(nums)))", "l_num = len(nums)\nnums = list(map(str, nums))\nfor i in range(l_num):\n for j in range(0, l_num ...
<|body_start_0|> import functools l_num = len(nums) nums = list(map(str, nums)) cmp = lambda a, b: -1 if a + b > b + a else 1 if a + b < b + a else 0 nums.sort(key=functools.cmp_to_key(cmp)) return str(int(''.join(nums))) <|end_body_0|> <|body_start_1|> l_num = l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestNumber(self, nums): """:type nums: List[int] :rtype: str""" <|body_0|> def largestNumberScratch(self, nums): """:type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> import functools l_num = l...
stack_v2_sparse_classes_36k_train_017698
1,042
no_license
[ { "docstring": ":type nums: List[int] :rtype: str", "name": "largestNumber", "signature": "def largestNumber(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: str", "name": "largestNumberScratch", "signature": "def largestNumberScratch(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007904
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): :type nums: List[int] :rtype: str - def largestNumberScratch(self, nums): :type nums: List[int] :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestNumber(self, nums): :type nums: List[int] :rtype: str - def largestNumberScratch(self, nums): :type nums: List[int] :rtype: str <|skeleton|> class Solution: def ...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def largestNumber(self, nums): """:type nums: List[int] :rtype: str""" <|body_0|> def largestNumberScratch(self, nums): """:type nums: List[int] :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestNumber(self, nums): """:type nums: List[int] :rtype: str""" import functools l_num = len(nums) nums = list(map(str, nums)) cmp = lambda a, b: -1 if a + b > b + a else 1 if a + b < b + a else 0 nums.sort(key=functools.cmp_to_key(cmp)) ...
the_stack_v2_python_sparse
cs_notes/sort/largest_number.py
hwc1824/LeetCodeSolution
train
0
49bc9e21fff296ba1b4a870c8f6f984a1b0b7601
[ "user_id = 'test'\ngt = GeetestLib(settings.GEETEST['pc_geetest_id'], settings.GEETEST['pc_geetest_key'])\nstatus = gt.pre_process(user_id)\nresponse_str = gt.get_response_str()\nimport json\nresponse = json.loads(response_str)\nreturn Response(response)", "gt = GeetestLib(settings.GEETEST['pc_geetest_id'], setti...
<|body_start_0|> user_id = 'test' gt = GeetestLib(settings.GEETEST['pc_geetest_id'], settings.GEETEST['pc_geetest_key']) status = gt.pre_process(user_id) response_str = gt.get_response_str() import json response = json.loads(response_str) return Response(response)...
GeetestCapchaAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeetestCapchaAPIView: def get(self, request): """生成验证码的流水号""" <|body_0|> def post(self, request): """校验验证码的结果""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_id = 'test' gt = GeetestLib(settings.GEETEST['pc_geetest_id'], settings.GEETES...
stack_v2_sparse_classes_36k_train_017699
14,869
no_license
[ { "docstring": "生成验证码的流水号", "name": "get", "signature": "def get(self, request)" }, { "docstring": "校验验证码的结果", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_003510
Implement the Python class `GeetestCapchaAPIView` described below. Class description: Implement the GeetestCapchaAPIView class. Method signatures and docstrings: - def get(self, request): 生成验证码的流水号 - def post(self, request): 校验验证码的结果
Implement the Python class `GeetestCapchaAPIView` described below. Class description: Implement the GeetestCapchaAPIView class. Method signatures and docstrings: - def get(self, request): 生成验证码的流水号 - def post(self, request): 校验验证码的结果 <|skeleton|> class GeetestCapchaAPIView: def get(self, request): """生成...
8e551d417b6ba0143bd9636a85ea46ebaba944f4
<|skeleton|> class GeetestCapchaAPIView: def get(self, request): """生成验证码的流水号""" <|body_0|> def post(self, request): """校验验证码的结果""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeetestCapchaAPIView: def get(self, request): """生成验证码的流水号""" user_id = 'test' gt = GeetestLib(settings.GEETEST['pc_geetest_id'], settings.GEETEST['pc_geetest_key']) status = gt.pre_process(user_id) response_str = gt.get_response_str() import json respon...
the_stack_v2_python_sparse
Recruitment/apps/user/views.py
tkhto/Recruitment
train
0