blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4e2a7659b3b97cda44731ce5fd901742d2d6a44c | [
"if operations not in ['f', 'b', 'fb', 'bf']:\n raise ValueError(\"'operations' parameter should be one of the following options: f, b, fb, bf.\")\nself.feature = next(self._parse_features(feature)())\nself.operations = operations\nself.value = value\nself.axis = axis",
"if not isinstance(data, np.ndarray) or ... | <|body_start_0|>
if operations not in ['f', 'b', 'fb', 'bf']:
raise ValueError("'operations' parameter should be one of the following options: f, b, fb, bf.")
self.feature = next(self._parse_features(feature)())
self.operations = operations
self.value = value
self.axi... | Overwrites occurrences of a desired value with their neighbor values in either forward, backward direction or both, along an axis. Possible fillout operations are 'f' (forward), 'b' (backward) or both, 'fb' or 'bf': 'f': nan, nan, nan, 8, 5, nan, 1, 0, nan, nan -> nan, nan, nan, 8, 5, 5, 1, 0, 0, 0 'b': nan, nan, nan, ... | ValueFilloutTask | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ValueFilloutTask:
"""Overwrites occurrences of a desired value with their neighbor values in either forward, backward direction or both, along an axis. Possible fillout operations are 'f' (forward), 'b' (backward) or both, 'fb' or 'bf': 'f': nan, nan, nan, 8, 5, nan, 1, 0, nan, nan -> nan, nan, n... | stack_v2_sparse_classes_75kplus_train_006100 | 8,688 | permissive | [
{
"docstring": ":param feature: A feature that must be value-filled. :type feature: an object supported by the :class:`FeatureParser<eolearn.core.utilities.FeatureParser>` :param operations: Fill directions, which should be one of ['f', 'b', 'fb', 'bf']. :type operations: str :param value: Which value to fill b... | 3 | stack_v2_sparse_classes_30k_train_022389 | Implement the Python class `ValueFilloutTask` described below.
Class description:
Overwrites occurrences of a desired value with their neighbor values in either forward, backward direction or both, along an axis. Possible fillout operations are 'f' (forward), 'b' (backward) or both, 'fb' or 'bf': 'f': nan, nan, nan, 8... | Implement the Python class `ValueFilloutTask` described below.
Class description:
Overwrites occurrences of a desired value with their neighbor values in either forward, backward direction or both, along an axis. Possible fillout operations are 'f' (forward), 'b' (backward) or both, 'fb' or 'bf': 'f': nan, nan, nan, 8... | 148189e2b92e06059b87f223b596255ccafac86d | <|skeleton|>
class ValueFilloutTask:
"""Overwrites occurrences of a desired value with their neighbor values in either forward, backward direction or both, along an axis. Possible fillout operations are 'f' (forward), 'b' (backward) or both, 'fb' or 'bf': 'f': nan, nan, nan, 8, 5, nan, 1, 0, nan, nan -> nan, nan, n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ValueFilloutTask:
"""Overwrites occurrences of a desired value with their neighbor values in either forward, backward direction or both, along an axis. Possible fillout operations are 'f' (forward), 'b' (backward) or both, 'fb' or 'bf': 'f': nan, nan, nan, 8, 5, nan, 1, 0, nan, nan -> nan, nan, nan, 8, 5, 5, ... | the_stack_v2_python_sparse | features/eolearn/features/feature_manipulation.py | wouellette/eo-learn | train | 2 |
c800ac64134d99ebb25866bd399b2fb0cc5ef359 | [
"import bisect as bi\nM = []\nfor r in matrix:\n M.extend(r)\nidx = bi.bisect_left(M, target)\nif idx <= len(M) - 1 and M[idx] == target:\n return True\nreturn False",
"for r in range(len(matrix)):\n if not matrix[r]:\n return False\n if target > matrix[r][-1]:\n continue\n if target ... | <|body_start_0|>
import bisect as bi
M = []
for r in matrix:
M.extend(r)
idx = bi.bisect_left(M, target)
if idx <= len(M) - 1 and M[idx] == target:
return True
return False
<|end_body_0|>
<|body_start_1|>
for r in range(len(matrix)):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool convert matrix to a long sorted list then do a binary search."""
<|body_0|>
def rewrite(self, matrix, target):
""":type matrix: List[List[int]] :type tar... | stack_v2_sparse_classes_75kplus_train_006101 | 1,784 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool convert matrix to a long sorted list then do a binary search.",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix, target)"
},
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bo... | 2 | stack_v2_sparse_classes_30k_train_027502 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool convert matrix to a long sorted list then do a binary search.
- def rewrite(s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool convert matrix to a long sorted list then do a binary search.
- def rewrite(s... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool convert matrix to a long sorted list then do a binary search."""
<|body_0|>
def rewrite(self, matrix, target):
""":type matrix: List[List[int]] :type tar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool convert matrix to a long sorted list then do a binary search."""
import bisect as bi
M = []
for r in matrix:
M.extend(r)
idx = bi.bisect_left(M,... | the_stack_v2_python_sparse | co_ms/74_Search_a_2D_Matrix.py | vsdrun/lc_public | train | 6 | |
802979e54a11d2dd58f657d41129780c38efa549 | [
"if data is None:\n loader = AgentDSTDataloader(MultiWOZDataloader())\n data = loader.load_data()\nself.file_url = 'https://convlab.blob.core.windows.net/convlab-2/mdbt_multiwoz_sys.zip'\nlocal_path = os.path.dirname(os.path.abspath(__file__))\nself.data_dir = os.path.join(local_path, data_dir)\nself.validati... | <|body_start_0|>
if data is None:
loader = AgentDSTDataloader(MultiWOZDataloader())
data = loader.load_data()
self.file_url = 'https://convlab.blob.core.windows.net/convlab-2/mdbt_multiwoz_sys.zip'
local_path = os.path.dirname(os.path.abspath(__file__))
self.data_... | MultiWozMDBT | [
"Apache-2.0",
"CC-BY-NC-4.0",
"CC-BY-4.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiWozMDBT:
def __init__(self, data_dir='configs', data=None):
"""Constructor of MultiWOzMDBT class. Args: data_dir (str): The path of data dir, where the root path is convlab2/dst/mdbt/multiwoz."""
<|body_0|>
def auto_download(self):
"""Automatically download the ... | stack_v2_sparse_classes_75kplus_train_006102 | 5,484 | permissive | [
{
"docstring": "Constructor of MultiWOzMDBT class. Args: data_dir (str): The path of data dir, where the root path is convlab2/dst/mdbt/multiwoz.",
"name": "__init__",
"signature": "def __init__(self, data_dir='configs', data=None)"
},
{
"docstring": "Automatically download the pretrained model ... | 2 | stack_v2_sparse_classes_30k_train_009074 | Implement the Python class `MultiWozMDBT` described below.
Class description:
Implement the MultiWozMDBT class.
Method signatures and docstrings:
- def __init__(self, data_dir='configs', data=None): Constructor of MultiWOzMDBT class. Args: data_dir (str): The path of data dir, where the root path is convlab2/dst/mdbt... | Implement the Python class `MultiWozMDBT` described below.
Class description:
Implement the MultiWozMDBT class.
Method signatures and docstrings:
- def __init__(self, data_dir='configs', data=None): Constructor of MultiWOzMDBT class. Args: data_dir (str): The path of data dir, where the root path is convlab2/dst/mdbt... | 9547cb09bfd7e297e2c609637c9e38f6c94fdbfb | <|skeleton|>
class MultiWozMDBT:
def __init__(self, data_dir='configs', data=None):
"""Constructor of MultiWOzMDBT class. Args: data_dir (str): The path of data dir, where the root path is convlab2/dst/mdbt/multiwoz."""
<|body_0|>
def auto_download(self):
"""Automatically download the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiWozMDBT:
def __init__(self, data_dir='configs', data=None):
"""Constructor of MultiWOzMDBT class. Args: data_dir (str): The path of data dir, where the root path is convlab2/dst/mdbt/multiwoz."""
if data is None:
loader = AgentDSTDataloader(MultiWOZDataloader())
da... | the_stack_v2_python_sparse | convlab2/dst/mdbt/multiwoz/dst.py | sherlock1987/ConvLab-2 | train | 1 | |
cfafb7718d56867e4447a865778877d7b9c170a0 | [
"response = self.client.get('/demo_module/')\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'demo_module/home.html')\nself.assertContains(response, 'Demo-modul')",
"response = self.client.get('/demo_module/show_info')\nself.assertEqual(response.status_code, 200)\nself.assertTempla... | <|body_start_0|>
response = self.client.get('/demo_module/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'demo_module/home.html')
self.assertContains(response, 'Demo-modul')
<|end_body_0|>
<|body_start_1|>
response = self.client.get('/demo_modul... | Test cases for the demo module | TestHome | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestHome:
"""Test cases for the demo module"""
def test_demo_homepage_works(self):
"""Test that the landing page for the module exists and renders"""
<|body_0|>
def test_info_page(self):
"""Test that the info page for the module exists and renders"""
<|bo... | stack_v2_sparse_classes_75kplus_train_006103 | 1,148 | no_license | [
{
"docstring": "Test that the landing page for the module exists and renders",
"name": "test_demo_homepage_works",
"signature": "def test_demo_homepage_works(self)"
},
{
"docstring": "Test that the info page for the module exists and renders",
"name": "test_info_page",
"signature": "def ... | 3 | null | Implement the Python class `TestHome` described below.
Class description:
Test cases for the demo module
Method signatures and docstrings:
- def test_demo_homepage_works(self): Test that the landing page for the module exists and renders
- def test_info_page(self): Test that the info page for the module exists and re... | Implement the Python class `TestHome` described below.
Class description:
Test cases for the demo module
Method signatures and docstrings:
- def test_demo_homepage_works(self): Test that the landing page for the module exists and renders
- def test_info_page(self): Test that the info page for the module exists and re... | 7d5697a1de85b56c5ae10fb402ead310980212f7 | <|skeleton|>
class TestHome:
"""Test cases for the demo module"""
def test_demo_homepage_works(self):
"""Test that the landing page for the module exists and renders"""
<|body_0|>
def test_info_page(self):
"""Test that the info page for the module exists and renders"""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestHome:
"""Test cases for the demo module"""
def test_demo_homepage_works(self):
"""Test that the landing page for the module exists and renders"""
response = self.client.get('/demo_module/')
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, '... | the_stack_v2_python_sparse | webinterface/demo_module/tests.py | AUTeam2/server-setup | train | 2 |
f92a3e2f707a8af65f66bb923b044c36e3c64b51 | [
"Idevice.__init__(self, x_(u'Java Applet'), x_(u'University of Auckland'), u'', u'', u'', parentNode)\nself.emphasis = Idevice.NoEmphasis\nself.appletCode = u''\nself.fileInstruc = u''\nself.codeInstruc = u''",
"log.debug(u'uploadFile ' + unicode(filePath))\nresourceFile = Path(filePath)\nassert (self.parentNode,... | <|body_start_0|>
Idevice.__init__(self, x_(u'Java Applet'), x_(u'University of Auckland'), u'', u'', u'', parentNode)
self.emphasis = Idevice.NoEmphasis
self.appletCode = u''
self.fileInstruc = u''
self.codeInstruc = u''
<|end_body_0|>
<|body_start_1|>
log.debug(u'upload... | Java Applet Idevice. Enables you to embed java applet in the browser | AppletIdevice | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppletIdevice:
"""Java Applet Idevice. Enables you to embed java applet in the browser"""
def __init__(self, parentNode=None):
"""Sets up the idevice title and instructions etc"""
<|body_0|>
def uploadFile(self, filePath):
"""Store the upload files in the package... | stack_v2_sparse_classes_75kplus_train_006104 | 2,070 | no_license | [
{
"docstring": "Sets up the idevice title and instructions etc",
"name": "__init__",
"signature": "def __init__(self, parentNode=None)"
},
{
"docstring": "Store the upload files in the package Needs to be in a package to work.",
"name": "uploadFile",
"signature": "def uploadFile(self, fi... | 3 | stack_v2_sparse_classes_30k_train_014437 | Implement the Python class `AppletIdevice` described below.
Class description:
Java Applet Idevice. Enables you to embed java applet in the browser
Method signatures and docstrings:
- def __init__(self, parentNode=None): Sets up the idevice title and instructions etc
- def uploadFile(self, filePath): Store the upload... | Implement the Python class `AppletIdevice` described below.
Class description:
Java Applet Idevice. Enables you to embed java applet in the browser
Method signatures and docstrings:
- def __init__(self, parentNode=None): Sets up the idevice title and instructions etc
- def uploadFile(self, filePath): Store the upload... | 1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad | <|skeleton|>
class AppletIdevice:
"""Java Applet Idevice. Enables you to embed java applet in the browser"""
def __init__(self, parentNode=None):
"""Sets up the idevice title and instructions etc"""
<|body_0|>
def uploadFile(self, filePath):
"""Store the upload files in the package... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AppletIdevice:
"""Java Applet Idevice. Enables you to embed java applet in the browser"""
def __init__(self, parentNode=None):
"""Sets up the idevice title and instructions etc"""
Idevice.__init__(self, x_(u'Java Applet'), x_(u'University of Auckland'), u'', u'', u'', parentNode)
... | the_stack_v2_python_sparse | eXe/rev1889-1952/left-trunk-1952/exe/idevices/appletidevice.py | joliebig/featurehouse_fstmerge_examples | train | 3 |
753c5a93ad0d5d9fed607cf9f338b4b409635d3d | [
"self.sckt = sckt\nself.msg_cnt = 0\nself.d = Diffie()\nself.c = Cifra()\nself.s = SSL()\nself.public_key_server = None\nself.k = None",
"self.msg_cnt += 1\nif self.msg_cnt == 1:\n return self.d.Public_key()\nelif self.msg_cnt == 2:\n self.public_key_server = msg[1541:]\n self.s.verifySignature(msg[:256]... | <|body_start_0|>
self.sckt = sckt
self.msg_cnt = 0
self.d = Diffie()
self.c = Cifra()
self.s = SSL()
self.public_key_server = None
self.k = None
<|end_body_0|>
<|body_start_1|>
self.msg_cnt += 1
if self.msg_cnt == 1:
return self.d.Publ... | Classe que implementa a funcionalidade de um CLIENTE. | Client | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Client:
"""Classe que implementa a funcionalidade de um CLIENTE."""
def __init__(self, sckt=None):
"""Construtor da classe."""
<|body_0|>
def process(self, msg=b''):
"""Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a mensagem a transmitir co... | stack_v2_sparse_classes_75kplus_train_006105 | 7,208 | no_license | [
{
"docstring": "Construtor da classe.",
"name": "__init__",
"signature": "def __init__(self, sckt=None)"
},
{
"docstring": "Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a mensagem a transmitir como resposta (`None` para finalizar ligacao)",
"name": "process",
"sign... | 2 | stack_v2_sparse_classes_30k_train_050072 | Implement the Python class `Client` described below.
Class description:
Classe que implementa a funcionalidade de um CLIENTE.
Method signatures and docstrings:
- def __init__(self, sckt=None): Construtor da classe.
- def process(self, msg=b''): Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a men... | Implement the Python class `Client` described below.
Class description:
Classe que implementa a funcionalidade de um CLIENTE.
Method signatures and docstrings:
- def __init__(self, sckt=None): Construtor da classe.
- def process(self, msg=b''): Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a men... | 95a4e5966a37b431a85340762e326fb51ff6b608 | <|skeleton|>
class Client:
"""Classe que implementa a funcionalidade de um CLIENTE."""
def __init__(self, sckt=None):
"""Construtor da classe."""
<|body_0|>
def process(self, msg=b''):
"""Processa uma mensagem (`bytestring`) enviada pelo SERVIDOR. Retorna a mensagem a transmitir co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Client:
"""Classe que implementa a funcionalidade de um CLIENTE."""
def __init__(self, sckt=None):
"""Construtor da classe."""
self.sckt = sckt
self.msg_cnt = 0
self.d = Diffie()
self.c = Cifra()
self.s = SSL()
self.public_key_server = None
... | the_stack_v2_python_sparse | 4ªAno/Criptografia/Aula8/G8/Client.py | joseluisgomes/MIETI | train | 0 |
0f4478970af037f152436dfd5c765d4e97803738 | [
"if self is ResizeLib.CV2:\n lossless = {bool: np.uint8, np.float16: np.float32}\n infoloss = {x: np.int32 for x in (np.uint32, np.int64, np.uint64, int)}\nif self is ResizeLib.PIL:\n lossless = {np.float16: np.float32}\n infoloss = {x: np.int32 for x in (np.uint16, np.uint32, np.int64, np.uint64, int)}... | <|body_start_0|>
if self is ResizeLib.CV2:
lossless = {bool: np.uint8, np.float16: np.float32}
infoloss = {x: np.int32 for x in (np.uint32, np.int64, np.uint64, int)}
if self is ResizeLib.PIL:
lossless = {np.float16: np.float32}
infoloss = {x: np.int32 for... | Backends available for spatial resizing of data. | ResizeLib | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResizeLib:
"""Backends available for spatial resizing of data."""
def get_compatible_dtype(self, dtype: Union[np.dtype, type]) -> np.dtype:
"""Returns a suitable dtype with which the library can work. Warns if information loss could occur."""
<|body_0|>
def _extract_comp... | stack_v2_sparse_classes_75kplus_train_006106 | 7,379 | permissive | [
{
"docstring": "Returns a suitable dtype with which the library can work. Warns if information loss could occur.",
"name": "get_compatible_dtype",
"signature": "def get_compatible_dtype(self, dtype: Union[np.dtype, type]) -> np.dtype"
},
{
"docstring": "Searches the dictionaries and extract the ... | 2 | null | Implement the Python class `ResizeLib` described below.
Class description:
Backends available for spatial resizing of data.
Method signatures and docstrings:
- def get_compatible_dtype(self, dtype: Union[np.dtype, type]) -> np.dtype: Returns a suitable dtype with which the library can work. Warns if information loss ... | Implement the Python class `ResizeLib` described below.
Class description:
Backends available for spatial resizing of data.
Method signatures and docstrings:
- def get_compatible_dtype(self, dtype: Union[np.dtype, type]) -> np.dtype: Returns a suitable dtype with which the library can work. Warns if information loss ... | a65899e4632b50c9c41a67e1f7698c09b929d840 | <|skeleton|>
class ResizeLib:
"""Backends available for spatial resizing of data."""
def get_compatible_dtype(self, dtype: Union[np.dtype, type]) -> np.dtype:
"""Returns a suitable dtype with which the library can work. Warns if information loss could occur."""
<|body_0|>
def _extract_comp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResizeLib:
"""Backends available for spatial resizing of data."""
def get_compatible_dtype(self, dtype: Union[np.dtype, type]) -> np.dtype:
"""Returns a suitable dtype with which the library can work. Warns if information loss could occur."""
if self is ResizeLib.CV2:
lossless... | the_stack_v2_python_sparse | features/eolearn/features/utils.py | sentinel-hub/eo-learn | train | 1,072 |
89feb48b98f9a079189b42e31dc7c6aafef83d16 | [
"@functools.wraps(func)\ndef wrapper(self, *args, **kwargs):\n result = self.matrix_factory(func(self, *args, **kwargs))\n return result\nreturn wrapper",
"@functools.wraps(func)\ndef wrapper(self, *args, **kwargs):\n result = func(self, *args, **kwargs)\n return Matrix(result)\nreturn wrapper"
] | <|body_start_0|>
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
result = self.matrix_factory(func(self, *args, **kwargs))
return result
return wrapper
<|end_body_0|>
<|body_start_1|>
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
... | MatrixDecorator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MatrixDecorator:
def use_matrix_factory_decorator(func):
"""Decorator to return the result using the matrix factory to get the most relevant matrix"""
<|body_0|>
def use_default_matrix_type_decorator(func):
"""Decorator to return the result using the default Matrix c... | stack_v2_sparse_classes_75kplus_train_006107 | 26,594 | no_license | [
{
"docstring": "Decorator to return the result using the matrix factory to get the most relevant matrix",
"name": "use_matrix_factory_decorator",
"signature": "def use_matrix_factory_decorator(func)"
},
{
"docstring": "Decorator to return the result using the default Matrix class",
"name": "... | 2 | null | Implement the Python class `MatrixDecorator` described below.
Class description:
Implement the MatrixDecorator class.
Method signatures and docstrings:
- def use_matrix_factory_decorator(func): Decorator to return the result using the matrix factory to get the most relevant matrix
- def use_default_matrix_type_decora... | Implement the Python class `MatrixDecorator` described below.
Class description:
Implement the MatrixDecorator class.
Method signatures and docstrings:
- def use_matrix_factory_decorator(func): Decorator to return the result using the matrix factory to get the most relevant matrix
- def use_default_matrix_type_decora... | 339567a672e12ebc4847dfd97e9d1a2a7d45f655 | <|skeleton|>
class MatrixDecorator:
def use_matrix_factory_decorator(func):
"""Decorator to return the result using the matrix factory to get the most relevant matrix"""
<|body_0|>
def use_default_matrix_type_decorator(func):
"""Decorator to return the result using the default Matrix c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MatrixDecorator:
def use_matrix_factory_decorator(func):
"""Decorator to return the result using the matrix factory to get the most relevant matrix"""
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
result = self.matrix_factory(func(self, *args, **kwargs))
... | the_stack_v2_python_sparse | matrix/basic_matrix.py | KerimovEmil/HigherMathInvestigations | train | 2 | |
c98b79e9cc21e40b65e942fd8186f26939a54dd6 | [
"with allure.step('点击“热门资讯”'):\n self.steps('../page/newsdynamic.yaml')\nreturn self",
"with allure.step('点击“合作动态”'):\n self.steps('../page/newsdynamic.yaml')\nreturn self",
"with allure.step('点击热门资讯下的第一条资讯'):\n self.steps('../page/newsdynamic.yaml')\nreturn",
"with allure.step('点击“合作动态”的第一条,进入详情'):\... | <|body_start_0|>
with allure.step('点击“热门资讯”'):
self.steps('../page/newsdynamic.yaml')
return self
<|end_body_0|>
<|body_start_1|>
with allure.step('点击“合作动态”'):
self.steps('../page/newsdynamic.yaml')
return self
<|end_body_1|>
<|body_start_2|>
with allure... | 项目动态 页面 | NewsDynamic | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewsDynamic:
"""项目动态 页面"""
def click_news(self):
"""点击“热门资讯”tab :return: self"""
<|body_0|>
def click_dynamic(self):
"""点击“合作动态”tab :return: self"""
<|body_1|>
def click_first_news(self):
"""点击热门资讯下的第一条资讯,进入详情 :return:"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus_train_006108 | 1,956 | no_license | [
{
"docstring": "点击“热门资讯”tab :return: self",
"name": "click_news",
"signature": "def click_news(self)"
},
{
"docstring": "点击“合作动态”tab :return: self",
"name": "click_dynamic",
"signature": "def click_dynamic(self)"
},
{
"docstring": "点击热门资讯下的第一条资讯,进入详情 :return:",
"name": "click... | 6 | stack_v2_sparse_classes_30k_train_045271 | Implement the Python class `NewsDynamic` described below.
Class description:
项目动态 页面
Method signatures and docstrings:
- def click_news(self): 点击“热门资讯”tab :return: self
- def click_dynamic(self): 点击“合作动态”tab :return: self
- def click_first_news(self): 点击热门资讯下的第一条资讯,进入详情 :return:
- def click_first_dynamic_title(self):... | Implement the Python class `NewsDynamic` described below.
Class description:
项目动态 页面
Method signatures and docstrings:
- def click_news(self): 点击“热门资讯”tab :return: self
- def click_dynamic(self): 点击“合作动态”tab :return: self
- def click_first_news(self): 点击热门资讯下的第一条资讯,进入详情 :return:
- def click_first_dynamic_title(self):... | 7f1d9323ea6c7defa3714467e3c121a7ffc44c62 | <|skeleton|>
class NewsDynamic:
"""项目动态 页面"""
def click_news(self):
"""点击“热门资讯”tab :return: self"""
<|body_0|>
def click_dynamic(self):
"""点击“合作动态”tab :return: self"""
<|body_1|>
def click_first_news(self):
"""点击热门资讯下的第一条资讯,进入详情 :return:"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NewsDynamic:
"""项目动态 页面"""
def click_news(self):
"""点击“热门资讯”tab :return: self"""
with allure.step('点击“热门资讯”'):
self.steps('../page/newsdynamic.yaml')
return self
def click_dynamic(self):
"""点击“合作动态”tab :return: self"""
with allure.step('点击“合作动态”'):... | the_stack_v2_python_sparse | page/newsdynamic.py | gzsyr/testcase-III-pytest-allure | train | 0 |
520977166ca9bd330b56bd9eb257e347fac4d8d2 | [
"if not root:\n return 0\n\ndef find_diff(node: TreeNode, d: int):\n if node.left and node.right:\n in_right, rd = find_diff(node.right, d + 1)\n if in_right:\n return (in_right, rd)\n in_left, ld = find_diff(node.left, d + 1)\n if in_left:\n return (in_left +... | <|body_start_0|>
if not root:
return 0
def find_diff(node: TreeNode, d: int):
if node.left and node.right:
in_right, rd = find_diff(node.right, d + 1)
if in_right:
return (in_right, rd)
in_left, ld = find_diff(n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countNodes(self, root: TreeNode) -> int:
"""05/12/2019 22:01"""
<|body_0|>
def countNodes(self, root: TreeNode) -> int:
"""05/12/2019 22:09"""
<|body_1|>
def countNodes(self, root: Optional[TreeNode]) -> int:
"""11/05/2021 15:04"""
... | stack_v2_sparse_classes_75kplus_train_006109 | 4,062 | no_license | [
{
"docstring": "05/12/2019 22:01",
"name": "countNodes",
"signature": "def countNodes(self, root: TreeNode) -> int"
},
{
"docstring": "05/12/2019 22:09",
"name": "countNodes",
"signature": "def countNodes(self, root: TreeNode) -> int"
},
{
"docstring": "11/05/2021 15:04",
"na... | 4 | stack_v2_sparse_classes_30k_train_037556 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root: TreeNode) -> int: 05/12/2019 22:01
- def countNodes(self, root: TreeNode) -> int: 05/12/2019 22:09
- def countNodes(self, root: Optional[TreeNode]) -> ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countNodes(self, root: TreeNode) -> int: 05/12/2019 22:01
- def countNodes(self, root: TreeNode) -> int: 05/12/2019 22:09
- def countNodes(self, root: Optional[TreeNode]) -> ... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def countNodes(self, root: TreeNode) -> int:
"""05/12/2019 22:01"""
<|body_0|>
def countNodes(self, root: TreeNode) -> int:
"""05/12/2019 22:09"""
<|body_1|>
def countNodes(self, root: Optional[TreeNode]) -> int:
"""11/05/2021 15:04"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countNodes(self, root: TreeNode) -> int:
"""05/12/2019 22:01"""
if not root:
return 0
def find_diff(node: TreeNode, d: int):
if node.left and node.right:
in_right, rd = find_diff(node.right, d + 1)
if in_right:
... | the_stack_v2_python_sparse | leetcode/solved/222_Count_Complete_Tree_Nodes/solution.py | sungminoh/algorithms | train | 0 | |
b33f920e46cd5ece61fe3489255cb445552bac7a | [
"m200, z, r = [np.asanyarray(arr) for arr in [m200, z, r]]\nif r200 is None:\n r200 = calc_rdelta(m200, z, self.cosmology)\nx = self.r2x(m200, z, r, dist=dist)\nparams = get_params_battaglia(m200, z, self.cosmology)\nreturn params.P0 * utils.gnfw(x, xc=params.xc, alpha=params.alpha, beta=params.beta, gamma=param... | <|body_start_0|>
m200, z, r = [np.asanyarray(arr) for arr in [m200, z, r]]
if r200 is None:
r200 = calc_rdelta(m200, z, self.cosmology)
x = self.r2x(m200, z, r, dist=dist)
params = get_params_battaglia(m200, z, self.cosmology)
return params.P0 * utils.gnfw(x, xc=param... | Battaglia cluster profile evaluator. | ProfileBattaglia | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileBattaglia:
"""Battaglia cluster profile evaluator."""
def _raw(self, m200, z, r, dist='physical', r200=None):
"""Evaluate the dimensionless 3d pressure profiles for clusters with the the given masses m200 and redshifts z at the distances r from the center. m200, z and r must b... | stack_v2_sparse_classes_75kplus_train_006110 | 15,514 | no_license | [
{
"docstring": "Evaluate the dimensionless 3d pressure profiles for clusters with the the given masses m200 and redshifts z at the distances r from the center. m200, z and r must broadcast to the same shape.",
"name": "_raw",
"signature": "def _raw(self, m200, z, r, dist='physical', r200=None)"
},
{... | 2 | stack_v2_sparse_classes_30k_test_001650 | Implement the Python class `ProfileBattaglia` described below.
Class description:
Battaglia cluster profile evaluator.
Method signatures and docstrings:
- def _raw(self, m200, z, r, dist='physical', r200=None): Evaluate the dimensionless 3d pressure profiles for clusters with the the given masses m200 and redshifts z... | Implement the Python class `ProfileBattaglia` described below.
Class description:
Battaglia cluster profile evaluator.
Method signatures and docstrings:
- def _raw(self, m200, z, r, dist='physical', r200=None): Evaluate the dimensionless 3d pressure profiles for clusters with the the given masses m200 and redshifts z... | a7674289f4df4a3c526c07440f26edd1a7ab7cd0 | <|skeleton|>
class ProfileBattaglia:
"""Battaglia cluster profile evaluator."""
def _raw(self, m200, z, r, dist='physical', r200=None):
"""Evaluate the dimensionless 3d pressure profiles for clusters with the the given masses m200 and redshifts z at the distances r from the center. m200, z and r must b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProfileBattaglia:
"""Battaglia cluster profile evaluator."""
def _raw(self, m200, z, r, dist='physical', r200=None):
"""Evaluate the dimensionless 3d pressure profiles for clusters with the the given masses m200 and redshifts z at the distances r from the center. m200, z and r must broadcast to t... | the_stack_v2_python_sparse | clusters.py | amaurea/enlib | train | 5 |
dccfc1f695ce8612817a0825bba250d730573e55 | [
"self.cancelled = cancelled\nself.environment = environment\nself.failed = failed\nself.id = id\nself.name = name\nself.parent_source_id = parent_source_id\nself.parent_source_name = parent_source_name\nself.running = running\nself.successful = successful\nself.total = total\nself.trends = trends",
"if dictionary... | <|body_start_0|>
self.cancelled = cancelled
self.environment = environment
self.failed = failed
self.id = id
self.name = name
self.parent_source_id = parent_source_id
self.parent_source_name = parent_source_name
self.running = running
self.successf... | Implementation of the 'ProtectionTrend' model. Specifies details of a protected object with it's protection trends. Attributes: cancelled (long|int): Specifies number of cancelled runs across trends. environment (EnvironmentProtectionTrendEnum): Specifies environment. Supported environment types such as 'kView', 'kSQL'... | ProtectionTrend | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtectionTrend:
"""Implementation of the 'ProtectionTrend' model. Specifies details of a protected object with it's protection trends. Attributes: cancelled (long|int): Specifies number of cancelled runs across trends. environment (EnvironmentProtectionTrendEnum): Specifies environment. Supporte... | stack_v2_sparse_classes_75kplus_train_006111 | 7,932 | permissive | [
{
"docstring": "Constructor for the ProtectionTrend class",
"name": "__init__",
"signature": "def __init__(self, cancelled=None, environment=None, failed=None, id=None, name=None, parent_source_id=None, parent_source_name=None, running=None, successful=None, total=None, trends=None)"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_train_043993 | Implement the Python class `ProtectionTrend` described below.
Class description:
Implementation of the 'ProtectionTrend' model. Specifies details of a protected object with it's protection trends. Attributes: cancelled (long|int): Specifies number of cancelled runs across trends. environment (EnvironmentProtectionTren... | Implement the Python class `ProtectionTrend` described below.
Class description:
Implementation of the 'ProtectionTrend' model. Specifies details of a protected object with it's protection trends. Attributes: cancelled (long|int): Specifies number of cancelled runs across trends. environment (EnvironmentProtectionTren... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class ProtectionTrend:
"""Implementation of the 'ProtectionTrend' model. Specifies details of a protected object with it's protection trends. Attributes: cancelled (long|int): Specifies number of cancelled runs across trends. environment (EnvironmentProtectionTrendEnum): Specifies environment. Supporte... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProtectionTrend:
"""Implementation of the 'ProtectionTrend' model. Specifies details of a protected object with it's protection trends. Attributes: cancelled (long|int): Specifies number of cancelled runs across trends. environment (EnvironmentProtectionTrendEnum): Specifies environment. Supported environment... | the_stack_v2_python_sparse | cohesity_management_sdk/models/protection_trend.py | cohesity/management-sdk-python | train | 24 |
359196c2b6efeeb860b3008b36b28a6d871ed024 | [
"body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A', 'startTime': '2018101000000000', 'endTime': '2018102300000000'}\na = api_v1_analysis_channel_sec_waitsecond(body1)\ndict_data = json.loads(a)\nself.assertNotEqual(dict_data['results'][0]['num'], 0)",
"body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-D', 'startTi... | <|body_start_0|>
body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A', 'startTime': '2018101000000000', 'endTime': '2018102300000000'}
a = api_v1_analysis_channel_sec_waitsecond(body1)
dict_data = json.loads(a)
self.assertNotEqual(dict_data['results'][0]['num'], 0)
<|end_body_0|>
<|body_s... | 2.4.9.4平均安检等待时间 | TestApiAnalysisChannelSecWaitSecond | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestApiAnalysisChannelSecWaitSecond:
"""2.4.9.4平均安检等待时间"""
def test_01(self):
"""验证正确传入参数时能返回平均安检等待时间数据"""
<|body_0|>
def test_02(self):
"""验证查询非有效时间内不能查询到平均安检等待时间数据"""
<|body_1|>
def test_03(self):
"""验证区域通道不存在时,不能查到平均安检等待时间数据"""
<|b... | stack_v2_sparse_classes_75kplus_train_006112 | 3,210 | no_license | [
{
"docstring": "验证正确传入参数时能返回平均安检等待时间数据",
"name": "test_01",
"signature": "def test_01(self)"
},
{
"docstring": "验证查询非有效时间内不能查询到平均安检等待时间数据",
"name": "test_02",
"signature": "def test_02(self)"
},
{
"docstring": "验证区域通道不存在时,不能查到平均安检等待时间数据",
"name": "test_03",
"signature": "... | 6 | stack_v2_sparse_classes_30k_train_003226 | Implement the Python class `TestApiAnalysisChannelSecWaitSecond` described below.
Class description:
2.4.9.4平均安检等待时间
Method signatures and docstrings:
- def test_01(self): 验证正确传入参数时能返回平均安检等待时间数据
- def test_02(self): 验证查询非有效时间内不能查询到平均安检等待时间数据
- def test_03(self): 验证区域通道不存在时,不能查到平均安检等待时间数据
- def test_04(self): 验证reqId为... | Implement the Python class `TestApiAnalysisChannelSecWaitSecond` described below.
Class description:
2.4.9.4平均安检等待时间
Method signatures and docstrings:
- def test_01(self): 验证正确传入参数时能返回平均安检等待时间数据
- def test_02(self): 验证查询非有效时间内不能查询到平均安检等待时间数据
- def test_03(self): 验证区域通道不存在时,不能查到平均安检等待时间数据
- def test_04(self): 验证reqId为... | aa0749f4a237ee76a61579dc5984635a7127a631 | <|skeleton|>
class TestApiAnalysisChannelSecWaitSecond:
"""2.4.9.4平均安检等待时间"""
def test_01(self):
"""验证正确传入参数时能返回平均安检等待时间数据"""
<|body_0|>
def test_02(self):
"""验证查询非有效时间内不能查询到平均安检等待时间数据"""
<|body_1|>
def test_03(self):
"""验证区域通道不存在时,不能查到平均安检等待时间数据"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestApiAnalysisChannelSecWaitSecond:
"""2.4.9.4平均安检等待时间"""
def test_01(self):
"""验证正确传入参数时能返回平均安检等待时间数据"""
body1 = {'reqId': get_uuid(), 'areaCode': 'atAJ-A', 'startTime': '2018101000000000', 'endTime': '2018102300000000'}
a = api_v1_analysis_channel_sec_waitsecond(body1)
... | the_stack_v2_python_sparse | Airport/Auto_return/TestCase/test_data_platform_094.py | jingshiyue/zhongkeyuan_workspace | train | 0 |
92227ccfcbc87adac81a17be87ebb6c12412b2b8 | [
"iLengthPairs, iLengthMS, iHardwareType, iFormat, iCompression, iShortDelayCode, iLongDelayCode, iCodemapLength = struct.unpack('<2L6B', drof.read(14))\ncodemap = struct.unpack(str(iCodemapLength) + 'B', drof.read(iCodemapLength))\nif iFormat != 0:\n raise DROFileException('Unsupported DRO v2 format. Only 0 is s... | <|body_start_0|>
iLengthPairs, iLengthMS, iHardwareType, iFormat, iCompression, iShortDelayCode, iLongDelayCode, iCodemapLength = struct.unpack('<2L6B', drof.read(14))
codemap = struct.unpack(str(iCodemapLength) + 'B', drof.read(iCodemapLength))
if iFormat != 0:
raise DROFileExceptio... | DroFileIOv2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DroFileIOv2:
def read_data(self, file_name, drof):
"""@type file_name: str @type drof: File"""
<|body_0|>
def write_data(self, drof, dro_song):
"""@type drof: File @type dro_song: DROSongV2"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
iLengthPair... | stack_v2_sparse_classes_75kplus_train_006113 | 9,408 | no_license | [
{
"docstring": "@type file_name: str @type drof: File",
"name": "read_data",
"signature": "def read_data(self, file_name, drof)"
},
{
"docstring": "@type drof: File @type dro_song: DROSongV2",
"name": "write_data",
"signature": "def write_data(self, drof, dro_song)"
}
] | 2 | stack_v2_sparse_classes_30k_test_002706 | Implement the Python class `DroFileIOv2` described below.
Class description:
Implement the DroFileIOv2 class.
Method signatures and docstrings:
- def read_data(self, file_name, drof): @type file_name: str @type drof: File
- def write_data(self, drof, dro_song): @type drof: File @type dro_song: DROSongV2 | Implement the Python class `DroFileIOv2` described below.
Class description:
Implement the DroFileIOv2 class.
Method signatures and docstrings:
- def read_data(self, file_name, drof): @type file_name: str @type drof: File
- def write_data(self, drof, dro_song): @type drof: File @type dro_song: DROSongV2
<|skeleton|>... | 6fcf6f960b17a4da84ae4a86a589a5c935bb4993 | <|skeleton|>
class DroFileIOv2:
def read_data(self, file_name, drof):
"""@type file_name: str @type drof: File"""
<|body_0|>
def write_data(self, drof, dro_song):
"""@type drof: File @type dro_song: DROSongV2"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DroFileIOv2:
def read_data(self, file_name, drof):
"""@type file_name: str @type drof: File"""
iLengthPairs, iLengthMS, iHardwareType, iFormat, iCompression, iShortDelayCode, iLongDelayCode, iCodemapLength = struct.unpack('<2L6B', drof.read(14))
codemap = struct.unpack(str(iCodemapLeng... | the_stack_v2_python_sparse | src/dro_io.py | rofl0r/dro-trimmer | train | 2 | |
2918e1bc7e74f33e74b858a0c0518aa6e75abbfd | [
"if n == 1:\n return 1\nugly = [0] * n\nugly[0] = 1\nnext_ugly_2 = 2\nnext_ugly_3 = 3\nnext_ugly_5 = 5\ni2 = i3 = i5 = 0\nfor i in range(1, n):\n next_ugly = min(next_ugly_2, next_ugly_3, next_ugly_5)\n ugly[i] = next_ugly\n if next_ugly == next_ugly_2:\n i2 += 1\n next_ugly_2 = ugly[i2] *... | <|body_start_0|>
if n == 1:
return 1
ugly = [0] * n
ugly[0] = 1
next_ugly_2 = 2
next_ugly_3 = 3
next_ugly_5 = 5
i2 = i3 = i5 = 0
for i in range(1, n):
next_ugly = min(next_ugly_2, next_ugly_3, next_ugly_5)
ugly[i] = next... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def nthSuperUglyNumber(self, n, primes):
""":type n: int :type primes: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 1:
retur... | stack_v2_sparse_classes_75kplus_train_006114 | 3,254 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "nthUglyNumber",
"signature": "def nthUglyNumber(self, n)"
},
{
"docstring": ":type n: int :type primes: List[int] :rtype: int",
"name": "nthSuperUglyNumber",
"signature": "def nthSuperUglyNumber(self, n, primes)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018829 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nthUglyNumber(self, n): :type n: int :rtype: int
- def nthSuperUglyNumber(self, n, primes): :type n: int :type primes: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nthUglyNumber(self, n): :type n: int :rtype: int
- def nthSuperUglyNumber(self, n, primes): :type n: int :type primes: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 8731e2ccfbda9323ea5c8629599806cd1c37c3bf | <|skeleton|>
class Solution:
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def nthSuperUglyNumber(self, n, primes):
""":type n: int :type primes: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
if n == 1:
return 1
ugly = [0] * n
ugly[0] = 1
next_ugly_2 = 2
next_ugly_3 = 3
next_ugly_5 = 5
i2 = i3 = i5 = 0
for i in range(1, n):
next_ugly =... | the_stack_v2_python_sparse | problems/dynamicProgramming/UglyNumber.py | jonu4u/DataStructuresInPython | train | 0 | |
b5d1d94b766ed5b5721a5acc1ff18130d35d218a | [
"model = SRPN_Model()\nalist = []\nnr1 = 1\nr1 = R(RT.IN, nr1)\nalist.append(nr1)\nself.assertEqual(model.take_in(str(nr1)), [r1])\nop = '+'\nself.assertEqual(model.take_in(op), [R(RT.ER, Error(ERROR.ST_UNDRF))])",
"model = SRPN_Model()\nalist = []\nnr1 = 10\nr1 = R(RT.IN, nr1)\nalist.append(nr1)\nself.assertEqua... | <|body_start_0|>
model = SRPN_Model()
alist = []
nr1 = 1
r1 = R(RT.IN, nr1)
alist.append(nr1)
self.assertEqual(model.take_in(str(nr1)), [r1])
op = '+'
self.assertEqual(model.take_in(op), [R(RT.ER, Error(ERROR.ST_UNDRF))])
<|end_body_0|>
<|body_start_1|>
... | Test_Fourth_Section | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_Fourth_Section:
def test_4_1(self):
"""1 +"""
<|body_0|>
def test_4_2(self):
"""10 5 -5 + /"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
model = SRPN_Model()
alist = []
nr1 = 1
r1 = R(RT.IN, nr1)
alist.append(... | stack_v2_sparse_classes_75kplus_train_006115 | 13,734 | permissive | [
{
"docstring": "1 +",
"name": "test_4_1",
"signature": "def test_4_1(self)"
},
{
"docstring": "10 5 -5 + /",
"name": "test_4_2",
"signature": "def test_4_2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002501 | Implement the Python class `Test_Fourth_Section` described below.
Class description:
Implement the Test_Fourth_Section class.
Method signatures and docstrings:
- def test_4_1(self): 1 +
- def test_4_2(self): 10 5 -5 + / | Implement the Python class `Test_Fourth_Section` described below.
Class description:
Implement the Test_Fourth_Section class.
Method signatures and docstrings:
- def test_4_1(self): 1 +
- def test_4_2(self): 10 5 -5 + /
<|skeleton|>
class Test_Fourth_Section:
def test_4_1(self):
"""1 +"""
<|body... | 1ee89edbbb2dcb496b2648a5e5a8ad807239c7c5 | <|skeleton|>
class Test_Fourth_Section:
def test_4_1(self):
"""1 +"""
<|body_0|>
def test_4_2(self):
"""10 5 -5 + /"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test_Fourth_Section:
def test_4_1(self):
"""1 +"""
model = SRPN_Model()
alist = []
nr1 = 1
r1 = R(RT.IN, nr1)
alist.append(nr1)
self.assertEqual(model.take_in(str(nr1)), [r1])
op = '+'
self.assertEqual(model.take_in(op), [R(RT.ER, Error(E... | the_stack_v2_python_sparse | test.py | cstml/UoB-reverse-polish-notation-calculator | train | 0 | |
159437dc3d490b4982953cd6dbeccee803bf2e60 | [
"self.auth_before_sign = auth_before_sign\nself.social_security_number = social_security_number\nself.signature_method_unique_id = signature_method_unique_id\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nauth_before_sign = dictionary.get('authBeforeSign')\nsocial_... | <|body_start_0|>
self.auth_before_sign = auth_before_sign
self.social_security_number = social_security_number
self.signature_method_unique_id = signature_method_unique_id
self.additional_properties = additional_properties
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers social security number signature_method_un... | Authentication | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Authentication:
"""Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers ... | stack_v2_sparse_classes_75kplus_train_006116 | 2,927 | permissive | [
{
"docstring": "Constructor for the Authentication class",
"name": "__init__",
"signature": "def __init__(self, auth_before_sign=None, social_security_number=None, signature_method_unique_id=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary A... | 2 | stack_v2_sparse_classes_30k_train_025910 | Implement the Python class `Authentication` described below.
Class description:
Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social... | Implement the Python class `Authentication` described below.
Class description:
Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Authentication:
"""Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Authentication:
"""Implementation of the 'Authentication' model. TODO: type model description here. Attributes: auth_before_sign (bool): If this is set to true, you have to include the social security number or SignatureMethod unique id for the signer social_security_number (string): The signers social securi... | the_stack_v2_python_sparse | idfy_rest_client/models/authentication.py | dealflowteam/Idfy | train | 0 |
fbd1b5d939565c484d46a3d31600f17e87d12b91 | [
"person1_instance = User.objects.get(username=person1).id\nperson2_instance = User.objects.get(username=person2).id\ntry:\n instance_1 = Friend.objects.get(sender=person1_instance, receiver=person2_instance)\n return (instance_1, 1)\nexcept Friend.DoesNotExist:\n instance_1 = None\nif instance_1 is None:\n... | <|body_start_0|>
person1_instance = User.objects.get(username=person1).id
person2_instance = User.objects.get(username=person2).id
try:
instance_1 = Friend.objects.get(sender=person1_instance, receiver=person2_instance)
return (instance_1, 1)
except Friend.DoesNot... | FriendManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FriendManager:
def get_friend_status(self, person1, person2):
""":param person1: :param person2: :return: The resulting row_instance if present in Table or None"""
<|body_0|>
def add_friend_request(self, sender, receiver):
"""This function will add the friends Reques... | stack_v2_sparse_classes_75kplus_train_006117 | 5,352 | no_license | [
{
"docstring": ":param person1: :param person2: :return: The resulting row_instance if present in Table or None",
"name": "get_friend_status",
"signature": "def get_friend_status(self, person1, person2)"
},
{
"docstring": "This function will add the friends Request for person1 and person2 i.e. i... | 2 | stack_v2_sparse_classes_30k_train_032304 | Implement the Python class `FriendManager` described below.
Class description:
Implement the FriendManager class.
Method signatures and docstrings:
- def get_friend_status(self, person1, person2): :param person1: :param person2: :return: The resulting row_instance if present in Table or None
- def add_friend_request(... | Implement the Python class `FriendManager` described below.
Class description:
Implement the FriendManager class.
Method signatures and docstrings:
- def get_friend_status(self, person1, person2): :param person1: :param person2: :return: The resulting row_instance if present in Table or None
- def add_friend_request(... | 89e6fae406c33e2c2ef3884be5af68817d2f9413 | <|skeleton|>
class FriendManager:
def get_friend_status(self, person1, person2):
""":param person1: :param person2: :return: The resulting row_instance if present in Table or None"""
<|body_0|>
def add_friend_request(self, sender, receiver):
"""This function will add the friends Reques... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FriendManager:
def get_friend_status(self, person1, person2):
""":param person1: :param person2: :return: The resulting row_instance if present in Table or None"""
person1_instance = User.objects.get(username=person1).id
person2_instance = User.objects.get(username=person2).id
... | the_stack_v2_python_sparse | chitchat/models.py | pranjalpranjal/UNO-Game | train | 0 | |
eda8de8ccada37bedd3845bd948fc30cfa7d0ad1 | [
"cube1 = Cube('red', 6)\ncube2 = Cube('blue', 5)\nstacked_list = [cube1, cube2]\nself.assertEqual(calc_height(stacked_list), 'The maximum tower height is 11')",
"cube1 = Cube('red', 5)\ncube2 = Cube('red', 5)\ncube_list = [cube1, cube2]\nwith self.assertRaises(ValueError):\n stack_cubes(cube_list)",
"cube1 =... | <|body_start_0|>
cube1 = Cube('red', 6)
cube2 = Cube('blue', 5)
stacked_list = [cube1, cube2]
self.assertEqual(calc_height(stacked_list), 'The maximum tower height is 11')
<|end_body_0|>
<|body_start_1|>
cube1 = Cube('red', 5)
cube2 = Cube('red', 5)
cube_list = [... | UnitTest | UnitTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnitTest:
"""UnitTest"""
def test_calc_height(self):
"""test_calc_height: Testing calculate_height function"""
<|body_0|>
def test_failure(self):
"""test_failure: Make sure a ValueError is raised if you cannot stack the cubes"""
<|body_1|>
def test_w... | stack_v2_sparse_classes_75kplus_train_006118 | 1,393 | no_license | [
{
"docstring": "test_calc_height: Testing calculate_height function",
"name": "test_calc_height",
"signature": "def test_calc_height(self)"
},
{
"docstring": "test_failure: Make sure a ValueError is raised if you cannot stack the cubes",
"name": "test_failure",
"signature": "def test_fai... | 3 | stack_v2_sparse_classes_30k_train_014355 | Implement the Python class `UnitTest` described below.
Class description:
UnitTest
Method signatures and docstrings:
- def test_calc_height(self): test_calc_height: Testing calculate_height function
- def test_failure(self): test_failure: Make sure a ValueError is raised if you cannot stack the cubes
- def test_wides... | Implement the Python class `UnitTest` described below.
Class description:
UnitTest
Method signatures and docstrings:
- def test_calc_height(self): test_calc_height: Testing calculate_height function
- def test_failure(self): test_failure: Make sure a ValueError is raised if you cannot stack the cubes
- def test_wides... | 78f8f8d575e69da8d0c48929a562b0e9f64ab68d | <|skeleton|>
class UnitTest:
"""UnitTest"""
def test_calc_height(self):
"""test_calc_height: Testing calculate_height function"""
<|body_0|>
def test_failure(self):
"""test_failure: Make sure a ValueError is raised if you cannot stack the cubes"""
<|body_1|>
def test_w... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnitTest:
"""UnitTest"""
def test_calc_height(self):
"""test_calc_height: Testing calculate_height function"""
cube1 = Cube('red', 6)
cube2 = Cube('blue', 5)
stacked_list = [cube1, cube2]
self.assertEqual(calc_height(stacked_list), 'The maximum tower height is 11')... | the_stack_v2_python_sparse | task3/unit_test.py | jamesl33/210CT-Course-Work | train | 0 |
4ab3f5b4fda4f3b314aa465de6117a17ed70c212 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn TelecomExpenseManagementPartner()",
"from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'appAuthorized': lambda n: setattr(self, 'app_authorized', n.get_bool_value()), 'displayName': lam... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return TelecomExpenseManagementPartner()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .entity import Entity
fields: Dict[str, Callable[[Any], None]] = {'appAuthorized... | telecomExpenseManagementPartner resources represent the metadata and status of a given TEM service. Once your organization has onboarded with a partner, the partner can be enabled or disabled to switch TEM functionality on or off. | TelecomExpenseManagementPartner | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TelecomExpenseManagementPartner:
"""telecomExpenseManagementPartner resources represent the metadata and status of a given TEM service. Once your organization has onboarded with a partner, the partner can be enabled or disabled to switch TEM functionality on or off."""
def create_from_discri... | stack_v2_sparse_classes_75kplus_train_006119 | 3,459 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: TelecomExpenseManagementPartner",
"name": "create_from_discriminator_value",
"signature": "def create_from_d... | 3 | null | Implement the Python class `TelecomExpenseManagementPartner` described below.
Class description:
telecomExpenseManagementPartner resources represent the metadata and status of a given TEM service. Once your organization has onboarded with a partner, the partner can be enabled or disabled to switch TEM functionality on... | Implement the Python class `TelecomExpenseManagementPartner` described below.
Class description:
telecomExpenseManagementPartner resources represent the metadata and status of a given TEM service. Once your organization has onboarded with a partner, the partner can be enabled or disabled to switch TEM functionality on... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class TelecomExpenseManagementPartner:
"""telecomExpenseManagementPartner resources represent the metadata and status of a given TEM service. Once your organization has onboarded with a partner, the partner can be enabled or disabled to switch TEM functionality on or off."""
def create_from_discri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TelecomExpenseManagementPartner:
"""telecomExpenseManagementPartner resources represent the metadata and status of a given TEM service. Once your organization has onboarded with a partner, the partner can be enabled or disabled to switch TEM functionality on or off."""
def create_from_discriminator_value... | the_stack_v2_python_sparse | msgraph/generated/models/telecom_expense_management_partner.py | microsoftgraph/msgraph-sdk-python | train | 135 |
9efb07e8c6460fa338f4b4901896d80f3adf9afa | [
"if isinstance(size, (str, unicode)):\n size = int(size)\nreturn numpy.ones((size, 1)) * numpy.array([1.0, 0.0])",
"if isinstance(start_idx, (str, unicode)):\n start_idx = int(start_idx)\nif isinstance(end_idx, (str, unicode)):\n end_idx = int(end_idx)\nsize = end_idx - start_idx\nresult = numpy.transpos... | <|body_start_0|>
if isinstance(size, (str, unicode)):
size = int(size)
return numpy.ones((size, 1)) * numpy.array([1.0, 0.0])
<|end_body_0|>
<|body_start_1|>
if isinstance(start_idx, (str, unicode)):
start_idx = int(start_idx)
if isinstance(end_idx, (str, unicode... | Framework methods regarding RegionMapping DataType. | RegionMappingFramework | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegionMappingFramework:
"""Framework methods regarding RegionMapping DataType."""
def get_alpha_array(size):
"""Compute alpha weights. When displaying region-based results, we need to compute color for each surface vertex based on a gradient of the neighbor region(s). Currently only ... | stack_v2_sparse_classes_75kplus_train_006120 | 25,280 | no_license | [
{
"docstring": "Compute alpha weights. When displaying region-based results, we need to compute color for each surface vertex based on a gradient of the neighbor region(s). Currently only one vertex is used for determining color (the one indicated by the RegionMapping). :return: NumPy array with [[1, 0], [1, 0]... | 3 | stack_v2_sparse_classes_30k_train_015450 | Implement the Python class `RegionMappingFramework` described below.
Class description:
Framework methods regarding RegionMapping DataType.
Method signatures and docstrings:
- def get_alpha_array(size): Compute alpha weights. When displaying region-based results, we need to compute color for each surface vertex based... | Implement the Python class `RegionMappingFramework` described below.
Class description:
Framework methods regarding RegionMapping DataType.
Method signatures and docstrings:
- def get_alpha_array(size): Compute alpha weights. When displaying region-based results, we need to compute color for each surface vertex based... | dd4beb028719abaa70c639f64c97ba23bd4a1f3a | <|skeleton|>
class RegionMappingFramework:
"""Framework methods regarding RegionMapping DataType."""
def get_alpha_array(size):
"""Compute alpha weights. When displaying region-based results, we need to compute color for each surface vertex based on a gradient of the neighbor region(s). Currently only ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegionMappingFramework:
"""Framework methods regarding RegionMapping DataType."""
def get_alpha_array(size):
"""Compute alpha weights. When displaying region-based results, we need to compute color for each surface vertex based on a gradient of the neighbor region(s). Currently only one vertex is... | the_stack_v2_python_sparse | tvb/datatypes/surfaces_framework.py | HuifangWang/the-virtual-brain-website | train | 0 |
a81bad7345a4aa2679aa41d099d2ec7c53a0c3f5 | [
"if root is None:\n return []\nq = []\nres = []\nq.append(root)\nwhile len(q) > 0:\n for _ in range(len(q)):\n node = q.pop(0)\n for next_node in [node.left, node.right]:\n if next_node is not None:\n q.append(next_node)\n res.append(node.val)\nreturn res",
"if roo... | <|body_start_0|>
if root is None:
return []
q = []
res = []
q.append(root)
while len(q) > 0:
for _ in range(len(q)):
node = q.pop(0)
for next_node in [node.left, node.right]:
if next_node is not None:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rightSideView2(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def rightSideView(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
r... | stack_v2_sparse_classes_75kplus_train_006121 | 1,365 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "rightSideView2",
"signature": "def rightSideView2(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "rightSideView",
"signature": "def rightSideView(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_025259 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rightSideView2(self, root): :type root: TreeNode :rtype: List[int]
- def rightSideView(self, root): :type root: TreeNode :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rightSideView2(self, root): :type root: TreeNode :rtype: List[int]
- def rightSideView(self, root): :type root: TreeNode :rtype: List[int]
<|skeleton|>
class Solution:
... | 70cb1ee0cdc1ddec93861aef56610f7def1472e1 | <|skeleton|>
class Solution:
def rightSideView2(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def rightSideView(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rightSideView2(self, root):
""":type root: TreeNode :rtype: List[int]"""
if root is None:
return []
q = []
res = []
q.append(root)
while len(q) > 0:
for _ in range(len(q)):
node = q.pop(0)
for... | the_stack_v2_python_sparse | trees/bfs/right_side_view.py | medesiv/ds_algo | train | 0 | |
d316d79d360196d13ed68a0d32ae64f209bf5f0d | [
"if maxNumbers > 0:\n self.current = linkedlist(0)\n self.head = linkedlist(-1)\n self.head.next = self.current\n for i in range(1, maxNumbers):\n self.current.next = linkedlist(i)\n self.current = self.current.next\nself.available = {num for num in range(maxNumbers)}",
"if self.head.nex... | <|body_start_0|>
if maxNumbers > 0:
self.current = linkedlist(0)
self.head = linkedlist(-1)
self.head.next = self.current
for i in range(1, maxNumbers):
self.current.next = linkedlist(i)
self.current = self.current.next
self... | PhoneDirectory | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhoneDirectory:
def __init__(self, maxNumbers: int):
"""Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory."""
<|body_0|>
def get(self):
"""Provide a number which is not assigned to anyone. @return - ... | stack_v2_sparse_classes_75kplus_train_006122 | 2,076 | permissive | [
{
"docstring": "Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.",
"name": "__init__",
"signature": "def __init__(self, maxNumbers: int)"
},
{
"docstring": "Provide a number which is not assigned to anyone. @return - Return an... | 4 | stack_v2_sparse_classes_30k_train_036267 | Implement the Python class `PhoneDirectory` described below.
Class description:
Implement the PhoneDirectory class.
Method signatures and docstrings:
- def __init__(self, maxNumbers: int): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.
- def get(... | Implement the Python class `PhoneDirectory` described below.
Class description:
Implement the PhoneDirectory class.
Method signatures and docstrings:
- def __init__(self, maxNumbers: int): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory.
- def get(... | 3fd33092f53de25e8014c05af4ac3e6754f54e23 | <|skeleton|>
class PhoneDirectory:
def __init__(self, maxNumbers: int):
"""Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory."""
<|body_0|>
def get(self):
"""Provide a number which is not assigned to anyone. @return - ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhoneDirectory:
def __init__(self, maxNumbers: int):
"""Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory."""
if maxNumbers > 0:
self.current = linkedlist(0)
self.head = linkedlist(-1)
self.... | the_stack_v2_python_sparse | Python3/379.design-phone-directory.py | 610yilingliu/leetcode | train | 2 | |
5a64418b307c241aac4824f46f6d0041f1222aa9 | [
"QSearchTreeWidget.__init__(self, parent)\nself.header().hide()\nself.setRootIsDecorated(False)\nself.delegate = QAliasParameterTreeWidgetItemDelegate(self, self)\nself.setItemDelegate(self.delegate)\nself.aliasNames = []\nself.itemDoubleClicked.connect(self.changeAlias)",
"self.clear()\nif not pipeline:\n ret... | <|body_start_0|>
QSearchTreeWidget.__init__(self, parent)
self.header().hide()
self.setRootIsDecorated(False)
self.delegate = QAliasParameterTreeWidgetItemDelegate(self, self)
self.setItemDelegate(self.delegate)
self.aliasNames = []
self.itemDoubleClicked.connect(... | QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module | QAliasParameterTreeWidget | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QAliasParameterTreeWidget:
"""QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module"""
def __init__(self, parent=None):
"""QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_006123 | 18,014 | permissive | [
{
"docstring": "QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "updateFromPipeline(pipeline: Pipeline) -> None Read the list of aliases and parameters from the... | 3 | stack_v2_sparse_classes_30k_train_017849 | Implement the Python class `QAliasParameterTreeWidget` described below.
Class description:
QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module
Method signatures and docstrings:
- def __init__(self, parent=None): QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidge... | Implement the Python class `QAliasParameterTreeWidget` described below.
Class description:
QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module
Method signatures and docstrings:
- def __init__(self, parent=None): QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidge... | 23ef56ec24b85c82416e1437a08381635328abe5 | <|skeleton|>
class QAliasParameterTreeWidget:
"""QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module"""
def __init__(self, parent=None):
"""QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QAliasParameterTreeWidget:
"""QAliasParameterTreeWidget is a subclass of QSearchTreeWidget to display all Vistrails Module"""
def __init__(self, parent=None):
"""QAliasParameterTreeWidget(parent: QWidget) -> QParameterTreeWidget Set up size policy and header"""
QSearchTreeWidget.__init__(... | the_stack_v2_python_sparse | vistrails_current/vistrails/gui/mashups/alias_parameter_view.py | lumig242/VisTrailsRecommendation | train | 3 |
8f2a0d2c2b781211f13f6f848aab6fd0e9ae5529 | [
"super(Inverter, self).__init__()\nself.add_param('inverter_efficiency', 1.0, desc='power out / power in')\nself.add_param('output_voltage', 120.0, desc='amplitude of AC output voltage', units='V')\nself.add_param('output_current', 2.0, desc='amplitude of AC output current', units='A')\nself.add_param('output_frequ... | <|body_start_0|>
super(Inverter, self).__init__()
self.add_param('inverter_efficiency', 1.0, desc='power out / power in')
self.add_param('output_voltage', 120.0, desc='amplitude of AC output voltage', units='V')
self.add_param('output_current', 2.0, desc='amplitude of AC output current',... | The `Inverter` class represents a BLDC inverter in an OpenMDAO model The `Inverter` class models the efficiency loss across a typical BLDC inverter following the example from [1]_. Params ------ inverter_efficiency : float power out / power in (W) output_voltage : float amplitude of AC output voltage (A) output_current... | Inverter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Inverter:
"""The `Inverter` class represents a BLDC inverter in an OpenMDAO model The `Inverter` class models the efficiency loss across a typical BLDC inverter following the example from [1]_. Params ------ inverter_efficiency : float power out / power in (W) output_voltage : float amplitude of ... | stack_v2_sparse_classes_75kplus_train_006124 | 3,116 | permissive | [
{
"docstring": "Initializes a `Inverter` object Sets up the given Params/Outputs of the OpenMDAO `Inverter` component, initializes their shape, and sets them to their default values.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Runs the `Battery` component and sets ... | 2 | stack_v2_sparse_classes_30k_train_044701 | Implement the Python class `Inverter` described below.
Class description:
The `Inverter` class represents a BLDC inverter in an OpenMDAO model The `Inverter` class models the efficiency loss across a typical BLDC inverter following the example from [1]_. Params ------ inverter_efficiency : float power out / power in (... | Implement the Python class `Inverter` described below.
Class description:
The `Inverter` class represents a BLDC inverter in an OpenMDAO model The `Inverter` class models the efficiency loss across a typical BLDC inverter following the example from [1]_. Params ------ inverter_efficiency : float power out / power in (... | ac6261ffc2926cc4041185563044de3dac0101e6 | <|skeleton|>
class Inverter:
"""The `Inverter` class represents a BLDC inverter in an OpenMDAO model The `Inverter` class models the efficiency loss across a typical BLDC inverter following the example from [1]_. Params ------ inverter_efficiency : float power out / power in (W) output_voltage : float amplitude of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Inverter:
"""The `Inverter` class represents a BLDC inverter in an OpenMDAO model The `Inverter` class models the efficiency loss across a typical BLDC inverter following the example from [1]_. Params ------ inverter_efficiency : float power out / power in (W) output_voltage : float amplitude of AC output vol... | the_stack_v2_python_sparse | src/hyperloop/Python/pod/drivetrain/inverter.py | HamzaRabi/MagnePlane | train | 0 |
9bbb4f37cf57c773eaf13df4c7cb538ad2704a86 | [
"import Queue\nself.queue = Queue.Queue(size)\nself.MovingSum = 0",
"if self.queue.full():\n self.MovingSum += val - self.queue.get()\nelse:\n self.MovingSum += val\nself.queue.put(val)\nreturn float(self.MovingSum) / self.queue.qsize()"
] | <|body_start_0|>
import Queue
self.queue = Queue.Queue(size)
self.MovingSum = 0
<|end_body_0|>
<|body_start_1|>
if self.queue.full():
self.MovingSum += val - self.queue.get()
else:
self.MovingSum += val
self.queue.put(val)
return float(sel... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import Queue
self.queue = Que... | stack_v2_sparse_classes_75kplus_train_006125 | 705 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | null | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | 921abbb1b0add8f92fb2d4e034950d8a31b9c90c | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
import Queue
self.queue = Queue.Queue(size)
self.MovingSum = 0
def next(self, val):
""":type val: int :rtype: float"""
if self.queue.full():
self... | the_stack_v2_python_sparse | 346. Moving Average from Data Stream.py | jlyang1990/LeetCode | train | 5 | |
31b99c87de413856878828458a43a06efd07b4df | [
"super(FreshdeskTicketResourceTestCase, self).setUp()\nmixer.cycle(5).blend(FreshdeskContact, email=random_dbca_email)\nmixer.cycle(5).blend(FreshdeskTicket, subject=mixer.RANDOM, description_text=mixer.RANDOM, type='Test', freshdesk_requester=mixer.SELECT, it_system=mixer.SELECT, custom_fields={'support_category':... | <|body_start_0|>
super(FreshdeskTicketResourceTestCase, self).setUp()
mixer.cycle(5).blend(FreshdeskContact, email=random_dbca_email)
mixer.cycle(5).blend(FreshdeskTicket, subject=mixer.RANDOM, description_text=mixer.RANDOM, type='Test', freshdesk_requester=mixer.SELECT, it_system=mixer.SELECT, ... | FreshdeskTicketResourceTestCase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FreshdeskTicketResourceTestCase:
def setUp(self):
"""Generate from FreshdeskTicket objects."""
<|body_0|>
def test_list(self):
"""Test the FreshdeskTicketResource list response"""
<|body_1|>
def test_list_filtering(self):
"""Test the FreshdeskTic... | stack_v2_sparse_classes_75kplus_train_006126 | 2,797 | permissive | [
{
"docstring": "Generate from FreshdeskTicket objects.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test the FreshdeskTicketResource list response",
"name": "test_list",
"signature": "def test_list(self)"
},
{
"docstring": "Test the FreshdeskTicketResource... | 4 | stack_v2_sparse_classes_30k_train_011140 | Implement the Python class `FreshdeskTicketResourceTestCase` described below.
Class description:
Implement the FreshdeskTicketResourceTestCase class.
Method signatures and docstrings:
- def setUp(self): Generate from FreshdeskTicket objects.
- def test_list(self): Test the FreshdeskTicketResource list response
- def ... | Implement the Python class `FreshdeskTicketResourceTestCase` described below.
Class description:
Implement the FreshdeskTicketResourceTestCase class.
Method signatures and docstrings:
- def setUp(self): Generate from FreshdeskTicket objects.
- def test_list(self): Test the FreshdeskTicketResource list response
- def ... | 09a789402eafe0a477fc07689528029430d4f98c | <|skeleton|>
class FreshdeskTicketResourceTestCase:
def setUp(self):
"""Generate from FreshdeskTicket objects."""
<|body_0|>
def test_list(self):
"""Test the FreshdeskTicketResource list response"""
<|body_1|>
def test_list_filtering(self):
"""Test the FreshdeskTic... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FreshdeskTicketResourceTestCase:
def setUp(self):
"""Generate from FreshdeskTicket objects."""
super(FreshdeskTicketResourceTestCase, self).setUp()
mixer.cycle(5).blend(FreshdeskContact, email=random_dbca_email)
mixer.cycle(5).blend(FreshdeskTicket, subject=mixer.RANDOM, descri... | the_stack_v2_python_sparse | tracking/disable_test_api.py | rockychen-dpaw/it-assets | train | 0 | |
c11ab62590f94b32b47721e346b2902a0af4ed16 | [
"front_data = FAQClassSerializers(data=request.data)\nif front_data.is_valid():\n try:\n with transaction.atomic():\n front_data.save()\n except Exception as err:\n logger.error(err)\n return JsonResponse(json_response(0, error_code=421, msg='数据库操作失败'))\n else:\n retu... | <|body_start_0|>
front_data = FAQClassSerializers(data=request.data)
if front_data.is_valid():
try:
with transaction.atomic():
front_data.save()
except Exception as err:
logger.error(err)
return JsonResponse(json... | 处理 api/v1/ops/faq/classes/ 请求 | FAQClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FAQClass:
"""处理 api/v1/ops/faq/classes/ 请求"""
def post(self, request, version):
"""处理POST请求,添加分类 :param request: :param version: API版本号"""
<|body_0|>
def get(self, request, version):
"""处理GET请求, 返回全部分类信息 :param version: API版本号 :param request:"""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_006127 | 13,131 | no_license | [
{
"docstring": "处理POST请求,添加分类 :param request: :param version: API版本号",
"name": "post",
"signature": "def post(self, request, version)"
},
{
"docstring": "处理GET请求, 返回全部分类信息 :param version: API版本号 :param request:",
"name": "get",
"signature": "def get(self, request, version)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_036431 | Implement the Python class `FAQClass` described below.
Class description:
处理 api/v1/ops/faq/classes/ 请求
Method signatures and docstrings:
- def post(self, request, version): 处理POST请求,添加分类 :param request: :param version: API版本号
- def get(self, request, version): 处理GET请求, 返回全部分类信息 :param version: API版本号 :param request:... | Implement the Python class `FAQClass` described below.
Class description:
处理 api/v1/ops/faq/classes/ 请求
Method signatures and docstrings:
- def post(self, request, version): 处理POST请求,添加分类 :param request: :param version: API版本号
- def get(self, request, version): 处理GET请求, 返回全部分类信息 :param version: API版本号 :param request:... | 427c26a0d851e59c392c6c67c82eacec84b6d6f6 | <|skeleton|>
class FAQClass:
"""处理 api/v1/ops/faq/classes/ 请求"""
def post(self, request, version):
"""处理POST请求,添加分类 :param request: :param version: API版本号"""
<|body_0|>
def get(self, request, version):
"""处理GET请求, 返回全部分类信息 :param version: API版本号 :param request:"""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FAQClass:
"""处理 api/v1/ops/faq/classes/ 请求"""
def post(self, request, version):
"""处理POST请求,添加分类 :param request: :param version: API版本号"""
front_data = FAQClassSerializers(data=request.data)
if front_data.is_valid():
try:
with transaction.atomic():
... | the_stack_v2_python_sparse | yunwei/ops_server/faq/views.py | wll1014/KKB | train | 1 |
301b5daca88d8bd3b005a2365340b53bbab16af1 | [
"req = api.payload\ncurrent_user = flask_praetorian.current_user()\nuser = User.query.filter_by(id=id).first()\nif user is None:\n return ({'message': 'User does not exist'}, 404)\nif user in current_user.following:\n return ({'message': 'Already following User'}, 403)\ntry:\n current_user.following.append... | <|body_start_0|>
req = api.payload
current_user = flask_praetorian.current_user()
user = User.query.filter_by(id=id).first()
if user is None:
return ({'message': 'User does not exist'}, 404)
if user in current_user.following:
return ({'message': 'Already f... | follow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class follow:
def post(self, id):
"""Follow a User by id"""
<|body_0|>
def delete(self, id):
"""Unfollow a User by id"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
req = api.payload
current_user = flask_praetorian.current_user()
user = U... | stack_v2_sparse_classes_75kplus_train_006128 | 13,377 | no_license | [
{
"docstring": "Follow a User by id",
"name": "post",
"signature": "def post(self, id)"
},
{
"docstring": "Unfollow a User by id",
"name": "delete",
"signature": "def delete(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037073 | Implement the Python class `follow` described below.
Class description:
Implement the follow class.
Method signatures and docstrings:
- def post(self, id): Follow a User by id
- def delete(self, id): Unfollow a User by id | Implement the Python class `follow` described below.
Class description:
Implement the follow class.
Method signatures and docstrings:
- def post(self, id): Follow a User by id
- def delete(self, id): Unfollow a User by id
<|skeleton|>
class follow:
def post(self, id):
"""Follow a User by id"""
<... | ae78fff9888b0f68d9403d7f65cba086dabb3802 | <|skeleton|>
class follow:
def post(self, id):
"""Follow a User by id"""
<|body_0|>
def delete(self, id):
"""Unfollow a User by id"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class follow:
def post(self, id):
"""Follow a User by id"""
req = api.payload
current_user = flask_praetorian.current_user()
user = User.query.filter_by(id=id).first()
if user is None:
return ({'message': 'User does not exist'}, 404)
if user in current_use... | the_stack_v2_python_sparse | api/v1/users.py | mythril-io/flask-api | train | 0 | |
dc81ee959dd6129cba143ed46b138e3f0472fdd4 | [
"friendly_name = actions.app.name()\nexecutable = actions.app.executable().split(os.path.sep)[-1]\napp_name = create_name(friendly_name.replace('.exe', ''))\nif app.platform == 'mac':\n result = 'mod.apps.{} = \"\"\"\\nos: {}\\nand app.bundle: {}\\n\"\"\"'.format(app_name, app.platform, actions.app.bundle())\nel... | <|body_start_0|>
friendly_name = actions.app.name()
executable = actions.app.executable().split(os.path.sep)[-1]
app_name = create_name(friendly_name.replace('.exe', ''))
if app.platform == 'mac':
result = 'mod.apps.{} = """\nos: {}\nand app.bundle: {}\n"""'.format(app_name, ... | Actions | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Actions:
def talon_add_context_clipboard_python():
"""Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared."""
<|body_0|>
def talon_add_context_clipboard():
"""Adds os-specific context info to th... | stack_v2_sparse_classes_75kplus_train_006129 | 2,957 | permissive | [
{
"docstring": "Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared.",
"name": "talon_add_context_clipboard_python",
"signature": "def talon_add_context_clipboard_python()"
},
{
"docstring": "Adds os-specific context info t... | 3 | stack_v2_sparse_classes_30k_train_040369 | Implement the Python class `Actions` described below.
Class description:
Implement the Actions class.
Method signatures and docstrings:
- def talon_add_context_clipboard_python(): Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared.
- def talon_... | Implement the Python class `Actions` described below.
Class description:
Implement the Actions class.
Method signatures and docstrings:
- def talon_add_context_clipboard_python(): Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared.
- def talon_... | c4cf4659ffba1abf76e99f99ec376cca04bb6291 | <|skeleton|>
class Actions:
def talon_add_context_clipboard_python():
"""Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared."""
<|body_0|>
def talon_add_context_clipboard():
"""Adds os-specific context info to th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Actions:
def talon_add_context_clipboard_python():
"""Adds os-specific context info to the clipboard for the focused app for .py files. Assumes you've a Module named mod declared."""
friendly_name = actions.app.name()
executable = actions.app.executable().split(os.path.sep)[-1]
... | the_stack_v2_python_sparse | code/talon_helpers.py | ma-anwar/knausj_talon | train | 0 | |
a6f71bfff68ba6a7cf63a1e41bea6f54f481bf18 | [
"self.dict = {}\nself.list = []\nself.isListValid = True",
"if val not in self.dict:\n self.dict[val] = True\n self.list.append(val)\n return True\nelse:\n return False",
"if val not in self.dict:\n return False\nelse:\n del self.dict[val]\n self.isListValid = False\n return True",
"im... | <|body_start_0|>
self.dict = {}
self.list = []
self.isListValid = True
<|end_body_0|>
<|body_start_1|>
if val not in self.dict:
self.dict[val] = True
self.list.append(val)
return True
else:
return False
<|end_body_1|>
<|body_start... | RandomizedSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_006130 | 1,477 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool",
"name": "insert",
"signature": ... | 4 | stack_v2_sparse_classes_30k_train_015436 | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif... | Implement the Python class `RandomizedSet` described below.
Class description:
Implement the RandomizedSet class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif... | bb074b3778c8331fb91b41866c043a6c67227727 | <|skeleton|>
class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomizedSet:
def __init__(self):
"""Initialize your data structure here."""
self.dict = {}
self.list = []
self.isListValid = True
def insert(self, val):
"""Inserts a value to the set. Returns true if the set did not already contain the specified element. :type va... | the_stack_v2_python_sparse | 380-Insert-Delete-GetRandom-O(1)/solution.py | Jing233/LeetCode_Python | train | 0 | |
d4cc121dc4da2ca81e100bf2acb364ed55606185 | [
"queryset = Like.objects.all()\nif self.action == 'destroy':\n return queryset.filter(id=self.kwargs['pk'])\nreturn queryset",
"if self.action in ['destroy']:\n permissions = [IsAuthenticated, IsObjectOwner]\nelse:\n permissions = [IsAuthenticated]\nreturn [p() for p in permissions]",
"queryset = Like.... | <|body_start_0|>
queryset = Like.objects.all()
if self.action == 'destroy':
return queryset.filter(id=self.kwargs['pk'])
return queryset
<|end_body_0|>
<|body_start_1|>
if self.action in ['destroy']:
permissions = [IsAuthenticated, IsObjectOwner]
else:
... | LikeViewSet Handle create, delete, list of photos. | LikeViewSet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LikeViewSet:
"""LikeViewSet Handle create, delete, list of photos."""
def get_queryset(self):
"""Restrict list to public-only."""
<|body_0|>
def get_permissions(self):
"""Assign permissions based on action."""
<|body_1|>
def list(self, request, photo... | stack_v2_sparse_classes_75kplus_train_006131 | 2,329 | permissive | [
{
"docstring": "Restrict list to public-only.",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Assign permissions based on action.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Show all the likes of a ph... | 5 | stack_v2_sparse_classes_30k_train_044386 | Implement the Python class `LikeViewSet` described below.
Class description:
LikeViewSet Handle create, delete, list of photos.
Method signatures and docstrings:
- def get_queryset(self): Restrict list to public-only.
- def get_permissions(self): Assign permissions based on action.
- def list(self, request, photo_pk=... | Implement the Python class `LikeViewSet` described below.
Class description:
LikeViewSet Handle create, delete, list of photos.
Method signatures and docstrings:
- def get_queryset(self): Restrict list to public-only.
- def get_permissions(self): Assign permissions based on action.
- def list(self, request, photo_pk=... | 83b79ed62e21c654d0945decaaf6571e19c8c12a | <|skeleton|>
class LikeViewSet:
"""LikeViewSet Handle create, delete, list of photos."""
def get_queryset(self):
"""Restrict list to public-only."""
<|body_0|>
def get_permissions(self):
"""Assign permissions based on action."""
<|body_1|>
def list(self, request, photo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LikeViewSet:
"""LikeViewSet Handle create, delete, list of photos."""
def get_queryset(self):
"""Restrict list to public-only."""
queryset = Like.objects.all()
if self.action == 'destroy':
return queryset.filter(id=self.kwargs['pk'])
return queryset
def ge... | the_stack_v2_python_sparse | ig_clone_api/photos/views/likes.py | whosgriffith/ig-clone-api | train | 0 |
de32ded185ba5e7389073366145dfd0f584717f7 | [
"self.mask = mask\nself.seed_mask = seed_mask\nself._shift_mask_scale = shift_mask_scale\nself.shift_mask = None\nif shift_mask is not None:\n self.shift_mask = np.max(np.abs(shift_mask), axis=0) >= shift_mask_threshold\n assert shift_mask_fov is not None\n self._shift_mask_fov_pre_offset = shift_mask_fov.... | <|body_start_0|>
self.mask = mask
self.seed_mask = seed_mask
self._shift_mask_scale = shift_mask_scale
self.shift_mask = None
if shift_mask is not None:
self.shift_mask = np.max(np.abs(shift_mask), axis=0) >= shift_mask_threshold
assert shift_mask_fov is n... | Restricts the movement of the FFN FoV. | MovementRestrictor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovementRestrictor:
"""Restricts the movement of the FFN FoV."""
def __init__(self, mask=None, shift_mask=None, shift_mask_fov=None, shift_mask_threshold=4, shift_mask_scale=1, seed_mask=None):
"""Initializes the restrictor. Args: mask: 3d ndarray-like of shape (z, y, x); positive va... | stack_v2_sparse_classes_75kplus_train_006132 | 11,092 | permissive | [
{
"docstring": "Initializes the restrictor. Args: mask: 3d ndarray-like of shape (z, y, x); positive values indicate voxels that are not going to be segmented shift_mask: 4d ndarray-like of shape (2, z, y, x) representing a 2d shift vector field shift_mask_fov: bounding_box.BoundingBox around large shifts in wh... | 3 | null | Implement the Python class `MovementRestrictor` described below.
Class description:
Restricts the movement of the FFN FoV.
Method signatures and docstrings:
- def __init__(self, mask=None, shift_mask=None, shift_mask_fov=None, shift_mask_threshold=4, shift_mask_scale=1, seed_mask=None): Initializes the restrictor. Ar... | Implement the Python class `MovementRestrictor` described below.
Class description:
Restricts the movement of the FFN FoV.
Method signatures and docstrings:
- def __init__(self, mask=None, shift_mask=None, shift_mask_fov=None, shift_mask_threshold=4, shift_mask_scale=1, seed_mask=None): Initializes the restrictor. Ar... | a37f0695c5a3d2c28bf612faefd54ad6bed845ea | <|skeleton|>
class MovementRestrictor:
"""Restricts the movement of the FFN FoV."""
def __init__(self, mask=None, shift_mask=None, shift_mask_fov=None, shift_mask_threshold=4, shift_mask_scale=1, seed_mask=None):
"""Initializes the restrictor. Args: mask: 3d ndarray-like of shape (z, y, x); positive va... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MovementRestrictor:
"""Restricts the movement of the FFN FoV."""
def __init__(self, mask=None, shift_mask=None, shift_mask_fov=None, shift_mask_threshold=4, shift_mask_scale=1, seed_mask=None):
"""Initializes the restrictor. Args: mask: 3d ndarray-like of shape (z, y, x); positive values indicate... | the_stack_v2_python_sparse | ffn/inference/movement.py | google/ffn | train | 295 |
232f0cc232bf0a59c7b6e8fad5bad360d9f29daa | [
"if data is None:\n self.n = int(n)\n self.p = float(p)\n if n <= 0:\n raise ValueError('n must be a positive value')\n self.n = int(n)\n if p <= 0 or p >= 1:\n raise ValueError('p must be greater than 0 and less than 1')\nelse:\n if not isinstance(data, list):\n raise TypeErr... | <|body_start_0|>
if data is None:
self.n = int(n)
self.p = float(p)
if n <= 0:
raise ValueError('n must be a positive value')
self.n = int(n)
if p <= 0 or p >= 1:
raise ValueError('p must be greater than 0 and less than ... | the binomial distribution class | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""the binomial distribution class"""
def __init__(self, data=None, n=1.0, p=0.5):
"""constructor for binomial distribution n trials, p prob for success"""
<|body_0|>
def pmf(self, k):
"""calculates pmf for k successes"""
<|body_1|>
def cdf... | stack_v2_sparse_classes_75kplus_train_006133 | 2,834 | no_license | [
{
"docstring": "constructor for binomial distribution n trials, p prob for success",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1.0, p=0.5)"
},
{
"docstring": "calculates pmf for k successes",
"name": "pmf",
"signature": "def pmf(self, k)"
},
{
"docstring":... | 4 | stack_v2_sparse_classes_30k_train_012731 | Implement the Python class `Binomial` described below.
Class description:
the binomial distribution class
Method signatures and docstrings:
- def __init__(self, data=None, n=1.0, p=0.5): constructor for binomial distribution n trials, p prob for success
- def pmf(self, k): calculates pmf for k successes
- def cdf(sel... | Implement the Python class `Binomial` described below.
Class description:
the binomial distribution class
Method signatures and docstrings:
- def __init__(self, data=None, n=1.0, p=0.5): constructor for binomial distribution n trials, p prob for success
- def pmf(self, k): calculates pmf for k successes
- def cdf(sel... | d86b0e0cae2dd07c761f84a493abc895007873ee | <|skeleton|>
class Binomial:
"""the binomial distribution class"""
def __init__(self, data=None, n=1.0, p=0.5):
"""constructor for binomial distribution n trials, p prob for success"""
<|body_0|>
def pmf(self, k):
"""calculates pmf for k successes"""
<|body_1|>
def cdf... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Binomial:
"""the binomial distribution class"""
def __init__(self, data=None, n=1.0, p=0.5):
"""constructor for binomial distribution n trials, p prob for success"""
if data is None:
self.n = int(n)
self.p = float(p)
if n <= 0:
raise Val... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | mag389/holbertonschool-machine_learning | train | 2 |
035cbc7f473045958567f8ba0ab9d3055302d069 | [
"ans = 0\nn = len(nums)\nif n == 1:\n return 0\nnn = nums\nfor _ in range(n):\n res = 0\n for i in range(n):\n res += nn[i] * i\n ans = max(ans, res)\n nn = nn[1:] + nn[:1]\nprint(ans)\nreturn ans",
"s = sum(nums)\nn = len(nums)\nf = [0] * n\nfor i in range(n):\n f[0] += i * nums[i]\nans ... | <|body_start_0|>
ans = 0
n = len(nums)
if n == 1:
return 0
nn = nums
for _ in range(n):
res = 0
for i in range(n):
res += nn[i] * i
ans = max(ans, res)
nn = nn[1:] + nn[:1]
print(ans)
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxRotateFunction_TLE(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxRotateFunction(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = 0
n = len(nums)... | stack_v2_sparse_classes_75kplus_train_006134 | 2,357 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxRotateFunction_TLE",
"signature": "def maxRotateFunction_TLE(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxRotateFunction",
"signature": "def maxRotateFunction(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053217 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxRotateFunction_TLE(self, nums): :type nums: List[int] :rtype: int
- def maxRotateFunction(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 maxRotateFunction_TLE(self, nums): :type nums: List[int] :rtype: int
- def maxRotateFunction(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
... | 2d5fa4cd696d5035ea8859befeadc5cc436959c9 | <|skeleton|>
class Solution:
def maxRotateFunction_TLE(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxRotateFunction(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxRotateFunction_TLE(self, nums):
""":type nums: List[int] :rtype: int"""
ans = 0
n = len(nums)
if n == 1:
return 0
nn = nums
for _ in range(n):
res = 0
for i in range(n):
res += nn[i] * i
... | the_stack_v2_python_sparse | SourceCode/Python/Problem/00396.Rotate Function.py | roger6blog/LeetCode | train | 0 | |
42d2f29674fc6dc17a50df35f73393da2e3e96fc | [
"self.__person_repository = person_repository\nself.__unit_of_work = unit_of_work\nself.__event_bus = event_bus",
"person_id = PersonId(create_person_command.id)\nname = Name(create_person_command.name)\nlast_name = LastName(create_person_command.last_name)\nsecond_last_name = SecondLastName(create_person_command... | <|body_start_0|>
self.__person_repository = person_repository
self.__unit_of_work = unit_of_work
self.__event_bus = event_bus
<|end_body_0|>
<|body_start_1|>
person_id = PersonId(create_person_command.id)
name = Name(create_person_command.name)
last_name = LastName(creat... | Person Creator | PersonCreator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonCreator:
"""Person Creator"""
def __init__(self, person_repository: PersonRepository, unit_of_work: UnitOfWork, event_bus: EventBus):
"""Person Creator @param person_repository: @type person_repository: @param unit_of_work: @type unit_of_work:"""
<|body_0|>
def __c... | stack_v2_sparse_classes_75kplus_train_006135 | 2,620 | permissive | [
{
"docstring": "Person Creator @param person_repository: @type person_repository: @param unit_of_work: @type unit_of_work:",
"name": "__init__",
"signature": "def __init__(self, person_repository: PersonRepository, unit_of_work: UnitOfWork, event_bus: EventBus)"
},
{
"docstring": "Create Person ... | 2 | stack_v2_sparse_classes_30k_train_004348 | Implement the Python class `PersonCreator` described below.
Class description:
Person Creator
Method signatures and docstrings:
- def __init__(self, person_repository: PersonRepository, unit_of_work: UnitOfWork, event_bus: EventBus): Person Creator @param person_repository: @type person_repository: @param unit_of_wor... | Implement the Python class `PersonCreator` described below.
Class description:
Person Creator
Method signatures and docstrings:
- def __init__(self, person_repository: PersonRepository, unit_of_work: UnitOfWork, event_bus: EventBus): Person Creator @param person_repository: @type person_repository: @param unit_of_wor... | 8055927cb460bc40f3a2651c01a9d1da696177e8 | <|skeleton|>
class PersonCreator:
"""Person Creator"""
def __init__(self, person_repository: PersonRepository, unit_of_work: UnitOfWork, event_bus: EventBus):
"""Person Creator @param person_repository: @type person_repository: @param unit_of_work: @type unit_of_work:"""
<|body_0|>
def __c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PersonCreator:
"""Person Creator"""
def __init__(self, person_repository: PersonRepository, unit_of_work: UnitOfWork, event_bus: EventBus):
"""Person Creator @param person_repository: @type person_repository: @param unit_of_work: @type unit_of_work:"""
self.__person_repository = person_re... | the_stack_v2_python_sparse | modules/persons/application/create/person_creator.py | eduardolujan/hexagonal_architecture_django | train | 5 |
581ec5db4a01dac41a9d66756a7b5da45b83e275 | [
"namespaces = {'xsi': LT_XSI_NS}\nschemaLocation = etree.QName(LT_XSI_NS, 'schemaLocation')\npayload = etree.Element('RTML', {schemaLocation: LT_SCHEMA_LOCATION}, xmlns=LT_XML_NS, mode='request', uid=format(str(request.id)), version='3.1a', nsmap=namespaces)\nreturn payload",
"altdata = request.allocation.altdata... | <|body_start_0|>
namespaces = {'xsi': LT_XSI_NS}
schemaLocation = etree.QName(LT_XSI_NS, 'schemaLocation')
payload = etree.Element('RTML', {schemaLocation: LT_SCHEMA_LOCATION}, xmlns=LT_XML_NS, mode='request', uid=format(str(request.id)), version='3.1a', nsmap=namespaces)
return payload
... | An XML structure for LT requests. | LTRequest | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LTRequest:
"""An XML structure for LT requests."""
def _build_prolog(self, request):
"""Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests."""
<|body_0|>
def _build_project(self, payload, request):
... | stack_v2_sparse_classes_75kplus_train_006136 | 27,052 | permissive | [
{
"docstring": "Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.",
"name": "_build_prolog",
"signature": "def _build_prolog(self, request)"
},
{
"docstring": "Payload header for all LT queue requests. Parameters ---------- payl... | 4 | stack_v2_sparse_classes_30k_train_051642 | Implement the Python class `LTRequest` described below.
Class description:
An XML structure for LT requests.
Method signatures and docstrings:
- def _build_prolog(self, request): Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.
- def _build_project(... | Implement the Python class `LTRequest` described below.
Class description:
An XML structure for LT requests.
Method signatures and docstrings:
- def _build_prolog(self, request): Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests.
- def _build_project(... | 161d3532ba3ba059446addcdac58ca96f39e9636 | <|skeleton|>
class LTRequest:
"""An XML structure for LT requests."""
def _build_prolog(self, request):
"""Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests."""
<|body_0|>
def _build_project(self, payload, request):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LTRequest:
"""An XML structure for LT requests."""
def _build_prolog(self, request):
"""Payload outline for all LT queue requests. Returns ---------- payload: etree.Element payload outline for LT requests."""
namespaces = {'xsi': LT_XSI_NS}
schemaLocation = etree.QName(LT_XSI_NS, ... | the_stack_v2_python_sparse | skyportal/facility_apis/lt.py | skyportal/skyportal | train | 80 |
5517b21befbc475c798db26286b46a79e8f7b66b | [
"self.n = ZZ(n)\nself.m = m\nself.__i = 0\nself.K = IntegerModRing(q)\nself.FM = FreeModule(self.K, n)\nself.D = D\nself.secret_dist = secret_dist\nif secret_dist == 'uniform':\n self.__s = random_vector(self.K, self.n)\nelif secret_dist == 'noise':\n self.__s = vector(self.K, self.n, [self.D() for _ in range... | <|body_start_0|>
self.n = ZZ(n)
self.m = m
self.__i = 0
self.K = IntegerModRing(q)
self.FM = FreeModule(self.K, n)
self.D = D
self.secret_dist = secret_dist
if secret_dist == 'uniform':
self.__s = random_vector(self.K, self.n)
elif secr... | Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__ | LWE | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LWE:
"""Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__"""
def __init__(self, n, q, D, secret_dist='uniform', m=None):
"""Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimensi... | stack_v2_sparse_classes_75kplus_train_006137 | 31,769 | no_license | [
{
"docstring": "Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimension (integer > 0) - ``q`` - modulus typically > n (integer > 0) - ``D`` - an error distribution such as an instance of :class:`DiscreteGaussianDistributionIntegerSampler` o... | 3 | stack_v2_sparse_classes_30k_train_054113 | Implement the Python class `LWE` described below.
Class description:
Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__
Method signatures and docstrings:
- def __init__(self, n, q, D, secret_dist='uniform', m=None): Construct an LWE oracle in dimension ``n`` over a ring of order ``q`... | Implement the Python class `LWE` described below.
Class description:
Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__
Method signatures and docstrings:
- def __init__(self, n, q, D, secret_dist='uniform', m=None): Construct an LWE oracle in dimension ``n`` over a ring of order ``q`... | 0d9eacbf74e2acffefde93e39f8bcbec745cdaba | <|skeleton|>
class LWE:
"""Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__"""
def __init__(self, n, q, D, secret_dist='uniform', m=None):
"""Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimensi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LWE:
"""Learning with Errors (LWE) oracle. .. automethod:: __init__ .. automethod:: __call__"""
def __init__(self, n, q, D, secret_dist='uniform', m=None):
"""Construct an LWE oracle in dimension ``n`` over a ring of order ``q`` with noise distribution ``D``. INPUT: - ``n`` - dimension (integer >... | the_stack_v2_python_sparse | sage/src/sage/crypto/lwe.py | bopopescu/geosci | train | 0 |
ee705ebbb7578e8b30c3adf5e0d4541989402a91 | [
"hook_id = kwargs['hook']\ntest_id = kwargs['test']\nhook = Hook.objects.get(pk=hook_id)\ntest = TestCase.objects.get(pk=test_id)\nhook.tests.add(test)\nserializer1 = HookSerializer(instance=hook)\nreturn Response(serializer1.data, status=status.HTTP_201_CREATED)",
"hook_id = kwargs['hook']\ntest_id = kwargs['tes... | <|body_start_0|>
hook_id = kwargs['hook']
test_id = kwargs['test']
hook = Hook.objects.get(pk=hook_id)
test = TestCase.objects.get(pk=test_id)
hook.tests.add(test)
serializer1 = HookSerializer(instance=hook)
return Response(serializer1.data, status=status.HTTP_201... | HookAndTestCaseView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HookAndTestCaseView:
def post(self, request, *args, **kwargs):
"""Create association between test and hook"""
<|body_0|>
def delete(self, request, *args, **kwargs):
"""Delete association between test and hook"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_006138 | 1,497 | no_license | [
{
"docstring": "Create association between test and hook",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "Delete association between test and hook",
"name": "delete",
"signature": "def delete(self, request, *args, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027522 | Implement the Python class `HookAndTestCaseView` described below.
Class description:
Implement the HookAndTestCaseView class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Create association between test and hook
- def delete(self, request, *args, **kwargs): Delete association between ... | Implement the Python class `HookAndTestCaseView` described below.
Class description:
Implement the HookAndTestCaseView class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): Create association between test and hook
- def delete(self, request, *args, **kwargs): Delete association between ... | 2885edcf91ad887505850ae5d0ef7f65dbebef34 | <|skeleton|>
class HookAndTestCaseView:
def post(self, request, *args, **kwargs):
"""Create association between test and hook"""
<|body_0|>
def delete(self, request, *args, **kwargs):
"""Delete association between test and hook"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HookAndTestCaseView:
def post(self, request, *args, **kwargs):
"""Create association between test and hook"""
hook_id = kwargs['hook']
test_id = kwargs['test']
hook = Hook.objects.get(pk=hook_id)
test = TestCase.objects.get(pk=test_id)
hook.tests.add(test)
... | the_stack_v2_python_sparse | asura/hooks/views.py | EtheriousNatsu/asura-web | train | 0 | |
105672e66eb8bee3a5cfb49e473e97e855b6ed28 | [
"task_qs = Task.objects.select_related('manager').prefetch_related('agent_list').filter(id=pk)\nif len(task_qs) < 1:\n return Response({'detail': 'Task not found!'}, status=400)\ntask = task_qs[0]\nself.check_object_permissions(request, task)\ntask_data = get_task_details(task)\nreturn Response(task_data, status... | <|body_start_0|>
task_qs = Task.objects.select_related('manager').prefetch_related('agent_list').filter(id=pk)
if len(task_qs) < 1:
return Response({'detail': 'Task not found!'}, status=400)
task = task_qs[0]
self.check_object_permissions(request, task)
task_data = ge... | TaskViewSetAgent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskViewSetAgent:
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, "images": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agent_... | stack_v2_sparse_classes_75kplus_train_006139 | 22,163 | no_license | [
{
"docstring": "Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, \"images\": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agent_list': [50, 51], 'manager': 'name', 'custom_fields': [], 'address': 'addr... | 4 | stack_v2_sparse_classes_30k_train_031609 | Implement the Python class `TaskViewSetAgent` described below.
Class description:
Implement the TaskViewSetAgent class.
Method signatures and docstrings:
- def retrieve(self, request, pk, format=None): Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'star... | Implement the Python class `TaskViewSetAgent` described below.
Class description:
Implement the TaskViewSetAgent class.
Method signatures and docstrings:
- def retrieve(self, request, pk, format=None): Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'star... | 11be165f85cda0ffe7a237d011de562d3dc64135 | <|skeleton|>
class TaskViewSetAgent:
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, "images": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agent_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TaskViewSetAgent:
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, "images": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agent_list': [50, 51... | the_stack_v2_python_sparse | apps/task/views.py | ash018/FFTracker | train | 0 | |
24c0eca60e4b90b60e8991bbd27f5d587f97dfc2 | [
"pc = DotDict()\nf2jd = copy.deepcopy(cannonical_json_dump)\npc.upload_file_minidump_flash2 = DotDict()\npc.upload_file_minidump_flash2.json_dump = f2jd\npc.upload_file_minidump_flash2.json_dump['threads'][0]['frames'][1]['function'] = 'NtUserPeekMessage'\npc.upload_file_minidump_flash2.json_dump['threads'][0]['fra... | <|body_start_0|>
pc = DotDict()
f2jd = copy.deepcopy(cannonical_json_dump)
pc.upload_file_minidump_flash2 = DotDict()
pc.upload_file_minidump_flash2.json_dump = f2jd
pc.upload_file_minidump_flash2.json_dump['threads'][0]['frames'][1]['function'] = 'NtUserPeekMessage'
pc.u... | TestBug812318 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestBug812318:
def test_action_case_1(self):
"""success - both targets found in top 5 frames of stack"""
<|body_0|>
def test_action_case_2(self):
"""success - only 1st target found in top 5 frames of stack"""
<|body_1|>
def test_action_case_3(self):
... | stack_v2_sparse_classes_75kplus_train_006140 | 27,276 | no_license | [
{
"docstring": "success - both targets found in top 5 frames of stack",
"name": "test_action_case_1",
"signature": "def test_action_case_1(self)"
},
{
"docstring": "success - only 1st target found in top 5 frames of stack",
"name": "test_action_case_2",
"signature": "def test_action_case... | 3 | stack_v2_sparse_classes_30k_train_014551 | Implement the Python class `TestBug812318` described below.
Class description:
Implement the TestBug812318 class.
Method signatures and docstrings:
- def test_action_case_1(self): success - both targets found in top 5 frames of stack
- def test_action_case_2(self): success - only 1st target found in top 5 frames of s... | Implement the Python class `TestBug812318` described below.
Class description:
Implement the TestBug812318 class.
Method signatures and docstrings:
- def test_action_case_1(self): success - both targets found in top 5 frames of stack
- def test_action_case_2(self): success - only 1st target found in top 5 frames of s... | 9c9b7701d7ddf9f3cbba1a4d0aa65758e8b49528 | <|skeleton|>
class TestBug812318:
def test_action_case_1(self):
"""success - both targets found in top 5 frames of stack"""
<|body_0|>
def test_action_case_2(self):
"""success - only 1st target found in top 5 frames of stack"""
<|body_1|>
def test_action_case_3(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestBug812318:
def test_action_case_1(self):
"""success - both targets found in top 5 frames of stack"""
pc = DotDict()
f2jd = copy.deepcopy(cannonical_json_dump)
pc.upload_file_minidump_flash2 = DotDict()
pc.upload_file_minidump_flash2.json_dump = f2jd
pc.uploa... | the_stack_v2_python_sparse | socorro/unittest/processor/test_skunk_classifiers.py | v1ka5/socorro | train | 0 | |
a4989dd2ed22b287f2fe0543d3888aa50fbeed93 | [
"query = Exercise.get_query(info)\nif author:\n user = UserModel.find_by_username(author)\n return query.order_by(ExerciseModel.name.desc()).filter(ExerciseModel.author == user.id).all()\nreturn query.all()",
"query = Exercise.get_query(info)\nif id:\n return query.filter(ExerciseModel.id == id).first()\... | <|body_start_0|>
query = Exercise.get_query(info)
if author:
user = UserModel.find_by_username(author)
return query.order_by(ExerciseModel.name.desc()).filter(ExerciseModel.author == user.id).all()
return query.all()
<|end_body_0|>
<|body_start_1|>
query = Exerci... | Query | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Query:
def resolve_exercises(root, info, author=None):
"""Return a list of all exercises. Search by author: A user's username."""
<|body_0|>
def resolve_exercise(root, info, id=None, name=None, desc=None):
"""Return a single exercise by id."""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus_train_006141 | 1,111 | no_license | [
{
"docstring": "Return a list of all exercises. Search by author: A user's username.",
"name": "resolve_exercises",
"signature": "def resolve_exercises(root, info, author=None)"
},
{
"docstring": "Return a single exercise by id.",
"name": "resolve_exercise",
"signature": "def resolve_exe... | 2 | stack_v2_sparse_classes_30k_train_022677 | Implement the Python class `Query` described below.
Class description:
Implement the Query class.
Method signatures and docstrings:
- def resolve_exercises(root, info, author=None): Return a list of all exercises. Search by author: A user's username.
- def resolve_exercise(root, info, id=None, name=None, desc=None): ... | Implement the Python class `Query` described below.
Class description:
Implement the Query class.
Method signatures and docstrings:
- def resolve_exercises(root, info, author=None): Return a list of all exercises. Search by author: A user's username.
- def resolve_exercise(root, info, id=None, name=None, desc=None): ... | f0056da32453fce0a9dece90508fcdcad8cc905b | <|skeleton|>
class Query:
def resolve_exercises(root, info, author=None):
"""Return a list of all exercises. Search by author: A user's username."""
<|body_0|>
def resolve_exercise(root, info, id=None, name=None, desc=None):
"""Return a single exercise by id."""
<|body_1|>
<|e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Query:
def resolve_exercises(root, info, author=None):
"""Return a list of all exercises. Search by author: A user's username."""
query = Exercise.get_query(info)
if author:
user = UserModel.find_by_username(author)
return query.order_by(ExerciseModel.name.desc(... | the_stack_v2_python_sparse | stronk/schemas/exercise/query.py | not-monday/stronk-backend | train | 3 | |
5a0120925072d98797090bfecd93309a27a6f9f6 | [
"if kind not in ['start_date', 'end_date']:\n raise ValueError\nif dateval:\n setattr(self, 'partial_%s' % kind, dateval)\n if getattr(self, kind).year < 1919:\n setattr(self, '%s_precision' % kind, DatePrecision.month | DatePrecision.day)\nelif earliest and latest:\n setattr(self, kind, earliest... | <|body_start_0|>
if kind not in ['start_date', 'end_date']:
raise ValueError
if dateval:
setattr(self, 'partial_%s' % kind, dateval)
if getattr(self, kind).year < 1919:
setattr(self, '%s_precision' % kind, DatePrecision.month | DatePrecision.day)
... | Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`. | PartialDateMixin | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PartialDateMixin:
"""Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`."""
def calculate_date(self, kind, dateval=None, earliest=None, latest=None):
"""Calculate end or start date based on a single value in a sup... | stack_v2_sparse_classes_75kplus_train_006142 | 10,637 | permissive | [
{
"docstring": "Calculate end or start date based on a single value in a supported partial date form or based on earliest/latest datetime.",
"name": "calculate_date",
"signature": "def calculate_date(self, kind, dateval=None, earliest=None, latest=None)"
},
{
"docstring": "Borrowing event date r... | 2 | stack_v2_sparse_classes_30k_train_015269 | Implement the Python class `PartialDateMixin` described below.
Class description:
Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`.
Method signatures and docstrings:
- def calculate_date(self, kind, dateval=None, earliest=None, latest=None): Cal... | Implement the Python class `PartialDateMixin` described below.
Class description:
Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`.
Method signatures and docstrings:
- def calculate_date(self, kind, dateval=None, earliest=None, latest=None): Cal... | 6103855f07c2c0123ab21b93b794ea5d5ca39aa2 | <|skeleton|>
class PartialDateMixin:
"""Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`."""
def calculate_date(self, kind, dateval=None, earliest=None, latest=None):
"""Calculate end or start date based on a single value in a sup... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PartialDateMixin:
"""Mixin to add fields for partial start and end dates to a model using :class:`DatePrecisionField` and :class:`PartialDate`."""
def calculate_date(self, kind, dateval=None, earliest=None, latest=None):
"""Calculate end or start date based on a single value in a supported partia... | the_stack_v2_python_sparse | mep/accounts/partial_date.py | Princeton-CDH/mep-django | train | 6 |
947bb894473e2eb5b37295415f27abc6f7c81227 | [
"self.parsed_urls = []\nself.parsed_payloads = []\nreturn",
"if self.url_match.match(data):\n self.parsed_urls.append(data)\nif validators.sha256(data):\n self.parsed_payloads.append(data)\nreturn"
] | <|body_start_0|>
self.parsed_urls = []
self.parsed_payloads = []
return
<|end_body_0|>
<|body_start_1|>
if self.url_match.match(data):
self.parsed_urls.append(data)
if validators.sha256(data):
self.parsed_payloads.append(data)
return
<|end_body_1|... | HTML parser class | ParserHTML | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParserHTML:
"""HTML parser class"""
def reload(self):
"""Empty the list of URLs and payloads."""
<|body_0|>
def handle_data(self, data):
"""Feed source code to parser and extract URLs and hashes."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
s... | stack_v2_sparse_classes_75kplus_train_006143 | 8,066 | permissive | [
{
"docstring": "Empty the list of URLs and payloads.",
"name": "reload",
"signature": "def reload(self)"
},
{
"docstring": "Feed source code to parser and extract URLs and hashes.",
"name": "handle_data",
"signature": "def handle_data(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000360 | Implement the Python class `ParserHTML` described below.
Class description:
HTML parser class
Method signatures and docstrings:
- def reload(self): Empty the list of URLs and payloads.
- def handle_data(self, data): Feed source code to parser and extract URLs and hashes. | Implement the Python class `ParserHTML` described below.
Class description:
HTML parser class
Method signatures and docstrings:
- def reload(self): Empty the list of URLs and payloads.
- def handle_data(self, data): Feed source code to parser and extract URLs and hashes.
<|skeleton|>
class ParserHTML:
"""HTML pa... | 914232c99ca10bf0d42c560860c8c05d24485c75 | <|skeleton|>
class ParserHTML:
"""HTML parser class"""
def reload(self):
"""Empty the list of URLs and payloads."""
<|body_0|>
def handle_data(self, data):
"""Feed source code to parser and extract URLs and hashes."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ParserHTML:
"""HTML parser class"""
def reload(self):
"""Empty the list of URLs and payloads."""
self.parsed_urls = []
self.parsed_payloads = []
return
def handle_data(self, data):
"""Feed source code to parser and extract URLs and hashes."""
if self.u... | the_stack_v2_python_sparse | bin/urlhaus_api.py | lin0x/osweep | train | 0 |
8ee9228952ebb7ae54244773b81e0102447430fa | [
"x = tunable.x\nnew_x = tunable.clamp_into_domain(x * 1.1)\nif new_x == x:\n new_x = tunable.clamp_into_domain(x * 0.9)\n if new_x == x:\n raise RuntimeError('Unable to perturb x for secant solver.')\ntunable.x = new_x",
"counter = self._counters.get(tunable, 0) + 1\nif counter > self._max_allowable_... | <|body_start_0|>
x = tunable.x
new_x = tunable.clamp_into_domain(x * 1.1)
if new_x == x:
new_x = tunable.clamp_into_domain(x * 0.9)
if new_x == x:
raise RuntimeError('Unable to perturb x for secant solver.')
tunable.x = new_x
<|end_body_0|>
<|body... | Provides helper methods for solvers that require gradients. | _GradientHelper | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _GradientHelper:
"""Provides helper methods for solvers that require gradients."""
def _initialize_tuning(tunable):
"""Called when a tunable is passed for the first time to solver. Perturbs x to allow for the calculation of df/dx."""
<|body_0|>
def _handle_static_y(self,... | stack_v2_sparse_classes_75kplus_train_006144 | 22,981 | permissive | [
{
"docstring": "Called when a tunable is passed for the first time to solver. Perturbs x to allow for the calculation of df/dx.",
"name": "_initialize_tuning",
"signature": "def _initialize_tuning(tunable)"
},
{
"docstring": "Handles when y is constant for multiple calls to solve_one. We do noth... | 2 | null | Implement the Python class `_GradientHelper` described below.
Class description:
Provides helper methods for solvers that require gradients.
Method signatures and docstrings:
- def _initialize_tuning(tunable): Called when a tunable is passed for the first time to solver. Perturbs x to allow for the calculation of df/... | Implement the Python class `_GradientHelper` described below.
Class description:
Provides helper methods for solvers that require gradients.
Method signatures and docstrings:
- def _initialize_tuning(tunable): Called when a tunable is passed for the first time to solver. Perturbs x to allow for the calculation of df/... | abdd76bc854358426e4cf055badd27f80df6ec85 | <|skeleton|>
class _GradientHelper:
"""Provides helper methods for solvers that require gradients."""
def _initialize_tuning(tunable):
"""Called when a tunable is passed for the first time to solver. Perturbs x to allow for the calculation of df/dx."""
<|body_0|>
def _handle_static_y(self,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _GradientHelper:
"""Provides helper methods for solvers that require gradients."""
def _initialize_tuning(tunable):
"""Called when a tunable is passed for the first time to solver. Perturbs x to allow for the calculation of df/dx."""
x = tunable.x
new_x = tunable.clamp_into_domain... | the_stack_v2_python_sparse | hoomd/tune/solve.py | glotzerlab/hoomd-blue | train | 287 |
d9cbebe0e7da2584149a64dbe460117812bbc103 | [
"model = Battle\nserializer = BattleSerializer\nverbose_serializer = None\ndata_dict = request.GET.dict()\nif 'verbose' in data_dict and verbose_serializer:\n serializer = verbose_serializer\nif 'pk' in kwargs:\n data_dict['id'] = kwargs['pk']\nlimit, offset = get_limit_offset(request)\nq_filter = filter_from... | <|body_start_0|>
model = Battle
serializer = BattleSerializer
verbose_serializer = None
data_dict = request.GET.dict()
if 'verbose' in data_dict and verbose_serializer:
serializer = verbose_serializer
if 'pk' in kwargs:
data_dict['id'] = kwargs['pk... | BattleApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BattleApi:
def get(self, request, *args, **kwargs):
"""If no pk is passed in the URL, a filtered list is returned Otherwise the record of the request id is returned"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""If no pk is passed in the URL, a new record... | stack_v2_sparse_classes_75kplus_train_006145 | 8,170 | no_license | [
{
"docstring": "If no pk is passed in the URL, a filtered list is returned Otherwise the record of the request id is returned",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "If no pk is passed in the URL, a new record is created Otherwise the record of ... | 2 | stack_v2_sparse_classes_30k_train_045296 | Implement the Python class `BattleApi` described below.
Class description:
Implement the BattleApi class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): If no pk is passed in the URL, a filtered list is returned Otherwise the record of the request id is returned
- def post(self, request,... | Implement the Python class `BattleApi` described below.
Class description:
Implement the BattleApi class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): If no pk is passed in the URL, a filtered list is returned Otherwise the record of the request id is returned
- def post(self, request,... | 76f5c407d9513ccc5a48a91dd4d8838ee716e889 | <|skeleton|>
class BattleApi:
def get(self, request, *args, **kwargs):
"""If no pk is passed in the URL, a filtered list is returned Otherwise the record of the request id is returned"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""If no pk is passed in the URL, a new record... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BattleApi:
def get(self, request, *args, **kwargs):
"""If no pk is passed in the URL, a filtered list is returned Otherwise the record of the request id is returned"""
model = Battle
serializer = BattleSerializer
verbose_serializer = None
data_dict = request.GET.dict()
... | the_stack_v2_python_sparse | ptmo/myfarog/views.py | kwstewart/ptmo | train | 0 | |
dcb3401a9110b7c3383f2bb9d596bd8f0e54e97d | [
"outputs = sorted(StreamAlertOutput.get_all_outputs().keys())\ngenerate_skeleton_parser = generate_subparser(subparser, 'generate-skeleton', description=cls.description, help=cls.description, subcommand=True)\ngenerate_skeleton_parser.add_argument('--services', choices=outputs, nargs='+', metavar='SERVICE', default... | <|body_start_0|>
outputs = sorted(StreamAlertOutput.get_all_outputs().keys())
generate_skeleton_parser = generate_subparser(subparser, 'generate-skeleton', description=cls.description, help=cls.description, subcommand=True)
generate_skeleton_parser.add_argument('--services', choices=outputs, nar... | OutputGenerateSkeletonSubCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutputGenerateSkeletonSubCommand:
def setup_subparser(cls, subparser):
"""Add generate-skeleton subparser to the output subparser"""
<|body_0|>
def handler(cls, options, config):
"""Generate a skeleton file for use with set-from-file Args: options (argparse.Namespace... | stack_v2_sparse_classes_75kplus_train_006146 | 19,044 | permissive | [
{
"docstring": "Add generate-skeleton subparser to the output subparser",
"name": "setup_subparser",
"signature": "def setup_subparser(cls, subparser)"
},
{
"docstring": "Generate a skeleton file for use with set-from-file Args: options (argparse.Namespace): Basically a namedtuple with the servi... | 2 | stack_v2_sparse_classes_30k_test_002200 | Implement the Python class `OutputGenerateSkeletonSubCommand` described below.
Class description:
Implement the OutputGenerateSkeletonSubCommand class.
Method signatures and docstrings:
- def setup_subparser(cls, subparser): Add generate-skeleton subparser to the output subparser
- def handler(cls, options, config): ... | Implement the Python class `OutputGenerateSkeletonSubCommand` described below.
Class description:
Implement the OutputGenerateSkeletonSubCommand class.
Method signatures and docstrings:
- def setup_subparser(cls, subparser): Add generate-skeleton subparser to the output subparser
- def handler(cls, options, config): ... | 75ba140d2e1aa6e903313d88326920adcb8bff45 | <|skeleton|>
class OutputGenerateSkeletonSubCommand:
def setup_subparser(cls, subparser):
"""Add generate-skeleton subparser to the output subparser"""
<|body_0|>
def handler(cls, options, config):
"""Generate a skeleton file for use with set-from-file Args: options (argparse.Namespace... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OutputGenerateSkeletonSubCommand:
def setup_subparser(cls, subparser):
"""Add generate-skeleton subparser to the output subparser"""
outputs = sorted(StreamAlertOutput.get_all_outputs().keys())
generate_skeleton_parser = generate_subparser(subparser, 'generate-skeleton', description=cl... | the_stack_v2_python_sparse | streamalert_cli/outputs/handler.py | avmi/streamalert | train | 0 | |
02a1e8b6ec1c0c542df60f019bff255dba1309fa | [
"alipay = Alipay(pid=settings.ALIPAY_PID, key=settings.ALIPAY_KEY, seller_email=settings.ALIPAY_EMAIL)\nif not alipay.verify_notify(**request.GET.dict()):\n return HttpResponseForbidden()\ncode, payment_type = request.GET['out_trade_no'].split('_')\norder = Order.objects.get(code=code)\npayment = Payment()\npaym... | <|body_start_0|>
alipay = Alipay(pid=settings.ALIPAY_PID, key=settings.ALIPAY_KEY, seller_email=settings.ALIPAY_EMAIL)
if not alipay.verify_notify(**request.GET.dict()):
return HttpResponseForbidden()
code, payment_type = request.GET['out_trade_no'].split('_')
order = Order.o... | Payment success. return_url for Alipay. | SuccessView | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SuccessView:
"""Payment success. return_url for Alipay."""
def get2(self, request, *args, **kwargs):
"""Verify notify"""
<|body_0|>
def get_context_data2(self, **kwargs):
"""Add extra data to the context"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_006147 | 8,035 | permissive | [
{
"docstring": "Verify notify",
"name": "get2",
"signature": "def get2(self, request, *args, **kwargs)"
},
{
"docstring": "Add extra data to the context",
"name": "get_context_data2",
"signature": "def get_context_data2(self, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026320 | Implement the Python class `SuccessView` described below.
Class description:
Payment success. return_url for Alipay.
Method signatures and docstrings:
- def get2(self, request, *args, **kwargs): Verify notify
- def get_context_data2(self, **kwargs): Add extra data to the context | Implement the Python class `SuccessView` described below.
Class description:
Payment success. return_url for Alipay.
Method signatures and docstrings:
- def get2(self, request, *args, **kwargs): Verify notify
- def get_context_data2(self, **kwargs): Add extra data to the context
<|skeleton|>
class SuccessView:
"... | 0ea016745d92054bd4df8d934c1b67fd61b6f845 | <|skeleton|>
class SuccessView:
"""Payment success. return_url for Alipay."""
def get2(self, request, *args, **kwargs):
"""Verify notify"""
<|body_0|>
def get_context_data2(self, **kwargs):
"""Add extra data to the context"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SuccessView:
"""Payment success. return_url for Alipay."""
def get2(self, request, *args, **kwargs):
"""Verify notify"""
alipay = Alipay(pid=settings.ALIPAY_PID, key=settings.ALIPAY_KEY, seller_email=settings.ALIPAY_EMAIL)
if not alipay.verify_notify(**request.GET.dict()):
... | the_stack_v2_python_sparse | payments/views.py | ygrass/handsome | train | 0 |
affd4533183535bde040675c3e0763d6a39c516d | [
"kernel_size = [kernel_size, kernel_size] if isinstance(kernel_size, int) else kernel_size\ndimensions = ModuleDimensions(features=int(np.prod(kernel_size)), in_channel=shapley_module.dimensions.in_channel, out_channel=shapley_module.dimensions.out_channel)\nsuper(ShallowConvShapleyNetwork, self).__init__(dimension... | <|body_start_0|>
kernel_size = [kernel_size, kernel_size] if isinstance(kernel_size, int) else kernel_size
dimensions = ModuleDimensions(features=int(np.prod(kernel_size)), in_channel=shapley_module.dimensions.in_channel, out_channel=shapley_module.dimensions.out_channel)
super(ShallowConvShaple... | This is as described in the paper under paragraph \\paragraph{Deep {\\sc ShapNet} for Images} We simply swap the matrix multiplication in convolutional layers, and substitute in the Shapley Modules This is implemented by utilizing PyTorch's nn.Unfold and nn.Fold modules | ShallowConvShapleyNetwork | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShallowConvShapleyNetwork:
"""This is as described in the paper under paragraph \\paragraph{Deep {\\sc ShapNet} for Images} We simply swap the matrix multiplication in convolutional layers, and substitute in the Shapley Modules This is implemented by utilizing PyTorch's nn.Unfold and nn.Fold modu... | stack_v2_sparse_classes_75kplus_train_006148 | 12,568 | permissive | [
{
"docstring": "The instantiation function The arguments including kernel_size, dilation, padding and stride are following the convention of nn.Conv2d Args: shapley_module (): the Shapley Module with which the matrix multiplication in convolution is replaced. reference_values (): the reference values for the ba... | 3 | null | Implement the Python class `ShallowConvShapleyNetwork` described below.
Class description:
This is as described in the paper under paragraph \\paragraph{Deep {\\sc ShapNet} for Images} We simply swap the matrix multiplication in convolutional layers, and substitute in the Shapley Modules This is implemented by utilizi... | Implement the Python class `ShallowConvShapleyNetwork` described below.
Class description:
This is as described in the paper under paragraph \\paragraph{Deep {\\sc ShapNet} for Images} We simply swap the matrix multiplication in convolutional layers, and substitute in the Shapley Modules This is implemented by utilizi... | cab6644677894f0ac88610d2f9cfca239068f403 | <|skeleton|>
class ShallowConvShapleyNetwork:
"""This is as described in the paper under paragraph \\paragraph{Deep {\\sc ShapNet} for Images} We simply swap the matrix multiplication in convolutional layers, and substitute in the Shapley Modules This is implemented by utilizing PyTorch's nn.Unfold and nn.Fold modu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShallowConvShapleyNetwork:
"""This is as described in the paper under paragraph \\paragraph{Deep {\\sc ShapNet} for Images} We simply swap the matrix multiplication in convolutional layers, and substitute in the Shapley Modules This is implemented by utilizing PyTorch's nn.Unfold and nn.Fold modules"""
d... | the_stack_v2_python_sparse | ShapNet/vision.py | Tzq2doc/ShapleyExplanationNetworks | train | 0 |
af9a0485da0352e489101eb0b9a9487f30618c6d | [
"affinityPropagation = AffinityPropagation(affinity='precomputed').fit(self.affinity)\nself.nClusters = len(affinityPropagation.cluster_centers_indices_)\nself.clusterLabels = affinityPropagation.labels_\nself.affinityPropagation = affinityPropagation\nself.confusionMatrix = confusion_matrix(self.trueLabels, self.c... | <|body_start_0|>
affinityPropagation = AffinityPropagation(affinity='precomputed').fit(self.affinity)
self.nClusters = len(affinityPropagation.cluster_centers_indices_)
self.clusterLabels = affinityPropagation.labels_
self.affinityPropagation = affinityPropagation
self.confusionM... | Run affinity propagation cluster analysis. | AffinityPropagationAnalysis | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AffinityPropagationAnalysis:
"""Run affinity propagation cluster analysis."""
def cluster(self):
"""Interface to affinity propagation clustering. @return: An C{sklearn.cluster.AffinityPropagation} instance."""
<|body_0|>
def print_(self, margin='', result=None):
... | stack_v2_sparse_classes_75kplus_train_006149 | 9,448 | no_license | [
{
"docstring": "Interface to affinity propagation clustering. @return: An C{sklearn.cluster.AffinityPropagation} instance.",
"name": "cluster",
"signature": "def cluster(self)"
},
{
"docstring": "Print details of the clustering. @param margin: A C{str} that should be inserted at the start of eac... | 2 | null | Implement the Python class `AffinityPropagationAnalysis` described below.
Class description:
Run affinity propagation cluster analysis.
Method signatures and docstrings:
- def cluster(self): Interface to affinity propagation clustering. @return: An C{sklearn.cluster.AffinityPropagation} instance.
- def print_(self, m... | Implement the Python class `AffinityPropagationAnalysis` described below.
Class description:
Run affinity propagation cluster analysis.
Method signatures and docstrings:
- def cluster(self): Interface to affinity propagation clustering. @return: An C{sklearn.cluster.AffinityPropagation} instance.
- def print_(self, m... | 3e848dfa66f5fd07f1fb709abc935baff9f43d87 | <|skeleton|>
class AffinityPropagationAnalysis:
"""Run affinity propagation cluster analysis."""
def cluster(self):
"""Interface to affinity propagation clustering. @return: An C{sklearn.cluster.AffinityPropagation} instance."""
<|body_0|>
def print_(self, margin='', result=None):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AffinityPropagationAnalysis:
"""Run affinity propagation cluster analysis."""
def cluster(self):
"""Interface to affinity propagation clustering. @return: An C{sklearn.cluster.AffinityPropagation} instance."""
affinityPropagation = AffinityPropagation(affinity='precomputed').fit(self.affi... | the_stack_v2_python_sparse | light/performance/cluster.py | acorg/light-matter | train | 0 |
a1871b6b3dab5b11caefe733d2f3894f904667d2 | [
"exp_uid = request.json['exp_uid']\nexp_key = request.json['exp_key']\nif not keychain.verify_exp_key(exp_uid, exp_key):\n return (api_util.attach_meta({}, api_util.verification_error), 200)\ntarget_blob = request.json['target_blob']\ncurrent_target_mapping = targetmapper.create_target_mapping(exp_uid, target_bl... | <|body_start_0|>
exp_uid = request.json['exp_uid']
exp_key = request.json['exp_key']
if not keychain.verify_exp_key(exp_uid, exp_key):
return (api_util.attach_meta({}, api_util.verification_error), 200)
target_blob = request.json['target_blob']
current_target_mapping ... | Targets | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Targets:
def post(self):
"""Requires a exp_uid, exp_key, n, and target_blob to create target map. USAGE BELOW DEPRECIATED Usage: :: POST { 'app_id': application id, 'exp_id': experiment id, 'exp_key': experiment key, 'args': application specific keys }"""
<|body_0|>
def get(... | stack_v2_sparse_classes_75kplus_train_006150 | 2,505 | permissive | [
{
"docstring": "Requires a exp_uid, exp_key, n, and target_blob to create target map. USAGE BELOW DEPRECIATED Usage: :: POST { 'app_id': application id, 'exp_id': experiment id, 'exp_key': experiment key, 'args': application specific keys }",
"name": "post",
"signature": "def post(self)"
},
{
"d... | 2 | null | Implement the Python class `Targets` described below.
Class description:
Implement the Targets class.
Method signatures and docstrings:
- def post(self): Requires a exp_uid, exp_key, n, and target_blob to create target map. USAGE BELOW DEPRECIATED Usage: :: POST { 'app_id': application id, 'exp_id': experiment id, 'e... | Implement the Python class `Targets` described below.
Class description:
Implement the Targets class.
Method signatures and docstrings:
- def post(self): Requires a exp_uid, exp_key, n, and target_blob to create target map. USAGE BELOW DEPRECIATED Usage: :: POST { 'app_id': application id, 'exp_id': experiment id, 'e... | 2fcd8df29d274c86276bb5a039f7e61f201ebf61 | <|skeleton|>
class Targets:
def post(self):
"""Requires a exp_uid, exp_key, n, and target_blob to create target map. USAGE BELOW DEPRECIATED Usage: :: POST { 'app_id': application id, 'exp_id': experiment id, 'exp_key': experiment key, 'args': application specific keys }"""
<|body_0|>
def get(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Targets:
def post(self):
"""Requires a exp_uid, exp_key, n, and target_blob to create target map. USAGE BELOW DEPRECIATED Usage: :: POST { 'app_id': application id, 'exp_id': experiment id, 'exp_key': experiment key, 'args': application specific keys }"""
exp_uid = request.json['exp_uid']
... | the_stack_v2_python_sparse | next/api/resources/targets.py | kgjamieson/NEXT-psych | train | 4 | |
b05a6ab488b278b2517584bf4ef8c76a5461e8d5 | [
"self.reqparse = reqparse.RequestParser()\nself.reqparse.add_argument('username', type=str, required=True, help='Username not given, provide password as well')\nself.reqparse.add_argument('email', type=str, required=False, help='email not given')\nself.reqparse.add_argument('contact', type=str, required=False, help... | <|body_start_0|>
self.reqparse = reqparse.RequestParser()
self.reqparse.add_argument('username', type=str, required=True, help='Username not given, provide password as well')
self.reqparse.add_argument('email', type=str, required=False, help='email not given')
self.reqparse.add_argument(... | class logs in registred user | LoginUser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginUser:
"""class logs in registred user"""
def __init__(self):
"""constructor method for login class"""
<|body_0|>
def post(self):
"""method logs in user"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.reqparse = reqparse.RequestParser()... | stack_v2_sparse_classes_75kplus_train_006151 | 4,568 | no_license | [
{
"docstring": "constructor method for login class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "method logs in user",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008457 | Implement the Python class `LoginUser` described below.
Class description:
class logs in registred user
Method signatures and docstrings:
- def __init__(self): constructor method for login class
- def post(self): method logs in user | Implement the Python class `LoginUser` described below.
Class description:
class logs in registred user
Method signatures and docstrings:
- def __init__(self): constructor method for login class
- def post(self): method logs in user
<|skeleton|>
class LoginUser:
"""class logs in registred user"""
def __init... | 9af0b1c029279a9fc0ea6047e9d45fcf7d51f22e | <|skeleton|>
class LoginUser:
"""class logs in registred user"""
def __init__(self):
"""constructor method for login class"""
<|body_0|>
def post(self):
"""method logs in user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoginUser:
"""class logs in registred user"""
def __init__(self):
"""constructor method for login class"""
self.reqparse = reqparse.RequestParser()
self.reqparse.add_argument('username', type=str, required=True, help='Username not given, provide password as well')
self.req... | the_stack_v2_python_sparse | api/views/userview.py | billkabanga/fast-food-fast-2 | train | 2 |
6e27f7b8c62d9a9632620af1d831dbe069c94492 | [
"super(Encoder, self).__init__()\nself.dm = dm\nself.N = N\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",... | <|body_start_0|>
super(Encoder, self).__init__()
self.dm = dm
self.N = N
self.embedding = tf.keras.layers.Embedding(input_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, self.dm)
self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N... | Encoder represents a Transformers encoder layer | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Encoder represents a Transformers encoder layer"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""Encoder represents a Transformers encoder layer"""
<|body_0|>
def call(self, x, training, mask):
"""This calls the enc... | stack_v2_sparse_classes_75kplus_train_006152 | 1,422 | no_license | [
{
"docstring": "Encoder represents a Transformers encoder layer",
"name": "__init__",
"signature": "def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1)"
},
{
"docstring": "This calls the encoder algo and returns encoder output",
"name": "call",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_049543 | Implement the Python class `Encoder` described below.
Class description:
Encoder represents a Transformers encoder layer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Encoder represents a Transformers encoder layer
- def call(self, x, training, mask... | Implement the Python class `Encoder` described below.
Class description:
Encoder represents a Transformers encoder layer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): Encoder represents a Transformers encoder layer
- def call(self, x, training, mask... | 05eabebe5e5c050b1c4a7e1454b947638d883176 | <|skeleton|>
class Encoder:
"""Encoder represents a Transformers encoder layer"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""Encoder represents a Transformers encoder layer"""
<|body_0|>
def call(self, x, training, mask):
"""This calls the enc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
"""Encoder represents a Transformers encoder layer"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""Encoder represents a Transformers encoder layer"""
super(Encoder, self).__init__()
self.dm = dm
self.N = N
self.embeddin... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/9-transformer_encoder.py | chriswill88/holbertonschool-machine_learning | train | 0 |
40e028f8a7914f0bac6718151d5df3044d2dd0de | [
"text = sql.strip()\nit = iter(text)\nsb = []\nfor c in it:\n if c.isspace():\n c = QueryBase._process_whitespace(it)\n sb.append(' ')\n sb.append(c.lower())\n if c in ('`', '\"', \"'\"):\n for d in QueryBase._process_quoted(it, c):\n sb.append(d)\nif sb[-1] == ';':\n sb.... | <|body_start_0|>
text = sql.strip()
it = iter(text)
sb = []
for c in it:
if c.isspace():
c = QueryBase._process_whitespace(it)
sb.append(' ')
sb.append(c.lower())
if c in ('`', '"', "'"):
for d in QueryBa... | QueryBase | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueryBase:
def _normalize(sql: str) -> str:
"""Normalizes a SQL query or SQL expression. No checks are made to ensure that the input is valid SQL. This is not a full normalization. The following operations are preformed: - Any run of whitespace characters outside of a quoted region is re... | stack_v2_sparse_classes_75kplus_train_006153 | 2,769 | permissive | [
{
"docstring": "Normalizes a SQL query or SQL expression. No checks are made to ensure that the input is valid SQL. This is not a full normalization. The following operations are preformed: - Any run of whitespace characters outside of a quoted region is replaces by a single ' ' character. - Characters outside ... | 3 | stack_v2_sparse_classes_30k_train_018816 | Implement the Python class `QueryBase` described below.
Class description:
Implement the QueryBase class.
Method signatures and docstrings:
- def _normalize(sql: str) -> str: Normalizes a SQL query or SQL expression. No checks are made to ensure that the input is valid SQL. This is not a full normalization. The follo... | Implement the Python class `QueryBase` described below.
Class description:
Implement the QueryBase class.
Method signatures and docstrings:
- def _normalize(sql: str) -> str: Normalizes a SQL query or SQL expression. No checks are made to ensure that the input is valid SQL. This is not a full normalization. The follo... | 8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6 | <|skeleton|>
class QueryBase:
def _normalize(sql: str) -> str:
"""Normalizes a SQL query or SQL expression. No checks are made to ensure that the input is valid SQL. This is not a full normalization. The following operations are preformed: - Any run of whitespace characters outside of a quoted region is re... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QueryBase:
def _normalize(sql: str) -> str:
"""Normalizes a SQL query or SQL expression. No checks are made to ensure that the input is valid SQL. This is not a full normalization. The following operations are preformed: - Any run of whitespace characters outside of a quoted region is replaces by a si... | the_stack_v2_python_sparse | govern/data-meta/amundsen/databuilder/databuilder/models/query/base.py | alldatacenter/alldata | train | 774 | |
a076e171968789c1698e6b08a516acf4761d1a9e | [
"params = kwarg['params']\ncmd = 'tc chain {} '.format(command)\nreturn cmd",
"params = kwarg['params']\ncmd = 'tc chain {} '.format(command)\nreturn cmd"
] | <|body_start_0|>
params = kwarg['params']
cmd = 'tc chain {} '.format(command)
return cmd
<|end_body_0|>
<|body_start_1|>
params = kwarg['params']
cmd = 'tc chain {} '.format(command)
return cmd
<|end_body_1|>
| LinuxTcChainImpl | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinuxTcChainImpl:
def format_modify(self, command, *argv, **kwarg):
"""tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type spec... | stack_v2_sparse_classes_75kplus_train_006154 | 945 | permissive | [
{
"docstring": "tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type specific parameters ]",
"name": "format_modify",
"signature": "def format_m... | 2 | stack_v2_sparse_classes_30k_train_002159 | Implement the Python class `LinuxTcChainImpl` described below.
Class description:
Implement the LinuxTcChainImpl class.
Method signatures and docstrings:
- def format_modify(self, command, *argv, **kwarg): tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific ... | Implement the Python class `LinuxTcChainImpl` described below.
Class description:
Implement the LinuxTcChainImpl class.
Method signatures and docstrings:
- def format_modify(self, command, *argv, **kwarg): tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific ... | e4c8221e18cd94e7424c30e12eb0fb82f7767267 | <|skeleton|>
class LinuxTcChainImpl:
def format_modify(self, command, *argv, **kwarg):
"""tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type spec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinuxTcChainImpl:
def format_modify(self, command, *argv, **kwarg):
"""tc [ OPTIONS ] chain [ add | delete | get ] dev DEV [ parent qdisc-id | root ] filtertype [ filtertype specific parameters ] tc [ OPTIONS ] chain [ add | delete | get ] block BLOCK_INDEX filtertype [ filter‐ type specific parameter... | the_stack_v2_python_sparse | Amazon_Framework/DentOsTestbedLib/src/dent_os_testbed/lib/tc/linux/linux_tc_chain_impl.py | tld3daniel/testing | train | 0 | |
47428ac9318fc0fb7016213df8947dc792c946ee | [
"self.title = title\nself.duration = duration\nself.year_released = year_released\nself.storyline = storyline\nself.poster_img_url = poster_img_url\nself.youtube_url = youtube_url",
"num_hours = math.floor(self.duration / 60)\nnum_minutes = self.duration % 60\nreturn str(num_hours) + 'h ' + str(num_minutes) + 'm'... | <|body_start_0|>
self.title = title
self.duration = duration
self.year_released = year_released
self.storyline = storyline
self.poster_img_url = poster_img_url
self.youtube_url = youtube_url
<|end_body_0|>
<|body_start_1|>
num_hours = math.floor(self.duration / 6... | This class provides a way to store movie related information | Movie | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Movie:
"""This class provides a way to store movie related information"""
def __init__(self, title, duration, year_released, storyline, poster_img_url, youtube_url):
""":param title (str): Title of the movie :param duration (int): Duration of the movie in minutes :param year_released... | stack_v2_sparse_classes_75kplus_train_006155 | 1,216 | no_license | [
{
"docstring": ":param title (str): Title of the movie :param duration (int): Duration of the movie in minutes :param year_released (str): Year movie was released :param storyline (str): Short description of the movie's plot :param poster_img_url (str): URL pointing to the movie's poster image :param youtube_ur... | 2 | stack_v2_sparse_classes_30k_train_039030 | Implement the Python class `Movie` described below.
Class description:
This class provides a way to store movie related information
Method signatures and docstrings:
- def __init__(self, title, duration, year_released, storyline, poster_img_url, youtube_url): :param title (str): Title of the movie :param duration (in... | Implement the Python class `Movie` described below.
Class description:
This class provides a way to store movie related information
Method signatures and docstrings:
- def __init__(self, title, duration, year_released, storyline, poster_img_url, youtube_url): :param title (str): Title of the movie :param duration (in... | 3d22a7658ecd130d25ac927290da583d2bd30b8a | <|skeleton|>
class Movie:
"""This class provides a way to store movie related information"""
def __init__(self, title, duration, year_released, storyline, poster_img_url, youtube_url):
""":param title (str): Title of the movie :param duration (int): Duration of the movie in minutes :param year_released... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Movie:
"""This class provides a way to store movie related information"""
def __init__(self, title, duration, year_released, storyline, poster_img_url, youtube_url):
""":param title (str): Title of the movie :param duration (int): Duration of the movie in minutes :param year_released (str): Year ... | the_stack_v2_python_sparse | movies/media.py | Drew-Kimberly/fullstack | train | 0 |
7150d082e61e8273835b4260666d80eb886f6091 | [
"initialConfig = conf.get('settings', 'initialConfig')\nif initialConfig:\n initialConfig = ',' + initialConfig\nret = 'GSS,{0},3,0'.format(config['identifier'])\nret += ',O3=' + conf.get('settings', 'reportFormat')\nret += initialConfig\nret += ',D1=' + str(config['gprs']['apn'] or '')\nret += ',D2=' + str(conf... | <|body_start_0|>
initialConfig = conf.get('settings', 'initialConfig')
if initialConfig:
initialConfig = ',' + initialConfig
ret = 'GSS,{0},3,0'.format(config['identifier'])
ret += ',O3=' + conf.get('settings', 'reportFormat')
ret += initialConfig
ret += ',D1=... | GloblasatCommandConfigure | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GloblasatCommandConfigure:
def getSmsData(self, config):
"""Converts options to string @param config: request data @return: string"""
<|body_0|>
def getData(self, transport='tcp'):
"""Returns command data array accordingly to the transport @param transport: str @retu... | stack_v2_sparse_classes_75kplus_train_006156 | 6,582 | no_license | [
{
"docstring": "Converts options to string @param config: request data @return: string",
"name": "getSmsData",
"signature": "def getSmsData(self, config)"
},
{
"docstring": "Returns command data array accordingly to the transport @param transport: str @return: list of dicts",
"name": "getDat... | 2 | stack_v2_sparse_classes_30k_train_032907 | Implement the Python class `GloblasatCommandConfigure` described below.
Class description:
Implement the GloblasatCommandConfigure class.
Method signatures and docstrings:
- def getSmsData(self, config): Converts options to string @param config: request data @return: string
- def getData(self, transport='tcp'): Retur... | Implement the Python class `GloblasatCommandConfigure` described below.
Class description:
Implement the GloblasatCommandConfigure class.
Method signatures and docstrings:
- def getSmsData(self, config): Converts options to string @param config: request data @return: string
- def getData(self, transport='tcp'): Retur... | 4a4bc730252ece695b2773388812e2d59d4947ce | <|skeleton|>
class GloblasatCommandConfigure:
def getSmsData(self, config):
"""Converts options to string @param config: request data @return: string"""
<|body_0|>
def getData(self, transport='tcp'):
"""Returns command data array accordingly to the transport @param transport: str @retu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GloblasatCommandConfigure:
def getSmsData(self, config):
"""Converts options to string @param config: request data @return: string"""
initialConfig = conf.get('settings', 'initialConfig')
if initialConfig:
initialConfig = ',' + initialConfig
ret = 'GSS,{0},3,0'.form... | the_stack_v2_python_sparse | lib/handlers/globalsat/commands.py | maprox/pipe | train | 4 | |
b472bfead96051b3cba4d3d18f9122570dac3305 | [
"self._table = {}\nfor p in breadth_first_traversal(self._tree):\n self._table[p.index()] = [p]\n l = 0\n while l < self._tree.depth(p):\n u = self._table[p.index()][l]\n w = self._tree.parent(u)\n self._table[p.index()].append(w)\n l += 1",
"if isinstance(p, int):\n if k >... | <|body_start_0|>
self._table = {}
for p in breadth_first_traversal(self._tree):
self._table[p.index()] = [p]
l = 0
while l < self._tree.depth(p):
u = self._table[p.index()][l]
w = self._tree.parent(u)
self._table[p.index... | Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed by a simple table look-up in O(1) ti... | LA_table | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LA_table:
"""Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed ... | stack_v2_sparse_classes_75kplus_train_006157 | 15,776 | no_license | [
{
"docstring": "Precompute all n^2 possible queries and store them in a table.",
"name": "_preprocess",
"signature": "def _preprocess(self)"
},
{
"docstring": "Perform simple table look-up.",
"name": "_query",
"signature": "def _query(self, p, k)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023358 | Implement the Python class `LA_table` described below.
Class description:
Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming... | Implement the Python class `LA_table` described below.
Class description:
Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming... | 341bdc7d144d18b49917453006461d670109e706 | <|skeleton|>
class LA_table:
"""Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LA_table:
"""Concrete class implementing table indexing strategy. Every possible query (p, k) is precomputed and the result is stored in a table. The size of the table is n^2. Computation of the level ancestor is performed using bottom-up dynamic programming in O(n^2) time. Querying is performed by a simple t... | the_stack_v2_python_sparse | Level_Ancestor/la.py | pi-tau/fun-with-algorithms | train | 0 |
ed1377943e7bd8a8963a2147987a898bf5a72908 | [
"self.minsize = min_size\nself.maxsize = max_size\nself.interpolation = interpolation",
"w, h = img.size\nratio = numpy.random.uniform(self.minsize, self.maxsize)\now = int(w * ratio)\noh = int(h * ratio)\nreturn (img.resize((ow, oh), self.interpolation), label.resize((ow, oh), Image.NEAREST))"
] | <|body_start_0|>
self.minsize = min_size
self.maxsize = max_size
self.interpolation = interpolation
<|end_body_0|>
<|body_start_1|>
w, h = img.size
ratio = numpy.random.uniform(self.minsize, self.maxsize)
ow = int(w * ratio)
oh = int(h * ratio)
return (im... | random Rescale the input image and correspond label to the given size. | RandomScale | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomScale:
"""random Rescale the input image and correspond label to the given size."""
def __init__(self, min_size, max_size, interpolation=Image.BICUBIC):
""":param min_size: (int), Desired min output size. :param max_size: (int), Desired max output size. :param interpolation: De... | stack_v2_sparse_classes_75kplus_train_006158 | 11,352 | permissive | [
{
"docstring": ":param min_size: (int), Desired min output size. :param max_size: (int), Desired max output size. :param interpolation: Desired interpolation for image, for not introduce unknown label, the label using NEAREST as default.",
"name": "__init__",
"signature": "def __init__(self, min_size, m... | 2 | stack_v2_sparse_classes_30k_train_027574 | Implement the Python class `RandomScale` described below.
Class description:
random Rescale the input image and correspond label to the given size.
Method signatures and docstrings:
- def __init__(self, min_size, max_size, interpolation=Image.BICUBIC): :param min_size: (int), Desired min output size. :param max_size:... | Implement the Python class `RandomScale` described below.
Class description:
random Rescale the input image and correspond label to the given size.
Method signatures and docstrings:
- def __init__(self, min_size, max_size, interpolation=Image.BICUBIC): :param min_size: (int), Desired min output size. :param max_size:... | f6e6565ddfb910d1aec477b34e58d79e097b339e | <|skeleton|>
class RandomScale:
"""random Rescale the input image and correspond label to the given size."""
def __init__(self, min_size, max_size, interpolation=Image.BICUBIC):
""":param min_size: (int), Desired min output size. :param max_size: (int), Desired max output size. :param interpolation: De... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomScale:
"""random Rescale the input image and correspond label to the given size."""
def __init__(self, min_size, max_size, interpolation=Image.BICUBIC):
""":param min_size: (int), Desired min output size. :param max_size: (int), Desired max output size. :param interpolation: Desired interpo... | the_stack_v2_python_sparse | dataset/data_loader.py | jtpils/structure_knowledge_distillation | train | 1 |
53e47d7e875f3f5abf9f1fac172be0bfdbda66eb | [
"allCards = self.getCardsToDeal(context)\nwhile len(allCards) > 0:\n for foe in context.foes:\n if len(allCards) > 0:\n zone = context.getPlayerContext(foe).loadZone(HAND)\n zone.add(allCards.pop())",
"allCards = []\neventZone = context.loadZone(EVENT)\nfor card in list(eventZone):... | <|body_start_0|>
allCards = self.getCardsToDeal(context)
while len(allCards) > 0:
for foe in context.foes:
if len(allCards) > 0:
zone = context.getPlayerContext(foe).loadZone(HAND)
zone.add(allCards.pop())
<|end_body_0|>
<|body_start_1... | Represents an effect to Shuffle Cards and Deal them to the foes | ShuffleAndDeal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShuffleAndDeal:
"""Represents an effect to Shuffle Cards and Deal them to the foes"""
def perform(self, context):
"""Perform the Game Effect"""
<|body_0|>
def getCardsToDeal(self, context):
"""Get the Cards to Deal to the Character"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus_train_006159 | 869 | no_license | [
{
"docstring": "Perform the Game Effect",
"name": "perform",
"signature": "def perform(self, context)"
},
{
"docstring": "Get the Cards to Deal to the Character",
"name": "getCardsToDeal",
"signature": "def getCardsToDeal(self, context)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006479 | Implement the Python class `ShuffleAndDeal` described below.
Class description:
Represents an effect to Shuffle Cards and Deal them to the foes
Method signatures and docstrings:
- def perform(self, context): Perform the Game Effect
- def getCardsToDeal(self, context): Get the Cards to Deal to the Character | Implement the Python class `ShuffleAndDeal` described below.
Class description:
Represents an effect to Shuffle Cards and Deal them to the foes
Method signatures and docstrings:
- def perform(self, context): Perform the Game Effect
- def getCardsToDeal(self, context): Get the Cards to Deal to the Character
<|skeleto... | 0b5a7573a3cf33430fe61e4ff8a8a7a0ae20b258 | <|skeleton|>
class ShuffleAndDeal:
"""Represents an effect to Shuffle Cards and Deal them to the foes"""
def perform(self, context):
"""Perform the Game Effect"""
<|body_0|>
def getCardsToDeal(self, context):
"""Get the Cards to Deal to the Character"""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShuffleAndDeal:
"""Represents an effect to Shuffle Cards and Deal them to the foes"""
def perform(self, context):
"""Perform the Game Effect"""
allCards = self.getCardsToDeal(context)
while len(allCards) > 0:
for foe in context.foes:
if len(allCards) > ... | the_stack_v2_python_sparse | src/Game/Effects/shuffle_and_deal.py | dfwarden/DeckBuilding | train | 0 |
fd23ef21ff4ab6cd19e86f000418074c22fe74bc | [
"def preorder(root):\n if root:\n vals.append(str(root.val))\n preorder(root.left)\n preorder(root.right)\nvals = []\npreorder(root)\nreturn ' '.join(vals)",
"preorder = map(int, data.split())\ninorder = sorted(preorder)\n\ndef dfs(preorder, inorder):\n if not inorder:\n return N... | <|body_start_0|>
def preorder(root):
if root:
vals.append(str(root.val))
preorder(root.left)
preorder(root.right)
vals = []
preorder(root)
return ' '.join(vals)
<|end_body_0|>
<|body_start_1|>
preorder = map(int, data.s... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_006160 | 1,327 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | afc686acdda4168f4384e13fb730e17f4bdcd553 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def preorder(root):
if root:
vals.append(str(root.val))
preorder(root.left)
preorder(root.right)
vals = []
pre... | the_stack_v2_python_sparse | serialize-and-deserialize-bst.py | sfdye/leetcode | train | 3 | |
d12d7dfc464c164ddc3933854fa9cc3617037162 | [
"if not nums:\n return\nself.sums = [nums[0]]\nfor i in range(len(nums) - 1):\n self.sums.append(self.sums[-1] + nums[i + 1])",
"if i != 0:\n return self.sums[j] - self.sums[i - 1]\nelse:\n return self.sums[j]"
] | <|body_start_0|>
if not nums:
return
self.sums = [nums[0]]
for i in range(len(nums) - 1):
self.sums.append(self.sums[-1] + nums[i + 1])
<|end_body_0|>
<|body_start_1|>
if i != 0:
return self.sums[j] - self.sums[i - 1]
else:
return ... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return
self.sums = [nums[0... | stack_v2_sparse_classes_75kplus_train_006161 | 733 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031410 | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(self, nums):
... | 85415872711c7c4b646f71ba44b5ef9200c03f5e | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
if not nums:
return
self.sums = [nums[0]]
for i in range(len(nums) - 1):
self.sums.append(self.sums[-1] + nums[i + 1])
def sumRange(self, i, j):
""":type i: int :type j: int :rt... | the_stack_v2_python_sparse | 303.py | ninini976/yf_leetcode_problems | train | 0 | |
c364c1de7b80b3ad6de660847c7de0324ebdd334 | [
"response = self.client.get(reverse('books'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'There are currently no books available.')\nself.assertQuerysetEqual(response.context['books_list'], [])",
"create_book_helper('Test Book', 3, User.objects.create())\nresponse = self.client.ge... | <|body_start_0|>
response = self.client.get(reverse('books'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'There are currently no books available.')
self.assertQuerysetEqual(response.context['books_list'], [])
<|end_body_0|>
<|body_start_1|>
create_... | BooksViewTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BooksViewTests:
def test_books_view_no_books(self):
"""If no books are available display appropriate message"""
<|body_0|>
def test_books_view_no_books_available(self):
"""If all books are rented, display no available message"""
<|body_1|>
def test_books... | stack_v2_sparse_classes_75kplus_train_006162 | 23,279 | no_license | [
{
"docstring": "If no books are available display appropriate message",
"name": "test_books_view_no_books",
"signature": "def test_books_view_no_books(self)"
},
{
"docstring": "If all books are rented, display no available message",
"name": "test_books_view_no_books_available",
"signatur... | 5 | stack_v2_sparse_classes_30k_train_023387 | Implement the Python class `BooksViewTests` described below.
Class description:
Implement the BooksViewTests class.
Method signatures and docstrings:
- def test_books_view_no_books(self): If no books are available display appropriate message
- def test_books_view_no_books_available(self): If all books are rented, dis... | Implement the Python class `BooksViewTests` described below.
Class description:
Implement the BooksViewTests class.
Method signatures and docstrings:
- def test_books_view_no_books(self): If no books are available display appropriate message
- def test_books_view_no_books_available(self): If all books are rented, dis... | d06d44511a56eaa90bce46dcb5e35d79b91bbbc5 | <|skeleton|>
class BooksViewTests:
def test_books_view_no_books(self):
"""If no books are available display appropriate message"""
<|body_0|>
def test_books_view_no_books_available(self):
"""If all books are rented, display no available message"""
<|body_1|>
def test_books... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BooksViewTests:
def test_books_view_no_books(self):
"""If no books are available display appropriate message"""
response = self.client.get(reverse('books'))
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'There are currently no books available.')
... | the_stack_v2_python_sparse | book_rental_store/books/tests.py | joe-kimlinger/book-rental-store | train | 0 | |
daa8d036324b6c9cc8a5fa4c96ff18a910eb1081 | [
"super(NotConstitutionalStrategy, self).__init__(decision, member, bill)\nself._name = 'Not Constitutional'\nself._CONSTITUTION = 'Constitution'\nself._non_constitutional_stances = []",
"constitution = PymongoDB.get_db().find_one(db_constants.ISSUES, queries.issue_query(self._CONSTITUTION))\nif not constitution:\... | <|body_start_0|>
super(NotConstitutionalStrategy, self).__init__(decision, member, bill)
self._name = 'Not Constitutional'
self._CONSTITUTION = 'Constitution'
self._non_constitutional_stances = []
<|end_body_0|>
<|body_start_1|>
constitution = PymongoDB.get_db().find_one(db_cons... | From Professor Slade's Lisp code: ================================================================== 3 Not constitutional [B] (NOT-CONSTITUTIONAL) Remarks: Vote against a measure that would be struck down by the Supreme Court. Rank: "B" ================================================================== If there is a co... | NotConstitutionalStrategy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NotConstitutionalStrategy:
"""From Professor Slade's Lisp code: ================================================================== 3 Not constitutional [B] (NOT-CONSTITUTIONAL) Remarks: Vote against a measure that would be struck down by the Supreme Court. Rank: "B" ==============================... | stack_v2_sparse_classes_75kplus_train_006163 | 3,675 | no_license | [
{
"docstring": "Constructs a new NotConstitutionalStrategy. Arguments: decision: The Decision object the Strategy will attempt to compute a result for. member: A Member object of the member who is deciding on the bill bill: A Bill object of the bill being decided upon.",
"name": "__init__",
"signature":... | 3 | null | Implement the Python class `NotConstitutionalStrategy` described below.
Class description:
From Professor Slade's Lisp code: ================================================================== 3 Not constitutional [B] (NOT-CONSTITUTIONAL) Remarks: Vote against a measure that would be struck down by the Supreme Court. R... | Implement the Python class `NotConstitutionalStrategy` described below.
Class description:
From Professor Slade's Lisp code: ================================================================== 3 Not constitutional [B] (NOT-CONSTITUTIONAL) Remarks: Vote against a measure that would be struck down by the Supreme Court. R... | 6df6e0ba491a839908ddcebe7feed9bff0f4db4d | <|skeleton|>
class NotConstitutionalStrategy:
"""From Professor Slade's Lisp code: ================================================================== 3 Not constitutional [B] (NOT-CONSTITUTIONAL) Remarks: Vote against a measure that would be struck down by the Supreme Court. Rank: "B" ==============================... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NotConstitutionalStrategy:
"""From Professor Slade's Lisp code: ================================================================== 3 Not constitutional [B] (NOT-CONSTITUTIONAL) Remarks: Vote against a measure that would be struck down by the Supreme Court. Rank: "B" ===========================================... | the_stack_v2_python_sparse | src/classes/strategies/not_constitutional_strategy.py | WEB3-GForce/VOTE | train | 4 |
6bc7ce008f6cfe9fef23195874358389f1645c38 | [
"if request.GET.get(DBMI_AUTH_QUERY_BRANDING_KEY):\n state[DBMI_AUTH_QUERY_BRANDING_KEY] = request.GET[DBMI_AUTH_QUERY_BRANDING_KEY]\n logger.debug(f'Passing along branding')\nelse:\n branding = {}\n if dbmi_settings.AUTHN_TITLE:\n branding['title'] = dbmi_settings.AUTHN_TITLE\n if dbmi_settin... | <|body_start_0|>
if request.GET.get(DBMI_AUTH_QUERY_BRANDING_KEY):
state[DBMI_AUTH_QUERY_BRANDING_KEY] = request.GET[DBMI_AUTH_QUERY_BRANDING_KEY]
logger.debug(f'Passing along branding')
else:
branding = {}
if dbmi_settings.AUTHN_TITLE:
bra... | The provider class encapsulates authentication provider behaviors and routines. | Auth0 | [
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth0:
"""The provider class encapsulates authentication provider behaviors and routines."""
def set_state(self, request, state):
"""This method allows the provider instance to add to or modify the state object that is passed along with the '/authorize' request. This allows the servi... | stack_v2_sparse_classes_75kplus_train_006164 | 7,677 | permissive | [
{
"docstring": "This method allows the provider instance to add to or modify the state object that is passed along with the '/authorize' request. This allows the service to pass parameters through login to the redirect to the calling service. :param request: The current request :type request: HttpRequest :param... | 6 | null | Implement the Python class `Auth0` described below.
Class description:
The provider class encapsulates authentication provider behaviors and routines.
Method signatures and docstrings:
- def set_state(self, request, state): This method allows the provider instance to add to or modify the state object that is passed a... | Implement the Python class `Auth0` described below.
Class description:
The provider class encapsulates authentication provider behaviors and routines.
Method signatures and docstrings:
- def set_state(self, request, state): This method allows the provider instance to add to or modify the state object that is passed a... | 0c0db67331ff184b7e35831e0a497f0e6923264b | <|skeleton|>
class Auth0:
"""The provider class encapsulates authentication provider behaviors and routines."""
def set_state(self, request, state):
"""This method allows the provider instance to add to or modify the state object that is passed along with the '/authorize' request. This allows the servi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Auth0:
"""The provider class encapsulates authentication provider behaviors and routines."""
def set_state(self, request, state):
"""This method allows the provider instance to add to or modify the state object that is passed along with the '/authorize' request. This allows the service to pass pa... | the_stack_v2_python_sparse | dbmi_client/provider/auth0.py | hms-dbmi/django-dbmi-client | train | 3 |
4936a198b564c2680863123cb37f76b979a6b332 | [
"super(MultiHeadAttn, self).__init__()\nself.batch_size = batch_size\nself.matmul = nn.MatMul()\nself.add = P.Add()\nself.reshape = P.Reshape()\nself.transpose = P.Transpose()\nself.div = P.Div()\nself.softmax = nn.Softmax(axis=3)\nself.query_linear_weight = Parameter(Tensor(np.random.uniform(0, 1, (4096, 4096)).as... | <|body_start_0|>
super(MultiHeadAttn, self).__init__()
self.batch_size = batch_size
self.matmul = nn.MatMul()
self.add = P.Add()
self.reshape = P.Reshape()
self.transpose = P.Transpose()
self.div = P.Div()
self.softmax = nn.Softmax(axis=3)
self.que... | Multi-head attention layer | MultiHeadAttn | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiHeadAttn:
"""Multi-head attention layer"""
def __init__(self, batch_size, query_linear_bias, key_linear_bias, value_linear_bias):
"""init function"""
<|body_0|>
def construct(self, hidden_states, extended_attention_mask):
"""construct function"""
<|b... | stack_v2_sparse_classes_75kplus_train_006165 | 12,912 | permissive | [
{
"docstring": "init function",
"name": "__init__",
"signature": "def __init__(self, batch_size, query_linear_bias, key_linear_bias, value_linear_bias)"
},
{
"docstring": "construct function",
"name": "construct",
"signature": "def construct(self, hidden_states, extended_attention_mask)"... | 2 | stack_v2_sparse_classes_30k_test_001382 | Implement the Python class `MultiHeadAttn` described below.
Class description:
Multi-head attention layer
Method signatures and docstrings:
- def __init__(self, batch_size, query_linear_bias, key_linear_bias, value_linear_bias): init function
- def construct(self, hidden_states, extended_attention_mask): construct fu... | Implement the Python class `MultiHeadAttn` described below.
Class description:
Multi-head attention layer
Method signatures and docstrings:
- def __init__(self, batch_size, query_linear_bias, key_linear_bias, value_linear_bias): init function
- def construct(self, hidden_states, extended_attention_mask): construct fu... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class MultiHeadAttn:
"""Multi-head attention layer"""
def __init__(self, batch_size, query_linear_bias, key_linear_bias, value_linear_bias):
"""init function"""
<|body_0|>
def construct(self, hidden_states, extended_attention_mask):
"""construct function"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiHeadAttn:
"""Multi-head attention layer"""
def __init__(self, batch_size, query_linear_bias, key_linear_bias, value_linear_bias):
"""init function"""
super(MultiHeadAttn, self).__init__()
self.batch_size = batch_size
self.matmul = nn.MatMul()
self.add = P.Add(... | the_stack_v2_python_sparse | research/nlp/tprr/src/albert.py | mindspore-ai/models | train | 301 |
2886d1f63db3d48b43dd5f047dc144c659c102e5 | [
"assert features.is_contiguous()\nassert indices.is_contiguous()\nB, nfeatures, nsample = indices.size()\n_, C, N = features.size()\noutput = torch.cuda.FloatTensor(B, C, nfeatures, nsample)\ngroup_points_ext.forward(B, C, N, nfeatures, nsample, features, indices, output)\nctx.for_backwards = (indices, N)\nreturn o... | <|body_start_0|>
assert features.is_contiguous()
assert indices.is_contiguous()
B, nfeatures, nsample = indices.size()
_, C, N = features.size()
output = torch.cuda.FloatTensor(B, C, nfeatures, nsample)
group_points_ext.forward(B, C, N, nfeatures, nsample, features, indic... | Grouping Operation. Group feature with given index. | GroupingOperation | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupingOperation:
"""Grouping Operation. Group feature with given index."""
def forward(ctx, features: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
"""forward. Args: features (Tensor): (B, C, N) tensor of features to group. indices (Tensor): (B, npoint, nsample) the indicie... | stack_v2_sparse_classes_75kplus_train_006166 | 1,896 | permissive | [
{
"docstring": "forward. Args: features (Tensor): (B, C, N) tensor of features to group. indices (Tensor): (B, npoint, nsample) the indicies of features to group with. Returns: Tensor: (B, C, npoint, nsample) Grouped features.",
"name": "forward",
"signature": "def forward(ctx, features: torch.Tensor, i... | 2 | stack_v2_sparse_classes_30k_train_031035 | Implement the Python class `GroupingOperation` described below.
Class description:
Grouping Operation. Group feature with given index.
Method signatures and docstrings:
- def forward(ctx, features: torch.Tensor, indices: torch.Tensor) -> torch.Tensor: forward. Args: features (Tensor): (B, C, N) tensor of features to ... | Implement the Python class `GroupingOperation` described below.
Class description:
Grouping Operation. Group feature with given index.
Method signatures and docstrings:
- def forward(ctx, features: torch.Tensor, indices: torch.Tensor) -> torch.Tensor: forward. Args: features (Tensor): (B, C, N) tensor of features to ... | 9987806185a4e1619bc15ceecb8a1755e764ff68 | <|skeleton|>
class GroupingOperation:
"""Grouping Operation. Group feature with given index."""
def forward(ctx, features: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
"""forward. Args: features (Tensor): (B, C, N) tensor of features to group. indices (Tensor): (B, npoint, nsample) the indicie... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupingOperation:
"""Grouping Operation. Group feature with given index."""
def forward(ctx, features: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
"""forward. Args: features (Tensor): (B, C, N) tensor of features to group. indices (Tensor): (B, npoint, nsample) the indicies of features... | the_stack_v2_python_sparse | gorilla3d/ops/group_points/group_points.py | SijanNeupane49/gorilla-3d | train | 0 |
d2359edfc0d88f902cb790c8c5759b4fc4e8d50c | [
"if not issubclass(type(entity), Renderable_3D):\n raise TypeError('The entities added to a 3D layer must be 3D renderables.')\nif name not in self._Layer__entities.keys():\n self._Layer__entities[name] = entity\nelse:\n raise KeyError('An entity already exists with the name {}.'.format(name))",
"if self... | <|body_start_0|>
if not issubclass(type(entity), Renderable_3D):
raise TypeError('The entities added to a 3D layer must be 3D renderables.')
if name not in self._Layer__entities.keys():
self._Layer__entities[name] = entity
else:
raise KeyError('An entity alrea... | A layer specificly for 3D rendered entities (that inherit from "Renderable_3D"). Constructor: pygame.Surface surface -> The surface on which to render the layer Can be omitted if the layer is to be registered to a simulation (pygame.Surface((1, 1), pygame.SRCALPHA)) pygame.Color backgroundColour -> The background colou... | Layer_3D | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Layer_3D:
"""A layer specificly for 3D rendered entities (that inherit from "Renderable_3D"). Constructor: pygame.Surface surface -> The surface on which to render the layer Can be omitted if the layer is to be registered to a simulation (pygame.Surface((1, 1), pygame.SRCALPHA)) pygame.Color back... | stack_v2_sparse_classes_75kplus_train_006167 | 12,253 | no_license | [
{
"docstring": "Registers a new Renderable_3D entity with the simulation. Paramiters: str name -> The name the new entity should be registered with Renderable_3D entity -> The entity to register",
"name": "addEntity",
"signature": "def addEntity(self, name: str, entity: Renderable_3D)"
},
{
"doc... | 2 | stack_v2_sparse_classes_30k_train_034927 | Implement the Python class `Layer_3D` described below.
Class description:
A layer specificly for 3D rendered entities (that inherit from "Renderable_3D"). Constructor: pygame.Surface surface -> The surface on which to render the layer Can be omitted if the layer is to be registered to a simulation (pygame.Surface((1, ... | Implement the Python class `Layer_3D` described below.
Class description:
A layer specificly for 3D rendered entities (that inherit from "Renderable_3D"). Constructor: pygame.Surface surface -> The surface on which to render the layer Can be omitted if the layer is to be registered to a simulation (pygame.Surface((1, ... | 9a250ca7a9fb81f7e03b06f14a40e360ec2cbcfd | <|skeleton|>
class Layer_3D:
"""A layer specificly for 3D rendered entities (that inherit from "Renderable_3D"). Constructor: pygame.Surface surface -> The surface on which to render the layer Can be omitted if the layer is to be registered to a simulation (pygame.Surface((1, 1), pygame.SRCALPHA)) pygame.Color back... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Layer_3D:
"""A layer specificly for 3D rendered entities (that inherit from "Renderable_3D"). Constructor: pygame.Surface surface -> The surface on which to render the layer Can be omitted if the layer is to be registered to a simulation (pygame.Surface((1, 1), pygame.SRCALPHA)) pygame.Color backgroundColour ... | the_stack_v2_python_sparse | simulation/layer.py | QuasarX1/Phys205Project | train | 1 |
f26511ab31383a6139ce94571990035a9f80aa4e | [
"seen = set()\nq = collections.deque([s])\nwhile q:\n s = q.popleft()\n for word in wordDict:\n if s.startswith(word):\n new_s = s[len(word):]\n if new_s == '':\n return True\n if new_s not in seen:\n q.append(new_s)\n seen.a... | <|body_start_0|>
seen = set()
q = collections.deque([s])
while q:
s = q.popleft()
for word in wordDict:
if s.startswith(word):
new_s = s[len(word):]
if new_s == '':
return True
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def wordBreak(self, s: str, wordDict: list[str]) -> bool:
"""iterative"""
<|body_0|>
def wordBreak(self, s: str, wordDict: list[str]) -> bool:
"""DP programming"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
seen = set()
q = colle... | stack_v2_sparse_classes_75kplus_train_006168 | 972 | no_license | [
{
"docstring": "iterative",
"name": "wordBreak",
"signature": "def wordBreak(self, s: str, wordDict: list[str]) -> bool"
},
{
"docstring": "DP programming",
"name": "wordBreak",
"signature": "def wordBreak(self, s: str, wordDict: list[str]) -> bool"
}
] | 2 | stack_v2_sparse_classes_30k_train_021918 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s: str, wordDict: list[str]) -> bool: iterative
- def wordBreak(self, s: str, wordDict: list[str]) -> bool: DP programming | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def wordBreak(self, s: str, wordDict: list[str]) -> bool: iterative
- def wordBreak(self, s: str, wordDict: list[str]) -> bool: DP programming
<|skeleton|>
class Solution:
... | e50dc0642f087f37ab3234390be3d8a0ed48fe62 | <|skeleton|>
class Solution:
def wordBreak(self, s: str, wordDict: list[str]) -> bool:
"""iterative"""
<|body_0|>
def wordBreak(self, s: str, wordDict: list[str]) -> bool:
"""DP programming"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def wordBreak(self, s: str, wordDict: list[str]) -> bool:
"""iterative"""
seen = set()
q = collections.deque([s])
while q:
s = q.popleft()
for word in wordDict:
if s.startswith(word):
new_s = s[len(word):]
... | the_stack_v2_python_sparse | Leetcode/139. Word Break.py | brlala/Educative-Grokking-Coding-Exercise | train | 3 | |
79c8760e51df507aec4b9dbff75429ee8306eeaf | [
"self.k = k\nself.heapque = []\nself.heapque = [i for i in nums[:k]]\nheapq.heapify(self.heapque)\nif nums[k:]:\n for i in nums[k:]:\n if i > self.heapque[0]:\n heapq.heappop(self.heapque)\n heapq.heappush(self.heapque, i)",
"if len(self.heapque) < self.k:\n heapq.heappush(self.... | <|body_start_0|>
self.k = k
self.heapque = []
self.heapque = [i for i in nums[:k]]
heapq.heapify(self.heapque)
if nums[k:]:
for i in nums[k:]:
if i > self.heapque[0]:
heapq.heappop(self.heapque)
heapq.heappush(se... | KthLargest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KthLargest:
def __init__(self, k: int, nums: List[int]):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val: int) -> int:
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.k = k
self.heapqu... | stack_v2_sparse_classes_75kplus_train_006169 | 5,863 | no_license | [
{
"docstring": ":type k: int :type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, k: int, nums: List[int])"
},
{
"docstring": ":type val: int :rtype: int",
"name": "add",
"signature": "def add(self, val: int) -> int"
}
] | 2 | stack_v2_sparse_classes_30k_train_023955 | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k: int, nums: List[int]): :type k: int :type nums: List[int]
- def add(self, val: int) -> int: :type val: int :rtype: int | Implement the Python class `KthLargest` described below.
Class description:
Implement the KthLargest class.
Method signatures and docstrings:
- def __init__(self, k: int, nums: List[int]): :type k: int :type nums: List[int]
- def add(self, val: int) -> int: :type val: int :rtype: int
<|skeleton|>
class KthLargest:
... | f2621cd76822a922c49b60f32931f26cce1c571d | <|skeleton|>
class KthLargest:
def __init__(self, k: int, nums: List[int]):
""":type k: int :type nums: List[int]"""
<|body_0|>
def add(self, val: int) -> int:
""":type val: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KthLargest:
def __init__(self, k: int, nums: List[int]):
""":type k: int :type nums: List[int]"""
self.k = k
self.heapque = []
self.heapque = [i for i in nums[:k]]
heapq.heapify(self.heapque)
if nums[k:]:
for i in nums[k:]:
if i > sel... | the_stack_v2_python_sparse | Heap/005_leetcode_P_703_Kth_LargestElementInAStream/Solution.py | Keshav1506/competitive_programming | train | 0 | |
c24e73a31314548db5a406462ebf7dba7e3d6bc7 | [
"result = commands.getstatusoutput('svn info %s' % directory)\nif result[0] > 0:\n raise SuitcaseVcsError(\"Can't find svn version for %s (%s)\\nCommand exited with error (%s), %s\" % (directory, os.getcwd(), result[0], result[1]))\nelse:\n match = re.search('^URL: (.*?)$', result[1], re.M)\n if match is N... | <|body_start_0|>
result = commands.getstatusoutput('svn info %s' % directory)
if result[0] > 0:
raise SuitcaseVcsError("Can't find svn version for %s (%s)\nCommand exited with error (%s), %s" % (directory, os.getcwd(), result[0], result[1]))
else:
match = re.search('^URL:... | Class interface to subversion | Subversion | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subversion:
"""Class interface to subversion"""
def get_remote_branch_location(self, directory):
"""Works out the URL of remote branch"""
<|body_0|>
def get_directory_revision(self, directory):
"""Works out the revno for a path by querying the remote repo"""
... | stack_v2_sparse_classes_75kplus_train_006170 | 1,912 | permissive | [
{
"docstring": "Works out the URL of remote branch",
"name": "get_remote_branch_location",
"signature": "def get_remote_branch_location(self, directory)"
},
{
"docstring": "Works out the revno for a path by querying the remote repo",
"name": "get_directory_revision",
"signature": "def ge... | 2 | stack_v2_sparse_classes_30k_train_032525 | Implement the Python class `Subversion` described below.
Class description:
Class interface to subversion
Method signatures and docstrings:
- def get_remote_branch_location(self, directory): Works out the URL of remote branch
- def get_directory_revision(self, directory): Works out the revno for a path by querying th... | Implement the Python class `Subversion` described below.
Class description:
Class interface to subversion
Method signatures and docstrings:
- def get_remote_branch_location(self, directory): Works out the URL of remote branch
- def get_directory_revision(self, directory): Works out the revno for a path by querying th... | 2a0eb274ffccd3692ba4659cbb0010d0725f2b20 | <|skeleton|>
class Subversion:
"""Class interface to subversion"""
def get_remote_branch_location(self, directory):
"""Works out the URL of remote branch"""
<|body_0|>
def get_directory_revision(self, directory):
"""Works out the revno for a path by querying the remote repo"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Subversion:
"""Class interface to subversion"""
def get_remote_branch_location(self, directory):
"""Works out the URL of remote branch"""
result = commands.getstatusoutput('svn info %s' % directory)
if result[0] > 0:
raise SuitcaseVcsError("Can't find svn version for %... | the_stack_v2_python_sparse | suitcase/vcs/subversion.py | brosner/suitcaseproject | train | 0 |
a5fdf182d391ef1b00713fabb23dc8abbc048892 | [
"resp = get_model_list_method(*get_method_args, **get_method_kwargs)\nif not resp.ok:\n raise DatasetGeneratorError('Request for list of {0} during data-driven-test setup failed with an HTTP {1} ERROR'.format(model_type_name, resp.status_code))\nif resp.entity is None:\n raise DatasetGeneratorError('Unable to... | <|body_start_0|>
resp = get_model_list_method(*get_method_args, **get_method_kwargs)
if not resp.ok:
raise DatasetGeneratorError('Request for list of {0} during data-driven-test setup failed with an HTTP {1} ERROR'.format(model_type_name, resp.status_code))
if resp.entity is None:
... | Collection of dataset generators and helper methods for developing data driven tests | ModelBasedDatasetToolkit | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelBasedDatasetToolkit:
"""Collection of dataset generators and helper methods for developing data driven tests"""
def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs):
"""Gets list of all models in the environment."""
<|bo... | stack_v2_sparse_classes_75kplus_train_006171 | 3,872 | permissive | [
{
"docstring": "Gets list of all models in the environment.",
"name": "_get_model_list",
"signature": "def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs)"
},
{
"docstring": "Filters should be dictionaries with model attributes as keys and list... | 3 | stack_v2_sparse_classes_30k_train_035366 | Implement the Python class `ModelBasedDatasetToolkit` described below.
Class description:
Collection of dataset generators and helper methods for developing data driven tests
Method signatures and docstrings:
- def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): Ge... | Implement the Python class `ModelBasedDatasetToolkit` described below.
Class description:
Collection of dataset generators and helper methods for developing data driven tests
Method signatures and docstrings:
- def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): Ge... | 7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924 | <|skeleton|>
class ModelBasedDatasetToolkit:
"""Collection of dataset generators and helper methods for developing data driven tests"""
def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs):
"""Gets list of all models in the environment."""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModelBasedDatasetToolkit:
"""Collection of dataset generators and helper methods for developing data driven tests"""
def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs):
"""Gets list of all models in the environment."""
resp = get_model_... | the_stack_v2_python_sparse | cloudcafe/common/datasets.py | kurhula/cloudcafe | train | 0 |
78edf8a1c884cdff7d1cc499dbb056689aeec205 | [
"object_id = request.GET.get('project_id', None)\nis_view_editing_data = request.GET.get('view_editing_data', False)\npreview_url = u'/termite2/webapp_page/?project_id={}&woid={}'.format(object_id, request.user.id)\nif is_view_editing_data:\n preview_url += '&page_id=preview'\npage_title = pagecreater.get_site_t... | <|body_start_0|>
object_id = request.GET.get('project_id', None)
is_view_editing_data = request.GET.get('view_editing_data', False)
preview_url = u'/termite2/webapp_page/?project_id={}&woid={}'.format(object_id, request.user.id)
if is_view_editing_data:
preview_url += '&page_... | 预览 | TermitePreview | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TermitePreview:
"""预览"""
def get(request):
"""预览"""
<|body_0|>
def api_put(request):
"""预览"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
object_id = request.GET.get('project_id', None)
is_view_editing_data = request.GET.get('view_editi... | stack_v2_sparse_classes_75kplus_train_006172 | 2,848 | no_license | [
{
"docstring": "预览",
"name": "get",
"signature": "def get(request)"
},
{
"docstring": "预览",
"name": "api_put",
"signature": "def api_put(request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_046322 | Implement the Python class `TermitePreview` described below.
Class description:
预览
Method signatures and docstrings:
- def get(request): 预览
- def api_put(request): 预览 | Implement the Python class `TermitePreview` described below.
Class description:
预览
Method signatures and docstrings:
- def get(request): 预览
- def api_put(request): 预览
<|skeleton|>
class TermitePreview:
"""预览"""
def get(request):
"""预览"""
<|body_0|>
def api_put(request):
"""预览"""... | 8b2f7befe92841bcc35e0e60cac5958ef3f3af54 | <|skeleton|>
class TermitePreview:
"""预览"""
def get(request):
"""预览"""
<|body_0|>
def api_put(request):
"""预览"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TermitePreview:
"""预览"""
def get(request):
"""预览"""
object_id = request.GET.get('project_id', None)
is_view_editing_data = request.GET.get('view_editing_data', False)
preview_url = u'/termite2/webapp_page/?project_id={}&woid={}'.format(object_id, request.user.id)
i... | the_stack_v2_python_sparse | weapp/termite2/termite_preview.py | chengdg/weizoom | train | 1 |
172123e56ba54fc8c4d0a801c18b0cff571083c1 | [
"provider_url = self.provider_url\nif provider_url is None:\n return None\nreturn provider_url.replace('$1', metaidentifier)",
"node = bioregistry_metaresource.term(self.prefix)\ngraph.add((node, RDF['type'], bioregistry_schema[self.__class__.__name__]))\ngraph.add((node, RDFS['label'], Literal(self.name)))\ng... | <|body_start_0|>
provider_url = self.provider_url
if provider_url is None:
return None
return provider_url.replace('$1', metaidentifier)
<|end_body_0|>
<|body_start_1|>
node = bioregistry_metaresource.term(self.prefix)
graph.add((node, RDF['type'], bioregistry_schema... | Metadata about a registry. | Registry | [
"MIT",
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Registry:
"""Metadata about a registry."""
def get_provider(self, metaidentifier: str) -> Optional[str]:
"""Get the provider string."""
<|body_0|>
def add_triples(self, graph: rdflib.Graph) -> Node:
"""Add triples to an RDF graph for this registry."""
<|b... | stack_v2_sparse_classes_75kplus_train_006173 | 10,018 | permissive | [
{
"docstring": "Get the provider string.",
"name": "get_provider",
"signature": "def get_provider(self, metaidentifier: str) -> Optional[str]"
},
{
"docstring": "Add triples to an RDF graph for this registry.",
"name": "add_triples",
"signature": "def add_triples(self, graph: rdflib.Grap... | 2 | stack_v2_sparse_classes_30k_test_002019 | Implement the Python class `Registry` described below.
Class description:
Metadata about a registry.
Method signatures and docstrings:
- def get_provider(self, metaidentifier: str) -> Optional[str]: Get the provider string.
- def add_triples(self, graph: rdflib.Graph) -> Node: Add triples to an RDF graph for this reg... | Implement the Python class `Registry` described below.
Class description:
Metadata about a registry.
Method signatures and docstrings:
- def get_provider(self, metaidentifier: str) -> Optional[str]: Get the provider string.
- def add_triples(self, graph: rdflib.Graph) -> Node: Add triples to an RDF graph for this reg... | ff20ca569958eec19ed23bc67c0485663e67ebd9 | <|skeleton|>
class Registry:
"""Metadata about a registry."""
def get_provider(self, metaidentifier: str) -> Optional[str]:
"""Get the provider string."""
<|body_0|>
def add_triples(self, graph: rdflib.Graph) -> Node:
"""Add triples to an RDF graph for this registry."""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Registry:
"""Metadata about a registry."""
def get_provider(self, metaidentifier: str) -> Optional[str]:
"""Get the provider string."""
provider_url = self.provider_url
if provider_url is None:
return None
return provider_url.replace('$1', metaidentifier)
... | the_stack_v2_python_sparse | src/bioregistry/schema/struct.py | polyneme/bioregistry | train | 0 |
9f4575256762219e9f0edaec801958bb09904ac6 | [
"driver = self.base_driver\ndriver.sleep(3)\ndriver.switch_to_frame('x,//*[@id =\"jquery-interactive-alert\"]/table/tbody/tr[2]/td[2]/div/div/div[4]/div/iframe')\ndriver.sleep(4)\nself.login_text = driver.get_text('x,//*[@id=\"phone_login_1\"]')\ndriver.type('p_name', '13823218582')\ndriver.click('x,//*[@id=\"am\"]... | <|body_start_0|>
driver = self.base_driver
driver.sleep(3)
driver.switch_to_frame('x,//*[@id ="jquery-interactive-alert"]/table/tbody/tr[2]/td[2]/div/div/div[4]/div/iframe')
driver.sleep(4)
self.login_text = driver.get_text('x,//*[@id="phone_login_1"]')
driver.type('p_nam... | ShopAfterLogin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShopAfterLogin:
def shop_num_login(self):
"""购买商品后短信验证登录"""
<|body_0|>
def shop_net_login(self):
"""购买商品后互联网验证登录"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
driver = self.base_driver
driver.sleep(3)
driver.switch_to_frame('x,//*[... | stack_v2_sparse_classes_75kplus_train_006174 | 1,581 | no_license | [
{
"docstring": "购买商品后短信验证登录",
"name": "shop_num_login",
"signature": "def shop_num_login(self)"
},
{
"docstring": "购买商品后互联网验证登录",
"name": "shop_net_login",
"signature": "def shop_net_login(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_035810 | Implement the Python class `ShopAfterLogin` described below.
Class description:
Implement the ShopAfterLogin class.
Method signatures and docstrings:
- def shop_num_login(self): 购买商品后短信验证登录
- def shop_net_login(self): 购买商品后互联网验证登录 | Implement the Python class `ShopAfterLogin` described below.
Class description:
Implement the ShopAfterLogin class.
Method signatures and docstrings:
- def shop_num_login(self): 购买商品后短信验证登录
- def shop_net_login(self): 购买商品后互联网验证登录
<|skeleton|>
class ShopAfterLogin:
def shop_num_login(self):
"""购买商品后短信验证... | b75bf1bdbf4ee14f0485d552ff2f382c7991821e | <|skeleton|>
class ShopAfterLogin:
def shop_num_login(self):
"""购买商品后短信验证登录"""
<|body_0|>
def shop_net_login(self):
"""购买商品后互联网验证登录"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShopAfterLogin:
def shop_num_login(self):
"""购买商品后短信验证登录"""
driver = self.base_driver
driver.sleep(3)
driver.switch_to_frame('x,//*[@id ="jquery-interactive-alert"]/table/tbody/tr[2]/td[2]/div/div/div[4]/div/iframe')
driver.sleep(4)
self.login_text = driver.get_... | the_stack_v2_python_sparse | nengkaiShop/page/after_login_page/shop_after_login.py | caixinshu/api | train | 0 | |
62da06083352717cd06395d00985dd6dcf9b2836 | [
"pg.ModellingBase.__init__(self, verbose)\nself.nlay = nlay\nself.FOP1d = data.FOP(nlay)\nself.nx = len(data.x)\nself.nf = len(data.freq())\nself.mesh_ = pg.createMesh1D(self.nx, 2 * nlay - 1)\nself.setMesh(self.mesh_)",
"modA = np.asarray(model).reshape((self.nlay * 2 - 1, self.nx)).T\nresp = pg.RVector(0)\nfor ... | <|body_start_0|>
pg.ModellingBase.__init__(self, verbose)
self.nlay = nlay
self.FOP1d = data.FOP(nlay)
self.nx = len(data.x)
self.nf = len(data.freq())
self.mesh_ = pg.createMesh1D(self.nx, 2 * nlay - 1)
self.setMesh(self.mesh_)
<|end_body_0|>
<|body_start_1|>
... | Old variant of 2D FOP (to be deleted). | FDEM2dFOPold | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FDEM2dFOPold:
"""Old variant of 2D FOP (to be deleted)."""
def __init__(self, data, nlay=2, verbose=False):
"""constructor with data and (optionally) number of layers"""
<|body_0|>
def response(self, model):
"""Yields forward model response."""
<|body_1|>... | stack_v2_sparse_classes_75kplus_train_006175 | 27,181 | permissive | [
{
"docstring": "constructor with data and (optionally) number of layers",
"name": "__init__",
"signature": "def __init__(self, data, nlay=2, verbose=False)"
},
{
"docstring": "Yields forward model response.",
"name": "response",
"signature": "def response(self, model)"
}
] | 2 | stack_v2_sparse_classes_30k_train_037830 | Implement the Python class `FDEM2dFOPold` described below.
Class description:
Old variant of 2D FOP (to be deleted).
Method signatures and docstrings:
- def __init__(self, data, nlay=2, verbose=False): constructor with data and (optionally) number of layers
- def response(self, model): Yields forward model response. | Implement the Python class `FDEM2dFOPold` described below.
Class description:
Old variant of 2D FOP (to be deleted).
Method signatures and docstrings:
- def __init__(self, data, nlay=2, verbose=False): constructor with data and (optionally) number of layers
- def response(self, model): Yields forward model response.
... | 9962fe882fad284e52858ba3aa5e87b2395d791d | <|skeleton|>
class FDEM2dFOPold:
"""Old variant of 2D FOP (to be deleted)."""
def __init__(self, data, nlay=2, verbose=False):
"""constructor with data and (optionally) number of layers"""
<|body_0|>
def response(self, model):
"""Yields forward model response."""
<|body_1|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FDEM2dFOPold:
"""Old variant of 2D FOP (to be deleted)."""
def __init__(self, data, nlay=2, verbose=False):
"""constructor with data and (optionally) number of layers"""
pg.ModellingBase.__init__(self, verbose)
self.nlay = nlay
self.FOP1d = data.FOP(nlay)
self.nx =... | the_stack_v2_python_sparse | python/pygimli/physics/em/fdem.py | Geophysics-OpenSource/gimli | train | 0 |
2f27f180076d85ede96ce548b4fe470e54cce54b | [
"pattern = 'data:(?P<mime>[\\\\w/]+);(?P<encoding>\\\\w+),(?P<data>.*)'\nm = re.search(pattern, data_uri)\nreturn (m.group('mime'), m.group('encoding'), m.group('data'))",
"def file_size(f):\n f.seek(0, os.SEEK_END)\n return f.tell()\nfile_uri = bundle.data.get(file_field, None)\nif file_uri:\n content_t... | <|body_start_0|>
pattern = 'data:(?P<mime>[\\w/]+);(?P<encoding>\\w+),(?P<data>.*)'
m = re.search(pattern, data_uri)
return (m.group('mime'), m.group('encoding'), m.group('data'))
<|end_body_0|>
<|body_start_1|>
def file_size(f):
f.seek(0, os.SEEK_END)
return f.t... | DataUriResourceMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataUriResourceMixin:
def parse_data_uri(self, data_uri):
"""Parse a data URI string Returns a tuple of (mime_type, encoding, data) represented in the URI See http://tools.ietf.org/html/rfc2397"""
<|body_0|>
def _hydrate_file(self, bundle, file_model_class, file_field, filen... | stack_v2_sparse_classes_75kplus_train_006176 | 22,939 | permissive | [
{
"docstring": "Parse a data URI string Returns a tuple of (mime_type, encoding, data) represented in the URI See http://tools.ietf.org/html/rfc2397",
"name": "parse_data_uri",
"signature": "def parse_data_uri(self, data_uri)"
},
{
"docstring": "Decode the base-64 encoded file",
"name": "_hy... | 2 | stack_v2_sparse_classes_30k_train_033346 | Implement the Python class `DataUriResourceMixin` described below.
Class description:
Implement the DataUriResourceMixin class.
Method signatures and docstrings:
- def parse_data_uri(self, data_uri): Parse a data URI string Returns a tuple of (mime_type, encoding, data) represented in the URI See http://tools.ietf.or... | Implement the Python class `DataUriResourceMixin` described below.
Class description:
Implement the DataUriResourceMixin class.
Method signatures and docstrings:
- def parse_data_uri(self, data_uri): Parse a data URI string Returns a tuple of (mime_type, encoding, data) represented in the URI See http://tools.ietf.or... | 15e429df850b68ee107a9b8206adc44fe1174370 | <|skeleton|>
class DataUriResourceMixin:
def parse_data_uri(self, data_uri):
"""Parse a data URI string Returns a tuple of (mime_type, encoding, data) represented in the URI See http://tools.ietf.org/html/rfc2397"""
<|body_0|>
def _hydrate_file(self, bundle, file_model_class, file_field, filen... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataUriResourceMixin:
def parse_data_uri(self, data_uri):
"""Parse a data URI string Returns a tuple of (mime_type, encoding, data) represented in the URI See http://tools.ietf.org/html/rfc2397"""
pattern = 'data:(?P<mime>[\\w/]+);(?P<encoding>\\w+),(?P<data>.*)'
m = re.search(pattern,... | the_stack_v2_python_sparse | apps/storybase/api/resources.py | denverfoundation/storybase | train | 3 | |
495ab6017d9190fdc4e604d4ee1cfa16f7bf5d67 | [
"if not username:\n raise ValueError('Users must have an username.')\nuser = self.model(username=username)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(username=username, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user"
] | <|body_start_0|>
if not username:
raise ValueError('Users must have an username.')
user = self.model(username=username)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.create_user(username=username... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, username, password=None):
"""Creates and saves a User with the given username and password."""
<|body_0|>
def create_superuser(self, username, password):
"""Creates and saves a superuser with the given username and password."""
... | stack_v2_sparse_classes_75kplus_train_006177 | 5,720 | no_license | [
{
"docstring": "Creates and saves a User with the given username and password.",
"name": "create_user",
"signature": "def create_user(self, username, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given username and password.",
"name": "create_superuser",
"sign... | 2 | stack_v2_sparse_classes_30k_train_045095 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, username, password=None): Creates and saves a User with the given username and password.
- def create_superuser(self, username, password): Creates... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, username, password=None): Creates and saves a User with the given username and password.
- def create_superuser(self, username, password): Creates... | a92f30a77ad3ba9f97e916d2c0a355641c9397ba | <|skeleton|>
class MyUserManager:
def create_user(self, username, password=None):
"""Creates and saves a User with the given username and password."""
<|body_0|>
def create_superuser(self, username, password):
"""Creates and saves a superuser with the given username and password."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, username, password=None):
"""Creates and saves a User with the given username and password."""
if not username:
raise ValueError('Users must have an username.')
user = self.model(username=username)
user.set_password(password)
... | the_stack_v2_python_sparse | app/models.py | nlattessi/inspt_tp_final_cpe | train | 0 | |
b5dba62868351a721c4982b464d83698f056cb19 | [
"print(len(matrix))\nif len(matrix) == 0:\n return False\nfor row in range(len(matrix)):\n for col in range(len(matrix[row])):\n print('::', matrix[row][col])\n if matrix[row][col] == target:\n return True\nreturn False",
"if not matrix or not matrix[0]:\n return False\nleft, rig... | <|body_start_0|>
print(len(matrix))
if len(matrix) == 0:
return False
for row in range(len(matrix)):
for col in range(len(matrix[row])):
print('::', matrix[row][col])
if matrix[row][col] == target:
return True
re... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrixNaive(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_0|>
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_006178 | 1,800 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool",
"name": "searchMatrixNaive",
"signature": "def searchMatrixNaive(self, matrix, target)"
},
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool",
"name": "searchMatrix",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_054591 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrixNaive(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrixNaive(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] ... | 786075e0f9f61cf062703bc0b41cc3191d77f033 | <|skeleton|>
class Solution:
def searchMatrixNaive(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_0|>
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_1|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchMatrixNaive(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
print(len(matrix))
if len(matrix) == 0:
return False
for row in range(len(matrix)):
for col in range(len(matrix[row])):
... | the_stack_v2_python_sparse | search2DMatrix.py | Anirban2404/LeetCodePractice | train | 1 | |
1c2587e2e11a60265619963bdf60ef9e0b94f7ca | [
"import random\nimport string\ns = ''\nletterCount = random.randint(3, 5)\nnumberCount = random.randint(3, 5)\nsuffleCount = random.randint(1, 10)\nfor _ in range(letterCount):\n s += str(random.choice(string.ascii_letters))\nfor _ in range(numberCount):\n s += str(random.choice(string.digits))\nlt = list(s)\... | <|body_start_0|>
import random
import string
s = ''
letterCount = random.randint(3, 5)
numberCount = random.randint(3, 5)
suffleCount = random.randint(1, 10)
for _ in range(letterCount):
s += str(random.choice(string.ascii_letters))
for _ in ra... | Get the joincode, To join in a admin group | GetJoinCodeAPIView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetJoinCodeAPIView:
"""Get the joincode, To join in a admin group"""
def _generateUniqueJoinCode(self):
"""Get unique code"""
<|body_0|>
def get(self, request, *args, **kwargs):
"""didn't allow to generate newcode ,if a joincode is generated already Returns exist... | stack_v2_sparse_classes_75kplus_train_006179 | 15,595 | permissive | [
{
"docstring": "Get unique code",
"name": "_generateUniqueJoinCode",
"signature": "def _generateUniqueJoinCode(self)"
},
{
"docstring": "didn't allow to generate newcode ,if a joincode is generated already Returns existing joincode for the requested admin, if all codes were used for joining, gen... | 2 | stack_v2_sparse_classes_30k_train_008695 | Implement the Python class `GetJoinCodeAPIView` described below.
Class description:
Get the joincode, To join in a admin group
Method signatures and docstrings:
- def _generateUniqueJoinCode(self): Get unique code
- def get(self, request, *args, **kwargs): didn't allow to generate newcode ,if a joincode is generated ... | Implement the Python class `GetJoinCodeAPIView` described below.
Class description:
Get the joincode, To join in a admin group
Method signatures and docstrings:
- def _generateUniqueJoinCode(self): Get unique code
- def get(self, request, *args, **kwargs): didn't allow to generate newcode ,if a joincode is generated ... | 82820d93876a2c3e6caec2725b1c6078e79e3bfb | <|skeleton|>
class GetJoinCodeAPIView:
"""Get the joincode, To join in a admin group"""
def _generateUniqueJoinCode(self):
"""Get unique code"""
<|body_0|>
def get(self, request, *args, **kwargs):
"""didn't allow to generate newcode ,if a joincode is generated already Returns exist... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetJoinCodeAPIView:
"""Get the joincode, To join in a admin group"""
def _generateUniqueJoinCode(self):
"""Get unique code"""
import random
import string
s = ''
letterCount = random.randint(3, 5)
numberCount = random.randint(3, 5)
suffleCount = rand... | the_stack_v2_python_sparse | grocery/shopowner/views.py | DeepakDk04/bigbasketClone | train | 0 |
ca63aac4d1f7230bf7b292ecf3e59f7ed20658f4 | [
"self.scr = scr\nself.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)\nself.label.rect.center = self.scr.get_rect().center",
"self.scr.fill(SCREEN_COLOR)\nself.label.draw()\npygame.display.flip()"
] | <|body_start_0|>
self.scr = scr
self.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)
self.label.rect.center = self.scr.get_rect().center
<|end_body_0|>
<|body_start_1|>
self.scr.fill(SCREEN_COLOR)
self.label.draw()
pygame.display.flip... | LoadingScreen | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadingScreen:
def __init__(self, scr):
"""Input parameters: scr - Surface for drawing."""
<|body_0|>
def draw(self):
"""Fills the specified surface with solid color and renders the text label with message."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_006180 | 851 | permissive | [
{
"docstring": "Input parameters: scr - Surface for drawing.",
"name": "__init__",
"signature": "def __init__(self, scr)"
},
{
"docstring": "Fills the specified surface with solid color and renders the text label with message.",
"name": "draw",
"signature": "def draw(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_036720 | Implement the Python class `LoadingScreen` described below.
Class description:
Implement the LoadingScreen class.
Method signatures and docstrings:
- def __init__(self, scr): Input parameters: scr - Surface for drawing.
- def draw(self): Fills the specified surface with solid color and renders the text label with mes... | Implement the Python class `LoadingScreen` described below.
Class description:
Implement the LoadingScreen class.
Method signatures and docstrings:
- def __init__(self, scr): Input parameters: scr - Surface for drawing.
- def draw(self): Fills the specified surface with solid color and renders the text label with mes... | f15e9d609e763e70710cd3e0faea9a5a18dfd8a5 | <|skeleton|>
class LoadingScreen:
def __init__(self, scr):
"""Input parameters: scr - Surface for drawing."""
<|body_0|>
def draw(self):
"""Fills the specified surface with solid color and renders the text label with message."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoadingScreen:
def __init__(self, scr):
"""Input parameters: scr - Surface for drawing."""
self.scr = scr
self.label = TextLabel(scr=self.scr, text=TEXT_MESSAGE, color=TEXT_COLOR, size=FONT_SIZE)
self.label.rect.center = self.scr.get_rect().center
def draw(self):
"... | the_stack_v2_python_sparse | loading_screen.py | ammydolphin/space_racer | train | 0 | |
7d7736a805a85aeef00b2cdda1a5dcc44d5669db | [
"try:\n logger.info('文件整理测试')\n self.login()\n result = self.file_arrangement()\n self.assertEqual(result, '保存成功!')\nexcept Exception as msg:\n logger.error(u'异常原因:%s' % msg)\n self.driver.get_screenshot_as_file(os.path.join(readconfig.screen_path, 'test_file_arrangement.png'))\n raise Exceptio... | <|body_start_0|>
try:
logger.info('文件整理测试')
self.login()
result = self.file_arrangement()
self.assertEqual(result, '保存成功!')
except Exception as msg:
logger.error(u'异常原因:%s' % msg)
self.driver.get_screenshot_as_file(os.path.join(read... | 硬盘管理测试 | DiskManagementTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiskManagementTest:
"""硬盘管理测试"""
def test2_file_arrangement(self):
"""文件整理测试"""
<|body_0|>
def test3_software_upload(self):
"""辅助软件上传测试"""
<|body_1|>
def test4_disk_format(self):
"""硬盘格式化测试"""
<|body_2|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_006181 | 2,563 | no_license | [
{
"docstring": "文件整理测试",
"name": "test2_file_arrangement",
"signature": "def test2_file_arrangement(self)"
},
{
"docstring": "辅助软件上传测试",
"name": "test3_software_upload",
"signature": "def test3_software_upload(self)"
},
{
"docstring": "硬盘格式化测试",
"name": "test4_disk_format",
... | 3 | null | Implement the Python class `DiskManagementTest` described below.
Class description:
硬盘管理测试
Method signatures and docstrings:
- def test2_file_arrangement(self): 文件整理测试
- def test3_software_upload(self): 辅助软件上传测试
- def test4_disk_format(self): 硬盘格式化测试 | Implement the Python class `DiskManagementTest` described below.
Class description:
硬盘管理测试
Method signatures and docstrings:
- def test2_file_arrangement(self): 文件整理测试
- def test3_software_upload(self): 辅助软件上传测试
- def test4_disk_format(self): 硬盘格式化测试
<|skeleton|>
class DiskManagementTest:
"""硬盘管理测试"""
def t... | fd552eeb47fd4838c2c5caef4deea7480ab75ce9 | <|skeleton|>
class DiskManagementTest:
"""硬盘管理测试"""
def test2_file_arrangement(self):
"""文件整理测试"""
<|body_0|>
def test3_software_upload(self):
"""辅助软件上传测试"""
<|body_1|>
def test4_disk_format(self):
"""硬盘格式化测试"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DiskManagementTest:
"""硬盘管理测试"""
def test2_file_arrangement(self):
"""文件整理测试"""
try:
logger.info('文件整理测试')
self.login()
result = self.file_arrangement()
self.assertEqual(result, '保存成功!')
except Exception as msg:
logger.er... | the_stack_v2_python_sparse | test_case/A002_disk_management_test.py | luhuifnag/AVA_UIauto_test | train | 0 |
90d64461fb873f406b049cf93a3b51fd3485af29 | [
"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... | MapServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MapServicer:
def GetRoadNetwork(self, request, context):
"""Returns the road network structure of the current scene. Large response, call only once."""
<|body_0|>
def ToRoadPoint(self, request, context):
"""Converts from world coordinates to road coordinates."""
... | stack_v2_sparse_classes_75kplus_train_006182 | 5,232 | no_license | [
{
"docstring": "Returns the road network structure of the current scene. Large response, call only once.",
"name": "GetRoadNetwork",
"signature": "def GetRoadNetwork(self, request, context)"
},
{
"docstring": "Converts from world coordinates to road coordinates.",
"name": "ToRoadPoint",
... | 5 | stack_v2_sparse_classes_30k_train_047154 | Implement the Python class `MapServicer` described below.
Class description:
Implement the MapServicer class.
Method signatures and docstrings:
- def GetRoadNetwork(self, request, context): Returns the road network structure of the current scene. Large response, call only once.
- def ToRoadPoint(self, request, contex... | Implement the Python class `MapServicer` described below.
Class description:
Implement the MapServicer class.
Method signatures and docstrings:
- def GetRoadNetwork(self, request, context): Returns the road network structure of the current scene. Large response, call only once.
- def ToRoadPoint(self, request, contex... | 090b9bd6af1fdf012afc4b7cc19c3c80e4651dba | <|skeleton|>
class MapServicer:
def GetRoadNetwork(self, request, context):
"""Returns the road network structure of the current scene. Large response, call only once."""
<|body_0|>
def ToRoadPoint(self, request, context):
"""Converts from world coordinates to road coordinates."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MapServicer:
def GetRoadNetwork(self, request, context):
"""Returns the road network structure of the current scene. Large response, call only once."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Meth... | the_stack_v2_python_sparse | NativeAPI/Native-API/Tools/DataConversion/python/metamoto/services/map_pb2_grpc.py | Huzefa-Kagalwala/OpenCAV-Metamoto | train | 0 | |
c33383580f7ddf7a92122fc8650d60b05dfcbfd6 | [
"discrete_space, continuous_space = env.action_space.spaces\nassert isinstance(continuous_space, spaces.Box) or isinstance(continuous_space, spaces.Tuple), 'expected Box or Tuple for continuous action space, got {}'.format(type(continuous_space))\nsuper().__init__(env)\nself.low = np.zeros(continuous_space.shape, d... | <|body_start_0|>
discrete_space, continuous_space = env.action_space.spaces
assert isinstance(continuous_space, spaces.Box) or isinstance(continuous_space, spaces.Tuple), 'expected Box or Tuple for continuous action space, got {}'.format(type(continuous_space))
super().__init__(env)
self... | Rescales the continuous actions of a parameterized action space. | RescaleParameterizedAction | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RescaleParameterizedAction:
"""Rescales the continuous actions of a parameterized action space."""
def __init__(self, env: Env, low: float, high: float):
"""Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment wi... | stack_v2_sparse_classes_75kplus_train_006183 | 3,671 | permissive | [
{
"docstring": "Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment with the action space to wrap. low: The infinum of the action space. hi gh: The suprenum of the action space.",
"name": "__init__",
"signature": "def __init__(self... | 3 | stack_v2_sparse_classes_30k_train_001931 | Implement the Python class `RescaleParameterizedAction` described below.
Class description:
Rescales the continuous actions of a parameterized action space.
Method signatures and docstrings:
- def __init__(self, env: Env, low: float, high: float): Rescales the continuous actions of the parameterized action space to h... | Implement the Python class `RescaleParameterizedAction` described below.
Class description:
Rescales the continuous actions of a parameterized action space.
Method signatures and docstrings:
- def __init__(self, env: Env, low: float, high: float): Rescales the continuous actions of the parameterized action space to h... | cde3be1c69bfd76fe4a78fa529e851d0a78318c7 | <|skeleton|>
class RescaleParameterizedAction:
"""Rescales the continuous actions of a parameterized action space."""
def __init__(self, env: Env, low: float, high: float):
"""Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment wi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RescaleParameterizedAction:
"""Rescales the continuous actions of a parameterized action space."""
def __init__(self, env: Env, low: float, high: float):
"""Rescales the continuous actions of the parameterized action space to have the low and high given. Args: env: The environment with the action... | the_stack_v2_python_sparse | hlrl/core/envs/gym/wrappers/rescale_parameterized_action.py | Chainso/HLRL | train | 3 |
96a7120c90af2788b912cda750837aee6100caaa | [
"self.letters = 400\nself.d = 55\nself.w = np.zeros((self.d + 1, self.letters))\nself.g = np.zeros((self.letters, self.letters))\nself.alphabet = list('abcdefghijklmnopqrstuvwxyz')",
"weights = self.w\nL = word.shape[1]\nF = np.zeros((self.letters, L))\nGF_id = np.zeros((self.letters, L)).astype(int)\nprediction ... | <|body_start_0|>
self.letters = 400
self.d = 55
self.w = np.zeros((self.d + 1, self.letters))
self.g = np.zeros((self.letters, self.letters))
self.alphabet = list('abcdefghijklmnopqrstuvwxyz')
<|end_body_0|>
<|body_start_1|>
weights = self.w
L = word.shape[1]
... | LinearStructuredOutputClassifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearStructuredOutputClassifier:
def __init__(self):
"""Defines number of classes (self.letters) and number of fetures (self.d)"""
<|body_0|>
def predict(self, word):
"""Predicts letter. Makes dot prouct of input feature vector x with all columns of matrix w. Than a... | stack_v2_sparse_classes_75kplus_train_006184 | 8,369 | permissive | [
{
"docstring": "Defines number of classes (self.letters) and number of fetures (self.d)",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Predicts letter. Makes dot prouct of input feature vector x with all columns of matrix w. Than argmax selects highest value from dot ... | 6 | stack_v2_sparse_classes_30k_train_047201 | Implement the Python class `LinearStructuredOutputClassifier` described below.
Class description:
Implement the LinearStructuredOutputClassifier class.
Method signatures and docstrings:
- def __init__(self): Defines number of classes (self.letters) and number of fetures (self.d)
- def predict(self, word): Predicts le... | Implement the Python class `LinearStructuredOutputClassifier` described below.
Class description:
Implement the LinearStructuredOutputClassifier class.
Method signatures and docstrings:
- def __init__(self): Defines number of classes (self.letters) and number of fetures (self.d)
- def predict(self, word): Predicts le... | 016fd81df6fb56019c9a48ec6d904da119e5d3d4 | <|skeleton|>
class LinearStructuredOutputClassifier:
def __init__(self):
"""Defines number of classes (self.letters) and number of fetures (self.d)"""
<|body_0|>
def predict(self, word):
"""Predicts letter. Makes dot prouct of input feature vector x with all columns of matrix w. Than a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LinearStructuredOutputClassifier:
def __init__(self):
"""Defines number of classes (self.letters) and number of fetures (self.d)"""
self.letters = 400
self.d = 55
self.w = np.zeros((self.d + 1, self.letters))
self.g = np.zeros((self.letters, self.letters))
self.... | the_stack_v2_python_sparse | models/perceptron.py | lukoucky/swimming_pool_attendance_prediction | train | 0 | |
90a15fcf268132f139a85f2c8c95b44850af0f8d | [
"execution_result = self.drop_token_game.start()\ncomparison_error = self.cli_execution_validator.get_execution_result_comparison_error(execution_result, self.ExpectedCommandOutcomes.ProgramStart())\nif comparison_error:\n self.fail(comparison_error)",
"self.drop_token_game.start()\nvalid_column = 1\nexecution... | <|body_start_0|>
execution_result = self.drop_token_game.start()
comparison_error = self.cli_execution_validator.get_execution_result_comparison_error(execution_result, self.ExpectedCommandOutcomes.ProgramStart())
if comparison_error:
self.fail(comparison_error)
<|end_body_0|>
<|bod... | SmokeTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SmokeTests:
def test_smoke_0001(self):
"""@test Program starts without Error"""
<|body_0|>
def test_smoke_0002(self):
"""@test Program returns appropriate output with input - PUT X (in bounds)"""
<|body_1|>
def test_smoke_0003(self):
"""@test Pro... | stack_v2_sparse_classes_75kplus_train_006185 | 3,110 | no_license | [
{
"docstring": "@test Program starts without Error",
"name": "test_smoke_0001",
"signature": "def test_smoke_0001(self)"
},
{
"docstring": "@test Program returns appropriate output with input - PUT X (in bounds)",
"name": "test_smoke_0002",
"signature": "def test_smoke_0002(self)"
},
... | 6 | stack_v2_sparse_classes_30k_train_040124 | Implement the Python class `SmokeTests` described below.
Class description:
Implement the SmokeTests class.
Method signatures and docstrings:
- def test_smoke_0001(self): @test Program starts without Error
- def test_smoke_0002(self): @test Program returns appropriate output with input - PUT X (in bounds)
- def test_... | Implement the Python class `SmokeTests` described below.
Class description:
Implement the SmokeTests class.
Method signatures and docstrings:
- def test_smoke_0001(self): @test Program starts without Error
- def test_smoke_0002(self): @test Program returns appropriate output with input - PUT X (in bounds)
- def test_... | 79cd85649e60ca6a4a731966ab434060d49fe110 | <|skeleton|>
class SmokeTests:
def test_smoke_0001(self):
"""@test Program starts without Error"""
<|body_0|>
def test_smoke_0002(self):
"""@test Program returns appropriate output with input - PUT X (in bounds)"""
<|body_1|>
def test_smoke_0003(self):
"""@test Pro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SmokeTests:
def test_smoke_0001(self):
"""@test Program starts without Error"""
execution_result = self.drop_token_game.start()
comparison_error = self.cli_execution_validator.get_execution_result_comparison_error(execution_result, self.ExpectedCommandOutcomes.ProgramStart())
i... | the_stack_v2_python_sparse | src/e2e_tests/smoke_tests.py | wmaxlloyd/9dt-e2e-test-framework | train | 0 | |
7d35545b6372aec057a4a78c9d8a50f8c8eacd90 | [
"try:\n BinarySearchTree()\nexcept:\n self.fail('Error while constructing a BinarySearchTree')",
"itemcount = 26\nitems = []\nfor i in range(itemcount):\n items.append((i, chr(ord('a') + i)))\nrandom.shuffle(items)\nbintree = BinarySearchTree()\nfor key, value in items:\n bintree[key] = value\nself.as... | <|body_start_0|>
try:
BinarySearchTree()
except:
self.fail('Error while constructing a BinarySearchTree')
<|end_body_0|>
<|body_start_1|>
itemcount = 26
items = []
for i in range(itemcount):
items.append((i, chr(ord('a') + i)))
random.... | TestProblem5 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestProblem5:
def test_API(self):
"""P5: Sanity Test: Is BinarySearchTree constructable?"""
<|body_0|>
def test_storeAndLoad(self):
"""P5: Can items be stored and retrieved from the BinarySearchTree?"""
<|body_1|>
def test_updates(self):
"""P5: C... | stack_v2_sparse_classes_75kplus_train_006186 | 11,207 | no_license | [
{
"docstring": "P5: Sanity Test: Is BinarySearchTree constructable?",
"name": "test_API",
"signature": "def test_API(self)"
},
{
"docstring": "P5: Can items be stored and retrieved from the BinarySearchTree?",
"name": "test_storeAndLoad",
"signature": "def test_storeAndLoad(self)"
},
... | 3 | stack_v2_sparse_classes_30k_train_012433 | Implement the Python class `TestProblem5` described below.
Class description:
Implement the TestProblem5 class.
Method signatures and docstrings:
- def test_API(self): P5: Sanity Test: Is BinarySearchTree constructable?
- def test_storeAndLoad(self): P5: Can items be stored and retrieved from the BinarySearchTree?
- ... | Implement the Python class `TestProblem5` described below.
Class description:
Implement the TestProblem5 class.
Method signatures and docstrings:
- def test_API(self): P5: Sanity Test: Is BinarySearchTree constructable?
- def test_storeAndLoad(self): P5: Can items be stored and retrieved from the BinarySearchTree?
- ... | d4f32507a5f581ad8ee0ce84e6cd92daac0941d7 | <|skeleton|>
class TestProblem5:
def test_API(self):
"""P5: Sanity Test: Is BinarySearchTree constructable?"""
<|body_0|>
def test_storeAndLoad(self):
"""P5: Can items be stored and retrieved from the BinarySearchTree?"""
<|body_1|>
def test_updates(self):
"""P5: C... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestProblem5:
def test_API(self):
"""P5: Sanity Test: Is BinarySearchTree constructable?"""
try:
BinarySearchTree()
except:
self.fail('Error while constructing a BinarySearchTree')
def test_storeAndLoad(self):
"""P5: Can items be stored and retrieve... | the_stack_v2_python_sparse | Homework5/hw5_test.py | pillowfication/ECS-32B | train | 1 | |
ad62afe12fac08f8f15d5e451be6d1e5124370b7 | [
"Block.__init__(self, scenario, args)\nif self.language is None:\n raise LoadingException('Language must be defined!')\nself.lexicon = Lexicon()",
"if tnode.gram_verbmod != 'cdn' or re.search('(aby|kdyby)', tnode.formeme):\n return\naconj = tnode.get_deref_attr('wild/conjugated')\nif aconj.afun == 'AuxV':\n... | <|body_start_0|>
Block.__init__(self, scenario, args)
if self.language is None:
raise LoadingException('Language must be defined!')
self.lexicon = Lexicon()
<|end_body_0|>
<|body_start_1|>
if tnode.gram_verbmod != 'cdn' or re.search('(aby|kdyby)', tnode.formeme):
... | Add conditional auxiliary 'by'/'bych'. Arguments: language: the language of the target tree selector: the selector of the target tree | AddAuxVerbConditional | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddAuxVerbConditional:
"""Add conditional auxiliary 'by'/'bych'. Arguments: language: the language of the target tree selector: the selector of the target tree"""
def __init__(self, scenario, args):
"""Constructor, just checking the argument values"""
<|body_0|>
def proc... | stack_v2_sparse_classes_75kplus_train_006187 | 1,984 | permissive | [
{
"docstring": "Constructor, just checking the argument values",
"name": "__init__",
"signature": "def __init__(self, scenario, args)"
},
{
"docstring": "Add conditional auxiliary to a node, where appropriate.",
"name": "process_tnode",
"signature": "def process_tnode(self, tnode)"
}
] | 2 | stack_v2_sparse_classes_30k_train_039850 | Implement the Python class `AddAuxVerbConditional` described below.
Class description:
Add conditional auxiliary 'by'/'bych'. Arguments: language: the language of the target tree selector: the selector of the target tree
Method signatures and docstrings:
- def __init__(self, scenario, args): Constructor, just checkin... | Implement the Python class `AddAuxVerbConditional` described below.
Class description:
Add conditional auxiliary 'by'/'bych'. Arguments: language: the language of the target tree selector: the selector of the target tree
Method signatures and docstrings:
- def __init__(self, scenario, args): Constructor, just checkin... | 73af644ec35c8a1cd0c37cd478c2afc1db717e0b | <|skeleton|>
class AddAuxVerbConditional:
"""Add conditional auxiliary 'by'/'bych'. Arguments: language: the language of the target tree selector: the selector of the target tree"""
def __init__(self, scenario, args):
"""Constructor, just checking the argument values"""
<|body_0|>
def proc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddAuxVerbConditional:
"""Add conditional auxiliary 'by'/'bych'. Arguments: language: the language of the target tree selector: the selector of the target tree"""
def __init__(self, scenario, args):
"""Constructor, just checking the argument values"""
Block.__init__(self, scenario, args)
... | the_stack_v2_python_sparse | alex/components/nlg/tectotpl/block/t2a/cs/addauxverbconditional.py | oplatek/alex | train | 0 |
a9eab2ef4b94851019af2eb8818ad7dd47e983e0 | [
"try:\n all_notifications = Notification.query.filter(Notification.owner_id == user_id).order_by(Notification.timestamp.desc()).all()\nexcept:\n return make_response(jsonify({'error': 'Database Connection Problem'}), 500)\ntry:\n related_users = {}\n for notification in all_notifications:\n relat... | <|body_start_0|>
try:
all_notifications = Notification.query.filter(Notification.owner_id == user_id).order_by(Notification.timestamp.desc()).all()
except:
return make_response(jsonify({'error': 'Database Connection Problem'}), 500)
try:
related_users = {}
... | NotificationAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NotificationAPI:
def get(user_id, self):
"""Returns all notifications of the logged in user with related user lists"""
<|body_0|>
def post(user_id, self):
"""Updates the Notification Status Information"""
<|body_1|>
def delete(user_id, self):
"""... | stack_v2_sparse_classes_75kplus_train_006188 | 22,916 | no_license | [
{
"docstring": "Returns all notifications of the logged in user with related user lists",
"name": "get",
"signature": "def get(user_id, self)"
},
{
"docstring": "Updates the Notification Status Information",
"name": "post",
"signature": "def post(user_id, self)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_030270 | Implement the Python class `NotificationAPI` described below.
Class description:
Implement the NotificationAPI class.
Method signatures and docstrings:
- def get(user_id, self): Returns all notifications of the logged in user with related user lists
- def post(user_id, self): Updates the Notification Status Informati... | Implement the Python class `NotificationAPI` described below.
Class description:
Implement the NotificationAPI class.
Method signatures and docstrings:
- def get(user_id, self): Returns all notifications of the logged in user with related user lists
- def post(user_id, self): Updates the Notification Status Informati... | f7aebee17a0a79e8d3c2927733bce8015b4a9da3 | <|skeleton|>
class NotificationAPI:
def get(user_id, self):
"""Returns all notifications of the logged in user with related user lists"""
<|body_0|>
def post(user_id, self):
"""Updates the Notification Status Information"""
<|body_1|>
def delete(user_id, self):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NotificationAPI:
def get(user_id, self):
"""Returns all notifications of the logged in user with related user lists"""
try:
all_notifications = Notification.query.filter(Notification.owner_id == user_id).order_by(Notification.timestamp.desc()).all()
except:
retu... | the_stack_v2_python_sparse | platon/backend/app/profile_management/views.py | bounswe/bounswe2020group7 | train | 18 | |
3b333606eedf1ce4f3e68ebcca21ac6f5444e1f9 | [
"super(CRB, self).__init__()\nself.InChan = InChannel\nself.InterCh = InterChannel\nself.OutChan = OutChannel\nself.ConvB = nn.ModuleList()\nif self.InChan != self.OutChan:\n self.trans = nn.Sequential(*[nn.Conv2d(self.InChan, self.OutChan, kSize, padding=(kSize - 1) // 2, stride=1), nn.ReLU()])\nself.ConvB = nn... | <|body_start_0|>
super(CRB, self).__init__()
self.InChan = InChannel
self.InterCh = InterChannel
self.OutChan = OutChannel
self.ConvB = nn.ModuleList()
if self.InChan != self.OutChan:
self.trans = nn.Sequential(*[nn.Conv2d(self.InChan, self.OutChan, kSize, pad... | Construct the residual block for JDDNET. | CRB | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CRB:
"""Construct the residual block for JDDNET."""
def __init__(self, InChannel, InterChannel, OutChannel, kSize=3):
"""Initialize Block. :param InChannel: the channel number of input :type InChannel: int :param InterChannel: the channel number of interlayer :type InterChannel: int ... | stack_v2_sparse_classes_75kplus_train_006189 | 6,597 | permissive | [
{
"docstring": "Initialize Block. :param InChannel: the channel number of input :type InChannel: int :param InterChannel: the channel number of interlayer :type InterChannel: int :param OutChannel: the channel number of output :type OutChannel: int :param kSize: the kernel size of convolution :type kSize: int",... | 2 | null | Implement the Python class `CRB` described below.
Class description:
Construct the residual block for JDDNET.
Method signatures and docstrings:
- def __init__(self, InChannel, InterChannel, OutChannel, kSize=3): Initialize Block. :param InChannel: the channel number of input :type InChannel: int :param InterChannel: ... | Implement the Python class `CRB` described below.
Class description:
Construct the residual block for JDDNET.
Method signatures and docstrings:
- def __init__(self, InChannel, InterChannel, OutChannel, kSize=3): Initialize Block. :param InChannel: the channel number of input :type InChannel: int :param InterChannel: ... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class CRB:
"""Construct the residual block for JDDNET."""
def __init__(self, InChannel, InterChannel, OutChannel, kSize=3):
"""Initialize Block. :param InChannel: the channel number of input :type InChannel: int :param InterChannel: the channel number of interlayer :type InterChannel: int ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CRB:
"""Construct the residual block for JDDNET."""
def __init__(self, InChannel, InterChannel, OutChannel, kSize=3):
"""Initialize Block. :param InChannel: the channel number of input :type InChannel: int :param InterChannel: the channel number of interlayer :type InterChannel: int :param OutCha... | the_stack_v2_python_sparse | built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/pytorch/jddbodys/jdd_net.py | Huawei-Ascend/modelzoo | train | 1 |
a69c132bd1b1fa468a8abb189844ac73080c36be | [
"if len(nums) <= 1:\n return False\nfor i in range(len(nums)):\n for j in range(len(nums)):\n if i is not j and nums[i] + nums[j] == target:\n return [i, j]",
"if len(nums) <= 1:\n return False\nbuf_dict = {}\nfor i in range(len(nums)):\n if nums[i] in buf_dict:\n return [buf_... | <|body_start_0|>
if len(nums) <= 1:
return False
for i in range(len(nums)):
for j in range(len(nums)):
if i is not j and nums[i] + nums[j] == target:
return [i, j]
<|end_body_0|>
<|body_start_1|>
if len(nums) <= 1:
return F... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twosum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twosum_hash(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
def twosum_enumerate(self... | stack_v2_sparse_classes_75kplus_train_006190 | 1,310 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twosum",
"signature": "def twosum(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "twosum_hash",
"signature": "def twosum_hash(self, nums, targ... | 3 | stack_v2_sparse_classes_30k_train_054713 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twosum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twosum_hash(self, nums, target): :type nums: List[int] :type target: int :rtype: L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twosum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def twosum_hash(self, nums, target): :type nums: List[int] :type target: int :rtype: L... | 326d2656b2f852f64c43ab4932ebd0819ae6d5b9 | <|skeleton|>
class Solution:
def twosum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twosum_hash(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>
def twosum_enumerate(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twosum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
if len(nums) <= 1:
return False
for i in range(len(nums)):
for j in range(len(nums)):
if i is not j and nums[i] + nums[j] == target:
... | the_stack_v2_python_sparse | LeetCode/LeetCode_1.py | No1CharlesWu/Python | train | 0 | |
3119ec891683e72a49046e7cff5463760b8e7a7e | [
"profiles = Profile.objects.all()\nserializer = ProfileCreateSerializer(profiles, many=True)\nreturn Response(serializer.data)",
"serializer = ProfileCreateSerializer(data=request.data)\nif serializer.is_valid(raise_exception=ValueError):\n serializer.save()\n return Response(serializer.data, status=status.... | <|body_start_0|>
profiles = Profile.objects.all()
serializer = ProfileCreateSerializer(profiles, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
serializer = ProfileCreateSerializer(data=request.data)
if serializer.is_valid(raise_exception=ValueError)... | A class based view for creating and fetching student records | ProfileCreateAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileCreateAPIView:
"""A class based view for creating and fetching student records"""
def get(self, format: object=None) -> object:
"""Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records"""
<|body... | stack_v2_sparse_classes_75kplus_train_006191 | 8,136 | no_license | [
{
"docstring": "Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records",
"name": "get",
"signature": "def get(self, format: object=None) -> object"
},
{
"docstring": "Create a student record :param format: Format of the st... | 2 | stack_v2_sparse_classes_30k_train_025685 | Implement the Python class `ProfileCreateAPIView` described below.
Class description:
A class based view for creating and fetching student records
Method signatures and docstrings:
- def get(self, format: object=None) -> object: Get all the student records :param format: Format of the student records to return to :re... | Implement the Python class `ProfileCreateAPIView` described below.
Class description:
A class based view for creating and fetching student records
Method signatures and docstrings:
- def get(self, format: object=None) -> object: Get all the student records :param format: Format of the student records to return to :re... | 42e42cbd9b7dbcaed38109b7373735ff110900a3 | <|skeleton|>
class ProfileCreateAPIView:
"""A class based view for creating and fetching student records"""
def get(self, format: object=None) -> object:
"""Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProfileCreateAPIView:
"""A class based view for creating and fetching student records"""
def get(self, format: object=None) -> object:
"""Get all the student records :param format: Format of the student records to return to :return: Returns a list of student records"""
profiles = Profile.... | the_stack_v2_python_sparse | UserRegistrationApp/views.py | HishamDigitalHub/SportActivities | train | 0 |
537a597a73ab20be3d40a94295bc5c7548214eed | [
"self.snmp_object = snmp_object\nself.test_oid = test_oid\nself.tags = tags",
"validity = False\nif self.snmp_object.oid_exists(self.test_oid) is True:\n validity = True\nreturn validity"
] | <|body_start_0|>
self.snmp_object = snmp_object
self.test_oid = test_oid
self.tags = tags
<|end_body_0|>
<|body_start_1|>
validity = False
if self.snmp_object.oid_exists(self.test_oid) is True:
validity = True
return validity
<|end_body_1|>
| Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB information from the device. Keyed by... | Query | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Query:
"""Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB info... | stack_v2_sparse_classes_75kplus_train_006192 | 1,527 | permissive | [
{
"docstring": "Function for intializing the class. Args: snmp_object: SNMP Interact class object from snmp_manager.py Returns: None",
"name": "__init__",
"signature": "def __init__(self, snmp_object, test_oid, tags)"
},
{
"docstring": "Return device's support for the MIB. Args: None Returns: va... | 2 | stack_v2_sparse_classes_30k_train_000361 | Implement the Python class `Query` described below.
Class description:
Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. laye... | Implement the Python class `Query` described below.
Class description:
Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. laye... | ae82589fbbab77fef6d6be09c1fcca5846f595a8 | <|skeleton|>
class Query:
"""Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB info... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Query:
"""Base snmp query object. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. layer1: Returns all needed layer 1 MIB information from ... | the_stack_v2_python_sparse | switchmap/snmp/base_query.py | PalisadoesFoundation/switchmap-ng | train | 8 |
031f7932f060574d8950ad7bd22c64639b8b52c4 | [
"fso = FastStochasticOscillator()\ntoday = pd.Timestamp('2015')\nassets = np.arange(3, dtype=np.float64)\nout = np.empty(shape=(3,), dtype=np.float64)\nhighs = np.full((50, 3), 3, dtype=np.float64)\nlows = np.full((50, 3), 2, dtype=np.float64)\ncloses = np.full((50, 3), 4, dtype=np.float64)\nfso.compute(today, asse... | <|body_start_0|>
fso = FastStochasticOscillator()
today = pd.Timestamp('2015')
assets = np.arange(3, dtype=np.float64)
out = np.empty(shape=(3,), dtype=np.float64)
highs = np.full((50, 3), 3, dtype=np.float64)
lows = np.full((50, 3), 2, dtype=np.float64)
closes = ... | Test the Fast Stochastic Oscillator | TestFastStochasticOscillator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFastStochasticOscillator:
"""Test the Fast Stochastic Oscillator"""
def test_fso_expected_basic(self):
"""Simple test of expected output from fast stochastic oscillator"""
<|body_0|>
def test_fso_expected_with_talib(self, seed):
"""Test the output that is ret... | stack_v2_sparse_classes_75kplus_train_006193 | 20,639 | permissive | [
{
"docstring": "Simple test of expected output from fast stochastic oscillator",
"name": "test_fso_expected_basic",
"signature": "def test_fso_expected_basic(self)"
},
{
"docstring": "Test the output that is returned from the fast stochastic oscillator is the same as that from the ta-lib STOCHF ... | 2 | stack_v2_sparse_classes_30k_train_035638 | Implement the Python class `TestFastStochasticOscillator` described below.
Class description:
Test the Fast Stochastic Oscillator
Method signatures and docstrings:
- def test_fso_expected_basic(self): Simple test of expected output from fast stochastic oscillator
- def test_fso_expected_with_talib(self, seed): Test t... | Implement the Python class `TestFastStochasticOscillator` described below.
Class description:
Test the Fast Stochastic Oscillator
Method signatures and docstrings:
- def test_fso_expected_basic(self): Simple test of expected output from fast stochastic oscillator
- def test_fso_expected_with_talib(self, seed): Test t... | d08d1a9a343232e37d9e5767cae64af799067b45 | <|skeleton|>
class TestFastStochasticOscillator:
"""Test the Fast Stochastic Oscillator"""
def test_fso_expected_basic(self):
"""Simple test of expected output from fast stochastic oscillator"""
<|body_0|>
def test_fso_expected_with_talib(self, seed):
"""Test the output that is ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFastStochasticOscillator:
"""Test the Fast Stochastic Oscillator"""
def test_fso_expected_basic(self):
"""Simple test of expected output from fast stochastic oscillator"""
fso = FastStochasticOscillator()
today = pd.Timestamp('2015')
assets = np.arange(3, dtype=np.floa... | the_stack_v2_python_sparse | zipline/_tests/pipeline/test_technical.py | quantrocket-llc/zipline | train | 17 |
c86220b90dfd2b29ae7e19c84b7ff0dc6030c0c8 | [
"def countOnes(x: int) -> int:\n ones = 0\n while x > 0:\n x &= x - 1\n ones += 1\n return ones\nbits = [countOnes(i) for i in range(n + 1)]\nreturn bits",
"bits = [0]\nfor i in range(1, n + 1):\n bits.append(bits[i >> 1] + (i & 1))\nreturn bits",
"bits = [0]\nfor i in range(1, n + 1):... | <|body_start_0|>
def countOnes(x: int) -> int:
ones = 0
while x > 0:
x &= x - 1
ones += 1
return ones
bits = [countOnes(i) for i in range(n + 1)]
return bits
<|end_body_0|>
<|body_start_1|>
bits = [0]
for i in r... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countBits(self, n: int) -> List[int]:
"""时间复杂度:O(nlogn) 空间复杂度:O(1)。除了返回的数组以外,空间复杂度为常数。"""
<|body_0|>
def countBits2(self, n: int) -> List[int]:
"""对于正整数 x,将其二进制表示右移一位,等价于将其二进制表示的最低位去掉,得到的数是[x/2]。如果bits[x/2] 的值已知,则可以得到bits[x] 的值: 如果 x 是偶数,则 bits[x]=bits[... | stack_v2_sparse_classes_75kplus_train_006194 | 2,707 | no_license | [
{
"docstring": "时间复杂度:O(nlogn) 空间复杂度:O(1)。除了返回的数组以外,空间复杂度为常数。",
"name": "countBits",
"signature": "def countBits(self, n: int) -> List[int]"
},
{
"docstring": "对于正整数 x,将其二进制表示右移一位,等价于将其二进制表示的最低位去掉,得到的数是[x/2]。如果bits[x/2] 的值已知,则可以得到bits[x] 的值: 如果 x 是偶数,则 bits[x]=bits[x/2]; 如果 x 是奇数,则 bits[x]=bits[... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countBits(self, n: int) -> List[int]: 时间复杂度:O(nlogn) 空间复杂度:O(1)。除了返回的数组以外,空间复杂度为常数。
- def countBits2(self, n: int) -> List[int]: 对于正整数 x,将其二进制表示右移一位,等价于将其二进制表示的最低位去掉,得到的数是[x/... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countBits(self, n: int) -> List[int]: 时间复杂度:O(nlogn) 空间复杂度:O(1)。除了返回的数组以外,空间复杂度为常数。
- def countBits2(self, n: int) -> List[int]: 对于正整数 x,将其二进制表示右移一位,等价于将其二进制表示的最低位去掉,得到的数是[x/... | c84ff6cda06ceb7cda7f828b5eb706031527e522 | <|skeleton|>
class Solution:
def countBits(self, n: int) -> List[int]:
"""时间复杂度:O(nlogn) 空间复杂度:O(1)。除了返回的数组以外,空间复杂度为常数。"""
<|body_0|>
def countBits2(self, n: int) -> List[int]:
"""对于正整数 x,将其二进制表示右移一位,等价于将其二进制表示的最低位去掉,得到的数是[x/2]。如果bits[x/2] 的值已知,则可以得到bits[x] 的值: 如果 x 是偶数,则 bits[x]=bits[... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countBits(self, n: int) -> List[int]:
"""时间复杂度:O(nlogn) 空间复杂度:O(1)。除了返回的数组以外,空间复杂度为常数。"""
def countOnes(x: int) -> int:
ones = 0
while x > 0:
x &= x - 1
ones += 1
return ones
bits = [countOnes(i) for i in... | the_stack_v2_python_sparse | 0338_counting-bits/solution.py | issone/leetcode | train | 0 | |
8dcc88ae6f9a10a3cade9ef76e2e530828f94955 | [
"self.factory = RequestFactory()\nself.experiment = Experiment.objects.create(title='Ebola Outbreak', population_size=1000, vaccination_percent=0.98, virus_name='Ebola', mortality_chance=0.98, reproductive_rate=0.09, initial_infected=12)\nself.experiment.save()\nself.experiment.run_experiment()",
"id = self.exper... | <|body_start_0|>
self.factory = RequestFactory()
self.experiment = Experiment.objects.create(title='Ebola Outbreak', population_size=1000, vaccination_percent=0.98, virus_name='Ebola', mortality_chance=0.98, reproductive_rate=0.09, initial_infected=12)
self.experiment.save()
self.experim... | A user sees in-depth information about the epidemic they simulated. | ExperimentDetailTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExperimentDetailTests:
"""A user sees in-depth information about the epidemic they simulated."""
def setUp(self):
"""Instaniate RequestFactory and Experiment objects to use in tests."""
<|body_0|>
def test_get_details_for_one_experiment(self):
"""Site visitor see... | stack_v2_sparse_classes_75kplus_train_006195 | 5,815 | no_license | [
{
"docstring": "Instaniate RequestFactory and Experiment objects to use in tests.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Site visitor sees more nuanced data about an Experiment instance.",
"name": "test_get_details_for_one_experiment",
"signature": "def test... | 2 | stack_v2_sparse_classes_30k_train_026846 | Implement the Python class `ExperimentDetailTests` described below.
Class description:
A user sees in-depth information about the epidemic they simulated.
Method signatures and docstrings:
- def setUp(self): Instaniate RequestFactory and Experiment objects to use in tests.
- def test_get_details_for_one_experiment(se... | Implement the Python class `ExperimentDetailTests` described below.
Class description:
A user sees in-depth information about the epidemic they simulated.
Method signatures and docstrings:
- def setUp(self): Instaniate RequestFactory and Experiment objects to use in tests.
- def test_get_details_for_one_experiment(se... | 2699daaa6d7bfa4b6ea4e0fb0afa861e001fa8b0 | <|skeleton|>
class ExperimentDetailTests:
"""A user sees in-depth information about the epidemic they simulated."""
def setUp(self):
"""Instaniate RequestFactory and Experiment objects to use in tests."""
<|body_0|>
def test_get_details_for_one_experiment(self):
"""Site visitor see... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExperimentDetailTests:
"""A user sees in-depth information about the epidemic they simulated."""
def setUp(self):
"""Instaniate RequestFactory and Experiment objects to use in tests."""
self.factory = RequestFactory()
self.experiment = Experiment.objects.create(title='Ebola Outbre... | the_stack_v2_python_sparse | web/simulator/tests.py | sprajjwal/assignment-herd-immunity | train | 1 |
03342f279b1c5795a299311e18bcfdb8df1e37eb | [
"t0 = time.time()\nnoise = np.random.normal(0, params.noise_level)\nvalue = -1 * params.x ** 2 + 10 * params.x + noise\nt1 = time.time()\nreturn (float(value), t1 - t0)",
"param_x, values_x = self.get_series_params(1)\nparam_iter, values_iter = self.get_series_params(0)\nif what == 'value':\n result_index = 0\... | <|body_start_0|>
t0 = time.time()
noise = np.random.normal(0, params.noise_level)
value = -1 * params.x ** 2 + 10 * params.x + noise
t1 = time.time()
return (float(value), t1 - t0)
<|end_body_0|>
<|body_start_1|>
param_x, values_x = self.get_series_params(1)
para... | In this experiment we will use series 0 to repeat the process (using different instantiations of the noise). We will use series 1 to vary the parameter x of which we want to know the optimum value. | TestExperiment | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestExperiment:
"""In this experiment we will use series 0 to repeat the process (using different instantiations of the noise). We will use series 1 to vary the parameter x of which we want to know the optimum value."""
def experiment(self, params):
"""experiment(params) Our magic bo... | stack_v2_sparse_classes_75kplus_train_006196 | 21,696 | permissive | [
{
"docstring": "experiment(params) Our magic box. Given params.x, it calculates a value. In a real experiment, this calculation may be unknown to us.",
"name": "experiment",
"signature": "def experiment(self, params)"
},
{
"docstring": "quantify_results(what) Make the results ready for presentat... | 3 | stack_v2_sparse_classes_30k_train_041272 | Implement the Python class `TestExperiment` described below.
Class description:
In this experiment we will use series 0 to repeat the process (using different instantiations of the noise). We will use series 1 to vary the parameter x of which we want to know the optimum value.
Method signatures and docstrings:
- def ... | Implement the Python class `TestExperiment` described below.
Class description:
In this experiment we will use series 0 to repeat the process (using different instantiations of the noise). We will use series 1 to vary the parameter x of which we want to know the optimum value.
Method signatures and docstrings:
- def ... | 1647f8fd94aaf20350c972e0c405338ee841f8bf | <|skeleton|>
class TestExperiment:
"""In this experiment we will use series 0 to repeat the process (using different instantiations of the noise). We will use series 1 to vary the parameter x of which we want to know the optimum value."""
def experiment(self, params):
"""experiment(params) Our magic bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestExperiment:
"""In this experiment we will use series 0 to repeat the process (using different instantiations of the noise). We will use series 1 to vary the parameter x of which we want to know the optimum value."""
def experiment(self, params):
"""experiment(params) Our magic box. Given para... | the_stack_v2_python_sparse | pirt/experiment.py | almarklein/pirt | train | 17 |
cb603965bb0b9eed8069c5f2c068d7d7053405ec | [
"dic_of_barcodes = {}\nif len(barcodes) < 3:\n return barcodes\nfor i in barcodes:\n if i not in dic_of_barcodes:\n dic_of_barcodes[i] = 1\n else:\n dic_of_barcodes[i] += 1\nkeys = list(dic_of_barcodes.keys())\nkeys = sorted(keys, key=lambda i: dic_of_barcodes[i], reverse=True)\nprint(keys)\n... | <|body_start_0|>
dic_of_barcodes = {}
if len(barcodes) < 3:
return barcodes
for i in barcodes:
if i not in dic_of_barcodes:
dic_of_barcodes[i] = 1
else:
dic_of_barcodes[i] += 1
keys = list(dic_of_barcodes.keys())
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rearrangeBarcodes(self, barcodes):
""":type barcodes: List[int] :rtype: List[int]"""
<|body_0|>
def rearrangeBarcodes2(self, barcodes):
""":type barcodes: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dic_... | stack_v2_sparse_classes_75kplus_train_006197 | 1,932 | no_license | [
{
"docstring": ":type barcodes: List[int] :rtype: List[int]",
"name": "rearrangeBarcodes",
"signature": "def rearrangeBarcodes(self, barcodes)"
},
{
"docstring": ":type barcodes: List[int] :rtype: List[int]",
"name": "rearrangeBarcodes2",
"signature": "def rearrangeBarcodes2(self, barcod... | 2 | stack_v2_sparse_classes_30k_train_041411 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rearrangeBarcodes(self, barcodes): :type barcodes: List[int] :rtype: List[int]
- def rearrangeBarcodes2(self, barcodes): :type barcodes: List[int] :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rearrangeBarcodes(self, barcodes): :type barcodes: List[int] :rtype: List[int]
- def rearrangeBarcodes2(self, barcodes): :type barcodes: List[int] :rtype: List[int]
<|skelet... | 4105e18050b15fc0409c75353ad31be17187dd34 | <|skeleton|>
class Solution:
def rearrangeBarcodes(self, barcodes):
""":type barcodes: List[int] :rtype: List[int]"""
<|body_0|>
def rearrangeBarcodes2(self, barcodes):
""":type barcodes: List[int] :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rearrangeBarcodes(self, barcodes):
""":type barcodes: List[int] :rtype: List[int]"""
dic_of_barcodes = {}
if len(barcodes) < 3:
return barcodes
for i in barcodes:
if i not in dic_of_barcodes:
dic_of_barcodes[i] = 1
... | the_stack_v2_python_sparse | rearrangeBarcodes.py | NeilWangziyu/Leetcode_py | train | 2 | |
ba558d64aeefa21daae8d5fa9813438c4bfa0f18 | [
"super(fx.GraphModule, self).__init__()\nself.__class__.__name__ = class_name\nself.train_graph = train_graph\nself.eval_graph = eval_graph\nfor node in chain(iter(train_graph.nodes), iter(eval_graph.nodes)):\n if node.op in ['get_attr', 'call_module']:\n if not isinstance(node.target, str):\n ... | <|body_start_0|>
super(fx.GraphModule, self).__init__()
self.__class__.__name__ = class_name
self.train_graph = train_graph
self.eval_graph = eval_graph
for node in chain(iter(train_graph.nodes), iter(eval_graph.nodes)):
if node.op in ['get_attr', 'call_module']:
... | A derivative of `fx.GraphModule`. Differs in the following ways: - Requires a train and eval version of the underlying graph - Copies submodules according to the nodes of both train and eval graphs. - Calling train(mode) switches between train graph and eval graph. | DualGraphModule | [
"BSD-3-Clause",
"CC-BY-NC-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DualGraphModule:
"""A derivative of `fx.GraphModule`. Differs in the following ways: - Requires a train and eval version of the underlying graph - Copies submodules according to the nodes of both train and eval graphs. - Calling train(mode) switches between train graph and eval graph."""
def... | stack_v2_sparse_classes_75kplus_train_006198 | 25,577 | permissive | [
{
"docstring": "Args: root (nn.Module): module from which the copied module hierarchy is built train_graph (fx.Graph): the graph that should be used in train mode eval_graph (fx.Graph): the graph that should be used in eval mode",
"name": "__init__",
"signature": "def __init__(self, root: torch.nn.Modul... | 2 | stack_v2_sparse_classes_30k_train_006438 | Implement the Python class `DualGraphModule` described below.
Class description:
A derivative of `fx.GraphModule`. Differs in the following ways: - Requires a train and eval version of the underlying graph - Copies submodules according to the nodes of both train and eval graphs. - Calling train(mode) switches between ... | Implement the Python class `DualGraphModule` described below.
Class description:
A derivative of `fx.GraphModule`. Differs in the following ways: - Requires a train and eval version of the underlying graph - Copies submodules according to the nodes of both train and eval graphs. - Calling train(mode) switches between ... | 1f94320d8db8d102214a7dc02c22fa65ee9ac58a | <|skeleton|>
class DualGraphModule:
"""A derivative of `fx.GraphModule`. Differs in the following ways: - Requires a train and eval version of the underlying graph - Copies submodules according to the nodes of both train and eval graphs. - Calling train(mode) switches between train graph and eval graph."""
def... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DualGraphModule:
"""A derivative of `fx.GraphModule`. Differs in the following ways: - Requires a train and eval version of the underlying graph - Copies submodules according to the nodes of both train and eval graphs. - Calling train(mode) switches between train graph and eval graph."""
def __init__(sel... | the_stack_v2_python_sparse | torchvision/models/feature_extraction.py | pytorch/vision | train | 15,620 |
1862e477f2c911b029bc26979ebd1251cffca673 | [
"ValueIterator.__init__(self, delta, epsilon, sample_cost, movement_cost)\nself.all_states = np.linspace(0, 1, self.N + 1, dtype=np.float64)\nself.policy = np.zeros(self.all_states.shape, dtype=np.int)\nself.state_values = np.zeros(self.all_states.shape)",
"start = datetime.now()\nf = [0] * (self.N + 1)\nval = [0... | <|body_start_0|>
ValueIterator.__init__(self, delta, epsilon, sample_cost, movement_cost)
self.all_states = np.linspace(0, 1, self.N + 1, dtype=np.float64)
self.policy = np.zeros(self.all_states.shape, dtype=np.int)
self.state_values = np.zeros(self.all_states.shape)
<|end_body_0|>
<|bo... | This agent is meant to calculate a policy for the uniform change point problem. The policy can then be fed to a UniformScorer to see how well the agent performs on the uniform-v0 gym environment. This agent is based on John's code for value iteration, (for the uniform case) | UniformAgent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UniformAgent:
"""This agent is meant to calculate a policy for the uniform change point problem. The policy can then be fed to a UniformScorer to see how well the agent performs on the uniform-v0 gym environment. This agent is based on John's code for value iteration, (for the uniform case)"""
... | stack_v2_sparse_classes_75kplus_train_006199 | 6,354 | no_license | [
{
"docstring": "Save parameters and initialize policy :param delta: delta from the sps paper :param epsilon: epsilon from the sps paper :param sample_cost: Ts from the sps paper :param movement_cost: Tt from the sps paper",
"name": "__init__",
"signature": "def __init__(self, delta, epsilon=None, sample... | 4 | stack_v2_sparse_classes_30k_train_046039 | Implement the Python class `UniformAgent` described below.
Class description:
This agent is meant to calculate a policy for the uniform change point problem. The policy can then be fed to a UniformScorer to see how well the agent performs on the uniform-v0 gym environment. This agent is based on John's code for value ... | Implement the Python class `UniformAgent` described below.
Class description:
This agent is meant to calculate a policy for the uniform change point problem. The policy can then be fed to a UniformScorer to see how well the agent performs on the uniform-v0 gym environment. This agent is based on John's code for value ... | ccbb312766fbd69fb3151020f14a94041e5219c4 | <|skeleton|>
class UniformAgent:
"""This agent is meant to calculate a policy for the uniform change point problem. The policy can then be fed to a UniformScorer to see how well the agent performs on the uniform-v0 gym environment. This agent is based on John's code for value iteration, (for the uniform case)"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UniformAgent:
"""This agent is meant to calculate a policy for the uniform change point problem. The policy can then be fed to a UniformScorer to see how well the agent performs on the uniform-v0 gym environment. This agent is based on John's code for value iteration, (for the uniform case)"""
def __init... | the_stack_v2_python_sparse | agents/uniform_agent.py | isaacOnline/rl_for_al | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.