blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
2713c7fe674a209ade5ed49a86832860ffe54892
[ "self.LOGS = settings.logger\nself.dataset = settings.dataset\nself.LOGS.info('DATASET: Instantiating Dataset object')\nmodule = self._load_module(settings, client)\nremote_check = core.get_date(module.url)\nif self.dataset in settings.modules.keys() and remote_check > settings.modules[self.dataset]:\n msg = 'Re...
<|body_start_0|> self.LOGS = settings.logger self.dataset = settings.dataset self.LOGS.info('DATASET: Instantiating Dataset object') module = self._load_module(settings, client) remote_check = core.get_date(module.url) if self.dataset in settings.modules.keys() and remote...
Class to retrieve the required DHTK extension (dataset) module
ExtensionLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtensionLoader: """Class to retrieve the required DHTK extension (dataset) module""" def __init__(self, settings: object, client: object): """Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client:...
stack_v2_sparse_classes_10k_train_001200
3,777
no_license
[ { "docstring": "Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client: DHTK Client object Client to use Returns ------- Extension module selected by the user as the .module attribute", "name": "__init__", "signature":...
2
stack_v2_sparse_classes_30k_train_000790
Implement the Python class `ExtensionLoader` described below. Class description: Class to retrieve the required DHTK extension (dataset) module Method signatures and docstrings: - def __init__(self, settings: object, client: object): Method to retrieve the required the DHTK extension module. Parameters ---------- set...
Implement the Python class `ExtensionLoader` described below. Class description: Class to retrieve the required DHTK extension (dataset) module Method signatures and docstrings: - def __init__(self, settings: object, client: object): Method to retrieve the required the DHTK extension module. Parameters ---------- set...
54d9104c8b04af0fb368a499372d7ea0337be3d2
<|skeleton|> class ExtensionLoader: """Class to retrieve the required DHTK extension (dataset) module""" def __init__(self, settings: object, client: object): """Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExtensionLoader: """Class to retrieve the required DHTK extension (dataset) module""" def __init__(self, settings: object, client: object): """Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client: DHTK Client ...
the_stack_v2_python_sparse
venv/Lib/site-packages/dhtk/core/loader.py
sorchawalsh/semanticweb
train
0
1975f136643f26728a6846cbca65cdafcf5c2a1b
[ "if N == 1:\n return 1\nif N == 2:\n return 2\ndp = [1 for _ in range(N + 1)]\ndp[2] = 2\nfor i in range(3, N + 1):\n dp[i] = (2 * dp[i - 1] + dp[i - 3]) % int(1000000000.0 + 7)\nreturn dp[-1]", "import numpy as np\nif N == 1:\n return 1\nif N == 2:\n return 2\nif N % 2 == 1:\n k = (N - 2) // 2\...
<|body_start_0|> if N == 1: return 1 if N == 2: return 2 dp = [1 for _ in range(N + 1)] dp[2] = 2 for i in range(3, N + 1): dp[i] = (2 * dp[i - 1] + dp[i - 3]) % int(1000000000.0 + 7) return dp[-1] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numTilings(self, N): """:type N: int :rtype: int 35MS""" <|body_0|> def numTilings_1(self, N): """:type N: int :rtype: int 95MS""" <|body_1|> <|end_skeleton|> <|body_start_0|> if N == 1: return 1 if N == 2: ...
stack_v2_sparse_classes_10k_train_001201
1,973
no_license
[ { "docstring": ":type N: int :rtype: int 35MS", "name": "numTilings", "signature": "def numTilings(self, N)" }, { "docstring": ":type N: int :rtype: int 95MS", "name": "numTilings_1", "signature": "def numTilings_1(self, N)" } ]
2
stack_v2_sparse_classes_30k_train_002825
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTilings(self, N): :type N: int :rtype: int 35MS - def numTilings_1(self, N): :type N: int :rtype: int 95MS
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numTilings(self, N): :type N: int :rtype: int 35MS - def numTilings_1(self, N): :type N: int :rtype: int 95MS <|skeleton|> class Solution: def numTilings(self, N): ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def numTilings(self, N): """:type N: int :rtype: int 35MS""" <|body_0|> def numTilings_1(self, N): """:type N: int :rtype: int 95MS""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def numTilings(self, N): """:type N: int :rtype: int 35MS""" if N == 1: return 1 if N == 2: return 2 dp = [1 for _ in range(N + 1)] dp[2] = 2 for i in range(3, N + 1): dp[i] = (2 * dp[i - 1] + dp[i - 3]) % int(100000...
the_stack_v2_python_sparse
DominoAndTrominoTiling_MID_790.py
953250587/leetcode-python
train
2
46387d7f47da692898cc02ef9a31660e46dc86dc
[ "device = get_object_or_404(Device, slug=slug)\nself.check_object_permissions(request, device)\nserializer = DeviceRetrieveUpdateDestroySerializer(device, many=False)\nreturn Response(data=serializer.data, status=status.HTTP_200_OK)", "device = get_object_or_404(Device, slug=slug)\nself.check_object_permissions(r...
<|body_start_0|> device = get_object_or_404(Device, slug=slug) self.check_object_permissions(request, device) serializer = DeviceRetrieveUpdateDestroySerializer(device, many=False) return Response(data=serializer.data, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> d...
DeviceRetrieveUpdateDestroyAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceRetrieveUpdateDestroyAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> def delete(self, request, slug=None): """Delete""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_001202
5,225
permissive
[ { "docstring": "Retrieve", "name": "get", "signature": "def get(self, request, slug=None)" }, { "docstring": "Update", "name": "put", "signature": "def put(self, request, slug=None)" }, { "docstring": "Delete", "name": "delete", "signature": "def delete(self, request, slu...
3
null
Implement the Python class `DeviceRetrieveUpdateDestroyAPIView` described below. Class description: Implement the DeviceRetrieveUpdateDestroyAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update - def delete(self, request, slug=None)...
Implement the Python class `DeviceRetrieveUpdateDestroyAPIView` described below. Class description: Implement the DeviceRetrieveUpdateDestroyAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update - def delete(self, request, slug=None)...
98e1ff8bab7dda3492e5ff637bf5aafd111c840c
<|skeleton|> class DeviceRetrieveUpdateDestroyAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> def delete(self, request, slug=None): """Delete""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeviceRetrieveUpdateDestroyAPIView: def get(self, request, slug=None): """Retrieve""" device = get_object_or_404(Device, slug=slug) self.check_object_permissions(request, device) serializer = DeviceRetrieveUpdateDestroySerializer(device, many=False) return Response(data...
the_stack_v2_python_sparse
mikaponics/device/views/resources/device_crud_api_views.py
mikaponics/mikaponics-back
train
4
7e98a1f7014d23634fa7967fa88a9ffeff019a2b
[ "tl = self._grid.GetSelectionBlockTopLeft()\nbr = self._grid.GetSelectionBlockBottomRight()\nif tl == [(0, 0)] and br == [(self._grid.GetNumberRows() - 1, self._grid.GetNumberCols() - 1)]:\n self._grid.ClearSelection()\nfor (tlrow, tlcolumn), (brrow, brcolumn) in zip(tl, br):\n for row in range(tlrow, brrow +...
<|body_start_0|> tl = self._grid.GetSelectionBlockTopLeft() br = self._grid.GetSelectionBlockBottomRight() if tl == [(0, 0)] and br == [(self._grid.GetNumberRows() - 1, self._grid.GetNumberCols() - 1)]: self._grid.ClearSelection() for (tlrow, tlcolumn), (brrow, brcolumn) in z...
s3dcGridMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class s3dcGridMixin: def _handlerGridRangeSelect(self, event): """This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to ...
stack_v2_sparse_classes_10k_train_001203
3,119
no_license
[ { "docstring": "This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to be selected, but GetSelectedRows() doesn't think so. This event hand...
2
stack_v2_sparse_classes_30k_train_000382
Implement the Python class `s3dcGridMixin` described below. Class description: Implement the s3dcGridMixin class. Method signatures and docstrings: - def _handlerGridRangeSelect(self, event): This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activa...
Implement the Python class `s3dcGridMixin` described below. Class description: Implement the s3dcGridMixin class. Method signatures and docstrings: - def _handlerGridRangeSelect(self, event): This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activa...
586225d68b079e2a96007bd33784113b3a19a538
<|skeleton|> class s3dcGridMixin: def _handlerGridRangeSelect(self, event): """This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class s3dcGridMixin: def _handlerGridRangeSelect(self, event): """This event handler is a fix for the fact that the row selection in the wxGrid is deliberately broken. It's also used to activate and deactivate relevant menubar items. Whenever a user clicks on a cell, the grid SHOWS its row to be selected, b...
the_stack_v2_python_sparse
modules/viewers/slice3dVWRmodules/shared.py
JoonVan/devide
train
0
ee26eb86a6a90c6b4badd59216bb48100934e49e
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('medinad', 'medinad')\npolice = repo.medinad.police\nneighborhoods = repo.medinad.neighbor\n\ndef product(R, S):\n return [(t, u) for t in R for u in S]\n\ndef project(R, p):\n return [p(t) for t in...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('medinad', 'medinad') police = repo.medinad.police neighborhoods = repo.medinad.neighbor def product(R, S): return [(t, u) for...
policeneighbors
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class policeneighbors: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythi...
stack_v2_sparse_classes_10k_train_001204
5,402
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_003213
Implement the Python class `policeneighbors` described below. Class description: Implement the policeneighbors class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=Non...
Implement the Python class `policeneighbors` described below. Class description: Implement the policeneighbors class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=Non...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class policeneighbors: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everythi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class policeneighbors: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('medinad', 'medinad') police...
the_stack_v2_python_sparse
jtbloom_rfballes_medinad/medinad/policeneighbors.py
ROODAY/course-2017-fal-proj
train
3
a28524f6dbeae83f1a9e2ccab6f5337877b53d81
[ "truck_sheet = TruckSheet.query.get_sheet_or_404(truck_sheet_id)\norder_sheet = OrderSheet.query.get_sheet_or_404(order_sheet_id)\nreturn Planning.query.get_or_404((truck_sheet.id, order_sheet.id))", "truck_sheet = TruckSheet.query.get_sheet_or_404(truck_sheet_id)\norder_sheet = OrderSheet.query.get_sheet_or_404(...
<|body_start_0|> truck_sheet = TruckSheet.query.get_sheet_or_404(truck_sheet_id) order_sheet = OrderSheet.query.get_sheet_or_404(order_sheet_id) return Planning.query.get_or_404((truck_sheet.id, order_sheet.id)) <|end_body_0|> <|body_start_1|> truck_sheet = TruckSheet.query.get_sheet_or...
PlanningByID
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PlanningByID: def get(self, truck_sheet_id, order_sheet_id): """Get a single planning. `Truck_sheet_id` and `order_sheet_id` can both be the primary key of the sheets, or `latest` to use the latest sheet. Roles required: View-only, planner, administrator""" <|body_0|> def po...
stack_v2_sparse_classes_10k_train_001205
3,651
permissive
[ { "docstring": "Get a single planning. `Truck_sheet_id` and `order_sheet_id` can both be the primary key of the sheets, or `latest` to use the latest sheet. Roles required: View-only, planner, administrator", "name": "get", "signature": "def get(self, truck_sheet_id, order_sheet_id)" }, { "docst...
2
stack_v2_sparse_classes_30k_train_003058
Implement the Python class `PlanningByID` described below. Class description: Implement the PlanningByID class. Method signatures and docstrings: - def get(self, truck_sheet_id, order_sheet_id): Get a single planning. `Truck_sheet_id` and `order_sheet_id` can both be the primary key of the sheets, or `latest` to use ...
Implement the Python class `PlanningByID` described below. Class description: Implement the PlanningByID class. Method signatures and docstrings: - def get(self, truck_sheet_id, order_sheet_id): Get a single planning. `Truck_sheet_id` and `order_sheet_id` can both be the primary key of the sheets, or `latest` to use ...
a74faa30139a7c32ce2b872544eb2fac588716cd
<|skeleton|> class PlanningByID: def get(self, truck_sheet_id, order_sheet_id): """Get a single planning. `Truck_sheet_id` and `order_sheet_id` can both be the primary key of the sheets, or `latest` to use the latest sheet. Roles required: View-only, planner, administrator""" <|body_0|> def po...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PlanningByID: def get(self, truck_sheet_id, order_sheet_id): """Get a single planning. `Truck_sheet_id` and `order_sheet_id` can both be the primary key of the sheets, or `latest` to use the latest sheet. Roles required: View-only, planner, administrator""" truck_sheet = TruckSheet.query.get_s...
the_stack_v2_python_sparse
backend/api/plannings/resources.py
Hori1234/otmdservices
train
0
5c20b2f84bb4c04d8a273c447b6eb80ceede38c0
[ "print('压缩 %s 到 %s' % (source_dir, target_jar))\nfilex.check_and_create_dir(target_jar)\ntranslation_file_list = []\nfor root, dirs, files in os.walk(source_dir):\n for file_name in files:\n path = root + '/' + file_name\n translation_file_list.append(path.replace(source_dir, '').replace('\\\\', '/...
<|body_start_0|> print('压缩 %s 到 %s' % (source_dir, target_jar)) filex.check_and_create_dir(target_jar) translation_file_list = [] for root, dirs, files in os.walk(source_dir): for file_name in files: path = root + '/' + file_name translation_fi...
ZipTools
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZipTools: def zip_jar(source_dir, target_jar, rename_cn=False, rename_tips=False): """压缩文件夹 :param source_dir: :param target_jar: :param rename_cn: 是否将 _zh_CN 重命名再压缩 :return:""" <|body_0|> def extra_file(zip_file_path, file_path, output, print_msg=True): """解压文件""" ...
stack_v2_sparse_classes_10k_train_001206
37,444
no_license
[ { "docstring": "压缩文件夹 :param source_dir: :param target_jar: :param rename_cn: 是否将 _zh_CN 重命名再压缩 :return:", "name": "zip_jar", "signature": "def zip_jar(source_dir, target_jar, rename_cn=False, rename_tips=False)" }, { "docstring": "解压文件", "name": "extra_file", "signature": "def extra_fil...
2
null
Implement the Python class `ZipTools` described below. Class description: Implement the ZipTools class. Method signatures and docstrings: - def zip_jar(source_dir, target_jar, rename_cn=False, rename_tips=False): 压缩文件夹 :param source_dir: :param target_jar: :param rename_cn: 是否将 _zh_CN 重命名再压缩 :return: - def extra_file...
Implement the Python class `ZipTools` described below. Class description: Implement the ZipTools class. Method signatures and docstrings: - def zip_jar(source_dir, target_jar, rename_cn=False, rename_tips=False): 压缩文件夹 :param source_dir: :param target_jar: :param rename_cn: 是否将 _zh_CN 重命名再压缩 :return: - def extra_file...
efea806d49f07d78e3db0390696778d4a7fc6c28
<|skeleton|> class ZipTools: def zip_jar(source_dir, target_jar, rename_cn=False, rename_tips=False): """压缩文件夹 :param source_dir: :param target_jar: :param rename_cn: 是否将 _zh_CN 重命名再压缩 :return:""" <|body_0|> def extra_file(zip_file_path, file_path, output, print_msg=True): """解压文件""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ZipTools: def zip_jar(source_dir, target_jar, rename_cn=False, rename_tips=False): """压缩文件夹 :param source_dir: :param target_jar: :param rename_cn: 是否将 _zh_CN 重命名再压缩 :return:""" print('压缩 %s 到 %s' % (source_dir, target_jar)) filex.check_and_create_dir(target_jar) translation_fi...
the_stack_v2_python_sparse
ToolsX/tool/android/android_studio_translator/jet_brains_translator/jet_brains_translator.py
JunLei-MI/PythonX
train
0
38842145fb4093a1e86ed8ef81538bde37835646
[ "if not language in ACCEPTED_LANGUAGES:\n raise ValueError(f'Language {language} is not supported yet')\nelif descriptive_indices is not None and descriptive_indices.language != language:\n raise ValueError(f'The descriptive indices analyzer must be of the same language as the word information analyzer.')\nse...
<|body_start_0|> if not language in ACCEPTED_LANGUAGES: raise ValueError(f'Language {language} is not supported yet') elif descriptive_indices is not None and descriptive_indices.language != language: raise ValueError(f'The descriptive indices analyzer must be of the same languag...
This class will handle all operations to find the readability indices of a text according to Coh-Metrix.
ReadabilityIndices
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadabilityIndices: """This class will handle all operations to find the readability indices of a text according to Coh-Metrix.""" def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> None: """The constructor will initialize this object that ca...
stack_v2_sparse_classes_10k_train_001207
3,373
no_license
[ { "docstring": "The constructor will initialize this object that calculates the readability indices for a specific language of those that are available. Parameters: nlp: The spacy model that corresponds to a language. language(str): The language that the texts to process will have. descriptive_indices(Descripti...
2
stack_v2_sparse_classes_30k_train_000363
Implement the Python class `ReadabilityIndices` described below. Class description: This class will handle all operations to find the readability indices of a text according to Coh-Metrix. Method signatures and docstrings: - def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> ...
Implement the Python class `ReadabilityIndices` described below. Class description: This class will handle all operations to find the readability indices of a text according to Coh-Metrix. Method signatures and docstrings: - def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> ...
f23342fbf2cb54a89cd381813ad9eee754b61094
<|skeleton|> class ReadabilityIndices: """This class will handle all operations to find the readability indices of a text according to Coh-Metrix.""" def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> None: """The constructor will initialize this object that ca...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ReadabilityIndices: """This class will handle all operations to find the readability indices of a text according to Coh-Metrix.""" def __init__(self, nlp, language: str='es', descriptive_indices: DescriptiveIndices=None) -> None: """The constructor will initialize this object that calculates the ...
the_stack_v2_python_sparse
src/processing/coh_metrix_indices/readability_indices.py
persuaide/Tesis_Chatbot
train
0
1437c9583dbb261184023f7ca5008c03ae81243e
[ "graph = build_graph_with_attrs(nodes_with_attrs=self.nodes, edges_with_attrs=self.edges)\ntested_pass = AddIsCyclicAttribute()\ntested_pass.find_and_replace_pattern(graph)\nassert graph.graph['is_cyclic'] is False", "graph = build_graph_with_attrs(nodes_with_attrs=self.nodes, edges_with_attrs=self.edges, new_edg...
<|body_start_0|> graph = build_graph_with_attrs(nodes_with_attrs=self.nodes, edges_with_attrs=self.edges) tested_pass = AddIsCyclicAttribute() tested_pass.find_and_replace_pattern(graph) assert graph.graph['is_cyclic'] is False <|end_body_0|> <|body_start_1|> graph = build_graph...
AddIsCyclicAttributeTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddIsCyclicAttributeTest: def test_1(self): """Acyclic case => graph.graph['is_cyclic'] should be False.""" <|body_0|> def test_2(self): """Cyclic case => graph.graph['is_cyclic'] should be True. :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001208
1,771
permissive
[ { "docstring": "Acyclic case => graph.graph['is_cyclic'] should be False.", "name": "test_1", "signature": "def test_1(self)" }, { "docstring": "Cyclic case => graph.graph['is_cyclic'] should be True. :return:", "name": "test_2", "signature": "def test_2(self)" } ]
2
stack_v2_sparse_classes_30k_train_003095
Implement the Python class `AddIsCyclicAttributeTest` described below. Class description: Implement the AddIsCyclicAttributeTest class. Method signatures and docstrings: - def test_1(self): Acyclic case => graph.graph['is_cyclic'] should be False. - def test_2(self): Cyclic case => graph.graph['is_cyclic'] should be ...
Implement the Python class `AddIsCyclicAttributeTest` described below. Class description: Implement the AddIsCyclicAttributeTest class. Method signatures and docstrings: - def test_1(self): Acyclic case => graph.graph['is_cyclic'] should be False. - def test_2(self): Cyclic case => graph.graph['is_cyclic'] should be ...
2e6c95f389b195f6d3ff8597147d1f817433cfb3
<|skeleton|> class AddIsCyclicAttributeTest: def test_1(self): """Acyclic case => graph.graph['is_cyclic'] should be False.""" <|body_0|> def test_2(self): """Cyclic case => graph.graph['is_cyclic'] should be True. :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddIsCyclicAttributeTest: def test_1(self): """Acyclic case => graph.graph['is_cyclic'] should be False.""" graph = build_graph_with_attrs(nodes_with_attrs=self.nodes, edges_with_attrs=self.edges) tested_pass = AddIsCyclicAttribute() tested_pass.find_and_replace_pattern(graph) ...
the_stack_v2_python_sparse
model-optimizer/extensions/middle/AddIsCyclicAttribute_test.py
0xF6/openvino
train
2
56d67561858ea517483ad47f76c4b85a1913e0ba
[ "ctx = super().get_panel_context(view, request, context)\nif isinstance(view, StockLocationDetail):\n ctx['location'] = view.get_object()\nreturn ctx", "panels = [{'title': 'No Content'}]\nif self.get_setting('ENABLE_HELLO_WORLD'):\n content = \"\\n <strong>Hello world!</strong>\\n <hr...
<|body_start_0|> ctx = super().get_panel_context(view, request, context) if isinstance(view, StockLocationDetail): ctx['location'] = view.get_object() return ctx <|end_body_0|> <|body_start_1|> panels = [{'title': 'No Content'}] if self.get_setting('ENABLE_HELLO_WORL...
A sample plugin which renders some custom panels.
CustomPanelSample
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomPanelSample: """A sample plugin which renders some custom panels.""" def get_panel_context(self, view, request, context): """Returns enriched context.""" <|body_0|> def get_custom_panels(self, view, request): """You can decide at run-time which custom panel...
stack_v2_sparse_classes_10k_train_001209
4,420
permissive
[ { "docstring": "Returns enriched context.", "name": "get_panel_context", "signature": "def get_panel_context(self, view, request, context)" }, { "docstring": "You can decide at run-time which custom panels you want to display! - Display on every page - Only on a single page or set of pages - Onl...
2
stack_v2_sparse_classes_30k_train_003845
Implement the Python class `CustomPanelSample` described below. Class description: A sample plugin which renders some custom panels. Method signatures and docstrings: - def get_panel_context(self, view, request, context): Returns enriched context. - def get_custom_panels(self, view, request): You can decide at run-ti...
Implement the Python class `CustomPanelSample` described below. Class description: A sample plugin which renders some custom panels. Method signatures and docstrings: - def get_panel_context(self, view, request, context): Returns enriched context. - def get_custom_panels(self, view, request): You can decide at run-ti...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class CustomPanelSample: """A sample plugin which renders some custom panels.""" def get_panel_context(self, view, request, context): """Returns enriched context.""" <|body_0|> def get_custom_panels(self, view, request): """You can decide at run-time which custom panel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CustomPanelSample: """A sample plugin which renders some custom panels.""" def get_panel_context(self, view, request, context): """Returns enriched context.""" ctx = super().get_panel_context(view, request, context) if isinstance(view, StockLocationDetail): ctx['locati...
the_stack_v2_python_sparse
InvenTree/plugin/samples/integration/custom_panel_sample.py
inventree/InvenTree
train
3,077
a97e4bcaa8292daec01217899686888da783db12
[ "params = kwarg['params']\ncmd = 'df '\nreturn cmd", "disk = []\nrecords = output.split('\\n')[1:]\nfor r in records:\n r = r.strip()\n if not r:\n continue\n tokens = r.split()\n filesystem = tokens.pop(0)\n size = int(tokens.pop(0))\n used = int(tokens.pop(0))\n available = int(token...
<|body_start_0|> params = kwarg['params'] cmd = 'df ' return cmd <|end_body_0|> <|body_start_1|> disk = [] records = output.split('\n')[1:] for r in records: r = r.strip() if not r: continue tokens = r.split() ...
Disk free inforamtion
LinuxDiskFreeImpl
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinuxDiskFreeImpl: """Disk free inforamtion""" def format_show(self, command, *argv, **kwarg): """> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/o...
stack_v2_sparse_classes_10k_train_001210
2,420
permissive
[ { "docstring": "> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/onl/boot /dev/sda2 120M 1.6M 110M 2% /mnt/onl/config tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.9M 3.9G 1% /run...
2
stack_v2_sparse_classes_30k_train_002673
Implement the Python class `LinuxDiskFreeImpl` described below. Class description: Disk free inforamtion Method signatures and docstrings: - def format_show(self, command, *argv, **kwarg): > df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 6...
Implement the Python class `LinuxDiskFreeImpl` described below. Class description: Disk free inforamtion Method signatures and docstrings: - def format_show(self, command, *argv, **kwarg): > df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 6...
e4c8221e18cd94e7424c30e12eb0fb82f7767267
<|skeleton|> class LinuxDiskFreeImpl: """Disk free inforamtion""" def format_show(self, command, *argv, **kwarg): """> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LinuxDiskFreeImpl: """Disk free inforamtion""" def format_show(self, command, *argv, **kwarg): """> df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.0M 0 1.0M 0% /dev /dev/sda4 24G 1.2G 22G 6% / /dev/sda3 976M 306M 603M 34% /mnt/onl/images /dev/sda1 123M 29M 89M 25% /mnt/onl/boot /dev/...
the_stack_v2_python_sparse
Amazon_Framework/DentOsTestbedLib/src/dent_os_testbed/lib/os/linux/linux_disk_free_impl.py
tld3daniel/testing
train
0
27a65d72eb227977ba2fc0414ff3462275cdb4b8
[ "self.estrutura = frame(frame=fram)\nself.e = self.estrutura\nself.size = size\nself.cor_dos_detalhes = c\nself.desenha_as_partes_do_bloco()", "s = self.size / 2\nfr, ns = (self.estrutura, (-s, s))\nconvex(pos=[(x, ht * z / self.size, y) for x in ns for y in ns for z in ns if x - y or x - s], color=self.cor_dos_d...
<|body_start_0|> self.estrutura = frame(frame=fram) self.e = self.estrutura self.size = size self.cor_dos_detalhes = c self.desenha_as_partes_do_bloco() <|end_body_0|> <|body_start_1|> s = self.size / 2 fr, ns = (self.estrutura, (-s, s)) convex(pos=[(x, h...
Esse eu fiz para vocês: um prisma triangular que representa um telhado
prism
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class prism: """Esse eu fiz para vocês: um prisma triangular que representa um telhado""" def __init__(self, fram=frame(), size=10.0, c=color.white): """ontogênese: assim que é criado, o bloco se desenha""" <|body_0|> def desenha_as_partes_do_bloco(self): """cria um ob...
stack_v2_sparse_classes_10k_train_001211
5,267
no_license
[ { "docstring": "ontogênese: assim que é criado, o bloco se desenha", "name": "__init__", "signature": "def __init__(self, fram=frame(), size=10.0, c=color.white)" }, { "docstring": "cria um objeto convexo que passa por seis pontos no espaço", "name": "desenha_as_partes_do_bloco", "signat...
2
stack_v2_sparse_classes_30k_train_000190
Implement the Python class `prism` described below. Class description: Esse eu fiz para vocês: um prisma triangular que representa um telhado Method signatures and docstrings: - def __init__(self, fram=frame(), size=10.0, c=color.white): ontogênese: assim que é criado, o bloco se desenha - def desenha_as_partes_do_bl...
Implement the Python class `prism` described below. Class description: Esse eu fiz para vocês: um prisma triangular que representa um telhado Method signatures and docstrings: - def __init__(self, fram=frame(), size=10.0, c=color.white): ontogênese: assim que é criado, o bloco se desenha - def desenha_as_partes_do_bl...
91a88b5a9b15f324a64afc18607a5d1d0a25c4d0
<|skeleton|> class prism: """Esse eu fiz para vocês: um prisma triangular que representa um telhado""" def __init__(self, fram=frame(), size=10.0, c=color.white): """ontogênese: assim que é criado, o bloco se desenha""" <|body_0|> def desenha_as_partes_do_bloco(self): """cria um ob...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class prism: """Esse eu fiz para vocês: um prisma triangular que representa um telhado""" def __init__(self, fram=frame(), size=10.0, c=color.white): """ontogênese: assim que é criado, o bloco se desenha""" self.estrutura = frame(frame=fram) self.e = self.estrutura self.size = s...
the_stack_v2_python_sparse
artwork/abrapa/abrapa.py
cetoli/labase-draft
train
0
957af1f455c3986a871f29441c61d050dc21fe4c
[ "try:\n account_id = resource_utils.get_account_id(request)\n if account_id is None:\n return resource_utils.account_required_response()\n if not authorized(account_id, jwt):\n return resource_utils.unauthorized_error_response(account_id)\n username = 'anonymous'\n user = User.find_by_j...
<|body_start_0|> try: account_id = resource_utils.get_account_id(request) if account_id is None: return resource_utils.account_required_response() if not authorized(account_id, jwt): return resource_utils.unauthorized_error_response(account_id)...
Resource for executing draft statements.
DraftResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DraftResource: """Resource for executing draft statements.""" def get(): """Get the list of draft statements belonging to the header account ID.""" <|body_0|> def post(): """Create a new draft statement.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001212
9,959
permissive
[ { "docstring": "Get the list of draft statements belonging to the header account ID.", "name": "get", "signature": "def get()" }, { "docstring": "Create a new draft statement.", "name": "post", "signature": "def post()" } ]
2
stack_v2_sparse_classes_30k_val_000223
Implement the Python class `DraftResource` described below. Class description: Resource for executing draft statements. Method signatures and docstrings: - def get(): Get the list of draft statements belonging to the header account ID. - def post(): Create a new draft statement.
Implement the Python class `DraftResource` described below. Class description: Resource for executing draft statements. Method signatures and docstrings: - def get(): Get the list of draft statements belonging to the header account ID. - def post(): Create a new draft statement. <|skeleton|> class DraftResource: ...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class DraftResource: """Resource for executing draft statements.""" def get(): """Get the list of draft statements belonging to the header account ID.""" <|body_0|> def post(): """Create a new draft statement.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DraftResource: """Resource for executing draft statements.""" def get(): """Get the list of draft statements belonging to the header account ID.""" try: account_id = resource_utils.get_account_id(request) if account_id is None: return resource_utils...
the_stack_v2_python_sparse
ppr-api/src/ppr_api/resources/drafts.py
bcgov/ppr
train
4
43879ca3aef1ae28c37716e2c2f4fd66486cf481
[ "\"\"\"找出所有的pair, 如果符合条件,计数器加1 O(n^2)\"\"\"\ncount = 0\nfor i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if abs(nums[i] - nums[j]) == k:\n count += 1\nreturn count", "\"\"\"\n 思路:如果k不等于零的话,那就是nums和nums数组每个数加k集合的交,如果k等于零的话,那就统计数组中相同的数字即可\n 区分开k=0的情况\n \...
<|body_start_0|> """找出所有的pair, 如果符合条件,计数器加1 O(n^2)""" count = 0 for i in range(len(nums)): for j in range(i + 1, len(nums)): if abs(nums[i] - nums[j]) == k: count += 1 return count <|end_body_0|> <|body_start_1|> """ ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPairs_simple(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def findPairs_map(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> def findPairs_pointer(self, nums, k): ...
stack_v2_sparse_classes_10k_train_001213
2,289
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "findPairs_simple", "signature": "def findPairs_simple(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "findPairs_map", "signature": "def findPairs_map(self, nums, k)" }...
3
stack_v2_sparse_classes_30k_train_004591
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPairs_simple(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def findPairs_map(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def findP...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPairs_simple(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def findPairs_map(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def findP...
a0f270c1adce25be11df92877813037f2e73e28b
<|skeleton|> class Solution: def findPairs_simple(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def findPairs_map(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> def findPairs_pointer(self, nums, k): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findPairs_simple(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" """找出所有的pair, 如果符合条件,计数器加1 O(n^2)""" count = 0 for i in range(len(nums)): for j in range(i + 1, len(nums)): if abs(nums[i] - nums[j]) == k: ...
the_stack_v2_python_sparse
leetcode/532_k_diff_pairs_in_an_array.py
lvraikkonen/GoodCode
train
0
394828d907cf0f2b3ee48f0e5351684adb771078
[ "assert bias.shape[0] == 4\nassert weight_hh.shape[0] == 4\nassert weight_hh.shape[1] == 1\nself.hidden_size: int = 1\nself.input_size: int = input_size\nself.bias: np.ndarray = bias\nself.weight_hh: np.ndarray = weight_hh\nself.weight_xh: np.ndarray = weight_xh\nself.hx: np.ndarray = np.asarray([])\nself.c: np.nda...
<|body_start_0|> assert bias.shape[0] == 4 assert weight_hh.shape[0] == 4 assert weight_hh.shape[1] == 1 self.hidden_size: int = 1 self.input_size: int = input_size self.bias: np.ndarray = bias self.weight_hh: np.ndarray = weight_hh self.weight_xh: np.ndar...
Custom implementation of the single LSTM-cell.
LSTMCell
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMCell: """Custom implementation of the single LSTM-cell.""" def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): """Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bia...
stack_v2_sparse_classes_10k_train_001214
2,345
permissive
[ { "docstring": "Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bias: Bias-vector from each of the internal nodes :param weight_hh: Weight-vector from hidden to hidden states :param weight_xh: Weight-vector from input to hidden states", "name...
2
stack_v2_sparse_classes_30k_test_000111
Implement the Python class `LSTMCell` described below. Class description: Custom implementation of the single LSTM-cell. Method signatures and docstrings: - def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): Create the LSTM-cell with the provided parameters. :param in...
Implement the Python class `LSTMCell` described below. Class description: Custom implementation of the single LSTM-cell. Method signatures and docstrings: - def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): Create the LSTM-cell with the provided parameters. :param in...
818a4ce941536611c0f1780f7c4a6238f0e1884e
<|skeleton|> class LSTMCell: """Custom implementation of the single LSTM-cell.""" def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): """Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bia...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LSTMCell: """Custom implementation of the single LSTM-cell.""" def __init__(self, input_size: int, bias: np.ndarray, weight_hh: np.ndarray, weight_xh: np.ndarray): """Create the LSTM-cell with the provided parameters. :param input_size: Number of inputs going into the cell :param bias: Bias-vecto...
the_stack_v2_python_sparse
population/utils/rnn_cell_util/lstm.py
RubenPants/EvolvableRNN
train
1
195615d77634f7bba2f28f8323e06311ab8d04a8
[ "super(Monitor, self).__init__(agent)\nself._baseagent += '_Monitor'\nself.update_delay = 0.5\nself.last_time = time.time() + 5\nself.history = {}", "self.render()\ns_time = env.get_current_time()\ns_date = s_time.split(' ')[0]\nd_position = {}\nfor s_symbol, instr in iter(self._instr_stack.items()):\n d_posit...
<|body_start_0|> super(Monitor, self).__init__(agent) self._baseagent += '_Monitor' self.update_delay = 0.5 self.last_time = time.time() + 5 self.history = {} <|end_body_0|> <|body_start_1|> self.render() s_time = env.get_current_time() s_date = s_time.sp...
Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization
Monitor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Monitor: """Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization""" def __init__(self, agent): """Initiate a Tester instance. Save all parameters as attributes :param agen...
stack_v2_sparse_classes_10k_train_001215
4,389
permissive
[ { "docstring": "Initiate a Tester instance. Save all parameters as attributes :param agent: Agent object.", "name": "__init__", "signature": "def __init__(self, agent)" }, { "docstring": "Flush all relevant monitor information :param env: Environment Object.", "name": "flush", "signature...
4
stack_v2_sparse_classes_30k_train_005537
Implement the Python class `Monitor` described below. Class description: Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization Method signatures and docstrings: - def __init__(self, agent): Initiate a Teste...
Implement the Python class `Monitor` described below. Class description: Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization Method signatures and docstrings: - def __init__(self, agent): Initiate a Teste...
2d52bdc46895e5659f4ffbc6ffa2629392ed4f9a
<|skeleton|> class Monitor: """Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization""" def __init__(self, agent): """Initiate a Tester instance. Save all parameters as attributes :param agen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Monitor: """Monitor is used to including new methods to the agent that are not used in production environment and render information to be used in an external data visualization""" def __init__(self, agent): """Initiate a Tester instance. Save all parameters as attributes :param agent: Agent obje...
the_stack_v2_python_sparse
gymV02/wrappers/monitoring.py
onesoftsa/neutrino-lab
train
8
07c94975c2840d4c2d2c22e8ec4ba0f112fba832
[ "assert first_available_dim < 0, first_available_dim\nself.next_available_dim = first_available_dim\nself.next_available_id = 0\nself.dim_to_id = {}", "id_ = self.next_available_id\nself.next_available_id += 1\ndim = self.next_available_dim\nif dim == -float('inf'):\n raise ValueError('max_plate_nesting must b...
<|body_start_0|> assert first_available_dim < 0, first_available_dim self.next_available_dim = first_available_dim self.next_available_id = 0 self.dim_to_id = {} <|end_body_0|> <|body_start_1|> id_ = self.next_available_id self.next_available_id += 1 dim = self.n...
Dimension allocator for internal use by :func:`~pyro.poutine.markov`. There is a single global instance. Note that dimensions are indexed from the right, e.g. -1, -2. Note that ids are simply nonnegative integers here.
_EnumAllocator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _EnumAllocator: """Dimension allocator for internal use by :func:`~pyro.poutine.markov`. There is a single global instance. Note that dimensions are indexed from the right, e.g. -1, -2. Note that ids are simply nonnegative integers here.""" def set_first_available_dim(self, first_available_d...
stack_v2_sparse_classes_10k_train_001216
10,402
permissive
[ { "docstring": "Set the first available dim, which should be to the left of all :class:`plate` dimensions, e.g. ``-1 - max_plate_nesting``. This should be called once per program. In SVI this should be called only once per (guide,model) pair.", "name": "set_first_available_dim", "signature": "def set_fi...
2
null
Implement the Python class `_EnumAllocator` described below. Class description: Dimension allocator for internal use by :func:`~pyro.poutine.markov`. There is a single global instance. Note that dimensions are indexed from the right, e.g. -1, -2. Note that ids are simply nonnegative integers here. Method signatures a...
Implement the Python class `_EnumAllocator` described below. Class description: Dimension allocator for internal use by :func:`~pyro.poutine.markov`. There is a single global instance. Note that dimensions are indexed from the right, e.g. -1, -2. Note that ids are simply nonnegative integers here. Method signatures a...
0e82cad30f75b892a07e6c9a5f9e24f2cb5d0d81
<|skeleton|> class _EnumAllocator: """Dimension allocator for internal use by :func:`~pyro.poutine.markov`. There is a single global instance. Note that dimensions are indexed from the right, e.g. -1, -2. Note that ids are simply nonnegative integers here.""" def set_first_available_dim(self, first_available_d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _EnumAllocator: """Dimension allocator for internal use by :func:`~pyro.poutine.markov`. There is a single global instance. Note that dimensions are indexed from the right, e.g. -1, -2. Note that ids are simply nonnegative integers here.""" def set_first_available_dim(self, first_available_dim): ...
the_stack_v2_python_sparse
pyro/poutine/runtime.py
pyro-ppl/pyro
train
3,647
3ceb2508bd521f24c76178c55d01e5a72ab9efb8
[ "if 'output' in results:\n self.data = P.YamboOutputParser(results['output'], verbose=verbose, extendOut=extendOut)\nelse:\n print('There are no o-* files in the %s dictionary. Please check...' % results)\nfor key, value in results.items():\n if key == 'dipoles':\n self.dipoles = P.YamboDipolesParse...
<|body_start_0|> if 'output' in results: self.data = P.YamboOutputParser(results['output'], verbose=verbose, extendOut=extendOut) else: print('There are no o-* files in the %s dictionary. Please check...' % results) for key, value in results.items(): if key ==...
Class that perform the parsing starting from the results :py:class:`dict` built by the :class:`YamboCalculator` class. In the actual implementation of the class the parser is able to deal with the o- files, the dipoles database, the ``ndb.RT_G_PAR`` and the ``ns.db1`` database written in the SAVE folder. Args: results ...
YamboParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YamboParser: """Class that perform the parsing starting from the results :py:class:`dict` built by the :class:`YamboCalculator` class. In the actual implementation of the class the parser is able to deal with the o- files, the dipoles database, the ``ndb.RT_G_PAR`` and the ``ns.db1`` database wri...
stack_v2_sparse_classes_10k_train_001217
4,923
permissive
[ { "docstring": "Initialize the data member of the class.", "name": "__init__", "signature": "def __init__(self, results, verbose=False, extendOut=True)" }, { "docstring": "Init the a :class:`YamboParser` instance using the 'o-' files found inside the outputPath, the ``ns.db1`` database in the SA...
3
stack_v2_sparse_classes_30k_train_006942
Implement the Python class `YamboParser` described below. Class description: Class that perform the parsing starting from the results :py:class:`dict` built by the :class:`YamboCalculator` class. In the actual implementation of the class the parser is able to deal with the o- files, the dipoles database, the ``ndb.RT_...
Implement the Python class `YamboParser` described below. Class description: Class that perform the parsing starting from the results :py:class:`dict` built by the :class:`YamboCalculator` class. In the actual implementation of the class the parser is able to deal with the o- files, the dipoles database, the ``ndb.RT_...
6ddac37ce8da1c7e1e0291cc5e49591a0e230389
<|skeleton|> class YamboParser: """Class that perform the parsing starting from the results :py:class:`dict` built by the :class:`YamboCalculator` class. In the actual implementation of the class the parser is able to deal with the o- files, the dipoles database, the ``ndb.RT_G_PAR`` and the ``ns.db1`` database wri...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YamboParser: """Class that perform the parsing starting from the results :py:class:`dict` built by the :class:`YamboCalculator` class. In the actual implementation of the class the parser is able to deal with the o- files, the dipoles database, the ``ndb.RT_G_PAR`` and the ``ns.db1`` database written in the S...
the_stack_v2_python_sparse
mppi/Parsers/YamboParser.py
marcodalessandro76/MPPI
train
1
1404d761efab744c4f0a44dacc0f55e9ff39dd05
[ "if kwargs.get('units', None):\n kwargs['units'] = UNITS[kwargs['units']]\nsuper(IPerfParser, self).__init__(*args, **kwargs)\nself.format = iperfexpressions.ParserKeys.human", "results = []\nfor line in output.splitlines():\n match = self.search(line)\n if match:\n start = float(match[iperfexpres...
<|body_start_0|> if kwargs.get('units', None): kwargs['units'] = UNITS[kwargs['units']] super(IPerfParser, self).__init__(*args, **kwargs) self.format = iperfexpressions.ParserKeys.human <|end_body_0|> <|body_start_1|> results = [] for line in output.splitlines(): ...
Class for parsing Iperf output.
IPerfParser
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPerfParser: """Class for parsing Iperf output.""" def __init__(self, *args, **kwargs): """Initialize IPerfParser class.""" <|body_0|> def parse(self, output): """Parse output from iperf execution. Args: output(str): iperf output Returns: list: list of parsed ipe...
stack_v2_sparse_classes_10k_train_001218
4,769
permissive
[ { "docstring": "Initialize IPerfParser class.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Parse output from iperf execution. Args: output(str): iperf output Returns: list: list of parsed iperf results", "name": "parse", "signature": "def pa...
2
stack_v2_sparse_classes_30k_train_000385
Implement the Python class `IPerfParser` described below. Class description: Class for parsing Iperf output. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize IPerfParser class. - def parse(self, output): Parse output from iperf execution. Args: output(str): iperf output Returns: lis...
Implement the Python class `IPerfParser` described below. Class description: Class for parsing Iperf output. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Initialize IPerfParser class. - def parse(self, output): Parse output from iperf execution. Args: output(str): iperf output Returns: lis...
2007bf3fe66edfe704e485141c55caed54fe13aa
<|skeleton|> class IPerfParser: """Class for parsing Iperf output.""" def __init__(self, *args, **kwargs): """Initialize IPerfParser class.""" <|body_0|> def parse(self, output): """Parse output from iperf execution. Args: output(str): iperf output Returns: list: list of parsed ipe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IPerfParser: """Class for parsing Iperf output.""" def __init__(self, *args, **kwargs): """Initialize IPerfParser class.""" if kwargs.get('units', None): kwargs['units'] = UNITS[kwargs['units']] super(IPerfParser, self).__init__(*args, **kwargs) self.format = i...
the_stack_v2_python_sparse
taf/testlib/linux/iperf/iperf.py
AndriyZabavskyy/taf
train
0
4e5482a04ac19e211e8a7243b39d011b11e367f1
[ "nginx_conf = self.GenerateNginxConfig(umpire_config, env)\nif not nginx_conf:\n return []\nproc_config = {'executable': HTTP_BIN, 'name': HTTP_SERVICE_NAME, 'args': ['-c', nginx_conf], 'path': '/tmp'}\nproc = umpire_service.ServiceProcess(self)\nproc.SetConfig(proc_config)\nreturn [proc]", "if 'services' not ...
<|body_start_0|> nginx_conf = self.GenerateNginxConfig(umpire_config, env) if not nginx_conf: return [] proc_config = {'executable': HTTP_BIN, 'name': HTTP_SERVICE_NAME, 'args': ['-c', nginx_conf], 'path': '/tmp'} proc = umpire_service.ServiceProcess(self) proc.SetCon...
HTTP service. Example: svc = SimpleService() procs = svc.CreateProcesses(umpire_config_dict) svc.Start(procs)
HTTPService
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTTPService: """HTTP service. Example: svc = SimpleService() procs = svc.CreateProcesses(umpire_config_dict) svc.Start(procs)""" def CreateProcesses(self, umpire_config, env): """Creates list of processes via config. Args: umpire_config: Umpire config dict. env: UmpireEnv object. Ret...
stack_v2_sparse_classes_10k_train_001219
6,432
permissive
[ { "docstring": "Creates list of processes via config. Args: umpire_config: Umpire config dict. env: UmpireEnv object. Returns: A list of ServiceProcess.", "name": "CreateProcesses", "signature": "def CreateProcesses(self, umpire_config, env)" }, { "docstring": "Generates a nginx config. Args: um...
3
stack_v2_sparse_classes_30k_train_000791
Implement the Python class `HTTPService` described below. Class description: HTTP service. Example: svc = SimpleService() procs = svc.CreateProcesses(umpire_config_dict) svc.Start(procs) Method signatures and docstrings: - def CreateProcesses(self, umpire_config, env): Creates list of processes via config. Args: umpi...
Implement the Python class `HTTPService` described below. Class description: HTTP service. Example: svc = SimpleService() procs = svc.CreateProcesses(umpire_config_dict) svc.Start(procs) Method signatures and docstrings: - def CreateProcesses(self, umpire_config, env): Creates list of processes via config. Args: umpi...
a1b0fccd68987d8cd9c89710adc3c04b868347ec
<|skeleton|> class HTTPService: """HTTP service. Example: svc = SimpleService() procs = svc.CreateProcesses(umpire_config_dict) svc.Start(procs)""" def CreateProcesses(self, umpire_config, env): """Creates list of processes via config. Args: umpire_config: Umpire config dict. env: UmpireEnv object. Ret...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HTTPService: """HTTP service. Example: svc = SimpleService() procs = svc.CreateProcesses(umpire_config_dict) svc.Start(procs)""" def CreateProcesses(self, umpire_config, env): """Creates list of processes via config. Args: umpire_config: Umpire config dict. env: UmpireEnv object. Returns: A list ...
the_stack_v2_python_sparse
py/umpire/server/service/umpire_http.py
bridder/factory
train
0
55a7236e91d68b4fea2ab75fa0ca764aeff6c166
[ "self.audio_type = audio_type\nself.audio_format = audio_format\nif audio_type in SERIALIZABLE_AUDIO_TYPES:\n self.audio = raw_data if isinstance(raw_data, io.BytesIO) else io.BytesIO(raw_data)\n self.duration = read_duration(audio_type, self.audio)\nelse:\n self.audio = raw_data\n if self.audio_format ...
<|body_start_0|> self.audio_type = audio_type self.audio_format = audio_format if audio_type in SERIALIZABLE_AUDIO_TYPES: self.audio = raw_data if isinstance(raw_data, io.BytesIO) else io.BytesIO(raw_data) self.duration = read_duration(audio_type, self.audio) else...
Represents in-memory audio data of a certain (convertible) representation. Attributes: audio_type (str): See `__init__`. audio_format (tuple:(int, int, int)): See `__init__`. audio (obj): Audio data represented as indicated by `audio_type` duration (float): Audio duration of the sample in seconds
Sample
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-4.0", "CC-BY-SA-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sample: """Represents in-memory audio data of a certain (convertible) representation. Attributes: audio_type (str): See `__init__`. audio_format (tuple:(int, int, int)): See `__init__`. audio (obj): Audio data represented as indicated by `audio_type` duration (float): Audio duration of the sample...
stack_v2_sparse_classes_10k_train_001220
15,981
permissive
[ { "docstring": "Creates a Sample from a raw audio representation. :param audio_type: Audio data representation type CSupported types: - AUDIO_TYPE_OPUS: Memory file representation (BytesIO) of Opus encoded audio wrapped by a custom container format (used in SDBs) - AUDIO_TYPE_WAV: Memory file representation (By...
2
stack_v2_sparse_classes_30k_train_001094
Implement the Python class `Sample` described below. Class description: Represents in-memory audio data of a certain (convertible) representation. Attributes: audio_type (str): See `__init__`. audio_format (tuple:(int, int, int)): See `__init__`. audio (obj): Audio data represented as indicated by `audio_type` duratio...
Implement the Python class `Sample` described below. Class description: Represents in-memory audio data of a certain (convertible) representation. Attributes: audio_type (str): See `__init__`. audio_format (tuple:(int, int, int)): See `__init__`. audio (obj): Audio data represented as indicated by `audio_type` duratio...
93c4a42c95cd610c76dbd98de480dbb21f484c31
<|skeleton|> class Sample: """Represents in-memory audio data of a certain (convertible) representation. Attributes: audio_type (str): See `__init__`. audio_format (tuple:(int, int, int)): See `__init__`. audio (obj): Audio data represented as indicated by `audio_type` duration (float): Audio duration of the sample...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Sample: """Represents in-memory audio data of a certain (convertible) representation. Attributes: audio_type (str): See `__init__`. audio_format (tuple:(int, int, int)): See `__init__`. audio (obj): Audio data represented as indicated by `audio_type` duration (float): Audio duration of the sample in seconds""...
the_stack_v2_python_sparse
galvasr2/align/audio.py
Ciroye/peoples-speech
train
0
171aff9e6483768a821a2bfa7a0eceafcb83882d
[ "if n <= 0:\n raise ValueError('n must be a positive value')\nif p < 0 or p > 1:\n raise ValueError('p must be greater than 0 and less than 1')\nself.n = int(n)\nself.p = float(p)\nif data is None:\n self.n = self.n\n self.p = self.p\nelse:\n if type(data) is not list:\n raise TypeError('data ...
<|body_start_0|> if n <= 0: raise ValueError('n must be a positive value') if p < 0 or p > 1: raise ValueError('p must be greater than 0 and less than 1') self.n = int(n) self.p = float(p) if data is None: self.n = self.n self.p = s...
represents a binomial distribution
Binomial
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Binomial: """represents a binomial distribution""" def __init__(self, data=None, n=1, p=0.5): """Binomial contructor""" <|body_0|> def pmf(self, k): """Calculates the value of the PMF for a given number""" <|body_1|> def cdf(self, k): """Calc...
stack_v2_sparse_classes_10k_train_001221
1,886
no_license
[ { "docstring": "Binomial contructor", "name": "__init__", "signature": "def __init__(self, data=None, n=1, p=0.5)" }, { "docstring": "Calculates the value of the PMF for a given number", "name": "pmf", "signature": "def pmf(self, k)" }, { "docstring": "Calculates the value of the...
3
stack_v2_sparse_classes_30k_train_002294
Implement the Python class `Binomial` described below. Class description: represents a binomial distribution Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Binomial contructor - def pmf(self, k): Calculates the value of the PMF for a given number - def cdf(self, k): Calculates the valu...
Implement the Python class `Binomial` described below. Class description: represents a binomial distribution Method signatures and docstrings: - def __init__(self, data=None, n=1, p=0.5): Binomial contructor - def pmf(self, k): Calculates the value of the PMF for a given number - def cdf(self, k): Calculates the valu...
4adb0b69ab12ebeec08b1cf603e5c738378f6806
<|skeleton|> class Binomial: """represents a binomial distribution""" def __init__(self, data=None, n=1, p=0.5): """Binomial contructor""" <|body_0|> def pmf(self, k): """Calculates the value of the PMF for a given number""" <|body_1|> def cdf(self, k): """Calc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Binomial: """represents a binomial distribution""" def __init__(self, data=None, n=1, p=0.5): """Binomial contructor""" if n <= 0: raise ValueError('n must be a positive value') if p < 0 or p > 1: raise ValueError('p must be greater than 0 and less than 1')...
the_stack_v2_python_sparse
math/0x03-probability/binomial.py
Jdavp/holbertonschool-machine_learning
train
0
9952f694bb8ef912ef3ce1c4e089c40a803fd9f5
[ "Parametre.__init__(self, 'voir', 'view')\nself.schema = '<cle>'\nself.aide_courte = \"affiche le détail d'un cap\"\nself.aide_longue = \"Cette commande permet d'obtenir plus d'informations sur un cap maritime : son point de départ, ses points intermédiaires et son point d'arrivée.\"", "cle = dic_masques['cle'].c...
<|body_start_0|> Parametre.__init__(self, 'voir', 'view') self.schema = '<cle>' self.aide_courte = "affiche le détail d'un cap" self.aide_longue = "Cette commande permet d'obtenir plus d'informations sur un cap maritime : son point de départ, ses points intermédiaires et son point d'arri...
Commande 'cap voir'.
PrmVoir
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmVoir: """Commande 'cap voir'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre.__init__(...
stack_v2_sparse_classes_10k_train_001222
3,921
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmVoir` described below. Class description: Commande 'cap voir'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmVoir` described below. Class description: Commande 'cap voir'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmVoir: """Commande 'cap voir'.""" ...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmVoir: """Commande 'cap voir'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PrmVoir: """Commande 'cap voir'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'voir', 'view') self.schema = '<cle>' self.aide_courte = "affiche le détail d'un cap" self.aide_longue = "Cette commande permet d'obtenir plus d'informa...
the_stack_v2_python_sparse
src/secondaires/navigation/commandes/cap/voir.py
vincent-lg/tsunami
train
5
031c1d960d11127c13f1f2bc7b4f5bf4f6917765
[ "super(Network, self).__init__()\nself.seed = torch.manual_seed(seed)\n'*** YOUR CODE HERE ***'\nfeature_size = 64\nself.feature_layer = nn.Sequential(nn.Linear(state_size, feature_size), nn.ReLU())\nvalue_size = 64\nself.value_layer = nn.Sequential(nn.Linear(feature_size, value_size), nn.ReLU(), nn.Linear(value_si...
<|body_start_0|> super(Network, self).__init__() self.seed = torch.manual_seed(seed) '*** YOUR CODE HERE ***' feature_size = 64 self.feature_layer = nn.Sequential(nn.Linear(state_size, feature_size), nn.ReLU()) value_size = 64 self.value_layer = nn.Sequential(nn.L...
Actor (Policy) Model.
Network
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Network: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" <|body_0|> def...
stack_v2_sparse_classes_10k_train_001223
1,441
permissive
[ { "docstring": "Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed", "name": "__init__", "signature": "def __init__(self, state_size, action_size, seed)" }, { "docstring": "Build a net...
2
stack_v2_sparse_classes_30k_train_000418
Implement the Python class `Network` described below. Class description: Actor (Policy) Model. Method signatures and docstrings: - def __init__(self, state_size, action_size, seed): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each acti...
Implement the Python class `Network` described below. Class description: Actor (Policy) Model. Method signatures and docstrings: - def __init__(self, state_size, action_size, seed): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each acti...
9b1653b7aedeb4dc0e4aab9351cc4a7f4ccb4f32
<|skeleton|> class Network: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" <|body_0|> def...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Network: """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed""" super(Network, self).__init__() ...
the_stack_v2_python_sparse
p1_navigation/dueling_network.py
weicheng113/deep-reinforcement-learning
train
0
ad0d27e392f0368fbf41bf4a4c80c9d7d7917a9c
[ "if not nums:\n return 0\nsums = [0] * len(nums)\nsums[0] = nums[0]\nres = sums[0]\nfor i in range(1, len(nums)):\n sums[i] = sums[i - 1] + nums[i] if sums[i - 1] > 0 else nums[i]\n res = max(sums[i], res)\nreturn res", "localMaxSum, globalMaxSum = (nums[0], nums[0])\nfor i in range(1, len(nums)):\n l...
<|body_start_0|> if not nums: return 0 sums = [0] * len(nums) sums[0] = nums[0] res = sums[0] for i in range(1, len(nums)): sums[i] = sums[i - 1] + nums[i] if sums[i - 1] > 0 else nums[i] res = max(sums[i], res) return res <|end_body_0|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 su...
stack_v2_sparse_classes_10k_train_001224
1,509
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007176
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSubArra...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 sums = [0] * len(nums) sums[0] = nums[0] res = sums[0] for i in range(1, len(nums)): sums[i] = sums[i - 1] + nums[i] if sums[i - 1] > 0 e...
the_stack_v2_python_sparse
M/MaximumSubarray.py
bssrdf/pyleet
train
2
2fa1d40dd1b9ac75816c7b9fd3aaab5657ace752
[ "super().__init__()\nself.visual = visual\nself.hidden = hidden\nself.n_layers = n_layers\nself.attn_heads = attn_heads\nself.feed_forward_hidden = hidden * 2\nself.token_embedding = TokenEmbedding(vocab_size=vocab_size, embed_size=hidden)\nself.relation_embedding = RelationEmbedding(hidden, max_relative_1d_positio...
<|body_start_0|> super().__init__() self.visual = visual self.hidden = hidden self.n_layers = n_layers self.attn_heads = attn_heads self.feed_forward_hidden = hidden * 2 self.token_embedding = TokenEmbedding(vocab_size=vocab_size, embed_size=hidden) self.r...
Language Model for proteins
ProEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProEncoder: """Language Model for proteins""" def __init__(self, vocab_size, hidden=512, n_layers=5, attn_heads=1, dropout=0.0, max_relative_1d_positions=300, visual=False): """:param vocab_size: vocab_size of total words :param hidden: BERT model hidden size :param n_layers: numbers...
stack_v2_sparse_classes_10k_train_001225
9,053
no_license
[ { "docstring": ":param vocab_size: vocab_size of total words :param hidden: BERT model hidden size :param n_layers: numbers of Transformer blocks(layers) :param attn_heads: number of attention heads :param dropout: dropout rate", "name": "__init__", "signature": "def __init__(self, vocab_size, hidden=51...
2
stack_v2_sparse_classes_30k_train_004328
Implement the Python class `ProEncoder` described below. Class description: Language Model for proteins Method signatures and docstrings: - def __init__(self, vocab_size, hidden=512, n_layers=5, attn_heads=1, dropout=0.0, max_relative_1d_positions=300, visual=False): :param vocab_size: vocab_size of total words :para...
Implement the Python class `ProEncoder` described below. Class description: Language Model for proteins Method signatures and docstrings: - def __init__(self, vocab_size, hidden=512, n_layers=5, attn_heads=1, dropout=0.0, max_relative_1d_positions=300, visual=False): :param vocab_size: vocab_size of total words :para...
51b03ad1426794704027e0bc6658aae5d55a6e90
<|skeleton|> class ProEncoder: """Language Model for proteins""" def __init__(self, vocab_size, hidden=512, n_layers=5, attn_heads=1, dropout=0.0, max_relative_1d_positions=300, visual=False): """:param vocab_size: vocab_size of total words :param hidden: BERT model hidden size :param n_layers: numbers...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ProEncoder: """Language Model for proteins""" def __init__(self, vocab_size, hidden=512, n_layers=5, attn_heads=1, dropout=0.0, max_relative_1d_positions=300, visual=False): """:param vocab_size: vocab_size of total words :param hidden: BERT model hidden size :param n_layers: numbers of Transform...
the_stack_v2_python_sparse
model/prolm_relative.py
lahplover/unippi
train
1
2704c06c675e5399e382153e58b1c61b38180c88
[ "self.sleeptime = sleep_param\nself.looplimit = looplimit\nself.temperatureTask = TempSensorEmulatorTask.TempSensorEmulator()", "i = 0\nif self.sleeptime < 0 or self.looplimit < 0:\n logging.error('looplimit or sleeptime is less than 0')\n return False\nif self.enableTempEmulatorAdapter == True:\n while ...
<|body_start_0|> self.sleeptime = sleep_param self.looplimit = looplimit self.temperatureTask = TempSensorEmulatorTask.TempSensorEmulator() <|end_body_0|> <|body_start_1|> i = 0 if self.sleeptime < 0 or self.looplimit < 0: logging.error('looplimit or sleeptime is les...
This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations
TempEmulatorAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempEmulatorAdapter: """This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations""" def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault): """Constructor which sets...
stack_v2_sparse_classes_10k_train_001226
1,894
no_license
[ { "docstring": "Constructor which sets the sleep timer for the thread, and a looplimit if needed.", "name": "__init__", "signature": "def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault)" }, { "docstring": "This method runs the emulation if enableTempEmulatorAdapter is set to True...
2
stack_v2_sparse_classes_30k_train_006419
Implement the Python class `TempEmulatorAdapter` described below. Class description: This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations Method signatures and docstrings: - def __init__(self, sleep_param=sle...
Implement the Python class `TempEmulatorAdapter` described below. Class description: This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations Method signatures and docstrings: - def __init__(self, sleep_param=sle...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class TempEmulatorAdapter: """This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations""" def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault): """Constructor which sets...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TempEmulatorAdapter: """This class is responsible for running the temperature generation emulator Has inputs like the sleeptimer and looplimit so we can control the running of iterations""" def __init__(self, sleep_param=sleepDefault, looplimit=loopDefault): """Constructor which sets the sleep ti...
the_stack_v2_python_sparse
apps/labs/module02/TempEmulatorAdapter.py
mnk400/iot-device
train
0
88d165f5fc315b95204ac15beefffaee1f79a6dd
[ "collateral = {'collateralId': self.id, 'addedDateTime': ''}\nif self.status and self.status == STATUS_ADDED:\n collateral['descriptionAdd'] = self.description\nelif self.status and self.status == STATUS_DELETED:\n collateral['descriptionDelete'] = self.description\nelse:\n collateral['description'] = self...
<|body_start_0|> collateral = {'collateralId': self.id, 'addedDateTime': ''} if self.status and self.status == STATUS_ADDED: collateral['descriptionAdd'] = self.description elif self.status and self.status == STATUS_DELETED: collateral['descriptionDelete'] = self.descript...
This class manages all of the legacy application general collateral information.
GeneralCollateralLegacy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralCollateralLegacy: """This class manages all of the legacy application general collateral information.""" def current_json(self) -> dict: """Generate a Financing Statement current view of the general collateral as json/dict.""" <|body_0|> def json(self) -> dict: ...
stack_v2_sparse_classes_10k_train_001227
4,718
permissive
[ { "docstring": "Generate a Financing Statement current view of the general collateral as json/dict.", "name": "current_json", "signature": "def current_json(self) -> dict" }, { "docstring": "Generate the default view of the general collateral as json/a dict.", "name": "json", "signature"...
5
stack_v2_sparse_classes_30k_train_004467
Implement the Python class `GeneralCollateralLegacy` described below. Class description: This class manages all of the legacy application general collateral information. Method signatures and docstrings: - def current_json(self) -> dict: Generate a Financing Statement current view of the general collateral as json/di...
Implement the Python class `GeneralCollateralLegacy` described below. Class description: This class manages all of the legacy application general collateral information. Method signatures and docstrings: - def current_json(self) -> dict: Generate a Financing Statement current view of the general collateral as json/di...
af1a4458bb78c16ecca484514d4bd0d1d8c24b5d
<|skeleton|> class GeneralCollateralLegacy: """This class manages all of the legacy application general collateral information.""" def current_json(self) -> dict: """Generate a Financing Statement current view of the general collateral as json/dict.""" <|body_0|> def json(self) -> dict: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeneralCollateralLegacy: """This class manages all of the legacy application general collateral information.""" def current_json(self) -> dict: """Generate a Financing Statement current view of the general collateral as json/dict.""" collateral = {'collateralId': self.id, 'addedDateTime':...
the_stack_v2_python_sparse
ppr-api/src/ppr_api/models/general_collateral_legacy.py
bcgov/ppr
train
4
595216bae5a4661f03cce2a802de9cd329219ad5
[ "super(AddFlyerDatesForm, self).__init__(*args, **kwargs)\nif checked_data:\n self.fields['subdivision_consumer_count'].initial = checked_data.get('subdivision_consumer_count', 0)\nelse:\n self.fields['subdivision_consumer_count'].initial = subdivision_consumer_count\nfor flyer_month in available_flyer_dates_...
<|body_start_0|> super(AddFlyerDatesForm, self).__init__(*args, **kwargs) if checked_data: self.fields['subdivision_consumer_count'].initial = checked_data.get('subdivision_consumer_count', 0) else: self.fields['subdivision_consumer_count'].initial = subdivision_consumer_...
The Add Flyer Dates Form.
AddFlyerDatesForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddFlyerDatesForm: """The Add Flyer Dates Form.""" def __init__(self, available_flyer_dates_list, subdivision_consumer_count=None, checked_data=None, *args, **kwargs): """Dynamically create 10 sets of location fields.""" <|body_0|> def clean_dynamic_fields(self, post_dat...
stack_v2_sparse_classes_10k_train_001228
27,686
no_license
[ { "docstring": "Dynamically create 10 sets of location fields.", "name": "__init__", "signature": "def __init__(self, available_flyer_dates_list, subdivision_consumer_count=None, checked_data=None, *args, **kwargs)" }, { "docstring": "Clean method for this form.", "name": "clean_dynamic_fiel...
3
null
Implement the Python class `AddFlyerDatesForm` described below. Class description: The Add Flyer Dates Form. Method signatures and docstrings: - def __init__(self, available_flyer_dates_list, subdivision_consumer_count=None, checked_data=None, *args, **kwargs): Dynamically create 10 sets of location fields. - def cle...
Implement the Python class `AddFlyerDatesForm` described below. Class description: The Add Flyer Dates Form. Method signatures and docstrings: - def __init__(self, available_flyer_dates_list, subdivision_consumer_count=None, checked_data=None, *args, **kwargs): Dynamically create 10 sets of location fields. - def cle...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class AddFlyerDatesForm: """The Add Flyer Dates Form.""" def __init__(self, available_flyer_dates_list, subdivision_consumer_count=None, checked_data=None, *args, **kwargs): """Dynamically create 10 sets of location fields.""" <|body_0|> def clean_dynamic_fields(self, post_dat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddFlyerDatesForm: """The Add Flyer Dates Form.""" def __init__(self, available_flyer_dates_list, subdivision_consumer_count=None, checked_data=None, *args, **kwargs): """Dynamically create 10 sets of location fields.""" super(AddFlyerDatesForm, self).__init__(*args, **kwargs) if ...
the_stack_v2_python_sparse
coupon/forms.py
wcirillo/ten
train
0
cb9fe1aa66539a3e7f70b36de15de47f2ed19484
[ "minutes_spent = previous_request_time.total_minutes()\nif minutes_spent == 0:\n self._current_range = self.DEFAULT_RANGE_DAYS\nelse:\n days_per_minute = self._current_range / minutes_spent\n next_range = math.floor(days_per_minute / self.REQUEST_PER_MINUTE_LIMIT)\n self._current_range = min(next_range ...
<|body_start_0|> minutes_spent = previous_request_time.total_minutes() if minutes_spent == 0: self._current_range = self.DEFAULT_RANGE_DAYS else: days_per_minute = self._current_range / minutes_spent next_range = math.floor(days_per_minute / self.REQUEST_PER_M...
Generate slices from start_date up to current date. Every next slice could have different range based on was the previous slice processed successfully and how much time it took. The alghorithm is following: 1. First slice have INITIAL_RANGE_DAYS (30 days) length. 2. When slice is processed by stream this class expect "...
AdjustableSliceGenerator
[ "MIT", "Elastic-2.0", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdjustableSliceGenerator: """Generate slices from start_date up to current date. Every next slice could have different range based on was the previous slice processed successfully and how much time it took. The alghorithm is following: 1. First slice have INITIAL_RANGE_DAYS (30 days) length. 2. W...
stack_v2_sparse_classes_10k_train_001229
6,343
permissive
[ { "docstring": "Calculate next slice length in days based on previous slice length and processing time.", "name": "adjust_range", "signature": "def adjust_range(self, previous_request_time: Period)" }, { "docstring": "This method is supposed to be called when slice processing failed. Reset next ...
3
stack_v2_sparse_classes_30k_train_002562
Implement the Python class `AdjustableSliceGenerator` described below. Class description: Generate slices from start_date up to current date. Every next slice could have different range based on was the previous slice processed successfully and how much time it took. The alghorithm is following: 1. First slice have IN...
Implement the Python class `AdjustableSliceGenerator` described below. Class description: Generate slices from start_date up to current date. Every next slice could have different range based on was the previous slice processed successfully and how much time it took. The alghorithm is following: 1. First slice have IN...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class AdjustableSliceGenerator: """Generate slices from start_date up to current date. Every next slice could have different range based on was the previous slice processed successfully and how much time it took. The alghorithm is following: 1. First slice have INITIAL_RANGE_DAYS (30 days) length. 2. W...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AdjustableSliceGenerator: """Generate slices from start_date up to current date. Every next slice could have different range based on was the previous slice processed successfully and how much time it took. The alghorithm is following: 1. First slice have INITIAL_RANGE_DAYS (30 days) length. 2. When slice is ...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/source-iterable/source_iterable/slice_generators.py
alldatacenter/alldata
train
774
40d4c959dfab70ff3362e055e620a0eaa5c21411
[ "if do_generate:\n self.game_map = self.generate(size)\nelse:\n self.game_map = []", "trap_count = int(size ** 2 / RATIO_TRAPS)\ntreasure_count = int(size ** 2 / RATIO_TREASURE)\nif trap_count <= 0:\n raise MapInitError('Error initializing trap count. Try larger map size.')\nif treasure_count < config.PL...
<|body_start_0|> if do_generate: self.game_map = self.generate(size) else: self.game_map = [] <|end_body_0|> <|body_start_1|> trap_count = int(size ** 2 / RATIO_TRAPS) treasure_count = int(size ** 2 / RATIO_TREASURE) if trap_count <= 0: raise ...
DungeonMap
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DungeonMap: def __init__(self, size, do_generate=True): """Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation""" <|body_0|> def generate(self, size): """Generates map for Dungeon Game :param size: Map square size ...
stack_v2_sparse_classes_10k_train_001230
5,735
permissive
[ { "docstring": "Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation", "name": "__init__", "signature": "def __init__(self, size, do_generate=True)" }, { "docstring": "Generates map for Dungeon Game :param size: Map square size :return: None", ...
6
stack_v2_sparse_classes_30k_train_002082
Implement the Python class `DungeonMap` described below. Class description: Implement the DungeonMap class. Method signatures and docstrings: - def __init__(self, size, do_generate=True): Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation - def generate(self, size...
Implement the Python class `DungeonMap` described below. Class description: Implement the DungeonMap class. Method signatures and docstrings: - def __init__(self, size, do_generate=True): Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation - def generate(self, size...
291592e97b6d8fe9f9e6627dc0023875918d3463
<|skeleton|> class DungeonMap: def __init__(self, size, do_generate=True): """Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation""" <|body_0|> def generate(self, size): """Generates map for Dungeon Game :param size: Map square size ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DungeonMap: def __init__(self, size, do_generate=True): """Class constructor :param size: Generated map size :param do_generate: Whether to initiate map generation""" if do_generate: self.game_map = self.generate(size) else: self.game_map = [] def generate(...
the_stack_v2_python_sparse
Kyrylo_Yeremenko/10/dungeon_game/dungeon_map.py
SmischenkoB/campus_2018_python
train
0
c7d4d9c555f6a4d6ea6c1d92f47256ba6f4e935d
[ "self.mode = mode\nself.ids_rulesets = ids_rulesets\nself.protected_networks = protected_networks", "if dictionary is None:\n return None\nmode = dictionary.get('mode')\nids_rulesets = dictionary.get('idsRulesets')\nprotected_networks = meraki_sdk.models.protected_networks_model.ProtectedNetworksModel.from_dic...
<|body_start_0|> self.mode = mode self.ids_rulesets = ids_rulesets self.protected_networks = protected_networks <|end_body_0|> <|body_start_1|> if dictionary is None: return None mode = dictionary.get('mode') ids_rulesets = dictionary.get('idsRulesets') ...
Implementation of the 'updateNetworkSecurityIntrusionSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'disabled'/'detection'/'prevention' (optional - omitting will leave current config unchanged) ids_rulesets (string): Set the detection ruleset 'connectivity'/'balanced'/'securi...
UpdateNetworkSecurityIntrusionSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSecurityIntrusionSettingsModel: """Implementation of the 'updateNetworkSecurityIntrusionSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'disabled'/'detection'/'prevention' (optional - omitting will leave current config unchanged) ids_ruleset...
stack_v2_sparse_classes_10k_train_001231
2,701
permissive
[ { "docstring": "Constructor for the UpdateNetworkSecurityIntrusionSettingsModel class", "name": "__init__", "signature": "def __init__(self, mode=None, ids_rulesets=None, protected_networks=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary...
2
null
Implement the Python class `UpdateNetworkSecurityIntrusionSettingsModel` described below. Class description: Implementation of the 'updateNetworkSecurityIntrusionSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'disabled'/'detection'/'prevention' (optional - omitting will leav...
Implement the Python class `UpdateNetworkSecurityIntrusionSettingsModel` described below. Class description: Implementation of the 'updateNetworkSecurityIntrusionSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'disabled'/'detection'/'prevention' (optional - omitting will leav...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSecurityIntrusionSettingsModel: """Implementation of the 'updateNetworkSecurityIntrusionSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'disabled'/'detection'/'prevention' (optional - omitting will leave current config unchanged) ids_ruleset...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkSecurityIntrusionSettingsModel: """Implementation of the 'updateNetworkSecurityIntrusionSettings' model. TODO: type model description here. Attributes: mode (string): Set mode to 'disabled'/'detection'/'prevention' (optional - omitting will leave current config unchanged) ids_rulesets (string): S...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_security_intrusion_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
77ea59edc75bc37bbb84ebc9e8b4a6a458150b94
[ "name = read_unicode_string(fp)\nclassID = read_length_and_key(fp)\nkeyID = read_length_and_key(fp)\nreturn cls(name, classID, keyID)", "written = write_unicode_string(fp, self.name)\nwritten += write_length_and_key(fp, self.classID)\nwritten += write_length_and_key(fp, self.keyID)\nreturn written" ]
<|body_start_0|> name = read_unicode_string(fp) classID = read_length_and_key(fp) keyID = read_length_and_key(fp) return cls(name, classID, keyID) <|end_body_0|> <|body_start_1|> written = write_unicode_string(fp, self.name) written += write_length_and_key(fp, self.class...
Property structure. .. py:attribute:: name
Property
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Property: """Property structure. .. py:attribute:: name""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" <|body_0|> def write(self, fp): """Write the element to a file-like object. :param fp: file-like object""" ...
stack_v2_sparse_classes_10k_train_001232
19,890
permissive
[ { "docstring": "Read the element from a file-like object. :param fp: file-like object", "name": "read", "signature": "def read(cls, fp)" }, { "docstring": "Write the element to a file-like object. :param fp: file-like object", "name": "write", "signature": "def write(self, fp)" } ]
2
stack_v2_sparse_classes_30k_train_005542
Implement the Python class `Property` described below. Class description: Property structure. .. py:attribute:: name Method signatures and docstrings: - def read(cls, fp): Read the element from a file-like object. :param fp: file-like object - def write(self, fp): Write the element to a file-like object. :param fp: f...
Implement the Python class `Property` described below. Class description: Property structure. .. py:attribute:: name Method signatures and docstrings: - def read(cls, fp): Read the element from a file-like object. :param fp: file-like object - def write(self, fp): Write the element to a file-like object. :param fp: f...
0e3ac5b64061c7eb87c6eeacce4b9792d1f479b5
<|skeleton|> class Property: """Property structure. .. py:attribute:: name""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" <|body_0|> def write(self, fp): """Write the element to a file-like object. :param fp: file-like object""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Property: """Property structure. .. py:attribute:: name""" def read(cls, fp): """Read the element from a file-like object. :param fp: file-like object""" name = read_unicode_string(fp) classID = read_length_and_key(fp) keyID = read_length_and_key(fp) return cls(nam...
the_stack_v2_python_sparse
psd_tools/psd/descriptor.py
sfneal/psd-tools3
train
30
29d15c4c250ca4850556ce4ef32048387d4e4249
[ "result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id')\nresult.SetDuration(str(1), str(2000))\nself.assertTrue(result.is_slow_result)", "result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id')\nresult.SetDuration(30, 100000)\nself.assertFalse(result.is_slow_result...
<|body_start_0|> result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') result.SetDuration(str(1), str(2000)) self.assertTrue(result.is_slow_result) <|end_body_0|> <|body_start_1|> result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') ...
WebTestResultUnittest
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebTestResultUnittest: def testSetDurationString(self): """Tests that strings are properly converted when setting durations.""" <|body_0|> def testSetDurationNotSlow(self): """Tests that setting a duration for a non-slow result works.""" <|body_1|> def t...
stack_v2_sparse_classes_10k_train_001233
10,707
permissive
[ { "docstring": "Tests that strings are properly converted when setting durations.", "name": "testSetDurationString", "signature": "def testSetDurationString(self)" }, { "docstring": "Tests that setting a duration for a non-slow result works.", "name": "testSetDurationNotSlow", "signature...
5
stack_v2_sparse_classes_30k_train_007125
Implement the Python class `WebTestResultUnittest` described below. Class description: Implement the WebTestResultUnittest class. Method signatures and docstrings: - def testSetDurationString(self): Tests that strings are properly converted when setting durations. - def testSetDurationNotSlow(self): Tests that settin...
Implement the Python class `WebTestResultUnittest` described below. Class description: Implement the WebTestResultUnittest class. Method signatures and docstrings: - def testSetDurationString(self): Tests that strings are properly converted when setting durations. - def testSetDurationNotSlow(self): Tests that settin...
fd8a8914ca0183f0add65ae55f04e287543c7d4a
<|skeleton|> class WebTestResultUnittest: def testSetDurationString(self): """Tests that strings are properly converted when setting durations.""" <|body_0|> def testSetDurationNotSlow(self): """Tests that setting a duration for a non-slow result works.""" <|body_1|> def t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WebTestResultUnittest: def testSetDurationString(self): """Tests that strings are properly converted when setting durations.""" result = data_types.WebTestResult('foo', ['debug'], 'Pass', 'step', 'build_id') result.SetDuration(str(1), str(2000)) self.assertTrue(result.is_slow_r...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/data_types_unittest.py
SREERAGI18/chromium
train
1
6100f1a09996674b67a958a7026ada368ae699fb
[ "nn.Module.__init__(self)\nself.c = c\nself.nu = nu\nself.eps = eps\nself.soft_boundary = soft_boundary", "dist = torch.sum((self.c - input) ** 2, dim=1)\nif self.soft_boundary:\n scores = dist - R ** 2\n loss = R ** 2 + 1 / self.nu * torch.mean(torch.max(torch.zeros_like(scores), scores))\nelse:\n loss ...
<|body_start_0|> nn.Module.__init__(self) self.c = c self.nu = nu self.eps = eps self.soft_boundary = soft_boundary <|end_body_0|> <|body_start_1|> dist = torch.sum((self.c - input) ** 2, dim=1) if self.soft_boundary: scores = dist - R ** 2 ...
Implementation of the DeepSVDD loss proposed by Lukas Ruff et al. (2019)
DeepSVDDLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepSVDDLoss: """Implementation of the DeepSVDD loss proposed by Lukas Ruff et al. (2019)""" def __init__(self, c, nu, eps=1e-06, soft_boundary=False): """Constructor of the DeepSVDD loss. ---------- INPUT |---- c (torch.Tensor) the center of the hypersphere as a multidimensional vec...
stack_v2_sparse_classes_10k_train_001234
18,386
permissive
[ { "docstring": "Constructor of the DeepSVDD loss. ---------- INPUT |---- c (torch.Tensor) the center of the hypersphere as a multidimensional vector. |---- nu (float) a priory fraction of outliers. |---- eps (float) epsilon to ensure numerical stability in the | inverse distance. |---- soft_boundary (bool) whet...
2
stack_v2_sparse_classes_30k_train_001265
Implement the Python class `DeepSVDDLoss` described below. Class description: Implementation of the DeepSVDD loss proposed by Lukas Ruff et al. (2019) Method signatures and docstrings: - def __init__(self, c, nu, eps=1e-06, soft_boundary=False): Constructor of the DeepSVDD loss. ---------- INPUT |---- c (torch.Tensor...
Implement the Python class `DeepSVDDLoss` described below. Class description: Implementation of the DeepSVDD loss proposed by Lukas Ruff et al. (2019) Method signatures and docstrings: - def __init__(self, c, nu, eps=1e-06, soft_boundary=False): Constructor of the DeepSVDD loss. ---------- INPUT |---- c (torch.Tensor...
850b6195d6290a50eee865b4d5a66f5db5260e8f
<|skeleton|> class DeepSVDDLoss: """Implementation of the DeepSVDD loss proposed by Lukas Ruff et al. (2019)""" def __init__(self, c, nu, eps=1e-06, soft_boundary=False): """Constructor of the DeepSVDD loss. ---------- INPUT |---- c (torch.Tensor) the center of the hypersphere as a multidimensional vec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeepSVDDLoss: """Implementation of the DeepSVDD loss proposed by Lukas Ruff et al. (2019)""" def __init__(self, c, nu, eps=1e-06, soft_boundary=False): """Constructor of the DeepSVDD loss. ---------- INPUT |---- c (torch.Tensor) the center of the hypersphere as a multidimensional vector. |---- nu...
the_stack_v2_python_sparse
Code/src/models/optim/CustomLosses.py
antoine-spahr/X-ray-Anomaly-Detection
train
3
0a2449e76df8df27abfc4329685d69d939e1530c
[ "startTime = datetime.datetime.now()\nif trial:\n endTime = datetime.datetime.now()\n return {'start': startTime, 'end': endTime}\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate(TEAM_NAME, TEAM_NAME)\nurl = FUSION_TABLE_URL\ncsv_string = urllib.request.urlopen(url).read().decode('ut...
<|body_start_0|> startTime = datetime.datetime.now() if trial: endTime = datetime.datetime.now() return {'start': startTime, 'end': endTime} client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate(TEAM_NAME, TEAM_NAME) url = FUSION_...
countyShapes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class countyShapes: def execute(trial=False): """Read from Google Fusion table (uploaded to datamechanics.io) to get geoJSON data about each county and insert into collection ex) { "_id" : "7322", "Name" : Barnstable, "Shape" : "<Polygon> ... ", "Geo_ID" : "25001", }""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_001235
4,703
no_license
[ { "docstring": "Read from Google Fusion table (uploaded to datamechanics.io) to get geoJSON data about each county and insert into collection ex) { \"_id\" : \"7322\", \"Name\" : Barnstable, \"Shape\" : \"<Polygon> ... \", \"Geo_ID\" : \"25001\", }", "name": "execute", "signature": "def execute(trial=Fa...
2
stack_v2_sparse_classes_30k_train_006222
Implement the Python class `countyShapes` described below. Class description: Implement the countyShapes class. Method signatures and docstrings: - def execute(trial=False): Read from Google Fusion table (uploaded to datamechanics.io) to get geoJSON data about each county and insert into collection ex) { "_id" : "732...
Implement the Python class `countyShapes` described below. Class description: Implement the countyShapes class. Method signatures and docstrings: - def execute(trial=False): Read from Google Fusion table (uploaded to datamechanics.io) to get geoJSON data about each county and insert into collection ex) { "_id" : "732...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class countyShapes: def execute(trial=False): """Read from Google Fusion table (uploaded to datamechanics.io) to get geoJSON data about each county and insert into collection ex) { "_id" : "7322", "Name" : Barnstable, "Shape" : "<Polygon> ... ", "Geo_ID" : "25001", }""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class countyShapes: def execute(trial=False): """Read from Google Fusion table (uploaded to datamechanics.io) to get geoJSON data about each county and insert into collection ex) { "_id" : "7322", "Name" : Barnstable, "Shape" : "<Polygon> ... ", "Geo_ID" : "25001", }""" startTime = datetime.datetime...
the_stack_v2_python_sparse
ldisalvo_skeesara_vidyaap/countyShapes.py
maximega/course-2019-spr-proj
train
2
ddc2789d2459299c4f6c6be9ade9c56644d87a52
[ "if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host", "headers = {'org': org, 'user': user}\nroute_name = ''\nserv...
<|body_start_0|> if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0): raise Exception('server_ip和server_port必须同时指定') self._server_ip = server_ip self._server_port = server_port self._service_name = service_name self._host = host <|end_bod...
DeployClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和servic...
stack_v2_sparse_classes_10k_train_001236
7,561
permissive
[ { "docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com", "name": "__ini...
5
null
Implement the Python class `DeployClient` described below. Class description: Implement the DeployClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_por...
Implement the Python class `DeployClient` described below. Class description: Implement the DeployClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_por...
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
<|skeleton|> class DeployClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和servic...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeployClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,ser...
the_stack_v2_python_sparse
easy_flow_sdk/api/deploy/deploy_client.py
easyopsapis/easyops-api-python
train
5
441f89298b13bb0c31797197fa30fb941cb26afa
[ "assert colors1() == ('white', 'white', 'white', 'white')\nassert colors1('red', 'blue', 'yellow', 'chartreuse') == ('red', 'blue', 'yellow', 'chartreuse')\nassert colors1(link_color='red', back_color='blue') == ('white', 'blue', 'red', 'white')\nassert colors1('purple', link_color='red', back_color='blue') == ('pu...
<|body_start_0|> assert colors1() == ('white', 'white', 'white', 'white') assert colors1('red', 'blue', 'yellow', 'chartreuse') == ('red', 'blue', 'yellow', 'chartreuse') assert colors1(link_color='red', back_color='blue') == ('white', 'blue', 'red', 'white') assert colors1('purple', lin...
Class to test args_kwargs_lab
ArgsKwargsTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgsKwargsTest: """Class to test args_kwargs_lab""" def test_colors1(self): """Test assertions for colors1 function""" <|body_0|> def test_colors2(self): """Test assertions for colors2 function""" <|body_1|> <|end_skeleton|> <|body_start_0|> ass...
stack_v2_sparse_classes_10k_train_001237
1,798
no_license
[ { "docstring": "Test assertions for colors1 function", "name": "test_colors1", "signature": "def test_colors1(self)" }, { "docstring": "Test assertions for colors2 function", "name": "test_colors2", "signature": "def test_colors2(self)" } ]
2
stack_v2_sparse_classes_30k_train_005791
Implement the Python class `ArgsKwargsTest` described below. Class description: Class to test args_kwargs_lab Method signatures and docstrings: - def test_colors1(self): Test assertions for colors1 function - def test_colors2(self): Test assertions for colors2 function
Implement the Python class `ArgsKwargsTest` described below. Class description: Class to test args_kwargs_lab Method signatures and docstrings: - def test_colors1(self): Test assertions for colors1 function - def test_colors2(self): Test assertions for colors2 function <|skeleton|> class ArgsKwargsTest: """Class...
661903cd9dc49b294fb9a0c905133a4c3f9d8d0f
<|skeleton|> class ArgsKwargsTest: """Class to test args_kwargs_lab""" def test_colors1(self): """Test assertions for colors1 function""" <|body_0|> def test_colors2(self): """Test assertions for colors2 function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ArgsKwargsTest: """Class to test args_kwargs_lab""" def test_colors1(self): """Test assertions for colors1 function""" assert colors1() == ('white', 'white', 'white', 'white') assert colors1('red', 'blue', 'yellow', 'chartreuse') == ('red', 'blue', 'yellow', 'chartreuse') ...
the_stack_v2_python_sparse
students/douglas_klos/session6/lab/test_args_kwargs_lab.py
pauleclifton/GP_Python210B_Winter_2019
train
0
a295cb7cef40c671d9f5f71efe8d7701ebfedbca
[ "cur = 0\ntotal = 0\nstart = 0\nfor i in range(len(gas)):\n cur += gas[i] - cost[i]\n total += gas[i] - cost[i]\n if cur < 0:\n start = i + 1\n cur = 0\nif total < 0:\n return -1\nreturn start", "n = len(gas)\nfor i in range(n):\n start = (i + 1) % n\n count = gas[i] - cost[i]\n ...
<|body_start_0|> cur = 0 total = 0 start = 0 for i in range(len(gas)): cur += gas[i] - cost[i] total += gas[i] - cost[i] if cur < 0: start = i + 1 cur = 0 if total < 0: return -1 return start ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit0(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int 暴力解法""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_10k_train_001238
1,268
no_license
[ { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int", "name": "canCompleteCircuit", "signature": "def canCompleteCircuit(self, gas, cost)" }, { "docstring": ":type gas: List[int] :type cost: List[int] :rtype: int 暴力解法", "name": "canCompleteCircuit0", "signature": "def ...
2
stack_v2_sparse_classes_30k_test_000370
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit0(self, gas, cost): :type gas: List[int] :type cost: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canCompleteCircuit(self, gas, cost): :type gas: List[int] :type cost: List[int] :rtype: int - def canCompleteCircuit0(self, gas, cost): :type gas: List[int] :type cost: List[...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" <|body_0|> def canCompleteCircuit0(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int 暴力解法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canCompleteCircuit(self, gas, cost): """:type gas: List[int] :type cost: List[int] :rtype: int""" cur = 0 total = 0 start = 0 for i in range(len(gas)): cur += gas[i] - cost[i] total += gas[i] - cost[i] if cur < 0: ...
the_stack_v2_python_sparse
134.加油站.py
yangyuxiang1996/leetcode
train
0
66e82b10565295776b2d233ffe48370631c5fd94
[ "if not node:\n return None\nroot = UndirectedGraphNode(node.label)\nd_old_copy = {node: root}\ncur_layer = [node]\nself.bfs(cur_layer, d_old_copy)\nreturn root", "while cur_layer:\n node = cur_layer.pop()\n for nb in node.neighbors:\n if nb not in d_old_copy:\n d_old_copy[nb] = Undirec...
<|body_start_0|> if not node: return None root = UndirectedGraphNode(node.label) d_old_copy = {node: root} cur_layer = [node] self.bfs(cur_layer, d_old_copy) return root <|end_body_0|> <|body_start_1|> while cur_layer: node = cur_layer.pop...
Solution description
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution description""" def cloneGraph(self, node): """Solution function description""" <|body_0|> def bfs(self, cur_layer, d_old_copy): """breadth first""" <|body_1|> def dfs(self, node, d_old_copy): """depth first""" <|...
stack_v2_sparse_classes_10k_train_001239
1,512
permissive
[ { "docstring": "Solution function description", "name": "cloneGraph", "signature": "def cloneGraph(self, node)" }, { "docstring": "breadth first", "name": "bfs", "signature": "def bfs(self, cur_layer, d_old_copy)" }, { "docstring": "depth first", "name": "dfs", "signature...
3
stack_v2_sparse_classes_30k_train_004180
Implement the Python class `Solution` described below. Class description: Solution description Method signatures and docstrings: - def cloneGraph(self, node): Solution function description - def bfs(self, cur_layer, d_old_copy): breadth first - def dfs(self, node, d_old_copy): depth first
Implement the Python class `Solution` described below. Class description: Solution description Method signatures and docstrings: - def cloneGraph(self, node): Solution function description - def bfs(self, cur_layer, d_old_copy): breadth first - def dfs(self, node, d_old_copy): depth first <|skeleton|> class Solution...
869ee24c50c08403b170e8f7868699185e9dfdd1
<|skeleton|> class Solution: """Solution description""" def cloneGraph(self, node): """Solution function description""" <|body_0|> def bfs(self, cur_layer, d_old_copy): """breadth first""" <|body_1|> def dfs(self, node, d_old_copy): """depth first""" <|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """Solution description""" def cloneGraph(self, node): """Solution function description""" if not node: return None root = UndirectedGraphNode(node.label) d_old_copy = {node: root} cur_layer = [node] self.bfs(cur_layer, d_old_copy) ...
the_stack_v2_python_sparse
133.clone.graph/1.py
cerebrumaize/leetcode
train
0
27de8bfe64a91ccf13abf24aa4004908ae3be567
[ "self.matrix = matrix\nif not matrix:\n return\nm = len(matrix)\nn = len(matrix[0])\nself.dp = [[0] * (n + 1) for _ in range(m)]\nfor i in range(m):\n for j in range(1, n + 1):\n self.dp[i][j] = self.dp[i][j - 1] + matrix[i][j - 1]", "res = 0\nfor k in range(row1, row2 + 1):\n res += self.dp[k][co...
<|body_start_0|> self.matrix = matrix if not matrix: return m = len(matrix) n = len(matrix[0]) self.dp = [[0] * (n + 1) for _ in range(m)] for i in range(m): for j in range(1, n + 1): self.dp[i][j] = self.dp[i][j - 1] + matrix[i][j ...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_10k_train_001240
1,170
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
null
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" self.matrix = matrix if not matrix: return m = len(matrix) n = len(matrix[0]) self.dp = [[0] * (n + 1) for _ in range(m)] for i in range(m): for j in range...
the_stack_v2_python_sparse
0304_Range_Sum_Query_2D-Immutable.py
bingli8802/leetcode
train
0
57900062f3a74beb96084c6028884f8f6ae41c53
[ "if REQUEST is not None:\n self.__dict__.update(REQUEST)\nif kw is not None:\n self.__dict__.update(kw)", "if REQUEST is not None:\n aq_base(self).__dict__.update(REQUEST)\nif kw is not None:\n aq_base(self).__dict__.update(kw)\nif context is not None:\n return self.__of__(context)\nelse:\n retu...
<|body_start_0|> if REQUEST is not None: self.__dict__.update(REQUEST) if kw is not None: self.__dict__.update(kw) <|end_body_0|> <|body_start_1|> if REQUEST is not None: aq_base(self).__dict__.update(REQUEST) if kw is not None: aq_base(se...
Context objects are used all over ERP5 in so-called context dependent function. Examples of context dependent methods include: - price methods (price depends on the context: customer, quantity, etc.) - BOM methods
Context
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Context: """Context objects are used all over ERP5 in so-called context dependent function. Examples of context dependent methods include: - price methods (price depends on the context: customer, quantity, etc.) - BOM methods""" def __init__(self, context=None, REQUEST=None, **kw): "...
stack_v2_sparse_classes_10k_train_001241
2,898
no_license
[ { "docstring": "context -- The REQUEST -- the request object kw -- user specified parameters", "name": "__init__", "signature": "def __init__(self, context=None, REQUEST=None, **kw)" }, { "docstring": "Update args of context", "name": "asContext", "signature": "def asContext(self, contex...
2
null
Implement the Python class `Context` described below. Class description: Context objects are used all over ERP5 in so-called context dependent function. Examples of context dependent methods include: - price methods (price depends on the context: customer, quantity, etc.) - BOM methods Method signatures and docstring...
Implement the Python class `Context` described below. Class description: Context objects are used all over ERP5 in so-called context dependent function. Examples of context dependent methods include: - price methods (price depends on the context: customer, quantity, etc.) - BOM methods Method signatures and docstring...
dc02bfa887ffab9841abebc3f5c16d874388cef5
<|skeleton|> class Context: """Context objects are used all over ERP5 in so-called context dependent function. Examples of context dependent methods include: - price methods (price depends on the context: customer, quantity, etc.) - BOM methods""" def __init__(self, context=None, REQUEST=None, **kw): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Context: """Context objects are used all over ERP5 in so-called context dependent function. Examples of context dependent methods include: - price methods (price depends on the context: customer, quantity, etc.) - BOM methods""" def __init__(self, context=None, REQUEST=None, **kw): """context -- ...
the_stack_v2_python_sparse
product/ERP5Type/Context.py
jgpjuniorj/j
train
1
a0de415e928a3c4f271ac4937288ce4d351668d6
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn OnenoteSection()", "from .notebook import Notebook\nfrom .onenote_entity_hierarchy_model import OnenoteEntityHierarchyModel\nfrom .onenote_page import OnenotePage\nfrom .section_group import SectionGroup\nfrom .section_links import Sec...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return OnenoteSection() <|end_body_0|> <|body_start_1|> from .notebook import Notebook from .onenote_entity_hierarchy_model import OnenoteEntityHierarchyModel from .onenote_page import ...
OnenoteSection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OnenoteSection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: """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 Retur...
stack_v2_sparse_classes_10k_train_001242
4,298
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: OnenoteSection", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_valu...
3
stack_v2_sparse_classes_30k_train_001741
Implement the Python class `OnenoteSection` described below. Class description: Implement the OnenoteSection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: Creates a new instance of the appropriate class based on discriminator va...
Implement the Python class `OnenoteSection` described below. Class description: Implement the OnenoteSection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: Creates a new instance of the appropriate class based on discriminator va...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class OnenoteSection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: """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 Retur...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OnenoteSection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> OnenoteSection: """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: OnenoteSec...
the_stack_v2_python_sparse
msgraph/generated/models/onenote_section.py
microsoftgraph/msgraph-sdk-python
train
135
74feaa5bc2b7f188fe1ccb62c12a7e9381a925b6
[ "self.max_read_throughput = max_read_throughput\nself.max_write_throughput = max_write_throughput\nself.read_throughput_samples = read_throughput_samples\nself.write_throughput_samples = write_throughput_samples", "if dictionary is None:\n return None\nmax_read_throughput = dictionary.get('maxReadThroughput')\...
<|body_start_0|> self.max_read_throughput = max_read_throughput self.max_write_throughput = max_write_throughput self.read_throughput_samples = read_throughput_samples self.write_throughput_samples = write_throughput_samples <|end_body_0|> <|body_start_1|> if dictionary is None:...
Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of Sample): Read throughput samples taken for...
ThroughputTile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThroughputTile: """Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of ...
stack_v2_sparse_classes_10k_train_001243
3,283
permissive
[ { "docstring": "Constructor for the ThroughputTile class", "name": "__init__", "signature": "def __init__(self, max_read_throughput=None, max_write_throughput=None, read_throughput_samples=None, write_throughput_samples=None)" }, { "docstring": "Creates an instance of this model from a dictionar...
2
null
Implement the Python class `ThroughputTile` described below. Class description: Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 h...
Implement the Python class `ThroughputTile` described below. Class description: Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 h...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ThroughputTile: """Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ThroughputTile: """Implementation of the 'ThroughputTile' model. Throughput information for dashboard. Attributes: max_read_throughput (long|int): Maxium Read throughput in last 24 hours. max_write_throughput (long|int): Maximum Write throughput in last 24 hours. read_throughput_samples (list of Sample): Read...
the_stack_v2_python_sparse
cohesity_management_sdk/models/throughput_tile.py
cohesity/management-sdk-python
train
24
f1cb71ed6a45a6a81068504dfb916292bcdfe8cf
[ "host = DEFAULT_HOST if host is None else host\nport = DEFAULT_PORT if port is None else port\nself._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself._current_list = list()\nself.is_alive = True\ntry:\n self._socket.connect((host, port))\n self._receiver = Thread(target=self._hear_message_from...
<|body_start_0|> host = DEFAULT_HOST if host is None else host port = DEFAULT_PORT if port is None else port self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._current_list = list() self.is_alive = True try: self._socket.connect((host, port...
Client
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: def __init__(self, host=None, port=None): """Esta clase representa a un cliente, el cual se conecta a un servidor en host:port. Ademas, puede enviar y recibir mensajes del servidor""" <|body_0|> def _hear_message_from_server(self): """Esta funcion es la que q...
stack_v2_sparse_classes_10k_train_001244
2,503
no_license
[ { "docstring": "Esta clase representa a un cliente, el cual se conecta a un servidor en host:port. Ademas, puede enviar y recibir mensajes del servidor", "name": "__init__", "signature": "def __init__(self, host=None, port=None)" }, { "docstring": "Esta funcion es la que queda en un thread auxil...
4
stack_v2_sparse_classes_30k_train_001023
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def __init__(self, host=None, port=None): Esta clase representa a un cliente, el cual se conecta a un servidor en host:port. Ademas, puede enviar y recibir mensajes del servidor - de...
Implement the Python class `Client` described below. Class description: Implement the Client class. Method signatures and docstrings: - def __init__(self, host=None, port=None): Esta clase representa a un cliente, el cual se conecta a un servidor en host:port. Ademas, puede enviar y recibir mensajes del servidor - de...
1458756a37d927d8dd365ba21cef4490360f1985
<|skeleton|> class Client: def __init__(self, host=None, port=None): """Esta clase representa a un cliente, el cual se conecta a un servidor en host:port. Ademas, puede enviar y recibir mensajes del servidor""" <|body_0|> def _hear_message_from_server(self): """Esta funcion es la que q...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Client: def __init__(self, host=None, port=None): """Esta clase representa a un cliente, el cual se conecta a un servidor en host:port. Ademas, puede enviar y recibir mensajes del servidor""" host = DEFAULT_HOST if host is None else host port = DEFAULT_PORT if port is None else port ...
the_stack_v2_python_sparse
Ayudantias/11 - Networking/Ejemplo - Envio de objetos/client.py
frhuerta/Syllabus
train
0
ceac4fbeb7f222f38b417db5ad228228169e6991
[ "M, INT_MAX, d = (len(dungeon), 2 ** 31 - 1, dungeon)\nif M < 1:\n return 1\nN = len(d[0])\nd[M - 1][N - 1] = 1 if d[M - 1][N - 1] >= 0 else 1 - d[M - 1][N - 1]\nfor i in range(M - 1, -1, -1):\n for j in range(N - 1, -1, -1):\n if i == M - 1 and j == N - 1:\n continue\n right = max(1,...
<|body_start_0|> M, INT_MAX, d = (len(dungeon), 2 ** 31 - 1, dungeon) if M < 1: return 1 N = len(d[0]) d[M - 1][N - 1] = 1 if d[M - 1][N - 1] >= 0 else 1 - d[M - 1][N - 1] for i in range(M - 1, -1, -1): for j in range(N - 1, -1, -1): if i =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_0|> def calculateMinimumHP2(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> M, INT...
stack_v2_sparse_classes_10k_train_001245
3,940
no_license
[ { "docstring": ":type dungeon: List[List[int]] :rtype: int", "name": "calculateMinimumHP", "signature": "def calculateMinimumHP(self, dungeon)" }, { "docstring": ":type dungeon: List[List[int]] :rtype: int", "name": "calculateMinimumHP2", "signature": "def calculateMinimumHP2(self, dunge...
2
stack_v2_sparse_classes_30k_train_006665
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int - def calculateMinimumHP2(self, dungeon): :type dungeon: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calculateMinimumHP(self, dungeon): :type dungeon: List[List[int]] :rtype: int - def calculateMinimumHP2(self, dungeon): :type dungeon: List[List[int]] :rtype: int <|skeleton...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_0|> def calculateMinimumHP2(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def calculateMinimumHP(self, dungeon): """:type dungeon: List[List[int]] :rtype: int""" M, INT_MAX, d = (len(dungeon), 2 ** 31 - 1, dungeon) if M < 1: return 1 N = len(d[0]) d[M - 1][N - 1] = 1 if d[M - 1][N - 1] >= 0 else 1 - d[M - 1][N - 1] ...
the_stack_v2_python_sparse
code174DungeonGame.py
cybelewang/leetcode-python
train
0
43734b78b5aa22cb8e7882f19a78f3dc93fbfaf1
[ "A.sort()\nfor i, a in enumerate(A):\n if a >= 0 or K <= 0:\n break\n A[i] = -a\n K -= 1\nif K % 2:\n return sum(A) - 2 * min(A)\nreturn sum(A)", "heapq.heapify(A)\nwhile K:\n min_ = heapq.heappop(A)\n heapq.heappush(A, -min_)\n K -= 1\nreturn sum(A)" ]
<|body_start_0|> A.sort() for i, a in enumerate(A): if a >= 0 or K <= 0: break A[i] = -a K -= 1 if K % 2: return sum(A) - 2 * min(A) return sum(A) <|end_body_0|> <|body_start_1|> heapq.heapify(A) while K: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestSumAfterKNegations1(self, A: List[int], K: int) -> int: """执行用时 :68 ms, 在所有 Python3 提交中击败了61.61%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了20.00%的用户 :param A: :param K: :return:""" <|body_0|> def largestSumAfterKNegations2(self, A: List[int], K: int) -> int: ...
stack_v2_sparse_classes_10k_train_001246
2,143
no_license
[ { "docstring": "执行用时 :68 ms, 在所有 Python3 提交中击败了61.61%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了20.00%的用户 :param A: :param K: :return:", "name": "largestSumAfterKNegations1", "signature": "def largestSumAfterKNegations1(self, A: List[int], K: int) -> int" }, { "docstring": "思路:每次修改堆顶元素 @param A: @para...
2
stack_v2_sparse_classes_30k_train_003154
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestSumAfterKNegations1(self, A: List[int], K: int) -> int: 执行用时 :68 ms, 在所有 Python3 提交中击败了61.61%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了20.00%的用户 :param A: :param K: :return...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestSumAfterKNegations1(self, A: List[int], K: int) -> int: 执行用时 :68 ms, 在所有 Python3 提交中击败了61.61%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了20.00%的用户 :param A: :param K: :return...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def largestSumAfterKNegations1(self, A: List[int], K: int) -> int: """执行用时 :68 ms, 在所有 Python3 提交中击败了61.61%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了20.00%的用户 :param A: :param K: :return:""" <|body_0|> def largestSumAfterKNegations2(self, A: List[int], K: int) -> int: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def largestSumAfterKNegations1(self, A: List[int], K: int) -> int: """执行用时 :68 ms, 在所有 Python3 提交中击败了61.61%的用户 内存消耗 :13.8 MB, 在所有 Python3 提交中击败了20.00%的用户 :param A: :param K: :return:""" A.sort() for i, a in enumerate(A): if a >= 0 or K <= 0: break ...
the_stack_v2_python_sparse
LeetCode/贪心算法/1005. Maximize Sum Of Array After K Negations.py
yiming1012/MyLeetCode
train
2
292264cfc982b8615c66907afe2794555183e64b
[ "if head == None or head.next == None:\n return head\ndummy = ListNode(-1000)\ndummy.next = head\nslow = dummy\nfast = dummy.next\nwhile fast:\n if fast.next and fast.next.val == fast.val:\n tmp = fast.val\n while fast and tmp == fast.val:\n fast = fast.next\n else:\n slow.n...
<|body_start_0|> if head == None or head.next == None: return head dummy = ListNode(-1000) dummy.next = head slow = dummy fast = dummy.next while fast: if fast.next and fast.next.val == fast.val: tmp = fast.val while...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: """迭代 :param head: :return:""" <|body_0|> def deleteDuplicates2(self, head: ListNode) -> ListNode: """感觉会用到两个循环 假设第一个virtual_node为自己创建的,node后面跟head 快指针指向head.next 慢指针指向head 当 head存在,循环遍历head.next 如果存在,...
stack_v2_sparse_classes_10k_train_001247
2,768
permissive
[ { "docstring": "迭代 :param head: :return:", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head: ListNode) -> ListNode" }, { "docstring": "感觉会用到两个循环 假设第一个virtual_node为自己创建的,node后面跟head 快指针指向head.next 慢指针指向head 当 head存在,循环遍历head.next 如果存在,判断是否相等。如果不等,head为head.next 慢指针指向head ...
4
stack_v2_sparse_classes_30k_train_001714
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head: ListNode) -> ListNode: 迭代 :param head: :return: - def deleteDuplicates2(self, head: ListNode) -> ListNode: 感觉会用到两个循环 假设第一个virtual_node为自己创建的,node...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head: ListNode) -> ListNode: 迭代 :param head: :return: - def deleteDuplicates2(self, head: ListNode) -> ListNode: 感觉会用到两个循环 假设第一个virtual_node为自己创建的,node...
41f4b8b557cf15cbd602f187f6550184b3a108ec
<|skeleton|> class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: """迭代 :param head: :return:""" <|body_0|> def deleteDuplicates2(self, head: ListNode) -> ListNode: """感觉会用到两个循环 假设第一个virtual_node为自己创建的,node后面跟head 快指针指向head.next 慢指针指向head 当 head存在,循环遍历head.next 如果存在,...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: """迭代 :param head: :return:""" if head == None or head.next == None: return head dummy = ListNode(-1000) dummy.next = head slow = dummy fast = dummy.next while fast: ...
the_stack_v2_python_sparse
leetcode/82. 删除排序链表中的重复元素 II.py
zhongmb/suanfa
train
0
a3a777a18022111b81a565503bf9a2246dd90bbb
[ "super().__init__()\nself.normalizer = normalizer\nif self.normalizer is None:\n self.fitted = True\nif aggregator is None:\n aggregator = AverageAggregator()\nself.aggregator = aggregator", "if self.normalizer is not None:\n x = self.normalizer(x)\nx = self.aggregator(x)\nreturn x", "if self.normalize...
<|body_start_0|> super().__init__() self.normalizer = normalizer if self.normalizer is None: self.fitted = True if aggregator is None: aggregator = AverageAggregator() self.aggregator = aggregator <|end_body_0|> <|body_start_1|> if self.normalizer...
Ensembler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ensembler: def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): """An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` objec...
stack_v2_sparse_classes_10k_train_001248
9,337
permissive
[ { "docstring": "An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` object to normalize the scores. If ``None`` then no normalization is applied. aggregator `BaseTransformTorch` object to aggregate t...
3
stack_v2_sparse_classes_30k_train_003575
Implement the Python class `Ensembler` described below. Class description: Implement the Ensembler class. Method signatures and docstrings: - def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): An Ensembler applies normalization and aggregation operations to the sco...
Implement the Python class `Ensembler` described below. Class description: Implement the Ensembler class. Method signatures and docstrings: - def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): An Ensembler applies normalization and aggregation operations to the sco...
4a1b4f74a8590117965421e86c2295bff0f33e89
<|skeleton|> class Ensembler: def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): """An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` objec...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ensembler: def __init__(self, normalizer: Optional[BaseTransformTorch]=None, aggregator: BaseTransformTorch=None): """An Ensembler applies normalization and aggregation operations to the scores of an ensemble of detectors. Parameters ---------- normalizer `BaseFittedTransformTorch` object to normalize...
the_stack_v2_python_sparse
alibi_detect/od/pytorch/ensemble.py
SeldonIO/alibi-detect
train
1,922
19a9ba593a2291e326679f61412abae28c0f07cc
[ "super().__init__(nup, ndown, cuda)\nself.cusp_weights = None\nself.fc1 = nn.Linear(1, size1, bias=False)\nself.fc2 = nn.Linear(size1, size2, bias=False)\nself.fc3 = nn.Linear(size2, 1, bias=False)\neps = 1e-06\nself.fc1.weight.data *= eps\nself.fc2.weight.data *= eps\nself.fc3.weight.data *= eps\nself.nl_func = ac...
<|body_start_0|> super().__init__(nup, ndown, cuda) self.cusp_weights = None self.fc1 = nn.Linear(1, size1, bias=False) self.fc2 = nn.Linear(size1, size2, bias=False) self.fc3 = nn.Linear(size2, 1, bias=False) eps = 1e-06 self.fc1.weight.data *= eps self.f...
FullyConnectedJastrowKernel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullyConnectedJastrowKernel: def __init__(self, nup, ndown, cuda, size1=16, size2=8, activation=torch.nn.Sigmoid(), include_cusp_weight=True): """Defines a fully connected jastrow factors.""" <|body_0|> def get_var_weight(self): """define the variational weight.""" ...
stack_v2_sparse_classes_10k_train_001249
3,241
permissive
[ { "docstring": "Defines a fully connected jastrow factors.", "name": "__init__", "signature": "def __init__(self, nup, ndown, cuda, size1=16, size2=8, activation=torch.nn.Sigmoid(), include_cusp_weight=True)" }, { "docstring": "define the variational weight.", "name": "get_var_weight", "...
4
stack_v2_sparse_classes_30k_test_000205
Implement the Python class `FullyConnectedJastrowKernel` described below. Class description: Implement the FullyConnectedJastrowKernel class. Method signatures and docstrings: - def __init__(self, nup, ndown, cuda, size1=16, size2=8, activation=torch.nn.Sigmoid(), include_cusp_weight=True): Defines a fully connected ...
Implement the Python class `FullyConnectedJastrowKernel` described below. Class description: Implement the FullyConnectedJastrowKernel class. Method signatures and docstrings: - def __init__(self, nup, ndown, cuda, size1=16, size2=8, activation=torch.nn.Sigmoid(), include_cusp_weight=True): Defines a fully connected ...
439a79e97ee63057e3032d28a1a5ebafd2d5b5e4
<|skeleton|> class FullyConnectedJastrowKernel: def __init__(self, nup, ndown, cuda, size1=16, size2=8, activation=torch.nn.Sigmoid(), include_cusp_weight=True): """Defines a fully connected jastrow factors.""" <|body_0|> def get_var_weight(self): """define the variational weight.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FullyConnectedJastrowKernel: def __init__(self, nup, ndown, cuda, size1=16, size2=8, activation=torch.nn.Sigmoid(), include_cusp_weight=True): """Defines a fully connected jastrow factors.""" super().__init__(nup, ndown, cuda) self.cusp_weights = None self.fc1 = nn.Linear(1, si...
the_stack_v2_python_sparse
qmctorch/wavefunction/jastrows/elec_elec/kernels/fully_connected_jastrow_kernel.py
NLESC-JCER/QMCTorch
train
22
eae781e58493abcefc29f5b15efb3bc5bd34b850
[ "super().__init__(form=form, bTxt=self.START_TEXT, bCmd=lambda: self.__toggleMic())\nself.__start = True\nself.__configure()", "self.__mic = Microphone()\nself._button.configure(foreground=self.FOREGROUND)\nself._button.configure(background=self.START_COLOR)", "if self.__start:\n self._button['text'] = self....
<|body_start_0|> super().__init__(form=form, bTxt=self.START_TEXT, bCmd=lambda: self.__toggleMic()) self.__start = True self.__configure() <|end_body_0|> <|body_start_1|> self.__mic = Microphone() self._button.configure(foreground=self.FOREGROUND) self._button.configure(...
Class for selecting sound file.
MicButton
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MicButton: """Class for selecting sound file.""" def __init__(self, form): """Construct object.""" <|body_0|> def __configure(self): """Initialize the look/location of the Button.""" <|body_1|> def __toggleMic(self): """Toggle the microphone ...
stack_v2_sparse_classes_10k_train_001250
1,853
no_license
[ { "docstring": "Construct object.", "name": "__init__", "signature": "def __init__(self, form)" }, { "docstring": "Initialize the look/location of the Button.", "name": "__configure", "signature": "def __configure(self)" }, { "docstring": "Toggle the microphone button to start/st...
3
stack_v2_sparse_classes_30k_train_000767
Implement the Python class `MicButton` described below. Class description: Class for selecting sound file. Method signatures and docstrings: - def __init__(self, form): Construct object. - def __configure(self): Initialize the look/location of the Button. - def __toggleMic(self): Toggle the microphone button to start...
Implement the Python class `MicButton` described below. Class description: Class for selecting sound file. Method signatures and docstrings: - def __init__(self, form): Construct object. - def __configure(self): Initialize the look/location of the Button. - def __toggleMic(self): Toggle the microphone button to start...
6d29e1e0b2335c90452a832373dcf3058cec33e9
<|skeleton|> class MicButton: """Class for selecting sound file.""" def __init__(self, form): """Construct object.""" <|body_0|> def __configure(self): """Initialize the look/location of the Button.""" <|body_1|> def __toggleMic(self): """Toggle the microphone ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MicButton: """Class for selecting sound file.""" def __init__(self, form): """Construct object.""" super().__init__(form=form, bTxt=self.START_TEXT, bCmd=lambda: self.__toggleMic()) self.__start = True self.__configure() def __configure(self): """Initialize th...
the_stack_v2_python_sparse
emotionAnalyzer/gui/micButton.py
vkepuska/LivePitchTracking
train
0
934cc4adf4784cdbedeaa5bc022b4ec99423d927
[ "if project == 'CMIP6':\n required = [{'short_name': 'o3'}, {'short_name': 'ps'}]\nelse:\n required = [{'short_name': 'tro3'}, {'short_name': 'ps'}]\nreturn required", "tro3_cube = cubes.extract_cube(iris.Constraint(name='mole_fraction_of_ozone_in_air'))\nps_cube = cubes.extract_cube(iris.Constraint(name='s...
<|body_start_0|> if project == 'CMIP6': required = [{'short_name': 'o3'}, {'short_name': 'ps'}] else: required = [{'short_name': 'tro3'}, {'short_name': 'ps'}] return required <|end_body_0|> <|body_start_1|> tro3_cube = cubes.extract_cube(iris.Constraint(name='mo...
Derivation of variable `toz`.
DerivedVariable
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DerivedVariable: """Derivation of variable `toz`.""" def required(project): """Declare the variables needed for derivation.""" <|body_0|> def calculate(cubes): """Compute total column ozone. Note ---- The surface pressure is used as a lower integration bound. A f...
stack_v2_sparse_classes_10k_train_001251
2,234
permissive
[ { "docstring": "Declare the variables needed for derivation.", "name": "required", "signature": "def required(project)" }, { "docstring": "Compute total column ozone. Note ---- The surface pressure is used as a lower integration bound. A fixed upper integration bound of 0 Pa is used.", "name...
2
null
Implement the Python class `DerivedVariable` described below. Class description: Derivation of variable `toz`. Method signatures and docstrings: - def required(project): Declare the variables needed for derivation. - def calculate(cubes): Compute total column ozone. Note ---- The surface pressure is used as a lower i...
Implement the Python class `DerivedVariable` described below. Class description: Derivation of variable `toz`. Method signatures and docstrings: - def required(project): Declare the variables needed for derivation. - def calculate(cubes): Compute total column ozone. Note ---- The surface pressure is used as a lower i...
d5187438fea2928644cb53ecb26c6adb1e4cc947
<|skeleton|> class DerivedVariable: """Derivation of variable `toz`.""" def required(project): """Declare the variables needed for derivation.""" <|body_0|> def calculate(cubes): """Compute total column ozone. Note ---- The surface pressure is used as a lower integration bound. A f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DerivedVariable: """Derivation of variable `toz`.""" def required(project): """Declare the variables needed for derivation.""" if project == 'CMIP6': required = [{'short_name': 'o3'}, {'short_name': 'ps'}] else: required = [{'short_name': 'tro3'}, {'short_n...
the_stack_v2_python_sparse
esmvalcore/preprocessor/_derive/toz.py
ESMValGroup/ESMValCore
train
41
dead2d5b1ed5133c132853e6c076fc4cb996b7bb
[ "if not root:\n return ''\nencoded = []\nq = deque()\nq.appendleft(root)\nwhile q:\n node = q.pop()\n if node is None or node == 'None':\n encoded.append('None')\n else:\n encoded.append(str(node.val))\n q.appendleft(node.left)\n q.appendleft(node.right)\nreturn ' '.join(enco...
<|body_start_0|> if not root: return '' encoded = [] q = deque() q.appendleft(root) while q: node = q.pop() if node is None or node == 'None': encoded.append('None') else: encoded.append(str(node.val)...
Codec
[ "MIT" ]
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_10k_train_001252
3,104
permissive
[ { "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
null
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:...
6a83cb798cc317d1e4357ac6b2b1fbf76fa034fb
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' encoded = [] q = deque() q.appendleft(root) while q: node = q.pop() if node is None or node == ...
the_stack_v2_python_sparse
Month 03/Week 04/Day 05/a.py
KevinKnott/Coding-Review
train
0
08793fa7d6a00fc8468ad092b5e84b8a69dc36d6
[ "cache_key = (model_year, drive_system)\nstart_years = WorkFactor.start_years[drive_system]\nif len([yr for yr in start_years if yr <= model_year]) > 0:\n model_year = max([yr for yr in start_years if yr <= model_year])\n xwd = WorkFactor._cache[model_year, drive_system]['xwd']\n workfactor = eval(WorkFact...
<|body_start_0|> cache_key = (model_year, drive_system) start_years = WorkFactor.start_years[drive_system] if len([yr for yr in start_years if yr <= model_year]) > 0: model_year = max([yr for yr in start_years if yr <= model_year]) xwd = WorkFactor._cache[model_year, driv...
**Work factor definition and calculations.**
WorkFactor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkFactor: """**Work factor definition and calculations.**""" def calc_workfactor(model_year, curbweight_lbs, gvwr_lbs, gcwr_lbs, drive_system): """Calculate vehicle workfactor. Args: model_year (int): vehicle model year curbweight_lbs (float): vehicle curb weight in lbs gvwr_lbs (f...
stack_v2_sparse_classes_10k_train_001253
5,474
no_license
[ { "docstring": "Calculate vehicle workfactor. Args: model_year (int): vehicle model year curbweight_lbs (float): vehicle curb weight in lbs gvwr_lbs (float): vehicle gross vehicle weight rating in lbs gcwr_lbs (float): vehicle combined weight rating in lbs drive_system (int): drive system, 2=two wheel drive, 4=...
2
stack_v2_sparse_classes_30k_train_005177
Implement the Python class `WorkFactor` described below. Class description: **Work factor definition and calculations.** Method signatures and docstrings: - def calc_workfactor(model_year, curbweight_lbs, gvwr_lbs, gcwr_lbs, drive_system): Calculate vehicle workfactor. Args: model_year (int): vehicle model year curbw...
Implement the Python class `WorkFactor` described below. Class description: **Work factor definition and calculations.** Method signatures and docstrings: - def calc_workfactor(model_year, curbweight_lbs, gvwr_lbs, gcwr_lbs, drive_system): Calculate vehicle workfactor. Args: model_year (int): vehicle model year curbw...
afe912c57383b9de90ef30820f7977c3367a30c4
<|skeleton|> class WorkFactor: """**Work factor definition and calculations.**""" def calc_workfactor(model_year, curbweight_lbs, gvwr_lbs, gcwr_lbs, drive_system): """Calculate vehicle workfactor. Args: model_year (int): vehicle model year curbweight_lbs (float): vehicle curb weight in lbs gvwr_lbs (f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WorkFactor: """**Work factor definition and calculations.**""" def calc_workfactor(model_year, curbweight_lbs, gvwr_lbs, gcwr_lbs, drive_system): """Calculate vehicle workfactor. Args: model_year (int): vehicle model year curbweight_lbs (float): vehicle curb weight in lbs gvwr_lbs (float): vehicl...
the_stack_v2_python_sparse
omega_model/policy/workfactor_definition.py
USEPA/EPA_OMEGA_Model
train
17
f3037a1d461ece66e5fae87be3335f615c2ece9d
[ "if table_size < 1:\n raise ValueError('table_size must be at least 1.')\nif repetitions < 3:\n raise ValueError('repetitions must be at least 3.')\nif rescale_factor <= 0 or rescale_factor > table_size - 1:\n raise ValueError(f'rescale_factor must be positive and no greater than table_size - 1. Found tabl...
<|body_start_0|> if table_size < 1: raise ValueError('table_size must be at least 1.') if repetitions < 3: raise ValueError('repetitions must be at least 3.') if rescale_factor <= 0 or rescale_factor > table_size - 1: raise ValueError(f'rescale_factor must be ...
Hashes a string to an hyper-edge with coupled indices. For a string, generates a set of indices such that the indices are close to each as described in https://arxiv.org/pdf/2001.10500.pdf.
CoupledHyperEdgeHasher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoupledHyperEdgeHasher: """Hashes a string to an hyper-edge with coupled indices. For a string, generates a set of indices such that the indices are close to each as described in https://arxiv.org/pdf/2001.10500.pdf.""" def __init__(self, seed: int, table_size: int, repetitions: int, rescale...
stack_v2_sparse_classes_10k_train_001254
10,259
permissive
[ { "docstring": "Initialize CoupledHyperEdgeHasher. Args: seed: An integer seed for hash functions. table_size: The hash table size of the IBLT. Must be a positive integer. repetitions: The number of repetitions in IBLT data structure. Must be at least 3. rescale_factor: A float to rescale `table_size` to `table...
6
stack_v2_sparse_classes_30k_train_001620
Implement the Python class `CoupledHyperEdgeHasher` described below. Class description: Hashes a string to an hyper-edge with coupled indices. For a string, generates a set of indices such that the indices are close to each as described in https://arxiv.org/pdf/2001.10500.pdf. Method signatures and docstrings: - def ...
Implement the Python class `CoupledHyperEdgeHasher` described below. Class description: Hashes a string to an hyper-edge with coupled indices. For a string, generates a set of indices such that the indices are close to each as described in https://arxiv.org/pdf/2001.10500.pdf. Method signatures and docstrings: - def ...
ad4bca66f4b483e09d8396e9948630813a343d27
<|skeleton|> class CoupledHyperEdgeHasher: """Hashes a string to an hyper-edge with coupled indices. For a string, generates a set of indices such that the indices are close to each as described in https://arxiv.org/pdf/2001.10500.pdf.""" def __init__(self, seed: int, table_size: int, repetitions: int, rescale...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CoupledHyperEdgeHasher: """Hashes a string to an hyper-edge with coupled indices. For a string, generates a set of indices such that the indices are close to each as described in https://arxiv.org/pdf/2001.10500.pdf.""" def __init__(self, seed: int, table_size: int, repetitions: int, rescale_factor: floa...
the_stack_v2_python_sparse
tensorflow_federated/python/analytics/heavy_hitters/iblt/hyperedge_hashers.py
tensorflow/federated
train
2,297
098e483da95d13d2ebe99bd4da1def90324f1f66
[ "if not isinstance(min_length, int):\n raise TypeError('min_length must be Integer')\nif min_length < 0:\n raise ValueError('min_length must be lager 0')\nif not isinstance(max_length, int):\n raise TypeError('max_length must be Integer')\nif min_length > max_length:\n raise ValueError('must (min_length...
<|body_start_0|> if not isinstance(min_length, int): raise TypeError('min_length must be Integer') if min_length < 0: raise ValueError('min_length must be lager 0') if not isinstance(max_length, int): raise TypeError('max_length must be Integer') if mi...
字符串类型的数据描述符
CharField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CharField: """字符串类型的数据描述符""" def __init__(self, *args, min_length=0, max_length=256, regx='', **kwargs): """:param args: :param min_length: :param max_length: :param regx: 用于验证value是否匹配规则 :param kwargs:""" <|body_0|> def _validate(self, value): """value必须是字符串,同时长...
stack_v2_sparse_classes_10k_train_001255
3,660
no_license
[ { "docstring": ":param args: :param min_length: :param max_length: :param regx: 用于验证value是否匹配规则 :param kwargs:", "name": "__init__", "signature": "def __init__(self, *args, min_length=0, max_length=256, regx='', **kwargs)" }, { "docstring": "value必须是字符串,同时长度在min_length和max_length之间,能和regx完全匹配 :p...
2
stack_v2_sparse_classes_30k_train_005433
Implement the Python class `CharField` described below. Class description: 字符串类型的数据描述符 Method signatures and docstrings: - def __init__(self, *args, min_length=0, max_length=256, regx='', **kwargs): :param args: :param min_length: :param max_length: :param regx: 用于验证value是否匹配规则 :param kwargs: - def _validate(self, va...
Implement the Python class `CharField` described below. Class description: 字符串类型的数据描述符 Method signatures and docstrings: - def __init__(self, *args, min_length=0, max_length=256, regx='', **kwargs): :param args: :param min_length: :param max_length: :param regx: 用于验证value是否匹配规则 :param kwargs: - def _validate(self, va...
5e28d5db63ebe23d5004fff19104f2ef7fdbd327
<|skeleton|> class CharField: """字符串类型的数据描述符""" def __init__(self, *args, min_length=0, max_length=256, regx='', **kwargs): """:param args: :param min_length: :param max_length: :param regx: 用于验证value是否匹配规则 :param kwargs:""" <|body_0|> def _validate(self, value): """value必须是字符串,同时长...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CharField: """字符串类型的数据描述符""" def __init__(self, *args, min_length=0, max_length=256, regx='', **kwargs): """:param args: :param min_length: :param max_length: :param regx: 用于验证value是否匹配规则 :param kwargs:""" if not isinstance(min_length, int): raise TypeError('min_length must be...
the_stack_v2_python_sparse
FluentPython/20属性描述符/03属性描述符.py
cpfyjjs/python
train
0
76b32fa7c5391276630065e732f3ea6cd35f34c3
[ "end = self.end\nu = Mi32SlidingWindow()\nu.ADDR_WIDTH = end.ADDR_WIDTH\nu.DATA_WIDTH = end.DATA_WIDTH\nu.WINDOW_SIZE = window_size\nu.M_ADDR_WIDTH = new_addr_width\nsetattr(self.parent, self._findSuitableName('mi32SlidingWindow'), u)\nself._propagateClkRstn(u)\nu.s(self.end)\nself.lastComp = u\nself.end = u.m\nret...
<|body_start_0|> end = self.end u = Mi32SlidingWindow() u.ADDR_WIDTH = end.ADDR_WIDTH u.DATA_WIDTH = end.DATA_WIDTH u.WINDOW_SIZE = window_size u.M_ADDR_WIDTH = new_addr_width setattr(self.parent, self._findSuitableName('mi32SlidingWindow'), u) self._propa...
Mi32Builder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mi32Builder: def sliding_window(self, window_size: int, new_addr_width: int): """Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space""" <|body_0|> def from_axi(cls, parent, axi, name=None): """convertor A...
stack_v2_sparse_classes_10k_train_001256
2,536
permissive
[ { "docstring": "Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space", "name": "sliding_window", "signature": "def sliding_window(self, window_size: int, new_addr_width: int)" }, { "docstring": "convertor AXI/AxiLite -> Mi32", "na...
3
null
Implement the Python class `Mi32Builder` described below. Class description: Implement the Mi32Builder class. Method signatures and docstrings: - def sliding_window(self, window_size: int, new_addr_width: int): Instanciate a sliding window with an offset register which allows to virtually extend the addressable memor...
Implement the Python class `Mi32Builder` described below. Class description: Implement the Mi32Builder class. Method signatures and docstrings: - def sliding_window(self, window_size: int, new_addr_width: int): Instanciate a sliding window with an offset register which allows to virtually extend the addressable memor...
4c1d54c7b15929032ad2ba984bf48b45f3549c49
<|skeleton|> class Mi32Builder: def sliding_window(self, window_size: int, new_addr_width: int): """Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space""" <|body_0|> def from_axi(cls, parent, axi, name=None): """convertor A...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mi32Builder: def sliding_window(self, window_size: int, new_addr_width: int): """Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space""" end = self.end u = Mi32SlidingWindow() u.ADDR_WIDTH = end.ADDR_WIDTH u....
the_stack_v2_python_sparse
hwtLib/cesnet/mi32/builder.py
Nic30/hwtLib
train
36
fb03b8f9596d80fc944313d6d5bd695032b4dfa2
[ "self.file_type = file_type\nself.full_path = full_path\nself.size_bytes = size_bytes", "if dictionary is None:\n return None\nfile_type = dictionary.get('fileType')\nfull_path = dictionary.get('fullPath')\nsize_bytes = dictionary.get('sizeBytes')\nreturn cls(file_type, full_path, size_bytes)" ]
<|body_start_0|> self.file_type = file_type self.full_path = full_path self.size_bytes = size_bytes <|end_body_0|> <|body_start_1|> if dictionary is None: return None file_type = dictionary.get('fileType') full_path = dictionary.get('fullPath') size_b...
Implementation of the 'DbFileInfo' model. Specifies information about a database file. Attributes: file_type (FileTypeEnum): Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data file 'kLog' refers to a ...
DbFileInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbFileInfo: """Implementation of the 'DbFileInfo' model. Specifies information about a database file. Attributes: file_type (FileTypeEnum): Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' ref...
stack_v2_sparse_classes_10k_train_001257
2,285
permissive
[ { "docstring": "Constructor for the DbFileInfo class", "name": "__init__", "signature": "def __init__(self, file_type=None, full_path=None, size_bytes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the o...
2
null
Implement the Python class `DbFileInfo` described below. Class description: Implementation of the 'DbFileInfo' model. Specifies information about a database file. Attributes: file_type (FileTypeEnum): Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQ...
Implement the Python class `DbFileInfo` described below. Class description: Implementation of the 'DbFileInfo' model. Specifies information about a database file. Attributes: file_type (FileTypeEnum): Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DbFileInfo: """Implementation of the 'DbFileInfo' model. Specifies information about a database file. Attributes: file_type (FileTypeEnum): Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' ref...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DbFileInfo: """Implementation of the 'DbFileInfo' model. Specifies information about a database file. Attributes: file_type (FileTypeEnum): Specifies the format type of the file that SQL database stores the data. Specifies the format type of the file that SQL database stores the data. 'kRows' refers to a data...
the_stack_v2_python_sparse
cohesity_management_sdk/models/db_file_info.py
cohesity/management-sdk-python
train
24
e7cfa87a9d556bbafe2b7b82cb82f2c2de694aa9
[ "return_fields = ['timestamp']\nevents = self.event_stream(query_string=self.query, return_fields=return_fields)\nsession_num = 0\ntry:\n first_event = next(events)\n last_timestamp = first_event.source.get('timestamp')\n session_num = 1\n self.annotateEvent(first_event, session_num)\n for event in e...
<|body_start_0|> return_fields = ['timestamp'] events = self.event_stream(query_string=self.query, return_fields=return_fields) session_num = 0 try: first_event = next(events) last_timestamp = first_event.source.get('timestamp') session_num = 1 ...
Sessionizing analyzer. All events in sketch with id sketch_id are grouped in sessions based on the time difference between them. Two consecutive events are in the same session if the time difference between them is less or equal then max_time_diff_micros. Attributes: NAME (str): The name of the sessionizer. max_time_di...
SessionizerSketchPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionizerSketchPlugin: """Sessionizing analyzer. All events in sketch with id sketch_id are grouped in sessions based on the time difference between them. Two consecutive events are in the same session if the time difference between them is less or equal then max_time_diff_micros. Attributes: N...
stack_v2_sparse_classes_10k_train_001258
3,075
permissive
[ { "docstring": "Entry point for the analyzer. Allocates each event a session_id attribute. Returns: String containing the number of sessions created.", "name": "run", "signature": "def run(self)" }, { "docstring": "Annotate an event with a session ID. Store IDs as dictionary entries correspondin...
2
stack_v2_sparse_classes_30k_train_006709
Implement the Python class `SessionizerSketchPlugin` described below. Class description: Sessionizing analyzer. All events in sketch with id sketch_id are grouped in sessions based on the time difference between them. Two consecutive events are in the same session if the time difference between them is less or equal t...
Implement the Python class `SessionizerSketchPlugin` described below. Class description: Sessionizing analyzer. All events in sketch with id sketch_id are grouped in sessions based on the time difference between them. Two consecutive events are in the same session if the time difference between them is less or equal t...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class SessionizerSketchPlugin: """Sessionizing analyzer. All events in sketch with id sketch_id are grouped in sessions based on the time difference between them. Two consecutive events are in the same session if the time difference between them is less or equal then max_time_diff_micros. Attributes: N...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SessionizerSketchPlugin: """Sessionizing analyzer. All events in sketch with id sketch_id are grouped in sessions based on the time difference between them. Two consecutive events are in the same session if the time difference between them is less or equal then max_time_diff_micros. Attributes: NAME (str): Th...
the_stack_v2_python_sparse
timesketch/lib/analyzers/sessionizer.py
google/timesketch
train
2,263
6227349e50a3342bba8833ce3ea221cf5796cba0
[ "super()._init_layers()\nself.ref_point_head = MLP(self.embed_dims * 2, self.embed_dims, self.embed_dims, 2)\nself.norm = nn.LayerNorm(self.embed_dims)", "intermediate = []\nintermediate_reference_points = [reference_points]\nfor lid, layer in enumerate(self.layers):\n if reference_points.shape[-1] == 4:\n ...
<|body_start_0|> super()._init_layers() self.ref_point_head = MLP(self.embed_dims * 2, self.embed_dims, self.embed_dims, 2) self.norm = nn.LayerNorm(self.embed_dims) <|end_body_0|> <|body_start_1|> intermediate = [] intermediate_reference_points = [reference_points] for ...
Transformer encoder of DINO.
DinoTransformerDecoder
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DinoTransformerDecoder: """Transformer encoder of DINO.""" def _init_layers(self) -> None: """Initialize decoder layers.""" <|body_0|> def forward(self, query: Tensor, value: Tensor, key_padding_mask: Tensor, self_attn_mask: Tensor, reference_points: Tensor, spatial_shap...
stack_v2_sparse_classes_10k_train_001259
26,710
permissive
[ { "docstring": "Initialize decoder layers.", "name": "_init_layers", "signature": "def _init_layers(self) -> None" }, { "docstring": "Forward function of Transformer encoder. Args: query (Tensor): The input query, has shape (num_queries, bs, dim). value (Tensor): The input values, has shape (num...
2
stack_v2_sparse_classes_30k_train_002437
Implement the Python class `DinoTransformerDecoder` described below. Class description: Transformer encoder of DINO. Method signatures and docstrings: - def _init_layers(self) -> None: Initialize decoder layers. - def forward(self, query: Tensor, value: Tensor, key_padding_mask: Tensor, self_attn_mask: Tensor, refere...
Implement the Python class `DinoTransformerDecoder` described below. Class description: Transformer encoder of DINO. Method signatures and docstrings: - def _init_layers(self) -> None: Initialize decoder layers. - def forward(self, query: Tensor, value: Tensor, key_padding_mask: Tensor, self_attn_mask: Tensor, refere...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class DinoTransformerDecoder: """Transformer encoder of DINO.""" def _init_layers(self) -> None: """Initialize decoder layers.""" <|body_0|> def forward(self, query: Tensor, value: Tensor, key_padding_mask: Tensor, self_attn_mask: Tensor, reference_points: Tensor, spatial_shap...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DinoTransformerDecoder: """Transformer encoder of DINO.""" def _init_layers(self) -> None: """Initialize decoder layers.""" super()._init_layers() self.ref_point_head = MLP(self.embed_dims * 2, self.embed_dims, self.embed_dims, 2) self.norm = nn.LayerNorm(self.embed_dims) ...
the_stack_v2_python_sparse
ai/mmdetection/mmdet/models/layers/transformer/dino_layers.py
alldatacenter/alldata
train
774
15a52e613ca529ef39b8b96e2ad9ef34659bd067
[ "self.cluster_dir = cluster_dir\nself.year_id = year_id\nself.input_me = input_me\nself.output_me = output_me\nself.conn_def = 'cod'\nself.gbd_round = 4", "query = 'SELECT location_id, most_detailed FROM shared.location_hierarchy_history WHERE location_set_version_id=(SELECT location_set_version_id FROM {DATABASE...
<|body_start_0|> self.cluster_dir = cluster_dir self.year_id = year_id self.input_me = input_me self.output_me = output_me self.conn_def = 'cod' self.gbd_round = 4 <|end_body_0|> <|body_start_1|> query = 'SELECT location_id, most_detailed FROM shared.location_hie...
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: def __init__(self, cluster_dir, year_id, input_me, output_me): """This class incorporates all the functions that all the specific causes use, but all in different sequence""" <|body_0|> def get_locations(self, location_set_id): """Pulls the location hierarchy u...
stack_v2_sparse_classes_10k_train_001260
4,519
no_license
[ { "docstring": "This class incorporates all the functions that all the specific causes use, but all in different sequence", "name": "__init__", "signature": "def __init__(self, cluster_dir, year_id, input_me, output_me)" }, { "docstring": "Pulls the location hierarchy upon which this code is to ...
6
stack_v2_sparse_classes_30k_train_001613
Implement the Python class `Base` described below. Class description: Implement the Base class. Method signatures and docstrings: - def __init__(self, cluster_dir, year_id, input_me, output_me): This class incorporates all the functions that all the specific causes use, but all in different sequence - def get_locatio...
Implement the Python class `Base` described below. Class description: Implement the Base class. Method signatures and docstrings: - def __init__(self, cluster_dir, year_id, input_me, output_me): This class incorporates all the functions that all the specific causes use, but all in different sequence - def get_locatio...
746ea5fb76a9c049c37a8c15aa089c041a90a6d5
<|skeleton|> class Base: def __init__(self, cluster_dir, year_id, input_me, output_me): """This class incorporates all the functions that all the specific causes use, but all in different sequence""" <|body_0|> def get_locations(self, location_set_id): """Pulls the location hierarchy u...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Base: def __init__(self, cluster_dir, year_id, input_me, output_me): """This class incorporates all the functions that all the specific causes use, but all in different sequence""" self.cluster_dir = cluster_dir self.year_id = year_id self.input_me = input_me self.outpu...
the_stack_v2_python_sparse
nonfatal_code/obstetric_fistula/fistula_zero_out_locations_GATHER.py
Nermin-Ghith/ihme-modeling
train
0
a43cfac00faeef26915e339301d1118a0b5a8b3c
[ "gdf1.crs = 'epsg:4326'\ngdf2.crs = 'epsg:4326'\nreturn gpd.sjoin(gdf1, gdf2).drop('index_right', axis=1)", "AREA_SIZE_DIVIDER = 25000\nMIN_BUFFER_SIZE = 3\nMAX_BUFFER_SIZE = 10\nwall_gdf = relevant_floorplan_gdf.loc[relevant_floorplan_gdf['category'] == 'wall'].copy()\narea = wall_gdf.unary_union.buffer(0.01).co...
<|body_start_0|> gdf1.crs = 'epsg:4326' gdf2.crs = 'epsg:4326' return gpd.sjoin(gdf1, gdf2).drop('index_right', axis=1) <|end_body_0|> <|body_start_1|> AREA_SIZE_DIVIDER = 25000 MIN_BUFFER_SIZE = 3 MAX_BUFFER_SIZE = 10 wall_gdf = relevant_floorplan_gdf.loc[releva...
Image structure generator class, to generate windows and doors in walls.
ImageStructureGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageStructureGenerator: """Image structure generator class, to generate windows and doors in walls.""" def find_overlap(self, gdf1, gdf2): """Find overlap between 2 geodataframes. Args: gdf1: geodataframe of which you want to have the overlapping elements returned gdf2: geodataframe...
stack_v2_sparse_classes_10k_train_001261
3,582
no_license
[ { "docstring": "Find overlap between 2 geodataframes. Args: gdf1: geodataframe of which you want to have the overlapping elements returned gdf2: geodataframe that the overlap needs to be found against.", "name": "find_overlap", "signature": "def find_overlap(self, gdf1, gdf2)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_002620
Implement the Python class `ImageStructureGenerator` described below. Class description: Image structure generator class, to generate windows and doors in walls. Method signatures and docstrings: - def find_overlap(self, gdf1, gdf2): Find overlap between 2 geodataframes. Args: gdf1: geodataframe of which you want to ...
Implement the Python class `ImageStructureGenerator` described below. Class description: Image structure generator class, to generate windows and doors in walls. Method signatures and docstrings: - def find_overlap(self, gdf1, gdf2): Find overlap between 2 geodataframes. Args: gdf1: geodataframe of which you want to ...
1b953d87968dac46ebbc9b1d5c254ea9493ee328
<|skeleton|> class ImageStructureGenerator: """Image structure generator class, to generate windows and doors in walls.""" def find_overlap(self, gdf1, gdf2): """Find overlap between 2 geodataframes. Args: gdf1: geodataframe of which you want to have the overlapping elements returned gdf2: geodataframe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ImageStructureGenerator: """Image structure generator class, to generate windows and doors in walls.""" def find_overlap(self, gdf1, gdf2): """Find overlap between 2 geodataframes. Args: gdf1: geodataframe of which you want to have the overlapping elements returned gdf2: geodataframe that the ove...
the_stack_v2_python_sparse
fmlwright/dataset_builder/ImageStructureGenerator.py
rgresia-umd/fml-wright
train
0
221af954ec827e037fdab8c1c32d0d14bcb7daeb
[ "if self == other:\n return self\nelif type(self) == type(other):\n return type(self)(self.vars | other.vars)\nelif isinstance(other, SymbolicSubringRejectingVarsFunctor):\n if not self.vars & other.vars:\n return other", "if R is not SR:\n raise NotImplementedError('This functor can only be ap...
<|body_start_0|> if self == other: return self elif type(self) == type(other): return type(self)(self.vars | other.vars) elif isinstance(other, SymbolicSubringRejectingVarsFunctor): if not self.vars & other.vars: return other <|end_body_0|> <|...
SymbolicSubringAcceptingVarsFunctor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SymbolicSubringAcceptingVarsFunctor: def merge(self, other): """Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=...
stack_v2_sparse_classes_10k_train_001262
31,870
no_license
[ { "docstring": "Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=('a',)).construction()[0] sage: G = SymbolicSubring(rejecting_variables=...
2
null
Implement the Python class `SymbolicSubringAcceptingVarsFunctor` described below. Class description: Implement the SymbolicSubringAcceptingVarsFunctor class. Method signatures and docstrings: - def merge(self, other): Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or...
Implement the Python class `SymbolicSubringAcceptingVarsFunctor` described below. Class description: Implement the SymbolicSubringAcceptingVarsFunctor class. Method signatures and docstrings: - def merge(self, other): Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class SymbolicSubringAcceptingVarsFunctor: def merge(self, other): """Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SymbolicSubringAcceptingVarsFunctor: def merge(self, other): """Merge this functor with ``other`` if possible. INPUT: - ``other`` -- a functor. OUTPUT: A functor or ``None``. EXAMPLES:: sage: from sage.symbolic.subring import SymbolicSubring sage: F = SymbolicSubring(accepting_variables=('a',)).constr...
the_stack_v2_python_sparse
sage/src/sage/symbolic/subring.py
bopopescu/geosci
train
0
d01e533c15be3ffa5d7717e6909ec649a258309c
[ "self.__ops = ops\nself.__nops = len(ops)\nfor iop in range(self.__nops):\n if not isinstance(self.__ops[iop], operator):\n raise Exception('Elements of ops list must be of type operator')\nif self.__nops != len(dims):\n raise Exception('Number of dimensions (%d) must equal number of operators (%d)' % ...
<|body_start_0|> self.__ops = ops self.__nops = len(ops) for iop in range(self.__nops): if not isinstance(self.__ops[iop], operator): raise Exception('Elements of ops list must be of type operator') if self.__nops != len(dims): raise Exception('Num...
Column operator
colop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class colop: """Column operator""" def __init__(self, ops, dims, epss): """colop constructor Parameters: ops - a list of operators used to form the column operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows'...
stack_v2_sparse_classes_10k_train_001263
13,837
no_license
[ { "docstring": "colop constructor Parameters: ops - a list of operators used to form the column operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols': 10},...] epss - a list of scalar values to be applied to the outpu...
4
stack_v2_sparse_classes_30k_train_000959
Implement the Python class `colop` described below. Class description: Column operator Method signatures and docstrings: - def __init__(self, ops, dims, epss): colop constructor Parameters: ops - a list of operators used to form the column operator dims - a list of dictionaries that contain the dimensions of the inpu...
Implement the Python class `colop` described below. Class description: Column operator Method signatures and docstrings: - def __init__(self, ops, dims, epss): colop constructor Parameters: ops - a list of operators used to form the column operator dims - a list of dictionaries that contain the dimensions of the inpu...
32a303eddd13385d8778b8bb3b4fbbfbe78bea51
<|skeleton|> class colop: """Column operator""" def __init__(self, ops, dims, epss): """colop constructor Parameters: ops - a list of operators used to form the column operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows'...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class colop: """Column operator""" def __init__(self, ops, dims, epss): """colop constructor Parameters: ops - a list of operators used to form the column operator dims - a list of dictionaries that contain the dimensions of the inputs and outputs of the arrays For example dims = [{'nrows': 10, 'ncols'...
the_stack_v2_python_sparse
opt/linopt/combops.py
ke0m/scaas
train
2
f12f8afcf191d78c912a5d274a50189ab3ade460
[ "crypto_power = CryptoPower(power_ups=Ursula._default_crypto_powerups)\nif claim_signing_key:\n crypto_power.consume_power_up(SigningPower(pubkey=target_ursula.stamp.as_umbral_pubkey()))\nvladimir = cls(crypto_power=crypto_power, rest_host=target_ursula.rest_information()[0].host, rest_port=target_ursula.rest_in...
<|body_start_0|> crypto_power = CryptoPower(power_ups=Ursula._default_crypto_powerups) if claim_signing_key: crypto_power.consume_power_up(SigningPower(pubkey=target_ursula.stamp.as_umbral_pubkey())) vladimir = cls(crypto_power=crypto_power, rest_host=target_ursula.rest_information()...
The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever.
Vladimir
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vladimir: """The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever.""" def from_target_ursula(cls, target_ursula, claim_signing_key=False): """Sometimes Vladimir seeks to attack or imitate a *specific* target Ursula. TODO: This i...
stack_v2_sparse_classes_10k_train_001264
2,381
no_license
[ { "docstring": "Sometimes Vladimir seeks to attack or imitate a *specific* target Ursula. TODO: This is probably a more instructive method if it takes a bytes representation instead of the entire Ursula.", "name": "from_target_ursula", "signature": "def from_target_ursula(cls, target_ursula, claim_signi...
2
stack_v2_sparse_classes_30k_train_005042
Implement the Python class `Vladimir` described below. Class description: The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever. Method signatures and docstrings: - def from_target_ursula(cls, target_ursula, claim_signing_key=False): Sometimes Vladimir seeks to a...
Implement the Python class `Vladimir` described below. Class description: The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever. Method signatures and docstrings: - def from_target_ursula(cls, target_ursula, claim_signing_key=False): Sometimes Vladimir seeks to a...
9a8a5ba75c04e14d5f393ebd0a626c046948c003
<|skeleton|> class Vladimir: """The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever.""" def from_target_ursula(cls, target_ursula, claim_signing_key=False): """Sometimes Vladimir seeks to attack or imitate a *specific* target Ursula. TODO: This i...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Vladimir: """The power of Ursula, but with a heart forged deep in the mountains of Microsoft or a State Actor or whatever.""" def from_target_ursula(cls, target_ursula, claim_signing_key=False): """Sometimes Vladimir seeks to attack or imitate a *specific* target Ursula. TODO: This is probably a ...
the_stack_v2_python_sparse
nucypher/characters/unlawful.py
OnGridSystems/nucypher
train
0
cc5ab1aaf9dca2627793290b85057c2845a6ed16
[ "user = get_object_or_404(self.queryset, pk=pk)\nserializer = self.get_serializer(user)\nreturn Response(serializer.data)", "print(request.version)\nusers = self.queryset.values('id', 'username', 'is_staff')\nreturn Response({'data': users})", "username = request.data.get('username', None)\npassword = request.d...
<|body_start_0|> user = get_object_or_404(self.queryset, pk=pk) serializer = self.get_serializer(user) return Response(serializer.data) <|end_body_0|> <|body_start_1|> print(request.version) users = self.queryset.values('id', 'username', 'is_staff') return Response({'dat...
通过session确定认证,这个viewset下面的api需要session认证通过才能访问
UsersViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersViewSet: """通过session确定认证,这个viewset下面的api需要session认证通过才能访问""" def retrieve(self, request, pk=None): """指定用户信息""" <|body_0|> def list(self, request): """users列表""" <|body_1|> def create(self, request): """创建用户""" <|body_2|> d...
stack_v2_sparse_classes_10k_train_001265
5,186
no_license
[ { "docstring": "指定用户信息", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" }, { "docstring": "users列表", "name": "list", "signature": "def list(self, request)" }, { "docstring": "创建用户", "name": "create", "signature": "def create(self, request)" }, ...
5
stack_v2_sparse_classes_30k_train_003738
Implement the Python class `UsersViewSet` described below. Class description: 通过session确定认证,这个viewset下面的api需要session认证通过才能访问 Method signatures and docstrings: - def retrieve(self, request, pk=None): 指定用户信息 - def list(self, request): users列表 - def create(self, request): 创建用户 - def destroy(self, request, pk=None): 删除用户...
Implement the Python class `UsersViewSet` described below. Class description: 通过session确定认证,这个viewset下面的api需要session认证通过才能访问 Method signatures and docstrings: - def retrieve(self, request, pk=None): 指定用户信息 - def list(self, request): users列表 - def create(self, request): 创建用户 - def destroy(self, request, pk=None): 删除用户...
28a0b04ee3b9ca7e2d6e84e522047c63b0d19c8f
<|skeleton|> class UsersViewSet: """通过session确定认证,这个viewset下面的api需要session认证通过才能访问""" def retrieve(self, request, pk=None): """指定用户信息""" <|body_0|> def list(self, request): """users列表""" <|body_1|> def create(self, request): """创建用户""" <|body_2|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UsersViewSet: """通过session确定认证,这个viewset下面的api需要session认证通过才能访问""" def retrieve(self, request, pk=None): """指定用户信息""" user = get_object_or_404(self.queryset, pk=pk) serializer = self.get_serializer(user) return Response(serializer.data) def list(self, request): ...
the_stack_v2_python_sparse
mysite/users/views/users.py
26huitailang/django-tutorial
train
1
ede13065510e4903d5f52abfd5b7ae28abab7134
[ "identifier = self.data['id']\nitem = self.core.item_manager.items.get(identifier)\nif not item:\n return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with identifier {identifier}', 404)\nreturn self.json({'item': item.identifier, 'type': item.type, 'states': await item.states.dump()})", "identifier = self...
<|body_start_0|> identifier = self.data['id'] item = self.core.item_manager.items.get(identifier) if not item: return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with identifier {identifier}', 404) return self.json({'item': item.identifier, 'type': item.type, 'states': a...
Item states view
ItemStatesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemStatesView: """Item states view""" async def get(self) -> JSONResponse: """GET /item/{id}/states""" <|body_0|> async def post(self) -> JSONResponse: """POST /item/{id}/states""" <|body_1|> <|end_skeleton|> <|body_start_0|> identifier = self....
stack_v2_sparse_classes_10k_train_001266
10,547
permissive
[ { "docstring": "GET /item/{id}/states", "name": "get", "signature": "async def get(self) -> JSONResponse" }, { "docstring": "POST /item/{id}/states", "name": "post", "signature": "async def post(self) -> JSONResponse" } ]
2
stack_v2_sparse_classes_30k_train_002285
Implement the Python class `ItemStatesView` described below. Class description: Item states view Method signatures and docstrings: - async def get(self) -> JSONResponse: GET /item/{id}/states - async def post(self) -> JSONResponse: POST /item/{id}/states
Implement the Python class `ItemStatesView` described below. Class description: Item states view Method signatures and docstrings: - async def get(self) -> JSONResponse: GET /item/{id}/states - async def post(self) -> JSONResponse: POST /item/{id}/states <|skeleton|> class ItemStatesView: """Item states view""" ...
ee630d3ebf96d5b1d2055487d49968bdbb93d5b9
<|skeleton|> class ItemStatesView: """Item states view""" async def get(self) -> JSONResponse: """GET /item/{id}/states""" <|body_0|> async def post(self) -> JSONResponse: """POST /item/{id}/states""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ItemStatesView: """Item states view""" async def get(self) -> JSONResponse: """GET /item/{id}/states""" identifier = self.data['id'] item = self.core.item_manager.items.get(identifier) if not item: return self.error(ERROR_ITEM_NOT_FOUND, f'No item found with id...
the_stack_v2_python_sparse
homecontrol/modules/api/endpoints.py
lennart-k/HomeControl
train
7
1a1ed9851ca902d01ba558addcbc9bdcb49e8c6f
[ "for u_file in workspace.iter_files():\n if self.BIB_FILE.search(u_file.name):\n self._check_for_missing_bbl_file(workspace, u_file)", "base_path, name = os.path.split(u_file.path)\nbase, _ = os.path.splitext(name)\nbbl_file = f'{base}.bbl'\nbbl_path = os.path.join(base_path, bbl_file)\nif workspace.exi...
<|body_start_0|> for u_file in workspace.iter_files(): if self.BIB_FILE.search(u_file.name): self._check_for_missing_bbl_file(workspace, u_file) <|end_body_0|> <|body_start_1|> base_path, name = os.path.split(u_file.path) base, _ = os.path.splitext(name) bbl_...
Checks for .bib files, and removes them if a .bbl file is present. New modified handling of .bib without .bbl. We no longer delete .bib UNLESS we detect .bbl file. Generate error until we have .bbl.
CheckForMissingReferences
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckForMissingReferences: """Checks for .bib files, and removes them if a .bbl file is present. New modified handling of .bib without .bbl. We no longer delete .bib UNLESS we detect .bbl file. Generate error until we have .bbl.""" def check_workspace(self, workspace: Workspace) -> None: ...
stack_v2_sparse_classes_10k_train_001267
3,488
no_license
[ { "docstring": "Check for a .bib file, and remove if a .bbl file is present.", "name": "check_workspace", "signature": "def check_workspace(self, workspace: Workspace) -> None" }, { "docstring": "Look for a sibling .bbl file. If found, delete the .bib file. Otherwise, add an error, as this is ve...
2
stack_v2_sparse_classes_30k_train_005436
Implement the Python class `CheckForMissingReferences` described below. Class description: Checks for .bib files, and removes them if a .bbl file is present. New modified handling of .bib without .bbl. We no longer delete .bib UNLESS we detect .bbl file. Generate error until we have .bbl. Method signatures and docstr...
Implement the Python class `CheckForMissingReferences` described below. Class description: Checks for .bib files, and removes them if a .bbl file is present. New modified handling of .bib without .bbl. We no longer delete .bib UNLESS we detect .bbl file. Generate error until we have .bbl. Method signatures and docstr...
dfb71a40125324b1c1f4eb865c84cd9d2e512e6c
<|skeleton|> class CheckForMissingReferences: """Checks for .bib files, and removes them if a .bbl file is present. New modified handling of .bib without .bbl. We no longer delete .bib UNLESS we detect .bbl file. Generate error until we have .bbl.""" def check_workspace(self, workspace: Workspace) -> None: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CheckForMissingReferences: """Checks for .bib files, and removes them if a .bbl file is present. New modified handling of .bib without .bbl. We no longer delete .bib UNLESS we detect .bbl file. Generate error until we have .bbl.""" def check_workspace(self, workspace: Workspace) -> None: """Check...
the_stack_v2_python_sparse
filemanager/process/check/missing_references.py
arXiv/arxiv-filemanager
train
5
479c8b711df7bd95d1c9d587ade2469d33f3b92f
[ "self.DetectorObj = Detector(light_type, position, angle)\nself.detector_type = self.DetectorObj.detector_type\nself.psd = self.DetectorObj.psd\nself.intensity = self.DetectorObj.intensity\nself.database = self.DetectorObj.database\nself.position = self.DetectorObj.position\nself.angle = self.DetectorObj.angle\nsel...
<|body_start_0|> self.DetectorObj = Detector(light_type, position, angle) self.detector_type = self.DetectorObj.detector_type self.psd = self.DetectorObj.psd self.intensity = self.DetectorObj.intensity self.database = self.DetectorObj.database self.position = self.Detecto...
TestDetectorTypes
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDetectorTypes: def setUp(self): """Setup function TestTypes for class Detector""" <|body_0|> def test_types(self): """Function to test data types for class Detector""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.DetectorObj = Detector(ligh...
stack_v2_sparse_classes_10k_train_001268
1,617
permissive
[ { "docstring": "Setup function TestTypes for class Detector", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Function to test data types for class Detector", "name": "test_types", "signature": "def test_types(self)" } ]
2
stack_v2_sparse_classes_30k_train_004063
Implement the Python class `TestDetectorTypes` described below. Class description: Implement the TestDetectorTypes class. Method signatures and docstrings: - def setUp(self): Setup function TestTypes for class Detector - def test_types(self): Function to test data types for class Detector
Implement the Python class `TestDetectorTypes` described below. Class description: Implement the TestDetectorTypes class. Method signatures and docstrings: - def setUp(self): Setup function TestTypes for class Detector - def test_types(self): Function to test data types for class Detector <|skeleton|> class TestDete...
825a0eab64be709efe161b9a48eb54c4bc5c1bef
<|skeleton|> class TestDetectorTypes: def setUp(self): """Setup function TestTypes for class Detector""" <|body_0|> def test_types(self): """Function to test data types for class Detector""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestDetectorTypes: def setUp(self): """Setup function TestTypes for class Detector""" self.DetectorObj = Detector(light_type, position, angle) self.detector_type = self.DetectorObj.detector_type self.psd = self.DetectorObj.psd self.intensity = self.DetectorObj.intensity...
the_stack_v2_python_sparse
VLC_devel/class_structure/__auto_gen__/test_Detector.py
wenh81/vlc_simulator
train
0
c5afd837def6a6ec93ab77a5746a49b3d3ffd86d
[ "self.name = name\nconv2d = functools.partial(LayerConv, w=3, n=[nc, nc], stride=1, padding=padding, use_scaling=use_scaling, relu_slope=relu_slope)\nself.blocks = []\nwith tf.variable_scope(self.name):\n with tf.variable_scope('res0'):\n if use_dropout:\n self.blocks.append(LayerPipe([conv2d('...
<|body_start_0|> self.name = name conv2d = functools.partial(LayerConv, w=3, n=[nc, nc], stride=1, padding=padding, use_scaling=use_scaling, relu_slope=relu_slope) self.blocks = [] with tf.variable_scope(self.name): with tf.variable_scope('res0'): if use_dropo...
ResBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResBlock: def __init__(self, name, nc, norm_layer_constructor, activation, padding='SAME', use_scaling=False, relu_slope=1.0, use_dropout=False): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. nc: 2-tuple of ints, input an...
stack_v2_sparse_classes_10k_train_001269
13,442
permissive
[ { "docstring": "Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. nc: 2-tuple of ints, input and output channel depths. padding: string, the padding method {SAME, VALID, REFLECT}. use_scaling: bool, whether to use weight norm and scaling. relu_slope: f...
2
stack_v2_sparse_classes_30k_train_000429
Implement the Python class `ResBlock` described below. Class description: Implement the ResBlock class. Method signatures and docstrings: - def __init__(self, name, nc, norm_layer_constructor, activation, padding='SAME', use_scaling=False, relu_slope=1.0, use_dropout=False): Layer constructor. Args: name: string, lay...
Implement the Python class `ResBlock` described below. Class description: Implement the ResBlock class. Method signatures and docstrings: - def __init__(self, name, nc, norm_layer_constructor, activation, padding='SAME', use_scaling=False, relu_slope=1.0, use_dropout=False): Layer constructor. Args: name: string, lay...
091d6ae9e087cf5a6e18b00bce7d8f7ede9d9d08
<|skeleton|> class ResBlock: def __init__(self, name, nc, norm_layer_constructor, activation, padding='SAME', use_scaling=False, relu_slope=1.0, use_dropout=False): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. nc: 2-tuple of ints, input an...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ResBlock: def __init__(self, name, nc, norm_layer_constructor, activation, padding='SAME', use_scaling=False, relu_slope=1.0, use_dropout=False): """Layer constructor. Args: name: string, layer name. stride: int or 2-tuple, stride for the convolution kernel. nc: 2-tuple of ints, input and output chann...
the_stack_v2_python_sparse
layers.py
MoustafaMeshry/StEP
train
6
fe1b68be12c5b5606e3c516dd1543be259d091e3
[ "data_list = []\nresults = self.query.all()\nformatter = self.request.locale.dates.getFormatter('date', 'short')\nfor result in results:\n data = {}\n data['qid'] = 'm_' + str(result.motion_id)\n data['subject'] = u'M ' + str(result.motion_number) + u' ' + result.short_name\n data['title'] = result.shor...
<|body_start_0|> data_list = [] results = self.query.all() formatter = self.request.locale.dates.getFormatter('date', 'short') for result in results: data = {} data['qid'] = 'm_' + str(result.motion_id) data['subject'] = u'M ' + str(result.motion_numbe...
MotionInStateViewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MotionInStateViewlet: def getData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|> <|body_start_0|> data_list = [] results = self.query.all() formatter = self....
stack_v2_sparse_classes_10k_train_001270
35,739
no_license
[ { "docstring": "return the data of the query", "name": "getData", "signature": "def getData(self)" }, { "docstring": "refresh the query", "name": "update", "signature": "def update(self)" } ]
2
null
Implement the Python class `MotionInStateViewlet` described below. Class description: Implement the MotionInStateViewlet class. Method signatures and docstrings: - def getData(self): return the data of the query - def update(self): refresh the query
Implement the Python class `MotionInStateViewlet` described below. Class description: Implement the MotionInStateViewlet class. Method signatures and docstrings: - def getData(self): return the data of the query - def update(self): refresh the query <|skeleton|> class MotionInStateViewlet: def getData(self): ...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class MotionInStateViewlet: def getData(self): """return the data of the query""" <|body_0|> def update(self): """refresh the query""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MotionInStateViewlet: def getData(self): """return the data of the query""" data_list = [] results = self.query.all() formatter = self.request.locale.dates.getFormatter('date', 'short') for result in results: data = {} data['qid'] = 'm_' + str(re...
the_stack_v2_python_sparse
bungeni.buildout/branches/bungeni.buildout-refactor-2010-06-02/src/bungeni.main/bungeni/ui/viewlets/workspace.py
malangalanga/bungeni-portal
train
0
62f2e3555a08a9233e79638ad61e7e08be4ea68c
[ "if not data_kinds:\n data_kinds = [DataKind.WEIGHT_DIFF, DataKind.WEIGHTS]\nsuper().__init__(supported_data_kinds=[DataKind.WEIGHTS, DataKind.WEIGHT_DIFF], data_kinds_to_filter=data_kinds)\nself.exclude_vars = exclude_vars\nself.skip = False\nif self.exclude_vars is not None:\n if not (isinstance(self.exclud...
<|body_start_0|> if not data_kinds: data_kinds = [DataKind.WEIGHT_DIFF, DataKind.WEIGHTS] super().__init__(supported_data_kinds=[DataKind.WEIGHTS, DataKind.WEIGHT_DIFF], data_kinds_to_filter=data_kinds) self.exclude_vars = exclude_vars self.skip = False if self.exclud...
ExcludeVars
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExcludeVars: def __init__(self, exclude_vars: Union[List[str], str, None]=None, data_kinds: List[str]=None): """Exclude/Remove variables from Shareable. Args: exclude_vars (Union[List[str], str, None] , optional): variables/layer names to be excluded. data_kinds: kinds of DXO object to f...
stack_v2_sparse_classes_10k_train_001271
4,804
permissive
[ { "docstring": "Exclude/Remove variables from Shareable. Args: exclude_vars (Union[List[str], str, None] , optional): variables/layer names to be excluded. data_kinds: kinds of DXO object to filter Notes: Based on different types of exclude_vars, this filter has different behavior: if a list of variable/layer n...
2
null
Implement the Python class `ExcludeVars` described below. Class description: Implement the ExcludeVars class. Method signatures and docstrings: - def __init__(self, exclude_vars: Union[List[str], str, None]=None, data_kinds: List[str]=None): Exclude/Remove variables from Shareable. Args: exclude_vars (Union[List[str]...
Implement the Python class `ExcludeVars` described below. Class description: Implement the ExcludeVars class. Method signatures and docstrings: - def __init__(self, exclude_vars: Union[List[str], str, None]=None, data_kinds: List[str]=None): Exclude/Remove variables from Shareable. Args: exclude_vars (Union[List[str]...
1433290c203bd23f34c29e11795ce592bc067888
<|skeleton|> class ExcludeVars: def __init__(self, exclude_vars: Union[List[str], str, None]=None, data_kinds: List[str]=None): """Exclude/Remove variables from Shareable. Args: exclude_vars (Union[List[str], str, None] , optional): variables/layer names to be excluded. data_kinds: kinds of DXO object to f...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExcludeVars: def __init__(self, exclude_vars: Union[List[str], str, None]=None, data_kinds: List[str]=None): """Exclude/Remove variables from Shareable. Args: exclude_vars (Union[List[str], str, None] , optional): variables/layer names to be excluded. data_kinds: kinds of DXO object to filter Notes: B...
the_stack_v2_python_sparse
nvflare/app_common/filters/exclude_vars.py
NVIDIA/NVFlare
train
442
c528b65351ac1d5e000c4844dcd29781b8bac9e3
[ "i, j = (0, len(nums) - 1)\nwhile i < j:\n m = i + (j - i) // 2\n e = 2 * (m // 2)\n o = e + 1\n if nums[e] == nums[o]:\n i = o + 1\n else:\n j = e - 1\nreturn nums[i]", "if len(nums) == 1:\n return nums[0]\ns, e = (0, (len(nums) + 1) // 2 - 1)\nwhile s <= e:\n m = s + (e - s) /...
<|body_start_0|> i, j = (0, len(nums) - 1) while i < j: m = i + (j - i) // 2 e = 2 * (m // 2) o = e + 1 if nums[e] == nums[o]: i = o + 1 else: j = e - 1 return nums[i] <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """06/03/2020 21:59""" <|body_0|> def singleNonDuplicate(self, nums: List[int]) -> int: """Nov 30, 2021 21:40""" <|body_1|> def singleNonDuplicate(self, nums: List[int]) -> int: """N...
stack_v2_sparse_classes_10k_train_001272
3,053
no_license
[ { "docstring": "06/03/2020 21:59", "name": "singleNonDuplicate", "signature": "def singleNonDuplicate(self, nums: List[int]) -> int" }, { "docstring": "Nov 30, 2021 21:40", "name": "singleNonDuplicate", "signature": "def singleNonDuplicate(self, nums: List[int]) -> int" }, { "doc...
5
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNonDuplicate(self, nums: List[int]) -> int: 06/03/2020 21:59 - def singleNonDuplicate(self, nums: List[int]) -> int: Nov 30, 2021 21:40 - def singleNonDuplicate(self, n...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNonDuplicate(self, nums: List[int]) -> int: 06/03/2020 21:59 - def singleNonDuplicate(self, nums: List[int]) -> int: Nov 30, 2021 21:40 - def singleNonDuplicate(self, n...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """06/03/2020 21:59""" <|body_0|> def singleNonDuplicate(self, nums: List[int]) -> int: """Nov 30, 2021 21:40""" <|body_1|> def singleNonDuplicate(self, nums: List[int]) -> int: """N...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def singleNonDuplicate(self, nums: List[int]) -> int: """06/03/2020 21:59""" i, j = (0, len(nums) - 1) while i < j: m = i + (j - i) // 2 e = 2 * (m // 2) o = e + 1 if nums[e] == nums[o]: i = o + 1 els...
the_stack_v2_python_sparse
leetcode/solved/540_Single_Element_in_a_Sorted_Array/solution.py
sungminoh/algorithms
train
0
7d99a8f2d15085cbb9b8f21f29c5400f4f37a6a0
[ "if sourceSplineObj is None:\n raise TypeError('Expect a spline object got {0}'.format(sourceSplineObj.__class__.__name__))\nif sourceSplineObj.IsInstanceOf(c4d.Onull):\n return None\nif not sourceSplineObj.IsInstanceOf(c4d.Oline) and (not sourceSplineObj.GetInfo() & c4d.OBJECT_ISSPLINE):\n raise TypeError...
<|body_start_0|> if sourceSplineObj is None: raise TypeError('Expect a spline object got {0}'.format(sourceSplineObj.__class__.__name__)) if sourceSplineObj.IsInstanceOf(c4d.Onull): return None if not sourceSplineObj.IsInstanceOf(c4d.Oline) and (not sourceSplineObj.GetInf...
SplineInputGeneratorHelper
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SplineInputGeneratorHelper: def FinalSpline(sourceSplineObj): """Retrieves the final (deformed) representation of the spline. Args: sourceSplineObj (c4d.BaseObject or c4d.SplineObject or LineObject): A c4d.BaseObject that can be represented as a Spline. Returns: c4d.SplineObject: The fin...
stack_v2_sparse_classes_10k_train_001273
14,416
permissive
[ { "docstring": "Retrieves the final (deformed) representation of the spline. Args: sourceSplineObj (c4d.BaseObject or c4d.SplineObject or LineObject): A c4d.BaseObject that can be represented as a Spline. Returns: c4d.SplineObject: The final Spline/Line Object, SplineObject should be returned when it's possible...
4
stack_v2_sparse_classes_30k_train_000305
Implement the Python class `SplineInputGeneratorHelper` described below. Class description: Implement the SplineInputGeneratorHelper class. Method signatures and docstrings: - def FinalSpline(sourceSplineObj): Retrieves the final (deformed) representation of the spline. Args: sourceSplineObj (c4d.BaseObject or c4d.Sp...
Implement the Python class `SplineInputGeneratorHelper` described below. Class description: Implement the SplineInputGeneratorHelper class. Method signatures and docstrings: - def FinalSpline(sourceSplineObj): Retrieves the final (deformed) representation of the spline. Args: sourceSplineObj (c4d.BaseObject or c4d.Sp...
b1ea3fce533df34094bc3d0bd6460dfb84306e53
<|skeleton|> class SplineInputGeneratorHelper: def FinalSpline(sourceSplineObj): """Retrieves the final (deformed) representation of the spline. Args: sourceSplineObj (c4d.BaseObject or c4d.SplineObject or LineObject): A c4d.BaseObject that can be represented as a Spline. Returns: c4d.SplineObject: The fin...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SplineInputGeneratorHelper: def FinalSpline(sourceSplineObj): """Retrieves the final (deformed) representation of the spline. Args: sourceSplineObj (c4d.BaseObject or c4d.SplineObject or LineObject): A c4d.BaseObject that can be represented as a Spline. Returns: c4d.SplineObject: The final Spline/Line...
the_stack_v2_python_sparse
plugins/py-osffset_y_spline_r16/py-osffset_y_spline_r16.pyp
PluginCafe/cinema4d_py_sdk_extended
train
112
bc403fcdd9722d84dd2b72e1f64e8c21370e268f
[ "self.graph = graph\nself.point_dict = dict()\nself.radius = 1.0", "if root is None:\n algorithm = TreeCenter(self.graph)\n algorithm.run()\n root = algorithm.tree_center[0]\nself.plot(root, 0.0, 2.0 * math.pi, level=0)", "angle = 0.5 * (left + right)\nx = self.radius * level * math.cos(angle)\ny = sel...
<|body_start_0|> self.graph = graph self.point_dict = dict() self.radius = 1.0 <|end_body_0|> <|body_start_1|> if root is None: algorithm = TreeCenter(self.graph) algorithm.run() root = algorithm.tree_center[0] self.plot(root, 0.0, 2.0 * math....
Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions.
TreePlot
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TreePlot: """Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_001274
3,663
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, root=None)" }, { "docstring": "Find node positions. Parameters ---------- source : c...
3
stack_v2_sparse_classes_30k_val_000132
Implement the Python class `TreePlot` described below. Class description: Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions. Method signatures and docstrings: - def __init__(self, graph): T...
Implement the Python class `TreePlot` described below. Class description: Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions. Method signatures and docstrings: - def __init__(self, graph): T...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class TreePlot: """Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TreePlot: """Finding the positions of tree nodes in the plane. This is not suitable for large trees (|V| > 1e4) due to numerical errors. For large trees use TreePlotRadiusAngle with fractions.""" def __init__(self, graph): """The algorithm initialization.""" self.graph = graph sel...
the_stack_v2_python_sparse
graphtheory/forests/treeplot.py
kgashok/graphs-dict
train
0
a5df710216898b36bd489aec2be984a72a5188e3
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\ntry:\n dep = dependencias.read(id)\nexcept psycopg2.Error as err:\n ns.abort(400, message=get_msg_pgerror(err))\nexcept EmptySetError:\n ns.abort(404, message=self.dep_not_found)\nexcept Exception as err:\n ...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: dep = dependencias.read(id) except psycopg2.Error as err: ns.abort(400, message=get_msg_pgerror(err)) except EmptySetError:...
Dependencia
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dependencia: def get(self, id): """Recuperar una dependencia""" <|body_0|> def put(self, id): """Actualizar una dependencia""" <|body_1|> def delete(self, id): """Eliminar una dependencia""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_001275
6,772
no_license
[ { "docstring": "Recuperar una dependencia", "name": "get", "signature": "def get(self, id)" }, { "docstring": "Actualizar una dependencia", "name": "put", "signature": "def put(self, id)" }, { "docstring": "Eliminar una dependencia", "name": "delete", "signature": "def de...
3
stack_v2_sparse_classes_30k_train_002857
Implement the Python class `Dependencia` described below. Class description: Implement the Dependencia class. Method signatures and docstrings: - def get(self, id): Recuperar una dependencia - def put(self, id): Actualizar una dependencia - def delete(self, id): Eliminar una dependencia
Implement the Python class `Dependencia` described below. Class description: Implement the Dependencia class. Method signatures and docstrings: - def get(self, id): Recuperar una dependencia - def put(self, id): Actualizar una dependencia - def delete(self, id): Eliminar una dependencia <|skeleton|> class Dependenci...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class Dependencia: def get(self, id): """Recuperar una dependencia""" <|body_0|> def put(self, id): """Actualizar una dependencia""" <|body_1|> def delete(self, id): """Eliminar una dependencia""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Dependencia: def get(self, id): """Recuperar una dependencia""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) try: dep = dependencias.read(id) except psycopg2.Error as err: ns.abort...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/dependencias.py
Telematica/knight-rider
train
1
c6a89f14f95b00f4923eac9b31d5efc959457afd
[ "if len(initial_counter_block) == prefix_len + counter_len:\n self.nonce = _copy_bytes(None, prefix_len, initial_counter_block)\n 'Nonce; not available if there is a fixed suffix'\nself._state = VoidPointer()\nresult = raw_ctr_lib.CTR_start_operation(block_cipher.get(), c_uint8_ptr(initial_counter_block), c_s...
<|body_start_0|> if len(initial_counter_block) == prefix_len + counter_len: self.nonce = _copy_bytes(None, prefix_len, initial_counter_block) 'Nonce; not available if there is a fixed suffix' self._state = VoidPointer() result = raw_ctr_lib.CTR_start_operation(block_ciphe...
*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *counter* which must be unique across a...
CtrMode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtrMode: """*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *cou...
stack_v2_sparse_classes_10k_train_001276
15,880
permissive
[ { "docstring": "Create a new block cipher, configured in CTR mode. :Parameters: block_cipher : C pointer A smart pointer to the low-level block cipher instance. initial_counter_block : bytes/bytearray/memoryview The initial plaintext to use to generate the key stream. It is as large as the cipher block, and it ...
3
stack_v2_sparse_classes_30k_train_000024
Implement the Python class `CtrMode` described below. Class description: *CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Eac...
Implement the Python class `CtrMode` described below. Class description: *CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Eac...
fa82044a2dc2f0f1f7454f5394e6d68fa923c289
<|skeleton|> class CtrMode: """*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *cou...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CtrMode: """*CounTeR (CTR)* mode. This mode is very similar to ECB, in that encryption of one block is done independently of all other blocks. Unlike ECB, the block *position* contributes to the encryption and no information leaks about symbol frequency. Each message block is associated to a *counter* which m...
the_stack_v2_python_sparse
venv/lib/python3.6/site-packages/Crypto/Cipher/_mode_ctr.py
masora1030/eigoyurusan
train
11
6c6596da1613c2ae2d0dd27c1024a310728691bd
[ "self.mv_21_mv_71 = mv_21_mv_71\nself.mv_12_mv_22_mv_72 = mv_12_mv_22_mv_72\nself.mv_32 = mv_32\nself.mv_12_we = mv_12_we", "if dictionary is None:\n return None\nmv_21_mv_71 = meraki_sdk.models.mv_21_mv_71_model.MV21MV71Model.from_dictionary(dictionary.get('MV21/MV71')) if dictionary.get('MV21/MV71') else Non...
<|body_start_0|> self.mv_21_mv_71 = mv_21_mv_71 self.mv_12_mv_22_mv_72 = mv_12_mv_22_mv_72 self.mv_32 = mv_32 self.mv_12_we = mv_12_we <|end_body_0|> <|body_start_1|> if dictionary is None: return None mv_21_mv_71 = meraki_sdk.models.mv_21_mv_71_model.MV21MV7...
Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/MV22/MV72 camera models. mv_32 (MV32Model): Qu...
VideoSettingsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VideoSettingsModel: """Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/...
stack_v2_sparse_classes_10k_train_001277
2,971
permissive
[ { "docstring": "Constructor for the VideoSettingsModel class", "name": "__init__", "signature": "def __init__(self, mv_21_mv_71=None, mv_12_mv_22_mv_72=None, mv_32=None, mv_12_we=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictio...
2
null
Implement the Python class `VideoSettingsModel` described below. Class description: Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72M...
Implement the Python class `VideoSettingsModel` described below. Class description: Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72M...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class VideoSettingsModel: """Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VideoSettingsModel: """Implementation of the 'VideoSettings' model. Video quality and resolution settings for all the camera models. Attributes: mv_21_mv_71 (MV21MV71Model): Quality and resolution for MV21/MV71 camera models. mv_12_mv_22_mv_72 (MV12MV22MV72Model): Quality and resolution for MV12/MV22/MV72 cam...
the_stack_v2_python_sparse
meraki_sdk/models/video_settings_model.py
RaulCatalano/meraki-python-sdk
train
1
1c30e177e19b9845715f0ad9a2e0f01622919a2d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn RiskDetection()", "from .activity_type import ActivityType\nfrom .entity import Entity\nfrom .risk_detail import RiskDetail\nfrom .risk_detection_timing_type import RiskDetectionTimingType\nfrom .risk_level import RiskLevel\nfrom .risk...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return RiskDetection() <|end_body_0|> <|body_start_1|> from .activity_type import ActivityType from .entity import Entity from .risk_detail import RiskDetail from .risk_detectio...
RiskDetection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RiskDetection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskDetection: """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...
stack_v2_sparse_classes_10k_train_001278
10,613
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: RiskDetection", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value...
3
stack_v2_sparse_classes_30k_test_000093
Implement the Python class `RiskDetection` described below. Class description: Implement the RiskDetection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskDetection: Creates a new instance of the appropriate class based on discriminator value...
Implement the Python class `RiskDetection` described below. Class description: Implement the RiskDetection class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskDetection: Creates a new instance of the appropriate class based on discriminator value...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class RiskDetection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskDetection: """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...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RiskDetection: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskDetection: """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: RiskDetectio...
the_stack_v2_python_sparse
msgraph/generated/models/risk_detection.py
microsoftgraph/msgraph-sdk-python
train
135
e5d1fbd725e3dcfa1fa4c667e06a871641547634
[ "user = User.objects.create_user(username='some_username', password='some_password', email='some_email@gmail.com')\nProfile.objects.create_player(username='some_username')\nself.client.credentials(HTTP_AUTHORIZATION='Token {}'.format(user.auth_token.key))\nresponse = self.client.get(self.url)\nself.assertEqual(resp...
<|body_start_0|> user = User.objects.create_user(username='some_username', password='some_password', email='some_email@gmail.com') Profile.objects.create_player(username='some_username') self.client.credentials(HTTP_AUTHORIZATION='Token {}'.format(user.auth_token.key)) response = self.cl...
UserViewTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserViewTests: def test_get_user_details(self): """Ensure the user is setup properly and no unwanted details are revealed""" <|body_0|> def test_update_user_details(self): """Ensure that the change in the fields are saved""" <|body_1|> def test_last_seen...
stack_v2_sparse_classes_10k_train_001279
13,549
permissive
[ { "docstring": "Ensure the user is setup properly and no unwanted details are revealed", "name": "test_get_user_details", "signature": "def test_get_user_details(self)" }, { "docstring": "Ensure that the change in the fields are saved", "name": "test_update_user_details", "signature": "d...
3
stack_v2_sparse_classes_30k_train_002903
Implement the Python class `UserViewTests` described below. Class description: Implement the UserViewTests class. Method signatures and docstrings: - def test_get_user_details(self): Ensure the user is setup properly and no unwanted details are revealed - def test_update_user_details(self): Ensure that the change in ...
Implement the Python class `UserViewTests` described below. Class description: Implement the UserViewTests class. Method signatures and docstrings: - def test_get_user_details(self): Ensure the user is setup properly and no unwanted details are revealed - def test_update_user_details(self): Ensure that the change in ...
9fa31e01c8fc3496f92540081a8c078474d59c0f
<|skeleton|> class UserViewTests: def test_get_user_details(self): """Ensure the user is setup properly and no unwanted details are revealed""" <|body_0|> def test_update_user_details(self): """Ensure that the change in the fields are saved""" <|body_1|> def test_last_seen...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserViewTests: def test_get_user_details(self): """Ensure the user is setup properly and no unwanted details are revealed""" user = User.objects.create_user(username='some_username', password='some_password', email='some_email@gmail.com') Profile.objects.create_player(username='some_us...
the_stack_v2_python_sparse
player/tests.py
apoorvaeternity/DirectMe
train
1
54c4f3520d5d633aec41806b924b17ff1faf61a8
[ "QtWidgets.QDialog.__init__(self)\nself.findText = QtWidgets.QLineEdit()\nself.replaceText = QtWidgets.QLineEdit()\nself.layout = QtWidgets.QGridLayout(self)\nself.layout.addWidget(self.findText, 0, 1)\nself.layout.addWidget(QtWidgets.QLabel('Text to Find:'), 0, 0)\nself.layout.addWidget(self.replaceText, 1, 1)\nse...
<|body_start_0|> QtWidgets.QDialog.__init__(self) self.findText = QtWidgets.QLineEdit() self.replaceText = QtWidgets.QLineEdit() self.layout = QtWidgets.QGridLayout(self) self.layout.addWidget(self.findText, 0, 1) self.layout.addWidget(QtWidgets.QLabel('Text to Find:'), 0...
A dialog box to retrieve the two text values required by the findAndReplace function.
FindAndReplaceDialogBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindAndReplaceDialogBox: """A dialog box to retrieve the two text values required by the findAndReplace function.""" def __init__(self, parent): """Initializes the UI and sets the properties.""" <|body_0|> def getResults(self, parent=None): """Returns the user's ...
stack_v2_sparse_classes_10k_train_001280
29,548
no_license
[ { "docstring": "Initializes the UI and sets the properties.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "Returns the user's input", "name": "getResults", "signature": "def getResults(self, parent=None)" } ]
2
stack_v2_sparse_classes_30k_train_002313
Implement the Python class `FindAndReplaceDialogBox` described below. Class description: A dialog box to retrieve the two text values required by the findAndReplace function. Method signatures and docstrings: - def __init__(self, parent): Initializes the UI and sets the properties. - def getResults(self, parent=None)...
Implement the Python class `FindAndReplaceDialogBox` described below. Class description: A dialog box to retrieve the two text values required by the findAndReplace function. Method signatures and docstrings: - def __init__(self, parent): Initializes the UI and sets the properties. - def getResults(self, parent=None)...
1a3c5ad967472faf66236a311cc07a5128f5f911
<|skeleton|> class FindAndReplaceDialogBox: """A dialog box to retrieve the two text values required by the findAndReplace function.""" def __init__(self, parent): """Initializes the UI and sets the properties.""" <|body_0|> def getResults(self, parent=None): """Returns the user's ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FindAndReplaceDialogBox: """A dialog box to retrieve the two text values required by the findAndReplace function.""" def __init__(self, parent): """Initializes the UI and sets the properties.""" QtWidgets.QDialog.__init__(self) self.findText = QtWidgets.QLineEdit() self.re...
the_stack_v2_python_sparse
datatool/gui/Model.py
scottawalton/datatool
train
0
5816870a201e7830f4752728b303fc9eabcfd0d9
[ "_wavelet = pywt.Wavelet(wavelet)\nlogger.debug('Calculating wavelet coefficients with {w} wavelet'.format(w=_wavelet.family_name))\n_wavedec = pywt.wavedec(data=x, wavelet=_wavelet, axis=1, level=level)\nreturn cls._subset_coefficients(x=_wavedec, gid_count=x.shape[0], indices=indices)", "indices = indices or ra...
<|body_start_0|> _wavelet = pywt.Wavelet(wavelet) logger.debug('Calculating wavelet coefficients with {w} wavelet'.format(w=_wavelet.family_name)) _wavedec = pywt.wavedec(data=x, wavelet=_wavelet, axis=1, level=level) return cls._subset_coefficients(x=_wavedec, gid_count=x.shape[0], indi...
Base class for RPM wavelets
RPMWavelets
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RPMWavelets: """Base class for RPM wavelets""" def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): """Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavele...
stack_v2_sparse_classes_10k_train_001281
21,915
permissive
[ { "docstring": "Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavelet : string mother wavelet type level : int optional wavelet computation level indices : ndarray coefficient array levels to keep Returns -...
2
stack_v2_sparse_classes_30k_train_006529
Implement the Python class `RPMWavelets` described below. Class description: Base class for RPM wavelets Method signatures and docstrings: - def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Pa...
Implement the Python class `RPMWavelets` described below. Class description: Base class for RPM wavelets Method signatures and docstrings: - def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Pa...
2dd05402c9c05ca0bf7f0e5bc2849ede0d0bc3cb
<|skeleton|> class RPMWavelets: """Base class for RPM wavelets""" def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): """Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavele...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RPMWavelets: """Base class for RPM wavelets""" def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): """Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavelet : string mo...
the_stack_v2_python_sparse
reVX/rpm/rpm_clusters.py
NREL/reVX
train
10
019c9362a9d03118b14561e470d5de8aafeae4aa
[ "self.id = str(identity)\nself.direction = 'none'\nself.speed = 0", "self.speed = speed\noutput = '0' + self.id\nif self.speed < 11 and self.speed > -11:\n self.speed = 0\nelif self.speed < 0:\n output += '-'\n self.speed = self.speed * -1\nfor _ in range(4 - len(str(self.speed))):\n output += '0'\nou...
<|body_start_0|> self.id = str(identity) self.direction = 'none' self.speed = 0 <|end_body_0|> <|body_start_1|> self.speed = speed output = '0' + self.id if self.speed < 11 and self.speed > -11: self.speed = 0 elif self.speed < 0: output +...
A Wheel class representing a wheel of the emubot
Wheel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wheel: """A Wheel class representing a wheel of the emubot""" def __init__(self, identity): """Wheel.__init__(ID): parameters - the ID of the wheel""" <|body_0|> def move_wheel(self, speed): """Move the wheel""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_001282
2,748
permissive
[ { "docstring": "Wheel.__init__(ID): parameters - the ID of the wheel", "name": "__init__", "signature": "def __init__(self, identity)" }, { "docstring": "Move the wheel", "name": "move_wheel", "signature": "def move_wheel(self, speed)" } ]
2
stack_v2_sparse_classes_30k_train_006380
Implement the Python class `Wheel` described below. Class description: A Wheel class representing a wheel of the emubot Method signatures and docstrings: - def __init__(self, identity): Wheel.__init__(ID): parameters - the ID of the wheel - def move_wheel(self, speed): Move the wheel
Implement the Python class `Wheel` described below. Class description: A Wheel class representing a wheel of the emubot Method signatures and docstrings: - def __init__(self, identity): Wheel.__init__(ID): parameters - the ID of the wheel - def move_wheel(self, speed): Move the wheel <|skeleton|> class Wheel: ""...
a39dc01f7c1213c8079216d49d376b317efbf5f3
<|skeleton|> class Wheel: """A Wheel class representing a wheel of the emubot""" def __init__(self, identity): """Wheel.__init__(ID): parameters - the ID of the wheel""" <|body_0|> def move_wheel(self, speed): """Move the wheel""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Wheel: """A Wheel class representing a wheel of the emubot""" def __init__(self, identity): """Wheel.__init__(ID): parameters - the ID of the wheel""" self.id = str(identity) self.direction = 'none' self.speed = 0 def move_wheel(self, speed): """Move the wheel...
the_stack_v2_python_sparse
Client-Code-2018/CurrentEmuBotCode2/basic_classes.py
maxgodfrey2004/RoboCup-2018-Driving-Code
train
1
54dcc8891439a5350d8ec44525b64eda8554423c
[ "n = len(s)\nm = len(t)\ndp = [[0] * (m + 1) for _ in range(n + 1)]\ni = 0\nwhile i <= n:\n j = 0\n while j <= m:\n if i == j == 0:\n dp[i][j] = 0\n elif s[i - 1] == t[j - 1]:\n dp[i][j] = dp[i - 1][j - 1]\n else:\n dp[i][j] = min([dp[i - 1][j - 1] + 1, dp...
<|body_start_0|> n = len(s) m = len(t) dp = [[0] * (m + 1) for _ in range(n + 1)] i = 0 while i <= n: j = 0 while j <= m: if i == j == 0: dp[i][j] = 0 elif s[i - 1] == t[j - 1]: dp[i][...
@param s: a string @param t: a string @return: true if they are both one edit distance apart or false
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """@param s: a string @param t: a string @return: true if they are both one edit distance apart or false""" def isOneEditDistance(self, s, t): """Dynamic Programming solution (not recommended): O(n2) runtime, O(n2) space https://leetcode-cn.com/problems/edit-distance/soluti...
stack_v2_sparse_classes_10k_train_001283
1,840
no_license
[ { "docstring": "Dynamic Programming solution (not recommended): O(n2) runtime, O(n2) space https://leetcode-cn.com/problems/edit-distance/solution/edit-distance-by-ikaruga/", "name": "isOneEditDistance", "signature": "def isOneEditDistance(self, s, t)" }, { "docstring": "O(n) runtime, O(1) space...
2
null
Implement the Python class `Solution` described below. Class description: @param s: a string @param t: a string @return: true if they are both one edit distance apart or false Method signatures and docstrings: - def isOneEditDistance(self, s, t): Dynamic Programming solution (not recommended): O(n2) runtime, O(n2) sp...
Implement the Python class `Solution` described below. Class description: @param s: a string @param t: a string @return: true if they are both one edit distance apart or false Method signatures and docstrings: - def isOneEditDistance(self, s, t): Dynamic Programming solution (not recommended): O(n2) runtime, O(n2) sp...
3ea03cd8b1fa507553ebee4fd765c4cc4b5814b6
<|skeleton|> class Solution: """@param s: a string @param t: a string @return: true if they are both one edit distance apart or false""" def isOneEditDistance(self, s, t): """Dynamic Programming solution (not recommended): O(n2) runtime, O(n2) space https://leetcode-cn.com/problems/edit-distance/soluti...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: """@param s: a string @param t: a string @return: true if they are both one edit distance apart or false""" def isOneEditDistance(self, s, t): """Dynamic Programming solution (not recommended): O(n2) runtime, O(n2) space https://leetcode-cn.com/problems/edit-distance/solution/edit-dista...
the_stack_v2_python_sparse
One_Edit_Distance_14.py
jay6413682/Leetcode
train
0
7ba0a47cf51fc0b55be038ea136715870d3a13e3
[ "email = form.data.get('email')\nif User.objects.filter(email=email).first():\n messages.info(self.request, 'You already have an account on FireCARES. If you\\'ve forgotten your password or username, use the \"Forgot Password or Username\" links below.')\n return redirect('login')\nif RegistrationWhitelist.i...
<|body_start_0|> email = form.data.get('email') if User.objects.filter(email=email).first(): messages.info(self.request, 'You already have an account on FireCARES. If you\'ve forgotten your password or username, use the "Forgot Password or Username" links below.') return redirec...
Processes account requests.
AccountRequestView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountRequestView: """Processes account requests.""" def form_valid(self, form): """If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.""" <|body_0|> def form_invalid(self, form): """If the form is inval...
stack_v2_sparse_classes_10k_train_001284
23,296
permissive
[ { "docstring": "If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "If the form is invalid, re-render the context data with the data-filled form and err...
3
stack_v2_sparse_classes_30k_train_007235
Implement the Python class `AccountRequestView` described below. Class description: Processes account requests. Method signatures and docstrings: - def form_valid(self, form): If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address. - def form_invalid(self, form):...
Implement the Python class `AccountRequestView` described below. Class description: Processes account requests. Method signatures and docstrings: - def form_valid(self, form): If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address. - def form_invalid(self, form):...
aa708d441790263206dd3a0a480eb6ca9031439d
<|skeleton|> class AccountRequestView: """Processes account requests.""" def form_valid(self, form): """If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.""" <|body_0|> def form_invalid(self, form): """If the form is inval...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AccountRequestView: """Processes account requests.""" def form_valid(self, form): """If the form is valid AND the email is whitelisted, then send to registration; otherwise capture email address.""" email = form.data.get('email') if User.objects.filter(email=email).first(): ...
the_stack_v2_python_sparse
firecares/firecares_core/views.py
FireCARES/firecares
train
12
c2b33c3ac0039fdfa820f0eda8b5b2975c5975c4
[ "self.food = deque(food)\nself.width = width\nself.height = height\nself.bodyQueue = deque([(0, 0)])\nself.hashSet = set([(0, 0)])\nself.score = 0\nself.moveOps = {'U': (-1, 0), 'D': (1, 0), 'L': (0, -1), 'R': (0, 1)}", "s = self.hashSet\nq = self.bodyQueue\nops = self.moveOps\nwidth = self.width\nheight = self.h...
<|body_start_0|> self.food = deque(food) self.width = width self.height = height self.bodyQueue = deque([(0, 0)]) self.hashSet = set([(0, 0)]) self.score = 0 self.moveOps = {'U': (-1, 0), 'D': (1, 0), 'L': (0, -1), 'R': (0, 1)} <|end_body_0|> <|body_start_1|> ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_10k_train_001285
1,997
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
00bf9a8164008aa17507b1c87ce72a3374bcb7b9
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
solutions/353.design-snake-game.py
quixoteji/Leetcode
train
1
fa749a20fd799ae09726cb63bad95964bdcfb268
[ "self.machine = machine\nself.text = str(text)\nself._change_callback = None", "try:\n f = MpfFormatter(self.machine, parameters, False)\n return f.format(self.text)\nexcept Exception as e:\n raise AssertionError('Failed to format {} with {}'.format(self.text, parameters)) from e", "f = MpfFormatter(se...
<|body_start_0|> self.machine = machine self.text = str(text) self._change_callback = None <|end_body_0|> <|body_start_1|> try: f = MpfFormatter(self.machine, parameters, False) return f.format(self.text) except Exception as e: raise Assertion...
Text placeholder.
TextTemplate
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextTemplate: """Text placeholder.""" def __init__(self, machine: 'MachineController', text: str) -> None: """Initialise placeholder.""" <|body_0|> def evaluate(self, parameters) -> str: """Evaluate placeholder to string.""" <|body_1|> def evaluate_a...
stack_v2_sparse_classes_10k_train_001286
32,295
permissive
[ { "docstring": "Initialise placeholder.", "name": "__init__", "signature": "def __init__(self, machine: 'MachineController', text: str) -> None" }, { "docstring": "Evaluate placeholder to string.", "name": "evaluate", "signature": "def evaluate(self, parameters) -> str" }, { "doc...
3
null
Implement the Python class `TextTemplate` described below. Class description: Text placeholder. Method signatures and docstrings: - def __init__(self, machine: 'MachineController', text: str) -> None: Initialise placeholder. - def evaluate(self, parameters) -> str: Evaluate placeholder to string. - def evaluate_and_s...
Implement the Python class `TextTemplate` described below. Class description: Text placeholder. Method signatures and docstrings: - def __init__(self, machine: 'MachineController', text: str) -> None: Initialise placeholder. - def evaluate(self, parameters) -> str: Evaluate placeholder to string. - def evaluate_and_s...
9f90c8b1586363b65340017bfa3af5d56d32c6d9
<|skeleton|> class TextTemplate: """Text placeholder.""" def __init__(self, machine: 'MachineController', text: str) -> None: """Initialise placeholder.""" <|body_0|> def evaluate(self, parameters) -> str: """Evaluate placeholder to string.""" <|body_1|> def evaluate_a...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TextTemplate: """Text placeholder.""" def __init__(self, machine: 'MachineController', text: str) -> None: """Initialise placeholder.""" self.machine = machine self.text = str(text) self._change_callback = None def evaluate(self, parameters) -> str: """Evaluat...
the_stack_v2_python_sparse
mpf/core/placeholder_manager.py
missionpinball/mpf
train
191
8fd103c2892d529f5fd66ed603ad285900c9f5c9
[ "nbm = self.notebook_manager\nnbm.restore_checkpoint(notebook_id, checkpoint_id)\nself.set_status(204)\nself.finish()", "nbm = self.notebook_manager\nnbm.delte_checkpoint(notebook_id, checkpoint_id)\nself.set_status(204)\nself.finish()" ]
<|body_start_0|> nbm = self.notebook_manager nbm.restore_checkpoint(notebook_id, checkpoint_id) self.set_status(204) self.finish() <|end_body_0|> <|body_start_1|> nbm = self.notebook_manager nbm.delte_checkpoint(notebook_id, checkpoint_id) self.set_status(204) ...
ModifyNotebookCheckpointsHandler
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModifyNotebookCheckpointsHandler: def post(self, notebook_id, checkpoint_id): """post restores a notebook from a checkpoint""" <|body_0|> def delete(self, notebook_id, checkpoint_id): """delete clears a checkpoint for a given notebook""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k_train_001287
5,267
permissive
[ { "docstring": "post restores a notebook from a checkpoint", "name": "post", "signature": "def post(self, notebook_id, checkpoint_id)" }, { "docstring": "delete clears a checkpoint for a given notebook", "name": "delete", "signature": "def delete(self, notebook_id, checkpoint_id)" } ]
2
null
Implement the Python class `ModifyNotebookCheckpointsHandler` described below. Class description: Implement the ModifyNotebookCheckpointsHandler class. Method signatures and docstrings: - def post(self, notebook_id, checkpoint_id): post restores a notebook from a checkpoint - def delete(self, notebook_id, checkpoint_...
Implement the Python class `ModifyNotebookCheckpointsHandler` described below. Class description: Implement the ModifyNotebookCheckpointsHandler class. Method signatures and docstrings: - def post(self, notebook_id, checkpoint_id): post restores a notebook from a checkpoint - def delete(self, notebook_id, checkpoint_...
2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6
<|skeleton|> class ModifyNotebookCheckpointsHandler: def post(self, notebook_id, checkpoint_id): """post restores a notebook from a checkpoint""" <|body_0|> def delete(self, notebook_id, checkpoint_id): """delete clears a checkpoint for a given notebook""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModifyNotebookCheckpointsHandler: def post(self, notebook_id, checkpoint_id): """post restores a notebook from a checkpoint""" nbm = self.notebook_manager nbm.restore_checkpoint(notebook_id, checkpoint_id) self.set_status(204) self.finish() def delete(self, noteboo...
the_stack_v2_python_sparse
pkgs/ipython-1.2.1-py27_0/lib/python2.7/site-packages/IPython/html/services/notebooks/handlers.py
wangyum/Anaconda
train
11
7821f9731758664f91ed28101a4ac3279495276e
[ "temp_feature_keys = column_values\nkeys_features_length = len(temp_feature_keys)\nvariables_length = len(variables)\nfeature_keys = []\nfor i in range(keys_features_length * variables_length):\n quotient = int(i / keys_features_length)\n feature_keys.append(self.variables[quotient] + '_' + temp_feature_keys[...
<|body_start_0|> temp_feature_keys = column_values keys_features_length = len(temp_feature_keys) variables_length = len(variables) feature_keys = [] for i in range(keys_features_length * variables_length): quotient = int(i / keys_features_length) feature_k...
A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.
FeatureEngineering
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureEngineering: """A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.""" def _construct_feature_keys(self, column_values, variables): """Get the column values o...
stack_v2_sparse_classes_10k_train_001288
3,951
no_license
[ { "docstring": "Get the column values of one of the variables and since they are the same for all the variables because of tsfresh it expands the features by prepending the name of the variable. Parameters ---------- column_values: list A list with the values of the keys returned by tsfresh Returns ------- feat...
2
stack_v2_sparse_classes_30k_train_004976
Implement the Python class `FeatureEngineering` described below. Class description: A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier. Method signatures and docstrings: - def _construct_feature_keys...
Implement the Python class `FeatureEngineering` described below. Class description: A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier. Method signatures and docstrings: - def _construct_feature_keys...
d7e42676b64d177ded11d4731e11130c129d477b
<|skeleton|> class FeatureEngineering: """A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.""" def _construct_feature_keys(self, column_values, variables): """Get the column values o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FeatureEngineering: """A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.""" def _construct_feature_keys(self, column_values, variables): """Get the column values of one of the ...
the_stack_v2_python_sparse
code/classification/feature_engineering.py
mcbuehler/ssw-prediction
train
1
8276ec5dbe9c157bdb75502dcc89dec1cec3e946
[ "_, path = url_prefix.split(':')\npath = path.lstrip('/').rstrip('/')\npath_items = path.split('/')\nself.bucket = path_items.pop(0)\nself.prefix = '/'.join(path_items)\nself.s3 = boto3.client('s3')", "if not os.path.exists(output_dir):\n os.makedirs(output_dir)\nkey = f'{self.prefix}/{file_name}'\noutput_file...
<|body_start_0|> _, path = url_prefix.split(':') path = path.lstrip('/').rstrip('/') path_items = path.split('/') self.bucket = path_items.pop(0) self.prefix = '/'.join(path_items) self.s3 = boto3.client('s3') <|end_body_0|> <|body_start_1|> if not os.path.exists...
Downloader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Downloader: def __init__(self, url_prefix): """URL includes the bucket name and prefix, without filename, ie: s3://my_bucket/path/to/file/""" <|body_0|> def download(self, file_name, output_dir): """Download file from s3 into given file_path directory file_name: myfi...
stack_v2_sparse_classes_10k_train_001289
1,052
no_license
[ { "docstring": "URL includes the bucket name and prefix, without filename, ie: s3://my_bucket/path/to/file/", "name": "__init__", "signature": "def __init__(self, url_prefix)" }, { "docstring": "Download file from s3 into given file_path directory file_name: myfile.zip output_dir: /tmp/", "n...
2
stack_v2_sparse_classes_30k_train_005978
Implement the Python class `Downloader` described below. Class description: Implement the Downloader class. Method signatures and docstrings: - def __init__(self, url_prefix): URL includes the bucket name and prefix, without filename, ie: s3://my_bucket/path/to/file/ - def download(self, file_name, output_dir): Downl...
Implement the Python class `Downloader` described below. Class description: Implement the Downloader class. Method signatures and docstrings: - def __init__(self, url_prefix): URL includes the bucket name and prefix, without filename, ie: s3://my_bucket/path/to/file/ - def download(self, file_name, output_dir): Downl...
5f673f3238c0d13f2a5401573de0c1dd68e2a53f
<|skeleton|> class Downloader: def __init__(self, url_prefix): """URL includes the bucket name and prefix, without filename, ie: s3://my_bucket/path/to/file/""" <|body_0|> def download(self, file_name, output_dir): """Download file from s3 into given file_path directory file_name: myfi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Downloader: def __init__(self, url_prefix): """URL includes the bucket name and prefix, without filename, ie: s3://my_bucket/path/to/file/""" _, path = url_prefix.split(':') path = path.lstrip('/').rstrip('/') path_items = path.split('/') self.bucket = path_items.pop(0)...
the_stack_v2_python_sparse
importer/downloaders/s3.py
kflavin/importer
train
0
aaa53f0cccb3c0e1243abf6daa5670d7468b10e5
[ "super(Crash, self).__init__(Crash.__name__)\nif time is None:\n raise ValueError('Parameter \"time\": a time abstraction object expected but \"None\" value given!')\ncheck_argument_type(Crash.__name__, 'nodes_number', int, nodes_number, self.logger)\nif nodes_number <= 0:\n raise ValueError('Parameter \"node...
<|body_start_0|> super(Crash, self).__init__(Crash.__name__) if time is None: raise ValueError('Parameter "time": a time abstraction object expected but "None" value given!') check_argument_type(Crash.__name__, 'nodes_number', int, nodes_number, self.logger) if nodes_number <...
This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation.
Crash
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crash: """This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation.""" def __init__(self, time, nodes_number, crash_probability, maximum_crash_number, total_simulation_steps, transient_steps=0): ...
stack_v2_sparse_classes_10k_train_001290
11,001
permissive
[ { "docstring": "*Parameters*: - **time**: a simulation time object of the :class:`sim2net._time.Time` class; - **nodes_number** (`int`): the total number of nodes in the simulated network; - **crash_probability** (`float`): the probability that a single process will crash during the total simulation time; - **m...
3
stack_v2_sparse_classes_30k_train_002279
Implement the Python class `Crash` described below. Class description: This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation. Method signatures and docstrings: - def __init__(self, time, nodes_number, crash_probability, ma...
Implement the Python class `Crash` described below. Class description: This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation. Method signatures and docstrings: - def __init__(self, time, nodes_number, crash_probability, ma...
ed93d1e3067c569dd4194658b0d02da6b0ab4bed
<|skeleton|> class Crash: """This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation.""" def __init__(self, time, nodes_number, crash_probability, maximum_crash_number, total_simulation_steps, transient_steps=0): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Crash: """This class implements the process crash model. .. note:: It is presumed that the :meth:`node_failure` method is called at each step of the simulation.""" def __init__(self, time, nodes_number, crash_probability, maximum_crash_number, total_simulation_steps, transient_steps=0): """*Param...
the_stack_v2_python_sparse
sim2net/failure/crash.py
mkalewski/sim2net
train
14
eec269b1d989d34ae5f80122a3d62ee2dd7fe227
[ "t0 = Triangle()\nself.assertIsNot(t0, None)\nself.assertIsInstance(t0, Triangle)", "t1 = Triangle([1, 2, 3])\nself.assertIsNot(t1, None)\nself.assertIsInstance(t1, Triangle)\nt2 = Triangle('xyz')\nself.assertIsNot(t2, None)\nself.assertIsInstance(t2, Triangle)\nt3 = Triangle(['x', 'y', 'z'])\nself.assertIsNot(t3...
<|body_start_0|> t0 = Triangle() self.assertIsNot(t0, None) self.assertIsInstance(t0, Triangle) <|end_body_0|> <|body_start_1|> t1 = Triangle([1, 2, 3]) self.assertIsNot(t1, None) self.assertIsInstance(t1, Triangle) t2 = Triangle('xyz') self.assertIsNot(t...
Test Triangle class call
TestConstructor_Triangle
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" <|body_0|> def test_iterable(self): """Calling Vertex class with iterable key""" <|body_1|> def test_iterable_specific...
stack_v2_sparse_classes_10k_train_001291
11,224
permissive
[ { "docstring": "Calling Triangle class with no key (key = None)", "name": "test_none", "signature": "def test_none(self)" }, { "docstring": "Calling Vertex class with iterable key", "name": "test_iterable", "signature": "def test_iterable(self)" }, { "docstring": "Calling Vertex ...
3
stack_v2_sparse_classes_30k_val_000278
Implement the Python class `TestConstructor_Triangle` described below. Class description: Test Triangle class call Method signatures and docstrings: - def test_none(self): Calling Triangle class with no key (key = None) - def test_iterable(self): Calling Vertex class with iterable key - def test_iterable_specific(sel...
Implement the Python class `TestConstructor_Triangle` described below. Class description: Test Triangle class call Method signatures and docstrings: - def test_none(self): Calling Triangle class with no key (key = None) - def test_iterable(self): Calling Vertex class with iterable key - def test_iterable_specific(sel...
f9b00a39bc16aea4abac60c0dd0aab2acac5adcf
<|skeleton|> class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" <|body_0|> def test_iterable(self): """Calling Vertex class with iterable key""" <|body_1|> def test_iterable_specific...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestConstructor_Triangle: """Test Triangle class call""" def test_none(self): """Calling Triangle class with no key (key = None)""" t0 = Triangle() self.assertIsNot(t0, None) self.assertIsInstance(t0, Triangle) def test_iterable(self): """Calling Vertex class ...
the_stack_v2_python_sparse
_BACKUPS_V4/v4_5/LightPicture_Test.py
nagame/LightPicture
train
0
351cb3a3bf7348bdaf05dab2e109e3567874f0a1
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('jgrishey', 'jgrishey')\nif trial:\n crimes = list(repo['jgrishey.crime'].find(None, ['lat', 'long']))[:20]\nelse:\n crimes = list(repo['jgrishey.crime'].find(None, ['lat', 'long']))\ncrimes = np.ar...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jgrishey', 'jgrishey') if trial: crimes = list(repo['jgrishey.crime'].find(None, ['lat', 'long']))[:20] else: crimes = lis...
kMeansCrime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class kMeansCrime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything h...
stack_v2_sparse_classes_10k_train_001292
3,668
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_test_000390
Implement the Python class `kMeansCrime` described below. Class description: Implement the kMeansCrime class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTi...
Implement the Python class `kMeansCrime` described below. Class description: Implement the kMeansCrime class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTi...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class kMeansCrime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything h...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class kMeansCrime: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('jgrishey', 'jgrishey') if trial...
the_stack_v2_python_sparse
jgrishey/kMeansCrime.py
lingyigu/course-2017-spr-proj
train
0
daa40f592ecc9818acb7844861c0b8aff3cb9c13
[ "self.safe_views = []\nif hasattr(demo_settings, 'DEMO_SAFE_VIEWS'):\n for view_path in demo_settings.DEMO_SAFE_VIEWS:\n view = self._get_view(view_path)\n self.safe_views.append(view)", "right_most_dot = view_path.rfind('.')\nmodule_path, view_name = (view_path[:right_most_dot], view_path[right_...
<|body_start_0|> self.safe_views = [] if hasattr(demo_settings, 'DEMO_SAFE_VIEWS'): for view_path in demo_settings.DEMO_SAFE_VIEWS: view = self._get_view(view_path) self.safe_views.append(view) <|end_body_0|> <|body_start_1|> right_most_dot = view_pat...
Disable all views except those that are explicitly allowed. Safe views are listed in conf/demo_settings.py.
DisabledInDemoModeMiddleware
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DisabledInDemoModeMiddleware: """Disable all views except those that are explicitly allowed. Safe views are listed in conf/demo_settings.py.""" def __init__(self): """Constructor.""" <|body_0|> def _get_view(self, view_path): """Get the View from the path to help...
stack_v2_sparse_classes_10k_train_001293
1,588
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get the View from the path to help build the list of safe views.", "name": "_get_view", "signature": "def _get_view(self, view_path)" }, { "docstring": "Override to implement M...
3
stack_v2_sparse_classes_30k_train_005377
Implement the Python class `DisabledInDemoModeMiddleware` described below. Class description: Disable all views except those that are explicitly allowed. Safe views are listed in conf/demo_settings.py. Method signatures and docstrings: - def __init__(self): Constructor. - def _get_view(self, view_path): Get the View ...
Implement the Python class `DisabledInDemoModeMiddleware` described below. Class description: Disable all views except those that are explicitly allowed. Safe views are listed in conf/demo_settings.py. Method signatures and docstrings: - def __init__(self): Constructor. - def _get_view(self, view_path): Get the View ...
898936072a716a799462c113286056690a7723d1
<|skeleton|> class DisabledInDemoModeMiddleware: """Disable all views except those that are explicitly allowed. Safe views are listed in conf/demo_settings.py.""" def __init__(self): """Constructor.""" <|body_0|> def _get_view(self, view_path): """Get the View from the path to help...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DisabledInDemoModeMiddleware: """Disable all views except those that are explicitly allowed. Safe views are listed in conf/demo_settings.py.""" def __init__(self): """Constructor.""" self.safe_views = [] if hasattr(demo_settings, 'DEMO_SAFE_VIEWS'): for view_path in de...
the_stack_v2_python_sparse
genome_designer/main/middleware.py
RubensZimbres/millstone
train
1
f89ada51cac44a510353917b7303911918fb30c9
[ "self.surface = pygame.Surface(dim)\nself.rect = rect\nself.width = dim[0] // scale\nself.height = dim[1] // scale\nself.scale = scale\nself.drawsurface = pygame.Surface((self.width, self.height))\nself.drawsurface.fill((0, 0, 0))\nself.array2d = None\nself.fire = None\nself.palette = None\nself.initialize()", "s...
<|body_start_0|> self.surface = pygame.Surface(dim) self.rect = rect self.width = dim[0] // scale self.height = dim[1] // scale self.scale = scale self.drawsurface = pygame.Surface((self.width, self.height)) self.drawsurface.fill((0, 0, 0)) self.array2d = ...
Simulated Fire, 2d effect idea and basic algorithm from http://lodev.org/cgtutor/fire.html
Fire
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fire: """Simulated Fire, 2d effect idea and basic algorithm from http://lodev.org/cgtutor/fire.html""" def __init__(self, dim, rect, scale=4): """(pygame.surface) surface - to draw on (pygame.Rect) dest - rect to blit fire on (int) width - width of fire (int) height - height of fire ...
stack_v2_sparse_classes_10k_train_001294
4,189
no_license
[ { "docstring": "(pygame.surface) surface - to draw on (pygame.Rect) dest - rect to blit fire on (int) width - width of fire (int) height - height of fire (int) scale - scale fire", "name": "__init__", "signature": "def __init__(self, dim, rect, scale=4)" }, { "docstring": "generate palette and s...
3
stack_v2_sparse_classes_30k_train_002978
Implement the Python class `Fire` described below. Class description: Simulated Fire, 2d effect idea and basic algorithm from http://lodev.org/cgtutor/fire.html Method signatures and docstrings: - def __init__(self, dim, rect, scale=4): (pygame.surface) surface - to draw on (pygame.Rect) dest - rect to blit fire on (...
Implement the Python class `Fire` described below. Class description: Simulated Fire, 2d effect idea and basic algorithm from http://lodev.org/cgtutor/fire.html Method signatures and docstrings: - def __init__(self, dim, rect, scale=4): (pygame.surface) surface - to draw on (pygame.Rect) dest - rect to blit fire on (...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class Fire: """Simulated Fire, 2d effect idea and basic algorithm from http://lodev.org/cgtutor/fire.html""" def __init__(self, dim, rect, scale=4): """(pygame.surface) surface - to draw on (pygame.Rect) dest - rect to blit fire on (int) width - width of fire (int) height - height of fire ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Fire: """Simulated Fire, 2d effect idea and basic algorithm from http://lodev.org/cgtutor/fire.html""" def __init__(self, dim, rect, scale=4): """(pygame.surface) surface - to draw on (pygame.Rect) dest - rect to blit fire on (int) width - width of fire (int) height - height of fire (int) scale -...
the_stack_v2_python_sparse
effects/Fire.py
gunny26/pygame
train
5
2b3a2315d2e725cc090c15d11f5da6a2af57fb67
[ "try:\n success_log = info.getLogger(module)\n success_log.info(log)\nexcept Exception as e:\n print(e)", "try:\n error_log = info.getLogger(module)\n error_log.error(log)\nexcept Exception as e:\n print(e)", "try:\n warning_log = info.getLogger(module)\n warning_log.warning(log)\nexcept...
<|body_start_0|> try: success_log = info.getLogger(module) success_log.info(log) except Exception as e: print(e) <|end_body_0|> <|body_start_1|> try: error_log = info.getLogger(module) error_log.error(log) except Exception as e...
Logger
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logger: def create_success_log(module: str, log: str) -> None: """create success log from this method""" <|body_0|> def create_error_log(module: str, log: str): """create error log from this method""" <|body_1|> def create_warning_log(module: str, log: s...
stack_v2_sparse_classes_10k_train_001295
2,056
no_license
[ { "docstring": "create success log from this method", "name": "create_success_log", "signature": "def create_success_log(module: str, log: str) -> None" }, { "docstring": "create error log from this method", "name": "create_error_log", "signature": "def create_error_log(module: str, log:...
4
stack_v2_sparse_classes_30k_train_003403
Implement the Python class `Logger` described below. Class description: Implement the Logger class. Method signatures and docstrings: - def create_success_log(module: str, log: str) -> None: create success log from this method - def create_error_log(module: str, log: str): create error log from this method - def crea...
Implement the Python class `Logger` described below. Class description: Implement the Logger class. Method signatures and docstrings: - def create_success_log(module: str, log: str) -> None: create success log from this method - def create_error_log(module: str, log: str): create error log from this method - def crea...
c267cb76c5eacf30d893c4d3d1dcbaa717080471
<|skeleton|> class Logger: def create_success_log(module: str, log: str) -> None: """create success log from this method""" <|body_0|> def create_error_log(module: str, log: str): """create error log from this method""" <|body_1|> def create_warning_log(module: str, log: s...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Logger: def create_success_log(module: str, log: str) -> None: """create success log from this method""" try: success_log = info.getLogger(module) success_log.info(log) except Exception as e: print(e) def create_error_log(module: str, log: str):...
the_stack_v2_python_sparse
config/logger.py
ganeshsingamaneni/Flask-ordermanagement
train
0
0c60df827ef68aa87cf300f137aaa9d9d6725dcc
[ "self.disk_to_overwrite = disk_to_overwrite\nself.src_disk = src_disk\nself.target_location = target_location", "if dictionary is None:\n return None\ndisk_to_overwrite = cohesity_management_sdk.models.virtual_disk_id.VirtualDiskId.from_dictionary(dictionary.get('diskToOverwrite')) if dictionary.get('diskToOve...
<|body_start_0|> self.disk_to_overwrite = disk_to_overwrite self.src_disk = src_disk self.target_location = target_location <|end_body_0|> <|body_start_1|> if dictionary is None: return None disk_to_overwrite = cohesity_management_sdk.models.virtual_disk_id.VirtualDi...
Implementation of the 'RecoverVirtualDiskParams_VirtualDiskMapping' model. TODO: type description here. Attributes: disk_to_overwrite (VirtualDiskId): If the user is overwriting a destination disk, then this will capture the target disk info. NOTE: If this is specified, then power_off_vm_before_recovery must be true. s...
RecoverVirtualDiskParams_VirtualDiskMapping
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecoverVirtualDiskParams_VirtualDiskMapping: """Implementation of the 'RecoverVirtualDiskParams_VirtualDiskMapping' model. TODO: type description here. Attributes: disk_to_overwrite (VirtualDiskId): If the user is overwriting a destination disk, then this will capture the target disk info. NOTE: ...
stack_v2_sparse_classes_10k_train_001296
2,838
permissive
[ { "docstring": "Constructor for the RecoverVirtualDiskParams_VirtualDiskMapping class", "name": "__init__", "signature": "def __init__(self, disk_to_overwrite=None, src_disk=None, target_location=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dict...
2
stack_v2_sparse_classes_30k_train_004068
Implement the Python class `RecoverVirtualDiskParams_VirtualDiskMapping` described below. Class description: Implementation of the 'RecoverVirtualDiskParams_VirtualDiskMapping' model. TODO: type description here. Attributes: disk_to_overwrite (VirtualDiskId): If the user is overwriting a destination disk, then this wi...
Implement the Python class `RecoverVirtualDiskParams_VirtualDiskMapping` described below. Class description: Implementation of the 'RecoverVirtualDiskParams_VirtualDiskMapping' model. TODO: type description here. Attributes: disk_to_overwrite (VirtualDiskId): If the user is overwriting a destination disk, then this wi...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RecoverVirtualDiskParams_VirtualDiskMapping: """Implementation of the 'RecoverVirtualDiskParams_VirtualDiskMapping' model. TODO: type description here. Attributes: disk_to_overwrite (VirtualDiskId): If the user is overwriting a destination disk, then this will capture the target disk info. NOTE: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RecoverVirtualDiskParams_VirtualDiskMapping: """Implementation of the 'RecoverVirtualDiskParams_VirtualDiskMapping' model. TODO: type description here. Attributes: disk_to_overwrite (VirtualDiskId): If the user is overwriting a destination disk, then this will capture the target disk info. NOTE: If this is sp...
the_stack_v2_python_sparse
cohesity_management_sdk/models/recover_virtual_disk_params_virtual_disk_mapping.py
cohesity/management-sdk-python
train
24
7bb549de5553836e43f1d8d5c837f3e00b775291
[ "super(MEltPOSTagger, self).__init__()\nself._melt_command = ''\nself._encoding = encoding\nif language == language_support.KBLanguage.FRENCH:\n model_directory = path.join(MELT_MODEL_DIRECTORY, 'fr')\n self._melt_command = 'python %s -m %s -d %s -l %s -e %s' % (MELT_EXEC, model_directory, path.join(model_dir...
<|body_start_0|> super(MEltPOSTagger, self).__init__() self._melt_command = '' self._encoding = encoding if language == language_support.KBLanguage.FRENCH: model_directory = path.join(MELT_MODEL_DIRECTORY, 'fr') self._melt_command = 'python %s -m %s -d %s -l %s -e...
MElt Part-of-Speech tagger. MElt Part-of-Speech tagger. It currently only supports French (C{keybench.main.language_support.KBLanguage.FRENCH}) and English (C{keybench.main.language_support.KBLanguage.English}).
MEltPOSTagger
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MEltPOSTagger: """MElt Part-of-Speech tagger. MElt Part-of-Speech tagger. It currently only supports French (C{keybench.main.language_support.KBLanguage.FRENCH}) and English (C{keybench.main.language_support.KBLanguage.English}).""" def __init__(self, language, encoding): """Construc...
stack_v2_sparse_classes_10k_train_001297
6,186
no_license
[ { "docstring": "Constructor. Args: language: The C{string} name of the language of the data to treat (see C{keybench.main.language_support.KBLanguage}). encoding: The C{string} encoding of the data to treat.", "name": "__init__", "signature": "def __init__(self, language, encoding)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_000078
Implement the Python class `MEltPOSTagger` described below. Class description: MElt Part-of-Speech tagger. MElt Part-of-Speech tagger. It currently only supports French (C{keybench.main.language_support.KBLanguage.FRENCH}) and English (C{keybench.main.language_support.KBLanguage.English}). Method signatures and docst...
Implement the Python class `MEltPOSTagger` described below. Class description: MElt Part-of-Speech tagger. MElt Part-of-Speech tagger. It currently only supports French (C{keybench.main.language_support.KBLanguage.FRENCH}) and English (C{keybench.main.language_support.KBLanguage.English}). Method signatures and docst...
a66cf98b11260d2b74cd990f36f5dcde192b0346
<|skeleton|> class MEltPOSTagger: """MElt Part-of-Speech tagger. MElt Part-of-Speech tagger. It currently only supports French (C{keybench.main.language_support.KBLanguage.FRENCH}) and English (C{keybench.main.language_support.KBLanguage.English}).""" def __init__(self, language, encoding): """Construc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MEltPOSTagger: """MElt Part-of-Speech tagger. MElt Part-of-Speech tagger. It currently only supports French (C{keybench.main.language_support.KBLanguage.FRENCH}) and English (C{keybench.main.language_support.KBLanguage.English}).""" def __init__(self, language, encoding): """Constructor. Args: la...
the_stack_v2_python_sparse
src/keybench/main/nlp_tool/implementation/pos_tagger/melt_pos_tagger.py
Archer-W/KeyBench
train
0
51159822727d1eef0074618b80366d8c8ae8d915
[ "super(ExamSheetSerializer, self).__init__(*args, **kwargs)\nusers = User.objects.filter(id=self.context['request'].user.id)\nself.fields['owner'].queryset = users", "queryset = Question.objects.filter(sheet=obj)\nquestions = []\nfor q in queryset:\n questions.append(q.text)\nreturn questions" ]
<|body_start_0|> super(ExamSheetSerializer, self).__init__(*args, **kwargs) users = User.objects.filter(id=self.context['request'].user.id) self.fields['owner'].queryset = users <|end_body_0|> <|body_start_1|> queryset = Question.objects.filter(sheet=obj) questions = [] ...
ExamSheetSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExamSheetSerializer: def __init__(self, *args, **kwargs): """Teacher can only add examsheet with himself as an owner""" <|body_0|> def get_questions(self, obj): """Simply returns all questions which belongs to this examsheet""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_10k_train_001298
3,922
no_license
[ { "docstring": "Teacher can only add examsheet with himself as an owner", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Simply returns all questions which belongs to this examsheet", "name": "get_questions", "signature": "def get_questions(self...
2
stack_v2_sparse_classes_30k_train_002351
Implement the Python class `ExamSheetSerializer` described below. Class description: Implement the ExamSheetSerializer class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Teacher can only add examsheet with himself as an owner - def get_questions(self, obj): Simply returns all questions wh...
Implement the Python class `ExamSheetSerializer` described below. Class description: Implement the ExamSheetSerializer class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Teacher can only add examsheet with himself as an owner - def get_questions(self, obj): Simply returns all questions wh...
2651ac12078c7d5435d1fb23585bb275c974ce30
<|skeleton|> class ExamSheetSerializer: def __init__(self, *args, **kwargs): """Teacher can only add examsheet with himself as an owner""" <|body_0|> def get_questions(self, obj): """Simply returns all questions which belongs to this examsheet""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExamSheetSerializer: def __init__(self, *args, **kwargs): """Teacher can only add examsheet with himself as an owner""" super(ExamSheetSerializer, self).__init__(*args, **kwargs) users = User.objects.filter(id=self.context['request'].user.id) self.fields['owner'].queryset = use...
the_stack_v2_python_sparse
ExamAPI/Sheets/serializers.py
mtyton/ExamSheetEvaluator-API
train
0
19ef9eafcaee282c20d5097a625eec1dc607db6a
[ "super(InverseGamma, self).__init__(transform)\nself.covariance_prior = False\nself.alpha = alpha\nself.beta = beta", "if self.transform is not None:\n x = self.transform(x)\nreturn (-self.alpha - 1) * np.log(x) - self.beta / float(x)", "if self.transform is not None:\n x = self.transform(x)\nreturn x ** ...
<|body_start_0|> super(InverseGamma, self).__init__(transform) self.covariance_prior = False self.alpha = alpha self.beta = beta <|end_body_0|> <|body_start_1|> if self.transform is not None: x = self.transform(x) return (-self.alpha - 1) * np.log(x) - self.b...
Inverse Gamma Distribution ---- This class contains methods relating to the inverse gamma distribution for time series.
InverseGamma
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InverseGamma: """Inverse Gamma Distribution ---- This class contains methods relating to the inverse gamma distribution for time series.""" def __init__(self, alpha, beta, transform=None, **kwargs): """Parameters ---------- alpha : float Alpha parameter for the Inverse Gamma distribu...
stack_v2_sparse_classes_10k_train_001299
1,641
permissive
[ { "docstring": "Parameters ---------- alpha : float Alpha parameter for the Inverse Gamma distribution beta : float Beta parameter for the Inverse Gamma distribution transform : str Whether to apply a transformation - e.g. 'exp' or 'logit'", "name": "__init__", "signature": "def __init__(self, alpha, be...
3
stack_v2_sparse_classes_30k_train_002597
Implement the Python class `InverseGamma` described below. Class description: Inverse Gamma Distribution ---- This class contains methods relating to the inverse gamma distribution for time series. Method signatures and docstrings: - def __init__(self, alpha, beta, transform=None, **kwargs): Parameters ---------- alp...
Implement the Python class `InverseGamma` described below. Class description: Inverse Gamma Distribution ---- This class contains methods relating to the inverse gamma distribution for time series. Method signatures and docstrings: - def __init__(self, alpha, beta, transform=None, **kwargs): Parameters ---------- alp...
f5166854bb4a24c997fc2b9b4e3e37325a740d34
<|skeleton|> class InverseGamma: """Inverse Gamma Distribution ---- This class contains methods relating to the inverse gamma distribution for time series.""" def __init__(self, alpha, beta, transform=None, **kwargs): """Parameters ---------- alpha : float Alpha parameter for the Inverse Gamma distribu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InverseGamma: """Inverse Gamma Distribution ---- This class contains methods relating to the inverse gamma distribution for time series.""" def __init__(self, alpha, beta, transform=None, **kwargs): """Parameters ---------- alpha : float Alpha parameter for the Inverse Gamma distribution beta : f...
the_stack_v2_python_sparse
pyflux/families/inverse_gamma.py
ecastrow/pyflux
train
0