blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d9bff41e3f3c628c9f0dfa358f811094caca18a5 | [
"driver = obj.driver\nWebDriverWait(driver, Constants.WAIT_TIME_LONG).until(lambda driver: driver.find_element(*self.locator))\ndriver.find_element(*self.locator).clear()\ndriver.find_element(*self.locator).send_keys(value)",
"driver = obj.driver\nWebDriverWait(driver, Constants.WAIT_TIME_LONG).until(lambda drive... | <|body_start_0|>
driver = obj.driver
WebDriverWait(driver, Constants.WAIT_TIME_LONG).until(lambda driver: driver.find_element(*self.locator))
driver.find_element(*self.locator).clear()
driver.find_element(*self.locator).send_keys(value)
<|end_body_0|>
<|body_start_1|>
driver = o... | BasePageElement | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasePageElement:
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
<|body_0|>
def __get__(self, obj, owner):
"""Gets the element object"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
driver = obj.driver
WebDriverWait(... | stack_v2_sparse_classes_36k_train_007300 | 1,338 | permissive | [
{
"docstring": "Sets the text to the value supplied",
"name": "__set__",
"signature": "def __set__(self, obj, value)"
},
{
"docstring": "Gets the element object",
"name": "__get__",
"signature": "def __get__(self, obj, owner)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021533 | Implement the Python class `BasePageElement` described below.
Class description:
Implement the BasePageElement class.
Method signatures and docstrings:
- def __set__(self, obj, value): Sets the text to the value supplied
- def __get__(self, obj, owner): Gets the element object | Implement the Python class `BasePageElement` described below.
Class description:
Implement the BasePageElement class.
Method signatures and docstrings:
- def __set__(self, obj, value): Sets the text to the value supplied
- def __get__(self, obj, owner): Gets the element object
<|skeleton|>
class BasePageElement:
... | 8f2c6a88106985a3409bb032de1d2b9b7dcfb2fe | <|skeleton|>
class BasePageElement:
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
<|body_0|>
def __get__(self, obj, owner):
"""Gets the element object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasePageElement:
def __set__(self, obj, value):
"""Sets the text to the value supplied"""
driver = obj.driver
WebDriverWait(driver, Constants.WAIT_TIME_LONG).until(lambda driver: driver.find_element(*self.locator))
driver.find_element(*self.locator).clear()
driver.find_... | the_stack_v2_python_sparse | uiautomation/elements.py | fingerella2000/e2enuggets | train | 0 | |
d20f296de9cd6cbfd4275348b446b16ae5dea64e | [
"if humusType == '2':\n dPar = [0.0, 0.05, 0.01]\nelif humusType == '3':\n dPar = [0.05, 0.15, 0.1]\nelif humusType == '4':\n dPar = [0.15, 0.3, 0.22]\nelse:\n raise Exception('HumusType is not correct.')\nxLim = terrainAP[1][0]\nyLim = terrainAP[3][1]\nself.xNumInv = int(xLim / rasterDist)\nself.yNumIn... | <|body_start_0|>
if humusType == '2':
dPar = [0.0, 0.05, 0.01]
elif humusType == '3':
dPar = [0.05, 0.15, 0.1]
elif humusType == '4':
dPar = [0.15, 0.3, 0.22]
else:
raise Exception('HumusType is not correct.')
xLim = terrainAP[1][0]... | Needs comments and descriptions as well as nice plotting feature for determination of rasterDist, done but not working... This class is the HumusLayer that can be implemented for any type of machine simulation. However it is of largetst interest for the plantng machine which interacts with the soil. The humustypes are ... | HumusLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HumusLayer:
"""Needs comments and descriptions as well as nice plotting feature for determination of rasterDist, done but not working... This class is the HumusLayer that can be implemented for any type of machine simulation. However it is of largetst interest for the plantng machine which intera... | stack_v2_sparse_classes_36k_train_007301 | 3,398 | no_license | [
{
"docstring": "The humus layer has a triangular thickness distribution with parameters in dPar. RasterDist is the distance between each node on our raster with thicknesses given by the distribution. A large distance mimics a situation where the humuslayer is more or less spatially invariant, whilst a small dis... | 3 | stack_v2_sparse_classes_30k_train_005930 | Implement the Python class `HumusLayer` described below.
Class description:
Needs comments and descriptions as well as nice plotting feature for determination of rasterDist, done but not working... This class is the HumusLayer that can be implemented for any type of machine simulation. However it is of largetst intere... | Implement the Python class `HumusLayer` described below.
Class description:
Needs comments and descriptions as well as nice plotting feature for determination of rasterDist, done but not working... This class is the HumusLayer that can be implemented for any type of machine simulation. However it is of largetst intere... | 7166c5e69b40d00619e51df0477aec6c89908b15 | <|skeleton|>
class HumusLayer:
"""Needs comments and descriptions as well as nice plotting feature for determination of rasterDist, done but not working... This class is the HumusLayer that can be implemented for any type of machine simulation. However it is of largetst interest for the plantng machine which intera... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HumusLayer:
"""Needs comments and descriptions as well as nice plotting feature for determination of rasterDist, done but not working... This class is the HumusLayer that can be implemented for any type of machine simulation. However it is of largetst interest for the plantng machine which interacts with the ... | the_stack_v2_python_sparse | terrain/humusLayer.py | fiskpralin/pibsgraph | train | 0 |
c877ce4280390c74f54851c71cf993242ea67bc7 | [
"result = []\nfor single_spec in spec.specs:\n columns = single_spec.column_for_slicing\n result.append(tfma.slicer.SingleSliceSpec(columns=columns))\nif tfma.slicer.SingleSliceSpec() not in result:\n result.append(tfma.slicer.SingleSliceSpec())\nreturn result",
"if 'model_exports' not in input_dict:\n ... | <|body_start_0|>
result = []
for single_spec in spec.specs:
columns = single_spec.column_for_slicing
result.append(tfma.slicer.SingleSliceSpec(columns=columns))
if tfma.slicer.SingleSliceSpec() not in result:
result.append(tfma.slicer.SingleSliceSpec())
... | Generic TFX model evaluator executor. | Executor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Executor:
"""Generic TFX model evaluator executor."""
def _get_slice_spec_from_feature_slicing_spec(self, spec: evaluator_pb2.FeatureSlicingSpec) -> List[tfma.slicer.SingleSliceSpec]:
"""Given a feature slicing spec, returns a List of SingleSliceSpecs. Args: spec: slice specification... | stack_v2_sparse_classes_36k_train_007302 | 4,400 | permissive | [
{
"docstring": "Given a feature slicing spec, returns a List of SingleSliceSpecs. Args: spec: slice specification. Returns: List of corresponding SingleSliceSpecs. Always includes the overall slice, even if it was not specified in the given spec.",
"name": "_get_slice_spec_from_feature_slicing_spec",
"s... | 2 | null | Implement the Python class `Executor` described below.
Class description:
Generic TFX model evaluator executor.
Method signatures and docstrings:
- def _get_slice_spec_from_feature_slicing_spec(self, spec: evaluator_pb2.FeatureSlicingSpec) -> List[tfma.slicer.SingleSliceSpec]: Given a feature slicing spec, returns a ... | Implement the Python class `Executor` described below.
Class description:
Generic TFX model evaluator executor.
Method signatures and docstrings:
- def _get_slice_spec_from_feature_slicing_spec(self, spec: evaluator_pb2.FeatureSlicingSpec) -> List[tfma.slicer.SingleSliceSpec]: Given a feature slicing spec, returns a ... | dc9221abbb8dad991d1ae22fb91876da1290efae | <|skeleton|>
class Executor:
"""Generic TFX model evaluator executor."""
def _get_slice_spec_from_feature_slicing_spec(self, spec: evaluator_pb2.FeatureSlicingSpec) -> List[tfma.slicer.SingleSliceSpec]:
"""Given a feature slicing spec, returns a List of SingleSliceSpecs. Args: spec: slice specification... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Executor:
"""Generic TFX model evaluator executor."""
def _get_slice_spec_from_feature_slicing_spec(self, spec: evaluator_pb2.FeatureSlicingSpec) -> List[tfma.slicer.SingleSliceSpec]:
"""Given a feature slicing spec, returns a List of SingleSliceSpecs. Args: spec: slice specification. Returns: Li... | the_stack_v2_python_sparse | tfx/components/evaluator/executor.py | HassanDayoub/tfx | train | 2 |
6746dc60c5f10c58190b661752eafbbeb0dbc60a | [
"self.objs = objs\nself.count = count\nself.page = page\nself.Contacts = None\nself.Pt()",
"objs, count, page = (self.objs, self.count, self.page)\nPt = Paginator(objs, count)\ntry:\n Page = int(page)\nexcept Exception:\n Page = 1\ntry:\n Contacts = Pt.page(Page)\nexcept (EmptyPage, InvalidPage):\n if... | <|body_start_0|>
self.objs = objs
self.count = count
self.page = page
self.Contacts = None
self.Pt()
<|end_body_0|>
<|body_start_1|>
objs, count, page = (self.objs, self.count, self.page)
Pt = Paginator(objs, count)
try:
Page = int(page)
... | @attention: 分页处理类 @author:lizheng @date: 2010-12-13 | Cpt | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cpt:
"""@attention: 分页处理类 @author:lizheng @date: 2010-12-13"""
def __init__(self, objs=[], count=10, page=1):
"""@attention: 构造方法 @param objs: 需要分页的列表 @param count: 每页的数量 @param page: 要取得的页"""
<|body_0|>
def Pt(self):
"""@attention: 分页方法"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_007303 | 1,547 | no_license | [
{
"docstring": "@attention: 构造方法 @param objs: 需要分页的列表 @param count: 每页的数量 @param page: 要取得的页",
"name": "__init__",
"signature": "def __init__(self, objs=[], count=10, page=1)"
},
{
"docstring": "@attention: 分页方法",
"name": "Pt",
"signature": "def Pt(self)"
}
] | 2 | null | Implement the Python class `Cpt` described below.
Class description:
@attention: 分页处理类 @author:lizheng @date: 2010-12-13
Method signatures and docstrings:
- def __init__(self, objs=[], count=10, page=1): @attention: 构造方法 @param objs: 需要分页的列表 @param count: 每页的数量 @param page: 要取得的页
- def Pt(self): @attention: 分页方法 | Implement the Python class `Cpt` described below.
Class description:
@attention: 分页处理类 @author:lizheng @date: 2010-12-13
Method signatures and docstrings:
- def __init__(self, objs=[], count=10, page=1): @attention: 构造方法 @param objs: 需要分页的列表 @param count: 每页的数量 @param page: 要取得的页
- def Pt(self): @attention: 分页方法
<|s... | a0ca902d0a7c1b716ea1a395fdcf0a2297efc15a | <|skeleton|>
class Cpt:
"""@attention: 分页处理类 @author:lizheng @date: 2010-12-13"""
def __init__(self, objs=[], count=10, page=1):
"""@attention: 构造方法 @param objs: 需要分页的列表 @param count: 每页的数量 @param page: 要取得的页"""
<|body_0|>
def Pt(self):
"""@attention: 分页方法"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cpt:
"""@attention: 分页处理类 @author:lizheng @date: 2010-12-13"""
def __init__(self, objs=[], count=10, page=1):
"""@attention: 构造方法 @param objs: 需要分页的列表 @param count: 每页的数量 @param page: 要取得的页"""
self.objs = objs
self.count = count
self.page = page
self.Contacts = Non... | the_stack_v2_python_sparse | common/page.py | lantianlz/orange | train | 1 |
8a2345ac252bf0af7c8b7282b8b49e7ddb68b175 | [
"self.backup_run = backup_run\nself.copy_runs = copy_runs\nself.is_paused = is_paused\nself.next_protection_run_time_usecs = next_protection_run_time_usecs\nself.protected_source_uid = protected_source_uid\nself.protection_source = protection_source\nself.source_parameters = source_parameters",
"if dictionary is ... | <|body_start_0|>
self.backup_run = backup_run
self.copy_runs = copy_runs
self.is_paused = is_paused
self.next_protection_run_time_usecs = next_protection_run_time_usecs
self.protected_source_uid = protected_source_uid
self.protection_source = protection_source
sel... | Implementation of the 'ProtectedSourceSummary' model. ProtectedSourceSummary is the summary of all the Protection Runs for the Protection Jobs using the Specified Protection Policy. This is only populated for a policy of type kRPO. Attributes: backup_run (BackupRun): Specifies details about the last Backup task. A Back... | ProtectedSourceSummary | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtectedSourceSummary:
"""Implementation of the 'ProtectedSourceSummary' model. ProtectedSourceSummary is the summary of all the Protection Runs for the Protection Jobs using the Specified Protection Policy. This is only populated for a policy of type kRPO. Attributes: backup_run (BackupRun): Sp... | stack_v2_sparse_classes_36k_train_007304 | 4,952 | permissive | [
{
"docstring": "Constructor for the ProtectedSourceSummary class",
"name": "__init__",
"signature": "def __init__(self, backup_run=None, copy_runs=None, is_paused=None, next_protection_run_time_usecs=None, protected_source_uid=None, protection_source=None, source_parameters=None)"
},
{
"docstrin... | 2 | stack_v2_sparse_classes_30k_test_000201 | Implement the Python class `ProtectedSourceSummary` described below.
Class description:
Implementation of the 'ProtectedSourceSummary' model. ProtectedSourceSummary is the summary of all the Protection Runs for the Protection Jobs using the Specified Protection Policy. This is only populated for a policy of type kRPO.... | Implement the Python class `ProtectedSourceSummary` described below.
Class description:
Implementation of the 'ProtectedSourceSummary' model. ProtectedSourceSummary is the summary of all the Protection Runs for the Protection Jobs using the Specified Protection Policy. This is only populated for a policy of type kRPO.... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ProtectedSourceSummary:
"""Implementation of the 'ProtectedSourceSummary' model. ProtectedSourceSummary is the summary of all the Protection Runs for the Protection Jobs using the Specified Protection Policy. This is only populated for a policy of type kRPO. Attributes: backup_run (BackupRun): Sp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProtectedSourceSummary:
"""Implementation of the 'ProtectedSourceSummary' model. ProtectedSourceSummary is the summary of all the Protection Runs for the Protection Jobs using the Specified Protection Policy. This is only populated for a policy of type kRPO. Attributes: backup_run (BackupRun): Specifies detai... | the_stack_v2_python_sparse | cohesity_management_sdk/models/protected_source_summary.py | cohesity/management-sdk-python | train | 24 |
b4bbd7a936d354282613698437fc2de6ebefc346 | [
"if request.model == search_messages.SearchIndexEnum.DEVICE:\n deferred.defer(device_model.Device.clear_index)\nelif request.model == search_messages.SearchIndexEnum.SHELF:\n deferred.defer(shelf_model.Shelf.clear_index)\nreturn message_types.VoidMessage()",
"if request.model == search_messages.SearchIndexE... | <|body_start_0|>
if request.model == search_messages.SearchIndexEnum.DEVICE:
deferred.defer(device_model.Device.clear_index)
elif request.model == search_messages.SearchIndexEnum.SHELF:
deferred.defer(shelf_model.Shelf.clear_index)
return message_types.VoidMessage()
<|end... | Endpoints API service class for search helper methods. | SearchApi | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchApi:
"""Endpoints API service class for search helper methods."""
def clear(self, request):
"""Clears a search index for the given type."""
<|body_0|>
def reindex(self, request):
"""Reindexes a search index for the given type."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k_train_007305 | 2,480 | permissive | [
{
"docstring": "Clears a search index for the given type.",
"name": "clear",
"signature": "def clear(self, request)"
},
{
"docstring": "Reindexes a search index for the given type.",
"name": "reindex",
"signature": "def reindex(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007594 | Implement the Python class `SearchApi` described below.
Class description:
Endpoints API service class for search helper methods.
Method signatures and docstrings:
- def clear(self, request): Clears a search index for the given type.
- def reindex(self, request): Reindexes a search index for the given type. | Implement the Python class `SearchApi` described below.
Class description:
Endpoints API service class for search helper methods.
Method signatures and docstrings:
- def clear(self, request): Clears a search index for the given type.
- def reindex(self, request): Reindexes a search index for the given type.
<|skelet... | 91753e47aff26d78978ebe7aca70f4a7cbf6a3d4 | <|skeleton|>
class SearchApi:
"""Endpoints API service class for search helper methods."""
def clear(self, request):
"""Clears a search index for the given type."""
<|body_0|>
def reindex(self, request):
"""Reindexes a search index for the given type."""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SearchApi:
"""Endpoints API service class for search helper methods."""
def clear(self, request):
"""Clears a search index for the given type."""
if request.model == search_messages.SearchIndexEnum.DEVICE:
deferred.defer(device_model.Device.clear_index)
elif request.mo... | the_stack_v2_python_sparse | loaner/web_app/backend/api/search_api.py | ryangugcloudca/loaner | train | 0 |
5188214c5c5349f91bdc6df5d7ef809f1928b7f3 | [
"self.PI = protein\nself.cutoff = 8.0\nself.residues = self.PI.residues.keys()\nself.residues.sort()\nreturn",
"acc = 0.0\ncount = 0\nfor res2 in self.PI.residues.keys():\n if res2 == residue:\n continue\n if self.PI.dist(residue + ':CA', res2 + ':CA') < 35.0:\n counted = {}\n for atom1... | <|body_start_0|>
self.PI = protein
self.cutoff = 8.0
self.residues = self.PI.residues.keys()
self.residues.sort()
return
<|end_body_0|>
<|body_start_1|>
acc = 0.0
count = 0
for res2 in self.PI.residues.keys():
if res2 == residue:
... | access | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class access:
def __init__(self, protein):
"""Store the protool instance and calculate boxes"""
<|body_0|>
def get_access(self, residue):
"""Get the number of atoms close"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.PI = protein
self.cutof... | stack_v2_sparse_classes_36k_train_007306 | 2,599 | permissive | [
{
"docstring": "Store the protool instance and calculate boxes",
"name": "__init__",
"signature": "def __init__(self, protein)"
},
{
"docstring": "Get the number of atoms close",
"name": "get_access",
"signature": "def get_access(self, residue)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015670 | Implement the Python class `access` described below.
Class description:
Implement the access class.
Method signatures and docstrings:
- def __init__(self, protein): Store the protool instance and calculate boxes
- def get_access(self, residue): Get the number of atoms close | Implement the Python class `access` described below.
Class description:
Implement the access class.
Method signatures and docstrings:
- def __init__(self, protein): Store the protool instance and calculate boxes
- def get_access(self, residue): Get the number of atoms close
<|skeleton|>
class access:
def __init... | 983795788089ca5093474ba144340e02666fc6cc | <|skeleton|>
class access:
def __init__(self, protein):
"""Store the protool instance and calculate boxes"""
<|body_0|>
def get_access(self, residue):
"""Get the number of atoms close"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class access:
def __init__(self, protein):
"""Store the protool instance and calculate boxes"""
self.PI = protein
self.cutoff = 8.0
self.residues = self.PI.residues.keys()
self.residues.sort()
return
def get_access(self, residue):
"""Get the number of ato... | the_stack_v2_python_sparse | Protool/accessibility.py | tubapala/peat | train | 0 | |
7b520d3ca1c2df7c33577435d2b2d801823add6b | [
"self.front = -1\nself.rare = -1\nself.max_size = 5\nself.cqueue = [0] * self.max_size",
"if self.front == (self.rare + 1) % self.max_size:\n print('Overflow')\nelse:\n if self.front == -1:\n self.front += 1\n self.rare += 1\n else:\n self.rare = (self.rare + 1) % self.max_size\n ... | <|body_start_0|>
self.front = -1
self.rare = -1
self.max_size = 5
self.cqueue = [0] * self.max_size
<|end_body_0|>
<|body_start_1|>
if self.front == (self.rare + 1) % self.max_size:
print('Overflow')
else:
if self.front == -1:
self... | This class contains functions for circular queue implementation. Rare: next_rare_value = (rare + 1) % max_size Front: next_front_value = (front + 1) % max_size Overflow: if front == (rare + 1) % max_size Underflow: if front == None | cQueue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class cQueue:
"""This class contains functions for circular queue implementation. Rare: next_rare_value = (rare + 1) % max_size Front: next_front_value = (front + 1) % max_size Overflow: if front == (rare + 1) % max_size Underflow: if front == None"""
def __init__(self):
"""Constructor fun... | stack_v2_sparse_classes_36k_train_007307 | 2,507 | no_license | [
{
"docstring": "Constructor function. Argument: self -- represents the object of the class.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "This function will add elements to the circular queue. Arguments: self -- represents the object of the class. item -- integer val... | 4 | stack_v2_sparse_classes_30k_train_018870 | Implement the Python class `cQueue` described below.
Class description:
This class contains functions for circular queue implementation. Rare: next_rare_value = (rare + 1) % max_size Front: next_front_value = (front + 1) % max_size Overflow: if front == (rare + 1) % max_size Underflow: if front == None
Method signatu... | Implement the Python class `cQueue` described below.
Class description:
This class contains functions for circular queue implementation. Rare: next_rare_value = (rare + 1) % max_size Front: next_front_value = (front + 1) % max_size Overflow: if front == (rare + 1) % max_size Underflow: if front == None
Method signatu... | 6870426104aef417086788221dad29e887ddfe3f | <|skeleton|>
class cQueue:
"""This class contains functions for circular queue implementation. Rare: next_rare_value = (rare + 1) % max_size Front: next_front_value = (front + 1) % max_size Overflow: if front == (rare + 1) % max_size Underflow: if front == None"""
def __init__(self):
"""Constructor fun... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class cQueue:
"""This class contains functions for circular queue implementation. Rare: next_rare_value = (rare + 1) % max_size Front: next_front_value = (front + 1) % max_size Overflow: if front == (rare + 1) % max_size Underflow: if front == None"""
def __init__(self):
"""Constructor function. Argume... | the_stack_v2_python_sparse | Data Structure/03. Queue/02. Circular Queue/py_code.py | Slothfulwave612/Coding-Problems | train | 5 |
d4d6e81a1e4182c269cdaac531e29d97b4ce5c53 | [
"mask_changed = False\ninput_mask = input_mask_list[0]\nnum_out_masks = len(output_mask_list)\nfor i in range(num_out_masks):\n output_mask_list[i] = input_mask\nmask_changed = True\nreturn mask_changed",
"mask_changed = False\nsaved_input_mask = input_mask_list[0]\nnum_in_masks = len(input_mask_list)\nnum_out... | <|body_start_0|>
mask_changed = False
input_mask = input_mask_list[0]
num_out_masks = len(output_mask_list)
for i in range(num_out_masks):
output_mask_list[i] = input_mask
mask_changed = True
return mask_changed
<|end_body_0|>
<|body_start_1|>
mask_ch... | Models SPLIT internal connectivity for an Op. | SplitInternalConnectivity | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SplitInternalConnectivity:
"""Models SPLIT internal connectivity for an Op."""
def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool:
"""Based on the internal connectivity and input mask(s), updates the output mask(s). :par... | stack_v2_sparse_classes_36k_train_007308 | 39,659 | permissive | [
{
"docstring": "Based on the internal connectivity and input mask(s), updates the output mask(s). :param input_mask_list: The input mask(s) to be propagated :param output_mask_list: The output mask(s) to be updated based on the Op's Internal Connectivity",
"name": "forward_propagate_the_masks",
"signatu... | 2 | stack_v2_sparse_classes_30k_test_000029 | Implement the Python class `SplitInternalConnectivity` described below.
Class description:
Models SPLIT internal connectivity for an Op.
Method signatures and docstrings:
- def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool: Based on the internal connect... | Implement the Python class `SplitInternalConnectivity` described below.
Class description:
Models SPLIT internal connectivity for an Op.
Method signatures and docstrings:
- def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool: Based on the internal connect... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class SplitInternalConnectivity:
"""Models SPLIT internal connectivity for an Op."""
def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool:
"""Based on the internal connectivity and input mask(s), updates the output mask(s). :par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SplitInternalConnectivity:
"""Models SPLIT internal connectivity for an Op."""
def forward_propagate_the_masks(self, input_mask_list: List[List[int]], output_mask_list: List[List[int]]) -> bool:
"""Based on the internal connectivity and input mask(s), updates the output mask(s). :param input_mask... | the_stack_v2_python_sparse | TrainingExtensions/common/src/python/aimet_common/winnow/mask.py | quic/aimet | train | 1,676 |
81021995c393693c8422384b4323ac1936d6fd68 | [
"self._block_size_sel = ipywidgets.IntText(value=65, description='block size')\nself._c_sel = ipywidgets.FloatText(value=-2, description='const offset')\nself._smoothing_sel = ipywidgets.FloatText(value=3.0, description='smooth', step=0.1)\nself._method_sel = ipywidgets.Dropdown(options=['mean', 'gaussian'], descri... | <|body_start_0|>
self._block_size_sel = ipywidgets.IntText(value=65, description='block size')
self._c_sel = ipywidgets.FloatText(value=-2, description='const offset')
self._smoothing_sel = ipywidgets.FloatText(value=3.0, description='smooth', step=0.1)
self._method_sel = ipywidgets.Drop... | UI for setting options for :py:func:`sdt.image.adaptive_thresh` | AdaptiveOptions | [
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaptiveOptions:
"""UI for setting options for :py:func:`sdt.image.adaptive_thresh`"""
def __init__(self, *args, **kwargs):
"""Parameters ---------- *args, **kwargs Passed to the :py:class:`HBox` constructor after the list of children"""
<|body_0|>
def _options_from_ui(s... | stack_v2_sparse_classes_36k_train_007309 | 12,391 | permissive | [
{
"docstring": "Parameters ---------- *args, **kwargs Passed to the :py:class:`HBox` constructor after the list of children",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Set :py:attr:`options` from UI elements",
"name": "_options_from_ui",
"s... | 3 | null | Implement the Python class `AdaptiveOptions` described below.
Class description:
UI for setting options for :py:func:`sdt.image.adaptive_thresh`
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Parameters ---------- *args, **kwargs Passed to the :py:class:`HBox` constructor after the list of c... | Implement the Python class `AdaptiveOptions` described below.
Class description:
UI for setting options for :py:func:`sdt.image.adaptive_thresh`
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Parameters ---------- *args, **kwargs Passed to the :py:class:`HBox` constructor after the list of c... | 2f953e553f32118c3ad1f244481e5a0ac6c533f0 | <|skeleton|>
class AdaptiveOptions:
"""UI for setting options for :py:func:`sdt.image.adaptive_thresh`"""
def __init__(self, *args, **kwargs):
"""Parameters ---------- *args, **kwargs Passed to the :py:class:`HBox` constructor after the list of children"""
<|body_0|>
def _options_from_ui(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AdaptiveOptions:
"""UI for setting options for :py:func:`sdt.image.adaptive_thresh`"""
def __init__(self, *args, **kwargs):
"""Parameters ---------- *args, **kwargs Passed to the :py:class:`HBox` constructor after the list of children"""
self._block_size_sel = ipywidgets.IntText(value=65,... | the_stack_v2_python_sparse | sdt/nbui/thresholder.py | schuetzgroup/sdt-python | train | 31 |
564a24f061cb2094c7a67f1665009ddffb52b844 | [
"self.lhs = get_eval_func(columns=lhs, func=func)\nself.rhs = self.lhs if rhs is None else get_eval_func(columns=rhs)\nself.having = having",
"determinant = self.lhs.eval(df=df)\ndependent = self.rhs.eval(df=df)\ngroups = dict()\nmeta = dict()\nfor index, values in enumerate(zip(determinant, dependent)):\n val... | <|body_start_0|>
self.lhs = get_eval_func(columns=lhs, func=func)
self.rhs = self.lhs if rhs is None else get_eval_func(columns=rhs)
self.having = having
<|end_body_0|>
<|body_start_1|>
determinant = self.lhs.eval(df=df)
dependent = self.rhs.eval(df=df)
groups = dict()
... | Violations class that: 1) takes the left side and right side column names 2) generates a new key from the values (func callable) 3) identifies any tuples violating specified rules (having callable) 4) and returns them as a DataFrameViolation object. | Violations | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Violations:
"""Violations class that: 1) takes the left side and right side column names 2) generates a new key from the values (func callable) 3) identifies any tuples violating specified rules (having callable) 4) and returns them as a DataFrameViolation object."""
def __init__(self, lhs, ... | stack_v2_sparse_classes_36k_train_007310 | 7,053 | permissive | [
{
"docstring": "Initializes the Violation class with the left and right hand side key generators, and func and having callables. If no values for rhs are provided, it assumes we want to find violations in a singular set of column(s) (lhs). Parameters ---------- lhs: list or string column name(s) of the determin... | 4 | stack_v2_sparse_classes_30k_train_007607 | Implement the Python class `Violations` described below.
Class description:
Violations class that: 1) takes the left side and right side column names 2) generates a new key from the values (func callable) 3) identifies any tuples violating specified rules (having callable) 4) and returns them as a DataFrameViolation o... | Implement the Python class `Violations` described below.
Class description:
Violations class that: 1) takes the left side and right side column names 2) generates a new key from the values (func callable) 3) identifies any tuples violating specified rules (having callable) 4) and returns them as a DataFrameViolation o... | e3d0e04f90468c49f29ca53edc2feb12465c24d5 | <|skeleton|>
class Violations:
"""Violations class that: 1) takes the left side and right side column names 2) generates a new key from the values (func callable) 3) identifies any tuples violating specified rules (having callable) 4) and returns them as a DataFrameViolation object."""
def __init__(self, lhs, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Violations:
"""Violations class that: 1) takes the left side and right side column names 2) generates a new key from the values (func callable) 3) identifies any tuples violating specified rules (having callable) 4) and returns them as a DataFrameViolation object."""
def __init__(self, lhs, rhs=None, fun... | the_stack_v2_python_sparse | openclean/operator/map/violations.py | Denisfench/openclean-core | train | 0 |
d69c48471a57ac1f5cb05db09889aecda6a5ff9b | [
"self.input = fileInput\nself.output = fileOutput\nself.language = language\nself.minSilenceLen = 500\nself.silenceThresh = 14\nself.keepSilence = 500\nself.__check_files_valid()\nself.rec = sr.Recognizer()",
"self.__check_files_valid()\nsound = AudioSegment.from_file(self.input, format=pathlib.Path(self.input).s... | <|body_start_0|>
self.input = fileInput
self.output = fileOutput
self.language = language
self.minSilenceLen = 500
self.silenceThresh = 14
self.keepSilence = 500
self.__check_files_valid()
self.rec = sr.Recognizer()
<|end_body_0|>
<|body_start_1|>
... | Converts an audio file to text. | AudioToText | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AudioToText:
"""Converts an audio file to text."""
def __init__(self, fileInput, fileOutput, language):
"""Initialize."""
<|body_0|>
def get_text(self):
"""Returns the text recognized from the input file."""
<|body_1|>
def write_to_text_file(self, te... | stack_v2_sparse_classes_36k_train_007311 | 4,397 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, fileInput, fileOutput, language)"
},
{
"docstring": "Returns the text recognized from the input file.",
"name": "get_text",
"signature": "def get_text(self)"
},
{
"docstring": "Write a text to a fi... | 4 | stack_v2_sparse_classes_30k_train_007789 | Implement the Python class `AudioToText` described below.
Class description:
Converts an audio file to text.
Method signatures and docstrings:
- def __init__(self, fileInput, fileOutput, language): Initialize.
- def get_text(self): Returns the text recognized from the input file.
- def write_to_text_file(self, text):... | Implement the Python class `AudioToText` described below.
Class description:
Converts an audio file to text.
Method signatures and docstrings:
- def __init__(self, fileInput, fileOutput, language): Initialize.
- def get_text(self): Returns the text recognized from the input file.
- def write_to_text_file(self, text):... | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | <|skeleton|>
class AudioToText:
"""Converts an audio file to text."""
def __init__(self, fileInput, fileOutput, language):
"""Initialize."""
<|body_0|>
def get_text(self):
"""Returns the text recognized from the input file."""
<|body_1|>
def write_to_text_file(self, te... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AudioToText:
"""Converts an audio file to text."""
def __init__(self, fileInput, fileOutput, language):
"""Initialize."""
self.input = fileInput
self.output = fileOutput
self.language = language
self.minSilenceLen = 500
self.silenceThresh = 14
self.... | the_stack_v2_python_sparse | _RESOURCES/my-gists/__CONTAINER/825aa98d8f/825aa98d8fddbff215dadd41125cc487f503d563f1179583c1502bfebdb87cf8/audio-2-text.py | bgoonz/UsefulResourceRepo2.0 | train | 10 |
848ccb3e2e0ea1be0c986c4b7bdc22c5feefaf9c | [
"poke_images_dir = os.path.join(self.config['dist_dir'], 'images/pokemon')\nos.makedirs(poke_images_dir, exist_ok=True)\nself.generate_mon_pics(self.core_data['mon_front_pics'], self.core_data['species_to_national'], 'front', (0, 0, 64, 64))\nself.generate_mon_pics(self.core_data['mon_back_pics'], self.core_data['s... | <|body_start_0|>
poke_images_dir = os.path.join(self.config['dist_dir'], 'images/pokemon')
os.makedirs(poke_images_dir, exist_ok=True)
self.generate_mon_pics(self.core_data['mon_front_pics'], self.core_data['species_to_national'], 'front', (0, 0, 64, 64))
self.generate_mon_pics(self.core... | MonPicsGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MonPicsGenerator:
def generate(self, env):
"""Generates the various Pokémon image assets into the distribution directory."""
<|body_0|>
def generate_mon_pics(self, species_to_pics, species_to_national, name, crop, force=False):
"""Processes and generates the various ... | stack_v2_sparse_classes_36k_train_007312 | 3,837 | no_license | [
{
"docstring": "Generates the various Pokémon image assets into the distribution directory.",
"name": "generate",
"signature": "def generate(self, env)"
},
{
"docstring": "Processes and generates the various mon images into the distribution directory.",
"name": "generate_mon_pics",
"sign... | 3 | stack_v2_sparse_classes_30k_train_020548 | Implement the Python class `MonPicsGenerator` described below.
Class description:
Implement the MonPicsGenerator class.
Method signatures and docstrings:
- def generate(self, env): Generates the various Pokémon image assets into the distribution directory.
- def generate_mon_pics(self, species_to_pics, species_to_nat... | Implement the Python class `MonPicsGenerator` described below.
Class description:
Implement the MonPicsGenerator class.
Method signatures and docstrings:
- def generate(self, env): Generates the various Pokémon image assets into the distribution directory.
- def generate_mon_pics(self, species_to_pics, species_to_nat... | b3407ab5049a4f913a363bc98708b5697292181a | <|skeleton|>
class MonPicsGenerator:
def generate(self, env):
"""Generates the various Pokémon image assets into the distribution directory."""
<|body_0|>
def generate_mon_pics(self, species_to_pics, species_to_national, name, crop, force=False):
"""Processes and generates the various ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MonPicsGenerator:
def generate(self, env):
"""Generates the various Pokémon image assets into the distribution directory."""
poke_images_dir = os.path.join(self.config['dist_dir'], 'images/pokemon')
os.makedirs(poke_images_dir, exist_ok=True)
self.generate_mon_pics(self.core_da... | the_stack_v2_python_sparse | generators/mon_pics.py | klemniops/linoone | train | 0 | |
5eb0ccc2c3aefb5e5c5bd1b44bfe774714d918cf | [
"with patch('logout.logout', return_value='test') as mock:\n check_input('logout')\nself.assertTrue(mock.called)",
"with patch('logout.logout', return_value='test') as mock:\n check_input('logou')\n check_input('ogout')\n check_input('log out')\n check_input('some other string')\n check_input(67... | <|body_start_0|>
with patch('logout.logout', return_value='test') as mock:
check_input('logout')
self.assertTrue(mock.called)
<|end_body_0|>
<|body_start_1|>
with patch('logout.logout', return_value='test') as mock:
check_input('logou')
check_input('ogout')
... | check_input function tests | CheckInputTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckInputTestCase:
"""check_input function tests"""
def test_logout_called(self):
"""Test that logout() is called when proper"""
<|body_0|>
def test_logout_not_called(self):
"""Test that logout() is not called when improper"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_007313 | 2,406 | no_license | [
{
"docstring": "Test that logout() is called when proper",
"name": "test_logout_called",
"signature": "def test_logout_called(self)"
},
{
"docstring": "Test that logout() is not called when improper",
"name": "test_logout_not_called",
"signature": "def test_logout_not_called(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019086 | Implement the Python class `CheckInputTestCase` described below.
Class description:
check_input function tests
Method signatures and docstrings:
- def test_logout_called(self): Test that logout() is called when proper
- def test_logout_not_called(self): Test that logout() is not called when improper | Implement the Python class `CheckInputTestCase` described below.
Class description:
check_input function tests
Method signatures and docstrings:
- def test_logout_called(self): Test that logout() is called when proper
- def test_logout_not_called(self): Test that logout() is not called when improper
<|skeleton|>
cla... | a5268f86273cdfb25c966a4cbfb4d6beb91d0e21 | <|skeleton|>
class CheckInputTestCase:
"""check_input function tests"""
def test_logout_called(self):
"""Test that logout() is called when proper"""
<|body_0|>
def test_logout_not_called(self):
"""Test that logout() is not called when improper"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckInputTestCase:
"""check_input function tests"""
def test_logout_called(self):
"""Test that logout() is called when proper"""
with patch('logout.logout', return_value='test') as mock:
check_input('logout')
self.assertTrue(mock.called)
def test_logout_not_calle... | the_stack_v2_python_sparse | src/test_logout.py | mattkronengold/bpm | train | 1 |
4535135b06fb9d49469f28e0dac5c5c4aa226f05 | [
"for path in [termsPath]:\n if os.path.exists(path) == False:\n raise Exception('Cannot find specified path\\n%s' % path)\nself.termsPath = os.path.realpath(termsPath)\nself.queue = []\nself.baseDir = os.path.realpath(os.path.dirname(__file__))\nif outFile == None:\n self.outFile = 'gdistances.csv'\nel... | <|body_start_0|>
for path in [termsPath]:
if os.path.exists(path) == False:
raise Exception('Cannot find specified path\n%s' % path)
self.termsPath = os.path.realpath(termsPath)
self.queue = []
self.baseDir = os.path.realpath(os.path.dirname(__file__))
... | A generic class to handle calculate gene distances using term distances | GeneDistances | [
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneDistances:
"""A generic class to handle calculate gene distances using term distances"""
def __init__(self, termsPath, termDistancesPath, outFile=None):
"""Constructor"""
<|body_0|>
def get_min_term_dist(self, sourceTerms, sinkTerms):
"""To get the minimum di... | stack_v2_sparse_classes_36k_train_007314 | 3,568 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, termsPath, termDistancesPath, outFile=None)"
},
{
"docstring": "To get the minimum distance between a source and a sink gene we use the minimum distance between their go terms return the shorest path between two s... | 3 | null | Implement the Python class `GeneDistances` described below.
Class description:
A generic class to handle calculate gene distances using term distances
Method signatures and docstrings:
- def __init__(self, termsPath, termDistancesPath, outFile=None): Constructor
- def get_min_term_dist(self, sourceTerms, sinkTerms): ... | Implement the Python class `GeneDistances` described below.
Class description:
A generic class to handle calculate gene distances using term distances
Method signatures and docstrings:
- def __init__(self, termsPath, termDistancesPath, outFile=None): Constructor
- def get_min_term_dist(self, sourceTerms, sinkTerms): ... | a343aff9b833979b4f5d4ba6d16fc2b65d8ccfc1 | <|skeleton|>
class GeneDistances:
"""A generic class to handle calculate gene distances using term distances"""
def __init__(self, termsPath, termDistancesPath, outFile=None):
"""Constructor"""
<|body_0|>
def get_min_term_dist(self, sourceTerms, sinkTerms):
"""To get the minimum di... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeneDistances:
"""A generic class to handle calculate gene distances using term distances"""
def __init__(self, termsPath, termDistancesPath, outFile=None):
"""Constructor"""
for path in [termsPath]:
if os.path.exists(path) == False:
raise Exception('Cannot fin... | the_stack_v2_python_sparse | htsint/GeneDistances.py | changanla/htsint | train | 0 |
f49141147313ac7856cebd21a8914c5e9957e92c | [
"await super()._get_source_responses(*urls)\nstats_api = URL(f'{await self._api_url()}/cxrestapi/sast/scans/{self._scan_id}/resultsStatistics')\nreturn await SourceCollector._get_source_responses(self, stats_api)",
"stats = await responses[0].json()\nseverities = self._parameter('severities')\nreturn str(sum((sta... | <|body_start_0|>
await super()._get_source_responses(*urls)
stats_api = URL(f'{await self._api_url()}/cxrestapi/sast/scans/{self._scan_id}/resultsStatistics')
return await SourceCollector._get_source_responses(self, stats_api)
<|end_body_0|>
<|body_start_1|>
stats = await responses[0].j... | Collector class to measure the number of security warnings in a Checkmarx CxSAST scan. | CxSASTSecurityWarnings | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CxSASTSecurityWarnings:
"""Collector class to measure the number of security warnings in a Checkmarx CxSAST scan."""
async def _get_source_responses(self, *urls: URL) -> SourceResponses:
"""Extend to get the scan results."""
<|body_0|>
async def _parse_value(self, respon... | stack_v2_sparse_classes_36k_train_007315 | 1,092 | permissive | [
{
"docstring": "Extend to get the scan results.",
"name": "_get_source_responses",
"signature": "async def _get_source_responses(self, *urls: URL) -> SourceResponses"
},
{
"docstring": "Override to parse the number of security warnings from the scan results.",
"name": "_parse_value",
"si... | 2 | stack_v2_sparse_classes_30k_val_000331 | Implement the Python class `CxSASTSecurityWarnings` described below.
Class description:
Collector class to measure the number of security warnings in a Checkmarx CxSAST scan.
Method signatures and docstrings:
- async def _get_source_responses(self, *urls: URL) -> SourceResponses: Extend to get the scan results.
- asy... | Implement the Python class `CxSASTSecurityWarnings` described below.
Class description:
Collector class to measure the number of security warnings in a Checkmarx CxSAST scan.
Method signatures and docstrings:
- async def _get_source_responses(self, *urls: URL) -> SourceResponses: Extend to get the scan results.
- asy... | 5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3 | <|skeleton|>
class CxSASTSecurityWarnings:
"""Collector class to measure the number of security warnings in a Checkmarx CxSAST scan."""
async def _get_source_responses(self, *urls: URL) -> SourceResponses:
"""Extend to get the scan results."""
<|body_0|>
async def _parse_value(self, respon... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CxSASTSecurityWarnings:
"""Collector class to measure the number of security warnings in a Checkmarx CxSAST scan."""
async def _get_source_responses(self, *urls: URL) -> SourceResponses:
"""Extend to get the scan results."""
await super()._get_source_responses(*urls)
stats_api = U... | the_stack_v2_python_sparse | components/collector/src/source_collectors/cxsast/security_warnings.py | ICTU/quality-time | train | 43 |
5a551fefbbfd0a833bee54191edbc349c5376d16 | [
"self.auth = auth\nif isinstance(rid, TaskReport):\n self.report = rid\nelse:\n self.report = self.get_report_model(rid)",
"if not rid or rid == '':\n return None\nreport = TaskReport.objects.get_once(pk=rid)\nif not report:\n raise TaskReportExcept.report_is_not_exists()\nreturn report",
"if self.r... | <|body_start_0|>
self.auth = auth
if isinstance(rid, TaskReport):
self.report = rid
else:
self.report = self.get_report_model(rid)
<|end_body_0|>
<|body_start_1|>
if not rid or rid == '':
return None
report = TaskReport.objects.get_once(pk=rid... | TaskReportLogic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskReportLogic:
def __init__(self, auth, tid, rid):
"""INIT :param auth: :param tid: :param rid:"""
<|body_0|>
def get_report_model(self, rid):
"""获取汇报model :param rid: :return:"""
<|body_1|>
def get_report_info(self):
"""获取汇报详情 :return:"""
... | stack_v2_sparse_classes_36k_train_007316 | 1,633 | no_license | [
{
"docstring": "INIT :param auth: :param tid: :param rid:",
"name": "__init__",
"signature": "def __init__(self, auth, tid, rid)"
},
{
"docstring": "获取汇报model :param rid: :return:",
"name": "get_report_model",
"signature": "def get_report_model(self, rid)"
},
{
"docstring": "获取汇报... | 3 | null | Implement the Python class `TaskReportLogic` described below.
Class description:
Implement the TaskReportLogic class.
Method signatures and docstrings:
- def __init__(self, auth, tid, rid): INIT :param auth: :param tid: :param rid:
- def get_report_model(self, rid): 获取汇报model :param rid: :return:
- def get_report_inf... | Implement the Python class `TaskReportLogic` described below.
Class description:
Implement the TaskReportLogic class.
Method signatures and docstrings:
- def __init__(self, auth, tid, rid): INIT :param auth: :param tid: :param rid:
- def get_report_model(self, rid): 获取汇报model :param rid: :return:
- def get_report_inf... | 7467cd66e1fc91f0b3a264f8fc9b93f22f09fe7b | <|skeleton|>
class TaskReportLogic:
def __init__(self, auth, tid, rid):
"""INIT :param auth: :param tid: :param rid:"""
<|body_0|>
def get_report_model(self, rid):
"""获取汇报model :param rid: :return:"""
<|body_1|>
def get_report_info(self):
"""获取汇报详情 :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskReportLogic:
def __init__(self, auth, tid, rid):
"""INIT :param auth: :param tid: :param rid:"""
self.auth = auth
if isinstance(rid, TaskReport):
self.report = rid
else:
self.report = self.get_report_model(rid)
def get_report_model(self, rid):
... | the_stack_v2_python_sparse | FireHydrant/server/task/logics/report.py | shoogoome/FireHydrant | train | 4 | |
d8c7887bedc466479f5584538c0f694ef4f5e612 | [
"n = len(nums)\nL = [1] * n\nR = [1] * n\nfor i in range(1, n):\n L[i] = L[i - 1] * nums[i - 1]\nfor i in range(n - 2, -1, -1):\n R[i] = R[i + 1] * nums[i + 1]\nres = []\nfor i in range(n):\n res.append(L[i] * R[i])\nreturn res",
"n = len(nums)\nL = [1] * n\nfor i in range(1, n):\n L[i] = L[i - 1] * n... | <|body_start_0|>
n = len(nums)
L = [1] * n
R = [1] * n
for i in range(1, n):
L[i] = L[i - 1] * nums[i - 1]
for i in range(n - 2, -1, -1):
R[i] = R[i + 1] * nums[i + 1]
res = []
for i in range(n):
res.append(L[i] * R[i])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = len(nums)
... | stack_v2_sparse_classes_36k_train_007317 | 945 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelf",
"signature": "def productExceptSelf(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[int]",
"name": "productExceptSelf",
"signature": "def productExceptSelf(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011130 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
- def productExceptSelf(self, nums): :type nums: List[int] :rtype: List[int]
<|skeleton|>
class Soluti... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_0|>
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def productExceptSelf(self, nums):
""":type nums: List[int] :rtype: List[int]"""
n = len(nums)
L = [1] * n
R = [1] * n
for i in range(1, n):
L[i] = L[i - 1] * nums[i - 1]
for i in range(n - 2, -1, -1):
R[i] = R[i + 1] * nums[i +... | the_stack_v2_python_sparse | 0238_Product_of_Array_Except_Self.py | bingli8802/leetcode | train | 0 | |
a5992044a8d8a6b068a1b3ddf3d4f7c27a4c64e1 | [
"self.template_path = template_path\nself.must_be_first_tab = must_be_first_tab\ntemplate_drawio = DrawIO(self.template_path)\nself.template_metadata = template_drawio.get_metadata()[0]\nself.template_version = MarkdownValidator.extract_template_version(self.template_metadata)\nif self.template_version not in str(s... | <|body_start_0|>
self.template_path = template_path
self.must_be_first_tab = must_be_first_tab
template_drawio = DrawIO(self.template_path)
self.template_metadata = template_drawio.get_metadata()[0]
self.template_version = MarkdownValidator.extract_template_version(self.template_... | Validator to check whether drawio metadata meets validation expectations. | DrawIOMetadataValidator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DrawIOMetadataValidator:
"""Validator to check whether drawio metadata meets validation expectations."""
def __init__(self, template_path: pathlib.Path, must_be_first_tab: bool=True) -> None:
"""Initialize drawio validator. Args: template_path: Path to a templated drawio file where m... | stack_v2_sparse_classes_36k_train_007318 | 10,445 | permissive | [
{
"docstring": "Initialize drawio validator. Args: template_path: Path to a templated drawio file where metadata will be looked up on the first tab only. must_be_first_tab: Whether to search the candidate file for a metadata across multiple tabs.",
"name": "__init__",
"signature": "def __init__(self, te... | 2 | stack_v2_sparse_classes_30k_train_000931 | Implement the Python class `DrawIOMetadataValidator` described below.
Class description:
Validator to check whether drawio metadata meets validation expectations.
Method signatures and docstrings:
- def __init__(self, template_path: pathlib.Path, must_be_first_tab: bool=True) -> None: Initialize drawio validator. Arg... | Implement the Python class `DrawIOMetadataValidator` described below.
Class description:
Validator to check whether drawio metadata meets validation expectations.
Method signatures and docstrings:
- def __init__(self, template_path: pathlib.Path, must_be_first_tab: bool=True) -> None: Initialize drawio validator. Arg... | 969c10eceb73202d2b7856bac598f9b11afc696e | <|skeleton|>
class DrawIOMetadataValidator:
"""Validator to check whether drawio metadata meets validation expectations."""
def __init__(self, template_path: pathlib.Path, must_be_first_tab: bool=True) -> None:
"""Initialize drawio validator. Args: template_path: Path to a templated drawio file where m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DrawIOMetadataValidator:
"""Validator to check whether drawio metadata meets validation expectations."""
def __init__(self, template_path: pathlib.Path, must_be_first_tab: bool=True) -> None:
"""Initialize drawio validator. Args: template_path: Path to a templated drawio file where metadata will ... | the_stack_v2_python_sparse | trestle/core/draw_io.py | xee5ch/compliance-trestle | train | 0 |
5a27121a9c9ca5f245e04a8441881d742c04df55 | [
"webauthns = []\nfor w in Webauthn.objects.filter(user=request.user).all():\n webauthns.append({'id': w.id, 'active': w.active, 'title': w.title})\nreturn Response({'webauthns': webauthns}, status=status.HTTP_200_OK)",
"serializer = self.get_serializer(data=request.data)\nif not serializer.is_valid():\n ret... | <|body_start_0|>
webauthns = []
for w in Webauthn.objects.filter(user=request.user).all():
webauthns.append({'id': w.id, 'active': w.active, 'title': w.title})
return Response({'webauthns': webauthns}, status=status.HTTP_200_OK)
<|end_body_0|>
<|body_start_1|>
serializer = s... | UserWebauthn | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserWebauthn:
def get(self, request, *args, **kwargs):
"""Checks the REST Token and returns a list of all webauthns :param request: :type request: :param args: :type args: :param kwargs: :type kwargs: :return: 200 :rtype:"""
<|body_0|>
def put(self, request, *args, **kwargs)... | stack_v2_sparse_classes_36k_train_007319 | 5,377 | permissive | [
{
"docstring": "Checks the REST Token and returns a list of all webauthns :param request: :type request: :param args: :type args: :param kwargs: :type kwargs: :return: 200 :rtype:",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Checks the REST Token and... | 4 | null | Implement the Python class `UserWebauthn` described below.
Class description:
Implement the UserWebauthn class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Checks the REST Token and returns a list of all webauthns :param request: :type request: :param args: :type args: :param kwargs: ... | Implement the Python class `UserWebauthn` described below.
Class description:
Implement the UserWebauthn class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Checks the REST Token and returns a list of all webauthns :param request: :type request: :param args: :type args: :param kwargs: ... | 8936aa8ccdee8b9617ef7d894cb9a9a9f6f473cf | <|skeleton|>
class UserWebauthn:
def get(self, request, *args, **kwargs):
"""Checks the REST Token and returns a list of all webauthns :param request: :type request: :param args: :type args: :param kwargs: :type kwargs: :return: 200 :rtype:"""
<|body_0|>
def put(self, request, *args, **kwargs)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserWebauthn:
def get(self, request, *args, **kwargs):
"""Checks the REST Token and returns a list of all webauthns :param request: :type request: :param args: :type args: :param kwargs: :type kwargs: :return: 200 :rtype:"""
webauthns = []
for w in Webauthn.objects.filter(user=request.... | the_stack_v2_python_sparse | psono/restapi/views/user_webauthn.py | psono/psono-server | train | 76 | |
7a174be35bef155fa4e649a67ecfae0012fc3153 | [
"l = []\n\ndef preOrder(root):\n if not root:\n l.append('n')\n return\n l.append(str(root.val))\n preOrder(root.left)\n preOrder(root.right)\npreOrder(root)\nreturn ','.join(l)",
"l = list(map(lambda x: int(x) if x != 'n' else None, data.split(',')))\nif not l or l[0] is None:\n retu... | <|body_start_0|>
l = []
def preOrder(root):
if not root:
l.append('n')
return
l.append(str(root.val))
preOrder(root.left)
preOrder(root.right)
preOrder(root)
return ','.join(l)
<|end_body_0|>
<|body_start_1... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l = []
... | stack_v2_sparse_classes_36k_train_007320 | 2,159 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | stack_v2_sparse_classes_30k_val_000480 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | f6f7b548b29abe53b88a7396296d7edc932450cc | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
l = []
def preOrder(root):
if not root:
l.append('n')
return
l.append(str(root.val))
preOrder(root.left)
preOrder... | the_stack_v2_python_sparse | leetcode/daily challenges/2020-10/09-serialize-and-deserialize-bst.py | Nayald/algorithm-portfolio | train | 0 | |
707b3658ef827c8ed12566494a32c0fa8c7e7dc5 | [
"for factory in self.pyre_factories():\n factory.pyre_make(**kwds)\nreturn",
"outputs = {product for factory in self.pyre_factories() for product, _ in factory.pyre_outputs() if product is not None}\nfor factory in self.pyre_factories():\n for product, meta in factory.pyre_inputs():\n if product in o... | <|body_start_0|>
for factory in self.pyre_factories():
factory.pyre_make(**kwds)
return
<|end_body_0|>
<|body_start_1|>
outputs = {product for factory in self.pyre_factories() for product, _ in factory.pyre_outputs() if product is not None}
for factory in self.pyre_factories... | A container of flow products and factories | Workflow | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Workflow:
"""A container of flow products and factories"""
def pyre_make(self, **kwds):
"""Invoke this workflow"""
<|body_0|>
def pyre_inputs(self):
"""Generate the sequence of my input products"""
<|body_1|>
def pyre_outputs(self):
"""Genera... | stack_v2_sparse_classes_36k_train_007321 | 2,952 | permissive | [
{
"docstring": "Invoke this workflow",
"name": "pyre_make",
"signature": "def pyre_make(self, **kwds)"
},
{
"docstring": "Generate the sequence of my input products",
"name": "pyre_inputs",
"signature": "def pyre_inputs(self)"
},
{
"docstring": "Generate the sequence of my output... | 4 | null | Implement the Python class `Workflow` described below.
Class description:
A container of flow products and factories
Method signatures and docstrings:
- def pyre_make(self, **kwds): Invoke this workflow
- def pyre_inputs(self): Generate the sequence of my input products
- def pyre_outputs(self): Generate the sequence... | Implement the Python class `Workflow` described below.
Class description:
A container of flow products and factories
Method signatures and docstrings:
- def pyre_make(self, **kwds): Invoke this workflow
- def pyre_inputs(self): Generate the sequence of my input products
- def pyre_outputs(self): Generate the sequence... | d741c44ffb3e9e1f726bf492202ac8738bb4aa1c | <|skeleton|>
class Workflow:
"""A container of flow products and factories"""
def pyre_make(self, **kwds):
"""Invoke this workflow"""
<|body_0|>
def pyre_inputs(self):
"""Generate the sequence of my input products"""
<|body_1|>
def pyre_outputs(self):
"""Genera... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Workflow:
"""A container of flow products and factories"""
def pyre_make(self, **kwds):
"""Invoke this workflow"""
for factory in self.pyre_factories():
factory.pyre_make(**kwds)
return
def pyre_inputs(self):
"""Generate the sequence of my input products""... | the_stack_v2_python_sparse | packages/pyre/flow/Workflow.py | pyre/pyre | train | 27 |
bead2ad531fbd51bce5565c6caded35347e6f6f6 | [
"farthest = 0\nfor i in range(len(nums)):\n if i > farthest:\n return False\n farthest = max(farthest, i + nums[i])\nreturn True",
"start = len(nums) - 1\nfor i in range(len(nums) - 1, -1, -1):\n print(i, start)\n if i + nums[i] >= start:\n start = i\nreturn 0 == start"
] | <|body_start_0|>
farthest = 0
for i in range(len(nums)):
if i > farthest:
return False
farthest = max(farthest, i + nums[i])
return True
<|end_body_0|>
<|body_start_1|>
start = len(nums) - 1
for i in range(len(nums) - 1, -1, -1):
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canJump(self, nums: List[int]) -> bool:
"""贪心策略:如果一个位置能够到达,那么这个位置左侧所有位置都能到达。"""
<|body_0|>
def canJump2(self, nums: List[int]) -> bool:
"""贪心策略2:向前遍历记录可以到达终点的最前的位置。"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
farthest = 0
f... | stack_v2_sparse_classes_36k_train_007322 | 1,800 | permissive | [
{
"docstring": "贪心策略:如果一个位置能够到达,那么这个位置左侧所有位置都能到达。",
"name": "canJump",
"signature": "def canJump(self, nums: List[int]) -> bool"
},
{
"docstring": "贪心策略2:向前遍历记录可以到达终点的最前的位置。",
"name": "canJump2",
"signature": "def canJump2(self, nums: List[int]) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums: List[int]) -> bool: 贪心策略:如果一个位置能够到达,那么这个位置左侧所有位置都能到达。
- def canJump2(self, nums: List[int]) -> bool: 贪心策略2:向前遍历记录可以到达终点的最前的位置。 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums: List[int]) -> bool: 贪心策略:如果一个位置能够到达,那么这个位置左侧所有位置都能到达。
- def canJump2(self, nums: List[int]) -> bool: 贪心策略2:向前遍历记录可以到达终点的最前的位置。
<|skeleton|>
class Solutio... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def canJump(self, nums: List[int]) -> bool:
"""贪心策略:如果一个位置能够到达,那么这个位置左侧所有位置都能到达。"""
<|body_0|>
def canJump2(self, nums: List[int]) -> bool:
"""贪心策略2:向前遍历记录可以到达终点的最前的位置。"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canJump(self, nums: List[int]) -> bool:
"""贪心策略:如果一个位置能够到达,那么这个位置左侧所有位置都能到达。"""
farthest = 0
for i in range(len(nums)):
if i > farthest:
return False
farthest = max(farthest, i + nums[i])
return True
def canJump2(self, ... | the_stack_v2_python_sparse | 55-jump-game.py | yuenliou/leetcode | train | 0 | |
aa6e36ac8681973a3dd671df0794440d6671ea5c | [
"token = access_control.ACLToken(username='test', reason='fixture')\nwith aff4.FACTORY.Create('aff4:/stats/ClientFleetStats', 'ClientFleetStats', token=token) as fd:\n now = 1321057655\n for i in range(10, 15):\n histogram = fd.Schema.OS_HISTOGRAM(age=int((now + i * 60 * 60 * 24) * 1000000.0))\n ... | <|body_start_0|>
token = access_control.ACLToken(username='test', reason='fixture')
with aff4.FACTORY.Create('aff4:/stats/ClientFleetStats', 'ClientFleetStats', token=token) as fd:
now = 1321057655
for i in range(10, 15):
histogram = fd.Schema.OS_HISTOGRAM(age=int... | Test the statistics interface. | TestStats | [
"Apache-2.0",
"DOC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestStats:
"""Test the statistics interface."""
def PopulateData():
"""Populates data into the stats object."""
<|body_0|>
def testStats(self):
"""Test the statistics interface. Unfortunately this test is pretty lame because we can not look into the canvas object... | stack_v2_sparse_classes_36k_train_007323 | 2,708 | permissive | [
{
"docstring": "Populates data into the stats object.",
"name": "PopulateData",
"signature": "def PopulateData()"
},
{
"docstring": "Test the statistics interface. Unfortunately this test is pretty lame because we can not look into the canvas object with selenium.",
"name": "testStats",
... | 2 | stack_v2_sparse_classes_30k_train_010302 | Implement the Python class `TestStats` described below.
Class description:
Test the statistics interface.
Method signatures and docstrings:
- def PopulateData(): Populates data into the stats object.
- def testStats(self): Test the statistics interface. Unfortunately this test is pretty lame because we can not look i... | Implement the Python class `TestStats` described below.
Class description:
Test the statistics interface.
Method signatures and docstrings:
- def PopulateData(): Populates data into the stats object.
- def testStats(self): Test the statistics interface. Unfortunately this test is pretty lame because we can not look i... | ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e | <|skeleton|>
class TestStats:
"""Test the statistics interface."""
def PopulateData():
"""Populates data into the stats object."""
<|body_0|>
def testStats(self):
"""Test the statistics interface. Unfortunately this test is pretty lame because we can not look into the canvas object... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestStats:
"""Test the statistics interface."""
def PopulateData():
"""Populates data into the stats object."""
token = access_control.ACLToken(username='test', reason='fixture')
with aff4.FACTORY.Create('aff4:/stats/ClientFleetStats', 'ClientFleetStats', token=token) as fd:
... | the_stack_v2_python_sparse | gui/plugins/statistics_test.py | defaultnamehere/grr | train | 3 |
a24cd45a4efa46e6ba01bfdbd50b532d64011c01 | [
"self.text = ''\nself.keywords = None\nself.seg = Segmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags, delimiters=delimiters)\nself.sentences = None\nself.words_no_filter = None\nself.words_no_stop_words = None\nself.words_all_filters = None",
"self.text = text\nself.word_index = {}\... | <|body_start_0|>
self.text = ''
self.keywords = None
self.seg = Segmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags, delimiters=delimiters)
self.sentences = None
self.words_no_filter = None
self.words_no_stop_words = None
self.words_a... | TextRank4Keyword | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextRank4Keyword:
def __init__(self, stop_words_file=None, allow_speech_tags=allow_speech_tags, delimiters=sentence_delimiters):
"""Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: self.words_no_filter --... | stack_v2_sparse_classes_36k_train_007324 | 27,442 | no_license | [
{
"docstring": "Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: self.words_no_filter -- 对sentences中每个句子分词而得到的两级列表。 self.words_no_stop_words -- 去掉words_no_filter中的停止词而得到的两级列表。 self.words_all_filters -- 保留words_no_stop_words中指定词性... | 4 | stack_v2_sparse_classes_30k_train_008731 | Implement the Python class `TextRank4Keyword` described below.
Class description:
Implement the TextRank4Keyword class.
Method signatures and docstrings:
- def __init__(self, stop_words_file=None, allow_speech_tags=allow_speech_tags, delimiters=sentence_delimiters): Keyword arguments: stop_words_file -- str,指定停止词文件路径... | Implement the Python class `TextRank4Keyword` described below.
Class description:
Implement the TextRank4Keyword class.
Method signatures and docstrings:
- def __init__(self, stop_words_file=None, allow_speech_tags=allow_speech_tags, delimiters=sentence_delimiters): Keyword arguments: stop_words_file -- str,指定停止词文件路径... | 815a5706183063522d5a26c321b047ee1ab812cf | <|skeleton|>
class TextRank4Keyword:
def __init__(self, stop_words_file=None, allow_speech_tags=allow_speech_tags, delimiters=sentence_delimiters):
"""Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: self.words_no_filter --... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextRank4Keyword:
def __init__(self, stop_words_file=None, allow_speech_tags=allow_speech_tags, delimiters=sentence_delimiters):
"""Keyword arguments: stop_words_file -- str,指定停止词文件路径(一行一个停止词),若为其他类型,则使用默认停止词文件 delimiters -- 默认值是`?!;?!。;… `,用来将文本拆分为句子。 Object Var: self.words_no_filter -- 对sentences中每个... | the_stack_v2_python_sparse | knowledge_graph/information/keywords_extraction.py | wagaman/deep_learning | train | 0 | |
7fb2592690a9344ff820b7fc53060662577c7baf | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConnectionOperation()",
"from ..entity import Entity\nfrom ..public_error import PublicError\nfrom .connection_operation_status import ConnectionOperationStatus\nfrom ..entity import Entity\nfrom ..public_error import PublicError\nfrom... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ConnectionOperation()
<|end_body_0|>
<|body_start_1|>
from ..entity import Entity
from ..public_error import PublicError
from .connection_operation_status import ConnectionOperat... | ConnectionOperation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectionOperation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob... | stack_v2_sparse_classes_36k_train_007325 | 2,757 | 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: ConnectionOperation",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator... | 3 | null | Implement the Python class `ConnectionOperation` described below.
Class description:
Implement the ConnectionOperation class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: Creates a new instance of the appropriate class based on d... | Implement the Python class `ConnectionOperation` described below.
Class description:
Implement the ConnectionOperation class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation: Creates a new instance of the appropriate class based on d... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ConnectionOperation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectionOperation:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConnectionOperation:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ... | the_stack_v2_python_sparse | msgraph/generated/models/external_connectors/connection_operation.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
4876670306827da393525328adf6091c34d80535 | [
"try:\n response = self.dynamo_client.get_item(TableName=table, Key={'id': {'S': id}})\n items = response.get('Item')\n if return_type == 'dataframe':\n df = pd.DataFrame(items)\n return df\n else:\n return items\nexcept Exception as e:\n print(e)",
"try:\n self.dynamo_clien... | <|body_start_0|>
try:
response = self.dynamo_client.get_item(TableName=table, Key={'id': {'S': id}})
items = response.get('Item')
if return_type == 'dataframe':
df = pd.DataFrame(items)
return df
else:
return items
... | DynamoDBHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynamoDBHelper:
def get_data(self, table, id, return_type):
"""Retrieve Data from Table :param table: Table name, you want to retrieve data from. :param id: Record id, you want to retrieve. :param return_type: wether you want to return dataframe or Dictionary."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_007326 | 2,656 | no_license | [
{
"docstring": "Retrieve Data from Table :param table: Table name, you want to retrieve data from. :param id: Record id, you want to retrieve. :param return_type: wether you want to return dataframe or Dictionary.",
"name": "get_data",
"signature": "def get_data(self, table, id, return_type)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_003859 | Implement the Python class `DynamoDBHelper` described below.
Class description:
Implement the DynamoDBHelper class.
Method signatures and docstrings:
- def get_data(self, table, id, return_type): Retrieve Data from Table :param table: Table name, you want to retrieve data from. :param id: Record id, you want to retri... | Implement the Python class `DynamoDBHelper` described below.
Class description:
Implement the DynamoDBHelper class.
Method signatures and docstrings:
- def get_data(self, table, id, return_type): Retrieve Data from Table :param table: Table name, you want to retrieve data from. :param id: Record id, you want to retri... | 0ee797be88095388c41bc5074df926760a0e3f8f | <|skeleton|>
class DynamoDBHelper:
def get_data(self, table, id, return_type):
"""Retrieve Data from Table :param table: Table name, you want to retrieve data from. :param id: Record id, you want to retrieve. :param return_type: wether you want to return dataframe or Dictionary."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DynamoDBHelper:
def get_data(self, table, id, return_type):
"""Retrieve Data from Table :param table: Table name, you want to retrieve data from. :param id: Record id, you want to retrieve. :param return_type: wether you want to return dataframe or Dictionary."""
try:
response = se... | the_stack_v2_python_sparse | helpers/dynamodb_helper.py | taimoorpashanbs17/DataLake_Automation | train | 0 | |
0bbd80d0f78c1ab0ee748062e388f66450e3dcc8 | [
"a, b = (int(a), int(b))\nif op == '+':\n return a + b\nelif op == '-':\n return a - b\nelif op == '*':\n return a * b\nelse:\n return int(a / b)",
"stack = []\nfor token in tokens:\n if token[-1].isdigit():\n stack.append(token)\n else:\n b = stack.pop()\n a = stack.pop()\n... | <|body_start_0|>
a, b = (int(a), int(b))
if op == '+':
return a + b
elif op == '-':
return a - b
elif op == '*':
return a * b
else:
return int(a / b)
<|end_body_0|>
<|body_start_1|>
stack = []
for token in tokens:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def eval_expr(self, a, b, op):
"""Returns a result of evaluating an expression "a op b". input: a, b, op as strings Time complexity: O(1). Space complexity: O(1)."""
<|body_0|>
def evalRPN(self, tokens):
"""Evaluates postfix expression from left to right. T... | stack_v2_sparse_classes_36k_train_007327 | 1,822 | no_license | [
{
"docstring": "Returns a result of evaluating an expression \"a op b\". input: a, b, op as strings Time complexity: O(1). Space complexity: O(1).",
"name": "eval_expr",
"signature": "def eval_expr(self, a, b, op)"
},
{
"docstring": "Evaluates postfix expression from left to right. Time complexi... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def eval_expr(self, a, b, op): Returns a result of evaluating an expression "a op b". input: a, b, op as strings Time complexity: O(1). Space complexity: O(1).
- def evalRPN(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def eval_expr(self, a, b, op): Returns a result of evaluating an expression "a op b". input: a, b, op as strings Time complexity: O(1). Space complexity: O(1).
- def evalRPN(self... | 71b722ddfe8da04572e527b055cf8723d5c87bbf | <|skeleton|>
class Solution:
def eval_expr(self, a, b, op):
"""Returns a result of evaluating an expression "a op b". input: a, b, op as strings Time complexity: O(1). Space complexity: O(1)."""
<|body_0|>
def evalRPN(self, tokens):
"""Evaluates postfix expression from left to right. T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def eval_expr(self, a, b, op):
"""Returns a result of evaluating an expression "a op b". input: a, b, op as strings Time complexity: O(1). Space complexity: O(1)."""
a, b = (int(a), int(b))
if op == '+':
return a + b
elif op == '-':
return a - ... | the_stack_v2_python_sparse | Stack/evaluate_postfix_expr.py | vladn90/Algorithms | train | 0 | |
1f81dc3af2038bd7a0ebf317339e6b7275b40737 | [
"self.logo = logo\nself.alternate_logo = alternate_logo\nself.icon = icon\nself.alternate_icon = alternate_icon\nself.primary_color = primary_color\nself.secondary_color = secondary_color\nself.gradient_color_top = gradient_color_top\nself.gradient_color_bottom = gradient_color_bottom\nself.tile = tile\nself.tile_s... | <|body_start_0|>
self.logo = logo
self.alternate_logo = alternate_logo
self.icon = icon
self.alternate_icon = alternate_icon
self.primary_color = primary_color
self.secondary_color = secondary_color
self.gradient_color_top = gradient_color_top
self.gradien... | Implementation of the 'InstitutionBranding' model. TODO: type model description here. Attributes: logo (string): TODO: type description here. alternate_logo (string): TODO: type description here. icon (string): TODO: type description here. alternate_icon (string): TODO: type description here. primary_color (string): TO... | InstitutionBranding | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InstitutionBranding:
"""Implementation of the 'InstitutionBranding' model. TODO: type model description here. Attributes: logo (string): TODO: type description here. alternate_logo (string): TODO: type description here. icon (string): TODO: type description here. alternate_icon (string): TODO: ty... | stack_v2_sparse_classes_36k_train_007328 | 4,401 | permissive | [
{
"docstring": "Constructor for the InstitutionBranding class",
"name": "__init__",
"signature": "def __init__(self, logo=None, icon=None, alternate_icon=None, primary_color=None, gradient_color_top=None, gradient_color_bottom=None, tile=None, button_text_color=None, alternate_logo=None, secondary_color... | 2 | stack_v2_sparse_classes_30k_train_005447 | Implement the Python class `InstitutionBranding` described below.
Class description:
Implementation of the 'InstitutionBranding' model. TODO: type model description here. Attributes: logo (string): TODO: type description here. alternate_logo (string): TODO: type description here. icon (string): TODO: type description ... | Implement the Python class `InstitutionBranding` described below.
Class description:
Implementation of the 'InstitutionBranding' model. TODO: type model description here. Attributes: logo (string): TODO: type description here. alternate_logo (string): TODO: type description here. icon (string): TODO: type description ... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class InstitutionBranding:
"""Implementation of the 'InstitutionBranding' model. TODO: type model description here. Attributes: logo (string): TODO: type description here. alternate_logo (string): TODO: type description here. icon (string): TODO: type description here. alternate_icon (string): TODO: ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InstitutionBranding:
"""Implementation of the 'InstitutionBranding' model. TODO: type model description here. Attributes: logo (string): TODO: type description here. alternate_logo (string): TODO: type description here. icon (string): TODO: type description here. alternate_icon (string): TODO: type descriptio... | the_stack_v2_python_sparse | finicityapi/models/institution_branding.py | monarchmoney/finicity-python | train | 0 |
589a1580f580c946febcc1e2b6831e81a0948833 | [
"super(multichannel_exr_converter, self).__init__()\nself.setupUi(self)\nself.connect_ui()\nprint\n'xCC Version 1.2'\nself.setStyleSheet('QMainWindow {background-color: #444444; color: #FFFFFF} QPushButton{background-color: #444444; color: #FFFFFF} QListWidget{background-color: #444444; color: #FFFF00} QLineEdit{ba... | <|body_start_0|>
super(multichannel_exr_converter, self).__init__()
self.setupUi(self)
self.connect_ui()
print
'xCC Version 1.2'
self.setStyleSheet('QMainWindow {background-color: #444444; color: #FFFFFF} QPushButton{background-color: #444444; color: #FFFFFF} QListWidget{... | multichannel_exr_converter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class multichannel_exr_converter:
def __init__(self, parent=None):
"""Initialize the multichannel_exr_converter Class() :param parent:"""
<|body_0|>
def connect_ui(self):
"""Class object signaling and slotting."""
<|body_1|>
def ui_object_switch(self, browse=1... | stack_v2_sparse_classes_36k_train_007329 | 15,939 | no_license | [
{
"docstring": "Initialize the multichannel_exr_converter Class() :param parent:",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "Class object signaling and slotting.",
"name": "connect_ui",
"signature": "def connect_ui(self)"
},
{
"docstrin... | 3 | stack_v2_sparse_classes_30k_train_008168 | Implement the Python class `multichannel_exr_converter` described below.
Class description:
Implement the multichannel_exr_converter class.
Method signatures and docstrings:
- def __init__(self, parent=None): Initialize the multichannel_exr_converter Class() :param parent:
- def connect_ui(self): Class object signali... | Implement the Python class `multichannel_exr_converter` described below.
Class description:
Implement the multichannel_exr_converter class.
Method signatures and docstrings:
- def __init__(self, parent=None): Initialize the multichannel_exr_converter Class() :param parent:
- def connect_ui(self): Class object signali... | b4cd800356146c0b0f84557a8c95a8a7d2fafda8 | <|skeleton|>
class multichannel_exr_converter:
def __init__(self, parent=None):
"""Initialize the multichannel_exr_converter Class() :param parent:"""
<|body_0|>
def connect_ui(self):
"""Class object signaling and slotting."""
<|body_1|>
def ui_object_switch(self, browse=1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class multichannel_exr_converter:
def __init__(self, parent=None):
"""Initialize the multichannel_exr_converter Class() :param parent:"""
super(multichannel_exr_converter, self).__init__()
self.setupUi(self)
self.connect_ui()
print
'xCC Version 1.2'
self.setSt... | the_stack_v2_python_sparse | nuke/tools/multiChannelEXRRender/multicChannelEXR.py | devottam2485/develop | train | 0 | |
07781a5f0e9c8657ee38dc6df1861fbf5b1dd811 | [
"if not a and (not b):\n return True\nif not a or not b:\n return False\nif a.val == b.val:\n return self.symmetric(a.left, b.right) and self.symmetric(a.right, b.left)\nreturn False",
"if not root:\n return True\nreturn self.symmetric(root.left, root.right)"
] | <|body_start_0|>
if not a and (not b):
return True
if not a or not b:
return False
if a.val == b.val:
return self.symmetric(a.left, b.right) and self.symmetric(a.right, b.left)
return False
<|end_body_0|>
<|body_start_1|>
if not root:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def symmetric(self, a, b):
"""a.left = b.right a.right = b.left a.val = b.val"""
<|body_0|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not a and (not b):
... | stack_v2_sparse_classes_36k_train_007330 | 765 | no_license | [
{
"docstring": "a.left = b.right a.right = b.left a.val = b.val",
"name": "symmetric",
"signature": "def symmetric(self, a, b)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def symmetric(self, a, b): a.left = b.right a.right = b.left a.val = b.val
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def symmetric(self, a, b): a.left = b.right a.right = b.left a.val = b.val
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
<|skeleton|>
class Solution:
def... | 34d6e24ffe275184614953fc7f9f469e2891b5a6 | <|skeleton|>
class Solution:
def symmetric(self, a, b):
"""a.left = b.right a.right = b.left a.val = b.val"""
<|body_0|>
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def symmetric(self, a, b):
"""a.left = b.right a.right = b.left a.val = b.val"""
if not a and (not b):
return True
if not a or not b:
return False
if a.val == b.val:
return self.symmetric(a.left, b.right) and self.symmetric(a.right,... | the_stack_v2_python_sparse | python/101.py | tsupei/leetcode | train | 1 | |
9b22f6942e14f6103426bfa0e6421ab08b20d898 | [
"def to_set(x):\n if x is None:\n return set()\n if isinstance(x, (list, tuple)):\n return set(x)\n return set([x])\n\ndef make_match(m):\n return m and {k: to_set(v) for k, v in m.items()}\nself.accept, self.reject = (make_match(accept), make_match(reject))\nself.omit = to_set(omit)\nif a... | <|body_start_0|>
def to_set(x):
if x is None:
return set()
if isinstance(x, (list, tuple)):
return set(x)
return set([x])
def make_match(m):
return m and {k: to_set(v) for k, v in m.items()}
self.accept, self.reject... | Extractor is a class that extracts and normalizes values from incoming message dictionaries into ordered dictionaries based on the `type` key of each message. | Extractor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Extractor:
"""Extractor is a class that extracts and normalizes values from incoming message dictionaries into ordered dictionaries based on the `type` key of each message."""
def __init__(self, omit=None, normalizers=None, keys_by_type=None, accept=None, reject=None, auto_omit=True):
... | stack_v2_sparse_classes_36k_train_007331 | 3,337 | permissive | [
{
"docstring": "Arguments omit -- A list of keys that will not be extracted. normalizers -- Some keys also need to be \"normalized\" - scaled and offset so they are between 0 and 1, or -1 and 1. The `normalizers` table maps key names to a function that normalizes the value of that key. keys_by_type -- `keys_by_... | 2 | stack_v2_sparse_classes_30k_train_011922 | Implement the Python class `Extractor` described below.
Class description:
Extractor is a class that extracts and normalizes values from incoming message dictionaries into ordered dictionaries based on the `type` key of each message.
Method signatures and docstrings:
- def __init__(self, omit=None, normalizers=None, ... | Implement the Python class `Extractor` described below.
Class description:
Extractor is a class that extracts and normalizes values from incoming message dictionaries into ordered dictionaries based on the `type` key of each message.
Method signatures and docstrings:
- def __init__(self, omit=None, normalizers=None, ... | 3faac7450678aaccd4a283d0d41ca3e7f113f51b | <|skeleton|>
class Extractor:
"""Extractor is a class that extracts and normalizes values from incoming message dictionaries into ordered dictionaries based on the `type` key of each message."""
def __init__(self, omit=None, normalizers=None, keys_by_type=None, accept=None, reject=None, auto_omit=True):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Extractor:
"""Extractor is a class that extracts and normalizes values from incoming message dictionaries into ordered dictionaries based on the `type` key of each message."""
def __init__(self, omit=None, normalizers=None, keys_by_type=None, accept=None, reject=None, auto_omit=True):
"""Argument... | the_stack_v2_python_sparse | timedata/control/extractor.py | timedata-org/timedata | train | 5 |
223e3559156ae92bb96165ec709fe5d50fe25f59 | [
"rm.__init__(self, **kwargs)\nsed.__init__(self, **kwargs)\ntar.__init__(self, **kwargs)\nself.__eula = kwargs.get('eula', False)\nself.__components = kwargs.get('components', ['intel-icc__x86_64', 'intel-ifort__x86_64'])\nself.__license = kwargs.get('license', None)\nself.__ospackages = kwargs.get('ospackages', ['... | <|body_start_0|>
rm.__init__(self, **kwargs)
sed.__init__(self, **kwargs)
tar.__init__(self, **kwargs)
self.__eula = kwargs.get('eula', False)
self.__components = kwargs.get('components', ['intel-icc__x86_64', 'intel-ifort__x86_64'])
self.__license = kwargs.get('license',... | The `intel_psxe` building block installs [Intel Parallel Studio XE](https://software.intel.com/en-us/parallel-studio-xe). You must agree to the [Intel End User License Agreement](https://software.intel.com/en-us/articles/end-user-license-agreement) to use this building block. As a side effect, this building block modif... | intel_psxe | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class intel_psxe:
"""The `intel_psxe` building block installs [Intel Parallel Studio XE](https://software.intel.com/en-us/parallel-studio-xe). You must agree to the [Intel End User License Agreement](https://software.intel.com/en-us/articles/end-user-license-agreement) to use this building block. As a ... | stack_v2_sparse_classes_36k_train_007332 | 9,230 | permissive | [
{
"docstring": "Initialize building block",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "String representation of the building block",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Construct the series of shell comman... | 4 | stack_v2_sparse_classes_30k_train_000789 | Implement the Python class `intel_psxe` described below.
Class description:
The `intel_psxe` building block installs [Intel Parallel Studio XE](https://software.intel.com/en-us/parallel-studio-xe). You must agree to the [Intel End User License Agreement](https://software.intel.com/en-us/articles/end-user-license-agree... | Implement the Python class `intel_psxe` described below.
Class description:
The `intel_psxe` building block installs [Intel Parallel Studio XE](https://software.intel.com/en-us/parallel-studio-xe). You must agree to the [Intel End User License Agreement](https://software.intel.com/en-us/articles/end-user-license-agree... | 555093c0a5c98bd2b0114831b8c676c0c3c50dd7 | <|skeleton|>
class intel_psxe:
"""The `intel_psxe` building block installs [Intel Parallel Studio XE](https://software.intel.com/en-us/parallel-studio-xe). You must agree to the [Intel End User License Agreement](https://software.intel.com/en-us/articles/end-user-license-agreement) to use this building block. As a ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class intel_psxe:
"""The `intel_psxe` building block installs [Intel Parallel Studio XE](https://software.intel.com/en-us/parallel-studio-xe). You must agree to the [Intel End User License Agreement](https://software.intel.com/en-us/articles/end-user-license-agreement) to use this building block. As a side effect, ... | the_stack_v2_python_sparse | hpccm/building_blocks/intel_psxe.py | DalavanCloud/hpc-container-maker | train | 1 |
70a62820f27c2fc4d322d550e02390e60d5ec830 | [
"try:\n return phonenumbers.formatnumber(obj, phonenumbers.PhoneNumberFormat.NATIONAL)\nexcept Exception as e:\n return None",
"try:\n obj = phonenumbers.parse(text, 'CA')\n return phonenumbers.formatnumber(obj, phonenumbers.PhoneNumberFormat.NATIONAL)\nexcept Exception as e:\n return None"
] | <|body_start_0|>
try:
return phonenumbers.formatnumber(obj, phonenumbers.PhoneNumberFormat.NATIONAL)
except Exception as e:
return None
<|end_body_0|>
<|body_start_1|>
try:
obj = phonenumbers.parse(text, 'CA')
return phonenumbers.formatnumber(obj,... | Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library. | PhoneNumberField | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhoneNumberField:
"""Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library."""
def to_representation(self, obj):
"""Function used to convert the PhoneNumber object to text string representation."""
<|bo... | stack_v2_sparse_classes_36k_train_007333 | 1,103 | permissive | [
{
"docstring": "Function used to convert the PhoneNumber object to text string representation.",
"name": "to_representation",
"signature": "def to_representation(self, obj)"
},
{
"docstring": "Function used to conver the text into the PhoneNumber object representation.",
"name": "to_internal... | 2 | stack_v2_sparse_classes_30k_train_018491 | Implement the Python class `PhoneNumberField` described below.
Class description:
Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library.
Method signatures and docstrings:
- def to_representation(self, obj): Function used to convert the PhoneNum... | Implement the Python class `PhoneNumberField` described below.
Class description:
Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library.
Method signatures and docstrings:
- def to_representation(self, obj): Function used to convert the PhoneNum... | cf58cf216d377ea97a2676cd594f96fb9d602a46 | <|skeleton|>
class PhoneNumberField:
"""Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library."""
def to_representation(self, obj):
"""Function used to convert the PhoneNumber object to text string representation."""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PhoneNumberField:
"""Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library."""
def to_representation(self, obj):
"""Function used to convert the PhoneNumber object to text string representation."""
try:
... | the_stack_v2_python_sparse | academicstoday/shared_api/custom_fields.py | abhijitdalavi/Django-paas | train | 0 |
e027a9183c2c149dd94aeeaa48900e5a483960bd | [
"super().__init__()\nself._feature_dim = config[0]\nself._hidden_dim = config[1]\nself._output_dim = config[2]\nself._layer_count = config[3]\nself._layers = nn.ModuleList([])\nfor i in range(self._layer_count):\n layer = None\n if i == 0:\n layer = Stochastic_FC(self._feature_dim, self._hidden_dim)\n ... | <|body_start_0|>
super().__init__()
self._feature_dim = config[0]
self._hidden_dim = config[1]
self._output_dim = config[2]
self._layer_count = config[3]
self._layers = nn.ModuleList([])
for i in range(self._layer_count):
layer = None
if i ... | Deterministic_Conv_Encoder | Stochastic_FC_Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stochastic_FC_Encoder:
"""Deterministic_Conv_Encoder"""
def __init__(self, config):
"""NP"""
<|body_0|>
def forward(self, inputs):
"""Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_007334 | 18,202 | no_license | [
{
"docstring": "NP",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :",
"name": "forward",
"signature": "def forward(self, inputs)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001081 | Implement the Python class `Stochastic_FC_Encoder` described below.
Class description:
Deterministic_Conv_Encoder
Method signatures and docstrings:
- def __init__(self, config): NP
- def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output : | Implement the Python class `Stochastic_FC_Encoder` described below.
Class description:
Deterministic_Conv_Encoder
Method signatures and docstrings:
- def __init__(self, config): NP
- def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :
<|skeleton|>
class Stochasti... | c7e1bfb49ebaec6937ed7b186689227f95a43e0f | <|skeleton|>
class Stochastic_FC_Encoder:
"""Deterministic_Conv_Encoder"""
def __init__(self, config):
"""NP"""
<|body_0|>
def forward(self, inputs):
"""Args: input : imamges (num_tasks, n_way, k_shot, feature_dim) Return: output :"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Stochastic_FC_Encoder:
"""Deterministic_Conv_Encoder"""
def __init__(self, config):
"""NP"""
super().__init__()
self._feature_dim = config[0]
self._hidden_dim = config[1]
self._output_dim = config[2]
self._layer_count = config[3]
self._layers = nn.M... | the_stack_v2_python_sparse | model/MAML/Part/encoder.py | MingyuKim87/MLwM | train | 0 |
4acf368b530be055abad166700eea9f066af7e8e | [
"try:\n query = 'INSERT INTO ' + self.table + ' VALUES (%s , %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);'\n cursor = self.database.cursor()\n cursor.execute(query, [None, news[0], news[1], news[2], news[3], news[4], coref_content, lemma_content, original_content, news[6], None, None, None])\n self.... | <|body_start_0|>
try:
query = 'INSERT INTO ' + self.table + ' VALUES (%s , %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);'
cursor = self.database.cursor()
cursor.execute(query, [None, news[0], news[1], news[2], news[3], news[4], coref_content, lemma_content, original_conten... | ArticleAnalyzedDAO | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArticleAnalyzedDAO:
def insertNewsAnalyzed(self, news, original_content, coref_content, lemma_content):
"""Insert the news in the database"""
<|body_0|>
def updateNewsSentimentStrategy1(self, news_id, sentiment):
"""Update the field sentiment of a specified news. The... | stack_v2_sparse_classes_36k_train_007335 | 6,200 | no_license | [
{
"docstring": "Insert the news in the database",
"name": "insertNewsAnalyzed",
"signature": "def insertNewsAnalyzed(self, news, original_content, coref_content, lemma_content)"
},
{
"docstring": "Update the field sentiment of a specified news. The sentiment is the one regarding counting neutral... | 5 | stack_v2_sparse_classes_30k_train_001258 | Implement the Python class `ArticleAnalyzedDAO` described below.
Class description:
Implement the ArticleAnalyzedDAO class.
Method signatures and docstrings:
- def insertNewsAnalyzed(self, news, original_content, coref_content, lemma_content): Insert the news in the database
- def updateNewsSentimentStrategy1(self, n... | Implement the Python class `ArticleAnalyzedDAO` described below.
Class description:
Implement the ArticleAnalyzedDAO class.
Method signatures and docstrings:
- def insertNewsAnalyzed(self, news, original_content, coref_content, lemma_content): Insert the news in the database
- def updateNewsSentimentStrategy1(self, n... | 83b622ab161e27bf36d77ac4754184ccf68a90ba | <|skeleton|>
class ArticleAnalyzedDAO:
def insertNewsAnalyzed(self, news, original_content, coref_content, lemma_content):
"""Insert the news in the database"""
<|body_0|>
def updateNewsSentimentStrategy1(self, news_id, sentiment):
"""Update the field sentiment of a specified news. The... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArticleAnalyzedDAO:
def insertNewsAnalyzed(self, news, original_content, coref_content, lemma_content):
"""Insert the news in the database"""
try:
query = 'INSERT INTO ' + self.table + ' VALUES (%s , %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);'
cursor = self.databa... | the_stack_v2_python_sparse | analysis/utilities/articlesDAO.py | tangtang95/mercurio_project | train | 0 | |
8f7a8fe4612d97498f7071dc1b43f71aff9285fb | [
"valid = ('http://example.com', 'https://example.com/about/', 'ftp://127.0.0.1/', 'https://example.com/about/?something=else', 'sftp://ftp.com/')\nvalidator = URLLikeValidator()\nfor value in valid:\n with self.subTest(value):\n self.assertIsNone(validator(value))",
"invalid = ('example.com', 'htp://exa... | <|body_start_0|>
valid = ('http://example.com', 'https://example.com/about/', 'ftp://127.0.0.1/', 'https://example.com/about/?something=else', 'sftp://ftp.com/')
validator = URLLikeValidator()
for value in valid:
with self.subTest(value):
self.assertIsNone(validator(v... | Flexible URL validation. | URLLikeValidatorTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class URLLikeValidatorTestCase:
"""Flexible URL validation."""
def test_valid_urls(self):
"""Valid URLs examples."""
<|body_0|>
def test_invalid_urls(self):
"""Invalid URL examples."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
valid = ('http://exam... | stack_v2_sparse_classes_36k_train_007336 | 10,472 | no_license | [
{
"docstring": "Valid URLs examples.",
"name": "test_valid_urls",
"signature": "def test_valid_urls(self)"
},
{
"docstring": "Invalid URL examples.",
"name": "test_invalid_urls",
"signature": "def test_invalid_urls(self)"
}
] | 2 | null | Implement the Python class `URLLikeValidatorTestCase` described below.
Class description:
Flexible URL validation.
Method signatures and docstrings:
- def test_valid_urls(self): Valid URLs examples.
- def test_invalid_urls(self): Invalid URL examples. | Implement the Python class `URLLikeValidatorTestCase` described below.
Class description:
Flexible URL validation.
Method signatures and docstrings:
- def test_valid_urls(self): Valid URLs examples.
- def test_invalid_urls(self): Invalid URL examples.
<|skeleton|>
class URLLikeValidatorTestCase:
"""Flexible URL ... | f45fa2718ac8a0a852449fcb58cbcde20dd7a7ff | <|skeleton|>
class URLLikeValidatorTestCase:
"""Flexible URL validation."""
def test_valid_urls(self):
"""Valid URLs examples."""
<|body_0|>
def test_invalid_urls(self):
"""Invalid URL examples."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class URLLikeValidatorTestCase:
"""Flexible URL validation."""
def test_valid_urls(self):
"""Valid URLs examples."""
valid = ('http://example.com', 'https://example.com/about/', 'ftp://127.0.0.1/', 'https://example.com/about/?something=else', 'sftp://ftp.com/')
validator = URLLikeValida... | the_stack_v2_python_sparse | utilities/tests.py | CSIS-iLab/new-silk-road | train | 8 |
32e4d3a358323b04b54f56590c13bb2e1013a988 | [
"self.capacity = capacity\nself.times = List()\nself.cache = {}",
"if key in self.cache:\n node = self.cache[key]\n self.times.touch(node)\n return node.value\nreturn -1",
"if key in self.cache:\n node = self.cache[key]\n node.value = value\n self.times.touch(node)\nelse:\n if self.times.si... | <|body_start_0|>
self.capacity = capacity
self.times = List()
self.cache = {}
<|end_body_0|>
<|body_start_1|>
if key in self.cache:
node = self.cache[key]
self.times.touch(node)
return node.value
return -1
<|end_body_1|>
<|body_start_2|>
... | LRUCache | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_007337 | 3,014 | permissive | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: nothing",
"name": "set",
"sig... | 3 | stack_v2_sparse_classes_30k_test_000492 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :rtype: int
- def set(self, key, value): :type key: int :type value: int :rtype: nothing
<|skeleton|>
cla... | 38acc65fa4315f86acb62874ca488620c5d77e17 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":rtype: int"""
<|body_1|>
def set(self, key, value):
""":type key: int :type value: int :rtype: nothing"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.times = List()
self.cache = {}
def get(self, key):
""":rtype: int"""
if key in self.cache:
node = self.cache[key]
self.times.touch(node)
... | the_stack_v2_python_sparse | lru_cache/solution2.py | mahimadubey/leetcode-python | train | 0 | |
3568cd4d8e40eee95f0a9716ba528f99e476e69f | [
"super(CoordinateInfo, self).__init__()\nself.name = name\nself.generic_level = False\nself.generic_lev_coords = {}\nself.axis = ''\n'Axis'\nself.value = ''\n'Coordinate value'\nself.standard_name = ''\n'Standard name'\nself.long_name = ''\n'Long name'\nself.out_name = ''\n'\\n Out name\\n\\n This is ... | <|body_start_0|>
super(CoordinateInfo, self).__init__()
self.name = name
self.generic_level = False
self.generic_lev_coords = {}
self.axis = ''
'Axis'
self.value = ''
'Coordinate value'
self.standard_name = ''
'Standard name'
self.l... | Class to read and store coordinate information. | CoordinateInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoordinateInfo:
"""Class to read and store coordinate information."""
def __init__(self, name):
"""Class to read and store coordinate information. Parameters ---------- name: str coordinate's name"""
<|body_0|>
def read_json(self, json_data):
"""Read coordinate i... | stack_v2_sparse_classes_36k_train_007338 | 34,873 | permissive | [
{
"docstring": "Class to read and store coordinate information. Parameters ---------- name: str coordinate's name",
"name": "__init__",
"signature": "def __init__(self, name)"
},
{
"docstring": "Read coordinate information from json. Non-present options will be set to empty Parameters ----------... | 2 | stack_v2_sparse_classes_30k_train_020450 | Implement the Python class `CoordinateInfo` described below.
Class description:
Class to read and store coordinate information.
Method signatures and docstrings:
- def __init__(self, name): Class to read and store coordinate information. Parameters ---------- name: str coordinate's name
- def read_json(self, json_dat... | Implement the Python class `CoordinateInfo` described below.
Class description:
Class to read and store coordinate information.
Method signatures and docstrings:
- def __init__(self, name): Class to read and store coordinate information. Parameters ---------- name: str coordinate's name
- def read_json(self, json_dat... | d5187438fea2928644cb53ecb26c6adb1e4cc947 | <|skeleton|>
class CoordinateInfo:
"""Class to read and store coordinate information."""
def __init__(self, name):
"""Class to read and store coordinate information. Parameters ---------- name: str coordinate's name"""
<|body_0|>
def read_json(self, json_data):
"""Read coordinate i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CoordinateInfo:
"""Class to read and store coordinate information."""
def __init__(self, name):
"""Class to read and store coordinate information. Parameters ---------- name: str coordinate's name"""
super(CoordinateInfo, self).__init__()
self.name = name
self.generic_leve... | the_stack_v2_python_sparse | esmvalcore/cmor/table.py | ESMValGroup/ESMValCore | train | 41 |
b41f8ffc168c22cb7692a7c61b90bb2bc0064647 | [
"if self.nodes is None:\n raise CollocationError('Need nodes before computing weights, got %s' % self.nodes)\ncirc_one = np.zeros(self.num_nodes)\ncirc_one[0] = 1.0\ntcks = []\nfor i in range(self.num_nodes):\n tcks.append(BarycentricInterpolator(self.nodes, np.roll(circ_one, i)))\nweights = np.zeros(self.num... | <|body_start_0|>
if self.nodes is None:
raise CollocationError('Need nodes before computing weights, got %s' % self.nodes)
circ_one = np.zeros(self.num_nodes)
circ_one[0] = 1.0
tcks = []
for i in range(self.num_nodes):
tcks.append(BarycentricInterpolator(s... | OriginCollocation | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OriginCollocation:
def _getWeights(self, a, b):
"""Computes weights using barycentric interpolation Args: a (float): left interval boundary b (float): right interval boundary Returns: numpy.ndarray: weights of the collocation formula given by the nodes"""
<|body_0|>
def _gen... | stack_v2_sparse_classes_36k_train_007339 | 7,811 | permissive | [
{
"docstring": "Computes weights using barycentric interpolation Args: a (float): left interval boundary b (float): right interval boundary Returns: numpy.ndarray: weights of the collocation formula given by the nodes",
"name": "_getWeights",
"signature": "def _getWeights(self, a, b)"
},
{
"docs... | 2 | null | Implement the Python class `OriginCollocation` described below.
Class description:
Implement the OriginCollocation class.
Method signatures and docstrings:
- def _getWeights(self, a, b): Computes weights using barycentric interpolation Args: a (float): left interval boundary b (float): right interval boundary Returns... | Implement the Python class `OriginCollocation` described below.
Class description:
Implement the OriginCollocation class.
Method signatures and docstrings:
- def _getWeights(self, a, b): Computes weights using barycentric interpolation Args: a (float): left interval boundary b (float): right interval boundary Returns... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class OriginCollocation:
def _getWeights(self, a, b):
"""Computes weights using barycentric interpolation Args: a (float): left interval boundary b (float): right interval boundary Returns: numpy.ndarray: weights of the collocation formula given by the nodes"""
<|body_0|>
def _gen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OriginCollocation:
def _getWeights(self, a, b):
"""Computes weights using barycentric interpolation Args: a (float): left interval boundary b (float): right interval boundary Returns: numpy.ndarray: weights of the collocation formula given by the nodes"""
if self.nodes is None:
rai... | the_stack_v2_python_sparse | pySDC/playgrounds/lagrange/quadrature.py | Parallel-in-Time/pySDC | train | 30 | |
ad2cf5ed5bf84c172cb0aa1eaac2f3cd983f6298 | [
"super().__init__()\nself.input_size = input_size\nself.d_model = d_model\nif input_size != d_model:\n self.proj = nn.Linear(input_size, d_model)\nlayer = TransformerSRUEncoderLayer(d_model, nhead, dim_feedforward, dropout, sru_dropout, bidirectional)\nself.layers = nn.ModuleList([copy.deepcopy(layer) for _ in r... | <|body_start_0|>
super().__init__()
self.input_size = input_size
self.d_model = d_model
if input_size != d_model:
self.proj = nn.Linear(input_size, d_model)
layer = TransformerSRUEncoderLayer(d_model, nhead, dim_feedforward, dropout, sru_dropout, bidirectional)
... | A TransformerSRUEncoder with an SRU replacing the FFN. | TransformerSRUEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerSRUEncoder:
"""A TransformerSRUEncoder with an SRU replacing the FFN."""
def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1, sru_dropout: Optional[float]=None, bidirectional: bool=False, **kwargs... | stack_v2_sparse_classes_36k_train_007340 | 23,050 | permissive | [
{
"docstring": "Initialize the TransformerEncoder. Parameters --------- input_size : int The embedding dimension of the model. If different from d_model, a linear projection layer is added. d_model : int the number of expected features in encoder/decoder inputs. Default ``512``. nhead : int, optional the number... | 3 | null | Implement the Python class `TransformerSRUEncoder` described below.
Class description:
A TransformerSRUEncoder with an SRU replacing the FFN.
Method signatures and docstrings:
- def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1, sr... | Implement the Python class `TransformerSRUEncoder` described below.
Class description:
A TransformerSRUEncoder with an SRU replacing the FFN.
Method signatures and docstrings:
- def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1, sr... | 0dc2f5b2b286694defe8abf450fe5be9ae12c097 | <|skeleton|>
class TransformerSRUEncoder:
"""A TransformerSRUEncoder with an SRU replacing the FFN."""
def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1, sru_dropout: Optional[float]=None, bidirectional: bool=False, **kwargs... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransformerSRUEncoder:
"""A TransformerSRUEncoder with an SRU replacing the FFN."""
def __init__(self, input_size: int=512, d_model: int=512, nhead: int=8, num_layers: int=6, dim_feedforward: int=2048, dropout: float=0.1, sru_dropout: Optional[float]=None, bidirectional: bool=False, **kwargs: Dict[str, A... | the_stack_v2_python_sparse | flambe/nn/transformer_sru.py | cle-ros/flambe | train | 1 |
18cbed40f7a46a466e5fda0df9700bbde38ecdc9 | [
"super().__init__()\nif list_paddings is None:\n list_paddings = [0 for _ in list_filter_nums]\nlist_cnn_layers = []\nfor filter_num, window_size, padding in zip(list_filter_nums, list_window_sizes, list_paddings):\n cnn_layer = CNNLayer(embedding_size=embedding_size, filter_num=filter_num, window_size=window... | <|body_start_0|>
super().__init__()
if list_paddings is None:
list_paddings = [0 for _ in list_filter_nums]
list_cnn_layers = []
for filter_num, window_size, padding in zip(list_filter_nums, list_window_sizes, list_paddings):
cnn_layer = CNNLayer(embedding_size=em... | 接收到 N 句话(已经替换了词向量)之后, | CNNModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CNNModule:
"""接收到 N 句话(已经替换了词向量)之后,"""
def __init__(self, embedding_size: int, list_filter_nums: List[int], list_window_sizes: List[int], max_sentence_length: int, dropout_p: float, class_num: int, list_paddings: Optional[List[int]]=None):
"""参数中带 list_* 的要求 len 相同,即元素个数一致 :param emb... | stack_v2_sparse_classes_36k_train_007341 | 6,607 | no_license | [
{
"docstring": "参数中带 list_* 的要求 len 相同,即元素个数一致 :param embedding_size: 词向量维度 :param list_filter_nums: 卷积个数(几个滤波器) :param list_window_sizes: 窗口大小,对应论文中的 h :param max_sentence_length: 每个句子有多少单词(已经根据这个参数进行了填充或截断),对应论文中的 n :param dropout_p: p – probability of an element to be zeroed. :param class_num: 分类数目 :param li... | 2 | stack_v2_sparse_classes_30k_train_021483 | Implement the Python class `CNNModule` described below.
Class description:
接收到 N 句话(已经替换了词向量)之后,
Method signatures and docstrings:
- def __init__(self, embedding_size: int, list_filter_nums: List[int], list_window_sizes: List[int], max_sentence_length: int, dropout_p: float, class_num: int, list_paddings: Optional[Li... | Implement the Python class `CNNModule` described below.
Class description:
接收到 N 句话(已经替换了词向量)之后,
Method signatures and docstrings:
- def __init__(self, embedding_size: int, list_filter_nums: List[int], list_window_sizes: List[int], max_sentence_length: int, dropout_p: float, class_num: int, list_paddings: Optional[Li... | 29dc4aa0ebd3f610135ceb88f62634b4597b564a | <|skeleton|>
class CNNModule:
"""接收到 N 句话(已经替换了词向量)之后,"""
def __init__(self, embedding_size: int, list_filter_nums: List[int], list_window_sizes: List[int], max_sentence_length: int, dropout_p: float, class_num: int, list_paddings: Optional[List[int]]=None):
"""参数中带 list_* 的要求 len 相同,即元素个数一致 :param emb... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CNNModule:
"""接收到 N 句话(已经替换了词向量)之后,"""
def __init__(self, embedding_size: int, list_filter_nums: List[int], list_window_sizes: List[int], max_sentence_length: int, dropout_p: float, class_num: int, list_paddings: Optional[List[int]]=None):
"""参数中带 list_* 的要求 len 相同,即元素个数一致 :param embedding_size: ... | the_stack_v2_python_sparse | task02/modules/cnn.py | yjqiang/nlp-beginner | train | 2 |
1c9177b8478834bb631d9aa8d15c69caabdce0b9 | [
"orchestrate(obj=self, config=stencil_factory.config.dace_config)\ngrid_indexing = stencil_factory.grid_indexing\nself._del6_u = damping_coefficients.del6_u\nself._del6_v = damping_coefficients.del6_v\nself._rarea = rarea\nself._fx = quantity_factory.zeros(dims=[X_INTERFACE_DIM, Y_DIM, Z_DIM], units='undefined')\ns... | <|body_start_0|>
orchestrate(obj=self, config=stencil_factory.config.dace_config)
grid_indexing = stencil_factory.grid_indexing
self._del6_u = damping_coefficients.del6_u
self._del6_v = damping_coefficients.del6_v
self._rarea = rarea
self._fx = quantity_factory.zeros(dims... | Fortran name is del2_cubed | HyperdiffusionDamping | [
"Apache-2.0",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HyperdiffusionDamping:
"""Fortran name is del2_cubed"""
def __init__(self, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, damping_coefficients: DampingCoefficients, rarea, nmax: int):
"""Args: grid: fv3core grid object"""
<|body_0|>
def __c... | stack_v2_sparse_classes_36k_train_007342 | 7,280 | permissive | [
{
"docstring": "Args: grid: fv3core grid object",
"name": "__init__",
"signature": "def __init__(self, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, damping_coefficients: DampingCoefficients, rarea, nmax: int)"
},
{
"docstring": "Perform hyperdiffusion damping/fil... | 2 | null | Implement the Python class `HyperdiffusionDamping` described below.
Class description:
Fortran name is del2_cubed
Method signatures and docstrings:
- def __init__(self, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, damping_coefficients: DampingCoefficients, rarea, nmax: int): Args: gri... | Implement the Python class `HyperdiffusionDamping` described below.
Class description:
Fortran name is del2_cubed
Method signatures and docstrings:
- def __init__(self, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, damping_coefficients: DampingCoefficients, rarea, nmax: int): Args: gri... | c543e8ec478d46d88b48cdd3beaaa1717a95b935 | <|skeleton|>
class HyperdiffusionDamping:
"""Fortran name is del2_cubed"""
def __init__(self, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, damping_coefficients: DampingCoefficients, rarea, nmax: int):
"""Args: grid: fv3core grid object"""
<|body_0|>
def __c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HyperdiffusionDamping:
"""Fortran name is del2_cubed"""
def __init__(self, stencil_factory: StencilFactory, quantity_factory: pace.util.QuantityFactory, damping_coefficients: DampingCoefficients, rarea, nmax: int):
"""Args: grid: fv3core grid object"""
orchestrate(obj=self, config=stencil... | the_stack_v2_python_sparse | fv3core/pace/fv3core/stencils/del2cubed.py | ai2cm/pace | train | 27 |
e03b51a3fc4941fce2cf4073d6237bc18194e2d5 | [
"self.__prefix_trie = Trie()\nself.__suffix_trie = Trie()\nfor i in reversed(xrange(len(words))):\n self.__prefix_trie.insert(words[i], i)\n self.__suffix_trie.insert(words[i][::-1], i)",
"prefix_match = self.__prefix_trie.find(prefix)\nsuffix_match = self.__suffix_trie.find(suffix[::-1])\ni, j = (0, 0)\nwh... | <|body_start_0|>
self.__prefix_trie = Trie()
self.__suffix_trie = Trie()
for i in reversed(xrange(len(words))):
self.__prefix_trie.insert(words[i], i)
self.__suffix_trie.insert(words[i][::-1], i)
<|end_body_0|>
<|body_start_1|>
prefix_match = self.__prefix_trie.f... | WordFilter2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordFilter2:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.__prefix_trie = Trie()
self.... | stack_v2_sparse_classes_36k_train_007343 | 6,086 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type prefix: str :type suffix: str :rtype: int",
"name": "f",
"signature": "def f(self, prefix, suffix)"
}
] | 2 | null | Implement the Python class `WordFilter2` described below.
Class description:
Implement the WordFilter2 class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int | Implement the Python class `WordFilter2` described below.
Class description:
Implement the WordFilter2 class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
<|skeleton|>
class WordFilter2:
def _... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class WordFilter2:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordFilter2:
def __init__(self, words):
""":type words: List[str]"""
self.__prefix_trie = Trie()
self.__suffix_trie = Trie()
for i in reversed(xrange(len(words))):
self.__prefix_trie.insert(words[i], i)
self.__suffix_trie.insert(words[i][::-1], i)
d... | the_stack_v2_python_sparse | leetcode_python/Design/prefix-and-suffix-search.py | yennanliu/CS_basics | train | 64 | |
15454fd2e598a2d782cd4f01bdb9403bbdfe1a69 | [
"model = Dog\nname = 'Dogs'\nsuper().__init__(model=model, collection_name=name)\nself.__dog_owner_repository = dog_owner_repository",
"dogs = list()\nowners = self.__dog_owner_repository.search(f'owner_id=={owner_id}')\nfor dog_owner in owners.to_list():\n try:\n dog = self.read(dog_owner.dog_id)\n ... | <|body_start_0|>
model = Dog
name = 'Dogs'
super().__init__(model=model, collection_name=name)
self.__dog_owner_repository = dog_owner_repository
<|end_body_0|>
<|body_start_1|>
dogs = list()
owners = self.__dog_owner_repository.search(f'owner_id=={owner_id}')
fo... | Dog repository class. | DogRepository | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DogRepository:
"""Dog repository class."""
def __init__(self, dog_owner_repository):
"""Initialize dog repository."""
<|body_0|>
def read_dogs_of_owner(self, owner_id):
"""Get dogs associated with this user_id."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_007344 | 950 | no_license | [
{
"docstring": "Initialize dog repository.",
"name": "__init__",
"signature": "def __init__(self, dog_owner_repository)"
},
{
"docstring": "Get dogs associated with this user_id.",
"name": "read_dogs_of_owner",
"signature": "def read_dogs_of_owner(self, owner_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002296 | Implement the Python class `DogRepository` described below.
Class description:
Dog repository class.
Method signatures and docstrings:
- def __init__(self, dog_owner_repository): Initialize dog repository.
- def read_dogs_of_owner(self, owner_id): Get dogs associated with this user_id. | Implement the Python class `DogRepository` described below.
Class description:
Dog repository class.
Method signatures and docstrings:
- def __init__(self, dog_owner_repository): Initialize dog repository.
- def read_dogs_of_owner(self, owner_id): Get dogs associated with this user_id.
<|skeleton|>
class DogReposito... | 129dc7f8213fb3112c35b1551d9ed3d8a14b7fb5 | <|skeleton|>
class DogRepository:
"""Dog repository class."""
def __init__(self, dog_owner_repository):
"""Initialize dog repository."""
<|body_0|>
def read_dogs_of_owner(self, owner_id):
"""Get dogs associated with this user_id."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DogRepository:
"""Dog repository class."""
def __init__(self, dog_owner_repository):
"""Initialize dog repository."""
model = Dog
name = 'Dogs'
super().__init__(model=model, collection_name=name)
self.__dog_owner_repository = dog_owner_repository
def read_dogs... | the_stack_v2_python_sparse | hugbunadarfr_backend/src/app/repository/repositories/dog_repository.py | birna17/veff_hugb | train | 0 |
41e78d8664d25be15ae740d93651cd7da5b6a0b7 | [
"self.default = default\nself.defaultvalue = 'default value'\nsuper().__init__()\nsuper().__setitem__(self.default, self.defaultvalue)",
"try:\n return super().__getitem__(key)\nexcept KeyError:\n try:\n return super().__getitem__(self.default)\n except KeyError:\n print('Dammit! We came, ... | <|body_start_0|>
self.default = default
self.defaultvalue = 'default value'
super().__init__()
super().__setitem__(self.default, self.defaultvalue)
<|end_body_0|>
<|body_start_1|>
try:
return super().__getitem__(key)
except KeyError:
try:
... | This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to use the standard dict.__getitem__(),... | SubDict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubDict:
"""This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to u... | stack_v2_sparse_classes_36k_train_007345 | 1,673 | no_license | [
{
"docstring": "'default' will be the default value for missing keys...",
"name": "__init__",
"signature": "def __init__(self, default)"
},
{
"docstring": "Use some exception handling if no 'key' exists",
"name": "__getitem__",
"signature": "def __getitem__(self, key)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004264 | Implement the Python class `SubDict` described below.
Class description:
This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its _... | Implement the Python class `SubDict` described below.
Class description:
This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its _... | b32f83aa1b705a5ad384b73c618f04f7d2622753 | <|skeleton|>
class SubDict:
"""This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to u... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubDict:
"""This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to use the standa... | the_stack_v2_python_sparse | ostPython4/subdictclass.py | deepbsd/OST_Python | train | 1 |
a66a8fa0c65d15d3deee74c28f19e9858f16ee66 | [
"super(PsortAnalysisReportQueueConsumer, self).__init__(queue_object)\nself._filter_string = filter_string\nself._preferred_encoding = preferred_encoding\nself._storage_file = storage_file\nself.anomalies = []\nself.counter = collections.Counter()\nself.tags = []",
"self.counter[u'Total Reports'] += 1\nself.count... | <|body_start_0|>
super(PsortAnalysisReportQueueConsumer, self).__init__(queue_object)
self._filter_string = filter_string
self._preferred_encoding = preferred_encoding
self._storage_file = storage_file
self.anomalies = []
self.counter = collections.Counter()
self.... | Class that implements an analysis report queue consumer for psort. | PsortAnalysisReportQueueConsumer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PsortAnalysisReportQueueConsumer:
"""Class that implements an analysis report queue consumer for psort."""
def __init__(self, queue_object, storage_file, filter_string, preferred_encoding=u'utf-8'):
"""Initializes the queue consumer. Args: queue_object: the queue object (instance of ... | stack_v2_sparse_classes_36k_train_007346 | 25,291 | permissive | [
{
"docstring": "Initializes the queue consumer. Args: queue_object: the queue object (instance of Queue). storage_file: the storage file (instance of StorageFile). filter_string: the filter string. preferred_encoding: optional preferred encoding.",
"name": "__init__",
"signature": "def __init__(self, qu... | 2 | stack_v2_sparse_classes_30k_train_002720 | Implement the Python class `PsortAnalysisReportQueueConsumer` described below.
Class description:
Class that implements an analysis report queue consumer for psort.
Method signatures and docstrings:
- def __init__(self, queue_object, storage_file, filter_string, preferred_encoding=u'utf-8'): Initializes the queue con... | Implement the Python class `PsortAnalysisReportQueueConsumer` described below.
Class description:
Class that implements an analysis report queue consumer for psort.
Method signatures and docstrings:
- def __init__(self, queue_object, storage_file, filter_string, preferred_encoding=u'utf-8'): Initializes the queue con... | 923797fc00664fa9e3277781b0334d6eed5664fd | <|skeleton|>
class PsortAnalysisReportQueueConsumer:
"""Class that implements an analysis report queue consumer for psort."""
def __init__(self, queue_object, storage_file, filter_string, preferred_encoding=u'utf-8'):
"""Initializes the queue consumer. Args: queue_object: the queue object (instance of ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PsortAnalysisReportQueueConsumer:
"""Class that implements an analysis report queue consumer for psort."""
def __init__(self, queue_object, storage_file, filter_string, preferred_encoding=u'utf-8'):
"""Initializes the queue consumer. Args: queue_object: the queue object (instance of Queue). stora... | the_stack_v2_python_sparse | plaso/frontend/psort.py | CNR-ITTIG/plasodfaxp | train | 1 |
2111660474bba4c65e0a71626725a0886f9cbc0d | [
"if not s or not t:\n return True\nif len(s) != len(t):\n return False\ns_dict = {}\nt_dict = {}\nfor i in range(len(s)):\n if s[i] in s_dict.keys() and s_dict[s[i]] != t[i]:\n return False\n if t[i] in t_dict.keys() and t_dict[t[i]] != s[i]:\n return False\n s_dict[s[i]] = t[i]\n t_... | <|body_start_0|>
if not s or not t:
return True
if len(s) != len(t):
return False
s_dict = {}
t_dict = {}
for i in range(len(s)):
if s[i] in s_dict.keys() and s_dict[s[i]] != t[i]:
return False
if t[i] in t_dict.keys... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic_2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not s or not t:
... | stack_v2_sparse_classes_36k_train_007347 | 1,561 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic",
"signature": "def isIsomorphic(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isIsomorphic_2",
"signature": "def isIsomorphic_2(self, s, t)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic_2(self, s, t): :type s: str :type t: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isIsomorphic(self, s, t): :type s: str :type t: str :rtype: bool
- def isIsomorphic_2(self, s, t): :type s: str :type t: str :rtype: bool
<|skeleton|>
class Solution:
d... | a2cd0dc5e098080df87c4fb57d16877d21ca47a3 | <|skeleton|>
class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isIsomorphic_2(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isIsomorphic(self, s, t):
""":type s: str :type t: str :rtype: bool"""
if not s or not t:
return True
if len(s) != len(t):
return False
s_dict = {}
t_dict = {}
for i in range(len(s)):
if s[i] in s_dict.keys() and... | the_stack_v2_python_sparse | 0205_Isomorphic_Strings/solution.py | benjaminhuanghuang/ben-leetcode | train | 1 | |
c011335626f3e816981972ae5e7c596725e139b7 | [
"counter = Counter(nums)\nres = []\nfor num, count in counter.items():\n if count > len(nums) // 3:\n res.append(num)\nreturn res",
"res = []\ncount1, count2 = (0, 0)\ncand1, cand2 = (int(1e+20), int(1e+30))\nfor num in nums:\n if num == cand1:\n count1 += 1\n elif num == cand2:\n co... | <|body_start_0|>
counter = Counter(nums)
res = []
for num, count in counter.items():
if count > len(nums) // 3:
res.append(num)
return res
<|end_body_0|>
<|body_start_1|>
res = []
count1, count2 = (0, 0)
cand1, cand2 = (int(1e+20), int... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def majorityElement(self, nums: List[int]) -> List[int]:
"""counter肯定是最直接的 O(n)"""
<|body_0|>
def majorityElement2(self, nums: List[int]) -> List[int]:
"""摩尔投票法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
counter = Counter(nums)
... | stack_v2_sparse_classes_36k_train_007348 | 1,368 | no_license | [
{
"docstring": "counter肯定是最直接的 O(n)",
"name": "majorityElement",
"signature": "def majorityElement(self, nums: List[int]) -> List[int]"
},
{
"docstring": "摩尔投票法",
"name": "majorityElement2",
"signature": "def majorityElement2(self, nums: List[int]) -> List[int]"
}
] | 2 | stack_v2_sparse_classes_30k_train_006248 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums: List[int]) -> List[int]: counter肯定是最直接的 O(n)
- def majorityElement2(self, nums: List[int]) -> List[int]: 摩尔投票法 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def majorityElement(self, nums: List[int]) -> List[int]: counter肯定是最直接的 O(n)
- def majorityElement2(self, nums: List[int]) -> List[int]: 摩尔投票法
<|skeleton|>
class Solution:
... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def majorityElement(self, nums: List[int]) -> List[int]:
"""counter肯定是最直接的 O(n)"""
<|body_0|>
def majorityElement2(self, nums: List[int]) -> List[int]:
"""摩尔投票法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def majorityElement(self, nums: List[int]) -> List[int]:
"""counter肯定是最直接的 O(n)"""
counter = Counter(nums)
res = []
for num, count in counter.items():
if count > len(nums) // 3:
res.append(num)
return res
def majorityElement2(s... | the_stack_v2_python_sparse | 19_数学/众数/229. 求众数 II.py | 981377660LMT/algorithm-study | train | 225 | |
f011d29e69b62a8de87cdccba2dbb613ca76945a | [
"super().__init__(datapipe, self._read)\nself.feature_store = feature_store\nself.node_feature_keys = node_feature_keys\nself.edge_feature_keys = edge_feature_keys",
"data.node_features = {}\nnum_layer = len(data.sampled_subgraphs) if data.sampled_subgraphs else 0\ndata.edge_features = [{} for _ in range(num_laye... | <|body_start_0|>
super().__init__(datapipe, self._read)
self.feature_store = feature_store
self.node_feature_keys = node_feature_keys
self.edge_feature_keys = edge_feature_keys
<|end_body_0|>
<|body_start_1|>
data.node_features = {}
num_layer = len(data.sampled_subgraphs... | A feature fetcher used to fetch features for node/edge in graphbolt. | FeatureFetcher | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureFetcher:
"""A feature fetcher used to fetch features for node/edge in graphbolt."""
def __init__(self, datapipe, feature_store, node_feature_keys=None, edge_feature_keys=None):
"""Initlization for a feature fetcher. Parameters ---------- datapipe : DataPipe The datapipe. featu... | stack_v2_sparse_classes_36k_train_007349 | 4,846 | permissive | [
{
"docstring": "Initlization for a feature fetcher. Parameters ---------- datapipe : DataPipe The datapipe. feature_store : FeatureStore A storage for features, support read and update. node_feature_keys : List[str] or Dict[str, List[str]] Node features keys indicates the node features need to be read. - If `no... | 2 | stack_v2_sparse_classes_30k_train_009752 | Implement the Python class `FeatureFetcher` described below.
Class description:
A feature fetcher used to fetch features for node/edge in graphbolt.
Method signatures and docstrings:
- def __init__(self, datapipe, feature_store, node_feature_keys=None, edge_feature_keys=None): Initlization for a feature fetcher. Para... | Implement the Python class `FeatureFetcher` described below.
Class description:
A feature fetcher used to fetch features for node/edge in graphbolt.
Method signatures and docstrings:
- def __init__(self, datapipe, feature_store, node_feature_keys=None, edge_feature_keys=None): Initlization for a feature fetcher. Para... | bbc8ff6261f2e0d2b5982e992b6fbe545e2a4aa1 | <|skeleton|>
class FeatureFetcher:
"""A feature fetcher used to fetch features for node/edge in graphbolt."""
def __init__(self, datapipe, feature_store, node_feature_keys=None, edge_feature_keys=None):
"""Initlization for a feature fetcher. Parameters ---------- datapipe : DataPipe The datapipe. featu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeatureFetcher:
"""A feature fetcher used to fetch features for node/edge in graphbolt."""
def __init__(self, datapipe, feature_store, node_feature_keys=None, edge_feature_keys=None):
"""Initlization for a feature fetcher. Parameters ---------- datapipe : DataPipe The datapipe. feature_store : Fe... | the_stack_v2_python_sparse | python/dgl/graphbolt/feature_fetcher.py | dmlc/dgl | train | 12,631 |
2bac6ed7ad5e6163816a4eff3c7e019e96447a1e | [
"p, sk = ([0] * len(s), [])\nfor i, c in enumerate(s):\n if c == '(':\n sk.append(i)\n elif c == ')' and len(sk) > 0:\n p[sk.pop()] = 1\n p[i] = 1\ntmp, result = (0, 0)\nfor i in p:\n if i == 1:\n tmp += 1\n result = max(result, tmp)\n else:\n tmp = 0\nreturn re... | <|body_start_0|>
p, sk = ([0] * len(s), [])
for i, c in enumerate(s):
if c == '(':
sk.append(i)
elif c == ')' and len(sk) > 0:
p[sk.pop()] = 1
p[i] = 1
tmp, result = (0, 0)
for i in p:
if i == 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestValidParentheses(self, s: str) -> int:
"""1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度"""
<|body_0|>
def longestValidParentheses2(self, s: str) -> int:
"""1. 从左检索有效括号长度,当左括号等于右括号时,记录长度 2. 从右向左重复检索,避免出现()(()()这样的情况,导致误... | stack_v2_sparse_classes_36k_train_007350 | 2,505 | no_license | [
{
"docstring": "1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度",
"name": "longestValidParentheses",
"signature": "def longestValidParentheses(self, s: str) -> int"
},
{
"docstring": "1. 从左检索有效括号长度,当左括号等于右括号时,记录长度 2. 从右向左重复检索,避免出现()(()()这样的情况,导致误判",
"name": "longest... | 3 | stack_v2_sparse_classes_30k_train_012395 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestValidParentheses(self, s: str) -> int: 1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度
- def longestValidParentheses2(self, s: str) -> int: 1... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestValidParentheses(self, s: str) -> int: 1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度
- def longestValidParentheses2(self, s: str) -> int: 1... | 2e4edf7aa23eb094d713756a1ab53162ed467291 | <|skeleton|>
class Solution:
def longestValidParentheses(self, s: str) -> int:
"""1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度"""
<|body_0|>
def longestValidParentheses2(self, s: str) -> int:
"""1. 从左检索有效括号长度,当左括号等于右括号时,记录长度 2. 从右向左重复检索,避免出现()(()()这样的情况,导致误... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def longestValidParentheses(self, s: str) -> int:
"""1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度"""
p, sk = ([0] * len(s), [])
for i, c in enumerate(s):
if c == '(':
sk.append(i)
elif c == ')' and len(sk) >... | the_stack_v2_python_sparse | dp/32-Longest_Valid_Parentheses.py | wangluolin/Algorithm-Everyday | train | 0 | |
00244652a28a8b272f0974560e697d2dd7b802a3 | [
"super(QuestionManager, self).__init__()\nself.getters.update({'answers': 'get_many_to_one', 'help_text': 'get_general', 'label': 'get_general', 'max_answers': 'get_general', 'min_answers': 'get_general', 'max_length': 'get_general', 'min_length': 'get_general', 'max_value': 'get_general', 'min_value': 'get_general... | <|body_start_0|>
super(QuestionManager, self).__init__()
self.getters.update({'answers': 'get_many_to_one', 'help_text': 'get_general', 'label': 'get_general', 'max_answers': 'get_general', 'min_answers': 'get_general', 'max_length': 'get_general', 'min_length': 'get_general', 'max_value': 'get_general'... | Manage questions in the Power Reg system. **Attributes:** * *answers* -- List of foreign keys for Answer objects. * *rejoinder* -- Text to display when someone gets this question wrong. * *help_text* -- Help text for this question. * *label* -- Text of the question. * *max_answers* -- Maximum number of answers that may... | QuestionManager | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionManager:
"""Manage questions in the Power Reg system. **Attributes:** * *answers* -- List of foreign keys for Answer objects. * *rejoinder* -- Text to display when someone gets this question wrong. * *help_text* -- Help text for this question. * *label* -- Text of the question. * *max_ans... | stack_v2_sparse_classes_36k_train_007351 | 6,033 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create a new question. :param auth_token: The authentication token of the acting user :type auth_token: pr_services.models.AuthToken :param question_pool_id: primary key of question pool conta... | 2 | stack_v2_sparse_classes_30k_train_012384 | Implement the Python class `QuestionManager` described below.
Class description:
Manage questions in the Power Reg system. **Attributes:** * *answers* -- List of foreign keys for Answer objects. * *rejoinder* -- Text to display when someone gets this question wrong. * *help_text* -- Help text for this question. * *lab... | Implement the Python class `QuestionManager` described below.
Class description:
Manage questions in the Power Reg system. **Attributes:** * *answers* -- List of foreign keys for Answer objects. * *rejoinder* -- Text to display when someone gets this question wrong. * *help_text* -- Help text for this question. * *lab... | a59457bc37f0501aea1f54d006a6de94ff80511c | <|skeleton|>
class QuestionManager:
"""Manage questions in the Power Reg system. **Attributes:** * *answers* -- List of foreign keys for Answer objects. * *rejoinder* -- Text to display when someone gets this question wrong. * *help_text* -- Help text for this question. * *label* -- Text of the question. * *max_ans... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuestionManager:
"""Manage questions in the Power Reg system. **Attributes:** * *answers* -- List of foreign keys for Answer objects. * *rejoinder* -- Text to display when someone gets this question wrong. * *help_text* -- Help text for this question. * *label* -- Text of the question. * *max_answers* -- Maxi... | the_stack_v2_python_sparse | pr_services/exam_system/question_manager.py | ninemoreminutes/openassign-server | train | 0 |
dfffa696a4e7874e37f2b5384e65a63c28e6d9a8 | [
"self.poly_degree = poly_degree\nself.plain_modulus = plain_modulus\nself.ciph_modulus = ciph_modulus\nself.scaling_factor = self.ciph_modulus / self.plain_modulus",
"print('Encryption parameters')\nprint('\\t polynomial degree: %d' % self.poly_degree)\nprint('\\t plaintext modulus: %d' % self.plain_modulus)\npri... | <|body_start_0|>
self.poly_degree = poly_degree
self.plain_modulus = plain_modulus
self.ciph_modulus = ciph_modulus
self.scaling_factor = self.ciph_modulus / self.plain_modulus
<|end_body_0|>
<|body_start_1|>
print('Encryption parameters')
print('\t polynomial degree: %d... | An instance of parameters for the BFV scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. plain_modulus (int): Coefficient modulus of plaintexts (t). ciph_modulus (int): Coefficient modulus of ciphertexts (q). | BFVParameters | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BFVParameters:
"""An instance of parameters for the BFV scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. plain_modulus (int): Coefficient modulus of plaintexts (t). ciph_modulus (int): Coefficient modulus of ciphertexts (q)."""
def __init__(s... | stack_v2_sparse_classes_36k_train_007352 | 1,288 | permissive | [
{
"docstring": "Inits Parameters with the given parameters. Args: poly_degree (int): Degree d of polynomial of ring R. plain_modulus (int): Coefficient modulus of plaintexts. ciph_modulus (int): Coefficient modulus of ciphertexts.",
"name": "__init__",
"signature": "def __init__(self, poly_degree, plain... | 2 | stack_v2_sparse_classes_30k_train_008516 | Implement the Python class `BFVParameters` described below.
Class description:
An instance of parameters for the BFV scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. plain_modulus (int): Coefficient modulus of plaintexts (t). ciph_modulus (int): Coefficient modulus of ... | Implement the Python class `BFVParameters` described below.
Class description:
An instance of parameters for the BFV scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. plain_modulus (int): Coefficient modulus of plaintexts (t). ciph_modulus (int): Coefficient modulus of ... | be700505547b81671c37026e55c4eefbd44dcaae | <|skeleton|>
class BFVParameters:
"""An instance of parameters for the BFV scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. plain_modulus (int): Coefficient modulus of plaintexts (t). ciph_modulus (int): Coefficient modulus of ciphertexts (q)."""
def __init__(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BFVParameters:
"""An instance of parameters for the BFV scheme. Attributes: poly_degree (int): Degree d of polynomial that determines the quotient ring R. plain_modulus (int): Coefficient modulus of plaintexts (t). ciph_modulus (int): Coefficient modulus of ciphertexts (q)."""
def __init__(self, poly_deg... | the_stack_v2_python_sparse | bfv/bfv_parameters.py | seounghwan-oh/py_FHE_for_homomorphic_encryption | train | 3 |
92378ac58c2874044efe80afbe4d929fed67f9f6 | [
"dp = [[0] * (n + 1) for _ in range(m + 1)]\ndp_n = [[0] * (n + 1) for _ in range(m + 1)]\nfor k in range(len(strs)):\n a, b = (strs[k].count('0'), strs[k].count('1'))\n for i in range(0, m + 1):\n for j in range(0, n + 1):\n if i >= a and j >= b:\n dp_n[i][j] = max(dp[i - a][... | <|body_start_0|>
dp = [[0] * (n + 1) for _ in range(m + 1)]
dp_n = [[0] * (n + 1) for _ in range(m + 1)]
for k in range(len(strs)):
a, b = (strs[k].count('0'), strs[k].count('1'))
for i in range(0, m + 1):
for j in range(0, n + 1):
if i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMaxForm_dp1(self, strs, m, n):
""":type strs: List[str] :type m: int :type n: int :rtype: int"""
<|body_0|>
def findMaxForm_dp2(self, strs, m, n):
""":type strs: List[str] :type m: int :type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_007353 | 2,170 | no_license | [
{
"docstring": ":type strs: List[str] :type m: int :type n: int :rtype: int",
"name": "findMaxForm_dp1",
"signature": "def findMaxForm_dp1(self, strs, m, n)"
},
{
"docstring": ":type strs: List[str] :type m: int :type n: int :rtype: int",
"name": "findMaxForm_dp2",
"signature": "def find... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxForm_dp1(self, strs, m, n): :type strs: List[str] :type m: int :type n: int :rtype: int
- def findMaxForm_dp2(self, strs, m, n): :type strs: List[str] :type m: int :ty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaxForm_dp1(self, strs, m, n): :type strs: List[str] :type m: int :type n: int :rtype: int
- def findMaxForm_dp2(self, strs, m, n): :type strs: List[str] :type m: int :ty... | 0e99f9a5226507706b3ee66fd04bae813755ef40 | <|skeleton|>
class Solution:
def findMaxForm_dp1(self, strs, m, n):
""":type strs: List[str] :type m: int :type n: int :rtype: int"""
<|body_0|>
def findMaxForm_dp2(self, strs, m, n):
""":type strs: List[str] :type m: int :type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMaxForm_dp1(self, strs, m, n):
""":type strs: List[str] :type m: int :type n: int :rtype: int"""
dp = [[0] * (n + 1) for _ in range(m + 1)]
dp_n = [[0] * (n + 1) for _ in range(m + 1)]
for k in range(len(strs)):
a, b = (strs[k].count('0'), strs[k].... | the_stack_v2_python_sparse | medium/dp/test_474_Ones_and_Zeroes.py | wuxu1019/leetcode_sophia | train | 1 | |
e5d62b559d6e309344d0247a1420de4adffcd386 | [
"super(SpatialTransformer, self).__init__()\nvectors = [torch.arange(0, s) for s in size]\ngrids = torch.meshgrid(vectors)\ngrid = torch.stack(grids)\ngrid = torch.unsqueeze(grid, 0)\ngrid = grid.type(torch.FloatTensor)\nself.register_buffer('grid', grid)\nself.mode = mode",
"try:\n new_locs = self.grid + flow... | <|body_start_0|>
super(SpatialTransformer, self).__init__()
vectors = [torch.arange(0, s) for s in size]
grids = torch.meshgrid(vectors)
grid = torch.stack(grids)
grid = torch.unsqueeze(grid, 0)
grid = grid.type(torch.FloatTensor)
self.register_buffer('grid', grid... | [SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample | SpatialTransformer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpatialTransformer:
"""[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample"""
def __init__(self, size, mode='bilinear'):
"""Instiatiate the block :... | stack_v2_sparse_classes_36k_train_007354 | 8,888 | permissive | [
{
"docstring": "Instiatiate the block :param size: size of input to the spatial transformer block :param mode: method of interpolation for grid_sampler",
"name": "__init__",
"signature": "def __init__(self, size, mode='bilinear')"
},
{
"docstring": "Push the src and flow through the spatial tran... | 2 | stack_v2_sparse_classes_30k_train_018459 | Implement the Python class `SpatialTransformer` described below.
Class description:
[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample
Method signatures and docstrings:
- def __ini... | Implement the Python class `SpatialTransformer` described below.
Class description:
[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample
Method signatures and docstrings:
- def __ini... | 730f7dff2239ef716841390311b5b9250149acaf | <|skeleton|>
class SpatialTransformer:
"""[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample"""
def __init__(self, size, mode='bilinear'):
"""Instiatiate the block :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpatialTransformer:
"""[SpatialTransformer] represesents a spatial transformation block that uses the output from the UNet to preform an grid_sample https://pytorch.org/docs/stable/nn.functional.html#grid-sample"""
def __init__(self, size, mode='bilinear'):
"""Instiatiate the block :param size: s... | the_stack_v2_python_sparse | annolid/motion/deformation.py | healthonrails/annolid | train | 25 |
57294c24edc0c6c757c2bed018f47c25c43a1a7e | [
"super(ConvGRU, self).__init__()\nself.input_size = input_size\ninput_dim = self.input_size\ncell = ConvGRUCell(input_dim, hidden_size, kernel_size)\nself.cells = cell",
"hidden = None\nupd_hidden = []\nN, T, C, H, W = x.size()\nfor tidx in range(T):\n hidden = self.cell(x[:, tidx, :, :, :], hidden)\n upd_h... | <|body_start_0|>
super(ConvGRU, self).__init__()
self.input_size = input_size
input_dim = self.input_size
cell = ConvGRUCell(input_dim, hidden_size, kernel_size)
self.cells = cell
<|end_body_0|>
<|body_start_1|>
hidden = None
upd_hidden = []
N, T, C, H, W... | ConvGRU | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvGRU:
def __init__(self, input_size, hidden_size, kernel_size):
"""Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dim... | stack_v2_sparse_classes_36k_train_007355 | 3,254 | no_license | [
{
"docstring": "Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dimensions of hidden state. kernel_size : integer. sizes of Conv2d gate kernels."... | 2 | stack_v2_sparse_classes_30k_train_013283 | Implement the Python class `ConvGRU` described below.
Class description:
Implement the ConvGRU class.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, kernel_size): Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ----... | Implement the Python class `ConvGRU` described below.
Class description:
Implement the ConvGRU class.
Method signatures and docstrings:
- def __init__(self, input_size, hidden_size, kernel_size): Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ----... | 583d689d9347a719a62e5ba2887f3d5178c351fe | <|skeleton|>
class ConvGRU:
def __init__(self, input_size, hidden_size, kernel_size):
"""Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dim... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConvGRU:
def __init__(self, input_size, hidden_size, kernel_size):
"""Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_size : integer . depth dimensions of hid... | the_stack_v2_python_sparse | models_STM/gru.py | 0liliulei/Mem3D | train | 20 | |
665eee76936ab9e8590109589fb58e8fcc553d62 | [
"always_excluded_fields = ('cache',)\nexcluded_fields = list(super().get_exclude(request, obj=obj) or [])\nif obj:\n for excluded_field in always_excluded_fields:\n if hasattr(obj, excluded_field):\n excluded_fields.append(excluded_field)\nreturn list(set(excluded_fields))",
"search_term = se... | <|body_start_0|>
always_excluded_fields = ('cache',)
excluded_fields = list(super().get_exclude(request, obj=obj) or [])
if obj:
for excluded_field in always_excluded_fields:
if hasattr(obj, excluded_field):
excluded_fields.append(excluded_field)
... | Base admin class for ModularHistory's models. | ExtendedModelAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtendedModelAdmin:
"""Base admin class for ModularHistory's models."""
def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]:
"""Return the fields to exclude from admin forms."""
<|body_0|>
def get_search_results(self, request: HttpReques... | stack_v2_sparse_classes_36k_train_007356 | 5,673 | no_license | [
{
"docstring": "Return the fields to exclude from admin forms.",
"name": "get_exclude",
"signature": "def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]"
},
{
"docstring": "Return model instances matching the supplied search term.",
"name": "get_search_resu... | 2 | stack_v2_sparse_classes_30k_train_017536 | Implement the Python class `ExtendedModelAdmin` described below.
Class description:
Base admin class for ModularHistory's models.
Method signatures and docstrings:
- def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: Return the fields to exclude from admin forms.
- def get_search_r... | Implement the Python class `ExtendedModelAdmin` described below.
Class description:
Base admin class for ModularHistory's models.
Method signatures and docstrings:
- def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]: Return the fields to exclude from admin forms.
- def get_search_r... | 8bbdc8eec3622af22c17214051c34e36bea8e05a | <|skeleton|>
class ExtendedModelAdmin:
"""Base admin class for ModularHistory's models."""
def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]:
"""Return the fields to exclude from admin forms."""
<|body_0|>
def get_search_results(self, request: HttpReques... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExtendedModelAdmin:
"""Base admin class for ModularHistory's models."""
def get_exclude(self, request: HttpRequest, obj: Optional['Model']=None) -> list[str]:
"""Return the fields to exclude from admin forms."""
always_excluded_fields = ('cache',)
excluded_fields = list(super().ge... | the_stack_v2_python_sparse | apps/admin/model_admin.py | abdulwahed-mansour/modularhistory | train | 1 |
86f3f6ca7034c0201843d825af11a01c6922eb2d | [
"super().__init__(model_dim, dropout, is_pre_norm)\nself.attn_txt = ScaledDotAttention(model_dim, n_heads, attn_dropout)\nself.attn_img = ScaledDotAttention(model_dim, n_heads, attn_dropout)\nself.fusion = fusion",
"residual = query\nquery = self.apply_pre_norm_if_needed(query)\nattn_txt, attn_weights_txt = self.... | <|body_start_0|>
super().__init__(model_dim, dropout, is_pre_norm)
self.attn_txt = ScaledDotAttention(model_dim, n_heads, attn_dropout)
self.attn_img = ScaledDotAttention(model_dim, n_heads, attn_dropout)
self.fusion = fusion
<|end_body_0|>
<|body_start_1|>
residual = query
... | ParallelMMCrossAttentionSublayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParallelMMCrossAttentionSublayer:
def __init__(self, model_dim, n_heads, dropout=0.1, attn_dropout=0.0, is_pre_norm=False, fusion='sum'):
"""Creates a ParallelCrossAttentionSublayer. :param model_dim: The model dimensions. :param n_heads: The number of attention heads. :param dropout: Th... | stack_v2_sparse_classes_36k_train_007357 | 2,033 | permissive | [
{
"docstring": "Creates a ParallelCrossAttentionSublayer. :param model_dim: The model dimensions. :param n_heads: The number of attention heads. :param dropout: The dropout rate for the residual connection. :param is_pre_norm: Whether the layer type is pre_norm. Default: True.",
"name": "__init__",
"sig... | 2 | null | Implement the Python class `ParallelMMCrossAttentionSublayer` described below.
Class description:
Implement the ParallelMMCrossAttentionSublayer class.
Method signatures and docstrings:
- def __init__(self, model_dim, n_heads, dropout=0.1, attn_dropout=0.0, is_pre_norm=False, fusion='sum'): Creates a ParallelCrossAtt... | Implement the Python class `ParallelMMCrossAttentionSublayer` described below.
Class description:
Implement the ParallelMMCrossAttentionSublayer class.
Method signatures and docstrings:
- def __init__(self, model_dim, n_heads, dropout=0.1, attn_dropout=0.0, is_pre_norm=False, fusion='sum'): Creates a ParallelCrossAtt... | 6250b33dc518b3195da4fc9cc8d32ba7ada958c0 | <|skeleton|>
class ParallelMMCrossAttentionSublayer:
def __init__(self, model_dim, n_heads, dropout=0.1, attn_dropout=0.0, is_pre_norm=False, fusion='sum'):
"""Creates a ParallelCrossAttentionSublayer. :param model_dim: The model dimensions. :param n_heads: The number of attention heads. :param dropout: Th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParallelMMCrossAttentionSublayer:
def __init__(self, model_dim, n_heads, dropout=0.1, attn_dropout=0.0, is_pre_norm=False, fusion='sum'):
"""Creates a ParallelCrossAttentionSublayer. :param model_dim: The model dimensions. :param n_heads: The number of attention heads. :param dropout: The dropout rate... | the_stack_v2_python_sparse | pysimt/layers/transformers/cross_attention_sublayer_mm_parallel.py | welvin21/pysimt | train | 0 | |
51882dccbe33026b38bd5f3cc3dd19223190568a | [
"self.error = error\nself.msg = msg\nself.other = other",
"tab = ' '\ntmp_msg = str(self.error) + ': ' + self.msg\nif len(tmp_msg) > 80:\n tmp_msg = self.error + ':\\n'\n temp = tab + self.msg\n while True:\n if len(temp) > 80:\n idx = temp[:80].rfind(' ')\n half1 = te... | <|body_start_0|>
self.error = error
self.msg = msg
self.other = other
<|end_body_0|>
<|body_start_1|>
tab = ' '
tmp_msg = str(self.error) + ': ' + self.msg
if len(tmp_msg) > 80:
tmp_msg = self.error + ':\n'
temp = tab + self.msg
... | this class is the represntation of a single error | error_instance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class error_instance:
"""this class is the represntation of a single error"""
def __init__(self, error, msg, other=''):
"""initilizes the error arguments: error: (string) the errors name msg: (string) decription of the error other: (stirng) any other info about error"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_007358 | 9,637 | no_license | [
{
"docstring": "initilizes the error arguments: error: (string) the errors name msg: (string) decription of the error other: (stirng) any other info about error",
"name": "__init__",
"signature": "def __init__(self, error, msg, other='')"
},
{
"docstring": "converts the error to a sting returns:... | 2 | stack_v2_sparse_classes_30k_train_013152 | Implement the Python class `error_instance` described below.
Class description:
this class is the represntation of a single error
Method signatures and docstrings:
- def __init__(self, error, msg, other=''): initilizes the error arguments: error: (string) the errors name msg: (string) decription of the error other: (... | Implement the Python class `error_instance` described below.
Class description:
this class is the represntation of a single error
Method signatures and docstrings:
- def __init__(self, error, msg, other=''): initilizes the error arguments: error: (string) the errors name msg: (string) decription of the error other: (... | 95d0c102d649c5b028d262f5254106f997a7c77a | <|skeleton|>
class error_instance:
"""this class is the represntation of a single error"""
def __init__(self, error, msg, other=''):
"""initilizes the error arguments: error: (string) the errors name msg: (string) decription of the error other: (stirng) any other info about error"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class error_instance:
"""this class is the represntation of a single error"""
def __init__(self, error, msg, other=''):
"""initilizes the error arguments: error: (string) the errors name msg: (string) decription of the error other: (stirng) any other info about error"""
self.error = error
... | the_stack_v2_python_sparse | csv_lib/utility.py | rwspicer/csv_utilities | train | 1 |
6f115dbfeaec3b7fe6b6c51d0a278f094c8096f9 | [
"super(QuestionnaireWidget, self).__init__(rows=2 * len(main_app.question_list) + 1, cols=1)\nself.parent_screen = parent_screen\nself.main_app = main_app\nself.question_list = self.main_app.question_list\nself.questionsArray = []\nself.main_app.user_answers = []\nself.set_questions(self.question_list)\nstore = Jso... | <|body_start_0|>
super(QuestionnaireWidget, self).__init__(rows=2 * len(main_app.question_list) + 1, cols=1)
self.parent_screen = parent_screen
self.main_app = main_app
self.question_list = self.main_app.question_list
self.questionsArray = []
self.main_app.user_answers = ... | QuestionnaireWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuestionnaireWidget:
def __init__(self, parent_screen, main_app):
""":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers"""
<|body_0|>
def submit_action(self, instance):
"""Called when the user presses the ... | stack_v2_sparse_classes_36k_train_007359 | 4,800 | no_license | [
{
"docstring": ":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers",
"name": "__init__",
"signature": "def __init__(self, parent_screen, main_app)"
},
{
"docstring": "Called when the user presses the submit button. Saves the user's an... | 3 | stack_v2_sparse_classes_30k_train_020456 | Implement the Python class `QuestionnaireWidget` described below.
Class description:
Implement the QuestionnaireWidget class.
Method signatures and docstrings:
- def __init__(self, parent_screen, main_app): :param main_app: The main app that runs the program. We use it to pass on the question list and the user answer... | Implement the Python class `QuestionnaireWidget` described below.
Class description:
Implement the QuestionnaireWidget class.
Method signatures and docstrings:
- def __init__(self, parent_screen, main_app): :param main_app: The main app that runs the program. We use it to pass on the question list and the user answer... | d276e3d1bd4ee690c995915f99dbda2729fba213 | <|skeleton|>
class QuestionnaireWidget:
def __init__(self, parent_screen, main_app):
""":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers"""
<|body_0|>
def submit_action(self, instance):
"""Called when the user presses the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QuestionnaireWidget:
def __init__(self, parent_screen, main_app):
""":param main_app: The main app that runs the program. We use it to pass on the question list and the user answers"""
super(QuestionnaireWidget, self).__init__(rows=2 * len(main_app.question_list) + 1, cols=1)
self.pare... | the_stack_v2_python_sparse | KivyFiles/Questions/QuestionsDisplay.py | CuriosityLabTAU/graph_game_app | train | 0 | |
ade3c8acabd4fc28c297d2d8027ad048787c6222 | [
"fname2 = 'data/sessions23.pv.a.csv'\ntemp_df = pd.read_csv(fname2, nrows=2)\nif '55' in sessions_filename:\n temp_df = temp_df.drop('ua', axis=1)\nif '23' in sessions_filename and '1411' in sessions_filename:\n temp_df = temp_df.drop('ua', axis=1)\nself.columns = temp_df.columns\nif first_chars is None:\n ... | <|body_start_0|>
fname2 = 'data/sessions23.pv.a.csv'
temp_df = pd.read_csv(fname2, nrows=2)
if '55' in sessions_filename:
temp_df = temp_df.drop('ua', axis=1)
if '23' in sessions_filename and '1411' in sessions_filename:
temp_df = temp_df.drop('ua', axis=1)
... | represents the aggregation of files for device analysis | Aggregate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Aggregate:
"""represents the aggregation of files for device analysis"""
def __init__(self, sessions_filename, first_chars=None):
"""initialize"""
<|body_0|>
def run(self, nrows=None):
"""aggregate Input: nrows, int number of rows to load from each file Output: d... | stack_v2_sparse_classes_36k_train_007360 | 3,958 | no_license | [
{
"docstring": "initialize",
"name": "__init__",
"signature": "def __init__(self, sessions_filename, first_chars=None)"
},
{
"docstring": "aggregate Input: nrows, int number of rows to load from each file Output: df, resampled data",
"name": "run",
"signature": "def run(self, nrows=None)... | 2 | stack_v2_sparse_classes_30k_train_018167 | Implement the Python class `Aggregate` described below.
Class description:
represents the aggregation of files for device analysis
Method signatures and docstrings:
- def __init__(self, sessions_filename, first_chars=None): initialize
- def run(self, nrows=None): aggregate Input: nrows, int number of rows to load fro... | Implement the Python class `Aggregate` described below.
Class description:
represents the aggregation of files for device analysis
Method signatures and docstrings:
- def __init__(self, sessions_filename, first_chars=None): initialize
- def run(self, nrows=None): aggregate Input: nrows, int number of rows to load fro... | 580265c41de9f2145fec02df17af01245fbeaed6 | <|skeleton|>
class Aggregate:
"""represents the aggregation of files for device analysis"""
def __init__(self, sessions_filename, first_chars=None):
"""initialize"""
<|body_0|>
def run(self, nrows=None):
"""aggregate Input: nrows, int number of rows to load from each file Output: d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Aggregate:
"""represents the aggregation of files for device analysis"""
def __init__(self, sessions_filename, first_chars=None):
"""initialize"""
fname2 = 'data/sessions23.pv.a.csv'
temp_df = pd.read_csv(fname2, nrows=2)
if '55' in sessions_filename:
temp_df =... | the_stack_v2_python_sparse | code/aggregate_devices.py | nicolasgo/_pmx | train | 0 |
0e94783609ef063c663a2a24bd6cf60cc3fd85af | [
"if isinstance(pattern, list):\n if len(pattern) == 1:\n pattern = pattern[0]\nif not isinstance(pattern, str):\n raise TypeError('Incompatible pattern type. Should be a single string.')\nDataConsumer.__init__(self, blackboard, [pattern])\nself._pat_extension = None\nself._b = None\nself._a = None\nsel... | <|body_start_0|>
if isinstance(pattern, list):
if len(pattern) == 1:
pattern = pattern[0]
if not isinstance(pattern, str):
raise TypeError('Incompatible pattern type. Should be a single string.')
DataConsumer.__init__(self, blackboard, [pattern])
s... | A Linear filter is used to process a one-dimensional, constant frequency, data signal. It's based on SciPy's lfilter() method. Implements DataConsumer to continuously scan one blackboard buffer for new data and process it with _process_data() | IIRFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IIRFilter:
"""A Linear filter is used to process a one-dimensional, constant frequency, data signal. It's based on SciPy's lfilter() method. Implements DataConsumer to continuously scan one blackboard buffer for new data and process it with _process_data()"""
def __init__(self, blackboard, p... | stack_v2_sparse_classes_36k_train_007361 | 1,702 | no_license | [
{
"docstring": "@param blackboard: blackboard instance which contains the data that must be plotted. @param pattern the pattern corresponding to the data buffer that must be filtered. Only one pattern should be selected.",
"name": "__init__",
"signature": "def __init__(self, blackboard, pattern)"
},
... | 2 | stack_v2_sparse_classes_30k_train_007405 | Implement the Python class `IIRFilter` described below.
Class description:
A Linear filter is used to process a one-dimensional, constant frequency, data signal. It's based on SciPy's lfilter() method. Implements DataConsumer to continuously scan one blackboard buffer for new data and process it with _process_data()
... | Implement the Python class `IIRFilter` described below.
Class description:
A Linear filter is used to process a one-dimensional, constant frequency, data signal. It's based on SciPy's lfilter() method. Implements DataConsumer to continuously scan one blackboard buffer for new data and process it with _process_data()
... | 052db9e4f004a5754e554eb8f08dc0f8ed17e498 | <|skeleton|>
class IIRFilter:
"""A Linear filter is used to process a one-dimensional, constant frequency, data signal. It's based on SciPy's lfilter() method. Implements DataConsumer to continuously scan one blackboard buffer for new data and process it with _process_data()"""
def __init__(self, blackboard, p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IIRFilter:
"""A Linear filter is used to process a one-dimensional, constant frequency, data signal. It's based on SciPy's lfilter() method. Implements DataConsumer to continuously scan one blackboard buffer for new data and process it with _process_data()"""
def __init__(self, blackboard, pattern):
... | the_stack_v2_python_sparse | Source/EEG-KISS-Project/root/processing/iirfilter.py | baltanlaboratories/EEG-Kiss | train | 1 |
8328b8cc0ab164d338f7a3842d16f1df4b7026a1 | [
"members = guild.members\nif len(name) > 5 and name[-5] == '#':\n result = next((member for member in members if str(member).lower() == name.lower()), None)\n if result is not None:\n return result\n\ndef pred(m: discord.Member) -> bool:\n \"\"\"\n The predicate check to use while searchi... | <|body_start_0|>
members = guild.members
if len(name) > 5 and name[-5] == '#':
result = next((member for member in members if str(member).lower() == name.lower()), None)
if result is not None:
return result
def pred(m: discord.Member) -> bool:
... | Converts an argument to a discord.Member object. All lookups are via the local guild. The lookup strategy is as follows (in order): 1. Lookup by ID. 2. Lookup by mention. 3. Lookup by name#discriminator 4. Lookup by name 5. Lookup by nickname When processing a bulk-batch of members via a variadic method, this converter... | AggressiveDefaultMemberConverter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AggressiveDefaultMemberConverter:
"""Converts an argument to a discord.Member object. All lookups are via the local guild. The lookup strategy is as follows (in order): 1. Lookup by ID. 2. Lookup by mention. 3. Lookup by name#discriminator 4. Lookup by name 5. Lookup by nickname When processing a... | stack_v2_sparse_classes_36k_train_007362 | 10,856 | permissive | [
{
"docstring": "Returns the first member found that matches the name or (nickname) provided. Parameters: guild (discord.Guild): The guild to perform the query with. name (str): The (nick)name of the member. Returns: result (Optional[discord.Member]): The resulting member, if any.",
"name": "_guild_get_membe... | 4 | stack_v2_sparse_classes_30k_train_020460 | Implement the Python class `AggressiveDefaultMemberConverter` described below.
Class description:
Converts an argument to a discord.Member object. All lookups are via the local guild. The lookup strategy is as follows (in order): 1. Lookup by ID. 2. Lookup by mention. 3. Lookup by name#discriminator 4. Lookup by name ... | Implement the Python class `AggressiveDefaultMemberConverter` described below.
Class description:
Converts an argument to a discord.Member object. All lookups are via the local guild. The lookup strategy is as follows (in order): 1. Lookup by ID. 2. Lookup by mention. 3. Lookup by name#discriminator 4. Lookup by name ... | 16de7702fe5071aa731e863503ec28911eb64552 | <|skeleton|>
class AggressiveDefaultMemberConverter:
"""Converts an argument to a discord.Member object. All lookups are via the local guild. The lookup strategy is as follows (in order): 1. Lookup by ID. 2. Lookup by mention. 3. Lookup by name#discriminator 4. Lookup by name 5. Lookup by nickname When processing a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AggressiveDefaultMemberConverter:
"""Converts an argument to a discord.Member object. All lookups are via the local guild. The lookup strategy is as follows (in order): 1. Lookup by ID. 2. Lookup by mention. 3. Lookup by name#discriminator 4. Lookup by name 5. Lookup by nickname When processing a bulk-batch o... | the_stack_v2_python_sparse | utils/converters.py | JakeSichley/Discord-Bot | train | 7 |
ccc55dd455a67377721d51db39fab6b9258ea6c6 | [
"a_xor = 0\nfor i in nums:\n a_xor = a_xor ^ i\nreturn a_xor",
"if len(nums) == 1:\n return nums[0]\ni = 0\nnums2 = sorted(nums)\nprint(nums2)\nwhile i < len(nums2) - 1:\n if nums2[i] != nums2[i + 1]:\n return nums2[i]\n else:\n i += 2\nreturn nums2[-1]"
] | <|body_start_0|>
a_xor = 0
for i in nums:
a_xor = a_xor ^ i
return a_xor
<|end_body_0|>
<|body_start_1|>
if len(nums) == 1:
return nums[0]
i = 0
nums2 = sorted(nums)
print(nums2)
while i < len(nums2) - 1:
if nums2[i] !=... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def singleNumber(self, nums):
"""Using XOR logic. a ^ a = 0 but a ^ a ^ b = b, the missing number :type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber2(self, nums):
"""O(nlgn), sort list first and then loop over the array :type nums: List[int] :... | stack_v2_sparse_classes_36k_train_007363 | 950 | no_license | [
{
"docstring": "Using XOR logic. a ^ a = 0 but a ^ a ^ b = b, the missing number :type nums: List[int] :rtype: int",
"name": "singleNumber",
"signature": "def singleNumber(self, nums)"
},
{
"docstring": "O(nlgn), sort list first and then loop over the array :type nums: List[int] :rtype: int",
... | 2 | stack_v2_sparse_classes_30k_train_011339 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumber(self, nums): Using XOR logic. a ^ a = 0 but a ^ a ^ b = b, the missing number :type nums: List[int] :rtype: int
- def singleNumber2(self, nums): O(nlgn), sort li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumber(self, nums): Using XOR logic. a ^ a = 0 but a ^ a ^ b = b, the missing number :type nums: List[int] :rtype: int
- def singleNumber2(self, nums): O(nlgn), sort li... | e319481834d0d0519d50bbf00e4f46374bbcf091 | <|skeleton|>
class Solution:
def singleNumber(self, nums):
"""Using XOR logic. a ^ a = 0 but a ^ a ^ b = b, the missing number :type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber2(self, nums):
"""O(nlgn), sort list first and then loop over the array :type nums: List[int] :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def singleNumber(self, nums):
"""Using XOR logic. a ^ a = 0 but a ^ a ^ b = b, the missing number :type nums: List[int] :rtype: int"""
a_xor = 0
for i in nums:
a_xor = a_xor ^ i
return a_xor
def singleNumber2(self, nums):
"""O(nlgn), sort list... | the_stack_v2_python_sparse | single_number136.py | raghavgr/Leetcode | train | 1 | |
b0a7d2868feca46cdabd143a8f3d62d3b65b2413 | [
"r = type(self)(self._orig_objs)\nr._objs = [o.__enter__ for o in r._objs]\nreturn r.__call__()",
"r = type(self)(self._orig_objs)\nr._objs = [o.__exit__ for o in r._objs]\nr.__call__(exc_type, exc_val, exc_tb)",
"r = super(SyncParallelizer, self).__call__(*args, **kwargs)\nr.pFinish(None)\nreturn r",
"r = su... | <|body_start_0|>
r = type(self)(self._orig_objs)
r._objs = [o.__enter__ for o in r._objs]
return r.__call__()
<|end_body_0|>
<|body_start_1|>
r = type(self)(self._orig_objs)
r._objs = [o.__exit__ for o in r._objs]
r.__call__(exc_type, exc_val, exc_tb)
<|end_body_1|>
<|b... | A Parallelizer that blocks on function calls. | SyncParallelizer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SyncParallelizer:
"""A Parallelizer that blocks on function calls."""
def __enter__(self):
"""Emulate entering the context of |self|. Note that this call is synchronous. Returns: A Parallelizer emulating the value returned from entering into the context of |self|."""
<|body_0... | stack_v2_sparse_classes_36k_train_007364 | 7,659 | permissive | [
{
"docstring": "Emulate entering the context of |self|. Note that this call is synchronous. Returns: A Parallelizer emulating the value returned from entering into the context of |self|.",
"name": "__enter__",
"signature": "def __enter__(self)"
},
{
"docstring": "Emulate exiting the context of |... | 4 | null | Implement the Python class `SyncParallelizer` described below.
Class description:
A Parallelizer that blocks on function calls.
Method signatures and docstrings:
- def __enter__(self): Emulate entering the context of |self|. Note that this call is synchronous. Returns: A Parallelizer emulating the value returned from... | Implement the Python class `SyncParallelizer` described below.
Class description:
A Parallelizer that blocks on function calls.
Method signatures and docstrings:
- def __enter__(self): Emulate entering the context of |self|. Note that this call is synchronous. Returns: A Parallelizer emulating the value returned from... | 53102de187a48ac2cfc241fef54dcbc29c453a8e | <|skeleton|>
class SyncParallelizer:
"""A Parallelizer that blocks on function calls."""
def __enter__(self):
"""Emulate entering the context of |self|. Note that this call is synchronous. Returns: A Parallelizer emulating the value returned from entering into the context of |self|."""
<|body_0... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SyncParallelizer:
"""A Parallelizer that blocks on function calls."""
def __enter__(self):
"""Emulate entering the context of |self|. Note that this call is synchronous. Returns: A Parallelizer emulating the value returned from entering into the context of |self|."""
r = type(self)(self._... | the_stack_v2_python_sparse | devil/devil/utils/parallelizer.py | catapult-project/catapult | train | 2,032 |
13a3a46246fa5c27dc08c6cffa10eecdfce626dd | [
"if not nums:\n return 0\nfor i in range(len(nums)):\n while i < len(nums) - 1 and nums[i] == nums[i + 1]:\n nums.pop(i + 1)\nreturn len(nums)",
"if not nums:\n return 0\nfor i in range(len(nums) - 1):\n print('-------------------------')\n print('i:%d, nums:%s, len(nums):%d' % (i, nums, len... | <|body_start_0|>
if not nums:
return 0
for i in range(len(nums)):
while i < len(nums) - 1 and nums[i] == nums[i + 1]:
nums.pop(i + 1)
return len(nums)
<|end_body_0|>
<|body_start_1|>
if not nums:
return 0
for i in range(len(num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates_v2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def removeDuplicates_v3(self, nums):
""":type nums: List[int] :... | stack_v2_sparse_classes_36k_train_007365 | 3,305 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates",
"signature": "def removeDuplicates(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "removeDuplicates_v2",
"signature": "def removeDuplicates_v2(self, nums)"
},
{
"docstring... | 3 | stack_v2_sparse_classes_30k_train_020082 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates_v2(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates_v3(self, nums)... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeDuplicates(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates_v2(self, nums): :type nums: List[int] :rtype: int
- def removeDuplicates_v3(self, nums)... | 1ca58b87e5edfa8db389f14e3a9105e92b4ae85f | <|skeleton|>
class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def removeDuplicates_v2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def removeDuplicates_v3(self, nums):
""":type nums: List[int] :... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def removeDuplicates(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return 0
for i in range(len(nums)):
while i < len(nums) - 1 and nums[i] == nums[i + 1]:
nums.pop(i + 1)
return len(nums)
def removeDupli... | the_stack_v2_python_sparse | other/删除排序数据中的重复项.py | houhailun/leetcode | train | 1 | |
bceb4fce43877f06831cd878883ecec0560c737b | [
"if len(set(s)) != len(set(t)):\n return False\nalpha = set(s)\nfor i in alpha:\n if s.count(i) != t.count(i):\n return False\nreturn True",
"dic1 = {}\ndic2 = {}\nfor i in s:\n if i in dic1:\n dic1[i] += 1\n else:\n dic1[i] = 1\nfor j in t:\n if j in dic2:\n dic2[j] += ... | <|body_start_0|>
if len(set(s)) != len(set(t)):
return False
alpha = set(s)
for i in alpha:
if s.count(i) != t.count(i):
return False
return True
<|end_body_0|>
<|body_start_1|>
dic1 = {}
dic2 = {}
for i in s:
i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool""... | stack_v2_sparse_classes_36k_train_007366 | 1,362 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isAnagram",
"signature": "def isAnagram(self, s, t)"
},
{
"docstring": ":type s: str :type t: str :rtype: bool",
"name": "isAnagram",
"signature": "def isAnagram(self, s, t)"
},
{
"docstring": ":type s: str :type t... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool
- def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool
- def isAnagram(self, s, t): :type s: str :t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool
- def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool
- def isAnagram(self, s, t): :type s: str :t... | c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0 | <|skeleton|>
class Solution:
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_0|>
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
<|body_1|>
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isAnagram(self, s, t):
""":type s: str :type t: str :rtype: bool"""
if len(set(s)) != len(set(t)):
return False
alpha = set(s)
for i in alpha:
if s.count(i) != t.count(i):
return False
return True
def isAnagram(... | the_stack_v2_python_sparse | code/242#Valid Anagram.py | EachenKuang/LeetCode | train | 28 | |
dab0dea68b9be9f10c1eab6194d1621fde193094 | [
"if not args_lateral:\n args_lateral = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}\nif not args_longitudinal:\n args_longitudinal = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}\nself._lon_controller = PIDLongitudinalController(**args_longitudinal)\nself._lat_controller = PIDLateralController(**args_lateral)",
"throttle = ... | <|body_start_0|>
if not args_lateral:
args_lateral = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}
if not args_longitudinal:
args_longitudinal = {'K_P': 1.0, 'K_D': 0.0, 'K_I': 0.0}
self._lon_controller = PIDLongitudinalController(**args_longitudinal)
self._lat_controller ... | VehiclePIDController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VehiclePIDController:
def __init__(self, args_lateral=None, args_longitudinal=None):
""":param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitu... | stack_v2_sparse_classes_36k_train_007367 | 6,840 | no_license | [
{
"docstring": ":param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitudinal: dictionary of arguments to set the longitudinal PID controller using the following semant... | 2 | stack_v2_sparse_classes_30k_train_008305 | Implement the Python class `VehiclePIDController` described below.
Class description:
Implement the VehiclePIDController class.
Method signatures and docstrings:
- def __init__(self, args_lateral=None, args_longitudinal=None): :param args_lateral: dictionary of arguments to set the lateral PID controller using the fo... | Implement the Python class `VehiclePIDController` described below.
Class description:
Implement the VehiclePIDController class.
Method signatures and docstrings:
- def __init__(self, args_lateral=None, args_longitudinal=None): :param args_lateral: dictionary of arguments to set the lateral PID controller using the fo... | 0f5cd710a6fff1c19795662f8032cb9e22575bd7 | <|skeleton|>
class VehiclePIDController:
def __init__(self, args_lateral=None, args_longitudinal=None):
""":param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VehiclePIDController:
def __init__(self, args_lateral=None, args_longitudinal=None):
""":param args_lateral: dictionary of arguments to set the lateral PID controller using the following semantics: K_P -- Proportional term K_D -- Differential term K_I -- Integral term :param args_longitudinal: diction... | the_stack_v2_python_sparse | planning/trajectory_planner/trajectory_planner/controller.py | feiyuxiaoThu/IITS | train | 0 | |
0777163a574982a080149d140d4aab930085a556 | [
"super(HaasBreadthDefinition, self).__init__(*args, **kwargs)\nself.ls_definition = ls_definition\nself.constraints = [formulas.gte_n_units(n=3), formulas.not_in_abbreviations(config_dict.get('haas.abbreviations')), formulas.course_not_in(['ECON 1', 'ECON 2', 'ECON 3', 'ECON 100A', 'ECON 100B', 'ECON 101A', 'ECON 1... | <|body_start_0|>
super(HaasBreadthDefinition, self).__init__(*args, **kwargs)
self.ls_definition = ls_definition
self.constraints = [formulas.gte_n_units(n=3), formulas.not_in_abbreviations(config_dict.get('haas.abbreviations')), formulas.course_not_in(['ECON 1', 'ECON 2', 'ECON 3', 'ECON 100A',... | A definition for one Haas breadth requirement. To satisfy this definition, course must satisfy all: 1. Must satisfy the corresponding LS breadth definition Constraints: 1. Course must be at least three units 2. Must not be a business course 3. Econ 1/2/3/100{A|B}/101{A|B}, IAS 106/107 prohibited 4. Course cannot satisf... | HaasBreadthDefinition | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HaasBreadthDefinition:
"""A definition for one Haas breadth requirement. To satisfy this definition, course must satisfy all: 1. Must satisfy the corresponding LS breadth definition Constraints: 1. Course must be at least three units 2. Must not be a business course 3. Econ 1/2/3/100{A|B}/101{A|B... | stack_v2_sparse_classes_36k_train_007368 | 1,972 | permissive | [
{
"docstring": "Instantiate with definitions for a given LS breadth. :param ls_definition: The corresponding L&S breadth definition. :param excluded_definitions: Optional definitions which the course must NOT satisfy.",
"name": "__init__",
"signature": "def __init__(self, ls_definition, excluded_definit... | 2 | null | Implement the Python class `HaasBreadthDefinition` described below.
Class description:
A definition for one Haas breadth requirement. To satisfy this definition, course must satisfy all: 1. Must satisfy the corresponding LS breadth definition Constraints: 1. Course must be at least three units 2. Must not be a busines... | Implement the Python class `HaasBreadthDefinition` described below.
Class description:
A definition for one Haas breadth requirement. To satisfy this definition, course must satisfy all: 1. Must satisfy the corresponding LS breadth definition Constraints: 1. Course must be at least three units 2. Must not be a busines... | 34578dc14c8e5c2cfb28f8d6710e791cdd773d59 | <|skeleton|>
class HaasBreadthDefinition:
"""A definition for one Haas breadth requirement. To satisfy this definition, course must satisfy all: 1. Must satisfy the corresponding LS breadth definition Constraints: 1. Course must be at least three units 2. Must not be a business course 3. Econ 1/2/3/100{A|B}/101{A|B... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HaasBreadthDefinition:
"""A definition for one Haas breadth requirement. To satisfy this definition, course must satisfy all: 1. Must satisfy the corresponding LS breadth definition Constraints: 1. Course must be at least three units 2. Must not be a business course 3. Econ 1/2/3/100{A|B}/101{A|B}, IAS 106/10... | the_stack_v2_python_sparse | backend/playlist/utils/definition/haas.py | AviFS/berkeleytime | train | 0 |
1afe17321fd8eec6ba7f92c00aac9f6d3ab2a5f4 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | ExperimentManagerRPCServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExperimentManagerRPCServicer:
"""Missing associated documentation comment in .proto file."""
def CreateTable(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendText(self, request, context):
"""Missing associ... | stack_v2_sparse_classes_36k_train_007369 | 10,693 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "CreateTable",
"signature": "def CreateTable(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SendText",
"signature": "def SendText(self, requ... | 6 | stack_v2_sparse_classes_30k_train_001149 | Implement the Python class `ExperimentManagerRPCServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def CreateTable(self, request, context): Missing associated documentation comment in .proto file.
- def SendText(self, request, con... | Implement the Python class `ExperimentManagerRPCServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def CreateTable(self, request, context): Missing associated documentation comment in .proto file.
- def SendText(self, request, con... | 1c7ca1819325796a6ec604aa1ae8c771708fc50c | <|skeleton|>
class ExperimentManagerRPCServicer:
"""Missing associated documentation comment in .proto file."""
def CreateTable(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendText(self, request, context):
"""Missing associ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExperimentManagerRPCServicer:
"""Missing associated documentation comment in .proto file."""
def CreateTable(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not impl... | the_stack_v2_python_sparse | malib/rpc/proto/exprmanager_pb2_grpc.py | zhihaolyu/malib | train | 0 |
9a793a7753f42855e9c75723a50751cdd4837299 | [
"cmd = u'sw_interface_ip6nd_ra_config'\nargs = dict(sw_if_index=InterfaceUtil.get_interface_index(node, interface), suppress=1)\nerr_msg = f'Failed to disable sending ICMPv6 router-advertisement messages on interface {interface}'\nwith PapiSocketExecutor(node) as papi_exec:\n papi_exec.add(cmd, **args).get_reply... | <|body_start_0|>
cmd = u'sw_interface_ip6nd_ra_config'
args = dict(sw_if_index=InterfaceUtil.get_interface_index(node, interface), suppress=1)
err_msg = f'Failed to disable sending ICMPv6 router-advertisement messages on interface {interface}'
with PapiSocketExecutor(node) as papi_exec:
... | IPv6 utilities | IPv6Util | [
"GPL-1.0-or-later",
"CC-BY-4.0",
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPv6Util:
"""IPv6 utilities"""
def vpp_interface_ra_suppress(node, interface):
"""Disable sending ICMPv6 router-advertisement messages on an interface on a VPP node. :param node: VPP node. :param interface: Interface name. :type node: dict :type interface: str"""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_007370 | 3,181 | permissive | [
{
"docstring": "Disable sending ICMPv6 router-advertisement messages on an interface on a VPP node. :param node: VPP node. :param interface: Interface name. :type node: dict :type interface: str",
"name": "vpp_interface_ra_suppress",
"signature": "def vpp_interface_ra_suppress(node, interface)"
},
{... | 3 | null | Implement the Python class `IPv6Util` described below.
Class description:
IPv6 utilities
Method signatures and docstrings:
- def vpp_interface_ra_suppress(node, interface): Disable sending ICMPv6 router-advertisement messages on an interface on a VPP node. :param node: VPP node. :param interface: Interface name. :typ... | Implement the Python class `IPv6Util` described below.
Class description:
IPv6 utilities
Method signatures and docstrings:
- def vpp_interface_ra_suppress(node, interface): Disable sending ICMPv6 router-advertisement messages on an interface on a VPP node. :param node: VPP node. :param interface: Interface name. :typ... | 947057d7310cd1602119258c6b82fbb25fe1b79d | <|skeleton|>
class IPv6Util:
"""IPv6 utilities"""
def vpp_interface_ra_suppress(node, interface):
"""Disable sending ICMPv6 router-advertisement messages on an interface on a VPP node. :param node: VPP node. :param interface: Interface name. :type node: dict :type interface: str"""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IPv6Util:
"""IPv6 utilities"""
def vpp_interface_ra_suppress(node, interface):
"""Disable sending ICMPv6 router-advertisement messages on an interface on a VPP node. :param node: VPP node. :param interface: Interface name. :type node: dict :type interface: str"""
cmd = u'sw_interface_ip6n... | the_stack_v2_python_sparse | resources/libraries/python/IPv6Util.py | FDio/csit | train | 28 |
2fbe3005179873905f09fff54b16c255138eaf1f | [
"super().__init__(configs=configs)\nfor input_channel in self._configs['inputs']:\n self.addInput(input_channel, Data)\nfor input_channel in self._configs['inputs_list']:\n self.addInput(input_channel, list)\nself.addInput('send_msg', Data)\nself.addInput('send_msg_list', list)",
"self._config_lock = True\n... | <|body_start_0|>
super().__init__(configs=configs)
for input_channel in self._configs['inputs']:
self.addInput(input_channel, Data)
for input_channel in self._configs['inputs_list']:
self.addInput(input_channel, list)
self.addInput('send_msg', Data)
self.a... | ! Stage for exchange data using UDP protocol | UDP_Stage | [
"MIT",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UDP_Stage:
"""! Stage for exchange data using UDP protocol"""
def __init__(self, configs={}):
"""! Constructor Parameters: @param configs - configs dictionary ip - the ip for the UDP connection (default 127.0.0.1) port - the port for the UDP connection (default 6000) inputs - the inp... | stack_v2_sparse_classes_36k_train_007371 | 3,287 | permissive | [
{
"docstring": "! Constructor Parameters: @param configs - configs dictionary ip - the ip for the UDP connection (default 127.0.0.1) port - the port for the UDP connection (default 6000) inputs - the inputs channels of the stage (default []) inputs_list - the inputs channels with list data of the stage (default... | 4 | stack_v2_sparse_classes_30k_train_014176 | Implement the Python class `UDP_Stage` described below.
Class description:
! Stage for exchange data using UDP protocol
Method signatures and docstrings:
- def __init__(self, configs={}): ! Constructor Parameters: @param configs - configs dictionary ip - the ip for the UDP connection (default 127.0.0.1) port - the po... | Implement the Python class `UDP_Stage` described below.
Class description:
! Stage for exchange data using UDP protocol
Method signatures and docstrings:
- def __init__(self, configs={}): ! Constructor Parameters: @param configs - configs dictionary ip - the ip for the UDP connection (default 127.0.0.1) port - the po... | 20743f0c8d64d9d2e15cefa840423c9698c74653 | <|skeleton|>
class UDP_Stage:
"""! Stage for exchange data using UDP protocol"""
def __init__(self, configs={}):
"""! Constructor Parameters: @param configs - configs dictionary ip - the ip for the UDP connection (default 127.0.0.1) port - the port for the UDP connection (default 6000) inputs - the inp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UDP_Stage:
"""! Stage for exchange data using UDP protocol"""
def __init__(self, configs={}):
"""! Constructor Parameters: @param configs - configs dictionary ip - the ip for the UDP connection (default 127.0.0.1) port - the port for the UDP connection (default 6000) inputs - the inputs channels ... | the_stack_v2_python_sparse | src/redrawing/communication/udp.py | ReDrawing/redrawing | train | 1 |
2d38158dd7329908bd096314186b9278b099218f | [
"indexer_table = {}\nfor word in words_list:\n hash_value = self.calculate_weighted_hash(word)\n freq_table = calculate_frequency_table(word)\n if hash_value not in indexer_table:\n indexer_table[hash_value] = {}\n indexer_table[hash_value][as_set(freq_table)] = [word]\n elif as_set(freq_t... | <|body_start_0|>
indexer_table = {}
for word in words_list:
hash_value = self.calculate_weighted_hash(word)
freq_table = calculate_frequency_table(word)
if hash_value not in indexer_table:
indexer_table[hash_value] = {}
indexer_table[ha... | FastRetrievalIndexer provides fast retrieval approach implementation for anagrams indexers. | FastRetrievalIndexer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FastRetrievalIndexer:
"""FastRetrievalIndexer provides fast retrieval approach implementation for anagrams indexers."""
def perform_indexing(self, words_list):
"""Perform and return indexed data structure given list of words. :param words_list: loaded words list :type words_list: lis... | stack_v2_sparse_classes_36k_train_007372 | 11,327 | no_license | [
{
"docstring": "Perform and return indexed data structure given list of words. :param words_list: loaded words list :type words_list: list() :return indexer_table: list of words to be searched :rtype indexer_table: dictionary of dictionary of anagrams indexer_table[<hash_value>][<frequency_table>] = [<Anagrams ... | 2 | stack_v2_sparse_classes_30k_train_010947 | Implement the Python class `FastRetrievalIndexer` described below.
Class description:
FastRetrievalIndexer provides fast retrieval approach implementation for anagrams indexers.
Method signatures and docstrings:
- def perform_indexing(self, words_list): Perform and return indexed data structure given list of words. :... | Implement the Python class `FastRetrievalIndexer` described below.
Class description:
FastRetrievalIndexer provides fast retrieval approach implementation for anagrams indexers.
Method signatures and docstrings:
- def perform_indexing(self, words_list): Perform and return indexed data structure given list of words. :... | db473795f2f06e7f1b68298ac3613d0c54bb3ccf | <|skeleton|>
class FastRetrievalIndexer:
"""FastRetrievalIndexer provides fast retrieval approach implementation for anagrams indexers."""
def perform_indexing(self, words_list):
"""Perform and return indexed data structure given list of words. :param words_list: loaded words list :type words_list: lis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FastRetrievalIndexer:
"""FastRetrievalIndexer provides fast retrieval approach implementation for anagrams indexers."""
def perform_indexing(self, words_list):
"""Perform and return indexed data structure given list of words. :param words_list: loaded words list :type words_list: list() :return i... | the_stack_v2_python_sparse | BAML-Anagrams/solutions.py | minavyoussef/jobs-coding-exercises | train | 0 |
05c4191d762deb68bc788b4757c98bb85b127fbf | [
"instance = Data(template=validated_data['template'], title=validated_data['title'], user_id=str(validated_data['user'].id))\ninstance.xml_content = validated_data['xml_content']\ndata_api.upsert(instance, validated_data['user'])\ninstance.xml_content = validated_data['xml_content'].encode('utf-8')\nreturn instance... | <|body_start_0|>
instance = Data(template=validated_data['template'], title=validated_data['title'], user_id=str(validated_data['user'].id))
instance.xml_content = validated_data['xml_content']
data_api.upsert(instance, validated_data['user'])
instance.xml_content = validated_data['xml_c... | Data serializer | DataSerializer | [
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataSerializer:
"""Data serializer"""
def create(self, validated_data):
"""Create and return a new `Data` instance, given the validated data."""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing `Data` instance, given the val... | stack_v2_sparse_classes_36k_train_007373 | 2,557 | permissive | [
{
"docstring": "Create and return a new `Data` instance, given the validated data.",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Update and return an existing `Data` instance, given the validated data.",
"name": "update",
"signature": "def update(... | 2 | stack_v2_sparse_classes_30k_train_012738 | Implement the Python class `DataSerializer` described below.
Class description:
Data serializer
Method signatures and docstrings:
- def create(self, validated_data): Create and return a new `Data` instance, given the validated data.
- def update(self, instance, validated_data): Update and return an existing `Data` in... | Implement the Python class `DataSerializer` described below.
Class description:
Data serializer
Method signatures and docstrings:
- def create(self, validated_data): Create and return a new `Data` instance, given the validated data.
- def update(self, instance, validated_data): Update and return an existing `Data` in... | 568cb75a40ccff1d74a1a757866112535efd769a | <|skeleton|>
class DataSerializer:
"""Data serializer"""
def create(self, validated_data):
"""Create and return a new `Data` instance, given the validated data."""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing `Data` instance, given the val... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataSerializer:
"""Data serializer"""
def create(self, validated_data):
"""Create and return a new `Data` instance, given the validated data."""
instance = Data(template=validated_data['template'], title=validated_data['title'], user_id=str(validated_data['user'].id))
instance.xml... | the_stack_v2_python_sparse | core_main_app/rest/data/serializers.py | adilmania/core_main_app | train | 0 |
38e9ec4adaf60070870e9b92895a094400c08b5c | [
"site_limits = cls(pk=1)\ntry:\n site_limits.save()\nexcept IntegrityError:\n return cls.objects.get(pk=1)\nelse:\n return site_limits",
"try:\n return cls.objects.get(pk=1)\nexcept cls.DoesNotExist:\n return cls.create()",
"try:\n site_limits = cls.objects.select_for_update().get(pk=1)\nexcep... | <|body_start_0|>
site_limits = cls(pk=1)
try:
site_limits.save()
except IntegrityError:
return cls.objects.get(pk=1)
else:
return site_limits
<|end_body_0|>
<|body_start_1|>
try:
return cls.objects.get(pk=1)
except cls.Does... | Singleton model to track sitewide values in a row with ID=1 | SiteLimits | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiteLimits:
"""Singleton model to track sitewide values in a row with ID=1"""
def create(cls):
"""Create and return the ID=1 row, or fetch the existing one."""
<|body_0|>
def get(cls):
"""Get the ID=1 row, creating if necessary."""
<|body_1|>
def get... | stack_v2_sparse_classes_36k_train_007374 | 16,217 | permissive | [
{
"docstring": "Create and return the ID=1 row, or fetch the existing one.",
"name": "create",
"signature": "def create(cls)"
},
{
"docstring": "Get the ID=1 row, creating if necessary.",
"name": "get",
"signature": "def get(cls)"
},
{
"docstring": "Get the ID=1 row with select_f... | 5 | null | Implement the Python class `SiteLimits` described below.
Class description:
Singleton model to track sitewide values in a row with ID=1
Method signatures and docstrings:
- def create(cls): Create and return the ID=1 row, or fetch the existing one.
- def get(cls): Get the ID=1 row, creating if necessary.
- def get_for... | Implement the Python class `SiteLimits` described below.
Class description:
Singleton model to track sitewide values in a row with ID=1
Method signatures and docstrings:
- def create(cls): Create and return the ID=1 row, or fetch the existing one.
- def get(cls): Get the ID=1 row, creating if necessary.
- def get_for... | bec56eaa4bfb62a44260e85cf76b421172de10e0 | <|skeleton|>
class SiteLimits:
"""Singleton model to track sitewide values in a row with ID=1"""
def create(cls):
"""Create and return the ID=1 row, or fetch the existing one."""
<|body_0|>
def get(cls):
"""Get the ID=1 row, creating if necessary."""
<|body_1|>
def get... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SiteLimits:
"""Singleton model to track sitewide values in a row with ID=1"""
def create(cls):
"""Create and return the ID=1 row, or fetch the existing one."""
site_limits = cls(pk=1)
try:
site_limits.save()
except IntegrityError:
return cls.objects... | the_stack_v2_python_sparse | capstone/capapi/models.py | harvard-lil/capstone | train | 153 |
68a3372c5ac3c3bc5fce62236290b7847b6321a4 | [
"if not isinstance(page, pywikibot.page.WikibasePage):\n try:\n assert page.site.property_namespace\n assert page.site.item_namespace\n key = page.namespace() == page.site.property_namespace\n page_cls = cls.page_classes[key]\n page = page_cls(page.site, page.title(with_ns=Fals... | <|body_start_0|>
if not isinstance(page, pywikibot.page.WikibasePage):
try:
assert page.site.property_namespace
assert page.site.item_namespace
key = page.namespace() == page.site.property_namespace
page_cls = cls.page_classes[key]
... | Item claim filter. | ItemClaimFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemClaimFilter:
"""Item claim filter."""
def __filter_match(cls: ITEM_CLAIM_FILTER_CLASS, page: 'pywikibot.page.BasePage', prop: str, claim: str, qualifiers: Dict[str, str]) -> bool:
"""Return true if the page contains the claim given. :param page: the page to check :return: true if... | stack_v2_sparse_classes_36k_train_007375 | 18,748 | permissive | [
{
"docstring": "Return true if the page contains the claim given. :param page: the page to check :return: true if page contains the claim, false otherwise",
"name": "__filter_match",
"signature": "def __filter_match(cls: ITEM_CLAIM_FILTER_CLASS, page: 'pywikibot.page.BasePage', prop: str, claim: str, qu... | 2 | null | Implement the Python class `ItemClaimFilter` described below.
Class description:
Item claim filter.
Method signatures and docstrings:
- def __filter_match(cls: ITEM_CLAIM_FILTER_CLASS, page: 'pywikibot.page.BasePage', prop: str, claim: str, qualifiers: Dict[str, str]) -> bool: Return true if the page contains the cla... | Implement the Python class `ItemClaimFilter` described below.
Class description:
Item claim filter.
Method signatures and docstrings:
- def __filter_match(cls: ITEM_CLAIM_FILTER_CLASS, page: 'pywikibot.page.BasePage', prop: str, claim: str, qualifiers: Dict[str, str]) -> bool: Return true if the page contains the cla... | 5c01e6bfcd328bc6eae643e661f1a0ae57612808 | <|skeleton|>
class ItemClaimFilter:
"""Item claim filter."""
def __filter_match(cls: ITEM_CLAIM_FILTER_CLASS, page: 'pywikibot.page.BasePage', prop: str, claim: str, qualifiers: Dict[str, str]) -> bool:
"""Return true if the page contains the claim given. :param page: the page to check :return: true if... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ItemClaimFilter:
"""Item claim filter."""
def __filter_match(cls: ITEM_CLAIM_FILTER_CLASS, page: 'pywikibot.page.BasePage', prop: str, claim: str, qualifiers: Dict[str, str]) -> bool:
"""Return true if the page contains the claim given. :param page: the page to check :return: true if page contain... | the_stack_v2_python_sparse | pywikibot/pagegenerators/_filters.py | wikimedia/pywikibot | train | 432 |
55e9ad35957ddffed355c6d886ec991d4061b8f1 | [
"self.is_valid = is_valid\nself.browse_node_lookup_request = browse_node_lookup_request\nself.item_search_request = item_search_request\nself.item_lookup_request = item_lookup_request\nself.similarity_lookup_request = similarity_lookup_request\nself.cart_get_request = cart_get_request\nself.cart_add_request = cart_... | <|body_start_0|>
self.is_valid = is_valid
self.browse_node_lookup_request = browse_node_lookup_request
self.item_search_request = item_search_request
self.item_lookup_request = item_lookup_request
self.similarity_lookup_request = similarity_lookup_request
self.cart_get_re... | Implementation of the 'Request' model. TODO: type model description here. Attributes: is_valid (string): TODO: type description here. browse_node_lookup_request (BrowseNodeLookupRequest): TODO: type description here. item_search_request (ItemSearchRequest): TODO: type description here. item_lookup_request (ItemLookupRe... | Request | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Request:
"""Implementation of the 'Request' model. TODO: type model description here. Attributes: is_valid (string): TODO: type description here. browse_node_lookup_request (BrowseNodeLookupRequest): TODO: type description here. item_search_request (ItemSearchRequest): TODO: type description here... | stack_v2_sparse_classes_36k_train_007376 | 6,448 | permissive | [
{
"docstring": "Constructor for the Request class",
"name": "__init__",
"signature": "def __init__(self, is_valid=None, browse_node_lookup_request=None, item_search_request=None, item_lookup_request=None, similarity_lookup_request=None, cart_get_request=None, cart_add_request=None, cart_create_request=N... | 2 | stack_v2_sparse_classes_30k_train_002758 | Implement the Python class `Request` described below.
Class description:
Implementation of the 'Request' model. TODO: type model description here. Attributes: is_valid (string): TODO: type description here. browse_node_lookup_request (BrowseNodeLookupRequest): TODO: type description here. item_search_request (ItemSear... | Implement the Python class `Request` described below.
Class description:
Implementation of the 'Request' model. TODO: type model description here. Attributes: is_valid (string): TODO: type description here. browse_node_lookup_request (BrowseNodeLookupRequest): TODO: type description here. item_search_request (ItemSear... | 26ea1019115a1de3b1b37a4b830525e164ac55ce | <|skeleton|>
class Request:
"""Implementation of the 'Request' model. TODO: type model description here. Attributes: is_valid (string): TODO: type description here. browse_node_lookup_request (BrowseNodeLookupRequest): TODO: type description here. item_search_request (ItemSearchRequest): TODO: type description here... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Request:
"""Implementation of the 'Request' model. TODO: type model description here. Attributes: is_valid (string): TODO: type description here. browse_node_lookup_request (BrowseNodeLookupRequest): TODO: type description here. item_search_request (ItemSearchRequest): TODO: type description here. item_lookup... | the_stack_v2_python_sparse | awsecommerceservice/models/request.py | nidaizamir/Test-PY | train | 0 |
2a9a821f01405c06ab68c56de156e868e99d147a | [
"parser = parent.add_parser('attach', help='attach to container')\nparser.add_argument('--image', help='image to instantiate and attach to')\nparser.add_argument('command', nargs='*', help='image to instantiate and attach to')\nparser.set_defaults(class_=cls, method='attach')",
"super().__init__(args)\nif not arg... | <|body_start_0|>
parser = parent.add_parser('attach', help='attach to container')
parser.add_argument('--image', help='image to instantiate and attach to')
parser.add_argument('command', nargs='*', help='image to instantiate and attach to')
parser.set_defaults(class_=cls, method='attach'... | Class for attaching to a running container. | Attach | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attach:
"""Class for attaching to a running container."""
def subparser(cls, parent):
"""Add Attach command to parent parser."""
<|body_0|>
def __init__(self, args):
"""Construct Attach class."""
<|body_1|>
def attach(self):
"""Attach to inst... | stack_v2_sparse_classes_36k_train_007377 | 2,057 | permissive | [
{
"docstring": "Add Attach command to parent parser.",
"name": "subparser",
"signature": "def subparser(cls, parent)"
},
{
"docstring": "Construct Attach class.",
"name": "__init__",
"signature": "def __init__(self, args)"
},
{
"docstring": "Attach to instantiated image.",
"n... | 3 | stack_v2_sparse_classes_30k_train_007276 | Implement the Python class `Attach` described below.
Class description:
Class for attaching to a running container.
Method signatures and docstrings:
- def subparser(cls, parent): Add Attach command to parent parser.
- def __init__(self, args): Construct Attach class.
- def attach(self): Attach to instantiated image. | Implement the Python class `Attach` described below.
Class description:
Class for attaching to a running container.
Method signatures and docstrings:
- def subparser(cls, parent): Add Attach command to parent parser.
- def __init__(self, args): Construct Attach class.
- def attach(self): Attach to instantiated image.... | 94a46127cb0db2b6187186788a941ec72af476dd | <|skeleton|>
class Attach:
"""Class for attaching to a running container."""
def subparser(cls, parent):
"""Add Attach command to parent parser."""
<|body_0|>
def __init__(self, args):
"""Construct Attach class."""
<|body_1|>
def attach(self):
"""Attach to inst... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Attach:
"""Class for attaching to a running container."""
def subparser(cls, parent):
"""Add Attach command to parent parser."""
parser = parent.add_parser('attach', help='attach to container')
parser.add_argument('--image', help='image to instantiate and attach to')
parse... | the_stack_v2_python_sparse | pypodman/pypodman/lib/actions/attach_action.py | 4383/python-podman | train | 0 |
31f0bdede4f123023f5250218d6d075da9db54e6 | [
"super().__init__(**kwargs)\nself._context = weakref.ref(context)\nself._inbound_message = inbound_message\nself._send = send_outbound",
"context = self._context()\nif not context:\n raise RuntimeError('weakref to context has expired')\nif isinstance(message, AgentMessage) and context.settings.get('timing.enab... | <|body_start_0|>
super().__init__(**kwargs)
self._context = weakref.ref(context)
self._inbound_message = inbound_message
self._send = send_outbound
<|end_body_0|>
<|body_start_1|>
context = self._context()
if not context:
raise RuntimeError('weakref to contex... | Handle outgoing messages from message handlers. | DispatcherResponder | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DispatcherResponder:
"""Handle outgoing messages from message handlers."""
def __init__(self, context: RequestContext, inbound_message: InboundMessage, send_outbound: Coroutine, **kwargs):
"""Initialize an instance of `DispatcherResponder`. Args: context: The request context of the i... | stack_v2_sparse_classes_36k_train_007378 | 15,803 | permissive | [
{
"docstring": "Initialize an instance of `DispatcherResponder`. Args: context: The request context of the incoming message inbound_message: The inbound message triggering this handler send_outbound: Async function to send outbound message",
"name": "__init__",
"signature": "def __init__(self, context: ... | 4 | stack_v2_sparse_classes_30k_train_010024 | Implement the Python class `DispatcherResponder` described below.
Class description:
Handle outgoing messages from message handlers.
Method signatures and docstrings:
- def __init__(self, context: RequestContext, inbound_message: InboundMessage, send_outbound: Coroutine, **kwargs): Initialize an instance of `Dispatch... | Implement the Python class `DispatcherResponder` described below.
Class description:
Handle outgoing messages from message handlers.
Method signatures and docstrings:
- def __init__(self, context: RequestContext, inbound_message: InboundMessage, send_outbound: Coroutine, **kwargs): Initialize an instance of `Dispatch... | 39cac36d8937ce84a9307ce100aaefb8bc05ec04 | <|skeleton|>
class DispatcherResponder:
"""Handle outgoing messages from message handlers."""
def __init__(self, context: RequestContext, inbound_message: InboundMessage, send_outbound: Coroutine, **kwargs):
"""Initialize an instance of `DispatcherResponder`. Args: context: The request context of the i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DispatcherResponder:
"""Handle outgoing messages from message handlers."""
def __init__(self, context: RequestContext, inbound_message: InboundMessage, send_outbound: Coroutine, **kwargs):
"""Initialize an instance of `DispatcherResponder`. Args: context: The request context of the incoming messa... | the_stack_v2_python_sparse | aries_cloudagent/core/dispatcher.py | hyperledger/aries-cloudagent-python | train | 370 |
426fd9307a0228fa9beb89c0ac91d15897e46a46 | [
"super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)",
"enc_output = self.encoder(inputs, training, encoder_mask)\ndec_output = self... | <|body_start_0|>
super().__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)
self.linear = tf.keras.layers.Dense(target_vocab)
<|end_body_0|>
<|body_start_1|>
... | Class transformer | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""Class transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Method init Args: N: number of blocks in the encoder and decoder dm: dimensionality of the model h: number of heads hidden: number of... | stack_v2_sparse_classes_36k_train_007379 | 2,282 | no_license | [
{
"docstring": "Method init Args: N: number of blocks in the encoder and decoder dm: dimensionality of the model h: number of heads hidden: number of hidden units in the fully connected layers input_vocab: size of the input vocabulary target_vocab: size of the target vocabulary max_seq_input: maximum sequence l... | 2 | stack_v2_sparse_classes_30k_val_000328 | Implement the Python class `Transformer` described below.
Class description:
Class transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Method init Args: N: number of blocks in the encoder and decoder dm: dimensi... | Implement the Python class `Transformer` described below.
Class description:
Class transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Method init Args: N: number of blocks in the encoder and decoder dm: dimensi... | 7f9a040f23eda32c5aa154c991c930a01b490f0f | <|skeleton|>
class Transformer:
"""Class transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Method init Args: N: number of blocks in the encoder and decoder dm: dimensionality of the model h: number of heads hidden: number of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transformer:
"""Class transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Method init Args: N: number of blocks in the encoder and decoder dm: dimensionality of the model h: number of heads hidden: number of hidden units... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/11-transformer.py | dbaroli/holbertonschool-machine_learning | train | 0 |
f8e035b9b474e6fe48f26bd751f494f141c91db0 | [
"if obstacleGrid[0][0]:\n return 0\nrow = len(obstacleGrid)\ncol = len(obstacleGrid[0])\nres = [[0 for _ in range(col)] for _ in range(row)]\nfor i in range(row):\n if not obstacleGrid[i][0]:\n res[i][0] = 1\n else:\n break\nfor i in range(col):\n if not obstacleGrid[0][i]:\n res[0]... | <|body_start_0|>
if obstacleGrid[0][0]:
return 0
row = len(obstacleGrid)
col = len(obstacleGrid[0])
res = [[0 for _ in range(col)] for _ in range(row)]
for i in range(row):
if not obstacleGrid[i][0]:
res[i][0] = 1
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]"""
<|body_0|>
def uniquePathsWithObstacles2(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
... | stack_v2_sparse_classes_36k_train_007380 | 2,225 | no_license | [
{
"docstring": ":type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]",
"name": "uniquePathsWithObstacles",
"signature": "def uniquePathsWithObstacles(self, obstacleGrid)"
},
{
"docstring": ":type obstacleGrid: List[List[int]] :rtype: int",
"name": "uniquePathsW... | 2 | stack_v2_sparse_classes_30k_train_012794 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]
- def uniquePathsWithObstacles2(self, obstac... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePathsWithObstacles(self, obstacleGrid): :type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]
- def uniquePathsWithObstacles2(self, obstac... | 013f6f222c6c2a617787b258f8a37003a9f51526 | <|skeleton|>
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]"""
<|body_0|>
def uniquePathsWithObstacles2(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def uniquePathsWithObstacles(self, obstacleGrid):
""":type obstacleGrid: List[List[int]] :rtype: int res[i][j] = res[i-1][j]+res[i][j-1]"""
if obstacleGrid[0][0]:
return 0
row = len(obstacleGrid)
col = len(obstacleGrid[0])
res = [[0 for _ in range(... | the_stack_v2_python_sparse | dp/unique_paths_withobstacles.py | terrifyzhao/leetcode | train | 0 | |
0cd63281c731d060f861265b4d39a7f5fb278dcc | [
"if pRoot is None:\n return 0\ncur_level = [pRoot]\ncount = 0\nwhile cur_level:\n count += 1\n temp = cur_level\n cur_level = []\n for node in temp:\n if node.left:\n cur_level.append(node.left)\n if node.right:\n cur_level.append(node.right)\nreturn count",
"if ... | <|body_start_0|>
if pRoot is None:
return 0
cur_level = [pRoot]
count = 0
while cur_level:
count += 1
temp = cur_level
cur_level = []
for node in temp:
if node.left:
cur_level.append(node.left... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def TreeDepth(self, pRoot):
"""层次遍历 :param pRoot: :return:"""
<|body_0|>
def TreeDepth_1(self, pRoot):
"""深度优先遍历 :param pRoot: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if pRoot is None:
return 0
cur_leve... | stack_v2_sparse_classes_36k_train_007381 | 1,105 | no_license | [
{
"docstring": "层次遍历 :param pRoot: :return:",
"name": "TreeDepth",
"signature": "def TreeDepth(self, pRoot)"
},
{
"docstring": "深度优先遍历 :param pRoot: :return:",
"name": "TreeDepth_1",
"signature": "def TreeDepth_1(self, pRoot)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def TreeDepth(self, pRoot): 层次遍历 :param pRoot: :return:
- def TreeDepth_1(self, pRoot): 深度优先遍历 :param pRoot: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def TreeDepth(self, pRoot): 层次遍历 :param pRoot: :return:
- def TreeDepth_1(self, pRoot): 深度优先遍历 :param pRoot: :return:
<|skeleton|>
class Solution:
def TreeDepth(self, pRoot... | 2be3f8196bd38c25efe383c77539a7582cd441c0 | <|skeleton|>
class Solution:
def TreeDepth(self, pRoot):
"""层次遍历 :param pRoot: :return:"""
<|body_0|>
def TreeDepth_1(self, pRoot):
"""深度优先遍历 :param pRoot: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def TreeDepth(self, pRoot):
"""层次遍历 :param pRoot: :return:"""
if pRoot is None:
return 0
cur_level = [pRoot]
count = 0
while cur_level:
count += 1
temp = cur_level
cur_level = []
for node in temp:
... | the_stack_v2_python_sparse | jianzhi_Offer/34. 二叉树的深度.py | yongrl/LeetCode | train | 0 | |
ef8ffcb70fec1be02ec0bf8fec73184c44584a30 | [
"if n == 0:\n return []\nreturn self.dfs(1, n)",
"ans = []\nif begin > end:\n ans.append(None)\n return ans\nif begin == end:\n t = TreeNode(begin)\n ans.append(t)\n return ans\nif begin + 1 == end:\n t1 = TreeNode(begin)\n t1.right = TreeNode(end)\n ans.append(t1)\n t2 = TreeNode(en... | <|body_start_0|>
if n == 0:
return []
return self.dfs(1, n)
<|end_body_0|>
<|body_start_1|>
ans = []
if begin > end:
ans.append(None)
return ans
if begin == end:
t = TreeNode(begin)
ans.append(t)
return ans
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generateTrees(self, n):
""":type n: int :rtype: List[TreeNode]"""
<|body_0|>
def dfs(self, begin, end):
"""从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n =... | stack_v2_sparse_classes_36k_train_007382 | 1,392 | no_license | [
{
"docstring": ":type n: int :rtype: List[TreeNode]",
"name": "generateTrees",
"signature": "def generateTrees(self, n)"
},
{
"docstring": "从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]",
"name": "dfs",
"signature": "def dfs(self, begin, end)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001824 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateTrees(self, n): :type n: int :rtype: List[TreeNode]
- def dfs(self, begin, end): 从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generateTrees(self, n): :type n: int :rtype: List[TreeNode]
- def dfs(self, begin, end): 从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]
<|skeleton... | 96adb6c04c344e792e35dc70dc45eb76b5402008 | <|skeleton|>
class Solution:
def generateTrees(self, n):
""":type n: int :rtype: List[TreeNode]"""
<|body_0|>
def dfs(self, begin, end):
"""从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generateTrees(self, n):
""":type n: int :rtype: List[TreeNode]"""
if n == 0:
return []
return self.dfs(1, n)
def dfs(self, begin, end):
"""从begin到end,生成BST :param begin:int :param end: int :return: List[TreeNode]"""
ans = []
if beg... | the_stack_v2_python_sparse | JiQiang/leetcode_py/tree/UniqueBinarySearchTrees96.py | Hearen/AlgorithmHackers | train | 10 | |
089e8d3ede22e4ae0ca5842fbd657586db228ed0 | [
"self.arrayOne = [1, 3, 4, 2, 2, 2, 1, 1, 2]\nself.output = True\nreturn (self.arrayOne, self.output)",
"arrayOne, output = self.setUp()\noutput_method = solution(arrayOne)\nself.assertEqual(output, output_method)"
] | <|body_start_0|>
self.arrayOne = [1, 3, 4, 2, 2, 2, 1, 1, 2]
self.output = True
return (self.arrayOne, self.output)
<|end_body_0|>
<|body_start_1|>
arrayOne, output = self.setUp()
output_method = solution(arrayOne)
self.assertEqual(output, output_method)
<|end_body_1|>
| Class with unittests for Codility_2_task.py | test_Codility_2_task | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_Codility_2_task:
"""Class with unittests for Codility_2_task.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_user_input(self):
"""Checks if method works properly."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.arrayOne... | stack_v2_sparse_classes_36k_train_007383 | 849 | no_license | [
{
"docstring": "Sets up input.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Checks if method works properly.",
"name": "test_user_input",
"signature": "def test_user_input(self)"
}
] | 2 | null | Implement the Python class `test_Codility_2_task` described below.
Class description:
Class with unittests for Codility_2_task.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_user_input(self): Checks if method works properly. | Implement the Python class `test_Codility_2_task` described below.
Class description:
Class with unittests for Codility_2_task.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_user_input(self): Checks if method works properly.
<|skeleton|>
class test_Codility_2_task:
"""Class wit... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class test_Codility_2_task:
"""Class with unittests for Codility_2_task.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_user_input(self):
"""Checks if method works properly."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class test_Codility_2_task:
"""Class with unittests for Codility_2_task.py"""
def setUp(self):
"""Sets up input."""
self.arrayOne = [1, 3, 4, 2, 2, 2, 1, 1, 2]
self.output = True
return (self.arrayOne, self.output)
def test_user_input(self):
"""Checks if method work... | the_stack_v2_python_sparse | Codility_algorithms/test_Codility_2_task.py | JakubKazimierski/PythonPortfolio | train | 9 |
66a652ff07569da696c0478841487379c5943f8c | [
"super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nnew_downsample_block = nn.ModuleDict({'conv1': ConvBlock(in_chans, chans, drop_prob)})\nself.down_sample_layers = nn.ModuleList([new_downsample_block])\n... | <|body_start_0|>
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
new_downsample_block = nn.ModuleDict({'conv1': ConvBlock(in_chans, chans, drop_prob)})
... | PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. | UnetModelAssistLatentDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnetModelAssistLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventio... | stack_v2_sparse_classes_36k_train_007384 | 15,577 | no_license | [
{
"docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ... | 2 | stack_v2_sparse_classes_30k_train_005244 | Implement the Python class `UnetModelAssistLatentDecoder` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image comp... | Implement the Python class `UnetModelAssistLatentDecoder` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image comp... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class UnetModelAssistLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventio... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnetModelAssistLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–... | the_stack_v2_python_sparse | lemawarersn_unet_conv_redundancy_removed/unetmodels.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
65b704efc328ba5b51694224f41feb67c4e67e1a | [
"for i in range(len(nums)):\n t = target - nums[i]\n if t in nums and nums.index(t) != i:\n print([nums.index(t), i])\n return [nums.index(t), i]",
"d = {}\nfor i in range(len(nums)):\n t = target - nums[i]\n if t in d:\n print([d[t], i])\n return [d[t], i]\n d[nums[i]] ... | <|body_start_0|>
for i in range(len(nums)):
t = target - nums[i]
if t in nums and nums.index(t) != i:
print([nums.index(t), i])
return [nums.index(t), i]
<|end_body_0|>
<|body_start_1|>
d = {}
for i in range(len(nums)):
t = tar... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twosum(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_0|>
def twosum_2(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_007385 | 1,213 | no_license | [
{
"docstring": ":type nums:list[int] :type target:int :rtype:list[int]",
"name": "twosum",
"signature": "def twosum(self, nums, target)"
},
{
"docstring": ":type nums:list[int] :type target:int :rtype:list[int]",
"name": "twosum_2",
"signature": "def twosum_2(self, nums, target)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twosum(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int]
- def twosum_2(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twosum(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int]
- def twosum_2(self, nums, target): :type nums:list[int] :type target:int :rtype:list[int]
... | 4f2802d4773eddd2a2e06e61c51463056886b730 | <|skeleton|>
class Solution:
def twosum(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_0|>
def twosum_2(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def twosum(self, nums, target):
""":type nums:list[int] :type target:int :rtype:list[int]"""
for i in range(len(nums)):
t = target - nums[i]
if t in nums and nums.index(t) != i:
print([nums.index(t), i])
return [nums.index(t), i... | the_stack_v2_python_sparse | leetcode/9_twosum.py | Yara7L/python_algorithm | train | 0 | |
7cef8b3f2136f30c92d06386ce47da095a92993d | [
"l = 0\nr = len(nums) - 1\nwhile l < r:\n m = l + (r - l) / 2\n if nums[m] > nums[r]:\n l = m + 1\n elif nums[m] < nums[r]:\n r = m\n else:\n r -= 1\nreturn nums[r]",
"l = 0\nr = len(nums)\nwhile l < r:\n m = l + (r - l) / 2\n if nums[m] > nums[r - 1]:\n l = m\n el... | <|body_start_0|>
l = 0
r = len(nums) - 1
while l < r:
m = l + (r - l) / 2
if nums[m] > nums[r]:
l = m + 1
elif nums[m] < nums[r]:
r = m
else:
r -= 1
return nums[r]
<|end_body_0|>
<|body_start... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l = 0
r = len(nums) - 1
while l < r:
... | stack_v2_sparse_classes_36k_train_007386 | 2,200 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMin",
"signature": "def findMin(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMin",
"signature": "def findMin(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMin(self, nums): :type nums: List[int] :rtype: int
- def findMin(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 findMin(self, nums): :type nums: List[int] :rtype: int
- def findMin(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def findMin(self, nums)... | 860590239da0618c52967a55eda8d6bbe00bfa96 | <|skeleton|>
class Solution:
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMin(self, nums):
""":type nums: List[int] :rtype: int"""
l = 0
r = len(nums) - 1
while l < r:
m = l + (r - l) / 2
if nums[m] > nums[r]:
l = m + 1
elif nums[m] < nums[r]:
r = m
else... | the_stack_v2_python_sparse | LeetCode/p0154/II/find-minimum-in-rotated-sorted-array-ii.py | Ynjxsjmh/PracticeMakesPerfect | train | 0 | |
89f507bc0e205ae3fc33ab4b8d80c3be9424c360 | [
"super(MidasNet_StackedHourGlass, self).__init__()\nuse_pretrained = False if path else True\nself.pretrained, self.scratch = _make_encoder(backbone, features, use_pretrained)\nself.scratch.refinenet4 = ProgressiveUpsample(features, features // 2, 32)\nself.scratch.refinenet3 = ProgressiveUpsample(features + featur... | <|body_start_0|>
super(MidasNet_StackedHourGlass, self).__init__()
use_pretrained = False if path else True
self.pretrained, self.scratch = _make_encoder(backbone, features, use_pretrained)
self.scratch.refinenet4 = ProgressiveUpsample(features, features // 2, 32)
self.scratch.re... | Network for monocular depth estimation. | MidasNet_StackedHourGlass | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MidasNet_StackedHourGlass:
"""Network for monocular depth estimation."""
def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True):
"""Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defa... | stack_v2_sparse_classes_36k_train_007387 | 13,019 | permissive | [
{
"docstring": "Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256. backbone (str, optional): Backbone network for encoder. Defaults to resnet50",
"name": "__init__",
"signature": "def __init__(self, path=None, features=... | 2 | stack_v2_sparse_classes_30k_train_004694 | Implement the Python class `MidasNet_StackedHourGlass` described below.
Class description:
Network for monocular depth estimation.
Method signatures and docstrings:
- def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): Init. Args: path (str, optional): Path to saved model. Defaults to... | Implement the Python class `MidasNet_StackedHourGlass` described below.
Class description:
Network for monocular depth estimation.
Method signatures and docstrings:
- def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): Init. Args: path (str, optional): Path to saved model. Defaults to... | a00c3619bf4042e446e1919087f0b09fe9fa3a65 | <|skeleton|>
class MidasNet_StackedHourGlass:
"""Network for monocular depth estimation."""
def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True):
"""Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MidasNet_StackedHourGlass:
"""Network for monocular depth estimation."""
def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True):
"""Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256. ... | the_stack_v2_python_sparse | nasws/cnn/search_space/monodepth/models/midas_net.py | kcyu2014/nas-landmarkreg | train | 10 |
846278e061d7f654d3371f1c572ad3e915df55d4 | [
"input_json = request.data['APIParams']\noutput_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['AvailabilityDetails'], request.data['AuthenticationDetails'], None]))\nfetch_all_state = self.fetch_states(input_json)\npayload_details = {'states_details': fetch_all_state}\no... | <|body_start_0|>
input_json = request.data['APIParams']
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['AvailabilityDetails'], request.data['AuthenticationDetails'], None]))
fetch_all_state = self.fetch_states(input_json)
payload_details... | This API cover for fetch all states. | GetAllStatesByCountryAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetAllStatesByCountryAPI:
"""This API cover for fetch all states."""
def post(self, request):
"""This API cover for fetch all states."""
<|body_0|>
def fetch_states(self, request):
"""Function to fetch states into database."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_007388 | 1,574 | no_license | [
{
"docstring": "This API cover for fetch all states.",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "Function to fetch states into database.",
"name": "fetch_states",
"signature": "def fetch_states(self, request)"
}
] | 2 | null | Implement the Python class `GetAllStatesByCountryAPI` described below.
Class description:
This API cover for fetch all states.
Method signatures and docstrings:
- def post(self, request): This API cover for fetch all states.
- def fetch_states(self, request): Function to fetch states into database. | Implement the Python class `GetAllStatesByCountryAPI` described below.
Class description:
This API cover for fetch all states.
Method signatures and docstrings:
- def post(self, request): This API cover for fetch all states.
- def fetch_states(self, request): Function to fetch states into database.
<|skeleton|>
clas... | 36eb9931f330e64902354c6fc471be2adf4b7049 | <|skeleton|>
class GetAllStatesByCountryAPI:
"""This API cover for fetch all states."""
def post(self, request):
"""This API cover for fetch all states."""
<|body_0|>
def fetch_states(self, request):
"""Function to fetch states into database."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetAllStatesByCountryAPI:
"""This API cover for fetch all states."""
def post(self, request):
"""This API cover for fetch all states."""
input_json = request.data['APIParams']
output_json = dict(zip(['AvailabilityDetails', 'AuthenticationDetails', 'Payload'], [request.data['Availa... | the_stack_v2_python_sparse | Generic/common/location/api/getallstatesdetailsbycountry/views_getallstatesdetailsbycountry.py | archiemb303/common_backend_django | train | 0 |
51df1fa6665a9c3500d50700c2df411f266a07d7 | [
"try:\n dbclient = None\n dbclient = MyDB('JIRA')\n version_filter = ''\n if version_id_list:\n version_filter = 'AND nodeassociation.SINK_NODE_ID in (%s)' % ','.join(version_id_list)\n if issue_type_id:\n issue_type_filter = ' AND issuetype.ID=%s ' % issue_type_id\n else:\n i... | <|body_start_0|>
try:
dbclient = None
dbclient = MyDB('JIRA')
version_filter = ''
if version_id_list:
version_filter = 'AND nodeassociation.SINK_NODE_ID in (%s)' % ','.join(version_id_list)
if issue_type_id:
issue_type_f... | JiraDefect | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JiraDefect:
def get_defects_by_version_ids(version_id_list, issue_type_id):
"""根据项目版本获取缺陷"""
<|body_0|>
def get_defect_custom_field_info(defect_id):
"""根据缺陷id获取缺陷自定义字段信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
dbclient = Non... | stack_v2_sparse_classes_36k_train_007389 | 5,498 | permissive | [
{
"docstring": "根据项目版本获取缺陷",
"name": "get_defects_by_version_ids",
"signature": "def get_defects_by_version_ids(version_id_list, issue_type_id)"
},
{
"docstring": "根据缺陷id获取缺陷自定义字段信息",
"name": "get_defect_custom_field_info",
"signature": "def get_defect_custom_field_info(defect_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012593 | Implement the Python class `JiraDefect` described below.
Class description:
Implement the JiraDefect class.
Method signatures and docstrings:
- def get_defects_by_version_ids(version_id_list, issue_type_id): 根据项目版本获取缺陷
- def get_defect_custom_field_info(defect_id): 根据缺陷id获取缺陷自定义字段信息 | Implement the Python class `JiraDefect` described below.
Class description:
Implement the JiraDefect class.
Method signatures and docstrings:
- def get_defects_by_version_ids(version_id_list, issue_type_id): 根据项目版本获取缺陷
- def get_defect_custom_field_info(defect_id): 根据缺陷id获取缺陷自定义字段信息
<|skeleton|>
class JiraDefect:
... | 6e073808297eab642ff00b5ea39b6b283ee13ad2 | <|skeleton|>
class JiraDefect:
def get_defects_by_version_ids(version_id_list, issue_type_id):
"""根据项目版本获取缺陷"""
<|body_0|>
def get_defect_custom_field_info(defect_id):
"""根据缺陷id获取缺陷自定义字段信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JiraDefect:
def get_defects_by_version_ids(version_id_list, issue_type_id):
"""根据项目版本获取缺陷"""
try:
dbclient = None
dbclient = MyDB('JIRA')
version_filter = ''
if version_id_list:
version_filter = 'AND nodeassociation.SINK_NODE_ID i... | the_stack_v2_python_sparse | backend/jira/defect.py | themycode/test-management-platform | train | 0 | |
169f9778cdecdd24c3cc2d349b3a4aae55cae8ff | [
"self.tree = Element('GEDI')\ndl_document = SubElement(self.tree, 'DL_DOCUMENT')\nuser = SubElement(self.tree, 'USER')\nuser.attrib['name'] = user_name\nuser.attrib['date'] = str(date)\ndl_document.attrib['src'] = image_name\ndl_document.attrib['docTag'] = 'xml'\ndl_document.attrib['width'] = str(width)\ndl_documen... | <|body_start_0|>
self.tree = Element('GEDI')
dl_document = SubElement(self.tree, 'DL_DOCUMENT')
user = SubElement(self.tree, 'USER')
user.attrib['name'] = user_name
user.attrib['date'] = str(date)
dl_document.attrib['src'] = image_name
dl_document.attrib['docTag']... | XMLTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLTree:
def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()):
"""Instantiates a XML Tree representation to hold object detection results."""
<|body_0|>
def add_mask(self, name, type='PlanteInteret'):
"""Adds a detection. ID p... | stack_v2_sparse_classes_36k_train_007390 | 1,657 | no_license | [
{
"docstring": "Instantiates a XML Tree representation to hold object detection results.",
"name": "__init__",
"signature": "def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today())"
},
{
"docstring": "Adds a detection. ID points to a PNG mask representing th... | 3 | stack_v2_sparse_classes_30k_test_000278 | Implement the Python class `XMLTree` described below.
Class description:
Implement the XMLTree class.
Method signatures and docstrings:
- def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()): Instantiates a XML Tree representation to hold object detection results.
- def add_ma... | Implement the Python class `XMLTree` described below.
Class description:
Implement the XMLTree class.
Method signatures and docstrings:
- def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()): Instantiates a XML Tree representation to hold object detection results.
- def add_ma... | 361ca212cb236027a69acb2e3988506da5f286ea | <|skeleton|>
class XMLTree:
def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()):
"""Instantiates a XML Tree representation to hold object detection results."""
<|body_0|>
def add_mask(self, name, type='PlanteInteret'):
"""Adds a detection. ID p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XMLTree:
def __init__(self, image_name, width, height, user_name='Bipbip', date=datetime.date.today()):
"""Instantiates a XML Tree representation to hold object detection results."""
self.tree = Element('GEDI')
dl_document = SubElement(self.tree, 'DL_DOCUMENT')
user = SubElemen... | the_stack_v2_python_sparse | my_xml_toolbox.py | laclouis5/Utilities | train | 1 | |
42948d5d87a812e3719d9d1a87d996ce7bb1f05f | [
"self.zk_client = zk_client\nself.service_operator = service_operator\nself.projects = {}\nensure_path(CELERY_CONFIG_DIR)\nensure_path(CELERY_WORKER_DIR)\nensure_path(CELERY_WORKER_LOG_DIR)\nensure_path(CELERY_STATE_DIR)\nzk_client.ensure_path('/appscale/projects')\nzk_client.ChildrenWatch('/appscale/projects', sel... | <|body_start_0|>
self.zk_client = zk_client
self.service_operator = service_operator
self.projects = {}
ensure_path(CELERY_CONFIG_DIR)
ensure_path(CELERY_WORKER_DIR)
ensure_path(CELERY_WORKER_LOG_DIR)
ensure_path(CELERY_STATE_DIR)
zk_client.ensure_path('/a... | Manages the Celery workers for all projects. | GlobalPushWorkerManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GlobalPushWorkerManager:
"""Manages the Celery workers for all projects."""
def __init__(self, zk_client, service_operator):
"""Creates a new GlobalPushWorkerManager."""
<|body_0|>
def update_projects(self, new_project_list):
"""Establishes watches for each proje... | stack_v2_sparse_classes_36k_train_007391 | 7,083 | permissive | [
{
"docstring": "Creates a new GlobalPushWorkerManager.",
"name": "__init__",
"signature": "def __init__(self, zk_client, service_operator)"
},
{
"docstring": "Establishes watches for each project's queue configuration. Args: new_project_list: A fresh list of strings specifying existing project I... | 3 | null | Implement the Python class `GlobalPushWorkerManager` described below.
Class description:
Manages the Celery workers for all projects.
Method signatures and docstrings:
- def __init__(self, zk_client, service_operator): Creates a new GlobalPushWorkerManager.
- def update_projects(self, new_project_list): Establishes w... | Implement the Python class `GlobalPushWorkerManager` described below.
Class description:
Manages the Celery workers for all projects.
Method signatures and docstrings:
- def __init__(self, zk_client, service_operator): Creates a new GlobalPushWorkerManager.
- def update_projects(self, new_project_list): Establishes w... | be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f | <|skeleton|>
class GlobalPushWorkerManager:
"""Manages the Celery workers for all projects."""
def __init__(self, zk_client, service_operator):
"""Creates a new GlobalPushWorkerManager."""
<|body_0|>
def update_projects(self, new_project_list):
"""Establishes watches for each proje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GlobalPushWorkerManager:
"""Manages the Celery workers for all projects."""
def __init__(self, zk_client, service_operator):
"""Creates a new GlobalPushWorkerManager."""
self.zk_client = zk_client
self.service_operator = service_operator
self.projects = {}
ensure_p... | the_stack_v2_python_sparse | AdminServer/appscale/admin/push_worker_manager.py | obino/appscale | train | 1 |
3c08eb4060380679ae1d50a4fd567add0c475bb0 | [
"self.get_matching()\nself.remove_virtual()\nself.apply_matching()\nif self.graph.gl_plot:\n self.graph.gl_plot.plot_lines(self.matching)",
"verts, plaqs, tv, tp = ([], [], [], [])\ndvert, dplaq, dv, dp = ([], [], [], [])\nfor layer in self.graph.S.values():\n for stab in layer.values():\n type, y, x... | <|body_start_0|>
self.get_matching()
self.remove_virtual()
self.apply_matching()
if self.graph.gl_plot:
self.graph.gl_plot.plot_lines(self.matching)
<|end_body_0|>
<|body_start_1|>
verts, plaqs, tv, tp = ([], [], [], [])
dvert, dplaq, dv, dp = ([], [], [], []... | Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero. | planar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class planar:
"""Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero."""
def decode(self):
"""Decode function... | stack_v2_sparse_classes_36k_train_007392 | 11,180 | no_license | [
{
"docstring": "Decode functions for the MWPM planar decoder",
"name": "decode",
"signature": "def decode(self)"
},
{
"docstring": "Returns all anyons in the graph, as well as their respective virtual anyons in the boundary, for both their current layer as well as on the decode layer. This is th... | 5 | stack_v2_sparse_classes_30k_train_005663 | Implement the Python class `planar` described below.
Class description:
Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero.
Method signa... | Implement the Python class `planar` described below.
Class description:
Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero.
Method signa... | 8d952fc8d8d728086360e1718f43c0bc445f26b1 | <|skeleton|>
class planar:
"""Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero."""
def decode(self):
"""Decode function... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class planar:
"""Decodes the planar lattice (2D and 3D). Edges between all anyons are considered. Additionally, virtual anyons are added to the boundary, which connect to their main anyons. Edges between all virtual anyons are added with weight zero."""
def decode(self):
"""Decode functions for the MWP... | the_stack_v2_python_sparse | oopsc/decoder/mwpm.py | Poeloe/oop_surface_code | train | 3 |
12d378d0e33bef40fdcb1f04633d7269ec21a134 | [
"serializer = SampleSerializer(data=request.data)\nserializer.is_valid(raise_exception=True)\nsample = serializer.save(user=request.user)\nreturn JsonResponse({'id': sample.id}, status=status.HTTP_201_CREATED)",
"sample = self.get_object()\nif sample.user.id == request.user.id:\n serializer = SampleSerializer(... | <|body_start_0|>
serializer = SampleSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
sample = serializer.save(user=request.user)
return JsonResponse({'id': sample.id}, status=status.HTTP_201_CREATED)
<|end_body_0|>
<|body_start_1|>
sample = self.get_object... | SampleView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SampleView:
def create(self, request, *args, **kwargs):
"""Overridden create method in order to assign the authenticated user and to return the newly created sample ID."""
<|body_0|>
def update(self, request, *args, **kwargs):
"""Overridden patch method in order to o... | stack_v2_sparse_classes_36k_train_007393 | 2,384 | no_license | [
{
"docstring": "Overridden create method in order to assign the authenticated user and to return the newly created sample ID.",
"name": "create",
"signature": "def create(self, request, *args, **kwargs)"
},
{
"docstring": "Overridden patch method in order to only allow the sample owner to update... | 3 | stack_v2_sparse_classes_30k_test_000921 | Implement the Python class `SampleView` described below.
Class description:
Implement the SampleView class.
Method signatures and docstrings:
- def create(self, request, *args, **kwargs): Overridden create method in order to assign the authenticated user and to return the newly created sample ID.
- def update(self, r... | Implement the Python class `SampleView` described below.
Class description:
Implement the SampleView class.
Method signatures and docstrings:
- def create(self, request, *args, **kwargs): Overridden create method in order to assign the authenticated user and to return the newly created sample ID.
- def update(self, r... | 94810e2e0bddd98ec9f3bd44c2f9f5f3f166bb08 | <|skeleton|>
class SampleView:
def create(self, request, *args, **kwargs):
"""Overridden create method in order to assign the authenticated user and to return the newly created sample ID."""
<|body_0|>
def update(self, request, *args, **kwargs):
"""Overridden patch method in order to o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SampleView:
def create(self, request, *args, **kwargs):
"""Overridden create method in order to assign the authenticated user and to return the newly created sample ID."""
serializer = SampleSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
sample = serial... | the_stack_v2_python_sparse | src/safm_api/views/sample.py | HE-Arc/social-audio-free-market | train | 4 | |
b0a02ead4fffd437eb8ee12ace0bd92b37aa1a05 | [
"num = str(num)\nwhile len(num) > 1:\n ans = 0\n for i in num:\n ans += int(i)\n num = str(ans)\nreturn int(num)",
"num = str(num)\nans = 0\nfor n in num:\n ans += int(n)\n if ans >= 10:\n ans = ans % 10 + ans / 10\nreturn ans"
] | <|body_start_0|>
num = str(num)
while len(num) > 1:
ans = 0
for i in num:
ans += int(i)
num = str(ans)
return int(num)
<|end_body_0|>
<|body_start_1|>
num = str(num)
ans = 0
for n in num:
ans += int(n)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addDigits1(self, num):
""":type num: int :rtype: int"""
<|body_0|>
def addDigits(self, num):
""":type num: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
num = str(num)
while len(num) > 1:
ans = 0
... | stack_v2_sparse_classes_36k_train_007394 | 1,212 | no_license | [
{
"docstring": ":type num: int :rtype: int",
"name": "addDigits1",
"signature": "def addDigits1(self, num)"
},
{
"docstring": ":type num: int :rtype: int",
"name": "addDigits",
"signature": "def addDigits(self, num)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addDigits1(self, num): :type num: int :rtype: int
- def addDigits(self, num): :type num: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addDigits1(self, num): :type num: int :rtype: int
- def addDigits(self, num): :type num: int :rtype: int
<|skeleton|>
class Solution:
def addDigits1(self, num):
... | 1520e1e9bb0c428797a3e5234e5b328110472c20 | <|skeleton|>
class Solution:
def addDigits1(self, num):
""":type num: int :rtype: int"""
<|body_0|>
def addDigits(self, num):
""":type num: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def addDigits1(self, num):
""":type num: int :rtype: int"""
num = str(num)
while len(num) > 1:
ans = 0
for i in num:
ans += int(i)
num = str(ans)
return int(num)
def addDigits(self, num):
""":type num: i... | the_stack_v2_python_sparse | Math/258. Add Digits.py | tinkle1129/Leetcode_Solution | train | 0 | |
3fce6e554bc2be9ebd9b14f817c77b4e02837152 | [
"if cve is None:\n raise ValueError('CVE ID Required')\nmowCVE.__init__(self, cve=cve, **kwargs)\n'\\n self.description = kwargs.get(\"description\", None)\\n self.title = kwargs.get(\"title\", None)\\n self.cvss2 = cvss.CVSS2(kwargs.get(\"cvss2\", None))\\n self.cvss3 = cvss.CVSS3(kw... | <|body_start_0|>
if cve is None:
raise ValueError('CVE ID Required')
mowCVE.__init__(self, cve=cve, **kwargs)
'\n self.description = kwargs.get("description", None)\n self.title = kwargs.get("title", None)\n self.cvss2 = cvss.CVSS2(kwargs.get("cvss2", None))\n ... | Red Hat CVE Class that Updates mowCVE with Data from CVE | mowCVERedHat | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mowCVERedHat:
"""Red Hat CVE Class that Updates mowCVE with Data from CVE"""
def __init__(self, cve=None, **kwargs):
"""Initialze a Holder for CVE Things"""
<|body_0|>
def pull_rh_cve(self):
"""Reach out, Grab the CVE Data and Parse it"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_007395 | 6,606 | permissive | [
{
"docstring": "Initialze a Holder for CVE Things",
"name": "__init__",
"signature": "def __init__(self, cve=None, **kwargs)"
},
{
"docstring": "Reach out, Grab the CVE Data and Parse it",
"name": "pull_rh_cve",
"signature": "def pull_rh_cve(self)"
},
{
"docstring": "Takes the pa... | 3 | stack_v2_sparse_classes_30k_train_010745 | Implement the Python class `mowCVERedHat` described below.
Class description:
Red Hat CVE Class that Updates mowCVE with Data from CVE
Method signatures and docstrings:
- def __init__(self, cve=None, **kwargs): Initialze a Holder for CVE Things
- def pull_rh_cve(self): Reach out, Grab the CVE Data and Parse it
- def ... | Implement the Python class `mowCVERedHat` described below.
Class description:
Red Hat CVE Class that Updates mowCVE with Data from CVE
Method signatures and docstrings:
- def __init__(self, cve=None, **kwargs): Initialze a Holder for CVE Things
- def pull_rh_cve(self): Reach out, Grab the CVE Data and Parse it
- def ... | b9399f32950125ac7bfc48595da1c713544a1dfe | <|skeleton|>
class mowCVERedHat:
"""Red Hat CVE Class that Updates mowCVE with Data from CVE"""
def __init__(self, cve=None, **kwargs):
"""Initialze a Holder for CVE Things"""
<|body_0|>
def pull_rh_cve(self):
"""Reach out, Grab the CVE Data and Parse it"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class mowCVERedHat:
"""Red Hat CVE Class that Updates mowCVE with Data from CVE"""
def __init__(self, cve=None, **kwargs):
"""Initialze a Holder for CVE Things"""
if cve is None:
raise ValueError('CVE ID Required')
mowCVE.__init__(self, cve=cve, **kwargs)
'\n ... | the_stack_v2_python_sparse | audittools/redhat_cve.py | chalbersma/manowar | train | 3 |
c68d20632a5967698dc4b5468f42d3a934c61ecf | [
"self._args = ' '.join(args)\ntry:\n ns, extras = super().parse_known_args(args=args, namespace=namespace)\nexcept (ArgumentError, ArgumentTypeError) as e:\n if isinstance(e, OnionArgumentError):\n raise\n if isinstance(e, ArgumentError):\n raise OnionArgumentError(msg=e.message, argument=e.a... | <|body_start_0|>
self._args = ' '.join(args)
try:
ns, extras = super().parse_known_args(args=args, namespace=namespace)
except (ArgumentError, ArgumentTypeError) as e:
if isinstance(e, OnionArgumentError):
raise
if isinstance(e, ArgumentError):... | `argparse.ArgumentParser` subclass for parsing Onion comments. This class is essentially used to reimplement the installer programs' existing command line parsers with some slight tweaks specific to parsing Onion comments during the notebook's pre-cell execution phase. Since the arguments are eventually passed to the a... | OnionParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OnionParser:
"""`argparse.ArgumentParser` subclass for parsing Onion comments. This class is essentially used to reimplement the installer programs' existing command line parsers with some slight tweaks specific to parsing Onion comments during the notebook's pre-cell execution phase. Since the a... | stack_v2_sparse_classes_36k_train_007396 | 25,327 | permissive | [
{
"docstring": "Parse installer options as command line arguments. Parameters ---------- args : list of str Command line arguments for the installer program specified in an Onion comment, split into a list of strings. namespace : object, optional An object whose namespace should be populated with the parsed arg... | 2 | stack_v2_sparse_classes_30k_val_000000 | Implement the Python class `OnionParser` described below.
Class description:
`argparse.ArgumentParser` subclass for parsing Onion comments. This class is essentially used to reimplement the installer programs' existing command line parsers with some slight tweaks specific to parsing Onion comments during the notebook'... | Implement the Python class `OnionParser` described below.
Class description:
`argparse.ArgumentParser` subclass for parsing Onion comments. This class is essentially used to reimplement the installer programs' existing command line parsers with some slight tweaks specific to parsing Onion comments during the notebook'... | 4a3be140f5b77e8e01cdc964bf07972a2c9afbd5 | <|skeleton|>
class OnionParser:
"""`argparse.ArgumentParser` subclass for parsing Onion comments. This class is essentially used to reimplement the installer programs' existing command line parsers with some slight tweaks specific to parsing Onion comments during the notebook's pre-cell execution phase. Since the a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OnionParser:
"""`argparse.ArgumentParser` subclass for parsing Onion comments. This class is essentially used to reimplement the installer programs' existing command line parsers with some slight tweaks specific to parsing Onion comments during the notebook's pre-cell execution phase. Since the arguments are ... | the_stack_v2_python_sparse | davos/core/parsers.py | ContextLab/davos | train | 26 |
819ac6b07b4b6d8ae5b5c1b0955ec8bee20864f0 | [
"if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nself.mean = data.mean(axis=1, keepdims=True)\nXi = data - self.mean\nself.cov = np.dot(Xi, Xi.T) / (data.shape... | <|body_start_0|>
if not isinstance(data, np.ndarray) or len(data.shape) != 2:
raise TypeError('data must be a 2D numpy.ndarray')
if data.shape[1] < 2:
raise ValueError('data must contain multiple data points')
self.mean = data.mean(axis=1, keepdims=True)
Xi = data... | class that represents a Multivariate Normal distribution | MultiNormal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiNormal:
"""class that represents a Multivariate Normal distribution"""
def __init__(self, data):
"""initialization"""
<|body_0|>
def pdf(self, x):
"""Probability density Function"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not isinst... | stack_v2_sparse_classes_36k_train_007397 | 1,189 | no_license | [
{
"docstring": "initialization",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "Probability density Function",
"name": "pdf",
"signature": "def pdf(self, x)"
}
] | 2 | null | Implement the Python class `MultiNormal` described below.
Class description:
class that represents a Multivariate Normal distribution
Method signatures and docstrings:
- def __init__(self, data): initialization
- def pdf(self, x): Probability density Function | Implement the Python class `MultiNormal` described below.
Class description:
class that represents a Multivariate Normal distribution
Method signatures and docstrings:
- def __init__(self, data): initialization
- def pdf(self, x): Probability density Function
<|skeleton|>
class MultiNormal:
"""class that represe... | d45e18bcbe1898a1585e4b7b61f3a7af9f00e787 | <|skeleton|>
class MultiNormal:
"""class that represents a Multivariate Normal distribution"""
def __init__(self, data):
"""initialization"""
<|body_0|>
def pdf(self, x):
"""Probability density Function"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiNormal:
"""class that represents a Multivariate Normal distribution"""
def __init__(self, data):
"""initialization"""
if not isinstance(data, np.ndarray) or len(data.shape) != 2:
raise TypeError('data must be a 2D numpy.ndarray')
if data.shape[1] < 2:
... | the_stack_v2_python_sparse | math/0x06-multivariate_prob/multinormal.py | jlassi1/holbertonschool-machine_learning | train | 1 |
f612d9de6520e811538ca6a8c3196fb44c807788 | [
"assert da.getDim() == 1\nself.da = da\nself.params = params\nself.factor = factor\nself.dx = dx\nself.localX = da.createLocalVec()\nself.xs, self.xe = self.da.getRanges()[0]\nself.mx = self.da.getSizes()[0]\nself.row = PETSc.Mat.Stencil()\nself.col = PETSc.Mat.Stencil()",
"self.da.globalToLocal(X, self.localX)\n... | <|body_start_0|>
assert da.getDim() == 1
self.da = da
self.params = params
self.factor = factor
self.dx = dx
self.localX = da.createLocalVec()
self.xs, self.xe = self.da.getRanges()[0]
self.mx = self.da.getSizes()[0]
self.row = PETSc.Mat.Stencil()
... | Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES | Fisher_full | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, params, factor, dx):
"""Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x dire... | stack_v2_sparse_classes_36k_train_007398 | 18,877 | permissive | [
{
"docstring": "Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x direction",
"name": "__init__",
"signature": "def __init__(self, da, params, factor, dx)"
},
{
"docstring": "Function to evaluate the residual for the New... | 3 | stack_v2_sparse_classes_30k_train_011118 | Implement the Python class `Fisher_full` described below.
Class description:
Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES
Method signatures and docstrings:
- def __init__(self, da, params, factor, dx): Initialization routine Args: da: DMDA object params: problem parameters f... | Implement the Python class `Fisher_full` described below.
Class description:
Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES
Method signatures and docstrings:
- def __init__(self, da, params, factor, dx): Initialization routine Args: da: DMDA object params: problem parameters f... | de2cd523411276083355389d7e7993106cedf93d | <|skeleton|>
class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, params, factor, dx):
"""Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x dire... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Fisher_full:
"""Helper class to generate residual and Jacobian matrix for PETSc's nonlinear solver SNES"""
def __init__(self, da, params, factor, dx):
"""Initialization routine Args: da: DMDA object params: problem parameters factor: temporal factor (dt*Qd) dx: grid spacing in x direction"""
... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/GeneralizedFisher_1D_PETSc.py | ruthschoebel/pySDC | train | 0 |
737d9a4e631096ec48bf477f265f3869d285174c | [
"super().__init__(machine, name)\nself.shows_queue = deque()\nself._current_show = None",
"self.shows_queue.append((show_config, start_step))\nif not self._current_show:\n self._play_next_show()",
"if not self.shows_queue:\n self._current_show = None\n return\nshow_config, start_step = self.shows_queue... | <|body_start_0|>
super().__init__(machine, name)
self.shows_queue = deque()
self._current_show = None
<|end_body_0|>
<|body_start_1|>
self.shows_queue.append((show_config, start_step))
if not self._current_show:
self._play_next_show()
<|end_body_1|>
<|body_start_2|>... | Represents a show queue. | ShowQueue | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShowQueue:
"""Represents a show queue."""
def __init__(self, machine, name):
"""Initialise show queue."""
<|body_0|>
def enqueue_show(self, show_config: ShowConfig, start_step: int):
"""Add a show to the end of the queue."""
<|body_1|>
def _play_next... | stack_v2_sparse_classes_36k_train_007399 | 1,602 | permissive | [
{
"docstring": "Initialise show queue.",
"name": "__init__",
"signature": "def __init__(self, machine, name)"
},
{
"docstring": "Add a show to the end of the queue.",
"name": "enqueue_show",
"signature": "def enqueue_show(self, show_config: ShowConfig, start_step: int)"
},
{
"doc... | 3 | stack_v2_sparse_classes_30k_test_000706 | Implement the Python class `ShowQueue` described below.
Class description:
Represents a show queue.
Method signatures and docstrings:
- def __init__(self, machine, name): Initialise show queue.
- def enqueue_show(self, show_config: ShowConfig, start_step: int): Add a show to the end of the queue.
- def _play_next_sho... | Implement the Python class `ShowQueue` described below.
Class description:
Represents a show queue.
Method signatures and docstrings:
- def __init__(self, machine, name): Initialise show queue.
- def enqueue_show(self, show_config: ShowConfig, start_step: int): Add a show to the end of the queue.
- def _play_next_sho... | 9f90c8b1586363b65340017bfa3af5d56d32c6d9 | <|skeleton|>
class ShowQueue:
"""Represents a show queue."""
def __init__(self, machine, name):
"""Initialise show queue."""
<|body_0|>
def enqueue_show(self, show_config: ShowConfig, start_step: int):
"""Add a show to the end of the queue."""
<|body_1|>
def _play_next... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShowQueue:
"""Represents a show queue."""
def __init__(self, machine, name):
"""Initialise show queue."""
super().__init__(machine, name)
self.shows_queue = deque()
self._current_show = None
def enqueue_show(self, show_config: ShowConfig, start_step: int):
"""... | the_stack_v2_python_sparse | mpf/devices/show_queue.py | missionpinball/mpf | train | 191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.