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
c6013f131a6b3e35cb594c75e7cd391dcc7d983f
[ "save_btn = True\nactive_page = 'code'\ncode_snippet = None\ncode_snippets = ()\npage_title = _('Code snippets')\nif slug:\n code_snippet = get_object_or_404(Code, slug=slug)\n active_page = f'code/{code_snippet.title}'\n page_title = code_snippet.title\n try:\n self.get_user(request, username)\n...
<|body_start_0|> save_btn = True active_page = 'code' code_snippet = None code_snippets = () page_title = _('Code snippets') if slug: code_snippet = get_object_or_404(Code, slug=slug) active_page = f'code/{code_snippet.title}' page_titl...
CodeView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeView: def get(self, request, slug=None, username=None): """Get list of user code snippets or user snippet.""" <|body_0|> def post(self, request, slug=None, username=None): """Save or create code snippet.""" <|body_1|> def delete(self, request, slug, ...
stack_v2_sparse_classes_36k_train_025500
30,576
permissive
[ { "docstring": "Get list of user code snippets or user snippet.", "name": "get", "signature": "def get(self, request, slug=None, username=None)" }, { "docstring": "Save or create code snippet.", "name": "post", "signature": "def post(self, request, slug=None, username=None)" }, { ...
3
stack_v2_sparse_classes_30k_test_000648
Implement the Python class `CodeView` described below. Class description: Implement the CodeView class. Method signatures and docstrings: - def get(self, request, slug=None, username=None): Get list of user code snippets or user snippet. - def post(self, request, slug=None, username=None): Save or create code snippet...
Implement the Python class `CodeView` described below. Class description: Implement the CodeView class. Method signatures and docstrings: - def get(self, request, slug=None, username=None): Get list of user code snippets or user snippet. - def post(self, request, slug=None, username=None): Save or create code snippet...
51a2ae2b29ae5c91a3cf7171f89edf225cc8a6f0
<|skeleton|> class CodeView: def get(self, request, slug=None, username=None): """Get list of user code snippets or user snippet.""" <|body_0|> def post(self, request, slug=None, username=None): """Save or create code snippet.""" <|body_1|> def delete(self, request, slug, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodeView: def get(self, request, slug=None, username=None): """Get list of user code snippets or user snippet.""" save_btn = True active_page = 'code' code_snippet = None code_snippets = () page_title = _('Code snippets') if slug: code_snippe...
the_stack_v2_python_sparse
tool/views/views.py
mikekeda/tools
train
0
d1cf2693d6534155191cf92b85d6544d2c307cd2
[ "data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]])\nself.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea')\nself.plugin = DifferenceBetweenAdjacentGridSquares()", "expected = np.array([[1, 1], [2, 2], [5, 5]])\nresult = self.plugin.calculate_difference(self.cube, self.cube.coord(axis='x').n...
<|body_start_0|> data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea') self.plugin = DifferenceBetweenAdjacentGridSquares() <|end_body_0|> <|body_start_1|> expected = np.array([[1, 1], [2, 2], [5, 5]]) res...
Test the calculate_difference method.
Test_calculate_difference
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_calculate_difference: """Test the calculate_difference method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_x_dimension(self): """Test differences calculated along the x dimension.""" <|body_1|> def test_y_dimension(self): ...
stack_v2_sparse_classes_36k_train_025501
8,701
permissive
[ { "docstring": "Set up cube.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test differences calculated along the x dimension.", "name": "test_x_dimension", "signature": "def test_x_dimension(self)" }, { "docstring": "Test differences calculated along the y ...
5
null
Implement the Python class `Test_calculate_difference` described below. Class description: Test the calculate_difference method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_x_dimension(self): Test differences calculated along the x dimension. - def test_y_dimension(self): Test differe...
Implement the Python class `Test_calculate_difference` described below. Class description: Test the calculate_difference method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_x_dimension(self): Test differences calculated along the x dimension. - def test_y_dimension(self): Test differe...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_calculate_difference: """Test the calculate_difference method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_x_dimension(self): """Test differences calculated along the x dimension.""" <|body_1|> def test_y_dimension(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_calculate_difference: """Test the calculate_difference method.""" def setUp(self): """Set up cube.""" data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea') self.plugin = DifferenceBetweenAdjacen...
the_stack_v2_python_sparse
improver_tests/utilities/test_DifferenceBetweenAdjacentGridSquares.py
metoppv/improver
train
101
79fe33879daaf7191e44567c3d43c9c598e32f2b
[ "children = []\nfor path in paths:\n path = Path(path)\n if path.suffix.lower() in ('.jpg', '.jpeg'):\n upload_id, width, height = self.photo_rupload(path, to_album=True)\n children.append({'upload_id': upload_id, 'edits': dumps({'crop_original_size': [width, height], 'crop_center': [0.0, -0.0],...
<|body_start_0|> children = [] for path in paths: path = Path(path) if path.suffix.lower() in ('.jpg', '.jpeg'): upload_id, width, height = self.photo_rupload(path, to_album=True) children.append({'upload_id': upload_id, 'edits': dumps({'crop_origi...
UploadAlbumMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadAlbumMixin: def album_upload(self, paths: List[Path], caption: str, usertags: List[Usertag]=[], location: Location=None, configure_timeout: int=3, configure_handler=None, configure_exception=None, to_story=False) -> Media: """Upload album to feed Parameters ---------- paths: List[P...
stack_v2_sparse_classes_36k_train_025502
8,777
permissive
[ { "docstring": "Upload album to feed Parameters ---------- paths: List[Path] List of paths for media to upload caption: str Media caption usertags: List[Usertag], optional List of users to be tagged on this upload, default is empty list. location: Location, optional Location tag for this upload, default is none...
2
stack_v2_sparse_classes_30k_train_014017
Implement the Python class `UploadAlbumMixin` described below. Class description: Implement the UploadAlbumMixin class. Method signatures and docstrings: - def album_upload(self, paths: List[Path], caption: str, usertags: List[Usertag]=[], location: Location=None, configure_timeout: int=3, configure_handler=None, con...
Implement the Python class `UploadAlbumMixin` described below. Class description: Implement the UploadAlbumMixin class. Method signatures and docstrings: - def album_upload(self, paths: List[Path], caption: str, usertags: List[Usertag]=[], location: Location=None, configure_timeout: int=3, configure_handler=None, con...
14922b4038de0b693c6dd396c7ee0b57e626f32e
<|skeleton|> class UploadAlbumMixin: def album_upload(self, paths: List[Path], caption: str, usertags: List[Usertag]=[], location: Location=None, configure_timeout: int=3, configure_handler=None, configure_exception=None, to_story=False) -> Media: """Upload album to feed Parameters ---------- paths: List[P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UploadAlbumMixin: def album_upload(self, paths: List[Path], caption: str, usertags: List[Usertag]=[], location: Location=None, configure_timeout: int=3, configure_handler=None, configure_exception=None, to_story=False) -> Media: """Upload album to feed Parameters ---------- paths: List[Path] List of p...
the_stack_v2_python_sparse
instagrapi/mixins/album.py
bedefaced/instagrapi
train
1
ed41bfc5515008d62eee2b4e11ec55f39c8710c4
[ "query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nform = ClientForm()\nlist_client = None\nif query:\n list_client = Client.objects.filter(Q(name__icontains=query) | Q(phone__icontains=query) | Q(email__icontains=query))\nelse:\n list_client = Client.objects.all()\npage = request.GET.get(...
<|body_start_0|> query = request.GET.get('q') sort = request.GET.get('sort', 'name') form = ClientForm() list_client = None if query: list_client = Client.objects.filter(Q(name__icontains=query) | Q(phone__icontains=query) | Q(email__icontains=query)) else: ...
Clase para crear un servidor
NewClientView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NewClientView: """Clase para crear un servidor""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = request.GET.g...
stack_v2_sparse_classes_36k_train_025503
22,221
no_license
[ { "docstring": "Método get", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Método post", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_009038
Implement the Python class `NewClientView` described below. Class description: Clase para crear un servidor Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post
Implement the Python class `NewClientView` described below. Class description: Clase para crear un servidor Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post <|skeleton|> class NewClientView: """Clase para crear un serv...
e28e2d968372609ad396c42fb572a00c2410a117
<|skeleton|> class NewClientView: """Clase para crear un servidor""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NewClientView: """Clase para crear un servidor""" def get(self, request, *args, **kwargs): """Método get""" query = request.GET.get('q') sort = request.GET.get('sort', 'name') form = ClientForm() list_client = None if query: list_client = Client...
the_stack_v2_python_sparse
list/views.py
damaos/server_list2
train
0
6dbbb0165a3e7b4a8f5c1900e13b0dda93327c4f
[ "super(ERDBLayer, self).__init__()\nself.SFENet2 = ops.Conv2d(G0, G0, kSize, padding=(kSize - 1) // 2, stride=1)\nb_in_chan = G0\nb_out_chan = 0\nConc_all = 0\nERDBs = ops.MoudleList()\nfor i in range(len(arch)):\n name = arch[i]\n key = name.split('_')\n if i > 0:\n b_in_chan = b_out_chan\n b_co...
<|body_start_0|> super(ERDBLayer, self).__init__() self.SFENet2 = ops.Conv2d(G0, G0, kSize, padding=(kSize - 1) // 2, stride=1) b_in_chan = G0 b_out_chan = 0 Conc_all = 0 ERDBs = ops.MoudleList() for i in range(len(arch)): name = arch[i] ke...
Create ERDBLayer Searchspace.
ERDBLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ERDBLayer: """Create ERDBLayer Searchspace.""" def __init__(self, arch, G0, kSize): """Create ERDBLayer. :param arch: arch :type arch: dict :param G0: G0 :type G0: G0 :param kSize: kSize :type kSize: int""" <|body_0|> def call(self, inputs): """Calculate the outp...
stack_v2_sparse_classes_36k_train_025504
14,306
permissive
[ { "docstring": "Create ERDBLayer. :param arch: arch :type arch: dict :param G0: G0 :type G0: G0 :param kSize: kSize :type kSize: int", "name": "__init__", "signature": "def __init__(self, arch, G0, kSize)" }, { "docstring": "Calculate the output of the model. :param x: input tensor :type x: tens...
2
null
Implement the Python class `ERDBLayer` described below. Class description: Create ERDBLayer Searchspace. Method signatures and docstrings: - def __init__(self, arch, G0, kSize): Create ERDBLayer. :param arch: arch :type arch: dict :param G0: G0 :type G0: G0 :param kSize: kSize :type kSize: int - def call(self, inputs...
Implement the Python class `ERDBLayer` described below. Class description: Create ERDBLayer Searchspace. Method signatures and docstrings: - def __init__(self, arch, G0, kSize): Create ERDBLayer. :param arch: arch :type arch: dict :param G0: G0 :type G0: G0 :param kSize: kSize :type kSize: int - def call(self, inputs...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ERDBLayer: """Create ERDBLayer Searchspace.""" def __init__(self, arch, G0, kSize): """Create ERDBLayer. :param arch: arch :type arch: dict :param G0: G0 :type G0: G0 :param kSize: kSize :type kSize: int""" <|body_0|> def call(self, inputs): """Calculate the outp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ERDBLayer: """Create ERDBLayer Searchspace.""" def __init__(self, arch, G0, kSize): """Create ERDBLayer. :param arch: arch :type arch: dict :param G0: G0 :type G0: G0 :param kSize: kSize :type kSize: int""" super(ERDBLayer, self).__init__() self.SFENet2 = ops.Conv2d(G0, G0, kSize,...
the_stack_v2_python_sparse
zeus/networks/erdb_esr.py
huawei-noah/xingtian
train
308
744f5688727cef7d9e61a7743aee29b734624260
[ "def minFunc(param):\n \"\"\" The function to minimize - negative log likelihood\n of the data given the parameters \"\"\"\n logLikelihood = GeneralizedParetoDistribution.logLikelihood(param[0], param[1], data)\n return -logLikelihood if logLikelihood is not None else np.inf\nparams, bestCost, ...
<|body_start_0|> def minFunc(param): """ The function to minimize - negative log likelihood of the data given the parameters """ logLikelihood = GeneralizedParetoDistribution.logLikelihood(param[0], param[1], data) return -logLikelihood if logLikelihood i...
GpdEstimate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GpdEstimate: def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): """PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positi...
stack_v2_sparse_classes_36k_train_025505
8,218
no_license
[ { "docstring": "PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positions of the particles in the parameter space, it is a numpy array of shape (numParticles, 2) :param inertiaCoeff: coefficient used for updatin...
2
null
Implement the Python class `GpdEstimate` described below. Class description: Implement the GpdEstimate class. Method signatures and docstrings: - def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): PSO method for maximum likelihood estimation of GPD's p...
Implement the Python class `GpdEstimate` described below. Class description: Implement the GpdEstimate class. Method signatures and docstrings: - def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): PSO method for maximum likelihood estimation of GPD's p...
62f6fa0d5e832d2d1786eae729d9462b78d9b459
<|skeleton|> class GpdEstimate: def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): """PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GpdEstimate: def psoMethod(data, initialPos, inertiaCoeff=1, inertiaDamp=0.99, personalCoeff=2, socialCoeff=2, numIterations=20): """PSO method for maximum likelihood estimation of GPD's parameters :param data: the data, it is a numpy array of shape (n,) :param initialPos: initial positions of the par...
the_stack_v2_python_sparse
ts/experimental/genpareto.py
tedlaw09/time_series_forecaster
train
1
7e4eafa7313a163b6f638190d4aecc7070f00924
[ "cls.wdgNameDic['winName'] = 'texSwitcherWin'\nif cmds.window(cls.wdgNameDic['winName'], exists=True):\n cmds.deleteUI(cls.wdgNameDic['winName'])\ncls.ui()\ncls.addAssetUi()", "cmds.window(cls.wdgNameDic['winName'], title='Texture Switcher')\ncls.wdgNameDic['mainColLo'] = cmds.columnLayout(p=cls.wdgNameDic['wi...
<|body_start_0|> cls.wdgNameDic['winName'] = 'texSwitcherWin' if cmds.window(cls.wdgNameDic['winName'], exists=True): cmds.deleteUI(cls.wdgNameDic['winName']) cls.ui() cls.addAssetUi() <|end_body_0|> <|body_start_1|> cmds.window(cls.wdgNameDic['winName'], title='Text...
Main class.
MainUI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainUI: """Main class.""" def __init__(cls): """Delete window if window already exists then show window.""" <|body_0|> def ui(cls): """Build main ui.""" <|body_1|> def addAssetUi(cls): """Add asset ui in main window.""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_025506
5,877
no_license
[ { "docstring": "Delete window if window already exists then show window.", "name": "__init__", "signature": "def __init__(cls)" }, { "docstring": "Build main ui.", "name": "ui", "signature": "def ui(cls)" }, { "docstring": "Add asset ui in main window.", "name": "addAssetUi",...
5
null
Implement the Python class `MainUI` described below. Class description: Main class. Method signatures and docstrings: - def __init__(cls): Delete window if window already exists then show window. - def ui(cls): Build main ui. - def addAssetUi(cls): Add asset ui in main window. - def getRefFileTexLs(cls, refNodeNamesp...
Implement the Python class `MainUI` described below. Class description: Main class. Method signatures and docstrings: - def __init__(cls): Delete window if window already exists then show window. - def ui(cls): Build main ui. - def addAssetUi(cls): Add asset ui in main window. - def getRefFileTexLs(cls, refNodeNamesp...
bd98679cbab869a0c96eac34cb2f199dfbf8fee8
<|skeleton|> class MainUI: """Main class.""" def __init__(cls): """Delete window if window already exists then show window.""" <|body_0|> def ui(cls): """Build main ui.""" <|body_1|> def addAssetUi(cls): """Add asset ui in main window.""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainUI: """Main class.""" def __init__(cls): """Delete window if window already exists then show window.""" cls.wdgNameDic['winName'] = 'texSwitcherWin' if cmds.window(cls.wdgNameDic['winName'], exists=True): cmds.deleteUI(cls.wdgNameDic['winName']) cls.ui() ...
the_stack_v2_python_sparse
python/tak_texSwitcher.py
jasonbrackman/scripts
train
0
43174e2aa493941c76458b33a3094c2a08bc746f
[ "for flash_dom in self.find_elements('.flash'):\n if flash_dom.text == text:\n return\n print(flash_dom.text)\nraise AssertionError(f'Flash not found for text \"{text}\"')", "self.open(base_url + '/login')\nself.input('#email', email)\nself.input('#password', password)\nself.click('#btn-submit')" ]
<|body_start_0|> for flash_dom in self.find_elements('.flash'): if flash_dom.text == text: return print(flash_dom.text) raise AssertionError(f'Flash not found for text "{text}"') <|end_body_0|> <|body_start_1|> self.open(base_url + '/login') self....
Selenium base case with some GeekSeek utilities
GeekBaseCase
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeekBaseCase: """Selenium base case with some GeekSeek utilities""" def assert_flash(self, text): """asserts that message exists in flashes""" <|body_0|> def login_test_user(self, email=TEST_USER.email, password='test_frontend'): """login our test user""" ...
stack_v2_sparse_classes_36k_train_025507
1,320
permissive
[ { "docstring": "asserts that message exists in flashes", "name": "assert_flash", "signature": "def assert_flash(self, text)" }, { "docstring": "login our test user", "name": "login_test_user", "signature": "def login_test_user(self, email=TEST_USER.email, password='test_frontend')" } ]
2
stack_v2_sparse_classes_30k_train_011599
Implement the Python class `GeekBaseCase` described below. Class description: Selenium base case with some GeekSeek utilities Method signatures and docstrings: - def assert_flash(self, text): asserts that message exists in flashes - def login_test_user(self, email=TEST_USER.email, password='test_frontend'): login our...
Implement the Python class `GeekBaseCase` described below. Class description: Selenium base case with some GeekSeek utilities Method signatures and docstrings: - def assert_flash(self, text): asserts that message exists in flashes - def login_test_user(self, email=TEST_USER.email, password='test_frontend'): login our...
73f6bdcbd2f382a54dfec3e0e79120bd60c9513f
<|skeleton|> class GeekBaseCase: """Selenium base case with some GeekSeek utilities""" def assert_flash(self, text): """asserts that message exists in flashes""" <|body_0|> def login_test_user(self, email=TEST_USER.email, password='test_frontend'): """login our test user""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeekBaseCase: """Selenium base case with some GeekSeek utilities""" def assert_flash(self, text): """asserts that message exists in flashes""" for flash_dom in self.find_elements('.flash'): if flash_dom.text == text: return print(flash_dom.text) ...
the_stack_v2_python_sparse
qa327_test/frontend/geek_base.py
nicoleooi/cmpe327
train
0
261c83a8f57d74f0d9b26a411b057c0e78bd5861
[ "if not nums:\n return 0\ncount = 0\nfor i in range(1, len(nums)):\n if nums[count] != nums[i]:\n count += 1\n nums[count] = nums[i]\nreturn count + 1", "if not nums:\n return 0\nfor i in range(len(nums) - 1, 0, -1):\n if nums[i] == nums[i - 1]:\n nums.pop(i)\nreturn len(nums)" ]
<|body_start_0|> if not nums: return 0 count = 0 for i in range(1, len(nums)): if nums[count] != nums[i]: count += 1 nums[count] = nums[i] return count + 1 <|end_body_0|> <|body_start_1|> if not nums: return 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeDuplicates(self, nums: list) -> int: """双指针法 1. 定义count表示数组中不重复的数字的个数,同时,count表示慢指针 2. 定义快指针i,从1开始到数组末尾 3. 开始循环: 3.1 当nums[count] == nums[i]时,i向后移动,跳过重复值 3.2 当其不相等时,说明重复值已经全部跳过,此时i指向的值是下一个不重复的值,则count自增 并且,要将nums[i]的值赋给nums[count](即将这个不重复的值往前提,因为不需要考虑超出新长度的元素)""" ...
stack_v2_sparse_classes_36k_train_025508
1,659
no_license
[ { "docstring": "双指针法 1. 定义count表示数组中不重复的数字的个数,同时,count表示慢指针 2. 定义快指针i,从1开始到数组末尾 3. 开始循环: 3.1 当nums[count] == nums[i]时,i向后移动,跳过重复值 3.2 当其不相等时,说明重复值已经全部跳过,此时i指向的值是下一个不重复的值,则count自增 并且,要将nums[i]的值赋给nums[count](即将这个不重复的值往前提,因为不需要考虑超出新长度的元素)", "name": "removeDuplicates", "signature": "def removeDuplicates(se...
2
stack_v2_sparse_classes_30k_train_014383
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums: list) -> int: 双指针法 1. 定义count表示数组中不重复的数字的个数,同时,count表示慢指针 2. 定义快指针i,从1开始到数组末尾 3. 开始循环: 3.1 当nums[count] == nums[i]时,i向后移动,跳过重复值 3.2 当其不相等时,说明重复值已...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeDuplicates(self, nums: list) -> int: 双指针法 1. 定义count表示数组中不重复的数字的个数,同时,count表示慢指针 2. 定义快指针i,从1开始到数组末尾 3. 开始循环: 3.1 当nums[count] == nums[i]时,i向后移动,跳过重复值 3.2 当其不相等时,说明重复值已...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def removeDuplicates(self, nums: list) -> int: """双指针法 1. 定义count表示数组中不重复的数字的个数,同时,count表示慢指针 2. 定义快指针i,从1开始到数组末尾 3. 开始循环: 3.1 当nums[count] == nums[i]时,i向后移动,跳过重复值 3.2 当其不相等时,说明重复值已经全部跳过,此时i指向的值是下一个不重复的值,则count自增 并且,要将nums[i]的值赋给nums[count](即将这个不重复的值往前提,因为不需要考虑超出新长度的元素)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeDuplicates(self, nums: list) -> int: """双指针法 1. 定义count表示数组中不重复的数字的个数,同时,count表示慢指针 2. 定义快指针i,从1开始到数组末尾 3. 开始循环: 3.1 当nums[count] == nums[i]时,i向后移动,跳过重复值 3.2 当其不相等时,说明重复值已经全部跳过,此时i指向的值是下一个不重复的值,则count自增 并且,要将nums[i]的值赋给nums[count](即将这个不重复的值往前提,因为不需要考虑超出新长度的元素)""" if not num...
the_stack_v2_python_sparse
algorithm/leetcode/list/14-删除排序数组中的重复项.py
lxconfig/UbuntuCode_bak
train
0
9efa26e5cb64d9ffc3c127aca2f5a311b6c37607
[ "self.d = {}\nself.cap = capacity\nself.head = Node(-1, -1, None)\nList.init_head(self.head)", "if key not in self.d:\n return -1\nself.d[key].hit()\nreturn self.d[key].value", "if self.cap == 0:\n return\nif key in self.d:\n self.d[key].hit()\n self.d[key].value = value\nelse:\n if len(self.d) >...
<|body_start_0|> self.d = {} self.cap = capacity self.head = Node(-1, -1, None) List.init_head(self.head) <|end_body_0|> <|body_start_1|> if key not in self.d: return -1 self.d[key].hit() return self.d[key].value <|end_body_1|> <|body_start_2|> ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:param capacity: int""" <|body_0|> def get(self, key): """:param key: int :return: int""" <|body_1|> def put(self, key, value): """:param key: int :param value: int :return: None""" <|body_2|> <...
stack_v2_sparse_classes_36k_train_025509
2,657
no_license
[ { "docstring": ":param capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":param key: int :return: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":param key: int :param value: int :return: None", "name...
3
null
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :param capacity: int - def get(self, key): :param key: int :return: int - def put(self, key, value): :param key: int :param value: int :return: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :param capacity: int - def get(self, key): :param key: int :return: int - def put(self, key, value): :param key: int :param value: int :return: None...
ca4dacda39dc12d53ed8d4448b3356a3f2936603
<|skeleton|> class LRUCache: def __init__(self, capacity): """:param capacity: int""" <|body_0|> def get(self, key): """:param key: int :return: int""" <|body_1|> def put(self, key, value): """:param key: int :param value: int :return: None""" <|body_2|> <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:param capacity: int""" self.d = {} self.cap = capacity self.head = Node(-1, -1, None) List.init_head(self.head) def get(self, key): """:param key: int :return: int""" if key not in self.d: retu...
the_stack_v2_python_sparse
hard/lru-cache.py
lcqbit11/algorithms
train
0
cb3a98b0d2ba93027f2cb4e6fdf4c3b270f093c1
[ "super().__init__()\nassert len(radius) == len(nsamples) == len(mlps)\nself.npoint = npoint\nself.nsamples = nsamples\nself.radius = radius\nself.mlps = mlps\nself.fps = FarthestPointSample(npoint)\nself.mlp_layers = nn.ModuleList()\nself.query_ball_point = nn.ModuleList()\nfor mlp, radiu, nsample in zip(mlps, radi...
<|body_start_0|> super().__init__() assert len(radius) == len(nsamples) == len(mlps) self.npoint = npoint self.nsamples = nsamples self.radius = radius self.mlps = mlps self.fps = FarthestPointSample(npoint) self.mlp_layers = nn.ModuleList() self.q...
_BasePointnetMSGModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BasePointnetMSGModule: def __init__(self, npoint: int, radius: list, nsamples: list, mlps: list): """npoint : point number for fps sampling nsamples : sample point numbers for each radius""" <|body_0|> def forward(self, pc, feat): """input --------------- pc : B x 3...
stack_v2_sparse_classes_36k_train_025510
3,923
no_license
[ { "docstring": "npoint : point number for fps sampling nsamples : sample point numbers for each radius", "name": "__init__", "signature": "def __init__(self, npoint: int, radius: list, nsamples: list, mlps: list)" }, { "docstring": "input --------------- pc : B x 3 x N feat : B x C x N output --...
2
stack_v2_sparse_classes_30k_train_015000
Implement the Python class `_BasePointnetMSGModule` described below. Class description: Implement the _BasePointnetMSGModule class. Method signatures and docstrings: - def __init__(self, npoint: int, radius: list, nsamples: list, mlps: list): npoint : point number for fps sampling nsamples : sample point numbers for ...
Implement the Python class `_BasePointnetMSGModule` described below. Class description: Implement the _BasePointnetMSGModule class. Method signatures and docstrings: - def __init__(self, npoint: int, radius: list, nsamples: list, mlps: list): npoint : point number for fps sampling nsamples : sample point numbers for ...
6ff4287db5178e9c706bb2b2c512cee150367548
<|skeleton|> class _BasePointnetMSGModule: def __init__(self, npoint: int, radius: list, nsamples: list, mlps: list): """npoint : point number for fps sampling nsamples : sample point numbers for each radius""" <|body_0|> def forward(self, pc, feat): """input --------------- pc : B x 3...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _BasePointnetMSGModule: def __init__(self, npoint: int, radius: list, nsamples: list, mlps: list): """npoint : point number for fps sampling nsamples : sample point numbers for each radius""" super().__init__() assert len(radius) == len(nsamples) == len(mlps) self.npoint = npoi...
the_stack_v2_python_sparse
models/PointNet2/BasePointnetModule.py
zeal-up/General_3D
train
0
1e2f8f3362f5c3e81872d0334ae90e655e35c8bc
[ "server = datastore.server\nschema = datastore.schema\ntables = tables if tables is not None else {table.pyre_name for table in schema.tables}\nfor table in schema.tables:\n if table.pyre_name in tables:\n server.createTable(table)\nreturn self", "server = datastore.server\nschema = datastore.schema\nta...
<|body_start_0|> server = datastore.server schema = datastore.schema tables = tables if tables is not None else {table.pyre_name for table in schema.tables} for table in schema.tables: if table.pyre_name in tables: server.createTable(table) return self...
Builder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Builder: def createTables(self, datastore, tables=None): """Create the table structure of my database""" <|body_0|> def dropTables(self, datastore, tables=None): """Remove all tables from the database; use with caution!""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_025511
1,500
no_license
[ { "docstring": "Create the table structure of my database", "name": "createTables", "signature": "def createTables(self, datastore, tables=None)" }, { "docstring": "Remove all tables from the database; use with caution!", "name": "dropTables", "signature": "def dropTables(self, datastore...
2
stack_v2_sparse_classes_30k_test_000265
Implement the Python class `Builder` described below. Class description: Implement the Builder class. Method signatures and docstrings: - def createTables(self, datastore, tables=None): Create the table structure of my database - def dropTables(self, datastore, tables=None): Remove all tables from the database; use w...
Implement the Python class `Builder` described below. Class description: Implement the Builder class. Method signatures and docstrings: - def createTables(self, datastore, tables=None): Create the table structure of my database - def dropTables(self, datastore, tables=None): Remove all tables from the database; use w...
5b1e846d0dcd80934c8238ab0890b2bbb5126d41
<|skeleton|> class Builder: def createTables(self, datastore, tables=None): """Create the table structure of my database""" <|body_0|> def dropTables(self, datastore, tables=None): """Remove all tables from the database; use with caution!""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Builder: def createTables(self, datastore, tables=None): """Create the table structure of my database""" server = datastore.server schema = datastore.schema tables = tables if tables is not None else {table.pyre_name for table in schema.tables} for table in schema.table...
the_stack_v2_python_sparse
praxis/support/Builder.py
Orthologue/praxis
train
0
6cb806071f3f60364ff3ab5a552aed332360af42
[ "super().__init__(fmc, **kwargs)\nlogging.debug('In __init__() for FQDNS class.')\nself.parse_kwargs(**kwargs)\nself.type = 'FQDN'\nif self.fmc.serverVersion < self.FIRST_SUPPORTED_FMC_VERSION:\n logging.warning(f'The FQDNS API feature was released in version {self.FIRST_SUPPORTED_FMC_VERSION}. Your FMC version...
<|body_start_0|> super().__init__(fmc, **kwargs) logging.debug('In __init__() for FQDNS class.') self.parse_kwargs(**kwargs) self.type = 'FQDN' if self.fmc.serverVersion < self.FIRST_SUPPORTED_FMC_VERSION: logging.warning(f'The FQDNS API feature was released in versio...
The FQDNS Object in the FMC.
FQDNS
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FQDNS: """The FQDNS Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize FQDNS object. Set self.type to "FQDNS" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return: None""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_025512
2,558
permissive
[ { "docstring": "Initialize FQDNS object. Set self.type to \"FQDNS\" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return: None", "name": "__init__", "signature": "def __init__(self, fmc, **kwargs)" }, { "docstring": "Gather al...
3
stack_v2_sparse_classes_30k_train_013705
Implement the Python class `FQDNS` described below. Class description: The FQDNS Object in the FMC. Method signatures and docstrings: - def __init__(self, fmc, **kwargs): Initialize FQDNS object. Set self.type to "FQDNS" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed duri...
Implement the Python class `FQDNS` described below. Class description: The FQDNS Object in the FMC. Method signatures and docstrings: - def __init__(self, fmc, **kwargs): Initialize FQDNS object. Set self.type to "FQDNS" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed duri...
fd924de96e200ca8e0d5088b27a5abaf6f915bc6
<|skeleton|> class FQDNS: """The FQDNS Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize FQDNS object. Set self.type to "FQDNS" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return: None""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FQDNS: """The FQDNS Object in the FMC.""" def __init__(self, fmc, **kwargs): """Initialize FQDNS object. Set self.type to "FQDNS" and parse the kwargs. :param fmc: (object) FMC object :param kwargs: Any other values passed during instantiation. :return: None""" super().__init__(fmc, **kwa...
the_stack_v2_python_sparse
fmcapi/api_objects/object_services/fqdns.py
banzigaga/fmcapi
train
1
752f962d78e682a267cc647b4209a178c3961681
[ "count_2 = 0\ncount_3 = 0\nfor current_id in ids:\n char_cache = dict()\n for char in current_id:\n char_cache[char] = char_cache.get(char) + 1 if char in char_cache else 1\n counts = set(char_cache.values())\n count_2 = count_2 + 1 if 2 in counts else count_2\n count_3 = count_3 + 1 if 3 in c...
<|body_start_0|> count_2 = 0 count_3 = 0 for current_id in ids: char_cache = dict() for char in current_id: char_cache[char] = char_cache.get(char) + 1 if char in char_cache else 1 counts = set(char_cache.values()) count_2 = count_2...
Day2InventoryManagementSystem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Day2InventoryManagementSystem: def solve1(ids): """Determines the number of ids that contain one character at least 2 or 3 times. If multiple characters exists 2 or 3 times, only one pair is count. Args: ids (list[str]): The amount of ids Returns: int: count_2 * count_3""" <|body...
stack_v2_sparse_classes_36k_train_025513
2,436
no_license
[ { "docstring": "Determines the number of ids that contain one character at least 2 or 3 times. If multiple characters exists 2 or 3 times, only one pair is count. Args: ids (list[str]): The amount of ids Returns: int: count_2 * count_3", "name": "solve1", "signature": "def solve1(ids)" }, { "doc...
2
stack_v2_sparse_classes_30k_train_019945
Implement the Python class `Day2InventoryManagementSystem` described below. Class description: Implement the Day2InventoryManagementSystem class. Method signatures and docstrings: - def solve1(ids): Determines the number of ids that contain one character at least 2 or 3 times. If multiple characters exists 2 or 3 tim...
Implement the Python class `Day2InventoryManagementSystem` described below. Class description: Implement the Day2InventoryManagementSystem class. Method signatures and docstrings: - def solve1(ids): Determines the number of ids that contain one character at least 2 or 3 times. If multiple characters exists 2 or 3 tim...
a854671b330d7ff460d25791bc6ec4d32187f677
<|skeleton|> class Day2InventoryManagementSystem: def solve1(ids): """Determines the number of ids that contain one character at least 2 or 3 times. If multiple characters exists 2 or 3 times, only one pair is count. Args: ids (list[str]): The amount of ids Returns: int: count_2 * count_3""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Day2InventoryManagementSystem: def solve1(ids): """Determines the number of ids that contain one character at least 2 or 3 times. If multiple characters exists 2 or 3 times, only one pair is count. Args: ids (list[str]): The amount of ids Returns: int: count_2 * count_3""" count_2 = 0 ...
the_stack_v2_python_sparse
src/snake_squeeze/Y2018/Day2InventoryManagementSystem.py
Scavi/SnakeSqueeze
train
1
00723be7bfaeb89339dd64ddc66a69c9268a18d5
[ "def dfs(node):\n if node is None:\n return ''\n res = str(node.val)\n if len(node.children) > 0:\n res += '['\n for child in node.children:\n subres = dfs(child)\n res += subres + ' '\n res = res[:-1]\n res += ']'\n return res\nresult = dfs(root)...
<|body_start_0|> def dfs(node): if node is None: return '' res = str(node.val) if len(node.children) > 0: res += '[' for child in node.children: subres = dfs(child) res += subres + ' ' ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_025514
4,693
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|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: Node :rtype: str""" def dfs(node): if node is None: return '' res = str(node.val) if len(node.children) > 0: res += '[' for ch...
the_stack_v2_python_sparse
python/leetcode/tree/428_serialize_des_tree.py
Levintsky/topcoder
train
0
c4ad8601e338c37dd143835d2084b95de3fe2c03
[ "if toks[0].startswith('x'):\n zeropad = toks[0][1:].ljust(16, '0')\n binary = bytes.fromhex(zeropad)\n toks[0] = struct.unpack('<Q', binary)[0]\nelif toks[0].startswith('i'):\n toks[0] = int(toks[0][1:])\nelse:\n toks[0] = int(toks[0])\nreturn toks", "if toks[0].startswith('i'):\n toks[0] = int...
<|body_start_0|> if toks[0].startswith('x'): zeropad = toks[0][1:].ljust(16, '0') binary = bytes.fromhex(zeropad) toks[0] = struct.unpack('<Q', binary)[0] elif toks[0].startswith('i'): toks[0] = int(toks[0][1:]) else: toks[0] = int(toks...
Helper class holding static methods to parse each type
Parse
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parse: """Helper class holding static methods to parse each type""" def int(toks: list) -> list: """Parse ordinary int or big endian hex string as a 8-byte unsigned integer""" <|body_0|> def float(toks: list) -> list: """Parse fixed precision float or little endi...
stack_v2_sparse_classes_36k_train_025515
15,158
permissive
[ { "docstring": "Parse ordinary int or big endian hex string as a 8-byte unsigned integer", "name": "int", "signature": "def int(toks: list) -> list" }, { "docstring": "Parse fixed precision float or little endian hex string as a 4-byte float", "name": "float", "signature": "def float(tok...
2
stack_v2_sparse_classes_30k_train_008162
Implement the Python class `Parse` described below. Class description: Helper class holding static methods to parse each type Method signatures and docstrings: - def int(toks: list) -> list: Parse ordinary int or big endian hex string as a 8-byte unsigned integer - def float(toks: list) -> list: Parse fixed precision...
Implement the Python class `Parse` described below. Class description: Helper class holding static methods to parse each type Method signatures and docstrings: - def int(toks: list) -> list: Parse ordinary int or big endian hex string as a 8-byte unsigned integer - def float(toks: list) -> list: Parse fixed precision...
735f6a07eab7ccfd8632ea6ec93854b26e1902d0
<|skeleton|> class Parse: """Helper class holding static methods to parse each type""" def int(toks: list) -> list: """Parse ordinary int or big endian hex string as a 8-byte unsigned integer""" <|body_0|> def float(toks: list) -> list: """Parse fixed precision float or little endi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parse: """Helper class holding static methods to parse each type""" def int(toks: list) -> list: """Parse ordinary int or big endian hex string as a 8-byte unsigned integer""" if toks[0].startswith('x'): zeropad = toks[0][1:].ljust(16, '0') binary = bytes.fromhex(z...
the_stack_v2_python_sparse
autodrome/policeman/map.py
OSSDC/autodrome
train
2
8a6c178029b69ad058618273ee20c205e235c32f
[ "self.name = name\nself.container_path = container_path\nself.mode = mode\nself.is_host = is_host\nself.host_path = host_path\nself.driver = driver\nself.driver_opts = driver_opts", "if self.is_host:\n volume_name = self.host_path\nelse:\n is_created = True\n if is_created:\n volume_name = self.na...
<|body_start_0|> self.name = name self.container_path = container_path self.mode = mode self.is_host = is_host self.host_path = host_path self.driver = driver self.driver_opts = driver_opts <|end_body_0|> <|body_start_1|> if self.is_host: volu...
Defines a Docker volume that will be mounted into a container
Volume
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Volume: """Defines a Docker volume that will be mounted into a container""" def __init__(self, name, container_path, mode, is_host=True, host_path=None, driver=None, driver_opts=None): """Creates a volume to be mounted into a container :param name: The name of the volume :type name: ...
stack_v2_sparse_classes_36k_train_025516
3,397
permissive
[ { "docstring": "Creates a volume to be mounted into a container :param name: The name of the volume :type name: string :param container_path: The path within the container onto which the volume will be mounted :type container_path: string :param mode: Either 'ro' for read-only or 'rw' for read-write :type mode:...
2
null
Implement the Python class `Volume` described below. Class description: Defines a Docker volume that will be mounted into a container Method signatures and docstrings: - def __init__(self, name, container_path, mode, is_host=True, host_path=None, driver=None, driver_opts=None): Creates a volume to be mounted into a c...
Implement the Python class `Volume` described below. Class description: Defines a Docker volume that will be mounted into a container Method signatures and docstrings: - def __init__(self, name, container_path, mode, is_host=True, host_path=None, driver=None, driver_opts=None): Creates a volume to be mounted into a c...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class Volume: """Defines a Docker volume that will be mounted into a container""" def __init__(self, name, container_path, mode, is_host=True, host_path=None, driver=None, driver_opts=None): """Creates a volume to be mounted into a container :param name: The name of the volume :type name: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Volume: """Defines a Docker volume that will be mounted into a container""" def __init__(self, name, container_path, mode, is_host=True, host_path=None, driver=None, driver_opts=None): """Creates a volume to be mounted into a container :param name: The name of the volume :type name: string :param...
the_stack_v2_python_sparse
scale/job/execution/configuration/volume.py
kfconsultant/scale
train
0
348ad7251140216a28de93c4c165690bae51ddc7
[ "if self.survey_passwords:\n extra_vars = json.loads(self.extra_vars)\n for key, value in self.survey_passwords.items():\n if key in extra_vars:\n extra_vars[key] = value\n return json.dumps(extra_vars)\nelse:\n return self.extra_vars", "if self.survey_passwords:\n extra_vars = js...
<|body_start_0|> if self.survey_passwords: extra_vars = json.loads(self.extra_vars) for key, value in self.survey_passwords.items(): if key in extra_vars: extra_vars[key] = value return json.dumps(extra_vars) else: retur...
SurveyJobMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurveyJobMixin: def display_extra_vars(self): """Hides fields marked as passwords in survey.""" <|body_0|> def decrypted_extra_vars(self): """Decrypts fields marked as passwords in survey.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.surv...
stack_v2_sparse_classes_36k_train_025517
28,356
permissive
[ { "docstring": "Hides fields marked as passwords in survey.", "name": "display_extra_vars", "signature": "def display_extra_vars(self)" }, { "docstring": "Decrypts fields marked as passwords in survey.", "name": "decrypted_extra_vars", "signature": "def decrypted_extra_vars(self)" } ]
2
stack_v2_sparse_classes_30k_test_000289
Implement the Python class `SurveyJobMixin` described below. Class description: Implement the SurveyJobMixin class. Method signatures and docstrings: - def display_extra_vars(self): Hides fields marked as passwords in survey. - def decrypted_extra_vars(self): Decrypts fields marked as passwords in survey.
Implement the Python class `SurveyJobMixin` described below. Class description: Implement the SurveyJobMixin class. Method signatures and docstrings: - def display_extra_vars(self): Hides fields marked as passwords in survey. - def decrypted_extra_vars(self): Decrypts fields marked as passwords in survey. <|skeleton...
5e105c2cbd3fe828160540b3043cf6f605ed26be
<|skeleton|> class SurveyJobMixin: def display_extra_vars(self): """Hides fields marked as passwords in survey.""" <|body_0|> def decrypted_extra_vars(self): """Decrypts fields marked as passwords in survey.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SurveyJobMixin: def display_extra_vars(self): """Hides fields marked as passwords in survey.""" if self.survey_passwords: extra_vars = json.loads(self.extra_vars) for key, value in self.survey_passwords.items(): if key in extra_vars: ...
the_stack_v2_python_sparse
awx/main/models/mixins.py
ansible/awx
train
13,353
579330adbc74a9ae39a99d9346dca9e5053f66d9
[ "x = torch.randn(4, 2)\nn_components = np.random.randint(1, 100)\nmodel = GaussianMixture(n_components, x.size(1))\nmodel.fit(x)\ny = model.predict(x)\nself.assertEqual(torch.Tensor(x.size(0)).size(), y.size())", "x = torch.randn(4, 2)\nn_components = np.random.randint(1, 100)\nmodel = GaussianMixture(n_component...
<|body_start_0|> x = torch.randn(4, 2) n_components = np.random.randint(1, 100) model = GaussianMixture(n_components, x.size(1)) model.fit(x) y = model.predict(x) self.assertEqual(torch.Tensor(x.size(0)).size(), y.size()) <|end_body_0|> <|body_start_1|> x = torch...
Basic tests for CPU models.
CpuCheck
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CpuCheck: """Basic tests for CPU models.""" def testPredictClasses(self): """Assert that torch.FloatTensor is handled correctly.""" <|body_0|> def testPredictProbabilities(self): """Assert that torch.FloatTensor is handled correctly when returning class probabili...
stack_v2_sparse_classes_36k_train_025518
2,202
permissive
[ { "docstring": "Assert that torch.FloatTensor is handled correctly.", "name": "testPredictClasses", "signature": "def testPredictClasses(self)" }, { "docstring": "Assert that torch.FloatTensor is handled correctly when returning class probabilities.", "name": "testPredictProbabilities", ...
2
stack_v2_sparse_classes_30k_train_012129
Implement the Python class `CpuCheck` described below. Class description: Basic tests for CPU models. Method signatures and docstrings: - def testPredictClasses(self): Assert that torch.FloatTensor is handled correctly. - def testPredictProbabilities(self): Assert that torch.FloatTensor is handled correctly when retu...
Implement the Python class `CpuCheck` described below. Class description: Basic tests for CPU models. Method signatures and docstrings: - def testPredictClasses(self): Assert that torch.FloatTensor is handled correctly. - def testPredictProbabilities(self): Assert that torch.FloatTensor is handled correctly when retu...
df1c26047574fbe0a7b103ebc26687bc04739229
<|skeleton|> class CpuCheck: """Basic tests for CPU models.""" def testPredictClasses(self): """Assert that torch.FloatTensor is handled correctly.""" <|body_0|> def testPredictProbabilities(self): """Assert that torch.FloatTensor is handled correctly when returning class probabili...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CpuCheck: """Basic tests for CPU models.""" def testPredictClasses(self): """Assert that torch.FloatTensor is handled correctly.""" x = torch.randn(4, 2) n_components = np.random.randint(1, 100) model = GaussianMixture(n_components, x.size(1)) model.fit(x) ...
the_stack_v2_python_sparse
util/gmm_torch/test.py
Vichoko/aidio
train
2
31101687d35e8fe89ce8460a6901ccbd315bb198
[ "connection = os.environ.get('DB_CONNECTION')\nusername = os.getenv('DB_USERNAME')\npassword = os.getenv('DB_PASSWORD')\nhost = os.getenv('DB_HOST')\nport = os.environ.get('DB_PORT')\ndatabase = os.getenv('DB_DATABASE')\nSQLALCHEMY_DATABASE_URI = connection + '://' + username + ':' + password + '@' + host + ':' + p...
<|body_start_0|> connection = os.environ.get('DB_CONNECTION') username = os.getenv('DB_USERNAME') password = os.getenv('DB_PASSWORD') host = os.getenv('DB_HOST') port = os.environ.get('DB_PORT') database = os.getenv('DB_DATABASE') SQLALCHEMY_DATABASE_URI = connect...
Config
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: def database(): """Configuration For Database :return string:""" <|body_0|> def database_analytic(): """Configuration For Database Analytics :return string:""" <|body_1|> def per_page(): """this function for create default data perpage :r...
stack_v2_sparse_classes_36k_train_025519
1,655
no_license
[ { "docstring": "Configuration For Database :return string:", "name": "database", "signature": "def database()" }, { "docstring": "Configuration For Database Analytics :return string:", "name": "database_analytic", "signature": "def database_analytic()" }, { "docstring": "this fun...
3
stack_v2_sparse_classes_30k_train_020945
Implement the Python class `Config` described below. Class description: Implement the Config class. Method signatures and docstrings: - def database(): Configuration For Database :return string: - def database_analytic(): Configuration For Database Analytics :return string: - def per_page(): this function for create ...
Implement the Python class `Config` described below. Class description: Implement the Config class. Method signatures and docstrings: - def database(): Configuration For Database :return string: - def database_analytic(): Configuration For Database Analytics :return string: - def per_page(): this function for create ...
4af89bd110ca305b952df15febe749bc9d0f6fe8
<|skeleton|> class Config: def database(): """Configuration For Database :return string:""" <|body_0|> def database_analytic(): """Configuration For Database Analytics :return string:""" <|body_1|> def per_page(): """this function for create default data perpage :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Config: def database(): """Configuration For Database :return string:""" connection = os.environ.get('DB_CONNECTION') username = os.getenv('DB_USERNAME') password = os.getenv('DB_PASSWORD') host = os.getenv('DB_HOST') port = os.environ.get('DB_PORT') dat...
the_stack_v2_python_sparse
config/app.py
arywidiantara/Flask-Sqlalchemy
train
0
d52cfbcfe594aba53d7984b5d2186546d83ddf40
[ "count = maxWidth\nstart = end = 0\nresult = []\nfor word in words:\n length = len(word)\n nSpaces = end - start - 1\n if length + nSpaces + 1 > count:\n average = count / (nSpaces or 1)\n remainder = count - average * (nSpaces or 1)\n string = words[start] + (nSpaces == 0) * average *...
<|body_start_0|> count = maxWidth start = end = 0 result = [] for word in words: length = len(word) nSpaces = end - start - 1 if length + nSpaces + 1 > count: average = count / (nSpaces or 1) remainder = count - average ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fullJustify(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" <|body_0|> def fullJustify2(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_025520
2,353
permissive
[ { "docstring": ":type words: List[str] :type maxWidth: int :rtype: List[str]", "name": "fullJustify", "signature": "def fullJustify(self, words, maxWidth)" }, { "docstring": ":type words: List[str] :type maxWidth: int :rtype: List[str]", "name": "fullJustify2", "signature": "def fullJust...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fullJustify(self, words, maxWidth): :type words: List[str] :type maxWidth: int :rtype: List[str] - def fullJustify2(self, words, maxWidth): :type words: List[str] :type maxWi...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fullJustify(self, words, maxWidth): :type words: List[str] :type maxWidth: int :rtype: List[str] - def fullJustify2(self, words, maxWidth): :type words: List[str] :type maxWi...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def fullJustify(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" <|body_0|> def fullJustify2(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fullJustify(self, words, maxWidth): """:type words: List[str] :type maxWidth: int :rtype: List[str]""" count = maxWidth start = end = 0 result = [] for word in words: length = len(word) nSpaces = end - start - 1 if lengt...
the_stack_v2_python_sparse
1-100/61-70/68-textJustification/textJustification.py
xuychen/Leetcode
train
0
12b4f01d7dcd7d6e730c549af7d143cfdd7766c2
[ "self.ckpt = ckpt\nself.codelen = codelen\nself.grid_batch = grid_batch\nself.in_grid_res = in_grid_res\nself.encoder_nf = encoder_nf\nself.graph = tf.Graph()\nself._init_graph()", "with self.graph.as_default():\n self.encoder = g2v.GridEncoder(in_grid_res=self.in_grid_res, num_filters=self.encoder_nf, codelen...
<|body_start_0|> self.ckpt = ckpt self.codelen = codelen self.grid_batch = grid_batch self.in_grid_res = in_grid_res self.encoder_nf = encoder_nf self.graph = tf.Graph() self._init_graph() <|end_body_0|> <|body_start_1|> with self.graph.as_default(): ...
Load pretrained grid encoder and evaluate single crops.
EncoderEvaluator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderEvaluator: """Load pretrained grid encoder and evaluate single crops.""" def __init__(self, ckpt, in_grid_res=32, encoder_nf=32, codelen=32, grid_batch=128): """Initialization function. Args: ckpt: str, path to checkpoint. in_grid_res: int, resolution of grid to feed to encode...
stack_v2_sparse_classes_36k_train_025521
22,903
permissive
[ { "docstring": "Initialization function. Args: ckpt: str, path to checkpoint. in_grid_res: int, resolution of grid to feed to encoder. encoder_nf: int, number of base filters for encoder. codelen: int, length of output latent code. grid_batch: int, batch size of cut-out grid to evaluate at a time.", "name":...
3
null
Implement the Python class `EncoderEvaluator` described below. Class description: Load pretrained grid encoder and evaluate single crops. Method signatures and docstrings: - def __init__(self, ckpt, in_grid_res=32, encoder_nf=32, codelen=32, grid_batch=128): Initialization function. Args: ckpt: str, path to checkpoin...
Implement the Python class `EncoderEvaluator` described below. Class description: Load pretrained grid encoder and evaluate single crops. Method signatures and docstrings: - def __init__(self, ckpt, in_grid_res=32, encoder_nf=32, codelen=32, grid_batch=128): Initialization function. Args: ckpt: str, path to checkpoin...
1b0203eb538f2b6a1013ec7736d0d548416f059a
<|skeleton|> class EncoderEvaluator: """Load pretrained grid encoder and evaluate single crops.""" def __init__(self, ckpt, in_grid_res=32, encoder_nf=32, codelen=32, grid_batch=128): """Initialization function. Args: ckpt: str, path to checkpoint. in_grid_res: int, resolution of grid to feed to encode...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderEvaluator: """Load pretrained grid encoder and evaluate single crops.""" def __init__(self, ckpt, in_grid_res=32, encoder_nf=32, codelen=32, grid_batch=128): """Initialization function. Args: ckpt: str, path to checkpoint. in_grid_res: int, resolution of grid to feed to encoder. encoder_nf...
the_stack_v2_python_sparse
tensorflow_graphics/projects/local_implicit_grid/core/evaluator.py
tensorflow/graphics
train
2,920
27a9995676b055c0fdbef5c2fb8df0007d6e5e67
[ "super().__init__()\nself.blocks = len(rnns)\nfor index, rnn in enumerate(rnns, 1):\n setattr(self, 'rnn' + str(index), rnn)", "inputs = inputs.transpose(0, 1)\nT = inputs.size(0)\nhidden_states = []\nif len(initial_state) == 0:\n initial_state = [[] for i in range(self.blocks)]\nfor i in range(1, self.bloc...
<|body_start_0|> super().__init__() self.blocks = len(rnns) for index, rnn in enumerate(rnns, 1): setattr(self, 'rnn' + str(index), rnn) <|end_body_0|> <|body_start_1|> inputs = inputs.transpose(0, 1) T = inputs.size(0) hidden_states = [] if len(initi...
encoding a certain length of sequence The Encoder network consists of multiple convlstm cells.
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """encoding a certain length of sequence The Encoder network consists of multiple convlstm cells.""" def __init__(self, rnns): """rnns are a list of convlstm cells""" <|body_0|> def forward(self, inputs, initial_state): """forward pass of the encoder :pa...
stack_v2_sparse_classes_36k_train_025522
41,120
no_license
[ { "docstring": "rnns are a list of convlstm cells", "name": "__init__", "signature": "def __init__(self, rnns)" }, { "docstring": "forward pass of the encoder :param inputs: a tensor of shape (B, S, C, H, W) :param initial_state: Either a list containing [(h, c), ..., (h, c)], where each (h, c) ...
2
stack_v2_sparse_classes_30k_train_008761
Implement the Python class `Encoder` described below. Class description: encoding a certain length of sequence The Encoder network consists of multiple convlstm cells. Method signatures and docstrings: - def __init__(self, rnns): rnns are a list of convlstm cells - def forward(self, inputs, initial_state): forward pa...
Implement the Python class `Encoder` described below. Class description: encoding a certain length of sequence The Encoder network consists of multiple convlstm cells. Method signatures and docstrings: - def __init__(self, rnns): rnns are a list of convlstm cells - def forward(self, inputs, initial_state): forward pa...
b6a3161635bfa3b5da8ec871e1025e01f878e732
<|skeleton|> class Encoder: """encoding a certain length of sequence The Encoder network consists of multiple convlstm cells.""" def __init__(self, rnns): """rnns are a list of convlstm cells""" <|body_0|> def forward(self, inputs, initial_state): """forward pass of the encoder :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """encoding a certain length of sequence The Encoder network consists of multiple convlstm cells.""" def __init__(self, rnns): """rnns are a list of convlstm cells""" super().__init__() self.blocks = len(rnns) for index, rnn in enumerate(rnns, 1): seta...
the_stack_v2_python_sparse
src/bayesian_neural_net.py
KEHUIYAO/BCLS
train
0
df02a8556ed86a545947094217f81212642d9653
[ "try:\n self.sqlhandler = None\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n utils.parseJsonRequestBody(self)\n self.stuId = self.args['stuId']\n self.stuScore = self.args['stuScore']\n self.practiceId = self.args['practiceId']\n self.scoreDetail = self.args['...
<|body_start_0|> try: self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return utils.parseJsonRequestBody(self) self.stuId = self.args['stuId'] self.stuScore = self.args['stuScore'] s...
TeaCorrectPracticeRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeaCorrectPracticeRequestHandler: def post(self): """将老师上传的题目存到数据库""" <|body_0|> def pushPractice(self): """将分数成绩存放到数据库""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.sqlhandler = None if not utils.isUIDValid(self)...
stack_v2_sparse_classes_36k_train_025523
2,051
no_license
[ { "docstring": "将老师上传的题目存到数据库", "name": "post", "signature": "def post(self)" }, { "docstring": "将分数成绩存放到数据库", "name": "pushPractice", "signature": "def pushPractice(self)" } ]
2
stack_v2_sparse_classes_30k_test_001204
Implement the Python class `TeaCorrectPracticeRequestHandler` described below. Class description: Implement the TeaCorrectPracticeRequestHandler class. Method signatures and docstrings: - def post(self): 将老师上传的题目存到数据库 - def pushPractice(self): 将分数成绩存放到数据库
Implement the Python class `TeaCorrectPracticeRequestHandler` described below. Class description: Implement the TeaCorrectPracticeRequestHandler class. Method signatures and docstrings: - def post(self): 将老师上传的题目存到数据库 - def pushPractice(self): 将分数成绩存放到数据库 <|skeleton|> class TeaCorrectPracticeRequestHandler: def...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class TeaCorrectPracticeRequestHandler: def post(self): """将老师上传的题目存到数据库""" <|body_0|> def pushPractice(self): """将分数成绩存放到数据库""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeaCorrectPracticeRequestHandler: def post(self): """将老师上传的题目存到数据库""" try: self.sqlhandler = None if not utils.isUIDValid(self): self.write('no uid') return utils.parseJsonRequestBody(self) self.stuId = self.args['...
the_stack_v2_python_sparse
server/teacher/TeaCorrectPracticeRequestHandler.py
lyh-ADT/edu-app
train
1
e091d03d3ea5ec4d503bd736aafba91aba0ab645
[ "test_obj = Inventory(1, 2, 3, 4)\nself.assertEqual(test_obj.product_code, 1)\nself.assertEqual(test_obj.description, 2)\nself.assertEqual(test_obj.market_price, 3)\nself.assertEqual(test_obj.rental_price, 4)", "test_obj = Inventory(1, 2, 3, 4).return_as_dictionary()\nself.assertEqual(test_obj['product_code'], 1)...
<|body_start_0|> test_obj = Inventory(1, 2, 3, 4) self.assertEqual(test_obj.product_code, 1) self.assertEqual(test_obj.description, 2) self.assertEqual(test_obj.market_price, 3) self.assertEqual(test_obj.rental_price, 4) <|end_body_0|> <|body_start_1|> test_obj = Invento...
test Inventory class
InventoryTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryTest: """test Inventory class""" def test_init(self): """test init function of class""" <|body_0|> def test_return_dict(self): """test return as dict function""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_obj = Inventory(1, 2, 3,...
stack_v2_sparse_classes_36k_train_025524
4,928
no_license
[ { "docstring": "test init function of class", "name": "test_init", "signature": "def test_init(self)" }, { "docstring": "test return as dict function", "name": "test_return_dict", "signature": "def test_return_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_018597
Implement the Python class `InventoryTest` described below. Class description: test Inventory class Method signatures and docstrings: - def test_init(self): test init function of class - def test_return_dict(self): test return as dict function
Implement the Python class `InventoryTest` described below. Class description: test Inventory class Method signatures and docstrings: - def test_init(self): test init function of class - def test_return_dict(self): test return as dict function <|skeleton|> class InventoryTest: """test Inventory class""" def...
6ffd7b4ab8346076d3b6cc02ca1ebca3bf028697
<|skeleton|> class InventoryTest: """test Inventory class""" def test_init(self): """test init function of class""" <|body_0|> def test_return_dict(self): """test return as dict function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InventoryTest: """test Inventory class""" def test_init(self): """test init function of class""" test_obj = Inventory(1, 2, 3, 4) self.assertEqual(test_obj.product_code, 1) self.assertEqual(test_obj.description, 2) self.assertEqual(test_obj.market_price, 3) ...
the_stack_v2_python_sparse
students/JasneetChandok/lesson01/assignment/test_unit.py
UWPCE-PythonCert-ClassRepos/220-Advanced-Summer-2019
train
4
d97f2d45da395ceb5ae6d8b2c7e8b6070515ed3d
[ "if not nums or len(nums) < 4:\n return []\nnums.sort()\nreturn [list(t) for t in self.kSum(nums, target, 4)]", "res = set()\nif k == 2:\n lo, hi = (0, len(nums) - 1)\n while lo < hi:\n if nums[lo] + nums[hi] == target:\n res.add((nums[lo], nums[hi]))\n lo += 1\n elif ...
<|body_start_0|> if not nums or len(nums) < 4: return [] nums.sort() return [list(t) for t in self.kSum(nums, target, 4)] <|end_body_0|> <|body_start_1|> res = set() if k == 2: lo, hi = (0, len(nums) - 1) while lo < hi: if nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def kSum(self, nums, target, k): """:type nums = List[int] :type target: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k_train_025525
1,102
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]", "name": "fourSum", "signature": "def fourSum(self, nums, target)" }, { "docstring": ":type nums = List[int] :type target: int :type k: int :rtype: List[int]", "name": "kSum", "signature": "def kSum(self, nu...
2
stack_v2_sparse_classes_30k_train_012412
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def kSum(self, nums, target, k): :type nums = List[int] :type target: int :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fourSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[List[int]] - def kSum(self, nums, target, k): :type nums = List[int] :type target: int :type...
24988428cada3b1f8a6c0cf0140e288511cd9a6d
<|skeleton|> class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def kSum(self, nums, target, k): """:type nums = List[int] :type target: int :type k: int :rtype: List[int]""" <|body_1|> <|end_skelet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def fourSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[List[int]]""" if not nums or len(nums) < 4: return [] nums.sort() return [list(t) for t in self.kSum(nums, target, 4)] def kSum(self, nums, target, k): ""...
the_stack_v2_python_sparse
LC_n_Misc/LC_18_4Sum.py
abhikrish06/PythonPractice
train
0
e4d6a545b2b24441fd1c900785471b4cbd604fb1
[ "self._logfile = Pathname(path, prefix=prefix)\nepoch = datetime.datetime.utcfromtimestamp(0)\nnow = datetime.datetime.now() - datetime.timedelta(days=30)\nself._30day_delta = (now - epoch).total_seconds()\ntry:\n self._parser = auparse.AuParser(auparse.AUSOURCE_FILE, self._logfile)\nexcept IOError as e:\n ra...
<|body_start_0|> self._logfile = Pathname(path, prefix=prefix) epoch = datetime.datetime.utcfromtimestamp(0) now = datetime.datetime.now() - datetime.timedelta(days=30) self._30day_delta = (now - epoch).total_seconds() try: self._parser = auparse.AuParser(auparse.AUSO...
Manage SELinux audit logs.
Audit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Audit: """Manage SELinux audit logs.""" def __init__(self, path, prefix='/host'): """Construct manager.""" <|body_0|> def avc(self, by_time=True): """Filter log by avc's.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self._logfile = Pathname(p...
stack_v2_sparse_classes_36k_train_025526
1,968
permissive
[ { "docstring": "Construct manager.", "name": "__init__", "signature": "def __init__(self, path, prefix='/host')" }, { "docstring": "Filter log by avc's.", "name": "avc", "signature": "def avc(self, by_time=True)" } ]
2
null
Implement the Python class `Audit` described below. Class description: Manage SELinux audit logs. Method signatures and docstrings: - def __init__(self, path, prefix='/host'): Construct manager. - def avc(self, by_time=True): Filter log by avc's.
Implement the Python class `Audit` described below. Class description: Manage SELinux audit logs. Method signatures and docstrings: - def __init__(self, path, prefix='/host'): Construct manager. - def avc(self, by_time=True): Filter log by avc's. <|skeleton|> class Audit: """Manage SELinux audit logs.""" de...
8c0751359994d93025cd996cec0633ec7a330bd7
<|skeleton|> class Audit: """Manage SELinux audit logs.""" def __init__(self, path, prefix='/host'): """Construct manager.""" <|body_0|> def avc(self, by_time=True): """Filter log by avc's.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Audit: """Manage SELinux audit logs.""" def __init__(self, path, prefix='/host'): """Construct manager.""" self._logfile = Pathname(path, prefix=prefix) epoch = datetime.datetime.utcfromtimestamp(0) now = datetime.datetime.now() - datetime.timedelta(days=30) self._...
the_stack_v2_python_sparse
checking/utils/audit.py
jwhonce/container-check
train
0
c34fb1d0a867859dfc425bf4de2cf0985197f464
[ "with open(calls_dir + self.complexity + '.py', 'r') as f:\n self.code_cfg = f.read()\nself.R_rates = Rrates(self.R_rates)\nassert self.N > 1, 'N should be >1'\nassert self.trim <= 0, 'trim should be negative or zero'\nself.init_date = strevaldate(self.init_date)\nassert os.path.exists(self.workdir), 'Workdir ' ...
<|body_start_0|> with open(calls_dir + self.complexity + '.py', 'r') as f: self.code_cfg = f.read() self.R_rates = Rrates(self.R_rates) assert self.N > 1, 'N should be >1' assert self.trim <= 0, 'trim should be negative or zero' self.init_date = strevaldate(self.init_...
Creates model call.
ModelCall
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelCall: """Creates model call.""" def __post_init__(self): """Model Call.""" <|body_0|> def gencode(self): """Create Model Call code.""" <|body_1|> def unusedVars(self): """Find defined, yet unused variables.""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_025527
9,166
permissive
[ { "docstring": "Model Call.", "name": "__post_init__", "signature": "def __post_init__(self)" }, { "docstring": "Create Model Call code.", "name": "gencode", "signature": "def gencode(self)" }, { "docstring": "Find defined, yet unused variables.", "name": "unusedVars", "s...
3
stack_v2_sparse_classes_30k_train_004140
Implement the Python class `ModelCall` described below. Class description: Creates model call. Method signatures and docstrings: - def __post_init__(self): Model Call. - def gencode(self): Create Model Call code. - def unusedVars(self): Find defined, yet unused variables.
Implement the Python class `ModelCall` described below. Class description: Creates model call. Method signatures and docstrings: - def __post_init__(self): Model Call. - def gencode(self): Create Model Call code. - def unusedVars(self): Find defined, yet unused variables. <|skeleton|> class ModelCall: """Creates...
2d7e3621b472146a262745900ab143ba18ba0340
<|skeleton|> class ModelCall: """Creates model call.""" def __post_init__(self): """Model Call.""" <|body_0|> def gencode(self): """Create Model Call code.""" <|body_1|> def unusedVars(self): """Find defined, yet unused variables.""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelCall: """Creates model call.""" def __post_init__(self): """Model Call.""" with open(calls_dir + self.complexity + '.py', 'r') as f: self.code_cfg = f.read() self.R_rates = Rrates(self.R_rates) assert self.N > 1, 'N should be >1' assert self.trim <...
the_stack_v2_python_sparse
victoriaepi/configparsing/modelcalls.py
victoriaepidemics/Victoria
train
5
45c282e5451e9b9c2e4ffd94629784853dfa1c92
[ "log.debug('GET request from user %s for work item %s' % (request.user, wbs_id))\nproj = Project.objects.get(project_number=project_number)\nwbs = WorkItem.objects.get(id=wbs_id)\nif not check_project_read_acl(proj, request.user):\n log.debug('Refusing GET request for project %s from user %s' % (project_number, ...
<|body_start_0|> log.debug('GET request from user %s for work item %s' % (request.user, wbs_id)) proj = Project.objects.get(project_number=project_number) wbs = WorkItem.objects.get(id=wbs_id) if not check_project_read_acl(proj, request.user): log.debug('Refusing GET request ...
URI: /api/wbs/%project_number%/%wbs_id%/ VERBS: GET, PUT, DELETE Handles a single instance of WorkItem
WBSResourceHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WBSResourceHandler: """URI: /api/wbs/%project_number%/%wbs_id%/ VERBS: GET, PUT, DELETE Handles a single instance of WorkItem""" def read(self, request, project_number, wbs_id): """View a work item""" <|body_0|> def update(self, request, project_number, wbs_id): ...
stack_v2_sparse_classes_36k_train_025528
19,350
no_license
[ { "docstring": "View a work item", "name": "read", "signature": "def read(self, request, project_number, wbs_id)" }, { "docstring": "Update the work item", "name": "update", "signature": "def update(self, request, project_number, wbs_id)" }, { "docstring": "Disassociate the work ...
3
stack_v2_sparse_classes_30k_train_021547
Implement the Python class `WBSResourceHandler` described below. Class description: URI: /api/wbs/%project_number%/%wbs_id%/ VERBS: GET, PUT, DELETE Handles a single instance of WorkItem Method signatures and docstrings: - def read(self, request, project_number, wbs_id): View a work item - def update(self, request, p...
Implement the Python class `WBSResourceHandler` described below. Class description: URI: /api/wbs/%project_number%/%wbs_id%/ VERBS: GET, PUT, DELETE Handles a single instance of WorkItem Method signatures and docstrings: - def read(self, request, project_number, wbs_id): View a work item - def update(self, request, p...
106a96307612318fb66246486e7226069e5508ac
<|skeleton|> class WBSResourceHandler: """URI: /api/wbs/%project_number%/%wbs_id%/ VERBS: GET, PUT, DELETE Handles a single instance of WorkItem""" def read(self, request, project_number, wbs_id): """View a work item""" <|body_0|> def update(self, request, project_number, wbs_id): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WBSResourceHandler: """URI: /api/wbs/%project_number%/%wbs_id%/ VERBS: GET, PUT, DELETE Handles a single instance of WorkItem""" def read(self, request, project_number, wbs_id): """View a work item""" log.debug('GET request from user %s for work item %s' % (request.user, wbs_id)) ...
the_stack_v2_python_sparse
branches/rest-api-branch/django-project-management/wbs/api_views.py
NhaTrang/django-project-management
train
0
fdb5778578e52f90d20b075d10b680bb3c0c7bbc
[ "Command.__init__(self)\nself.__stat: bool = False\n'\\n If True stat must be called for each file.\\n '\nself._io: Optional[BackupPcCloneStyle] = None\n'\\n The output style.\\n '\nself.__dir_count: int = 0\n'\\n The number of directories counted.\\n '\nself.__file_count: ...
<|body_start_0|> Command.__init__(self) self.__stat: bool = False '\n If True stat must be called for each file.\n ' self._io: Optional[BackupPcCloneStyle] = None '\n The output style.\n ' self.__dir_count: int = 0 '\n The number...
Traversing recursively a directory performance test traverse-performance-test {--stat : Get status of each file} {dir : The start directory}
TraversePerformanceTestCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TraversePerformanceTestCommand: """Traversing recursively a directory performance test traverse-performance-test {--stat : Get status of each file} {dir : The start directory}""" def __init__(self): """Object constructor.""" <|body_0|> def __traverse(self, path: str) -> ...
stack_v2_sparse_classes_36k_train_025529
3,701
permissive
[ { "docstring": "Object constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Traverse recursively a directory. @param str path: The path to the directory.", "name": "__traverse", "signature": "def __traverse(self, path: str) -> None" }, { "docstr...
5
stack_v2_sparse_classes_30k_train_005095
Implement the Python class `TraversePerformanceTestCommand` described below. Class description: Traversing recursively a directory performance test traverse-performance-test {--stat : Get status of each file} {dir : The start directory} Method signatures and docstrings: - def __init__(self): Object constructor. - def...
Implement the Python class `TraversePerformanceTestCommand` described below. Class description: Traversing recursively a directory performance test traverse-performance-test {--stat : Get status of each file} {dir : The start directory} Method signatures and docstrings: - def __init__(self): Object constructor. - def...
a4009868f6cbec42f247f392965077c55f7265c5
<|skeleton|> class TraversePerformanceTestCommand: """Traversing recursively a directory performance test traverse-performance-test {--stat : Get status of each file} {dir : The start directory}""" def __init__(self): """Object constructor.""" <|body_0|> def __traverse(self, path: str) -> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TraversePerformanceTestCommand: """Traversing recursively a directory performance test traverse-performance-test {--stat : Get status of each file} {dir : The start directory}""" def __init__(self): """Object constructor.""" Command.__init__(self) self.__stat: bool = False ...
the_stack_v2_python_sparse
backuppc_clone/command/TraversePerformanceTestCommand.py
SetBased/BackupPC-Clone
train
7
ce09c5435d6c5f682c1bfa604690526706457759
[ "self.parent = parent\nself.MODULE = MODULE\nself.buttons = {}\nself.buttons['io'] = {}\nself.buttons['io'] = makeButtons_io(self)\nself.currentlyToggledFilterButton = None\nself.setEnabled('test', True)\nself.loadSaveButtonLayout = qt.QVBoxLayout()\nself.loadSaveButtonLayout.addWidget(self.buttons['io']['load'])\n...
<|body_start_0|> self.parent = parent self.MODULE = MODULE self.buttons = {} self.buttons['io'] = {} self.buttons['io'] = makeButtons_io(self) self.currentlyToggledFilterButton = None self.setEnabled('test', True) self.loadSaveButtonLayout = qt.QVBoxLayout...
Creates buttons for the GUI and calls respective workflows.
Buttons
[ "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Buttons: """Creates buttons for the GUI and calls respective workflows.""" def __init__(self, parent=None, MODULE=None): """Create buttons""" <|body_0|> def getButtonList(self, keys): """Returns a list of buttons as provided by key.""" <|body_1|> def...
stack_v2_sparse_classes_36k_train_025530
7,943
permissive
[ { "docstring": "Create buttons", "name": "__init__", "signature": "def __init__(self, parent=None, MODULE=None)" }, { "docstring": "Returns a list of buttons as provided by key.", "name": "getButtonList", "signature": "def getButtonList(self, keys)" }, { "docstring": "Sets a butt...
3
stack_v2_sparse_classes_30k_test_000476
Implement the Python class `Buttons` described below. Class description: Creates buttons for the GUI and calls respective workflows. Method signatures and docstrings: - def __init__(self, parent=None, MODULE=None): Create buttons - def getButtonList(self, keys): Returns a list of buttons as provided by key. - def set...
Implement the Python class `Buttons` described below. Class description: Creates buttons for the GUI and calls respective workflows. Method signatures and docstrings: - def __init__(self, parent=None, MODULE=None): Create buttons - def getButtonList(self, keys): Returns a list of buttons as provided by key. - def set...
06867037842e2a074ae5ed3b0bdf4bf016a231a5
<|skeleton|> class Buttons: """Creates buttons for the GUI and calls respective workflows.""" def __init__(self, parent=None, MODULE=None): """Create buttons""" <|body_0|> def getButtonList(self, keys): """Returns a list of buttons as provided by key.""" <|body_1|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Buttons: """Creates buttons for the GUI and calls respective workflows.""" def __init__(self, parent=None, MODULE=None): """Create buttons""" self.parent = parent self.MODULE = MODULE self.buttons = {} self.buttons['io'] = {} self.buttons['io'] = makeButton...
the_stack_v2_python_sparse
XNATSlicer/XnatSlicerLib/ui/Buttons.py
NrgXnat/XNATSlicer
train
4
15ccc943e0468f0eae8faa9d04c44b7a0a71f722
[ "claims = get_jwt_claims()\nif claims['user_id'] != user_id:\n return auth_util.make_json_response('fail', 'cannot access', 401)\nif item_id is None:\n elements = list_item.Item.query.filter_by(owner_id=user_id).all()\nelse:\n elements = list_item.Item.query.filter_by(owner_id=user_id, id=item_id).all()\nr...
<|body_start_0|> claims = get_jwt_claims() if claims['user_id'] != user_id: return auth_util.make_json_response('fail', 'cannot access', 401) if item_id is None: elements = list_item.Item.query.filter_by(owner_id=user_id).all() else: elements = list_it...
items CRUD endpoints
ItemAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemAPI: """items CRUD endpoints""" def get(self, user_id, item_id): """query items""" <|body_0|> def post(self, user_id): """add items""" <|body_1|> def delete(self, user_id, item_id): """delete items""" <|body_2|> def put(self,...
stack_v2_sparse_classes_36k_train_025531
3,844
no_license
[ { "docstring": "query items", "name": "get", "signature": "def get(self, user_id, item_id)" }, { "docstring": "add items", "name": "post", "signature": "def post(self, user_id)" }, { "docstring": "delete items", "name": "delete", "signature": "def delete(self, user_id, it...
4
stack_v2_sparse_classes_30k_train_016828
Implement the Python class `ItemAPI` described below. Class description: items CRUD endpoints Method signatures and docstrings: - def get(self, user_id, item_id): query items - def post(self, user_id): add items - def delete(self, user_id, item_id): delete items - def put(self, user_id, item_id): update items
Implement the Python class `ItemAPI` described below. Class description: items CRUD endpoints Method signatures and docstrings: - def get(self, user_id, item_id): query items - def post(self, user_id): add items - def delete(self, user_id, item_id): delete items - def put(self, user_id, item_id): update items <|skel...
d4eee301075efbc2c34315d5c18d1f19ffbe5047
<|skeleton|> class ItemAPI: """items CRUD endpoints""" def get(self, user_id, item_id): """query items""" <|body_0|> def post(self, user_id): """add items""" <|body_1|> def delete(self, user_id, item_id): """delete items""" <|body_2|> def put(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemAPI: """items CRUD endpoints""" def get(self, user_id, item_id): """query items""" claims = get_jwt_claims() if claims['user_id'] != user_id: return auth_util.make_json_response('fail', 'cannot access', 401) if item_id is None: elements = list_i...
the_stack_v2_python_sparse
api/items.py
chenfei531/todo-list
train
0
7f9579cec51eae360518ae957b933d74f01ab2ec
[ "account = self.model(*args, email=self.normalize_email(email), **kwargs)\naccount.save()\naccount.set_password(password)\naccount.save()\nreturn account", "account = self.create_user(email, *args, password=password, **kwargs)\naccount.is_admin = True\naccount.save()\nreturn account" ]
<|body_start_0|> account = self.model(*args, email=self.normalize_email(email), **kwargs) account.save() account.set_password(password) account.save() return account <|end_body_0|> <|body_start_1|> account = self.create_user(email, *args, password=password, **kwargs) ...
Account Manager Extends django.contrib.auth.models.BaseUserManager
AccountManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountManager: """Account Manager Extends django.contrib.auth.models.BaseUserManager""" def create_user(self, email, password=None, *args, **kwargs): """Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.cont...
stack_v2_sparse_classes_36k_train_025532
3,971
no_license
[ { "docstring": "Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUserManager.create_user", "name": "create_user", "signature": "def create_user(self, email, password=None, *args, **kwargs)" }, { ...
2
stack_v2_sparse_classes_30k_val_000811
Implement the Python class `AccountManager` described below. Class description: Account Manager Extends django.contrib.auth.models.BaseUserManager Method signatures and docstrings: - def create_user(self, email, password=None, *args, **kwargs): Create a new Account Also assign the user an auth_token https://docs.djan...
Implement the Python class `AccountManager` described below. Class description: Account Manager Extends django.contrib.auth.models.BaseUserManager Method signatures and docstrings: - def create_user(self, email, password=None, *args, **kwargs): Create a new Account Also assign the user an auth_token https://docs.djan...
f97c07bf62776ba965affe832caa099f423328fd
<|skeleton|> class AccountManager: """Account Manager Extends django.contrib.auth.models.BaseUserManager""" def create_user(self, email, password=None, *args, **kwargs): """Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.cont...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountManager: """Account Manager Extends django.contrib.auth.models.BaseUserManager""" def create_user(self, email, password=None, *args, **kwargs): """Create a new Account Also assign the user an auth_token https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.mode...
the_stack_v2_python_sparse
guru_api/core/models/account.py
mroyce/guru_api
train
0
6bc4d93ab82b5b45e0edaab7902b040b5c561a9b
[ "l = open(list_file).readlines()\nl = [i.split() for i in l]\nl = [(i[0], i[2]) for i in l]\nd = {}\nfor matrix_file, name in l:\n filename = '%s.pfm' % (matrix_file,)\n matrix_file = os.path.join(matrix_dir, filename)\n d[name] = PWM(self.load_matrix(matrix_file))\nreturn d", "f = open(matrix_file)\nl =...
<|body_start_0|> l = open(list_file).readlines() l = [i.split() for i in l] l = [(i[0], i[2]) for i in l] d = {} for matrix_file, name in l: filename = '%s.pfm' % (matrix_file,) matrix_file = os.path.join(matrix_dir, filename) d[name] = PWM(sel...
Jaspar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Jaspar: def load(self, list_file, matrix_dir): """Load all of the matrices in list_file from matrix_dir. Return a dictionary of PWM objects.""" <|body_0|> def load_matrix(self, matrix_file): """Load an individual matrix into a motility-compatible format.""" <...
stack_v2_sparse_classes_36k_train_025533
1,568
no_license
[ { "docstring": "Load all of the matrices in list_file from matrix_dir. Return a dictionary of PWM objects.", "name": "load", "signature": "def load(self, list_file, matrix_dir)" }, { "docstring": "Load an individual matrix into a motility-compatible format.", "name": "load_matrix", "sign...
2
null
Implement the Python class `Jaspar` described below. Class description: Implement the Jaspar class. Method signatures and docstrings: - def load(self, list_file, matrix_dir): Load all of the matrices in list_file from matrix_dir. Return a dictionary of PWM objects. - def load_matrix(self, matrix_file): Load an indivi...
Implement the Python class `Jaspar` described below. Class description: Implement the Jaspar class. Method signatures and docstrings: - def load(self, list_file, matrix_dir): Load all of the matrices in list_file from matrix_dir. Return a dictionary of PWM objects. - def load_matrix(self, matrix_file): Load an indivi...
7b3f4da9cdefd7680f07b707339aee59faece1d2
<|skeleton|> class Jaspar: def load(self, list_file, matrix_dir): """Load all of the matrices in list_file from matrix_dir. Return a dictionary of PWM objects.""" <|body_0|> def load_matrix(self, matrix_file): """Load an individual matrix into a motility-compatible format.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Jaspar: def load(self, list_file, matrix_dir): """Load all of the matrices in list_file from matrix_dir. Return a dictionary of PWM objects.""" l = open(list_file).readlines() l = [i.split() for i in l] l = [(i[0], i[2]) for i in l] d = {} for matrix_file, name ...
the_stack_v2_python_sparse
TranscriptionFactors/JASPAR.py
neilrobertson/BICRCode
train
0
d248e953d7c346dfbb86386214ace38ead345ca7
[ "self._char_index = char_index\nself._fixed_length_text = fixed_length_text\nself._fixed_length_word = fixed_length_word", "idx = np.zeros((self._fixed_length_text, self._fixed_length_word))\nfor i in range(min(len(input_), self._fixed_length_text)):\n for j in range(min(len(input_[i]), self._fixed_length_word...
<|body_start_0|> self._char_index = char_index self._fixed_length_text = fixed_length_text self._fixed_length_word = fixed_length_word <|end_body_0|> <|body_start_1|> idx = np.zeros((self._fixed_length_text, self._fixed_length_word)) for i in range(min(len(input_), self._fixed_l...
CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prerequisite of :class:`CharacterIndexUnit`. Ex...
CharacterIndex
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CharacterIndex: """CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prere...
stack_v2_sparse_classes_36k_train_025534
2,019
permissive
[ { "docstring": "Class initialization. :param char_index: character-index mapping generated by :class:'VocabularyUnit'. :param fixed_length_text: maximize length of a text. :param fixed_length_word: maximize length of a word.", "name": "__init__", "signature": "def __init__(self, char_index: dict, fixed_...
2
stack_v2_sparse_classes_30k_train_008488
Implement the Python class `CharacterIndex` described below. Class description: CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`...
Implement the Python class `CharacterIndex` described below. Class description: CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`...
1f763062c6cc861e93ccdba23d0f1f0171f74145
<|skeleton|> class CharacterIndex: """CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prere...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CharacterIndex: """CharacterIndexUnit for DIIN model. The input of :class:'CharacterIndexUnit' should be a list of word character list extracted from a text. The output is the character index representation of this text. :class:`NgramLetterUnit` and :class:`VocabularyUnit` are two essential prerequisite of :c...
the_stack_v2_python_sparse
matchzoo/preprocessors/units/character_index.py
JRetza/MatchZoo
train
1
f6d87c59d8b6f1ec8386c57d2dd47c82b169a4c6
[ "super().init_app(app)\nself._register_signals(app)\napp.errorhandler(RESTException)(handle_rest_exceptions)", "register_circulation_signals()\nregister_files_signals()\nregister_record_signals()\nif app.config['EXTEND_LOANS_LOCATION_UPDATED']:\n register_location_signals()" ]
<|body_start_0|> super().init_app(app) self._register_signals(app) app.errorhandler(RESTException)(handle_rest_exceptions) <|end_body_0|> <|body_start_1|> register_circulation_signals() register_files_signals() register_record_signals() if app.config['EXTEND_LOAN...
Invenio App ILS REST API app.
InvenioAppIlsREST
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenioAppIlsREST: """Invenio App ILS REST API app.""" def init_app(self, app): """Flask application initialization.""" <|body_0|> def _register_signals(self, app): """Register signals.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().ini...
stack_v2_sparse_classes_36k_train_025535
11,406
permissive
[ { "docstring": "Flask application initialization.", "name": "init_app", "signature": "def init_app(self, app)" }, { "docstring": "Register signals.", "name": "_register_signals", "signature": "def _register_signals(self, app)" } ]
2
null
Implement the Python class `InvenioAppIlsREST` described below. Class description: Invenio App ILS REST API app. Method signatures and docstrings: - def init_app(self, app): Flask application initialization. - def _register_signals(self, app): Register signals.
Implement the Python class `InvenioAppIlsREST` described below. Class description: Invenio App ILS REST API app. Method signatures and docstrings: - def init_app(self, app): Flask application initialization. - def _register_signals(self, app): Register signals. <|skeleton|> class InvenioAppIlsREST: """Invenio Ap...
1c36526e85510100c5f64059518d1b716d87ac10
<|skeleton|> class InvenioAppIlsREST: """Invenio App ILS REST API app.""" def init_app(self, app): """Flask application initialization.""" <|body_0|> def _register_signals(self, app): """Register signals.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvenioAppIlsREST: """Invenio App ILS REST API app.""" def init_app(self, app): """Flask application initialization.""" super().init_app(app) self._register_signals(app) app.errorhandler(RESTException)(handle_rest_exceptions) def _register_signals(self, app): ...
the_stack_v2_python_sparse
invenio_app_ils/ext.py
inveniosoftware/invenio-app-ils
train
64
14ff886cf8e7ca95a2370c82a29cfd00c80b98b0
[ "super().__init__(reporting_config, password)\nself.hostname = reporting_config['sftp_hostname']\nself.port = reporting_config['sftp_port']\nself.username = reporting_config['sftp_username']\nself.file_path = reporting_config['sftp_file_path']", "data_report_zipped = super().send(files)\nLOGGER.info('Connecting v...
<|body_start_0|> super().__init__(reporting_config, password) self.hostname = reporting_config['sftp_hostname'] self.port = reporting_config['sftp_port'] self.username = reporting_config['sftp_username'] self.file_path = reporting_config['sftp_file_path'] <|end_body_0|> <|body_s...
Class that handles sending an enterprise report file via SFTP.
SFTPDeliveryMethod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SFTPDeliveryMethod: """Class that handles sending an enterprise report file via SFTP.""" def __init__(self, reporting_config, password): """Initialize the SFTP Delivery Method.""" <|body_0|> def send(self, files): """Send the given files in zip format through SFT...
stack_v2_sparse_classes_36k_train_025536
4,537
no_license
[ { "docstring": "Initialize the SFTP Delivery Method.", "name": "__init__", "signature": "def __init__(self, reporting_config, password)" }, { "docstring": "Send the given files in zip format through SFTP.", "name": "send", "signature": "def send(self, files)" } ]
2
stack_v2_sparse_classes_30k_train_019408
Implement the Python class `SFTPDeliveryMethod` described below. Class description: Class that handles sending an enterprise report file via SFTP. Method signatures and docstrings: - def __init__(self, reporting_config, password): Initialize the SFTP Delivery Method. - def send(self, files): Send the given files in z...
Implement the Python class `SFTPDeliveryMethod` described below. Class description: Class that handles sending an enterprise report file via SFTP. Method signatures and docstrings: - def __init__(self, reporting_config, password): Initialize the SFTP Delivery Method. - def send(self, files): Send the given files in z...
d16a25b035b2e810b8ab2b0a2ac032b216562e26
<|skeleton|> class SFTPDeliveryMethod: """Class that handles sending an enterprise report file via SFTP.""" def __init__(self, reporting_config, password): """Initialize the SFTP Delivery Method.""" <|body_0|> def send(self, files): """Send the given files in zip format through SFT...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SFTPDeliveryMethod: """Class that handles sending an enterprise report file via SFTP.""" def __init__(self, reporting_config, password): """Initialize the SFTP Delivery Method.""" super().__init__(reporting_config, password) self.hostname = reporting_config['sftp_hostname'] ...
the_stack_v2_python_sparse
edx/app/analytics_api/venvs/analytics_api/lib/python2.7/site-packages/enterprise_reporting/delivery_method.py
JosiahKennedy/openedx-branded
train
0
a6b3015fc549deb25860dd8e3af128909cce6875
[ "self.window.erase()\nself.draw_headers()\nself.draw_columns()", "i = 1\nlist_max = max(0, self.model.maxy - i)\nfor user in self.model.sorted_users[:list_max]:\n j = 0\n user_data = self.model.user_data[user]\n for key in self.model.sorted_columns:\n value = Model.columns[key]['format'].format(us...
<|body_start_0|> self.window.erase() self.draw_headers() self.draw_columns() <|end_body_0|> <|body_start_1|> i = 1 list_max = max(0, self.model.maxy - i) for user in self.model.sorted_users[:list_max]: j = 0 user_data = self.model.user_data[user] ...
Draw the content of utop. This is the list of users with the other selected columns.
Content
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Content: """Draw the content of utop. This is the list of users with the other selected columns.""" def draw(self): """Draw the whole pane.""" <|body_0|> def draw_columns(self): """Draw the values of the sorted columns, per line.""" <|body_1|> def dr...
stack_v2_sparse_classes_36k_train_025537
1,707
permissive
[ { "docstring": "Draw the whole pane.", "name": "draw", "signature": "def draw(self)" }, { "docstring": "Draw the values of the sorted columns, per line.", "name": "draw_columns", "signature": "def draw_columns(self)" }, { "docstring": "Draw the headers of the content view.", ...
3
stack_v2_sparse_classes_30k_train_015625
Implement the Python class `Content` described below. Class description: Draw the content of utop. This is the list of users with the other selected columns. Method signatures and docstrings: - def draw(self): Draw the whole pane. - def draw_columns(self): Draw the values of the sorted columns, per line. - def draw_h...
Implement the Python class `Content` described below. Class description: Draw the content of utop. This is the list of users with the other selected columns. Method signatures and docstrings: - def draw(self): Draw the whole pane. - def draw_columns(self): Draw the values of the sorted columns, per line. - def draw_h...
62fb0d3cc8151161b7225a3b95b7715fb68898e2
<|skeleton|> class Content: """Draw the content of utop. This is the list of users with the other selected columns.""" def draw(self): """Draw the whole pane.""" <|body_0|> def draw_columns(self): """Draw the values of the sorted columns, per line.""" <|body_1|> def dr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Content: """Draw the content of utop. This is the list of users with the other selected columns.""" def draw(self): """Draw the whole pane.""" self.window.erase() self.draw_headers() self.draw_columns() def draw_columns(self): """Draw the values of the sorted ...
the_stack_v2_python_sparse
utop/views/content.py
leonkoens/utop
train
0
a7b81163f4ad5fbba39e6f9aa1c14c3594a51ddf
[ "while True:\n end_time = timezone.now()\n start_time = end_time - timedelta(minutes=3)\n info = Monitor_Resource.objects.values('ip').distinct()\n for i in info:\n _ip = i['ip']\n _time = start_time\n error_info = get_error_info(_ip, _time)\n if error_info:\n self...
<|body_start_0|> while True: end_time = timezone.now() start_time = end_time - timedelta(minutes=3) info = Monitor_Resource.objects.values('ip').distinct() for i in info: _ip = i['ip'] _time = start_time error_info =...
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: def handle(self, *args, **kwargs): """监控进程 :param: 接受所有参数 :return: 无""" <|body_0|> def ding_push_message(self, err_info): """报错发送钉钉群 :param err_info:报错信息 :return: 无""" <|body_1|> <|end_skeleton|> <|body_start_0|> while True: end...
stack_v2_sparse_classes_36k_train_025538
1,987
no_license
[ { "docstring": "监控进程 :param: 接受所有参数 :return: 无", "name": "handle", "signature": "def handle(self, *args, **kwargs)" }, { "docstring": "报错发送钉钉群 :param err_info:报错信息 :return: 无", "name": "ding_push_message", "signature": "def ding_push_message(self, err_info)" } ]
2
stack_v2_sparse_classes_30k_train_013194
Implement the Python class `Command` described below. Class description: Implement the Command class. Method signatures and docstrings: - def handle(self, *args, **kwargs): 监控进程 :param: 接受所有参数 :return: 无 - def ding_push_message(self, err_info): 报错发送钉钉群 :param err_info:报错信息 :return: 无
Implement the Python class `Command` described below. Class description: Implement the Command class. Method signatures and docstrings: - def handle(self, *args, **kwargs): 监控进程 :param: 接受所有参数 :return: 无 - def ding_push_message(self, err_info): 报错发送钉钉群 :param err_info:报错信息 :return: 无 <|skeleton|> class Command: ...
4febccac57bfa5f7ef46f5f57e52206c8b0a57ac
<|skeleton|> class Command: def handle(self, *args, **kwargs): """监控进程 :param: 接受所有参数 :return: 无""" <|body_0|> def ding_push_message(self, err_info): """报错发送钉钉群 :param err_info:报错信息 :return: 无""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: def handle(self, *args, **kwargs): """监控进程 :param: 接受所有参数 :return: 无""" while True: end_time = timezone.now() start_time = end_time - timedelta(minutes=3) info = Monitor_Resource.objects.values('ip').distinct() for i in info: ...
the_stack_v2_python_sparse
item/dev/cmdb/asset/management/commands/monitor.py
soulorman/Python
train
0
141b0f482d83f59d0ce0cd3876554b1174f53c6c
[ "self.reactions = tuple()\nfor app_name in app_names:\n a = __import__('apps.%s' % app_name, globals(), locals(), ['controller'], -1)\n self.reactions += a.controller.reactions\nself.app_names = app_names", "for msg in msg_set:\n for test, response in self.reactions:\n if test(msg):\n r...
<|body_start_0|> self.reactions = tuple() for app_name in app_names: a = __import__('apps.%s' % app_name, globals(), locals(), ['controller'], -1) self.reactions += a.controller.reactions self.app_names = app_names <|end_body_0|> <|body_start_1|> for msg in msg_s...
a Controller instance is initialized with the names of the apps which it manages using its control() method, which takes a message set and runs each apps tests on each message on the set, performing the app's response if the test returns true.
Controller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Controller: """a Controller instance is initialized with the names of the apps which it manages using its control() method, which takes a message set and runs each apps tests on each message on the set, performing the app's response if the test returns true.""" def __init__(self, app_names):...
stack_v2_sparse_classes_36k_train_025539
1,097
no_license
[ { "docstring": "Instantiate a controller. Argument: app_names -- the names of apps to manage (corresponding to dirs in the apps subdir)", "name": "__init__", "signature": "def __init__(self, app_names)" }, { "docstring": "Run all apps' tests on each message, call associated response if test pass...
2
stack_v2_sparse_classes_30k_train_019484
Implement the Python class `Controller` described below. Class description: a Controller instance is initialized with the names of the apps which it manages using its control() method, which takes a message set and runs each apps tests on each message on the set, performing the app's response if the test returns true....
Implement the Python class `Controller` described below. Class description: a Controller instance is initialized with the names of the apps which it manages using its control() method, which takes a message set and runs each apps tests on each message on the set, performing the app's response if the test returns true....
67a08382182804413e31992d38e2303038359ad7
<|skeleton|> class Controller: """a Controller instance is initialized with the names of the apps which it manages using its control() method, which takes a message set and runs each apps tests on each message on the set, performing the app's response if the test returns true.""" def __init__(self, app_names):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Controller: """a Controller instance is initialized with the names of the apps which it manages using its control() method, which takes a message set and runs each apps tests on each message on the set, performing the app's response if the test returns true.""" def __init__(self, app_names): """I...
the_stack_v2_python_sparse
core/controller.py
gabeos/python-samosa
train
0
7a02d49108d79b2075ab25f1edbb3626dee48182
[ "super().__init__(parent)\nself.hold = hold\nself.color = color\nself.items = items\nself.initUi()", "layout = QGridLayout()\nwidth = 100\nheight = 40\nroundness = 20\nstyle = '\\n QLabel {\\n color: white;\\n font-weight: bold;\\n font-size: 15pt;\\n ...
<|body_start_0|> super().__init__(parent) self.hold = hold self.color = color self.items = items self.initUi() <|end_body_0|> <|body_start_1|> layout = QGridLayout() width = 100 height = 40 roundness = 20 style = '\n QLabel {\n ...
Food Menu widget.
Menu
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Menu: """Food Menu widget.""" def __init__(self, items, color, parent, hold=None): """Init.""" <|body_0|> def initUi(self): """Ui Setup.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(parent) self.hold = hold se...
stack_v2_sparse_classes_36k_train_025540
2,585
no_license
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, items, color, parent, hold=None)" }, { "docstring": "Ui Setup.", "name": "initUi", "signature": "def initUi(self)" } ]
2
stack_v2_sparse_classes_30k_train_018077
Implement the Python class `Menu` described below. Class description: Food Menu widget. Method signatures and docstrings: - def __init__(self, items, color, parent, hold=None): Init. - def initUi(self): Ui Setup.
Implement the Python class `Menu` described below. Class description: Food Menu widget. Method signatures and docstrings: - def __init__(self, items, color, parent, hold=None): Init. - def initUi(self): Ui Setup. <|skeleton|> class Menu: """Food Menu widget.""" def __init__(self, items, color, parent, hold=...
a5d18593e689123cac34af552628ed2818ca5d59
<|skeleton|> class Menu: """Food Menu widget.""" def __init__(self, items, color, parent, hold=None): """Init.""" <|body_0|> def initUi(self): """Ui Setup.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Menu: """Food Menu widget.""" def __init__(self, items, color, parent, hold=None): """Init.""" super().__init__(parent) self.hold = hold self.color = color self.items = items self.initUi() def initUi(self): """Ui Setup.""" layout = QGri...
the_stack_v2_python_sparse
Menu.py
edgary777/lonchepos
train
0
38d366da53e354e605dc1347c9dbf4159326c6b8
[ "super(Mailer, self).__init__(config)\ntry:\n self._server = self.cfg['smtp_server']\n self._port = self.cfg.get('smtp_port')\nexcept KeyError as ex:\n raise ConfigurationException('Missing email notification ' + 'configuration property: ' + str(ex))\nexcept (ValueError, TypeError) as ex:\n raise Config...
<|body_start_0|> super(Mailer, self).__init__(config) try: self._server = self.cfg['smtp_server'] self._port = self.cfg.get('smtp_port') except KeyError as ex: raise ConfigurationException('Missing email notification ' + 'configuration property: ' + str(ex)) ...
A ChannelService that can send notifications via email
Mailer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mailer: """A ChannelService that can send notifications via email""" def __init__(self, config): """configure the Mailer. The following configuration properties are supported: :prop smtp_server str: the ISDN of the SMTP server to send email messages to (required). :prop smtp_port int...
stack_v2_sparse_classes_36k_train_025541
11,683
no_license
[ { "docstring": "configure the Mailer. The following configuration properties are supported: :prop smtp_server str: the ISDN of the SMTP server to send email messages to (required). :prop smtp_port int: the port of the SMTP server to connect to", "name": "__init__", "signature": "def __init__(self, confi...
2
stack_v2_sparse_classes_30k_train_017422
Implement the Python class `Mailer` described below. Class description: A ChannelService that can send notifications via email Method signatures and docstrings: - def __init__(self, config): configure the Mailer. The following configuration properties are supported: :prop smtp_server str: the ISDN of the SMTP server ...
Implement the Python class `Mailer` described below. Class description: A ChannelService that can send notifications via email Method signatures and docstrings: - def __init__(self, config): configure the Mailer. The following configuration properties are supported: :prop smtp_server str: the ISDN of the SMTP server ...
da8ddb1984a886e820827d3e757001a6c65af414
<|skeleton|> class Mailer: """A ChannelService that can send notifications via email""" def __init__(self, config): """configure the Mailer. The following configuration properties are supported: :prop smtp_server str: the ISDN of the SMTP server to send email messages to (required). :prop smtp_port int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mailer: """A ChannelService that can send notifications via email""" def __init__(self, config): """configure the Mailer. The following configuration properties are supported: :prop smtp_server str: the ISDN of the SMTP server to send email messages to (required). :prop smtp_port int: the port of...
the_stack_v2_python_sparse
python/nistoar/pdr/notify/email.py
usnistgov/oar-pdr
train
12
909c19e71235294769d0d2ffdbc9837e3da62293
[ "query = 'doi:\"{}\"'.format(doi)\nparams = deepcopy(self.params)\nparams['q'] = query\nres = requests.get(self.url, params=params)\nconceptdoi = None\nif res.ok:\n if res.json()['hits']['total'] == 1:\n conceptdoi = res.json()['hits']['hits'][0].get('conceptdoi')\n else:\n conceptdoi = doi\nels...
<|body_start_0|> query = 'doi:"{}"'.format(doi) params = deepcopy(self.params) params['q'] = query res = requests.get(self.url, params=params) conceptdoi = None if res.ok: if res.json()['hits']['total'] == 1: conceptdoi = res.json()['hits']['hi...
Zenodo client.
ZenodoClient
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZenodoClient: """Zenodo client.""" def get_concept_doi(self, doi: str) -> str: """.""" <|body_0|> def get_versions(self, conceptdoi) -> List[str]: """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = 'doi:"{}"'.format(doi) params...
stack_v2_sparse_classes_36k_train_025542
7,198
permissive
[ { "docstring": ".", "name": "get_concept_doi", "signature": "def get_concept_doi(self, doi: str) -> str" }, { "docstring": ".", "name": "get_versions", "signature": "def get_versions(self, conceptdoi) -> List[str]" } ]
2
stack_v2_sparse_classes_30k_val_000521
Implement the Python class `ZenodoClient` described below. Class description: Zenodo client. Method signatures and docstrings: - def get_concept_doi(self, doi: str) -> str: . - def get_versions(self, conceptdoi) -> List[str]: .
Implement the Python class `ZenodoClient` described below. Class description: Zenodo client. Method signatures and docstrings: - def get_concept_doi(self, doi: str) -> str: . - def get_versions(self, conceptdoi) -> List[str]: . <|skeleton|> class ZenodoClient: """Zenodo client.""" def get_concept_doi(self, ...
e7d24f8723ab1dc16213a5797a15c57a3a453d3e
<|skeleton|> class ZenodoClient: """Zenodo client.""" def get_concept_doi(self, doi: str) -> str: """.""" <|body_0|> def get_versions(self, conceptdoi) -> List[str]: """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZenodoClient: """Zenodo client.""" def get_concept_doi(self, doi: str) -> str: """.""" query = 'doi:"{}"'.format(doi) params = deepcopy(self.params) params['q'] = query res = requests.get(self.url, params=params) conceptdoi = None if res.ok: ...
the_stack_v2_python_sparse
asclepias_broker/harvester/zenodo.py
asclepias/asclepias-broker
train
11
1447754c4822da2b93fbc0d2875a771e87987efb
[ "mock_client = Taxii2FeedClient(url='', collection_to_fetch='default', proxies=[], verify=False, objects_to_fetch=[])\ndefault_id = 1\nnondefault_id = 2\nmock_client.collections = [MockCollection(default_id, 'default'), MockCollection(nondefault_id, 'not_default')]\nmock_client.collection_to_fetch = mock_client.col...
<|body_start_0|> mock_client = Taxii2FeedClient(url='', collection_to_fetch='default', proxies=[], verify=False, objects_to_fetch=[]) default_id = 1 nondefault_id = 2 mock_client.collections = [MockCollection(default_id, 'default'), MockCollection(nondefault_id, 'not_default')] m...
Scenario: Test fetch_indicators_command
TestFetchIndicators
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFetchIndicators: """Scenario: Test fetch_indicators_command""" def test_single_no_context(self, mocker): """Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - ini...
stack_v2_sparse_classes_36k_train_025543
12,922
permissive
[ { "docstring": "Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - initial interval is `1 day` When: - fetch_indicators_command is called Then: - update last run with latest collection fetch tim...
4
null
Implement the Python class `TestFetchIndicators` described below. Class description: Scenario: Test fetch_indicators_command Method signatures and docstrings: - def test_single_no_context(self, mocker): Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'defau...
Implement the Python class `TestFetchIndicators` described below. Class description: Scenario: Test fetch_indicators_command Method signatures and docstrings: - def test_single_no_context(self, mocker): Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'defau...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestFetchIndicators: """Scenario: Test fetch_indicators_command""" def test_single_no_context(self, mocker): """Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFetchIndicators: """Scenario: Test fetch_indicators_command""" def test_single_no_context(self, mocker): """Scenario: Test single collection fetch with no last run Given: - collection to fetch is available and set to 'default' - there is no integration context - limit is -1 - initial interval...
the_stack_v2_python_sparse
Packs/FeedTAXII/Integrations/FeedTAXII2/FeedTAXII2_test.py
demisto/content
train
1,023
29f820b4252f2d4c6c6853aeb8d16fbd474eac36
[ "key = NodeCache.generate_key(node, user_id)\ndb_node_cache = get_db_connector().node_cache.find({'key': key}).sort('insertion_date', -1).limit(1)\ncaches = list(db_node_cache)\nif len(caches):\n return NodeCache.from_dict(caches[0])\nelse:\n return None", "assert node.node_running_status == NodeRunningStat...
<|body_start_0|> key = NodeCache.generate_key(node, user_id) db_node_cache = get_db_connector().node_cache.find({'key': key}).sort('insertion_date', -1).limit(1) caches = list(db_node_cache) if len(caches): return NodeCache.from_dict(caches[0]) else: retur...
The Node cache interface. The cache is defined by Node's - parent_node - inputs - parameters
NodeCacheManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeCacheManager: """The Node cache interface. The cache is defined by Node's - parent_node - inputs - parameters""" def get(node, user_id): """Pull NodeCache if exists. Args: node (Node): Node object user_id (ObjectId, str): User ID Return: (NodeCache) NodeCache or None""" <...
stack_v2_sparse_classes_36k_train_025544
1,729
permissive
[ { "docstring": "Pull NodeCache if exists. Args: node (Node): Node object user_id (ObjectId, str): User ID Return: (NodeCache) NodeCache or None", "name": "get", "signature": "def get(node, user_id)" }, { "docstring": "Create NodeCache instance in the database. Args: node (Node): Node object grap...
2
stack_v2_sparse_classes_30k_train_011310
Implement the Python class `NodeCacheManager` described below. Class description: The Node cache interface. The cache is defined by Node's - parent_node - inputs - parameters Method signatures and docstrings: - def get(node, user_id): Pull NodeCache if exists. Args: node (Node): Node object user_id (ObjectId, str): U...
Implement the Python class `NodeCacheManager` described below. Class description: The Node cache interface. The cache is defined by Node's - parent_node - inputs - parameters Method signatures and docstrings: - def get(node, user_id): Pull NodeCache if exists. Args: node (Node): Node object user_id (ObjectId, str): U...
82f9312c92be1881fa744da11d806ed6c11d5c3b
<|skeleton|> class NodeCacheManager: """The Node cache interface. The cache is defined by Node's - parent_node - inputs - parameters""" def get(node, user_id): """Pull NodeCache if exists. Args: node (Node): Node object user_id (ObjectId, str): User ID Return: (NodeCache) NodeCache or None""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeCacheManager: """The Node cache interface. The cache is defined by Node's - parent_node - inputs - parameters""" def get(node, user_id): """Pull NodeCache if exists. Args: node (Node): Node object user_id (ObjectId, str): User ID Return: (NodeCache) NodeCache or None""" key = NodeCach...
the_stack_v2_python_sparse
plynx/db/node_cache_manager.py
techiev2/plynx
train
0
e86f1c7a0e3a96fb935e2035487a64cfe5652a13
[ "super(Repoquery, self).__init__(None)\nself.name = name\nself.query_type = query_type\nself.show_duplicates = show_duplicates\nself.match_version = match_version\nself.ignore_excluders = ignore_excluders\nself.verbose = verbose\nif self.match_version:\n self.show_duplicates = True\nself.query_format = '%{versio...
<|body_start_0|> super(Repoquery, self).__init__(None) self.name = name self.query_type = query_type self.show_duplicates = show_duplicates self.match_version = match_version self.ignore_excluders = ignore_excluders self.verbose = verbose if self.match_ver...
Class to wrap the repoquery
Repoquery
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Repoquery: """Class to wrap the repoquery""" def __init__(self, name, query_type, show_duplicates, match_version, ignore_excluders, verbose): """Constructor for YumList""" <|body_0|> def build_cmd(self): """build the repoquery cmd options""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_025545
22,630
permissive
[ { "docstring": "Constructor for YumList", "name": "__init__", "signature": "def __init__(self, name, query_type, show_duplicates, match_version, ignore_excluders, verbose)" }, { "docstring": "build the repoquery cmd options", "name": "build_cmd", "signature": "def build_cmd(self)" }, ...
6
null
Implement the Python class `Repoquery` described below. Class description: Class to wrap the repoquery Method signatures and docstrings: - def __init__(self, name, query_type, show_duplicates, match_version, ignore_excluders, verbose): Constructor for YumList - def build_cmd(self): build the repoquery cmd options - d...
Implement the Python class `Repoquery` described below. Class description: Class to wrap the repoquery Method signatures and docstrings: - def __init__(self, name, query_type, show_duplicates, match_version, ignore_excluders, verbose): Constructor for YumList - def build_cmd(self): build the repoquery cmd options - d...
e342f6659a4ef1a188ff403e2fc6b06ac6d119c7
<|skeleton|> class Repoquery: """Class to wrap the repoquery""" def __init__(self, name, query_type, show_duplicates, match_version, ignore_excluders, verbose): """Constructor for YumList""" <|body_0|> def build_cmd(self): """build the repoquery cmd options""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Repoquery: """Class to wrap the repoquery""" def __init__(self, name, query_type, show_duplicates, match_version, ignore_excluders, verbose): """Constructor for YumList""" super(Repoquery, self).__init__(None) self.name = name self.query_type = query_type self.show...
the_stack_v2_python_sparse
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/library/repoquery.py
openshift/openshift-tools
train
170
07e14314fde581920ab4ae9910f6ab85a6d1bd71
[ "if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\nlenNums = len(nums)\nreturn max(self.robI(nums[0:lenNums - 1]), self.robI(nums[1:lenNums]))", "if not nums:\n return 0\nif len(nums) < 2:\n return nums[-1]\nlenNums = len(nums)\ndp = [0 for _ in range(lenNums)]\ndp[0] = nums[0]\ndp[1] = nu...
<|body_start_0|> if not nums: return 0 if len(nums) == 1: return nums[0] lenNums = len(nums) return max(self.robI(nums[0:lenNums - 1]), self.robI(nums[1:lenNums])) <|end_body_0|> <|body_start_1|> if not nums: return 0 if len(nums) < 2:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def robII(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def robI(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 if len(nums) == ...
stack_v2_sparse_classes_36k_train_025546
1,135
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "robII", "signature": "def robII(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "robI", "signature": "def robI(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def robII(self, nums): :type nums: List[int] :rtype: int - def robI(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def robII(self, nums): :type nums: List[int] :rtype: int - def robI(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def robII(self, nums): ...
70b7a0f031ef4bc1b04ae787ac1fd78f2f25a04d
<|skeleton|> class Solution: def robII(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def robI(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def robII(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 if len(nums) == 1: return nums[0] lenNums = len(nums) return max(self.robI(nums[0:lenNums - 1]), self.robI(nums[1:lenNums])) def robI(self, nums):...
the_stack_v2_python_sparse
dynamicProgramming/213robII.py
tzhou2018/LeetCode
train
6
00a4e51fca37988efe641292da470535a461b4b5
[ "self.node_id = node_id\nself.node_ip = node_ip\nself.use_as_compute_node = use_as_compute_node", "if dictionary is None:\n return None\nnode_id = dictionary.get('nodeId')\nnode_ip = dictionary.get('nodeIp')\nuse_as_compute_node = dictionary.get('useAsComputeNode')\nreturn cls(node_id, node_ip, use_as_compute_...
<|body_start_0|> self.node_id = node_id self.node_ip = node_ip self.use_as_compute_node = use_as_compute_node <|end_body_0|> <|body_start_1|> if dictionary is None: return None node_id = dictionary.get('nodeId') node_ip = dictionary.get('nodeIp') use_...
Implementation of the 'VirtualNodeConfiguration' model. Specifies the configuration for a node in the Cluster. Attributes: node_id (long|int): Specifies the Node ID for this node. node_ip (string): Specifies the Node IP address for this node. use_as_compute_node (bool): Specifies whether to use the Node for compute onl...
VirtualNodeConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualNodeConfiguration: """Implementation of the 'VirtualNodeConfiguration' model. Specifies the configuration for a node in the Cluster. Attributes: node_id (long|int): Specifies the Node ID for this node. node_ip (string): Specifies the Node IP address for this node. use_as_compute_node (bool...
stack_v2_sparse_classes_36k_train_025547
1,919
permissive
[ { "docstring": "Constructor for the VirtualNodeConfiguration class", "name": "__init__", "signature": "def __init__(self, node_id=None, node_ip=None, use_as_compute_node=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary repr...
2
null
Implement the Python class `VirtualNodeConfiguration` described below. Class description: Implementation of the 'VirtualNodeConfiguration' model. Specifies the configuration for a node in the Cluster. Attributes: node_id (long|int): Specifies the Node ID for this node. node_ip (string): Specifies the Node IP address f...
Implement the Python class `VirtualNodeConfiguration` described below. Class description: Implementation of the 'VirtualNodeConfiguration' model. Specifies the configuration for a node in the Cluster. Attributes: node_id (long|int): Specifies the Node ID for this node. node_ip (string): Specifies the Node IP address f...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VirtualNodeConfiguration: """Implementation of the 'VirtualNodeConfiguration' model. Specifies the configuration for a node in the Cluster. Attributes: node_id (long|int): Specifies the Node ID for this node. node_ip (string): Specifies the Node IP address for this node. use_as_compute_node (bool...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirtualNodeConfiguration: """Implementation of the 'VirtualNodeConfiguration' model. Specifies the configuration for a node in the Cluster. Attributes: node_id (long|int): Specifies the Node ID for this node. node_ip (string): Specifies the Node IP address for this node. use_as_compute_node (bool): Specifies ...
the_stack_v2_python_sparse
cohesity_management_sdk/models/virtual_node_configuration.py
cohesity/management-sdk-python
train
24
293728762f776ad2e4fc25235ec11c3303e661d0
[ "super(GetScalingPolicy, cls).setUpClass(change_percent=100)\ncls.get_policy_response = cls.autoscale_client.get_policy_details(cls.group.id, cls.policy['id'])\ncls.get_policy = cls.get_policy_response.entity", "self.assertEquals(self.get_policy_response.status_code, 200, msg='Get scaling policy failed with {0} f...
<|body_start_0|> super(GetScalingPolicy, cls).setUpClass(change_percent=100) cls.get_policy_response = cls.autoscale_client.get_policy_details(cls.group.id, cls.policy['id']) cls.get_policy = cls.get_policy_response.entity <|end_body_0|> <|body_start_1|> self.assertEquals(self.get_polic...
Verify get policy.
GetScalingPolicy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetScalingPolicy: """Verify get policy.""" def setUpClass(cls): """Creates a scaling group with policy with type change percent.""" <|body_0|> def test_get_scaling_policy(self): """Verify the get policy call for response code 200, headers and data.""" <|b...
stack_v2_sparse_classes_36k_train_025548
1,102
permissive
[ { "docstring": "Creates a scaling group with policy with type change percent.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Verify the get policy call for response code 200, headers and data.", "name": "test_get_scaling_policy", "signature": "def test_get_...
2
stack_v2_sparse_classes_30k_train_010420
Implement the Python class `GetScalingPolicy` described below. Class description: Verify get policy. Method signatures and docstrings: - def setUpClass(cls): Creates a scaling group with policy with type change percent. - def test_get_scaling_policy(self): Verify the get policy call for response code 200, headers and...
Implement the Python class `GetScalingPolicy` described below. Class description: Verify get policy. Method signatures and docstrings: - def setUpClass(cls): Creates a scaling group with policy with type change percent. - def test_get_scaling_policy(self): Verify the get policy call for response code 200, headers and...
7199cdd67255fe116dbcbedea660c13453671134
<|skeleton|> class GetScalingPolicy: """Verify get policy.""" def setUpClass(cls): """Creates a scaling group with policy with type change percent.""" <|body_0|> def test_get_scaling_policy(self): """Verify the get policy call for response code 200, headers and data.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetScalingPolicy: """Verify get policy.""" def setUpClass(cls): """Creates a scaling group with policy with type change percent.""" super(GetScalingPolicy, cls).setUpClass(change_percent=100) cls.get_policy_response = cls.autoscale_client.get_policy_details(cls.group.id, cls.polic...
the_stack_v2_python_sparse
autoscale_cloudroast/test_repo/autoscale/functional/scaling_policy/test_get_scaling_policy.py
rackerlabs/otter
train
20
0caf8b440f056164b5309a37d901f538c4455932
[ "super(Decoder, self).__init__()\nself.dm = dm\nself.N = N\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)", "...
<|body_start_0|> super(Decoder, self).__init__() self.dm = dm self.N = N self.embedding = tf.keras.layers.Embedding(target_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, dm) self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)] ...
to Decoder for machine translation
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """to Decoder for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @...
stack_v2_sparse_classes_36k_train_025549
2,701
no_license
[ { "docstring": "constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @target_vocab: size of target vocabulary @max_seq_len: maximum sequence length possible @drop_rate: dropout rate *Sets following public instance a...
2
stack_v2_sparse_classes_30k_train_005595
Implement the Python class `Decoder` described below. Class description: to Decoder for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @...
Implement the Python class `Decoder` described below. Class description: to Decoder for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @...
e20b284d5f1841952104d7d9a0274cff80eb304d
<|skeleton|> class Decoder: """to Decoder for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """to Decoder for machine translation""" def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @target_vocab:...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/10-transformer_decoder.py
jgadelugo/holbertonschool-machine_learning
train
1
b8425396ab2dc40e7d85bbbf1ab1ee7569e184c6
[ "self.bar = None\nself.onBar = onBar\nif bar_type == const.MARKET_TYPE_KLINE_5M:\n self.xmin = 5\nelif bar_type == const.MARKET_TYPE_KLINE_15M:\n self.xmin = 15\nself.bar_type = bar_type\nself.xminBar = None\nself.onXminBar = onXminBar", "newMinute = False\nif not self.bar:\n self.bar = Kline()\n newM...
<|body_start_0|> self.bar = None self.onBar = onBar if bar_type == const.MARKET_TYPE_KLINE_5M: self.xmin = 5 elif bar_type == const.MARKET_TYPE_KLINE_15M: self.xmin = 15 self.bar_type = bar_type self.xminBar = None self.onXminBar = onXminBa...
K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)
KlineGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KlineGenerator: """K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)""" def __init__(self, onBar, bar_type=None, onXminBar=None): """Constructor""" <|body_0|> async def update_trade(self, trade): """逐笔成交更新""" <|body_1|> async def update_bar(se...
stack_v2_sparse_classes_36k_train_025550
3,675
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, onBar, bar_type=None, onXminBar=None)" }, { "docstring": "逐笔成交更新", "name": "update_trade", "signature": "async def update_trade(self, trade)" }, { "docstring": "1分钟K线更新", "name": "update_bar", ...
3
stack_v2_sparse_classes_30k_train_001571
Implement the Python class `KlineGenerator` described below. Class description: K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15) Method signatures and docstrings: - def __init__(self, onBar, bar_type=None, onXminBar=None): Constructor - async def update_trade(self, trade): 逐笔成交更新 - async def update_bar(self, ...
Implement the Python class `KlineGenerator` described below. Class description: K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15) Method signatures and docstrings: - def __init__(self, onBar, bar_type=None, onXminBar=None): Constructor - async def update_trade(self, trade): 逐笔成交更新 - async def update_bar(self, ...
5f45dbd5f09354dd161606f7e740f8c8d8ae2772
<|skeleton|> class KlineGenerator: """K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)""" def __init__(self, onBar, bar_type=None, onXminBar=None): """Constructor""" <|body_0|> async def update_trade(self, trade): """逐笔成交更新""" <|body_1|> async def update_bar(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KlineGenerator: """K线合成器,支持: 1. 基于trade合成1分钟K线 2. 基于1分钟K线合成X分钟K线 (X可以是5、15)""" def __init__(self, onBar, bar_type=None, onXminBar=None): """Constructor""" self.bar = None self.onBar = onBar if bar_type == const.MARKET_TYPE_KLINE_5M: self.xmin = 5 elif b...
the_stack_v2_python_sparse
quant/interface/kline_generator.py
lucali2014/alphahunter
train
0
6aa499b865a746a5429bf954af963efb1e6ad538
[ "super().set_params(params)\nparams = dict_to_namespace(params)\nself.params.name = getattr(params, 'name', 'OptRightScan')\nself.params.init_x = getattr(params, 'init_x', [4.0])\nself.params.x_grid_gap = getattr(params, 'x_grid_gap', 0.1)\nself.params.conv_thresh = getattr(params, 'conv_thresh', 0.2)\nself.params....
<|body_start_0|> super().set_params(params) params = dict_to_namespace(params) self.params.name = getattr(params, 'name', 'OptRightScan') self.params.init_x = getattr(params, 'init_x', [4.0]) self.params.x_grid_gap = getattr(params, 'x_grid_gap', 0.1) self.params.conv_thr...
A simple minimization algorithm that, starting from some initial point, optimizes by scanning to the right until function starts to increase.
OptRightScan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptRightScan: """A simple minimization algorithm that, starting from some initial point, optimizes by scanning to the right until function starts to increase.""" def set_params(self, params): """Set self.params, the parameters for the algorithm.""" <|body_0|> def get_nex...
stack_v2_sparse_classes_36k_train_025551
19,618
no_license
[ { "docstring": "Set self.params, the parameters for the algorithm.", "name": "set_params", "signature": "def set_params(self, params)" }, { "docstring": "Given the current execution path, return the next x in the execution path. If the algorithm is complete, return None.", "name": "get_next_...
5
stack_v2_sparse_classes_30k_train_003246
Implement the Python class `OptRightScan` described below. Class description: A simple minimization algorithm that, starting from some initial point, optimizes by scanning to the right until function starts to increase. Method signatures and docstrings: - def set_params(self, params): Set self.params, the parameters ...
Implement the Python class `OptRightScan` described below. Class description: A simple minimization algorithm that, starting from some initial point, optimizes by scanning to the right until function starts to increase. Method signatures and docstrings: - def set_params(self, params): Set self.params, the parameters ...
d75d1a89bb566e62662e4d010d91893bfe1ee9f4
<|skeleton|> class OptRightScan: """A simple minimization algorithm that, starting from some initial point, optimizes by scanning to the right until function starts to increase.""" def set_params(self, params): """Set self.params, the parameters for the algorithm.""" <|body_0|> def get_nex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptRightScan: """A simple minimization algorithm that, starting from some initial point, optimizes by scanning to the right until function starts to increase.""" def set_params(self, params): """Set self.params, the parameters for the algorithm.""" super().set_params(params) param...
the_stack_v2_python_sparse
bax/alg/algorithms.py
willieneis/bayesian-algorithm-execution
train
45
a98739f7c75f284ac2417610ba5fda18d9fea6e5
[ "category_id = request.query_params['category_id']\nsearch = request.query_params['search']\nqueryset = self.get_queryset().filter(category_id=category_id)\nif search != '':\n queryset = queryset.filter(name__contains=search)\npagination_queryset = self.paginate_queryset(queryset)\nserializer = self.get_serializ...
<|body_start_0|> category_id = request.query_params['category_id'] search = request.query_params['search'] queryset = self.get_queryset().filter(category_id=category_id) if search != '': queryset = queryset.filter(name__contains=search) pagination_queryset = self.pagi...
API操作视图
ApiViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiViewSet: """API操作视图""" def list(self, request): """接口列表 { classify_id: int, }""" <|body_0|> def add(self, request): """新增一个接口""" <|body_1|> def update(self, request, **kwargs): """更新接口""" <|body_2|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_025552
6,485
no_license
[ { "docstring": "接口列表 { classify_id: int, }", "name": "list", "signature": "def list(self, request)" }, { "docstring": "新增一个接口", "name": "add", "signature": "def add(self, request)" }, { "docstring": "更新接口", "name": "update", "signature": "def update(self, request, **kwarg...
3
stack_v2_sparse_classes_30k_train_019905
Implement the Python class `ApiViewSet` described below. Class description: API操作视图 Method signatures and docstrings: - def list(self, request): 接口列表 { classify_id: int, } - def add(self, request): 新增一个接口 - def update(self, request, **kwargs): 更新接口
Implement the Python class `ApiViewSet` described below. Class description: API操作视图 Method signatures and docstrings: - def list(self, request): 接口列表 { classify_id: int, } - def add(self, request): 新增一个接口 - def update(self, request, **kwargs): 更新接口 <|skeleton|> class ApiViewSet: """API操作视图""" def list(self,...
e8407fdd97e821779f2abb4c2debfb246f44e4ed
<|skeleton|> class ApiViewSet: """API操作视图""" def list(self, request): """接口列表 { classify_id: int, }""" <|body_0|> def add(self, request): """新增一个接口""" <|body_1|> def update(self, request, **kwargs): """更新接口""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiViewSet: """API操作视图""" def list(self, request): """接口列表 { classify_id: int, }""" category_id = request.query_params['category_id'] search = request.query_params['search'] queryset = self.get_queryset().filter(category_id=category_id) if search != '': ...
the_stack_v2_python_sparse
begin/views1/api.py
aaas19920513/ApiDemo
train
0
3a9517c16fbd0277f41ee23fe2a317d21db22820
[ "nums = [1] + nums + [1]\nn = len(nums) - 1\nmp = [[0 for i in range(n)] for j in range(n)]\nfor p in range(1, n):\n for j in range(p, n):\n i = j - p\n mp[i][j] = max((mp[i][k] + mp[k + 1][j] + nums[i] * nums[k + 1] * nums[j + 1] for k in range(i, j)))\nreturn mp[0][n - 1]", "nums = [1] + nums +...
<|body_start_0|> nums = [1] + nums + [1] n = len(nums) - 1 mp = [[0 for i in range(n)] for j in range(n)] for p in range(1, n): for j in range(p, n): i = j - p mp[i][j] = max((mp[i][k] + mp[k + 1][j] + nums[i] * nums[k + 1] * nums[j + 1] for k ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxCoins_solution_1_matrix_chain_multiplication(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int""" <|body_0|> def maxCoins_solution_2_top_down_DP(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int""" <|body_1...
stack_v2_sparse_classes_36k_train_025553
5,872
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxCoins_solution_1_matrix_chain_multiplication", "signature": "def maxCoins_solution_1_matrix_chain_multiplication(self, nums: List[int]) -> int" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxCoins_solution_2_...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxCoins_solution_1_matrix_chain_multiplication(self, nums: List[int]) -> int: :type nums: List[int] :rtype: int - def maxCoins_solution_2_top_down_DP(self, nums: List[int]) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxCoins_solution_1_matrix_chain_multiplication(self, nums: List[int]) -> int: :type nums: List[int] :rtype: int - def maxCoins_solution_2_top_down_DP(self, nums: List[int]) ...
f2621cd76822a922c49b60f32931f26cce1c571d
<|skeleton|> class Solution: def maxCoins_solution_1_matrix_chain_multiplication(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int""" <|body_0|> def maxCoins_solution_2_top_down_DP(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxCoins_solution_1_matrix_chain_multiplication(self, nums: List[int]) -> int: """:type nums: List[int] :rtype: int""" nums = [1] + nums + [1] n = len(nums) - 1 mp = [[0 for i in range(n)] for j in range(n)] for p in range(1, n): for j in range...
the_stack_v2_python_sparse
Dynamic_Programming/026_leetcode_P_312_BurstBalloons_AKA_MatrixChainMultiplication/Solution.py
Keshav1506/competitive_programming
train
0
67353d2f386975f693ba9c68f5ba1fb5fca8c189
[ "if len(prices) < 2:\n return 0\nmin_price = float('inf')\nmax_price = 0\nfor v in prices:\n min_price = min(min_price, v)\n max_price = max(max_price, v - min_price)\nreturn max_price", "diff = [0]\nif len(prices) < 2:\n return 0\nfor i in range(1, len(prices)):\n diff.append(prices[i] - prices[i ...
<|body_start_0|> if len(prices) < 2: return 0 min_price = float('inf') max_price = 0 for v in prices: min_price = min(min_price, v) max_price = max(max_price, v - min_price) return max_price <|end_body_0|> <|body_start_1|> diff = [0] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(prices) < 2: return 0...
stack_v2_sparse_classes_36k_train_025554
851
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_018072
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit1(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def maxPro...
472f780c3214aab5c713612812d834ccbe589434
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" if len(prices) < 2: return 0 min_price = float('inf') max_price = 0 for v in prices: min_price = min(min_price, v) max_price = max(max_price, v - min_pri...
the_stack_v2_python_sparse
4/121-Best_Time_to_Buy_and_Sell_Stock.py
ChangXiaodong/Leetcode-solutions
train
4
56d20ae91390c9a40d9b29503dbac57a1ead6c6e
[ "super(ShowingSpider, self).__init__(*args, **kwargs)\nif not self.movie_list:\n self.movie_list.append('君の名は。')\nif not self.cinema_list:\n self.cinema_list.append(default_cinema[self.name])\nfor idx, item in enumerate(self.movie_list):\n self.movie_list[idx] = unicodedata.normalize('NFKC', item)\nfor idx...
<|body_start_0|> super(ShowingSpider, self).__init__(*args, **kwargs) if not self.movie_list: self.movie_list.append('君の名は。') if not self.cinema_list: self.cinema_list.append(default_cinema[self.name]) for idx, item in enumerate(self.movie_list): self....
ShowingSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowingSpider: def __init__(self, *args, **kwargs): """Prepare common settings for showing spider. All strings are normailized""" <|body_0|> def is_cinema_crawl(self, cinema_names): """check if current cinema should be crawled""" <|body_1|> def is_movie_...
stack_v2_sparse_classes_36k_train_025555
2,820
permissive
[ { "docstring": "Prepare common settings for showing spider. All strings are normailized", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "check if current cinema should be crawled", "name": "is_cinema_crawl", "signature": "def is_cinema_crawl(sel...
4
stack_v2_sparse_classes_30k_train_009240
Implement the Python class `ShowingSpider` described below. Class description: Implement the ShowingSpider class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Prepare common settings for showing spider. All strings are normailized - def is_cinema_crawl(self, cinema_names): check if current...
Implement the Python class `ShowingSpider` described below. Class description: Implement the ShowingSpider class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Prepare common settings for showing spider. All strings are normailized - def is_cinema_crawl(self, cinema_names): check if current...
67c7b963914565589f64dd1bcf18839a4160ea34
<|skeleton|> class ShowingSpider: def __init__(self, *args, **kwargs): """Prepare common settings for showing spider. All strings are normailized""" <|body_0|> def is_cinema_crawl(self, cinema_names): """check if current cinema should be crawled""" <|body_1|> def is_movie_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowingSpider: def __init__(self, *args, **kwargs): """Prepare common settings for showing spider. All strings are normailized""" super(ShowingSpider, self).__init__(*args, **kwargs) if not self.movie_list: self.movie_list.append('君の名は。') if not self.cinema_list: ...
the_stack_v2_python_sparse
scrapyproject/showingspiders/showing_spider.py
gas1121/JapanCinemaStatusSpider
train
2
1f18aad35e93fee69c0335d3a5a23feedae1e087
[ "parser.add_argument('path', nargs='*', help='The path of objects and directories to list. The path must begin with gs:// and is allowed to contain wildcard characters.')\nparser.add_argument('-a', '--all-versions', action='store_true', help='Include non-current object versions in the listing. This flag is typicall...
<|body_start_0|> parser.add_argument('path', nargs='*', help='The path of objects and directories to list. The path must begin with gs:// and is allowed to contain wildcard characters.') parser.add_argument('-a', '--all-versions', action='store_true', help='Include non-current object versions in the lis...
List Cloud Storage buckets and objects.
Ls
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ls: """List Cloud Storage buckets and objects.""" def Args(parser): """Edit argparse.ArgumentParser for the command.""" <|body_0|> def Run(self, args): """Command execution logic.""" <|body_1|> <|end_skeleton|> <|body_start_0|> parser.add_argume...
stack_v2_sparse_classes_36k_train_025556
8,020
permissive
[ { "docstring": "Edit argparse.ArgumentParser for the command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Command execution logic.", "name": "Run", "signature": "def Run(self, args)" } ]
2
stack_v2_sparse_classes_30k_train_018748
Implement the Python class `Ls` described below. Class description: List Cloud Storage buckets and objects. Method signatures and docstrings: - def Args(parser): Edit argparse.ArgumentParser for the command. - def Run(self, args): Command execution logic.
Implement the Python class `Ls` described below. Class description: List Cloud Storage buckets and objects. Method signatures and docstrings: - def Args(parser): Edit argparse.ArgumentParser for the command. - def Run(self, args): Command execution logic. <|skeleton|> class Ls: """List Cloud Storage buckets and ...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Ls: """List Cloud Storage buckets and objects.""" def Args(parser): """Edit argparse.ArgumentParser for the command.""" <|body_0|> def Run(self, args): """Command execution logic.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Ls: """List Cloud Storage buckets and objects.""" def Args(parser): """Edit argparse.ArgumentParser for the command.""" parser.add_argument('path', nargs='*', help='The path of objects and directories to list. The path must begin with gs:// and is allowed to contain wildcard characters.')...
the_stack_v2_python_sparse
lib/surface/storage/ls.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
2f88331361c5baf352af58f72326fd7b3c9090dc
[ "model_inputs = buffer_to((observation, prev_action, prev_reward), device=self.device)\nmu, log_std, value = self.model(*model_inputs)\nreturn buffer_to((DistInfoStd(mean=mu, log_std=log_std), value), device='cpu')", "super().initialize(env_spaces, share_memory, global_B=global_B, env_ranks=env_ranks)\nassert len...
<|body_start_0|> model_inputs = buffer_to((observation, prev_action, prev_reward), device=self.device) mu, log_std, value = self.model(*model_inputs) return buffer_to((DistInfoStd(mean=mu, log_std=log_std), value), device='cpu') <|end_body_0|> <|body_start_1|> super().initialize(env_spa...
Agent for policy gradient algorithm using Gaussian action distribution.
GaussianPgAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianPgAgent: """Agent for policy gradient algorithm using Gaussian action distribution.""" def __call__(self, observation, prev_action, prev_reward): """Performs forward pass on training data, for algorithm.""" <|body_0|> def initialize(self, env_spaces, share_memory...
stack_v2_sparse_classes_36k_train_025557
6,276
permissive
[ { "docstring": "Performs forward pass on training data, for algorithm.", "name": "__call__", "signature": "def __call__(self, observation, prev_action, prev_reward)" }, { "docstring": "Extends base method to build Gaussian distribution.", "name": "initialize", "signature": "def initializ...
4
stack_v2_sparse_classes_30k_test_000058
Implement the Python class `GaussianPgAgent` described below. Class description: Agent for policy gradient algorithm using Gaussian action distribution. Method signatures and docstrings: - def __call__(self, observation, prev_action, prev_reward): Performs forward pass on training data, for algorithm. - def initializ...
Implement the Python class `GaussianPgAgent` described below. Class description: Agent for policy gradient algorithm using Gaussian action distribution. Method signatures and docstrings: - def __call__(self, observation, prev_action, prev_reward): Performs forward pass on training data, for algorithm. - def initializ...
98681a23bae9e8e5e9fbf68a0316ca2a22a27593
<|skeleton|> class GaussianPgAgent: """Agent for policy gradient algorithm using Gaussian action distribution.""" def __call__(self, observation, prev_action, prev_reward): """Performs forward pass on training data, for algorithm.""" <|body_0|> def initialize(self, env_spaces, share_memory...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianPgAgent: """Agent for policy gradient algorithm using Gaussian action distribution.""" def __call__(self, observation, prev_action, prev_reward): """Performs forward pass on training data, for algorithm.""" model_inputs = buffer_to((observation, prev_action, prev_reward), device=s...
the_stack_v2_python_sparse
dependencies/rlpyt/rlpyt/agents/pg/gaussian.py
keirp/glamor
train
5
0c913ec90df1bf7e1fcbf01a8ff3fc93964c9407
[ "self.data = ''\n\ndef serialize(root):\n if not root:\n return\n self.data += str(root.val)\n if root.children:\n self.data += '['\n [serialize(child) for child in root.children]\n self.data = self.data[:-1] + ']'\n self.data += ','\nserialize(root)\nreturn self.data[:-1]", ...
<|body_start_0|> self.data = '' def serialize(root): if not root: return self.data += str(root.val) if root.children: self.data += '[' [serialize(child) for child in root.children] self.data = self.data[...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node BNF: expr ::= node {, node...
stack_v2_sparse_classes_36k_train_025558
1,921
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node BNF: expr ::= node {, node } node ::= digit['[' expr '...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
d13297506bd2b9beb24fe393c727f18d6ea895c7
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node BNF: expr ::= node {, node...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" self.data = '' def serialize(root): if not root: return self.data += str(root.val) if root.children: ...
the_stack_v2_python_sparse
leetcode/428.py
Crysple/grocery
train
0
cb9b2dcfc5fc879ca9be2761faae15f1cf69b628
[ "book = get_edition(book_id)\ntemplate = {'want': 'want.html', 'start': 'start.html', 'finish': 'finish.html', 'stop': 'stop.html'}.get(status)\nif not template:\n return HttpResponseNotFound()\nreturn TemplateResponse(request, f'reading_progress/{template}', {'book': book})", "identifier = {'want': models.She...
<|body_start_0|> book = get_edition(book_id) template = {'want': 'want.html', 'start': 'start.html', 'finish': 'finish.html', 'stop': 'stop.html'}.get(status) if not template: return HttpResponseNotFound() return TemplateResponse(request, f'reading_progress/{template}', {'boo...
consider reading a book
ReadingStatus
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadingStatus: """consider reading a book""" def get(self, request, status, book_id): """modal page""" <|body_0|> def post(self, request, status, book_id): """Change the state of a book by shelving it and adding reading dates""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_025559
8,188
no_license
[ { "docstring": "modal page", "name": "get", "signature": "def get(self, request, status, book_id)" }, { "docstring": "Change the state of a book by shelving it and adding reading dates", "name": "post", "signature": "def post(self, request, status, book_id)" } ]
2
null
Implement the Python class `ReadingStatus` described below. Class description: consider reading a book Method signatures and docstrings: - def get(self, request, status, book_id): modal page - def post(self, request, status, book_id): Change the state of a book by shelving it and adding reading dates
Implement the Python class `ReadingStatus` described below. Class description: consider reading a book Method signatures and docstrings: - def get(self, request, status, book_id): modal page - def post(self, request, status, book_id): Change the state of a book by shelving it and adding reading dates <|skeleton|> cl...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ReadingStatus: """consider reading a book""" def get(self, request, status, book_id): """modal page""" <|body_0|> def post(self, request, status, book_id): """Change the state of a book by shelving it and adding reading dates""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadingStatus: """consider reading a book""" def get(self, request, status, book_id): """modal page""" book = get_edition(book_id) template = {'want': 'want.html', 'start': 'start.html', 'finish': 'finish.html', 'stop': 'stop.html'}.get(status) if not template: ...
the_stack_v2_python_sparse
bookwyrm/views/reading.py
bookwyrm-social/bookwyrm
train
1,398
2603c9e428bebd954eca7e88268b003fd95465ca
[ "parser.add_argument('-i', '--instructor', action='store_true', help='make users instructors')\nparser.add_argument('-e', '--email', default='email', help='name of the email column')\nparser.add_argument('-p', default='boguspwd', help='Default password value')\nparser.add_argument('csvfile', type=str, nargs='*', he...
<|body_start_0|> parser.add_argument('-i', '--instructor', action='store_true', help='make users instructors') parser.add_argument('-e', '--email', default='email', help='name of the email column') parser.add_argument('-p', default='boguspwd', help='Default password value') parser.add_ar...
Cldss implementing the command to create users.
Command
[ "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 Command: """Cldss implementing the command to create users.""" def add_arguments(self, parser): """Parse the arguments.""" <|body_0|> def handle(self, *args, **options): """Execute the command, process the file and create the users.""" <|body_1|> def...
stack_v2_sparse_classes_36k_train_025560
7,096
permissive
[ { "docstring": "Parse the arguments.", "name": "add_arguments", "signature": "def add_arguments(self, parser)" }, { "docstring": "Execute the command, process the file and create the users.", "name": "handle", "signature": "def handle(self, *args, **options)" }, { "docstring": "G...
4
null
Implement the Python class `Command` described below. Class description: Cldss implementing the command to create users. Method signatures and docstrings: - def add_arguments(self, parser): Parse the arguments. - def handle(self, *args, **options): Execute the command, process the file and create the users. - def get...
Implement the Python class `Command` described below. Class description: Cldss implementing the command to create users. Method signatures and docstrings: - def add_arguments(self, parser): Parse the arguments. - def handle(self, *args, **options): Execute the command, process the file and create the users. - def get...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class Command: """Cldss implementing the command to create users.""" def add_arguments(self, parser): """Parse the arguments.""" <|body_0|> def handle(self, *args, **options): """Execute the command, process the file and create the users.""" <|body_1|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Command: """Cldss implementing the command to create users.""" def add_arguments(self, parser): """Parse the arguments.""" parser.add_argument('-i', '--instructor', action='store_true', help='make users instructors') parser.add_argument('-e', '--email', default='email', help='name...
the_stack_v2_python_sparse
ontask/management/commands/initialize_db.py
abelardopardo/ontask_b
train
43
0e89a2684ef98653de2e0f7f4b0e4d05b0820f3e
[ "super(DC_and_CE_loss, self).__init__()\nif ignore_label is not None:\n ce_kwargs['ignore_index'] = ignore_label\nself.weight_dice = weight_dice\nself.weight_ce = weight_ce\nself.ignore_label = ignore_label\nself.ce = RobustCrossEntropyLoss(**ce_kwargs)\nself.dc = dice_class(apply_nonlin=softmax_helper_dim1, **s...
<|body_start_0|> super(DC_and_CE_loss, self).__init__() if ignore_label is not None: ce_kwargs['ignore_index'] = ignore_label self.weight_dice = weight_dice self.weight_ce = weight_ce self.ignore_label = ignore_label self.ce = RobustCrossEntropyLoss(**ce_kwarg...
DC_and_CE_loss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DC_and_CE_loss: def __init__(self, soft_dice_kwargs, ce_kwargs, weight_ce=1, weight_dice=1, ignore_label=None, dice_class=SoftDiceLoss): """Weights for CE and Dice do not need to sum to one. You can set whatever you want. :param soft_dice_kwargs: :param ce_kwargs: :param aggregate: :para...
stack_v2_sparse_classes_36k_train_025561
5,988
permissive
[ { "docstring": "Weights for CE and Dice do not need to sum to one. You can set whatever you want. :param soft_dice_kwargs: :param ce_kwargs: :param aggregate: :param square_dice: :param weight_ce: :param weight_dice:", "name": "__init__", "signature": "def __init__(self, soft_dice_kwargs, ce_kwargs, wei...
2
null
Implement the Python class `DC_and_CE_loss` described below. Class description: Implement the DC_and_CE_loss class. Method signatures and docstrings: - def __init__(self, soft_dice_kwargs, ce_kwargs, weight_ce=1, weight_dice=1, ignore_label=None, dice_class=SoftDiceLoss): Weights for CE and Dice do not need to sum to...
Implement the Python class `DC_and_CE_loss` described below. Class description: Implement the DC_and_CE_loss class. Method signatures and docstrings: - def __init__(self, soft_dice_kwargs, ce_kwargs, weight_ce=1, weight_dice=1, ignore_label=None, dice_class=SoftDiceLoss): Weights for CE and Dice do not need to sum to...
b4e97fe38a9eb6728077678d4850c41570a1cb02
<|skeleton|> class DC_and_CE_loss: def __init__(self, soft_dice_kwargs, ce_kwargs, weight_ce=1, weight_dice=1, ignore_label=None, dice_class=SoftDiceLoss): """Weights for CE and Dice do not need to sum to one. You can set whatever you want. :param soft_dice_kwargs: :param ce_kwargs: :param aggregate: :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DC_and_CE_loss: def __init__(self, soft_dice_kwargs, ce_kwargs, weight_ce=1, weight_dice=1, ignore_label=None, dice_class=SoftDiceLoss): """Weights for CE and Dice do not need to sum to one. You can set whatever you want. :param soft_dice_kwargs: :param ce_kwargs: :param aggregate: :param square_dice:...
the_stack_v2_python_sparse
nnunetv2/training/loss/compound_losses.py
MIC-DKFZ/nnUNet
train
4,219
6491a8498e4b72cf6ff9c754788ab538dc74c2f7
[ "self.is_mail_enabled = is_mail_enabled\nself.is_security_enabled = is_security_enabled\nself.member_count = member_count\nself.visibility = visibility", "if dictionary is None:\n return None\nis_mail_enabled = dictionary.get('isMailEnabled')\nis_security_enabled = dictionary.get('isSecurityEnabled')\nmember_c...
<|body_start_0|> self.is_mail_enabled = is_mail_enabled self.is_security_enabled = is_security_enabled self.member_count = member_count self.visibility = visibility <|end_body_0|> <|body_start_1|> if dictionary is None: return None is_mail_enabled = dictionar...
Implementation of the 'Office365GroupInfo' model. Specifies information about a M365 Group. Attributes: is_mail_enabled (bool): Specifies whether the Group is mail enabled. Mail enabled groups are used within Microsoft to distribute messages. is_security_enabled (bool): Specifies whether the Group is security enabled. ...
Office365GroupInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Office365GroupInfo: """Implementation of the 'Office365GroupInfo' model. Specifies information about a M365 Group. Attributes: is_mail_enabled (bool): Specifies whether the Group is mail enabled. Mail enabled groups are used within Microsoft to distribute messages. is_security_enabled (bool): Spe...
stack_v2_sparse_classes_36k_train_025562
2,486
permissive
[ { "docstring": "Constructor for the Office365GroupInfo class", "name": "__init__", "signature": "def __init__(self, is_mail_enabled=None, is_security_enabled=None, member_count=None, visibility=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictio...
2
stack_v2_sparse_classes_30k_train_019294
Implement the Python class `Office365GroupInfo` described below. Class description: Implementation of the 'Office365GroupInfo' model. Specifies information about a M365 Group. Attributes: is_mail_enabled (bool): Specifies whether the Group is mail enabled. Mail enabled groups are used within Microsoft to distribute me...
Implement the Python class `Office365GroupInfo` described below. Class description: Implementation of the 'Office365GroupInfo' model. Specifies information about a M365 Group. Attributes: is_mail_enabled (bool): Specifies whether the Group is mail enabled. Mail enabled groups are used within Microsoft to distribute me...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class Office365GroupInfo: """Implementation of the 'Office365GroupInfo' model. Specifies information about a M365 Group. Attributes: is_mail_enabled (bool): Specifies whether the Group is mail enabled. Mail enabled groups are used within Microsoft to distribute messages. is_security_enabled (bool): Spe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Office365GroupInfo: """Implementation of the 'Office365GroupInfo' model. Specifies information about a M365 Group. Attributes: is_mail_enabled (bool): Specifies whether the Group is mail enabled. Mail enabled groups are used within Microsoft to distribute messages. is_security_enabled (bool): Specifies whethe...
the_stack_v2_python_sparse
cohesity_management_sdk/models/office_365_group_info.py
cohesity/management-sdk-python
train
24
69f86ffd9038b134738c76594792cf6fcb8557e9
[ "test_inventory = Furniture(123, 'chair', 100, 50, 'wood', 'm')\nself.assertEqual(test_inventory.material, 'wood')\nself.assertEqual(test_inventory.size, 'm')", "test_inventory = Furniture(123, 'chair', 100, 50, 'wood', 'm').return_as_dictionary()\nself.assertEqual(test_inventory['material'], 'wood')\nself.assert...
<|body_start_0|> test_inventory = Furniture(123, 'chair', 100, 50, 'wood', 'm') self.assertEqual(test_inventory.material, 'wood') self.assertEqual(test_inventory.size, 'm') <|end_body_0|> <|body_start_1|> test_inventory = Furniture(123, 'chair', 100, 50, 'wood', 'm').return_as_dictionar...
Test the Furniture class
FurnitureTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FurnitureTest: """Test the Furniture class""" def test_init(self): """Test init""" <|body_0|> def test_return_as_dictionary(self): """Test the return as dictionary method""" <|body_1|> <|end_skeleton|> <|body_start_0|> test_inventory = Furniture...
stack_v2_sparse_classes_36k_train_025563
3,232
no_license
[ { "docstring": "Test init", "name": "test_init", "signature": "def test_init(self)" }, { "docstring": "Test the return as dictionary method", "name": "test_return_as_dictionary", "signature": "def test_return_as_dictionary(self)" } ]
2
stack_v2_sparse_classes_30k_train_010045
Implement the Python class `FurnitureTest` described below. Class description: Test the Furniture class Method signatures and docstrings: - def test_init(self): Test init - def test_return_as_dictionary(self): Test the return as dictionary method
Implement the Python class `FurnitureTest` described below. Class description: Test the Furniture class Method signatures and docstrings: - def test_init(self): Test init - def test_return_as_dictionary(self): Test the return as dictionary method <|skeleton|> class FurnitureTest: """Test the Furniture class""" ...
6ffd7b4ab8346076d3b6cc02ca1ebca3bf028697
<|skeleton|> class FurnitureTest: """Test the Furniture class""" def test_init(self): """Test init""" <|body_0|> def test_return_as_dictionary(self): """Test the return as dictionary method""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FurnitureTest: """Test the Furniture class""" def test_init(self): """Test init""" test_inventory = Furniture(123, 'chair', 100, 50, 'wood', 'm') self.assertEqual(test_inventory.material, 'wood') self.assertEqual(test_inventory.size, 'm') def test_return_as_dictionary...
the_stack_v2_python_sparse
students/AndrewMiotke/lesson01/assignment/test_unit.py
UWPCE-PythonCert-ClassRepos/220-Advanced-Summer-2019
train
4
cdb7745db8068ff0e14335a4721625874e9bcb32
[ "self.user = UserFactory()\nself.post = PostFactory()\nself.view = ReactionCreate()\nself.view.kwargs = {'pk': self.post.id}\nself.request = MagicMock()\nself.request.user = self.user\nself.view.request = self.request", "reaction = Reaction.LIKE\nself.request.method = 'POST'\nself.request.POST = {'description': r...
<|body_start_0|> self.user = UserFactory() self.post = PostFactory() self.view = ReactionCreate() self.view.kwargs = {'pk': self.post.id} self.request = MagicMock() self.request.user = self.user self.view.request = self.request <|end_body_0|> <|body_start_1|> ...
ReactionTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReactionTestCase: def setUp(self): """Create new post, user and ReactionView.""" <|body_0|> def test_reaction_add(self): """Test reaction creates""" <|body_1|> def test_reaction_single(self): """Test user can react only once by one emote""" ...
stack_v2_sparse_classes_36k_train_025564
1,575
no_license
[ { "docstring": "Create new post, user and ReactionView.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test reaction creates", "name": "test_reaction_add", "signature": "def test_reaction_add(self)" }, { "docstring": "Test user can react only once by one emo...
3
stack_v2_sparse_classes_30k_test_000971
Implement the Python class `ReactionTestCase` described below. Class description: Implement the ReactionTestCase class. Method signatures and docstrings: - def setUp(self): Create new post, user and ReactionView. - def test_reaction_add(self): Test reaction creates - def test_reaction_single(self): Test user can reac...
Implement the Python class `ReactionTestCase` described below. Class description: Implement the ReactionTestCase class. Method signatures and docstrings: - def setUp(self): Create new post, user and ReactionView. - def test_reaction_add(self): Test reaction creates - def test_reaction_single(self): Test user can reac...
4089c3f084d7460f64517158eefb54b3b93a01e8
<|skeleton|> class ReactionTestCase: def setUp(self): """Create new post, user and ReactionView.""" <|body_0|> def test_reaction_add(self): """Test reaction creates""" <|body_1|> def test_reaction_single(self): """Test user can react only once by one emote""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReactionTestCase: def setUp(self): """Create new post, user and ReactionView.""" self.user = UserFactory() self.post = PostFactory() self.view = ReactionCreate() self.view.kwargs = {'pk': self.post.id} self.request = MagicMock() self.request.user = self....
the_stack_v2_python_sparse
apps/reactions/tests.py
maxwell912/social-app
train
0
c9d43ec0429de5abc9fb87a56f714f5518ac10aa
[ "countries = request.query_params.get('countries', '').split(',')\ntoday = now()\nperiods = [(1, 'day'), (7, 'week'), (30, 'month')]\nif countries == ['']:\n countries = list(SMSInvitation.objects.filter(created_at__gte=today - timedelta(days=periods[-1][0])).values_list('country', flat=True).distinct())\nstatus...
<|body_start_0|> countries = request.query_params.get('countries', '').split(',') today = now() periods = [(1, 'day'), (7, 'week'), (30, 'month')] if countries == ['']: countries = list(SMSInvitation.objects.filter(created_at__gte=today - timedelta(days=periods[-1][0])).value...
SMSInvitation API Resources.
SMSViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMSViewSet: """SMSInvitation API Resources.""" def summary(self, request, *args, **kwargs): """SMSInvitation summary --- omit_serializer: true omit_parameters: - query""" <|body_0|> def create(self, request, *args, **kwargs): """Create SMSInvitation --- omit_seri...
stack_v2_sparse_classes_36k_train_025565
3,442
no_license
[ { "docstring": "SMSInvitation summary --- omit_serializer: true omit_parameters: - query", "name": "summary", "signature": "def summary(self, request, *args, **kwargs)" }, { "docstring": "Create SMSInvitation --- omit_serializer: true", "name": "create", "signature": "def create(self, re...
3
null
Implement the Python class `SMSViewSet` described below. Class description: SMSInvitation API Resources. Method signatures and docstrings: - def summary(self, request, *args, **kwargs): SMSInvitation summary --- omit_serializer: true omit_parameters: - query - def create(self, request, *args, **kwargs): Create SMSInv...
Implement the Python class `SMSViewSet` described below. Class description: SMSInvitation API Resources. Method signatures and docstrings: - def summary(self, request, *args, **kwargs): SMSInvitation summary --- omit_serializer: true omit_parameters: - query - def create(self, request, *args, **kwargs): Create SMSInv...
f3c95585ac639b45c28521712ed33a178ab36ea4
<|skeleton|> class SMSViewSet: """SMSInvitation API Resources.""" def summary(self, request, *args, **kwargs): """SMSInvitation summary --- omit_serializer: true omit_parameters: - query""" <|body_0|> def create(self, request, *args, **kwargs): """Create SMSInvitation --- omit_seri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SMSViewSet: """SMSInvitation API Resources.""" def summary(self, request, *args, **kwargs): """SMSInvitation summary --- omit_serializer: true omit_parameters: - query""" countries = request.query_params.get('countries', '').split(',') today = now() periods = [(1, 'day'), ...
the_stack_v2_python_sparse
src/shoutit/api/v2/views/sms_views.py
shoutit/shoutit-api
train
0
5c2f399afa568a062738014440c042be0dd729bc
[ "winSize = (64, 128)\nblockSize = (16, 16)\nblockStride = (8, 8)\ncellSize = (8, 8)\nnbins = 9\nderivAperture = 1\nwinSigma = -1\nhistogramNormType = 0\nL2HysThreshold = 0.2\ngammaCorrection = True\nnlevels = 64\nsignedGradient = False\nself.params = {}\nself.params['winSize'] = winSize\nself.params['blockSize'] = ...
<|body_start_0|> winSize = (64, 128) blockSize = (16, 16) blockStride = (8, 8) cellSize = (8, 8) nbins = 9 derivAperture = 1 winSigma = -1 histogramNormType = 0 L2HysThreshold = 0.2 gammaCorrection = True nlevels = 64 signed...
this class implements the opencv Hog People Detector detector
HogPeopleDetector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HogPeopleDetector: """this class implements the opencv Hog People Detector detector""" def __init__(self): """Constructor initialize hog for people detection""" <|body_0|> def maxRectArea(self, rects): """returns the largest rectangle""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_025566
3,372
permissive
[ { "docstring": "Constructor initialize hog for people detection", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "returns the largest rectangle", "name": "maxRectArea", "signature": "def maxRectArea(self, rects)" }, { "docstring": "returns the one largest...
3
stack_v2_sparse_classes_30k_train_005758
Implement the Python class `HogPeopleDetector` described below. Class description: this class implements the opencv Hog People Detector detector Method signatures and docstrings: - def __init__(self): Constructor initialize hog for people detection - def maxRectArea(self, rects): returns the largest rectangle - def d...
Implement the Python class `HogPeopleDetector` described below. Class description: this class implements the opencv Hog People Detector detector Method signatures and docstrings: - def __init__(self): Constructor initialize hog for people detection - def maxRectArea(self, rects): returns the largest rectangle - def d...
18fbe5fe8848e6568e53c52b15c286cb3bc19d06
<|skeleton|> class HogPeopleDetector: """this class implements the opencv Hog People Detector detector""" def __init__(self): """Constructor initialize hog for people detection""" <|body_0|> def maxRectArea(self, rects): """returns the largest rectangle""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HogPeopleDetector: """this class implements the opencv Hog People Detector detector""" def __init__(self): """Constructor initialize hog for people detection""" winSize = (64, 128) blockSize = (16, 16) blockStride = (8, 8) cellSize = (8, 8) nbins = 9 ...
the_stack_v2_python_sparse
tracking-python3/trackers/hogpeopledetector.py
Gaurav14cs17/Tracker
train
0
673a691f81d9d094a54c2f13823229d5673ffa4f
[ "self.learning_rate = learning_rate\nself.beta1 = beta1\nself.beta2 = beta2\nself.epsilon = epsilon\nself.network_params: Optional[List[Tuple]] = None\nself.network_v: List[Dict[str, np.ndarray]] = []\nself.network_s: List[Dict[str, np.ndarray]] = []\nself.t = 0", "self.network_v.clear()\nself.network_s.clear()\n...
<|body_start_0|> self.learning_rate = learning_rate self.beta1 = beta1 self.beta2 = beta2 self.epsilon = epsilon self.network_params: Optional[List[Tuple]] = None self.network_v: List[Dict[str, np.ndarray]] = [] self.network_s: List[Dict[str, np.ndarray]] = [] ...
AdamOptimizer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamOptimizer: def __init__(self, learning_rate: float=0.01, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08): """Builds a new Adam Optimizer storing the optimizer parameters and defining additional parameters to be used during the optimization process""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_025567
2,983
permissive
[ { "docstring": "Builds a new Adam Optimizer storing the optimizer parameters and defining additional parameters to be used during the optimization process", "name": "__init__", "signature": "def __init__(self, learning_rate: float=0.01, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08)" }, ...
3
stack_v2_sparse_classes_30k_train_004046
Implement the Python class `AdamOptimizer` described below. Class description: Implement the AdamOptimizer class. Method signatures and docstrings: - def __init__(self, learning_rate: float=0.01, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08): Builds a new Adam Optimizer storing the optimizer parameters ...
Implement the Python class `AdamOptimizer` described below. Class description: Implement the AdamOptimizer class. Method signatures and docstrings: - def __init__(self, learning_rate: float=0.01, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08): Builds a new Adam Optimizer storing the optimizer parameters ...
eb3cad13701471a7aaeea1d573bc5608855bab52
<|skeleton|> class AdamOptimizer: def __init__(self, learning_rate: float=0.01, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08): """Builds a new Adam Optimizer storing the optimizer parameters and defining additional parameters to be used during the optimization process""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdamOptimizer: def __init__(self, learning_rate: float=0.01, beta1: float=0.9, beta2: float=0.999, epsilon: float=1e-08): """Builds a new Adam Optimizer storing the optimizer parameters and defining additional parameters to be used during the optimization process""" self.learning_rate = learni...
the_stack_v2_python_sparse
src/docknet/optimizer/adam_optimizer.py
jeekim/Docknet
train
1
3d7a8fb5aa813cf33c023b869e14e8874ec963bc
[ "if vals.get('miscible', False) and (not vals.get('not_do_procurement', False)):\n raise osv.except_osv(_('Error!'), _(\"Cannnot put this product to do procurement, because this poduct is marked as miscible and the miscible products don't do procurement.\"))\nreturn True", "self.check_if_procurement(cr, uid, i...
<|body_start_0|> if vals.get('miscible', False) and (not vals.get('not_do_procurement', False)): raise osv.except_osv(_('Error!'), _("Cannnot put this product to do procurement, because this poduct is marked as miscible and the miscible products don't do procurement.")) return True <|end_bod...
add functionally for differentiate miscible product and not miscible product
product_product
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class product_product: """add functionally for differentiate miscible product and not miscible product""" def check_if_procurement(self, cr, uid, ids, vals): """checks if the product has configurate well the procurement""" <|body_0|> def write(self, cr, uid, ids, vals, context...
stack_v2_sparse_classes_36k_train_025568
4,387
no_license
[ { "docstring": "checks if the product has configurate well the procurement", "name": "check_if_procurement", "signature": "def check_if_procurement(self, cr, uid, ids, vals)" }, { "docstring": "overwrites write method for checks if the procurement for the product is configurate well", "name"...
3
null
Implement the Python class `product_product` described below. Class description: add functionally for differentiate miscible product and not miscible product Method signatures and docstrings: - def check_if_procurement(self, cr, uid, ids, vals): checks if the product has configurate well the procurement - def write(s...
Implement the Python class `product_product` described below. Class description: add functionally for differentiate miscible product and not miscible product Method signatures and docstrings: - def check_if_procurement(self, cr, uid, ids, vals): checks if the product has configurate well the procurement - def write(s...
01c8294e969cce818a33fd06682560e0344c217c
<|skeleton|> class product_product: """add functionally for differentiate miscible product and not miscible product""" def check_if_procurement(self, cr, uid, ids, vals): """checks if the product has configurate well the procurement""" <|body_0|> def write(self, cr, uid, ids, vals, context...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class product_product: """add functionally for differentiate miscible product and not miscible product""" def check_if_procurement(self, cr, uid, ids, vals): """checks if the product has configurate well the procurement""" if vals.get('miscible', False) and (not vals.get('not_do_procurement', F...
the_stack_v2_python_sparse
Varios/alimentacion/__unported__/full_stock_traceability/product.py
ELNOGAL/GALIPAT_LUGO
train
0
c6bbbc932da09ce1eacb63de1c7b238510195e60
[ "row = index / columns\ncolumn = index - row * columns\nreturn (row, column)", "if len(matrix) == 0 or len(matrix[0]) == 0:\n return False\nrows = len(matrix)\ncolumns = len(matrix[0])\nleft, right = (0, rows * columns - 1)\nwhile left <= right:\n middle = (left + right) / 2\n row, column = self.one_d_to...
<|body_start_0|> row = index / columns column = index - row * columns return (row, column) <|end_body_0|> <|body_start_1|> if len(matrix) == 0 or len(matrix[0]) == 0: return False rows = len(matrix) columns = len(matrix[0]) left, right = (0, rows * co...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def one_d_to_two_d_index(self, index, columns): """>>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4)...
stack_v2_sparse_classes_36k_train_025569
1,790
no_license
[ { "docstring": ">>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4) (2, 0) >>> s.one_d_to_two_d_index(7, 3, 4) (1, 3)", "name": "one...
2
stack_v2_sparse_classes_30k_train_012407
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def one_d_to_two_d_index(self, index, columns): >>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_ind...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def one_d_to_two_d_index(self, index, columns): >>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_ind...
3b13a02f9c8273f9794a57b948d2655792707f37
<|skeleton|> class Solution: def one_d_to_two_d_index(self, index, columns): """>>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def one_d_to_two_d_index(self, index, columns): """>>> s = Solution() >>> s.one_d_to_two_d_index(0, 3, 4) (0, 0) >>> s.one_d_to_two_d_index(11, 3, 4) (2, 3) >>> s.one_d_to_two_d_index(5, 3, 4) (1, 1) >>> s.one_d_to_two_d_index(4, 3, 4) (1, 0) >>> s.one_d_to_two_d_index(8, 3, 4) (2, 0) >>> s....
the_stack_v2_python_sparse
search_2d_matrix.py
gsy/leetcode
train
1
96e66221ceebd0b1653fce8eb8931d29ab48d9a5
[ "if not nodes_encountered:\n nodes_encountered = set()\nnodes = network.nodes()\nif not source:\n source = nodes[0]\nnodes_encountered.add(source)\nif len(nodes_encountered) != len(nodes):\n for node in network.network_dict[source].get_adjacents():\n if node not in nodes_encountered:\n if...
<|body_start_0|> if not nodes_encountered: nodes_encountered = set() nodes = network.nodes() if not source: source = nodes[0] nodes_encountered.add(source) if len(nodes_encountered) != len(nodes): for node in network.network_dict[source].get_ad...
This class determines whether a given network is connected or not. In a connected network, there exists a path between any given node and all other nodes (no nodes exist that cannot be reached)
ConnectivityChecker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnectivityChecker: """This class determines whether a given network is connected or not. In a connected network, there exists a path between any given node and all other nodes (no nodes exist that cannot be reached)""" def is_connected(network: Network, nodes_encountered: Set[Optional[int]...
stack_v2_sparse_classes_36k_train_025570
4,071
permissive
[ { "docstring": "Returns bool indicating graph connectivity (path between all nodes). This is a recursive DFS. :param network: object representing a graph (network) :param Set[int] nodes_encountered: set of node_id's encountered (None by default) :param int source: node_id of start of search (None by default) :r...
3
stack_v2_sparse_classes_30k_train_007281
Implement the Python class `ConnectivityChecker` described below. Class description: This class determines whether a given network is connected or not. In a connected network, there exists a path between any given node and all other nodes (no nodes exist that cannot be reached) Method signatures and docstrings: - def...
Implement the Python class `ConnectivityChecker` described below. Class description: This class determines whether a given network is connected or not. In a connected network, there exists a path between any given node and all other nodes (no nodes exist that cannot be reached) Method signatures and docstrings: - def...
1a07acbe7b039e04d40cceb790a95fe0421dfea5
<|skeleton|> class ConnectivityChecker: """This class determines whether a given network is connected or not. In a connected network, there exists a path between any given node and all other nodes (no nodes exist that cannot be reached)""" def is_connected(network: Network, nodes_encountered: Set[Optional[int]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConnectivityChecker: """This class determines whether a given network is connected or not. In a connected network, there exists a path between any given node and all other nodes (no nodes exist that cannot be reached)""" def is_connected(network: Network, nodes_encountered: Set[Optional[int]]=None, sourc...
the_stack_v2_python_sparse
network_simulator/ConnectivityChecker.py
zspatter/network-simulation
train
0
6fe04939960f1d174ec60be04347e4b9d58b1f1f
[ "self.MinIter = MinIter\nself.control = control\nself.iStep = 0\nself.maxvertices = maxvertices\nself.verticesMultiplicator = verticesMultiplicator\nself.mesh_0 = mesh_0\nself.theta = theta\nself.CVaR = CVaR", "while mesh.num_vertices() <= targetvertices:\n print('refine mesh..')\n V = FunctionSpace(mesh, V...
<|body_start_0|> self.MinIter = MinIter self.control = control self.iStep = 0 self.maxvertices = maxvertices self.verticesMultiplicator = verticesMultiplicator self.mesh_0 = mesh_0 self.theta = theta self.CVaR = CVaR <|end_body_0|> <|body_start_1|> ...
meshadaptor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class meshadaptor: def __init__(self, mesh_0, MinIter=50, control=1, maxvertices=15000, verticesMultiplicator=1.5, theta=0.6, CVaR=False): """Finite elemente discretization such that the interface region on the pase field phi and the solution of the state equation u are well represented :param...
stack_v2_sparse_classes_36k_train_025571
4,996
no_license
[ { "docstring": "Finite elemente discretization such that the interface region on the pase field phi and the solution of the state equation u are well represented :param mesh_0: start mesh from Lineat Elasticity Problem (LEP) (we start refining the new mesh from mesh_0 every time) :param MinIter: minimum iterati...
3
stack_v2_sparse_classes_30k_train_012358
Implement the Python class `meshadaptor` described below. Class description: Implement the meshadaptor class. Method signatures and docstrings: - def __init__(self, mesh_0, MinIter=50, control=1, maxvertices=15000, verticesMultiplicator=1.5, theta=0.6, CVaR=False): Finite elemente discretization such that the interfa...
Implement the Python class `meshadaptor` described below. Class description: Implement the meshadaptor class. Method signatures and docstrings: - def __init__(self, mesh_0, MinIter=50, control=1, maxvertices=15000, verticesMultiplicator=1.5, theta=0.6, CVaR=False): Finite elemente discretization such that the interfa...
6c042e57b289a29fd4703ccd35472c703266f5c1
<|skeleton|> class meshadaptor: def __init__(self, mesh_0, MinIter=50, control=1, maxvertices=15000, verticesMultiplicator=1.5, theta=0.6, CVaR=False): """Finite elemente discretization such that the interface region on the pase field phi and the solution of the state equation u are well represented :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class meshadaptor: def __init__(self, mesh_0, MinIter=50, control=1, maxvertices=15000, verticesMultiplicator=1.5, theta=0.6, CVaR=False): """Finite elemente discretization such that the interface region on the pase field phi and the solution of the state equation u are well represented :param mesh_0: start...
the_stack_v2_python_sparse
adaptivity/mesh_adaptivity.py
MarvinHaa/DeepNNforTopoOptisation
train
1
403ffb5ab3253633b53379f50780ec39dd120a40
[ "self._AMPLIFIER_CHANNELS = []\nself._AUX_CHANNELS = []\nself._SUPPLY_VOLTAGE_CHANNELS = []\nself._ADC_INPUT_CHANNELS = []\nself._DIGITAL_INPUT_CHANNELS = []\nself._TEMP_SENSORS = 0\nself.rhd = rhd_file\nself.readHead()\nself.readBlocks()", "filesize = self.rhd.tell()\nself.header_identifier = hex(np.uint32(struc...
<|body_start_0|> self._AMPLIFIER_CHANNELS = [] self._AUX_CHANNELS = [] self._SUPPLY_VOLTAGE_CHANNELS = [] self._ADC_INPUT_CHANNELS = [] self._DIGITAL_INPUT_CHANNELS = [] self._TEMP_SENSORS = 0 self.rhd = rhd_file self.readHead() self.readBlocks() <...
RHD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RHD: def __init__(self, rhd_file): """Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention""" <|body_0|> def readHead(self): """Reads all header data from the rhd file creates signal group and channel list""" ...
stack_v2_sparse_classes_36k_train_025572
12,179
permissive
[ { "docstring": "Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention", "name": "__init__", "signature": "def __init__(self, rhd_file)" }, { "docstring": "Reads all header data from the rhd file creates signal group and channel list", "name"...
3
stack_v2_sparse_classes_30k_train_003209
Implement the Python class `RHD` described below. Class description: Implement the RHD class. Method signatures and docstrings: - def __init__(self, rhd_file): Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention - def readHead(self): Reads all header data from the ...
Implement the Python class `RHD` described below. Class description: Implement the RHD class. Method signatures and docstrings: - def __init__(self, rhd_file): Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention - def readHead(self): Reads all header data from the ...
0fdbe834442550117dc9d9c8f611989bb600db62
<|skeleton|> class RHD: def __init__(self, rhd_file): """Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention""" <|body_0|> def readHead(self): """Reads all header data from the rhd file creates signal group and channel list""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RHD: def __init__(self, rhd_file): """Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention""" self._AMPLIFIER_CHANNELS = [] self._AUX_CHANNELS = [] self._SUPPLY_VOLTAGE_CHANNELS = [] self._ADC_INPUT_CHANNELS = [] ...
the_stack_v2_python_sparse
pyhfo/io/RHD.py
britodasilva/pyhfo
train
4
20782ba2561d8a9b2953206822d776327080e62a
[ "def helper(node: TreeNode, lower=float('-inf'), upper=float('inf')) -> bool:\n if node is None:\n return True\n val = node.val\n if val <= lower or val >= upper:\n return False\n if not helper(node.left, lower, val):\n return False\n if not helper(node.right, val, upper):\n ...
<|body_start_0|> def helper(node: TreeNode, lower=float('-inf'), upper=float('inf')) -> bool: if node is None: return True val = node.val if val <= lower or val >= upper: return False if not helper(node.left, lower, val): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root: TreeNode) -> bool: """递归法 :param root: :return:""" <|body_0|> def isValidBST2(self, root: TreeNode) -> bool: """中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_025573
1,618
no_license
[ { "docstring": "递归法 :param root: :return:", "name": "isValidBST", "signature": "def isValidBST(self, root: TreeNode) -> bool" }, { "docstring": "中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:", "name": "isValidBST2", "signature": "def isValidBST2(self, root: TreeNode) -> bool" }...
2
stack_v2_sparse_classes_30k_train_000323
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root: TreeNode) -> bool: 递归法 :param root: :return: - def isValidBST2(self, root: TreeNode) -> bool: 中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root: TreeNode) -> bool: 递归法 :param root: :return: - def isValidBST2(self, root: TreeNode) -> bool: 中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return: <|...
150a216213ddb2012b603899717ad7a769c1b3c3
<|skeleton|> class Solution: def isValidBST(self, root: TreeNode) -> bool: """递归法 :param root: :return:""" <|body_0|> def isValidBST2(self, root: TreeNode) -> bool: """中序遍历 使用栈来进行存储中序遍历节点,每次判断与前一节点大小 :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root: TreeNode) -> bool: """递归法 :param root: :return:""" def helper(node: TreeNode, lower=float('-inf'), upper=float('inf')) -> bool: if node is None: return True val = node.val if val <= lower or val >= upper: ...
the_stack_v2_python_sparse
code/26_验证二叉搜索树.py
fsc2016/LeetCode
train
0
5bea94f7e9e262e32b335fce66a1020a846be7e8
[ "self.nbhood_radius = nbhood_radius\nself.textural_threshold = textural_threshold\nself.diagnostic_threshold = diagnostic_threshold\nself.model_id_attr = model_id_attr", "potential_transitions = NeighbourhoodProcessing('square', radius, sum_only=True).process(cube)\npotential_transitions.data = 4 * potential_tran...
<|body_start_0|> self.nbhood_radius = nbhood_radius self.textural_threshold = textural_threshold self.diagnostic_threshold = diagnostic_threshold self.model_id_attr = model_id_attr <|end_body_0|> <|body_start_1|> potential_transitions = NeighbourhoodProcessing('square', radius, ...
Plugin to calculate whether or not the input field texture exceeds a given threshold. 1) Takes a binary field that has been thresholded and looks for the transitions/edges in the field that mark out a transition. 2) The transition calculation is then fed into the neighbourhooding code (_calculate_ratio) to calculate a ...
FieldTexture
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FieldTexture: """Plugin to calculate whether or not the input field texture exceeds a given threshold. 1) Takes a binary field that has been thresholded and looks for the transitions/edges in the field that mark out a transition. 2) The transition calculation is then fed into the neighbourhooding...
stack_v2_sparse_classes_36k_train_025574
11,432
permissive
[ { "docstring": "Args: nbhood_radius: The neighbourhood radius in metres within which the number of potential transitions should be calculated. This forms the denominator in the calculation of the ratio of actual to potential transitions that indicates a field's texture. A larger radius should be used for diagno...
4
null
Implement the Python class `FieldTexture` described below. Class description: Plugin to calculate whether or not the input field texture exceeds a given threshold. 1) Takes a binary field that has been thresholded and looks for the transitions/edges in the field that mark out a transition. 2) The transition calculatio...
Implement the Python class `FieldTexture` described below. Class description: Plugin to calculate whether or not the input field texture exceeds a given threshold. 1) Takes a binary field that has been thresholded and looks for the transitions/edges in the field that mark out a transition. 2) The transition calculatio...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class FieldTexture: """Plugin to calculate whether or not the input field texture exceeds a given threshold. 1) Takes a binary field that has been thresholded and looks for the transitions/edges in the field that mark out a transition. 2) The transition calculation is then fed into the neighbourhooding...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FieldTexture: """Plugin to calculate whether or not the input field texture exceeds a given threshold. 1) Takes a binary field that has been thresholded and looks for the transitions/edges in the field that mark out a transition. 2) The transition calculation is then fed into the neighbourhooding code (_calcu...
the_stack_v2_python_sparse
improver/utilities/textural.py
metoppv/improver
train
101
e9d1535a759e2dc6ba2925268a00232d09a80701
[ "if timestamp is not None and signature is not None and (token is not None):\n key_bytes = bytes(settings.MAILGUN_KEY, 'latin-1')\n data_bytes = bytes('{}{}'.format(timestamp, token), 'latin-1')\n hmac_digest = hmac.new(key=key_bytes, msg=data_bytes, digestmod=hashlib.sha256).hexdigest()\n return hmac.c...
<|body_start_0|> if timestamp is not None and signature is not None and (token is not None): key_bytes = bytes(settings.MAILGUN_KEY, 'latin-1') data_bytes = bytes('{}{}'.format(timestamp, token), 'latin-1') hmac_digest = hmac.new(key=key_bytes, msg=data_bytes, digestmod=hashl...
Verifies HMAC signature for Mailgun webhook
MailGunWebHookPermission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailGunWebHookPermission: """Verifies HMAC signature for Mailgun webhook""" def verify(cls, token, timestamp, signature): """Verify signature of event for security Args: token (str): Randomly generated alpha numeric string with length 50. timestamp (int): Number of seconds passed sin...
stack_v2_sparse_classes_36k_train_025575
5,096
permissive
[ { "docstring": "Verify signature of event for security Args: token (str): Randomly generated alpha numeric string with length 50. timestamp (int): Number of seconds passed since January 1, 1970 signature (str): String with hexadecimal digits generate by HMAC algorithm. Returns: boolean: True if signature is val...
2
null
Implement the Python class `MailGunWebHookPermission` described below. Class description: Verifies HMAC signature for Mailgun webhook Method signatures and docstrings: - def verify(cls, token, timestamp, signature): Verify signature of event for security Args: token (str): Randomly generated alpha numeric string with...
Implement the Python class `MailGunWebHookPermission` described below. Class description: Verifies HMAC signature for Mailgun webhook Method signatures and docstrings: - def verify(cls, token, timestamp, signature): Verify signature of event for security Args: token (str): Randomly generated alpha numeric string with...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class MailGunWebHookPermission: """Verifies HMAC signature for Mailgun webhook""" def verify(cls, token, timestamp, signature): """Verify signature of event for security Args: token (str): Randomly generated alpha numeric string with length 50. timestamp (int): Number of seconds passed sin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailGunWebHookPermission: """Verifies HMAC signature for Mailgun webhook""" def verify(cls, token, timestamp, signature): """Verify signature of event for security Args: token (str): Randomly generated alpha numeric string with length 50. timestamp (int): Number of seconds passed since January 1,...
the_stack_v2_python_sparse
mail/permissions.py
mitodl/micromasters
train
35
d71d3c56cf7742fb71ae915e607722ceab180e5c
[ "self.consumers = []\nself.qty_workers = qty_workers\nself.cached_crawlers = {}\nself.times_to_run = times_to_run", "for i in range(self.qty_workers):\n p = Thread(target=self._crawl_params)\n self.consumers.append(p)\nfor consumer in self.consumers:\n consumer.start()", "crawler = get_crawler_by_name(...
<|body_start_0|> self.consumers = [] self.qty_workers = qty_workers self.cached_crawlers = {} self.times_to_run = times_to_run <|end_body_0|> <|body_start_1|> for i in range(self.qty_workers): p = Thread(target=self._crawl_params) self.consumers.append(p)...
Initiates a crawl consumer that reads from the multiprocessing queue. It processes the parameters in parallel using a determined quantity of workers.
CrawlConsumer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrawlConsumer: """Initiates a crawl consumer that reads from the multiprocessing queue. It processes the parameters in parallel using a determined quantity of workers.""" def __init__(self, qty_workers=2, times_to_run=None): """Args: qty_workers: The quantity of consumers that we wan...
stack_v2_sparse_classes_36k_train_025576
4,282
permissive
[ { "docstring": "Args: qty_workers: The quantity of consumers that we want to start. times_to_run: how many time to run on the thread. [ONLY FOR TESTING]", "name": "__init__", "signature": "def __init__(self, qty_workers=2, times_to_run=None)" }, { "docstring": "Start all the consumers that we ne...
5
stack_v2_sparse_classes_30k_train_004794
Implement the Python class `CrawlConsumer` described below. Class description: Initiates a crawl consumer that reads from the multiprocessing queue. It processes the parameters in parallel using a determined quantity of workers. Method signatures and docstrings: - def __init__(self, qty_workers=2, times_to_run=None):...
Implement the Python class `CrawlConsumer` described below. Class description: Initiates a crawl consumer that reads from the multiprocessing queue. It processes the parameters in parallel using a determined quantity of workers. Method signatures and docstrings: - def __init__(self, qty_workers=2, times_to_run=None):...
fc321b21b50ecdf987d65302a48d6170fe03d3f5
<|skeleton|> class CrawlConsumer: """Initiates a crawl consumer that reads from the multiprocessing queue. It processes the parameters in parallel using a determined quantity of workers.""" def __init__(self, qty_workers=2, times_to_run=None): """Args: qty_workers: The quantity of consumers that we wan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrawlConsumer: """Initiates a crawl consumer that reads from the multiprocessing queue. It processes the parameters in parallel using a determined quantity of workers.""" def __init__(self, qty_workers=2, times_to_run=None): """Args: qty_workers: The quantity of consumers that we want to start. t...
the_stack_v2_python_sparse
src/davinci_crawling/management/commands/utils/consumer.py
intellstartup/django-davinci-crawling
train
0
5605513c7bad3b4405e3f5166fc4c42afece4136
[ "obj = self.get_object()\nuser = request.user\nobj.set_deleted(user=user)\nreturn Response(status=status.HTTP_204_NO_CONTENT)", "if isinstance(request.data, list):\n serializer = self.get_serializer(data=request.data, many=True)\n serializer.is_valid(raise_exception=True)\n self.perform_create(serializer...
<|body_start_0|> obj = self.get_object() user = request.user obj.set_deleted(user=user) return Response(status=status.HTTP_204_NO_CONTENT) <|end_body_0|> <|body_start_1|> if isinstance(request.data, list): serializer = self.get_serializer(data=request.data, many=True...
Submission Review ViewSet class
SubmissionReviewViewSet
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubmissionReviewViewSet: """Submission Review ViewSet class""" def destroy(self, request, *args, **kwargs): """Custom destroy method""" <|body_0|> def create(self, request, *args, **kwargs): """Custom create method. Handle bulk create""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_025577
3,167
permissive
[ { "docstring": "Custom destroy method", "name": "destroy", "signature": "def destroy(self, request, *args, **kwargs)" }, { "docstring": "Custom create method. Handle bulk create", "name": "create", "signature": "def create(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `SubmissionReviewViewSet` described below. Class description: Submission Review ViewSet class Method signatures and docstrings: - def destroy(self, request, *args, **kwargs): Custom destroy method - def create(self, request, *args, **kwargs): Custom create method. Handle bulk create
Implement the Python class `SubmissionReviewViewSet` described below. Class description: Submission Review ViewSet class Method signatures and docstrings: - def destroy(self, request, *args, **kwargs): Custom destroy method - def create(self, request, *args, **kwargs): Custom create method. Handle bulk create <|skel...
e5bdec91cb47179172b515bbcb91701262ff3377
<|skeleton|> class SubmissionReviewViewSet: """Submission Review ViewSet class""" def destroy(self, request, *args, **kwargs): """Custom destroy method""" <|body_0|> def create(self, request, *args, **kwargs): """Custom create method. Handle bulk create""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SubmissionReviewViewSet: """Submission Review ViewSet class""" def destroy(self, request, *args, **kwargs): """Custom destroy method""" obj = self.get_object() user = request.user obj.set_deleted(user=user) return Response(status=status.HTTP_204_NO_CONTENT) de...
the_stack_v2_python_sparse
onadata/apps/api/viewsets/submission_review_viewset.py
onaio/onadata
train
177
dd63fa6b82e4dab3873fc064eea723e31221d581
[ "self.debug = True\npygame.init()\npygame.joystick.init()\nif pygame.joystick.get_init():\n logger.debug('Joystick module initialized!')\n self.count = pygame.joystick.get_count()\n logger.debug('%s joysticks detected.' % pygame.joystick.get_count())\nself.controllers = []\nfor i in range(self.count):\n ...
<|body_start_0|> self.debug = True pygame.init() pygame.joystick.init() if pygame.joystick.get_init(): logger.debug('Joystick module initialized!') self.count = pygame.joystick.get_count() logger.debug('%s joysticks detected.' % pygame.joystick.get_cou...
ConnexionDevice
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnexionDevice: def __init__(self): """Creates and initializes pygame.joystick object and creates subordinate pygame.joystick.Joystick module""" <|body_0|> def close(self): """Disconnects and removes modules upon closing application. Included are the pygame.joystick...
stack_v2_sparse_classes_36k_train_025578
2,052
permissive
[ { "docstring": "Creates and initializes pygame.joystick object and creates subordinate pygame.joystick.Joystick module", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Disconnects and removes modules upon closing application. Included are the pygame.joystick and pygame....
2
null
Implement the Python class `ConnexionDevice` described below. Class description: Implement the ConnexionDevice class. Method signatures and docstrings: - def __init__(self): Creates and initializes pygame.joystick object and creates subordinate pygame.joystick.Joystick module - def close(self): Disconnects and remove...
Implement the Python class `ConnexionDevice` described below. Class description: Implement the ConnexionDevice class. Method signatures and docstrings: - def __init__(self): Creates and initializes pygame.joystick object and creates subordinate pygame.joystick.Joystick module - def close(self): Disconnects and remove...
e9a20930d790c995163192b29394a266af54a3d0
<|skeleton|> class ConnexionDevice: def __init__(self): """Creates and initializes pygame.joystick object and creates subordinate pygame.joystick.Joystick module""" <|body_0|> def close(self): """Disconnects and removes modules upon closing application. Included are the pygame.joystick...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConnexionDevice: def __init__(self): """Creates and initializes pygame.joystick object and creates subordinate pygame.joystick.Joystick module""" self.debug = True pygame.init() pygame.joystick.init() if pygame.joystick.get_init(): logger.debug('Joystick mod...
the_stack_v2_python_sparse
ScopeFoundryHW/connexion_pygame/connexion_pg_ec.py
erictang000/stackbot
train
1
b46af8f0762d3bc349bcdeddc2863dda99112d50
[ "self.k = k\nself.loss_hp = []\nheapify(self.loss_hp)\nself.min_loss = np.inf", "if loss < self.min_loss:\n return True\nelse:\n return False", "self.min_loss = min(self.min_loss, loss)\nif len(self.loss_hp) < self.k:\n heappush(self.loss_hp, -loss)\nelif loss < -self.loss_hp[0]:\n heappop(self.loss...
<|body_start_0|> self.k = k self.loss_hp = [] heapify(self.loss_hp) self.min_loss = np.inf <|end_body_0|> <|body_start_1|> if loss < self.min_loss: return True else: return False <|end_body_1|> <|body_start_2|> self.min_loss = min(self.mi...
EarlyStopping
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EarlyStopping: def __init__(self, k): """Early stop training process if model loss didn't decease in k epoch Args: k(int): number of epoch to stop training process""" <|body_0|> def loss_compare(self, loss): """Return if the loss is the minimum Args: loss(float): tra...
stack_v2_sparse_classes_36k_train_025579
1,535
no_license
[ { "docstring": "Early stop training process if model loss didn't decease in k epoch Args: k(int): number of epoch to stop training process", "name": "__init__", "signature": "def __init__(self, k)" }, { "docstring": "Return if the loss is the minimum Args: loss(float): training loss", "name"...
3
stack_v2_sparse_classes_30k_train_010928
Implement the Python class `EarlyStopping` described below. Class description: Implement the EarlyStopping class. Method signatures and docstrings: - def __init__(self, k): Early stop training process if model loss didn't decease in k epoch Args: k(int): number of epoch to stop training process - def loss_compare(sel...
Implement the Python class `EarlyStopping` described below. Class description: Implement the EarlyStopping class. Method signatures and docstrings: - def __init__(self, k): Early stop training process if model loss didn't decease in k epoch Args: k(int): number of epoch to stop training process - def loss_compare(sel...
4d4c84c30d72cc2f4e65efad51f4bf8473191c19
<|skeleton|> class EarlyStopping: def __init__(self, k): """Early stop training process if model loss didn't decease in k epoch Args: k(int): number of epoch to stop training process""" <|body_0|> def loss_compare(self, loss): """Return if the loss is the minimum Args: loss(float): tra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EarlyStopping: def __init__(self, k): """Early stop training process if model loss didn't decease in k epoch Args: k(int): number of epoch to stop training process""" self.k = k self.loss_hp = [] heapify(self.loss_hp) self.min_loss = np.inf def loss_compare(self, l...
the_stack_v2_python_sparse
experiment/utils/early_stopping.py
crystal22/VGMF
train
0
5313e8d09288736663990eff5d2eaba2eac8b078
[ "left = 0\nright = 0\nfor i in range(len(s)):\n if s[i] in '(*':\n left += 1\n else:\n left -= 1\n if s[len(s) - i - 1] in '*)':\n right += 1\n else:\n right -= 1\n if left < 0 or right < 0:\n return False\nreturn True", "close_max = 0\nclose_min = 0\nfor c in s:\...
<|body_start_0|> left = 0 right = 0 for i in range(len(s)): if s[i] in '(*': left += 1 else: left -= 1 if s[len(s) - i - 1] in '*)': right += 1 else: right -= 1 if left < 0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkValidString(self, s): """:type s: str :rtype: bool""" <|body_0|> def checkValidString_1(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = 0 right = 0 for i in range(len(s...
stack_v2_sparse_classes_36k_train_025580
1,167
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "checkValidString", "signature": "def checkValidString(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "checkValidString_1", "signature": "def checkValidString_1(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkValidString(self, s): :type s: str :rtype: bool - def checkValidString_1(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 checkValidString(self, s): :type s: str :rtype: bool - def checkValidString_1(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def checkValidString(self...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def checkValidString(self, s): """:type s: str :rtype: bool""" <|body_0|> def checkValidString_1(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 checkValidString(self, s): """:type s: str :rtype: bool""" left = 0 right = 0 for i in range(len(s)): if s[i] in '(*': left += 1 else: left -= 1 if s[len(s) - i - 1] in '*)': right...
the_stack_v2_python_sparse
LeetCode/30 days challenge/16_Valid_Parenthesis_String.py
XyK0907/for_work
train
0
6e72c696afff34f756072cf334852123b2aa7a23
[ "checkboxes_data = {}\nfield_prefix = '%s__' % name\nif data:\n for field_name in data:\n if field_name.startswith(field_prefix):\n origin_field_name = field_name.replace(field_prefix, '')\n checkboxes_data[origin_field_name] = True\n for field_name in Customer.DEFAULT_CONTACT_PRE...
<|body_start_0|> checkboxes_data = {} field_prefix = '%s__' % name if data: for field_name in data: if field_name.startswith(field_prefix): origin_field_name = field_name.replace(field_prefix, '') checkboxes_data[origin_field_na...
Handle rendering and converting data for `Customer.contact_preferences`
JsonCheckboxesWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JsonCheckboxesWidget: """Handle rendering and converting data for `Customer.contact_preferences`""" def value_from_datadict(self, data, files, name): """Restore `contact preferences` structure from inputs values""" <|body_0|> def render(self, name, value, attrs=None): ...
stack_v2_sparse_classes_36k_train_025581
3,800
no_license
[ { "docstring": "Restore `contact preferences` structure from inputs values", "name": "value_from_datadict", "signature": "def value_from_datadict(self, data, files, name)" }, { "docstring": "Renders json structure of `Customer.contact_preferences` into list of checkboxes", "name": "render", ...
2
null
Implement the Python class `JsonCheckboxesWidget` described below. Class description: Handle rendering and converting data for `Customer.contact_preferences` Method signatures and docstrings: - def value_from_datadict(self, data, files, name): Restore `contact preferences` structure from inputs values - def render(se...
Implement the Python class `JsonCheckboxesWidget` described below. Class description: Handle rendering and converting data for `Customer.contact_preferences` Method signatures and docstrings: - def value_from_datadict(self, data, files, name): Restore `contact preferences` structure from inputs values - def render(se...
f1a8cd8268d032ea8321e1588e226da09925b7aa
<|skeleton|> class JsonCheckboxesWidget: """Handle rendering and converting data for `Customer.contact_preferences`""" def value_from_datadict(self, data, files, name): """Restore `contact preferences` structure from inputs values""" <|body_0|> def render(self, name, value, attrs=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JsonCheckboxesWidget: """Handle rendering and converting data for `Customer.contact_preferences`""" def value_from_datadict(self, data, files, name): """Restore `contact preferences` structure from inputs values""" checkboxes_data = {} field_prefix = '%s__' % name if data:...
the_stack_v2_python_sparse
website/apps/accounts/forms.py
protoprojects/worksample
train
0
6c080a43b866b5841b7a48492b3fcece3527e5e4
[ "super().__init__(cost_multiplier=cost_multiplier)\nself.density_count = target_densities.shape[0]\nself.hilbert_size = target_densities.shape[-1]\nself.target_densities_dagger = conjugate_transpose(np.stack(target_densities))", "hilbert_size = self.hilbert_size\nfidelity = 0\nfor i, target_density_dagger in enum...
<|body_start_0|> super().__init__(cost_multiplier=cost_multiplier) self.density_count = target_densities.shape[0] self.hilbert_size = target_densities.shape[-1] self.target_densities_dagger = conjugate_transpose(np.stack(target_densities)) <|end_body_0|> <|body_start_1|> hilbert...
This class encapsulates the target density infidelity cost function. The penalty of this function is calculated using the Frobenius inner product. Fields: cost_multiplier :: float - the wieght factor for this cost density_count :: int - the number of evolving densities hilbert_size :: int - the dimension of the hilbert...
TargetDensityInfidelity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TargetDensityInfidelity: """This class encapsulates the target density infidelity cost function. The penalty of this function is calculated using the Frobenius inner product. Fields: cost_multiplier :: float - the wieght factor for this cost density_count :: int - the number of evolving densities...
stack_v2_sparse_classes_36k_train_025582
4,173
permissive
[ { "docstring": "See class definition for arguments not listed here. Args: target_densities :: ndarray (density_count x hilbert_size x hilbert_size) - an array of densities that correspond to the target density for each of the initial densities used in optimization", "name": "__init__", "signature": "def...
2
stack_v2_sparse_classes_30k_train_020977
Implement the Python class `TargetDensityInfidelity` described below. Class description: This class encapsulates the target density infidelity cost function. The penalty of this function is calculated using the Frobenius inner product. Fields: cost_multiplier :: float - the wieght factor for this cost density_count ::...
Implement the Python class `TargetDensityInfidelity` described below. Class description: This class encapsulates the target density infidelity cost function. The penalty of this function is calculated using the Frobenius inner product. Fields: cost_multiplier :: float - the wieght factor for this cost density_count ::...
64c1eed34c9a4200a01a7152932482a29a1fd89e
<|skeleton|> class TargetDensityInfidelity: """This class encapsulates the target density infidelity cost function. The penalty of this function is calculated using the Frobenius inner product. Fields: cost_multiplier :: float - the wieght factor for this cost density_count :: int - the number of evolving densities...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TargetDensityInfidelity: """This class encapsulates the target density infidelity cost function. The penalty of this function is calculated using the Frobenius inner product. Fields: cost_multiplier :: float - the wieght factor for this cost density_count :: int - the number of evolving densities hilbert_size...
the_stack_v2_python_sparse
qoc/standard/costs/targetdensityinfidelity.py
jmbaker94/qoc
train
0
7659c8a25fb676ee8e232bb0543b536a311029b3
[ "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.
ModelRepositoryServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelRepositoryServiceServicer: """Missing associated documentation comment in .proto file.""" def RepositoryIndex(self, request, context): """Get the index of model repository contents.""" <|body_0|> def RepositoryModelLoad(self, request, context): """Load or re...
stack_v2_sparse_classes_36k_train_025583
6,338
permissive
[ { "docstring": "Get the index of model repository contents.", "name": "RepositoryIndex", "signature": "def RepositoryIndex(self, request, context)" }, { "docstring": "Load or reload a model from a repository.", "name": "RepositoryModelLoad", "signature": "def RepositoryModelLoad(self, re...
3
stack_v2_sparse_classes_30k_train_010792
Implement the Python class `ModelRepositoryServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def RepositoryIndex(self, request, context): Get the index of model repository contents. - def RepositoryModelLoad(self, request,...
Implement the Python class `ModelRepositoryServiceServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def RepositoryIndex(self, request, context): Get the index of model repository contents. - def RepositoryModelLoad(self, request,...
07a36f2cacf4eea6ed3ac28436792f31adb04d01
<|skeleton|> class ModelRepositoryServiceServicer: """Missing associated documentation comment in .proto file.""" def RepositoryIndex(self, request, context): """Get the index of model repository contents.""" <|body_0|> def RepositoryModelLoad(self, request, context): """Load or re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelRepositoryServiceServicer: """Missing associated documentation comment in .proto file.""" def RepositoryIndex(self, request, context): """Get the index of model repository contents.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented...
the_stack_v2_python_sparse
mlserver/grpc/model_repository_pb2_grpc.py
LiangTsao/MLServer
train
0
6efbb1067a143214af796dbf7ac041b68b4419bf
[ "def dfs(nums, target1, target2):\n if target1 == 0 or target2 == 0:\n return True\n if target1 < 0 or target2 < 0:\n return False\n return dfs(nums[1:], target1 - nums[0], target2) or dfs(nums[1:], target1, target2 - nums[0])\nnums.sort(reverse=True)\ntotal = sum(nums)\nreturn False if total...
<|body_start_0|> def dfs(nums, target1, target2): if target1 == 0 or target2 == 0: return True if target1 < 0 or target2 < 0: return False return dfs(nums[1:], target1 - nums[0], target2) or dfs(nums[1:], target1, target2 - nums[0]) num...
等价转换:是否可以从数组中挑出一些正整数,使得这些数的和等于整个数组元素和的一半。因此,如果满足条件,则数组总和一定是偶数
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """等价转换:是否可以从数组中挑出一些正整数,使得这些数的和等于整个数组元素和的一半。因此,如果满足条件,则数组总和一定是偶数""" def canPartition1(self, nums: List[int]) -> bool: """DFS: 1. 对于nums中的每一个元素,要么放到子集1中,要么放到子集2中,这两种操作互补且等价 2. 当任意一个子集和等于sum(nums)/2时,即成功找到一个解 3. 当任意一个子集和大于sum(nums)/2时,在此种分支下不可能找到一个可行解,剪枝""" <|body_0|>...
stack_v2_sparse_classes_36k_train_025584
3,002
no_license
[ { "docstring": "DFS: 1. 对于nums中的每一个元素,要么放到子集1中,要么放到子集2中,这两种操作互补且等价 2. 当任意一个子集和等于sum(nums)/2时,即成功找到一个解 3. 当任意一个子集和大于sum(nums)/2时,在此种分支下不可能找到一个可行解,剪枝", "name": "canPartition1", "signature": "def canPartition1(self, nums: List[int]) -> bool" }, { "docstring": "DP:类似0-1背包问题 详解:https://leetcode-cn.co...
2
stack_v2_sparse_classes_30k_train_002161
Implement the Python class `Solution` described below. Class description: 等价转换:是否可以从数组中挑出一些正整数,使得这些数的和等于整个数组元素和的一半。因此,如果满足条件,则数组总和一定是偶数 Method signatures and docstrings: - def canPartition1(self, nums: List[int]) -> bool: DFS: 1. 对于nums中的每一个元素,要么放到子集1中,要么放到子集2中,这两种操作互补且等价 2. 当任意一个子集和等于sum(nums)/2时,即成功找到一个解 3. 当任意一个子集...
Implement the Python class `Solution` described below. Class description: 等价转换:是否可以从数组中挑出一些正整数,使得这些数的和等于整个数组元素和的一半。因此,如果满足条件,则数组总和一定是偶数 Method signatures and docstrings: - def canPartition1(self, nums: List[int]) -> bool: DFS: 1. 对于nums中的每一个元素,要么放到子集1中,要么放到子集2中,这两种操作互补且等价 2. 当任意一个子集和等于sum(nums)/2时,即成功找到一个解 3. 当任意一个子集...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: """等价转换:是否可以从数组中挑出一些正整数,使得这些数的和等于整个数组元素和的一半。因此,如果满足条件,则数组总和一定是偶数""" def canPartition1(self, nums: List[int]) -> bool: """DFS: 1. 对于nums中的每一个元素,要么放到子集1中,要么放到子集2中,这两种操作互补且等价 2. 当任意一个子集和等于sum(nums)/2时,即成功找到一个解 3. 当任意一个子集和大于sum(nums)/2时,在此种分支下不可能找到一个可行解,剪枝""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """等价转换:是否可以从数组中挑出一些正整数,使得这些数的和等于整个数组元素和的一半。因此,如果满足条件,则数组总和一定是偶数""" def canPartition1(self, nums: List[int]) -> bool: """DFS: 1. 对于nums中的每一个元素,要么放到子集1中,要么放到子集2中,这两种操作互补且等价 2. 当任意一个子集和等于sum(nums)/2时,即成功找到一个解 3. 当任意一个子集和大于sum(nums)/2时,在此种分支下不可能找到一个可行解,剪枝""" def dfs(nums, target1, ...
the_stack_v2_python_sparse
416_partition-equal-subset-sum.py
helloocc/algorithm
train
1
1cb7153d1eafd5bbdbdf63a3392606b7f8712ef6
[ "customer = order_data.get('customer')\nflavour = order_data.get('flavour')\nsize = order_data.get('size')\nmobile_number = customer.get('mobile_number')\nif self.model.objects.filter(flavour=flavour, size=size, customer__mobile_number=mobile_number).exists():\n raise DuplicateOrderException", "self._check_dup...
<|body_start_0|> customer = order_data.get('customer') flavour = order_data.get('flavour') size = order_data.get('size') mobile_number = customer.get('mobile_number') if self.model.objects.filter(flavour=flavour, size=size, customer__mobile_number=mobile_number).exists(): ...
Order Service
OrderService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrderService: """Order Service""" def _check_duplicate_order(self, order_data): """Check Duplicate Order :param order_data: Order payload :return: None""" <|body_0|> def create_order(self, order_data): """Create Order :param order_data: Order payload :return: ord...
stack_v2_sparse_classes_36k_train_025585
4,498
no_license
[ { "docstring": "Check Duplicate Order :param order_data: Order payload :return: None", "name": "_check_duplicate_order", "signature": "def _check_duplicate_order(self, order_data)" }, { "docstring": "Create Order :param order_data: Order payload :return: order: Order object", "name": "create...
5
stack_v2_sparse_classes_30k_train_013329
Implement the Python class `OrderService` described below. Class description: Order Service Method signatures and docstrings: - def _check_duplicate_order(self, order_data): Check Duplicate Order :param order_data: Order payload :return: None - def create_order(self, order_data): Create Order :param order_data: Order...
Implement the Python class `OrderService` described below. Class description: Order Service Method signatures and docstrings: - def _check_duplicate_order(self, order_data): Check Duplicate Order :param order_data: Order payload :return: None - def create_order(self, order_data): Create Order :param order_data: Order...
787e67788359521a188b9ca4fad58c216fec387d
<|skeleton|> class OrderService: """Order Service""" def _check_duplicate_order(self, order_data): """Check Duplicate Order :param order_data: Order payload :return: None""" <|body_0|> def create_order(self, order_data): """Create Order :param order_data: Order payload :return: ord...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OrderService: """Order Service""" def _check_duplicate_order(self, order_data): """Check Duplicate Order :param order_data: Order payload :return: None""" customer = order_data.get('customer') flavour = order_data.get('flavour') size = order_data.get('size') mobile...
the_stack_v2_python_sparse
pizza_ordering/orders/services/order_service.py
solaman-raji/pizza-ordering
train
0
e2bc1443a105bae44339fef1004555b10d1c2710
[ "batch = batch.to(self.device)\nnoisy_wavs, lens = batch.noisy_sig\nfeats = self.hparams.compute_STFT(noisy_wavs)\nfeats = spectral_magnitude(feats, power=0.5)\nfeats = torch.log1p(feats)\npredict_spec = self.hparams.model(feats)\nif stage != sb.Stage.TRAIN:\n predict_wav = self.hparams.resynth(torch.expm1(predi...
<|body_start_0|> batch = batch.to(self.device) noisy_wavs, lens = batch.noisy_sig feats = self.hparams.compute_STFT(noisy_wavs) feats = spectral_magnitude(feats, power=0.5) feats = torch.log1p(feats) predict_spec = self.hparams.model(feats) if stage != sb.Stage.TR...
SEBrain
[ "GPL-1.0-or-later", "LicenseRef-scancode-other-permissive", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SEBrain: def compute_forward(self, batch, stage): """Forward computations from the waveform batches to the enhanced output.""" <|body_0|> def compute_objectives(self, predictions, batch, stage): """Computes the loss given the predicted and targeted outputs""" ...
stack_v2_sparse_classes_36k_train_025586
9,502
permissive
[ { "docstring": "Forward computations from the waveform batches to the enhanced output.", "name": "compute_forward", "signature": "def compute_forward(self, batch, stage)" }, { "docstring": "Computes the loss given the predicted and targeted outputs", "name": "compute_objectives", "signat...
4
stack_v2_sparse_classes_30k_train_017968
Implement the Python class `SEBrain` described below. Class description: Implement the SEBrain class. Method signatures and docstrings: - def compute_forward(self, batch, stage): Forward computations from the waveform batches to the enhanced output. - def compute_objectives(self, predictions, batch, stage): Computes ...
Implement the Python class `SEBrain` described below. Class description: Implement the SEBrain class. Method signatures and docstrings: - def compute_forward(self, batch, stage): Forward computations from the waveform batches to the enhanced output. - def compute_objectives(self, predictions, batch, stage): Computes ...
d4c9a53773f13d5a2843f25bc7f89482936e2f17
<|skeleton|> class SEBrain: def compute_forward(self, batch, stage): """Forward computations from the waveform batches to the enhanced output.""" <|body_0|> def compute_objectives(self, predictions, batch, stage): """Computes the loss given the predicted and targeted outputs""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SEBrain: def compute_forward(self, batch, stage): """Forward computations from the waveform batches to the enhanced output.""" batch = batch.to(self.device) noisy_wavs, lens = batch.noisy_sig feats = self.hparams.compute_STFT(noisy_wavs) feats = spectral_magnitude(feats...
the_stack_v2_python_sparse
recipes/DNS/enhance/spectral_map/train.py
zycv/speechbrain
train
2
e88e07759d538c6878671b86e221ee2920622f85
[ "max_heap = [-num for num in nums]\nheapq.heapify(max_heap)\nres = []\nfor i in range(k):\n res.append(heapq.heappop(max_heap))\nreturn -res[-1]", "heap = []\nfor i in range(k):\n heapq.heappush(heap, nums[i])\nfor i in range(k, len(nums)):\n if nums[i] > heap[0]:\n heapq.heappop(heap)\n he...
<|body_start_0|> max_heap = [-num for num in nums] heapq.heapify(max_heap) res = [] for i in range(k): res.append(heapq.heappop(max_heap)) return -res[-1] <|end_body_0|> <|body_start_1|> heap = [] for i in range(k): heapq.heappush(heap, nu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_hea...
stack_v2_sparse_classes_36k_train_025587
1,752
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "findKthLargest", "signature": "def findKthLargest(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "findKthLargest", "signature": "def findKthLargest(self, nums, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def findKthLargest(self, nums, k): :type nums: List[int] :type k: int :rtype: int <|skeleton|...
860590239da0618c52967a55eda8d6bbe00bfa96
<|skeleton|> class Solution: def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findKthLargest(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" max_heap = [-num for num in nums] heapq.heapify(max_heap) res = [] for i in range(k): res.append(heapq.heappop(max_heap)) return -res[-1] def findK...
the_stack_v2_python_sparse
LeetCode/p0215/II/kth-largest-element-in-an-array.py
Ynjxsjmh/PracticeMakesPerfect
train
0
fbe664acda29fa4f09813d4a03f0baa3fb8597d1
[ "if 'event_uuid' in self.kwargs:\n self.event_proposal = get_object_or_404(models.EventProposal, uuid=self.kwargs['event_uuid'], user=request.user)\nelif 'speaker_uuid' in self.kwargs:\n self.speaker_proposal = get_object_or_404(models.SpeakerProposal, uuid=self.kwargs['speaker_uuid'], user=request.user)\nels...
<|body_start_0|> if 'event_uuid' in self.kwargs: self.event_proposal = get_object_or_404(models.EventProposal, uuid=self.kwargs['event_uuid'], user=request.user) elif 'speaker_uuid' in self.kwargs: self.speaker_proposal = get_object_or_404(models.SpeakerProposal, uuid=self.kwargs...
Mixin with code shared between all the Url views
UrlViewMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UrlViewMixin: """Mixin with code shared between all the Url views""" def dispatch(self, request, *args, **kwargs): """Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user""" <|body_0|> def get_context_data(self, **kwargs): ...
stack_v2_sparse_classes_36k_train_025588
7,691
permissive
[ { "docstring": "Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user", "name": "dispatch", "signature": "def dispatch(self, request, *args, **kwargs)" }, { "docstring": "Include the proposal in the template context", "name": "get_context_data", ...
3
stack_v2_sparse_classes_30k_train_003604
Implement the Python class `UrlViewMixin` described below. Class description: Mixin with code shared between all the Url views Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user - def get...
Implement the Python class `UrlViewMixin` described below. Class description: Mixin with code shared between all the Url views Method signatures and docstrings: - def dispatch(self, request, *args, **kwargs): Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user - def get...
767deb7f58429e9162e0c2ef79be9f0f38f37ce1
<|skeleton|> class UrlViewMixin: """Mixin with code shared between all the Url views""" def dispatch(self, request, *args, **kwargs): """Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user""" <|body_0|> def get_context_data(self, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UrlViewMixin: """Mixin with code shared between all the Url views""" def dispatch(self, request, *args, **kwargs): """Check that we have a valid SpeakerProposal or EventProposal and that it belongs to the current user""" if 'event_uuid' in self.kwargs: self.event_proposal = ge...
the_stack_v2_python_sparse
src/program/mixins.py
bornhack/bornhack-website
train
9
ede2922f45bcf3a4ce481084fc84ca31b0a036bb
[ "if u'一' <= item <= u'龥':\n return True\nelse:\n return False", "if u'A' <= item <= u'Z' or u'a' <= item <= u'z':\n return True\nelse:\n return False", "if item >= u'0' and item <= u'9':\n return True\nelse:\n return False" ]
<|body_start_0|> if u'一' <= item <= u'龥': return True else: return False <|end_body_0|> <|body_start_1|> if u'A' <= item <= u'Z' or u'a' <= item <= u'z': return True else: return False <|end_body_1|> <|body_start_2|> if item >= u'...
判断元素类型
JudgeType
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JudgeType: """判断元素类型""" def is_chinese(self, item): """判断一个unicode是否是汉字""" <|body_0|> def is_alphabet(self, item): """判断一个unicode是否是英文字母""" <|body_1|> def is_number(self, item): """判断一个unicode是否是数字""" <|body_2|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_025589
854
no_license
[ { "docstring": "判断一个unicode是否是汉字", "name": "is_chinese", "signature": "def is_chinese(self, item)" }, { "docstring": "判断一个unicode是否是英文字母", "name": "is_alphabet", "signature": "def is_alphabet(self, item)" }, { "docstring": "判断一个unicode是否是数字", "name": "is_number", "signatu...
3
stack_v2_sparse_classes_30k_train_017415
Implement the Python class `JudgeType` described below. Class description: 判断元素类型 Method signatures and docstrings: - def is_chinese(self, item): 判断一个unicode是否是汉字 - def is_alphabet(self, item): 判断一个unicode是否是英文字母 - def is_number(self, item): 判断一个unicode是否是数字
Implement the Python class `JudgeType` described below. Class description: 判断元素类型 Method signatures and docstrings: - def is_chinese(self, item): 判断一个unicode是否是汉字 - def is_alphabet(self, item): 判断一个unicode是否是英文字母 - def is_number(self, item): 判断一个unicode是否是数字 <|skeleton|> class JudgeType: """判断元素类型""" def is...
908bef52867e3944b76898cfcc018fa403202815
<|skeleton|> class JudgeType: """判断元素类型""" def is_chinese(self, item): """判断一个unicode是否是汉字""" <|body_0|> def is_alphabet(self, item): """判断一个unicode是否是英文字母""" <|body_1|> def is_number(self, item): """判断一个unicode是否是数字""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JudgeType: """判断元素类型""" def is_chinese(self, item): """判断一个unicode是否是汉字""" if u'一' <= item <= u'龥': return True else: return False def is_alphabet(self, item): """判断一个unicode是否是英文字母""" if u'A' <= item <= u'Z' or u'a' <= item <= u'z': ...
the_stack_v2_python_sparse
testfarm/test_program/utils/judge_character_type.py
sj542484/test
train
0
0896ffcf30923a1114753d6020cd96ed26d9499d
[ "cu = Change_Param(username, password, prod)\ngu = cu.get_params()\nself.suffix = self.c.get_value('Passport', 'passport_miniProgram_autoLogin')\nself.url = self.url_joint(prod) + gu[1]\nlogs.info('test url:%s' % self.url)\nreturn self.get_requests(self.url, gu[0], data)", "cu = Change_Param(username, password, p...
<|body_start_0|> cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_value('Passport', 'passport_miniProgram_autoLogin') self.url = self.url_joint(prod) + gu[1] logs.info('test url:%s' % self.url) return self.get_requests(self.url, gu...
Passport_Mini_Program
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Passport_Mini_Program: def get_passport_miniProgram_autoLogin(self, username=None, password=None, data=None, prod=None): """相关参数有: code code uuid uuid miniProgramType miniProgramType""" <|body_0|> def post_passport_miniProgram_bindUser(self, username=None, password=None, dat...
stack_v2_sparse_classes_36k_train_025590
4,333
no_license
[ { "docstring": "相关参数有: code code uuid uuid miniProgramType miniProgramType", "name": "get_passport_miniProgram_autoLogin", "signature": "def get_passport_miniProgram_autoLogin(self, username=None, password=None, data=None, prod=None)" }, { "docstring": "相关参数有: mini_program_type 小程序类型(miniprogram...
5
stack_v2_sparse_classes_30k_train_004083
Implement the Python class `Passport_Mini_Program` described below. Class description: Implement the Passport_Mini_Program class. Method signatures and docstrings: - def get_passport_miniProgram_autoLogin(self, username=None, password=None, data=None, prod=None): 相关参数有: code code uuid uuid miniProgramType miniProgram...
Implement the Python class `Passport_Mini_Program` described below. Class description: Implement the Passport_Mini_Program class. Method signatures and docstrings: - def get_passport_miniProgram_autoLogin(self, username=None, password=None, data=None, prod=None): 相关参数有: code code uuid uuid miniProgramType miniProgram...
235200a67c1fb125f75f9771808f6655a7b14202
<|skeleton|> class Passport_Mini_Program: def get_passport_miniProgram_autoLogin(self, username=None, password=None, data=None, prod=None): """相关参数有: code code uuid uuid miniProgramType miniProgramType""" <|body_0|> def post_passport_miniProgram_bindUser(self, username=None, password=None, dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Passport_Mini_Program: def get_passport_miniProgram_autoLogin(self, username=None, password=None, data=None, prod=None): """相关参数有: code code uuid uuid miniProgramType miniProgramType""" cu = Change_Param(username, password, prod) gu = cu.get_params() self.suffix = self.c.get_va...
the_stack_v2_python_sparse
business/passport/passport_mini_program.py
vothin/requsets_test
train
0
f697311ca21da3da40e323f7d20fe2ab8fa97dd7
[ "with db.connection as connection:\n service = CitiesService(connection)\n cities = service.read_all()\n return (jsonify(cities), 200)", "name = request.json.get('name')\nwith db.connection as connection:\n city = CitiesService(connection)\n try:\n return (jsonify(city.read(name)), 200)\n ...
<|body_start_0|> with db.connection as connection: service = CitiesService(connection) cities = service.read_all() return (jsonify(cities), 200) <|end_body_0|> <|body_start_1|> name = request.json.get('name') with db.connection as connection: city...
CitiesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CitiesView: def get(self): """Получение списка всех городов""" <|body_0|> def post(self): """Создание нового города""" <|body_1|> <|end_skeleton|> <|body_start_0|> with db.connection as connection: service = CitiesService(connection) ...
stack_v2_sparse_classes_36k_train_025591
1,079
no_license
[ { "docstring": "Получение списка всех городов", "name": "get", "signature": "def get(self)" }, { "docstring": "Создание нового города", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_008851
Implement the Python class `CitiesView` described below. Class description: Implement the CitiesView class. Method signatures and docstrings: - def get(self): Получение списка всех городов - def post(self): Создание нового города
Implement the Python class `CitiesView` described below. Class description: Implement the CitiesView class. Method signatures and docstrings: - def get(self): Получение списка всех городов - def post(self): Создание нового города <|skeleton|> class CitiesView: def get(self): """Получение списка всех гор...
79b0563f654016f7d56d988988ddc4bfdb0f1474
<|skeleton|> class CitiesView: def get(self): """Получение списка всех городов""" <|body_0|> def post(self): """Создание нового города""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CitiesView: def get(self): """Получение списка всех городов""" with db.connection as connection: service = CitiesService(connection) cities = service.read_all() return (jsonify(cities), 200) def post(self): """Создание нового города""" n...
the_stack_v2_python_sparse
Lesson 13/final v 2.0/src/blueprints/cities.py
Alexey7953/antida-school
train
0
322e6af7c6ad2a7e66e0bf83cf0f42b30974e184
[ "col, row = (set(), set())\nm, n = (len(matrix), len(matrix[0]))\nfor index_m in range(m):\n for index_n in range(n):\n if matrix[index_m][index_n] == 0:\n row.add(index_m)\n col.add(index_n)\nfor index_m in range(m):\n for index_n in range(n):\n if index_m in row or index_...
<|body_start_0|> col, row = (set(), set()) m, n = (len(matrix), len(matrix[0])) for index_m in range(m): for index_n in range(n): if matrix[index_m][index_n] == 0: row.add(index_m) col.add(index_n) for index_m in range(m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def setZeroes(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def setZeroes2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matri...
stack_v2_sparse_classes_36k_train_025592
1,663
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.", "name": "setZeroes", "signature": "def setZeroes(self, matrix)" }, { "docstring": ":type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instea...
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: void Do not return anything, modify matrix in-place instead. - def setZeroes2(self, matrix): :type matrix: List...
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: void Do not return anything, modify matrix in-place instead. - def setZeroes2(self, matrix): :type matrix: List...
bdf5518fb387dfa599964425354115dfad49eb00
<|skeleton|> class Solution: def setZeroes(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" <|body_0|> def setZeroes2(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def setZeroes(self, matrix): """:type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead.""" col, row = (set(), set()) m, n = (len(matrix), len(matrix[0])) for index_m in range(m): for index_n in range(n): ...
the_stack_v2_python_sparse
Set Matrix Zeroes.py
jinxin0924/LeetCode
train
1
f25dcf55d91db37f3b40586cc8088d7854967933
[ "assert isinstance(block_string, str)\nops = block_string.split('_')\noptions = {}\nfor op in ops:\n splits = re.split('(\\\\d.*)', op)\n if len(splits) >= 2:\n key, value = splits[:2]\n options[key] = value\nif 's' not in options or len(options['s']) != 2:\n raise ValueError('Strides options...
<|body_start_0|> assert isinstance(block_string, str) ops = block_string.split('_') options = {} for op in ops: splits = re.split('(\\d.*)', op) if len(splits) >= 2: key, value = splits[:2] options[key] = value if 's' not in...
Block Decoder for readability
BlockDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlockDecoder: """Block Decoder for readability""" def _decode_block_string(block_string): """Gets a block through a string notation of arguments.""" <|body_0|> def _encode_block_string(block): """Encodes a block to a string.""" <|body_1|> def decode(...
stack_v2_sparse_classes_36k_train_025593
15,770
no_license
[ { "docstring": "Gets a block through a string notation of arguments.", "name": "_decode_block_string", "signature": "def _decode_block_string(block_string)" }, { "docstring": "Encodes a block to a string.", "name": "_encode_block_string", "signature": "def _encode_block_string(block)" ...
4
stack_v2_sparse_classes_30k_train_008110
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability Method signatures and docstrings: - def _decode_block_string(block_string): Gets a block through a string notation of arguments. - def _encode_block_string(block): Encodes a block to a string. - def decode(self...
Implement the Python class `BlockDecoder` described below. Class description: Block Decoder for readability Method signatures and docstrings: - def _decode_block_string(block_string): Gets a block through a string notation of arguments. - def _encode_block_string(block): Encodes a block to a string. - def decode(self...
a81ab54a79466568700d98900faac28e753c0591
<|skeleton|> class BlockDecoder: """Block Decoder for readability""" def _decode_block_string(block_string): """Gets a block through a string notation of arguments.""" <|body_0|> def _encode_block_string(block): """Encodes a block to a string.""" <|body_1|> def decode(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlockDecoder: """Block Decoder for readability""" def _decode_block_string(block_string): """Gets a block through a string notation of arguments.""" assert isinstance(block_string, str) ops = block_string.split('_') options = {} for op in ops: splits = ...
the_stack_v2_python_sparse
image_seg_aliTianchi2021/model/modules/backbones/efficientnet.py
HAOYUANJIE123/ali_Tianchi_2021
train
1
7351c33a74e9cc074949eb947ba7f9fa16fd6675
[ "if not root:\n return 0\nif not root.left and (not root.right):\n return 1\nleft = self.dfs(root.left)\nright = self.dfs(root.right)\nself.res = max(self.res, left + right)\nreturn max(left, right) + 1", "self.res = 0\nself.dfs(root)\nreturn self.res" ]
<|body_start_0|> if not root: return 0 if not root.left and (not root.right): return 1 left = self.dfs(root.left) right = self.dfs(root.right) self.res = max(self.res, left + right) return max(left, right) + 1 <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def dfs(self, root): """记忆化搜索,自底向上 dfs :param root: :return:""" <|body_0|> def diameterOfBinaryTree(self, root): """左子树深度 + 右子树深度 :type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ret...
stack_v2_sparse_classes_36k_train_025594
1,705
no_license
[ { "docstring": "记忆化搜索,自底向上 dfs :param root: :return:", "name": "dfs", "signature": "def dfs(self, root)" }, { "docstring": "左子树深度 + 右子树深度 :type root: TreeNode :rtype: int", "name": "diameterOfBinaryTree", "signature": "def diameterOfBinaryTree(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dfs(self, root): 记忆化搜索,自底向上 dfs :param root: :return: - def diameterOfBinaryTree(self, root): 左子树深度 + 右子树深度 :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def dfs(self, root): 记忆化搜索,自底向上 dfs :param root: :return: - def diameterOfBinaryTree(self, root): 左子树深度 + 右子树深度 :type root: TreeNode :rtype: int <|skeleton|> class Solution: ...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def dfs(self, root): """记忆化搜索,自底向上 dfs :param root: :return:""" <|body_0|> def diameterOfBinaryTree(self, root): """左子树深度 + 右子树深度 :type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def dfs(self, root): """记忆化搜索,自底向上 dfs :param root: :return:""" if not root: return 0 if not root.left and (not root.right): return 1 left = self.dfs(root.left) right = self.dfs(root.right) self.res = max(self.res, left + right)...
the_stack_v2_python_sparse
543_二叉树的直径.py
lovehhf/LeetCode
train
0
8f9e7639125922045cbbae9860f77d12dd672bcb
[ "RESTFormatter.__init__(self, config)\nmimes = {'text/json+das': self.dasjson, 'application/xml+das': self.xml, 'application/plist': self.plist}\nself.supporttypes.update(mimes)", "start_time = request.time\nresults = data\ncall_time = time.time() - start_time\nres_expire = make_timestamp(expires)\nkeyhash = hash...
<|body_start_0|> RESTFormatter.__init__(self, config) mimes = {'text/json+das': self.dasjson, 'application/xml+das': self.xml, 'application/plist': self.plist} self.supporttypes.update(mimes) <|end_body_0|> <|body_start_1|> start_time = request.time results = data call_t...
A REST formatter that appends the DAS headers to the result data
DASRESTFormatter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DASRESTFormatter: """A REST formatter that appends the DAS headers to the result data""" def __init__(self, config): """Initialise the formatter and set the mime types it supports""" <|body_0|> def runDas(self, data, expires): """Run a query and produce a diction...
stack_v2_sparse_classes_36k_train_025595
2,821
no_license
[ { "docstring": "Initialise the formatter and set the mime types it supports", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Run a query and produce a dictionary for DAS formatting", "name": "runDas", "signature": "def runDas(self, data, expires)" }, ...
5
null
Implement the Python class `DASRESTFormatter` described below. Class description: A REST formatter that appends the DAS headers to the result data Method signatures and docstrings: - def __init__(self, config): Initialise the formatter and set the mime types it supports - def runDas(self, data, expires): Run a query ...
Implement the Python class `DASRESTFormatter` described below. Class description: A REST formatter that appends the DAS headers to the result data Method signatures and docstrings: - def __init__(self, config): Initialise the formatter and set the mime types it supports - def runDas(self, data, expires): Run a query ...
f4cb398de940560e40491ba676b704e1489d4682
<|skeleton|> class DASRESTFormatter: """A REST formatter that appends the DAS headers to the result data""" def __init__(self, config): """Initialise the formatter and set the mime types it supports""" <|body_0|> def runDas(self, data, expires): """Run a query and produce a diction...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DASRESTFormatter: """A REST formatter that appends the DAS headers to the result data""" def __init__(self, config): """Initialise the formatter and set the mime types it supports""" RESTFormatter.__init__(self, config) mimes = {'text/json+das': self.dasjson, 'application/xml+das'...
the_stack_v2_python_sparse
src/python/WMCore/WebTools/DASRESTFormatter.py
PerilousApricot/WMCore
train
1
d78897830b362e76a0a15a86d054208d54cad769
[ "C = self.COEFFS[imt]\nmag = rup.mag\nhypo_depth = rup.hypo_depth\nmean = self._compute_mean(C, g, mag, hypo_depth, dists, imt)\nstddevs = self._get_stddevs(C, stddev_types, sites.vs30.shape[0])\nreturn (mean, stddevs)", "delta = 0.0075 * 10 ** (0.507 * mag)\nif mag < 6.5:\n R = np.sqrt(dists.rhypo ** 2 + delt...
<|body_start_0|> C = self.COEFFS[imt] mag = rup.mag hypo_depth = rup.hypo_depth mean = self._compute_mean(C, g, mag, hypo_depth, dists, imt) stddevs = self._get_stddevs(C, stddev_types, sites.vs30.shape[0]) return (mean, stddevs) <|end_body_0|> <|body_start_1|> d...
Implements GMPE developed by Garcia, D., Singh, S. K., Harraiz, M, Ordaz, M., and Pacheco, J. F. and published in BSSA as: "Inslab earthquakes of Central Mexico: Peak ground-motion parameters and response spectra", vol. 95, No. 6, pp. 2272-2282." The original formulation predict peak ground acceleration (PGA), in cm/s*...
GarciaEtAl2005SSlab
[ "BSD-3-Clause", "AGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GarciaEtAl2005SSlab: """Implements GMPE developed by Garcia, D., Singh, S. K., Harraiz, M, Ordaz, M., and Pacheco, J. F. and published in BSSA as: "Inslab earthquakes of Central Mexico: Peak ground-motion parameters and response spectra", vol. 95, No. 6, pp. 2272-2282." The original formulation p...
stack_v2_sparse_classes_36k_train_025596
9,779
permissive
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Compute mean accord...
3
null
Implement the Python class `GarciaEtAl2005SSlab` described below. Class description: Implements GMPE developed by Garcia, D., Singh, S. K., Harraiz, M, Ordaz, M., and Pacheco, J. F. and published in BSSA as: "Inslab earthquakes of Central Mexico: Peak ground-motion parameters and response spectra", vol. 95, No. 6, pp....
Implement the Python class `GarciaEtAl2005SSlab` described below. Class description: Implements GMPE developed by Garcia, D., Singh, S. K., Harraiz, M, Ordaz, M., and Pacheco, J. F. and published in BSSA as: "Inslab earthquakes of Central Mexico: Peak ground-motion parameters and response spectra", vol. 95, No. 6, pp....
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class GarciaEtAl2005SSlab: """Implements GMPE developed by Garcia, D., Singh, S. K., Harraiz, M, Ordaz, M., and Pacheco, J. F. and published in BSSA as: "Inslab earthquakes of Central Mexico: Peak ground-motion parameters and response spectra", vol. 95, No. 6, pp. 2272-2282." The original formulation p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GarciaEtAl2005SSlab: """Implements GMPE developed by Garcia, D., Singh, S. K., Harraiz, M, Ordaz, M., and Pacheco, J. F. and published in BSSA as: "Inslab earthquakes of Central Mexico: Peak ground-motion parameters and response spectra", vol. 95, No. 6, pp. 2272-2282." The original formulation predict peak g...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/garcia_2005.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
0bc268e0959ebd52db661aadc09388190f61175c
[ "super(Linker_complex, self).__init__()\nself.config = config\nself.encoder = encoder\nself.entity_embeddings_real = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nself.entity_embeddings_img = nn.Embedding(self.config.entity_size, self.config.embedding_dim)\nif self.config.priors:\n self.char_...
<|body_start_0|> super(Linker_complex, self).__init__() self.config = config self.encoder = encoder self.entity_embeddings_real = nn.Embedding(self.config.entity_size, self.config.embedding_dim) self.entity_embeddings_img = nn.Embedding(self.config.entity_size, self.config.embedd...
Linker_complex
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linker_complex: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, entity_candidates, mention_representation, sentence, char_sc...
stack_v2_sparse_classes_36k_train_025597
42,719
permissive
[ { "docstring": ":param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions", "name": "__init__", "signature": "def __init__(self, config, encoder)" }, { "docstring": ":return: unnormalized log probabilities (logits) of gold enti...
2
stack_v2_sparse_classes_30k_train_014209
Implement the Python class `Linker_complex` described below. Class description: Implement the Linker_complex class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions - ...
Implement the Python class `Linker_complex` described below. Class description: Implement the Linker_complex class. Method signatures and docstrings: - def __init__(self, config, encoder): :param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions - ...
6a7dcd7d3756327c61ef949e5b4f6af6e2849187
<|skeleton|> class Linker_complex: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" <|body_0|> def forward(self, entity_candidates, mention_representation, sentence, char_sc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Linker_complex: def __init__(self, config, encoder): """:param config: A config object that specifies the hyperparameters of the model :param encoder: A Encoder for encoding mentions""" super(Linker_complex, self).__init__() self.config = config self.encoder = encoder s...
the_stack_v2_python_sparse
typenet/src/model.py
dhruvdcoder/dl-with-constraints
train
0
f5aa25b0be7c01e0c1ce47b17eb0c62c15b2b45d
[ "result = nums[0]\ndpmx = nums[0]\ndpmin = nums[0]\nfor i in range(1, len(nums)):\n if nums[i] < 0:\n dpmx, dpmin = (dpmin, dpmx)\n dpmx = max(dpmx * nums[i], nums[i])\n dpmin = min(dpmin * nums[i], nums[i])\n result = max(dpmx, result)\nreturn result", "\"\"\" \n :type nums: List[int]\n...
<|body_start_0|> result = nums[0] dpmx = nums[0] dpmin = nums[0] for i in range(1, len(nums)): if nums[i] < 0: dpmx, dpmin = (dpmin, dpmx) dpmx = max(dpmx * nums[i], nums[i]) dpmin = min(dpmin * nums[i], nums[i]) result = ma...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProductDPSpace1(self, nums): """Զ¼Сֵֵһ Ϊֻǰһ״̬(i-1) ԲҪDP棬ֻһͺ ͬ쳲Ҫi-1i-2ҲֻҪ2ǰĽҪ""" <|body_0|> def maxProductDPSpaceN(self, nums): """Զ¼Сֵֵһ""" <|body_1|> def maxProductPrefixSuffixProduct(selfself, nums): """û0˻һͷβ ().ǰ׺˻ͺ׺˻ȡ 00ĵط¿ʼ...
stack_v2_sparse_classes_36k_train_025598
2,013
no_license
[ { "docstring": "Զ¼Сֵֵһ Ϊֻǰһ״̬(i-1) ԲҪDP棬ֻһͺ ͬ쳲Ҫi-1i-2ҲֻҪ2ǰĽҪ", "name": "maxProductDPSpace1", "signature": "def maxProductDPSpace1(self, nums)" }, { "docstring": "Զ¼Сֵֵһ", "name": "maxProductDPSpaceN", "signature": "def maxProductDPSpaceN(self, nums)" }, { "docstring": "û0˻һͷβ ()....
3
stack_v2_sparse_classes_30k_train_010366
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProductDPSpace1(self, nums): Զ¼Сֵֵһ Ϊֻǰһ״̬(i-1) ԲҪDP棬ֻһͺ ͬ쳲Ҫi-1i-2ҲֻҪ2ǰĽҪ - def maxProductDPSpaceN(self, nums): Զ¼Сֵֵһ - def maxProductPrefixSuffixProduct(selfself, nums):...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProductDPSpace1(self, nums): Զ¼Сֵֵһ Ϊֻǰһ״̬(i-1) ԲҪDP棬ֻһͺ ͬ쳲Ҫi-1i-2ҲֻҪ2ǰĽҪ - def maxProductDPSpaceN(self, nums): Զ¼Сֵֵһ - def maxProductPrefixSuffixProduct(selfself, nums):...
325519f6a729b4e6eb04fec5e69f46a84e727252
<|skeleton|> class Solution: def maxProductDPSpace1(self, nums): """Զ¼Сֵֵһ Ϊֻǰһ״̬(i-1) ԲҪDP棬ֻһͺ ͬ쳲Ҫi-1i-2ҲֻҪ2ǰĽҪ""" <|body_0|> def maxProductDPSpaceN(self, nums): """Զ¼Сֵֵһ""" <|body_1|> def maxProductPrefixSuffixProduct(selfself, nums): """û0˻һͷβ ().ǰ׺˻ͺ׺˻ȡ 00ĵط¿ʼ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProductDPSpace1(self, nums): """Զ¼Сֵֵһ Ϊֻǰһ״̬(i-1) ԲҪDP棬ֻһͺ ͬ쳲Ҫi-1i-2ҲֻҪ2ǰĽҪ""" result = nums[0] dpmx = nums[0] dpmin = nums[0] for i in range(1, len(nums)): if nums[i] < 0: dpmx, dpmin = (dpmin, dpmx) dpmx = max(...
the_stack_v2_python_sparse
152_Maximum Product Subarray.py
hahalaugh/LeetCode
train
0
c90eb76c5089707efa78711af6a206cf45f46544
[ "params = super().get_default_params(with_embedding=True)\nparams.add(Param(name='kernel_num', value=11, hyper_space=hyper_spaces.quniform(low=5, high=20), desc='The number of RBF kernels.'))\nparams.add(Param(name='sigma', value=0.1, hyper_space=hyper_spaces.quniform(low=0.01, high=0.2, q=0.01), desc='The `sigma` ...
<|body_start_0|> params = super().get_default_params(with_embedding=True) params.add(Param(name='kernel_num', value=11, hyper_space=hyper_spaces.quniform(low=5, high=20), desc='The number of RBF kernels.')) params.add(Param(name='sigma', value=0.1, hyper_space=hyper_spaces.quniform(low=0.01, hig...
KNRM Model. Examples: >>> model = KNRM() >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()
KNRM
[ "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KNRM: """KNRM Model. Examples: >>> model = KNRM() >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()""" def get_default_params(cls) -> ParamTable: """:return:...
stack_v2_sparse_classes_36k_train_025599
3,237
permissive
[ { "docstring": ":return: model default parameters.", "name": "get_default_params", "signature": "def get_default_params(cls) -> ParamTable" }, { "docstring": "Build model structure.", "name": "build", "signature": "def build(self)" }, { "docstring": "Forward.", "name": "forwa...
3
null
Implement the Python class `KNRM` described below. Class description: KNRM Model. Examples: >>> model = KNRM() >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() Method signatures and docstrin...
Implement the Python class `KNRM` described below. Class description: KNRM Model. Examples: >>> model = KNRM() >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() Method signatures and docstrin...
4198ebce942f4afe7ddca6a96ab6f4464ade4518
<|skeleton|> class KNRM: """KNRM Model. Examples: >>> model = KNRM() >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()""" def get_default_params(cls) -> ParamTable: """:return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KNRM: """KNRM Model. Examples: >>> model = KNRM() >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()""" def get_default_params(cls) -> ParamTable: """:return: model defaul...
the_stack_v2_python_sparse
poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/knrm.py
microsoft/ContextualSP
train
332