blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d98a1523dbb4a5fbc7014c7adf33fa9261ef881c | [
"self.now = datetime.datetime.now()\nself.current_date = self.now.strftime('%Y%m%d')\nself.patch_date = self.now.strftime('%Y%m15')\nself.checkJan = self.now.strftime('%m')\nself.checkJan = int(self.checkJan)",
"if self.checkJan == 1:\n if int(self.now.strftime('%d')) < 15:\n recent_release_date = self.... | <|body_start_0|>
self.now = datetime.datetime.now()
self.current_date = self.now.strftime('%Y%m%d')
self.patch_date = self.now.strftime('%Y%m15')
self.checkJan = self.now.strftime('%m')
self.checkJan = int(self.checkJan)
<|end_body_0|>
<|body_start_1|>
if self.checkJan =... | Get this months and last months release date. | ReleaseDate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReleaseDate:
"""Get this months and last months release date."""
def __init__(self):
"""Get date object."""
<|body_0|>
def get_current_release(self):
"""Return this months release date."""
<|body_1|>
def get_last_relesae(self):
"""Return last... | stack_v2_sparse_classes_75kplus_train_073500 | 5,886 | no_license | [
{
"docstring": "Get date object.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Return this months release date.",
"name": "get_current_release",
"signature": "def get_current_release(self)"
},
{
"docstring": "Return last months release date.",
"na... | 3 | stack_v2_sparse_classes_30k_train_015376 | Implement the Python class `ReleaseDate` described below.
Class description:
Get this months and last months release date.
Method signatures and docstrings:
- def __init__(self): Get date object.
- def get_current_release(self): Return this months release date.
- def get_last_relesae(self): Return last months release... | Implement the Python class `ReleaseDate` described below.
Class description:
Get this months and last months release date.
Method signatures and docstrings:
- def __init__(self): Get date object.
- def get_current_release(self): Return this months release date.
- def get_last_relesae(self): Return last months release... | 6e4e98ca0aeb54e293769c04c7f34c3369ba06d7 | <|skeleton|>
class ReleaseDate:
"""Get this months and last months release date."""
def __init__(self):
"""Get date object."""
<|body_0|>
def get_current_release(self):
"""Return this months release date."""
<|body_1|>
def get_last_relesae(self):
"""Return last... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReleaseDate:
"""Get this months and last months release date."""
def __init__(self):
"""Get date object."""
self.now = datetime.datetime.now()
self.current_date = self.now.strftime('%Y%m%d')
self.patch_date = self.now.strftime('%Y%m15')
self.checkJan = self.now.str... | the_stack_v2_python_sparse | repo_changelog.py | kerringtonwells/Python-Ruby_code | train | 0 |
7ff391c97e7b508094939678f69a82a783c729ab | [
"self.sigma_ = sigma_\nself.lambda_ = lambda_\nself.fitsigma = fitsigma\nself.fitlambda = fitlambda\nself.coef_ = coef_\nself.intercept_ = intercept_",
"X = np.array(X)\nY = np.array(Y)\nif len(X.shape) == 1:\n X = X.reshape(-1, 1)\nself.X = np.append(X, np.ones((X.shape[0], 1)), axis=1)\nself.updateW(Y=Y)\nif... | <|body_start_0|>
self.sigma_ = sigma_
self.lambda_ = lambda_
self.fitsigma = fitsigma
self.fitlambda = fitlambda
self.coef_ = coef_
self.intercept_ = intercept_
<|end_body_0|>
<|body_start_1|>
X = np.array(X)
Y = np.array(Y)
if len(X.shape) == 1:
... | BayesianRegress | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BayesianRegress:
def __init__(self, lambda_=0.1, sigma_=2.5, coef_=None, intercept_=None, fitsigma=True, fitlambda=False):
"""Initialize a Bayesian regressor. _lambda: L2 constrains of weights _sigma: square root of variance."""
<|body_0|>
def fit(self, X, Y):
"""Fit... | stack_v2_sparse_classes_75kplus_train_073501 | 15,651 | permissive | [
{
"docstring": "Initialize a Bayesian regressor. _lambda: L2 constrains of weights _sigma: square root of variance.",
"name": "__init__",
"signature": "def __init__(self, lambda_=0.1, sigma_=2.5, coef_=None, intercept_=None, fitsigma=True, fitlambda=False)"
},
{
"docstring": "Fit the model.",
... | 4 | stack_v2_sparse_classes_30k_train_024906 | Implement the Python class `BayesianRegress` described below.
Class description:
Implement the BayesianRegress class.
Method signatures and docstrings:
- def __init__(self, lambda_=0.1, sigma_=2.5, coef_=None, intercept_=None, fitsigma=True, fitlambda=False): Initialize a Bayesian regressor. _lambda: L2 constrains of... | Implement the Python class `BayesianRegress` described below.
Class description:
Implement the BayesianRegress class.
Method signatures and docstrings:
- def __init__(self, lambda_=0.1, sigma_=2.5, coef_=None, intercept_=None, fitsigma=True, fitlambda=False): Initialize a Bayesian regressor. _lambda: L2 constrains of... | 06559cef6a43888f015117f25734125f95b34484 | <|skeleton|>
class BayesianRegress:
def __init__(self, lambda_=0.1, sigma_=2.5, coef_=None, intercept_=None, fitsigma=True, fitlambda=False):
"""Initialize a Bayesian regressor. _lambda: L2 constrains of weights _sigma: square root of variance."""
<|body_0|>
def fit(self, X, Y):
"""Fit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BayesianRegress:
def __init__(self, lambda_=0.1, sigma_=2.5, coef_=None, intercept_=None, fitsigma=True, fitlambda=False):
"""Initialize a Bayesian regressor. _lambda: L2 constrains of weights _sigma: square root of variance."""
self.sigma_ = sigma_
self.lambda_ = lambda_
self.... | the_stack_v2_python_sparse | brie/version1/model_brie.py | huangyh09/brie | train | 45 | |
f0362e83c1bb9dd18bd7a8905f7914bffc39383d | [
"query = request.args.get('query')\ndept = request.args.get('department')\nif query is None:\n abort(400)\ntry:\n if dept is not None:\n dept_filter = set([x.strip() for x in dept.split(',')])\n else:\n dept_filter = set()\nexcept:\n abort(400)\nq_parser = parser.QueryParser()\nq_builder =... | <|body_start_0|>
query = request.args.get('query')
dept = request.args.get('department')
if query is None:
abort(400)
try:
if dept is not None:
dept_filter = set([x.strip() for x in dept.split(',')])
else:
dept_filter = ... | Contains methods for performing search over keywords. | SearchAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchAPI:
"""Contains methods for performing search over keywords."""
def get(self):
"""HTTP Get that enables boolean query processing and search."""
<|body_0|>
def get_faculty_with_keywords(response):
"""Builds a dictionary of faculty ids to list of all keyword... | stack_v2_sparse_classes_75kplus_train_073502 | 4,959 | no_license | [
{
"docstring": "HTTP Get that enables boolean query processing and search.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Builds a dictionary of faculty ids to list of all keywords. Finds all keywords that belong to a professor, and creates a list. The list contains the json re... | 4 | stack_v2_sparse_classes_30k_train_027762 | Implement the Python class `SearchAPI` described below.
Class description:
Contains methods for performing search over keywords.
Method signatures and docstrings:
- def get(self): HTTP Get that enables boolean query processing and search.
- def get_faculty_with_keywords(response): Builds a dictionary of faculty ids t... | Implement the Python class `SearchAPI` described below.
Class description:
Contains methods for performing search over keywords.
Method signatures and docstrings:
- def get(self): HTTP Get that enables boolean query processing and search.
- def get_faculty_with_keywords(response): Builds a dictionary of faculty ids t... | 54481dfd88637572b92b8e17ba6ef6458fade9a4 | <|skeleton|>
class SearchAPI:
"""Contains methods for performing search over keywords."""
def get(self):
"""HTTP Get that enables boolean query processing and search."""
<|body_0|>
def get_faculty_with_keywords(response):
"""Builds a dictionary of faculty ids to list of all keyword... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SearchAPI:
"""Contains methods for performing search over keywords."""
def get(self):
"""HTTP Get that enables boolean query processing and search."""
query = request.args.get('query')
dept = request.args.get('department')
if query is None:
abort(400)
t... | the_stack_v2_python_sparse | web/bfex/blueprints/search_api.py | MandyMeindersma/BFEX | train | 0 |
e75b195857bc5b39955c42f6062fbd425a0a51d2 | [
"BaseWorkerThread.__init__(self)\nself.queue = queue\nself.config = config\nself.reqmgr2Svc = ReqMgr(self.config.TaskArchiver.ReqMgr2ServiceURL)\nself.abortedAndForceCompleteWorkflowCache = self.reqmgr2Svc.getAbortedAndForceCompleteRequestsFromMemoryCache()",
"t = random.randrange(self.idleTime)\nself.logger.info... | <|body_start_0|>
BaseWorkerThread.__init__(self)
self.queue = queue
self.config = config
self.reqmgr2Svc = ReqMgr(self.config.TaskArchiver.ReqMgr2ServiceURL)
self.abortedAndForceCompleteWorkflowCache = self.reqmgr2Svc.getAbortedAndForceCompleteRequestsFromMemoryCache()
<|end_body... | Cleans expired items, updates element status. | WorkQueueManagerCleaner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkQueueManagerCleaner:
"""Cleans expired items, updates element status."""
def __init__(self, queue, config):
"""Initialise class members"""
<|body_0|>
def setup(self, parameters):
"""Called at startup - introduce random delay to avoid workers all starting at o... | stack_v2_sparse_classes_75kplus_train_073503 | 1,967 | no_license | [
{
"docstring": "Initialise class members",
"name": "__init__",
"signature": "def __init__(self, queue, config)"
},
{
"docstring": "Called at startup - introduce random delay to avoid workers all starting at once",
"name": "setup",
"signature": "def setup(self, parameters)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_002009 | Implement the Python class `WorkQueueManagerCleaner` described below.
Class description:
Cleans expired items, updates element status.
Method signatures and docstrings:
- def __init__(self, queue, config): Initialise class members
- def setup(self, parameters): Called at startup - introduce random delay to avoid work... | Implement the Python class `WorkQueueManagerCleaner` described below.
Class description:
Cleans expired items, updates element status.
Method signatures and docstrings:
- def __init__(self, queue, config): Initialise class members
- def setup(self, parameters): Called at startup - introduce random delay to avoid work... | f4cb398de940560e40491ba676b704e1489d4682 | <|skeleton|>
class WorkQueueManagerCleaner:
"""Cleans expired items, updates element status."""
def __init__(self, queue, config):
"""Initialise class members"""
<|body_0|>
def setup(self, parameters):
"""Called at startup - introduce random delay to avoid workers all starting at o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorkQueueManagerCleaner:
"""Cleans expired items, updates element status."""
def __init__(self, queue, config):
"""Initialise class members"""
BaseWorkerThread.__init__(self)
self.queue = queue
self.config = config
self.reqmgr2Svc = ReqMgr(self.config.TaskArchiver.... | the_stack_v2_python_sparse | src/python/WMComponent/WorkQueueManager/WorkQueueManagerCleaner.py | PerilousApricot/WMCore | train | 1 |
6954075ed633ef7d574a394375cad9ef39f664bf | [
"self.name = interpara['Name']\nself.nodenum1, self.nodenum2 = (network1.demandnum, network2.supplynum)\nself.network1, self.network2 = (network1, network2)\nself.nearestnum = interpara['dependnum']\nself.Distmatrix()\nself.Adjmatrix()\nself.create_edgelist()",
"self.distmatrix = np.zeros((self.nodenum1, self.nod... | <|body_start_0|>
self.name = interpara['Name']
self.nodenum1, self.nodenum2 = (network1.demandnum, network2.supplynum)
self.network1, self.network2 = (network1, network2)
self.nearestnum = interpara['dependnum']
self.Distmatrix()
self.Adjmatrix()
self.create_edgel... | phynode2node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class phynode2node:
def __init__(self, network1, network2, interpara):
"""Define the object of the physical dependency between nodes and nodes Input: network1, network2 - two python objects, network1 serves for network2 interpara - dictionary, the parameters for defining interdependency betwee... | stack_v2_sparse_classes_75kplus_train_073504 | 8,644 | no_license | [
{
"docstring": "Define the object of the physical dependency between nodes and nodes Input: network1, network2 - two python objects, network1 serves for network2 interpara - dictionary, the parameters for defining interdependency between network1 and network2 Output: the object of physical interdependency",
... | 4 | stack_v2_sparse_classes_30k_train_039739 | Implement the Python class `phynode2node` described below.
Class description:
Implement the phynode2node class.
Method signatures and docstrings:
- def __init__(self, network1, network2, interpara): Define the object of the physical dependency between nodes and nodes Input: network1, network2 - two python objects, ne... | Implement the Python class `phynode2node` described below.
Class description:
Implement the phynode2node class.
Method signatures and docstrings:
- def __init__(self, network1, network2, interpara): Define the object of the physical dependency between nodes and nodes Input: network1, network2 - two python objects, ne... | 8d8dc350856c449148721cfba4f76eb7e27989b4 | <|skeleton|>
class phynode2node:
def __init__(self, network1, network2, interpara):
"""Define the object of the physical dependency between nodes and nodes Input: network1, network2 - two python objects, network1 serves for network2 interpara - dictionary, the parameters for defining interdependency betwee... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class phynode2node:
def __init__(self, network1, network2, interpara):
"""Define the object of the physical dependency between nodes and nodes Input: network1, network2 - two python objects, network1 serves for network2 interpara - dictionary, the parameters for defining interdependency between network1 and... | the_stack_v2_python_sparse | interdependency.py | YuWVandy/Infrastructure-network-simulation | train | 3 | |
07f0fc301575c125fe0bd6abdad01c376fa29d8f | [
"AssessmentResults.__init__(self, controller, **kwargs)\nself._lst_labels.append(u'π<sub>U</sub>:')\nself._lst_labels.append(u'π<sub>A</sub>:')\nself._lblModel.set_tooltip_markup(_(u'The assessment model used to calculate the hardware item failure rate.'))\nself.txtPiU = ramstk.RAMSTKEntry(width=125, editable=False... | <|body_start_0|>
AssessmentResults.__init__(self, controller, **kwargs)
self._lst_labels.append(u'π<sub>U</sub>:')
self._lst_labels.append(u'π<sub>A</sub>:')
self._lblModel.set_tooltip_markup(_(u'The assessment model used to calculate the hardware item failure rate.'))
self.txtPi... | Display Misc assessment results attribute data in the RAMSTK Work Book. The Miscellaneous hardware item assessment result view displays all the assessment results for the selected miscellaneous hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The ... | MiscAssessmentResults | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MiscAssessmentResults:
"""Display Misc assessment results attribute data in the RAMSTK Work Book. The Miscellaneous hardware item assessment result view displays all the assessment results for the selected miscellaneous hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts co... | stack_v2_sparse_classes_75kplus_train_073505 | 18,511 | permissive | [
{
"docstring": "Initialize an instance of the Miscellaneous assessment result view. :param controller: the hardware data controller instance. :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController`",
"name": "__init__",
"signature": "def __init__(self, controller, **kwargs)"
},... | 5 | stack_v2_sparse_classes_30k_train_043642 | Implement the Python class `MiscAssessmentResults` described below.
Class description:
Display Misc assessment results attribute data in the RAMSTK Work Book. The Miscellaneous hardware item assessment result view displays all the assessment results for the selected miscellaneous hardware item. This includes, currentl... | Implement the Python class `MiscAssessmentResults` described below.
Class description:
Display Misc assessment results attribute data in the RAMSTK Work Book. The Miscellaneous hardware item assessment result view displays all the assessment results for the selected miscellaneous hardware item. This includes, currentl... | 488ffed8b842399ddcae93007de6c6f1dda23d05 | <|skeleton|>
class MiscAssessmentResults:
"""Display Misc assessment results attribute data in the RAMSTK Work Book. The Miscellaneous hardware item assessment result view displays all the assessment results for the selected miscellaneous hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MiscAssessmentResults:
"""Display Misc assessment results attribute data in the RAMSTK Work Book. The Miscellaneous hardware item assessment result view displays all the assessment results for the selected miscellaneous hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-H... | the_stack_v2_python_sparse | src/ramstk/gui/gtk/workviews/components/Miscellaneous.py | JmiXIII/ramstk | train | 0 |
ae734686acc72409694c7301a992e4b8d7b19ab9 | [
"threading.Thread.__init__(self)\nself.daemon = True\nself.queueIn = queueIn\nself.queueOut = queueOut\nself.proxyList = proxyList\nself.rxList = [re.compile(item) for item in googleResultsStrList]",
"while not self.queueIn.empty():\n host = self.queueIn.get()\n data = self.GetData(host)\n print('- %s: %... | <|body_start_0|>
threading.Thread.__init__(self)
self.daemon = True
self.queueIn = queueIn
self.queueOut = queueOut
self.proxyList = proxyList
self.rxList = [re.compile(item) for item in googleResultsStrList]
<|end_body_0|>
<|body_start_1|>
while not self.queueIn... | Поточный чекер кейвордов в гугле | KeywordsChecker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeywordsChecker:
"""Поточный чекер кейвордов в гугле"""
def __init__(self, queueIn, queueOut, proxyList):
"""Инициализация"""
<|body_0|>
def run(self):
"""Обработка очередей"""
<|body_1|>
def GetData(self, host):
"""Делаем запрос в гугл"""
... | stack_v2_sparse_classes_75kplus_train_073506 | 10,867 | no_license | [
{
"docstring": "Инициализация",
"name": "__init__",
"signature": "def __init__(self, queueIn, queueOut, proxyList)"
},
{
"docstring": "Обработка очередей",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Делаем запрос в гугл",
"name": "GetData",
"signature"... | 3 | stack_v2_sparse_classes_30k_train_027379 | Implement the Python class `KeywordsChecker` described below.
Class description:
Поточный чекер кейвордов в гугле
Method signatures and docstrings:
- def __init__(self, queueIn, queueOut, proxyList): Инициализация
- def run(self): Обработка очередей
- def GetData(self, host): Делаем запрос в гугл | Implement the Python class `KeywordsChecker` described below.
Class description:
Поточный чекер кейвордов в гугле
Method signatures and docstrings:
- def __init__(self, queueIn, queueOut, proxyList): Инициализация
- def run(self): Обработка очередей
- def GetData(self, host): Делаем запрос в гугл
<|skeleton|>
class ... | d2771bf04aa187dda6d468883a5a167237589369 | <|skeleton|>
class KeywordsChecker:
"""Поточный чекер кейвордов в гугле"""
def __init__(self, queueIn, queueOut, proxyList):
"""Инициализация"""
<|body_0|>
def run(self):
"""Обработка очередей"""
<|body_1|>
def GetData(self, host):
"""Делаем запрос в гугл"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KeywordsChecker:
"""Поточный чекер кейвордов в гугле"""
def __init__(self, queueIn, queueOut, proxyList):
"""Инициализация"""
threading.Thread.__init__(self)
self.daemon = True
self.queueIn = queueIn
self.queueOut = queueOut
self.proxyList = proxyList
... | the_stack_v2_python_sparse | tools/freehostsfinder.py | cash2one/doorscenter | train | 0 |
3e126d7c065d57b06aa1a8392fef0777e8331f09 | [
"def produce(nums, target, current, output):\n if target == 0:\n output.append(list(current))\n return\n for i, n in enumerate(nums):\n if n > target:\n continue\n if i > 0 and nums[i] == nums[i - 1]:\n continue\n current.append(n)\n produce(nums... | <|body_start_0|>
def produce(nums, target, current, output):
if target == 0:
output.append(list(current))
return
for i, n in enumerate(nums):
if n > target:
continue
if i > 0 and nums[i] == nums[i - 1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combinationSum2(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def combinationSum2_TLE(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]... | stack_v2_sparse_classes_75kplus_train_073507 | 2,534 | no_license | [
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]",
"name": "combinationSum2",
"signature": "def combinationSum2(self, candidates, target)"
},
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]",
"name": "combinationSum2_... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum2(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def combinationSum2_TLE(self, candidates, target): :type ca... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum2(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def combinationSum2_TLE(self, candidates, target): :type ca... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def combinationSum2(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def combinationSum2_TLE(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def combinationSum2(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
def produce(nums, target, current, output):
if target == 0:
output.append(list(current))
return
for i, n ... | the_stack_v2_python_sparse | src/lt_40.py | oxhead/CodingYourWay | train | 0 | |
aaa925a9ae2e34e06ea4169268b04819d356d2f5 | [
"snap = super(Notebook, self).snapshot()\nsnap['tab_style'] = self.tab_style\nsnap['tab_position'] = self.tab_position\nsnap['tabs_closable'] = self.tabs_closable\nsnap['tabs_movable'] = self.tabs_movable\nreturn snap",
"super(Notebook, self).bind()\nattrs = ('tab_style', 'tab_position', 'tabs_closable', 'tabs_mo... | <|body_start_0|>
snap = super(Notebook, self).snapshot()
snap['tab_style'] = self.tab_style
snap['tab_position'] = self.tab_position
snap['tabs_closable'] = self.tabs_closable
snap['tabs_movable'] = self.tabs_movable
return snap
<|end_body_0|>
<|body_start_1|>
su... | A component which displays its children as tabbed pages. | Notebook | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notebook:
"""A component which displays its children as tabbed pages."""
def snapshot(self):
"""Returns the snapshot for the control."""
<|body_0|>
def bind(self):
"""Bind the change handlers for the control."""
<|body_1|>
def _get_pages(self):
... | stack_v2_sparse_classes_75kplus_train_073508 | 2,869 | permissive | [
{
"docstring": "Returns the snapshot for the control.",
"name": "snapshot",
"signature": "def snapshot(self)"
},
{
"docstring": "Bind the change handlers for the control.",
"name": "bind",
"signature": "def bind(self)"
},
{
"docstring": "The getter for the 'pages' property. Retur... | 3 | stack_v2_sparse_classes_30k_train_028444 | Implement the Python class `Notebook` described below.
Class description:
A component which displays its children as tabbed pages.
Method signatures and docstrings:
- def snapshot(self): Returns the snapshot for the control.
- def bind(self): Bind the change handlers for the control.
- def _get_pages(self): The gette... | Implement the Python class `Notebook` described below.
Class description:
A component which displays its children as tabbed pages.
Method signatures and docstrings:
- def snapshot(self): Returns the snapshot for the control.
- def bind(self): Bind the change handlers for the control.
- def _get_pages(self): The gette... | 424bba29219de58fe9e47196de6763de8b2009f2 | <|skeleton|>
class Notebook:
"""A component which displays its children as tabbed pages."""
def snapshot(self):
"""Returns the snapshot for the control."""
<|body_0|>
def bind(self):
"""Bind the change handlers for the control."""
<|body_1|>
def _get_pages(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Notebook:
"""A component which displays its children as tabbed pages."""
def snapshot(self):
"""Returns the snapshot for the control."""
snap = super(Notebook, self).snapshot()
snap['tab_style'] = self.tab_style
snap['tab_position'] = self.tab_position
snap['tabs_c... | the_stack_v2_python_sparse | enaml/widgets/notebook.py | enthought/enaml | train | 17 |
85220137e0044094a85969f0a3b98fc903409506 | [
"api = '/corp/list'\ndata = {'page': 1, 'limit': 10}\nres = run_method.post(api, data, headers=super_header)\nself.assertEqual(res.status_code, 200, run_method.errInfo(res))",
"api = '/corp/list'\ndata = {'page': 1, 'limit': 10}\nres = run_method.post(api, data, headers=corp_header)\nself.assertEqual(res.status_c... | <|body_start_0|>
api = '/corp/list'
data = {'page': 1, 'limit': 10}
res = run_method.post(api, data, headers=super_header)
self.assertEqual(res.status_code, 200, run_method.errInfo(res))
<|end_body_0|>
<|body_start_1|>
api = '/corp/list'
data = {'page': 1, 'limit': 10}
... | TestCorpList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCorpList:
def test01_corp_list_super_success(self):
"""case01:组列表[RSM]--超管查询成功"""
<|body_0|>
def test02_corp_list_rcm_success(self):
"""case02:组列表[RCM]--组织管理员查询成功"""
<|body_1|>
def test03_corp_list_common_success(self):
"""case03:组列表[普通用户]--普... | stack_v2_sparse_classes_75kplus_train_073509 | 24,092 | no_license | [
{
"docstring": "case01:组列表[RSM]--超管查询成功",
"name": "test01_corp_list_super_success",
"signature": "def test01_corp_list_super_success(self)"
},
{
"docstring": "case02:组列表[RCM]--组织管理员查询成功",
"name": "test02_corp_list_rcm_success",
"signature": "def test02_corp_list_rcm_success(self)"
},
... | 3 | null | Implement the Python class `TestCorpList` described below.
Class description:
Implement the TestCorpList class.
Method signatures and docstrings:
- def test01_corp_list_super_success(self): case01:组列表[RSM]--超管查询成功
- def test02_corp_list_rcm_success(self): case02:组列表[RCM]--组织管理员查询成功
- def test03_corp_list_common_succe... | Implement the Python class `TestCorpList` described below.
Class description:
Implement the TestCorpList class.
Method signatures and docstrings:
- def test01_corp_list_super_success(self): case01:组列表[RSM]--超管查询成功
- def test02_corp_list_rcm_success(self): case02:组列表[RCM]--组织管理员查询成功
- def test03_corp_list_common_succe... | d03a4f2e86a701bb113c2ba6e033e6871515705c | <|skeleton|>
class TestCorpList:
def test01_corp_list_super_success(self):
"""case01:组列表[RSM]--超管查询成功"""
<|body_0|>
def test02_corp_list_rcm_success(self):
"""case02:组列表[RCM]--组织管理员查询成功"""
<|body_1|>
def test03_corp_list_common_success(self):
"""case03:组列表[普通用户]--普... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCorpList:
def test01_corp_list_super_success(self):
"""case01:组列表[RSM]--超管查询成功"""
api = '/corp/list'
data = {'page': 1, 'limit': 10}
res = run_method.post(api, data, headers=super_header)
self.assertEqual(res.status_code, 200, run_method.errInfo(res))
def test0... | the_stack_v2_python_sparse | atd_test/test_corp.py | cxdtotsj/DatatronInterface | train | 0 | |
764c41604b208d8213ea86323bdfb5630bd0a7dd | [
"allure.dynamic.title(\"Testing 'save' function: negative\")\nallure.dynamic.severity(allure.severity_level.NORMAL)\nallure.dynamic.description_html('<h3>Codewars badge:</h3><img src=\"https://www.codewars.com/users/myFirstCode/badges/large\"><h3>Test Description:</h3><p></p>')\nwith allure.step('Enter sizes, hd an... | <|body_start_0|>
allure.dynamic.title("Testing 'save' function: negative")
allure.dynamic.severity(allure.severity_level.NORMAL)
allure.dynamic.description_html('<h3>Codewars badge:</h3><img src="https://www.codewars.com/users/myFirstCode/badges/large"><h3>Test Description:</h3><p></p>')
... | Testing 'save' function | SaveTestCase | [
"Unlicense",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SaveTestCase:
"""Testing 'save' function"""
def test_save_negative(self):
"""Testing 'save' function: negative The function should determine how many files of the copy queue you will be able to save into your Hard Disk Drive. :return:"""
<|body_0|>
def test_save_positive... | stack_v2_sparse_classes_75kplus_train_073510 | 3,162 | permissive | [
{
"docstring": "Testing 'save' function: negative The function should determine how many files of the copy queue you will be able to save into your Hard Disk Drive. :return:",
"name": "test_save_negative",
"signature": "def test_save_negative(self)"
},
{
"docstring": "Testing 'save' function: po... | 2 | stack_v2_sparse_classes_30k_train_024662 | Implement the Python class `SaveTestCase` described below.
Class description:
Testing 'save' function
Method signatures and docstrings:
- def test_save_negative(self): Testing 'save' function: negative The function should determine how many files of the copy queue you will be able to save into your Hard Disk Drive. :... | Implement the Python class `SaveTestCase` described below.
Class description:
Testing 'save' function
Method signatures and docstrings:
- def test_save_negative(self): Testing 'save' function: negative The function should determine how many files of the copy queue you will be able to save into your Hard Disk Drive. :... | ba3ea81125b6082d867f0ae34c6c9be15e153966 | <|skeleton|>
class SaveTestCase:
"""Testing 'save' function"""
def test_save_negative(self):
"""Testing 'save' function: negative The function should determine how many files of the copy queue you will be able to save into your Hard Disk Drive. :return:"""
<|body_0|>
def test_save_positive... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SaveTestCase:
"""Testing 'save' function"""
def test_save_negative(self):
"""Testing 'save' function: negative The function should determine how many files of the copy queue you will be able to save into your Hard Disk Drive. :return:"""
allure.dynamic.title("Testing 'save' function: nega... | the_stack_v2_python_sparse | kyu_7/fill_the_hard_disk_drive/test_save.py | qamine-test/codewars | train | 0 |
67337bcd29e905da0b32b73ecd43c7c84ff31c61 | [
"super(KML, self).__init__(gis=gis, url=url)\nself._con = gis\nself._url = url\nif initialize:\n self._init(gis)",
"url = self._url + '/createKmz'\nparams = {'f': 'json', 'kml': kmz_as_json}\nreturn self._con.post(path=url, postdata=params)"
] | <|body_start_0|>
super(KML, self).__init__(gis=gis, url=url)
self._con = gis
self._url = url
if initialize:
self._init(gis)
<|end_body_0|>
<|body_start_1|>
url = self._url + '/createKmz'
params = {'f': 'json', 'kml': kmz_as_json}
return self._con.post... | This resource is a container for all the KMZ files created on the server. | KML | [
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KML:
"""This resource is a container for all the KMZ files created on the server."""
def __init__(self, url, gis, initialize=False):
"""Constructor =============== ==================================================================== **Argument** **Description** --------------- ------... | stack_v2_sparse_classes_75kplus_train_073511 | 2,189 | permissive | [
{
"docstring": "Constructor =============== ==================================================================== **Argument** **Description** --------------- -------------------------------------------------------------------- url Required string. The administration URL for the ArcGIS Server. --------------- --... | 2 | stack_v2_sparse_classes_30k_train_009539 | Implement the Python class `KML` described below.
Class description:
This resource is a container for all the KMZ files created on the server.
Method signatures and docstrings:
- def __init__(self, url, gis, initialize=False): Constructor =============== ===============================================================... | Implement the Python class `KML` described below.
Class description:
This resource is a container for all the KMZ files created on the server.
Method signatures and docstrings:
- def __init__(self, url, gis, initialize=False): Constructor =============== ===============================================================... | a874fe7e5c95196e4de68db2da0e2a05eb70e5d8 | <|skeleton|>
class KML:
"""This resource is a container for all the KMZ files created on the server."""
def __init__(self, url, gis, initialize=False):
"""Constructor =============== ==================================================================== **Argument** **Description** --------------- ------... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KML:
"""This resource is a container for all the KMZ files created on the server."""
def __init__(self, url, gis, initialize=False):
"""Constructor =============== ==================================================================== **Argument** **Description** --------------- -------------------... | the_stack_v2_python_sparse | arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/server/admin/_kml.py | SherbazHashmi/HackathonServer | train | 3 |
7180d87c16adf53abb10af49603bc77db6a29b2a | [
"self.capacity = capacity\nself.size = 0\nself.mem = dict()\nself.head = None\nself.tail = None",
"node.next = self.head\nif self.head:\n self.head.prev = node\nself.head = node\nif self.tail is None:\n self.tail = node",
"if node == self.head and node == self.tail:\n self.head = None\n self.tail = ... | <|body_start_0|>
self.capacity = capacity
self.size = 0
self.mem = dict()
self.head = None
self.tail = None
<|end_body_0|>
<|body_start_1|>
node.next = self.head
if self.head:
self.head.prev = node
self.head = node
if self.tail is None... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def add_node(self, node):
"""Add a node to the head of the DLL"""
<|body_1|>
def remove_node(self, node):
"""Remove a node in the DLL"""
<|body_2|>
def get(... | stack_v2_sparse_classes_75kplus_train_073512 | 3,216 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": "Add a node to the head of the DLL",
"name": "add_node",
"signature": "def add_node(self, node)"
},
{
"docstring": "Remove a node in the DLL",
"name": "remo... | 5 | stack_v2_sparse_classes_30k_train_005183 | 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 add_node(self, node): Add a node to the head of the DLL
- def remove_node(self, node): Remove a node in the DLL
- def get(... | 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 add_node(self, node): Add a node to the head of the DLL
- def remove_node(self, node): Remove a node in the DLL
- def get(... | 43dbcc129de3092d1ef24b95eaf35e20363cbd93 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def add_node(self, node):
"""Add a node to the head of the DLL"""
<|body_1|>
def remove_node(self, node):
"""Remove a node in the DLL"""
<|body_2|>
def get(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.size = 0
self.mem = dict()
self.head = None
self.tail = None
def add_node(self, node):
"""Add a node to the head of the DLL"""
node.next = self.h... | the_stack_v2_python_sparse | lru-cache.py | iyyuan/leetcode-practice | train | 0 | |
86ef541f9a10d722d5ba349005aaccf431cbcedd | [
"descriptions = ru.as_list(descriptions)\nfor td in descriptions:\n td.raptor_id = self.uid\nreturn self._tmgr.submit_workers(descriptions)",
"descriptions = ru.as_list(descriptions)\nfor td in descriptions:\n td.raptor_id = self.uid\nreturn self._tmgr.submit_tasks(descriptions)",
"if not self._pilot:\n ... | <|body_start_0|>
descriptions = ru.as_list(descriptions)
for td in descriptions:
td.raptor_id = self.uid
return self._tmgr.submit_workers(descriptions)
<|end_body_0|>
<|body_start_1|>
descriptions = ru.as_list(descriptions)
for td in descriptions:
td.rapt... | RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptors excel at high throughput executi... | Raptor | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Raptor:
"""RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptor... | stack_v2_sparse_classes_75kplus_train_073513 | 4,123 | permissive | [
{
"docstring": "Submit a set of workers for this `Raptor` instance. Args: descriptions (List[TaskDescription]): ;aunch a raptor worker for each provided description. Returns: List[Tasks]: a list of `rp.Task` instances, one for each created worker task The method will return immediately without waiting for actua... | 3 | stack_v2_sparse_classes_30k_train_049436 | Implement the Python class `Raptor` described below.
Class description:
RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those w... | Implement the Python class `Raptor` described below.
Class description:
RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those w... | 13852db38c96216d62130e370c1385336723b167 | <|skeleton|>
class Raptor:
"""RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Raptor:
"""RAPTOR ('RAPid Task executOR') is a task executor which, other than other RADICAL-Pilot executors can handle function tasks. A `Raptor` must be submitted to a pilot. It will be associated with `RaptorWorker` instances on that pilot and use those workers to rapidly execute tasks. Raptors excel at hi... | the_stack_v2_python_sparse | src/radical/pilot/raptor_tasks.py | radical-cybertools/radical.pilot | train | 58 |
b7b68e5f1863258a816370b5bdb2312a38a752e1 | [
"Property.property_apparitions[property_name] = {}\nProperty.property_apparitions[property_name][SHOULD_BE_IN] = domain\nProperty.property_apparitions[property_name][IS_IN] = []",
"if property_name not in Property.property_apparitions:\n Property.add_property(property_name, domain)\nProperty.property_apparitio... | <|body_start_0|>
Property.property_apparitions[property_name] = {}
Property.property_apparitions[property_name][SHOULD_BE_IN] = domain
Property.property_apparitions[property_name][IS_IN] = []
<|end_body_0|>
<|body_start_1|>
if property_name not in Property.property_apparitions:
... | This class is used to check if all the classes from the domain of a property implement that property. | Property | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Property:
"""This class is used to check if all the classes from the domain of a property implement that property."""
def add_property(property_name: str, domain: List[str]):
"""This method adds a property."""
<|body_0|>
def add_class_to_property(property_name: str, clas... | stack_v2_sparse_classes_75kplus_train_073514 | 1,077 | no_license | [
{
"docstring": "This method adds a property.",
"name": "add_property",
"signature": "def add_property(property_name: str, domain: List[str])"
},
{
"docstring": "This method adds a class to the list of classes that implement the property.",
"name": "add_class_to_property",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_035187 | Implement the Python class `Property` described below.
Class description:
This class is used to check if all the classes from the domain of a property implement that property.
Method signatures and docstrings:
- def add_property(property_name: str, domain: List[str]): This method adds a property.
- def add_class_to_p... | Implement the Python class `Property` described below.
Class description:
This class is used to check if all the classes from the domain of a property implement that property.
Method signatures and docstrings:
- def add_property(property_name: str, domain: List[str]): This method adds a property.
- def add_class_to_p... | 09f12f0d7d2a767a56b2e53d0975dcdb18ef8812 | <|skeleton|>
class Property:
"""This class is used to check if all the classes from the domain of a property implement that property."""
def add_property(property_name: str, domain: List[str]):
"""This method adds a property."""
<|body_0|>
def add_class_to_property(property_name: str, clas... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Property:
"""This class is used to check if all the classes from the domain of a property implement that property."""
def add_property(property_name: str, domain: List[str]):
"""This method adds a property."""
Property.property_apparitions[property_name] = {}
Property.property_app... | the_stack_v2_python_sparse | tools/ontology-validator/utils/property.py | PlatformOfTrust/standards | train | 2 |
52c41950217afca0b46e5a7f0ac7c8af355aa293 | [
"self.array = array\nself.tree = [0 for _ in range(len(self.array) * 4)]\nself.init(self.tree, 0, len(self.array) - 1, 1)\nself.last_index = len(array) - 1",
"if start == end:\n tree[node] = start\n return tree[node]\nmid = (start + end) // 2\nleft = self.init(tree, start, mid, node * 2)\nright = self.init(... | <|body_start_0|>
self.array = array
self.tree = [0 for _ in range(len(self.array) * 4)]
self.init(self.tree, 0, len(self.array) - 1, 1)
self.last_index = len(array) - 1
<|end_body_0|>
<|body_start_1|>
if start == end:
tree[node] = start
return tree[node]
... | A Class used to get partial min of an array and update data ... Attributes ---------- array : list a list which to make a segment tree Methods ------- init(tree, start, end, node) make segment tree from the array. don't call this method directly. min(left, right, node=1, start=0, end=-1) return the partial min of the a... | Segment_Min_Tree | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Segment_Min_Tree:
"""A Class used to get partial min of an array and update data ... Attributes ---------- array : list a list which to make a segment tree Methods ------- init(tree, start, end, node) make segment tree from the array. don't call this method directly. min(left, right, node=1, star... | stack_v2_sparse_classes_75kplus_train_073515 | 4,003 | permissive | [
{
"docstring": "Parameters ---------- array : list the array that you want to make tree",
"name": "__init__",
"signature": "def __init__(self, array)"
},
{
"docstring": "Don't Call This Method Directly",
"name": "init",
"signature": "def init(self, tree, start, end, node)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_006755 | Implement the Python class `Segment_Min_Tree` described below.
Class description:
A Class used to get partial min of an array and update data ... Attributes ---------- array : list a list which to make a segment tree Methods ------- init(tree, start, end, node) make segment tree from the array. don't call this method ... | Implement the Python class `Segment_Min_Tree` described below.
Class description:
A Class used to get partial min of an array and update data ... Attributes ---------- array : list a list which to make a segment tree Methods ------- init(tree, start, end, node) make segment tree from the array. don't call this method ... | 3efa96710e97c8740d6fef69e4afe7a23bfca05f | <|skeleton|>
class Segment_Min_Tree:
"""A Class used to get partial min of an array and update data ... Attributes ---------- array : list a list which to make a segment tree Methods ------- init(tree, start, end, node) make segment tree from the array. don't call this method directly. min(left, right, node=1, star... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Segment_Min_Tree:
"""A Class used to get partial min of an array and update data ... Attributes ---------- array : list a list which to make a segment tree Methods ------- init(tree, start, end, node) make segment tree from the array. don't call this method directly. min(left, right, node=1, start=0, end=-1) ... | the_stack_v2_python_sparse | libs/segment_tree_min.py | yskang/AlgorithmPractice | train | 0 |
4f07e9d0315251659c9848469a42e1ef9330e035 | [
"self.setupchannel()\nself.setupbroadcast(name)\nself.declarechannel()",
"result = self.channel.queue_declare(exclusive=True)\nself.queue_name = result.method.queue\nself.channel.queue_bind(exchange=self._exchangename, queue=self.queue_name)"
] | <|body_start_0|>
self.setupchannel()
self.setupbroadcast(name)
self.declarechannel()
<|end_body_0|>
<|body_start_1|>
result = self.channel.queue_declare(exclusive=True)
self.queue_name = result.method.queue
self.channel.queue_bind(exchange=self._exchangename, queue=self.... | BroadcastListener | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BroadcastListener:
def initialize(self, name):
"""init"""
<|body_0|>
def declarechannel(self):
"""declare the channel"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.setupchannel()
self.setupbroadcast(name)
self.declarechannel()... | stack_v2_sparse_classes_75kplus_train_073516 | 7,096 | permissive | [
{
"docstring": "init",
"name": "initialize",
"signature": "def initialize(self, name)"
},
{
"docstring": "declare the channel",
"name": "declarechannel",
"signature": "def declarechannel(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_024966 | Implement the Python class `BroadcastListener` described below.
Class description:
Implement the BroadcastListener class.
Method signatures and docstrings:
- def initialize(self, name): init
- def declarechannel(self): declare the channel | Implement the Python class `BroadcastListener` described below.
Class description:
Implement the BroadcastListener class.
Method signatures and docstrings:
- def initialize(self, name): init
- def declarechannel(self): declare the channel
<|skeleton|>
class BroadcastListener:
def initialize(self, name):
... | b53a35b1b051db27d947f2768c96712ad01f2328 | <|skeleton|>
class BroadcastListener:
def initialize(self, name):
"""init"""
<|body_0|>
def declarechannel(self):
"""declare the channel"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BroadcastListener:
def initialize(self, name):
"""init"""
self.setupchannel()
self.setupbroadcast(name)
self.declarechannel()
def declarechannel(self):
"""declare the channel"""
result = self.channel.queue_declare(exclusive=True)
self.queue_name = r... | the_stack_v2_python_sparse | fullcyclepy/helpers/queuehelper.py | shawnmullaney/fullcycle | train | 0 | |
e8665f140f7afa9eefca1c84352b55ab36c86d5d | [
"latlngA = {50.71527036, -2.44427954}\nlatlngB = {50.71520046, -2.44137513}\nexpectedOutput = 0.2\nactualOutput = distance(latlngA, latlngB)\nself.assertTrue(actualOutput < expectedOutput + 0.1 and actualOutput > expectedOutput - 0.1)",
"latlngA = {50.793569, -2.887478}\nlatlngB = {50.065787, -5.712524}\nexpected... | <|body_start_0|>
latlngA = {50.71527036, -2.44427954}
latlngB = {50.71520046, -2.44137513}
expectedOutput = 0.2
actualOutput = distance(latlngA, latlngB)
self.assertTrue(actualOutput < expectedOutput + 0.1 and actualOutput > expectedOutput - 0.1)
<|end_body_0|>
<|body_start_1|>
... | TestModuleDistanceBetween | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestModuleDistanceBetween:
def test_coords(self):
"""Test to make sure distance from geodist module between 2 co-ords is within 0.1 a km of the value from https://gps-coordinates.org/distance-between-coordinates.php"""
<|body_0|>
def test_west_east_coord(self):
"""Te... | stack_v2_sparse_classes_75kplus_train_073517 | 2,204 | no_license | [
{
"docstring": "Test to make sure distance from geodist module between 2 co-ords is within 0.1 a km of the value from https://gps-coordinates.org/distance-between-coordinates.php",
"name": "test_coords",
"signature": "def test_coords(self)"
},
{
"docstring": "Test to make sure co-ds furthest Wes... | 5 | null | Implement the Python class `TestModuleDistanceBetween` described below.
Class description:
Implement the TestModuleDistanceBetween class.
Method signatures and docstrings:
- def test_coords(self): Test to make sure distance from geodist module between 2 co-ords is within 0.1 a km of the value from https://gps-coordin... | Implement the Python class `TestModuleDistanceBetween` described below.
Class description:
Implement the TestModuleDistanceBetween class.
Method signatures and docstrings:
- def test_coords(self): Test to make sure distance from geodist module between 2 co-ords is within 0.1 a km of the value from https://gps-coordin... | b495a6e68de9d15cbf6f6b1b87289bb9f9de842a | <|skeleton|>
class TestModuleDistanceBetween:
def test_coords(self):
"""Test to make sure distance from geodist module between 2 co-ords is within 0.1 a km of the value from https://gps-coordinates.org/distance-between-coordinates.php"""
<|body_0|>
def test_west_east_coord(self):
"""Te... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestModuleDistanceBetween:
def test_coords(self):
"""Test to make sure distance from geodist module between 2 co-ords is within 0.1 a km of the value from https://gps-coordinates.org/distance-between-coordinates.php"""
latlngA = {50.71527036, -2.44427954}
latlngB = {50.71520046, -2.441... | the_stack_v2_python_sparse | src/modules/geodist/geodist_test.py | FebruaryRain/sysdev2coursework | train | 0 | |
f2300951f9be0ea4c4854ee42463fa3b20d68ebc | [
"self.pump = Pump('127.0.0.1', 1000)\nself.sensor = Sensor('127.0.0.2', 2000)\nself.decider = Decider(300, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)",
"self.sensor.measure = MagicMock(return_value=275)\nself.pump.get_state = MagicMock(return_value='PUMP_OFF')\nself.controller.tick ... | <|body_start_0|>
self.pump = Pump('127.0.0.1', 1000)
self.sensor = Sensor('127.0.0.2', 2000)
self.decider = Decider(300, 0.05)
self.controller = Controller(self.sensor, self.pump, self.decider)
<|end_body_0|>
<|body_start_1|>
self.sensor.measure = MagicMock(return_value=275)
... | Module tests for the water-regulation module | ModuleTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModuleTests:
"""Module tests for the water-regulation module"""
def setUp(self):
"""This method does a setup for integration testing raterregulation"""
<|body_0|>
def test_tick(self):
"""This method performs an integration test for tick"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus_train_073518 | 1,011 | no_license | [
{
"docstring": "This method does a setup for integration testing raterregulation",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "This method performs an integration test for tick",
"name": "test_tick",
"signature": "def test_tick(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012119 | Implement the Python class `ModuleTests` described below.
Class description:
Module tests for the water-regulation module
Method signatures and docstrings:
- def setUp(self): This method does a setup for integration testing raterregulation
- def test_tick(self): This method performs an integration test for tick | Implement the Python class `ModuleTests` described below.
Class description:
Module tests for the water-regulation module
Method signatures and docstrings:
- def setUp(self): This method does a setup for integration testing raterregulation
- def test_tick(self): This method performs an integration test for tick
<|sk... | b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1 | <|skeleton|>
class ModuleTests:
"""Module tests for the water-regulation module"""
def setUp(self):
"""This method does a setup for integration testing raterregulation"""
<|body_0|>
def test_tick(self):
"""This method performs an integration test for tick"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModuleTests:
"""Module tests for the water-regulation module"""
def setUp(self):
"""This method does a setup for integration testing raterregulation"""
self.pump = Pump('127.0.0.1', 1000)
self.sensor = Sensor('127.0.0.2', 2000)
self.decider = Decider(300, 0.05)
sel... | the_stack_v2_python_sparse | students/AurelP/lesson6/water-regulation/waterregulation/integrationtest.py | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | train | 4 |
38b369d142e3c97e9cbd451d637630f80b55a8e5 | [
"self.nombre = nombre\nself.exigencia_act = 0\nself.exigencia_tar = 0\nself.prob = prob",
"if random() < self.prob:\n return True\nreturn False"
] | <|body_start_0|>
self.nombre = nombre
self.exigencia_act = 0
self.exigencia_tar = 0
self.prob = prob
<|end_body_0|>
<|body_start_1|>
if random() < self.prob:
return True
return False
<|end_body_1|>
| representa al Malvado Dr. Mavrakis | Coordinador | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Coordinador:
"""representa al Malvado Dr. Mavrakis"""
def __init__(self, nombre, prob):
""":param nombre: nombre del malvado :type nombre: str :param prob: probabilidad de atrasar notas :type prob: float"""
<|body_0|>
def atrasar_notas(self):
"""funcion para deci... | stack_v2_sparse_classes_75kplus_train_073519 | 14,275 | no_license | [
{
"docstring": ":param nombre: nombre del malvado :type nombre: str :param prob: probabilidad de atrasar notas :type prob: float",
"name": "__init__",
"signature": "def __init__(self, nombre, prob)"
},
{
"docstring": "funcion para decidir si atrasar notas o no",
"name": "atrasar_notas",
... | 2 | stack_v2_sparse_classes_30k_train_048637 | Implement the Python class `Coordinador` described below.
Class description:
representa al Malvado Dr. Mavrakis
Method signatures and docstrings:
- def __init__(self, nombre, prob): :param nombre: nombre del malvado :type nombre: str :param prob: probabilidad de atrasar notas :type prob: float
- def atrasar_notas(sel... | Implement the Python class `Coordinador` described below.
Class description:
representa al Malvado Dr. Mavrakis
Method signatures and docstrings:
- def __init__(self, nombre, prob): :param nombre: nombre del malvado :type nombre: str :param prob: probabilidad de atrasar notas :type prob: float
- def atrasar_notas(sel... | 9adac1d0c39ee7afdc38d84853848c1494237aae | <|skeleton|>
class Coordinador:
"""representa al Malvado Dr. Mavrakis"""
def __init__(self, nombre, prob):
""":param nombre: nombre del malvado :type nombre: str :param prob: probabilidad de atrasar notas :type prob: float"""
<|body_0|>
def atrasar_notas(self):
"""funcion para deci... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Coordinador:
"""representa al Malvado Dr. Mavrakis"""
def __init__(self, nombre, prob):
""":param nombre: nombre del malvado :type nombre: str :param prob: probabilidad de atrasar notas :type prob: float"""
self.nombre = nombre
self.exigencia_act = 0
self.exigencia_tar = 0... | the_stack_v2_python_sparse | Tareas/T04/DES.py | jnhasard/IIC2233-Programacion_Avanzada | train | 0 |
323f137b35fe341a868599f7a62c868edeebaf91 | [
"result = {'errcode': 0, 'msg': None}\nid = request.GET.get('id', None)\nqueryset = User.objects.only('id', 'realname').all()\nrole = Role.objects.filter(id=id).first()\nu_list = []\nif role:\n role_users = role.users.only('id').all()\n role_ids = [ru.id for ru in role_users]\n for au in queryset:\n ... | <|body_start_0|>
result = {'errcode': 0, 'msg': None}
id = request.GET.get('id', None)
queryset = User.objects.only('id', 'realname').all()
role = Role.objects.filter(id=id).first()
u_list = []
if role:
role_users = role.users.only('id').all()
role... | GetRoleAllUser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetRoleAllUser:
def get(self, request, **kwargs):
"""获取当前角色的所属用户"""
<|body_0|>
def post(self, request, **kwargs):
"""修改 角色的用户信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = {'errcode': 0, 'msg': None}
id = request.GET.get('id', N... | stack_v2_sparse_classes_75kplus_train_073520 | 6,998 | no_license | [
{
"docstring": "获取当前角色的所属用户",
"name": "get",
"signature": "def get(self, request, **kwargs)"
},
{
"docstring": "修改 角色的用户信息",
"name": "post",
"signature": "def post(self, request, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001148 | Implement the Python class `GetRoleAllUser` described below.
Class description:
Implement the GetRoleAllUser class.
Method signatures and docstrings:
- def get(self, request, **kwargs): 获取当前角色的所属用户
- def post(self, request, **kwargs): 修改 角色的用户信息 | Implement the Python class `GetRoleAllUser` described below.
Class description:
Implement the GetRoleAllUser class.
Method signatures and docstrings:
- def get(self, request, **kwargs): 获取当前角色的所属用户
- def post(self, request, **kwargs): 修改 角色的用户信息
<|skeleton|>
class GetRoleAllUser:
def get(self, request, **kwargs... | 9ceeecd85fdfd52fb90ebac7cc17092476877640 | <|skeleton|>
class GetRoleAllUser:
def get(self, request, **kwargs):
"""获取当前角色的所属用户"""
<|body_0|>
def post(self, request, **kwargs):
"""修改 角色的用户信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetRoleAllUser:
def get(self, request, **kwargs):
"""获取当前角色的所属用户"""
result = {'errcode': 0, 'msg': None}
id = request.GET.get('id', None)
queryset = User.objects.only('id', 'realname').all()
role = Role.objects.filter(id=id).first()
u_list = []
if role:
... | the_stack_v2_python_sparse | user/api.py | vanwt/ttcmdb | train | 1 | |
e5101eb2823b74724e422188dda13b0345cf4723 | [
"threading.Thread.__init__(self)\nself.daemon = True\nself.metaQueue = metaQueue\nself.commandsQueue = commandsQueue\nself.text = text",
"self.commandsQueue.join()\nif self.text:\n common.ThreadSafePrint(self.text)\nself.metaQueue.task_done()"
] | <|body_start_0|>
threading.Thread.__init__(self)
self.daemon = True
self.metaQueue = metaQueue
self.commandsQueue = commandsQueue
self.text = text
<|end_body_0|>
<|body_start_1|>
self.commandsQueue.join()
if self.text:
common.ThreadSafePrint(self.text... | Ожидаем завершения обработки очереди команд и выводим заданный текст | SocialBotLauncherWaitingThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SocialBotLauncherWaitingThread:
"""Ожидаем завершения обработки очереди команд и выводим заданный текст"""
def __init__(self, metaQueue, commandsQueue, text=None):
"""Инициализация"""
<|body_0|>
def run(self):
"""Главный метод"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus_train_073521 | 7,553 | no_license | [
{
"docstring": "Инициализация",
"name": "__init__",
"signature": "def __init__(self, metaQueue, commandsQueue, text=None)"
},
{
"docstring": "Главный метод",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010363 | Implement the Python class `SocialBotLauncherWaitingThread` described below.
Class description:
Ожидаем завершения обработки очереди команд и выводим заданный текст
Method signatures and docstrings:
- def __init__(self, metaQueue, commandsQueue, text=None): Инициализация
- def run(self): Главный метод | Implement the Python class `SocialBotLauncherWaitingThread` described below.
Class description:
Ожидаем завершения обработки очереди команд и выводим заданный текст
Method signatures and docstrings:
- def __init__(self, metaQueue, commandsQueue, text=None): Инициализация
- def run(self): Главный метод
<|skeleton|>
c... | d2771bf04aa187dda6d468883a5a167237589369 | <|skeleton|>
class SocialBotLauncherWaitingThread:
"""Ожидаем завершения обработки очереди команд и выводим заданный текст"""
def __init__(self, metaQueue, commandsQueue, text=None):
"""Инициализация"""
<|body_0|>
def run(self):
"""Главный метод"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SocialBotLauncherWaitingThread:
"""Ожидаем завершения обработки очереди команд и выводим заданный текст"""
def __init__(self, metaQueue, commandsQueue, text=None):
"""Инициализация"""
threading.Thread.__init__(self)
self.daemon = True
self.metaQueue = metaQueue
sel... | the_stack_v2_python_sparse | stumbleupon/botlaunch.py | cash2one/doorscenter | train | 0 |
9f2ee347ef49c508215cb7aebdbbe62734b471cf | [
"serial = []\nq = []\nif root:\n q.append((root, 1))\n serial.append(str(root.val))\n serial.append('None')\nwhile q:\n root, level = q.pop(0)\n if root.children:\n for child in root.children:\n serial.append(str(child.val))\n q.append((child, level + 1))\n serial.appe... | <|body_start_0|>
serial = []
q = []
if root:
q.append((root, 1))
serial.append(str(root.val))
serial.append('None')
while q:
root, level = q.pop(0)
if root.children:
for child in root.children:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus_train_073522 | 1,824 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root: 'Node') -> str"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def des... | 2 | stack_v2_sparse_classes_30k_train_043288 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre... | 920b65db80031fad45d495431eda8d3fb4ef06e5 | <|skeleton|>
class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data: str) -> 'Node':
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root: 'Node') -> str:
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
serial = []
q = []
if root:
q.append((root, 1))
serial.append(str(root.val))
serial.append('None')
while q:
... | the_stack_v2_python_sparse | hard/ex428.py | ziyuan-shen/leetcode_algorithm_python_solution | train | 2 | |
3ae4efa831d26ebb99510e9e375a0af638082e0f | [
"self.connections.add(self)\nif self.application.settings['hide_scoreboard']:\n self.write_message('pause')\nelse:\n self.write_message(Scoreboard.now(self))",
"Scoreboard.update_gamestate(self)\nif self.application.settings['hide_scoreboard']:\n self.write_message('pause')\nelse:\n self.write_message... | <|body_start_0|>
self.connections.add(self)
if self.application.settings['hide_scoreboard']:
self.write_message('pause')
else:
self.write_message(Scoreboard.now(self))
<|end_body_0|>
<|body_start_1|>
Scoreboard.update_gamestate(self)
if self.application.s... | Get Score data via websocket | ScoreboardDataSocketHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScoreboardDataSocketHandler:
"""Get Score data via websocket"""
def open(self):
"""When we receive a new websocket connect"""
<|body_0|>
def on_message(self, message):
"""We ignore messages if there are more than 1 every 3 seconds"""
<|body_1|>
def o... | stack_v2_sparse_classes_75kplus_train_073523 | 14,374 | permissive | [
{
"docstring": "When we receive a new websocket connect",
"name": "open",
"signature": "def open(self)"
},
{
"docstring": "We ignore messages if there are more than 1 every 3 seconds",
"name": "on_message",
"signature": "def on_message(self, message)"
},
{
"docstring": "Lost conn... | 3 | stack_v2_sparse_classes_30k_train_026651 | Implement the Python class `ScoreboardDataSocketHandler` described below.
Class description:
Get Score data via websocket
Method signatures and docstrings:
- def open(self): When we receive a new websocket connect
- def on_message(self, message): We ignore messages if there are more than 1 every 3 seconds
- def on_cl... | Implement the Python class `ScoreboardDataSocketHandler` described below.
Class description:
Get Score data via websocket
Method signatures and docstrings:
- def open(self): When we receive a new websocket connect
- def on_message(self, message): We ignore messages if there are more than 1 every 3 seconds
- def on_cl... | de44dd6ef86dd5b97524d0e438d0441922099930 | <|skeleton|>
class ScoreboardDataSocketHandler:
"""Get Score data via websocket"""
def open(self):
"""When we receive a new websocket connect"""
<|body_0|>
def on_message(self, message):
"""We ignore messages if there are more than 1 every 3 seconds"""
<|body_1|>
def o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScoreboardDataSocketHandler:
"""Get Score data via websocket"""
def open(self):
"""When we receive a new websocket connect"""
self.connections.add(self)
if self.application.settings['hide_scoreboard']:
self.write_message('pause')
else:
self.write_me... | the_stack_v2_python_sparse | handlers/ScoreboardHandlers.py | moloch--/RootTheBox | train | 804 |
387472346d0461269a4b94016b8f09059d456161 | [
"self.w = w\nself.total = sum(w)\nself.l = len(w)",
"seed = random.randint(1, self.total)\ncur = 0\nfor i in range(self.l):\n cur += self.w[i]\n if cur >= seed:\n return i"
] | <|body_start_0|>
self.w = w
self.total = sum(w)
self.l = len(w)
<|end_body_0|>
<|body_start_1|>
seed = random.randint(1, self.total)
cur = 0
for i in range(self.l):
cur += self.w[i]
if cur >= seed:
return i
<|end_body_1|>
| Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.w = w
self.total = sum(w)
self.l = len(w)
<|end_body_0|>
<|body_start_1|>
... | stack_v2_sparse_classes_75kplus_train_073524 | 1,297 | no_license | [
{
"docstring": ":type w: List[int]",
"name": "__init__",
"signature": "def __init__(self, w)"
},
{
"docstring": ":rtype: int",
"name": "pickIndex",
"signature": "def pickIndex(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_033422 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int
<|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|... | fd310ec0a989e003242f1840230aaac150f006f0 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def __init__(self, w):
""":type w: List[int]"""
self.w = w
self.total = sum(w)
self.l = len(w)
def pickIndex(self):
""":rtype: int"""
seed = random.randint(1, self.total)
cur = 0
for i in range(self.l):
cur += self.w[i]... | the_stack_v2_python_sparse | 900plus/RandomPickwithWeight528.py | jing1988a/python_fb | train | 0 | |
8a2bad26db356a136f93881bd8ccbe7413d7b4f2 | [
"self._session = session_obj\nself._ctx_ks = KeyStore(self._session)\nself._ctx_key = KeyObject(self._ctx_ks)\nself.key_obj_mode = apis.kKeyObject_Mode_Persistent",
"if file_name[-4:] != '.pem' and file_name[-4:] != '.der':\n log.error('Unsupported file type. File type should be in pem or der format')\n ret... | <|body_start_0|>
self._session = session_obj
self._ctx_ks = KeyStore(self._session)
self._ctx_key = KeyObject(self._ctx_ks)
self.key_obj_mode = apis.kKeyObject_Mode_Persistent
<|end_body_0|>
<|body_start_1|>
if file_name[-4:] != '.pem' and file_name[-4:] != '.der':
l... | Generate key pair/public key of ecc/rsa | Generate | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Generate:
"""Generate key pair/public key of ecc/rsa"""
def __init__(self, session_obj):
"""Constructor :param session_obj: Instance of session"""
<|body_0|>
def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format=''):
"""Generate ecc public... | stack_v2_sparse_classes_75kplus_train_073525 | 4,479 | permissive | [
{
"docstring": "Constructor :param session_obj: Instance of session",
"name": "__init__",
"signature": "def __init__(self, session_obj)"
},
{
"docstring": "Generate ecc public key :param key_id: Key index :param curve_type: ECC curve type :param file_name: File name to store public key :param po... | 6 | stack_v2_sparse_classes_30k_train_031831 | Implement the Python class `Generate` described below.
Class description:
Generate key pair/public key of ecc/rsa
Method signatures and docstrings:
- def __init__(self, session_obj): Constructor :param session_obj: Instance of session
- def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format='')... | Implement the Python class `Generate` described below.
Class description:
Generate key pair/public key of ecc/rsa
Method signatures and docstrings:
- def __init__(self, session_obj): Constructor :param session_obj: Instance of session
- def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format='')... | ab42459602787e9a557c3a00df40b20a52879fc7 | <|skeleton|>
class Generate:
"""Generate key pair/public key of ecc/rsa"""
def __init__(self, session_obj):
"""Constructor :param session_obj: Instance of session"""
<|body_0|>
def gen_ecc_public(self, key_id, curve_type, file_name, policy, encode_format=''):
"""Generate ecc public... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Generate:
"""Generate key pair/public key of ecc/rsa"""
def __init__(self, session_obj):
"""Constructor :param session_obj: Instance of session"""
self._session = session_obj
self._ctx_ks = KeyStore(self._session)
self._ctx_key = KeyObject(self._ctx_ks)
self.key_ob... | the_stack_v2_python_sparse | src/salt/base/state/secure_element/se05x_sss/sss/genkey.py | autopi-io/autopi-core | train | 141 |
cc61d82a13708eebeb4213bbcbe02f6d367ee491 | [
"load_file = LoadFileValidator(self.value)\nis_file_loaded = load_file.validate()\nself.append_report(load_file)\nif not is_file_loaded:\n return False\nload_yaml = LoadYamlValidator(load_file)\nis_yaml_loaded = load_yaml.validate()\nself.append_report(load_yaml)\nif not is_yaml_loaded:\n return False\nconfig... | <|body_start_0|>
load_file = LoadFileValidator(self.value)
is_file_loaded = load_file.validate()
self.append_report(load_file)
if not is_file_loaded:
return False
load_yaml = LoadYamlValidator(load_file)
is_yaml_loaded = load_yaml.validate()
self.appen... | Validator for an API Map file. Validator for validating a given configuration file. Consists of a FileLoadValidator, a YamlLoadValidator and an ConfigYamlValidator. Attributes: value: The file name or file path as Text. | ProgramConfigValidator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProgramConfigValidator:
"""Validator for an API Map file. Validator for validating a given configuration file. Consists of a FileLoadValidator, a YamlLoadValidator and an ConfigYamlValidator. Attributes: value: The file name or file path as Text."""
def validate(self) -> bool:
"""Val... | stack_v2_sparse_classes_75kplus_train_073526 | 6,733 | no_license | [
{
"docstring": "Validates the value. Validates the value attribute while generating a validation Report. Returns: Whether further Validators may continue validating.",
"name": "validate",
"signature": "def validate(self) -> bool"
},
{
"docstring": "TODO: Fill out",
"name": "result",
"sig... | 2 | stack_v2_sparse_classes_30k_train_050910 | Implement the Python class `ProgramConfigValidator` described below.
Class description:
Validator for an API Map file. Validator for validating a given configuration file. Consists of a FileLoadValidator, a YamlLoadValidator and an ConfigYamlValidator. Attributes: value: The file name or file path as Text.
Method sig... | Implement the Python class `ProgramConfigValidator` described below.
Class description:
Validator for an API Map file. Validator for validating a given configuration file. Consists of a FileLoadValidator, a YamlLoadValidator and an ConfigYamlValidator. Attributes: value: The file name or file path as Text.
Method sig... | 09e970944f8bc07dc565576cb798c6db4f17b347 | <|skeleton|>
class ProgramConfigValidator:
"""Validator for an API Map file. Validator for validating a given configuration file. Consists of a FileLoadValidator, a YamlLoadValidator and an ConfigYamlValidator. Attributes: value: The file name or file path as Text."""
def validate(self) -> bool:
"""Val... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProgramConfigValidator:
"""Validator for an API Map file. Validator for validating a given configuration file. Consists of a FileLoadValidator, a YamlLoadValidator and an ConfigYamlValidator. Attributes: value: The file name or file path as Text."""
def validate(self) -> bool:
"""Validates the va... | the_stack_v2_python_sparse | open_crypto/model/validating/program_config_validator.py | SergejUschakow/open-crypto | train | 0 |
b059c6b0b35c63bb8a47a74000ef2bf9bc9ec4c1 | [
"jump_range = []\nfor i, n in enumerate(nums):\n jump_range.append([i, i + n])\njump_range_sorted = sorted(jump_range, key=lambda x: x[1])\ndp = [[0, 0] for _ in range(len(nums) + 1)]\nfor i in range(len(nums) + 1):\n dp[i][0] = dp[i - 1][0] + (dp[i - 1][1] > i)\n dp[i][1] = max(dp[i - 1][1], jump_range_so... | <|body_start_0|>
jump_range = []
for i, n in enumerate(nums):
jump_range.append([i, i + n])
jump_range_sorted = sorted(jump_range, key=lambda x: x[1])
dp = [[0, 0] for _ in range(len(nums) + 1)]
for i in range(len(nums) + 1):
dp[i][0] = dp[i - 1][0] + (dp[... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump_dp(self, nums) -> int:
"""动态规划思想解决问题 dp[i]: 第i个位置的最小跳跃数、最远距离 dp[i] = 若dp[i-1]最远距离>i,则dp[i-1]否则dp[i-1]+1"""
<|body_0|>
def jump(self, nums) -> int:
"""贪心算法"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
jump_range = []
for... | stack_v2_sparse_classes_75kplus_train_073527 | 2,006 | no_license | [
{
"docstring": "动态规划思想解决问题 dp[i]: 第i个位置的最小跳跃数、最远距离 dp[i] = 若dp[i-1]最远距离>i,则dp[i-1]否则dp[i-1]+1",
"name": "jump_dp",
"signature": "def jump_dp(self, nums) -> int"
},
{
"docstring": "贪心算法",
"name": "jump",
"signature": "def jump(self, nums) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_017575 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump_dp(self, nums) -> int: 动态规划思想解决问题 dp[i]: 第i个位置的最小跳跃数、最远距离 dp[i] = 若dp[i-1]最远距离>i,则dp[i-1]否则dp[i-1]+1
- def jump(self, nums) -> int: 贪心算法 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump_dp(self, nums) -> int: 动态规划思想解决问题 dp[i]: 第i个位置的最小跳跃数、最远距离 dp[i] = 若dp[i-1]最远距离>i,则dp[i-1]否则dp[i-1]+1
- def jump(self, nums) -> int: 贪心算法
<|skeleton|>
class Solution:
... | c9eed637887753eb28d78cf252ea3763231e23a2 | <|skeleton|>
class Solution:
def jump_dp(self, nums) -> int:
"""动态规划思想解决问题 dp[i]: 第i个位置的最小跳跃数、最远距离 dp[i] = 若dp[i-1]最远距离>i,则dp[i-1]否则dp[i-1]+1"""
<|body_0|>
def jump(self, nums) -> int:
"""贪心算法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def jump_dp(self, nums) -> int:
"""动态规划思想解决问题 dp[i]: 第i个位置的最小跳跃数、最远距离 dp[i] = 若dp[i-1]最远距离>i,则dp[i-1]否则dp[i-1]+1"""
jump_range = []
for i, n in enumerate(nums):
jump_range.append([i, i + n])
jump_range_sorted = sorted(jump_range, key=lambda x: x[1])
... | the_stack_v2_python_sparse | CODE/45. 跳跃游戏 II.py | moshlwx/leetcode | train | 5 | |
4fd80bd0ff7b97352ed1bec35d4c6b2f20d3a620 | [
"used_words = set()\nsuggests = []\nfor text, weight in info_tuple:\n if text:\n words = es.indices.analyze(index=index, analyzer='ik_max_word', params={'filter': ['lowercase']}, body=text)\n analyzed_words = set([r['token'] for r in words['tokens'] if len(r['token']) > 1])\n new_words = ana... | <|body_start_0|>
used_words = set()
suggests = []
for text, weight in info_tuple:
if text:
words = es.indices.analyze(index=index, analyzer='ik_max_word', params={'filter': ['lowercase']}, body=text)
analyzed_words = set([r['token'] for r in words['tok... | 将数据写入到es中 | ElasticSearchPipeline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElasticSearchPipeline:
"""将数据写入到es中"""
def gen_suggests(self, index, info_tuple):
"""根据字符串生成搜索建议数组 :param index: :param info_tuple: :return:"""
<|body_0|>
def process_item(self, item, spider):
"""将item转换为es的数据格式 :param item: :param spider: :return:"""
<|b... | stack_v2_sparse_classes_75kplus_train_073528 | 5,067 | no_license | [
{
"docstring": "根据字符串生成搜索建议数组 :param index: :param info_tuple: :return:",
"name": "gen_suggests",
"signature": "def gen_suggests(self, index, info_tuple)"
},
{
"docstring": "将item转换为es的数据格式 :param item: :param spider: :return:",
"name": "process_item",
"signature": "def process_item(self... | 2 | null | Implement the Python class `ElasticSearchPipeline` described below.
Class description:
将数据写入到es中
Method signatures and docstrings:
- def gen_suggests(self, index, info_tuple): 根据字符串生成搜索建议数组 :param index: :param info_tuple: :return:
- def process_item(self, item, spider): 将item转换为es的数据格式 :param item: :param spider: :r... | Implement the Python class `ElasticSearchPipeline` described below.
Class description:
将数据写入到es中
Method signatures and docstrings:
- def gen_suggests(self, index, info_tuple): 根据字符串生成搜索建议数组 :param index: :param info_tuple: :return:
- def process_item(self, item, spider): 将item转换为es的数据格式 :param item: :param spider: :r... | 926002c7d66db2456fea94f1b50fdbf364d66836 | <|skeleton|>
class ElasticSearchPipeline:
"""将数据写入到es中"""
def gen_suggests(self, index, info_tuple):
"""根据字符串生成搜索建议数组 :param index: :param info_tuple: :return:"""
<|body_0|>
def process_item(self, item, spider):
"""将item转换为es的数据格式 :param item: :param spider: :return:"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ElasticSearchPipeline:
"""将数据写入到es中"""
def gen_suggests(self, index, info_tuple):
"""根据字符串生成搜索建议数组 :param index: :param info_tuple: :return:"""
used_words = set()
suggests = []
for text, weight in info_tuple:
if text:
words = es.indices.analyze(... | the_stack_v2_python_sparse | PositionSpider/PositionSpider/pipelines.py | JayZhou5299/search_engine | train | 1 |
1b91ba73a60f00ef36260cb6bbf33f8fe2ec5244 | [
"if os.path.isfile(self.tmp_cron_file):\n os.remove(self.tmp_cron_file)\nopen(self.tmp_cron_file, 'w').close()",
"cronfile = open(self.tmp_cron_file, 'w')\ncrons = database.get_scheduled_tasks()\nfor cron in crons:\n cronline = ''\n cronline += cron['minute'] + ' '\n cronline += cron['hour'] + ' '\n ... | <|body_start_0|>
if os.path.isfile(self.tmp_cron_file):
os.remove(self.tmp_cron_file)
open(self.tmp_cron_file, 'w').close()
<|end_body_0|>
<|body_start_1|>
cronfile = open(self.tmp_cron_file, 'w')
crons = database.get_scheduled_tasks()
for cron in crons:
... | crontab interface for scheduled tasks | Crontab | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Crontab:
"""crontab interface for scheduled tasks"""
def __init__(self):
"""init"""
<|body_0|>
def generate_cron_file(self, database):
"""generate a new cron file with all the scheduled tasks"""
<|body_1|>
def set_cron_file(self):
"""call cro... | stack_v2_sparse_classes_75kplus_train_073529 | 2,327 | no_license | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "generate a new cron file with all the scheduled tasks",
"name": "generate_cron_file",
"signature": "def generate_cron_file(self, database)"
},
{
"docstring": "call crontab 'file' to se... | 3 | null | Implement the Python class `Crontab` described below.
Class description:
crontab interface for scheduled tasks
Method signatures and docstrings:
- def __init__(self): init
- def generate_cron_file(self, database): generate a new cron file with all the scheduled tasks
- def set_cron_file(self): call crontab 'file' to ... | Implement the Python class `Crontab` described below.
Class description:
crontab interface for scheduled tasks
Method signatures and docstrings:
- def __init__(self): init
- def generate_cron_file(self, database): generate a new cron file with all the scheduled tasks
- def set_cron_file(self): call crontab 'file' to ... | c10068b692e331ff5210ee42cd68d4ddfd78f88b | <|skeleton|>
class Crontab:
"""crontab interface for scheduled tasks"""
def __init__(self):
"""init"""
<|body_0|>
def generate_cron_file(self, database):
"""generate a new cron file with all the scheduled tasks"""
<|body_1|>
def set_cron_file(self):
"""call cro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Crontab:
"""crontab interface for scheduled tasks"""
def __init__(self):
"""init"""
if os.path.isfile(self.tmp_cron_file):
os.remove(self.tmp_cron_file)
open(self.tmp_cron_file, 'w').close()
def generate_cron_file(self, database):
"""generate a new cron fi... | the_stack_v2_python_sparse | engine/yarus/engine/crontab.py | alexandreborgo/yarus | train | 1 |
f3b4210cb331da72553582cf684470c8321b1eff | [
"self.request_user = request.user\nif self.request_user.is_anonymous:\n try:\n cart = Cart.objects.get(cart_id=_cart_id(request))\n cart_items = CartItem.objects.filter(cart=cart)\n except Cart.DoesNotExist:\n cart = Cart.objects.create(cart_id=_cart_id(request))\n cart_items = Non... | <|body_start_0|>
self.request_user = request.user
if self.request_user.is_anonymous:
try:
cart = Cart.objects.get(cart_id=_cart_id(request))
cart_items = CartItem.objects.filter(cart=cart)
except Cart.DoesNotExist:
cart = Cart.objec... | Mixin for cart and cart actions. | CartMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CartMixin:
"""Mixin for cart and cart actions."""
def dispatch(self, request, *args, **kwargs):
"""Method which return request user and cart items."""
<|body_0|>
def calculate_total(self):
"""Method which calculate total sum for order."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_073530 | 2,652 | permissive | [
{
"docstring": "Method which return request user and cart items.",
"name": "dispatch",
"signature": "def dispatch(self, request, *args, **kwargs)"
},
{
"docstring": "Method which calculate total sum for order.",
"name": "calculate_total",
"signature": "def calculate_total(self)"
},
{... | 3 | stack_v2_sparse_classes_30k_train_054592 | Implement the Python class `CartMixin` described below.
Class description:
Mixin for cart and cart actions.
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): Method which return request user and cart items.
- def calculate_total(self): Method which calculate total sum for order.
- def ... | Implement the Python class `CartMixin` described below.
Class description:
Mixin for cart and cart actions.
Method signatures and docstrings:
- def dispatch(self, request, *args, **kwargs): Method which return request user and cart items.
- def calculate_total(self): Method which calculate total sum for order.
- def ... | cbb16fc9ab2b85232e4c05446697fc82b78bc8e4 | <|skeleton|>
class CartMixin:
"""Mixin for cart and cart actions."""
def dispatch(self, request, *args, **kwargs):
"""Method which return request user and cart items."""
<|body_0|>
def calculate_total(self):
"""Method which calculate total sum for order."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CartMixin:
"""Mixin for cart and cart actions."""
def dispatch(self, request, *args, **kwargs):
"""Method which return request user and cart items."""
self.request_user = request.user
if self.request_user.is_anonymous:
try:
cart = Cart.objects.get(cart_... | the_stack_v2_python_sparse | shop/carts/mixins.py | Anych/mila-iris | train | 0 |
2ef984b3a5210a5b63f2ef9e337335e054edf591 | [
"i = 0\nwhile i <= len(nums):\n if i + nums[i] >= len(nums) - 1:\n return True\n if i == len(nums) - 2 or nums[i] == 0:\n return False\n max = nums[i + 1] + i + 1\n temp = i + 1\n if nums[i] != 0:\n for j in range(1, nums[i] + 1):\n if nums[i + j] + i + j >= max:\n ... | <|body_start_0|>
i = 0
while i <= len(nums):
if i + nums[i] >= len(nums) - 1:
return True
if i == len(nums) - 2 or nums[i] == 0:
return False
max = nums[i + 1] + i + 1
temp = i + 1
if nums[i] != 0:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canJump2(self, nums):
"""高端解法 :param nums: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
i = 0
while i <= len(nums):
if i + num... | stack_v2_sparse_classes_75kplus_train_073531 | 1,696 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canJump",
"signature": "def canJump(self, nums)"
},
{
"docstring": "高端解法 :param nums: :return:",
"name": "canJump2",
"signature": "def canJump2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_054090 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums): :type nums: List[int] :rtype: bool
- def canJump2(self, nums): 高端解法 :param nums: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums): :type nums: List[int] :rtype: bool
- def canJump2(self, nums): 高端解法 :param nums: :return:
<|skeleton|>
class Solution:
def canJump(self, nums):
... | beabfd31379f44ffd767fc676912db5022495b53 | <|skeleton|>
class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canJump2(self, nums):
"""高端解法 :param nums: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
i = 0
while i <= len(nums):
if i + nums[i] >= len(nums) - 1:
return True
if i == len(nums) - 2 or nums[i] == 0:
return False
max = nums[i + 1]... | the_stack_v2_python_sparse | leetCode/top100/055canJump.py | fatezy/Algorithm | train | 1 | |
754d3a0a02fb2655478b3d9efbbd2f17777ca101 | [
"self.access_zone_name = access_zone_name\nself.nfs_mount_point = nfs_mount_point\nself.path = path\nself.protocols = protocols\nself.smb_mount_points = smb_mount_points",
"if dictionary is None:\n return None\naccess_zone_name = dictionary.get('accessZoneName')\nnfs_mount_point = cohesity_management_sdk.model... | <|body_start_0|>
self.access_zone_name = access_zone_name
self.nfs_mount_point = nfs_mount_point
self.path = path
self.protocols = protocols
self.smb_mount_points = smb_mount_points
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
ac... | Implementation of the 'IsilonMountPoint' model. Specifies information about a mount point in an Isilon OneFs Cluster. Attributes: access_zone_name (string): Specifies the name of access zone. nfs_mount_point (IsilonNfsMountPoint): Specifies information about an NFS export. This field is set if the file system supports ... | IsilonMountPoint | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IsilonMountPoint:
"""Implementation of the 'IsilonMountPoint' model. Specifies information about a mount point in an Isilon OneFs Cluster. Attributes: access_zone_name (string): Specifies the name of access zone. nfs_mount_point (IsilonNfsMountPoint): Specifies information about an NFS export. Th... | stack_v2_sparse_classes_75kplus_train_073532 | 3,464 | permissive | [
{
"docstring": "Constructor for the IsilonMountPoint class",
"name": "__init__",
"signature": "def __init__(self, access_zone_name=None, nfs_mount_point=None, path=None, protocols=None, smb_mount_points=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionar... | 2 | stack_v2_sparse_classes_30k_train_007552 | Implement the Python class `IsilonMountPoint` described below.
Class description:
Implementation of the 'IsilonMountPoint' model. Specifies information about a mount point in an Isilon OneFs Cluster. Attributes: access_zone_name (string): Specifies the name of access zone. nfs_mount_point (IsilonNfsMountPoint): Specif... | Implement the Python class `IsilonMountPoint` described below.
Class description:
Implementation of the 'IsilonMountPoint' model. Specifies information about a mount point in an Isilon OneFs Cluster. Attributes: access_zone_name (string): Specifies the name of access zone. nfs_mount_point (IsilonNfsMountPoint): Specif... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class IsilonMountPoint:
"""Implementation of the 'IsilonMountPoint' model. Specifies information about a mount point in an Isilon OneFs Cluster. Attributes: access_zone_name (string): Specifies the name of access zone. nfs_mount_point (IsilonNfsMountPoint): Specifies information about an NFS export. Th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IsilonMountPoint:
"""Implementation of the 'IsilonMountPoint' model. Specifies information about a mount point in an Isilon OneFs Cluster. Attributes: access_zone_name (string): Specifies the name of access zone. nfs_mount_point (IsilonNfsMountPoint): Specifies information about an NFS export. This field is s... | the_stack_v2_python_sparse | cohesity_management_sdk/models/isilon_mount_point.py | cohesity/management-sdk-python | train | 24 |
ecf0e1889c0920e9e40c245e3381e4ab07b56dc4 | [
"super(CollaborativeMemoryNetwork, self).__init__()\nself.config = config\nself.device = device\nself.emb_dim = config['emb_dim']\nself.neighborhood = item_user_list\nself.max_neighbors = max([len(x) for x in item_user_list.values()])\nconfig['max_neighbors'] = self.max_neighbors\nself.user_memory = nn.Embedding(us... | <|body_start_0|>
super(CollaborativeMemoryNetwork, self).__init__()
self.config = config
self.device = device
self.emb_dim = config['emb_dim']
self.neighborhood = item_user_list
self.max_neighbors = max([len(x) for x in item_user_list.values()])
config['max_neighb... | CollaborativeMemoryNetwork Class. | CollaborativeMemoryNetwork | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CollaborativeMemoryNetwork:
"""CollaborativeMemoryNetwork Class."""
def __init__(self, config, user_embeddings, item_embeddings, item_user_list, device):
"""Initialize CollaborativeMemoryNetwork Class."""
<|body_0|>
def output_module(self, input):
"""Missing Doc.... | stack_v2_sparse_classes_75kplus_train_073533 | 9,498 | permissive | [
{
"docstring": "Initialize CollaborativeMemoryNetwork Class.",
"name": "__init__",
"signature": "def __init__(self, config, user_embeddings, item_embeddings, item_user_list, device)"
},
{
"docstring": "Missing Doc.",
"name": "output_module",
"signature": "def output_module(self, input)"
... | 4 | stack_v2_sparse_classes_30k_test_002883 | Implement the Python class `CollaborativeMemoryNetwork` described below.
Class description:
CollaborativeMemoryNetwork Class.
Method signatures and docstrings:
- def __init__(self, config, user_embeddings, item_embeddings, item_user_list, device): Initialize CollaborativeMemoryNetwork Class.
- def output_module(self,... | Implement the Python class `CollaborativeMemoryNetwork` described below.
Class description:
CollaborativeMemoryNetwork Class.
Method signatures and docstrings:
- def __init__(self, config, user_embeddings, item_embeddings, item_user_list, device): Initialize CollaborativeMemoryNetwork Class.
- def output_module(self,... | 625189d5e1002a3edc27c3e3ce075fddf7ae1c92 | <|skeleton|>
class CollaborativeMemoryNetwork:
"""CollaborativeMemoryNetwork Class."""
def __init__(self, config, user_embeddings, item_embeddings, item_user_list, device):
"""Initialize CollaborativeMemoryNetwork Class."""
<|body_0|>
def output_module(self, input):
"""Missing Doc.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CollaborativeMemoryNetwork:
"""CollaborativeMemoryNetwork Class."""
def __init__(self, config, user_embeddings, item_embeddings, item_user_list, device):
"""Initialize CollaborativeMemoryNetwork Class."""
super(CollaborativeMemoryNetwork, self).__init__()
self.config = config
... | the_stack_v2_python_sparse | beta_rec/models/cmn.py | beta-team/beta-recsys | train | 156 |
1f129b32690030aa5b21e971a5a0c7864e8f7cb5 | [
"loader = self.loader(self)\nobj = loader.get_object_from_aws(self.app.pargs.pk)\nassert hasattr(obj, 'ssh_target'), f'Objects of type {obj.__class__.__name__} do not support SSH actions'\ntarget = get_ssh_target(self.app, obj, choose=self.app.pargs.choose)\ntarget.ssh_interactive(verbose=self.app.pargs.verbose)",
... | <|body_start_0|>
loader = self.loader(self)
obj = loader.get_object_from_aws(self.app.pargs.pk)
assert hasattr(obj, 'ssh_target'), f'Objects of type {obj.__class__.__name__} do not support SSH actions'
target = get_ssh_target(self.app, obj, choose=self.app.pargs.choose)
target.ss... | ObjectSSHController | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectSSHController:
def ssh(self):
"""SSH to a container machine running one of the tasks for an existing Service or Task in AWS. NOTE: this is only available if your Service or Task is of launch type EC2. You cannot ssh to the container machine of a FARGATE Service or task."""
... | stack_v2_sparse_classes_75kplus_train_073534 | 13,998 | permissive | [
{
"docstring": "SSH to a container machine running one of the tasks for an existing Service or Task in AWS. NOTE: this is only available if your Service or Task is of launch type EC2. You cannot ssh to the container machine of a FARGATE Service or task.",
"name": "ssh",
"signature": "def ssh(self)"
},... | 2 | stack_v2_sparse_classes_30k_train_018920 | Implement the Python class `ObjectSSHController` described below.
Class description:
Implement the ObjectSSHController class.
Method signatures and docstrings:
- def ssh(self): SSH to a container machine running one of the tasks for an existing Service or Task in AWS. NOTE: this is only available if your Service or T... | Implement the Python class `ObjectSSHController` described below.
Class description:
Implement the ObjectSSHController class.
Method signatures and docstrings:
- def ssh(self): SSH to a container machine running one of the tasks for an existing Service or Task in AWS. NOTE: this is only available if your Service or T... | caa4698da812f5291a47366f307c1abebb4a989c | <|skeleton|>
class ObjectSSHController:
def ssh(self):
"""SSH to a container machine running one of the tasks for an existing Service or Task in AWS. NOTE: this is only available if your Service or Task is of launch type EC2. You cannot ssh to the container machine of a FARGATE Service or task."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ObjectSSHController:
def ssh(self):
"""SSH to a container machine running one of the tasks for an existing Service or Task in AWS. NOTE: this is only available if your Service or Task is of launch type EC2. You cannot ssh to the container machine of a FARGATE Service or task."""
loader = self.... | the_stack_v2_python_sparse | deployfish/controllers/network.py | caltechads/deployfish | train | 98 | |
cee6863466c6a3567b47f0e8e23aa00c9e2e06f5 | [
"pos_inds = torch.nonzero(assign_result.labels[:, 0] > 0, as_tuple=False)\nif pos_inds.numel() != 0:\n pos_inds = pos_inds.squeeze(1)\nif pos_inds.numel() <= num_expected:\n return pos_inds\nelse:\n return self.random_choice(pos_inds, num_expected)",
"neg_inds = torch.nonzero(assign_result.labels[:, 0] =... | <|body_start_0|>
pos_inds = torch.nonzero(assign_result.labels[:, 0] > 0, as_tuple=False)
if pos_inds.numel() != 0:
pos_inds = pos_inds.squeeze(1)
if pos_inds.numel() <= num_expected:
return pos_inds
else:
return self.random_choice(pos_inds, num_expect... | Random sampler for multi instance. Note: Multi-instance means to predict multiple detection boxes with one proposal box. `AssignResult` may assign multiple gt boxes to each proposal box, in this case `RandomSampler` should be replaced by `MultiInsRandomSampler` | MultiInsRandomSampler | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiInsRandomSampler:
"""Random sampler for multi instance. Note: Multi-instance means to predict multiple detection boxes with one proposal box. `AssignResult` may assign multiple gt boxes to each proposal box, in this case `RandomSampler` should be replaced by `MultiInsRandomSampler`"""
d... | stack_v2_sparse_classes_75kplus_train_073535 | 5,250 | permissive | [
{
"docstring": "Randomly sample some positive samples. Args: assign_result (:obj:`AssignResult`): Bbox assigning results. num_expected (int): The number of expected positive samples Returns: Tensor or ndarray: sampled indices.",
"name": "_sample_pos",
"signature": "def _sample_pos(self, assign_result: A... | 3 | stack_v2_sparse_classes_30k_train_039418 | Implement the Python class `MultiInsRandomSampler` described below.
Class description:
Random sampler for multi instance. Note: Multi-instance means to predict multiple detection boxes with one proposal box. `AssignResult` may assign multiple gt boxes to each proposal box, in this case `RandomSampler` should be replac... | Implement the Python class `MultiInsRandomSampler` described below.
Class description:
Random sampler for multi instance. Note: Multi-instance means to predict multiple detection boxes with one proposal box. `AssignResult` may assign multiple gt boxes to each proposal box, in this case `RandomSampler` should be replac... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class MultiInsRandomSampler:
"""Random sampler for multi instance. Note: Multi-instance means to predict multiple detection boxes with one proposal box. `AssignResult` may assign multiple gt boxes to each proposal box, in this case `RandomSampler` should be replaced by `MultiInsRandomSampler`"""
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiInsRandomSampler:
"""Random sampler for multi instance. Note: Multi-instance means to predict multiple detection boxes with one proposal box. `AssignResult` may assign multiple gt boxes to each proposal box, in this case `RandomSampler` should be replaced by `MultiInsRandomSampler`"""
def _sample_po... | the_stack_v2_python_sparse | ai/mmdetection/mmdet/models/task_modules/samplers/multi_instance_random_sampler.py | alldatacenter/alldata | train | 774 |
4d733c4aefc460de5b36fbc0fb046509e030af71 | [
"alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)\ndata = {'alloy_type_set': alloy_type_set}\nreturn render(request, 'admin/alloy/alloy_edit.html', context=data)",
"alloy_query = alloy_model.Alloy.objects.only('name').filter(is_delete=False)\ntry:\n alloy_json_data = re... | <|body_start_0|>
alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)
data = {'alloy_type_set': alloy_type_set}
return render(request, 'admin/alloy/alloy_edit.html', context=data)
<|end_body_0|>
<|body_start_1|>
alloy_query = alloy_model.Alloy.object... | AlloyAdd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlloyAdd:
def get(self, request):
"""添加页面展示 :param request: :return:"""
<|body_0|>
def post(self, request):
"""新合金添加 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
alloy_type_set = alloy_model.AlloyType.objects.only('id', '... | stack_v2_sparse_classes_75kplus_train_073536 | 11,849 | no_license | [
{
"docstring": "添加页面展示 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "新合金添加 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029536 | Implement the Python class `AlloyAdd` described below.
Class description:
Implement the AlloyAdd class.
Method signatures and docstrings:
- def get(self, request): 添加页面展示 :param request: :return:
- def post(self, request): 新合金添加 :param request: :return: | Implement the Python class `AlloyAdd` described below.
Class description:
Implement the AlloyAdd class.
Method signatures and docstrings:
- def get(self, request): 添加页面展示 :param request: :return:
- def post(self, request): 新合金添加 :param request: :return:
<|skeleton|>
class AlloyAdd:
def get(self, request):
... | 063332d2a5e2ddabf800817f02074b4f5c162ade | <|skeleton|>
class AlloyAdd:
def get(self, request):
"""添加页面展示 :param request: :return:"""
<|body_0|>
def post(self, request):
"""新合金添加 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AlloyAdd:
def get(self, request):
"""添加页面展示 :param request: :return:"""
alloy_type_set = alloy_model.AlloyType.objects.only('id', 'type').filter(is_delete=False)
data = {'alloy_type_set': alloy_type_set}
return render(request, 'admin/alloy/alloy_edit.html', context=data)
d... | the_stack_v2_python_sparse | sfs/apps/alloy/views.py | Hx-someone/sfs-1 | train | 0 | |
30cc576c2bdb1c10b6dadc1784e9924d5508a29d | [
"if not self.isVide():\n if self.isFeuille():\n self.getRacine().valeur = f(self.valRacine())\n else:\n self.getRacine().valeur = f(self.valRacine())\n if self.hasGauche():\n self.getGauche().applique(f)\n if self.hasDroit():\n self.getDroit().applique(f)",
... | <|body_start_0|>
if not self.isVide():
if self.isFeuille():
self.getRacine().valeur = f(self.valRacine())
else:
self.getRacine().valeur = f(self.valRacine())
if self.hasGauche():
self.getGauche().applique(f)
... | conception de fonctions récursives | Recursif | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Recursif:
"""conception de fonctions récursives"""
def applique(self, f):
"""applique la fonction f à toutes les valeurs de l'arbre"""
<|body_0|>
def grand_chemin(self):
"""renvoie la plus grande somme possible"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_073537 | 1,759 | no_license | [
{
"docstring": "applique la fonction f à toutes les valeurs de l'arbre",
"name": "applique",
"signature": "def applique(self, f)"
},
{
"docstring": "renvoie la plus grande somme possible",
"name": "grand_chemin",
"signature": "def grand_chemin(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031584 | Implement the Python class `Recursif` described below.
Class description:
conception de fonctions récursives
Method signatures and docstrings:
- def applique(self, f): applique la fonction f à toutes les valeurs de l'arbre
- def grand_chemin(self): renvoie la plus grande somme possible | Implement the Python class `Recursif` described below.
Class description:
conception de fonctions récursives
Method signatures and docstrings:
- def applique(self, f): applique la fonction f à toutes les valeurs de l'arbre
- def grand_chemin(self): renvoie la plus grande somme possible
<|skeleton|>
class Recursif:
... | c9877ad75d3c4ee6e3904fe8b457f8b3242c7c3f | <|skeleton|>
class Recursif:
"""conception de fonctions récursives"""
def applique(self, f):
"""applique la fonction f à toutes les valeurs de l'arbre"""
<|body_0|>
def grand_chemin(self):
"""renvoie la plus grande somme possible"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Recursif:
"""conception de fonctions récursives"""
def applique(self, f):
"""applique la fonction f à toutes les valeurs de l'arbre"""
if not self.isVide():
if self.isFeuille():
self.getRacine().valeur = f(self.valRacine())
else:
sel... | the_stack_v2_python_sparse | 2nd-year/structures-de-donnees-algos-python/tp9/complet/recursif.py | pakpake/licence-informatique | train | 3 |
fa6444dd6faa2f15875b11a7a85bb29defef8d56 | [
"self.model = model\nself.admin_site = admin_site\nsuper().__init__(attrs)",
"context = super().get_context(name, value, attrs)\nif self.model not in self.admin_site._registry:\n raise ValueError('The specified model is not registered with the specified admin site')\nchangelist_route_name = admin_urlname(self.... | <|body_start_0|>
self.model = model
self.admin_site = admin_site
super().__init__(attrs)
<|end_body_0|>
<|body_start_1|>
context = super().get_context(name, value, attrs)
if self.model not in self.admin_site._registry:
raise ValueError('The specified model is not reg... | A widget for selecting a model object using a change list in a pop-up window. This is similar to and based on RawForeignKeyIdWidget, however it is not tied to a particular model field (as RawForeignKeyIdWidget is). | RawIdWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RawIdWidget:
"""A widget for selecting a model object using a change list in a pop-up window. This is similar to and based on RawForeignKeyIdWidget, however it is not tied to a particular model field (as RawForeignKeyIdWidget is)."""
def __init__(self, model, admin_site=admin.site, attrs=Non... | stack_v2_sparse_classes_75kplus_train_073538 | 11,780 | permissive | [
{
"docstring": "Initialises the widget.",
"name": "__init__",
"signature": "def __init__(self, model, admin_site=admin.site, attrs=None)"
},
{
"docstring": "Gets the template context.",
"name": "get_context",
"signature": "def get_context(self, name, value, attrs)"
},
{
"docstrin... | 3 | null | Implement the Python class `RawIdWidget` described below.
Class description:
A widget for selecting a model object using a change list in a pop-up window. This is similar to and based on RawForeignKeyIdWidget, however it is not tied to a particular model field (as RawForeignKeyIdWidget is).
Method signatures and docs... | Implement the Python class `RawIdWidget` described below.
Class description:
A widget for selecting a model object using a change list in a pop-up window. This is similar to and based on RawForeignKeyIdWidget, however it is not tied to a particular model field (as RawForeignKeyIdWidget is).
Method signatures and docs... | a92faabf73fb93b5bfd94fd465eafc3e29aa6d8e | <|skeleton|>
class RawIdWidget:
"""A widget for selecting a model object using a change list in a pop-up window. This is similar to and based on RawForeignKeyIdWidget, however it is not tied to a particular model field (as RawForeignKeyIdWidget is)."""
def __init__(self, model, admin_site=admin.site, attrs=Non... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RawIdWidget:
"""A widget for selecting a model object using a change list in a pop-up window. This is similar to and based on RawForeignKeyIdWidget, however it is not tied to a particular model field (as RawForeignKeyIdWidget is)."""
def __init__(self, model, admin_site=admin.site, attrs=None):
"... | the_stack_v2_python_sparse | datahub/core/admin.py | cgsunkel/data-hub-api | train | 0 |
9d98bef6556da0c0ef934ad3d7a2cc47a0cbbbf4 | [
"custom_field_id = kwargs.get('custom_field_id')\napp_name = request.META.get('HTTP_APPNAME')\nusername = request.META.get('HTTP_USERNAME')\nworkflow_id = kwargs.get('workflow_id')\napp_permission, msg = account_base_service_ins.app_workflow_permission_check(app_name, workflow_id)\nif not app_permission:\n retur... | <|body_start_0|>
custom_field_id = kwargs.get('custom_field_id')
app_name = request.META.get('HTTP_APPNAME')
username = request.META.get('HTTP_USERNAME')
workflow_id = kwargs.get('workflow_id')
app_permission, msg = account_base_service_ins.app_workflow_permission_check(app_name,... | WorkflowCustomFieldDetailView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkflowCustomFieldDetailView:
def patch(self, request, *args, **kwargs):
"""更新自定义字段 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def delete(self, request, *args, **kwargs):
"""删除记录"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_073539 | 48,278 | permissive | [
{
"docstring": "更新自定义字段 :param request: :param args: :param kwargs: :return:",
"name": "patch",
"signature": "def patch(self, request, *args, **kwargs)"
},
{
"docstring": "删除记录",
"name": "delete",
"signature": "def delete(self, request, *args, **kwargs)"
}
] | 2 | null | Implement the Python class `WorkflowCustomFieldDetailView` described below.
Class description:
Implement the WorkflowCustomFieldDetailView class.
Method signatures and docstrings:
- def patch(self, request, *args, **kwargs): 更新自定义字段 :param request: :param args: :param kwargs: :return:
- def delete(self, request, *arg... | Implement the Python class `WorkflowCustomFieldDetailView` described below.
Class description:
Implement the WorkflowCustomFieldDetailView class.
Method signatures and docstrings:
- def patch(self, request, *args, **kwargs): 更新自定义字段 :param request: :param args: :param kwargs: :return:
- def delete(self, request, *arg... | b0e236b314286c5f6cc6959622c9c8505e776443 | <|skeleton|>
class WorkflowCustomFieldDetailView:
def patch(self, request, *args, **kwargs):
"""更新自定义字段 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def delete(self, request, *args, **kwargs):
"""删除记录"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorkflowCustomFieldDetailView:
def patch(self, request, *args, **kwargs):
"""更新自定义字段 :param request: :param args: :param kwargs: :return:"""
custom_field_id = kwargs.get('custom_field_id')
app_name = request.META.get('HTTP_APPNAME')
username = request.META.get('HTTP_USERNAME')
... | the_stack_v2_python_sparse | apps/workflow/views.py | blackholll/loonflow | train | 1,864 | |
58f30b73c59ecb722a870efa5bf0ed312fabd444 | [
"rs1 = self.create(self.leader, 't', self.tid, self.pid, 144000, 2, 'true', card='string:index', merchant='string:index', amt='double')\nself.assertIn('Create table ok', rs1)\nschema, column_key = self.showschema(self.leader, self.tid, self.pid)\nself.assertEqual(len(schema), 3)\nself.assertEqual(schema[0], ['0', '... | <|body_start_0|>
rs1 = self.create(self.leader, 't', self.tid, self.pid, 144000, 2, 'true', card='string:index', merchant='string:index', amt='double')
self.assertIn('Create table ok', rs1)
schema, column_key = self.showschema(self.leader, self.tid, self.pid)
self.assertEqual(len(schema)... | TestShowSchema | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestShowSchema:
def test_showschema_tid_not_exist(self):
"""tid不存在,查看schema :return:"""
<|body_0|>
def test_showschema_type(self):
"""测试showschema是否支持所有字段类型 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
rs1 = self.create(self.leader, 't',... | stack_v2_sparse_classes_75kplus_train_073540 | 3,832 | permissive | [
{
"docstring": "tid不存在,查看schema :return:",
"name": "test_showschema_tid_not_exist",
"signature": "def test_showschema_tid_not_exist(self)"
},
{
"docstring": "测试showschema是否支持所有字段类型 :return:",
"name": "test_showschema_type",
"signature": "def test_showschema_type(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_024101 | Implement the Python class `TestShowSchema` described below.
Class description:
Implement the TestShowSchema class.
Method signatures and docstrings:
- def test_showschema_tid_not_exist(self): tid不存在,查看schema :return:
- def test_showschema_type(self): 测试showschema是否支持所有字段类型 :return: | Implement the Python class `TestShowSchema` described below.
Class description:
Implement the TestShowSchema class.
Method signatures and docstrings:
- def test_showschema_tid_not_exist(self): tid不存在,查看schema :return:
- def test_showschema_type(self): 测试showschema是否支持所有字段类型 :return:
<|skeleton|>
class TestShowSchema... | 14f662558880f0784699eb8339677e5afa6df6cf | <|skeleton|>
class TestShowSchema:
def test_showschema_tid_not_exist(self):
"""tid不存在,查看schema :return:"""
<|body_0|>
def test_showschema_type(self):
"""测试showschema是否支持所有字段类型 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestShowSchema:
def test_showschema_tid_not_exist(self):
"""tid不存在,查看schema :return:"""
rs1 = self.create(self.leader, 't', self.tid, self.pid, 144000, 2, 'true', card='string:index', merchant='string:index', amt='double')
self.assertIn('Create table ok', rs1)
schema, column_ke... | the_stack_v2_python_sparse | test-common/integrationtest/testcase/test_showschema.py | RhnSharma/OpenMLDB | train | 1 | |
9ca3adf43bd6d398de39d4cb662a00b5b7c5ed07 | [
"super().__init__(model, params)\nself._var_scope = 'encoder'\nself._lambda_end_d = 1.0\nself._n_classes = 0\nself._n_latent_dim = 16\nif 'n_classes' in params.keys():\n self._n_classes = params['n_classes']\nif 'lambda_d' in params.keys():\n self._lambda_enc_d = params['lambda_d']\nif 'latent_dim' in params.... | <|body_start_0|>
super().__init__(model, params)
self._var_scope = 'encoder'
self._lambda_end_d = 1.0
self._n_classes = 0
self._n_latent_dim = 16
if 'n_classes' in params.keys():
self._n_classes = params['n_classes']
if 'lambda_d' in params.keys():
... | debug implementation | Encoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""debug implementation"""
def __init__(self, model, params):
"""Args: model: parent model object. params: dict() of parameters."""
<|body_0|>
def _network(self, input):
"""forward network."""
<|body_1|>
def _loss(self, _data):
"""pr... | stack_v2_sparse_classes_75kplus_train_073541 | 9,168 | permissive | [
{
"docstring": "Args: model: parent model object. params: dict() of parameters.",
"name": "__init__",
"signature": "def __init__(self, model, params)"
},
{
"docstring": "forward network.",
"name": "_network",
"signature": "def _network(self, input)"
},
{
"docstring": "prepare the... | 3 | stack_v2_sparse_classes_30k_train_049343 | Implement the Python class `Encoder` described below.
Class description:
debug implementation
Method signatures and docstrings:
- def __init__(self, model, params): Args: model: parent model object. params: dict() of parameters.
- def _network(self, input): forward network.
- def _loss(self, _data): prepare the loss ... | Implement the Python class `Encoder` described below.
Class description:
debug implementation
Method signatures and docstrings:
- def __init__(self, model, params): Args: model: parent model object. params: dict() of parameters.
- def _network(self, input): forward network.
- def _loss(self, _data): prepare the loss ... | 9546d7a01c2b3e17131f34aa1e916e514c052ea8 | <|skeleton|>
class Encoder:
"""debug implementation"""
def __init__(self, model, params):
"""Args: model: parent model object. params: dict() of parameters."""
<|body_0|>
def _network(self, input):
"""forward network."""
<|body_1|>
def _loss(self, _data):
"""pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
"""debug implementation"""
def __init__(self, model, params):
"""Args: model: parent model object. params: dict() of parameters."""
super().__init__(model, params)
self._var_scope = 'encoder'
self._lambda_end_d = 1.0
self._n_classes = 0
self._n_lat... | the_stack_v2_python_sparse | networks/network_aae_v_lite.py | cosmoplankton-studio/cellular-probabilistic | train | 0 |
63d93f4050f11da5e904448b051f9612aeaf11cf | [
"self.pipeline = Pipeline()\nself.pipeline.add_node(component=retriever, name='Retriever', inputs=['Query'])\nself.pipeline.add_node(component=summarizer, name='Summarizer', inputs=['Retriever'])\nself.return_in_answer_format = return_in_answer_format",
"output = self.pipeline.run(query=query, params=params, debu... | <|body_start_0|>
self.pipeline = Pipeline()
self.pipeline.add_node(component=retriever, name='Retriever', inputs=['Query'])
self.pipeline.add_node(component=summarizer, name='Summarizer', inputs=['Retriever'])
self.return_in_answer_format = return_in_answer_format
<|end_body_0|>
<|body_... | Pipeline that retrieves documents for a query and then summarizes those documents. | SearchSummarizationPipeline | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SearchSummarizationPipeline:
"""Pipeline that retrieves documents for a query and then summarizes those documents."""
def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=False):
""":param summarizer: Summarizer instance :param retrie... | stack_v2_sparse_classes_75kplus_train_073542 | 18,541 | permissive | [
{
"docstring": ":param summarizer: Summarizer instance :param retriever: Retriever instance :param return_in_answer_format: Whether the results should be returned as documents (False) or in the answer format used in other QA pipelines (True). With the latter, you can use this pipeline as a \"drop-in replacement... | 2 | stack_v2_sparse_classes_30k_train_039306 | Implement the Python class `SearchSummarizationPipeline` described below.
Class description:
Pipeline that retrieves documents for a query and then summarizes those documents.
Method signatures and docstrings:
- def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=Fal... | Implement the Python class `SearchSummarizationPipeline` described below.
Class description:
Pipeline that retrieves documents for a query and then summarizes those documents.
Method signatures and docstrings:
- def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=Fal... | 6f6f2357fdef9e98850a7ffcd80f18b05aa7cfaf | <|skeleton|>
class SearchSummarizationPipeline:
"""Pipeline that retrieves documents for a query and then summarizes those documents."""
def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=False):
""":param summarizer: Summarizer instance :param retrie... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SearchSummarizationPipeline:
"""Pipeline that retrieves documents for a query and then summarizes those documents."""
def __init__(self, summarizer: BaseSummarizer, retriever: BaseRetriever, return_in_answer_format: bool=False):
""":param summarizer: Summarizer instance :param retriever: Retrieve... | the_stack_v2_python_sparse | haystack/pipelines/standard_pipelines.py | aantti/haystack | train | 0 |
c43495f5b837666b925bffd5271deeb700496169 | [
"try:\n return services.invite_service().get_invite_by_id(invite_id)\nexcept Exception as e:\n nsp.abort(500, 'An internal server error has occurred: {}'.format(e))\n print(e)",
"try:\n invite = request.json\n return (invite, 204)\nexcept Exception as e:\n nsp.abort(500, 'An internal server erro... | <|body_start_0|>
try:
return services.invite_service().get_invite_by_id(invite_id)
except Exception as e:
nsp.abort(500, 'An internal server error has occurred: {}'.format(e))
print(e)
<|end_body_0|>
<|body_start_1|>
try:
invite = request.json
... | Invite | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Invite:
def get(self, invite_id):
"""Get an invite by id"""
<|body_0|>
def put(self, invite_id):
"""Update an invite by id"""
<|body_1|>
def delete(self, invite_id):
"""Flag an invite for deletion by it's id"""
<|body_2|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus_train_073543 | 3,120 | no_license | [
{
"docstring": "Get an invite by id",
"name": "get",
"signature": "def get(self, invite_id)"
},
{
"docstring": "Update an invite by id",
"name": "put",
"signature": "def put(self, invite_id)"
},
{
"docstring": "Flag an invite for deletion by it's id",
"name": "delete",
"s... | 3 | stack_v2_sparse_classes_30k_train_019558 | Implement the Python class `Invite` described below.
Class description:
Implement the Invite class.
Method signatures and docstrings:
- def get(self, invite_id): Get an invite by id
- def put(self, invite_id): Update an invite by id
- def delete(self, invite_id): Flag an invite for deletion by it's id | Implement the Python class `Invite` described below.
Class description:
Implement the Invite class.
Method signatures and docstrings:
- def get(self, invite_id): Get an invite by id
- def put(self, invite_id): Update an invite by id
- def delete(self, invite_id): Flag an invite for deletion by it's id
<|skeleton|>
c... | df826cf7098aee59e0a1ced6f465c2e8bb3df9a5 | <|skeleton|>
class Invite:
def get(self, invite_id):
"""Get an invite by id"""
<|body_0|>
def put(self, invite_id):
"""Update an invite by id"""
<|body_1|>
def delete(self, invite_id):
"""Flag an invite for deletion by it's id"""
<|body_2|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Invite:
def get(self, invite_id):
"""Get an invite by id"""
try:
return services.invite_service().get_invite_by_id(invite_id)
except Exception as e:
nsp.abort(500, 'An internal server error has occurred: {}'.format(e))
print(e)
def put(self, inv... | the_stack_v2_python_sparse | patient_portal/patient_portal/api/invites.py | bkh148/patient-cloud | train | 0 | |
8e79cad0739d8de9e3c86cdd31761b0cd0052d40 | [
"cache = {}\nfor x in nums:\n cache[x] = cache.get(x, 0) + 1\nfor item in cache.items():\n if item[1] == 1:\n return item[0]",
"result = 0\nfor x in nums:\n result ^= x\nreturn result"
] | <|body_start_0|>
cache = {}
for x in nums:
cache[x] = cache.get(x, 0) + 1
for item in cache.items():
if item[1] == 1:
return item[0]
<|end_body_0|>
<|body_start_1|>
result = 0
for x in nums:
result ^= x
return result
<|... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def singleNumberUsingExtra(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cache = {}
for x in nums:... | stack_v2_sparse_classes_75kplus_train_073544 | 946 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "singleNumberUsingExtra",
"signature": "def singleNumberUsingExtra(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "singleNumber",
"signature": "def singleNumber(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053511 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def singleNumberUsingExtra(self, nums): :type nums: List[int] :rtype: int
- def singleNumber(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 singleNumberUsingExtra(self, nums): :type nums: List[int] :rtype: int
- def singleNumber(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def... | 0743cbeb0e9aa4a8a25f4520a1e3f92793fae1ee | <|skeleton|>
class Solution:
def singleNumberUsingExtra(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def singleNumber(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def singleNumberUsingExtra(self, nums):
""":type nums: List[int] :rtype: int"""
cache = {}
for x in nums:
cache[x] = cache.get(x, 0) + 1
for item in cache.items():
if item[1] == 1:
return item[0]
def singleNumber(self, nums... | the_stack_v2_python_sparse | practice/leetcode/algorithm/136_SingleNumber.py | aliceayres/leetcode-practice | train | 0 | |
fd5393ff8fe32578fbb7acc3dd53e79475098142 | [
"super(PointerNetwork, self).__init__()\nself._score_type = score_type\nself._name = name\nself._hidden_size = hidden_size\nself._init_scale = init_scale",
"input_dim = len(q.shape)\nif input_dim == 2:\n q = layers.unsqueeze(q, [1])\nif self._score_type == 'dot_prod':\n ptr_score = layers.matmul(q, v, trans... | <|body_start_0|>
super(PointerNetwork, self).__init__()
self._score_type = score_type
self._name = name
self._hidden_size = hidden_size
self._init_scale = init_scale
<|end_body_0|>
<|body_start_1|>
input_dim = len(q.shape)
if input_dim == 2:
q = layer... | Pointer Network | PointerNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PointerNetwork:
"""Pointer Network"""
def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1):
"""init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): fo... | stack_v2_sparse_classes_75kplus_train_073545 | 5,544 | permissive | [
{
"docstring": "init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): for init fc param. used when score_type is affine or std. default is 0.1 hidden_size (int): only used when score_type=std.",
"name": "__i... | 2 | stack_v2_sparse_classes_30k_train_054568 | Implement the Python class `PointerNetwork` described below.
Class description:
Pointer Network
Method signatures and docstrings:
- def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for p... | Implement the Python class `PointerNetwork` described below.
Class description:
Pointer Network
Method signatures and docstrings:
- def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1): init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for p... | e08f3cb7b9db4c837000316c791542580ba02624 | <|skeleton|>
class PointerNetwork:
"""Pointer Network"""
def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1):
"""init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PointerNetwork:
"""Pointer Network"""
def __init__(self, score_type='dot_prod', name=None, init_scale=0.1, hidden_size=-1):
"""init of class Args: score_type (TYPE): dot_prod/affine/std name (str): param name prefix. used for parameter sharing. Default is None. init_scale (float): for init fc par... | the_stack_v2_python_sparse | NLP/DuSQL-Baseline/text2sql/models/pointer_network.py | ajayvbabu/Research | train | 0 |
5e8bddfda5e3c038b510556c8f35758dad4d301d | [
"LOG.debug('Index() called with %s' % tenant_id)\nsec_groups = models.SecurityGroup().find_all(tenant_id=tenant_id, deleted=False)\nrules_map = {g.id: g.get_rules() for g in sec_groups}\nreturn wsgi.Result(views.SecurityGroupsView(sec_groups, rules_map, req, tenant_id).list(), 200)",
"LOG.debug('Show() called wit... | <|body_start_0|>
LOG.debug('Index() called with %s' % tenant_id)
sec_groups = models.SecurityGroup().find_all(tenant_id=tenant_id, deleted=False)
rules_map = {g.id: g.get_rules() for g in sec_groups}
return wsgi.Result(views.SecurityGroupsView(sec_groups, rules_map, req, tenant_id).list(... | Controller for security groups functionality. | SecurityGroupController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecurityGroupController:
"""Controller for security groups functionality."""
def index(self, req, tenant_id):
"""Return all security groups tied to a particular tenant_id."""
<|body_0|>
def show(self, req, tenant_id, id):
"""Return a single security group."""
... | stack_v2_sparse_classes_75kplus_train_073546 | 6,170 | permissive | [
{
"docstring": "Return all security groups tied to a particular tenant_id.",
"name": "index",
"signature": "def index(self, req, tenant_id)"
},
{
"docstring": "Return a single security group.",
"name": "show",
"signature": "def show(self, req, tenant_id, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041777 | Implement the Python class `SecurityGroupController` described below.
Class description:
Controller for security groups functionality.
Method signatures and docstrings:
- def index(self, req, tenant_id): Return all security groups tied to a particular tenant_id.
- def show(self, req, tenant_id, id): Return a single s... | Implement the Python class `SecurityGroupController` described below.
Class description:
Controller for security groups functionality.
Method signatures and docstrings:
- def index(self, req, tenant_id): Return all security groups tied to a particular tenant_id.
- def show(self, req, tenant_id, id): Return a single s... | 012da9a334bc4e9c7711dc918eea3f011463ec82 | <|skeleton|>
class SecurityGroupController:
"""Controller for security groups functionality."""
def index(self, req, tenant_id):
"""Return all security groups tied to a particular tenant_id."""
<|body_0|>
def show(self, req, tenant_id, id):
"""Return a single security group."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SecurityGroupController:
"""Controller for security groups functionality."""
def index(self, req, tenant_id):
"""Return all security groups tied to a particular tenant_id."""
LOG.debug('Index() called with %s' % tenant_id)
sec_groups = models.SecurityGroup().find_all(tenant_id=ten... | the_stack_v2_python_sparse | trove/extensions/security_group/service.py | 2020human/trove-new | train | 1 |
43d4dce4eb6e2582847828712603a006447f83c2 | [
"super(ChooseFileDialog, self).__init__(title=title, parent=parent, action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))\nif initial_dir:\n self.set_current_folder(initial_dir)\nself.set_local_only(True)\nself.set_select_multiple(select_multiples)... | <|body_start_0|>
super(ChooseFileDialog, self).__init__(title=title, parent=parent, action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
if initial_dir:
self.set_current_folder(initial_dir)
self.set_local_only(True)
... | A dialog selection for folders. | ChooseFileDialog | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChooseFileDialog:
"""A dialog selection for folders."""
def __init__(self, title, parent, filter_name, pattern, select_multiples=True, initial_dir=None):
"""Constructor."""
<|body_0|>
def run(self):
"""Run the dialog."""
<|body_1|>
def __creater_filt... | stack_v2_sparse_classes_75kplus_train_073547 | 3,971 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, title, parent, filter_name, pattern, select_multiples=True, initial_dir=None)"
},
{
"docstring": "Run the dialog.",
"name": "run",
"signature": "def run(self)"
},
{
"docstring": "Create the list f... | 3 | null | Implement the Python class `ChooseFileDialog` described below.
Class description:
A dialog selection for folders.
Method signatures and docstrings:
- def __init__(self, title, parent, filter_name, pattern, select_multiples=True, initial_dir=None): Constructor.
- def run(self): Run the dialog.
- def __creater_filters(... | Implement the Python class `ChooseFileDialog` described below.
Class description:
A dialog selection for folders.
Method signatures and docstrings:
- def __init__(self, title, parent, filter_name, pattern, select_multiples=True, initial_dir=None): Constructor.
- def run(self): Run the dialog.
- def __creater_filters(... | c21ddf8aba58dc83d58a8db960d58d91ee2e5c74 | <|skeleton|>
class ChooseFileDialog:
"""A dialog selection for folders."""
def __init__(self, title, parent, filter_name, pattern, select_multiples=True, initial_dir=None):
"""Constructor."""
<|body_0|>
def run(self):
"""Run the dialog."""
<|body_1|>
def __creater_filt... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChooseFileDialog:
"""A dialog selection for folders."""
def __init__(self, title, parent, filter_name, pattern, select_multiples=True, initial_dir=None):
"""Constructor."""
super(ChooseFileDialog, self).__init__(title=title, parent=parent, action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons=(gtk... | the_stack_v2_python_sparse | tf/widgets/filedialog.py | yurimalheiros/textflow | train | 1 |
55b7aa075564e2774268d5d7b790ef62ad03d5fd | [
"format_date = lambda d: d.date().strftime('%d.%m.%Y')\ndate_from, date_till = get_datetime_from_till(7)\nsubject = cls.get_full_subject(f'Подборка материалов {format_date(date_from)}-{format_date(date_till)}')\ncontext = {'date_from': date_from.timestamp(), 'date_till': date_till.timestamp()}\ncls(subject, context... | <|body_start_0|>
format_date = lambda d: d.date().strftime('%d.%m.%Y')
date_from, date_till = get_datetime_from_till(7)
subject = cls.get_full_subject(f'Подборка материалов {format_date(date_from)}-{format_date(date_till)}')
context = {'date_from': date_from.timestamp(), 'date_till': dat... | Класс реализующий рассылку с подборкой новых материалов сайта (сводку). | PythonzEmailDigest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PythonzEmailDigest:
"""Класс реализующий рассылку с подборкой новых материалов сайта (сводку)."""
def create(cls):
"""Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile()."""
<|body_0|>
def get_realms_data(cls, date_from: dat... | stack_v2_sparse_classes_75kplus_train_073548 | 16,520 | no_license | [
{
"docstring": "Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile().",
"name": "create",
"signature": "def create(cls)"
},
{
"docstring": "Возвращает данные о материалах за указанный период. :param date_from: Дата начала периода :param date_till: Да... | 5 | stack_v2_sparse_classes_30k_train_049958 | Implement the Python class `PythonzEmailDigest` described below.
Class description:
Класс реализующий рассылку с подборкой новых материалов сайта (сводку).
Method signatures and docstrings:
- def create(cls): Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile().
- def get... | Implement the Python class `PythonzEmailDigest` described below.
Class description:
Класс реализующий рассылку с подборкой новых материалов сайта (сводку).
Method signatures and docstrings:
- def create(cls): Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile().
- def get... | ba5c0f198da7bed3de2d80bb01c280832253c1ce | <|skeleton|>
class PythonzEmailDigest:
"""Класс реализующий рассылку с подборкой новых материалов сайта (сводку)."""
def create(cls):
"""Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile()."""
<|body_0|>
def get_realms_data(cls, date_from: dat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PythonzEmailDigest:
"""Класс реализующий рассылку с подборкой новых материалов сайта (сводку)."""
def create(cls):
"""Создаёт депеши для рассылки еженедельной сводки. Реальная компиляция сводки происходит в compile()."""
format_date = lambda d: d.date().strftime('%d.%m.%Y')
date_f... | the_stack_v2_python_sparse | pythonz/apps/sitemessages.py | fonfs9/pythonz | train | 1 |
ee7ee13f61bd7165a3a505c7cb1e908af70fa190 | [
"self.degree = degree\nself.cross = cross\nself.previous_statistics = previous_statistics\nself.L = L",
"if self.previous_statistics is not None:\n data = self.previous_statistics.statistics(data)\nelse:\n data = self._check_and_transform_input(data)\ndata = data[:, [6, 7, 8, 16, 17, 21, 22, 23]]\nresult = ... | <|body_start_0|>
self.degree = degree
self.cross = cross
self.previous_statistics = previous_statistics
self.L = L
<|end_body_0|>
<|body_start_1|>
if self.previous_statistics is not None:
data = self.previous_statistics.statistics(data)
else:
data... | This class implements identity statistics not applying any transformation to the data, before the optional polynomial expansion step. If the data set contains n numpy.ndarray of length p, it returns therefore an nx(p+degree*p+cross*nchoosek(p,2)) matrix, where for each of the n points with p statistics, degree*p polyno... | Multiply | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Multiply:
"""This class implements identity statistics not applying any transformation to the data, before the optional polynomial expansion step. If the data set contains n numpy.ndarray of length p, it returns therefore an nx(p+degree*p+cross*nchoosek(p,2)) matrix, where for each of the n point... | stack_v2_sparse_classes_75kplus_train_073549 | 5,600 | no_license | [
{
"docstring": "Parameters ---------- degree : integer, optional Of polynomial expansion. The default value is 2 meaning second order polynomial expansion. cross : boolean, optional Defines whether to include the cross-product terms. The default value is True, meaning the cross product term is included. previou... | 2 | stack_v2_sparse_classes_30k_train_045143 | Implement the Python class `Multiply` described below.
Class description:
This class implements identity statistics not applying any transformation to the data, before the optional polynomial expansion step. If the data set contains n numpy.ndarray of length p, it returns therefore an nx(p+degree*p+cross*nchoosek(p,2)... | Implement the Python class `Multiply` described below.
Class description:
This class implements identity statistics not applying any transformation to the data, before the optional polynomial expansion step. If the data set contains n numpy.ndarray of length p, it returns therefore an nx(p+degree*p+cross*nchoosek(p,2)... | be3c648b19ddf5770482216a9381db5bbcdb3d24 | <|skeleton|>
class Multiply:
"""This class implements identity statistics not applying any transformation to the data, before the optional polynomial expansion step. If the data set contains n numpy.ndarray of length p, it returns therefore an nx(p+degree*p+cross*nchoosek(p,2)) matrix, where for each of the n point... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Multiply:
"""This class implements identity statistics not applying any transformation to the data, before the optional polynomial expansion step. If the data set contains n numpy.ndarray of length p, it returns therefore an nx(p+degree*p+cross*nchoosek(p,2)) matrix, where for each of the n points with p stat... | the_stack_v2_python_sparse | BiologicalScience/StochasticPlateletsDeposition/statistic.py | eth-cscs/abcpy-models | train | 11 |
ff298ead63253cd09ab3d43eb3ab8922f1b3e387 | [
"self.key_attrs = {}\nself.val_attrs = {}\nif 'key_attrs' in kwargs:\n self.key_attrs = kwargs.pop('key_attrs')\nif 'val_attrs' in kwargs:\n self.val_attrs = kwargs.pop('val_attrs')\nWidget.__init__(self, *args, **kwargs)",
"if value is None or value.strip() is '':\n value = ('', '')\nret = ''\nctx = {'k... | <|body_start_0|>
self.key_attrs = {}
self.val_attrs = {}
if 'key_attrs' in kwargs:
self.key_attrs = kwargs.pop('key_attrs')
if 'val_attrs' in kwargs:
self.val_attrs = kwargs.pop('val_attrs')
Widget.__init__(self, *args, **kwargs)
<|end_body_0|>
<|body_sta... | A widget that displays JSON Key Value Pairs as a list of text input box pairs Usage (in forms.py) : examplejsonfield = forms.CharField(label = "Example JSON Key Value Field", required = False, widget = JsonPairInputs(val_attrs={'size':35}, key_attrs={'class':'large'})) | AdditionalFile | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdditionalFile:
"""A widget that displays JSON Key Value Pairs as a list of text input box pairs Usage (in forms.py) : examplejsonfield = forms.CharField(label = "Example JSON Key Value Field", required = False, widget = JsonPairInputs(val_attrs={'size':35}, key_attrs={'class':'large'}))"""
... | stack_v2_sparse_classes_75kplus_train_073550 | 5,886 | permissive | [
{
"docstring": "A widget that displays JSON Key Value Pairs as a list of text input box pairs kwargs: key_attrs -- html attributes applied to the 1st input box pairs val_attrs -- html attributes applied to the 2nd input box pairs",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
... | 3 | stack_v2_sparse_classes_30k_train_006145 | Implement the Python class `AdditionalFile` described below.
Class description:
A widget that displays JSON Key Value Pairs as a list of text input box pairs Usage (in forms.py) : examplejsonfield = forms.CharField(label = "Example JSON Key Value Field", required = False, widget = JsonPairInputs(val_attrs={'size':35},... | Implement the Python class `AdditionalFile` described below.
Class description:
A widget that displays JSON Key Value Pairs as a list of text input box pairs Usage (in forms.py) : examplejsonfield = forms.CharField(label = "Example JSON Key Value Field", required = False, widget = JsonPairInputs(val_attrs={'size':35},... | f570fcc887fd622f958732806863749c66afe772 | <|skeleton|>
class AdditionalFile:
"""A widget that displays JSON Key Value Pairs as a list of text input box pairs Usage (in forms.py) : examplejsonfield = forms.CharField(label = "Example JSON Key Value Field", required = False, widget = JsonPairInputs(val_attrs={'size':35}, key_attrs={'class':'large'}))"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdditionalFile:
"""A widget that displays JSON Key Value Pairs as a list of text input box pairs Usage (in forms.py) : examplejsonfield = forms.CharField(label = "Example JSON Key Value Field", required = False, widget = JsonPairInputs(val_attrs={'size':35}, key_attrs={'class':'large'}))"""
def __init__(... | the_stack_v2_python_sparse | masterinterface/scs_resources/widgets.py | b3c/vphshare | train | 1 |
706f03de9b00b27eba43246e16da502d9b065a1c | [
"super(EncoderBlock, self).__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNormalization(... | <|body_start_0|>
super(EncoderBlock, self).__init__()
self.mha = MultiHeadAttention(dm, h)
self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')
self.dense_output = tf.keras.layers.Dense(dm)
self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)
... | encoder block class for transformers | EncoderBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EncoderBlock:
"""encoder block class for transformers"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""initializer for transformer encoder dm: int: dimensinoality of model h: number of heads hidden: number of hidden units in fully connected layer drop_rate: the dropout rate"""... | stack_v2_sparse_classes_75kplus_train_073551 | 1,772 | no_license | [
{
"docstring": "initializer for transformer encoder dm: int: dimensinoality of model h: number of heads hidden: number of hidden units in fully connected layer drop_rate: the dropout rate",
"name": "__init__",
"signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)"
},
{
"docstring": "cal... | 2 | null | Implement the Python class `EncoderBlock` described below.
Class description:
encoder block class for transformers
Method signatures and docstrings:
- def __init__(self, dm, h, hidden, drop_rate=0.1): initializer for transformer encoder dm: int: dimensinoality of model h: number of heads hidden: number of hidden unit... | Implement the Python class `EncoderBlock` described below.
Class description:
encoder block class for transformers
Method signatures and docstrings:
- def __init__(self, dm, h, hidden, drop_rate=0.1): initializer for transformer encoder dm: int: dimensinoality of model h: number of heads hidden: number of hidden unit... | d86b0e0cae2dd07c761f84a493abc895007873ee | <|skeleton|>
class EncoderBlock:
"""encoder block class for transformers"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""initializer for transformer encoder dm: int: dimensinoality of model h: number of heads hidden: number of hidden units in fully connected layer drop_rate: the dropout rate"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EncoderBlock:
"""encoder block class for transformers"""
def __init__(self, dm, h, hidden, drop_rate=0.1):
"""initializer for transformer encoder dm: int: dimensinoality of model h: number of heads hidden: number of hidden units in fully connected layer drop_rate: the dropout rate"""
supe... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/7-transformer_encoder_block.py | mag389/holbertonschool-machine_learning | train | 2 |
1ad9f41312f5fcb7f8538697176b48a66a916152 | [
"self.id = id_\nself.blob = blob\nif label is None:\n self.label = id_\nelse:\n self.label = label\nself._collection_path = deque([self])",
"cu = self.scraper.current_item\nif self is cu:\n return\nif cu.items and self in cu.items:\n self.scraper.move_to(self)\n return\nif self is cu.parent:\n s... | <|body_start_0|>
self.id = id_
self.blob = blob
if label is None:
self.label = id_
else:
self.label = label
self._collection_path = deque([self])
<|end_body_0|>
<|body_start_1|>
cu = self.scraper.current_item
if self is cu:
ret... | Common base class for collections and datasets. | Item | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Item:
"""Common base class for collections and datasets."""
def __init__(self, id_, label=None, blob=None):
"""Use blob to store any custom data."""
<|body_0|>
def _move_here(self):
"""Move the cursor to this item."""
<|body_1|>
def path(self):
... | stack_v2_sparse_classes_75kplus_train_073552 | 20,757 | permissive | [
{
"docstring": "Use blob to store any custom data.",
"name": "__init__",
"signature": "def __init__(self, id_, label=None, blob=None)"
},
{
"docstring": "Move the cursor to this item.",
"name": "_move_here",
"signature": "def _move_here(self)"
},
{
"docstring": "All named collect... | 4 | null | Implement the Python class `Item` described below.
Class description:
Common base class for collections and datasets.
Method signatures and docstrings:
- def __init__(self, id_, label=None, blob=None): Use blob to store any custom data.
- def _move_here(self): Move the cursor to this item.
- def path(self): All named... | Implement the Python class `Item` described below.
Class description:
Common base class for collections and datasets.
Method signatures and docstrings:
- def __init__(self, id_, label=None, blob=None): Use blob to store any custom data.
- def _move_here(self): Move the cursor to this item.
- def path(self): All named... | 92ca985310b0fb1793f8a72da1c0e3fd45c46238 | <|skeleton|>
class Item:
"""Common base class for collections and datasets."""
def __init__(self, id_, label=None, blob=None):
"""Use blob to store any custom data."""
<|body_0|>
def _move_here(self):
"""Move the cursor to this item."""
<|body_1|>
def path(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Item:
"""Common base class for collections and datasets."""
def __init__(self, id_, label=None, blob=None):
"""Use blob to store any custom data."""
self.id = id_
self.blob = blob
if label is None:
self.label = id_
else:
self.label = label
... | the_stack_v2_python_sparse | statscraper/base_scraper.py | Patechoc/statscraper | train | 1 |
20dd0bc859c17a8325bf80a746cd9baf1a80bdd4 | [
"if not nums:\n return None\nmax_idx = 0\nmax = nums[0]\nfor idx, i in enumerate(nums):\n if i > max:\n max = i\n max_idx = idx\nroot = TreeNode(max)\nroot.left = self.constructMaximumBinaryTree(nums[0:max_idx])\nroot.right = self.constructMaximumBinaryTree(nums[max_idx + 1:])\nreturn root",
"... | <|body_start_0|>
if not nums:
return None
max_idx = 0
max = nums[0]
for idx, i in enumerate(nums):
if i > max:
max = i
max_idx = idx
root = TreeNode(max)
root.left = self.constructMaximumBinaryTree(nums[0:max_idx])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
"""Time complexity : O(n^2). 一般情况下 O(nlogn) Space complexity : O(n)"""
<|body_0|>
def constructMaximumBinaryTree2(self, nums: List[int]) -> TreeNode:
"""Time complexity : O(n)"""
<|b... | stack_v2_sparse_classes_75kplus_train_073553 | 1,152 | no_license | [
{
"docstring": "Time complexity : O(n^2). 一般情况下 O(nlogn) Space complexity : O(n)",
"name": "constructMaximumBinaryTree",
"signature": "def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode"
},
{
"docstring": "Time complexity : O(n)",
"name": "constructMaximumBinaryTree2",
"si... | 2 | stack_v2_sparse_classes_30k_val_001230 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode: Time complexity : O(n^2). 一般情况下 O(nlogn) Space complexity : O(n)
- def constructMaximumBinaryTree2(self, nums: ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode: Time complexity : O(n^2). 一般情况下 O(nlogn) Space complexity : O(n)
- def constructMaximumBinaryTree2(self, nums: ... | d99eb75a74e38c91effda81cfc7341679422f005 | <|skeleton|>
class Solution:
def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
"""Time complexity : O(n^2). 一般情况下 O(nlogn) Space complexity : O(n)"""
<|body_0|>
def constructMaximumBinaryTree2(self, nums: List[int]) -> TreeNode:
"""Time complexity : O(n)"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
"""Time complexity : O(n^2). 一般情况下 O(nlogn) Space complexity : O(n)"""
if not nums:
return None
max_idx = 0
max = nums[0]
for idx, i in enumerate(nums):
if i > max:
... | the_stack_v2_python_sparse | Python/Maximum_Binary_Tree.py | mt3925/leetcode | train | 0 | |
160a542bc18cf1418d0d7b5d324be2f9cdd52502 | [
"parser = reqparse.RequestParser()\nparser.add_argument('Authorization', type=str, location='headers', required=True)\nparser.add_argument('other_user_id', type=int, location='args', required=False)\nargs = parser.parse_args()\ntry:\n user = User.query.filter(User.fitpals_secret == args.Authorization).first()\n ... | <|body_start_0|>
parser = reqparse.RequestParser()
parser.add_argument('Authorization', type=str, location='headers', required=True)
parser.add_argument('other_user_id', type=int, location='args', required=False)
args = parser.parse_args()
try:
user = User.query.filte... | MessageThreadsAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessageThreadsAPI:
def get(self):
"""Get all message threads for a user, specified by Authorization Will not return any message threads that have been "deleted". :reqheader Authorization: facebook secret :query int other_user_id: Get message thread between requester and other_user :statu... | stack_v2_sparse_classes_75kplus_train_073554 | 22,930 | no_license | [
{
"docstring": "Get all message threads for a user, specified by Authorization Will not return any message threads that have been \"deleted\". :reqheader Authorization: facebook secret :query int other_user_id: Get message thread between requester and other_user :status 401: Not Authorized. :status 200: Message... | 2 | stack_v2_sparse_classes_30k_train_022955 | Implement the Python class `MessageThreadsAPI` described below.
Class description:
Implement the MessageThreadsAPI class.
Method signatures and docstrings:
- def get(self): Get all message threads for a user, specified by Authorization Will not return any message threads that have been "deleted". :reqheader Authoriza... | Implement the Python class `MessageThreadsAPI` described below.
Class description:
Implement the MessageThreadsAPI class.
Method signatures and docstrings:
- def get(self): Get all message threads for a user, specified by Authorization Will not return any message threads that have been "deleted". :reqheader Authoriza... | 6f85f3541de549ea65bde234bf2c5afa7bc06914 | <|skeleton|>
class MessageThreadsAPI:
def get(self):
"""Get all message threads for a user, specified by Authorization Will not return any message threads that have been "deleted". :reqheader Authorization: facebook secret :query int other_user_id: Get message thread between requester and other_user :statu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MessageThreadsAPI:
def get(self):
"""Get all message threads for a user, specified by Authorization Will not return any message threads that have been "deleted". :reqheader Authorization: facebook secret :query int other_user_id: Get message thread between requester and other_user :status 401: Not Aut... | the_stack_v2_python_sparse | RestDatabase/app/controllers/MessagesAPI.py | strudels/FitPalsBackend | train | 3 | |
aa072a1de0119749fe932f4c50674a1fb2a470e3 | [
"self.CONFIG = config\nself.CHECKING_TIME = int(Misc.hasKey(self.CONFIG, 'CHECKING_TIME', 10))\nself.URL = self.CONFIG['URL_BASE']\nself.controllers = {}",
"cp = CommPool(self.CONFIG, preferred_url=CommPool.URL_TICKETS)\ncp.logFromCore(Messages.system_controllers_connect.format(cp.URL_BASE), LogTypes.INFO, self._... | <|body_start_0|>
self.CONFIG = config
self.CHECKING_TIME = int(Misc.hasKey(self.CONFIG, 'CHECKING_TIME', 10))
self.URL = self.CONFIG['URL_BASE']
self.controllers = {}
<|end_body_0|>
<|body_start_1|>
cp = CommPool(self.CONFIG, preferred_url=CommPool.URL_TICKETS)
cp.logFro... | Class to load all device controllers. | LoaderOfController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoaderOfController:
"""Class to load all device controllers."""
def __init__(self, config):
"""Initialize all variables"""
<|body_0|>
def start(self):
"""Start load of all device controllers"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.C... | stack_v2_sparse_classes_75kplus_train_073555 | 1,956 | permissive | [
{
"docstring": "Initialize all variables",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Start load of all device controllers",
"name": "start",
"signature": "def start(self)"
}
] | 2 | null | Implement the Python class `LoaderOfController` described below.
Class description:
Class to load all device controllers.
Method signatures and docstrings:
- def __init__(self, config): Initialize all variables
- def start(self): Start load of all device controllers | Implement the Python class `LoaderOfController` described below.
Class description:
Class to load all device controllers.
Method signatures and docstrings:
- def __init__(self, config): Initialize all variables
- def start(self): Start load of all device controllers
<|skeleton|>
class LoaderOfController:
"""Clas... | 0ae0149e455a5d62beaab3eb778f1257bf881483 | <|skeleton|>
class LoaderOfController:
"""Class to load all device controllers."""
def __init__(self, config):
"""Initialize all variables"""
<|body_0|>
def start(self):
"""Start load of all device controllers"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoaderOfController:
"""Class to load all device controllers."""
def __init__(self, config):
"""Initialize all variables"""
self.CONFIG = config
self.CHECKING_TIME = int(Misc.hasKey(self.CONFIG, 'CHECKING_TIME', 10))
self.URL = self.CONFIG['URL_BASE']
self.controlle... | the_stack_v2_python_sparse | Core/LoaderOfController.py | Turing-IA-IHC/Home-Monitor | train | 1 |
491812f9b3f909220c8638facf042e6d1a20a2c5 | [
"body = parse_data(request, 'POST')\ngroup = ProjectGroup(**body)\nsave(group)\nreturn Response.success(group)",
"parse_data(request, 'DELETE')\nid = kwargs['pk']\ngroup = get_by_id(id)\ntry:\n from backend.handler.project.project import count_by_group\nexcept ImportError:\n raise PlatformError.error(ErrorC... | <|body_start_0|>
body = parse_data(request, 'POST')
group = ProjectGroup(**body)
save(group)
return Response.success(group)
<|end_body_0|>
<|body_start_1|>
parse_data(request, 'DELETE')
id = kwargs['pk']
group = get_by_id(id)
try:
from backend... | ProjectGroupViewSet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectGroupViewSet:
def create(self, request, *args, **kwargs):
"""创建项目分组"""
<|body_0|>
def destroy(self, request, *args, **kwargs):
"""根据 id 删除项目分组"""
<|body_1|>
def update(self, request, *args, **kwargs):
"""修改项目分组"""
<|body_2|>
d... | stack_v2_sparse_classes_75kplus_train_073556 | 2,791 | permissive | [
{
"docstring": "创建项目分组",
"name": "create",
"signature": "def create(self, request, *args, **kwargs)"
},
{
"docstring": "根据 id 删除项目分组",
"name": "destroy",
"signature": "def destroy(self, request, *args, **kwargs)"
},
{
"docstring": "修改项目分组",
"name": "update",
"signature": ... | 4 | null | Implement the Python class `ProjectGroupViewSet` described below.
Class description:
Implement the ProjectGroupViewSet class.
Method signatures and docstrings:
- def create(self, request, *args, **kwargs): 创建项目分组
- def destroy(self, request, *args, **kwargs): 根据 id 删除项目分组
- def update(self, request, *args, **kwargs):... | Implement the Python class `ProjectGroupViewSet` described below.
Class description:
Implement the ProjectGroupViewSet class.
Method signatures and docstrings:
- def create(self, request, *args, **kwargs): 创建项目分组
- def destroy(self, request, *args, **kwargs): 根据 id 删除项目分组
- def update(self, request, *args, **kwargs):... | d7008343c25ec7f47acb670ae5c9b9b5f0593d63 | <|skeleton|>
class ProjectGroupViewSet:
def create(self, request, *args, **kwargs):
"""创建项目分组"""
<|body_0|>
def destroy(self, request, *args, **kwargs):
"""根据 id 删除项目分组"""
<|body_1|>
def update(self, request, *args, **kwargs):
"""修改项目分组"""
<|body_2|>
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectGroupViewSet:
def create(self, request, *args, **kwargs):
"""创建项目分组"""
body = parse_data(request, 'POST')
group = ProjectGroup(**body)
save(group)
return Response.success(group)
def destroy(self, request, *args, **kwargs):
"""根据 id 删除项目分组"""
... | the_stack_v2_python_sparse | backend/handler/project/project_group.py | felixu1992/testing-platform | train | 0 | |
89aabd23ce18f6a7b8c19e9ef9d32212c596b9dd | [
"series, lag = data\ntest_stat = abs(thinkstats2.SerialCorr(series, lag))\nreturn test_stat",
"series, lag = self.data\npermutation = series.reindex(np.random.permutation(series.index))\nreturn (permutation, lag)"
] | <|body_start_0|>
series, lag = data
test_stat = abs(thinkstats2.SerialCorr(series, lag))
return test_stat
<|end_body_0|>
<|body_start_1|>
series, lag = self.data
permutation = series.reindex(np.random.permutation(series.index))
return (permutation, lag)
<|end_body_1|>
| Test seial correlations | SerialCorrelationTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SerialCorrelationTest:
"""Test seial correlations"""
def TestStatistic(self, data):
"""computes the test statistic @param: data (tuple) - x and y values returns @param: test_stat"""
<|body_0|>
def RunModel(self):
"""Run the model of the null hypothesis returns: @... | stack_v2_sparse_classes_75kplus_train_073557 | 4,572 | no_license | [
{
"docstring": "computes the test statistic @param: data (tuple) - x and y values returns @param: test_stat",
"name": "TestStatistic",
"signature": "def TestStatistic(self, data)"
},
{
"docstring": "Run the model of the null hypothesis returns: @param: permutation, lag - simulated data",
"na... | 2 | stack_v2_sparse_classes_30k_train_036064 | Implement the Python class `SerialCorrelationTest` described below.
Class description:
Test seial correlations
Method signatures and docstrings:
- def TestStatistic(self, data): computes the test statistic @param: data (tuple) - x and y values returns @param: test_stat
- def RunModel(self): Run the model of the null ... | Implement the Python class `SerialCorrelationTest` described below.
Class description:
Test seial correlations
Method signatures and docstrings:
- def TestStatistic(self, data): computes the test statistic @param: data (tuple) - x and y values returns @param: test_stat
- def RunModel(self): Run the model of the null ... | cb5e0df827f85f39951dbda236e2fe0b382f19d1 | <|skeleton|>
class SerialCorrelationTest:
"""Test seial correlations"""
def TestStatistic(self, data):
"""computes the test statistic @param: data (tuple) - x and y values returns @param: test_stat"""
<|body_0|>
def RunModel(self):
"""Run the model of the null hypothesis returns: @... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SerialCorrelationTest:
"""Test seial correlations"""
def TestStatistic(self, data):
"""computes the test statistic @param: data (tuple) - x and y values returns @param: test_stat"""
series, lag = data
test_stat = abs(thinkstats2.SerialCorr(series, lag))
return test_stat
... | the_stack_v2_python_sparse | DSC530_Paulovici_Exercise_10_2.py | kevinpau/Bellevue_University_DSC_530 | train | 0 |
65726c34cc237923ead167730f30bb1963a2294f | [
"if root is None:\n return []\nres = []\nres.append(root.val)\nres.extend(self.preorderTraversal(root.left))\nres.extend(self.preorderTraversal(root.right))\nreturn res",
"if root is None:\n return []\nres = []\nres.extend(self.inorderTraversal(root.left))\nres.append(root.val)\nres.extend(self.inorderTrave... | <|body_start_0|>
if root is None:
return []
res = []
res.append(root.val)
res.extend(self.preorderTraversal(root.left))
res.extend(self.preorderTraversal(root.right))
return res
<|end_body_0|>
<|body_start_1|>
if root is None:
return []
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def preorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def inorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def postorderTraversal(self, root):
""":type root: Tree... | stack_v2_sparse_classes_75kplus_train_073558 | 1,813 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "preorderTraversal",
"signature": "def preorderTraversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "inorderTraversal",
"signature": "def inorderTraversal(self, root)"
},
{
"doc... | 3 | stack_v2_sparse_classes_30k_train_039387 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def postorderTraversal(self... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def inorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def postorderTraversal(self... | 79dee7dab41830c4ff9e38858dad229815c719a0 | <|skeleton|>
class Solution:
def preorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def inorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
def postorderTraversal(self, root):
""":type root: Tree... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def preorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
if root is None:
return []
res = []
res.append(root.val)
res.extend(self.preorderTraversal(root.left))
res.extend(self.preorderTraversal(root.right))
re... | the_stack_v2_python_sparse | Cracking_the_Code_Interview/Leetcode/6.Binary_Tree/Traversal/144_94_145.Traversal_Recursive.py | lzxyzq/Cracking_the_Coding_Interview | train | 0 | |
00f3b73a17f249a6cb3ac196ce9111290f2d5d1a | [
"try:\n igdb = request.GET['igdb']\n game = Game.objects.get(igdb=igdb)\n user = CustomUser.objects.get(id=request.user.id)\n r = Ratings.objects.get(game=game, user=user)\nexcept ObjectDoesNotExist:\n return Response({})\nserializer = RatingSerializer(r)\nreturn Response(serializer.data)",
"rating... | <|body_start_0|>
try:
igdb = request.GET['igdb']
game = Game.objects.get(igdb=igdb)
user = CustomUser.objects.get(id=request.user.id)
r = Ratings.objects.get(game=game, user=user)
except ObjectDoesNotExist:
return Response({})
serialize... | Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint. | Rate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rate:
"""Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint."... | stack_v2_sparse_classes_75kplus_train_073559 | 15,728 | no_license | [
{
"docstring": "Get rating for a specific game by the logged-in user. If the game or rating don't exist in the database, no rating exists, so we return nothing. Args: game: the game ID. Returns: response: a RatingSerializer indicating the user, game and rating.",
"name": "get",
"signature": "def get(sel... | 2 | stack_v2_sparse_classes_30k_train_054206 | Implement the Python class `Rate` described below.
Class description:
Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authent... | Implement the Python class `Rate` described below.
Class description:
Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authent... | 7f7e44ca0dae3525394458c16b7093f90612524b | <|skeleton|>
class Rate:
"""Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rate:
"""Endpoint related to rating a game. Users can rate a game in a scale of 1 to 10. This value is saved in the Ratigs model, which takes the IDs of a user and a game as foreign keys. This endpoint accepts both GET and POST methods. Users must be authenticated to interact with this endpoint."""
def g... | the_stack_v2_python_sparse | backend/actions/views.py | RMalmberg/overworld | train | 3 |
3a539eaa631bf4c7dc1318a522905abdaaf78b8b | [
"self.kafo = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nself.user1 = Employee.objects.create(username='u1', first_name='f_u1', last_name='l_u1', telephone_number='31312', email='he@he.he', favorite_coffee='Rozpuszczalna', caffe=self.kafo)\nself.us... | <|body_start_0|>
self.kafo = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.user1 = Employee.objects.create(username='u1', first_name='f_u1', last_name='l_u1', telephone_number='31312', email='he@he.he', favorite_coffee='Rozpuszczalna'... | Tests of WorkedHoursForm. | WorkedHoursFormTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkedHoursFormTest:
"""Tests of WorkedHoursForm."""
def setUp(self):
"""Set up data to tests."""
<|body_0|>
def test_workedhours(self):
"""Check validation - should pass."""
<|body_1|>
def test_workedhours_two_employees(self):
"""Test Worked... | stack_v2_sparse_classes_75kplus_train_073560 | 8,264 | permissive | [
{
"docstring": "Set up data to tests.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Check validation - should pass.",
"name": "test_workedhours",
"signature": "def test_workedhours(self)"
},
{
"docstring": "Test WorkedHours forms for two employees.",
"n... | 4 | stack_v2_sparse_classes_30k_train_028972 | Implement the Python class `WorkedHoursFormTest` described below.
Class description:
Tests of WorkedHoursForm.
Method signatures and docstrings:
- def setUp(self): Set up data to tests.
- def test_workedhours(self): Check validation - should pass.
- def test_workedhours_two_employees(self): Test WorkedHours forms for... | Implement the Python class `WorkedHoursFormTest` described below.
Class description:
Tests of WorkedHoursForm.
Method signatures and docstrings:
- def setUp(self): Set up data to tests.
- def test_workedhours(self): Check validation - should pass.
- def test_workedhours_two_employees(self): Test WorkedHours forms for... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class WorkedHoursFormTest:
"""Tests of WorkedHoursForm."""
def setUp(self):
"""Set up data to tests."""
<|body_0|>
def test_workedhours(self):
"""Check validation - should pass."""
<|body_1|>
def test_workedhours_two_employees(self):
"""Test Worked... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorkedHoursFormTest:
"""Tests of WorkedHoursForm."""
def setUp(self):
"""Set up data to tests."""
self.kafo = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.user1 = Employee.objects.create(username='u1', first_na... | the_stack_v2_python_sparse | caffe/hours/test_forms.py | VirrageS/io-kawiarnie | train | 3 |
b4acf48fb6c1a75a53eba1c3672724bfab517093 | [
"self.selenium.wait_until_location_contains('/view', timeout=60, message='Record view did not open in 1 min')\nself.selenium.location_should_contain(f'/lightning/r/npe5__Affiliation__c/', message='Current page is not an Affiliation record view')\nself.selenium.wait_until_page_contains('Affiliation Information')",
... | <|body_start_0|>
self.selenium.wait_until_location_contains('/view', timeout=60, message='Record view did not open in 1 min')
self.selenium.location_should_contain(f'/lightning/r/npe5__Affiliation__c/', message='Current page is not an Affiliation record view')
self.selenium.wait_until_page_conta... | AffiliationDetailPage | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AffiliationDetailPage:
def _is_current_page(self):
"""Verify we are on the Account detail page by verifying that the url contains '/view'"""
<|body_0|>
def save_affiliation_record(self):
"""Saves the affiliation record and waits until save mode is exited"""
<... | stack_v2_sparse_classes_75kplus_train_073561 | 1,317 | permissive | [
{
"docstring": "Verify we are on the Account detail page by verifying that the url contains '/view'",
"name": "_is_current_page",
"signature": "def _is_current_page(self)"
},
{
"docstring": "Saves the affiliation record and waits until save mode is exited",
"name": "save_affiliation_record",... | 2 | null | Implement the Python class `AffiliationDetailPage` described below.
Class description:
Implement the AffiliationDetailPage class.
Method signatures and docstrings:
- def _is_current_page(self): Verify we are on the Account detail page by verifying that the url contains '/view'
- def save_affiliation_record(self): Sav... | Implement the Python class `AffiliationDetailPage` described below.
Class description:
Implement the AffiliationDetailPage class.
Method signatures and docstrings:
- def _is_current_page(self): Verify we are on the Account detail page by verifying that the url contains '/view'
- def save_affiliation_record(self): Sav... | e6ab6e5c5c095604ba8a024dac79351a94b59dce | <|skeleton|>
class AffiliationDetailPage:
def _is_current_page(self):
"""Verify we are on the Account detail page by verifying that the url contains '/view'"""
<|body_0|>
def save_affiliation_record(self):
"""Saves the affiliation record and waits until save mode is exited"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AffiliationDetailPage:
def _is_current_page(self):
"""Verify we are on the Account detail page by verifying that the url contains '/view'"""
self.selenium.wait_until_location_contains('/view', timeout=60, message='Record view did not open in 1 min')
self.selenium.location_should_contai... | the_stack_v2_python_sparse | robot/Cumulus/resources/AffiliationPageObject.py | SalesforceFoundation/NPSP | train | 239 | |
ac12766ab40db82d403104e19ffe82c6060f678e | [
"if isinstance(data_particle, DataParticle):\n sample_dict = data_particle.generate_dict()\nelif isinstance(data_particle, basestring):\n sample_dict = json.loads(data_particle)\nelif isinstance(data_particle, dict):\n sample_dict = data_particle\nelse:\n raise IDKException('invalid data particle type: ... | <|body_start_0|>
if isinstance(data_particle, DataParticle):
sample_dict = data_particle.generate_dict()
elif isinstance(data_particle, basestring):
sample_dict = json.loads(data_particle)
elif isinstance(data_particle, dict):
sample_dict = data_particle
... | A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base. | ParticleTestMixin | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParticleTestMixin:
"""A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base."""
def convert_data_particle_to_dict(self, data_particle):
"""Convert a data particle object to a dic... | stack_v2_sparse_classes_75kplus_train_073562 | 5,556 | permissive | [
{
"docstring": "Convert a data particle object to a dict. This will work for data particles as DataParticle object, dictionaries or a string @param data_particle data particle @return dictionary representation of a data particle",
"name": "convert_data_particle_to_dict",
"signature": "def convert_data_p... | 4 | stack_v2_sparse_classes_30k_train_018777 | Implement the Python class `ParticleTestMixin` described below.
Class description:
A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base.
Method signatures and docstrings:
- def convert_data_particle_to_dict(self... | Implement the Python class `ParticleTestMixin` described below.
Class description:
A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base.
Method signatures and docstrings:
- def convert_data_particle_to_dict(self... | bdbf01f5614e7188ce19596704794466e5683b30 | <|skeleton|>
class ParticleTestMixin:
"""A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base."""
def convert_data_particle_to_dict(self, data_particle):
"""Convert a data particle object to a dic... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParticleTestMixin:
"""A class with some methods to test data particles. Intended to be mixed into test classes so that particles can be tested in different areas of the MI code base."""
def convert_data_particle_to_dict(self, data_particle):
"""Convert a data particle object to a dict. This will ... | the_stack_v2_python_sparse | mi/core/unit_test.py | oceanobservatories/mi-instrument | train | 1 |
6b254d1513ee6d794723eee70b132ffef7267874 | [
"if num1 == '0' or num2 == '0':\n return '0'\n\ndef mul(num, d):\n res = ''\n carry = 0\n for n in num[::-1]:\n t = int(n) * int(d) + carry\n res = str(t % 10) + res\n carry = t // 10\n return str(carry) + res if carry > 0 else res\n\ndef add(m, n):\n if len(m) > len(n):\n ... | <|body_start_0|>
if num1 == '0' or num2 == '0':
return '0'
def mul(num, d):
res = ''
carry = 0
for n in num[::-1]:
t = int(n) * int(d) + carry
res = str(t % 10) + res
carry = t // 10
return str(c... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def multiply1(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_0|>
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if num1 == '0' or ... | stack_v2_sparse_classes_75kplus_train_073563 | 1,520 | no_license | [
{
"docstring": ":type num1: str :type num2: str :rtype: str",
"name": "multiply1",
"signature": "def multiply1(self, num1, num2)"
},
{
"docstring": ":type num1: str :type num2: str :rtype: str",
"name": "multiply",
"signature": "def multiply(self, num1, num2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_039552 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply1(self, num1, num2): :type num1: str :type num2: str :rtype: str
- def multiply(self, num1, num2): :type num1: str :type num2: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def multiply1(self, num1, num2): :type num1: str :type num2: str :rtype: str
- def multiply(self, num1, num2): :type num1: str :type num2: str :rtype: str
<|skeleton|>
class Sol... | e5b018493bbd12edcdcd0434f35d9c358106d391 | <|skeleton|>
class Solution:
def multiply1(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_0|>
def multiply(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def multiply1(self, num1, num2):
""":type num1: str :type num2: str :rtype: str"""
if num1 == '0' or num2 == '0':
return '0'
def mul(num, d):
res = ''
carry = 0
for n in num[::-1]:
t = int(n) * int(d) + carry
... | the_stack_v2_python_sparse | py/leetcode/43.py | wfeng1991/learnpy | train | 0 | |
2a1ffefb9cbca521e658bdbaa5e4842aab16f96b | [
"self.char_cnn_layers = hyper_parameters['model'].get('char_cnn_layers', [[256, 7, 3], [256, 7, 3], [256, 3, -1], [256, 3, -1], [256, 3, -1], [256, 3, 3]])\nself.full_connect_layers = hyper_parameters['model'].get('full_connect_layers', [1024, 1024])\nself.threshold = hyper_parameters['model'].get('threshold', 1e-0... | <|body_start_0|>
self.char_cnn_layers = hyper_parameters['model'].get('char_cnn_layers', [[256, 7, 3], [256, 7, 3], [256, 3, -1], [256, 3, -1], [256, 3, -1], [256, 3, 3]])
self.full_connect_layers = hyper_parameters['model'].get('full_connect_layers', [1024, 1024])
self.threshold = hyper_paramet... | CharCNNGraph | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharCNNGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
<|body_0|>
def create_model(self, hyper_parameters):
"""构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl"""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus_train_073564 | 2,306 | permissive | [
{
"docstring": "初始化 :param hyper_parameters: json,超参",
"name": "__init__",
"signature": "def __init__(self, hyper_parameters)"
},
{
"docstring": "构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl",
"name": "create_model",
"signature": "def create_mod... | 2 | stack_v2_sparse_classes_30k_train_031051 | Implement the Python class `CharCNNGraph` described below.
Class description:
Implement the CharCNNGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参
- def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper paramete... | Implement the Python class `CharCNNGraph` described below.
Class description:
Implement the CharCNNGraph class.
Method signatures and docstrings:
- def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参
- def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper paramete... | 640e3f44f90d9d8046546f7e1a93a29ebe5c8d30 | <|skeleton|>
class CharCNNGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
<|body_0|>
def create_model(self, hyper_parameters):
"""构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl"""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CharCNNGraph:
def __init__(self, hyper_parameters):
"""初始化 :param hyper_parameters: json,超参"""
self.char_cnn_layers = hyper_parameters['model'].get('char_cnn_layers', [[256, 7, 3], [256, 7, 3], [256, 3, -1], [256, 3, -1], [256, 3, -1], [256, 3, 3]])
self.full_connect_layers = hyper_par... | the_stack_v2_python_sparse | keras_textclassification/m03_CharCNN/graph_zhang.py | wzjames/Keras-TextClassification | train | 1 | |
0cf9c7b76ea93ed291cfd91179e38e62f4ea30c7 | [
"try:\n id = int(id)\nexcept ValueError:\n return (None, 404)\nteam = Team.query.filter(Team.id == id).first()\nif team is None:\n return (None, 404)\ntoken = request.headers.get('Authorization', None)\nuser = User.verify_auth_token(token)\nif user.role == 'professor' and team.professor_id != user.id:\n ... | <|body_start_0|>
try:
id = int(id)
except ValueError:
return (None, 404)
team = Team.query.filter(Team.id == id).first()
if team is None:
return (None, 404)
token = request.headers.get('Authorization', None)
user = User.verify_auth_toke... | TeamItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamItem:
def get(self, id):
"""Returns a team."""
<|body_0|>
def put(self, id):
"""Updates a team. Use this method to edit a team."""
<|body_1|>
def delete(self, id):
"""Deletes a team."""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_073565 | 6,299 | no_license | [
{
"docstring": "Returns a team.",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Updates a team. Use this method to edit a team.",
"name": "put",
"signature": "def put(self, id)"
},
{
"docstring": "Deletes a team.",
"name": "delete",
"signature": "def ... | 3 | stack_v2_sparse_classes_30k_train_042030 | Implement the Python class `TeamItem` described below.
Class description:
Implement the TeamItem class.
Method signatures and docstrings:
- def get(self, id): Returns a team.
- def put(self, id): Updates a team. Use this method to edit a team.
- def delete(self, id): Deletes a team. | Implement the Python class `TeamItem` described below.
Class description:
Implement the TeamItem class.
Method signatures and docstrings:
- def get(self, id): Returns a team.
- def put(self, id): Updates a team. Use this method to edit a team.
- def delete(self, id): Deletes a team.
<|skeleton|>
class TeamItem:
... | d427358dd52329438c4f42bed929bfa53d9ccfc5 | <|skeleton|>
class TeamItem:
def get(self, id):
"""Returns a team."""
<|body_0|>
def put(self, id):
"""Updates a team. Use this method to edit a team."""
<|body_1|>
def delete(self, id):
"""Deletes a team."""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeamItem:
def get(self, id):
"""Returns a team."""
try:
id = int(id)
except ValueError:
return (None, 404)
team = Team.query.filter(Team.id == id).first()
if team is None:
return (None, 404)
token = request.headers.get('Author... | the_stack_v2_python_sparse | api/teams/teams.py | jvazquez96/wt_test | train | 0 | |
1169bf240529f94428de44cebaa6591999db49b8 | [
"super(StEmb, self).__init__()\nself.col_names = col_names\nself.max_idxs = max_idxs\nself.embedding_size = embedding_size\nself.use_cuda = use_cuda\nself.embeddings = nn.ModuleList([Meta_Embedding(max_idx + 1, self.embedding_size) for max_idx in self.max_idxs.values()])",
"concat_embeddings = []\nbatch_size = st... | <|body_start_0|>
super(StEmb, self).__init__()
self.col_names = col_names
self.max_idxs = max_idxs
self.embedding_size = embedding_size
self.use_cuda = use_cuda
self.embeddings = nn.ModuleList([Meta_Embedding(max_idx + 1, self.embedding_size) for max_idx in self.max_idxs.... | StEmb | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StEmb:
def __init__(self, col_names, max_idxs, embedding_size=4, use_cuda=True):
"""fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout use_cuda: bool, True for gpu or False for cpu"""
... | stack_v2_sparse_classes_75kplus_train_073566 | 9,497 | permissive | [
{
"docstring": "fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout use_cuda: bool, True for gpu or False for cpu",
"name": "__init__",
"signature": "def __init__(self, col_names, max_idxs, embedding_size=4,... | 2 | stack_v2_sparse_classes_30k_train_041799 | Implement the Python class `StEmb` described below.
Class description:
Implement the StEmb class.
Method signatures and docstrings:
- def __init__(self, col_names, max_idxs, embedding_size=4, use_cuda=True): fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: pr... | Implement the Python class `StEmb` described below.
Class description:
Implement the StEmb class.
Method signatures and docstrings:
- def __init__(self, col_names, max_idxs, embedding_size=4, use_cuda=True): fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: pr... | 2969ed6c740d04283aa54af4e2c267cb980c96fe | <|skeleton|>
class StEmb:
def __init__(self, col_names, max_idxs, embedding_size=4, use_cuda=True):
"""fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout use_cuda: bool, True for gpu or False for cpu"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StEmb:
def __init__(self, col_names, max_idxs, embedding_size=4, use_cuda=True):
"""fnames: feature names max_idxs: array of max_idx of each feature embedding_size: size of embedding dropout: prob for dropout, set None if no dropout use_cuda: bool, True for gpu or False for cpu"""
super(StEmb,... | the_stack_v2_python_sparse | Application/audience expansion/model.py | easezyc/deep-transfer-learning | train | 801 | |
bea510e3466d9c17839bd176c8024a8cb589664a | [
"if asyncEstimate:\n task = self._coreEstimator.asyncEstimate(warp.warpedImage.coreImage)\n return AsyncTask(task, POST_PROCESSING.postProcessing)\nerror, estimation = self._coreEstimator.estimate(warp.warpedImage.coreImage)\nreturn POST_PROCESSING.postProcessing(error, estimation)",
"coreImages = [warp.war... | <|body_start_0|>
if asyncEstimate:
task = self._coreEstimator.asyncEstimate(warp.warpedImage.coreImage)
return AsyncTask(task, POST_PROCESSING.postProcessing)
error, estimation = self._coreEstimator.estimate(warp.warpedImage.coreImage)
return POST_PROCESSING.postProcessin... | Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`. | ImageColorTypeEstimator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageColorTypeEstimator:
"""Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`."""
def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageColorType, AsyncTask[ImageColorType]]:
"""Estimate image color... | stack_v2_sparse_classes_75kplus_train_073567 | 4,296 | permissive | [
{
"docstring": "Estimate image color type on warp. Args: warp: warped image asyncEstimate: estimate or run estimation in background Returns: estimated image color type if asyncEstimate is false otherwise async task Raises: LunaSDKException: if estimation failed",
"name": "estimate",
"signature": "def es... | 2 | stack_v2_sparse_classes_30k_train_030692 | Implement the Python class `ImageColorTypeEstimator` described below.
Class description:
Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`.
Method signatures and docstrings:
- def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageCo... | Implement the Python class `ImageColorTypeEstimator` described below.
Class description:
Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`.
Method signatures and docstrings:
- def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageCo... | 7a4bebc92ae7a96d8d9c18a024208308942f90cd | <|skeleton|>
class ImageColorTypeEstimator:
"""Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`."""
def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageColorType, AsyncTask[ImageColorType]]:
"""Estimate image color... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageColorTypeEstimator:
"""Image color type estimator. Work on face detections. Allowed types see `ImageColorSchema`."""
def estimate(self, warp: Union[FaceWarp, FaceWarpedImage], asyncEstimate: bool=False) -> Union[ImageColorType, AsyncTask[ImageColorType]]:
"""Estimate image color type on warp... | the_stack_v2_python_sparse | lunavl/sdk/estimators/face_estimators/image_type.py | matemax/lunasdk | train | 16 |
eefa1ffae1934d7a9898f822dcbb07819caa61ed | [
"self.sessionhandler = sessionhandler\nself.url = url\nself.rate = rate\nself.uid = uid\nself.bot = RSSReader(self, url, rate)\nself.task = None",
"def errback(fail):\n logger.log_err(fail.value)\nself.bot.init_session('rssbot', self.url, self.sessionhandler)\nself.bot.uid = self.uid\nself.bot.logged_in = True... | <|body_start_0|>
self.sessionhandler = sessionhandler
self.url = url
self.rate = rate
self.uid = uid
self.bot = RSSReader(self, url, rate)
self.task = None
<|end_body_0|>
<|body_start_1|>
def errback(fail):
logger.log_err(fail.value)
self.bot.... | Initializes new bots. | RSSBotFactory | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RSSBotFactory:
"""Initializes new bots."""
def __init__(self, sessionhandler, uid=None, url=None, rate=None):
"""Initialize the bot. Args: sessionhandler (PortalSessionHandler): The main sessionhandler object. uid (int): User id for the bot. url (str): The RSS URL. rate (int): How of... | stack_v2_sparse_classes_75kplus_train_073568 | 4,450 | permissive | [
{
"docstring": "Initialize the bot. Args: sessionhandler (PortalSessionHandler): The main sessionhandler object. uid (int): User id for the bot. url (str): The RSS URL. rate (int): How often for the RSS to request the latest RSS entries.",
"name": "__init__",
"signature": "def __init__(self, sessionhand... | 2 | stack_v2_sparse_classes_30k_train_037914 | Implement the Python class `RSSBotFactory` described below.
Class description:
Initializes new bots.
Method signatures and docstrings:
- def __init__(self, sessionhandler, uid=None, url=None, rate=None): Initialize the bot. Args: sessionhandler (PortalSessionHandler): The main sessionhandler object. uid (int): User i... | Implement the Python class `RSSBotFactory` described below.
Class description:
Initializes new bots.
Method signatures and docstrings:
- def __init__(self, sessionhandler, uid=None, url=None, rate=None): Initialize the bot. Args: sessionhandler (PortalSessionHandler): The main sessionhandler object. uid (int): User i... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class RSSBotFactory:
"""Initializes new bots."""
def __init__(self, sessionhandler, uid=None, url=None, rate=None):
"""Initialize the bot. Args: sessionhandler (PortalSessionHandler): The main sessionhandler object. uid (int): User id for the bot. url (str): The RSS URL. rate (int): How of... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RSSBotFactory:
"""Initializes new bots."""
def __init__(self, sessionhandler, uid=None, url=None, rate=None):
"""Initialize the bot. Args: sessionhandler (PortalSessionHandler): The main sessionhandler object. uid (int): User id for the bot. url (str): The RSS URL. rate (int): How often for the R... | the_stack_v2_python_sparse | evennia/server/portal/rss.py | evennia/evennia | train | 1,781 |
c89a6e3877d1e190374b0874f81c62f740f26a9f | [
"if self == self.ALL:\n join_by = ' and '\nelif self == self.ANY:\n join_by = ' or '\nprefix = f\"sum by ({', '.join(group_by)}) \" if group_by else 'sum'\nchildren_query = join_by.join((child.query for child in children))\nreturn f'{prefix}({children_query}) >= 1'",
"json_path_filters = ' || '.join((child.... | <|body_start_0|>
if self == self.ALL:
join_by = ' and '
elif self == self.ANY:
join_by = ' or '
prefix = f"sum by ({', '.join(group_by)}) " if group_by else 'sum'
children_query = join_by.join((child.query for child in children))
return f'{prefix}({childre... | The type of relationship a parent has towards its children. | Relationship | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Relationship:
"""The type of relationship a parent has towards its children."""
def build_query(self, children, group_by=None):
"""Build a query to derive an alert rule from its children."""
<|body_0|>
def build_json_path(children, group_by=None):
"""Build a JSON... | stack_v2_sparse_classes_75kplus_train_073569 | 7,171 | permissive | [
{
"docstring": "Build a query to derive an alert rule from its children.",
"name": "build_query",
"signature": "def build_query(self, children, group_by=None)"
},
{
"docstring": "Build a JSON Path to retrieve alert children.",
"name": "build_json_path",
"signature": "def build_json_path(... | 2 | null | Implement the Python class `Relationship` described below.
Class description:
The type of relationship a parent has towards its children.
Method signatures and docstrings:
- def build_query(self, children, group_by=None): Build a query to derive an alert rule from its children.
- def build_json_path(children, group_b... | Implement the Python class `Relationship` described below.
Class description:
The type of relationship a parent has towards its children.
Method signatures and docstrings:
- def build_query(self, children, group_by=None): Build a query to derive an alert rule from its children.
- def build_json_path(children, group_b... | 6854d582f58592675afb3759585ce614b3db08f3 | <|skeleton|>
class Relationship:
"""The type of relationship a parent has towards its children."""
def build_query(self, children, group_by=None):
"""Build a query to derive an alert rule from its children."""
<|body_0|>
def build_json_path(children, group_by=None):
"""Build a JSON... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Relationship:
"""The type of relationship a parent has towards its children."""
def build_query(self, children, group_by=None):
"""Build a query to derive an alert rule from its children."""
if self == self.ALL:
join_by = ' and '
elif self == self.ANY:
join... | the_stack_v2_python_sparse | tools/lib-alert-tree/lib_alert_tree/models.py | scality/metalk8s | train | 321 |
e0adebad64b655dbb5e2c6cebbc8b311010540da | [
"if 'default' in kwargs:\n if version is not None:\n kwargs['default'] = version\n super().__init__(title=title, advanced=advanced, **kwargs)\nelse:\n super().__init__(title=title, advanced=advanced, default=version, **kwargs)",
"if not is_version_valid(value):\n raise InvalidVersionFormat('Ver... | <|body_start_0|>
if 'default' in kwargs:
if version is not None:
kwargs['default'] = version
super().__init__(title=title, advanced=advanced, **kwargs)
else:
super().__init__(title=title, advanced=advanced, default=version, **kwargs)
<|end_body_0|>
<|... | Defines a Version property. Version property permits saving version information with (major.minor.build) format | VersionProperty | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VersionProperty:
"""Defines a Version property. Version property permits saving version information with (major.minor.build) format"""
def __init__(self, version=None, title='Version', advanced=True, **kwargs):
"""Initializes a version property. Keyword Args: Property definitions"""
... | stack_v2_sparse_classes_75kplus_train_073570 | 1,220 | no_license | [
{
"docstring": "Initializes a version property. Keyword Args: Property definitions",
"name": "__init__",
"signature": "def __init__(self, version=None, title='Version', advanced=True, **kwargs)"
},
{
"docstring": "Override default set to make sure it's a valid version",
"name": "__set__",
... | 2 | stack_v2_sparse_classes_30k_train_018367 | Implement the Python class `VersionProperty` described below.
Class description:
Defines a Version property. Version property permits saving version information with (major.minor.build) format
Method signatures and docstrings:
- def __init__(self, version=None, title='Version', advanced=True, **kwargs): Initializes a... | Implement the Python class `VersionProperty` described below.
Class description:
Defines a Version property. Version property permits saving version information with (major.minor.build) format
Method signatures and docstrings:
- def __init__(self, version=None, title='Version', advanced=True, **kwargs): Initializes a... | e2ef4c7b56c4e7e06964fe6f64ae6c497ac31727 | <|skeleton|>
class VersionProperty:
"""Defines a Version property. Version property permits saving version information with (major.minor.build) format"""
def __init__(self, version=None, title='Version', advanced=True, **kwargs):
"""Initializes a version property. Keyword Args: Property definitions"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VersionProperty:
"""Defines a Version property. Version property permits saving version information with (major.minor.build) format"""
def __init__(self, version=None, title='Version', advanced=True, **kwargs):
"""Initializes a version property. Keyword Args: Property definitions"""
if 'd... | the_stack_v2_python_sparse | nio/properties/version.py | niolabs/nio | train | 5 |
58b7753ef62358a7fd7c2056a12f8694fa3a5b20 | [
"kwargs = super(Create_a_challenge_view, self).get_form_kwargs()\nkwargs['user_id'] = self.request.user.pk\nreturn kwargs",
"this_user_model_id = self.request.user.id\ninvitor_user_model_obj = My_custom_user.objects.get(id=this_user_model_id)\nthis_invitation = Invitation_to_challenge.objects.get(id=self.id)\nthi... | <|body_start_0|>
kwargs = super(Create_a_challenge_view, self).get_form_kwargs()
kwargs['user_id'] = self.request.user.pk
return kwargs
<|end_body_0|>
<|body_start_1|>
this_user_model_id = self.request.user.id
invitor_user_model_obj = My_custom_user.objects.get(id=this_user_mode... | Allow user to create a challenge invitation object and challenge object. Send challenge invitation to invitees, submit current user to challenge created. | Create_a_challenge_view | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Create_a_challenge_view:
"""Allow user to create a challenge invitation object and challenge object. Send challenge invitation to invitees, submit current user to challenge created."""
def get_form_kwargs(self):
"""Pass user personal key to the related form"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_073571 | 17,591 | no_license | [
{
"docstring": "Pass user personal key to the related form",
"name": "get_form_kwargs",
"signature": "def get_form_kwargs(self)"
},
{
"docstring": "Set the current user challenge invitation status to accepted.",
"name": "create_invitor_status_accepted",
"signature": "def create_invitor_s... | 3 | stack_v2_sparse_classes_30k_train_007398 | Implement the Python class `Create_a_challenge_view` described below.
Class description:
Allow user to create a challenge invitation object and challenge object. Send challenge invitation to invitees, submit current user to challenge created.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass user pe... | Implement the Python class `Create_a_challenge_view` described below.
Class description:
Allow user to create a challenge invitation object and challenge object. Send challenge invitation to invitees, submit current user to challenge created.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass user pe... | 35880f4918e72990c97e6cfbc200eb60e755f40f | <|skeleton|>
class Create_a_challenge_view:
"""Allow user to create a challenge invitation object and challenge object. Send challenge invitation to invitees, submit current user to challenge created."""
def get_form_kwargs(self):
"""Pass user personal key to the related form"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Create_a_challenge_view:
"""Allow user to create a challenge invitation object and challenge object. Send challenge invitation to invitees, submit current user to challenge created."""
def get_form_kwargs(self):
"""Pass user personal key to the related form"""
kwargs = super(Create_a_chal... | the_stack_v2_python_sparse | challenges/views.py | Jwyman328/fitness_app | train | 0 |
cd2335718f1be7dc4545916a1f5daf10d9335211 | [
"self.camera = PiCamera()\nself.camera_resolution = (math.ceil(resolution[1] / 16) * 16, math.ceil(resolution[0] / 32) * 32, 3)\nself.camera.resolution = resolution\nself.camera.brightness = brightness\nself.camera.contrast = contrast\nself.camera.sharpness = sharpness\nself.camera.saturation = saturation\nself.cam... | <|body_start_0|>
self.camera = PiCamera()
self.camera_resolution = (math.ceil(resolution[1] / 16) * 16, math.ceil(resolution[0] / 32) * 32, 3)
self.camera.resolution = resolution
self.camera.brightness = brightness
self.camera.contrast = contrast
self.camera.sharpness = s... | Class responsible for reading raw input from Raspberry Pi camera. | CameraReader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CameraReader:
"""Class responsible for reading raw input from Raspberry Pi camera."""
def __init__(self, resolution=(640, 480), brightness=30, contrast=100, sharpness=100, saturation=100):
"""Parameters ---------- resolution : (int, int), optional Resolution of captured frames, defau... | stack_v2_sparse_classes_75kplus_train_073572 | 1,436 | permissive | [
{
"docstring": "Parameters ---------- resolution : (int, int), optional Resolution of captured frames, default is 640x480. First number should be multiple of 16, second number should be multiple of 32. Notes ----- Please do note that bigger images may result in higher calculation accuracy as well as longer proc... | 2 | null | Implement the Python class `CameraReader` described below.
Class description:
Class responsible for reading raw input from Raspberry Pi camera.
Method signatures and docstrings:
- def __init__(self, resolution=(640, 480), brightness=30, contrast=100, sharpness=100, saturation=100): Parameters ---------- resolution : ... | Implement the Python class `CameraReader` described below.
Class description:
Class responsible for reading raw input from Raspberry Pi camera.
Method signatures and docstrings:
- def __init__(self, resolution=(640, 480), brightness=30, contrast=100, sharpness=100, saturation=100): Parameters ---------- resolution : ... | 81820b35dab10b14f58d66079b0a8f82ef819bee | <|skeleton|>
class CameraReader:
"""Class responsible for reading raw input from Raspberry Pi camera."""
def __init__(self, resolution=(640, 480), brightness=30, contrast=100, sharpness=100, saturation=100):
"""Parameters ---------- resolution : (int, int), optional Resolution of captured frames, defau... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CameraReader:
"""Class responsible for reading raw input from Raspberry Pi camera."""
def __init__(self, resolution=(640, 480), brightness=30, contrast=100, sharpness=100, saturation=100):
"""Parameters ---------- resolution : (int, int), optional Resolution of captured frames, default is 640x480... | the_stack_v2_python_sparse | mrc/localization/camera/reader.py | Lukasz1928/mobile-robots-control | train | 2 |
54128ba389cd7549e7399daa442b9d21e892ad6b | [
"self.descriptor = 'BOS function'\nif scenario == 'greenfield':\n self.scenario = scenario\nelif scenario == 'solar addition':\n raise NotImplementedError\nelse:\n raise ValueError(\"CostCalculator scenario must be 'greenfield' or 'solar addition'\")\nself.interconnection_size = interconnection_size\nself.... | <|body_start_0|>
self.descriptor = 'BOS function'
if scenario == 'greenfield':
self.scenario = scenario
elif scenario == 'solar addition':
raise NotImplementedError
else:
raise ValueError("CostCalculator scenario must be 'greenfield' or 'solar addition... | CostCalculator class contains tools to determine BOS component costs and Installed costs for a single technology or hybrid plant | CostCalculator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CostCalculator:
"""CostCalculator class contains tools to determine BOS component costs and Installed costs for a single technology or hybrid plant"""
def __init__(self, bos_cost_source, scenario, interconnection_size, wind_installed_cost_mw, solar_installed_cost_mw, modify_costs, cost_reduc... | stack_v2_sparse_classes_75kplus_train_073573 | 7,258 | permissive | [
{
"docstring": ":param bos_cost_source: Defines the type of bos analysis used. Options are 'JSONLookup', 'Cost/MW', 'HybridBOSSE', 'HybridBOSSE manual' :param scenario: 'greenfield' or 'solar addition' :param interconnection_size: Size (MW) of interconnection :param wind_installed_cost_mw: $USD cost/mw for inst... | 3 | null | Implement the Python class `CostCalculator` described below.
Class description:
CostCalculator class contains tools to determine BOS component costs and Installed costs for a single technology or hybrid plant
Method signatures and docstrings:
- def __init__(self, bos_cost_source, scenario, interconnection_size, wind_... | Implement the Python class `CostCalculator` described below.
Class description:
CostCalculator class contains tools to determine BOS component costs and Installed costs for a single technology or hybrid plant
Method signatures and docstrings:
- def __init__(self, bos_cost_source, scenario, interconnection_size, wind_... | e8faa5012cab8335c75f8d1e84270e3127ff64bb | <|skeleton|>
class CostCalculator:
"""CostCalculator class contains tools to determine BOS component costs and Installed costs for a single technology or hybrid plant"""
def __init__(self, bos_cost_source, scenario, interconnection_size, wind_installed_cost_mw, solar_installed_cost_mw, modify_costs, cost_reduc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CostCalculator:
"""CostCalculator class contains tools to determine BOS component costs and Installed costs for a single technology or hybrid plant"""
def __init__(self, bos_cost_source, scenario, interconnection_size, wind_installed_cost_mw, solar_installed_cost_mw, modify_costs, cost_reductions):
... | the_stack_v2_python_sparse | tools/analysis/bos/cost_calculator.py | jlcox119/HOPP | train | 0 |
fd75864686c58be668ffc1684dd95ffcb0299608 | [
"path, user, method = (request.path, request.user, request.method)\nif not path.startswith(API_BASE):\n return True\nif method == 'GET':\n return True\nif method in ['POST', 'PUT', 'DELETE']:\n if not user.is_authenticated():\n if 'HTTP_AUTHORIZATION' in request.META:\n auth = request.MET... | <|body_start_0|>
path, user, method = (request.path, request.user, request.method)
if not path.startswith(API_BASE):
return True
if method == 'GET':
return True
if method in ['POST', 'PUT', 'DELETE']:
if not user.is_authenticated():
if ... | CheckPermissions | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckPermissions:
def user_has_perms(self, request):
"""Check if user has permissions for the URL path and method in the request."""
<|body_0|>
def process_request(self, request):
"""Return None to allow django request to pass through middleware. Return JSON error wi... | stack_v2_sparse_classes_75kplus_train_073574 | 2,193 | permissive | [
{
"docstring": "Check if user has permissions for the URL path and method in the request.",
"name": "user_has_perms",
"signature": "def user_has_perms(self, request)"
},
{
"docstring": "Return None to allow django request to pass through middleware. Return JSON error with status code 403 if user... | 2 | stack_v2_sparse_classes_30k_train_030715 | Implement the Python class `CheckPermissions` described below.
Class description:
Implement the CheckPermissions class.
Method signatures and docstrings:
- def user_has_perms(self, request): Check if user has permissions for the URL path and method in the request.
- def process_request(self, request): Return None to ... | Implement the Python class `CheckPermissions` described below.
Class description:
Implement the CheckPermissions class.
Method signatures and docstrings:
- def user_has_perms(self, request): Check if user has permissions for the URL path and method in the request.
- def process_request(self, request): Return None to ... | 708035e8d2299e70a6d3cecce40970242673426c | <|skeleton|>
class CheckPermissions:
def user_has_perms(self, request):
"""Check if user has permissions for the URL path and method in the request."""
<|body_0|>
def process_request(self, request):
"""Return None to allow django request to pass through middleware. Return JSON error wi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CheckPermissions:
def user_has_perms(self, request):
"""Check if user has permissions for the URL path and method in the request."""
path, user, method = (request.path, request.user, request.method)
if not path.startswith(API_BASE):
return True
if method == 'GET':
... | the_stack_v2_python_sparse | gazetteer/middleware/permissions.py | NYPL/gazetteer | train | 5 | |
feefabeb6afe949d8f7faf0cf316c3db122a2505 | [
"self.constrained = False\nself.bounds = [-inf, inf]\nvalidateName(name)\nArgument.__init__(self, name, value, const)\nreturn",
"Argument.setValue(self, val)\nif lb is not None:\n self.bounds[0] = lb\nif ub is not None:\n self.bounds[1] = ub\nreturn self",
"self.const = bool(const)\nif value is not None:\... | <|body_start_0|>
self.constrained = False
self.bounds = [-inf, inf]
validateName(name)
Argument.__init__(self, name, value, const)
return
<|end_body_0|>
<|body_start_1|>
Argument.setValue(self, val)
if lb is not None:
self.bounds[0] = lb
if ub... | Parameter class. Attributes name -- A name for this Parameter. const -- A flag indicating whether this is considered a constant. _value -- The value of the Parameter. Modified with 'setValue'. value -- Property for 'getValue' and 'setValue'. constrained -- A flag indicating if the Parameter is constrained (default Fals... | Parameter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parameter:
"""Parameter class. Attributes name -- A name for this Parameter. const -- A flag indicating whether this is considered a constant. _value -- The value of the Parameter. Modified with 'setValue'. value -- Property for 'getValue' and 'setValue'. constrained -- A flag indicating if the P... | stack_v2_sparse_classes_75kplus_train_073575 | 9,432 | no_license | [
{
"docstring": "Initialization. name -- The name of this Parameter (must be a valid attribute identifier) value -- The initial value of this Parameter (default 0). const -- A flag inticating whether the Parameter is a constant (like pi). Raises ValueError if the name is not a valid attribute identifier",
"n... | 5 | stack_v2_sparse_classes_30k_val_002771 | Implement the Python class `Parameter` described below.
Class description:
Parameter class. Attributes name -- A name for this Parameter. const -- A flag indicating whether this is considered a constant. _value -- The value of the Parameter. Modified with 'setValue'. value -- Property for 'getValue' and 'setValue'. co... | Implement the Python class `Parameter` described below.
Class description:
Parameter class. Attributes name -- A name for this Parameter. const -- A flag indicating whether this is considered a constant. _value -- The value of the Parameter. Modified with 'setValue'. value -- Property for 'getValue' and 'setValue'. co... | 303f73c570c1d756106aa69724898d5b119c4ead | <|skeleton|>
class Parameter:
"""Parameter class. Attributes name -- A name for this Parameter. const -- A flag indicating whether this is considered a constant. _value -- The value of the Parameter. Modified with 'setValue'. value -- Property for 'getValue' and 'setValue'. constrained -- A flag indicating if the P... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Parameter:
"""Parameter class. Attributes name -- A name for this Parameter. const -- A flag indicating whether this is considered a constant. _value -- The value of the Parameter. Modified with 'setValue'. value -- Property for 'getValue' and 'setValue'. constrained -- A flag indicating if the Parameter is c... | the_stack_v2_python_sparse | diffpy/srfit/fitbase/parameter.py | cfarrow/diffpy.srfit | train | 0 |
f37b5c32a812d5101b89c304aa72b5a7cd677016 | [
"self.row = 0\nself.col = 0\nself.vec2d = vec2d",
"result = self.vec2d[self.row][self.col]\nself.col += 1\nreturn result",
"while self.row < len(self.vec2d):\n if self.col < len(self.vec2d[self.row]):\n return True\n else:\n self.row += 1\n self.col = 0\nreturn False"
] | <|body_start_0|>
self.row = 0
self.col = 0
self.vec2d = vec2d
<|end_body_0|>
<|body_start_1|>
result = self.vec2d[self.row][self.col]
self.col += 1
return result
<|end_body_1|>
<|body_start_2|>
while self.row < len(self.vec2d):
if self.col < len(self... | Vector2D | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vector2D:
def __init__(self, vec2d):
"""Initialize your data structure here. :type vec2d: List[List[int]]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_073576 | 867 | permissive | [
{
"docstring": "Initialize your data structure here. :type vec2d: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, vec2d)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"name": "hasNext",... | 3 | stack_v2_sparse_classes_30k_train_052725 | Implement the Python class `Vector2D` described below.
Class description:
Implement the Vector2D class.
Method signatures and docstrings:
- def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bool | Implement the Python class `Vector2D` described below.
Class description:
Implement the Vector2D class.
Method signatures and docstrings:
- def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bool
<|skeleton|>
class V... | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | <|skeleton|>
class Vector2D:
def __init__(self, vec2d):
"""Initialize your data structure here. :type vec2d: List[List[int]]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vector2D:
def __init__(self, vec2d):
"""Initialize your data structure here. :type vec2d: List[List[int]]"""
self.row = 0
self.col = 0
self.vec2d = vec2d
def next(self):
""":rtype: int"""
result = self.vec2d[self.row][self.col]
self.col += 1
... | the_stack_v2_python_sparse | MY_REPOS/INTERVIEW-PREP-COMPLETE/Leetcode/251.py | bgoonz/UsefulResourceRepo2.0 | train | 10 | |
b8f78be36e80b18f38ff260de07d9748cec55b2b | [
"super().__init__()\nself.mode = mode\nif not isinstance(self.mode, FilterMode):\n raise ValueError(f'mode must be an instance of FilterMode: mode={mode}')\nself.py_name_set = set(py_name_set)\nself.exact_match = exact_match",
"if self.mode == FilterMode.INCLUDE:\n return py_name not in self.py_name_set\nel... | <|body_start_0|>
super().__init__()
self.mode = mode
if not isinstance(self.mode, FilterMode):
raise ValueError(f'mode must be an instance of FilterMode: mode={mode}')
self.py_name_set = set(py_name_set)
self.exact_match = exact_match
<|end_body_0|>
<|body_start_1|>
... | A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False) | PropertyTypeFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PropertyTypeFilter:
"""A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)"""
def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, py_name_set=None, exact_match=False):
... | stack_v2_sparse_classes_75kplus_train_073577 | 7,968 | permissive | [
{
"docstring": "Creates a `PropertyTypeFilter` instance Args: mode (FilterMode): the mode (include/exclude) for the filter instance. Defaults to EXCLUDE. py_name_set (set, optional): the default set of py_names to include or exclude. Defaults to None. exact_match (bool, optional): whether to use exact matching ... | 5 | stack_v2_sparse_classes_30k_train_005798 | Implement the Python class `PropertyTypeFilter` described below.
Class description:
A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)
Method signatures and docstrings:
- def __init__(self, mode: Fi... | Implement the Python class `PropertyTypeFilter` described below.
Class description:
A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)
Method signatures and docstrings:
- def __init__(self, mode: Fi... | bc6733d774fe31a23f4c7e73e5eb0beed8d30e7d | <|skeleton|>
class PropertyTypeFilter:
"""A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)"""
def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, py_name_set=None, exact_match=False):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PropertyTypeFilter:
"""A filter class for filtering based on property type py_names Example: .. code-block:: python filter = PropertyTypeFilter(include=['ge_freq', 'qscale'], exact_match=False)"""
def __init__(self, mode: FilterMode=FilterMode.EXCLUDE, py_name_set=None, exact_match=False):
"""Cre... | the_stack_v2_python_sparse | pycqed/utilities/devicedb/filters.py | QudevETH/PycQED_py3 | train | 8 |
9db99ac6d82dca7c63f3b7789ff86ee960227654 | [
"self.name = name\nself.kernel_regularizer = kernel_regularizer\nself.bias_regularizer = bias_regularizer",
"func_name = 'get_discriminator_logits'\nprint_obj('\\n' + func_name, 'source_image', source_image)\nprint_obj(func_name, 'target_image', target_image)\nkernel_initializer = tf.random_normal_initializer(mea... | <|body_start_0|>
self.name = name
self.kernel_regularizer = kernel_regularizer
self.bias_regularizer = bias_regularizer
<|end_body_0|>
<|body_start_1|>
func_name = 'get_discriminator_logits'
print_obj('\n' + func_name, 'source_image', source_image)
print_obj(func_name, '... | Discriminator that takes image input and outputs logits. Fields: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables. | Discriminator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Discriminator:
"""Discriminator that takes image input and outputs logits. Fields: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables."""
def __init... | stack_v2_sparse_classes_75kplus_train_073578 | 7,975 | permissive | [
{
"docstring": "Instantiates and builds discriminator network. Args: kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables. name: str, name of discriminator.",
"name": "__init__",
"signature": "def _... | 3 | stack_v2_sparse_classes_30k_train_032077 | Implement the Python class `Discriminator` described below.
Class description:
Discriminator that takes image input and outputs logits. Fields: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar... | Implement the Python class `Discriminator` described below.
Class description:
Discriminator that takes image input and outputs logits. Fields: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar... | f7c21af221f366b075d351deeeb00a1b266ac3e3 | <|skeleton|>
class Discriminator:
"""Discriminator that takes image input and outputs logits. Fields: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables."""
def __init... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Discriminator:
"""Discriminator that takes image input and outputs logits. Fields: name: str, name of `Discriminator`. kernel_regularizer: `l1_l2_regularizer` object, regularizar for kernel variables. bias_regularizer: `l1_l2_regularizer` object, regularizar for bias variables."""
def __init__(self, kern... | the_stack_v2_python_sparse | machine_learning/gan/pix2pix/tf_pix2pix/pix2pix_module/trainer/discriminator.py | ryangillard/artificial_intelligence | train | 4 |
ab20bf843447c4c0de15c02adbdb4a98be399351 | [
"cleaned_data = self.clean()\nif cleaned_data['password'] != cleaned_data['password_confirmation']:\n raise forms.ValidationError('Password confirmation does not match password')\nreturn cleaned_data['password']",
"if not self.is_valid():\n return False\ntry:\n user = User.objects.get(auth_token=self['to... | <|body_start_0|>
cleaned_data = self.clean()
if cleaned_data['password'] != cleaned_data['password_confirmation']:
raise forms.ValidationError('Password confirmation does not match password')
return cleaned_data['password']
<|end_body_0|>
<|body_start_1|>
if not self.is_vali... | Employee form class. Updates user information and creates CompanyMember object | EmployeeActivationForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EmployeeActivationForm:
"""Employee form class. Updates user information and creates CompanyMember object"""
def clean_password_confirmation(self):
"""Check matching of password and password confirmation."""
<|body_0|>
def submit(self):
"""Activate company member... | stack_v2_sparse_classes_75kplus_train_073579 | 2,154 | no_license | [
{
"docstring": "Check matching of password and password confirmation.",
"name": "clean_password_confirmation",
"signature": "def clean_password_confirmation(self)"
},
{
"docstring": "Activate company member.",
"name": "submit",
"signature": "def submit(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006380 | Implement the Python class `EmployeeActivationForm` described below.
Class description:
Employee form class. Updates user information and creates CompanyMember object
Method signatures and docstrings:
- def clean_password_confirmation(self): Check matching of password and password confirmation.
- def submit(self): Ac... | Implement the Python class `EmployeeActivationForm` described below.
Class description:
Employee form class. Updates user information and creates CompanyMember object
Method signatures and docstrings:
- def clean_password_confirmation(self): Check matching of password and password confirmation.
- def submit(self): Ac... | 252b0ebd77eefbcc945a0efc3068cc3421f46d5f | <|skeleton|>
class EmployeeActivationForm:
"""Employee form class. Updates user information and creates CompanyMember object"""
def clean_password_confirmation(self):
"""Check matching of password and password confirmation."""
<|body_0|>
def submit(self):
"""Activate company member... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EmployeeActivationForm:
"""Employee form class. Updates user information and creates CompanyMember object"""
def clean_password_confirmation(self):
"""Check matching of password and password confirmation."""
cleaned_data = self.clean()
if cleaned_data['password'] != cleaned_data['... | the_stack_v2_python_sparse | app/companies/forms/employee_activation.py | vsokoltsov/Interview360Server | train | 2 |
b133c56cf98e9d4f7e465bc3f2c70c422d0961a6 | [
"alen, blen = (len(a), len(b))\nif alen == blen:\n return self.handle_same_length(a, b)\nif alen == blen + 1:\n return self.handle_one_off(b, a)\nelif blen == alen + 1:\n return self.handle_one_off(a, b)\nreturn False",
"found = False\nfor n, c in enumerate(shorter):\n if shorter[n] == longer[n]:\n ... | <|body_start_0|>
alen, blen = (len(a), len(b))
if alen == blen:
return self.handle_same_length(a, b)
if alen == blen + 1:
return self.handle_one_off(b, a)
elif blen == alen + 1:
return self.handle_one_off(a, b)
return False
<|end_body_0|>
<|bo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def oneaway(self, a, b):
"""Given two strings and the set of three rules of string changes, return whether the 2 strings are one edit or zero edits away from each other. Three permissible edits are as follows: single leter inserts, deletions and replacements."""
<|body_... | stack_v2_sparse_classes_75kplus_train_073580 | 2,592 | no_license | [
{
"docstring": "Given two strings and the set of three rules of string changes, return whether the 2 strings are one edit or zero edits away from each other. Three permissible edits are as follows: single leter inserts, deletions and replacements.",
"name": "oneaway",
"signature": "def oneaway(self, a, ... | 3 | stack_v2_sparse_classes_30k_test_000709 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def oneaway(self, a, b): Given two strings and the set of three rules of string changes, return whether the 2 strings are one edit or zero edits away from each other. Three permi... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def oneaway(self, a, b): Given two strings and the set of three rules of string changes, return whether the 2 strings are one edit or zero edits away from each other. Three permi... | acad7283f4af301539c621b4b50268208509d38f | <|skeleton|>
class Solution:
def oneaway(self, a, b):
"""Given two strings and the set of three rules of string changes, return whether the 2 strings are one edit or zero edits away from each other. Three permissible edits are as follows: single leter inserts, deletions and replacements."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def oneaway(self, a, b):
"""Given two strings and the set of three rules of string changes, return whether the 2 strings are one edit or zero edits away from each other. Three permissible edits are as follows: single leter inserts, deletions and replacements."""
alen, blen = (len(a),... | the_stack_v2_python_sparse | ctci/one-away.py | arijort/prep | train | 2 | |
7c9ccece9f340f3436927ea6c94ca002f13c93a3 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | NOTE(const): Not used. TODO(const): Switch to Bittensor protocol. | BittensorServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BittensorServicer:
"""NOTE(const): Not used. TODO(const): Switch to Bittensor protocol."""
def Spike(self, request, context):
"""Query remote component with text-features, responses are var-length vector representations of the text."""
<|body_0|>
def Grade(self, request,... | stack_v2_sparse_classes_75kplus_train_073581 | 2,451 | permissive | [
{
"docstring": "Query remote component with text-features, responses are var-length vector representations of the text.",
"name": "Spike",
"signature": "def Spike(self, request, context)"
},
{
"docstring": "Query a remote component with gradients. Responses are boolean affirmatives.",
"name"... | 2 | stack_v2_sparse_classes_30k_train_004400 | Implement the Python class `BittensorServicer` described below.
Class description:
NOTE(const): Not used. TODO(const): Switch to Bittensor protocol.
Method signatures and docstrings:
- def Spike(self, request, context): Query remote component with text-features, responses are var-length vector representations of the ... | Implement the Python class `BittensorServicer` described below.
Class description:
NOTE(const): Not used. TODO(const): Switch to Bittensor protocol.
Method signatures and docstrings:
- def Spike(self, request, context): Query remote component with text-features, responses are var-length vector representations of the ... | d1af6993c1d6bca273a0c8d147132ee9867f5543 | <|skeleton|>
class BittensorServicer:
"""NOTE(const): Not used. TODO(const): Switch to Bittensor protocol."""
def Spike(self, request, context):
"""Query remote component with text-features, responses are var-length vector representations of the text."""
<|body_0|>
def Grade(self, request,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BittensorServicer:
"""NOTE(const): Not used. TODO(const): Switch to Bittensor protocol."""
def Spike(self, request, context):
"""Query remote component with text-features, responses are var-length vector representations of the text."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
... | the_stack_v2_python_sparse | bittensor/proto/bittensor_pb2_grpc.py | unconst/BitTensor | train | 10 |
6ebd198eeb46f305830ead391cfbf102a14d41a4 | [
"super().fit(kg)\nfor vertex in kg._vertices:\n is_reverse = True if vertex.predicate else False\n counter = self._pred_degs if vertex.predicate else self._obj_degs\n self._neighbor_counts[vertex.name] = len(kg.get_neighbors(vertex, is_reverse=is_reverse))\n if vertex.name in counter:\n counter[v... | <|body_start_0|>
super().fit(kg)
for vertex in kg._vertices:
is_reverse = True if vertex.predicate else False
counter = self._pred_degs if vertex.predicate else self._obj_degs
self._neighbor_counts[vertex.name] = len(kg.get_neighbors(vertex, is_reverse=is_reverse))
... | Wide sampling node-centric sampling strategy which gives priority to walks containing edges with the highest degree of predicates and objects. The degree of a predicate and an object being defined by the number of predicates and objects present in its neighborhood, but also by their number of occurrence in a Knowledge ... | WideSampler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WideSampler:
"""Wide sampling node-centric sampling strategy which gives priority to walks containing edges with the highest degree of predicates and objects. The degree of a predicate and an object being defined by the number of predicates and objects present in its neighborhood, but also by the... | stack_v2_sparse_classes_75kplus_train_073582 | 3,392 | permissive | [
{
"docstring": "Fits the sampling strategy by couting the number of available neighbors for each vertex, but also by counting the number of occurrence that a predicate and an object appears in the Knowledge Graph. Args: kg: The Knowledge Graph.",
"name": "fit",
"signature": "def fit(self, kg: KG) -> Non... | 2 | stack_v2_sparse_classes_30k_train_013224 | Implement the Python class `WideSampler` described below.
Class description:
Wide sampling node-centric sampling strategy which gives priority to walks containing edges with the highest degree of predicates and objects. The degree of a predicate and an object being defined by the number of predicates and objects prese... | Implement the Python class `WideSampler` described below.
Class description:
Wide sampling node-centric sampling strategy which gives priority to walks containing edges with the highest degree of predicates and objects. The degree of a predicate and an object being defined by the number of predicates and objects prese... | 940ef534cd44698dfb625a0f55a47b781a8dacae | <|skeleton|>
class WideSampler:
"""Wide sampling node-centric sampling strategy which gives priority to walks containing edges with the highest degree of predicates and objects. The degree of a predicate and an object being defined by the number of predicates and objects present in its neighborhood, but also by the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WideSampler:
"""Wide sampling node-centric sampling strategy which gives priority to walks containing edges with the highest degree of predicates and objects. The degree of a predicate and an object being defined by the number of predicates and objects present in its neighborhood, but also by their number of ... | the_stack_v2_python_sparse | pyrdf2vec/samplers/wide.py | IBCNServices/pyRDF2Vec | train | 229 |
c7450479200273fedab576f2d6cb58b03f5fd231 | [
"super(FakeStorageWriter, self).__init__(storage_type=storage_type)\nself._first_written_event_data_index = 0\nself._first_written_event_source_index = 0\nself._written_event_data_index = 0\nself._written_event_source_index = 0\nself.task_completion = None\nself.task_start = None",
"if not self._store:\n raise... | <|body_start_0|>
super(FakeStorageWriter, self).__init__(storage_type=storage_type)
self._first_written_event_data_index = 0
self._first_written_event_source_index = 0
self._written_event_data_index = 0
self._written_event_source_index = 0
self.task_completion = None
... | Fake (in-memory only) storage writer object. Attributes: task_completion (TaskCompletion): task completion attribute container. task_start (TaskStart): task start attribute container. | FakeStorageWriter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FakeStorageWriter:
"""Fake (in-memory only) storage writer object. Attributes: task_completion (TaskCompletion): task completion attribute container. task_start (TaskStart): task start attribute container."""
def __init__(self, storage_type=definitions.STORAGE_TYPE_SESSION):
"""Initi... | stack_v2_sparse_classes_75kplus_train_073583 | 4,244 | permissive | [
{
"docstring": "Initializes a storage writer object. Args: storage_type (Optional[str]): storage type.",
"name": "__init__",
"signature": "def __init__(self, storage_type=definitions.STORAGE_TYPE_SESSION)"
},
{
"docstring": "Retrieves the first event data that was written after open. Using GetFi... | 6 | stack_v2_sparse_classes_30k_train_008819 | Implement the Python class `FakeStorageWriter` described below.
Class description:
Fake (in-memory only) storage writer object. Attributes: task_completion (TaskCompletion): task completion attribute container. task_start (TaskStart): task start attribute container.
Method signatures and docstrings:
- def __init__(se... | Implement the Python class `FakeStorageWriter` described below.
Class description:
Fake (in-memory only) storage writer object. Attributes: task_completion (TaskCompletion): task completion attribute container. task_start (TaskStart): task start attribute container.
Method signatures and docstrings:
- def __init__(se... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class FakeStorageWriter:
"""Fake (in-memory only) storage writer object. Attributes: task_completion (TaskCompletion): task completion attribute container. task_start (TaskStart): task start attribute container."""
def __init__(self, storage_type=definitions.STORAGE_TYPE_SESSION):
"""Initi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FakeStorageWriter:
"""Fake (in-memory only) storage writer object. Attributes: task_completion (TaskCompletion): task completion attribute container. task_start (TaskStart): task start attribute container."""
def __init__(self, storage_type=definitions.STORAGE_TYPE_SESSION):
"""Initializes a stor... | the_stack_v2_python_sparse | plaso/storage/fake/writer.py | log2timeline/plaso | train | 1,506 |
f0bdc18bbdc65c9e968d24215b8e50bef2352cc7 | [
"super(Conv2dSubsampling, self).__init__()\nself.conv = torch.nn.Sequential(torch.nn.Conv2d(1, odim, 3, 2), torch.nn.ReLU(), torch.nn.Conv2d(odim, odim, 3, 2), torch.nn.ReLU())\nself.out = torch.nn.Sequential(torch.nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim), pos_enc if pos_enc is not None else PositionalE... | <|body_start_0|>
super(Conv2dSubsampling, self).__init__()
self.conv = torch.nn.Sequential(torch.nn.Conv2d(1, odim, 3, 2), torch.nn.ReLU(), torch.nn.Conv2d(odim, odim, 3, 2), torch.nn.ReLU())
self.out = torch.nn.Sequential(torch.nn.Linear(odim * (((idim - 1) // 2 - 1) // 2), odim), pos_enc if po... | Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer. | Conv2dSubsampling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Conv2dSubsampling:
"""Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer."""
def __init__(self, idim, odim, dropout_rate, pos_enc=None):
... | stack_v2_sparse_classes_75kplus_train_073584 | 14,351 | permissive | [
{
"docstring": "Construct an Conv2dSubsampling object.",
"name": "__init__",
"signature": "def __init__(self, idim, odim, dropout_rate, pos_enc=None)"
},
{
"docstring": "Subsample x. Args: x (torch.Tensor): Input tensor (#batch, time, idim). x_mask (torch.Tensor): Input mask (#batch, 1, time). R... | 3 | stack_v2_sparse_classes_30k_train_027011 | Implement the Python class `Conv2dSubsampling` described below.
Class description:
Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Method signatures and docstri... | Implement the Python class `Conv2dSubsampling` described below.
Class description:
Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer.
Method signatures and docstri... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class Conv2dSubsampling:
"""Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer."""
def __init__(self, idim, odim, dropout_rate, pos_enc=None):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Conv2dSubsampling:
"""Convolutional 2D subsampling (to 1/4 length). Args: idim (int): Input dimension. odim (int): Output dimension. dropout_rate (float): Dropout rate. pos_enc (torch.nn.Module): Custom position encoding layer."""
def __init__(self, idim, odim, dropout_rate, pos_enc=None):
"""Con... | the_stack_v2_python_sparse | espnet/nets/pytorch_backend/transformer/subsampling.py | espnet/espnet | train | 7,242 |
2d2379245576ed84a0ecf7658f73db9e4ee3779b | [
"super(Attention, self).__init__()\nself.features_att = weight_norm(nn.Linear(features_dim, attention_dim))\nself.decoder_att = weight_norm(nn.Linear(decoder_dim, attention_dim))\nself.full_att = weight_norm(nn.Linear(attention_dim, 1))\nself.dropout = nn.Dropout(p=dropout)\nself.softmax = nn.Softmax(dim=1)",
"at... | <|body_start_0|>
super(Attention, self).__init__()
self.features_att = weight_norm(nn.Linear(features_dim, attention_dim))
self.decoder_att = weight_norm(nn.Linear(decoder_dim, attention_dim))
self.full_att = weight_norm(nn.Linear(attention_dim, 1))
self.dropout = nn.Dropout(p=dr... | Attention Network. | Attention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Attention:
"""Attention Network."""
def __init__(self, features_dim, decoder_dim, attention_dim, dropout=0.2):
""":param features_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_073585 | 18,298 | no_license | [
{
"docstring": ":param features_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network",
"name": "__init__",
"signature": "def __init__(self, features_dim, decoder_dim, attention_dim, dropout=0.2)"
},
{
"docstring": "Forw... | 2 | stack_v2_sparse_classes_30k_train_031544 | Implement the Python class `Attention` described below.
Class description:
Attention Network.
Method signatures and docstrings:
- def __init__(self, features_dim, decoder_dim, attention_dim, dropout=0.2): :param features_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_di... | Implement the Python class `Attention` described below.
Class description:
Attention Network.
Method signatures and docstrings:
- def __init__(self, features_dim, decoder_dim, attention_dim, dropout=0.2): :param features_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_di... | 7e29bd5af38c7221bd1b49472769c6a024b27c0e | <|skeleton|>
class Attention:
"""Attention Network."""
def __init__(self, features_dim, decoder_dim, attention_dim, dropout=0.2):
""":param features_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Attention:
"""Attention Network."""
def __init__(self, features_dim, decoder_dim, attention_dim, dropout=0.2):
""":param features_dim: feature size of encoded images :param decoder_dim: size of decoder's RNN :param attention_dim: size of the attention network"""
super(Attention, self).__i... | the_stack_v2_python_sparse | captioning_generation/mm_lstm_model.py | hduwbf/WSDVC | train | 0 |
3a8b2f25b2ede5a50ac79f6478866acedd225294 | [
"self.content_type = content_type\nself.s3_uri = s3_uri\nself.content_digest = content_digest",
"metrics_source_request = {'ContentType': self.content_type, 'S3Uri': self.s3_uri}\nif self.content_digest is not None:\n metrics_source_request['ContentDigest'] = self.content_digest\nreturn metrics_source_request"... | <|body_start_0|>
self.content_type = content_type
self.s3_uri = s3_uri
self.content_digest = content_digest
<|end_body_0|>
<|body_start_1|>
metrics_source_request = {'ContentType': self.content_type, 'S3Uri': self.s3_uri}
if self.content_digest is not None:
metrics_s... | Accepts metrics source parameters for conversion to request dict. | MetricsSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetricsSource:
"""Accepts metrics source parameters for conversion to request dict."""
def __init__(self, content_type: Union[str, PipelineVariable], s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None):
"""Initialize a ``MetricsSource`` ... | stack_v2_sparse_classes_75kplus_train_073586 | 7,143 | permissive | [
{
"docstring": "Initialize a ``MetricsSource`` instance and turn parameters into dict. Args: content_type (str or PipelineVariable): Specifies the type of content in S3 URI s3_uri (str or PipelineVariable): The S3 URI of the metric content_digest (str or PipelineVariable): The digest of the metric (default: Non... | 2 | stack_v2_sparse_classes_30k_train_002050 | Implement the Python class `MetricsSource` described below.
Class description:
Accepts metrics source parameters for conversion to request dict.
Method signatures and docstrings:
- def __init__(self, content_type: Union[str, PipelineVariable], s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, ... | Implement the Python class `MetricsSource` described below.
Class description:
Accepts metrics source parameters for conversion to request dict.
Method signatures and docstrings:
- def __init__(self, content_type: Union[str, PipelineVariable], s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, ... | 8d5d7fd8ae1a917ed3e2b988d5e533bce244fd85 | <|skeleton|>
class MetricsSource:
"""Accepts metrics source parameters for conversion to request dict."""
def __init__(self, content_type: Union[str, PipelineVariable], s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None):
"""Initialize a ``MetricsSource`` ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MetricsSource:
"""Accepts metrics source parameters for conversion to request dict."""
def __init__(self, content_type: Union[str, PipelineVariable], s3_uri: Union[str, PipelineVariable], content_digest: Optional[Union[str, PipelineVariable]]=None):
"""Initialize a ``MetricsSource`` instance and ... | the_stack_v2_python_sparse | src/sagemaker/model_metrics.py | aws/sagemaker-python-sdk | train | 2,050 |
1e1c20aff8e2333b50ba635d5042a3e6bc92e17c | [
"matches = re.finditer(self.regex_string, data, re.MULTILINE)\nmethods = []\ndoc_string = ''\nshorten_doc = ['']\nfor match in matches:\n if match.group(2) is None:\n doc = re.sub('\\n\\\\s.*\\\\*\\\\s@return.*', '', match.group(1))\n shorten_doc = re.sub('\\n\\\\s*\\\\*?', '', doc).split('@')\n ... | <|body_start_0|>
matches = re.finditer(self.regex_string, data, re.MULTILINE)
methods = []
doc_string = ''
shorten_doc = ['']
for match in matches:
if match.group(2) is None:
doc = re.sub('\n\\s.*\\*\\s@return.*', '', match.group(1))
sh... | This ScalaParser class parses a scala file, extracts the method elements and writes them out to a config file | ScalaParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScalaParser:
"""This ScalaParser class parses a scala file, extracts the method elements and writes them out to a config file"""
def regex_parser(self, data):
"""This function takes in data as a string, then uses the regex string variable within this class. To find the doc strings, n... | stack_v2_sparse_classes_75kplus_train_073587 | 10,652 | permissive | [
{
"docstring": "This function takes in data as a string, then uses the regex string variable within this class. To find the doc strings, name, parameters, types and return type for each function within the data. It then stores this information as a Method class and saves all the methods as a list. :param data: ... | 4 | stack_v2_sparse_classes_30k_val_000186 | Implement the Python class `ScalaParser` described below.
Class description:
This ScalaParser class parses a scala file, extracts the method elements and writes them out to a config file
Method signatures and docstrings:
- def regex_parser(self, data): This function takes in data as a string, then uses the regex stri... | Implement the Python class `ScalaParser` described below.
Class description:
This ScalaParser class parses a scala file, extracts the method elements and writes them out to a config file
Method signatures and docstrings:
- def regex_parser(self, data): This function takes in data as a string, then uses the regex stri... | 960424c36f2c004e6dc1f2b7d428af4616156e7b | <|skeleton|>
class ScalaParser:
"""This ScalaParser class parses a scala file, extracts the method elements and writes them out to a config file"""
def regex_parser(self, data):
"""This function takes in data as a string, then uses the regex string variable within this class. To find the doc strings, n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScalaParser:
"""This ScalaParser class parses a scala file, extracts the method elements and writes them out to a config file"""
def regex_parser(self, data):
"""This function takes in data as a string, then uses the regex string variable within this class. To find the doc strings, name, paramete... | the_stack_v2_python_sparse | wrapper_writer/parsers.py | treilly94/wrapper-writer | train | 0 |
c75e2d4af970136e8648bdefd46002469c0d64d5 | [
"song = get_object_or_404(models.Song, slug__iexact=slug)\nplayit = utility.object_path(song)\nmyform = self.form_class(instance=song, initial=query.my_preference_dict(song, request.user))\ncontext = {'song': song, 'playit': playit, 'objectForm': myform}\nreturn render(request, self.template_name, context)",
"son... | <|body_start_0|>
song = get_object_or_404(models.Song, slug__iexact=slug)
playit = utility.object_path(song)
myform = self.form_class(instance=song, initial=query.my_preference_dict(song, request.user))
context = {'song': song, 'playit': playit, 'objectForm': myform}
return rende... | SongDetailView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SongDetailView:
def get(self, request, slug):
"""display form with initial values"""
<|body_0|>
def post(self, request, slug):
"""Post handles updates from the SongForm as well as requests from kodi playback"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_073588 | 30,857 | no_license | [
{
"docstring": "display form with initial values",
"name": "get",
"signature": "def get(self, request, slug)"
},
{
"docstring": "Post handles updates from the SongForm as well as requests from kodi playback",
"name": "post",
"signature": "def post(self, request, slug)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004222 | Implement the Python class `SongDetailView` described below.
Class description:
Implement the SongDetailView class.
Method signatures and docstrings:
- def get(self, request, slug): display form with initial values
- def post(self, request, slug): Post handles updates from the SongForm as well as requests from kodi p... | Implement the Python class `SongDetailView` described below.
Class description:
Implement the SongDetailView class.
Method signatures and docstrings:
- def get(self, request, slug): display form with initial values
- def post(self, request, slug): Post handles updates from the SongForm as well as requests from kodi p... | 8bde933513745d2de78a34a149a534c1e984aeef | <|skeleton|>
class SongDetailView:
def get(self, request, slug):
"""display form with initial values"""
<|body_0|>
def post(self, request, slug):
"""Post handles updates from the SongForm as well as requests from kodi playback"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SongDetailView:
def get(self, request, slug):
"""display form with initial values"""
song = get_object_or_404(models.Song, slug__iexact=slug)
playit = utility.object_path(song)
myform = self.form_class(instance=song, initial=query.my_preference_dict(song, request.user))
... | the_stack_v2_python_sparse | FriendlyHomeLibrary/FHLBuilder/views.py | camorton2/FriendlyHomeLibrary | train | 1 | |
4dbc70a9ca29603ffefacfff89f8bf0eb68e290b | [
"self.diff_args = diff_args\nself.cwd = cwd\nself.temp_dir = tempfile.mkdtemp()\nself.debug = debug\nself.vcs_helper = VCSHelper.get_helper(self.cwd, debug=self.debug)\nself.changed_files = self.vcs_helper.get_changed_files(self.diff_args)\nself.changed_hunks = []\nfor f in self.changed_files:\n self.changed_hun... | <|body_start_0|>
self.diff_args = diff_args
self.cwd = cwd
self.temp_dir = tempfile.mkdtemp()
self.debug = debug
self.vcs_helper = VCSHelper.get_helper(self.cwd, debug=self.debug)
self.changed_files = self.vcs_helper.get_changed_files(self.diff_args)
self.changed_... | Class for handling understanding and parsing a specific diff. This class represents the entire diff. | DiffParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiffParser:
"""Class for handling understanding and parsing a specific diff. This class represents the entire diff."""
def __init__(self, diff_args, cwd, debug=False, get_diff_headers=False):
"""Constructor. Args: diff_args: The arguments to be used for the Git diff. cwd: The working... | stack_v2_sparse_classes_75kplus_train_073589 | 2,727 | permissive | [
{
"docstring": "Constructor. Args: diff_args: The arguments to be used for the Git diff. cwd: The working directory. get_diff_headers: Whether we want per-file header hunks for this diff.",
"name": "__init__",
"signature": "def __init__(self, diff_args, cwd, debug=False, get_diff_headers=False)"
},
... | 2 | stack_v2_sparse_classes_30k_train_014790 | Implement the Python class `DiffParser` described below.
Class description:
Class for handling understanding and parsing a specific diff. This class represents the entire diff.
Method signatures and docstrings:
- def __init__(self, diff_args, cwd, debug=False, get_diff_headers=False): Constructor. Args: diff_args: Th... | Implement the Python class `DiffParser` described below.
Class description:
Class for handling understanding and parsing a specific diff. This class represents the entire diff.
Method signatures and docstrings:
- def __init__(self, diff_args, cwd, debug=False, get_diff_headers=False): Constructor. Args: diff_args: Th... | 17afe53e4a96c80f0a43093f5ea21d61c42a090b | <|skeleton|>
class DiffParser:
"""Class for handling understanding and parsing a specific diff. This class represents the entire diff."""
def __init__(self, diff_args, cwd, debug=False, get_diff_headers=False):
"""Constructor. Args: diff_args: The arguments to be used for the Git diff. cwd: The working... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiffParser:
"""Class for handling understanding and parsing a specific diff. This class represents the entire diff."""
def __init__(self, diff_args, cwd, debug=False, get_diff_headers=False):
"""Constructor. Args: diff_args: The arguments to be used for the Git diff. cwd: The working directory. g... | the_stack_v2_python_sparse | parser/diff_parser.py | CJTozer/SublimeDiffView | train | 23 |
42aa0adc6de70271db0420d402122aa7be5401b5 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('vinwah', 'vinwah')\nuri = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=062fc6fa-b5ff-4270-86cf-202225e40858&limit=171000'\nresponse = urllib.request.urlopen(uri).read().decode('utf-... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('vinwah', 'vinwah')
uri = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=062fc6fa-b5ff-4270-86cf-202225e40858&limit=171000'
res... | retrieveProperties | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class retrieveProperties:
def execute(trial=False):
"""Retrieves data about properties in Boston from Analyze Boston"""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening... | stack_v2_sparse_classes_75kplus_train_073590 | 3,579 | no_license | [
{
"docstring": "Retrieves data about properties in Boston from Analyze Boston",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describ... | 2 | stack_v2_sparse_classes_30k_train_024704 | Implement the Python class `retrieveProperties` described below.
Class description:
Implement the retrieveProperties class.
Method signatures and docstrings:
- def execute(trial=False): Retrieves data about properties in Boston from Analyze Boston
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTim... | Implement the Python class `retrieveProperties` described below.
Class description:
Implement the retrieveProperties class.
Method signatures and docstrings:
- def execute(trial=False): Retrieves data about properties in Boston from Analyze Boston
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTim... | b5ccaad97f6e35f9580e645ca764f36eb3406f43 | <|skeleton|>
class retrieveProperties:
def execute(trial=False):
"""Retrieves data about properties in Boston from Analyze Boston"""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class retrieveProperties:
def execute(trial=False):
"""Retrieves data about properties in Boston from Analyze Boston"""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('vinwah', 'vinwah')
uri = 'https://data.... | the_stack_v2_python_sparse | vinwah/retrieveProperties.py | dwang1995/course-2018-spr-proj | train | 1 | |
8096a9ce2884c50212a631ae0f34b2a2722e98cc | [
"self.set_header('content-type', 'application/json')\ntry:\n result = StrategyDefaultDao().get_strategy_by_app_and_name(app, name)\n if result:\n self.finish(json_dumps({'status': 0, 'msg': 'ok', 'values': [result.get_dict()]}))\n else:\n self.finish(json_dumps({'status': 404, 'msg': 'not exi... | <|body_start_0|>
self.set_header('content-type', 'application/json')
try:
result = StrategyDefaultDao().get_strategy_by_app_and_name(app, name)
if result:
self.finish(json_dumps({'status': 0, 'msg': 'ok', 'values': [result.get_dict()]}))
else:
... | StrategyQueryHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - default parameters: - name: app in: path required: true type: string description: the app of the strategy - name: ... | stack_v2_sparse_classes_75kplus_train_073591 | 10,941 | permissive | [
{
"docstring": "get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - default parameters: - name: app in: path required: true type: string description: the app of the strategy - name: name in: path required: true type: string description: the ... | 3 | stack_v2_sparse_classes_30k_train_036129 | Implement the Python class `StrategyQueryHandler` described below.
Class description:
Implement the StrategyQueryHandler class.
Method signatures and docstrings:
- def get(self, app, name): get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - defau... | Implement the Python class `StrategyQueryHandler` described below.
Class description:
Implement the StrategyQueryHandler class.
Method signatures and docstrings:
- def get(self, app, name): get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - defau... | 2e32e6e7b225e0bd87ee8c847c22862f12c51bb1 | <|skeleton|>
class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - default parameters: - name: app in: path required: true type: string description: the app of the strategy - name: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - default parameters: - name: app in: path required: true type: string description: the app of the strategy - name: name in: path ... | the_stack_v2_python_sparse | nebula/views/strategy_default.py | threathunterX/nebula_web | train | 2 | |
073961f1b3c7f559cf9b661cbea2c74a2baa1bf4 | [
"try:\n user = getUser(request.session.get('login'))\n ago = request.GET.get('ago')\n page = request.GET.get('page')\n three_month_ago = get_three_month_ago()\n if ago:\n tailwindTake = TailwindTakeOrder.objects.filter(Q(mandatory=user) & Q(create_time__lte=three_month_ago))\n else:\n ... | <|body_start_0|>
try:
user = getUser(request.session.get('login'))
ago = request.GET.get('ago')
page = request.GET.get('page')
three_month_ago = get_three_month_ago()
if ago:
tailwindTake = TailwindTakeOrder.objects.filter(Q(mandatory=u... | 用户对接受单的一系列操作 | UserTailwindTakeOrderView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserTailwindTakeOrderView:
"""用户对接受单的一系列操作"""
def get(self, request):
"""获取用户的所有接收单 :param request: :return:"""
<|body_0|>
def put(self, request, rid):
"""用户接单 :param request: :param rid: request id :return:"""
<|body_1|>
def delete(self, request, ri... | stack_v2_sparse_classes_75kplus_train_073592 | 5,314 | no_license | [
{
"docstring": "获取用户的所有接收单 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "用户接单 :param request: :param rid: request id :return:",
"name": "put",
"signature": "def put(self, request, rid)"
},
{
"docstring": "用户撤销接受单 :param request... | 3 | stack_v2_sparse_classes_30k_train_020332 | Implement the Python class `UserTailwindTakeOrderView` described below.
Class description:
用户对接受单的一系列操作
Method signatures and docstrings:
- def get(self, request): 获取用户的所有接收单 :param request: :return:
- def put(self, request, rid): 用户接单 :param request: :param rid: request id :return:
- def delete(self, request, rid): ... | Implement the Python class `UserTailwindTakeOrderView` described below.
Class description:
用户对接受单的一系列操作
Method signatures and docstrings:
- def get(self, request): 获取用户的所有接收单 :param request: :return:
- def put(self, request, rid): 用户接单 :param request: :param rid: request id :return:
- def delete(self, request, rid): ... | bcfbfb71bac696695ec98ac7796fea8262e5af8a | <|skeleton|>
class UserTailwindTakeOrderView:
"""用户对接受单的一系列操作"""
def get(self, request):
"""获取用户的所有接收单 :param request: :return:"""
<|body_0|>
def put(self, request, rid):
"""用户接单 :param request: :param rid: request id :return:"""
<|body_1|>
def delete(self, request, ri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserTailwindTakeOrderView:
"""用户对接受单的一系列操作"""
def get(self, request):
"""获取用户的所有接收单 :param request: :return:"""
try:
user = getUser(request.session.get('login'))
ago = request.GET.get('ago')
page = request.GET.get('page')
three_month_ago = g... | the_stack_v2_python_sparse | App/Account/views/restFul/userTailwindInfo/userTailwindBaseInfo/userTailwindTakeOrderInfo.py | DICKQI/UTime_BackEnd | train | 0 |
4bf9774fc44a32e95b9c6f8a4becbc2efd3dab44 | [
"org_id = int(org_id)\nif not ccnet_api.get_org_by_id(org_id):\n error_msg = 'Organization %s not found.' % org_id\n return api_error(status.HTTP_404_NOT_FOUND, error_msg)\ngroup_id = int(group_id)\nif get_org_id_by_group(group_id) != org_id:\n error_msg = 'Group %s not found.' % group_id\n return api_e... | <|body_start_0|>
org_id = int(org_id)
if not ccnet_api.get_org_by_id(org_id):
error_msg = 'Organization %s not found.' % org_id
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
group_id = int(group_id)
if get_org_id_by_group(group_id) != org_id:
... | OrgAdminGroup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrgAdminGroup:
def get(self, request, org_id, group_id):
"""get org group info"""
<|body_0|>
def put(self, request, org_id, group_id):
"""Admin update a group 1. transfer a group.abs 2. set group quota Permission checking: 1. Admin user;"""
<|body_1|>
de... | stack_v2_sparse_classes_75kplus_train_073593 | 5,361 | no_license | [
{
"docstring": "get org group info",
"name": "get",
"signature": "def get(self, request, org_id, group_id)"
},
{
"docstring": "Admin update a group 1. transfer a group.abs 2. set group quota Permission checking: 1. Admin user;",
"name": "put",
"signature": "def put(self, request, org_id,... | 3 | stack_v2_sparse_classes_30k_train_045371 | Implement the Python class `OrgAdminGroup` described below.
Class description:
Implement the OrgAdminGroup class.
Method signatures and docstrings:
- def get(self, request, org_id, group_id): get org group info
- def put(self, request, org_id, group_id): Admin update a group 1. transfer a group.abs 2. set group quota... | Implement the Python class `OrgAdminGroup` described below.
Class description:
Implement the OrgAdminGroup class.
Method signatures and docstrings:
- def get(self, request, org_id, group_id): get org group info
- def put(self, request, org_id, group_id): Admin update a group 1. transfer a group.abs 2. set group quota... | d848dace19f3fb27512f2fc242b61c04865947b3 | <|skeleton|>
class OrgAdminGroup:
def get(self, request, org_id, group_id):
"""get org group info"""
<|body_0|>
def put(self, request, org_id, group_id):
"""Admin update a group 1. transfer a group.abs 2. set group quota Permission checking: 1. Admin user;"""
<|body_1|>
de... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrgAdminGroup:
def get(self, request, org_id, group_id):
"""get org group info"""
org_id = int(org_id)
if not ccnet_api.get_org_by_id(org_id):
error_msg = 'Organization %s not found.' % org_id
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
group_... | the_stack_v2_python_sparse | organizations/api/admin/groups.py | mengde007/seahub-extra-sdu | train | 0 | |
5debbd7844ab366465ae8d0c43a294531168d6ab | [
"super(AverageAggregator, self).__init__(name, statistic)\nself._interval = random.randint(config.AGGREGATE_AVERAGE_REFRESH_MIN, config.AGGREGATE_AVERAGE_REFRESH_MAX)\nself._counter = 0",
"self._counter += 1\nif self._counter == self._interval:\n self._value = self.getLocalValue()\nelse:\n pass",
"if self... | <|body_start_0|>
super(AverageAggregator, self).__init__(name, statistic)
self._interval = random.randint(config.AGGREGATE_AVERAGE_REFRESH_MIN, config.AGGREGATE_AVERAGE_REFRESH_MAX)
self._counter = 0
<|end_body_0|>
<|body_start_1|>
self._counter += 1
if self._counter == self._in... | AVERAGE AGGREGATOR Aggregator that keeps an average of a value. | AverageAggregator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AverageAggregator:
"""AVERAGE AGGREGATOR Aggregator that keeps an average of a value."""
def __init__(self, name, statistic=None):
"""Constructor"""
<|body_0|>
def refresh(self):
"""Refresh on a certain interval."""
<|body_1|>
def reduce(self, other)... | stack_v2_sparse_classes_75kplus_train_073594 | 15,105 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, name, statistic=None)"
},
{
"docstring": "Refresh on a certain interval.",
"name": "refresh",
"signature": "def refresh(self)"
},
{
"docstring": "Reduce from a received message. When we combine two... | 3 | stack_v2_sparse_classes_30k_test_002569 | Implement the Python class `AverageAggregator` described below.
Class description:
AVERAGE AGGREGATOR Aggregator that keeps an average of a value.
Method signatures and docstrings:
- def __init__(self, name, statistic=None): Constructor
- def refresh(self): Refresh on a certain interval.
- def reduce(self, other): Re... | Implement the Python class `AverageAggregator` described below.
Class description:
AVERAGE AGGREGATOR Aggregator that keeps an average of a value.
Method signatures and docstrings:
- def __init__(self, name, statistic=None): Constructor
- def refresh(self): Refresh on a certain interval.
- def reduce(self, other): Re... | 90e155d4c32fa9a3f020c7c03b0fbb2572d83a27 | <|skeleton|>
class AverageAggregator:
"""AVERAGE AGGREGATOR Aggregator that keeps an average of a value."""
def __init__(self, name, statistic=None):
"""Constructor"""
<|body_0|>
def refresh(self):
"""Refresh on a certain interval."""
<|body_1|>
def reduce(self, other)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AverageAggregator:
"""AVERAGE AGGREGATOR Aggregator that keeps an average of a value."""
def __init__(self, name, statistic=None):
"""Constructor"""
super(AverageAggregator, self).__init__(name, statistic)
self._interval = random.randint(config.AGGREGATE_AVERAGE_REFRESH_MIN, confi... | the_stack_v2_python_sparse | hiss/aggregation.py | chetmancini/Hiss | train | 6 |
a3cfd76931aa64d1a046a0d593bf94836548521a | [
"def preorder(root):\n if root:\n res.append(str(root.val))\n preorder(root.left)\n preorder(root.right)\nres = list()\npreorder(root)\nreturn ' '.join(res)",
"left = float('-inf')\nright = float('inf')\ndata = [int(val) for val in data.strip('[]{}').split(',')]\nlength = len(data)\nindex ... | <|body_start_0|>
def preorder(root):
if root:
res.append(str(root.val))
preorder(root.left)
preorder(root.right)
res = list()
preorder(root)
return ' '.join(res)
<|end_body_0|>
<|body_start_1|>
left = float('-inf')
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_073595 | 3,101 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_032441 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 6b24724da055a08510c83c645455eaa4ed201298 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def preorder(root):
if root:
res.append(str(root.val))
preorder(root.left)
preorder(root.right)
res = list()
p... | the_stack_v2_python_sparse | Tree/python/leetcode/serialize_and_deserialize_bst.py | sankeerth/Algorithms | train | 0 | |
af0c343806766ea9a7d1bae7cd1d3228e3e255a2 | [
"loop = asyncio.get_event_loop()\nfuture = asyncio.ensure_future(PSStore.get_all_f2p_games_links(iterations=3))\nresult = loop.run_until_complete(future)\nself.assertTrue(bool(result))",
"loop = asyncio.get_event_loop()\nfuture = asyncio.ensure_future(PSStore.get_all_soon_tbr_games_links(iterations=3))\nresult = ... | <|body_start_0|>
loop = asyncio.get_event_loop()
future = asyncio.ensure_future(PSStore.get_all_f2p_games_links(iterations=3))
result = loop.run_until_complete(future)
self.assertTrue(bool(result))
<|end_body_0|>
<|body_start_1|>
loop = asyncio.get_event_loop()
future = ... | AsynchronousMethods | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsynchronousMethods:
async def test_get_f2p_in_bulk_returns_nonempty(self):
"""Test if fetching Free To Play games in bulk returns non-empty set:"""
<|body_0|>
async def test_get_tbr_in_bulk_returns_nonempty(self):
"""Test if fetching To Be Released games in bulk ret... | stack_v2_sparse_classes_75kplus_train_073596 | 3,938 | permissive | [
{
"docstring": "Test if fetching Free To Play games in bulk returns non-empty set:",
"name": "test_get_f2p_in_bulk_returns_nonempty",
"signature": "async def test_get_f2p_in_bulk_returns_nonempty(self)"
},
{
"docstring": "Test if fetching To Be Released games in bulk returns non-empty set",
... | 5 | stack_v2_sparse_classes_30k_train_030102 | Implement the Python class `AsynchronousMethods` described below.
Class description:
Implement the AsynchronousMethods class.
Method signatures and docstrings:
- async def test_get_f2p_in_bulk_returns_nonempty(self): Test if fetching Free To Play games in bulk returns non-empty set:
- async def test_get_tbr_in_bulk_r... | Implement the Python class `AsynchronousMethods` described below.
Class description:
Implement the AsynchronousMethods class.
Method signatures and docstrings:
- async def test_get_f2p_in_bulk_returns_nonempty(self): Test if fetching Free To Play games in bulk returns non-empty set:
- async def test_get_tbr_in_bulk_r... | 02c983eb0baf92599cce3bd523d0a2ae658e5377 | <|skeleton|>
class AsynchronousMethods:
async def test_get_f2p_in_bulk_returns_nonempty(self):
"""Test if fetching Free To Play games in bulk returns non-empty set:"""
<|body_0|>
async def test_get_tbr_in_bulk_returns_nonempty(self):
"""Test if fetching To Be Released games in bulk ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AsynchronousMethods:
async def test_get_f2p_in_bulk_returns_nonempty(self):
"""Test if fetching Free To Play games in bulk returns non-empty set:"""
loop = asyncio.get_event_loop()
future = asyncio.ensure_future(PSStore.get_all_f2p_games_links(iterations=3))
result = loop.run_u... | the_stack_v2_python_sparse | psstore4ru/tests.py | Ian-Gabaraev/psstorereader | train | 0 | |
b873dc0076fba7d52605f049c67d9224ed675d03 | [
"createdLocalSession = False\nif len(ids) == 0:\n return None\nif session == None:\n session = LogServiceDao.getSession()\n createdLocalSession = True\nselectedLogService = None\nrs = session.query(LogService).filter(LogService.id in ids)\nlogServices = []\nfor logService in rs:\n logger.debug('--getLog... | <|body_start_0|>
createdLocalSession = False
if len(ids) == 0:
return None
if session == None:
session = LogServiceDao.getSession()
createdLocalSession = True
selectedLogService = None
rs = session.query(LogService).filter(LogService.id in ids)... | classdocs | LogServiceDao | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogServiceDao:
"""classdocs"""
def getLogServices(cls, ids, session=None):
"""gets logsets of given ids from database"""
<|body_0|>
def getLogService(cls, id, session=None):
"""gets logset of given id from database"""
<|body_1|>
def getAllLogServices... | stack_v2_sparse_classes_75kplus_train_073597 | 3,229 | permissive | [
{
"docstring": "gets logsets of given ids from database",
"name": "getLogServices",
"signature": "def getLogServices(cls, ids, session=None)"
},
{
"docstring": "gets logset of given id from database",
"name": "getLogService",
"signature": "def getLogService(cls, id, session=None)"
},
... | 3 | stack_v2_sparse_classes_30k_train_049712 | Implement the Python class `LogServiceDao` described below.
Class description:
classdocs
Method signatures and docstrings:
- def getLogServices(cls, ids, session=None): gets logsets of given ids from database
- def getLogService(cls, id, session=None): gets logset of given id from database
- def getAllLogServicesForW... | Implement the Python class `LogServiceDao` described below.
Class description:
classdocs
Method signatures and docstrings:
- def getLogServices(cls, ids, session=None): gets logsets of given ids from database
- def getLogService(cls, id, session=None): gets logset of given id from database
- def getAllLogServicesForW... | 20fba1b1fd1a42add223d9e8af2d267665bec493 | <|skeleton|>
class LogServiceDao:
"""classdocs"""
def getLogServices(cls, ids, session=None):
"""gets logsets of given ids from database"""
<|body_0|>
def getLogService(cls, id, session=None):
"""gets logset of given id from database"""
<|body_1|>
def getAllLogServices... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LogServiceDao:
"""classdocs"""
def getLogServices(cls, ids, session=None):
"""gets logsets of given ids from database"""
createdLocalSession = False
if len(ids) == 0:
return None
if session == None:
session = LogServiceDao.getSession()
c... | the_stack_v2_python_sparse | db/core/logservice/logservicedao.py | ABV-Hub/qreservoir | train | 0 |
5b83bb9e9b648da61b5b80df78b6d38c097c93bc | [
"super(Data_New, self).__init__(premodel_data)\nself.observation_labels = []\nself.list_error = []\nself.dataset = []\nself.uid = current_app.config.get('USER_ID')\nself.list_model_type = current_app.config.get('MODEL_TYPE')\nself.model_type = premodel_data['data']['settings']['model_type']",
"numeric_model_type ... | <|body_start_0|>
super(Data_New, self).__init__(premodel_data)
self.observation_labels = []
self.list_error = []
self.dataset = []
self.uid = current_app.config.get('USER_ID')
self.list_model_type = current_app.config.get('MODEL_TYPE')
self.model_type = premodel_d... | @Data_New This class provides a generic constructor interface. Note: this class is invoked within 'load_data.py' Note: inherit base methods from superclass 'Base', 'Base_Data | Data_New | [
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data_New:
"""@Data_New This class provides a generic constructor interface. Note: this class is invoked within 'load_data.py' Note: inherit base methods from superclass 'Base', 'Base_Data"""
def __init__(self, premodel_data):
"""@__init__ This constructor defines class properties usi... | stack_v2_sparse_classes_75kplus_train_073598 | 3,237 | permissive | [
{
"docstring": "@__init__ This constructor defines class properties using the superclass 'Base', and 'Base_Data' constructor, along with the constructor in this subclass. @super(), implement 'Base', and 'Base_Data' superclass constructor within this child class constructor. @self.uid, the logged-in user (i.e. u... | 2 | null | Implement the Python class `Data_New` described below.
Class description:
@Data_New This class provides a generic constructor interface. Note: this class is invoked within 'load_data.py' Note: inherit base methods from superclass 'Base', 'Base_Data
Method signatures and docstrings:
- def __init__(self, premodel_data)... | Implement the Python class `Data_New` described below.
Class description:
@Data_New This class provides a generic constructor interface. Note: this class is invoked within 'load_data.py' Note: inherit base methods from superclass 'Base', 'Base_Data
Method signatures and docstrings:
- def __init__(self, premodel_data)... | 576ffee48f36e2594855259eb4215070c6d1e18f | <|skeleton|>
class Data_New:
"""@Data_New This class provides a generic constructor interface. Note: this class is invoked within 'load_data.py' Note: inherit base methods from superclass 'Base', 'Base_Data"""
def __init__(self, premodel_data):
"""@__init__ This constructor defines class properties usi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Data_New:
"""@Data_New This class provides a generic constructor interface. Note: this class is invoked within 'load_data.py' Note: inherit base methods from superclass 'Base', 'Base_Data"""
def __init__(self, premodel_data):
"""@__init__ This constructor defines class properties using the superc... | the_stack_v2_python_sparse | brain/session/data_new.py | datadave/machine-learning | train | 1 |
f792352fdeb28ea284804cd869049f0028cbec07 | [
"fn = itembarNode.getAttr('back', data.D_FILENAME)\nkwargs['background'] = fn\nself.init(parent, **kwargs)\nfn = itembarNode.getAttr('backarrow', data.D_FILENAME)\nself.backArrow = data.getImage(fn, itembarNode.ditto_fn)\nself.icon = None\nself.labels = []",
"if self.icon is not None:\n self.icon.destroy()\n ... | <|body_start_0|>
fn = itembarNode.getAttr('back', data.D_FILENAME)
kwargs['background'] = fn
self.init(parent, **kwargs)
fn = itembarNode.getAttr('backarrow', data.D_FILENAME)
self.backArrow = data.getImage(fn, itembarNode.ditto_fn)
self.icon = None
self.labels = ... | Widget to show the item info at the bottom of the screen. | ItemBar | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ItemBar:
"""Widget to show the item info at the bottom of the screen."""
def __init__(self, parent, itembarNode, **kwargs):
"""Create the item bar. parent - the parent widget. location - the location of the widget relative to its parent. font - the font to write with. itembarNode - t... | stack_v2_sparse_classes_75kplus_train_073599 | 18,452 | no_license | [
{
"docstring": "Create the item bar. parent - the parent widget. location - the location of the widget relative to its parent. font - the font to write with. itembarNode - the <itembar> node.",
"name": "__init__",
"signature": "def __init__(self, parent, itembarNode, **kwargs)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_val_000827 | Implement the Python class `ItemBar` described below.
Class description:
Widget to show the item info at the bottom of the screen.
Method signatures and docstrings:
- def __init__(self, parent, itembarNode, **kwargs): Create the item bar. parent - the parent widget. location - the location of the widget relative to i... | Implement the Python class `ItemBar` described below.
Class description:
Widget to show the item info at the bottom of the screen.
Method signatures and docstrings:
- def __init__(self, parent, itembarNode, **kwargs): Create the item bar. parent - the parent widget. location - the location of the widget relative to i... | 72841fc503c716ac3b524e42f2311cbd9d18a092 | <|skeleton|>
class ItemBar:
"""Widget to show the item info at the bottom of the screen."""
def __init__(self, parent, itembarNode, **kwargs):
"""Create the item bar. parent - the parent widget. location - the location of the widget relative to its parent. font - the font to write with. itembarNode - t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ItemBar:
"""Widget to show the item info at the bottom of the screen."""
def __init__(self, parent, itembarNode, **kwargs):
"""Create the item bar. parent - the parent widget. location - the location of the widget relative to its parent. font - the font to write with. itembarNode - the <itembar> ... | the_stack_v2_python_sparse | eng/menus/bag_screen.py | andrew-turner/Ditto | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.