blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
d25a60fd706303e81a9eac9e4071776e34e9ba98
[ "self.surface = surface\nself.beans = []\nself.framecount = 1", "self.framecount += 1\nx_off = self.framecount * 0.0003\ny_off = x_off + 20\nx = noise.pnoise1(x_off, octaves=8) * self.surface.get_width()\ny = noise.pnoise1(y_off, octaves=8) * self.surface.get_height()\nif self.framecount % 4 == 0:\n self.beans...
<|body_start_0|> self.surface = surface self.beans = [] self.framecount = 1 <|end_body_0|> <|body_start_1|> self.framecount += 1 x_off = self.framecount * 0.0003 y_off = x_off + 20 x = noise.pnoise1(x_off, octaves=8) * self.surface.get_width() y = noise.p...
draws nice colored lines on surface
CoffeeDraw
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoffeeDraw: """draws nice colored lines on surface""" def __init__(self, surface): """(pygame.Surface) surface - surface to draw on""" <|body_0|> def update(self): """update every frame""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.surfac...
stack_v2_sparse_classes_36k_train_027800
3,495
no_license
[ { "docstring": "(pygame.Surface) surface - surface to draw on", "name": "__init__", "signature": "def __init__(self, surface)" }, { "docstring": "update every frame", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_004261
Implement the Python class `CoffeeDraw` described below. Class description: draws nice colored lines on surface Method signatures and docstrings: - def __init__(self, surface): (pygame.Surface) surface - surface to draw on - def update(self): update every frame
Implement the Python class `CoffeeDraw` described below. Class description: draws nice colored lines on surface Method signatures and docstrings: - def __init__(self, surface): (pygame.Surface) surface - surface to draw on - def update(self): update every frame <|skeleton|> class CoffeeDraw: """draws nice colore...
1fd421195a2888c0588a49f5a043a1110eedcdbf
<|skeleton|> class CoffeeDraw: """draws nice colored lines on surface""" def __init__(self, surface): """(pygame.Surface) surface - surface to draw on""" <|body_0|> def update(self): """update every frame""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoffeeDraw: """draws nice colored lines on surface""" def __init__(self, surface): """(pygame.Surface) surface - surface to draw on""" self.surface = surface self.beans = [] self.framecount = 1 def update(self): """update every frame""" self.framecount...
the_stack_v2_python_sparse
effects/CoffeeBean.py
gunny26/pygame
train
5
91634db380917c9365f2b9e7cb4de4a49b27517a
[ "pool = ForkedProcessPool(name=self.test_01_sys_exit_1.__name__)\nimport pytest\nwith pytest.raises(FailedProcessException, match=ForkedProcessPool.NONZERO_EXIT_STATUS_ERROR_REGEX) as exec_info:\n pool.submit(_sys_exit_1.__name__, _sys_exit_1)\n pool.shutdown()", "pool = ForkedProcessPool(name=self.test_02_...
<|body_start_0|> pool = ForkedProcessPool(name=self.test_01_sys_exit_1.__name__) import pytest with pytest.raises(FailedProcessException, match=ForkedProcessPool.NONZERO_EXIT_STATUS_ERROR_REGEX) as exec_info: pool.submit(_sys_exit_1.__name__, _sys_exit_1) pool.shutdown() ...
TestForkedProcessPool
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestForkedProcessPool: def test_01_sys_exit_1(self): """Check that processes that exit with sys.exit(1) are detected. :return:""" <|body_0|> def test_02_exception(self): """Check that processes that exit with sys.exit(1) are detected. :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027801
13,482
permissive
[ { "docstring": "Check that processes that exit with sys.exit(1) are detected. :return:", "name": "test_01_sys_exit_1", "signature": "def test_01_sys_exit_1(self)" }, { "docstring": "Check that processes that exit with sys.exit(1) are detected. :return:", "name": "test_02_exception", "sig...
3
stack_v2_sparse_classes_30k_train_013922
Implement the Python class `TestForkedProcessPool` described below. Class description: Implement the TestForkedProcessPool class. Method signatures and docstrings: - def test_01_sys_exit_1(self): Check that processes that exit with sys.exit(1) are detected. :return: - def test_02_exception(self): Check that processes...
Implement the Python class `TestForkedProcessPool` described below. Class description: Implement the TestForkedProcessPool class. Method signatures and docstrings: - def test_01_sys_exit_1(self): Check that processes that exit with sys.exit(1) are detected. :return: - def test_02_exception(self): Check that processes...
cdd9bbdc2a3a832be24f20105b8c9fe28149cb63
<|skeleton|> class TestForkedProcessPool: def test_01_sys_exit_1(self): """Check that processes that exit with sys.exit(1) are detected. :return:""" <|body_0|> def test_02_exception(self): """Check that processes that exit with sys.exit(1) are detected. :return:""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestForkedProcessPool: def test_01_sys_exit_1(self): """Check that processes that exit with sys.exit(1) are detected. :return:""" pool = ForkedProcessPool(name=self.test_01_sys_exit_1.__name__) import pytest with pytest.raises(FailedProcessException, match=ForkedProcessPool.NON...
the_stack_v2_python_sparse
rlscope/profiler/concurrent.py
UofT-EcoSystem/rlscope
train
42
9184cb39bebd2bbbad3ad44212c6f27a74219ede
[ "fields = cls.IMPORT_FIELDS\nfor name, field in fields.items():\n base_field = None\n for f in cls._meta.fields:\n if f.name == name:\n base_field = f\n break\n if base_field:\n if 'label' not in field:\n field['label'] = base_field.verbose_name\n if 'h...
<|body_start_0|> fields = cls.IMPORT_FIELDS for name, field in fields.items(): base_field = None for f in cls._meta.fields: if f.name == name: base_field = f break if base_field: if 'label' not in...
Model mixin class which provides support for 'data import' functionality. Models which implement this mixin should provide information on the fields available for import
DataImportMixin
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataImportMixin: """Model mixin class which provides support for 'data import' functionality. Models which implement this mixin should provide information on the fields available for import""" def get_import_fields(cls): """Return all available import fields. Where information on a p...
stack_v2_sparse_classes_36k_train_027802
29,718
permissive
[ { "docstring": "Return all available import fields. Where information on a particular field is not explicitly provided, introspect the base model to (attempt to) find that information.", "name": "get_import_fields", "signature": "def get_import_fields(cls)" }, { "docstring": "Return all *require...
2
stack_v2_sparse_classes_30k_train_002037
Implement the Python class `DataImportMixin` described below. Class description: Model mixin class which provides support for 'data import' functionality. Models which implement this mixin should provide information on the fields available for import Method signatures and docstrings: - def get_import_fields(cls): Ret...
Implement the Python class `DataImportMixin` described below. Class description: Model mixin class which provides support for 'data import' functionality. Models which implement this mixin should provide information on the fields available for import Method signatures and docstrings: - def get_import_fields(cls): Ret...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class DataImportMixin: """Model mixin class which provides support for 'data import' functionality. Models which implement this mixin should provide information on the fields available for import""" def get_import_fields(cls): """Return all available import fields. Where information on a p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataImportMixin: """Model mixin class which provides support for 'data import' functionality. Models which implement this mixin should provide information on the fields available for import""" def get_import_fields(cls): """Return all available import fields. Where information on a particular fie...
the_stack_v2_python_sparse
InvenTree/InvenTree/models.py
inventree/InvenTree
train
3,077
d6042ec81b5d80b63131d038f9032f8b9d76b978
[ "WAITLIST = ['__lll_lock_wait', 'futex_abstimed_wait', 'futex_abstimed_wait_cancelable', 'futex_reltimed_wait', 'futex_reltimed_wait_cancelable', 'futex_wait', 'futex_wait_cancelable']\nif is_thread_blocked_with_frame(thread_id, top_line, WAITLIST, 'pthread_mutex'):\n return MutexType.PTHREAD_MUTEX_T\nif is_thre...
<|body_start_0|> WAITLIST = ['__lll_lock_wait', 'futex_abstimed_wait', 'futex_abstimed_wait_cancelable', 'futex_reltimed_wait', 'futex_reltimed_wait_cancelable', 'futex_wait', 'futex_wait_cancelable'] if is_thread_blocked_with_frame(thread_id, top_line, WAITLIST, 'pthread_mutex'): return Mut...
Types of mutexes that we can detect deadlocks.
MutexType
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MutexType: """Types of mutexes that we can detect deadlocks.""" def get_mutex_type(thread_id, top_line): """Returns the probable mutex type, based on the first line of the thread's stack. Returns None if not found.""" <|body_0|> def get_mutex_owner_and_address_func_for_t...
stack_v2_sparse_classes_36k_train_027803
16,226
permissive
[ { "docstring": "Returns the probable mutex type, based on the first line of the thread's stack. Returns None if not found.", "name": "get_mutex_type", "signature": "def get_mutex_type(thread_id, top_line)" }, { "docstring": "Returns a function to resolve the mutex owner and address for the given...
2
stack_v2_sparse_classes_30k_train_003022
Implement the Python class `MutexType` described below. Class description: Types of mutexes that we can detect deadlocks. Method signatures and docstrings: - def get_mutex_type(thread_id, top_line): Returns the probable mutex type, based on the first line of the thread's stack. Returns None if not found. - def get_mu...
Implement the Python class `MutexType` described below. Class description: Types of mutexes that we can detect deadlocks. Method signatures and docstrings: - def get_mutex_type(thread_id, top_line): Returns the probable mutex type, based on the first line of the thread's stack. Returns None if not found. - def get_mu...
ab45d9b6a7a2a24b2a725447387f36772dd2cc4a
<|skeleton|> class MutexType: """Types of mutexes that we can detect deadlocks.""" def get_mutex_type(thread_id, top_line): """Returns the probable mutex type, based on the first line of the thread's stack. Returns None if not found.""" <|body_0|> def get_mutex_owner_and_address_func_for_t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MutexType: """Types of mutexes that we can detect deadlocks.""" def get_mutex_type(thread_id, top_line): """Returns the probable mutex type, based on the first line of the thread's stack. Returns None if not found.""" WAITLIST = ['__lll_lock_wait', 'futex_abstimed_wait', 'futex_abstimed_w...
the_stack_v2_python_sparse
folly/experimental/gdb/deadlock.py
facebook/folly
train
23,991
f6e0b997e0ab73243c7e9380538a593e2e0e5dbc
[ "if self._disable:\n return False\nif self.spectrograph is None or self.telescope is None:\n return False\nif self.unknown != 'snr':\n raise NotImplementedError('Only SNR calculations currently supported')\nself._update_snr()", "if self.verbose:\n msg1 = 'Creating exposure for {} ({})'.format(self.tel...
<|body_start_0|> if self._disable: return False if self.spectrograph is None or self.telescope is None: return False if self.unknown != 'snr': raise NotImplementedError('Only SNR calculations currently supported') self._update_snr() <|end_body_0|> <|b...
A subclass of the base Exposure model, for spectroscopic ETC calculations.
SpectrographicExposure
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectrographicExposure: """A subclass of the base Exposure model, for spectroscopic ETC calculations.""" def calculate(self): """Wrapper to calculate the exposure time, SNR, or limiting magnitude, based on the other two. The "unknown" attribute controls which of these parameters is c...
stack_v2_sparse_classes_36k_train_027804
18,852
no_license
[ { "docstring": "Wrapper to calculate the exposure time, SNR, or limiting magnitude, based on the other two. The \"unknown\" attribute controls which of these parameters is calculated.", "name": "calculate", "signature": "def calculate(self)" }, { "docstring": "Calculate the SNR based on the curr...
2
stack_v2_sparse_classes_30k_train_002685
Implement the Python class `SpectrographicExposure` described below. Class description: A subclass of the base Exposure model, for spectroscopic ETC calculations. Method signatures and docstrings: - def calculate(self): Wrapper to calculate the exposure time, SNR, or limiting magnitude, based on the other two. The "u...
Implement the Python class `SpectrographicExposure` described below. Class description: A subclass of the base Exposure model, for spectroscopic ETC calculations. Method signatures and docstrings: - def calculate(self): Wrapper to calculate the exposure time, SNR, or limiting magnitude, based on the other two. The "u...
ccd63cc79671fb333b892c3125861be2128e5ee8
<|skeleton|> class SpectrographicExposure: """A subclass of the base Exposure model, for spectroscopic ETC calculations.""" def calculate(self): """Wrapper to calculate the exposure time, SNR, or limiting magnitude, based on the other two. The "unknown" attribute controls which of these parameters is c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectrographicExposure: """A subclass of the base Exposure model, for spectroscopic ETC calculations.""" def calculate(self): """Wrapper to calculate the exposure time, SNR, or limiting magnitude, based on the other two. The "unknown" attribute controls which of these parameters is calculated."""...
the_stack_v2_python_sparse
syotools/models/exposure.py
tumlinson/luvoir_simtools
train
1
7eaba6bd8242c467d2422136ebc2ec5b4dcd7bf8
[ "super().__init__()\nself.N = neighbor_graph\nself.stylesheet = stylesheet\nself.style = next(self.stylesheet[style])\nself._ball()\nself._hull()\nself._edges()\nself._points()\nself._vertices()", "point_style = self.style.get('graph_point')\nif point_style is not None:\n point_style_dict = next(self.styleshee...
<|body_start_0|> super().__init__() self.N = neighbor_graph self.stylesheet = stylesheet self.style = next(self.stylesheet[style]) self._ball() self._hull() self._edges() self._points() self._vertices() <|end_body_0|> <|body_start_1|> poin...
A utility class used to draw visualizations of NeighborGraph objects as a series of points, edges, as well as convex hulls. Attributes ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str The object style used to draw a NeighborGraph as an str. (default 'neighbor_graph') style...
VizNeighborGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VizNeighborGraph: """A utility class used to draw visualizations of NeighborGraph objects as a series of points, edges, as well as convex hulls. Attributes ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str The object style used to draw a NeighborGraph...
stack_v2_sparse_classes_36k_train_027805
4,615
permissive
[ { "docstring": "Parameters ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str, optional The object style used to draw a NeighborGraph as an str. (default 'neighbor_graph') stylesheet: StyleSheet, optional The stylesheet used to describe which elements to draw an how ...
6
stack_v2_sparse_classes_30k_train_013502
Implement the Python class `VizNeighborGraph` described below. Class description: A utility class used to draw visualizations of NeighborGraph objects as a series of points, edges, as well as convex hulls. Attributes ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str The ob...
Implement the Python class `VizNeighborGraph` described below. Class description: A utility class used to draw visualizations of NeighborGraph objects as a series of points, edges, as well as convex hulls. Attributes ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str The ob...
1383b7b005ce59d35b4e012524382c08675594c6
<|skeleton|> class VizNeighborGraph: """A utility class used to draw visualizations of NeighborGraph objects as a series of points, edges, as well as convex hulls. Attributes ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str The object style used to draw a NeighborGraph...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VizNeighborGraph: """A utility class used to draw visualizations of NeighborGraph objects as a series of points, edges, as well as convex hulls. Attributes ---------- neighbor_graph: NeighborGraph a NeighborGraph object to draw to a canvas. style: str The object style used to draw a NeighborGraph as an str. (...
the_stack_v2_python_sparse
greedypermutation/vizneighborgraph.py
donsheehy/greedypermutation
train
6
5999a49edf907a298784b8e808c03c1961fff2b2
[ "super().__init__(cost_func)\nself.support_for_bounds = True\nself.no_bounds_minimizers = ['lm-scipy']\nself.param_ranges = None\nself.result = None\nself._status = None\nself._popt = None\nself._minimizer = ''", "if self.minimizer == 'lm-scipy':\n self._minimizer = 'lm'\nelse:\n self._minimizer = self.mini...
<|body_start_0|> super().__init__(cost_func) self.support_for_bounds = True self.no_bounds_minimizers = ['lm-scipy'] self.param_ranges = None self.result = None self._status = None self._popt = None self._minimizer = '' <|end_body_0|> <|body_start_1|> ...
Controller for the Scipy Least-Squares fitting software.
ScipyLSController
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScipyLSController: """Controller for the Scipy Least-Squares fitting software.""" def __init__(self, cost_func): """Initialise the class. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostF...
stack_v2_sparse_classes_36k_train_027806
3,366
permissive
[ { "docstring": "Initialise the class. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostFunc`", "name": "__init__", "signature": "def __init__(self, cost_func)" }, { "docstring": "Setup problem ready t...
4
null
Implement the Python class `ScipyLSController` described below. Class description: Controller for the Scipy Least-Squares fitting software. Method signatures and docstrings: - def __init__(self, cost_func): Initialise the class. :param cost_func: Cost function object selected from options. :type cost_func: subclass o...
Implement the Python class `ScipyLSController` described below. Class description: Controller for the Scipy Least-Squares fitting software. Method signatures and docstrings: - def __init__(self, cost_func): Initialise the class. :param cost_func: Cost function object selected from options. :type cost_func: subclass o...
5ee7e66d963ebe9296c0a62c24b9616f6c65537e
<|skeleton|> class ScipyLSController: """Controller for the Scipy Least-Squares fitting software.""" def __init__(self, cost_func): """Initialise the class. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostF...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScipyLSController: """Controller for the Scipy Least-Squares fitting software.""" def __init__(self, cost_func): """Initialise the class. :param cost_func: Cost function object selected from options. :type cost_func: subclass of :class:`~fitbenchmarking.cost_func.base_cost_func.CostFunc`""" ...
the_stack_v2_python_sparse
fitbenchmarking/controllers/scipy_ls_controller.py
fitbenchmarking/fitbenchmarking
train
15
5097d0a34fd70661e0574a0905fe8896d195c89f
[ "lst = [None] * len(S)\ntargets = []\nfor i in range(len(S)):\n if S[i] == C:\n targets.append(i)\nfor i in range(len(S)):\n if i in targets:\n lst[i] = 0\n else:\n lst[i] = min([abs(i - x) for x in targets])\nreturn lst", "lst = [n] * len(S)\npos = -n\nfor i in range(n) + range(n, 0...
<|body_start_0|> lst = [None] * len(S) targets = [] for i in range(len(S)): if S[i] == C: targets.append(i) for i in range(len(S)): if i in targets: lst[i] = 0 else: lst[i] = min([abs(i - x) for x in targ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestToChar(self, S, C): """:type S: str :type C: str :rtype: List[int]""" <|body_0|> def shortestToChar(self, S, C): """:param S: :param C: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> lst = [None] * len(S) targ...
stack_v2_sparse_classes_36k_train_027807
1,497
no_license
[ { "docstring": ":type S: str :type C: str :rtype: List[int]", "name": "shortestToChar", "signature": "def shortestToChar(self, S, C)" }, { "docstring": ":param S: :param C: :return:", "name": "shortestToChar", "signature": "def shortestToChar(self, S, C)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestToChar(self, S, C): :type S: str :type C: str :rtype: List[int] - def shortestToChar(self, S, C): :param S: :param C: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestToChar(self, S, C): :type S: str :type C: str :rtype: List[int] - def shortestToChar(self, S, C): :param S: :param C: :return: <|skeleton|> class Solution: def ...
8595b04cf5a024c2cd8a97f750d890a818568401
<|skeleton|> class Solution: def shortestToChar(self, S, C): """:type S: str :type C: str :rtype: List[int]""" <|body_0|> def shortestToChar(self, S, C): """:param S: :param C: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shortestToChar(self, S, C): """:type S: str :type C: str :rtype: List[int]""" lst = [None] * len(S) targets = [] for i in range(len(S)): if S[i] == C: targets.append(i) for i in range(len(S)): if i in targets: ...
the_stack_v2_python_sparse
python/821.shortest-distance-to-a-character.py
tainenko/Leetcode2019
train
5
4c23b1be8795ddcf1fa3ff07f86023bc149f0b48
[ "c = collections.Counter(arr)\nfor i in c:\n if c[i] * 4 > len(arr):\n return i", "n = len(arr)\nspan = n // 4 + 1\nfor i in range(0, n, span):\n iter_l = bisect.bisect_left(arr, arr[i])\n iter_r = bisect.bisect_right(arr, arr[i])\n if iter_r - iter_l >= span:\n return arr[i]" ]
<|body_start_0|> c = collections.Counter(arr) for i in c: if c[i] * 4 > len(arr): return i <|end_body_0|> <|body_start_1|> n = len(arr) span = n // 4 + 1 for i in range(0, n, span): iter_l = bisect.bisect_left(arr, arr[i]) iter...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findSpecialInteger(self, arr): """:type arr: List[int] :rtype: int""" <|body_0|> def findSpecialInteger(self, arr): """:type arr: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> c = collections.Counter(arr) ...
stack_v2_sparse_classes_36k_train_027808
855
no_license
[ { "docstring": ":type arr: List[int] :rtype: int", "name": "findSpecialInteger", "signature": "def findSpecialInteger(self, arr)" }, { "docstring": ":type arr: List[int] :rtype: int", "name": "findSpecialInteger", "signature": "def findSpecialInteger(self, arr)" } ]
2
stack_v2_sparse_classes_30k_test_000425
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSpecialInteger(self, arr): :type arr: List[int] :rtype: int - def findSpecialInteger(self, arr): :type arr: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSpecialInteger(self, arr): :type arr: List[int] :rtype: int - def findSpecialInteger(self, arr): :type arr: List[int] :rtype: int <|skeleton|> class Solution: def f...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def findSpecialInteger(self, arr): """:type arr: List[int] :rtype: int""" <|body_0|> def findSpecialInteger(self, arr): """:type arr: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findSpecialInteger(self, arr): """:type arr: List[int] :rtype: int""" c = collections.Counter(arr) for i in c: if c[i] * 4 > len(arr): return i def findSpecialInteger(self, arr): """:type arr: List[int] :rtype: int""" n = l...
the_stack_v2_python_sparse
1287_Element_Appearing_More_Than_25%_In_Sorted_Array.py
bingli8802/leetcode
train
0
16ff082144c2081e4919ec95f8ad1718a944b27f
[ "self.list = []\nself.key_value = {}\nself.cap = capacity", "if key not in self.list:\n return -1\nelse:\n self.list.remove(key)\n self.list.append(key)\n return self.key_value[key]", "if len(self.list) < self.cap:\n if key not in self.list:\n self.list.append(key)\n self.key_value[...
<|body_start_0|> self.list = [] self.key_value = {} self.cap = capacity <|end_body_0|> <|body_start_1|> if key not in self.list: return -1 else: self.list.remove(key) self.list.append(key) return self.key_value[key] <|end_body_1|> ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_027809
3,513
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_004802
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
9f949ae6b5ee178c7153f1c402a92accbf710111
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.list = [] self.key_value = {} self.cap = capacity def get(self, key): """:type key: int :rtype: int""" if key not in self.list: return -1 else: self.list....
the_stack_v2_python_sparse
算法题/LRU缓存机制.py
yllzxzyq/Nick-life-of-code
train
1
17881f8ea30d6a578e1b0280d01b753254485b6b
[ "self.width = width\nself.height = height\nself.food = food\nself.snake = [[0, 0]]\nself.score = 0", "nextx, nexty = self.snake[0]\nif direction == 'U':\n nextx -= 1\nelif direction == 'L':\n nexty -= 1\nelif direction == 'D':\n nextx += 1\nelif direction == 'R':\n nexty += 1\nif self.food and [nextx,...
<|body_start_0|> self.width = width self.height = height self.food = food self.snake = [[0, 0]] self.score = 0 <|end_body_0|> <|body_start_1|> nextx, nexty = self.snake[0] if direction == 'U': nextx -= 1 elif direction == 'L': next...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_36k_train_027810
2,161
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
stack_v2_sparse_classes_30k_train_003210
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
16b329e5eafffb3cee14a054a35cfe7c6eb9268a
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
ixl/353DesignSnakeGame.py
CheLcodes/leetcode_python_practice
train
0
e70651ef79d9ddeb6338d8757744f83e07b1bdef
[ "self.df = data\nself.feats = feats\nself.df.drop(['addr_state', 'installment', 'purpose'], 1, inplace=True)\nself.df = pd.get_dummies(self.df)\ny = self.df.int_rate.values\nself.df.drop('int_rate', axis=1, inplace=True)\nX, y = shuffle(self.df.values, y, random_state=30)\nX = X.astype(np.float32)\noffset = int(X.s...
<|body_start_0|> self.df = data self.feats = feats self.df.drop(['addr_state', 'installment', 'purpose'], 1, inplace=True) self.df = pd.get_dummies(self.df) y = self.df.int_rate.values self.df.drop('int_rate', axis=1, inplace=True) X, y = shuffle(self.df.values, y...
This is the class for visulization methods of GBT
GBT_model
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GBT_model: """This is the class for visulization methods of GBT""" def __init__(self, data, feats): """Constructor""" <|body_0|> def gbt_model(self): """get the dataframe, test and training data Return ====== return accuracy of GBT regression""" <|body_1|...
stack_v2_sparse_classes_36k_train_027811
4,025
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, data, feats)" }, { "docstring": "get the dataframe, test and training data Return ====== return accuracy of GBT regression", "name": "gbt_model", "signature": "def gbt_model(self)" }, { "docstring"...
5
stack_v2_sparse_classes_30k_train_014886
Implement the Python class `GBT_model` described below. Class description: This is the class for visulization methods of GBT Method signatures and docstrings: - def __init__(self, data, feats): Constructor - def gbt_model(self): get the dataframe, test and training data Return ====== return accuracy of GBT regression...
Implement the Python class `GBT_model` described below. Class description: This is the class for visulization methods of GBT Method signatures and docstrings: - def __init__(self, data, feats): Constructor - def gbt_model(self): get the dataframe, test and training data Return ====== return accuracy of GBT regression...
dc9185cbc5e65650d985ebecf877a157c8c19a13
<|skeleton|> class GBT_model: """This is the class for visulization methods of GBT""" def __init__(self, data, feats): """Constructor""" <|body_0|> def gbt_model(self): """get the dataframe, test and training data Return ====== return accuracy of GBT regression""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GBT_model: """This is the class for visulization methods of GBT""" def __init__(self, data, feats): """Constructor""" self.df = data self.feats = feats self.df.drop(['addr_state', 'installment', 'purpose'], 1, inplace=True) self.df = pd.get_dummies(self.df) ...
the_stack_v2_python_sparse
sj2384/GBT_model.py
ds-ga-1007/final_project
train
0
9e3e9c30f9b8440388e8e6677e1d7cc7b14c7f91
[ "e = Furniture('test product code', 'test description', 'test market price', 'test rental price', 'test material', 'test size')\nself.assertEqual(e.product_code, 'test product code')\nself.assertEqual(e.description, 'test description')\nself.assertEqual(e.market_price, 'test market price')\nself.assertEqual(e.renta...
<|body_start_0|> e = Furniture('test product code', 'test description', 'test market price', 'test rental price', 'test material', 'test size') self.assertEqual(e.product_code, 'test product code') self.assertEqual(e.description, 'test description') self.assertEqual(e.market_price, 'test...
FurnitureTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FurnitureTest: def test_furniture_init(self): """Tests that Furniture can be initiated""" <|body_0|> def test_furniture_return(self): """Tests Furniture return_as_dictionary""" <|body_1|> <|end_skeleton|> <|body_start_0|> e = Furniture('test product...
stack_v2_sparse_classes_36k_train_027812
9,076
no_license
[ { "docstring": "Tests that Furniture can be initiated", "name": "test_furniture_init", "signature": "def test_furniture_init(self)" }, { "docstring": "Tests Furniture return_as_dictionary", "name": "test_furniture_return", "signature": "def test_furniture_return(self)" } ]
2
stack_v2_sparse_classes_30k_train_011838
Implement the Python class `FurnitureTest` described below. Class description: Implement the FurnitureTest class. Method signatures and docstrings: - def test_furniture_init(self): Tests that Furniture can be initiated - def test_furniture_return(self): Tests Furniture return_as_dictionary
Implement the Python class `FurnitureTest` described below. Class description: Implement the FurnitureTest class. Method signatures and docstrings: - def test_furniture_init(self): Tests that Furniture can be initiated - def test_furniture_return(self): Tests Furniture return_as_dictionary <|skeleton|> class Furnitu...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class FurnitureTest: def test_furniture_init(self): """Tests that Furniture can be initiated""" <|body_0|> def test_furniture_return(self): """Tests Furniture return_as_dictionary""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FurnitureTest: def test_furniture_init(self): """Tests that Furniture can be initiated""" e = Furniture('test product code', 'test description', 'test market price', 'test rental price', 'test material', 'test size') self.assertEqual(e.product_code, 'test product code') self.as...
the_stack_v2_python_sparse
students/kyle_lehning/Lesson01/test_unit.py
JavaRod/SP_Python220B_2019
train
1
6536469631939640f12ced1d33068590fdcb876c
[ "level = {s}\nwhile True:\n valid = []\n for s in level:\n try:\n eval('0,' + filter('()'.count, s).replace(')', '),'))\n valid.append(s)\n except Exception:\n pass\n if valid:\n return valid\n level = {s[:i] + s[i + 1:] for s in level for i in range...
<|body_start_0|> level = {s} while True: valid = [] for s in level: try: eval('0,' + filter('()'.count, s).replace(')', '),')) valid.append(s) except Exception: pass if valid: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str] BFS 起手勢變形~ 將 root 加入 list.""" <|body_0|> def rewrite(self, s): """:type s: str :rtype: List[str] my best and clear solution :-) BFS 起手勢變形~ 將 root 加入 list.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k_train_027813
3,225
no_license
[ { "docstring": ":type s: str :rtype: List[str] BFS 起手勢變形~ 將 root 加入 list.", "name": "removeInvalidParentheses", "signature": "def removeInvalidParentheses(self, s)" }, { "docstring": ":type s: str :rtype: List[str] my best and clear solution :-) BFS 起手勢變形~ 將 root 加入 list.", "name": "rewrite"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeInvalidParentheses(self, s): :type s: str :rtype: List[str] BFS 起手勢變形~ 將 root 加入 list. - def rewrite(self, s): :type s: str :rtype: List[str] my best and clear solution...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeInvalidParentheses(self, s): :type s: str :rtype: List[str] BFS 起手勢變形~ 將 root 加入 list. - def rewrite(self, s): :type s: str :rtype: List[str] my best and clear solution...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str] BFS 起手勢變形~ 將 root 加入 list.""" <|body_0|> def rewrite(self, s): """:type s: str :rtype: List[str] my best and clear solution :-) BFS 起手勢變形~ 將 root 加入 list.""" <|body_1|> <|end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeInvalidParentheses(self, s): """:type s: str :rtype: List[str] BFS 起手勢變形~ 將 root 加入 list.""" level = {s} while True: valid = [] for s in level: try: eval('0,' + filter('()'.count, s).replace(')', '),')) ...
the_stack_v2_python_sparse
co_twitter/301_Remove_Invalid_Parentheses.py
vsdrun/lc_public
train
6
bc82625bc4ea04ca856b77ff8d2056f58299ba77
[ "references = ['nothing']\nif not metrics:\n aidegen_metrics.starts_asuite_metrics(references)\n self.assertFalse(mock_print_data.called)\nelse:\n with mock.patch.object(metrics_utils, 'get_start_time') as mk_get:\n with mock.patch.object(metrics, 'AtestStartEvent') as mk_start:\n aidegen...
<|body_start_0|> references = ['nothing'] if not metrics: aidegen_metrics.starts_asuite_metrics(references) self.assertFalse(mock_print_data.called) else: with mock.patch.object(metrics_utils, 'get_start_time') as mk_get: with mock.patch.object...
Unit tests for aidegen_metrics.py.
AidegenMetricsUnittests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AidegenMetricsUnittests: """Unit tests for aidegen_metrics.py.""" def test_starts_asuite_metrics(self, mock_print_data): """Test starts_asuite_metrics.""" <|body_0|> def test_ends_asuite_metrics(self): """Test ends_asuite_metrics.""" <|body_1|> def t...
stack_v2_sparse_classes_36k_train_027814
2,531
no_license
[ { "docstring": "Test starts_asuite_metrics.", "name": "test_starts_asuite_metrics", "signature": "def test_starts_asuite_metrics(self, mock_print_data)" }, { "docstring": "Test ends_asuite_metrics.", "name": "test_ends_asuite_metrics", "signature": "def test_ends_asuite_metrics(self)" ...
3
null
Implement the Python class `AidegenMetricsUnittests` described below. Class description: Unit tests for aidegen_metrics.py. Method signatures and docstrings: - def test_starts_asuite_metrics(self, mock_print_data): Test starts_asuite_metrics. - def test_ends_asuite_metrics(self): Test ends_asuite_metrics. - def test_...
Implement the Python class `AidegenMetricsUnittests` described below. Class description: Unit tests for aidegen_metrics.py. Method signatures and docstrings: - def test_starts_asuite_metrics(self, mock_print_data): Test starts_asuite_metrics. - def test_ends_asuite_metrics(self): Test ends_asuite_metrics. - def test_...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class AidegenMetricsUnittests: """Unit tests for aidegen_metrics.py.""" def test_starts_asuite_metrics(self, mock_print_data): """Test starts_asuite_metrics.""" <|body_0|> def test_ends_asuite_metrics(self): """Test ends_asuite_metrics.""" <|body_1|> def t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AidegenMetricsUnittests: """Unit tests for aidegen_metrics.py.""" def test_starts_asuite_metrics(self, mock_print_data): """Test starts_asuite_metrics.""" references = ['nothing'] if not metrics: aidegen_metrics.starts_asuite_metrics(references) self.assert...
the_stack_v2_python_sparse
tools/asuite/aidegen/lib/aidegen_metrics_unittest.py
ZYHGOD-1/Aosp11
train
0
2c773aa30db86b7ded2d0b92e51924565ac64813
[ "cube = set_up_variable_cube(np.ones((3, 3), dtype=np.float32))\nset_history_attribute(cube, 'Nowcast')\nself.assertTrue('history' in cube.attributes)\nself.assertTrue('Nowcast' in cube.attributes['history'])", "cube = set_up_variable_cube(np.ones((3, 3), dtype=np.float32))\nold_history = '2018-09-13T11:28:29: St...
<|body_start_0|> cube = set_up_variable_cube(np.ones((3, 3), dtype=np.float32)) set_history_attribute(cube, 'Nowcast') self.assertTrue('history' in cube.attributes) self.assertTrue('Nowcast' in cube.attributes['history']) <|end_body_0|> <|body_start_1|> cube = set_up_variable_cu...
Test the set_history_attribute function.
Test_set_history_attribute
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_set_history_attribute: """Test the set_history_attribute function.""" def test_add_history(self): """Test that a history attribute has been added.""" <|body_0|> def test_history_already_exists(self): """Test that the history attribute is overwritten, if it a...
stack_v2_sparse_classes_36k_train_027815
12,457
permissive
[ { "docstring": "Test that a history attribute has been added.", "name": "test_add_history", "signature": "def test_add_history(self)" }, { "docstring": "Test that the history attribute is overwritten, if it already exists.", "name": "test_history_already_exists", "signature": "def test_h...
4
null
Implement the Python class `Test_set_history_attribute` described below. Class description: Test the set_history_attribute function. Method signatures and docstrings: - def test_add_history(self): Test that a history attribute has been added. - def test_history_already_exists(self): Test that the history attribute is...
Implement the Python class `Test_set_history_attribute` described below. Class description: Test the set_history_attribute function. Method signatures and docstrings: - def test_add_history(self): Test that a history attribute has been added. - def test_history_already_exists(self): Test that the history attribute is...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_set_history_attribute: """Test the set_history_attribute function.""" def test_add_history(self): """Test that a history attribute has been added.""" <|body_0|> def test_history_already_exists(self): """Test that the history attribute is overwritten, if it a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_set_history_attribute: """Test the set_history_attribute function.""" def test_add_history(self): """Test that a history attribute has been added.""" cube = set_up_variable_cube(np.ones((3, 3), dtype=np.float32)) set_history_attribute(cube, 'Nowcast') self.assertTrue(...
the_stack_v2_python_sparse
improver_tests/metadata/test_amend.py
metoppv/improver
train
101
7340da8e9ddd2ab4fcb9b8103c88967cab920cda
[ "instance = cfg.GetInstanceInfo(self.inst_uuid)\ndisks = cfg.GetInstanceDisks(self.inst_uuid)\nif instance is None:\n raise errors.ProgrammerError(\"Unknown instance '%s' passed to IAllocator\" % self.inst_uuid)\nif not utils.AllDiskOfType(disks, constants.DTS_MIRRORED):\n raise errors.OpPrereqError(\"Can't r...
<|body_start_0|> instance = cfg.GetInstanceInfo(self.inst_uuid) disks = cfg.GetInstanceDisks(self.inst_uuid) if instance is None: raise errors.ProgrammerError("Unknown instance '%s' passed to IAllocator" % self.inst_uuid) if not utils.AllDiskOfType(disks, constants.DTS_MIRROR...
A relocation request.
IAReqRelocate
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IAReqRelocate: """A relocation request.""" def GetRequest(self, cfg): """Request an relocation of an instance The checks for the completeness of the opcode must have already been done.""" <|body_0|> def ValidateResult(self, ia, result): """Validates the result of...
stack_v2_sparse_classes_36k_train_027816
29,971
permissive
[ { "docstring": "Request an relocation of an instance The checks for the completeness of the opcode must have already been done.", "name": "GetRequest", "signature": "def GetRequest(self, cfg)" }, { "docstring": "Validates the result of an relocation request.", "name": "ValidateResult", "...
3
stack_v2_sparse_classes_30k_train_019083
Implement the Python class `IAReqRelocate` described below. Class description: A relocation request. Method signatures and docstrings: - def GetRequest(self, cfg): Request an relocation of an instance The checks for the completeness of the opcode must have already been done. - def ValidateResult(self, ia, result): Va...
Implement the Python class `IAReqRelocate` described below. Class description: A relocation request. Method signatures and docstrings: - def GetRequest(self, cfg): Request an relocation of an instance The checks for the completeness of the opcode must have already been done. - def ValidateResult(self, ia, result): Va...
456ea285a7583183c2c8e5bcffe9006ec8a9d658
<|skeleton|> class IAReqRelocate: """A relocation request.""" def GetRequest(self, cfg): """Request an relocation of an instance The checks for the completeness of the opcode must have already been done.""" <|body_0|> def ValidateResult(self, ia, result): """Validates the result of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IAReqRelocate: """A relocation request.""" def GetRequest(self, cfg): """Request an relocation of an instance The checks for the completeness of the opcode must have already been done.""" instance = cfg.GetInstanceInfo(self.inst_uuid) disks = cfg.GetInstanceDisks(self.inst_uuid) ...
the_stack_v2_python_sparse
lib/masterd/iallocator.py
ganeti/ganeti
train
465
c7159a6993b9e9de81c46b3ac79f6b21865e34f6
[ "model = gan.load('models/nn/ScalarIncremental.model')\nmodel_g = model['generator'].eval()\nstate_g = model['state_g']\ninput_g = model_g.generate_input(N)\npred_g, state_g = model_g(input_g.detach(), state_g)\nsentences = []\nfor sentence_idx in range(N):\n words = []\n for word_idx in range(config.seq_len)...
<|body_start_0|> model = gan.load('models/nn/ScalarIncremental.model') model_g = model['generator'].eval() state_g = model['state_g'] input_g = model_g.generate_input(N) pred_g, state_g = model_g(input_g.detach(), state_g) sentences = [] for sentence_idx in range(...
generate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class generate: def ScalarIncremental(N=1): """Generates text from ScalarIncremental. Args: N (int): Number of samples.""" <|body_0|> def ClosestWord2Vec(N=1): """Generates text from ClosestWord2Vec. Args: N (int): Number of samples.""" <|body_1|> def Bert(N=1...
stack_v2_sparse_classes_36k_train_027817
11,310
permissive
[ { "docstring": "Generates text from ScalarIncremental. Args: N (int): Number of samples.", "name": "ScalarIncremental", "signature": "def ScalarIncremental(N=1)" }, { "docstring": "Generates text from ClosestWord2Vec. Args: N (int): Number of samples.", "name": "ClosestWord2Vec", "signat...
3
stack_v2_sparse_classes_30k_train_016923
Implement the Python class `generate` described below. Class description: Implement the generate class. Method signatures and docstrings: - def ScalarIncremental(N=1): Generates text from ScalarIncremental. Args: N (int): Number of samples. - def ClosestWord2Vec(N=1): Generates text from ClosestWord2Vec. Args: N (int...
Implement the Python class `generate` described below. Class description: Implement the generate class. Method signatures and docstrings: - def ScalarIncremental(N=1): Generates text from ScalarIncremental. Args: N (int): Number of samples. - def ClosestWord2Vec(N=1): Generates text from ClosestWord2Vec. Args: N (int...
c82cd38e7890b9843e2b9a91f14f004d6a54a562
<|skeleton|> class generate: def ScalarIncremental(N=1): """Generates text from ScalarIncremental. Args: N (int): Number of samples.""" <|body_0|> def ClosestWord2Vec(N=1): """Generates text from ClosestWord2Vec. Args: N (int): Number of samples.""" <|body_1|> def Bert(N=1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class generate: def ScalarIncremental(N=1): """Generates text from ScalarIncremental. Args: N (int): Number of samples.""" model = gan.load('models/nn/ScalarIncremental.model') model_g = model['generator'].eval() state_g = model['state_g'] input_g = model_g.generate_input(N) ...
the_stack_v2_python_sparse
src/evaluate.py
martinbenes1996/732A92-project
train
0
3ca280ea2b0b584187cefc7cc5b96ec3447e4983
[ "super(OpsimFieldSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs)\nself.fieldID = None\nself.simDataFieldIDColName = simDataFieldIDColName\nself.fieldIDColName = fieldIDColName\nself.fieldRaColName = fieldRaColName\nself.fieldDecColName = fieldDecColName\nself.columnsNeeded = [simDataFiel...
<|body_start_0|> super(OpsimFieldSlicer, self).__init__(verbose=verbose, badval=badval, plotFuncs=plotFuncs) self.fieldID = None self.simDataFieldIDColName = simDataFieldIDColName self.fieldIDColName = fieldIDColName self.fieldRaColName = fieldRaColName self.fieldDecColNa...
Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID of the opsim fields to generate spatial matc...
OpsimFieldSlicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpsimFieldSlicer: """Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID ...
stack_v2_sparse_classes_36k_train_027818
6,744
no_license
[ { "docstring": "Instantiate opsim field slicer (an index-based slicer that can do spatial plots). simDataFieldIDColName = the column name in simData for the field ID simDataFieldRaColName = the column name in simData for the field RA simDataFieldDecColName = the column name in simData for the field Dec fieldIDc...
4
stack_v2_sparse_classes_30k_train_010742
Implement the Python class `OpsimFieldSlicer` described below. Class description: Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. ...
Implement the Python class `OpsimFieldSlicer` described below. Class description: Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. ...
2b0faebd60fb4387366954d3531ac4d9df8c6fc4
<|skeleton|> class OpsimFieldSlicer: """Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpsimFieldSlicer: """Index-based slicer, matched ID's between simData and fieldData. Slicer uses fieldData RA and Dec values to do sky map plotting, but could be used more generally for any kind of data slicing where the match is based on a simple ID value. Note that this slicer uses the fieldID of the opsim ...
the_stack_v2_python_sparse
python/lsst/sims/maf/slicers/opsimFieldSlicer.py
nanchenchen/sims_maf
train
0
bf52cdb366bf2827c2168f9a33a80c59443be497
[ "super().__init__()\nself._momentum = momentum\nself._eps = eps", "self.running_mean = self.add_weight(name='running_mean', shape=input_shape[1:], dtype=tf.float32, initializer=tf.keras.initializers.Zeros(), trainable=False)\nself.running_var = self.add_weight(name='running_var', shape=input_shape[1:], dtype=tf.f...
<|body_start_0|> super().__init__() self._momentum = momentum self._eps = eps <|end_body_0|> <|body_start_1|> self.running_mean = self.add_weight(name='running_mean', shape=input_shape[1:], dtype=tf.float32, initializer=tf.keras.initializers.Zeros(), trainable=False) self.runnin...
Revertible batch normalization. Attributes: _momentum: _eps:
BatchNorm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchNorm: """Revertible batch normalization. Attributes: _momentum: _eps:""" def __init__(self, momentum=0.9, eps=1e-05): """Initializes the object. Args: momentum: eps:""" <|body_0|> def build(self, input_shape): """Adds variables to the layer. Args: input_shap...
stack_v2_sparse_classes_36k_train_027819
12,897
no_license
[ { "docstring": "Initializes the object. Args: momentum: eps:", "name": "__init__", "signature": "def __init__(self, momentum=0.9, eps=1e-05)" }, { "docstring": "Adds variables to the layer. Args: input_shape: Returns:", "name": "build", "signature": "def build(self, input_shape)" }, ...
3
stack_v2_sparse_classes_30k_train_003448
Implement the Python class `BatchNorm` described below. Class description: Revertible batch normalization. Attributes: _momentum: _eps: Method signatures and docstrings: - def __init__(self, momentum=0.9, eps=1e-05): Initializes the object. Args: momentum: eps: - def build(self, input_shape): Adds variables to the la...
Implement the Python class `BatchNorm` described below. Class description: Revertible batch normalization. Attributes: _momentum: _eps: Method signatures and docstrings: - def __init__(self, momentum=0.9, eps=1e-05): Initializes the object. Args: momentum: eps: - def build(self, input_shape): Adds variables to the la...
6d04861ef87ba2ba2a4182ad36f3b322fcf47cfa
<|skeleton|> class BatchNorm: """Revertible batch normalization. Attributes: _momentum: _eps:""" def __init__(self, momentum=0.9, eps=1e-05): """Initializes the object. Args: momentum: eps:""" <|body_0|> def build(self, input_shape): """Adds variables to the layer. Args: input_shap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchNorm: """Revertible batch normalization. Attributes: _momentum: _eps:""" def __init__(self, momentum=0.9, eps=1e-05): """Initializes the object. Args: momentum: eps:""" super().__init__() self._momentum = momentum self._eps = eps def build(self, input_shape): ...
the_stack_v2_python_sparse
flow.py
gaotianxiang/text-to-image-synthesis
train
0
79a4d20bbab4094e5bafae11d9cdb248e8195e24
[ "try:\n matching_host = next((host for host, ref in self.__hosts.items() if platform_name in ref['platforms']))\n return matching_host\nexcept StopIteration:\n raise ConfigurationError('Unconfigured platform_name in RegionalRiotapiHosts()') from None", "try:\n matching_host = next((host for host, ref ...
<|body_start_0|> try: matching_host = next((host for host, ref in self.__hosts.items() if platform_name in ref['platforms'])) return matching_host except StopIteration: raise ConfigurationError('Unconfigured platform_name in RegionalRiotapiHosts()') from None <|end_bo...
Region <=references=> Platform <=references=> Host; Platforms are multiple for NA1/NA
RegionalRiotapiHosts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegionalRiotapiHosts: """Region <=references=> Platform <=references=> Host; Platforms are multiple for NA1/NA""" def get_host_by_platform(self, platform_name): """This could be one-liner (using next's default argument), but more explicit using StopIteration instead""" <|body...
stack_v2_sparse_classes_36k_train_027820
3,007
no_license
[ { "docstring": "This could be one-liner (using next's default argument), but more explicit using StopIteration instead", "name": "get_host_by_platform", "signature": "def get_host_by_platform(self, platform_name)" }, { "docstring": "This could be one-liner (using next's default argument), but mo...
4
stack_v2_sparse_classes_30k_train_008114
Implement the Python class `RegionalRiotapiHosts` described below. Class description: Region <=references=> Platform <=references=> Host; Platforms are multiple for NA1/NA Method signatures and docstrings: - def get_host_by_platform(self, platform_name): This could be one-liner (using next's default argument), but mo...
Implement the Python class `RegionalRiotapiHosts` described below. Class description: Region <=references=> Platform <=references=> Host; Platforms are multiple for NA1/NA Method signatures and docstrings: - def get_host_by_platform(self, platform_name): This could be one-liner (using next's default argument), but mo...
267fa63991e7d7b510e0c13e6a1d5005e79f560a
<|skeleton|> class RegionalRiotapiHosts: """Region <=references=> Platform <=references=> Host; Platforms are multiple for NA1/NA""" def get_host_by_platform(self, platform_name): """This could be one-liner (using next's default argument), but more explicit using StopIteration instead""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegionalRiotapiHosts: """Region <=references=> Platform <=references=> Host; Platforms are multiple for NA1/NA""" def get_host_by_platform(self, platform_name): """This could be one-liner (using next's default argument), but more explicit using StopIteration instead""" try: ma...
the_stack_v2_python_sparse
dj_lol_dcs/lolapi/app_lib/regional_riotapi_hosts.py
Mew-www/lol-data-collection-system
train
2
de2f29a2de5eafcafa9f37574a0190371524b568
[ "super().__init__(data, device)\nself._data = data\nself._device = device\nself._operated_remote = None\nself._operated_keypad = None\nself._operated_autorelock = None\nself._operated_time = None\nself._attr_unique_id = f'{self._device_id}_lock_operator'\nself._update_from_data()", "lock_activity = self._data.act...
<|body_start_0|> super().__init__(data, device) self._data = data self._device = device self._operated_remote = None self._operated_keypad = None self._operated_autorelock = None self._operated_time = None self._attr_unique_id = f'{self._device_id}_lock_op...
Representation of an August lock operation sensor.
AugustOperatorSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AugustOperatorSensor: """Representation of an August lock operation sensor.""" def __init__(self, data, device): """Initialize the sensor.""" <|body_0|> def _update_from_data(self): """Get the latest state of the sensor and update activity.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027821
9,526
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, data, device)" }, { "docstring": "Get the latest state of the sensor and update activity.", "name": "_update_from_data", "signature": "def _update_from_data(self)" }, { "docstring": "Ret...
4
null
Implement the Python class `AugustOperatorSensor` described below. Class description: Representation of an August lock operation sensor. Method signatures and docstrings: - def __init__(self, data, device): Initialize the sensor. - def _update_from_data(self): Get the latest state of the sensor and update activity. -...
Implement the Python class `AugustOperatorSensor` described below. Class description: Representation of an August lock operation sensor. Method signatures and docstrings: - def __init__(self, data, device): Initialize the sensor. - def _update_from_data(self): Get the latest state of the sensor and update activity. -...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AugustOperatorSensor: """Representation of an August lock operation sensor.""" def __init__(self, data, device): """Initialize the sensor.""" <|body_0|> def _update_from_data(self): """Get the latest state of the sensor and update activity.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AugustOperatorSensor: """Representation of an August lock operation sensor.""" def __init__(self, data, device): """Initialize the sensor.""" super().__init__(data, device) self._data = data self._device = device self._operated_remote = None self._operated_...
the_stack_v2_python_sparse
homeassistant/components/august/sensor.py
home-assistant/core
train
35,501
392be3f3af0ae3f2a7a7bf2092f9d89359db73d1
[ "self.name = 'Binary KDE'\nself.pos_class = pos_class\nself.train_together(X, y)", "bandwidths = np.linspace(0.0001, 1, 100)\nkernels = ['exponential', 'gaussian']\nbest_loss, best_bw, best_kernel = find_best_params(X, y, bandwidths, kernels)\nprint('\\n' + self.pos_class + ' best bandwidth: ' + str(best_bw) + ' ...
<|body_start_0|> self.name = 'Binary KDE' self.pos_class = pos_class self.train_together(X, y) <|end_body_0|> <|body_start_1|> bandwidths = np.linspace(0.0001, 1, 100) kernels = ['exponential', 'gaussian'] best_loss, best_bw, best_kernel = find_best_params(X, y, bandwidt...
Multivariate KDE classifier
KDEClassifier
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KDEClassifier: """Multivariate KDE classifier""" def __init__(self, X, y, pos_class, model_dir): """Init classifier through training :param X: DataFrame of training data features :param y: DataFrame of TARGET_LABEL with 1 for pos_class and 0 for not pos_class :param pos_class: Name o...
stack_v2_sparse_classes_36k_train_027822
7,053
permissive
[ { "docstring": "Init classifier through training :param X: DataFrame of training data features :param y: DataFrame of TARGET_LABEL with 1 for pos_class and 0 for not pos_class :param pos_class: Name of positive class :param model_dir: Model directory to save output to", "name": "__init__", "signature": ...
4
stack_v2_sparse_classes_30k_train_017028
Implement the Python class `KDEClassifier` described below. Class description: Multivariate KDE classifier Method signatures and docstrings: - def __init__(self, X, y, pos_class, model_dir): Init classifier through training :param X: DataFrame of training data features :param y: DataFrame of TARGET_LABEL with 1 for p...
Implement the Python class `KDEClassifier` described below. Class description: Multivariate KDE classifier Method signatures and docstrings: - def __init__(self, X, y, pos_class, model_dir): Init classifier through training :param X: DataFrame of training data features :param y: DataFrame of TARGET_LABEL with 1 for p...
9d498b697b7c4b03e1db31cae4d7a469311229f7
<|skeleton|> class KDEClassifier: """Multivariate KDE classifier""" def __init__(self, X, y, pos_class, model_dir): """Init classifier through training :param X: DataFrame of training data features :param y: DataFrame of TARGET_LABEL with 1 for pos_class and 0 for not pos_class :param pos_class: Name o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KDEClassifier: """Multivariate KDE classifier""" def __init__(self, X, y, pos_class, model_dir): """Init classifier through training :param X: DataFrame of training data features :param y: DataFrame of TARGET_LABEL with 1 for pos_class and 0 for not pos_class :param pos_class: Name of positive cl...
the_stack_v2_python_sparse
classifiers/binary/kdeclassifier.py
marinakiseleva/thex_model
train
4
bcd5d58a4b1789a205e03f69fe2458b9b4a5b5a2
[ "while m > 0 and n > 0:\n if nums1[m - 1] > nums2[n - 1]:\n nums1[m + n - 1] = nums1[m - 1]\n m -= 1\n else:\n nums1[m + n - 1] = nums2[n - 1]\n n -= 1\nif m == 0:\n nums1[:n] = nums2[:n]\n nums1[m:] = nums2[j:]", "i = 0\nj = 0\nwhile j < n:\n while i < m and nums1[i] <=...
<|body_start_0|> while m > 0 and n > 0: if nums1[m - 1] > nums2[n - 1]: nums1[m + n - 1] = nums1[m - 1] m -= 1 else: nums1[m + n - 1] = nums2[n - 1] n -= 1 if m == 0: nums1[:n] = nums2[:n] num...
Do not return anything, modify nums1 in-place instead.
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Do not return anything, modify nums1 in-place instead.""" def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge1(self, nums1, m, nums2, n): """Tw...
stack_v2_sparse_classes_36k_train_027823
2,069
permissive
[ { "docstring": "Do not return anything, modify nums1 in-place instead.", "name": "merge", "signature": "def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None" }, { "docstring": "Two Pointers", "name": "merge1", "signature": "def merge1(self, nums1, m, nums2, n)" }...
3
stack_v2_sparse_classes_30k_train_012375
Implement the Python class `Solution` described below. Class description: Do not return anything, modify nums1 in-place instead. Method signatures and docstrings: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge1(self, nu...
Implement the Python class `Solution` described below. Class description: Do not return anything, modify nums1 in-place instead. Method signatures and docstrings: - def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. - def merge1(self, nu...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: """Do not return anything, modify nums1 in-place instead.""" def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge1(self, nums1, m, nums2, n): """Tw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Do not return anything, modify nums1 in-place instead.""" def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead.""" while m > 0 and n > 0: if nums1[m - 1] > nums2[n - 1]: ...
the_stack_v2_python_sparse
leetcode/0088_merge_sorted_array.py
chaosWsF/Python-Practice
train
1
e0758aee29a3830dc4e7c64f7506a8a18b68bafe
[ "super().__init__(args)\nself.matmul_shapes = [[128, 128, 12288]]\nself.split_k_slices = [2, 4, 16, 18]\nself.dispatches_collection_list = []", "for matmul_shape in matmul_shapes:\n for split_k_slice in split_k_slices:\n operation = MatmulOperation(matmul_shape, TensorDescription(data_type[0], LayoutTyp...
<|body_start_0|> super().__init__(args) self.matmul_shapes = [[128, 128, 12288]] self.split_k_slices = [2, 4, 16, 18] self.dispatches_collection_list = [] <|end_body_0|> <|body_start_1|> for matmul_shape in matmul_shapes: for split_k_slice in split_k_slices: ...
SplitK Matmul dispatch generator class.
CudaSplitKMatmulGenerator
[ "Apache-2.0", "LLVM-exception", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CudaSplitKMatmulGenerator: """SplitK Matmul dispatch generator class.""" def __init__(self, args): """Initializes the splitK matmul generator.""" <|body_0|> def _append_matmul_dispatch_collection(self, matmul_shapes, split_k_slices, data_type, configuration_list): ...
stack_v2_sparse_classes_36k_train_027824
3,866
permissive
[ { "docstring": "Initializes the splitK matmul generator.", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Appends the split-k matmul dispatches collection with the given configuration list.", "name": "_append_matmul_dispatch_collection", "signature": "def ...
5
stack_v2_sparse_classes_30k_test_000513
Implement the Python class `CudaSplitKMatmulGenerator` described below. Class description: SplitK Matmul dispatch generator class. Method signatures and docstrings: - def __init__(self, args): Initializes the splitK matmul generator. - def _append_matmul_dispatch_collection(self, matmul_shapes, split_k_slices, data_t...
Implement the Python class `CudaSplitKMatmulGenerator` described below. Class description: SplitK Matmul dispatch generator class. Method signatures and docstrings: - def __init__(self, args): Initializes the splitK matmul generator. - def _append_matmul_dispatch_collection(self, matmul_shapes, split_k_slices, data_t...
13ef677e556d0a1d154e45b052fe016256057f65
<|skeleton|> class CudaSplitKMatmulGenerator: """SplitK Matmul dispatch generator class.""" def __init__(self, args): """Initializes the splitK matmul generator.""" <|body_0|> def _append_matmul_dispatch_collection(self, matmul_shapes, split_k_slices, data_type, configuration_list): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CudaSplitKMatmulGenerator: """SplitK Matmul dispatch generator class.""" def __init__(self, args): """Initializes the splitK matmul generator.""" super().__init__(args) self.matmul_shapes = [[128, 128, 12288]] self.split_k_slices = [2, 4, 16, 18] self.dispatches_co...
the_stack_v2_python_sparse
experimental/dispatch_profiler/split_k_matmul.py
openxla/iree
train
387
d307fa01b0eae33736e7d9a5bddb91e2caf3c17f
[ "self.filename = filename\nself.temp_directory = Path('unzipped-{}'.format(self.filename))\nself.user_input1 = x\nself.user_input2 = y", "print(self.temp_directory)\nprint(self.temp_directory.iterdir)\nfor filename in self.temp_directory.iterdir():\n if filename.name == '__MACOSX':\n continue\n im = ...
<|body_start_0|> self.filename = filename self.temp_directory = Path('unzipped-{}'.format(self.filename)) self.user_input1 = x self.user_input2 = y <|end_body_0|> <|body_start_1|> print(self.temp_directory) print(self.temp_directory.iterdir) for filename in self....
ScaleZip
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScaleZip: def __init__(self, filename, x, y): """Initiate parameters :param filename: archieve""" <|body_0|> def process(self): """Scale each image in the directory to 640x480""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.filename = filename ...
stack_v2_sparse_classes_36k_train_027825
2,295
no_license
[ { "docstring": "Initiate parameters :param filename: archieve", "name": "__init__", "signature": "def __init__(self, filename, x, y)" }, { "docstring": "Scale each image in the directory to 640x480", "name": "process", "signature": "def process(self)" } ]
2
stack_v2_sparse_classes_30k_train_004586
Implement the Python class `ScaleZip` described below. Class description: Implement the ScaleZip class. Method signatures and docstrings: - def __init__(self, filename, x, y): Initiate parameters :param filename: archieve - def process(self): Scale each image in the directory to 640x480
Implement the Python class `ScaleZip` described below. Class description: Implement the ScaleZip class. Method signatures and docstrings: - def __init__(self, filename, x, y): Initiate parameters :param filename: archieve - def process(self): Scale each image in the directory to 640x480 <|skeleton|> class ScaleZip: ...
9837a5a738a2b9ddcd2d9dcf2f069f89dc410bbd
<|skeleton|> class ScaleZip: def __init__(self, filename, x, y): """Initiate parameters :param filename: archieve""" <|body_0|> def process(self): """Scale each image in the directory to 640x480""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScaleZip: def __init__(self, filename, x, y): """Initiate parameters :param filename: archieve""" self.filename = filename self.temp_directory = Path('unzipped-{}'.format(self.filename)) self.user_input1 = x self.user_input2 = y def process(self): """Scale ...
the_stack_v2_python_sparse
3_Абстрактні класи. Керування атрибутами. Методи класу та статичні методи/task1/scale_zip.py
sophiashuv/UCU_labs_2term
train
0
51ef5aef183d3d9518cb0325c7b68ee765aac927
[ "self.treeName = 'SixJetTreeProducer'\nself.selComps = selComps\nself.varName = varName\nself.cut = cut\nself.bins = bins\nself.xmin = xmin\nself.xmax = xmax\nsuper(StackPlot, self).__init__(varName, directory, weights)\nself.legendBorders = (0.651, 0.463, 0.895, 0.892)", "if not hasattr(comp, 'tree'):\n comp....
<|body_start_0|> self.treeName = 'SixJetTreeProducer' self.selComps = selComps self.varName = varName self.cut = cut self.bins = bins self.xmin = xmin self.xmax = xmax super(StackPlot, self).__init__(varName, directory, weights) self.legendBorders ...
StackPlot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StackPlot: def __init__(self, varName, directory, selComps, weights, bins=None, xmin=None, xmax=None, cut=''): """Data/MC plotter adapted to the LEP3 analysis. The plotter takes a collection of trees in input. The trees are found according to the dictionary of selected components selComp...
stack_v2_sparse_classes_36k_train_027826
4,059
no_license
[ { "docstring": "Data/MC plotter adapted to the LEP3 analysis. The plotter takes a collection of trees in input. The trees are found according to the dictionary of selected components selComps. The global weighting information for each component is read from the weights dictionary.", "name": "__init__", ...
4
stack_v2_sparse_classes_30k_val_000345
Implement the Python class `StackPlot` described below. Class description: Implement the StackPlot class. Method signatures and docstrings: - def __init__(self, varName, directory, selComps, weights, bins=None, xmin=None, xmax=None, cut=''): Data/MC plotter adapted to the LEP3 analysis. The plotter takes a collection...
Implement the Python class `StackPlot` described below. Class description: Implement the StackPlot class. Method signatures and docstrings: - def __init__(self, varName, directory, selComps, weights, bins=None, xmin=None, xmax=None, cut=''): Data/MC plotter adapted to the LEP3 analysis. The plotter takes a collection...
7bec46d27e491397c4e13a52b34cf414a692d867
<|skeleton|> class StackPlot: def __init__(self, varName, directory, selComps, weights, bins=None, xmin=None, xmax=None, cut=''): """Data/MC plotter adapted to the LEP3 analysis. The plotter takes a collection of trees in input. The trees are found according to the dictionary of selected components selComp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StackPlot: def __init__(self, varName, directory, selComps, weights, bins=None, xmin=None, xmax=None, cut=''): """Data/MC plotter adapted to the LEP3 analysis. The plotter takes a collection of trees in input. The trees are found according to the dictionary of selected components selComps. The global ...
the_stack_v2_python_sparse
CMGTools/LEP3/python/plotter/StackPlot.py
HemantAHK/CMG
train
0
64e25d923b0cb98d7949b97099008f1e7cc7dbd2
[ "b1, b2 = parse(filename)\nb2 = np.array(b2, dtype=np.int16)\nb2 = np.pad(b2, (4, 4), 'constant', constant_values=(0, 0))\nb2 = enhance(b1, b2)\nb2 = enhance(b1, b2)\nreturn np.count_nonzero(b2)", "data = parse(filename)\nb1, b2 = parse(filename)\nb2 = np.array(b2, dtype=np.int16)\nb2 = np.pad(b2, (3, 3), 'consta...
<|body_start_0|> b1, b2 = parse(filename) b2 = np.array(b2, dtype=np.int16) b2 = np.pad(b2, (4, 4), 'constant', constant_values=(0, 0)) b2 = enhance(b1, b2) b2 = enhance(b1, b2) return np.count_nonzero(b2) <|end_body_0|> <|body_start_1|> data = parse(filename) ...
AoC 2021 Day 20
Day20
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day20: """AoC 2021 Day 20""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 20 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2021 day 20 part 2""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027827
1,992
no_license
[ { "docstring": "Given a filename, solve 2021 day 20 part 1", "name": "part1", "signature": "def part1(filename: str) -> int" }, { "docstring": "Given a filename, solve 2021 day 20 part 2", "name": "part2", "signature": "def part2(filename: str) -> int" } ]
2
stack_v2_sparse_classes_30k_train_018768
Implement the Python class `Day20` described below. Class description: AoC 2021 Day 20 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2021 day 20 part 1 - def part2(filename: str) -> int: Given a filename, solve 2021 day 20 part 2
Implement the Python class `Day20` described below. Class description: AoC 2021 Day 20 Method signatures and docstrings: - def part1(filename: str) -> int: Given a filename, solve 2021 day 20 part 1 - def part2(filename: str) -> int: Given a filename, solve 2021 day 20 part 2 <|skeleton|> class Day20: """AoC 202...
e89db235837d2d05848210a18c9c2a4456085570
<|skeleton|> class Day20: """AoC 2021 Day 20""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 20 part 1""" <|body_0|> def part2(filename: str) -> int: """Given a filename, solve 2021 day 20 part 2""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day20: """AoC 2021 Day 20""" def part1(filename: str) -> int: """Given a filename, solve 2021 day 20 part 1""" b1, b2 = parse(filename) b2 = np.array(b2, dtype=np.int16) b2 = np.pad(b2, (4, 4), 'constant', constant_values=(0, 0)) b2 = enhance(b1, b2) b2 = e...
the_stack_v2_python_sparse
2021/python2021/aoc/day20.py
mreishus/aoc
train
16
bd05a8664b0fb26fd41702c0f3fffe653052aa0c
[ "maxi, maxj = (0, 0)\nmax_len = 0\nfor i in range(0, len(s)):\n if len(s) - i <= max_len:\n break\n for j in range(len(s) - 1, i, -1):\n if j - i + 1 <= max_len:\n break\n if s[i] == s[j]:\n k = 1\n while i + k < j - k and s[i + k] == s[j - k]:\n ...
<|body_start_0|> maxi, maxj = (0, 0) max_len = 0 for i in range(0, len(s)): if len(s) - i <= max_len: break for j in range(len(s) - 1, i, -1): if j - i + 1 <= max_len: break if s[i] == s[j]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome1(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_2|> <|e...
stack_v2_sparse_classes_36k_train_027828
3,382
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" }, { "docstring": ":type s: str :rtype:...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome1(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome1(self, s): :type s: str :rtype: str - def longestPalindrome2(self, s): :type s: str :rtype: str ...
22f208400cd7e13fcf2ebf189e61ccad7e22b098
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome1(self, s): """:type s: str :rtype: str""" <|body_1|> def longestPalindrome2(self, s): """:type s: str :rtype: str""" <|body_2|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" maxi, maxj = (0, 0) max_len = 0 for i in range(0, len(s)): if len(s) - i <= max_len: break for j in range(len(s) - 1, i, -1): if j - i + 1 <= max_len...
the_stack_v2_python_sparse
previously_completed/1-30/5-longestPalindrome.py
learnerjiahao/leetcode-solve
train
0
520c85458badb9b29eaba638f48d4e2ec304597f
[ "row = len(matrix)\ncol = len(matrix[0])\nrow_zero = set()\ncol_zero = set()\nfor i in range(row):\n for j in range(col):\n if matrix[i][j] == 0:\n row_zero.add(i)\n col_zero.add(j)\nfor i in range(row):\n for j in range(col):\n if i in row_zero or j in col_zero:\n ...
<|body_start_0|> row = len(matrix) col = len(matrix[0]) row_zero = set() col_zero = set() for i in range(row): for j in range(col): if matrix[i][j] == 0: row_zero.add(i) col_zero.add(j) for i in range(row...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def setZeroes(self, matrix): """:type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. O(m+n)额外空间""" <|body_0|> def setZeroes1(self, matrix): """:type matrix: List[List[int]] :rtype: None Do not return anything, m...
stack_v2_sparse_classes_36k_train_027829
1,551
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. O(m+n)额外空间", "name": "setZeroes", "signature": "def setZeroes(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-p...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def setZeroes(self, matrix): :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. O(m+n)额外空间 - def setZeroes1(self, matrix): :type m...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def setZeroes(self, matrix): :type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. O(m+n)额外空间 - def setZeroes1(self, matrix): :type m...
3f4284330f9771037ca59e2e6a94122e51e58540
<|skeleton|> class Solution: def setZeroes(self, matrix): """:type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. O(m+n)额外空间""" <|body_0|> def setZeroes1(self, matrix): """:type matrix: List[List[int]] :rtype: None Do not return anything, m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def setZeroes(self, matrix): """:type matrix: List[List[int]] :rtype: None Do not return anything, modify matrix in-place instead. O(m+n)额外空间""" row = len(matrix) col = len(matrix[0]) row_zero = set() col_zero = set() for i in range(row): f...
the_stack_v2_python_sparse
Leetcode/73.矩阵置零.py
myf-algorithm/Leetcode
train
1
485eae12827f3fa0ece146d1f76146250bb47904
[ "if not HomepageSysApi._api:\n HomepageSysApi._api = HomepageSysApi()\nreturn HomepageSysApi._api", "r = self.career_category_service.get_all_career_category()\nif len(r) > 4:\n r = r[:4]\nr = self.n_obj('CareerCategory', r)\n\ndef _worker(cc):\n cs = self.career_category_service.get_distinct_related_cou...
<|body_start_0|> if not HomepageSysApi._api: HomepageSysApi._api = HomepageSysApi() return HomepageSysApi._api <|end_body_0|> <|body_start_1|> r = self.career_category_service.get_all_career_category() if len(r) > 4: r = r[:4] r = self.n_obj('CareerCatego...
HomepageSysApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HomepageSysApi: def default_instance(): """@brief 默认api对象""" <|body_0|> def get_homepage_all_hot_course(self): """@brief 主页推荐热门课程 @return [(CareerCategory, [Course])].""" <|body_1|> def get_home_page_article(self): """@brief 主页推荐热门文章 @return [(Ar...
stack_v2_sparse_classes_36k_train_027830
1,726
no_license
[ { "docstring": "@brief 默认api对象", "name": "default_instance", "signature": "def default_instance()" }, { "docstring": "@brief 主页推荐热门课程 @return [(CareerCategory, [Course])].", "name": "get_homepage_all_hot_course", "signature": "def get_homepage_all_hot_course(self)" }, { "docstrin...
3
null
Implement the Python class `HomepageSysApi` described below. Class description: Implement the HomepageSysApi class. Method signatures and docstrings: - def default_instance(): @brief 默认api对象 - def get_homepage_all_hot_course(self): @brief 主页推荐热门课程 @return [(CareerCategory, [Course])]. - def get_home_page_article(self...
Implement the Python class `HomepageSysApi` described below. Class description: Implement the HomepageSysApi class. Method signatures and docstrings: - def default_instance(): @brief 默认api对象 - def get_homepage_all_hot_course(self): @brief 主页推荐热门课程 @return [(CareerCategory, [Course])]. - def get_home_page_article(self...
aec5d23bb412f7dfca374fb5c5b9988c1b817347
<|skeleton|> class HomepageSysApi: def default_instance(): """@brief 默认api对象""" <|body_0|> def get_homepage_all_hot_course(self): """@brief 主页推荐热门课程 @return [(CareerCategory, [Course])].""" <|body_1|> def get_home_page_article(self): """@brief 主页推荐热门文章 @return [(Ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HomepageSysApi: def default_instance(): """@brief 默认api对象""" if not HomepageSysApi._api: HomepageSysApi._api = HomepageSysApi() return HomepageSysApi._api def get_homepage_all_hot_course(self): """@brief 主页推荐热门课程 @return [(CareerCategory, [Course])].""" ...
the_stack_v2_python_sparse
hotfix/mz_platform/apis/homepage_sys_api.py
az0ne/python
train
0
147b063c1a0b2bc61f60d961c3ebc509fbb3dc64
[ "comp = protprop.Composition()\npp = protprop.ProteinProperties()\naa_classes = ['FY', 'P', 'NQ']\nfor xi in range(5):\n seq = genMotif(aa_classes, [(0, 2), (1, 1), (2, 2), (0, 2), (1, 1), (2, 2)])\n self.assertTrue(pp.count(seq, 'FY') == 4)\n mot = pp.motif(seq, aa_classes)\n self.assertTrue(mot == 'aa...
<|body_start_0|> comp = protprop.Composition() pp = protprop.ProteinProperties() aa_classes = ['FY', 'P', 'NQ'] for xi in range(5): seq = genMotif(aa_classes, [(0, 2), (1, 1), (2, 2), (0, 2), (1, 1), (2, 2)]) self.assertTrue(pp.count(seq, 'FY') == 4) m...
test003
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test003: def test_run(self): """Composition and motifs""" <|body_0|> def test_run_skip(self): """Composition and motifs with skips""" <|body_1|> def test_comp_counts(self): """Composition and motifs with skips""" <|body_2|> def test_...
stack_v2_sparse_classes_36k_train_027831
4,558
no_license
[ { "docstring": "Composition and motifs", "name": "test_run", "signature": "def test_run(self)" }, { "docstring": "Composition and motifs with skips", "name": "test_run_skip", "signature": "def test_run_skip(self)" }, { "docstring": "Composition and motifs with skips", "name":...
6
stack_v2_sparse_classes_30k_val_000164
Implement the Python class `test003` described below. Class description: Implement the test003 class. Method signatures and docstrings: - def test_run(self): Composition and motifs - def test_run_skip(self): Composition and motifs with skips - def test_comp_counts(self): Composition and motifs with skips - def test_n...
Implement the Python class `test003` described below. Class description: Implement the test003 class. Method signatures and docstrings: - def test_run(self): Composition and motifs - def test_run_skip(self): Composition and motifs with skips - def test_comp_counts(self): Composition and motifs with skips - def test_n...
d7ddd2b585a841c6d986974a24a53e4d1abe71ba
<|skeleton|> class test003: def test_run(self): """Composition and motifs""" <|body_0|> def test_run_skip(self): """Composition and motifs with skips""" <|body_1|> def test_comp_counts(self): """Composition and motifs with skips""" <|body_2|> def test_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test003: def test_run(self): """Composition and motifs""" comp = protprop.Composition() pp = protprop.ProteinProperties() aa_classes = ['FY', 'P', 'NQ'] for xi in range(5): seq = genMotif(aa_classes, [(0, 2), (1, 1), (2, 2), (0, 2), (1, 1), (2, 2)]) ...
the_stack_v2_python_sparse
src/protprop_test.py
dad/base
train
0
9c0c3b64e469c154e4385b71e27e8bd3a22eebf6
[ "query = {'uuid': metadata_id}\nprojection = {'_id': False}\nlogging.debug(f'MONGO-START: db.Metadata.find_one(filter={query}, projection={projection})')\nret = await self.db.Metadata.find_one(filter=query, projection=projection)\nlogging.debug('MONGO-END: db.Metadata.find_one(filter, projection)')\nif not ret:\n...
<|body_start_0|> query = {'uuid': metadata_id} projection = {'_id': False} logging.debug(f'MONGO-START: db.Metadata.find_one(filter={query}, projection={projection})') ret = await self.db.Metadata.find_one(filter=query, projection=projection) logging.debug('MONGO-END: db.Metada...
MetadataSingleHandler handles object level routes for Metadata.
MetadataSingleHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetadataSingleHandler: """MetadataSingleHandler handles object level routes for Metadata.""" async def get(self, metadata_id: str) -> None: """Handle GET /Metadata/{uuid}.""" <|body_0|> async def delete(self, metadata_id: str) -> None: """Handle DELETE /Metadata/...
stack_v2_sparse_classes_36k_train_027832
42,572
permissive
[ { "docstring": "Handle GET /Metadata/{uuid}.", "name": "get", "signature": "async def get(self, metadata_id: str) -> None" }, { "docstring": "Handle DELETE /Metadata/{uuid}.", "name": "delete", "signature": "async def delete(self, metadata_id: str) -> None" } ]
2
stack_v2_sparse_classes_30k_train_009323
Implement the Python class `MetadataSingleHandler` described below. Class description: MetadataSingleHandler handles object level routes for Metadata. Method signatures and docstrings: - async def get(self, metadata_id: str) -> None: Handle GET /Metadata/{uuid}. - async def delete(self, metadata_id: str) -> None: Han...
Implement the Python class `MetadataSingleHandler` described below. Class description: MetadataSingleHandler handles object level routes for Metadata. Method signatures and docstrings: - async def get(self, metadata_id: str) -> None: Handle GET /Metadata/{uuid}. - async def delete(self, metadata_id: str) -> None: Han...
12719efa84be2281debe98a18c69bbe7a6d0f399
<|skeleton|> class MetadataSingleHandler: """MetadataSingleHandler handles object level routes for Metadata.""" async def get(self, metadata_id: str) -> None: """Handle GET /Metadata/{uuid}.""" <|body_0|> async def delete(self, metadata_id: str) -> None: """Handle DELETE /Metadata/...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetadataSingleHandler: """MetadataSingleHandler handles object level routes for Metadata.""" async def get(self, metadata_id: str) -> None: """Handle GET /Metadata/{uuid}.""" query = {'uuid': metadata_id} projection = {'_id': False} logging.debug(f'MONGO-START: db.Metadata...
the_stack_v2_python_sparse
lta/rest_server.py
blinkdog/lta
train
0
37894ebd2417402c047a0f492707e5acb428afff
[ "from collections import Counter\nsize = len(p)\nans = []\nfor i in range(len(s) - size + 1):\n c = Counter(s[i:size + i]) - Counter(p)\n if len(list(c.elements())) == 0:\n ans.append(i)\nreturn ans", "ans = []\nsize = len(p)\npd = {}\nfor c in p:\n if c in pd:\n pd[c] += 1\n else:\n ...
<|body_start_0|> from collections import Counter size = len(p) ans = [] for i in range(len(s) - size + 1): c = Counter(s[i:size + i]) - Counter(p) if len(list(c.elements())) == 0: ans.append(i) return ans <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findAnagrams2(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_0|> def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collections impor...
stack_v2_sparse_classes_36k_train_027833
3,017
no_license
[ { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagrams2", "signature": "def findAnagrams2(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: List[int]", "name": "findAnagrams", "signature": "def findAnagrams(self, s, p)" } ]
2
stack_v2_sparse_classes_30k_train_009804
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams2(self, s, p): :type s: str :type p: str :rtype: List[int] - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findAnagrams2(self, s, p): :type s: str :type p: str :rtype: List[int] - def findAnagrams(self, s, p): :type s: str :type p: str :rtype: List[int] <|skeleton|> class Solutio...
a57282895fb213b68e5d81db301903721a92d80f
<|skeleton|> class Solution: def findAnagrams2(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_0|> def findAnagrams(self, s, p): """:type s: str :type p: str :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findAnagrams2(self, s, p): """:type s: str :type p: str :rtype: List[int]""" from collections import Counter size = len(p) ans = [] for i in range(len(s) - size + 1): c = Counter(s[i:size + i]) - Counter(p) if len(list(c.elements())...
the_stack_v2_python_sparse
Python/438_find-all-anagrams-in-a-string.py
antonylu/leetcode2
train
0
f50a563a8913dfdff5e01ca7db1d41c1013c046a
[ "record = dict()\ni = 0\nwhile i < len(equations):\n record[equations[i][0]] = record.get(equations[i][0], dict())\n record[equations[i][0]][equations[i][1]] = values[i]\n record[equations[i][1]] = record.get(equations[i][1], dict())\n record[equations[i][1]][equations[i][0]] = 1 / values[i]\n i += 1...
<|body_start_0|> record = dict() i = 0 while i < len(equations): record[equations[i][0]] = record.get(equations[i][0], dict()) record[equations[i][0]][equations[i][1]] = values[i] record[equations[i][1]] = record.get(equations[i][1], dict()) record...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def calcEquation(self, equations, values, queries): """:type equations: List[List[str]] :type values: List[float] :type queries: List[List[str]] :rtype: List[float]""" <|body_0|> def dfs(self, record, d, b, visited): """:param record: 图的record :param d: 前一个...
stack_v2_sparse_classes_36k_train_027834
5,414
no_license
[ { "docstring": ":type equations: List[List[str]] :type values: List[float] :type queries: List[List[str]] :rtype: List[float]", "name": "calcEquation", "signature": "def calcEquation(self, equations, values, queries)" }, { "docstring": ":param record: 图的record :param d: 前一个点的后继点集,用一个dict存储 :para...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calcEquation(self, equations, values, queries): :type equations: List[List[str]] :type values: List[float] :type queries: List[List[str]] :rtype: List[float] - def dfs(self, ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def calcEquation(self, equations, values, queries): :type equations: List[List[str]] :type values: List[float] :type queries: List[List[str]] :rtype: List[float] - def dfs(self, ...
9eb44afa4233fdedc2e5c72be0fdf54b25d1c45c
<|skeleton|> class Solution: def calcEquation(self, equations, values, queries): """:type equations: List[List[str]] :type values: List[float] :type queries: List[List[str]] :rtype: List[float]""" <|body_0|> def dfs(self, record, d, b, visited): """:param record: 图的record :param d: 前一个...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def calcEquation(self, equations, values, queries): """:type equations: List[List[str]] :type values: List[float] :type queries: List[List[str]] :rtype: List[float]""" record = dict() i = 0 while i < len(equations): record[equations[i][0]] = record.get(equ...
the_stack_v2_python_sparse
Google/Pro399. Evaluate Division.py
YoyinZyc/Leetcode_Python
train
0
c5eb839a9dac997e981ffe034c4abcbf0b68b6db
[ "Figure.__init__(self, size=size, parent=figure)\nself._aspect = aspect\nself._fg_color = fg_color\nself._bg_color = bg_color", "W, H = (self.parent.width, self.parent.height)\nw, h = (self._size[0] * W, self._size[1] * H)\nif self._aspect is not None:\n if w / float(h) > self._aspect:\n w = self._aspec...
<|body_start_0|> Figure.__init__(self, size=size, parent=figure) self._aspect = aspect self._fg_color = fg_color self._bg_color = bg_color <|end_body_0|> <|body_start_1|> W, H = (self.parent.width, self.parent.height) w, h = (self._size[0] * W, self._size[1] * H) ...
A Frame is a special king of figure that can drawns itself and preserves a given aspect ratio.
Frame
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Frame: """A Frame is a special king of figure that can drawns itself and preserves a given aspect ratio.""" def __init__(self, figure, size=(1.0, 1.0), aspect=None, fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 1)): """Create a new frame within given figures. :Parameters: ``figure``: Fig...
stack_v2_sparse_classes_36k_train_027835
27,991
permissive
[ { "docstring": "Create a new frame within given figures. :Parameters: ``figure``: Figure Figure to put frame into ``size``: (float,float) Frame relative size ``aspect``: float Frame aspect ``fg_color``: 4-floats tuple Foreground color (border) ``bg_color``: 4-floats tuple Background color", "name": "__init_...
6
stack_v2_sparse_classes_30k_train_007662
Implement the Python class `Frame` described below. Class description: A Frame is a special king of figure that can drawns itself and preserves a given aspect ratio. Method signatures and docstrings: - def __init__(self, figure, size=(1.0, 1.0), aspect=None, fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 1)): Create a new...
Implement the Python class `Frame` described below. Class description: A Frame is a special king of figure that can drawns itself and preserves a given aspect ratio. Method signatures and docstrings: - def __init__(self, figure, size=(1.0, 1.0), aspect=None, fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 1)): Create a new...
26100b30e3bdb800c448c2f983675a752827e827
<|skeleton|> class Frame: """A Frame is a special king of figure that can drawns itself and preserves a given aspect ratio.""" def __init__(self, figure, size=(1.0, 1.0), aspect=None, fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 1)): """Create a new frame within given figures. :Parameters: ``figure``: Fig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Frame: """A Frame is a special king of figure that can drawns itself and preserves a given aspect ratio.""" def __init__(self, figure, size=(1.0, 1.0), aspect=None, fg_color=(0, 0, 0, 1), bg_color=(1, 1, 1, 1)): """Create a new frame within given figures. :Parameters: ``figure``: Figure Figure to...
the_stack_v2_python_sparse
glumpy/figure.py
davidcox/glumpy
train
2
f7480e71fa8ee1ff0e6b60d4eb1a71cd28c036cb
[ "if not root:\n return 'None'\nreturn str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right)", "s = data.split(',')\n\ndef helper(s):\n num = s.pop(0)\n if num == 'None':\n return None\n root = TreeNode(num)\n root.left = helper(s)\n root.right = helper(s)\n ...
<|body_start_0|> if not root: return 'None' return str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right) <|end_body_0|> <|body_start_1|> s = data.split(',') def helper(s): num = s.pop(0) if num == 'None': ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_027836
1,484
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
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
882724c8d50b2f21193c81e5072c31385c5e6b8e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return 'None' return str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right) def deserialize(self, data): """Deco...
the_stack_v2_python_sparse
297. Serialize and Deserialize Binary Tree.py
QIAOZHIBAO0104/My-Leetcode-Records
train
0
ede75bf36d6fa477cba76131105a65ece35bc352
[ "expression = ''\nfor date, cash in trades.items():\n td = round_to((end_date - date).days / 365, 0.001)\n expression = expression + str(cash) + '*(1 + x) **' + str(td) + '+'\nexpression = expression[:-1] + '-' + str(end_cash)\nreturn expression", "pre_result = 0\nresult = 0\nfor as_annual_return in range(1...
<|body_start_0|> expression = '' for date, cash in trades.items(): td = round_to((end_date - date).days / 365, 0.001) expression = expression + str(cash) + '*(1 + x) **' + str(td) + '+' expression = expression[:-1] + '-' + str(end_cash) return expression <|end_bod...
CalReturns
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalReturns: def cal_annual_returns(trades: {}, end_date, end_cash): """计算年化收益,需要交易日、金额, 截止日:金额""" <|body_0|> def annual_returns(trades: {}, end_date, end_cash): """此处只考虑正年化收益,且年化收益率到100%停止搜索 :param trades: 字典,key: date, value: cash :param end_date: 最终统计日期 :param end_...
stack_v2_sparse_classes_36k_train_027837
1,668
permissive
[ { "docstring": "计算年化收益,需要交易日、金额, 截止日:金额", "name": "cal_annual_returns", "signature": "def cal_annual_returns(trades: {}, end_date, end_cash)" }, { "docstring": "此处只考虑正年化收益,且年化收益率到100%停止搜索 :param trades: 字典,key: date, value: cash :param end_date: 最终统计日期 :param end_cash: 最终资金 :return:", "name"...
2
null
Implement the Python class `CalReturns` described below. Class description: Implement the CalReturns class. Method signatures and docstrings: - def cal_annual_returns(trades: {}, end_date, end_cash): 计算年化收益,需要交易日、金额, 截止日:金额 - def annual_returns(trades: {}, end_date, end_cash): 此处只考虑正年化收益,且年化收益率到100%停止搜索 :param trades...
Implement the Python class `CalReturns` described below. Class description: Implement the CalReturns class. Method signatures and docstrings: - def cal_annual_returns(trades: {}, end_date, end_cash): 计算年化收益,需要交易日、金额, 截止日:金额 - def annual_returns(trades: {}, end_date, end_cash): 此处只考虑正年化收益,且年化收益率到100%停止搜索 :param trades...
7901a0fb80a5b44d6fc752bd4b2b64ec62c8f84b
<|skeleton|> class CalReturns: def cal_annual_returns(trades: {}, end_date, end_cash): """计算年化收益,需要交易日、金额, 截止日:金额""" <|body_0|> def annual_returns(trades: {}, end_date, end_cash): """此处只考虑正年化收益,且年化收益率到100%停止搜索 :param trades: 字典,key: date, value: cash :param end_date: 最终统计日期 :param end_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalReturns: def cal_annual_returns(trades: {}, end_date, end_cash): """计算年化收益,需要交易日、金额, 截止日:金额""" expression = '' for date, cash in trades.items(): td = round_to((end_date - date).days / 365, 0.001) expression = expression + str(cash) + '*(1 + x) **' + str(td) +...
the_stack_v2_python_sparse
vnpy/analyze/util/cal_returns.py
CatTiger/vnpy
train
0
184e7c2648927302e015ff0cc1b095808cbb7df7
[ "super().__init__()\nself.original_features_num = original_features_num\nself.num_blocks = num_blocks\nself.in_features = in_features\nself.out_features = out_features\nself.depth_of_mlp = depth_of_mlp\nself.node_embedder = embedding_class(original_features_num, num_blocks, in_features, out_features, depth_of_mlp)"...
<|body_start_0|> super().__init__() self.original_features_num = original_features_num self.num_blocks = num_blocks self.in_features = in_features self.out_features = out_features self.depth_of_mlp = depth_of_mlp self.node_embedder = embedding_class(original_featu...
Siamese_Model
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Siamese_Model: def __init__(self, original_features_num, num_blocks, in_features, out_features, depth_of_mlp, embedding_class=Simple_Node_Embedding): """take a batch of pair of graphs ((bs, n_vertices, n_vertices, in_features) (bs,n_vertices, n_vertices, in_features)) and return a batch ...
stack_v2_sparse_classes_36k_train_027838
4,148
permissive
[ { "docstring": "take a batch of pair of graphs ((bs, n_vertices, n_vertices, in_features) (bs,n_vertices, n_vertices, in_features)) and return a batch of node similarities (bs, n_vertices, n_vertices) for each node the sum over the second dim should be one: sum(torch.exp(out[b,i,:]))==1 graphs must have same si...
2
stack_v2_sparse_classes_30k_train_017474
Implement the Python class `Siamese_Model` described below. Class description: Implement the Siamese_Model class. Method signatures and docstrings: - def __init__(self, original_features_num, num_blocks, in_features, out_features, depth_of_mlp, embedding_class=Simple_Node_Embedding): take a batch of pair of graphs ((...
Implement the Python class `Siamese_Model` described below. Class description: Implement the Siamese_Model class. Method signatures and docstrings: - def __init__(self, original_features_num, num_blocks, in_features, out_features, depth_of_mlp, embedding_class=Simple_Node_Embedding): take a batch of pair of graphs ((...
58912098b9c98bb8eeb79bab9539c5c6c3a6420b
<|skeleton|> class Siamese_Model: def __init__(self, original_features_num, num_blocks, in_features, out_features, depth_of_mlp, embedding_class=Simple_Node_Embedding): """take a batch of pair of graphs ((bs, n_vertices, n_vertices, in_features) (bs,n_vertices, n_vertices, in_features)) and return a batch ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Siamese_Model: def __init__(self, original_features_num, num_blocks, in_features, out_features, depth_of_mlp, embedding_class=Simple_Node_Embedding): """take a batch of pair of graphs ((bs, n_vertices, n_vertices, in_features) (bs,n_vertices, n_vertices, in_features)) and return a batch of node simila...
the_stack_v2_python_sparse
models/siamese_net.py
mlelarge/graph_neural_net
train
42
ae0daed613857aaab835a422fa526906df3749e3
[ "super(InputAtoms, self).store()\nself.natoms.store(atoms.natoms)\nself.q.store(dstrip(atoms.q))\nself.p.store(dstrip(atoms.p))\nself.m.store(dstrip(atoms.m))\nself.names.store(dstrip(atoms.names))", "super(InputAtoms, self).fetch()\natoms = Atoms(self.natoms.fetch())\natoms.q = self.q.fetch()\natoms.p = self.p.f...
<|body_start_0|> super(InputAtoms, self).store() self.natoms.store(atoms.natoms) self.q.store(dstrip(atoms.q)) self.p.store(dstrip(atoms.p)) self.m.store(dstrip(atoms.m)) self.names.store(dstrip(atoms.names)) <|end_body_0|> <|body_start_1|> super(InputAtoms, self...
Atoms input class. Handles generating the appropriate atoms class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: natoms: An optional integer giving the number of atoms. Defaults to 0. q: An optional array giving the atom positions. Defaults to an emp...
InputAtoms
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputAtoms: """Atoms input class. Handles generating the appropriate atoms class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: natoms: An optional integer giving the number of atoms. Defaults to 0. q: An optional array giving ...
stack_v2_sparse_classes_36k_train_027839
4,340
no_license
[ { "docstring": "Takes an Atoms instance and stores a minimal representation of it. Args: atoms: An Atoms object from which to initialise from. filename: An optional string giving a filename to take the atom positions from. Defaults to ''.", "name": "store", "signature": "def store(self, atoms)" }, {...
3
null
Implement the Python class `InputAtoms` described below. Class description: Atoms input class. Handles generating the appropriate atoms class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: natoms: An optional integer giving the number of atoms. Defa...
Implement the Python class `InputAtoms` described below. Class description: Atoms input class. Handles generating the appropriate atoms class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: natoms: An optional integer giving the number of atoms. Defa...
57f255266d4668bafef0881d1e7cbf8a27270ddd
<|skeleton|> class InputAtoms: """Atoms input class. Handles generating the appropriate atoms class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: natoms: An optional integer giving the number of atoms. Defaults to 0. q: An optional array giving ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InputAtoms: """Atoms input class. Handles generating the appropriate atoms class from the xml input file, and generating the xml checkpoint tags and data from an instance of the object. Attributes: natoms: An optional integer giving the number of atoms. Defaults to 0. q: An optional array giving the atom posi...
the_stack_v2_python_sparse
ipi/inputs/atoms.py
i-pi/i-pi
train
170
973415825e49ea6743413cdfa55faa94ca472001
[ "BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity')\nself.v_des = v_des\nself.max_accel = car_following_params.controller_params['accel']\nself.dx_1_0 = 4.5\nself.dx_2_0 = 5.25\nself.dx_3_0 = 6.0\nself.d_1 = 1.5\nself.d_2 = 1.0\nself.d_3 = 0.5\nself.danger_edges = dang...
<|body_start_0|> BaseController.__init__(self, veh_id, car_following_params, delay=1.0, fail_safe='safe_velocity') self.v_des = v_des self.max_accel = car_following_params.controller_params['accel'] self.dx_1_0 = 4.5 self.dx_2_0 = 5.25 self.dx_3_0 = 6.0 self.d_1 =...
Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional desired speed of the vehicles (m/s)
FollowerStopper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowerStopper: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional ...
stack_v2_sparse_classes_36k_train_027840
7,700
permissive
[ { "docstring": "Instantiate FollowerStopper.", "name": "__init__", "signature": "def __init__(self, veh_id, car_following_params, v_des=15, danger_edges=None)" }, { "docstring": "Find distance to intersection. Parameters ---------- env : flow.envs.Env see flow/envs/base.py Returns ------- float ...
3
null
Implement the Python class `FollowerStopper` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehi...
Implement the Python class `FollowerStopper` described below. Class description: Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehi...
badac3da17f04d8d8ae5691ee8ba2af9d56fac35
<|skeleton|> class FollowerStopper: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FollowerStopper: """Inspired by Dan Work's... work. Dissipation of stop-and-go waves via control of autonomous vehicles: Field experiments https://arxiv.org/abs/1705.01693 Usage ----- See base class for example. Parameters ---------- veh_id : str unique vehicle identifier v_des : float, optional desired speed...
the_stack_v2_python_sparse
flow/controllers/velocity_controllers.py
parthjaggi/flow
train
6
989a1f4d7ee01dca0dc4a6f147342bb921b0d98b
[ "if not nums:\n return None\n' run outer loop `k` times, and not for `n` times\\n since we only need to bubble kth largest element\\n to its sorted place in the array\\n '\nfor i in range(k):\n ' for each iteration of outer loop, run inner\\n loop one less than the ...
<|body_start_0|> if not nums: return None ' run outer loop `k` times, and not for `n` times\n since we only need to bubble kth largest element\n to its sorted place in the array\n ' for i in range(k): ' for each iteration of outer loop, run in...
KLargestElement
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KLargestElement: def find_bubble_sort(self, nums: List[int], k: int) -> int: """using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times""" <|body_0|> def find_heap(self, nums: List[int], k: int) -> int: """using heap complexity : O(n + k lo...
stack_v2_sparse_classes_36k_train_027841
2,275
permissive
[ { "docstring": "using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times", "name": "find_bubble_sort", "signature": "def find_bubble_sort(self, nums: List[int], k: int) -> int" }, { "docstring": "using heap complexity : O(n + k log n) -> O(n) for creating the heap -> O(...
2
stack_v2_sparse_classes_30k_test_000523
Implement the Python class `KLargestElement` described below. Class description: Implement the KLargestElement class. Method signatures and docstrings: - def find_bubble_sort(self, nums: List[int], k: int) -> int: using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times - def find_heap(self,...
Implement the Python class `KLargestElement` described below. Class description: Implement the KLargestElement class. Method signatures and docstrings: - def find_bubble_sort(self, nums: List[int], k: int) -> int: using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times - def find_heap(self,...
14356c6adb1946417482eaaf6f42dde4b8351d2f
<|skeleton|> class KLargestElement: def find_bubble_sort(self, nums: List[int], k: int) -> int: """using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times""" <|body_0|> def find_heap(self, nums: List[int], k: int) -> int: """using heap complexity : O(n + k lo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KLargestElement: def find_bubble_sort(self, nums: List[int], k: int) -> int: """using bubble sort complexity : O(nk) -> outer loop `k` times, inner loop `n` times""" if not nums: return None ' run outer loop `k` times, and not for `n` times\n since we only need t...
the_stack_v2_python_sparse
simple_array/m_kth_largest.py
dhrubach/python-code-recipes
train
1
b9d3c82cc5afd29e76b63012ce67187dff1ec233
[ "self.copy_snapshot_tasks = copy_snapshot_tasks\nself.data_lock_constraints = data_lock_constraints\nself.error = error\nself.expiry_time_usecs = expiry_time_usecs\nself.hold_for_legal_purpose = hold_for_legal_purpose\nself.legal_holdings = legal_holdings\nself.run_start_time_usecs = run_start_time_usecs\nself.stat...
<|body_start_0|> self.copy_snapshot_tasks = copy_snapshot_tasks self.data_lock_constraints = data_lock_constraints self.error = error self.expiry_time_usecs = expiry_time_usecs self.hold_for_legal_purpose = hold_for_legal_purpose self.legal_holdings = legal_holdings ...
Implementation of the 'CopyRun' model. Specifies details about the Copy Run for a backup run of a Job Run. A Copy task copies snapshots resulted from a backup run to a snapshot target which could be 'kLocal', 'kArchival', or 'kRemote'. Attributes: copy_snapshot_tasks (list of CopySnapshotTaskStatus): Specifies the stat...
CopyRun
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopyRun: """Implementation of the 'CopyRun' model. Specifies details about the Copy Run for a backup run of a Job Run. A Copy task copies snapshots resulted from a backup run to a snapshot target which could be 'kLocal', 'kArchival', or 'kRemote'. Attributes: copy_snapshot_tasks (list of CopySnap...
stack_v2_sparse_classes_36k_train_027842
7,628
permissive
[ { "docstring": "Constructor for the CopyRun class", "name": "__init__", "signature": "def __init__(self, copy_snapshot_tasks=None, data_lock_constraints=None, error=None, expiry_time_usecs=None, hold_for_legal_purpose=None, legal_holdings=None, run_start_time_usecs=None, stats=None, status=None, target=...
2
stack_v2_sparse_classes_30k_train_018533
Implement the Python class `CopyRun` described below. Class description: Implementation of the 'CopyRun' model. Specifies details about the Copy Run for a backup run of a Job Run. A Copy task copies snapshots resulted from a backup run to a snapshot target which could be 'kLocal', 'kArchival', or 'kRemote'. Attributes...
Implement the Python class `CopyRun` described below. Class description: Implementation of the 'CopyRun' model. Specifies details about the Copy Run for a backup run of a Job Run. A Copy task copies snapshots resulted from a backup run to a snapshot target which could be 'kLocal', 'kArchival', or 'kRemote'. Attributes...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CopyRun: """Implementation of the 'CopyRun' model. Specifies details about the Copy Run for a backup run of a Job Run. A Copy task copies snapshots resulted from a backup run to a snapshot target which could be 'kLocal', 'kArchival', or 'kRemote'. Attributes: copy_snapshot_tasks (list of CopySnap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CopyRun: """Implementation of the 'CopyRun' model. Specifies details about the Copy Run for a backup run of a Job Run. A Copy task copies snapshots resulted from a backup run to a snapshot target which could be 'kLocal', 'kArchival', or 'kRemote'. Attributes: copy_snapshot_tasks (list of CopySnapshotTaskStatu...
the_stack_v2_python_sparse
cohesity_management_sdk/models/copy_run.py
cohesity/management-sdk-python
train
24
3c5ccabd61ebb30610d25a6c995ccbfc4b730de5
[ "pytest.importorskip('pysteps')\nshape = (30, 30)\nearlier_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_precipitation_rate', units='m s-1', time=datetime(2018, 2, 20, 4, 15))\nlater_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_precipitation_rate', units='m s-1', time=...
<|body_start_0|> pytest.importorskip('pysteps') shape = (30, 30) earlier_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_precipitation_rate', units='m s-1', time=datetime(2018, 2, 20, 4, 15)) later_cube = set_up_test_cube(np.zeros(shape, dtype=np.float32), name='lwe_...
Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.
Test_generate_advection_velocities_from_winds
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_generate_advection_velocities_from_winds: """Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.""" def setUp(self): """Set up test input cubes""" <|...
stack_v2_sparse_classes_36k_train_027843
5,214
permissive
[ { "docstring": "Set up test input cubes", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test function returns a cubelist with the expected components", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test output time coordinates a...
4
stack_v2_sparse_classes_30k_train_019057
Implement the Python class `Test_generate_advection_velocities_from_winds` described below. Class description: Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only. Method signatures and docstrings:...
Implement the Python class `Test_generate_advection_velocities_from_winds` described below. Class description: Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only. Method signatures and docstrings:...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_generate_advection_velocities_from_winds: """Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.""" def setUp(self): """Set up test input cubes""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_generate_advection_velocities_from_winds: """Tests for the generate_advection_velocities_from_winds function. Optical flow velocity values are tested within the Test_optical_flow module; this class tests metadata only.""" def setUp(self): """Set up test input cubes""" pytest.importor...
the_stack_v2_python_sparse
improver_tests/nowcasting/optical_flow/test_generate_advection_velocities_from_winds.py
metoppv/improver
train
101
9a8f01f0088d86c0e17a4fefece37d34fbd94b5b
[ "self.snake = [(0, 0)]\nself.head = [0, 0]\nself.foods = food\nself.width = width\nself.height = height\nself.score = 0", "x, y = self.head\nif direction == 'U':\n x -= 1\nelif direction == 'L':\n y -= 1\nelif direction == 'R':\n y += 1\nelif direction == 'D':\n x += 1\nif not (0 <= x <= self.height -...
<|body_start_0|> self.snake = [(0, 0)] self.head = [0, 0] self.foods = food self.width = width self.height = height self.score = 0 <|end_body_0|> <|body_start_1|> x, y = self.head if direction == 'U': x -= 1 elif direction == 'L': ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_36k_train_027844
4,665
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
44765a7d89423b7ec2c159f70b1a6f6e446523c2
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
python/_0001_0500/0353_design-snake-game.py
Wang-Yann/LeetCodeMe
train
0
aa25bf553e61e9c747cdcb8d93a2cc2fce97f1d7
[ "parts = parse.urlsplit(await super()._api_url())\nnetloc = f\"{parts.netloc.split(':')[0]}\"\nreturn URL(parse.urlunsplit((parts.scheme, netloc, f'{parts.path}/reports', '', '')))", "measurement_dates = []\nfor report in await self._get_reports(response):\n for subject in report.get('subjects', {}).values():\...
<|body_start_0|> parts = parse.urlsplit(await super()._api_url()) netloc = f"{parts.netloc.split(':')[0]}" return URL(parse.urlunsplit((parts.scheme, netloc, f'{parts.path}/reports', '', ''))) <|end_body_0|> <|body_start_1|> measurement_dates = [] for report in await self._get_r...
Collector to get the "source up-to-dateness" metric from Quality-time.
QualityTimeSourceUpToDateness
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QualityTimeSourceUpToDateness: """Collector to get the "source up-to-dateness" metric from Quality-time.""" async def _api_url(self) -> URL: """Extend to add the reports API path.""" <|body_0|> async def _parse_source_response_date_time(self, response: Response) -> datet...
stack_v2_sparse_classes_36k_train_027845
1,417
permissive
[ { "docstring": "Extend to add the reports API path.", "name": "_api_url", "signature": "async def _api_url(self) -> URL" }, { "docstring": "Override to parse the oldest datetime from the recent measurements.", "name": "_parse_source_response_date_time", "signature": "async def _parse_sou...
2
null
Implement the Python class `QualityTimeSourceUpToDateness` described below. Class description: Collector to get the "source up-to-dateness" metric from Quality-time. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the reports API path. - async def _parse_source_response_date_time(se...
Implement the Python class `QualityTimeSourceUpToDateness` described below. Class description: Collector to get the "source up-to-dateness" metric from Quality-time. Method signatures and docstrings: - async def _api_url(self) -> URL: Extend to add the reports API path. - async def _parse_source_response_date_time(se...
5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3
<|skeleton|> class QualityTimeSourceUpToDateness: """Collector to get the "source up-to-dateness" metric from Quality-time.""" async def _api_url(self) -> URL: """Extend to add the reports API path.""" <|body_0|> async def _parse_source_response_date_time(self, response: Response) -> datet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QualityTimeSourceUpToDateness: """Collector to get the "source up-to-dateness" metric from Quality-time.""" async def _api_url(self) -> URL: """Extend to add the reports API path.""" parts = parse.urlsplit(await super()._api_url()) netloc = f"{parts.netloc.split(':')[0]}" ...
the_stack_v2_python_sparse
components/collector/src/source_collectors/quality_time/source_up_to_dateness.py
ICTU/quality-time
train
43
66eacbfe8a7a267f3d601242b1fac10253f943d1
[ "self._spawn(self.conn_cmd)\ntry:\n self.device.expect(['login:'])\n self.device.sendline(self.username)\n self.device.expect(['Password:'])\n self.device.setecho(False)\n self.device.sendline(self.password)\n self.device.setecho(True)\n self.device.expect(['OpenGear Serial Server'])\nexcept pe...
<|body_start_0|> self._spawn(self.conn_cmd) try: self.device.expect(['login:']) self.device.sendline(self.username) self.device.expect(['Password:']) self.device.setecho(False) self.device.sendline(self.password) self.device.setecho...
Allow authenticated telnet sessions to be established with a unit's serial ports by OpenGear server. If a board is connected serially to a OpenGear terminal server, this class can be used to connect to the board.
AuthenticatedTelnetConnection
[ "BSD-3-Clause-Clear" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticatedTelnetConnection: """Allow authenticated telnet sessions to be established with a unit's serial ports by OpenGear server. If a board is connected serially to a OpenGear terminal server, this class can be used to connect to the board.""" def connect(self): """Connect to t...
stack_v2_sparse_classes_36k_train_027846
4,580
permissive
[ { "docstring": "Connect to the board/station using telnet. This method spawn a pexpect session with telnet command. The telnet port must be as per the ser2net configuration file in order to connect to serial ports of the board. :raises: Exception Board is in use (connection refused).", "name": "connect", ...
2
null
Implement the Python class `AuthenticatedTelnetConnection` described below. Class description: Allow authenticated telnet sessions to be established with a unit's serial ports by OpenGear server. If a board is connected serially to a OpenGear terminal server, this class can be used to connect to the board. Method sig...
Implement the Python class `AuthenticatedTelnetConnection` described below. Class description: Allow authenticated telnet sessions to be established with a unit's serial ports by OpenGear server. If a board is connected serially to a OpenGear terminal server, this class can be used to connect to the board. Method sig...
e722e35f937656efaa43dfd29b49df5c38795243
<|skeleton|> class AuthenticatedTelnetConnection: """Allow authenticated telnet sessions to be established with a unit's serial ports by OpenGear server. If a board is connected serially to a OpenGear terminal server, this class can be used to connect to the board.""" def connect(self): """Connect to t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticatedTelnetConnection: """Allow authenticated telnet sessions to be established with a unit's serial ports by OpenGear server. If a board is connected serially to a OpenGear terminal server, this class can be used to connect to the board.""" def connect(self): """Connect to the board/stat...
the_stack_v2_python_sparse
boardfarm/devices/authenticated_serial_connections.py
lgirdk/boardfarm
train
20
3de583f2f00f4914d1aa86d9d991dd8cc02811f0
[ "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\nmax_sum = -2 ** 23\nsums = []\nfor i in range(len(nums)):\n sums.append(nums[i])\n if nums[i] > max_sum:\n max_sum = nums[i]\n for j in range(len(nums)):\n k = i + j + 1\n if k >= len(nums):\n break\n ...
<|body_start_0|> if not nums: return 0 if len(nums) == 1: return nums[0] max_sum = -2 ** 23 sums = [] for i in range(len(nums)): sums.append(nums[i]) if nums[i] > max_sum: max_sum = nums[i] for j in range...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray1(self, nums) -> int: """暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/""" <|body_0|> def maxSubArray2(self, nums) -> int: """时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum Subarray的Python3提交中击败了72.70% 的用户 内存消耗 : 13.4 MB, 在Maximum Sub...
stack_v2_sparse_classes_36k_train_027847
4,928
no_license
[ { "docstring": "暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/", "name": "maxSubArray1", "signature": "def maxSubArray1(self, nums) -> int" }, { "docstring": "时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum Subarray的Python3提交中击败了72.70% 的用户 内存消耗 : 13.4 MB, 在Maximum Subarray的Python3提交中击败了96...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray1(self, nums) -> int: 暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/ - def maxSubArray2(self, nums) -> int: 时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray1(self, nums) -> int: 暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/ - def maxSubArray2(self, nums) -> int: 时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum ...
7bca9dc8ec211be15c12f89bffbb680d639f87bf
<|skeleton|> class Solution: def maxSubArray1(self, nums) -> int: """暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/""" <|body_0|> def maxSubArray2(self, nums) -> int: """时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum Subarray的Python3提交中击败了72.70% 的用户 内存消耗 : 13.4 MB, 在Maximum Sub...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray1(self, nums) -> int: """暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/""" if not nums: return 0 if len(nums) == 1: return nums[0] max_sum = -2 ** 23 sums = [] for i in range(len(nums)): ...
the_stack_v2_python_sparse
python/leetcode/53-maximum-subarray.py
wxnacy/study
train
18
79cb853387edc39d3b61d31a5765ee54b4ae22e2
[ "def getNext(cells):\n ret = [0]\n for i in range(1, len(cells) - 1):\n ret.append(int(cells[i - 1] == cells[i + 1]))\n ret.append(0)\n return ret\nwhile N > 0:\n N -= 1\n cells = getNext(cells)\nreturn cells", "def getNext(cells):\n ret = [0]\n for i in range(1, len(cells) - 1):\n ...
<|body_start_0|> def getNext(cells): ret = [0] for i in range(1, len(cells) - 1): ret.append(int(cells[i - 1] == cells[i + 1])) ret.append(0) return ret while N > 0: N -= 1 cells = getNext(cells) return cells...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def prisonAfterNDays(self, cells, N): """:type cells: List[int] :type N: int :rtype: List[int]""" <|body_0|> def prisonAfterNDays(self, cells, N): """:type cells: List[int] :type N: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_027848
2,128
no_license
[ { "docstring": ":type cells: List[int] :type N: int :rtype: List[int]", "name": "prisonAfterNDays", "signature": "def prisonAfterNDays(self, cells, N)" }, { "docstring": ":type cells: List[int] :type N: int :rtype: List[int]", "name": "prisonAfterNDays", "signature": "def prisonAfterNDay...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def prisonAfterNDays(self, cells, N): :type cells: List[int] :type N: int :rtype: List[int] - def prisonAfterNDays(self, cells, N): :type cells: List[int] :type N: int :rtype: Li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def prisonAfterNDays(self, cells, N): :type cells: List[int] :type N: int :rtype: List[int] - def prisonAfterNDays(self, cells, N): :type cells: List[int] :type N: int :rtype: Li...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Solution: def prisonAfterNDays(self, cells, N): """:type cells: List[int] :type N: int :rtype: List[int]""" <|body_0|> def prisonAfterNDays(self, cells, N): """:type cells: List[int] :type N: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def prisonAfterNDays(self, cells, N): """:type cells: List[int] :type N: int :rtype: List[int]""" def getNext(cells): ret = [0] for i in range(1, len(cells) - 1): ret.append(int(cells[i - 1] == cells[i + 1])) ret.append(0) ...
the_stack_v2_python_sparse
python_leetcode_2020/Python_Leetcode_2020/957_prison_cells_after_n_days.py
xiangcao/Leetcode
train
0
1e2ff366708c8c237cdd1846b30815e9c89f0dc6
[ "if not s or not words:\n return []\nword_len = len(words[0])\nstr_len = word_len * len(words)\nres = []\ntimes = {}\nfor i in words:\n if i not in times:\n times[i] = 0\n times[i] += 1\nfor i in range(word_len):\n self.findSubstring_core(i, s, res, word_len, str_len, times)\nreturn res", "word...
<|body_start_0|> if not s or not words: return [] word_len = len(words[0]) str_len = word_len * len(words) res = [] times = {} for i in words: if i not in times: times[i] = 0 times[i] += 1 for i in range(word_len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findSubstring(self, s, words): """:type s: str :type words: List[str] 其中每个word长度相同!!! :rtype: List[int]""" <|body_0|> def findSubstring_core(self, str_start, s, res, word_len, str_len, times): """依照分布相同寻找与单词相关联的子串 :param str_start: :param s: :param res:...
stack_v2_sparse_classes_36k_train_027849
2,309
no_license
[ { "docstring": ":type s: str :type words: List[str] 其中每个word长度相同!!! :rtype: List[int]", "name": "findSubstring", "signature": "def findSubstring(self, s, words)" }, { "docstring": "依照分布相同寻找与单词相关联的子串 :param str_start: :param s: :param res: :param word_len: :param str_len: :param times: :return:",...
2
stack_v2_sparse_classes_30k_train_000170
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSubstring(self, s, words): :type s: str :type words: List[str] 其中每个word长度相同!!! :rtype: List[int] - def findSubstring_core(self, str_start, s, res, word_len, str_len, time...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findSubstring(self, s, words): :type s: str :type words: List[str] 其中每个word长度相同!!! :rtype: List[int] - def findSubstring_core(self, str_start, s, res, word_len, str_len, time...
328fdd303af1c8cde5bc9bb4c4f039e777de20e5
<|skeleton|> class Solution: def findSubstring(self, s, words): """:type s: str :type words: List[str] 其中每个word长度相同!!! :rtype: List[int]""" <|body_0|> def findSubstring_core(self, str_start, s, res, word_len, str_len, times): """依照分布相同寻找与单词相关联的子串 :param str_start: :param s: :param res:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findSubstring(self, s, words): """:type s: str :type words: List[str] 其中每个word长度相同!!! :rtype: List[int]""" if not s or not words: return [] word_len = len(words[0]) str_len = word_len * len(words) res = [] times = {} for i in wo...
the_stack_v2_python_sparse
leetcode/x30. 与所有单词相关联的字串.py
zhangzeyang0/code
train
0
3c4780f3ce85df39a2ffc3889cd4cd0a8f0ae6fd
[ "elements = self.root.findall('./camera')\npresets = []\nfor element in elements:\n if activeOnly:\n if element.get('active') == 'True':\n presets.append(element.get('name'))\n else:\n presets.append(element.get('name'))\nreturn presets", "try:\n sensor_w = float(self.root.find(\...
<|body_start_0|> elements = self.root.findall('./camera') presets = [] for element in elements: if activeOnly: if element.get('active') == 'True': presets.append(element.get('name')) else: presets.append(element.get('nam...
Manipulates XML database to store camera presets. Inherits XMLData class.
CamPresets
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CamPresets: """Manipulates XML database to store camera presets. Inherits XMLData class.""" def getPresets(self, activeOnly=False): """Return a list of camera presets. If 'activeOnly' is True, only cameras marked as active will be returned.""" <|body_0|> def getFilmback(...
stack_v2_sparse_classes_36k_train_027850
1,336
permissive
[ { "docstring": "Return a list of camera presets. If 'activeOnly' is True, only cameras marked as active will be returned.", "name": "getPresets", "signature": "def getPresets(self, activeOnly=False)" }, { "docstring": "Get the filmback (as a tuple) for the specified camera. Units in millimetres ...
2
null
Implement the Python class `CamPresets` described below. Class description: Manipulates XML database to store camera presets. Inherits XMLData class. Method signatures and docstrings: - def getPresets(self, activeOnly=False): Return a list of camera presets. If 'activeOnly' is True, only cameras marked as active will...
Implement the Python class `CamPresets` described below. Class description: Manipulates XML database to store camera presets. Inherits XMLData class. Method signatures and docstrings: - def getPresets(self, activeOnly=False): Return a list of camera presets. If 'activeOnly' is True, only cameras marked as active will...
a05abc916f0b6a9ee2c00e9f9b3dec12c09e6abe
<|skeleton|> class CamPresets: """Manipulates XML database to store camera presets. Inherits XMLData class.""" def getPresets(self, activeOnly=False): """Return a list of camera presets. If 'activeOnly' is True, only cameras marked as active will be returned.""" <|body_0|> def getFilmback(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CamPresets: """Manipulates XML database to store camera presets. Inherits XMLData class.""" def getPresets(self, activeOnly=False): """Return a list of camera presets. If 'activeOnly' is True, only cameras marked as active will be returned.""" elements = self.root.findall('./camera') ...
the_stack_v2_python_sparse
shared/camPresets.py
mjbonnington/icarus-gps
train
0
f926f39b352247838754a578ed0b62f8df95060a
[ "if hasattr(parser, 'added_gradle_bom'):\n return\nparser.added_gradle_bom = True\nGradleCommandFactory.add_argument(parser, 'bintray_org', defaults, None, help='The bintray organization for the bintray_*_repositories.')\nGradleCommandFactory.add_argument(parser, 'bintray_debian_repository', defaults, None, help...
<|body_start_0|> if hasattr(parser, 'added_gradle_bom'): return parser.added_gradle_bom = True GradleCommandFactory.add_argument(parser, 'bintray_org', defaults, None, help='The bintray organization for the bintray_*_repositories.') GradleCommandFactory.add_argument(parser, '...
Base class for build commands using Gradle.
GradleCommandFactory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradleCommandFactory: """Base class for build commands using Gradle.""" def add_bom_parser_args(parser, defaults): """Adds publishing arguments of interest to the BOM commands as well.""" <|body_0|> def init_argparser(self, parser, defaults): """Adds command-spec...
stack_v2_sparse_classes_36k_train_027851
20,381
permissive
[ { "docstring": "Adds publishing arguments of interest to the BOM commands as well.", "name": "add_bom_parser_args", "signature": "def add_bom_parser_args(parser, defaults)" }, { "docstring": "Adds command-specific arguments.", "name": "init_argparser", "signature": "def init_argparser(se...
2
stack_v2_sparse_classes_30k_train_018757
Implement the Python class `GradleCommandFactory` described below. Class description: Base class for build commands using Gradle. Method signatures and docstrings: - def add_bom_parser_args(parser, defaults): Adds publishing arguments of interest to the BOM commands as well. - def init_argparser(self, parser, default...
Implement the Python class `GradleCommandFactory` described below. Class description: Base class for build commands using Gradle. Method signatures and docstrings: - def add_bom_parser_args(parser, defaults): Adds publishing arguments of interest to the BOM commands as well. - def init_argparser(self, parser, default...
6b672a8862e526f6b9dd3bceec6e34605e1f1998
<|skeleton|> class GradleCommandFactory: """Base class for build commands using Gradle.""" def add_bom_parser_args(parser, defaults): """Adds publishing arguments of interest to the BOM commands as well.""" <|body_0|> def init_argparser(self, parser, defaults): """Adds command-spec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradleCommandFactory: """Base class for build commands using Gradle.""" def add_bom_parser_args(parser, defaults): """Adds publishing arguments of interest to the BOM commands as well.""" if hasattr(parser, 'added_gradle_bom'): return parser.added_gradle_bom = True ...
the_stack_v2_python_sparse
dev/buildtool/gradle_support.py
spinnaker/buildtool
train
7
4562e226437382e36b300ad8fc1885b738f0de67
[ "super().__init__(x_ref=x_ref, p_val=p_val, x_ref_preprocessed=x_ref_preprocessed, preprocess_at_init=preprocess_at_init, update_x_ref=update_x_ref, preprocess_fn=preprocess_fn, sigma=sigma, configure_kernel_from_x_ref=configure_kernel_from_x_ref, n_permutations=n_permutations, input_shape=input_shape, data_type=da...
<|body_start_0|> super().__init__(x_ref=x_ref, p_val=p_val, x_ref_preprocessed=x_ref_preprocessed, preprocess_at_init=preprocess_at_init, update_x_ref=update_x_ref, preprocess_fn=preprocess_fn, sigma=sigma, configure_kernel_from_x_ref=configure_kernel_from_x_ref, n_permutations=n_permutations, input_shape=input...
MMDDriftKeops
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MMDDriftKeops: def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, kernel: Callable=GaussianRBF, sigma: Optional[np.ndarray]=None,...
stack_v2_sparse_classes_36k_train_027852
8,750
permissive
[ { "docstring": "Maximum Mean Discrepancy (MMD) data drift detector using a permutation test. Parameters ---------- x_ref Data used as reference distribution. p_val p-value used for the significance of the permutation test. x_ref_preprocessed Whether the given reference data `x_ref` has been preprocessed yet. If...
3
stack_v2_sparse_classes_30k_train_009763
Implement the Python class `MMDDriftKeops` described below. Class description: Implement the MMDDriftKeops class. Method signatures and docstrings: - def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, in...
Implement the Python class `MMDDriftKeops` described below. Class description: Implement the MMDDriftKeops class. Method signatures and docstrings: - def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, in...
4a1b4f74a8590117965421e86c2295bff0f33e89
<|skeleton|> class MMDDriftKeops: def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, kernel: Callable=GaussianRBF, sigma: Optional[np.ndarray]=None,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MMDDriftKeops: def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, kernel: Callable=GaussianRBF, sigma: Optional[np.ndarray]=None, configure_ker...
the_stack_v2_python_sparse
alibi_detect/cd/keops/mmd.py
SeldonIO/alibi-detect
train
1,922
215c8ce6eea8bb844c7171d1b8b43276d9381cb5
[ "key = cache_key('followers', obj.pk, obj.__class__.__name__)\nfollowers = cache.get(key)\nif followers is None:\n follower_classname = obj.__class__.__name__.lower()\n qs = Follow.objects.select_related('follower').filter(object_id=obj.pk, content_type__model=follower_classname)\n followers = [u.follower ...
<|body_start_0|> key = cache_key('followers', obj.pk, obj.__class__.__name__) followers = cache.get(key) if followers is None: follower_classname = obj.__class__.__name__.lower() qs = Follow.objects.select_related('follower').filter(object_id=obj.pk, content_type__model=f...
Following manager
FollowingManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FollowingManager: """Following manager""" def followers(self, obj): """Return a list of all followers""" <|body_0|> def following(self, user, followee_class): """Return a list of all objects of the followee_class the given user follows""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027853
5,784
no_license
[ { "docstring": "Return a list of all followers", "name": "followers", "signature": "def followers(self, obj)" }, { "docstring": "Return a list of all objects of the followee_class the given user follows", "name": "following", "signature": "def following(self, user, followee_class)" }, ...
5
stack_v2_sparse_classes_30k_train_014704
Implement the Python class `FollowingManager` described below. Class description: Following manager Method signatures and docstrings: - def followers(self, obj): Return a list of all followers - def following(self, user, followee_class): Return a list of all objects of the followee_class the given user follows - def ...
Implement the Python class `FollowingManager` described below. Class description: Following manager Method signatures and docstrings: - def followers(self, obj): Return a list of all followers - def following(self, user, followee_class): Return a list of all objects of the followee_class the given user follows - def ...
4f7aa41fd0697af61539efd1aba2062addb63009
<|skeleton|> class FollowingManager: """Following manager""" def followers(self, obj): """Return a list of all followers""" <|body_0|> def following(self, user, followee_class): """Return a list of all objects of the followee_class the given user follows""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FollowingManager: """Following manager""" def followers(self, obj): """Return a list of all followers""" key = cache_key('followers', obj.pk, obj.__class__.__name__) followers = cache.get(key) if followers is None: follower_classname = obj.__class__.__name__.lo...
the_stack_v2_python_sparse
barddo/follow/models.py
bruno-ortiz/barddo
train
0
8b3cb71744e6c5560e4ff36de6fae337e3fd94ad
[ "self._parser = reqparse.RequestParser()\nself._parser.add_argument('device_ui_id', help='This field cannot be blank', required=True)\nself._parser.add_argument('name', help='This field cannot be blank', required=True)\nself._parser.add_argument('state', help='This field cannot be blank', required=True)\nself._pars...
<|body_start_0|> self._parser = reqparse.RequestParser() self._parser.add_argument('device_ui_id', help='This field cannot be blank', required=True) self._parser.add_argument('name', help='This field cannot be blank', required=True) self._parser.add_argument('state', help='This field can...
Controller to help register a device to a user.
UserDeviceRegistration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserDeviceRegistration: """Controller to help register a device to a user.""" def __init__(self): """Setup the request arguments parser in the constructor.""" <|body_0|> def post(self): """POST request that requires JWT.""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_36k_train_027854
3,279
permissive
[ { "docstring": "Setup the request arguments parser in the constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "POST request that requires JWT.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_004087
Implement the Python class `UserDeviceRegistration` described below. Class description: Controller to help register a device to a user. Method signatures and docstrings: - def __init__(self): Setup the request arguments parser in the constructor. - def post(self): POST request that requires JWT.
Implement the Python class `UserDeviceRegistration` described below. Class description: Controller to help register a device to a user. Method signatures and docstrings: - def __init__(self): Setup the request arguments parser in the constructor. - def post(self): POST request that requires JWT. <|skeleton|> class U...
dc4d362c1c3e34734951ab4a6cb4248a53fd6c93
<|skeleton|> class UserDeviceRegistration: """Controller to help register a device to a user.""" def __init__(self): """Setup the request arguments parser in the constructor.""" <|body_0|> def post(self): """POST request that requires JWT.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserDeviceRegistration: """Controller to help register a device to a user.""" def __init__(self): """Setup the request arguments parser in the constructor.""" self._parser = reqparse.RequestParser() self._parser.add_argument('device_ui_id', help='This field cannot be blank', requi...
the_stack_v2_python_sparse
backend/api/user_devices/controllers.py
KPetsas/IoTHome
train
0
ed3dc8cd7c0ec56f557b7afcf46d1eaad191176c
[ "res = []\n\ndef helper(level, root):\n if len(res) == level:\n res.append([])\n res[level].append(root.val)\n for node in root.children:\n helper(level + 1, node)\nif root is not None:\n helper(0, root)\nreturn res", "if root is None:\n return []\nres = []\nlayer = [root]\nwhile laye...
<|body_start_0|> res = [] def helper(level, root): if len(res) == level: res.append([]) res[level].append(root.val) for node in root.children: helper(level + 1, node) if root is not None: helper(0, root) ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder1(self, root): """递归 :type root: Node :rtype: List[List[int]]""" <|body_0|> def levelOrder2(self, root): """递归 :type root: Node :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] def hel...
stack_v2_sparse_classes_36k_train_027855
1,347
no_license
[ { "docstring": "递归 :type root: Node :rtype: List[List[int]]", "name": "levelOrder1", "signature": "def levelOrder1(self, root)" }, { "docstring": "递归 :type root: Node :rtype: List[List[int]]", "name": "levelOrder2", "signature": "def levelOrder2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_021330
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder1(self, root): 递归 :type root: Node :rtype: List[List[int]] - def levelOrder2(self, root): 递归 :type root: Node :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder1(self, root): 递归 :type root: Node :rtype: List[List[int]] - def levelOrder2(self, root): 递归 :type root: Node :rtype: List[List[int]] <|skeleton|> class Solution: ...
840a5d4969d5541d9d92f9dbe650506af3d84a99
<|skeleton|> class Solution: def levelOrder1(self, root): """递归 :type root: Node :rtype: List[List[int]]""" <|body_0|> def levelOrder2(self, root): """递归 :type root: Node :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder1(self, root): """递归 :type root: Node :rtype: List[List[int]]""" res = [] def helper(level, root): if len(res) == level: res.append([]) res[level].append(root.val) for node in root.children: he...
the_stack_v2_python_sparse
Week_03/G20200343040184/LeetCode_429_0184.py
Z-Clark/algorithm007-class02
train
1
81a8a2cb11688874d8203235090f5aab4e337ab4
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AuthenticationStrengthRoot()", "from .authentication_method_mode_detail import AuthenticationMethodModeDetail\nfrom .authentication_method_modes import AuthenticationMethodModes\nfrom .authentication_strength_policy import Authenticati...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AuthenticationStrengthRoot() <|end_body_0|> <|body_start_1|> from .authentication_method_mode_detail import AuthenticationMethodModeDetail from .authentication_method_modes import Authen...
AuthenticationStrengthRoot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationStrengthRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and...
stack_v2_sparse_classes_36k_train_027856
3,660
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: AuthenticationStrengthRoot", "name": "create_from_discriminator_value", "signature": "def create_from_discri...
3
null
Implement the Python class `AuthenticationStrengthRoot` described below. Class description: Implement the AuthenticationStrengthRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: Creates a new instance of the appropr...
Implement the Python class `AuthenticationStrengthRoot` described below. Class description: Implement the AuthenticationStrengthRoot class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: Creates a new instance of the appropr...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AuthenticationStrengthRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthenticationStrengthRoot: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AuthenticationStrengthRoot: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ob...
the_stack_v2_python_sparse
msgraph/generated/models/authentication_strength_root.py
microsoftgraph/msgraph-sdk-python
train
135
de66eaf46a6325a476b5383eb4b6ed45fc8f6c90
[ "if isinstance(xScale, PQU):\n xScale = float(xScale.inUnitsOf(xUnit).value)\nself.w = w\nparams = {'xScale': xScale, 'w': w}\nif domainMin is None:\n domainMin = -xScale / 10.0\nif domainMax is None:\n domainMax = xScale * 6.0\nUnivariatePDF.__init__(self, xUnit=xUnit, domainMin=domainMin, domainMax=domai...
<|body_start_0|> if isinstance(xScale, PQU): xScale = float(xScale.inUnitsOf(xUnit).value) self.w = w params = {'xScale': xScale, 'w': w} if domainMin is None: domainMin = -xScale / 10.0 if domainMax is None: domainMax = xScale * 6.0 Un...
BrodyDistribution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrodyDistribution: def __init__(self, xUnit='', xScale=1.0, w=0.5, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): """Brody distribution vaguely interpolates between Poisson and Wigner distributions Outside of the interval (domainMin,domainMax), getValue() evalua...
stack_v2_sparse_classes_36k_train_027857
43,025
permissive
[ { "docstring": "Brody distribution vaguely interpolates between Poisson and Wigner distributions Outside of the interval (domainMin,domainMax), getValue() evaluates to None since this pdf is undefined here :param xUnit: units to use for the x axis :param w: (float) exponent to use in the equation :param xScale:...
2
stack_v2_sparse_classes_30k_train_001564
Implement the Python class `BrodyDistribution` described below. Class description: Implement the BrodyDistribution class. Method signatures and docstrings: - def __init__(self, xUnit='', xScale=1.0, w=0.5, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): Brody distribution vaguely interpolates...
Implement the Python class `BrodyDistribution` described below. Class description: Implement the BrodyDistribution class. Method signatures and docstrings: - def __init__(self, xUnit='', xScale=1.0, w=0.5, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): Brody distribution vaguely interpolates...
9566131c37b45fc37f5f8ad07903264864575b6e
<|skeleton|> class BrodyDistribution: def __init__(self, xUnit='', xScale=1.0, w=0.5, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): """Brody distribution vaguely interpolates between Poisson and Wigner distributions Outside of the interval (domainMin,domainMax), getValue() evalua...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrodyDistribution: def __init__(self, xUnit='', xScale=1.0, w=0.5, domainMin=None, domainMax=None, xLabel='indep. variable', yLabel='PDF'): """Brody distribution vaguely interpolates between Poisson and Wigner distributions Outside of the interval (domainMin,domainMax), getValue() evaluates to None si...
the_stack_v2_python_sparse
fudge/core/math/pdf.py
alhajri/FUDGE
train
0
e8d7ee81f44fb5bcce2a22f7bdc785bdf4dd6fd7
[ "super(EvaluateEnsemblePartial, self).__init__()\nself.evaluate_ensemble_partial = evaluate_ensemble_partial\nself.result_labels = result_labels\nself.every_x_epoch = every_x_epoch", "if epoch % self.every_x_epoch == self.every_x_epoch - 1:\n results = self.evaluate_ensemble_partial()\n if results is not No...
<|body_start_0|> super(EvaluateEnsemblePartial, self).__init__() self.evaluate_ensemble_partial = evaluate_ensemble_partial self.result_labels = result_labels self.every_x_epoch = every_x_epoch <|end_body_0|> <|body_start_1|> if epoch % self.every_x_epoch == self.every_x_epoch -...
Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.
EvaluateEnsemblePartial
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluateEnsemblePartial: """Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.""" def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): """Evaluate ensemble using a ensemble.evaluate partial. Can be used in combi...
stack_v2_sparse_classes_36k_train_027858
20,794
permissive
[ { "docstring": "Evaluate ensemble using a ensemble.evaluate partial. Can be used in combination with EvaluateEnsemblePartial to evaluate the ensemble at regular intervals inside a keras model.fit() loop. Note: only ScalarStatistic's are supported. Args: evaluate_ensemble_partial: bnn.ensemble.Ensemble.evaluate ...
2
stack_v2_sparse_classes_30k_train_004057
Implement the Python class `EvaluateEnsemblePartial` described below. Class description: Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop. Method signatures and docstrings: - def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): Evaluate ensembl...
Implement the Python class `EvaluateEnsemblePartial` described below. Class description: Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop. Method signatures and docstrings: - def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): Evaluate ensembl...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class EvaluateEnsemblePartial: """Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.""" def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): """Evaluate ensemble using a ensemble.evaluate partial. Can be used in combi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvaluateEnsemblePartial: """Evaluate Ensemble after every epoch. Enables ensemble evaluation inside a keras model.fit() loop.""" def __init__(self, evaluate_ensemble_partial, result_labels, every_x_epoch=1): """Evaluate ensemble using a ensemble.evaluate partial. Can be used in combination with E...
the_stack_v2_python_sparse
cold_posterior_bnn/core/keras_utils.py
Ayoob7/google-research
train
2
5c5bcfca4ed0497a23b56d5a1629686290f415c0
[ "iOPType = self.getOperationFromGET(prequest)\nobjWMSProxy = None\nif iOPType == self.WMS_OP_GETCAPABILITIES:\n objWMSProxy = WMSGetCapabilityProxy(pobjService, prequest)\nelif iOPType == self.WMS_OP_GETMAP:\n objWMSProxy = WMSProxy(pobjService, prequest)\nelif iOPType == self.WMS_OP_GETLEGENDGRAPHIC:\n ob...
<|body_start_0|> iOPType = self.getOperationFromGET(prequest) objWMSProxy = None if iOPType == self.WMS_OP_GETCAPABILITIES: objWMSProxy = WMSGetCapabilityProxy(pobjService, prequest) elif iOPType == self.WMS_OP_GETMAP: objWMSProxy = WMSProxy(pobjService, prequest)...
Un proxy factory pour le WMS qui retourne le bon proxy WMS selon l'operation demande.
WMSProxyFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WMSProxyFactory: """Un proxy factory pour le WMS qui retourne le bon proxy WMS selon l'operation demande.""" def getWMSProxy(self, pobjService, prequest): """Recupere le proxy selon l'operation Args: pobjService: Object service prequest: La requete Returns: Un proxy WMS""" <|...
stack_v2_sparse_classes_36k_train_027859
23,054
permissive
[ { "docstring": "Recupere le proxy selon l'operation Args: pobjService: Object service prequest: La requete Returns: Un proxy WMS", "name": "getWMSProxy", "signature": "def getWMSProxy(self, pobjService, prequest)" }, { "docstring": "Recupere l'operation dans l'url Args: prequest: La requete cont...
2
stack_v2_sparse_classes_30k_train_011615
Implement the Python class `WMSProxyFactory` described below. Class description: Un proxy factory pour le WMS qui retourne le bon proxy WMS selon l'operation demande. Method signatures and docstrings: - def getWMSProxy(self, pobjService, prequest): Recupere le proxy selon l'operation Args: pobjService: Object service...
Implement the Python class `WMSProxyFactory` described below. Class description: Un proxy factory pour le WMS qui retourne le bon proxy WMS selon l'operation demande. Method signatures and docstrings: - def getWMSProxy(self, pobjService, prequest): Recupere le proxy selon l'operation Args: pobjService: Object service...
4732fdb8a0684eb4d7fd50aa43e11b454ee71d08
<|skeleton|> class WMSProxyFactory: """Un proxy factory pour le WMS qui retourne le bon proxy WMS selon l'operation demande.""" def getWMSProxy(self, pobjService, prequest): """Recupere le proxy selon l'operation Args: pobjService: Object service prequest: La requete Returns: Un proxy WMS""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WMSProxyFactory: """Un proxy factory pour le WMS qui retourne le bon proxy WMS selon l'operation demande.""" def getWMSProxy(self, pobjService, prequest): """Recupere le proxy selon l'operation Args: pobjService: Object service prequest: La requete Returns: Un proxy WMS""" iOPType = self....
the_stack_v2_python_sparse
geoprisma/core/proxies/wmsproxy.py
groupe-conseil-nutshimit-nippour/django-geoprisma
train
0
7961ed9fccc54d98ae719f2fa5695615c3c71a09
[ "if not nums:\n return None\nelse:\n maxnum = nums[0]\n for i in range(len(nums)):\n num = nums[i]\n if num > maxnum:\n maxnum = num\n for j in range(i + 1, len(nums)):\n num += nums[j]\n if num > maxnum:\n maxnum = num\n return maxnum...
<|body_start_0|> if not nums: return None else: maxnum = nums[0] for i in range(len(nums)): num = nums[i] if num > maxnum: maxnum = num for j in range(i + 1, len(nums)): num += num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)""" <|body_0|> def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(...
stack_v2_sparse_classes_36k_train_027860
1,970
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(n) = max(f(n-1)...
3
stack_v2_sparse_classes_30k_train_016629
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2) - def maxSubArray1(self, nums): :type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2) - def maxSubArray1(self, nums): :type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],s...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)""" <|body_0|> def maxSubArray1(self, nums): """:type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)""" if not nums: return None else: maxnum = nums[0] for i in range(len(nums)): num = nums[i] if num > maxnum: ...
the_stack_v2_python_sparse
53_maximum-subarray.py
95275059/Algorithm
train
0
c516f55549f2541746ffee8c2e56d9d1f62ab314
[ "m, n = (len(nums1), len(nums2))\nans = []\ni, j = (0, 0)\nwhile i < m and j < n:\n if nums1[i] <= nums2[j]:\n ans.append(nums1[i])\n if (m + n) % 2 == 1 and len(ans) == int((m + n) / 2) + 1:\n return ans[-1]\n if (m + n) % 2 == 0 and len(ans) == int((m + n) / 2) + 1:\n ...
<|body_start_0|> m, n = (len(nums1), len(nums2)) ans = [] i, j = (0, 0) while i < m and j < n: if nums1[i] <= nums2[j]: ans.append(nums1[i]) if (m + n) % 2 == 1 and len(ans) == int((m + n) / 2) + 1: return ans[-1] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findMedianSortedArrays_binary_search(self, nums1, nums2): """O(log(min(m, n))) :param nums1: :param nums2: :return:""" <...
stack_v2_sparse_classes_36k_train_027861
3,283
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: float", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1, nums2)" }, { "docstring": "O(log(min(m, n))) :param nums1: :param nums2: :return:", "name": "findMedianSortedArrays_binary_sea...
2
stack_v2_sparse_classes_30k_train_020545
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findMedianSortedArrays_binary_search(self, nums1, nums2): O(log(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: float - def findMedianSortedArrays_binary_search(self, nums1, nums2): O(log(...
f2c4f727689567e00ee06560132fca55a6fd9286
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" <|body_0|> def findMedianSortedArrays_binary_search(self, nums1, nums2): """O(log(min(m, n))) :param nums1: :param nums2: :return:""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: float""" m, n = (len(nums1), len(nums2)) ans = [] i, j = (0, 0) while i < m and j < n: if nums1[i] <= nums2[j]: ans.append(nums...
the_stack_v2_python_sparse
leetcode/4_median_of_two_sorted_arrays.py
JianxiangWang/python-journey
train
1
12492e47e30ceeb472638c84bc3c17c54aa0f22e
[ "opts = setup_options()\nopt_file = tempfile.NamedTemporaryFile(suffix='.ini', mode='w', delete=False)\nopts.write_to_stream(opt_file)\nopt_file.close()\nproblem = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'mock_problems', 'default_parsers'))\nrun([problem], options_file=opt_file.name, debu...
<|body_start_0|> opts = setup_options() opt_file = tempfile.NamedTemporaryFile(suffix='.ini', mode='w', delete=False) opts.write_to_stream(opt_file) opt_file.close() problem = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'mock_problems', 'default_parsers')) ...
Regression tests for the Fitbenchmarking software with all default fitting software packages
TestRegressionDefault
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRegressionDefault: """Regression tests for the Fitbenchmarking software with all default fitting software packages""" def setUpClass(cls): """Create an options file, run it, and get the results.""" <|body_0|> def test_results_consistent(self): """Regression t...
stack_v2_sparse_classes_36k_train_027862
8,084
permissive
[ { "docstring": "Create an options file, run it, and get the results.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Regression testing that the results of fitting a set of problems containing all problem types against a single minimizer from each of the supported s...
2
stack_v2_sparse_classes_30k_train_008511
Implement the Python class `TestRegressionDefault` described below. Class description: Regression tests for the Fitbenchmarking software with all default fitting software packages Method signatures and docstrings: - def setUpClass(cls): Create an options file, run it, and get the results. - def test_results_consisten...
Implement the Python class `TestRegressionDefault` described below. Class description: Regression tests for the Fitbenchmarking software with all default fitting software packages Method signatures and docstrings: - def setUpClass(cls): Create an options file, run it, and get the results. - def test_results_consisten...
edae46c0361568bc537de2425d603e7b271eabe7
<|skeleton|> class TestRegressionDefault: """Regression tests for the Fitbenchmarking software with all default fitting software packages""" def setUpClass(cls): """Create an options file, run it, and get the results.""" <|body_0|> def test_results_consistent(self): """Regression t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestRegressionDefault: """Regression tests for the Fitbenchmarking software with all default fitting software packages""" def setUpClass(cls): """Create an options file, run it, and get the results.""" opts = setup_options() opt_file = tempfile.NamedTemporaryFile(suffix='.ini', mo...
the_stack_v2_python_sparse
fitbenchmarking/systests/test_regression.py
dsotiropoulos/fitbenchmarking
train
0
b8c4f459b40784f9a2b2da2b9dedf7cc2b5e4c92
[ "try:\n current_subscription = self.get_current_subscription()\n serializer = SubscriptionSerializer(current_subscription)\n print(serializer.data)\n return Response(serializer.data, status=status.HTTP_200_0K)\nexcept:\n return Response(status=status.HTTP_204_NO_CONTENT)", "serializer = CreateSubsc...
<|body_start_0|> try: current_subscription = self.get_current_subscription() serializer = SubscriptionSerializer(current_subscription) print(serializer.data) return Response(serializer.data, status=status.HTTP_200_0K) except: return Response(st...
A REST API for Stripes implementation in the backend. Shows account details including customer and subscription details.
SubscribeView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscribeView: """A REST API for Stripes implementation in the backend. Shows account details including customer and subscription details.""" def get(self, request, *args, **kwargs): """Return the users current subscription. Returns with status code 200.""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_027863
12,846
no_license
[ { "docstring": "Return the users current subscription. Returns with status code 200.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Create a new current subscription for the user. Returns with status code 201.", "name": "post", "signature": "de...
3
stack_v2_sparse_classes_30k_train_012221
Implement the Python class `SubscribeView` described below. Class description: A REST API for Stripes implementation in the backend. Shows account details including customer and subscription details. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return the users current subscription. Re...
Implement the Python class `SubscribeView` described below. Class description: A REST API for Stripes implementation in the backend. Shows account details including customer and subscription details. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return the users current subscription. Re...
f38ea1ff9283416f4b4b1a9eb134344a566856a4
<|skeleton|> class SubscribeView: """A REST API for Stripes implementation in the backend. Shows account details including customer and subscription details.""" def get(self, request, *args, **kwargs): """Return the users current subscription. Returns with status code 200.""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubscribeView: """A REST API for Stripes implementation in the backend. Shows account details including customer and subscription details.""" def get(self, request, *args, **kwargs): """Return the users current subscription. Returns with status code 200.""" try: current_subscr...
the_stack_v2_python_sparse
djstripe/views.py
meanwise-eng/meanwise-server
train
0
9a6725bd20276f39603cd18c6db3f3f3f1e2f8fc
[ "logg = logging.getLogger(f'c.{__class__.__name__}.init')\nlogg.info(f'Start init')\nself.dod_map = dod_map\nself.map_shape = dod_map.mappa.shape\nself.bias = bias\nself.scale = scale\nself.step_len = step_len\nself.num_steps = 3\npad = 10\nif x is None:\n self.x = 50\nelse:\n self.x = x\nif y is None:\n s...
<|body_start_0|> logg = logging.getLogger(f'c.{__class__.__name__}.init') logg.info(f'Start init') self.dod_map = dod_map self.map_shape = dod_map.mappa.shape self.bias = bias self.scale = scale self.step_len = step_len self.num_steps = 3 pad = 10 ...
Agent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Agent: def __init__(self, dod_map, bias, scale, step_len, x=None, y=None, d=None): """Create a doodling agent, that will draw on dod_map bias controls the tightness of the curvature step_len is the length of a step specific position and direction can be provided""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_027864
2,152
no_license
[ { "docstring": "Create a doodling agent, that will draw on dod_map bias controls the tightness of the curvature step_len is the length of a step specific position and direction can be provided", "name": "__init__", "signature": "def __init__(self, dod_map, bias, scale, step_len, x=None, y=None, d=None)"...
2
null
Implement the Python class `Agent` described below. Class description: Implement the Agent class. Method signatures and docstrings: - def __init__(self, dod_map, bias, scale, step_len, x=None, y=None, d=None): Create a doodling agent, that will draw on dod_map bias controls the tightness of the curvature step_len is ...
Implement the Python class `Agent` described below. Class description: Implement the Agent class. Method signatures and docstrings: - def __init__(self, dod_map, bias, scale, step_len, x=None, y=None, d=None): Create a doodling agent, that will draw on dod_map bias controls the tightness of the curvature step_len is ...
1d7e5657014b00612cde87b78d5506a9e8b6adfc
<|skeleton|> class Agent: def __init__(self, dod_map, bias, scale, step_len, x=None, y=None, d=None): """Create a doodling agent, that will draw on dod_map bias controls the tightness of the curvature step_len is the length of a step specific position and direction can be provided""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Agent: def __init__(self, dod_map, bias, scale, step_len, x=None, y=None, d=None): """Create a doodling agent, that will draw on dod_map bias controls the tightness of the curvature step_len is the length of a step specific position and direction can be provided""" logg = logging.getLogger(f'c...
the_stack_v2_python_sparse
python/proc-generation/doodles/doodle_agent.py
Pitrified/snippet
train
2
823ff152610a1f07d0dbd0253c7125d1a92e4077
[ "self.data = {}\ncancer_ann_file = os.path.join(data_dir, sample_name + 'T.ann')\nnormal_ann_file = os.path.join(data_dir, sample_name + 'N.ann')\ncancer_consensus_qualities = get_consensus_qualities(cancer_ann_file)\nnormal_consensus_qualities = get_consensus_qualities(normal_ann_file)\nconsensus_qualities = {}\nc...
<|body_start_0|> self.data = {} cancer_ann_file = os.path.join(data_dir, sample_name + 'T.ann') normal_ann_file = os.path.join(data_dir, sample_name + 'N.ann') cancer_consensus_qualities = get_consensus_qualities(cancer_ann_file) normal_consensus_qualities = get_consensus_qualiti...
Simple class for data parsed from data/all_non_ref_hg19/yuaker folder, or other samples
calls
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class calls: """Simple class for data parsed from data/all_non_ref_hg19/yuaker folder, or other samples""" def __init__(self, data_dir, sample_name): """Parses exome and ann files in data_dir for this sample to make {} of paired tumor/normal call data""" <|body_0|> def get_inh...
stack_v2_sparse_classes_36k_train_027865
12,376
no_license
[ { "docstring": "Parses exome and ann files in data_dir for this sample to make {} of paired tumor/normal call data", "name": "__init__", "signature": "def __init__(self, data_dir, sample_name)" }, { "docstring": "Return chrpos and ref, normal, cancer alleles for in inherited and somatic {}", ...
4
stack_v2_sparse_classes_30k_train_001964
Implement the Python class `calls` described below. Class description: Simple class for data parsed from data/all_non_ref_hg19/yuaker folder, or other samples Method signatures and docstrings: - def __init__(self, data_dir, sample_name): Parses exome and ann files in data_dir for this sample to make {} of paired tumo...
Implement the Python class `calls` described below. Class description: Simple class for data parsed from data/all_non_ref_hg19/yuaker folder, or other samples Method signatures and docstrings: - def __init__(self, data_dir, sample_name): Parses exome and ann files in data_dir for this sample to make {} of paired tumo...
6565975357bb944f7a4b3d1b2e502ca3cf9d2312
<|skeleton|> class calls: """Simple class for data parsed from data/all_non_ref_hg19/yuaker folder, or other samples""" def __init__(self, data_dir, sample_name): """Parses exome and ann files in data_dir for this sample to make {} of paired tumor/normal call data""" <|body_0|> def get_inh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class calls: """Simple class for data parsed from data/all_non_ref_hg19/yuaker folder, or other samples""" def __init__(self, data_dir, sample_name): """Parses exome and ann files in data_dir for this sample to make {} of paired tumor/normal call data""" self.data = {} cancer_ann_file =...
the_stack_v2_python_sparse
call_class.py
samesense/loh
train
0
d13d087464b40df9ee5d4fc05ab47f609ff1c1c8
[ "super(LockedDictionary, self).__init__()\nfor k, v in template.items():\n super(LockedDictionary, self).__setitem__(k, v)", "if self.has_key(key):\n super(LockedDictionary, self).__setitem__(key, value)\nelse:\n msg = 'Can not ad key to LockedDictionary: %s' % key\n raise KeyError(msg)" ]
<|body_start_0|> super(LockedDictionary, self).__init__() for k, v in template.items(): super(LockedDictionary, self).__setitem__(k, v) <|end_body_0|> <|body_start_1|> if self.has_key(key): super(LockedDictionary, self).__setitem__(key, value) else: m...
Defines a dictionary subclass with a pre-determined set of keys. It is not possible to add new keys after construction.
LockedDictionary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockedDictionary: """Defines a dictionary subclass with a pre-determined set of keys. It is not possible to add new keys after construction.""" def __init__(self, template): """Construct new LockedDictionary. ARGS: template - dictionary which defined allowed keys and initial values."...
stack_v2_sparse_classes_36k_train_027866
1,021
no_license
[ { "docstring": "Construct new LockedDictionary. ARGS: template - dictionary which defined allowed keys and initial values.", "name": "__init__", "signature": "def __init__(self, template)" }, { "docstring": "Sets dictionary value. Raises KeyError for invalid key.", "name": "__setitem__", ...
2
stack_v2_sparse_classes_30k_test_001091
Implement the Python class `LockedDictionary` described below. Class description: Defines a dictionary subclass with a pre-determined set of keys. It is not possible to add new keys after construction. Method signatures and docstrings: - def __init__(self, template): Construct new LockedDictionary. ARGS: template - d...
Implement the Python class `LockedDictionary` described below. Class description: Defines a dictionary subclass with a pre-determined set of keys. It is not possible to add new keys after construction. Method signatures and docstrings: - def __init__(self, template): Construct new LockedDictionary. ARGS: template - d...
97f530ff0841b9604f0d9575e7e1f0e3c0660be0
<|skeleton|> class LockedDictionary: """Defines a dictionary subclass with a pre-determined set of keys. It is not possible to add new keys after construction.""" def __init__(self, template): """Construct new LockedDictionary. ARGS: template - dictionary which defined allowed keys and initial values."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockedDictionary: """Defines a dictionary subclass with a pre-determined set of keys. It is not possible to add new keys after construction.""" def __init__(self, template): """Construct new LockedDictionary. ARGS: template - dictionary which defined allowed keys and initial values.""" su...
the_stack_v2_python_sparse
llia/locked_dictionary.py
plewto/Llia
train
17
b5bde1bbb7a01917e6ab445423edff96e6742c2e
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
DeliverServicer
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeliverServicer: """Missing associated documentation comment in .proto file.""" def Deliver(self, request_iterator, context): """Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message, then a stream of block replies i...
stack_v2_sparse_classes_36k_train_027867
6,614
permissive
[ { "docstring": "Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message, then a stream of block replies is received", "name": "Deliver", "signature": "def Deliver(self, request_iterator, context)" }, { "docstring": "DeliverFiltere...
3
stack_v2_sparse_classes_30k_train_003618
Implement the Python class `DeliverServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Deliver(self, request_iterator, context): Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled o...
Implement the Python class `DeliverServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def Deliver(self, request_iterator, context): Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled o...
0ca510569229217f81fb093682c38e1b4a0cd7c6
<|skeleton|> class DeliverServicer: """Missing associated documentation comment in .proto file.""" def Deliver(self, request_iterator, context): """Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message, then a stream of block replies i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeliverServicer: """Missing associated documentation comment in .proto file.""" def Deliver(self, request_iterator, context): """Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message, then a stream of block replies is received"""...
the_stack_v2_python_sparse
hfc/protos/peer/events_pb2_grpc.py
hyperledger/fabric-sdk-py
train
439
80c37cd98ec568cab060ce699f8620c4409dcaa2
[ "self.x = x\nself.y = y\nself.height = 25\nself.width = 50\nself.health = health", "if self.health == 1:\n pygame.draw.rect(screen, GREY, (self.x, self.y, self.width, self.height))\nif self.health == 2:\n pygame.draw.rect(screen, RED, (self.x, self.y, self.width, self.height))\nif self.health == 3:\n pyg...
<|body_start_0|> self.x = x self.y = y self.height = 25 self.width = 50 self.health = health <|end_body_0|> <|body_start_1|> if self.health == 1: pygame.draw.rect(screen, GREY, (self.x, self.y, self.width, self.height)) if self.health == 2: ...
This class contains the structure of the bricks objects to be destroyed by the player
Bricks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bricks: """This class contains the structure of the bricks objects to be destroyed by the player""" def __init__(self, x, y, health=1): """self.x is the x position on the screen self.y is the y position on the screen self.height is the height of the rectangle self.width is the width ...
stack_v2_sparse_classes_36k_train_027868
4,153
no_license
[ { "docstring": "self.x is the x position on the screen self.y is the y position on the screen self.height is the height of the rectangle self.width is the width of the rectangle self.health is the health of the bricks which defines how many hits needed to destroy the bricks", "name": "__init__", "signat...
2
stack_v2_sparse_classes_30k_train_016556
Implement the Python class `Bricks` described below. Class description: This class contains the structure of the bricks objects to be destroyed by the player Method signatures and docstrings: - def __init__(self, x, y, health=1): self.x is the x position on the screen self.y is the y position on the screen self.heigh...
Implement the Python class `Bricks` described below. Class description: This class contains the structure of the bricks objects to be destroyed by the player Method signatures and docstrings: - def __init__(self, x, y, health=1): self.x is the x position on the screen self.y is the y position on the screen self.heigh...
14a140aac32397ae4b412e276488a83b730cc7b5
<|skeleton|> class Bricks: """This class contains the structure of the bricks objects to be destroyed by the player""" def __init__(self, x, y, health=1): """self.x is the x position on the screen self.y is the y position on the screen self.height is the height of the rectangle self.width is the width ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bricks: """This class contains the structure of the bricks objects to be destroyed by the player""" def __init__(self, x, y, health=1): """self.x is the x position on the screen self.y is the y position on the screen self.height is the height of the rectangle self.width is the width of the rectan...
the_stack_v2_python_sparse
Objektorientert INF-1400/oblig1/Files/Objects.py
MartinRovang/UniversityPhysics
train
3
da577011b4bad29f3cbda1e044ee544f6bcce846
[ "if not os.path.exists(path):\n return\nif os.path.isfile(path) or os.path.islink(path):\n os.unlink(path)\nelse:\n shutil.rmtree(path)", "if os.path.exists(dstname):\n if os.path.abspath(linkto) == os.path.abspath(dstname):\n return\n os.unlink(dstname)\nos.symlink(linkto, dstname)", "try...
<|body_start_0|> if not os.path.exists(path): return if os.path.isfile(path) or os.path.islink(path): os.unlink(path) else: shutil.rmtree(path) <|end_body_0|> <|body_start_1|> if os.path.exists(dstname): if os.path.abspath(linkto) == os.pa...
FileUtils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileUtils: def rm_rf(path): """Util to delete path""" <|body_0|> def symlink(linkto, dstname): """Util to symlink path""" <|body_1|> def mkdir_p(start_path): """Util to make path""" <|body_2|> def dir_size(start_path): """Uti...
stack_v2_sparse_classes_36k_train_027869
1,591
no_license
[ { "docstring": "Util to delete path", "name": "rm_rf", "signature": "def rm_rf(path)" }, { "docstring": "Util to symlink path", "name": "symlink", "signature": "def symlink(linkto, dstname)" }, { "docstring": "Util to make path", "name": "mkdir_p", "signature": "def mkdir...
4
stack_v2_sparse_classes_30k_train_013852
Implement the Python class `FileUtils` described below. Class description: Implement the FileUtils class. Method signatures and docstrings: - def rm_rf(path): Util to delete path - def symlink(linkto, dstname): Util to symlink path - def mkdir_p(start_path): Util to make path - def dir_size(start_path): Util to get t...
Implement the Python class `FileUtils` described below. Class description: Implement the FileUtils class. Method signatures and docstrings: - def rm_rf(path): Util to delete path - def symlink(linkto, dstname): Util to symlink path - def mkdir_p(start_path): Util to make path - def dir_size(start_path): Util to get t...
3962b3c7bab9d26bf871d257e15dd39c45ffaddd
<|skeleton|> class FileUtils: def rm_rf(path): """Util to delete path""" <|body_0|> def symlink(linkto, dstname): """Util to symlink path""" <|body_1|> def mkdir_p(start_path): """Util to make path""" <|body_2|> def dir_size(start_path): """Uti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileUtils: def rm_rf(path): """Util to delete path""" if not os.path.exists(path): return if os.path.isfile(path) or os.path.islink(path): os.unlink(path) else: shutil.rmtree(path) def symlink(linkto, dstname): """Util to symlink...
the_stack_v2_python_sparse
tools/files/file_utils.py
zigvu/samosa
train
0
9d6fe2626314c5bd7708fc9b7c689a0624374f97
[ "self._values = args[::2]\nself._times = args[1::2]\nassert len(self._values) == len(self._times) + 1\nassert all((isinstance(dt, datetime.datetime) for dt in self._times))", "left = 0\nright = len(self._times)\nif now is None:\n now = datetime.datetime.utcnow()\nwhile left != right:\n mid = (left + right) ...
<|body_start_0|> self._values = args[::2] self._times = args[1::2] assert len(self._values) == len(self._times) + 1 assert all((isinstance(dt, datetime.datetime) for dt in self._times)) <|end_body_0|> <|body_start_1|> left = 0 right = len(self._times) if now is N...
Config helper class to handle config values changing at set times.
Until
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Until: """Config helper class to handle config values changing at set times.""" def __init__(self, *args): """Initialise class. Args should be an alternating sequence of values and sequential datetimes.""" <|body_0|> def get(self, now=None): """Return the appropr...
stack_v2_sparse_classes_36k_train_027870
1,978
no_license
[ { "docstring": "Initialise class. Args should be an alternating sequence of values and sequential datetimes.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Return the appropriate value based on the current time.", "name": "get", "signature": "def get(se...
2
stack_v2_sparse_classes_30k_test_000912
Implement the Python class `Until` described below. Class description: Config helper class to handle config values changing at set times. Method signatures and docstrings: - def __init__(self, *args): Initialise class. Args should be an alternating sequence of values and sequential datetimes. - def get(self, now=None...
Implement the Python class `Until` described below. Class description: Config helper class to handle config values changing at set times. Method signatures and docstrings: - def __init__(self, *args): Initialise class. Args should be an alternating sequence of values and sequential datetimes. - def get(self, now=None...
1115fe316f7c1ee1407017a60a054b1f7291f331
<|skeleton|> class Until: """Config helper class to handle config values changing at set times.""" def __init__(self, *args): """Initialise class. Args should be an alternating sequence of values and sequential datetimes.""" <|body_0|> def get(self, now=None): """Return the appropr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Until: """Config helper class to handle config values changing at set times.""" def __init__(self, *args): """Initialise class. Args should be an alternating sequence of values and sequential datetimes.""" self._values = args[::2] self._times = args[1::2] assert len(self._...
the_stack_v2_python_sparse
eisitirio/helpers/timed_config.py
gwynethbradbury/ouss_ball
train
1
bccc353a6d7056da6e489c1144a242fbd5af02ae
[ "self.schemas = Collection()\nself.collector = collector\nif self.collector is None:\n paths = os.environ.get('HARMONY_SCHEMA_PATH', self.DEFAULT_SCHEMA_PATH).split(os.pathsep)\n self.collector = FilesystemCollector(paths)\nself.validator_class = validator_class\nif self.validator_class is None:\n self.val...
<|body_start_0|> self.schemas = Collection() self.collector = collector if self.collector is None: paths = os.environ.get('HARMONY_SCHEMA_PATH', self.DEFAULT_SCHEMA_PATH).split(os.pathsep) self.collector = FilesystemCollector(paths) self.validator_class = validato...
A configuration of the various components in a standard way.
Session
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Session: """A configuration of the various components in a standard way.""" def __init__(self, collector=None, processors=None, validator_class=None): """Initialise session. *collector* is used to collect schemas for use in the session and should conform to the :py:class:`~harmony.sc...
stack_v2_sparse_classes_36k_train_027871
5,833
permissive
[ { "docstring": "Initialise session. *collector* is used to collect schemas for use in the session and should conform to the :py:class:`~harmony.schema.collector.Collector` interface. Defaults to a :py:class:`~harmony.schema.collector.FileSystemCollector` using the environment variable :envvar:`HARMONY_SCHEMA_PA...
6
stack_v2_sparse_classes_30k_train_009959
Implement the Python class `Session` described below. Class description: A configuration of the various components in a standard way. Method signatures and docstrings: - def __init__(self, collector=None, processors=None, validator_class=None): Initialise session. *collector* is used to collect schemas for use in the...
Implement the Python class `Session` described below. Class description: A configuration of the various components in a standard way. Method signatures and docstrings: - def __init__(self, collector=None, processors=None, validator_class=None): Initialise session. *collector* is used to collect schemas for use in the...
41039cea452860649f717358fd57a99e73202579
<|skeleton|> class Session: """A configuration of the various components in a standard way.""" def __init__(self, collector=None, processors=None, validator_class=None): """Initialise session. *collector* is used to collect schemas for use in the session and should conform to the :py:class:`~harmony.sc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Session: """A configuration of the various components in a standard way.""" def __init__(self, collector=None, processors=None, validator_class=None): """Initialise session. *collector* is used to collect schemas for use in the session and should conform to the :py:class:`~harmony.schema.collecto...
the_stack_v2_python_sparse
source/harmony/session.py
4degrees/harmony
train
4
6be2f838c3901f986b9013e96c70fecff9544420
[ "body = pickle.dumps(item)\nheader = struct.pack(self.packing, len(body))\nmessage = header + body\nreturn channel.write(bstr=message)", "header = channel.read(maxlen=self.headerSize)\nlength, = struct.unpack(self.packing, header)\nbody = channel.read(minlen=length)\nreturn pickle.loads(body)" ]
<|body_start_0|> body = pickle.dumps(item) header = struct.pack(self.packing, len(body)) message = header + body return channel.write(bstr=message) <|end_body_0|> <|body_start_1|> header = channel.read(maxlen=self.headerSize) length, = struct.unpack(self.packing, header)...
A marshaler that uses the native python services in {pickle} to serialize python objects for transmission to other processes. The {send} protocol pickles an object into the payload byte stream, and builds a header with the length of the payload. Similarly, {recv} first extracts the length of the byte string and uses th...
Pickler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pickler: """A marshaler that uses the native python services in {pickle} to serialize python objects for transmission to other processes. The {send} protocol pickles an object into the payload byte stream, and builds a header with the length of the payload. Similarly, {recv} first extracts the le...
stack_v2_sparse_classes_36k_train_027872
1,854
permissive
[ { "docstring": "Pack and ship {item} over {channel}", "name": "send", "signature": "def send(self, item, channel)" }, { "docstring": "Extract and return a single item from {channel}", "name": "recv", "signature": "def recv(self, channel)" } ]
2
null
Implement the Python class `Pickler` described below. Class description: A marshaler that uses the native python services in {pickle} to serialize python objects for transmission to other processes. The {send} protocol pickles an object into the payload byte stream, and builds a header with the length of the payload. ...
Implement the Python class `Pickler` described below. Class description: A marshaler that uses the native python services in {pickle} to serialize python objects for transmission to other processes. The {send} protocol pickles an object into the payload byte stream, and builds a header with the length of the payload. ...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Pickler: """A marshaler that uses the native python services in {pickle} to serialize python objects for transmission to other processes. The {send} protocol pickles an object into the payload byte stream, and builds a header with the length of the payload. Similarly, {recv} first extracts the le...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pickler: """A marshaler that uses the native python services in {pickle} to serialize python objects for transmission to other processes. The {send} protocol pickles an object into the payload byte stream, and builds a header with the length of the payload. Similarly, {recv} first extracts the length of the b...
the_stack_v2_python_sparse
packages/pyre/ipc/Pickler.py
pyre/pyre
train
27
7cef87f8d560167381388303cafd5f843102d9bd
[ "url = host + '/api/mart/list'\ndata = {'size': 10, 'page': 1}\nr = requests.post(url=url, data=data).json()\nout_format('砍价列表:', r)\ns = len(r['data'])\nif s == 0:\n print('data is null')\nelse:\n p_id = r['data'][5]['id']\n return p_id", "url = host + '/api/trophy/list'\ndata = {'size': 10, 'page': 1}\...
<|body_start_0|> url = host + '/api/mart/list' data = {'size': 10, 'page': 1} r = requests.post(url=url, data=data).json() out_format('砍价列表:', r) s = len(r['data']) if s == 0: print('data is null') else: p_id = r['data'][5]['id'] ...
定义一个双十一活动的公共测试类
double_elev
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class double_elev: """定义一个双十一活动的公共测试类""" def test_mart_list(self): """砍价列表""" <|body_0|> def test_past(self): """往期开奖 :param:size:单页记录数 :param:page:页码""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = host + '/api/mart/list' data = {'size'...
stack_v2_sparse_classes_36k_train_027873
1,327
no_license
[ { "docstring": "砍价列表", "name": "test_mart_list", "signature": "def test_mart_list(self)" }, { "docstring": "往期开奖 :param:size:单页记录数 :param:page:页码", "name": "test_past", "signature": "def test_past(self)" } ]
2
null
Implement the Python class `double_elev` described below. Class description: 定义一个双十一活动的公共测试类 Method signatures and docstrings: - def test_mart_list(self): 砍价列表 - def test_past(self): 往期开奖 :param:size:单页记录数 :param:page:页码
Implement the Python class `double_elev` described below. Class description: 定义一个双十一活动的公共测试类 Method signatures and docstrings: - def test_mart_list(self): 砍价列表 - def test_past(self): 往期开奖 :param:size:单页记录数 :param:page:页码 <|skeleton|> class double_elev: """定义一个双十一活动的公共测试类""" def test_mart_list(self): ...
0ebaae335de2f1633e31c4fc3f60e556220a8bfb
<|skeleton|> class double_elev: """定义一个双十一活动的公共测试类""" def test_mart_list(self): """砍价列表""" <|body_0|> def test_past(self): """往期开奖 :param:size:单页记录数 :param:page:页码""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class double_elev: """定义一个双十一活动的公共测试类""" def test_mart_list(self): """砍价列表""" url = host + '/api/mart/list' data = {'size': 10, 'page': 1} r = requests.post(url=url, data=data).json() out_format('砍价列表:', r) s = len(r['data']) if s == 0: print(...
the_stack_v2_python_sparse
Atle/interface/framework/common/pubilc_act.py
shiqi0128/My_scripts
train
0
3cbdab37c7968553f96e904dbaeb6a2c6660f74c
[ "self.kl_low = kl_low\nself.kl_high = kl_high\nself.n_epochs = n_epochs\nself.start_epoch = start_epoch\nself.kl = (self.kl_high - self.kl_low) / (self.n_epochs - self.start_epoch)", "k = epoch - self.start_epoch if epoch >= self.start_epoch else 0\nbeta = self.kl_low + k * self.kl\nif beta > self.kl_high:\n b...
<|body_start_0|> self.kl_low = kl_low self.kl_high = kl_high self.n_epochs = n_epochs self.start_epoch = start_epoch self.kl = (self.kl_high - self.kl_low) / (self.n_epochs - self.start_epoch) <|end_body_0|> <|body_start_1|> k = epoch - self.start_epoch if epoch >= self....
Annealer scaling KL weights (beta) linearly according to the number of epochs.
KLAnnealer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KLAnnealer: """Annealer scaling KL weights (beta) linearly according to the number of epochs.""" def __init__(self, kl_low: float, kl_high: float, n_epochs: int, start_epoch: int) -> None: """Construct KLAnnealer. Args: kl_low: low KL weight. kl_high: high KL weight. n_epochs: number...
stack_v2_sparse_classes_36k_train_027874
2,172
permissive
[ { "docstring": "Construct KLAnnealer. Args: kl_low: low KL weight. kl_high: high KL weight. n_epochs: number of epochs. start_epoch: starting epoch.", "name": "__init__", "signature": "def __init__(self, kl_low: float, kl_high: float, n_epochs: int, start_epoch: int) -> None" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_007908
Implement the Python class `KLAnnealer` described below. Class description: Annealer scaling KL weights (beta) linearly according to the number of epochs. Method signatures and docstrings: - def __init__(self, kl_low: float, kl_high: float, n_epochs: int, start_epoch: int) -> None: Construct KLAnnealer. Args: kl_low:...
Implement the Python class `KLAnnealer` described below. Class description: Annealer scaling KL weights (beta) linearly according to the number of epochs. Method signatures and docstrings: - def __init__(self, kl_low: float, kl_high: float, n_epochs: int, start_epoch: int) -> None: Construct KLAnnealer. Args: kl_low:...
0b69b7d5b261f2f9af3984793c1295b9b80cd01a
<|skeleton|> class KLAnnealer: """Annealer scaling KL weights (beta) linearly according to the number of epochs.""" def __init__(self, kl_low: float, kl_high: float, n_epochs: int, start_epoch: int) -> None: """Construct KLAnnealer. Args: kl_low: low KL weight. kl_high: high KL weight. n_epochs: number...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KLAnnealer: """Annealer scaling KL weights (beta) linearly according to the number of epochs.""" def __init__(self, kl_low: float, kl_high: float, n_epochs: int, start_epoch: int) -> None: """Construct KLAnnealer. Args: kl_low: low KL weight. kl_high: high KL weight. n_epochs: number of epochs. s...
the_stack_v2_python_sparse
src/gt4sd/frameworks/granular/ml/models/utils.py
GT4SD/gt4sd-core
train
239
10ccbd8041655ad4bbbcac7d6dfe62cfc2bfa94f
[ "it = iter(test_inputs.split('\\n')) if test_inputs else None\n\ndef uinput():\n return next(it) if it else sys.stdin.readline().rstrip()\n[self.p, self.k] = map(int, uinput().split())\nself.M = 10 ** 9 + 7", "result = 0\nbp = Binominals(mod=self.p)\nmm = 1\nfor m in range(1, self.p):\n mm = bp.mul(mm, self...
<|body_start_0|> it = iter(test_inputs.split('\n')) if test_inputs else None def uinput(): return next(it) if it else sys.stdin.readline().rstrip() [self.p, self.k] = map(int, uinput().split()) self.M = 10 ** 9 + 7 <|end_body_0|> <|body_start_1|> result = 0 ...
Modular representation
Modular
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Modular: """Modular representation""" def __init__(self, test_inputs=None): """Default constructor""" <|body_0|> def calculate(self): """Main calcualtion function of the class""" <|body_1|> <|end_skeleton|> <|body_start_0|> it = iter(test_inputs...
stack_v2_sparse_classes_36k_train_027875
3,558
permissive
[ { "docstring": "Default constructor", "name": "__init__", "signature": "def __init__(self, test_inputs=None)" }, { "docstring": "Main calcualtion function of the class", "name": "calculate", "signature": "def calculate(self)" } ]
2
stack_v2_sparse_classes_30k_train_008476
Implement the Python class `Modular` described below. Class description: Modular representation Method signatures and docstrings: - def __init__(self, test_inputs=None): Default constructor - def calculate(self): Main calcualtion function of the class
Implement the Python class `Modular` described below. Class description: Modular representation Method signatures and docstrings: - def __init__(self, test_inputs=None): Default constructor - def calculate(self): Main calcualtion function of the class <|skeleton|> class Modular: """Modular representation""" ...
ae02ea872ca91ef98630cc172a844b82cc56f621
<|skeleton|> class Modular: """Modular representation""" def __init__(self, test_inputs=None): """Default constructor""" <|body_0|> def calculate(self): """Main calcualtion function of the class""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Modular: """Modular representation""" def __init__(self, test_inputs=None): """Default constructor""" it = iter(test_inputs.split('\n')) if test_inputs else None def uinput(): return next(it) if it else sys.stdin.readline().rstrip() [self.p, self.k] = map(int,...
the_stack_v2_python_sparse
codeforces/604D_modular.py
snsokolov/contests
train
1
9015a6981f4388cb8fd6788addf1c6447f0c876a
[ "result = cls(group=operation, data_type=data_type)\nlatency_unit = 'ms'\nfor _, name, val in lines:\n name = name.strip()\n val = val.strip()\n if name.startswith('>'):\n name = name[1:]\n val = float(val) if '.' in val or 'nan' in val.lower() else int(val)\n if name.isdigit():\n if va...
<|body_start_0|> result = cls(group=operation, data_type=data_type) latency_unit = 'ms' for _, name, val in lines: name = name.strip() val = val.strip() if name.startswith('>'): name = name[1:] val = float(val) if '.' in val or 'nan...
Individual results for a single operation. YCSB results are either aggregated per operation (read/update) at the end of the run or output on a per-interval (i.e. second) basis during the run. Attributes: group: group name (e.g. update, insert, overall) statistics: dict mapping from statistic name to value (e.g. {'Count...
_OpResult
[ "Classpath-exception-2.0", "BSD-3-Clause", "AGPL-3.0-only", "MIT", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _OpResult: """Individual results for a single operation. YCSB results are either aggregated per operation (read/update) at the end of the run or output on a per-interval (i.e. second) basis during the run. Attributes: group: group name (e.g. update, insert, overall) statistics: dict mapping from ...
stack_v2_sparse_classes_36k_train_027876
37,650
permissive
[ { "docstring": "Returns an _OpResult parsed from YCSB summary lines. Example format: [UPDATE], Operations, 2468054 [UPDATE], AverageLatency(us), 2218.8513395574005 [UPDATE], MinLatency(us), 554 [UPDATE], MaxLatency(us), 352634 [UPDATE], 95thPercentileLatency(ms), 4 [UPDATE], 99thPercentileLatency(ms), 7 [UPDATE...
2
stack_v2_sparse_classes_30k_train_019415
Implement the Python class `_OpResult` described below. Class description: Individual results for a single operation. YCSB results are either aggregated per operation (read/update) at the end of the run or output on a per-interval (i.e. second) basis during the run. Attributes: group: group name (e.g. update, insert, ...
Implement the Python class `_OpResult` described below. Class description: Individual results for a single operation. YCSB results are either aggregated per operation (read/update) at the end of the run or output on a per-interval (i.e. second) basis during the run. Attributes: group: group name (e.g. update, insert, ...
d0699f32998898757b036704fba39e5471641f01
<|skeleton|> class _OpResult: """Individual results for a single operation. YCSB results are either aggregated per operation (read/update) at the end of the run or output on a per-interval (i.e. second) basis during the run. Attributes: group: group name (e.g. update, insert, overall) statistics: dict mapping from ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _OpResult: """Individual results for a single operation. YCSB results are either aggregated per operation (read/update) at the end of the run or output on a per-interval (i.e. second) basis during the run. Attributes: group: group name (e.g. update, insert, overall) statistics: dict mapping from statistic nam...
the_stack_v2_python_sparse
perfkitbenchmarker/linux_packages/ycsb_stats.py
GoogleCloudPlatform/PerfKitBenchmarker
train
1,923
9b8eeb5c92964259eaa481abfbb71b7808653243
[ "self.w = w\nfor i in range(1, len(self.w)):\n self.w[i] += self.w[i - 1]", "index = randint(1, self.w[-1])\nstart = 0\nend = len(self.w) - 1\nif index < self.w[0]:\n return 0\nwhile start < end:\n mid = (start + end) // 2\n if index > self.w[mid]:\n start = mid + 1\n else:\n end = mi...
<|body_start_0|> self.w = w for i in range(1, len(self.w)): self.w[i] += self.w[i - 1] <|end_body_0|> <|body_start_1|> index = randint(1, self.w[-1]) start = 0 end = len(self.w) - 1 if index < self.w[0]: return 0 while start < end: ...
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 for i in range(1, len(self.w)): self.w[i] += self.w[i - 1] <|end_...
stack_v2_sparse_classes_36k_train_027877
650
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
16e8a7935811fa71ce71998da8549e29ba68f847
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.w = w for i in range(1, len(self.w)): self.w[i] += self.w[i - 1] def pickIndex(self): """:rtype: int""" index = randint(1, self.w[-1]) start = 0 end = len(self.w) - 1 ...
the_stack_v2_python_sparse
leetcode6/pickIndex.py
lizyang95/leetcode
train
0
b2c651ca1856de05b4edc60d44e18493e3cc29c9
[ "new_users = []\nseen = set()\nfor user_dict in validated_data:\n if user_dict['id'] in seen:\n raise ValidationError({'id': [f\"User with ID {user_dict['id']} given multiple times.\"]})\n seen.add(user_dict['id'])\n new_users.append(User(**user_dict))\nUser.objects.bulk_create(new_users, ignore_con...
<|body_start_0|> new_users = [] seen = set() for user_dict in validated_data: if user_dict['id'] in seen: raise ValidationError({'id': [f"User with ID {user_dict['id']} given multiple times."]}) seen.add(user_dict['id']) new_users.append(User(*...
List serializer for User model to handle bulk updates.
UserListSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserListSerializer: """List serializer for User model to handle bulk updates.""" def create(self, validated_data: list) -> list: """Override create method to optimize django queries.""" <|body_0|> def update(self, queryset: QuerySet, validated_data: list) -> list: ...
stack_v2_sparse_classes_36k_train_027878
23,871
permissive
[ { "docstring": "Override create method to optimize django queries.", "name": "create", "signature": "def create(self, validated_data: list) -> list" }, { "docstring": "Override update method to support bulk updates. ref:https://www.django-rest-framework.org/api-guide/serializers/#customizing-mul...
2
null
Implement the Python class `UserListSerializer` described below. Class description: List serializer for User model to handle bulk updates. Method signatures and docstrings: - def create(self, validated_data: list) -> list: Override create method to optimize django queries. - def update(self, queryset: QuerySet, valid...
Implement the Python class `UserListSerializer` described below. Class description: List serializer for User model to handle bulk updates. Method signatures and docstrings: - def create(self, validated_data: list) -> list: Override create method to optimize django queries. - def update(self, queryset: QuerySet, valid...
cb6326cabee6570a5725702cb2893ae39f752279
<|skeleton|> class UserListSerializer: """List serializer for User model to handle bulk updates.""" def create(self, validated_data: list) -> list: """Override create method to optimize django queries.""" <|body_0|> def update(self, queryset: QuerySet, validated_data: list) -> list: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserListSerializer: """List serializer for User model to handle bulk updates.""" def create(self, validated_data: list) -> list: """Override create method to optimize django queries.""" new_users = [] seen = set() for user_dict in validated_data: if user_dict['...
the_stack_v2_python_sparse
pydis_site/apps/api/serializers.py
python-discord/site
train
746
e489f1bc1d7aa773665187aa5c276fb97cd92c25
[ "if self.state_model.op_state in [DevState.UNKNOWN, DevState.DISABLE]:\n log_msg = f'ObsReset() is not allowed in {self.state_model.op_state}'\n tango.Except.throw_exception(log_msg, 'Failed to invoke ObsReset command on CspSubarrayLeafNode.', 'cspsubarrayleafnode.ObsReset()', tango.ErrSeverity.ERR)\nthis_ser...
<|body_start_0|> if self.state_model.op_state in [DevState.UNKNOWN, DevState.DISABLE]: log_msg = f'ObsReset() is not allowed in {self.state_model.op_state}' tango.Except.throw_exception(log_msg, 'Failed to invoke ObsReset command on CspSubarrayLeafNode.', 'cspsubarrayleafnode.ObsReset()'...
A class for CSPSubarrayLeafNode's ObsReset() command. ObsReset command is inherited from BaseCommand. Command to reset the Csp Subarray and bring it to its RESETTING state.
ObsResetCommand
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObsResetCommand: """A class for CSPSubarrayLeafNode's ObsReset() command. ObsReset command is inherited from BaseCommand. Command to reset the Csp Subarray and bring it to its RESETTING state.""" def check_allowed(self): """Checks whether this command is allowed to be run in current ...
stack_v2_sparse_classes_36k_train_027879
4,780
permissive
[ { "docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state", "name": "check_allowed", "signature": ...
3
stack_v2_sparse_classes_30k_train_000913
Implement the Python class `ObsResetCommand` described below. Class description: A class for CSPSubarrayLeafNode's ObsReset() command. ObsReset command is inherited from BaseCommand. Command to reset the Csp Subarray and bring it to its RESETTING state. Method signatures and docstrings: - def check_allowed(self): Che...
Implement the Python class `ObsResetCommand` described below. Class description: A class for CSPSubarrayLeafNode's ObsReset() command. ObsReset command is inherited from BaseCommand. Command to reset the Csp Subarray and bring it to its RESETTING state. Method signatures and docstrings: - def check_allowed(self): Che...
7ee65a9c8dada9b28893144b372a398bd0646195
<|skeleton|> class ObsResetCommand: """A class for CSPSubarrayLeafNode's ObsReset() command. ObsReset command is inherited from BaseCommand. Command to reset the Csp Subarray and bring it to its RESETTING state.""" def check_allowed(self): """Checks whether this command is allowed to be run in current ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObsResetCommand: """A class for CSPSubarrayLeafNode's ObsReset() command. ObsReset command is inherited from BaseCommand. Command to reset the Csp Subarray and bring it to its RESETTING state.""" def check_allowed(self): """Checks whether this command is allowed to be run in current device state ...
the_stack_v2_python_sparse
temp_src/ska_tmc_cspsubarrayleafnode_mid/obsreset_command.py
ska-telescope/tmc-prototype
train
4
a9fa36ae5eab3868b96042f88178ed764c70450a
[ "body_1 = {'reqId': '32位UUID', 'areaCode': 'atYA-A', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'}\na = api_v1_analysis_pre_security_passrate(body_1)\ndict_data = json.loads(a)\nself.assertNotEqual(dict_data['results'][0]['num'], 0)", "body_1 = {'reqId': '32位UUID', 'areaCode': 'atYA-A'...
<|body_start_0|> body_1 = {'reqId': '32位UUID', 'areaCode': 'atYA-A', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'} a = api_v1_analysis_pre_security_passrate(body_1) dict_data = json.loads(a) self.assertNotEqual(dict_data['results'][0]['num'], 0) <|end_body_0|>...
预安检通过率接口测试回归
TestApiAnalysisPreSecurityPassRate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestApiAnalysisPreSecurityPassRate: """预安检通过率接口测试回归""" def test_01(self): """查询通过率""" <|body_0|> def test_02(self): """不在当前时间不能查出来""" <|body_1|> def test_03(self): """区域通道不存在时不能查询相关信息""" <|body_2|> def test_04(self): """验...
stack_v2_sparse_classes_36k_train_027880
2,178
no_license
[ { "docstring": "查询通过率", "name": "test_01", "signature": "def test_01(self)" }, { "docstring": "不在当前时间不能查出来", "name": "test_02", "signature": "def test_02(self)" }, { "docstring": "区域通道不存在时不能查询相关信息", "name": "test_03", "signature": "def test_03(self)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_000767
Implement the Python class `TestApiAnalysisPreSecurityPassRate` described below. Class description: 预安检通过率接口测试回归 Method signatures and docstrings: - def test_01(self): 查询通过率 - def test_02(self): 不在当前时间不能查出来 - def test_03(self): 区域通道不存在时不能查询相关信息 - def test_04(self): 验证服务器响应时间小于1S
Implement the Python class `TestApiAnalysisPreSecurityPassRate` described below. Class description: 预安检通过率接口测试回归 Method signatures and docstrings: - def test_01(self): 查询通过率 - def test_02(self): 不在当前时间不能查出来 - def test_03(self): 区域通道不存在时不能查询相关信息 - def test_04(self): 验证服务器响应时间小于1S <|skeleton|> class TestApiAnalysisPre...
aa0749f4a237ee76a61579dc5984635a7127a631
<|skeleton|> class TestApiAnalysisPreSecurityPassRate: """预安检通过率接口测试回归""" def test_01(self): """查询通过率""" <|body_0|> def test_02(self): """不在当前时间不能查出来""" <|body_1|> def test_03(self): """区域通道不存在时不能查询相关信息""" <|body_2|> def test_04(self): """验...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestApiAnalysisPreSecurityPassRate: """预安检通过率接口测试回归""" def test_01(self): """查询通过率""" body_1 = {'reqId': '32位UUID', 'areaCode': 'atYA-A', 'startTime': '20181010' + '06000000', 'endTime': '20181023' + '06000000'} a = api_v1_analysis_pre_security_passrate(body_1) dict_data =...
the_stack_v2_python_sparse
Airport/Auto_return/TestCase/test_data_platform_082.py
jingshiyue/zhongkeyuan_workspace
train
0
8918786f098a26e9888ecc5be3afe37bf6bffb34
[ "self.app_id = 'my-app'\nos.environ['APPLICATION_ID'] = self.app_id\nself.datastore_stub = datastore_file_stub.DatastoreFileStub(self.app_id, None)\nself.ResetApiProxyStubMap()\napiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', self.datastore_stub)", "if self.__apiproxy_initialized:\n return\nself.__apip...
<|body_start_0|> self.app_id = 'my-app' os.environ['APPLICATION_ID'] = self.app_id self.datastore_stub = datastore_file_stub.DatastoreFileStub(self.app_id, None) self.ResetApiProxyStubMap() apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', self.datastore_stub) <|end_body_0|...
Base class for tests that require datastore.
DatastoreTest
[ "BSD-3-Clause", "Apache-2.0", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatastoreTest: """Base class for tests that require datastore.""" def setUp(self): """Set up the datastore.""" <|body_0|> def ResetApiProxyStubMap(self): """Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless of their status. Must ...
stack_v2_sparse_classes_36k_train_027881
2,277
permissive
[ { "docstring": "Set up the datastore.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless of their status. Must be called before stubs can be configured. Every time a new test is created, it is n...
2
stack_v2_sparse_classes_30k_train_005243
Implement the Python class `DatastoreTest` described below. Class description: Base class for tests that require datastore. Method signatures and docstrings: - def setUp(self): Set up the datastore. - def ResetApiProxyStubMap(self): Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless o...
Implement the Python class `DatastoreTest` described below. Class description: Base class for tests that require datastore. Method signatures and docstrings: - def setUp(self): Set up the datastore. - def ResetApiProxyStubMap(self): Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless o...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class DatastoreTest: """Base class for tests that require datastore.""" def setUp(self): """Set up the datastore.""" <|body_0|> def ResetApiProxyStubMap(self): """Reset the proxy stub-map. Args: force: When True, always reset the stubs regardless of their status. Must ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatastoreTest: """Base class for tests that require datastore.""" def setUp(self): """Set up the datastore.""" self.app_id = 'my-app' os.environ['APPLICATION_ID'] = self.app_id self.datastore_stub = datastore_file_stub.DatastoreFileStub(self.app_id, None) self.Rese...
the_stack_v2_python_sparse
third_party/catapult/third_party/gsutil/third_party/protorpc/demos/tunes_db/server/datastore_test_util.py
metux/chromium-suckless
train
5
fb1200c85ac9ab4177dbb59360d3939337dfb76d
[ "row_num = len(array)\nfor i in range(row_num):\n col_num = len(array[i])\n for j in range(col_num):\n if array[i][j] == target:\n return True\nreturn False", "row_num = 0\ncol_num = len(array[0]) - 1\nrow_count = len(array)\nwhile row_num < row_count and col_num >= 0:\n val = array[row...
<|body_start_0|> row_num = len(array) for i in range(row_num): col_num = len(array[i]) for j in range(col_num): if array[i][j] == target: return True return False <|end_body_0|> <|body_start_1|> row_num = 0 col_num = le...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def Find_1(self, target, array): """方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性""" <|body_0|> def Find_2(self, target, array): """方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。时间复杂度为O(n)""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_027882
1,457
no_license
[ { "docstring": "方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性", "name": "Find_1", "signature": "def Find_1(self, target, array)" }, { "docstring": "方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。时间复杂度为O(n)", "name": "Find_2", "signature": "def Find_2(self, target, array)...
2
stack_v2_sparse_classes_30k_train_020830
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def Find_1(self, target, array): 方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性 - def Find_2(self, target, array): 方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def Find_1(self, target, array): 方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性 - def Find_2(self, target, array): 方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。...
6ee455019ae2d9adeea9fc3876f5da4297320715
<|skeleton|> class Solution: def Find_1(self, target, array): """方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性""" <|body_0|> def Find_2(self, target, array): """方法二:利用 每行从左到右递增、每列从上到下递增 的特性,减少扫描、比较次数。时间复杂度为O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def Find_1(self, target, array): """方法一:常规扫描整个二维数组。时间复杂度为O(n*m) 行数*列数,可视为O(n^2) 没有用到 每行从左到右递增、每列从上到下递增 的特性""" row_num = len(array) for i in range(row_num): col_num = len(array[i]) for j in range(col_num): if array[i][j] == target: ...
the_stack_v2_python_sparse
p1_array/a1_Find.py
atm1992/nowcoder_offer_in_Python27
train
0
9a2e3ec46e565c30ec121349ae78b06f15b3e245
[ "key = ndb.Key(models.InstanceGroupManager, 'fake-key')\ninstance_group_managers.delete(key)\nself.failIf(key.get())", "def json_request(url, *_args, **_kwargs):\n return {'targetLink': url}\nself.mock(instance_group_managers.net, 'json_request', json_request)\nkey = models.InstanceGroupManager(key=instance_gr...
<|body_start_0|> key = ndb.Key(models.InstanceGroupManager, 'fake-key') instance_group_managers.delete(key) self.failIf(key.get()) <|end_body_0|> <|body_start_1|> def json_request(url, *_args, **_kwargs): return {'targetLink': url} self.mock(instance_group_managers.n...
Tests for instance_group_managers.delete.
DeleteTest
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteTest: """Tests for instance_group_managers.delete.""" def test_entity_doesnt_exist(self): """Ensures nothing happens when the entity doesn't exist.""" <|body_0|> def test_deletes(self): """Ensures an instance group manager is deleted.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_027883
34,211
permissive
[ { "docstring": "Ensures nothing happens when the entity doesn't exist.", "name": "test_entity_doesnt_exist", "signature": "def test_entity_doesnt_exist(self)" }, { "docstring": "Ensures an instance group manager is deleted.", "name": "test_deletes", "signature": "def test_deletes(self)" ...
6
null
Implement the Python class `DeleteTest` described below. Class description: Tests for instance_group_managers.delete. Method signatures and docstrings: - def test_entity_doesnt_exist(self): Ensures nothing happens when the entity doesn't exist. - def test_deletes(self): Ensures an instance group manager is deleted. -...
Implement the Python class `DeleteTest` described below. Class description: Tests for instance_group_managers.delete. Method signatures and docstrings: - def test_entity_doesnt_exist(self): Ensures nothing happens when the entity doesn't exist. - def test_deletes(self): Ensures an instance group manager is deleted. -...
0a4fdfc25f89833026be6a8b29c0a27b8f3c5fc4
<|skeleton|> class DeleteTest: """Tests for instance_group_managers.delete.""" def test_entity_doesnt_exist(self): """Ensures nothing happens when the entity doesn't exist.""" <|body_0|> def test_deletes(self): """Ensures an instance group manager is deleted.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeleteTest: """Tests for instance_group_managers.delete.""" def test_entity_doesnt_exist(self): """Ensures nothing happens when the entity doesn't exist.""" key = ndb.Key(models.InstanceGroupManager, 'fake-key') instance_group_managers.delete(key) self.failIf(key.get()) ...
the_stack_v2_python_sparse
appengine/gce-backend/instance_group_managers_test.py
Swift1313/luci-py
train
0
a3f827b6e43308c94dad6a568ed8c7c6376a1f09
[ "processedString = []\nfor c in s:\n if c.isalnum():\n processedString.append(c.lower())\nl = len(processedString)\nfor i in range(0, l // 2):\n if processedString[i] != processedString[l - 1 - i]:\n return False\nreturn True", "import re\ns = s.lower()\ns1 = re.findall('[a-z0-9]', s)\ns2 = ''...
<|body_start_0|> processedString = [] for c in s: if c.isalnum(): processedString.append(c.lower()) l = len(processedString) for i in range(0, l // 2): if processedString[i] != processedString[l - 1 - i]: return False return...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def isPalindrome2(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> processedString = [] for c in s: if c.isalnu...
stack_v2_sparse_classes_36k_train_027884
902
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "isPalindrome2", "signature": "def isPalindrome2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - def isPalindrome2(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, s): :type s: str :rtype: bool - def isPalindrome2(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, s): ...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def isPalindrome2(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, s): """:type s: str :rtype: bool""" processedString = [] for c in s: if c.isalnum(): processedString.append(c.lower()) l = len(processedString) for i in range(0, l // 2): if processedString[i] != p...
the_stack_v2_python_sparse
code/125#Valid Palindrome.py
EachenKuang/LeetCode
train
28
e027a9183c2c149dd94aeeaa48900e5a483960bd
[ "super().__init__()\nself._img_size = config.get('img_size')\nself._input_channel = config.get('input_channel')\nself._filter_sizes = config.get('filter_size')\nself._kernel_size = config.get('kernel_size')\nself._padding = padding\nself._stride = stride\nself._dilation = dilation\nself._encoder_maxpool_count = con...
<|body_start_0|> super().__init__() self._img_size = config.get('img_size') self._input_channel = config.get('input_channel') self._filter_sizes = config.get('filter_size') self._kernel_size = config.get('kernel_size') self._padding = padding self._stride = stride...
Deterministic_Conv_Encoder
Deterministic_Conv_Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Deterministic_Conv_Encoder: """Deterministic_Conv_Encoder""" def __init__(self, config, padding=0, stride=2, dilation=1): """NP""" <|body_0|> def forward(self, inputs): """Args: input : imamges (num_tasks, n_way, k_shot, filter_size img_size, img_size) Return: ou...
stack_v2_sparse_classes_36k_train_027885
18,202
no_license
[ { "docstring": "NP", "name": "__init__", "signature": "def __init__(self, config, padding=0, stride=2, dilation=1)" }, { "docstring": "Args: input : imamges (num_tasks, n_way, k_shot, filter_size img_size, img_size) Return: output :", "name": "forward", "signature": "def forward(self, in...
2
stack_v2_sparse_classes_30k_train_017083
Implement the Python class `Deterministic_Conv_Encoder` described below. Class description: Deterministic_Conv_Encoder Method signatures and docstrings: - def __init__(self, config, padding=0, stride=2, dilation=1): NP - def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, filter_size img_size,...
Implement the Python class `Deterministic_Conv_Encoder` described below. Class description: Deterministic_Conv_Encoder Method signatures and docstrings: - def __init__(self, config, padding=0, stride=2, dilation=1): NP - def forward(self, inputs): Args: input : imamges (num_tasks, n_way, k_shot, filter_size img_size,...
c7e1bfb49ebaec6937ed7b186689227f95a43e0f
<|skeleton|> class Deterministic_Conv_Encoder: """Deterministic_Conv_Encoder""" def __init__(self, config, padding=0, stride=2, dilation=1): """NP""" <|body_0|> def forward(self, inputs): """Args: input : imamges (num_tasks, n_way, k_shot, filter_size img_size, img_size) Return: ou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Deterministic_Conv_Encoder: """Deterministic_Conv_Encoder""" def __init__(self, config, padding=0, stride=2, dilation=1): """NP""" super().__init__() self._img_size = config.get('img_size') self._input_channel = config.get('input_channel') self._filter_sizes = conf...
the_stack_v2_python_sparse
model/MAML/Part/encoder.py
MingyuKim87/MLwM
train
0
6ba4c6b4610048c9b939a6634a75709bf7df7ca5
[ "self.tfrecord_paths = tfrecord_paths\nself.num_shards = len(self.tfrecord_paths)\nself.tfrecord_paths_tensor = tf.constant(self.tfrecord_paths)\nself.image_width = image_width\nself.image_channels = image_channels\nif seperate_background_channel:\n mask_channels += 1\nself.mask_channels = mask_channels\nprint('...
<|body_start_0|> self.tfrecord_paths = tfrecord_paths self.num_shards = len(self.tfrecord_paths) self.tfrecord_paths_tensor = tf.constant(self.tfrecord_paths) self.image_width = image_width self.image_channels = image_channels if seperate_background_channel: m...
TFRecordSegmentationDataset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFRecordSegmentationDataset: def __init__(self, tfrecord_paths: List[str], image_width: int, image_channels=3, mask_channels=1, seed=0, augmenter: Optional[Augmenter]=None, seperate_background_channel: bool=True): """Image segmentation tf.data.Dataset constructor for batching from tfreco...
stack_v2_sparse_classes_36k_train_027886
8,998
permissive
[ { "docstring": "Image segmentation tf.data.Dataset constructor for batching from tfrecords. Args: tfrecord_paths: list of paths to tfrecords image_width: side of images and masks (all images and masks assumed to be square and of the same size) image_channels: Int number of channels in the images. mask_channels:...
3
stack_v2_sparse_classes_30k_train_010231
Implement the Python class `TFRecordSegmentationDataset` described below. Class description: Implement the TFRecordSegmentationDataset class. Method signatures and docstrings: - def __init__(self, tfrecord_paths: List[str], image_width: int, image_channels=3, mask_channels=1, seed=0, augmenter: Optional[Augmenter]=No...
Implement the Python class `TFRecordSegmentationDataset` described below. Class description: Implement the TFRecordSegmentationDataset class. Method signatures and docstrings: - def __init__(self, tfrecord_paths: List[str], image_width: int, image_channels=3, mask_channels=1, seed=0, augmenter: Optional[Augmenter]=No...
f40352e734f77609bcd5c4ad330ea73a897a217d
<|skeleton|> class TFRecordSegmentationDataset: def __init__(self, tfrecord_paths: List[str], image_width: int, image_channels=3, mask_channels=1, seed=0, augmenter: Optional[Augmenter]=None, seperate_background_channel: bool=True): """Image segmentation tf.data.Dataset constructor for batching from tfreco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TFRecordSegmentationDataset: def __init__(self, tfrecord_paths: List[str], image_width: int, image_channels=3, mask_channels=1, seed=0, augmenter: Optional[Augmenter]=None, seperate_background_channel: bool=True): """Image segmentation tf.data.Dataset constructor for batching from tfrecords. Args: tfr...
the_stack_v2_python_sparse
joint_train/data/input_fn.py
qilicun/mliis
train
0
e94f0719a87a3fea23ece170d9430681caaa266c
[ "if grid == []:\n return 0\nif len(grid) > 0:\n parent = [-1] * (len(grid) * len(grid[0]))\nchecks = {}\nfor row in range(len(grid)):\n for col in range(len(grid[row])):\n if grid[row][col] == 1:\n if row - 1 >= 0 and grid[row - 1][col] == 1:\n rParent = self.find(parent, (...
<|body_start_0|> if grid == []: return 0 if len(grid) > 0: parent = [-1] * (len(grid) * len(grid[0])) checks = {} for row in range(len(grid)): for col in range(len(grid[row])): if grid[row][col] == 1: if row - 1 >= 0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int if it is a one check all four neighbors and if it is a one then put in subset""" <|body_0|> def find(self, parent, node): """:type parent: List[] :rtype: int""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_027887
2,057
no_license
[ { "docstring": ":type grid: List[List[str]] :rtype: int if it is a one check all four neighbors and if it is a one then put in subset", "name": "numIslands", "signature": "def numIslands(self, grid)" }, { "docstring": ":type parent: List[] :rtype: int", "name": "find", "signature": "def ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int if it is a one check all four neighbors and if it is a one then put in subset - def find(self, parent, node): ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int if it is a one check all four neighbors and if it is a one then put in subset - def find(self, parent, node): ...
d5b3c659e6617853464c57819c1f04828bb202ad
<|skeleton|> class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int if it is a one check all four neighbors and if it is a one then put in subset""" <|body_0|> def find(self, parent, node): """:type parent: List[] :rtype: int""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int if it is a one check all four neighbors and if it is a one then put in subset""" if grid == []: return 0 if len(grid) > 0: parent = [-1] * (len(grid) * len(grid[0])) checks ...
the_stack_v2_python_sparse
unionFind/numberOfIslands.py
davidyip50/WallBreakers
train
0
522e38d8d8e209522f73df52b27263cd65318ac0
[ "for i in range(int(c ** 0.5) + 1):\n j = int((c - i * i) ** 0.5)\n if i * i + j * j == c:\n return True\nreturn False", "i = 2\nwhile i * i <= c:\n if c % i == 0:\n cnt = 0\n while c % i == 0:\n c //= i\n cnt += 1\n if i % 4 == 3 and cnt % 2 != 0:\n ...
<|body_start_0|> for i in range(int(c ** 0.5) + 1): j = int((c - i * i) ** 0.5) if i * i + j * j == c: return True return False <|end_body_0|> <|body_start_1|> i = 2 while i * i <= c: if c % i == 0: cnt = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def judgeSquareSum_MK1(self, c: int) -> bool: """Time complexity: O(√clgc). Space complexity: O(1).""" <|body_0|> def judgeSquareSum_MK2(self, c: int) -> bool: """Fermat Theorem: Any positive number n is expressible as a sum of two squares if and only if th...
stack_v2_sparse_classes_36k_train_027888
985
no_license
[ { "docstring": "Time complexity: O(√clgc). Space complexity: O(1).", "name": "judgeSquareSum_MK1", "signature": "def judgeSquareSum_MK1(self, c: int) -> bool" }, { "docstring": "Fermat Theorem: Any positive number n is expressible as a sum of two squares if and only if the prime factorization of...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum_MK1(self, c: int) -> bool: Time complexity: O(√clgc). Space complexity: O(1). - def judgeSquareSum_MK2(self, c: int) -> bool: Fermat Theorem: Any positive numb...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum_MK1(self, c: int) -> bool: Time complexity: O(√clgc). Space complexity: O(1). - def judgeSquareSum_MK2(self, c: int) -> bool: Fermat Theorem: Any positive numb...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def judgeSquareSum_MK1(self, c: int) -> bool: """Time complexity: O(√clgc). Space complexity: O(1).""" <|body_0|> def judgeSquareSum_MK2(self, c: int) -> bool: """Fermat Theorem: Any positive number n is expressible as a sum of two squares if and only if th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def judgeSquareSum_MK1(self, c: int) -> bool: """Time complexity: O(√clgc). Space complexity: O(1).""" for i in range(int(c ** 0.5) + 1): j = int((c - i * i) ** 0.5) if i * i + j * j == c: return True return False def judgeSquareSu...
the_stack_v2_python_sparse
0633. Sum of Square Numbers/Solution.py
faterazer/LeetCode
train
4
2a793dad8a047ed5bf32b4ccfa5bc9dc0f6441e3
[ "if not preorder or not inorder:\n return None\nval = preorder.pop(0)\nroot_node = TreeNode(val)\nroot_index = inorder.index(val)\nleft_pre = preorder[:root_index]\nleft_in = inorder[:root_index]\nright_pre = preorder[root_index:]\nright_in = inorder[root_index + 1:]\nroot_node.left = self.buildTree(left_pre, le...
<|body_start_0|> if not preorder or not inorder: return None val = preorder.pop(0) root_node = TreeNode(val) root_index = inorder.index(val) left_pre = preorder[:root_index] left_in = inorder[:root_index] right_pre = preorder[root_index:] right...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """先确定根节点:根节点是前序遍历的第一个元素 再在中序遍历中确定左右子树的个数:根节点左边是左子树,根节点右边是右子树 递归这个过程 :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTree1(self, preorder, inorder): """力扣官方解法 :type preorder:...
stack_v2_sparse_classes_36k_train_027889
3,589
no_license
[ { "docstring": "先确定根节点:根节点是前序遍历的第一个元素 再在中序遍历中确定左右子树的个数:根节点左边是左子树,根节点右边是右子树 递归这个过程 :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, preorder, inorder)" }, { "docstring": "力扣官方解法 :type preorder: List[int] :type inorder: Li...
2
stack_v2_sparse_classes_30k_train_003041
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): 先确定根节点:根节点是前序遍历的第一个元素 再在中序遍历中确定左右子树的个数:根节点左边是左子树,根节点右边是右子树 递归这个过程 :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode - de...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): 先确定根节点:根节点是前序遍历的第一个元素 再在中序遍历中确定左右子树的个数:根节点左边是左子树,根节点右边是右子树 递归这个过程 :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode - de...
a3a1556abc5adb9325de54d64f9814e64b96db0f
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """先确定根节点:根节点是前序遍历的第一个元素 再在中序遍历中确定左右子树的个数:根节点左边是左子树,根节点右边是右子树 递归这个过程 :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTree1(self, preorder, inorder): """力扣官方解法 :type preorder:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, preorder, inorder): """先确定根节点:根节点是前序遍历的第一个元素 再在中序遍历中确定左右子树的个数:根节点左边是左子树,根节点右边是右子树 递归这个过程 :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" if not preorder or not inorder: return None val = preorder.pop(0) root_node ...
the_stack_v2_python_sparse
leetcode/tree/buildTree.py
BigerWANG/geek_algorithm
train
0
ed4febb5ee9c4cbb8787bbf48a3b01bed43c3ba1
[ "if Config.instance is None:\n Config.instance = Config.__Config()\nreturn Config.instance", "Config.instance = Config.__Config(path)\nif not os.path.exists(path + Config.CONFIG_NAME):\n print('No config file found in ' + path)\n exit(1)" ]
<|body_start_0|> if Config.instance is None: Config.instance = Config.__Config() return Config.instance <|end_body_0|> <|body_start_1|> Config.instance = Config.__Config(path) if not os.path.exists(path + Config.CONFIG_NAME): print('No config file found in ' + pa...
Config
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: def get_instance(): """implementation of singleton design pattern""" <|body_0|> def set_instance(path): """implementation of singleton design pattern @param path String where config should be stored""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027890
3,889
permissive
[ { "docstring": "implementation of singleton design pattern", "name": "get_instance", "signature": "def get_instance()" }, { "docstring": "implementation of singleton design pattern @param path String where config should be stored", "name": "set_instance", "signature": "def set_instance(p...
2
stack_v2_sparse_classes_30k_train_007003
Implement the Python class `Config` described below. Class description: Implement the Config class. Method signatures and docstrings: - def get_instance(): implementation of singleton design pattern - def set_instance(path): implementation of singleton design pattern @param path String where config should be stored
Implement the Python class `Config` described below. Class description: Implement the Config class. Method signatures and docstrings: - def get_instance(): implementation of singleton design pattern - def set_instance(path): implementation of singleton design pattern @param path String where config should be stored ...
701d935dd215bfd9a4810a4430973b33fecec257
<|skeleton|> class Config: def get_instance(): """implementation of singleton design pattern""" <|body_0|> def set_instance(path): """implementation of singleton design pattern @param path String where config should be stored""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Config: def get_instance(): """implementation of singleton design pattern""" if Config.instance is None: Config.instance = Config.__Config() return Config.instance def set_instance(path): """implementation of singleton design pattern @param path String where co...
the_stack_v2_python_sparse
Kaspa/config.py
karim-awad/kaspa
train
0
8b090c85807616328655677f860db8276c8c078e
[ "super().__init__(name=name)\nself._loss = loss if loss is not None else tf.keras.losses.BinaryCrossentropy()\nself._ranking_metrics = metrics or []\nself._prediction_metrics = prediction_metrics or []\nself._label_metrics = label_metrics or []\nself._loss_metrics = loss_metrics or []", "loss = self._loss(y_true=...
<|body_start_0|> super().__init__(name=name) self._loss = loss if loss is not None else tf.keras.losses.BinaryCrossentropy() self._ranking_metrics = metrics or [] self._prediction_metrics = prediction_metrics or [] self._label_metrics = label_metrics or [] self._loss_metr...
A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few dozen candidates. This task helps wit...
Ranking
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ranking: """A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few do...
stack_v2_sparse_classes_36k_train_027891
4,074
permissive
[ { "docstring": "Initializes the task. Args: loss: Loss function. Defaults to BinaryCrossentropy. metrics: List of Keras metrics to be evaluated. prediction_metrics: List of Keras metrics used to summarize the predictions. label_metrics: List of Keras metrics used to summarize the labels. loss_metrics: List of K...
2
stack_v2_sparse_classes_30k_train_009303
Implement the Python class `Ranking` described below. Class description: A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model t...
Implement the Python class `Ranking` described below. Class description: A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model t...
f4f42c1a183a262539e21f5ab8d25f0dc3e5621d
<|skeleton|> class Ranking: """A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few do...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ranking: """A ranking task. Recommender systems are often composed of two components: - a retrieval model, retrieving O(thousands) candidates from a corpus of O(millions) candidates. - a ranker model, scoring the candidates retrieved by the retrieval model to return a ranked shortlist of a few dozen candidate...
the_stack_v2_python_sparse
tensorflow_recommenders/tasks/ranking.py
tensorflow/recommenders
train
1,666
cefae31dd48354d56cbb8ece4e781e777e347f05
[ "self.g = tf.Graph()\nwith self.g.as_default():\n self.session = tf.Session()\n model = load_cnn(self.session, modelname, run)\n self.params = model.params\n image_shape = [1] + model.params.image_dim\n optim = optimizer(lr)\n self.input_placeholder = tf.placeholder(tf.float32, shape=image_shape, ...
<|body_start_0|> self.g = tf.Graph() with self.g.as_default(): self.session = tf.Session() model = load_cnn(self.session, modelname, run) self.params = model.params image_shape = [1] + model.params.image_dim optim = optimizer(lr) se...
Class for creating fooling images against a CNNClassifier model
FoolingModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FoolingModel: """Class for creating fooling images against a CNNClassifier model""" def __init__(self, modelname, run=None, min_valid=0.0, max_valid=1.0, lr=0.0005, optimizer=tf.train.GradientDescentOptimizer): """Defines the operations for creating fooling images based on the input ...
stack_v2_sparse_classes_36k_train_027892
8,339
permissive
[ { "docstring": "Defines the operations for creating fooling images based on the input model. A 'fooling' variable-scope is used so that optimizers which create variables, such as Adam, can have those variables accessed and re-initialized separately from the main model. Inputs: - modelname: name used in the CNN ...
3
stack_v2_sparse_classes_30k_train_017720
Implement the Python class `FoolingModel` described below. Class description: Class for creating fooling images against a CNNClassifier model Method signatures and docstrings: - def __init__(self, modelname, run=None, min_valid=0.0, max_valid=1.0, lr=0.0005, optimizer=tf.train.GradientDescentOptimizer): Defines the o...
Implement the Python class `FoolingModel` described below. Class description: Class for creating fooling images against a CNNClassifier model Method signatures and docstrings: - def __init__(self, modelname, run=None, min_valid=0.0, max_valid=1.0, lr=0.0005, optimizer=tf.train.GradientDescentOptimizer): Defines the o...
24c354db961e5e620557c8f4d4d960bea05f3f7d
<|skeleton|> class FoolingModel: """Class for creating fooling images against a CNNClassifier model""" def __init__(self, modelname, run=None, min_valid=0.0, max_valid=1.0, lr=0.0005, optimizer=tf.train.GradientDescentOptimizer): """Defines the operations for creating fooling images based on the input ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FoolingModel: """Class for creating fooling images against a CNNClassifier model""" def __init__(self, modelname, run=None, min_valid=0.0, max_valid=1.0, lr=0.0005, optimizer=tf.train.GradientDescentOptimizer): """Defines the operations for creating fooling images based on the input model. A 'foo...
the_stack_v2_python_sparse
fooling_images.py
vogelta/vogelta.github.io
train
0
98d1d8a708a1b16ac650b4e544af3495781d7e19
[ "tenant_id = self.request.user.tenant_id\nipsecsiteconnections = api.vpn.ipsecsiteconnection_list(request, tenant_id=tenant_id)\nreturn {'items': [u.to_dict() for u in ipsecsiteconnections]}", "new_ipsecsiteconnection = api.vpn.ipsecsiteconnection_create(request, **request.DATA)\ni = api.vpn.ipsecsiteconnection_g...
<|body_start_0|> tenant_id = self.request.user.tenant_id ipsecsiteconnections = api.vpn.ipsecsiteconnection_list(request, tenant_id=tenant_id) return {'items': [u.to_dict() for u in ipsecsiteconnections]} <|end_body_0|> <|body_start_1|> new_ipsecsiteconnection = api.vpn.ipsecsiteconnect...
API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html
IPSecSiteConnections
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPSecSiteConnections: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of ikepolicies for a project The listing result is an object with property "items". Each item is a network.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_027893
11,907
permissive
[ { "docstring": "Get a list of ikepolicies for a project The listing result is an object with property \"items\". Each item is a network.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Create IPSecSiteConnection :param request: request context :param name: name for IPSe...
2
stack_v2_sparse_classes_30k_train_017054
Implement the Python class `IPSecSiteConnections` described below. Class description: API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html Method signatures and docstrings: - def get(self, request): Get a list of ikepolicies for a project The listing result is an object with property "it...
Implement the Python class `IPSecSiteConnections` described below. Class description: API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html Method signatures and docstrings: - def get(self, request): Get a list of ikepolicies for a project The listing result is an object with property "it...
9524f1952461c83db485d5d1702c350b158d7ce0
<|skeleton|> class IPSecSiteConnections: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of ikepolicies for a project The listing result is an object with property "items". Each item is a network.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPSecSiteConnections: """API for Neutron Networks http://developer.openstack.org/api-ref-networking-v2.html""" def get(self, request): """Get a list of ikepolicies for a project The listing result is an object with property "items". Each item is a network.""" tenant_id = self.request.user...
the_stack_v2_python_sparse
easystack_dashboard/api/rest/vpn.py
oksbsb/horizon-acc
train
0
5a9bc394abfec97c2ed61fdca423b0a26c146d42
[ "threading.Thread.__init__(self)\nself.taskBuffer = taskBuffer\nif log_stream:\n self.log_stream = log_stream\nelse:\n self.log_stream = _logger\nif hasattr(panda_config, 'CRIC_URL_SCHEDCONFIG'):\n self.CRIC_URL_TAGS = panda_config.CRIC_URL_TAGS\nelse:\n self.CRIC_URL_TAGS = 'https://atlas-cric.cern.ch/...
<|body_start_0|> threading.Thread.__init__(self) self.taskBuffer = taskBuffer if log_stream: self.log_stream = log_stream else: self.log_stream = _logger if hasattr(panda_config, 'CRIC_URL_SCHEDCONFIG'): self.CRIC_URL_TAGS = panda_config.CRIC_U...
Downloads the CRIC tags dump, flattens it out and stores it in the DB, one row per queue
SWTagsDumper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SWTagsDumper: """Downloads the CRIC tags dump, flattens it out and stores it in the DB, one row per queue""" def __init__(self, taskBuffer, log_stream=None): """Initialization and configuration""" <|body_0|> def run(self): """Principal function""" <|body_...
stack_v2_sparse_classes_36k_train_027894
38,097
permissive
[ { "docstring": "Initialization and configuration", "name": "__init__", "signature": "def __init__(self, taskBuffer, log_stream=None)" }, { "docstring": "Principal function", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_004128
Implement the Python class `SWTagsDumper` described below. Class description: Downloads the CRIC tags dump, flattens it out and stores it in the DB, one row per queue Method signatures and docstrings: - def __init__(self, taskBuffer, log_stream=None): Initialization and configuration - def run(self): Principal functi...
Implement the Python class `SWTagsDumper` described below. Class description: Downloads the CRIC tags dump, flattens it out and stores it in the DB, one row per queue Method signatures and docstrings: - def __init__(self, taskBuffer, log_stream=None): Initialization and configuration - def run(self): Principal functi...
365a9feb55d493b208e3052428f0b524e63e4178
<|skeleton|> class SWTagsDumper: """Downloads the CRIC tags dump, flattens it out and stores it in the DB, one row per queue""" def __init__(self, taskBuffer, log_stream=None): """Initialization and configuration""" <|body_0|> def run(self): """Principal function""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SWTagsDumper: """Downloads the CRIC tags dump, flattens it out and stores it in the DB, one row per queue""" def __init__(self, taskBuffer, log_stream=None): """Initialization and configuration""" threading.Thread.__init__(self) self.taskBuffer = taskBuffer if log_stream: ...
the_stack_v2_python_sparse
pandaserver/configurator/Configurator.py
PanDAWMS/panda-server
train
8
feaf07c7c3b3d32682df66b5a78281bf015e3829
[ "def add(num: int) -> None:\n for i in range(32):\n if not num >> i & 1:\n counter[i] += 1\n\ndef remove(num: int) -> int:\n repay = 0\n for i in range(32):\n if not num >> i & 1:\n if counter[i] == 1:\n repay |= 1 << i\n counter[i] -= 1\n re...
<|body_start_0|> def add(num: int) -> None: for i in range(32): if not num >> i & 1: counter[i] += 1 def remove(num: int) -> int: repay = 0 for i in range(32): if not num >> i & 1: if counter[i] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestCombination2(self, candidates: List[int]) -> int: """返回按位与结果大于 0 的 最长子数组 利用与运算的单调性 O(n*logA)""" <|body_0|> def largestCombination3(self, candidates: List[int]) -> int: """返回按位与结果大于 0 的 最长子数组 标记下该位上一个是 0 的位置在哪里 按位分开处理 O(n*logA)""" <|body_1...
stack_v2_sparse_classes_36k_train_027895
3,617
no_license
[ { "docstring": "返回按位与结果大于 0 的 最长子数组 利用与运算的单调性 O(n*logA)", "name": "largestCombination2", "signature": "def largestCombination2(self, candidates: List[int]) -> int" }, { "docstring": "返回按位与结果大于 0 的 最长子数组 标记下该位上一个是 0 的位置在哪里 按位分开处理 O(n*logA)", "name": "largestCombination3", "signature": "de...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestCombination2(self, candidates: List[int]) -> int: 返回按位与结果大于 0 的 最长子数组 利用与运算的单调性 O(n*logA) - def largestCombination3(self, candidates: List[int]) -> int: 返回按位与结果大于 0 的 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestCombination2(self, candidates: List[int]) -> int: 返回按位与结果大于 0 的 最长子数组 利用与运算的单调性 O(n*logA) - def largestCombination3(self, candidates: List[int]) -> int: 返回按位与结果大于 0 的 ...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def largestCombination2(self, candidates: List[int]) -> int: """返回按位与结果大于 0 的 最长子数组 利用与运算的单调性 O(n*logA)""" <|body_0|> def largestCombination3(self, candidates: List[int]) -> int: """返回按位与结果大于 0 的 最长子数组 标记下该位上一个是 0 的位置在哪里 按位分开处理 O(n*logA)""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestCombination2(self, candidates: List[int]) -> int: """返回按位与结果大于 0 的 最长子数组 利用与运算的单调性 O(n*logA)""" def add(num: int) -> None: for i in range(32): if not num >> i & 1: counter[i] += 1 def remove(num: int) -> int: ...
the_stack_v2_python_sparse
21_位运算/按位与/6065. 按位与结果大于零的最长子数组-按位统计.py
981377660LMT/algorithm-study
train
225
db21a3b853c6dbd661a00bc2ee6a1ae9393adcb6
[ "def dfs(n, k, memo):\n if n == 0:\n return 0\n if k == 1:\n return n\n if (n, k) not in memo:\n ans = float('inf')\n for x in range(1, n + 1):\n ans = min(ans, 1 + max(dfs(x - 1, k - 1, memo), dfs(n - x, k, memo)))\n memo[n, k] = ans\n return memo[n, k]\nre...
<|body_start_0|> def dfs(n, k, memo): if n == 0: return 0 if k == 1: return n if (n, k) not in memo: ans = float('inf') for x in range(1, n + 1): ans = min(ans, 1 + max(dfs(x - 1, k - 1, memo)...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def superEggDrop(self, K: int, N: int) -> int: """Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)""" <|body_0|> def superEggDrop(self, K: int, N: int) -> int: ...
stack_v2_sparse_classes_36k_train_027896
5,857
no_license
[ { "docstring": "Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)", "name": "superEggDrop", "signature": "def superEggDrop(self, K: int, N: int) -> int" }, { "docstring": "The above algorithm got TL...
5
stack_v2_sparse_classes_30k_test_000662
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop(self, K: int, N: int) -> int: Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop(self, K: int, N: int) -> int: Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def superEggDrop(self, K: int, N: int) -> int: """Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)""" <|body_0|> def superEggDrop(self, K: int, N: int) -> int: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def superEggDrop(self, K: int, N: int) -> int: """Intuition: dp[n][k] = min steps to check n floors with k eggs dp[n][k] = min(1 + max(dp[x-1][k-1], dp[n-x][k]) for all x) time O(KN^2), space O(KN)""" def dfs(n, k, memo): if n == 0: return 0 if...
the_stack_v2_python_sparse
Leetcode 0887. Super Egg Drop.py
Chaoran-sjsu/leetcode
train
0
cd820f5feccd5cba37a2d9b0fdcca63a7cb2dcdb
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
StringFormatterServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringFormatterServicer: def Upper(self, request, context): """makes all chars in string upper case""" <|body_0|> def Lower(self, request, context): """makes all chars in string lower case""" <|body_1|> def Proper(self, request, context): """make...
stack_v2_sparse_classes_36k_train_027897
2,935
no_license
[ { "docstring": "makes all chars in string upper case", "name": "Upper", "signature": "def Upper(self, request, context)" }, { "docstring": "makes all chars in string lower case", "name": "Lower", "signature": "def Lower(self, request, context)" }, { "docstring": "makes first char...
3
stack_v2_sparse_classes_30k_test_000866
Implement the Python class `StringFormatterServicer` described below. Class description: Implement the StringFormatterServicer class. Method signatures and docstrings: - def Upper(self, request, context): makes all chars in string upper case - def Lower(self, request, context): makes all chars in string lower case - ...
Implement the Python class `StringFormatterServicer` described below. Class description: Implement the StringFormatterServicer class. Method signatures and docstrings: - def Upper(self, request, context): makes all chars in string upper case - def Lower(self, request, context): makes all chars in string lower case - ...
e08127c22b39cc7d87de1713ca42c98dc3855b7d
<|skeleton|> class StringFormatterServicer: def Upper(self, request, context): """makes all chars in string upper case""" <|body_0|> def Lower(self, request, context): """makes all chars in string lower case""" <|body_1|> def Proper(self, request, context): """make...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StringFormatterServicer: def Upper(self, request, context): """makes all chars in string upper case""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def Lower(self, reques...
the_stack_v2_python_sparse
stringFormatter_grpc/stringFormatter_pb2_grpc.py
vzellmeister/ep_sistemas_distribuidos
train
0
3890bc3de624292f2203e9910ed70a1b0e1cdf3b
[ "super().__init__(*args, **kwargs)\nself.set_fields_from_dict(['dst_key', 'src_key', 'how_merge'])\nself.fields['how_merge'].required = False", "form_data = super().clean()\nself.store_fields_in_dict([('dst_key', None), ('src_key', None), ('how_merge', None)])\nif self.workflow.has_data_frame:\n if not form_da...
<|body_start_0|> super().__init__(*args, **kwargs) self.set_fields_from_dict(['dst_key', 'src_key', 'how_merge']) self.fields['how_merge'].required = False <|end_body_0|> <|body_start_1|> form_data = super().clean() self.store_fields_in_dict([('dst_key', None), ('src_key', None)...
Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method
ScheduleSQLUploadForm
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduleSQLUploadForm: """Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method""" ...
stack_v2_sparse_classes_36k_train_027898
2,781
permissive
[ { "docstring": "Initialize all the fields", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Store the fields in the Form Payload", "name": "clean", "signature": "def clean(self) -> Dict" } ]
2
stack_v2_sparse_classes_30k_train_012779
Implement the Python class `ScheduleSQLUploadForm` described below. Class description: Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: ...
Implement the Python class `ScheduleSQLUploadForm` described below. Class description: Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: ...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ScheduleSQLUploadForm: """Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScheduleSQLUploadForm: """Form to request info for the SQL scheduled upload Three blocks of information are requested: Block 1: Name, description, start -- frequency -- stop times Block 2: Parameters for the SQL connection Block 3: Parameters for the merge: Left/Right column + merge method""" def __init_...
the_stack_v2_python_sparse
ontask/scheduler/forms/sql.py
abelardopardo/ontask_b
train
43
204837e6365227f2b5c9259cee61720831530093
[ "m = MultiFileInput()\nself.assertTrue(m.needs_multipart_form)\nself.assertFalse(m.is_hidden)", "m = MultiFileInput({'count': 0})\nr = m.render(name='blah', value='bla', attrs={'id': 'test'})\nself.assert_('<input type=\"file\" name=\"blah[]\" id=\"test0\" />' in r)", "m = MultiFileInput()\nr = m.render(name='b...
<|body_start_0|> m = MultiFileInput() self.assertTrue(m.needs_multipart_form) self.assertFalse(m.is_hidden) <|end_body_0|> <|body_start_1|> m = MultiFileInput({'count': 0}) r = m.render(name='blah', value='bla', attrs={'id': 'test'}) self.assert_('<input type="file" name...
Tests for the widget itself.
MultiFileInputTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiFileInputTest: """Tests for the widget itself.""" def testBasics(self): """Make sure the basics are correct (needs_multipart_form & is_hidden).""" <|body_0|> def testNoRender(self): """Makes sure we show a minimum of 1 input box.""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_027899
3,598
no_license
[ { "docstring": "Make sure the basics are correct (needs_multipart_form & is_hidden).", "name": "testBasics", "signature": "def testBasics(self)" }, { "docstring": "Makes sure we show a minimum of 1 input box.", "name": "testNoRender", "signature": "def testNoRender(self)" }, { "d...
4
stack_v2_sparse_classes_30k_train_010960
Implement the Python class `MultiFileInputTest` described below. Class description: Tests for the widget itself. Method signatures and docstrings: - def testBasics(self): Make sure the basics are correct (needs_multipart_form & is_hidden). - def testNoRender(self): Makes sure we show a minimum of 1 input box. - def t...
Implement the Python class `MultiFileInputTest` described below. Class description: Tests for the widget itself. Method signatures and docstrings: - def testBasics(self): Make sure the basics are correct (needs_multipart_form & is_hidden). - def testNoRender(self): Makes sure we show a minimum of 1 input box. - def t...
2791145f62a7e296be859a400499812b394249e9
<|skeleton|> class MultiFileInputTest: """Tests for the widget itself.""" def testBasics(self): """Make sure the basics are correct (needs_multipart_form & is_hidden).""" <|body_0|> def testNoRender(self): """Makes sure we show a minimum of 1 input box.""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiFileInputTest: """Tests for the widget itself.""" def testBasics(self): """Make sure the basics are correct (needs_multipart_form & is_hidden).""" m = MultiFileInput() self.assertTrue(m.needs_multipart_form) self.assertFalse(m.is_hidden) def testNoRender(self): ...
the_stack_v2_python_sparse
combaragi/ccboard/tests.py
yonseics/yonseics
train
1