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
6a9d3b8a6494ffa42099fa4d6404c01fb3b9d87b
[ "dtype = dtypes.as_dtype(dtype).base_dtype\nif dtype not in (dtypes.uint8, dtypes.float32):\n raise TypeError('Invalid dtype %r, expected uint8 or float32' % dtype)\nassert data_X.shape[0] == data_Y.shape[0], 'data_X.shape: %s data_Y.shape: %s' % (data_X.shape, data_Y.shape)\nself.num_examples = data_X.shape[0]\...
<|body_start_0|> dtype = dtypes.as_dtype(dtype).base_dtype if dtype not in (dtypes.uint8, dtypes.float32): raise TypeError('Invalid dtype %r, expected uint8 or float32' % dtype) assert data_X.shape[0] == data_Y.shape[0], 'data_X.shape: %s data_Y.shape: %s' % (data_X.shape, data_Y.sha...
DataSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSet: def __init__(self, data_X, data_Y, dtype=dtypes.float32): """Checks data and casts it into correct data type.""" <|body_0|> def next_batch(self, batch_size, seed=None): """Return the next `batch_size` examples from this data set.""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_073400
19,030
no_license
[ { "docstring": "Checks data and casts it into correct data type.", "name": "__init__", "signature": "def __init__(self, data_X, data_Y, dtype=dtypes.float32)" }, { "docstring": "Return the next `batch_size` examples from this data set.", "name": "next_batch", "signature": "def next_batch...
2
stack_v2_sparse_classes_30k_train_010357
Implement the Python class `DataSet` described below. Class description: Implement the DataSet class. Method signatures and docstrings: - def __init__(self, data_X, data_Y, dtype=dtypes.float32): Checks data and casts it into correct data type. - def next_batch(self, batch_size, seed=None): Return the next `batch_siz...
Implement the Python class `DataSet` described below. Class description: Implement the DataSet class. Method signatures and docstrings: - def __init__(self, data_X, data_Y, dtype=dtypes.float32): Checks data and casts it into correct data type. - def next_batch(self, batch_size, seed=None): Return the next `batch_siz...
4514e7231ee36ad10030105db14333bd04ee7f72
<|skeleton|> class DataSet: def __init__(self, data_X, data_Y, dtype=dtypes.float32): """Checks data and casts it into correct data type.""" <|body_0|> def next_batch(self, batch_size, seed=None): """Return the next `batch_size` examples from this data set.""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataSet: def __init__(self, data_X, data_Y, dtype=dtypes.float32): """Checks data and casts it into correct data type.""" dtype = dtypes.as_dtype(dtype).base_dtype if dtype not in (dtypes.uint8, dtypes.float32): raise TypeError('Invalid dtype %r, expected uint8 or float32' ...
the_stack_v2_python_sparse
statmech/ising2d.py
HussainAther/physics
train
18
c179f6185a227367bb957a4354ba34e1a24951b8
[ "val = {'pay_now': operation_type == 'treasury' and 'pay_later' or 'pay_now', 'payment_option': operation_type == 'treasury' and 'with_writeoff' or 'without_writeoff'}\nif operation_type == 'treasury':\n val.update({'line_dr_ids': False})\n account = self.pool.get('res.partner').browse(cr, uid, partner_id, co...
<|body_start_0|> val = {'pay_now': operation_type == 'treasury' and 'pay_later' or 'pay_now', 'payment_option': operation_type == 'treasury' and 'with_writeoff' or 'without_writeoff'} if operation_type == 'treasury': val.update({'line_dr_ids': False}) account = self.pool.get('res...
account_voucher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_voucher: def onchange_operation_type(self, cr, uid, ids, operation_type, partner_id, context=None): """Method that call when changing operation_type value, when operation is treasury feeding: * Reset line_dr_ids field * Make voucher with writeoff * Make voucher pay later @return:...
stack_v2_sparse_classes_75kplus_train_073401
3,763
no_license
[ { "docstring": "Method that call when changing operation_type value, when operation is treasury feeding: * Reset line_dr_ids field * Make voucher with writeoff * Make voucher pay later @return: dictionary of fields values", "name": "onchange_operation_type", "signature": "def onchange_operation_type(sel...
5
stack_v2_sparse_classes_30k_train_052022
Implement the Python class `account_voucher` described below. Class description: Implement the account_voucher class. Method signatures and docstrings: - def onchange_operation_type(self, cr, uid, ids, operation_type, partner_id, context=None): Method that call when changing operation_type value, when operation is tr...
Implement the Python class `account_voucher` described below. Class description: Implement the account_voucher class. Method signatures and docstrings: - def onchange_operation_type(self, cr, uid, ids, operation_type, partner_id, context=None): Method that call when changing operation_type value, when operation is tr...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class account_voucher: def onchange_operation_type(self, cr, uid, ids, operation_type, partner_id, context=None): """Method that call when changing operation_type value, when operation is treasury feeding: * Reset line_dr_ids field * Make voucher with writeoff * Make voucher pay later @return:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class account_voucher: def onchange_operation_type(self, cr, uid, ids, operation_type, partner_id, context=None): """Method that call when changing operation_type value, when operation is treasury feeding: * Reset line_dr_ids field * Make voucher with writeoff * Make voucher pay later @return: dictionary of...
the_stack_v2_python_sparse
v_7/Dongola/wafi/account_indirect_treasury_feeding/account_custom.py
musabahmed/baba
train
0
63c56da208c8a3bfe9fe98d7679dd5cd0e400b18
[ "if urlconf_modules is None:\n urlconf_modules = [settings.ROOT_URLCONF]\n if self.URLCONF_MODULES is not None:\n urlconf_modules.extend(self.URLCONF_MODULES)\nfor urlconf in urlconf_modules:\n if urlconf in sys.modules:\n reload(sys.modules[urlconf])\nclear_url_caches()\nresolve('/')", "su...
<|body_start_0|> if urlconf_modules is None: urlconf_modules = [settings.ROOT_URLCONF] if self.URLCONF_MODULES is not None: urlconf_modules.extend(self.URLCONF_MODULES) for urlconf in urlconf_modules: if urlconf in sys.modules: reload(s...
Mixin to reset urls.py before and after a test Django memoizes the function that reads the urls module (whatever module urlconf names). The module itself is also stored by python in sys.modules. To fully reload it, we need to reload the python module, and also clear django's cache of the parsed urls. However, the order...
UrlResetMixin
[ "MIT", "AGPL-3.0-only", "AGPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UrlResetMixin: """Mixin to reset urls.py before and after a test Django memoizes the function that reads the urls module (whatever module urlconf names). The module itself is also stored by python in sys.modules. To fully reload it, we need to reload the python module, and also clear django's cac...
stack_v2_sparse_classes_75kplus_train_073402
5,815
permissive
[ { "docstring": "Reset `urls.py` for a set of Django apps.", "name": "reset_urls", "signature": "def reset_urls(self, urlconf_modules=None)" }, { "docstring": "Reset Django urls before tests and after tests If you need to reset `urls.py` from a particular Django app (or apps), specify these modul...
2
stack_v2_sparse_classes_30k_train_035038
Implement the Python class `UrlResetMixin` described below. Class description: Mixin to reset urls.py before and after a test Django memoizes the function that reads the urls module (whatever module urlconf names). The module itself is also stored by python in sys.modules. To fully reload it, we need to reload the pyt...
Implement the Python class `UrlResetMixin` described below. Class description: Mixin to reset urls.py before and after a test Django memoizes the function that reads the urls module (whatever module urlconf names). The module itself is also stored by python in sys.modules. To fully reload it, we need to reload the pyt...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class UrlResetMixin: """Mixin to reset urls.py before and after a test Django memoizes the function that reads the urls module (whatever module urlconf names). The module itself is also stored by python in sys.modules. To fully reload it, we need to reload the python module, and also clear django's cac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UrlResetMixin: """Mixin to reset urls.py before and after a test Django memoizes the function that reads the urls module (whatever module urlconf names). The module itself is also stored by python in sys.modules. To fully reload it, we need to reload the python module, and also clear django's cache of the par...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/djangoapps/util/testing.py
luque/better-ways-of-thinking-about-software
train
3
b221d978994eee995013cf6ff6d17c730f16cdb8
[ "if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is None:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)", "with open('{}.json'.format(cls.__name__), 'w', encoding='UTF8') as file:\n list = []\n if list_obj...
<|body_start_0|> if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is None: return '[]' else: return json.dumps(list_dictionaries) <|en...
This is the class Base.
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """This is the class Base.""" def __init__(self, id=None): """This init's the id.""" <|body_0|> def to_json_string(list_dictionaries): """Returns the JSON string representation of list_dictionaries""" <|body_1|> def save_to_file(cls, list_objs)...
stack_v2_sparse_classes_75kplus_train_073403
2,151
no_license
[ { "docstring": "This init's the id.", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "Returns the JSON string representation of list_dictionaries", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "...
6
stack_v2_sparse_classes_30k_train_046457
Implement the Python class `Base` described below. Class description: This is the class Base. Method signatures and docstrings: - def __init__(self, id=None): This init's the id. - def to_json_string(list_dictionaries): Returns the JSON string representation of list_dictionaries - def save_to_file(cls, list_objs): Wr...
Implement the Python class `Base` described below. Class description: This is the class Base. Method signatures and docstrings: - def __init__(self, id=None): This init's the id. - def to_json_string(list_dictionaries): Returns the JSON string representation of list_dictionaries - def save_to_file(cls, list_objs): Wr...
5050902bc99d99cc779c5a31bf3bb767eb93521f
<|skeleton|> class Base: """This is the class Base.""" def __init__(self, id=None): """This init's the id.""" <|body_0|> def to_json_string(list_dictionaries): """Returns the JSON string representation of list_dictionaries""" <|body_1|> def save_to_file(cls, list_objs)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Base: """This is the class Base.""" def __init__(self, id=None): """This init's the id.""" if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dictionaries): """Returns th...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
koukijohn/holbertonschool-higher_level_programming
train
0
64c205c66879ce9b153b5476d91bacf986692feb
[ "super().__init__()\nself.register_buffer('support', torch.linspace(vmin, vmax, n_atoms))\nself.fc1 = nn.Linear(state_size, 256)\nself.fc2 = nn.Linear(256 + action_size, 256)\nself.fc3 = nn.Linear(256, 128)\nself.fc4 = nn.Linear(128, n_atoms)", "x = F.leaky_relu(self.fc1(state))\nx = torch.cat([x, action], dim=1)...
<|body_start_0|> super().__init__() self.register_buffer('support', torch.linspace(vmin, vmax, n_atoms)) self.fc1 = nn.Linear(state_size, 256) self.fc2 = nn.Linear(256 + action_size, 256) self.fc3 = nn.Linear(256, 128) self.fc4 = nn.Linear(128, n_atoms) <|end_body_0|> <|...
Distributional Value Model
Critic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Critic: """Distributional Value Model""" def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): """Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper &...
stack_v2_sparse_classes_75kplus_train_073404
2,383
no_license
[ { "docstring": "Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper & Lower bounds of the support n_atoms : int Number of bins in the support", "name": "__init__", "signature": "def __in...
2
stack_v2_sparse_classes_30k_train_033084
Implement the Python class `Critic` described below. Class description: Distributional Value Model Method signatures and docstrings: - def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size ...
Implement the Python class `Critic` described below. Class description: Distributional Value Model Method signatures and docstrings: - def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size ...
f6d450e0c68236bf493689bffef48a0f3723416d
<|skeleton|> class Critic: """Distributional Value Model""" def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): """Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper &...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Critic: """Distributional Value Model""" def __init__(self, state_size, action_size, vmin, vmax, n_atoms=51): """Initialize parameters and build model. Parameters ---------- state_size : int Dimension of each state action_size : int Dimension of each action vmin, vmax : float Upper & Lower bounds...
the_stack_v2_python_sparse
drlnd/p2_continuous-control/control/model.py
jkorge/udacity
train
0
4b129b03624e70565021613924dc3c291e73ae12
[ "threading.Thread.__init__(self)\nself.daemon = True\nself.parent = parent\nself.commandsQueue = commandsQueue\nself.launcher = LauncherSingle()", "self.launcher.bot._Print('Thread started')\nwhile not self.commandsQueue.empty():\n command = self.commandsQueue.get()\n argumentsList = shlex.split(command)\n ...
<|body_start_0|> threading.Thread.__init__(self) self.daemon = True self.parent = parent self.commandsQueue = commandsQueue self.launcher = LauncherSingle() <|end_body_0|> <|body_start_1|> self.launcher.bot._Print('Thread started') while not self.commandsQueue.em...
Запускаем бота - одна команда в потоке
LauncherSingleThreaded
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LauncherSingleThreaded: """Запускаем бота - одна команда в потоке""" def __init__(self, parent, commandsQueue): """Инициализация""" <|body_0|> def run(self): """Главный метод""" <|body_1|> <|end_skeleton|> <|body_start_0|> threading.Thread.__ini...
stack_v2_sparse_classes_75kplus_train_073405
16,928
no_license
[ { "docstring": "Инициализация", "name": "__init__", "signature": "def __init__(self, parent, commandsQueue)" }, { "docstring": "Главный метод", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `LauncherSingleThreaded` described below. Class description: Запускаем бота - одна команда в потоке Method signatures and docstrings: - def __init__(self, parent, commandsQueue): Инициализация - def run(self): Главный метод
Implement the Python class `LauncherSingleThreaded` described below. Class description: Запускаем бота - одна команда в потоке Method signatures and docstrings: - def __init__(self, parent, commandsQueue): Инициализация - def run(self): Главный метод <|skeleton|> class LauncherSingleThreaded: """Запускаем бота -...
d2771bf04aa187dda6d468883a5a167237589369
<|skeleton|> class LauncherSingleThreaded: """Запускаем бота - одна команда в потоке""" def __init__(self, parent, commandsQueue): """Инициализация""" <|body_0|> def run(self): """Главный метод""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LauncherSingleThreaded: """Запускаем бота - одна команда в потоке""" def __init__(self, parent, commandsQueue): """Инициализация""" threading.Thread.__init__(self) self.daemon = True self.parent = parent self.commandsQueue = commandsQueue self.launcher = La...
the_stack_v2_python_sparse
pinterest/launcher.py
cash2one/doorscenter
train
0
3554249ca6c1b9fcdfe14372cfed88d293e1424e
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return False\nm, n = (len(matrix), len(matrix[0]))\nrow, col = (m - 1, 0)\ncount = 0\nwhile row >= 0 and col < n:\n if matrix[row][col] > target:\n row -= 1\n elif matrix[row][col] < target:\n col += 1\n else:\n return True\n print(r...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return False m, n = (len(matrix), len(matrix[0])) row, col = (m - 1, 0) count = 0 while row >= 0 and col < n: if matrix[row][col] > target: row -= 1 elif matrix[row][c...
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""" <|body_0|> def searchMatrixCount(self, matrix, target): """return the occurrence number of 'target' in 'matrix' :type matrix: List[List[int]] :type ta...
stack_v2_sparse_classes_75kplus_train_073406
1,909
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": "return the occurrence number of 'target' in 'matrix' :type matrix: List[List[int]] :type target: int :rtype: bool", ...
2
stack_v2_sparse_classes_30k_train_025156
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 - def searchMatrixCount(self, matrix, target): return the occurrence number o...
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 - def searchMatrixCount(self, matrix, target): return the occurrence number o...
e1a4c1bc5d01b4e2ba51a5255deed6426557dcb0
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_0|> def searchMatrixCount(self, matrix, target): """return the occurrence number of 'target' in 'matrix' :type matrix: List[List[int]] :type ta...
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""" if len(matrix) == 0 or len(matrix[0]) == 0: return False m, n = (len(matrix), len(matrix[0])) row, col = (m - 1, 0) count = 0 while r...
the_stack_v2_python_sparse
src/search2DMatrix2.py
xuetingandyang/leetcode
train
3
56d697ce3028da75a0d7691a5fab7f836962f271
[ "super(HotstartEncoder, self).__init__(conf, constraint, name)\nconf.remove_section('encoder')\nconf.add_section('encoder')\nfor option, value in conf.items(self.conf['wrapped']):\n conf.set('encoder', option, value)\nconf.remove_section(self.conf['wrapped'])\nself.wrapped = ed_encoder_factory.factory(conf.get('...
<|body_start_0|> super(HotstartEncoder, self).__init__(conf, constraint, name) conf.remove_section('encoder') conf.add_section('encoder') for option, value in conf.items(self.conf['wrapped']): conf.set('encoder', option, value) conf.remove_section(self.conf['wrapped']...
a listener object transforms input features into a high level representation
HotstartEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HotstartEncoder: """a listener object transforms input features into a high level representation""" def __init__(self, conf, constraint, name=None): """constructor Args: conf: the encoder configuration name: the encoder name constraint: the constraint for the variables""" <|b...
stack_v2_sparse_classes_75kplus_train_073407
2,327
permissive
[ { "docstring": "constructor Args: conf: the encoder configuration name: the encoder name constraint: the constraint for the variables", "name": "__init__", "signature": "def __init__(self, conf, constraint, name=None)" }, { "docstring": "Create the variables and do the forward computation Args: ...
2
null
Implement the Python class `HotstartEncoder` described below. Class description: a listener object transforms input features into a high level representation Method signatures and docstrings: - def __init__(self, conf, constraint, name=None): constructor Args: conf: the encoder configuration name: the encoder name co...
Implement the Python class `HotstartEncoder` described below. Class description: a listener object transforms input features into a high level representation Method signatures and docstrings: - def __init__(self, conf, constraint, name=None): constructor Args: conf: the encoder configuration name: the encoder name co...
313018a46f68cec1d4a7eb15b8b1cf68111a959c
<|skeleton|> class HotstartEncoder: """a listener object transforms input features into a high level representation""" def __init__(self, conf, constraint, name=None): """constructor Args: conf: the encoder configuration name: the encoder name constraint: the constraint for the variables""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HotstartEncoder: """a listener object transforms input features into a high level representation""" def __init__(self, conf, constraint, name=None): """constructor Args: conf: the encoder configuration name: the encoder name constraint: the constraint for the variables""" super(HotstartEn...
the_stack_v2_python_sparse
nabu/neuralnetworks/models/ed_encoders/hotstart_encoder.py
ishandutta2007/nabu
train
0
db6b7eb3fcc16cf5bb81a8d4791acaf1751db37a
[ "if self.action in ['list']:\n permission_classes = [IsAuthenticated]\nelse:\n try:\n permission_classes = getattr(self, self.action).kwargs.get('permission_classes')\n except AttributeError:\n permission_classes = self.permission_classes\nreturn [permission() for permission in permission_cla...
<|body_start_0|> if self.action in ['list']: permission_classes = [IsAuthenticated] else: try: permission_classes = getattr(self, self.action).kwargs.get('permission_classes') except AttributeError: permission_classes = self.permission_...
API endpoints for unit memberships.
UnitMembershipViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitMembershipViewSet: """API endpoints for unit memberships.""" def get_permissions(self): """Manage permissions for built-in DRF methods, defaulting to the actions self defined permissions if applicable or to the ViewSet's default permissions.""" <|body_0|> def get_uni...
stack_v2_sparse_classes_75kplus_train_073408
2,178
permissive
[ { "docstring": "Manage permissions for built-in DRF methods, defaulting to the actions self defined permissions if applicable or to the ViewSet's default permissions.", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "Helper: get the related unit, return an ...
3
stack_v2_sparse_classes_30k_train_019516
Implement the Python class `UnitMembershipViewSet` described below. Class description: API endpoints for unit memberships. Method signatures and docstrings: - def get_permissions(self): Manage permissions for built-in DRF methods, defaulting to the actions self defined permissions if applicable or to the ViewSet's de...
Implement the Python class `UnitMembershipViewSet` described below. Class description: API endpoints for unit memberships. Method signatures and docstrings: - def get_permissions(self): Manage permissions for built-in DRF methods, defaulting to the actions self defined permissions if applicable or to the ViewSet's de...
22e4afa728a851bb4c2479fbb6f5944a75984b9b
<|skeleton|> class UnitMembershipViewSet: """API endpoints for unit memberships.""" def get_permissions(self): """Manage permissions for built-in DRF methods, defaulting to the actions self defined permissions if applicable or to the ViewSet's default permissions.""" <|body_0|> def get_uni...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnitMembershipViewSet: """API endpoints for unit memberships.""" def get_permissions(self): """Manage permissions for built-in DRF methods, defaulting to the actions self defined permissions if applicable or to the ViewSet's default permissions.""" if self.action in ['list']: ...
the_stack_v2_python_sparse
src/backend/partaj/core/api/unit_membership.py
MTES-MCT/partaj
train
4
899c824a8382f9feb170f5138ae31660e3db922c
[ "cates = ctrl.cate.get_cates_ctl(self.current_user['store_id'])\ndata = {'list': []}\nif not cates:\n return self.send_json(data)\nFILTER = ({'id': 'cate_id'}, 'store_id', 'name', 'update_time')\ndata['list'] = [utils.dict_filter(cate, FILTER) for cate in cates]\nself.send_json(data)", "try:\n args = json.l...
<|body_start_0|> cates = ctrl.cate.get_cates_ctl(self.current_user['store_id']) data = {'list': []} if not cates: return self.send_json(data) FILTER = ({'id': 'cate_id'}, 'store_id', 'name', 'update_time') data['list'] = [utils.dict_filter(cate, FILTER) for cate in ca...
CateHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CateHandler: def get(self): """获取所有的酒水分类""" <|body_0|> def post(self): """添加酒水分类""" <|body_1|> def delete(self): """删除酒水分类""" <|body_2|> def put(self): """修改某酒水分类""" <|body_3|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_073409
7,327
no_license
[ { "docstring": "获取所有的酒水分类", "name": "get", "signature": "def get(self)" }, { "docstring": "添加酒水分类", "name": "post", "signature": "def post(self)" }, { "docstring": "删除酒水分类", "name": "delete", "signature": "def delete(self)" }, { "docstring": "修改某酒水分类", "name":...
4
null
Implement the Python class `CateHandler` described below. Class description: Implement the CateHandler class. Method signatures and docstrings: - def get(self): 获取所有的酒水分类 - def post(self): 添加酒水分类 - def delete(self): 删除酒水分类 - def put(self): 修改某酒水分类
Implement the Python class `CateHandler` described below. Class description: Implement the CateHandler class. Method signatures and docstrings: - def get(self): 获取所有的酒水分类 - def post(self): 添加酒水分类 - def delete(self): 删除酒水分类 - def put(self): 修改某酒水分类 <|skeleton|> class CateHandler: def get(self): """获取所有的酒...
3adc4347c942bd8378c13a026e30b0a30ee26919
<|skeleton|> class CateHandler: def get(self): """获取所有的酒水分类""" <|body_0|> def post(self): """添加酒水分类""" <|body_1|> def delete(self): """删除酒水分类""" <|body_2|> def put(self): """修改某酒水分类""" <|body_3|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CateHandler: def get(self): """获取所有的酒水分类""" cates = ctrl.cate.get_cates_ctl(self.current_user['store_id']) data = {'list': []} if not cates: return self.send_json(data) FILTER = ({'id': 'cate_id'}, 'store_id', 'name', 'update_time') data['list'] = [u...
the_stack_v2_python_sparse
handler/cate.py
y00273676/O2O_ERP_Server
train
0
419e17a8ad7d54b6edab059bf1e0ed2e5557bcde
[ "self.sourcekind = 'MFC'\nself.win_length_ms = 25\nself.win_shift_ms = 10\nself.num_chans = 26\nself.num_lift_ceps = 22\nself.num_ceps = 12\nself.pre_em_coef = 0.97\nself.targetkindw = 'MFCC_0_D'\nself.targetkind = 'MFCC_0_D_N_Z'\nself.nbmv = 25\nself.configfile = ''\nself.mfcconfigfile = ''\nself.framerate = 16000...
<|body_start_0|> self.sourcekind = 'MFC' self.win_length_ms = 25 self.win_shift_ms = 10 self.num_chans = 26 self.num_lift_ceps = 22 self.num_ceps = 12 self.pre_em_coef = 0.97 self.targetkindw = 'MFCC_0_D' self.targetkind = 'MFCC_0_D_N_Z' se...
Acoustic model features. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org
sppasAcFeatures
[ "GPL-3.0-only", "MIT", "GFDL-1.1-or-later", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sppasAcFeatures: """Acoustic model features. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org""" def __init__(self): """Create a sppasAcFeatures...
stack_v2_sparse_classes_75kplus_train_073410
11,367
permissive
[ { "docstring": "Create a sppasAcFeatures instance.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Write all files at once. Write files with their default name, in the given directory. :param dirname: (str) a directory name (existing or to be created).", "name": "w...
4
stack_v2_sparse_classes_30k_train_012624
Implement the Python class `sppasAcFeatures` described below. Class description: Acoustic model features. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Method signatures and d...
Implement the Python class `sppasAcFeatures` described below. Class description: Acoustic model features. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org Method signatures and d...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class sppasAcFeatures: """Acoustic model features. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org""" def __init__(self): """Create a sppasAcFeatures...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class sppasAcFeatures: """Acoustic model features. :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi :author: Brigitte Bigi :contact: develop@sppas.org""" def __init__(self): """Create a sppasAcFeatures instance."""...
the_stack_v2_python_sparse
sppas/sppas/src/models/acm/features.py
mirfan899/MTTS
train
0
304281889024949fda88666d6129758adb98e5c3
[ "self.__logger = State().getLogger('DetectionCore_Component_Logger')\nself.__logger.info('Starting __init__()', 'ImageResizer:__init__')\nself.__targetNumberOfRows = targetNumberOfRows\nself.__targetNumberOfColumns = targetNumberOfColumns\nself.__interpolation = interpolation\nself.__showImagesInWindow = showImages...
<|body_start_0|> self.__logger = State().getLogger('DetectionCore_Component_Logger') self.__logger.info('Starting __init__()', 'ImageResizer:__init__') self.__targetNumberOfRows = targetNumberOfRows self.__targetNumberOfColumns = targetNumberOfColumns self.__interpolation = inter...
ImageResizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageResizer: def __init__(self, targetNumberOfRows=110, targetNumberOfColumns=32, interpolation=cv2.INTER_LINEAR, showImagesInWindow=False): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" <|body_0|> def coreProcess(self, mats): """To-Do: Bitte Kommentar b...
stack_v2_sparse_classes_75kplus_train_073411
2,660
no_license
[ { "docstring": "To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!", "name": "__init__", "signature": "def __init__(self, targetNumberOfRows=110, targetNumberOfColumns=32, interpolation=cv2.INTER_LINEAR, showImagesInWindow=False)" }, { "docstring": "To-Do: Bitte Kommentar bzw. Dokumentaion erst...
2
stack_v2_sparse_classes_30k_train_014026
Implement the Python class `ImageResizer` described below. Class description: Implement the ImageResizer class. Method signatures and docstrings: - def __init__(self, targetNumberOfRows=110, targetNumberOfColumns=32, interpolation=cv2.INTER_LINEAR, showImagesInWindow=False): To-Do: Bitte Kommentar bzw. Dokumentaion e...
Implement the Python class `ImageResizer` described below. Class description: Implement the ImageResizer class. Method signatures and docstrings: - def __init__(self, targetNumberOfRows=110, targetNumberOfColumns=32, interpolation=cv2.INTER_LINEAR, showImagesInWindow=False): To-Do: Bitte Kommentar bzw. Dokumentaion e...
3daaa72b193ebfb55894b47b6a752cdc2192bb6b
<|skeleton|> class ImageResizer: def __init__(self, targetNumberOfRows=110, targetNumberOfColumns=32, interpolation=cv2.INTER_LINEAR, showImagesInWindow=False): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" <|body_0|> def coreProcess(self, mats): """To-Do: Bitte Kommentar b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImageResizer: def __init__(self, targetNumberOfRows=110, targetNumberOfColumns=32, interpolation=cv2.INTER_LINEAR, showImagesInWindow=False): """To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!""" self.__logger = State().getLogger('DetectionCore_Component_Logger') self.__logger.info...
the_stack_v2_python_sparse
SheetMusicScanner/DetectionCore_Component/ImageOptimizer/ImageResizer.py
jadeskon/score-scan
train
0
139bc12ad36a417dafb096b4d213836cbb068138
[ "res = ApiFactory.get_order_api().order_list_api(1)\nlogging.info('请求地址:{}'.format(res.url))\nlogging.info('响应数据:{}'.format(res.json()))\nutils.common_assert_code(res)\nassert False not in [i in res.text for i in ['current_page', 'data', 'snap_name']]", "product_id = 12\ncount = 7\nres = ApiFactory.get_order_api(...
<|body_start_0|> res = ApiFactory.get_order_api().order_list_api(1) logging.info('请求地址:{}'.format(res.url)) logging.info('响应数据:{}'.format(res.json())) utils.common_assert_code(res) assert False not in [i in res.text for i in ['current_page', 'data', 'snap_name']] <|end_body_0|> ...
TestOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOrder: def test_order_list(self): """订单列表""" <|body_0|> def test_create_order(self): """创建订单""" <|body_1|> def test_query_order(self): """查看订单""" <|body_2|> <|end_skeleton|> <|body_start_0|> res = ApiFactory.get_order_api()....
stack_v2_sparse_classes_75kplus_train_073412
1,694
no_license
[ { "docstring": "订单列表", "name": "test_order_list", "signature": "def test_order_list(self)" }, { "docstring": "创建订单", "name": "test_create_order", "signature": "def test_create_order(self)" }, { "docstring": "查看订单", "name": "test_query_order", "signature": "def test_query_...
3
stack_v2_sparse_classes_30k_train_023496
Implement the Python class `TestOrder` described below. Class description: Implement the TestOrder class. Method signatures and docstrings: - def test_order_list(self): 订单列表 - def test_create_order(self): 创建订单 - def test_query_order(self): 查看订单
Implement the Python class `TestOrder` described below. Class description: Implement the TestOrder class. Method signatures and docstrings: - def test_order_list(self): 订单列表 - def test_create_order(self): 创建订单 - def test_query_order(self): 查看订单 <|skeleton|> class TestOrder: def test_order_list(self): ""...
8c0f3b3b499311f2dc0e2e5a1738476e0af77cac
<|skeleton|> class TestOrder: def test_order_list(self): """订单列表""" <|body_0|> def test_create_order(self): """创建订单""" <|body_1|> def test_query_order(self): """查看订单""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestOrder: def test_order_list(self): """订单列表""" res = ApiFactory.get_order_api().order_list_api(1) logging.info('请求地址:{}'.format(res.url)) logging.info('响应数据:{}'.format(res.json())) utils.common_assert_code(res) assert False not in [i in res.text for i in ['cur...
the_stack_v2_python_sparse
Scripts/testOrder.py
yang9801/ego
train
1
570abdf826968daea50cecc6d514f39001872008
[ "n = len(init_val)\nself.segfunc = segfunc\nself.ide_ele = ide_ele\nself.num = 1 << (n - 1).bit_length()\nself.tree = [ide_ele] * 2 * self.num\nfor i in range(n):\n self.tree[self.num + i] = init_val[i]\nfor i in range(self.num - 1, 0, -1):\n self.tree[i] = segfunc(self.tree[2 * i], self.tree[2 * i + 1])", ...
<|body_start_0|> n = len(init_val) self.segfunc = segfunc self.ide_ele = ide_ele self.num = 1 << (n - 1).bit_length() self.tree = [ide_ele] * 2 * self.num for i in range(n): self.tree[self.num + i] = init_val[i] for i in range(self.num - 1, 0, -1): ...
Segment Tree
SegTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegTree: """Segment Tree""" def __init__(self, init_val, segfunc, ide_ele): """初期化 init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" <|body_0|> def update(self, k, x): """k番目の値をxに更新 O(N) k: index(0-index) x: update ...
stack_v2_sparse_classes_75kplus_train_073413
4,134
no_license
[ { "docstring": "初期化 init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)", "name": "__init__", "signature": "def __init__(self, init_val, segfunc, ide_ele)" }, { "docstring": "k番目の値をxに更新 O(N) k: index(0-index) x: update value", "name": "update", ...
3
stack_v2_sparse_classes_30k_val_001672
Implement the Python class `SegTree` described below. Class description: Segment Tree Method signatures and docstrings: - def __init__(self, init_val, segfunc, ide_ele): 初期化 init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index) - def update(self, k, x): k番目の値をxに更新 O(N) k: inde...
Implement the Python class `SegTree` described below. Class description: Segment Tree Method signatures and docstrings: - def __init__(self, init_val, segfunc, ide_ele): 初期化 init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index) - def update(self, k, x): k番目の値をxに更新 O(N) k: inde...
07cb6dbbc32e98bb34427044cf3b4031a11c4367
<|skeleton|> class SegTree: """Segment Tree""" def __init__(self, init_val, segfunc, ide_ele): """初期化 init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" <|body_0|> def update(self, k, x): """k番目の値をxに更新 O(N) k: index(0-index) x: update ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SegTree: """Segment Tree""" def __init__(self, init_val, segfunc, ide_ele): """初期化 init_val: 配列の初期値 segfunc: 区間にしたい操作 ide_ele: 単位元 n: 要素数 num: n以上の最小の2のべき乗 tree: セグメント木(1-index)""" n = len(init_val) self.segfunc = segfunc self.ide_ele = ide_ele self.num = 1 << (n -...
the_stack_v2_python_sparse
acl_b.py
inzm99/atcoder
train
0
23f1b8647cce82f9a5b7fe535fc1eddb37fbf8b9
[ "if allowed_classes is None:\n allowed_classes = []\nself._allowed_classes = set(allowed_classes)", "if len(self._allowed_classes) > 0 and type(item) not in self._allowed_classes:\n raise ValueError(f'Cannot add {type(item)} to restricted set: {self._allowed_classes}')\nif item in self:\n super().discard...
<|body_start_0|> if allowed_classes is None: allowed_classes = [] self._allowed_classes = set(allowed_classes) <|end_body_0|> <|body_start_1|> if len(self._allowed_classes) > 0 and type(item) not in self._allowed_classes: raise ValueError(f'Cannot add {type(item)} to res...
a DSC set object.
dsc_set
[ "BSD-2-Clause-Patent" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dsc_set: """a DSC set object.""" def __init__(self, allowed_classes=None): """Initializes an empty set.""" <|body_0|> def add(self, item): """Adds the item to the set. Raises: (ValueError): if the type is not allowed to be added.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_75kplus_train_073414
25,923
permissive
[ { "docstring": "Initializes an empty set.", "name": "__init__", "signature": "def __init__(self, allowed_classes=None)" }, { "docstring": "Adds the item to the set. Raises: (ValueError): if the type is not allowed to be added.", "name": "add", "signature": "def add(self, item)" } ]
2
null
Implement the Python class `dsc_set` described below. Class description: a DSC set object. Method signatures and docstrings: - def __init__(self, allowed_classes=None): Initializes an empty set. - def add(self, item): Adds the item to the set. Raises: (ValueError): if the type is not allowed to be added.
Implement the Python class `dsc_set` described below. Class description: a DSC set object. Method signatures and docstrings: - def __init__(self, allowed_classes=None): Initializes an empty set. - def add(self, item): Adds the item to the set. Raises: (ValueError): if the type is not allowed to be added. <|skeleton|...
78295929b37af62a8cfc4c28eab72ed0c468f350
<|skeleton|> class dsc_set: """a DSC set object.""" def __init__(self, allowed_classes=None): """Initializes an empty set.""" <|body_0|> def add(self, item): """Adds the item to the set. Raises: (ValueError): if the type is not allowed to be added.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class dsc_set: """a DSC set object.""" def __init__(self, allowed_classes=None): """Initializes an empty set.""" if allowed_classes is None: allowed_classes = [] self._allowed_classes = set(allowed_classes) def add(self, item): """Adds the item to the set. Raise...
the_stack_v2_python_sparse
edk2toollib/uefi/edk2/build_objects/dsc.py
tianocore/edk2-pytool-library
train
47
a045ade5528c7dd52b83167a2633e5d4d1ef2ea6
[ "self.tokenlabel = tokenlabel\nif tokenlabel is not None:\n self.token_xpath = '[@{:s}]'.format(tokenlabel)\nelse:\n self.token_xpath = ''\nself.token_xpath = './/tok' + self.token_xpath\nif doc_sel == 'DOCUMENT':\n self.doc_xpath = './/doc'\nelif doc_sel == 'SENTENCE':\n self.doc_xpath = './/doc//sent'...
<|body_start_0|> self.tokenlabel = tokenlabel if tokenlabel is not None: self.token_xpath = '[@{:s}]'.format(tokenlabel) else: self.token_xpath = '' self.token_xpath = './/tok' + self.token_xpath if doc_sel == 'DOCUMENT': self.doc_xpath = './/d...
BagOfWords
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BagOfWords: def __init__(self, tokenlabel='label', doc_sel='DOCUMENT'): """Specifies the element of a corpus to treat as a document. Can be one of "DOCUMENT" or "SENTENCE". Specifies the attribute of the token to treat as a word. If None, extracts the text of the token to treat as a word...
stack_v2_sparse_classes_75kplus_train_073415
2,683
no_license
[ { "docstring": "Specifies the element of a corpus to treat as a document. Can be one of \"DOCUMENT\" or \"SENTENCE\". Specifies the attribute of the token to treat as a word. If None, extracts the text of the token to treat as a word.", "name": "__init__", "signature": "def __init__(self, tokenlabel='la...
2
stack_v2_sparse_classes_30k_train_002246
Implement the Python class `BagOfWords` described below. Class description: Implement the BagOfWords class. Method signatures and docstrings: - def __init__(self, tokenlabel='label', doc_sel='DOCUMENT'): Specifies the element of a corpus to treat as a document. Can be one of "DOCUMENT" or "SENTENCE". Specifies the at...
Implement the Python class `BagOfWords` described below. Class description: Implement the BagOfWords class. Method signatures and docstrings: - def __init__(self, tokenlabel='label', doc_sel='DOCUMENT'): Specifies the element of a corpus to treat as a document. Can be one of "DOCUMENT" or "SENTENCE". Specifies the at...
affe6a5c64697d38081d0d2581212c2f2fdd304a
<|skeleton|> class BagOfWords: def __init__(self, tokenlabel='label', doc_sel='DOCUMENT'): """Specifies the element of a corpus to treat as a document. Can be one of "DOCUMENT" or "SENTENCE". Specifies the attribute of the token to treat as a word. If None, extracts the text of the token to treat as a word...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BagOfWords: def __init__(self, tokenlabel='label', doc_sel='DOCUMENT'): """Specifies the element of a corpus to treat as a document. Can be one of "DOCUMENT" or "SENTENCE". Specifies the attribute of the token to treat as a word. If None, extracts the text of the token to treat as a word.""" s...
the_stack_v2_python_sparse
themecrafter/preprocessing/words.py
joesdesk/themecrafter
train
1
c8c26f5c37a8f07031365282c3d7b7aff23d96c0
[ "private_key_path = Path(path)\ninstance = SshKey(private_key=private_key_path.read_text(), label=private_key_path.name)\nself.validate_ssh_key(instance, storage)\nreturn instance", "with_same_label = storage.filter(SshKey, **{'label': instance.label, 'id.ne': instance.id})\nif with_same_label:\n raise Invalid...
<|body_start_0|> private_key_path = Path(path) instance = SshKey(private_key=private_key_path.read_text(), label=private_key_path.name) self.validate_ssh_key(instance, storage) return instance <|end_body_0|> <|body_start_1|> with_same_label = storage.filter(SshKey, **{'label': i...
Mixin for create new ssh key from file.
SshKeyGeneratorMixin
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SshKeyGeneratorMixin: """Mixin for create new ssh key from file.""" def generate_ssh_key_instance(self, path, storage): """Generate ssh key from file.""" <|body_0|> def validate_ssh_key(self, instance, storage): """Raise an error when any instances exist with sam...
stack_v2_sparse_classes_75kplus_train_073416
2,354
permissive
[ { "docstring": "Generate ssh key from file.", "name": "generate_ssh_key_instance", "signature": "def generate_ssh_key_instance(self, path, storage)" }, { "docstring": "Raise an error when any instances exist with same label.", "name": "validate_ssh_key", "signature": "def validate_ssh_ke...
2
stack_v2_sparse_classes_30k_train_037576
Implement the Python class `SshKeyGeneratorMixin` described below. Class description: Mixin for create new ssh key from file. Method signatures and docstrings: - def generate_ssh_key_instance(self, path, storage): Generate ssh key from file. - def validate_ssh_key(self, instance, storage): Raise an error when any ins...
Implement the Python class `SshKeyGeneratorMixin` described below. Class description: Mixin for create new ssh key from file. Method signatures and docstrings: - def generate_ssh_key_instance(self, path, storage): Generate ssh key from file. - def validate_ssh_key(self, instance, storage): Raise an error when any ins...
2664d0c70d3d682ad931b885b4965447b156c280
<|skeleton|> class SshKeyGeneratorMixin: """Mixin for create new ssh key from file.""" def generate_ssh_key_instance(self, path, storage): """Generate ssh key from file.""" <|body_0|> def validate_ssh_key(self, instance, storage): """Raise an error when any instances exist with sam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SshKeyGeneratorMixin: """Mixin for create new ssh key from file.""" def generate_ssh_key_instance(self, path, storage): """Generate ssh key from file.""" private_key_path = Path(path) instance = SshKey(private_key=private_key_path.read_text(), label=private_key_path.name) ...
the_stack_v2_python_sparse
termius/handlers/ssh_key.py
termius/termius-cli
train
262
44fedd5f108a10694d4a9a0880751ea0533a54de
[ "super().__init__()\nself.pending_q = data_q\nself.done_q = batch_q\nself.stop_event = stop_event\nself.batch_size = batch_size\nself.batch = []\nif n_in_queue is None:\n self.n_in_queue = Counter()\nelse:\n self.n_in_queue = n_in_queue\nself.nsaved = 0\nself.postprocess_fun = postprocess_fun", "while not s...
<|body_start_0|> super().__init__() self.pending_q = data_q self.done_q = batch_q self.stop_event = stop_event self.batch_size = batch_size self.batch = [] if n_in_queue is None: self.n_in_queue = Counter() else: self.n_in_queue = n...
Create a new process that will aggregate examples created by DataGenerator processes into a batch of examples
DataAggregator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataAggregator: """Create a new process that will aggregate examples created by DataGenerator processes into a batch of examples""" def __init__(self, data_q: Queue, batch_q: Queue, stop_event: Event, batch_size: int, n_in_queue: Counter=None, postprocess_fun=None): """This is the co...
stack_v2_sparse_classes_75kplus_train_073417
7,565
permissive
[ { "docstring": "This is the constructor for the class. @params: data_q (Queue): A Queue in which to get new examples batch_q (Queue): A Queue in which to put new batches of examples stop_event (Event): An Event to kill the DataAggregator process batch_size (int): The number of examples in a batch n_in_queue (Co...
2
null
Implement the Python class `DataAggregator` described below. Class description: Create a new process that will aggregate examples created by DataGenerator processes into a batch of examples Method signatures and docstrings: - def __init__(self, data_q: Queue, batch_q: Queue, stop_event: Event, batch_size: int, n_in_q...
Implement the Python class `DataAggregator` described below. Class description: Create a new process that will aggregate examples created by DataGenerator processes into a batch of examples Method signatures and docstrings: - def __init__(self, data_q: Queue, batch_q: Queue, stop_event: Event, batch_size: int, n_in_q...
3c0c12b06b01175e0f0ab0a60383cfc7da8fb402
<|skeleton|> class DataAggregator: """Create a new process that will aggregate examples created by DataGenerator processes into a batch of examples""" def __init__(self, data_q: Queue, batch_q: Queue, stop_event: Event, batch_size: int, n_in_queue: Counter=None, postprocess_fun=None): """This is the co...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataAggregator: """Create a new process that will aggregate examples created by DataGenerator processes into a batch of examples""" def __init__(self, data_q: Queue, batch_q: Queue, stop_event: Event, batch_size: int, n_in_queue: Counter=None, postprocess_fun=None): """This is the constructor for...
the_stack_v2_python_sparse
vrmslearn/Inputqueue.py
GeoCode-polymtl/Deep_1D_velocity
train
16
27b9deaa7481efb6f3041665dbb30fa4fc107915
[ "labels, label_ids = self.get_labels()\nself.save_field_to_hdf5(set_name=self.set_name, field='labels', data=labels, dtype=np.uint8, fillvalue=0)\nreturn label_ids", "labels = self.data['labels']\nlabel_ids = list(range(len(labels)))\nreturn (labels, label_ids)" ]
<|body_start_0|> labels, label_ids = self.get_labels() self.save_field_to_hdf5(set_name=self.set_name, field='labels', data=labels, dtype=np.uint8, fillvalue=0) return label_ids <|end_body_0|> <|body_start_1|> labels = self.data['labels'] label_ids = list(range(len(labels))) ...
Label id field metadata process/save class.
LabelIdField
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelIdField: """Label id field metadata process/save class.""" def process(self): """Processes and saves the labels metadata to hdf5.""" <|body_0|> def get_labels(self): """Returns a np.ndarray of labels and a list of label ids for each row of 'object_ids' field...
stack_v2_sparse_classes_75kplus_train_073418
9,235
permissive
[ { "docstring": "Processes and saves the labels metadata to hdf5.", "name": "process", "signature": "def process(self)" }, { "docstring": "Returns a np.ndarray of labels and a list of label ids for each row of 'object_ids' field.", "name": "get_labels", "signature": "def get_labels(self)"...
2
stack_v2_sparse_classes_30k_train_036010
Implement the Python class `LabelIdField` described below. Class description: Label id field metadata process/save class. Method signatures and docstrings: - def process(self): Processes and saves the labels metadata to hdf5. - def get_labels(self): Returns a np.ndarray of labels and a list of label ids for each row ...
Implement the Python class `LabelIdField` described below. Class description: Label id field metadata process/save class. Method signatures and docstrings: - def process(self): Processes and saves the labels metadata to hdf5. - def get_labels(self): Returns a np.ndarray of labels and a list of label ids for each row ...
e0be95d941b50a5b2e27ffa1c5be20dc6aa2d6a1
<|skeleton|> class LabelIdField: """Label id field metadata process/save class.""" def process(self): """Processes and saves the labels metadata to hdf5.""" <|body_0|> def get_labels(self): """Returns a np.ndarray of labels and a list of label ids for each row of 'object_ids' field...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelIdField: """Label id field metadata process/save class.""" def process(self): """Processes and saves the labels metadata to hdf5.""" labels, label_ids = self.get_labels() self.save_field_to_hdf5(set_name=self.set_name, field='labels', data=labels, dtype=np.uint8, fillvalue=0)...
the_stack_v2_python_sparse
dbcollection/datasets/mnist/classification.py
dbcollection/dbcollection
train
25
df42bb737f4a84506114f08a24aa01ae322ecc8c
[ "super(Decoder, self).__init__()\nself.deEmb = nn.Embedding(deVocabSize, embSize)\nself.dePos = Position(deVocabSize, embSize, dropout).to(device)\nself.layers = nn.ModuleList([DecoderLayer(embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias) for _ in range(numLayers)]).to(device)", "deInputs =...
<|body_start_0|> super(Decoder, self).__init__() self.deEmb = nn.Embedding(deVocabSize, embSize) self.dePos = Position(deVocabSize, embSize, dropout).to(device) self.layers = nn.ModuleList([DecoderLayer(embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias) for _ in rang...
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: def __init__(self, deVocabSize, embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias, numLayers=numLayers, dropout=dropout): """@doc: Decoder @author: Alpaca-Man @date: 2021/2/22 @param: { deVocabSize: Decoder 单词表长度 embSize: 词向量维度 qSize: Q 的维度 kSize: K 的维度(需要与 ...
stack_v2_sparse_classes_75kplus_train_073419
9,438
no_license
[ { "docstring": "@doc: Decoder @author: Alpaca-Man @date: 2021/2/22 @param: { deVocabSize: Decoder 单词表长度 embSize: 词向量维度 qSize: Q 的维度 kSize: K 的维度(需要与 Q 的维度相等) vSize: V 的维度 hiddenSize: 两层全连接层中间的维度 numHeads: 头数 default 8 bias: 偏置 default False numLayers: Encoder 层数 default 8 } @return: { }", "name": "__init__"...
2
null
Implement the Python class `Decoder` described below. Class description: Implement the Decoder class. Method signatures and docstrings: - def __init__(self, deVocabSize, embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias, numLayers=numLayers, dropout=dropout): @doc: Decoder @author: Alpaca-Man @da...
Implement the Python class `Decoder` described below. Class description: Implement the Decoder class. Method signatures and docstrings: - def __init__(self, deVocabSize, embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias, numLayers=numLayers, dropout=dropout): @doc: Decoder @author: Alpaca-Man @da...
49824925970f0439634dc66a7f19edc512f18a5f
<|skeleton|> class Decoder: def __init__(self, deVocabSize, embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias, numLayers=numLayers, dropout=dropout): """@doc: Decoder @author: Alpaca-Man @date: 2021/2/22 @param: { deVocabSize: Decoder 单词表长度 embSize: 词向量维度 qSize: Q 的维度 kSize: K 的维度(需要与 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Decoder: def __init__(self, deVocabSize, embSize, qSize, kSize, vSize, hiddenSize, numHeads=numHeads, bias=bias, numLayers=numLayers, dropout=dropout): """@doc: Decoder @author: Alpaca-Man @date: 2021/2/22 @param: { deVocabSize: Decoder 单词表长度 embSize: 词向量维度 qSize: Q 的维度 kSize: K 的维度(需要与 Q 的维度相等) vSize...
the_stack_v2_python_sparse
Transformer/standard/Transformer.py
Alpaca-Man/NLP-Newcomer
train
1
269834b1313970654ee77467a6237c292e52caa7
[ "self.start_time = datetime.now()\nself.master_db = get_master_mongo_conn()\nself.clean_ingredients()", "query_params = {}\nrecipes = self.master_db['cleansed_ingredients'].find(query_params, no_cursor_timeout=True)\ntotal_records_count = recipes.count()\nspecial_cases = []\nsand_cases = []\nerror_cases = []\nfor...
<|body_start_0|> self.start_time = datetime.now() self.master_db = get_master_mongo_conn() self.clean_ingredients() <|end_body_0|> <|body_start_1|> query_params = {} recipes = self.master_db['cleansed_ingredients'].find(query_params, no_cursor_timeout=True) total_records...
Tokenizes ingredient text
TokenizeIngredients
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenizeIngredients: """Tokenizes ingredient text""" def __init__(self): """Creating mongo connection and calling main method directly from initialization method""" <|body_0|> def clean_ingredients(self): """This is the main function where the tokenization starts...
stack_v2_sparse_classes_75kplus_train_073420
2,209
no_license
[ { "docstring": "Creating mongo connection and calling main method directly from initialization method", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This is the main function where the tokenization starts", "name": "clean_ingredients", "signature": "def clean_...
2
stack_v2_sparse_classes_30k_train_002192
Implement the Python class `TokenizeIngredients` described below. Class description: Tokenizes ingredient text Method signatures and docstrings: - def __init__(self): Creating mongo connection and calling main method directly from initialization method - def clean_ingredients(self): This is the main function where th...
Implement the Python class `TokenizeIngredients` described below. Class description: Tokenizes ingredient text Method signatures and docstrings: - def __init__(self): Creating mongo connection and calling main method directly from initialization method - def clean_ingredients(self): This is the main function where th...
495bfd49f245b1a6b7bc1d336745813a30c898ab
<|skeleton|> class TokenizeIngredients: """Tokenizes ingredient text""" def __init__(self): """Creating mongo connection and calling main method directly from initialization method""" <|body_0|> def clean_ingredients(self): """This is the main function where the tokenization starts...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TokenizeIngredients: """Tokenizes ingredient text""" def __init__(self): """Creating mongo connection and calling main method directly from initialization method""" self.start_time = datetime.now() self.master_db = get_master_mongo_conn() self.clean_ingredients() def ...
the_stack_v2_python_sparse
cleansing_ingredients/get_error_cases.py
nireeshach/Groceryappstore
train
0
9ea1c2746cd676d8a16df87e9b920ae9f6c52dd6
[ "seq_length = 4\nnum_predictions = 2\nxlnet_base = _get_xlnet_base()\nxlnet_trainer_model = xlnet.XLNetPretrainer(network=xlnet_base)\ninputs = dict(input_word_ids=tf.keras.layers.Input(shape=(seq_length,), dtype=tf.int32, name='input_word_ids'), input_type_ids=tf.keras.layers.Input(shape=(seq_length,), dtype=tf.in...
<|body_start_0|> seq_length = 4 num_predictions = 2 xlnet_base = _get_xlnet_base() xlnet_trainer_model = xlnet.XLNetPretrainer(network=xlnet_base) inputs = dict(input_word_ids=tf.keras.layers.Input(shape=(seq_length,), dtype=tf.int32, name='input_word_ids'), input_type_ids=tf.ker...
XLNetPretrainerTest
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XLNetPretrainerTest: def test_xlnet_trainer(self): """Validates that the Keras object can be created.""" <|body_0|> def test_xlnet_tensor_call(self): """Validates that the Keras object can be invoked.""" <|body_1|> def test_serialize_deserialize(self): ...
stack_v2_sparse_classes_75kplus_train_073421
13,124
permissive
[ { "docstring": "Validates that the Keras object can be created.", "name": "test_xlnet_trainer", "signature": "def test_xlnet_trainer(self)" }, { "docstring": "Validates that the Keras object can be invoked.", "name": "test_xlnet_tensor_call", "signature": "def test_xlnet_tensor_call(self...
3
stack_v2_sparse_classes_30k_train_001553
Implement the Python class `XLNetPretrainerTest` described below. Class description: Implement the XLNetPretrainerTest class. Method signatures and docstrings: - def test_xlnet_trainer(self): Validates that the Keras object can be created. - def test_xlnet_tensor_call(self): Validates that the Keras object can be inv...
Implement the Python class `XLNetPretrainerTest` described below. Class description: Implement the XLNetPretrainerTest class. Method signatures and docstrings: - def test_xlnet_trainer(self): Validates that the Keras object can be created. - def test_xlnet_tensor_call(self): Validates that the Keras object can be inv...
6fc53292b1d3ce3c0340ce724c2c11c77e663d27
<|skeleton|> class XLNetPretrainerTest: def test_xlnet_trainer(self): """Validates that the Keras object can be created.""" <|body_0|> def test_xlnet_tensor_call(self): """Validates that the Keras object can be invoked.""" <|body_1|> def test_serialize_deserialize(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class XLNetPretrainerTest: def test_xlnet_trainer(self): """Validates that the Keras object can be created.""" seq_length = 4 num_predictions = 2 xlnet_base = _get_xlnet_base() xlnet_trainer_model = xlnet.XLNetPretrainer(network=xlnet_base) inputs = dict(input_word_id...
the_stack_v2_python_sparse
models/official/nlp/modeling/models/xlnet_test.py
aboerzel/German_License_Plate_Recognition
train
34
0145583c62075cd4d4baaa61a746f33d0397f943
[ "orders = []\n\ndef inorder(node):\n if node:\n inorder(node.left)\n orders.append(node.val)\n inorder(node.right)\ninorder(root)\nreturn orders", "res, stack = ([], [])\ncur = root\nwhile cur or len(stack) != 0:\n while cur:\n '\\n 对一节点执行左根右的遍历,其实就是不断地去寻找节点的左子...
<|body_start_0|> orders = [] def inorder(node): if node: inorder(node.left) orders.append(node.val) inorder(node.right) inorder(root) return orders <|end_body_0|> <|body_start_1|> res, stack = ([], []) cur = ro...
94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右""" def inorder_traversal(self, root): """:type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要...
stack_v2_sparse_classes_75kplus_train_073422
2,703
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要被访问两遍,因此时间复杂度为O(n),空间上如果除了子节点外所有结点都具有左、右子节点,则空间复杂度为 O(n),平均下来为O(logn) 时间复杂度:O(n) 空间复杂度:O(logn)", "name": "inorder_traversal", "signature": "d...
2
stack_v2_sparse_classes_30k_train_053914
Implement the Python class `Solution` described below. Class description: 94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右 Method signatures and docstrings: - def inorder_traversal(self, root): :type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来...
Implement the Python class `Solution` described below. Class description: 94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右 Method signatures and docstrings: - def inorder_traversal(self, root): :type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来...
2c534185854c1a6f5ffdb2698f9db9989f30a25b
<|skeleton|> class Solution: """94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右""" def inorder_traversal(self, root): """:type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """94. 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 2 / 3 输出: [1,3,2] 分析: 树的中序遍历的顺序为:左根右""" def inorder_traversal(self, root): """:type root: TreeNode :rtype: List[int] 直接使用递归,从根节点开始遍历的顺序为左根右,假定当前层左子树、右子树均完成遍历, 则此时对于根节点来说遍历的顺序就为左节点、根节点、右节点。左子树、右子树中任意节点均与根节点具有相同的遍历规律 因为树种每个节点都要被访问两遍,因此时间复杂度...
the_stack_v2_python_sparse
Week 02/id_668/leetcode_94_668.py
Carryours/algorithm004-03
train
2
9b394f830b91a7ca0074dd44e3fb9f58f04b2d3e
[ "binding_ids = self.session.search(self.model._name, [('civicrm_id', '=', external_id), ('backend_id', '=', self.backend_record.id)])\nif not binding_ids:\n return None\nassert len(binding_ids) == 1, 'Several records found: %s' % binding_ids\nbinding_id = binding_ids[0]\nif unwrap:\n return self.session.read(...
<|body_start_0|> binding_ids = self.session.search(self.model._name, [('civicrm_id', '=', external_id), ('backend_id', '=', self.backend_record.id)]) if not binding_ids: return None assert len(binding_ids) == 1, 'Several records found: %s' % binding_ids binding_id = binding_i...
CivicrmBinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CivicrmBinder: def to_openerp(self, external_id, unwrap=False): """Give the OpenERP ID for an external ID :param external_id: external ID for which we want the OpenERP ID :param unwrap: if True, returns the openerp_id of the icops_xxxx record, else return the id (binding id) of that reco...
stack_v2_sparse_classes_75kplus_train_073423
2,576
no_license
[ { "docstring": "Give the OpenERP ID for an external ID :param external_id: external ID for which we want the OpenERP ID :param unwrap: if True, returns the openerp_id of the icops_xxxx record, else return the id (binding id) of that record :return: a record ID, depending on the value of unwrap, or None if the e...
3
null
Implement the Python class `CivicrmBinder` described below. Class description: Implement the CivicrmBinder class. Method signatures and docstrings: - def to_openerp(self, external_id, unwrap=False): Give the OpenERP ID for an external ID :param external_id: external ID for which we want the OpenERP ID :param unwrap: ...
Implement the Python class `CivicrmBinder` described below. Class description: Implement the CivicrmBinder class. Method signatures and docstrings: - def to_openerp(self, external_id, unwrap=False): Give the OpenERP ID for an external ID :param external_id: external ID for which we want the OpenERP ID :param unwrap: ...
a359060d67d3049ffad0946b65691a73738f0ebf
<|skeleton|> class CivicrmBinder: def to_openerp(self, external_id, unwrap=False): """Give the OpenERP ID for an external ID :param external_id: external ID for which we want the OpenERP ID :param unwrap: if True, returns the openerp_id of the icops_xxxx record, else return the id (binding id) of that reco...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CivicrmBinder: def to_openerp(self, external_id, unwrap=False): """Give the OpenERP ID for an external ID :param external_id: external ID for which we want the OpenERP ID :param unwrap: if True, returns the openerp_id of the icops_xxxx record, else return the id (binding id) of that record :return: a ...
the_stack_v2_python_sparse
sp_civicrmconnector/binder.py
shouyejing/civicrm_connector
train
0
5e76fab39bf8811971226f2a15ef2bb2432703c3
[ "self.params = {}\nself.reg = reg\nself.dtype = dtype\nC, H, W = input_dim\npooled_height = 1 + (H - 2) / 2\npooled_width = 1 + (W - 2) / 2\nself.params['W1'] = np.random.randn(num_filters, C, filter_size, filter_size) * weight_scale\nself.params['b1'] = np.zeros(num_filters)\nself.params['W2'] = np.random.randn(nu...
<|body_start_0|> self.params = {} self.reg = reg self.dtype = dtype C, H, W = input_dim pooled_height = 1 + (H - 2) / 2 pooled_width = 1 + (W - 2) / 2 self.params['W1'] = np.random.randn(num_filters, C, filter_size, filter_size) * weight_scale self.params[...
A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input channels.
ThreeLayerConvNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreeLayerConvNet: """A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input...
stack_v2_sparse_classes_75kplus_train_073424
9,082
no_license
[ { "docstring": "Initialize a new network. Inputs: - input_dim: Tuple (C, H, W) giving size of input data - num_filters: Number of filters to use in the convolutional layer - filter_size: Size of filters to use in the convolutional layer - hidden_dim: Number of units to use in the fully-connected hidden layer - ...
2
null
Implement the Python class `ThreeLayerConvNet` described below. Class description: A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each wit...
Implement the Python class `ThreeLayerConvNet` described below. Class description: A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each wit...
49a1992ef1559030287cd1090ad410936f2125fd
<|skeleton|> class ThreeLayerConvNet: """A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThreeLayerConvNet: """A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input channels."""...
the_stack_v2_python_sparse
cs231n-convnets-2016/assignment-2/assignment2/cs231n/classifiers/cnn.py
fagan2888/original-machine-learning
train
0
da2c3febebe42f269d2b0802d4378863d8d970ee
[ "this_user = self.context['request'].user\nworkflow = validated_data['workflow']\nif workflow.user != this_user:\n raise APIException(_('Incorrect permission to manipulate workflow.'))\naction = validated_data['action']\nif action is not None and action.workflow != workflow:\n raise APIException(_('Incorrect ...
<|body_start_0|> this_user = self.context['request'].user workflow = validated_data['workflow'] if workflow.user != this_user: raise APIException(_('Incorrect permission to manipulate workflow.')) action = validated_data['action'] if action is not None and action.work...
Serializer to take care of a few fields and the item column.
ScheduledOperationSerializer
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScheduledOperationSerializer: """Serializer to take care of a few fields and the item column.""" def extra_validation(self, validated_data: Dict): """Check for extra properties. Checking for extra properties in the information contained in the validated data. Namely: - The action nam...
stack_v2_sparse_classes_75kplus_train_073425
8,568
permissive
[ { "docstring": "Check for extra properties. Checking for extra properties in the information contained in the validated data. Namely: - The action name corresponds with a valid action for the user. - The execution time must be in the future - The received object has a payload - The item_column, if present, must...
3
stack_v2_sparse_classes_30k_train_000866
Implement the Python class `ScheduledOperationSerializer` described below. Class description: Serializer to take care of a few fields and the item column. Method signatures and docstrings: - def extra_validation(self, validated_data: Dict): Check for extra properties. Checking for extra properties in the information ...
Implement the Python class `ScheduledOperationSerializer` described below. Class description: Serializer to take care of a few fields and the item column. Method signatures and docstrings: - def extra_validation(self, validated_data: Dict): Check for extra properties. Checking for extra properties in the information ...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class ScheduledOperationSerializer: """Serializer to take care of a few fields and the item column.""" def extra_validation(self, validated_data: Dict): """Check for extra properties. Checking for extra properties in the information contained in the validated data. Namely: - The action nam...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScheduledOperationSerializer: """Serializer to take care of a few fields and the item column.""" def extra_validation(self, validated_data: Dict): """Check for extra properties. Checking for extra properties in the information contained in the validated data. Namely: - The action name corresponds...
the_stack_v2_python_sparse
ontask/scheduler/serializers.py
abelardopardo/ontask_b
train
43
9dd439a6460486272b6c8148cee620a926b5507a
[ "for i in xrange(1, len(nums)):\n if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]):\n nums[i], nums[i - 1] = (nums[i - 1], nums[i])", "nums.sort()\nfor i in xrange((len(nums) - 1) / 2):\n nums[2 * i + 1], nums[2 * i + 2] = (nums[2 * i + 2], nums[2 * i + 1])" ]
<|body_start_0|> for i in xrange(1, len(nums)): if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]): nums[i], nums[i - 1] = (nums[i - 1], nums[i]) <|end_body_0|> <|body_start_1|> nums.sort() for i in xrange((len(nums) - 1) / 2): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wiggleSort(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def wiggleSort_nlogn(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instea...
stack_v2_sparse_classes_75kplus_train_073426
718
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "wiggleSort", "signature": "def wiggleSort(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "wi...
2
stack_v2_sparse_classes_30k_train_002061
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def wiggleSort_nlogn(self, nums): :type nums: List[int] :rt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleSort(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def wiggleSort_nlogn(self, nums): :type nums: List[int] :rt...
ed15eb27936b39980d4cb5fb61cd937ec7ddcb6a
<|skeleton|> class Solution: def wiggleSort(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def wiggleSort_nlogn(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def wiggleSort(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" for i in xrange(1, len(nums)): if i % 2 == 0 and nums[i] > nums[i - 1] or (i % 2 == 1 and nums[i] < nums[i - 1]): nums[i], nums[i - 1...
the_stack_v2_python_sparse
alice/LC280.py
AliceTTXu/LeetCode
train
0
6953bdcd9eacadc9f273a711cbc22ada826d51ce
[ "elems = self.find_elements_by_css_selector(css_selector)\nfound = len(elems)\nif found == 1:\n return elems[0]\nelif not elems:\n raise NoSuchElementException(css_selector)\nreturn elems", "try:\n return WebDriverWait(self, timeout).until(lambda driver: driver.find_css(css_selector))\nexcept:\n self....
<|body_start_0|> elems = self.find_elements_by_css_selector(css_selector) found = len(elems) if found == 1: return elems[0] elif not elems: raise NoSuchElementException(css_selector) return elems <|end_body_0|> <|body_start_1|> try: re...
Our own WebDriver with some helpers added
CustomWebDriver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomWebDriver: """Our own WebDriver with some helpers added""" def find_css(self, css_selector): """Shortcut to find elements by CSS. Returns either a list or singleton""" <|body_0|> def wait_for_css(self, css_selector, timeout=7): """Shortcut for WebDriverWait...
stack_v2_sparse_classes_75kplus_train_073427
7,802
no_license
[ { "docstring": "Shortcut to find elements by CSS. Returns either a list or singleton", "name": "find_css", "signature": "def find_css(self, css_selector)" }, { "docstring": "Shortcut for WebDriverWait", "name": "wait_for_css", "signature": "def wait_for_css(self, css_selector, timeout=7)...
2
null
Implement the Python class `CustomWebDriver` described below. Class description: Our own WebDriver with some helpers added Method signatures and docstrings: - def find_css(self, css_selector): Shortcut to find elements by CSS. Returns either a list or singleton - def wait_for_css(self, css_selector, timeout=7): Short...
Implement the Python class `CustomWebDriver` described below. Class description: Our own WebDriver with some helpers added Method signatures and docstrings: - def find_css(self, css_selector): Shortcut to find elements by CSS. Returns either a list or singleton - def wait_for_css(self, css_selector, timeout=7): Short...
27a1bfb342c0e533ba99d197db3b47dc4443b170
<|skeleton|> class CustomWebDriver: """Our own WebDriver with some helpers added""" def find_css(self, css_selector): """Shortcut to find elements by CSS. Returns either a list or singleton""" <|body_0|> def wait_for_css(self, css_selector, timeout=7): """Shortcut for WebDriverWait...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomWebDriver: """Our own WebDriver with some helpers added""" def find_css(self, css_selector): """Shortcut to find elements by CSS. Returns either a list or singleton""" elems = self.find_elements_by_css_selector(css_selector) found = len(elems) if found == 1: ...
the_stack_v2_python_sparse
webcdi/cdi_forms/tests.py
langcog/web-cdi
train
9
ba168de0b51e4c0c6ba4db85c47c6e4c4136e23b
[ "super(AutoEncoder, self).__init__(name=name, **kwargs)\nself.add_module('encoder', encoder)\nself.add_module('decoder', decoder)", "y = self.encoder(x)\nx_hat = self.decoder(y)\nreturn (x_hat, y)" ]
<|body_start_0|> super(AutoEncoder, self).__init__(name=name, **kwargs) self.add_module('encoder', encoder) self.add_module('decoder', decoder) <|end_body_0|> <|body_start_1|> y = self.encoder(x) x_hat = self.decoder(y) return (x_hat, y) <|end_body_1|>
A class representing a standard autoencoder Attributes ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture Methods ------- forward(x) returns the autoencoder output
AutoEncoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoEncoder: """A class representing a standard autoencoder Attributes ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture Methods ------- forward(x) returns the autoencoder output""" def __init__(self, encoder, decoder, name='Auto...
stack_v2_sparse_classes_75kplus_train_073428
1,622
permissive
[ { "docstring": "Parameters ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture name : str (optional) the name of the autoencoder (default is 'AutoEncoder')", "name": "__init__", "signature": "def __init__(self, encoder, decoder, name='AutoEnco...
2
null
Implement the Python class `AutoEncoder` described below. Class description: A class representing a standard autoencoder Attributes ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture Methods ------- forward(x) returns the autoencoder output Method signatur...
Implement the Python class `AutoEncoder` described below. Class description: A class representing a standard autoencoder Attributes ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture Methods ------- forward(x) returns the autoencoder output Method signatur...
2615b66dd4addfd5c03d9d91a24c7da414294308
<|skeleton|> class AutoEncoder: """A class representing a standard autoencoder Attributes ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture Methods ------- forward(x) returns the autoencoder output""" def __init__(self, encoder, decoder, name='Auto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AutoEncoder: """A class representing a standard autoencoder Attributes ---------- encoder : torch.nn.Module the encoder architecture decoder : torch.nn.Module the decoder architecture Methods ------- forward(x) returns the autoencoder output""" def __init__(self, encoder, decoder, name='AutoEncoder', **k...
the_stack_v2_python_sparse
ACME/model/autoencoder.py
mauriziokovacic/ACME
train
3
279f0192a9e44244a6febbfa5127f5e402a48c00
[ "self.folder_id = folder_id\nself.public_folder_item_id_list = public_folder_item_id_list\nself.restore_entire_folder = restore_entire_folder", "if dictionary is None:\n return None\nfolder_id = dictionary.get('folderId')\npublic_folder_item_id_list = dictionary.get('publicFolderItemIdList')\nrestore_entire_fo...
<|body_start_0|> self.folder_id = folder_id self.public_folder_item_id_list = public_folder_item_id_list self.restore_entire_folder = restore_entire_folder <|end_body_0|> <|body_start_1|> if dictionary is None: return None folder_id = dictionary.get('folderId') ...
Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the user wishes not to restore the entire fold...
PublicFolder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicFolder: """Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the us...
stack_v2_sparse_classes_75kplus_train_073429
2,185
permissive
[ { "docstring": "Constructor for the PublicFolder class", "name": "__init__", "signature": "def __init__(self, folder_id=None, public_folder_item_id_list=None, restore_entire_folder=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
stack_v2_sparse_classes_30k_train_007923
Implement the Python class `PublicFolder` described below. Class description: Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within ...
Implement the Python class `PublicFolder` described below. Class description: Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class PublicFolder: """Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the us...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PublicFolder: """Implementation of the 'PublicFolder' model. Specifies the O365 PublicFolder details. Attributes: folder_id (string): Specifies the unique ID of the folder. public_folder_item_id_list (list of string): Specifies the PublicFolder items within the folder to be restored incase the user wishes not...
the_stack_v2_python_sparse
cohesity_management_sdk/models/public_folder.py
cohesity/management-sdk-python
train
24
f2ee7f09cd7883b0a77fa7228113203c47f4fb27
[ "limit = df[CLOSE].min()\nif limit > 0:\n limit_df = df[df[CLOSE] <= limit * (2 - LIMIT_DETECT_LIMIT_FACTOR)]\n if not limit_df.empty:\n tm = limit_df.index[-1]\n return tm", "limit = df[DIF].min()\nif limit < 0:\n return cls.__get_min_limit_tm(df[DIF], limit)", "limit = df[MACD].min()\ni...
<|body_start_0|> limit = df[CLOSE].min() if limit > 0: limit_df = df[df[CLOSE] <= limit * (2 - LIMIT_DETECT_LIMIT_FACTOR)] if not limit_df.empty: tm = limit_df.index[-1] return tm <|end_body_0|> <|body_start_1|> limit = df[DIF].min() ...
检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD
MinLimitDetect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinLimitDetect: """检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD""" def get_close_limit_tm_in(cls, df): """获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:""" <|body_0|> def get_dif_limit_tm_in(cls, df): """获取区间内DIF最小值的时间。 ...
stack_v2_sparse_classes_75kplus_train_073430
36,499
no_license
[ { "docstring": "获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:", "name": "get_close_limit_tm_in", "signature": "def get_close_limit_tm_in(cls, df)" }, { "docstring": "获取区间内DIF最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:", ...
4
stack_v2_sparse_classes_30k_train_048916
Implement the Python class `MinLimitDetect` described below. Class description: 检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD Method signatures and docstrings: - def get_close_limit_tm_in(cls, df): 获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return: - def get_dif_limit_tm_in(cls, ...
Implement the Python class `MinLimitDetect` described below. Class description: 检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD Method signatures and docstrings: - def get_close_limit_tm_in(cls, df): 获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return: - def get_dif_limit_tm_in(cls, ...
9446d33c0978c325c8b24a876ac2c42fe323dbe6
<|skeleton|> class MinLimitDetect: """检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD""" def get_close_limit_tm_in(cls, df): """获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:""" <|body_0|> def get_dif_limit_tm_in(cls, df): """获取区间内DIF最小值的时间。 ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MinLimitDetect: """检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD""" def get_close_limit_tm_in(cls, df): """获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:""" limit = df[CLOSE].min() if limit > 0: limit_df = df[df[CLOSE] <= limit...
the_stack_v2_python_sparse
back_forecast/learn_quant/MACD/jukuan_macd_signal.py
lnkyzhang/wayToFreedomOfWealth
train
3
a2c36711728a95b92e9b571bd8dffdf4fbe0c11b
[ "if std is None:\n print(src + ': Please specify a standard output for messages!')\n exit()\nelse:\n self.std = std\nself.std.Print('Initialising GrfNode', fg, bg, style, src)\nsuper(GrfNode, self).__init__(sheetCanvas=sheetCanvas, cat=cat, label=label, center=center, size=size, con_type=con_type, color_ty...
<|body_start_0|> if std is None: print(src + ': Please specify a standard output for messages!') exit() else: self.std = std self.std.Print('Initialising GrfNode', fg, bg, style, src) super(GrfNode, self).__init__(sheetCanvas=sheetCanvas, cat=cat, labe...
Node item in the Blodiator. Define an instance of 'GrfNode' with appropriate arguments: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item label size = size of the node inPort = list containing information about in...
GrfNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrfNode: """Node item in the Blodiator. Define an instance of 'GrfNode' with appropriate arguments: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item label size = size of the node inPort = l...
stack_v2_sparse_classes_75kplus_train_073431
6,091
permissive
[ { "docstring": "Construct a GrfNode input: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item label size = size of the node inPort = list containing information about input ports of the item outPort = list ...
3
stack_v2_sparse_classes_30k_test_001964
Implement the Python class `GrfNode` described below. Class description: Node item in the Blodiator. Define an instance of 'GrfNode' with appropriate arguments: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item l...
Implement the Python class `GrfNode` described below. Class description: Node item in the Blodiator. Define an instance of 'GrfNode' with appropriate arguments: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item l...
4afaf5fb11e6c5d807fdfbca862013a42c63d215
<|skeleton|> class GrfNode: """Node item in the Blodiator. Define an instance of 'GrfNode' with appropriate arguments: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item label size = size of the node inPort = l...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GrfNode: """Node item in the Blodiator. Define an instance of 'GrfNode' with appropriate arguments: sheetCanvas = an instance of the canvas. For Blodiator it is an instance of CntSheetCanvas tag = a string used by tkinter to identify the block label = item label size = size of the node inPort = list containin...
the_stack_v2_python_sparse
blodiator/graf/grfnode.py
MansourM61/Blodiator
train
1
fbf3aced4752d2c4e6ad34ef18c1d02ae7c5dca7
[ "self.window_size = window_size\nself.threshold = threshold\nself.threshold_r = threshold_r\nself.perform_NCC(descriptor1, descriptor2)", "mean1 = np.mean(descriptor1['neighbour'])\nmean2 = np.mean(descriptor2['neighbour'])\nncc_num = 0\nncc_den1 = 0\nncc_den2 = 0\nfor i in range(self.window_size):\n for j in ...
<|body_start_0|> self.window_size = window_size self.threshold = threshold self.threshold_r = threshold_r self.perform_NCC(descriptor1, descriptor2) <|end_body_0|> <|body_start_1|> mean1 = np.mean(descriptor1['neighbour']) mean2 = np.mean(descriptor2['neighbour']) ...
NCC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NCC: def __init__(self, descriptor1, descriptor2, window_size, threshold, threshold_r): """Initialize the required resources to compute NCC value @param descriptor1 The first descriptor list @param descriptor2 The second descriptor list @param window_size The NCC window size @param thres...
stack_v2_sparse_classes_75kplus_train_073432
2,961
no_license
[ { "docstring": "Initialize the required resources to compute NCC value @param descriptor1 The first descriptor list @param descriptor2 The second descriptor list @param window_size The NCC window size @param threshold The threshold of NCC @param threshold_r The threshold ratio of NCC", "name": "__init__", ...
3
null
Implement the Python class `NCC` described below. Class description: Implement the NCC class. Method signatures and docstrings: - def __init__(self, descriptor1, descriptor2, window_size, threshold, threshold_r): Initialize the required resources to compute NCC value @param descriptor1 The first descriptor list @para...
Implement the Python class `NCC` described below. Class description: Implement the NCC class. Method signatures and docstrings: - def __init__(self, descriptor1, descriptor2, window_size, threshold, threshold_r): Initialize the required resources to compute NCC value @param descriptor1 The first descriptor list @para...
d1b048908affb30cba7b976404b601b35fec2cbe
<|skeleton|> class NCC: def __init__(self, descriptor1, descriptor2, window_size, threshold, threshold_r): """Initialize the required resources to compute NCC value @param descriptor1 The first descriptor list @param descriptor2 The second descriptor list @param window_size The NCC window size @param thres...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NCC: def __init__(self, descriptor1, descriptor2, window_size, threshold, threshold_r): """Initialize the required resources to compute NCC value @param descriptor1 The first descriptor list @param descriptor2 The second descriptor list @param window_size The NCC window size @param threshold The thres...
the_stack_v2_python_sparse
Hw4/import/NCC.py
GeforceTesla/ECE661_Computer_Vision_Combined
train
1
2958cf5f388871323e7e7193985c67c505a6fddc
[ "actions = super().get_actions(request)\nif not request.user.is_superuser:\n if 'delete_selected' in actions:\n del actions['delete_selected']\nreturn actions", "if not hasattr(obj, 'created_by'):\n obj.created_by = request.user\nobj.updated_by = request.user\nobj.save()" ]
<|body_start_0|> actions = super().get_actions(request) if not request.user.is_superuser: if 'delete_selected' in actions: del actions['delete_selected'] return actions <|end_body_0|> <|body_start_1|> if not hasattr(obj, 'created_by'): obj.created...
Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired
BaseAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAdmin: """Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired""" def get_actions(self, request): """override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the...
stack_v2_sparse_classes_75kplus_train_073433
3,701
no_license
[ { "docstring": "override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the privilege of deleting objects from `Django Admin Summary pages`", "name": "get_actions", "signature": "def get_actions(self, request)" }, { "docstring": "override :meth:`djang...
2
stack_v2_sparse_classes_30k_train_028668
Implement the Python class `BaseAdmin` described below. Class description: Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired Method signatures and docstrings: - def get_actions(self, request): override :meth:`django.contrib.admin.ModelAdmin...
Implement the Python class `BaseAdmin` described below. Class description: Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired Method signatures and docstrings: - def get_actions(self, request): override :meth:`django.contrib.admin.ModelAdmin...
d96200e06cd350bdacdd6bdc59b14a6901051a59
<|skeleton|> class BaseAdmin: """Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired""" def get_actions(self, request): """override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseAdmin: """Use this class as the base class for other admin classes inheriting from :class:`django.contrib.admin.ModelAdmin` if so desired""" def get_actions(self, request): """override :meth:`django.contrib.admin.ModelAdmin.get_actions` The purpose is to only allow superusers the privilege of...
the_stack_v2_python_sparse
p_soc_auto_base/admin.py
serbant/PHSA-SOC
train
0
932426d5171e9a73b11cc8bf8c6be6fa98a0fd07
[ "node = Node(item)\nif self.is_empty():\n print(self.head)\n self.head = node\nelse:\n cur = self.head\n while cur.next != None:\n cur = cur.next\n cur.next = node\n node.prev = cur", "node = Node(item)\nnode.next = self.head\nself.head = node\nnode.next.prev = node", "if pos < 0:\n ...
<|body_start_0|> node = Node(item) if self.is_empty(): print(self.head) self.head = node else: cur = self.head while cur.next != None: cur = cur.next cur.next = node node.prev = cur <|end_body_0|> <|body_sta...
双链表
DoubleLinkList
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoubleLinkList: """双链表""" def append(self, item): """尾部添加元素""" <|body_0|> def add(self, item): """链表头部添加""" <|body_1|> def insert(self, pos, item): """在链表的指定位置添加,这里以0为开始""" <|body_2|> def remove(self, item): """从链表中删除元素""...
stack_v2_sparse_classes_75kplus_train_073434
2,652
permissive
[ { "docstring": "尾部添加元素", "name": "append", "signature": "def append(self, item)" }, { "docstring": "链表头部添加", "name": "add", "signature": "def add(self, item)" }, { "docstring": "在链表的指定位置添加,这里以0为开始", "name": "insert", "signature": "def insert(self, pos, item)" }, { ...
4
stack_v2_sparse_classes_30k_train_001198
Implement the Python class `DoubleLinkList` described below. Class description: 双链表 Method signatures and docstrings: - def append(self, item): 尾部添加元素 - def add(self, item): 链表头部添加 - def insert(self, pos, item): 在链表的指定位置添加,这里以0为开始 - def remove(self, item): 从链表中删除元素
Implement the Python class `DoubleLinkList` described below. Class description: 双链表 Method signatures and docstrings: - def append(self, item): 尾部添加元素 - def add(self, item): 链表头部添加 - def insert(self, pos, item): 在链表的指定位置添加,这里以0为开始 - def remove(self, item): 从链表中删除元素 <|skeleton|> class DoubleLinkList: """双链表""" ...
912dc05a3bd0ded9544166a68da23ca0a97b84da
<|skeleton|> class DoubleLinkList: """双链表""" def append(self, item): """尾部添加元素""" <|body_0|> def add(self, item): """链表头部添加""" <|body_1|> def insert(self, pos, item): """在链表的指定位置添加,这里以0为开始""" <|body_2|> def remove(self, item): """从链表中删除元素""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DoubleLinkList: """双链表""" def append(self, item): """尾部添加元素""" node = Node(item) if self.is_empty(): print(self.head) self.head = node else: cur = self.head while cur.next != None: cur = cur.next c...
the_stack_v2_python_sparse
jiaocheng/08-数据结构与算法/08-双向链表.py
kellanfan/python
train
3
987a6b662bd774b37e9c8d2efaf8ae60bdfd1296
[ "if clss.__domain_extractor_nlp is not None:\n return clss.__domain_extractor_nlp\nnlp = spacy.load('en_core_web_sm')\nid_re = re.compile('id|ID|Id')\nprefix_re = spacy.util.compile_prefix_regex(nlp.Defaults.prefixes)\ninfix_re = spacy.util.compile_infix_regex(nlp.Defaults.infixes)\nsuffix_re = spacy.util.compil...
<|body_start_0|> if clss.__domain_extractor_nlp is not None: return clss.__domain_extractor_nlp nlp = spacy.load('en_core_web_sm') id_re = re.compile('id|ID|Id') prefix_re = spacy.util.compile_prefix_regex(nlp.Defaults.prefixes) infix_re = spacy.util.compile_infix_reg...
提供基于spacy的NLP处理包装 这里主要用到的是create_spacy_nlp_for_domain_extractor方法,创建一个可以处理api文档描述文本,抽取其中属于专有名词性质的domain term的pipeline
SpacyNLPFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpacyNLPFactory: """提供基于spacy的NLP处理包装 这里主要用到的是create_spacy_nlp_for_domain_extractor方法,创建一个可以处理api文档描述文本,抽取其中属于专有名词性质的domain term的pipeline""" def create_spacy_nlp_for_domain_extractor(clss): """load a spacy nlp pipeline for extract domain entity and relations :return:""" <|bod...
stack_v2_sparse_classes_75kplus_train_073435
3,348
permissive
[ { "docstring": "load a spacy nlp pipeline for extract domain entity and relations :return:", "name": "create_spacy_nlp_for_domain_extractor", "signature": "def create_spacy_nlp_for_domain_extractor(clss)" }, { "docstring": "load a spacy nlp pipeline for extract domain entity and relations :retur...
3
stack_v2_sparse_classes_30k_train_019795
Implement the Python class `SpacyNLPFactory` described below. Class description: 提供基于spacy的NLP处理包装 这里主要用到的是create_spacy_nlp_for_domain_extractor方法,创建一个可以处理api文档描述文本,抽取其中属于专有名词性质的domain term的pipeline Method signatures and docstrings: - def create_spacy_nlp_for_domain_extractor(clss): load a spacy nlp pipeline for extr...
Implement the Python class `SpacyNLPFactory` described below. Class description: 提供基于spacy的NLP处理包装 这里主要用到的是create_spacy_nlp_for_domain_extractor方法,创建一个可以处理api文档描述文本,抽取其中属于专有名词性质的domain term的pipeline Method signatures and docstrings: - def create_spacy_nlp_for_domain_extractor(clss): load a spacy nlp pipeline for extr...
74bbcfa62c7e293b2b02f23249ac408aa22b44af
<|skeleton|> class SpacyNLPFactory: """提供基于spacy的NLP处理包装 这里主要用到的是create_spacy_nlp_for_domain_extractor方法,创建一个可以处理api文档描述文本,抽取其中属于专有名词性质的domain term的pipeline""" def create_spacy_nlp_for_domain_extractor(clss): """load a spacy nlp pipeline for extract domain entity and relations :return:""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpacyNLPFactory: """提供基于spacy的NLP处理包装 这里主要用到的是create_spacy_nlp_for_domain_extractor方法,创建一个可以处理api文档描述文本,抽取其中属于专有名词性质的domain term的pipeline""" def create_spacy_nlp_for_domain_extractor(clss): """load a spacy nlp pipeline for extract domain entity and relations :return:""" if clss.__domain_e...
the_stack_v2_python_sparse
src/util/apidoc_semantic/spacy_factory.py
SmartServiceGroup/SOworkspace
train
0
e604de2ee2fcf48a388b44ea7bf154e91e27e16d
[ "try:\n from config_parser import config_parser\n self.conf_file = current_file_path + '/../../conf/appviewx.conf'\n self.conf_data = config_parser(self.conf_file)\n self.hostname = socket.gethostbyname(socket.gethostname())\n self.ip = ip\nexcept Exception as e:\n print(colored(e, 'red'))\n lg...
<|body_start_0|> try: from config_parser import config_parser self.conf_file = current_file_path + '/../../conf/appviewx.conf' self.conf_data = config_parser(self.conf_file) self.hostname = socket.gethostbyname(socket.gethostname()) self.ip = ip ...
.
InitializeMongoDB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitializeMongoDB: """.""" def __init__(self, ip=False): """.""" <|body_0|> def initialize(self): """.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: from config_parser import config_parser self.conf_file = current_...
stack_v2_sparse_classes_75kplus_train_073436
2,724
no_license
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self, ip=False)" }, { "docstring": ".", "name": "initialize", "signature": "def initialize(self)" } ]
2
stack_v2_sparse_classes_30k_train_008908
Implement the Python class `InitializeMongoDB` described below. Class description: . Method signatures and docstrings: - def __init__(self, ip=False): . - def initialize(self): .
Implement the Python class `InitializeMongoDB` described below. Class description: . Method signatures and docstrings: - def __init__(self, ip=False): . - def initialize(self): . <|skeleton|> class InitializeMongoDB: """.""" def __init__(self, ip=False): """.""" <|body_0|> def initializ...
e513224364dce05ea4d17ac25ecfa981238b1311
<|skeleton|> class InitializeMongoDB: """.""" def __init__(self, ip=False): """.""" <|body_0|> def initialize(self): """.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InitializeMongoDB: """.""" def __init__(self, ip=False): """.""" try: from config_parser import config_parser self.conf_file = current_file_path + '/../../conf/appviewx.conf' self.conf_data = config_parser(self.conf_file) self.hostname = soc...
the_stack_v2_python_sparse
scripts_avx/scripts/scripts/Mongodb/initialize_mongodb.py
Poonammahunta/Integration
train
0
c9f14608294f5c509f2a1a1bae790550b007c609
[ "candidates = (('https://example.com/with/a/path', 'https://example.com'), ('http://example.com/path?and=querystring#andfragment', 'http://example.com'), ('http://example.com:12345', 'http://example.com:12345'), ('http://a.b.c.example.com', 'http://a.b.c.example.com'), ('site1.example.com', 'http://site1.example.co...
<|body_start_0|> candidates = (('https://example.com/with/a/path', 'https://example.com'), ('http://example.com/path?and=querystring#andfragment', 'http://example.com'), ('http://example.com:12345', 'http://example.com:12345'), ('http://a.b.c.example.com', 'http://a.b.c.example.com'), ('site1.example.com', 'htt...
Tests for the Url resource.
TestUrlResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUrlResource: """Tests for the Url resource.""" def test_base_address(self) -> None: """The address can be reduced to a root URL.""" <|body_0|> def test_path_case_preservation(self) -> None: """Paths are allowed to be case-sensitive.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_073437
1,476
no_license
[ { "docstring": "The address can be reduced to a root URL.", "name": "test_base_address", "signature": "def test_base_address(self) -> None" }, { "docstring": "Paths are allowed to be case-sensitive.", "name": "test_path_case_preservation", "signature": "def test_path_case_preservation(se...
3
stack_v2_sparse_classes_30k_train_030334
Implement the Python class `TestUrlResource` described below. Class description: Tests for the Url resource. Method signatures and docstrings: - def test_base_address(self) -> None: The address can be reduced to a root URL. - def test_path_case_preservation(self) -> None: Paths are allowed to be case-sensitive. - def...
Implement the Python class `TestUrlResource` described below. Class description: Tests for the Url resource. Method signatures and docstrings: - def test_base_address(self) -> None: The address can be reduced to a root URL. - def test_path_case_preservation(self) -> None: Paths are allowed to be case-sensitive. - def...
7129415303b94d5d10b2c29ec432f0c7d41cc651
<|skeleton|> class TestUrlResource: """Tests for the Url resource.""" def test_base_address(self) -> None: """The address can be reduced to a root URL.""" <|body_0|> def test_path_case_preservation(self) -> None: """Paths are allowed to be case-sensitive.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestUrlResource: """Tests for the Url resource.""" def test_base_address(self) -> None: """The address can be reduced to a root URL.""" candidates = (('https://example.com/with/a/path', 'https://example.com'), ('http://example.com/path?and=querystring#andfragment', 'http://example.com'), ...
the_stack_v2_python_sparse
resources/url_test.py
lovett/medley
train
6
c55ad944c159909d9053e634b866d1d153444989
[ "if len(request.files) == 0:\n print('No files found in request')\n print(request)\n return ERROR_400\ncreated_resources = []\nfor file in request.files:\n file = request.files[file]\n print(file)\n if file.filename == '':\n print('Empty filename error:')\n print(json.dumps(file))\n ...
<|body_start_0|> if len(request.files) == 0: print('No files found in request') print(request) return ERROR_400 created_resources = [] for file in request.files: file = request.files[file] print(file) if file.filename == '':...
FileCollectionManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileCollectionManager: def post(self, user_identifier): """Upload a new file.""" <|body_0|> def get(self, user_identifier): """List all files owned by the given user.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(request.files) == 0: ...
stack_v2_sparse_classes_75kplus_train_073438
2,736
no_license
[ { "docstring": "Upload a new file.", "name": "post", "signature": "def post(self, user_identifier)" }, { "docstring": "List all files owned by the given user.", "name": "get", "signature": "def get(self, user_identifier)" } ]
2
stack_v2_sparse_classes_30k_train_018021
Implement the Python class `FileCollectionManager` described below. Class description: Implement the FileCollectionManager class. Method signatures and docstrings: - def post(self, user_identifier): Upload a new file. - def get(self, user_identifier): List all files owned by the given user.
Implement the Python class `FileCollectionManager` described below. Class description: Implement the FileCollectionManager class. Method signatures and docstrings: - def post(self, user_identifier): Upload a new file. - def get(self, user_identifier): List all files owned by the given user. <|skeleton|> class FileCo...
f66885351dcbc700d6b6be3a0777643c3420befe
<|skeleton|> class FileCollectionManager: def post(self, user_identifier): """Upload a new file.""" <|body_0|> def get(self, user_identifier): """List all files owned by the given user.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileCollectionManager: def post(self, user_identifier): """Upload a new file.""" if len(request.files) == 0: print('No files found in request') print(request) return ERROR_400 created_resources = [] for file in request.files: file...
the_stack_v2_python_sparse
src/rickbox/resources/file_collection_manager.py
CodingGrounds/INFO-3103-Final-Project
train
0
bca6dbcd0dafc1ef9786d14067fd5e5e74b5ddb9
[ "super(AdamOptimizer, self).__init__(False, name)\nself.learning_rate = learning_rate\nself.learning_rate_scale = learning_rate_scale\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.param_name_to_overridden_parameters = {} if param_name_to_overri...
<|body_start_0|> super(AdamOptimizer, self).__init__(False, name) self.learning_rate = learning_rate self.learning_rate_scale = learning_rate_scale self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon ...
A basic Adam optimizer that includes "correct" L2 weight decay. Rowan: I modified this from BERT by incorporating the bias correction
AdamOptimizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay. Rowan: I modified this from BERT by incorporating the bias correction""" def __init__(self, learning_rate, learning_rate_scale=1.0, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, param_name_to_...
stack_v2_sparse_classes_75kplus_train_073439
25,278
permissive
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, learning_rate_scale=1.0, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, param_name_to_overridden_parameters=None, name='AdamOptimizer', make_things_dependent_on_g...
3
stack_v2_sparse_classes_30k_train_054053
Implement the Python class `AdamOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Rowan: I modified this from BERT by incorporating the bias correction Method signatures and docstrings: - def __init__(self, learning_rate, learning_rate_scale=1.0, weight_dec...
Implement the Python class `AdamOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Rowan: I modified this from BERT by incorporating the bias correction Method signatures and docstrings: - def __init__(self, learning_rate, learning_rate_scale=1.0, weight_dec...
41fb35a3606415deabb47541e59d9d286c398350
<|skeleton|> class AdamOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay. Rowan: I modified this from BERT by incorporating the bias correction""" def __init__(self, learning_rate, learning_rate_scale=1.0, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, param_name_to_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdamOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay. Rowan: I modified this from BERT by incorporating the bias correction""" def __init__(self, learning_rate, learning_rate_scale=1.0, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, param_name_to_overridden_pa...
the_stack_v2_python_sparse
model/optimization.py
zeta1999/piglet
train
0
bfdb3d02836659d92e1dd30c1796092d9441c74b
[ "self.unity_env = unity_env\nself.unity_env.reset()\nengine_configuration_channel = EngineConfigurationChannel()\nengine_configuration_channel.set_configuration_parameters(time_scale=time_scale, width=width, height=height, target_frame_rate=target_frame_rate, quality_level=quality_level)\nself.unity_env.side_channe...
<|body_start_0|> self.unity_env = unity_env self.unity_env.reset() engine_configuration_channel = EngineConfigurationChannel() engine_configuration_channel.set_configuration_parameters(time_scale=time_scale, width=width, height=height, target_frame_rate=target_frame_rate, quality_level=q...
Game Class Game is a wrapper that takes a UnityEnvironment and makes a set of NeuralNetworks play in this environment. The game stops when all agents are done and returns their scores. An Agent does not play again when he's done. A Game might contain multiple simulations to make multiple neural networks play at the sam...
Game
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Game: """Game Class Game is a wrapper that takes a UnityEnvironment and makes a set of NeuralNetworks play in this environment. The game stops when all agents are done and returns their scores. An Agent does not play again when he's done. A Game might contain multiple simulations to make multiple...
stack_v2_sparse_classes_75kplus_train_073440
3,309
permissive
[ { "docstring": "Initializes the game :param unity_env: (UnityEnvironment) Environment where the game will be played :param time_scale:(float) Speed of the game :param width:(int) Window's width :param height:(int) Window's height :param target_frame_rate:(int) Frame rate :param quality_level:(int) Visual qualit...
2
stack_v2_sparse_classes_30k_train_000836
Implement the Python class `Game` described below. Class description: Game Class Game is a wrapper that takes a UnityEnvironment and makes a set of NeuralNetworks play in this environment. The game stops when all agents are done and returns their scores. An Agent does not play again when he's done. A Game might contai...
Implement the Python class `Game` described below. Class description: Game Class Game is a wrapper that takes a UnityEnvironment and makes a set of NeuralNetworks play in this environment. The game stops when all agents are done and returns their scores. An Agent does not play again when he's done. A Game might contai...
2083afb187b72e313c8423217bb3bef20a564d44
<|skeleton|> class Game: """Game Class Game is a wrapper that takes a UnityEnvironment and makes a set of NeuralNetworks play in this environment. The game stops when all agents are done and returns their scores. An Agent does not play again when he's done. A Game might contain multiple simulations to make multiple...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Game: """Game Class Game is a wrapper that takes a UnityEnvironment and makes a set of NeuralNetworks play in this environment. The game stops when all agents are done and returns their scores. An Agent does not play again when he's done. A Game might contain multiple simulations to make multiple neural netwo...
the_stack_v2_python_sparse
game.py
dsapandora/genetic-unity
train
0
3261b46d02181f0bcde4828646ae9c6516cec1dc
[ "self.databases = ['DECIPHER', 'OMIM', 'ORPHA']\nself.diseases = {}\nself._parse_diseases()\nLOG.info(f'Parsed {len(self.diseases)} disease/phenotypes from resource file')", "if not field:\n return None\nif field.upper() in FREQUENCY_TERMS:\n return FREQUENCY_TERMS[field]\nif field.endswith('%'):\n field...
<|body_start_0|> self.databases = ['DECIPHER', 'OMIM', 'ORPHA'] self.diseases = {} self._parse_diseases() LOG.info(f'Parsed {len(self.diseases)} disease/phenotypes from resource file') <|end_body_0|> <|body_start_1|> if not field: return None if field.upper()...
Create an object containing all diseases from the phenotype_annotations.tav.txt file Resources included in this file: DECIPHER, OMIM, ORPHANET
Diseases
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Diseases: """Create an object containing all diseases from the phenotype_annotations.tav.txt file Resources included in this file: DECIPHER, OMIM, ORPHANET""" def init_app(self): """Initialize the diseases object when the app is launched""" <|body_0|> def _parse_disease_...
stack_v2_sparse_classes_75kplus_train_073441
5,230
permissive
[ { "docstring": "Initialize the diseases object when the app is launched", "name": "init_app", "signature": "def init_app(self)" }, { "docstring": "Parse disease frequency (col 8 in phenotype anno file)", "name": "_parse_disease_frequency", "signature": "def _parse_disease_frequency(self,...
5
stack_v2_sparse_classes_30k_train_006358
Implement the Python class `Diseases` described below. Class description: Create an object containing all diseases from the phenotype_annotations.tav.txt file Resources included in this file: DECIPHER, OMIM, ORPHANET Method signatures and docstrings: - def init_app(self): Initialize the diseases object when the app i...
Implement the Python class `Diseases` described below. Class description: Create an object containing all diseases from the phenotype_annotations.tav.txt file Resources included in this file: DECIPHER, OMIM, ORPHANET Method signatures and docstrings: - def init_app(self): Initialize the diseases object when the app i...
e13c20ce69a627c0dc0cfadab39811dd33eb2320
<|skeleton|> class Diseases: """Create an object containing all diseases from the phenotype_annotations.tav.txt file Resources included in this file: DECIPHER, OMIM, ORPHANET""" def init_app(self): """Initialize the diseases object when the app is launched""" <|body_0|> def _parse_disease_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Diseases: """Create an object containing all diseases from the phenotype_annotations.tav.txt file Resources included in this file: DECIPHER, OMIM, ORPHANET""" def init_app(self): """Initialize the diseases object when the app is launched""" self.databases = ['DECIPHER', 'OMIM', 'ORPHA'] ...
the_stack_v2_python_sparse
patientMatcher/utils/disease.py
Clinical-Genomics/patientMatcher
train
21
098488790d31900f44208d9cd2279a4afd2423c9
[ "self.seg = WordSegmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags)\nself.wc_background = get_default_wc_background()\nif type(wc_background) is str:\n self.wc_background = wc_background\nself.font_path = get_default_font_path()\nif type(font_path) is str:\n self.font_path = fon...
<|body_start_0|> self.seg = WordSegmentation(stop_words_file=stop_words_file, allow_speech_tags=allow_speech_tags) self.wc_background = get_default_wc_background() if type(wc_background) is str: self.wc_background = wc_background self.font_path = get_default_font_path() ...
WordCloud
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordCloud: def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name=None, topK=10): """:param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags:...
stack_v2_sparse_classes_75kplus_train_073442
4,561
no_license
[ { "docstring": ":param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags: -- 词性列表 :param wc_background: 词云图背景图片 :param max_words: 最多显示词数,默认200 :param max_font_size: 字体最大值,默认100 :param save_path: 词云图保存地址,默认当前文件夹", "name": "__init__", "signature": "def __init__(self, stop_words_fil...
4
stack_v2_sparse_classes_30k_train_009742
Implement the Python class `WordCloud` described below. Class description: Implement the WordCloud class. Method signatures and docstrings: - def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name...
Implement the Python class `WordCloud` described below. Class description: Implement the WordCloud class. Method signatures and docstrings: - def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name...
a477c2926e97c86135623a2c7c844812be3be696
<|skeleton|> class WordCloud: def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name=None, topK=10): """:param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordCloud: def __init__(self, stop_words_file=None, allow_speech_tags=conf.allow_speech_tags, wc_background=None, font_path=None, max_words=200, max_font_size=100, save_path=None, wc_name=None, topK=10): """:param stop_words_file: -- str,停用词文件路径,若不是str则使用默认停用词文件 :param allow_speech_tags: -- 词性列表 :para...
the_stack_v2_python_sparse
WordCloud/word_cloud/word_cloud.py
FredZhao04/chinese-nlp
train
5
c11dcf1fd67c8b7a5d1af7a4b1801a7d46b112ad
[ "super().__init__(dist, sources, target, rv_mode=rv_mode)\nq_size = prod(self._shape) + 1\nbound = min([bound, q_size]) if bound is not None else q_size\nself._construct_auxvars([(self._rvs | self._crvs, bound)])\nentropies = [entropy(dist, source + target) for source in sources]\nmutual_informations = [mutual_info...
<|body_start_0|> super().__init__(dist, sources, target, rv_mode=rv_mode) q_size = prod(self._shape) + 1 bound = min([bound, q_size]) if bound is not None else q_size self._construct_auxvars([(self._rvs | self._crvs, bound)]) entropies = [entropy(dist, source + target) for source...
Optimizer for the Griffith & Ho redundancy.
GHOptimizer
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GHOptimizer: """Optimizer for the Griffith & Ho redundancy.""" def __init__(self, dist, sources, target, bound=None, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to compute i_gh of. sources : list, None A list of lists. Each i...
stack_v2_sparse_classes_75kplus_train_073443
5,217
permissive
[ { "docstring": "Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to compute i_gh of. sources : list, None A list of lists. Each inner list specifies the indexes of the random variables used to calculate the intrinsic mutual information. If None, then it is calculated over all...
3
stack_v2_sparse_classes_30k_train_004433
Implement the Python class `GHOptimizer` described below. Class description: Optimizer for the Griffith & Ho redundancy. Method signatures and docstrings: - def __init__(self, dist, sources, target, bound=None, rv_mode=None): Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to comp...
Implement the Python class `GHOptimizer` described below. Class description: Optimizer for the Griffith & Ho redundancy. Method signatures and docstrings: - def __init__(self, dist, sources, target, bound=None, rv_mode=None): Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to comp...
b13c5020a2b8524527a4a0db5a81d8549142228c
<|skeleton|> class GHOptimizer: """Optimizer for the Griffith & Ho redundancy.""" def __init__(self, dist, sources, target, bound=None, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to compute i_gh of. sources : list, None A list of lists. Each i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GHOptimizer: """Optimizer for the Griffith & Ho redundancy.""" def __init__(self, dist, sources, target, bound=None, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to compute i_gh of. sources : list, None A list of lists. Each inner list spe...
the_stack_v2_python_sparse
dit/pid/measures/igh.py
dit/dit
train
468
528a6fc9225110d6602e0ce04cf95e1ddcf68104
[ "num_inputs = '{} Inputs:\\n'.format(self.size)\ninputs = '\\n'.join(['\"{}\": {:~P}'.format(key, value.value) for key, value in self.data.items()])\nreturn num_inputs + inputs", "if self.size == 0:\n return ''\nhead = 'DERIVATIVES {}\\n'.format(self.size)\n_ins = []\nderivative: TypeVariable\nfor derivative i...
<|body_start_0|> num_inputs = '{} Inputs:\n'.format(self.size) inputs = '\n'.join(['"{}": {:~P}'.format(key, value.value) for key, value in self.data.items()]) return num_inputs + inputs <|end_body_0|> <|body_start_1|> if self.size == 0: return '' head = 'DERIVATIVES...
Subclass of :class:`VariableCollection` specific to Derivatives.
DerivativesCollection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DerivativesCollection: """Subclass of :class:`VariableCollection` specific to Derivatives.""" def __repr__(self): """Return repr(self).""" <|body_0|> def _to_deck(self): """Return deck representation of self.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_75kplus_train_073444
1,067
permissive
[ { "docstring": "Return repr(self).", "name": "__repr__", "signature": "def __repr__(self)" }, { "docstring": "Return deck representation of self.", "name": "_to_deck", "signature": "def _to_deck(self)" } ]
2
null
Implement the Python class `DerivativesCollection` described below. Class description: Subclass of :class:`VariableCollection` specific to Derivatives. Method signatures and docstrings: - def __repr__(self): Return repr(self). - def _to_deck(self): Return deck representation of self.
Implement the Python class `DerivativesCollection` described below. Class description: Subclass of :class:`VariableCollection` specific to Derivatives. Method signatures and docstrings: - def __repr__(self): Return repr(self). - def _to_deck(self): Return deck representation of self. <|skeleton|> class DerivativesCo...
f2deb5eb340a2814722eead5f8b6278a945c730d
<|skeleton|> class DerivativesCollection: """Subclass of :class:`VariableCollection` specific to Derivatives.""" def __repr__(self): """Return repr(self).""" <|body_0|> def _to_deck(self): """Return deck representation of self.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DerivativesCollection: """Subclass of :class:`VariableCollection` specific to Derivatives.""" def __repr__(self): """Return repr(self).""" num_inputs = '{} Inputs:\n'.format(self.size) inputs = '\n'.join(['"{}": {:~P}'.format(key, value.value) for key, value in self.data.items()])...
the_stack_v2_python_sparse
trnsystor/collections/derivatives.py
sturmianseq/trnsystor
train
0
88f75ed11a9d89b16a53f9560e12f5c143088dc8
[ "super(CandlestickData, self).__init__()\nself.o = kwargs.get('o')\nself.h = kwargs.get('h')\nself.l = kwargs.get('l')\nself.c = kwargs.get('c')", "data = data.copy()\nif data.get('o') is not None:\n data['o'] = ctx.convert_decimal_number(data.get('o'))\nif data.get('h') is not None:\n data['h'] = ctx.conve...
<|body_start_0|> super(CandlestickData, self).__init__() self.o = kwargs.get('o') self.h = kwargs.get('h') self.l = kwargs.get('l') self.c = kwargs.get('c') <|end_body_0|> <|body_start_1|> data = data.copy() if data.get('o') is not None: data['o'] = c...
The price data (open, high, low, close) for the Candlestick representation.
CandlestickData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CandlestickData: """The price data (open, high, low, close) for the Candlestick representation.""" def __init__(self, **kwargs): """Create a new CandlestickData instance""" <|body_0|> def from_dict(data, ctx): """Instantiate a new CandlestickData from a dict (gen...
stack_v2_sparse_classes_75kplus_train_073445
11,143
permissive
[ { "docstring": "Create a new CandlestickData instance", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Instantiate a new CandlestickData from a dict (generally from loading a JSON response). The data used to instantiate the CandlestickData is a shallow copy of...
2
stack_v2_sparse_classes_30k_train_007698
Implement the Python class `CandlestickData` described below. Class description: The price data (open, high, low, close) for the Candlestick representation. Method signatures and docstrings: - def __init__(self, **kwargs): Create a new CandlestickData instance - def from_dict(data, ctx): Instantiate a new Candlestick...
Implement the Python class `CandlestickData` described below. Class description: The price data (open, high, low, close) for the Candlestick representation. Method signatures and docstrings: - def __init__(self, **kwargs): Create a new CandlestickData instance - def from_dict(data, ctx): Instantiate a new Candlestick...
055f51e55c52d6dd5cfd38550a48892a0fb09b0d
<|skeleton|> class CandlestickData: """The price data (open, high, low, close) for the Candlestick representation.""" def __init__(self, **kwargs): """Create a new CandlestickData instance""" <|body_0|> def from_dict(data, ctx): """Instantiate a new CandlestickData from a dict (gen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CandlestickData: """The price data (open, high, low, close) for the Candlestick representation.""" def __init__(self, **kwargs): """Create a new CandlestickData instance""" super(CandlestickData, self).__init__() self.o = kwargs.get('o') self.h = kwargs.get('h') se...
the_stack_v2_python_sparse
forex/env-python2/lib/python2.7/site-packages/v20/instrument.py
phroiland/forex_algos
train
1
a4e96ee2fd58e1422659ef8ed5f3b4c87ed2b370
[ "all_tags = cls.objects.all()\nstyling = {t.pk: {'style': t.style, 'desc': t.description} for t in all_tags}\nreturn styling", "if isinstance(value, list):\n count = cls.objects.raw({'_id': {'$in': value}}).count()\n if count == len(value):\n return True\nreturn False" ]
<|body_start_0|> all_tags = cls.objects.all() styling = {t.pk: {'style': t.style, 'desc': t.description} for t in all_tags} return styling <|end_body_0|> <|body_start_1|> if isinstance(value, list): count = cls.objects.raw({'_id': {'$in': value}}).count() if coun...
Tag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tag: def get_display_data(cls): """Get a dict with the styling for each tag""" <|body_0|> def validate_field(cls, value): """Validate field for sample form submission.""" <|body_1|> <|end_skeleton|> <|body_start_0|> all_tags = cls.objects.all() ...
stack_v2_sparse_classes_75kplus_train_073446
1,421
no_license
[ { "docstring": "Get a dict with the styling for each tag", "name": "get_display_data", "signature": "def get_display_data(cls)" }, { "docstring": "Validate field for sample form submission.", "name": "validate_field", "signature": "def validate_field(cls, value)" } ]
2
null
Implement the Python class `Tag` described below. Class description: Implement the Tag class. Method signatures and docstrings: - def get_display_data(cls): Get a dict with the styling for each tag - def validate_field(cls, value): Validate field for sample form submission.
Implement the Python class `Tag` described below. Class description: Implement the Tag class. Method signatures and docstrings: - def get_display_data(cls): Get a dict with the styling for each tag - def validate_field(cls, value): Validate field for sample form submission. <|skeleton|> class Tag: def get_displ...
34fe159927eaa3884acf354c62b8213b0cd33368
<|skeleton|> class Tag: def get_display_data(cls): """Get a dict with the styling for each tag""" <|body_0|> def validate_field(cls, value): """Validate field for sample form submission.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Tag: def get_display_data(cls): """Get a dict with the styling for each tag""" all_tags = cls.objects.all() styling = {t.pk: {'style': t.style, 'desc': t.description} for t in all_tags} return styling def validate_field(cls, value): """Validate field for sample for...
the_stack_v2_python_sparse
app/minilims/models/tag.py
ssi-dk/miniLIMS
train
4
d33f5928e4414fbed5d4a09ae32baa2c6f413c19
[ "super().__init__()\nassert attention_size % n_heads == 0\nself.hidden_size = hidden_size\nself.n_heads = n_heads\nself.head_size = attention_size // n_heads\nself.attention_size = attention_size\nself.hidden_to_query = nn.Linear(hidden_size, attention_size)\nself.hidden_to_key = nn.Linear(hidden_size, attention_si...
<|body_start_0|> super().__init__() assert attention_size % n_heads == 0 self.hidden_size = hidden_size self.n_heads = n_heads self.head_size = attention_size // n_heads self.attention_size = attention_size self.hidden_to_query = nn.Linear(hidden_size, attention_s...
Multihead self-attention
MultiHeadAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttention: """Multihead self-attention""" def __init__(self, hidden_size: int, attention_size: int, n_heads: int, dropout: float, device: str): """Constructor Args: hidden_size (int): hidden size of the input. attention_size (int): attention size n_heads (int): number of hea...
stack_v2_sparse_classes_75kplus_train_073447
14,969
permissive
[ { "docstring": "Constructor Args: hidden_size (int): hidden size of the input. attention_size (int): attention size n_heads (int): number of heads (attention heads) dropout (double): dropout rate device (string): cuda or cpu", "name": "__init__", "signature": "def __init__(self, hidden_size: int, attent...
2
stack_v2_sparse_classes_30k_train_024123
Implement the Python class `MultiHeadAttention` described below. Class description: Multihead self-attention Method signatures and docstrings: - def __init__(self, hidden_size: int, attention_size: int, n_heads: int, dropout: float, device: str): Constructor Args: hidden_size (int): hidden size of the input. attentio...
Implement the Python class `MultiHeadAttention` described below. Class description: Multihead self-attention Method signatures and docstrings: - def __init__(self, hidden_size: int, attention_size: int, n_heads: int, dropout: float, device: str): Constructor Args: hidden_size (int): hidden size of the input. attentio...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class MultiHeadAttention: """Multihead self-attention""" def __init__(self, hidden_size: int, attention_size: int, n_heads: int, dropout: float, device: str): """Constructor Args: hidden_size (int): hidden size of the input. attention_size (int): attention size n_heads (int): number of hea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiHeadAttention: """Multihead self-attention""" def __init__(self, hidden_size: int, attention_size: int, n_heads: int, dropout: float, device: str): """Constructor Args: hidden_size (int): hidden size of the input. attention_size (int): attention size n_heads (int): number of heads (attention...
the_stack_v2_python_sparse
src/models/anomalia/layers.py
maurony/ts-vrae
train
1
e04f2bacd02be1e7f467af55b3799871e093afdb
[ "file1 = MockAffectedFile('some/dir/file1.html', ['<!DOCTYPE html>', '<html>', '<body>', '<p>Test</p>', '</body>', '</html>'])\nfile2 = MockAffectedFile('some/dir2/file2.html', ['<html>', '<body>', '<p>Test</p>', '</body>', '</html>'])\nfile3 = MockAffectedFile('file3.html', ['<!--Some comment-->', '<!docTYPE ht...
<|body_start_0|> file1 = MockAffectedFile('some/dir/file1.html', ['<!DOCTYPE html>', '<html>', '<body>', '<p>Test</p>', '</body>', '</html>']) file2 = MockAffectedFile('some/dir2/file2.html', ['<html>', '<body>', '<p>Test</p>', '</body>', '</html>']) file3 = MockAffectedFile('file3.html', ['<!--...
PresubmitTest
[ "BSD-3-Clause", "Apache-2.0", "LGPL-2.0-or-later", "MIT", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PresubmitTest: def testCheckForDoctypeHTML(self): """This verifies that we correctly identify missing DOCTYPE html tags.""" <|body_0|> def testCheckForDoctypeHTMLExceptions(self): """This test makes sure that we don't raise <!DOCTYPE html> errors for WPT importer."""...
stack_v2_sparse_classes_75kplus_train_073448
3,449
permissive
[ { "docstring": "This verifies that we correctly identify missing DOCTYPE html tags.", "name": "testCheckForDoctypeHTML", "signature": "def testCheckForDoctypeHTML(self)" }, { "docstring": "This test makes sure that we don't raise <!DOCTYPE html> errors for WPT importer.", "name": "testCheckF...
2
null
Implement the Python class `PresubmitTest` described below. Class description: Implement the PresubmitTest class. Method signatures and docstrings: - def testCheckForDoctypeHTML(self): This verifies that we correctly identify missing DOCTYPE html tags. - def testCheckForDoctypeHTMLExceptions(self): This test makes su...
Implement the Python class `PresubmitTest` described below. Class description: Implement the PresubmitTest class. Method signatures and docstrings: - def testCheckForDoctypeHTML(self): This verifies that we correctly identify missing DOCTYPE html tags. - def testCheckForDoctypeHTMLExceptions(self): This test makes su...
87244f4ee50062e59667bf8b9ca4d5291b6818d7
<|skeleton|> class PresubmitTest: def testCheckForDoctypeHTML(self): """This verifies that we correctly identify missing DOCTYPE html tags.""" <|body_0|> def testCheckForDoctypeHTMLExceptions(self): """This test makes sure that we don't raise <!DOCTYPE html> errors for WPT importer."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PresubmitTest: def testCheckForDoctypeHTML(self): """This verifies that we correctly identify missing DOCTYPE html tags.""" file1 = MockAffectedFile('some/dir/file1.html', ['<!DOCTYPE html>', '<html>', '<body>', '<p>Test</p>', '</body>', '</html>']) file2 = MockAffectedFile('some/dir2/...
the_stack_v2_python_sparse
chromium/third_party/blink/web_tests/PRESUBMIT_test.py
ric2b/Vivaldi-browser
train
166
884a3a594bfe5af3db29950f4b949eaf774cbc8a
[ "result = []\nfields = resource.fields\ntake_field = query.state.get('field')\nstate = cls._get_query_state(query, level=level)\nif state is True:\n take = {resource.id_name: True}\n group = None\nelse:\n take = state.get('take')\n group = state.get('group')\nif group:\n return [Record(name=name, typ...
<|body_start_0|> result = [] fields = resource.fields take_field = query.state.get('field') state = cls._get_query_state(query, level=level) if state is True: take = {resource.id_name: True} group = None else: take = state.get('take') ...
Selection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Selection: def _take_fields(cls, resource, action, level=None, query=None, request=None): """Get a subset of a resource's fields to be used for an action Arguments: resource: a Resource action: action string (ex: "get") level: level string (ex: "a.b") query: a Query request: a Django Req...
stack_v2_sparse_classes_75kplus_train_073449
24,219
permissive
[ { "docstring": "Get a subset of a resource's fields to be used for an action Arguments: resource: a Resource action: action string (ex: \"get\") level: level string (ex: \"a.b\") query: a Query request: a Django Request object", "name": "_take_fields", "signature": "def _take_fields(cls, resource, actio...
2
null
Implement the Python class `Selection` described below. Class description: Implement the Selection class. Method signatures and docstrings: - def _take_fields(cls, resource, action, level=None, query=None, request=None): Get a subset of a resource's fields to be used for an action Arguments: resource: a Resource acti...
Implement the Python class `Selection` described below. Class description: Implement the Selection class. Method signatures and docstrings: - def _take_fields(cls, resource, action, level=None, query=None, request=None): Get a subset of a resource's fields to be used for an action Arguments: resource: a Resource acti...
217a5298a7a4be85991f6cf229f30ddbfdcb1215
<|skeleton|> class Selection: def _take_fields(cls, resource, action, level=None, query=None, request=None): """Get a subset of a resource's fields to be used for an action Arguments: resource: a Resource action: action string (ex: "get") level: level string (ex: "a.b") query: a Query request: a Django Req...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Selection: def _take_fields(cls, resource, action, level=None, query=None, request=None): """Get a subset of a resource's fields to be used for an action Arguments: resource: a Resource action: action string (ex: "get") level: level string (ex: "a.b") query: a Query request: a Django Request object"""...
the_stack_v2_python_sparse
pyresource/executor.py
aleontiev/pyresource
train
1
6bc2ef7fd787ba4bea29300d401f5a7241ed65d8
[ "wx.Panel.__init__(self, parent)\nself.widget = wxVTKRenderWindowInteractor(self, -1)\nself.widget.Enable(1)\nself.widget.AddObserver()\nself.sizer = wx.BoxSizer(wx.VERTICAL)\nself.sizer.Add(self.widget, 1, wx.EXPAND)\nself.SetSizer(self.sizer)\nself.Layout()\nself.ren = vtk.vtkRenderer()\nself.filename = ''\nself....
<|body_start_0|> wx.Panel.__init__(self, parent) self.widget = wxVTKRenderWindowInteractor(self, -1) self.widget.Enable(1) self.widget.AddObserver() self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.widget, 1, wx.EXPAND) self.SetSizer(self.sizer) s...
Vtk Viewer
VtkViewer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VtkViewer: """Vtk Viewer""" def __init__(self, parent): """:param parent: :return:""" <|body_0|> def renderthis(self): """:return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> wx.Panel.__init__(self, parent) self.widget = wxVTKRenderW...
stack_v2_sparse_classes_75kplus_train_073450
2,472
no_license
[ { "docstring": ":param parent: :return:", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": ":return:", "name": "renderthis", "signature": "def renderthis(self)" } ]
2
stack_v2_sparse_classes_30k_train_018344
Implement the Python class `VtkViewer` described below. Class description: Vtk Viewer Method signatures and docstrings: - def __init__(self, parent): :param parent: :return: - def renderthis(self): :return:
Implement the Python class `VtkViewer` described below. Class description: Vtk Viewer Method signatures and docstrings: - def __init__(self, parent): :param parent: :return: - def renderthis(self): :return: <|skeleton|> class VtkViewer: """Vtk Viewer""" def __init__(self, parent): """:param parent: ...
e78511f30935b006385b571472487bb081aa36d8
<|skeleton|> class VtkViewer: """Vtk Viewer""" def __init__(self, parent): """:param parent: :return:""" <|body_0|> def renderthis(self): """:return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VtkViewer: """Vtk Viewer""" def __init__(self, parent): """:param parent: :return:""" wx.Panel.__init__(self, parent) self.widget = wxVTKRenderWindowInteractor(self, -1) self.widget.Enable(1) self.widget.AddObserver() self.sizer = wx.BoxSizer(wx.VERTICAL) ...
the_stack_v2_python_sparse
boaui/view/vtk.py
JoenyBui/boa-gui
train
0
a763c9d6e4f909126e046c04ee2baa79a24923ea
[ "if m < n:\n m, n = (n, m)\nmul = lambda x, y: reduce(operator.mul, range(x, y), 1)\nreturn mul(m, m + n - 1) / mul(1, n)", "if m < n:\n m, n = (n, m)\ndp = [0] * n\ndp[0] = 1\nfor x in range(m):\n for y in range(n - 1):\n dp[y + 1] += dp[y]\nreturn dp[n - 1]", "dp = [[0] * n for x in range(m)]\...
<|body_start_0|> if m < n: m, n = (n, m) mul = lambda x, y: reduce(operator.mul, range(x, y), 1) return mul(m, m + n - 1) / mul(1, n) <|end_body_0|> <|body_start_1|> if m < n: m, n = (n, m) dp = [0] * n dp[0] = 1 for x in range(m): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths_v1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> def uniquePaths_v0(self, m, n): """:type m: int :type n: int :rty...
stack_v2_sparse_classes_75kplus_train_073451
3,652
no_license
[ { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths", "signature": "def uniquePaths(self, m, n)" }, { "docstring": ":type m: int :type n: int :rtype: int", "name": "uniquePaths_v1", "signature": "def uniquePaths_v1(self, m, n)" }, { "docstring": ":type m:...
3
stack_v2_sparse_classes_30k_train_022185
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_v1(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_v0(self, m, n): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_v1(self, m, n): :type m: int :type n: int :rtype: int - def uniquePaths_v0(self, m, n): :type...
b5e09f24e8e96454dc99e20281e853fb9fcc85ed
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths_v1(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> def uniquePaths_v0(self, m, n): """:type m: int :type n: int :rty...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" if m < n: m, n = (n, m) mul = lambda x, y: reduce(operator.mul, range(x, y), 1) return mul(m, m + n - 1) / mul(1, n) def uniquePaths_v1(self, m, n): """:type m: int :type...
the_stack_v2_python_sparse
python/62_Unique_Paths.py
Moby5/myleetcode
train
2
6a5191e22116da27b0396f70bd54d80cfcdb8d5f
[ "try:\n type_key, identifier = key.split(':', maxsplit=1)\nexcept ValueError as e:\n msg = f\"'{key}' is not a valid source. There should be a single colon ':' sign somewhere. Original error: {e}\"\n raise UnknownSourceIdentifierException(msg) from e\nfor id_type in self.types:\n if id_type.key == type_...
<|body_start_0|> try: type_key, identifier = key.split(':', maxsplit=1) except ValueError as e: msg = f"'{key}' is not a valid source. There should be a single colon ':' sign somewhere. Original error: {e}" raise UnknownSourceIdentifierException(msg) from e fo...
Creates SourceIdentifier objects based on key input
SourceIdentifierFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceIdentifierFactory: """Creates SourceIdentifier objects based on key input""" def get_source_identifier_for_key(self, key: str) -> SourceIdentifier: """Cast given key input back to identifier object Parameters ---------- key: str Key to cast, like 'folder:/myfolder' Raises -----...
stack_v2_sparse_classes_75kplus_train_073452
20,389
permissive
[ { "docstring": "Cast given key input back to identifier object Parameters ---------- key: str Key to cast, like 'folder:/myfolder' Raises ------ UnknownSourceIdentifierException: When the key cannot be cast to any known identifier Returns ------- Instance of SourceIdentifier or subtype The type that the given k...
2
stack_v2_sparse_classes_30k_train_046160
Implement the Python class `SourceIdentifierFactory` described below. Class description: Creates SourceIdentifier objects based on key input Method signatures and docstrings: - def get_source_identifier_for_key(self, key: str) -> SourceIdentifier: Cast given key input back to identifier object Parameters ---------- k...
Implement the Python class `SourceIdentifierFactory` described below. Class description: Creates SourceIdentifier objects based on key input Method signatures and docstrings: - def get_source_identifier_for_key(self, key: str) -> SourceIdentifier: Cast given key input back to identifier object Parameters ---------- k...
d0d5437c9bbce60ee79165214ef87c69d47095c7
<|skeleton|> class SourceIdentifierFactory: """Creates SourceIdentifier objects based on key input""" def get_source_identifier_for_key(self, key: str) -> SourceIdentifier: """Cast given key input back to identifier object Parameters ---------- key: str Key to cast, like 'folder:/myfolder' Raises -----...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SourceIdentifierFactory: """Creates SourceIdentifier objects based on key input""" def get_source_identifier_for_key(self, key: str) -> SourceIdentifier: """Cast given key input back to identifier object Parameters ---------- key: str Key to cast, like 'folder:/myfolder' Raises ------ UnknownSour...
the_stack_v2_python_sparse
anonapi/parameters.py
sjoerdk/anonapi
train
0
462e99cf8b33bcb1239c1fd08f749f48d975500d
[ "for sdir in self.static_dirs:\n if self.path.startswith(sdir):\n SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)\n return\ni = self.path.rfind('?')\nif i >= 0:\n path, query = (self.path[:i], self.path[i + 1:])\nelse:\n path = self.path\n query = ''\nself.handle_query(path, query)"...
<|body_start_0|> for sdir in self.static_dirs: if self.path.startswith(sdir): SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) return i = self.path.rfind('?') if i >= 0: path, query = (self.path[:i], self.path[i + 1:]) else: ...
SimpleAppServer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleAppServer: def do_GET(self): """GETリクエストを処理する""" <|body_0|> def do_POST(self): """POSTリクエストを処理する""" <|body_1|> def handle_query(self, path, query): """クエリ付きのGET,POSTリクエストをハンドリングする""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_073453
2,403
permissive
[ { "docstring": "GETリクエストを処理する", "name": "do_GET", "signature": "def do_GET(self)" }, { "docstring": "POSTリクエストを処理する", "name": "do_POST", "signature": "def do_POST(self)" }, { "docstring": "クエリ付きのGET,POSTリクエストをハンドリングする", "name": "handle_query", "signature": "def handle_que...
3
stack_v2_sparse_classes_30k_train_022050
Implement the Python class `SimpleAppServer` described below. Class description: Implement the SimpleAppServer class. Method signatures and docstrings: - def do_GET(self): GETリクエストを処理する - def do_POST(self): POSTリクエストを処理する - def handle_query(self, path, query): クエリ付きのGET,POSTリクエストをハンドリングする
Implement the Python class `SimpleAppServer` described below. Class description: Implement the SimpleAppServer class. Method signatures and docstrings: - def do_GET(self): GETリクエストを処理する - def do_POST(self): POSTリクエストを処理する - def handle_query(self, path, query): クエリ付きのGET,POSTリクエストをハンドリングする <|skeleton|> class SimpleAp...
b96eaae97c82b82a388aee567e702a63072ae6ac
<|skeleton|> class SimpleAppServer: def do_GET(self): """GETリクエストを処理する""" <|body_0|> def do_POST(self): """POSTリクエストを処理する""" <|body_1|> def handle_query(self, path, query): """クエリ付きのGET,POSTリクエストをハンドリングする""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleAppServer: def do_GET(self): """GETリクエストを処理する""" for sdir in self.static_dirs: if self.path.startswith(sdir): SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) return i = self.path.rfind('?') if i >= 0: path, qu...
the_stack_v2_python_sparse
cgi-bin/simpleappserver.py
kyon-bll/min_py_web
train
0
c5908d688aabaf9bd6015ccad3ce505013901897
[ "if root is None:\n return 'S,'\nelse:\n left = self.serialize(root.left)\n right = self.serialize(root.right)\nreturn str(root.val) + ',' + str(left) + str(right)", "def deserializeHelper(queue):\n node = queue.popleft()\n if node == 'S':\n return None\n root = TreeNode(node)\n root.l...
<|body_start_0|> if root is None: return 'S,' else: left = self.serialize(root.left) right = self.serialize(root.right) return str(root.val) + ',' + str(left) + str(right) <|end_body_0|> <|body_start_1|> def deserializeHelper(queue): node ...
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_073454
1,474
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_test_002595
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:...
fea3d75e99433dc67a7b4e303e25ed0ad9343f5f
<|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""" if root is None: return 'S,' else: left = self.serialize(root.left) right = self.serialize(root.right) return str(root.val) + ',' + st...
the_stack_v2_python_sparse
puthon_files/serialize-and-deserialize-binary-tree.py
aashishravindran/interview_prep
train
0
68dca3034b3bcac8b1df73b794e4ec83db614e93
[ "user = super().save_user(request, sociallogin, form)\nuser.username = smart_str(base64.urlsafe_b64encode(hashlib.sha1(smart_bytes(user.email)).digest()).rstrip(b'='))\nuser.save()\nreturn user", "email = sociallogin.account.extra_data.get('email')\nif not email:\n return\ntry:\n user = User.objects.get(ema...
<|body_start_0|> user = super().save_user(request, sociallogin, form) user.username = smart_str(base64.urlsafe_b64encode(hashlib.sha1(smart_bytes(user.email)).digest()).rstrip(b'=')) user.save() return user <|end_body_0|> <|body_start_1|> email = sociallogin.account.extra_data.g...
PontoonSocialAdapter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PontoonSocialAdapter: def save_user(self, request, sociallogin, form=None): """Generates an unique username in the same way as it was done in django-browserid. This is required to avoid collisions and the backward compatibility.""" <|body_0|> def pre_social_login(self, reque...
stack_v2_sparse_classes_75kplus_train_073455
1,402
permissive
[ { "docstring": "Generates an unique username in the same way as it was done in django-browserid. This is required to avoid collisions and the backward compatibility.", "name": "save_user", "signature": "def save_user(self, request, sociallogin, form=None)" }, { "docstring": "Connect existing Pon...
2
null
Implement the Python class `PontoonSocialAdapter` described below. Class description: Implement the PontoonSocialAdapter class. Method signatures and docstrings: - def save_user(self, request, sociallogin, form=None): Generates an unique username in the same way as it was done in django-browserid. This is required to...
Implement the Python class `PontoonSocialAdapter` described below. Class description: Implement the PontoonSocialAdapter class. Method signatures and docstrings: - def save_user(self, request, sociallogin, form=None): Generates an unique username in the same way as it was done in django-browserid. This is required to...
0c4f74e15b1e442a9cee9b1cd636214b24f5352b
<|skeleton|> class PontoonSocialAdapter: def save_user(self, request, sociallogin, form=None): """Generates an unique username in the same way as it was done in django-browserid. This is required to avoid collisions and the backward compatibility.""" <|body_0|> def pre_social_login(self, reque...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PontoonSocialAdapter: def save_user(self, request, sociallogin, form=None): """Generates an unique username in the same way as it was done in django-browserid. This is required to avoid collisions and the backward compatibility.""" user = super().save_user(request, sociallogin, form) u...
the_stack_v2_python_sparse
pontoon/base/adapter.py
mozilla/pontoon
train
1,367
288c94d00404f22d6d2df134956367cb603c4fea
[ "self._ambig_finder = ambig_finder\nself._num_ambiguous = num_ambiguous\nself._alphabet_letters = ambig_finder.all_unambiguous()", "new_org = organism.copy()\nwhile 1:\n seq_genome = new_org.genome.toseq()\n all_ambiguous = self._ambig_finder.find_ambiguous(seq_genome.tostring())\n if len(all_ambiguous) ...
<|body_start_0|> self._ambig_finder = ambig_finder self._num_ambiguous = num_ambiguous self._alphabet_letters = ambig_finder.all_unambiguous() <|end_body_0|> <|body_start_1|> new_org = organism.copy() while 1: seq_genome = new_org.genome.toseq() all_ambig...
Perform repair to reduce the number of Ambiguous genes in a genome. In cases where ambiguous genes are allowed in a genome (for example, where you have a wild card character like '*' that will match anything), these can come to dominate a genome since, really, the best fitness is someting like '*******'. This repair pr...
AmbiguousRepair
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmbiguousRepair: """Perform repair to reduce the number of Ambiguous genes in a genome. In cases where ambiguous genes are allowed in a genome (for example, where you have a wild card character like '*' that will match anything), these can come to dominate a genome since, really, the best fitness...
stack_v2_sparse_classes_75kplus_train_073456
2,341
permissive
[ { "docstring": "Initialize the repair class. Arguments: o ambig_finder - A class implementing the function find_ambiguous which will return a list of all ambiguous positions in a sequence. It also must have the function all_unambiguous, which will return all allowed unambiguous letters. o num_ambiguous - The mi...
2
null
Implement the Python class `AmbiguousRepair` described below. Class description: Perform repair to reduce the number of Ambiguous genes in a genome. In cases where ambiguous genes are allowed in a genome (for example, where you have a wild card character like '*' that will match anything), these can come to dominate a...
Implement the Python class `AmbiguousRepair` described below. Class description: Perform repair to reduce the number of Ambiguous genes in a genome. In cases where ambiguous genes are allowed in a genome (for example, where you have a wild card character like '*' that will match anything), these can come to dominate a...
1d9a8e84a8572809ee3260ede44290e14de3bdd1
<|skeleton|> class AmbiguousRepair: """Perform repair to reduce the number of Ambiguous genes in a genome. In cases where ambiguous genes are allowed in a genome (for example, where you have a wild card character like '*' that will match anything), these can come to dominate a genome since, really, the best fitness...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AmbiguousRepair: """Perform repair to reduce the number of Ambiguous genes in a genome. In cases where ambiguous genes are allowed in a genome (for example, where you have a wild card character like '*' that will match anything), these can come to dominate a genome since, really, the best fitness is someting ...
the_stack_v2_python_sparse
bin/last_wrapper/Bio/GA/Repair/Stabilizing.py
LyonsLab/coge
train
41
3b786df6b51e839673cd16770e2710942cc4da40
[ "n = str(n)[::-1]\nst = ''\nroman_lst = ['', 'I', 'V', 'X', 'L', 'C', 'D', 'M']\nindex = 0\nfor ch in n if len(n) < 4 else n[:3]:\n index += 2\n if int(ch):\n roman_dict = {0: '*', 1: f'{roman_lst[index - 1]}', 2: f'{roman_lst[index - 1] * 2}', 3: f'{roman_lst[index - 1] * 3}', 4: f'{roman_lst[index - ...
<|body_start_0|> n = str(n)[::-1] st = '' roman_lst = ['', 'I', 'V', 'X', 'L', 'C', 'D', 'M'] index = 0 for ch in n if len(n) < 4 else n[:3]: index += 2 if int(ch): roman_dict = {0: '*', 1: f'{roman_lst[index - 1]}', 2: f'{roman_lst[index -...
RomanNumerals
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RomanNumerals: def to_roman(n): """Функция переводит число в римское Принцип работы: Получаем число, его преобразуем в строку и переворачиваем, далее идем по строке и отталкиваясь от индекса в строке создаем соответсвенный словарь из римских цифр. Первая цифра в строке это единицы, потом...
stack_v2_sparse_classes_75kplus_train_073457
4,897
no_license
[ { "docstring": "Функция переводит число в римское Принцип работы: Получаем число, его преобразуем в строку и переворачиваем, далее идем по строке и отталкиваясь от индекса в строке создаем соответсвенный словарь из римских цифр. Первая цифра в строке это единицы, потом десятки, сотни и тысяча. Для каждого измер...
2
stack_v2_sparse_classes_30k_train_033728
Implement the Python class `RomanNumerals` described below. Class description: Implement the RomanNumerals class. Method signatures and docstrings: - def to_roman(n): Функция переводит число в римское Принцип работы: Получаем число, его преобразуем в строку и переворачиваем, далее идем по строке и отталкиваясь от инд...
Implement the Python class `RomanNumerals` described below. Class description: Implement the RomanNumerals class. Method signatures and docstrings: - def to_roman(n): Функция переводит число в римское Принцип работы: Получаем число, его преобразуем в строку и переворачиваем, далее идем по строке и отталкиваясь от инд...
8f676985ca7ee9dc592778f5958352f183ce8029
<|skeleton|> class RomanNumerals: def to_roman(n): """Функция переводит число в римское Принцип работы: Получаем число, его преобразуем в строку и переворачиваем, далее идем по строке и отталкиваясь от индекса в строке создаем соответсвенный словарь из римских цифр. Первая цифра в строке это единицы, потом...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RomanNumerals: def to_roman(n): """Функция переводит число в римское Принцип работы: Получаем число, его преобразуем в строку и переворачиваем, далее идем по строке и отталкиваясь от индекса в строке создаем соответсвенный словарь из римских цифр. Первая цифра в строке это единицы, потом десятки, сотн...
the_stack_v2_python_sparse
4/Roman Numerals Helper 4kyu.py
VIVERA83/Codewars
train
0
919cc4e5efa5b8fac7ea50e9b2e720279c093c3b
[ "home_dir = os.path.expanduser('~')\ncredential_dir = os.path.join(home_dir, '.credentials')\nif not os.path.exists(credential_dir):\n os.makedirs(credential_dir)\ncredential_path = os.path.join(credential_dir, GmailApiUsage.APPLICATION_NAME + '.json')\nstore = Storage(credential_path)\ncredentials = store.get()...
<|body_start_0|> home_dir = os.path.expanduser('~') credential_dir = os.path.join(home_dir, '.credentials') if not os.path.exists(credential_dir): os.makedirs(credential_dir) credential_path = os.path.join(credential_dir, GmailApiUsage.APPLICATION_NAME + '.json') stor...
GmailApiUsage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GmailApiUsage: def get_credentials(): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_073458
3,464
permissive
[ { "docstring": "Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential.", "name": "get_credentials", "signature": "def get_credentials()" }...
4
stack_v2_sparse_classes_30k_train_044245
Implement the Python class `GmailApiUsage` described below. Class description: Implement the GmailApiUsage class. Method signatures and docstrings: - def get_credentials(): Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to o...
Implement the Python class `GmailApiUsage` described below. Class description: Implement the GmailApiUsage class. Method signatures and docstrings: - def get_credentials(): Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to o...
f714ed8172aa290d3f13ff8b7f09f888a5b33640
<|skeleton|> class GmailApiUsage: def get_credentials(): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GmailApiUsage: def get_credentials(): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential.""" home_dir = os.path.expanduser('...
the_stack_v2_python_sparse
incubation-python/relative_scheduler/modules/gmailapiusage.py
yk0242/incubation
train
1
39bb95010a9bc20217a54ffe3de7f367839d3b19
[ "if not validate_contract_document(self.request, 'add'):\n return\ndocument = upload_file(self.request)\nself.context.documents.append(document)\nif save_auction(self.request):\n self.LOGGER.info('Created auction contract document {}'.format(document.id), extra=context_unpack(self.request, {'MESSAGE_ID': 'auc...
<|body_start_0|> if not validate_contract_document(self.request, 'add'): return document = upload_file(self.request) self.context.documents.append(document) if save_auction(self.request): self.LOGGER.info('Created auction contract document {}'.format(document.id),...
BaseAuctionAwardContractDocumentResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseAuctionAwardContractDocumentResource: def collection_post(self): """Auction Contract Prolongation Document Upload""" <|body_0|> def get(self): """Auction Contract Document Read""" <|body_1|> def collection_get(self): """Auction Contract Prolo...
stack_v2_sparse_classes_75kplus_train_073459
4,208
permissive
[ { "docstring": "Auction Contract Prolongation Document Upload", "name": "collection_post", "signature": "def collection_post(self)" }, { "docstring": "Auction Contract Document Read", "name": "get", "signature": "def get(self)" }, { "docstring": "Auction Contract Prolongation Doc...
4
null
Implement the Python class `BaseAuctionAwardContractDocumentResource` described below. Class description: Implement the BaseAuctionAwardContractDocumentResource class. Method signatures and docstrings: - def collection_post(self): Auction Contract Prolongation Document Upload - def get(self): Auction Contract Documen...
Implement the Python class `BaseAuctionAwardContractDocumentResource` described below. Class description: Implement the BaseAuctionAwardContractDocumentResource class. Method signatures and docstrings: - def collection_post(self): Auction Contract Prolongation Document Upload - def get(self): Auction Contract Documen...
b4ed171f990e2b27b2547160df7d5ac968a1c477
<|skeleton|> class BaseAuctionAwardContractDocumentResource: def collection_post(self): """Auction Contract Prolongation Document Upload""" <|body_0|> def get(self): """Auction Contract Document Read""" <|body_1|> def collection_get(self): """Auction Contract Prolo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseAuctionAwardContractDocumentResource: def collection_post(self): """Auction Contract Prolongation Document Upload""" if not validate_contract_document(self.request, 'add'): return document = upload_file(self.request) self.context.documents.append(document) ...
the_stack_v2_python_sparse
openprocurement/auctions/core/plugins/contracting/v3/views/prolongation_document.py
openprocurement/openprocurement.auctions.core
train
2
818c4333209496ccd5b47f9f8ccb3b6d6dbcdc0d
[ "super().__init__(logger)\nself.logger = logger\nself.filename = filename\nself.load_data()", "fh = FileHandler(self.logger, self.filename)\nfor entry in fh.get('entries'):\n self.add(key=entry.get('encoding'), value=entry.get('modality'))" ]
<|body_start_0|> super().__init__(logger) self.logger = logger self.filename = filename self.load_data() <|end_body_0|> <|body_start_1|> fh = FileHandler(self.logger, self.filename) for entry in fh.get('entries'): self.add(key=entry.get('encoding'), value=ent...
Encoding format to modality mappings class.
Encodings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encodings: """Encoding format to modality mappings class.""" def __init__(self, logger, filename): """Initialize the Encodings object. Parameters: logger (aida.Logger) filename (str)""" <|body_0|> def load_data(self): """Reads the file containing the mappings int...
stack_v2_sparse_classes_75kplus_train_073460
1,050
no_license
[ { "docstring": "Initialize the Encodings object. Parameters: logger (aida.Logger) filename (str)", "name": "__init__", "signature": "def __init__(self, logger, filename)" }, { "docstring": "Reads the file containing the mappings into Encodings.", "name": "load_data", "signature": "def lo...
2
null
Implement the Python class `Encodings` described below. Class description: Encoding format to modality mappings class. Method signatures and docstrings: - def __init__(self, logger, filename): Initialize the Encodings object. Parameters: logger (aida.Logger) filename (str) - def load_data(self): Reads the file contai...
Implement the Python class `Encodings` described below. Class description: Encoding format to modality mappings class. Method signatures and docstrings: - def __init__(self, logger, filename): Initialize the Encodings object. Parameters: logger (aida.Logger) filename (str) - def load_data(self): Reads the file contai...
a0b379ba0e78e8e5eceeda465f75bba5c288aea4
<|skeleton|> class Encodings: """Encoding format to modality mappings class.""" def __init__(self, logger, filename): """Initialize the Encodings object. Parameters: logger (aida.Logger) filename (str)""" <|body_0|> def load_data(self): """Reads the file containing the mappings int...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encodings: """Encoding format to modality mappings class.""" def __init__(self, logger, filename): """Initialize the Encodings object. Parameters: logger (aida.Logger) filename (str)""" super().__init__(logger) self.logger = logger self.filename = filename self.loa...
the_stack_v2_python_sparse
python/aida/encodings.py
shahraj81/aida
train
8
28f1c2035d5bd40880fc34bf9ced71900512d0f4
[ "filterInputValue = request.GET.get('filterInputValue', '')\nfilterDbType = request.GET.get('filterDbType[]', '')\nfilterDbType = json.loads(filterDbType) if len(filterDbType) > 2 else None\nobj = DataSourceConfig.objects.filter()\nif filterInputValue:\n obj = obj.filter(host__contains=filterInputValue)\nif filt...
<|body_start_0|> filterInputValue = request.GET.get('filterInputValue', '') filterDbType = request.GET.get('filterDbType[]', '') filterDbType = json.loads(filterDbType) if len(filterDbType) > 2 else None obj = DataSourceConfig.objects.filter() if filterInputValue: obj...
DataSourceConfigList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSourceConfigList: def get(self, request, *args, **kwargs): """数据源列表""" <|body_0|> def put(self, request, *args, **kwargs): """编辑数据源""" <|body_1|> def post(self, request, *args, **kwargs): """创建数据源""" <|body_2|> def delete(self, r...
stack_v2_sparse_classes_75kplus_train_073461
9,325
no_license
[ { "docstring": "数据源列表", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "编辑数据源", "name": "put", "signature": "def put(self, request, *args, **kwargs)" }, { "docstring": "创建数据源", "name": "post", "signature": "def post(self, request, ...
4
stack_v2_sparse_classes_30k_train_032208
Implement the Python class `DataSourceConfigList` described below. Class description: Implement the DataSourceConfigList class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 数据源列表 - def put(self, request, *args, **kwargs): 编辑数据源 - def post(self, request, *args, **kwargs): 创建数据源 - def de...
Implement the Python class `DataSourceConfigList` described below. Class description: Implement the DataSourceConfigList class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 数据源列表 - def put(self, request, *args, **kwargs): 编辑数据源 - def post(self, request, *args, **kwargs): 创建数据源 - def de...
f2523d6e51cde1b53ac6f453f8066b4b90c523b9
<|skeleton|> class DataSourceConfigList: def get(self, request, *args, **kwargs): """数据源列表""" <|body_0|> def put(self, request, *args, **kwargs): """编辑数据源""" <|body_1|> def post(self, request, *args, **kwargs): """创建数据源""" <|body_2|> def delete(self, r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataSourceConfigList: def get(self, request, *args, **kwargs): """数据源列表""" filterInputValue = request.GET.get('filterInputValue', '') filterDbType = request.GET.get('filterDbType[]', '') filterDbType = json.loads(filterDbType) if len(filterDbType) > 2 else None obj = Da...
the_stack_v2_python_sparse
api/db/rest/dataSourceConfig.py
zhuzhanhao1/backend
train
0
2f3a43ab7610f3425b5a914020cd5e9b7bb41dd5
[ "ContextLemmatizer.__init__(self, context_to_lemmatize, backoff)\nself.include = include\nself._context_to_tag = context_to_lemmatize if context_to_lemmatize else {}", "from cltk.tag.pos import POSTag\ntagger = POSTag('latin')\ntokens = ' '.join(tokens)\ntags = tagger.tag_ngram_123_backoff(tokens)\ntags = [tag[1]...
<|body_start_0|> ContextLemmatizer.__init__(self, context_to_lemmatize, backoff) self.include = include self._context_to_tag = context_to_lemmatize if context_to_lemmatize else {} <|end_body_0|> <|body_start_1|> from cltk.tag.pos import POSTag tagger = POSTag('latin') to...
Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept that lemma disambiguation can be made based on t...
ContextPOSLemmatizer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextPOSLemmatizer: """Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept ...
stack_v2_sparse_classes_75kplus_train_073462
23,254
permissive
[ { "docstring": "Setup ContextPOSLemmatizer(). :param context_to_lemmatize: List of tuples of the form (TOKEN, LEMMA); this should be 'gold standard' data that can be used to train on a given context, e.g. unigrams, bigrams, etc. :param include: List of tokens to include, all other tokens return None from choose...
4
stack_v2_sparse_classes_30k_train_049786
Implement the Python class `ContextPOSLemmatizer` described below. Class description: Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatize...
Implement the Python class `ContextPOSLemmatizer` described below. Class description: Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatize...
085420eaed7055fbcb311714eebb67861fd1b241
<|skeleton|> class ContextPOSLemmatizer: """Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContextPOSLemmatizer: """Lemmatizer that combines context with POS-tagging based on training data. Subclasses define context. The code for _train closely follows ContextTagger in https://github.com/nltk/nltk/blob/develop/nltk/tag/sequential.py This lemmatizer is included here as proof of concept that lemma di...
the_stack_v2_python_sparse
cltk/lemmatize/latin/backoff.py
jerryfrancis-97/cltk
train
1
8e2da36d495a27d8af5b87156ad02433e3de00c4
[ "nums = list(map(int, s))\nn = len(nums)\ndp = [[0] * (n + 1) for _ in range(k + 1)]\ndp[0][0] = 1\nfor c in range(1, k + 1):\n dpSum = [0] * (n + 1)\n for i in range(1, n + 1):\n dpSum[i] = dpSum[i - 1] + (dp[c - 1][i - 1] if IS_PRIME[nums[i - 1]] else 0)\n dpSum[i] %= MOD\n for i in range(1...
<|body_start_0|> nums = list(map(int, s)) n = len(nums) dp = [[0] * (n + 1) for _ in range(k + 1)] dp[0][0] = 1 for c in range(1, k + 1): dpSum = [0] * (n + 1) for i in range(1, n + 1): dpSum[i] = dpSum[i - 1] + (dp[c - 1][i - 1] if IS_PRIM...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: """dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组""" <|body_0|> def beautifulPartitions2(self, s: str, k: int, minLength: int) -> int: """维护二维前缀和数组""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_073463
3,061
no_license
[ { "docstring": "dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组", "name": "beautifulPartitions", "signature": "def beautifulPartitions(self, s: str, k: int, minLength: int) -> int" }, { "docstring": "维护二维前缀和数组", "name": "beautifulPartitions2", "signature": "def beautifulPartitions2(s...
2
stack_v2_sparse_classes_30k_train_030149
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组 - def beautifulPartitions2(self, s: str, k: int, minLeng...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组 - def beautifulPartitions2(self, s: str, k: int, minLeng...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: """dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组""" <|body_0|> def beautifulPartitions2(self, s: str, k: int, minLength: int) -> int: """维护二维前缀和数组""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def beautifulPartitions(self, s: str, k: int, minLength: int) -> int: """dp[count][index]表示前index个字符分成count个子串的方案数 维护一维前缀和数组""" nums = list(map(int, s)) n = len(nums) dp = [[0] * (n + 1) for _ in range(k + 1)] dp[0][0] = 1 for c in range(1, k + 1): ...
the_stack_v2_python_sparse
11_动态规划/dp优化/前缀和优化/6244. 完美分割的方案数-index+remain的前缀和优化.py
981377660LMT/algorithm-study
train
225
a9c58b23c11564becd9e282401af5923ff01a27b
[ "l = 0\nnode = head\nwhile node:\n node = node.next\n l += 1\n\ndef reverse(node):\n pre = None\n while node:\n pre, node.next, node = (node, pre, node.next)\n return pre\ni = l // 2\nnode = head\nwhile i > 0:\n node = node.next\n i -= 1\nnode = reverse(node)\nwhile node:\n if node.va...
<|body_start_0|> l = 0 node = head while node: node = node.next l += 1 def reverse(node): pre = None while node: pre, node.next, node = (node, pre, node.next) return pre i = l // 2 node = head ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head: Optional[ListNode]) -> bool: """2022-08-23 Runtime: 947 ms, faster than 78.82% Memory Usage: 39 MB, less than 76.71% The number of nodes in the list is in the range [1, 10^5]. 0 <= Node.val <= 9""" <|body_0|> def isPalindrome2(self, hea...
stack_v2_sparse_classes_75kplus_train_073464
3,203
permissive
[ { "docstring": "2022-08-23 Runtime: 947 ms, faster than 78.82% Memory Usage: 39 MB, less than 76.71% The number of nodes in the list is in the range [1, 10^5]. 0 <= Node.val <= 9", "name": "isPalindrome", "signature": "def isPalindrome(self, head: Optional[ListNode]) -> bool" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_043236
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: Optional[ListNode]) -> bool: 2022-08-23 Runtime: 947 ms, faster than 78.82% Memory Usage: 39 MB, less than 76.71% The number of nodes in the list is ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: Optional[ListNode]) -> bool: 2022-08-23 Runtime: 947 ms, faster than 78.82% Memory Usage: 39 MB, less than 76.71% The number of nodes in the list is ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def isPalindrome(self, head: Optional[ListNode]) -> bool: """2022-08-23 Runtime: 947 ms, faster than 78.82% Memory Usage: 39 MB, less than 76.71% The number of nodes in the list is in the range [1, 10^5]. 0 <= Node.val <= 9""" <|body_0|> def isPalindrome2(self, hea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPalindrome(self, head: Optional[ListNode]) -> bool: """2022-08-23 Runtime: 947 ms, faster than 78.82% Memory Usage: 39 MB, less than 76.71% The number of nodes in the list is in the range [1, 10^5]. 0 <= Node.val <= 9""" l = 0 node = head while node: ...
the_stack_v2_python_sparse
src/234-PalindromeLinkedList.py
Jiezhi/myleetcode
train
1
05668b57bdb7acb5d38f6d265e74ea38e2cb1b71
[ "try:\n plugin = module.Plugin\nexcept AttributeError:\n return False\ncommand = data[invocation_length:]\ntry:\n result = plugin.run(self, command)\nexcept TypeError:\n result = plugin().run(self, command)\nplugin_ran = True\nreturn (plugin_ran, result)", "if plugin_list:\n plugin_ran = False\n ...
<|body_start_0|> try: plugin = module.Plugin except AttributeError: return False command = data[invocation_length:] try: result = plugin.run(self, command) except TypeError: result = plugin().run(self, command) plugin_ran = ...
PluginRunner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginRunner: def run_plugin(self, module, data, invocation_length): """Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:""" <|body_0|> def process_plugins(self, plugin_list, data, help_mode_on=False): """...
stack_v2_sparse_classes_75kplus_train_073465
4,870
no_license
[ { "docstring": "Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:", "name": "run_plugin", "signature": "def run_plugin(self, module, data, invocation_length)" }, { "docstring": "Process plugins to see if the data should be intercepted...
2
stack_v2_sparse_classes_30k_train_025715
Implement the Python class `PluginRunner` described below. Class description: Implement the PluginRunner class. Method signatures and docstrings: - def run_plugin(self, module, data, invocation_length): Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return: - d...
Implement the Python class `PluginRunner` described below. Class description: Implement the PluginRunner class. Method signatures and docstrings: - def run_plugin(self, module, data, invocation_length): Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return: - d...
fb0aa92ea05dc05416a0a2cf3cc7a698b25f1d38
<|skeleton|> class PluginRunner: def run_plugin(self, module, data, invocation_length): """Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:""" <|body_0|> def process_plugins(self, plugin_list, data, help_mode_on=False): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PluginRunner: def run_plugin(self, module, data, invocation_length): """Run the plugin in the given module. :param self: :param module: :param data: :param invocation_length: :return:""" try: plugin = module.Plugin except AttributeError: return False com...
the_stack_v2_python_sparse
common.py
RattleyCooper/Oyster
train
2
4419dea815d26a4e279ad6cebfd09bcb6f76da3d
[ "super(Reinforce, self).__init__()\nself.num_actions = num_actions\nself.hidden_size = 100\nself.dense1 = tf.keras.layers.Dense(self.hidden_size, activation='relu')\nself.dense2 = tf.keras.layers.Dense(self.num_actions, activation='softmax')\nself.optimizer = tf.keras.optimizers.Adam(learning_rate=0.001)", "dense...
<|body_start_0|> super(Reinforce, self).__init__() self.num_actions = num_actions self.hidden_size = 100 self.dense1 = tf.keras.layers.Dense(self.hidden_size, activation='relu') self.dense2 = tf.keras.layers.Dense(self.num_actions, activation='softmax') self.optimizer = t...
Reinforce
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reinforce: def __init__(self, state_size, num_actions): """The Reinforce class that inherits from tf.keras.Model The forward pass calculates the policy for the agent given a batch of states. :param state_size: number of parameters that define the state. You don't necessarily have to use ...
stack_v2_sparse_classes_75kplus_train_073466
3,018
no_license
[ { "docstring": "The Reinforce class that inherits from tf.keras.Model The forward pass calculates the policy for the agent given a batch of states. :param state_size: number of parameters that define the state. You don't necessarily have to use this, but it can be used as the input size for your first dense lay...
3
stack_v2_sparse_classes_30k_train_019976
Implement the Python class `Reinforce` described below. Class description: Implement the Reinforce class. Method signatures and docstrings: - def __init__(self, state_size, num_actions): The Reinforce class that inherits from tf.keras.Model The forward pass calculates the policy for the agent given a batch of states....
Implement the Python class `Reinforce` described below. Class description: Implement the Reinforce class. Method signatures and docstrings: - def __init__(self, state_size, num_actions): The Reinforce class that inherits from tf.keras.Model The forward pass calculates the policy for the agent given a batch of states....
8f0ed6982ae6aba938cbf39af0e2a6259478db1c
<|skeleton|> class Reinforce: def __init__(self, state_size, num_actions): """The Reinforce class that inherits from tf.keras.Model The forward pass calculates the policy for the agent given a batch of states. :param state_size: number of parameters that define the state. You don't necessarily have to use ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Reinforce: def __init__(self, state_size, num_actions): """The Reinforce class that inherits from tf.keras.Model The forward pass calculates the policy for the agent given a batch of states. :param state_size: number of parameters that define the state. You don't necessarily have to use this, but it c...
the_stack_v2_python_sparse
hw6_REINFORCE/reinforce.py
YingSun0314/DeepLearningProjects
train
0
07d47f79f36d6e5240a735aa454c163d4648f02d
[ "AbstractCommModule.__init__(self, sim_env, MessageClass)\nself.physical_lay = StdPhysicalLayer(sim_env)\nself.datalink_lay = StdDatalinkLayer(sim_env)\nself.transp_lay = SegmentTransportLayer(sim_env, MessageClass)\nself.datalink_lay.physical_lay = self.physical_lay\nself.transp_lay.datalink_lay = self.datalink_la...
<|body_start_0|> AbstractCommModule.__init__(self, sim_env, MessageClass) self.physical_lay = StdPhysicalLayer(sim_env) self.datalink_lay = StdDatalinkLayer(sim_env) self.transp_lay = SegmentTransportLayer(sim_env, MessageClass) self.datalink_lay.physical_lay = self.physical_lay ...
This class implements a communication module, that simply forwards the messages to the next layer
SegmentCommModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentCommModule: """This class implements a communication module, that simply forwards the messages to the next layer""" def __init__(self, sim_env, MessageClass): """Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class th...
stack_v2_sparse_classes_75kplus_train_073467
3,492
permissive
[ { "docstring": "Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class that is used for sending and receiving Output: -", "name": "__init__", "signature": "def __init__(self, sim_env, MessageClass)" }, { "docstring": "sets the initial set...
4
stack_v2_sparse_classes_30k_train_038691
Implement the Python class `SegmentCommModule` described below. Class description: This class implements a communication module, that simply forwards the messages to the next layer Method signatures and docstrings: - def __init__(self, sim_env, MessageClass): Constructor Input: sim_env simpy.Environment environment o...
Implement the Python class `SegmentCommModule` described below. Class description: This class implements a communication module, that simply forwards the messages to the next layer Method signatures and docstrings: - def __init__(self, sim_env, MessageClass): Constructor Input: sim_env simpy.Environment environment o...
b2e395611e9b5111aeda7ab128f3486354bbbf0d
<|skeleton|> class SegmentCommModule: """This class implements a communication module, that simply forwards the messages to the next layer""" def __init__(self, sim_env, MessageClass): """Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SegmentCommModule: """This class implements a communication module, that simply forwards the messages to the next layer""" def __init__(self, sim_env, MessageClass): """Constructor Input: sim_env simpy.Environment environment of this component MessageClass AbstractBusMessage class that is used fo...
the_stack_v2_python_sparse
ECUSimulation/components/base/ecu/software/impl_comm_module_segment.py
PhilippMundhenk/IVNS
train
15
e9af86f6c1091cc9e7270711bba8db7bc0151066
[ "msg = '\\n\\nRunning SMA strategy | SMA1 = %d & SMA2 = %d' % (SMA1, SMA2)\nmsg += '\\nfixed costs %.2f | ' % self.ftc\nmsg += 'proportional costs %.4f' % self.ptc\nprint(msg)\nprint('=' * 55)\nself.position = 0\nself.amount = self._amount\nself.data['SMA1'] = self.data['price'].rolling(SMA1).mean()\nself.data['SMA...
<|body_start_0|> msg = '\n\nRunning SMA strategy | SMA1 = %d & SMA2 = %d' % (SMA1, SMA2) msg += '\nfixed costs %.2f | ' % self.ftc msg += 'proportional costs %.4f' % self.ptc print(msg) print('=' * 55) self.position = 0 self.amount = self._amount self.data...
BacktestLongOnly
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BacktestLongOnly: def run_sma_strategy(self, SMA1, SMA2): """Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)""" <|body_0|> def run_momentum_strategy(self, momentum): """Backtesting a mome...
stack_v2_sparse_classes_75kplus_train_073468
4,494
no_license
[ { "docstring": "Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)", "name": "run_sma_strategy", "signature": "def run_sma_strategy(self, SMA1, SMA2)" }, { "docstring": "Backtesting a momentum-based strategy. Parameters...
3
stack_v2_sparse_classes_30k_train_054732
Implement the Python class `BacktestLongOnly` described below. Class description: Implement the BacktestLongOnly class. Method signatures and docstrings: - def run_sma_strategy(self, SMA1, SMA2): Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in ...
Implement the Python class `BacktestLongOnly` described below. Class description: Implement the BacktestLongOnly class. Method signatures and docstrings: - def run_sma_strategy(self, SMA1, SMA2): Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in ...
bfc8baa153aec70caa8981b8e9215bb0be7f3163
<|skeleton|> class BacktestLongOnly: def run_sma_strategy(self, SMA1, SMA2): """Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)""" <|body_0|> def run_momentum_strategy(self, momentum): """Backtesting a mome...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BacktestLongOnly: def run_sma_strategy(self, SMA1, SMA2): """Backtesting a SMA-based strategy. Parameters ========== SMA1, SMA2: int shorter and longer term simple moving average (in days)""" msg = '\n\nRunning SMA strategy | SMA1 = %d & SMA2 = %d' % (SMA1, SMA2) msg += '\nfixed costs ...
the_stack_v2_python_sparse
code/pyquants/pyalgo/ch06/BacktestLongOnly.py
godknowspe/NoahsArk
train
1
10588a2066278dd569a97052c4e08cc9e91967af
[ "if head == None:\n return head\nif head.next == None:\n return head\nprev = head\ncurr = head.next\nprev.next = None\nwhile curr.next != None:\n next = curr.next\n curr.next = prev\n prev = curr\n curr = next\ncurr.next = prev\nreturn curr", "if head == None:\n return\nif head.next == None:\...
<|body_start_0|> if head == None: return head if head.next == None: return head prev = head curr = head.next prev.next = None while curr.next != None: next = curr.next curr.next = prev prev = curr cur...
Solution format for LeetCode
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Solution format for LeetCode""" def reverseList(self, head): """:type head: ListNode :rtype: ListNode :method calls: Time O(n) Space O(1)""" <|body_0|> def reverseList_recur(self, head): """:type head: ListNode :rtype: ListNode :method calls: reverse...
stack_v2_sparse_classes_75kplus_train_073469
5,212
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode :method calls: Time O(n) Space O(1)", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode :method calls: reverseList Recursion on self - editing the .next values Time O(n)...
4
null
Implement the Python class `Solution` described below. Class description: Solution format for LeetCode Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode :method calls: Time O(n) Space O(1) - def reverseList_recur(self, head): :type head: ListNode :rtype: ListNode :...
Implement the Python class `Solution` described below. Class description: Solution format for LeetCode Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode :method calls: Time O(n) Space O(1) - def reverseList_recur(self, head): :type head: ListNode :rtype: ListNode :...
d91f60431aa7767d1a854e0e27a26023fc8ec45c
<|skeleton|> class Solution: """Solution format for LeetCode""" def reverseList(self, head): """:type head: ListNode :rtype: ListNode :method calls: Time O(n) Space O(1)""" <|body_0|> def reverseList_recur(self, head): """:type head: ListNode :rtype: ListNode :method calls: reverse...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """Solution format for LeetCode""" def reverseList(self, head): """:type head: ListNode :rtype: ListNode :method calls: Time O(n) Space O(1)""" if head == None: return head if head.next == None: return head prev = head curr = head....
the_stack_v2_python_sparse
Algorithms_LinkedLists/Code/206_ReverseLinkedList/v1.py
AKHeit/LeetCode
train
0
b80897f57926e3eadcbd4652303aa9a7af84b1df
[ "RlAgentHierarchical.__init__(self, rlEnvironment, gpuId, hasHistory, nSamples)\nself.level = 5\nself.InitializeCaffe(caffeDirPostfix)", "action = [prevDesc.image, copy(imageCoord)]\nT = copy(prevDesc.T)\nT[0:3, 3] = baseCoord\ndesc = HandDescriptor(T)\nreturn (action, desc)", "idx1 = int(self.nSamples / 3)\nid...
<|body_start_0|> RlAgentHierarchical.__init__(self, rlEnvironment, gpuId, hasHistory, nSamples) self.level = 5 self.InitializeCaffe(caffeDirPostfix) <|end_body_0|> <|body_start_1|> action = [prevDesc.image, copy(imageCoord)] T = copy(prevDesc.T) T[0:3, 3] = baseCoord ...
RlAgentLevel5
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RlAgentLevel5: def __init__(self, rlEnvironment, gpuId, hasHistory, nSamples, caffeDirPostfix=''): """Initializes agent in the given environment.""" <|body_0|> def ComposeAction(self, prevDesc, baseCoord, imageCoord): """Creates a new action and hand descriptor objec...
stack_v2_sparse_classes_75kplus_train_073470
2,859
permissive
[ { "docstring": "Initializes agent in the given environment.", "name": "__init__", "signature": "def __init__(self, rlEnvironment, gpuId, hasHistory, nSamples, caffeDirPostfix='')" }, { "docstring": "Creates a new action and hand descriptor objects.", "name": "ComposeAction", "signature":...
4
stack_v2_sparse_classes_30k_train_034180
Implement the Python class `RlAgentLevel5` described below. Class description: Implement the RlAgentLevel5 class. Method signatures and docstrings: - def __init__(self, rlEnvironment, gpuId, hasHistory, nSamples, caffeDirPostfix=''): Initializes agent in the given environment. - def ComposeAction(self, prevDesc, base...
Implement the Python class `RlAgentLevel5` described below. Class description: Implement the RlAgentLevel5 class. Method signatures and docstrings: - def __init__(self, rlEnvironment, gpuId, hasHistory, nSamples, caffeDirPostfix=''): Initializes agent in the given environment. - def ComposeAction(self, prevDesc, base...
78a5c14f09291ae13505198e36f92f0956ccfc49
<|skeleton|> class RlAgentLevel5: def __init__(self, rlEnvironment, gpuId, hasHistory, nSamples, caffeDirPostfix=''): """Initializes agent in the given environment.""" <|body_0|> def ComposeAction(self, prevDesc, baseCoord, imageCoord): """Creates a new action and hand descriptor objec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RlAgentLevel5: def __init__(self, rlEnvironment, gpuId, hasHistory, nSamples, caffeDirPostfix=''): """Initializes agent in the given environment.""" RlAgentHierarchical.__init__(self, rlEnvironment, gpuId, hasHistory, nSamples) self.level = 5 self.InitializeCaffe(caffeDirPostfi...
the_stack_v2_python_sparse
python/rl_agent_level5.py
musyoku/chainer-6dof-grasping-attention-focus
train
0
e26234a67f3341844e1e1f056f8a5ca1b9d66456
[ "question = 'Jaki jest Twoj ojczysty język?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_response('angielski')\nself.assertIn('angielski', my_survey.responses)", "question = 'Jaki jest Twoj ojczysty język?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['angielski', 'hiszpański', 'polski']\nfor ...
<|body_start_0|> question = 'Jaki jest Twoj ojczysty język?' my_survey = AnonymousSurvey(question) my_survey.store_response('angielski') self.assertIn('angielski', my_survey.responses) <|end_body_0|> <|body_start_1|> question = 'Jaki jest Twoj ojczysty język?' my_survey ...
Testy dla klasy AnonymousSurvey.
TestAnonymousSurvey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnonymousSurvey: """Testy dla klasy AnonymousSurvey.""" def test_store_single_response(self): """Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana.""" <|body_0|> def test_store_three_responses(self): """Sprawdzenie, czy trzy pojedyncze odpow...
stack_v2_sparse_classes_75kplus_train_073471
1,128
no_license
[ { "docstring": "Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana.", "name": "test_store_single_response", "signature": "def test_store_single_response(self)" }, { "docstring": "Sprawdzenie, czy trzy pojedyncze odpowiedzi są prawidłowo przechowywane.", "name": "test_store_t...
2
stack_v2_sparse_classes_30k_train_002125
Implement the Python class `TestAnonymousSurvey` described below. Class description: Testy dla klasy AnonymousSurvey. Method signatures and docstrings: - def test_store_single_response(self): Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana. - def test_store_three_responses(self): Sprawdzenie, czy ...
Implement the Python class `TestAnonymousSurvey` described below. Class description: Testy dla klasy AnonymousSurvey. Method signatures and docstrings: - def test_store_single_response(self): Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana. - def test_store_three_responses(self): Sprawdzenie, czy ...
969f95132822d8bd21c30403d8e0bf6aadb9914f
<|skeleton|> class TestAnonymousSurvey: """Testy dla klasy AnonymousSurvey.""" def test_store_single_response(self): """Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana.""" <|body_0|> def test_store_three_responses(self): """Sprawdzenie, czy trzy pojedyncze odpow...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAnonymousSurvey: """Testy dla klasy AnonymousSurvey.""" def test_store_single_response(self): """Sprawdzenie, czy pojedyncza odpowiedź jest prawidłowo przechowywana.""" question = 'Jaki jest Twoj ojczysty język?' my_survey = AnonymousSurvey(question) my_survey.store_re...
the_stack_v2_python_sparse
ksiazka_zrob_to_sam/test_survey.py
Licho59/learning_python_eric_matthes_book
train
0
3ad3b4cc0f1520ceff2cfa1d891f8134ed348dc5
[ "self.current_epoch = 0\nself.current_epoch_logged_images = set()\nself.max_imgs_to_log_per_epoch = 16\nself.bbox_interval = opt.bbox_interval\nself.clearml = clearml\nself.task = None\nself.data_dict = None\nif self.clearml:\n self.task = Task.init(project_name='YOLOv5', task_name='training', tags=['YOLOv5'], o...
<|body_start_0|> self.current_epoch = 0 self.current_epoch_logged_images = set() self.max_imgs_to_log_per_epoch = 16 self.bbox_interval = opt.bbox_interval self.clearml = clearml self.task = None self.data_dict = None if self.clearml: self.task...
Log training runs, datasets, models, and predictions to ClearML. This logger sends information to ClearML at app.clear.ml or to your own hosted server. By default, this information includes hyperparameters, system configuration and metrics, model metrics, code information and basic data metrics and analyses. By providi...
ClearmlLogger
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClearmlLogger: """Log training runs, datasets, models, and predictions to ClearML. This logger sends information to ClearML at app.clear.ml or to your own hosted server. By default, this information includes hyperparameters, system configuration and metrics, model metrics, code information and ba...
stack_v2_sparse_classes_75kplus_train_073472
7,470
permissive
[ { "docstring": "- Initialize ClearML Task, this object will capture the experiment - Upload dataset version to ClearML Data if opt.upload_dataset is True arguments: opt (namespace) -- Commandline arguments for this run hyp (dict) -- Hyperparameters for this run", "name": "__init__", "signature": "def __...
3
stack_v2_sparse_classes_30k_train_019126
Implement the Python class `ClearmlLogger` described below. Class description: Log training runs, datasets, models, and predictions to ClearML. This logger sends information to ClearML at app.clear.ml or to your own hosted server. By default, this information includes hyperparameters, system configuration and metrics,...
Implement the Python class `ClearmlLogger` described below. Class description: Log training runs, datasets, models, and predictions to ClearML. This logger sends information to ClearML at app.clear.ml or to your own hosted server. By default, this information includes hyperparameters, system configuration and metrics,...
017c50ee6a0a388caca193fd5a06ba237150bd05
<|skeleton|> class ClearmlLogger: """Log training runs, datasets, models, and predictions to ClearML. This logger sends information to ClearML at app.clear.ml or to your own hosted server. By default, this information includes hyperparameters, system configuration and metrics, model metrics, code information and ba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClearmlLogger: """Log training runs, datasets, models, and predictions to ClearML. This logger sends information to ClearML at app.clear.ml or to your own hosted server. By default, this information includes hyperparameters, system configuration and metrics, model metrics, code information and basic data metr...
the_stack_v2_python_sparse
Modules/object_detection/py_nodes/yolov5_tensorrt_server/utils/loggers/clearml/clearml_utils.py
amov-lab/Prometheus
train
2,129
8e51b0b6bfae44443262781e402c34f42b9914d2
[ "template = db.Template.find_one(template_name=template_name)\nif not template:\n return self.make_response('No such template found', HTTP.NOT_FOUND)\nreturn self.make_response({'template': template})", "self.reqparse.add_argument('template', type=str, required=True)\nargs = self.reqparse.parse_args()\ntemplat...
<|body_start_0|> template = db.Template.find_one(template_name=template_name) if not template: return self.make_response('No such template found', HTTP.NOT_FOUND) return self.make_response({'template': template}) <|end_body_0|> <|body_start_1|> self.reqparse.add_argument('te...
TemplateGet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateGet: def get(self, template_name): """Get a specific template""" <|body_0|> def put(self, template_name): """Update a template""" <|body_1|> def delete(self, template_name): """Delete a template""" <|body_2|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_073473
4,164
permissive
[ { "docstring": "Get a specific template", "name": "get", "signature": "def get(self, template_name)" }, { "docstring": "Update a template", "name": "put", "signature": "def put(self, template_name)" }, { "docstring": "Delete a template", "name": "delete", "signature": "de...
3
stack_v2_sparse_classes_30k_train_029002
Implement the Python class `TemplateGet` described below. Class description: Implement the TemplateGet class. Method signatures and docstrings: - def get(self, template_name): Get a specific template - def put(self, template_name): Update a template - def delete(self, template_name): Delete a template
Implement the Python class `TemplateGet` described below. Class description: Implement the TemplateGet class. Method signatures and docstrings: - def get(self, template_name): Get a specific template - def put(self, template_name): Update a template - def delete(self, template_name): Delete a template <|skeleton|> c...
29a26c705381fdba3538b4efedb25b9e09b387ed
<|skeleton|> class TemplateGet: def get(self, template_name): """Get a specific template""" <|body_0|> def put(self, template_name): """Update a template""" <|body_1|> def delete(self, template_name): """Delete a template""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TemplateGet: def get(self, template_name): """Get a specific template""" template = db.Template.find_one(template_name=template_name) if not template: return self.make_response('No such template found', HTTP.NOT_FOUND) return self.make_response({'template': template...
the_stack_v2_python_sparse
backend/cloud_inquisitor/plugins/views/templates.py
RiotGames/cloud-inquisitor
train
468
d324e67eaae90d43573dfcbe087f529668e8f132
[ "seen = set()\nfor i in range(len(arr)):\n sub_array_sum = 0\n sub_array = []\n for j in range(i, len(arr)):\n sub_array_sum += arr[j]\n sub_array.append(arr[j])\n if sub_array_sum == k and tuple(sub_array) not in seen:\n seen.add(tuple(sub_array))\nreturn len(seen)", "sum...
<|body_start_0|> seen = set() for i in range(len(arr)): sub_array_sum = 0 sub_array = [] for j in range(i, len(arr)): sub_array_sum += arr[j] sub_array.append(arr[j]) if sub_array_sum == k and tuple(sub_array) not in see...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def brute_force(self, arr: List[int], k: int) -> int: """Check every subarray Complexity ---- Time : O(N^2) Space : O(N^2)""" <|body_0|> def cumulative_sum(self, arr: List[int], k: int) -> int: """We can use the difference of cumulative sums. Cumulative sum...
stack_v2_sparse_classes_75kplus_train_073474
3,284
no_license
[ { "docstring": "Check every subarray Complexity ---- Time : O(N^2) Space : O(N^2)", "name": "brute_force", "signature": "def brute_force(self, arr: List[int], k: int) -> int" }, { "docstring": "We can use the difference of cumulative sums. Cumulative sums are often helpful when dealing with suba...
3
stack_v2_sparse_classes_30k_train_005992
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def brute_force(self, arr: List[int], k: int) -> int: Check every subarray Complexity ---- Time : O(N^2) Space : O(N^2) - def cumulative_sum(self, arr: List[int], k: int) -> int:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def brute_force(self, arr: List[int], k: int) -> int: Check every subarray Complexity ---- Time : O(N^2) Space : O(N^2) - def cumulative_sum(self, arr: List[int], k: int) -> int:...
c0d49423885832b616ae3c7cd58e8f24c17cfd4d
<|skeleton|> class Solution: def brute_force(self, arr: List[int], k: int) -> int: """Check every subarray Complexity ---- Time : O(N^2) Space : O(N^2)""" <|body_0|> def cumulative_sum(self, arr: List[int], k: int) -> int: """We can use the difference of cumulative sums. Cumulative sum...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def brute_force(self, arr: List[int], k: int) -> int: """Check every subarray Complexity ---- Time : O(N^2) Space : O(N^2)""" seen = set() for i in range(len(arr)): sub_array_sum = 0 sub_array = [] for j in range(i, len(arr)): ...
the_stack_v2_python_sparse
Arrays/sub_array_sum_k.py
miaviles/Data-Structures-Algorithms-Python
train
0
081f8a4bcc2495d402ea78be82d4401fd787ca91
[ "self.name = name\nself.ntuple = ntuple\nself.cuts = cuts", "try:\n method = getattr(self.ntuple, attr)\nexcept AttributeError:\n log.error('Attribute `{0}` not found on DataStore'.format(attr))\nelse:\n return method" ]
<|body_start_0|> self.name = name self.ntuple = ntuple self.cuts = cuts <|end_body_0|> <|body_start_1|> try: method = getattr(self.ntuple, attr) except AttributeError: log.error('Attribute `{0}` not found on DataStore'.format(attr)) else: ...
Container class for ntuple metadata for plotting.
DataStore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataStore: """Container class for ntuple metadata for plotting.""" def __init__(self, name, ntuple, cuts=''): """Initialise an instance of the DataStore class. Keyword arguments: name -- String assigned to DataStore.name ntuple -- Lc2pXX object assigned to DataStore.ntuple cuts -- St...
stack_v2_sparse_classes_75kplus_train_073475
2,979
no_license
[ { "docstring": "Initialise an instance of the DataStore class. Keyword arguments: name -- String assigned to DataStore.name ntuple -- Lc2pXX object assigned to DataStore.ntuple cuts -- String of requirements on ntuple entries assigned to DataStore.cuts (default \"\")", "name": "__init__", "signature": "...
2
stack_v2_sparse_classes_30k_train_054254
Implement the Python class `DataStore` described below. Class description: Container class for ntuple metadata for plotting. Method signatures and docstrings: - def __init__(self, name, ntuple, cuts=''): Initialise an instance of the DataStore class. Keyword arguments: name -- String assigned to DataStore.name ntuple...
Implement the Python class `DataStore` described below. Class description: Container class for ntuple metadata for plotting. Method signatures and docstrings: - def __init__(self, name, ntuple, cuts=''): Initialise an instance of the DataStore class. Keyword arguments: name -- String assigned to DataStore.name ntuple...
e62d698a363d7e0d77affd9f0327f9567239a1d7
<|skeleton|> class DataStore: """Container class for ntuple metadata for plotting.""" def __init__(self, name, ntuple, cuts=''): """Initialise an instance of the DataStore class. Keyword arguments: name -- String assigned to DataStore.name ntuple -- Lc2pXX object assigned to DataStore.ntuple cuts -- St...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataStore: """Container class for ntuple metadata for plotting.""" def __init__(self, name, ntuple, cuts=''): """Initialise an instance of the DataStore class. Keyword arguments: name -- String assigned to DataStore.name ntuple -- Lc2pXX object assigned to DataStore.ntuple cuts -- String of requi...
the_stack_v2_python_sparse
python/lc2pxx/containers.py
alexpearce/Lc2pXX-SVN
train
0
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.weight, fsmt_layer.self_attn.k_proj.weight, fsmt_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.bias, fsmt_layer.self_attn.k_proj.bias, fsmt_layer.self_attn...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.weight, fsmt_layer.self_attn.k_proj.weight, fsmt_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([fsmt_layer.self_attn.q_proj.bias, fsmt_layer.self_attn...
FSMTEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FSMTEncoderLayerBetterTransformer: def __init__(self, fsmt_layer, config): """A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.""" <|body_...
stack_v2_sparse_classes_75kplus_train_073476
43,670
no_license
[ { "docstring": "A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, fsmt_layer, config)" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_041015
Implement the Python class `FSMTEncoderLayerBetterTransformer` described below. Class description: Implement the FSMTEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, fsmt_layer, config): A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation....
Implement the Python class `FSMTEncoderLayerBetterTransformer` described below. Class description: Implement the FSMTEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, fsmt_layer, config): A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation....
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class FSMTEncoderLayerBetterTransformer: def __init__(self, fsmt_layer, config): """A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FSMTEncoderLayerBetterTransformer: def __init__(self, fsmt_layer, config): """A simple conversion of the FSMT Encoder layer to its `BetterTransformer` implementation. Args: fsmt_layer (`torch.nn.Module`): The original FSMT Layer where the weights needs to be retrieved.""" super().__init__(conf...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
c1924c508526bc1ad59661667524d6f30cd546fc
[ "if level == len(self.out_channels) - 1:\n return nn.Conv2d(out_channels, boxes_per_location * self.num_categories, kernel_size=1)\nreturn SeparableConv2d(out_channels, boxes_per_location * self.num_categories, kernel_size=3, stride=1, padding=1)", "if level == len(self.out_channels) - 1:\n return nn.Conv2d...
<|body_start_0|> if level == len(self.out_channels) - 1: return nn.Conv2d(out_channels, boxes_per_location * self.num_categories, kernel_size=1) return SeparableConv2d(out_channels, boxes_per_location * self.num_categories, kernel_size=3, stride=1, padding=1) <|end_body_0|> <|body_start_1|>...
description
SSDLiteBoxPredictor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SSDLiteBoxPredictor: """description""" def category_block(self, level: int, out_channels: int, boxes_per_location: int) -> nn.Module: """:param level: :type level: :param out_channels: :type out_channels: :param boxes_per_location: :type boxes_per_location: :return: :rtype:""" ...
stack_v2_sparse_classes_75kplus_train_073477
1,739
permissive
[ { "docstring": ":param level: :type level: :param out_channels: :type out_channels: :param boxes_per_location: :type boxes_per_location: :return: :rtype:", "name": "category_block", "signature": "def category_block(self, level: int, out_channels: int, boxes_per_location: int) -> nn.Module" }, { ...
2
stack_v2_sparse_classes_30k_train_048589
Implement the Python class `SSDLiteBoxPredictor` described below. Class description: description Method signatures and docstrings: - def category_block(self, level: int, out_channels: int, boxes_per_location: int) -> nn.Module: :param level: :type level: :param out_channels: :type out_channels: :param boxes_per_locat...
Implement the Python class `SSDLiteBoxPredictor` described below. Class description: description Method signatures and docstrings: - def category_block(self, level: int, out_channels: int, boxes_per_location: int) -> nn.Module: :param level: :type level: :param out_channels: :type out_channels: :param boxes_per_locat...
06839b08d8e8f274c02a6bcd31bf1b32d3dc04e4
<|skeleton|> class SSDLiteBoxPredictor: """description""" def category_block(self, level: int, out_channels: int, boxes_per_location: int) -> nn.Module: """:param level: :type level: :param out_channels: :type out_channels: :param boxes_per_location: :type boxes_per_location: :return: :rtype:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SSDLiteBoxPredictor: """description""" def category_block(self, level: int, out_channels: int, boxes_per_location: int) -> nn.Module: """:param level: :type level: :param out_channels: :type out_channels: :param boxes_per_location: :type boxes_per_location: :return: :rtype:""" if level ==...
the_stack_v2_python_sparse
neodroidvision/detection/single_stage/ssd/architecture/nms_box_heads/ssd_lite_box_predictor.py
aivclab/vision
train
1
cdc3ee5efc52eac849a22d7d405c65592590d056
[ "if not root:\n return 0\nif root.left and root.right:\n return min(self.minDepth(root.left), self.minDepth(root.right)) + 1\nelse:\n return max(self.minDepth(root.left), self.minDepth(root.right)) + 1", "if not root:\n return 0\ni = 1\ns = [root]\nwhile s:\n ss = []\n for node in s:\n if...
<|body_start_0|> if not root: return 0 if root.left and root.right: return min(self.minDepth(root.left), self.minDepth(root.right)) + 1 else: return max(self.minDepth(root.left), self.minDepth(root.right)) + 1 <|end_body_0|> <|body_start_1|> if not ro...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 if root.lef...
stack_v2_sparse_classes_75kplus_train_073478
1,091
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "minDepth", "signature": "def minDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "minDepth", "signature": "def minDepth(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_026624
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root): :type root: TreeNode :rtype: int - def minDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDepth(self, root): :type root: TreeNode :rtype: int - def minDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def minDepth(self, root...
c4e6c9590bb8531feeb4ac88d9ce95f823ef07e7
<|skeleton|> class Solution: def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minDepth(self, root): """:type root: TreeNode :rtype: int""" if not root: return 0 if root.left and root.right: return min(self.minDepth(root.left), self.minDepth(root.right)) + 1 else: return max(self.minDepth(root.left), self....
the_stack_v2_python_sparse
Facebook/phone/Binary Tree - Minimum Depth.py
armsky/Preps
train
0
6cfb4c27f0a897695d4b0bf229f64f5d0d5bb378
[ "if headA is None or headB is None:\n return\ncur1 = headA\nwhile cur1:\n cur2 = headB\n while cur2:\n if cur1 == cur2:\n return cur1\n else:\n cur2 = cur2.next\n cur1 = cur1.next\nreturn", "listA = []\nif headA is None or headB is None:\n return\ncur1 = headA\nw...
<|body_start_0|> if headA is None or headB is None: return cur1 = headA while cur1: cur2 = headB while cur2: if cur1 == cur2: return cur1 else: cur2 = cur2.next cur1 = cur1.nex...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """采用先遍历后判断的逻辑,此种方法把链表的存储优势浪费了,使用庞大的列表,对空间的需求和遍历也是绝大的开支,仍超时 :param headA: :par...
stack_v2_sparse_classes_75kplus_train_073479
3,348
no_license
[ { "docstring": "采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": "采用先遍历后判断的逻辑,此种方法把链表的存储优势浪费了,使用庞大的列表,对空间的需求和遍历也是绝大的开支,仍超时 :param headA: :param headB: :return:", ...
4
stack_v2_sparse_classes_30k_train_041973
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): 采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): 采用先遍历后判断的逻辑,此种...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): 采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): 采用先遍历后判断的逻辑,此种...
16b6fc4247c91a919d38bf18835f10fc29fccca7
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """采用先遍历后判断的逻辑,此种方法把链表的存储优势浪费了,使用庞大的列表,对空间的需求和遍历也是绝大的开支,仍超时 :param headA: :par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def getIntersectionNode(self, headA, headB): """采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode""" if headA is None or headB is None: return cur1 = headA while cur1: cur2 = headB while cur2: if...
the_stack_v2_python_sparse
problem_160.py
SeanLau/leetcode
train
0
d64c5aeff121913a1510df28d366c82ecdf00dc5
[ "self.connection = connection\nself.title = title\nself.manager = manager\nself.deadline = deadline", "cursor = self.connection.cursor()\nwrite_project = 'INSERT INTO project SELECT NULL,?,?,? WHERE NOT EXISTS (SELECT NULL FROM project WHERE title=?)'\ncursor.execute(write_project, (self.title, self.manager, self...
<|body_start_0|> self.connection = connection self.title = title self.manager = manager self.deadline = deadline <|end_body_0|> <|body_start_1|> cursor = self.connection.cursor() write_project = 'INSERT INTO project SELECT NULL,?,?,? WHERE NOT EXISTS (SELECT NULL FROM pr...
ProjectRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectRepository: def __init__(self, connection: sqlite3.Connection, title: str, manager: str, deadline: int): """Хранилище атрибутов проекта :param connection: соединение с СУБД :param title: Наименование проекта :param manager: ФИО руководителя :param deadline: Дата сдачи""" <...
stack_v2_sparse_classes_75kplus_train_073480
1,367
no_license
[ { "docstring": "Хранилище атрибутов проекта :param connection: соединение с СУБД :param title: Наименование проекта :param manager: ФИО руководителя :param deadline: Дата сдачи", "name": "__init__", "signature": "def __init__(self, connection: sqlite3.Connection, title: str, manager: str, deadline: int)...
2
null
Implement the Python class `ProjectRepository` described below. Class description: Implement the ProjectRepository class. Method signatures and docstrings: - def __init__(self, connection: sqlite3.Connection, title: str, manager: str, deadline: int): Хранилище атрибутов проекта :param connection: соединение с СУБД :p...
Implement the Python class `ProjectRepository` described below. Class description: Implement the ProjectRepository class. Method signatures and docstrings: - def __init__(self, connection: sqlite3.Connection, title: str, manager: str, deadline: int): Хранилище атрибутов проекта :param connection: соединение с СУБД :p...
b56b8f8c5b73e1363e2595b93daae0dbfc9ea70c
<|skeleton|> class ProjectRepository: def __init__(self, connection: sqlite3.Connection, title: str, manager: str, deadline: int): """Хранилище атрибутов проекта :param connection: соединение с СУБД :param title: Наименование проекта :param manager: ФИО руководителя :param deadline: Дата сдачи""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectRepository: def __init__(self, connection: sqlite3.Connection, title: str, manager: str, deadline: int): """Хранилище атрибутов проекта :param connection: соединение с СУБД :param title: Наименование проекта :param manager: ФИО руководителя :param deadline: Дата сдачи""" self.connection...
the_stack_v2_python_sparse
csv-consolidation/ProjectRepository.py
SbWereWolf/tensor-employee
train
0
49a9cd289962c290240368efa084ef814dea3d5c
[ "ebuild_path = 'chromeos-base/platform2/platform2-9999.ebuild'\ncomponents = ['chromeos-base', 'platform2', 'platform2-9999']\nfor path in (ebuild_path, './' + ebuild_path, 'foo.bar/' + ebuild_path):\n self.assertEquals(components, portage_util.SplitEbuildPath(path))", "pv = 'bar-1.2.3_rc1-r5'\npackage, versio...
<|body_start_0|> ebuild_path = 'chromeos-base/platform2/platform2-9999.ebuild' components = ['chromeos-base', 'platform2', 'platform2-9999'] for path in (ebuild_path, './' + ebuild_path, 'foo.bar/' + ebuild_path): self.assertEquals(components, portage_util.SplitEbuildPath(path)) <|en...
Tests related to Proejct Mapping.
ProjectMappingTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectMappingTest: """Tests related to Proejct Mapping.""" def testSplitEbuildPath(self): """Test if we can split an ebuild path into its components.""" <|body_0|> def testSplitPV(self): """Test splitting PVs into package and version components.""" <|bod...
stack_v2_sparse_classes_75kplus_train_073481
44,982
permissive
[ { "docstring": "Test if we can split an ebuild path into its components.", "name": "testSplitEbuildPath", "signature": "def testSplitEbuildPath(self)" }, { "docstring": "Test splitting PVs into package and version components.", "name": "testSplitPV", "signature": "def testSplitPV(self)" ...
4
stack_v2_sparse_classes_30k_train_012924
Implement the Python class `ProjectMappingTest` described below. Class description: Tests related to Proejct Mapping. Method signatures and docstrings: - def testSplitEbuildPath(self): Test if we can split an ebuild path into its components. - def testSplitPV(self): Test splitting PVs into package and version compone...
Implement the Python class `ProjectMappingTest` described below. Class description: Tests related to Proejct Mapping. Method signatures and docstrings: - def testSplitEbuildPath(self): Test if we can split an ebuild path into its components. - def testSplitPV(self): Test splitting PVs into package and version compone...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ProjectMappingTest: """Tests related to Proejct Mapping.""" def testSplitEbuildPath(self): """Test if we can split an ebuild path into its components.""" <|body_0|> def testSplitPV(self): """Test splitting PVs into package and version components.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectMappingTest: """Tests related to Proejct Mapping.""" def testSplitEbuildPath(self): """Test if we can split an ebuild path into its components.""" ebuild_path = 'chromeos-base/platform2/platform2-9999.ebuild' components = ['chromeos-base', 'platform2', 'platform2-9999'] ...
the_stack_v2_python_sparse
third_party/chromite/lib/portage_util_unittest.py
metux/chromium-suckless
train
5
1646348048a6d86ba2c09fe12dcd69fc868de6bc
[ "client = mock_client()\nargs = {'user-profile': {'userName': 'mock_user_name'}}\nwith requests_mock.Mocker() as m:\n m.get(userUri, json={'totalResults': 0, 'Resources': []})\n m.post(userUri, json=APP_USER_OUTPUT)\n user_profile = IAMCommand(get_user_iam_attrs=['userName']).create_user(client, args)\nout...
<|body_start_0|> client = mock_client() args = {'user-profile': {'userName': 'mock_user_name'}} with requests_mock.Mocker() as m: m.get(userUri, json={'totalResults': 0, 'Resources': []}) m.post(userUri, json=APP_USER_OUTPUT) user_profile = IAMCommand(get_user...
TestCreateUserCommand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCreateUserCommand: def test_success(self): """Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: - Calling function create_user_command Then: - Ensure a User Profile object with the user data is returned""" ...
stack_v2_sparse_classes_75kplus_train_073482
23,298
permissive
[ { "docstring": "Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: - Calling function create_user_command Then: - Ensure a User Profile object with the user data is returned", "name": "test_success", "signature": "def test_succe...
2
null
Implement the Python class `TestCreateUserCommand` described below. Class description: Implement the TestCreateUserCommand class. Method signatures and docstrings: - def test_success(self): Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: -...
Implement the Python class `TestCreateUserCommand` described below. Class description: Implement the TestCreateUserCommand class. Method signatures and docstrings: - def test_success(self): Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: -...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestCreateUserCommand: def test_success(self): """Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: - Calling function create_user_command Then: - Ensure a User Profile object with the user data is returned""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCreateUserCommand: def test_success(self): """Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: - Calling function create_user_command Then: - Ensure a User Profile object with the user data is returned""" client ...
the_stack_v2_python_sparse
Packs/AWS-ILM/Integrations/AWSILM/AWSILM_test.py
demisto/content
train
1,023
11331107fe0ce95c76bcbab6a19bd133db27cb35
[ "self.name = name\nself.output_dest = output_dest\nlog.debug('Mapper {0} initialized. Output={1}'.format(name, output_dest))", "input_file = key\nparams = val\noutput_file = '{0}/{1}_mapped.pkl'.format(self.output_dest, input_file)\nSavePickles(output_file, [(key, val)])\nSendPickle(self.output_dest, [(key, val)]...
<|body_start_0|> self.name = name self.output_dest = output_dest log.debug('Mapper {0} initialized. Output={1}'.format(name, output_dest)) <|end_body_0|> <|body_start_1|> input_file = key params = val output_file = '{0}/{1}_mapped.pkl'.format(self.output_dest, input_file...
A class that handles Mapping jobs Need to specify the Map() function
BaseMapper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseMapper: """A class that handles Mapping jobs Need to specify the Map() function""" def __init__(self, name, output_dest=None): """initialize the mapper. the mapper should have a name. output_dir specifies the folder to output map results. this class can also hold global parameter...
stack_v2_sparse_classes_75kplus_train_073483
7,956
permissive
[ { "docstring": "initialize the mapper. the mapper should have a name. output_dir specifies the folder to output map results. this class can also hold global parameters that are used by the Map() function. usually the output_dest is specified so that the mapper knows where to store the results.", "name": "__...
2
null
Implement the Python class `BaseMapper` described below. Class description: A class that handles Mapping jobs Need to specify the Map() function Method signatures and docstrings: - def __init__(self, name, output_dest=None): initialize the mapper. the mapper should have a name. output_dir specifies the folder to outp...
Implement the Python class `BaseMapper` described below. Class description: A class that handles Mapping jobs Need to specify the Map() function Method signatures and docstrings: - def __init__(self, name, output_dest=None): initialize the mapper. the mapper should have a name. output_dir specifies the folder to outp...
cf89cff095b542371d10af976fc687a3fb1da471
<|skeleton|> class BaseMapper: """A class that handles Mapping jobs Need to specify the Map() function""" def __init__(self, name, output_dest=None): """initialize the mapper. the mapper should have a name. output_dir specifies the folder to output map results. this class can also hold global parameter...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseMapper: """A class that handles Mapping jobs Need to specify the Map() function""" def __init__(self, name, output_dest=None): """initialize the mapper. the mapper should have a name. output_dir specifies the folder to output map results. this class can also hold global parameters that are us...
the_stack_v2_python_sparse
ex/pp/mr.py
excelly/xpy-ml
train
0
092caac84c8b61f34b216d0d84a15297f2403b5f
[ "try:\n data = PDPManager.get_pdp(user_id=user_id, pdp_id=uuid)\nexcept Exception as e:\n LOG.error(e, exc_info=True)\n return ({'result': False, 'error': str(e)}, 500)\nreturn {'pdps': data}", "try:\n data = PDPManager.add_pdp(user_id=user_id, pdp_id=None, value=request.json)\n add_pod(uuid=uuid, ...
<|body_start_0|> try: data = PDPManager.get_pdp(user_id=user_id, pdp_id=uuid) except Exception as e: LOG.error(e, exc_info=True) return ({'result': False, 'error': str(e)}, 500) return {'pdps': data} <|end_body_0|> <|body_start_1|> try: da...
Endpoint for pdp requests
PDP
[ "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PDP: """Endpoint for pdp requests""" def get(self, uuid=None, user_id=None): """Retrieve all pdp :param uuid: uuid of the pdp :param user_id: user ID who do the request :return: { "pdp_id1": { "name": "...", "security_pipeline": [...], "keystone_project_id": "keystone_project_id1", "...
stack_v2_sparse_classes_75kplus_train_073484
4,520
permissive
[ { "docstring": "Retrieve all pdp :param uuid: uuid of the pdp :param user_id: user ID who do the request :return: { \"pdp_id1\": { \"name\": \"...\", \"security_pipeline\": [...], \"keystone_project_id\": \"keystone_project_id1\", \"description\": \"...\", } } :internal_api: get_pdp", "name": "get", "si...
4
null
Implement the Python class `PDP` described below. Class description: Endpoint for pdp requests Method signatures and docstrings: - def get(self, uuid=None, user_id=None): Retrieve all pdp :param uuid: uuid of the pdp :param user_id: user ID who do the request :return: { "pdp_id1": { "name": "...", "security_pipeline"...
Implement the Python class `PDP` described below. Class description: Endpoint for pdp requests Method signatures and docstrings: - def get(self, uuid=None, user_id=None): Retrieve all pdp :param uuid: uuid of the pdp :param user_id: user ID who do the request :return: { "pdp_id1": { "name": "...", "security_pipeline"...
daaba34fa2ed4426bc0fde359e54a5e1b872208c
<|skeleton|> class PDP: """Endpoint for pdp requests""" def get(self, uuid=None, user_id=None): """Retrieve all pdp :param uuid: uuid of the pdp :param user_id: user ID who do the request :return: { "pdp_id1": { "name": "...", "security_pipeline": [...], "keystone_project_id": "keystone_project_id1", "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PDP: """Endpoint for pdp requests""" def get(self, uuid=None, user_id=None): """Retrieve all pdp :param uuid: uuid of the pdp :param user_id: user ID who do the request :return: { "pdp_id1": { "name": "...", "security_pipeline": [...], "keystone_project_id": "keystone_project_id1", "description":...
the_stack_v2_python_sparse
moonv4/moon_manager/moon_manager/api/pdp.py
hashnfv/hashnfv-moon
train
0
86bb8e150a073f505cc8ccdef7240e736f27bb50
[ "if IP_NOT_FOUND:\n return HttpResponseNotFound(IP_NOT_FOUND_MSG)\nreturn Response([{'ruleId': 0, 'ruleIp': blockedIp, 'ruleReason': 'string'}])", "if IP_NOT_FOUND:\n return HttpResponseNotFound(IP_NOT_FOUND_MSG)\nif len(request.data) != 1:\n return HttpResponseBadRequest()\nreturn Response([{'ruleId': 0...
<|body_start_0|> if IP_NOT_FOUND: return HttpResponseNotFound(IP_NOT_FOUND_MSG) return Response([{'ruleId': 0, 'ruleIp': blockedIp, 'ruleReason': 'string'}]) <|end_body_0|> <|body_start_1|> if IP_NOT_FOUND: return HttpResponseNotFound(IP_NOT_FOUND_MSG) if len(req...
[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP
RtbhBlockedIp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RtbhBlockedIp: """[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP""" def get(self, request, blockedIp, **kwargs): """:param bl...
stack_v2_sparse_classes_75kplus_train_073485
4,134
permissive
[ { "docstring": ":param blockedIp: any ipv4", "name": "get", "signature": "def get(self, request, blockedIp, **kwargs)" }, { "docstring": ":param blockedIp: any ipv4", "name": "put", "signature": "def put(self, request, blockedIp, **kwargs)" }, { "docstring": ":param blockedIp: an...
3
stack_v2_sparse_classes_30k_train_047139
Implement the Python class `RtbhBlockedIp` described below. Class description: [GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP Method signatures and docstrings:...
Implement the Python class `RtbhBlockedIp` described below. Class description: [GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP Method signatures and docstrings:...
73e4ac0ced6c3ac46d24ac5c3feb01a1e88bd36b
<|skeleton|> class RtbhBlockedIp: """[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP""" def get(self, request, blockedIp, **kwargs): """:param bl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RtbhBlockedIp: """[GET] /rtbh/{blockedIp} Get all rules with specified blockedIp on RTBH [PUT] /rtbh/{blockedIp} Change the reason for all rules with specified IP [DELETE] /rtbh/{blockedIp} Delete all rules for specified IP""" def get(self, request, blockedIp, **kwargs): """:param blockedIp: any ...
the_stack_v2_python_sparse
crusoe_act/act-component/rtbh-wrapper/rtbh_wrapper_project/views.py
wumingruiye/CRUSOE
train
0
857652691705971b1fcc0a08a758667bc9d00c81
[ "self._counter = Counter()\nself._interval = interval\nself.filters = filters\nself._verbose = verbose", "is_in_filters = self.filters is None or tag in self.filters\nat_interval = is_none_or_zero_or_negative_or_mod_zero(self._interval, self._counter[tag])\nreturn is_in_filters and at_interval" ]
<|body_start_0|> self._counter = Counter() self._interval = interval self.filters = filters self._verbose = verbose <|end_body_0|> <|body_start_1|> is_in_filters = self.filters is None or tag in self.filters at_interval = is_none_or_zero_or_negative_or_mod_zero(self._int...
CounterFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CounterFilter: def __init__(self, *, interval: Optional[int]=1, filters: Iterable=None, verbose: bool=False): """:param interval: :param filters: :param verbose:""" <|body_0|> def filter(self, tag: str) -> bool: """returns a boolean value, true if to be included, Fal...
stack_v2_sparse_classes_75kplus_train_073486
1,314
permissive
[ { "docstring": ":param interval: :param filters: :param verbose:", "name": "__init__", "signature": "def __init__(self, *, interval: Optional[int]=1, filters: Iterable=None, verbose: bool=False)" }, { "docstring": "returns a boolean value, true if to be included, False if to be excluded tag is i...
2
stack_v2_sparse_classes_30k_train_034283
Implement the Python class `CounterFilter` described below. Class description: Implement the CounterFilter class. Method signatures and docstrings: - def __init__(self, *, interval: Optional[int]=1, filters: Iterable=None, verbose: bool=False): :param interval: :param filters: :param verbose: - def filter(self, tag: ...
Implement the Python class `CounterFilter` described below. Class description: Implement the CounterFilter class. Method signatures and docstrings: - def __init__(self, *, interval: Optional[int]=1, filters: Iterable=None, verbose: bool=False): :param interval: :param filters: :param verbose: - def filter(self, tag: ...
94a402cab47a2bd6241608308371490079af4d53
<|skeleton|> class CounterFilter: def __init__(self, *, interval: Optional[int]=1, filters: Iterable=None, verbose: bool=False): """:param interval: :param filters: :param verbose:""" <|body_0|> def filter(self, tag: str) -> bool: """returns a boolean value, true if to be included, Fal...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CounterFilter: def __init__(self, *, interval: Optional[int]=1, filters: Iterable=None, verbose: bool=False): """:param interval: :param filters: :param verbose:""" self._counter = Counter() self._interval = interval self.filters = filters self._verbose = verbose d...
the_stack_v2_python_sparse
draugr/python_utilities/counter_filter.py
cnheider/draugr
train
4
2529ffeb5f01748be399fedc3721a03c34b27286
[ "self.en = Signal()\nself.data_in = Signal(width)\nself.data_out = Signal(width)", "m = Module()\nm.d.comb += self.data_out.eq(Mux(self.en, self.data_in[::-1], self.data_in))\nreturn m" ]
<|body_start_0|> self.en = Signal() self.data_in = Signal(width) self.data_out = Signal(width) <|end_body_0|> <|body_start_1|> m = Module() m.d.comb += self.data_out.eq(Mux(self.en, self.data_in[::-1], self.data_in)) return m <|end_body_1|>
A conditional bit reverser. Attributes: data_in: The input data. data_out: The output data. en: Whether reversing is enabled or disabled.
_ConditionalReverser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _ConditionalReverser: """A conditional bit reverser. Attributes: data_in: The input data. data_out: The output data. en: Whether reversing is enabled or disabled.""" def __init__(self, width: int): """Constructs a conditional reverser. Args: width: The number of bits in the reverser....
stack_v2_sparse_classes_75kplus_train_073487
7,020
no_license
[ { "docstring": "Constructs a conditional reverser. Args: width: The number of bits in the reverser.", "name": "__init__", "signature": "def __init__(self, width: int)" }, { "docstring": "Implements the logic for the reverser.", "name": "elaborate", "signature": "def elaborate(self, _: Pl...
2
null
Implement the Python class `_ConditionalReverser` described below. Class description: A conditional bit reverser. Attributes: data_in: The input data. data_out: The output data. en: Whether reversing is enabled or disabled. Method signatures and docstrings: - def __init__(self, width: int): Constructs a conditional r...
Implement the Python class `_ConditionalReverser` described below. Class description: A conditional bit reverser. Attributes: data_in: The input data. data_out: The output data. en: Whether reversing is enabled or disabled. Method signatures and docstrings: - def __init__(self, width: int): Constructs a conditional r...
9e652e1ca6dd5c2488ec30560b175d6d20ee003f
<|skeleton|> class _ConditionalReverser: """A conditional bit reverser. Attributes: data_in: The input data. data_out: The output data. en: Whether reversing is enabled or disabled.""" def __init__(self, width: int): """Constructs a conditional reverser. Args: width: The number of bits in the reverser....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _ConditionalReverser: """A conditional bit reverser. Attributes: data_in: The input data. data_out: The output data. en: Whether reversing is enabled or disabled.""" def __init__(self, width: int): """Constructs a conditional reverser. Args: width: The number of bits in the reverser.""" s...
the_stack_v2_python_sparse
shift_card.py
ElMahdiElAnnabi/riscv-reboot
train
0
ebcb97e058c714c3c336aa38be84fa4228d4f6f6
[ "if not root:\n return []\nres = []\nqueue = [root]\nwhile queue:\n level_node = []\n temp = []\n for i in queue:\n level_node.append(i.val)\n if i.left:\n temp.append(i.left)\n if i.right:\n temp.append(i.right)\n res.append(level_node)\n queue = temp\nr...
<|body_start_0|> if not root: return [] res = [] queue = [root] while queue: level_node = [] temp = [] for i in queue: level_node.append(i.val) if i.left: temp.append(i.left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """bfs 迭代:相对来说用队列就能实现""" <|body_0|> def levelOrder1(self, root: TreeNode) -> List[List[int]]: """递归""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return []...
stack_v2_sparse_classes_75kplus_train_073488
1,795
no_license
[ { "docstring": "bfs 迭代:相对来说用队列就能实现", "name": "levelOrder", "signature": "def levelOrder(self, root: TreeNode) -> List[List[int]]" }, { "docstring": "递归", "name": "levelOrder1", "signature": "def levelOrder1(self, root: TreeNode) -> List[List[int]]" } ]
2
stack_v2_sparse_classes_30k_train_047088
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: bfs 迭代:相对来说用队列就能实现 - def levelOrder1(self, root: TreeNode) -> List[List[int]]: 递归
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> List[List[int]]: bfs 迭代:相对来说用队列就能实现 - def levelOrder1(self, root: TreeNode) -> List[List[int]]: 递归 <|skeleton|> class Solution: def ...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """bfs 迭代:相对来说用队列就能实现""" <|body_0|> def levelOrder1(self, root: TreeNode) -> List[List[int]]: """递归""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def levelOrder(self, root: TreeNode) -> List[List[int]]: """bfs 迭代:相对来说用队列就能实现""" if not root: return [] res = [] queue = [root] while queue: level_node = [] temp = [] for i in queue: level_node.a...
the_stack_v2_python_sparse
算法/Week_02/102. 二叉树的层序遍历.py
RichieSong/algorithm
train
0
05d3c1e0dbc1523cd98da14d955a1e866336697c
[ "super().__init__(name=name)\nself.self_attention = MultiHeadAttention(config)\nself.norm1 = tf.keras.layers.LayerNormalization(epsilon=config['layernorm_epsilon'])\nself.ende_attn = MultiHeadAttention(config)\nself.norm2 = tf.keras.layers.LayerNormalization(epsilon=config['layernorm_epsilon'])\nself.ffn = Position...
<|body_start_0|> super().__init__(name=name) self.self_attention = MultiHeadAttention(config) self.norm1 = tf.keras.layers.LayerNormalization(epsilon=config['layernorm_epsilon']) self.ende_attn = MultiHeadAttention(config) self.norm2 = tf.keras.layers.LayerNormalization(epsilon=c...
Decoder Layer Class
DecoderLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderLayer: """Decoder Layer Class""" def __init__(self, config, name='decoder_layer'): """생성자 :param config: Config 객체 :param name: layer name""" <|body_0|> def call(self, dec_embed, enc_out, self_mask, ende_mask): """layer 실행 :param dec_embed: dec_embed 또는 이전...
stack_v2_sparse_classes_75kplus_train_073489
14,325
permissive
[ { "docstring": "생성자 :param config: Config 객체 :param name: layer name", "name": "__init__", "signature": "def __init__(self, config, name='decoder_layer')" }, { "docstring": "layer 실행 :param dec_embed: dec_embed 또는 이전 DecoderLayer의 출력 :param enc_out: 마지막 EncoderLayer의 출력 :param self_mask: dec_tok...
2
null
Implement the Python class `DecoderLayer` described below. Class description: Decoder Layer Class Method signatures and docstrings: - def __init__(self, config, name='decoder_layer'): 생성자 :param config: Config 객체 :param name: layer name - def call(self, dec_embed, enc_out, self_mask, ende_mask): layer 실행 :param dec_e...
Implement the Python class `DecoderLayer` described below. Class description: Decoder Layer Class Method signatures and docstrings: - def __init__(self, config, name='decoder_layer'): 생성자 :param config: Config 객체 :param name: layer name - def call(self, dec_embed, enc_out, self_mask, ende_mask): layer 실행 :param dec_e...
cf8588ead07a098de9dd1e4f177374ba7ce08d74
<|skeleton|> class DecoderLayer: """Decoder Layer Class""" def __init__(self, config, name='decoder_layer'): """생성자 :param config: Config 객체 :param name: layer name""" <|body_0|> def call(self, dec_embed, enc_out, self_mask, ende_mask): """layer 실행 :param dec_embed: dec_embed 또는 이전...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DecoderLayer: """Decoder Layer Class""" def __init__(self, config, name='decoder_layer'): """생성자 :param config: Config 객체 :param name: layer name""" super().__init__(name=name) self.self_attention = MultiHeadAttention(config) self.norm1 = tf.keras.layers.LayerNormalization...
the_stack_v2_python_sparse
transformer/model.py
paul-hyun/tf_transformers
train
10
79c85aaa703b43d9372579604d67a66d96a30b1c
[ "self._mapping = OrderedDict()\nself._counter = itertools.count()\nif data is not None:\n self.update(data)", "try:\n float(val)\nexcept ValueError:\n try:\n dateutil.parser.parse(val)\n except (ValueError, TypeError):\n return False\nreturn True", "data = np.atleast_1d(np.array(data, ...
<|body_start_0|> self._mapping = OrderedDict() self._counter = itertools.count() if data is not None: self.update(data) <|end_body_0|> <|body_start_1|> try: float(val) except ValueError: try: dateutil.parser.parse(val) ...
UnitData
[ "Apache-2.0", "CC0-1.0", "BSD-3-Clause", "MIT", "Bitstream-Charter", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-bakoma-fonts-1995", "LicenseRef-scancode-unknown-license-reference", "OFL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitData: def __init__(self, data=None): """Create mapping between unique categorical values and integer ids. Parameters ---------- data : iterable sequence of string values""" <|body_0|> def _str_is_convertible(val): """Helper method to check whether a string can be...
stack_v2_sparse_classes_75kplus_train_073490
7,316
permissive
[ { "docstring": "Create mapping between unique categorical values and integer ids. Parameters ---------- data : iterable sequence of string values", "name": "__init__", "signature": "def __init__(self, data=None)" }, { "docstring": "Helper method to check whether a string can be parsed as float o...
3
null
Implement the Python class `UnitData` described below. Class description: Implement the UnitData class. Method signatures and docstrings: - def __init__(self, data=None): Create mapping between unique categorical values and integer ids. Parameters ---------- data : iterable sequence of string values - def _str_is_con...
Implement the Python class `UnitData` described below. Class description: Implement the UnitData class. Method signatures and docstrings: - def __init__(self, data=None): Create mapping between unique categorical values and integer ids. Parameters ---------- data : iterable sequence of string values - def _str_is_con...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class UnitData: def __init__(self, data=None): """Create mapping between unique categorical values and integer ids. Parameters ---------- data : iterable sequence of string values""" <|body_0|> def _str_is_convertible(val): """Helper method to check whether a string can be...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnitData: def __init__(self, data=None): """Create mapping between unique categorical values and integer ids. Parameters ---------- data : iterable sequence of string values""" self._mapping = OrderedDict() self._counter = itertools.count() if data is not None: self...
the_stack_v2_python_sparse
contrib/python/matplotlib/py3/matplotlib/category.py
catboost/catboost
train
8,012
dd11237c18979426a3189f3a5532be868d85eaa5
[ "self.head = head\nself.len = 0\ncurr = self.head\nwhile curr != None:\n self.len += 1\n curr = curr.next", "rnd.seed()\ncurr = self.head\nstop = rnd.randrange(self.len)\nwhile stop != 0:\n stop -= 1\n curr = curr.next\nreturn curr.val" ]
<|body_start_0|> self.head = head self.len = 0 curr = self.head while curr != None: self.len += 1 curr = curr.next <|end_body_0|> <|body_start_1|> rnd.seed() curr = self.head stop = rnd.randrange(self.len) while stop != 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_75kplus_train_073491
1,684
no_license
[ { "docstring": "@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode", "name": "__init__", "signature": "def __init__(self, head)" }, { "docstring": "Returns a random node's value. :rtype: int", "name": "g...
2
stack_v2_sparse_classes_30k_train_049894
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, head): @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode - def getRan...
8cda0518440488992d7e2c70cb8555ec7b34083f
<|skeleton|> class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" <|body_0|> def getRandom(self): """Returns a random node's value. :rtype: int""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def __init__(self, head): """@param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. :type head: ListNode""" self.head = head self.len = 0 curr = self.head while curr != None: self.len ...
the_stack_v2_python_sparse
382/main.py
szhongren/leetcode
train
0
4bb21fd1fef767aad4d4f8cdbc0366c39cdf5898
[ "self.folder_with_objects_fullname_list = folder_with_objects_fullname_list\nself.expected_objects_count = expected_objects_count\nself.each_object_size_width = each_object_size_width\nself.each_object_size_height = each_object_size_height\nself.pixel_depth = pixel_depth", "try:\n print('► convert {} to pickle...
<|body_start_0|> self.folder_with_objects_fullname_list = folder_with_objects_fullname_list self.expected_objects_count = expected_objects_count self.each_object_size_width = each_object_size_width self.each_object_size_height = each_object_size_height self.pixel_depth = pixel_de...
PickleMaker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PickleMaker: def __init__(self, folder_with_objects_fullname_list, expected_objects_count, each_object_size_width=config.TRAIN_OBJECT_WIDTH, each_object_size_height=config.TRAIN_OBJECT_HEIGHT, pixel_depth=255.0): """Construct the PickleMaker that can convert objects under folders of fold...
stack_v2_sparse_classes_75kplus_train_073492
6,873
permissive
[ { "docstring": "Construct the PickleMaker that can convert objects under folders of folder_with_objects_fullname_list to a collection of 2-D, a 3-D collection. A validated result collection should contain rows not less than expected_objects_count. Give each_object_size_width/height to avoid unsituable training ...
4
stack_v2_sparse_classes_30k_train_037101
Implement the Python class `PickleMaker` described below. Class description: Implement the PickleMaker class. Method signatures and docstrings: - def __init__(self, folder_with_objects_fullname_list, expected_objects_count, each_object_size_width=config.TRAIN_OBJECT_WIDTH, each_object_size_height=config.TRAIN_OBJECT_...
Implement the Python class `PickleMaker` described below. Class description: Implement the PickleMaker class. Method signatures and docstrings: - def __init__(self, folder_with_objects_fullname_list, expected_objects_count, each_object_size_width=config.TRAIN_OBJECT_WIDTH, each_object_size_height=config.TRAIN_OBJECT_...
2d7296a4deebb0cd086be34ad7d66f5042cdf6e6
<|skeleton|> class PickleMaker: def __init__(self, folder_with_objects_fullname_list, expected_objects_count, each_object_size_width=config.TRAIN_OBJECT_WIDTH, each_object_size_height=config.TRAIN_OBJECT_HEIGHT, pixel_depth=255.0): """Construct the PickleMaker that can convert objects under folders of fold...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PickleMaker: def __init__(self, folder_with_objects_fullname_list, expected_objects_count, each_object_size_width=config.TRAIN_OBJECT_WIDTH, each_object_size_height=config.TRAIN_OBJECT_HEIGHT, pixel_depth=255.0): """Construct the PickleMaker that can convert objects under folders of folder_with_object...
the_stack_v2_python_sparse
machine_learning/pickle_maker.py
XinyueZ/some-python-codes
train
0
b2e672df28e20bae58e436d87c4e8fa4647d551f
[ "super(mp_conv_residual, self).__init__()\nself.conv1 = torch.nn.Sequential(torch.nn.Conv2d(nin, nmed, 1), SyncBatchNorm(nmed), torch.nn.ReLU(inplace=True))\nself.mp_conv = mp_conv_v2(nmed, nmed, netype, extension=extension)\nself.conv2 = torch.nn.Sequential(torch.nn.Conv2d(nmed, nin, 1), SyncBatchNorm(nin), torch....
<|body_start_0|> super(mp_conv_residual, self).__init__() self.conv1 = torch.nn.Sequential(torch.nn.Conv2d(nin, nmed, 1), SyncBatchNorm(nmed), torch.nn.ReLU(inplace=True)) self.mp_conv = mp_conv_v2(nmed, nmed, netype, extension=extension) self.conv2 = torch.nn.Sequential(torch.nn.Conv2d(...
mp_conv_residual
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mp_conv_residual: def __init__(self, nin, nmed, netype, extension=mp_conv_type.ORIG_WITH_DIFF, with_residual=True, with_hop=False): """Residual block for graph conv network. :param nin: number of input units :param nmed: number of units in the graph conv layer :param netype: number of ed...
stack_v2_sparse_classes_75kplus_train_073493
1,915
permissive
[ { "docstring": "Residual block for graph conv network. :param nin: number of input units :param nmed: number of units in the graph conv layer :param netype: number of edge types :param extension: organization type of edge features :param with_residual: use residual link or not", "name": "__init__", "sig...
2
stack_v2_sparse_classes_30k_train_042154
Implement the Python class `mp_conv_residual` described below. Class description: Implement the mp_conv_residual class. Method signatures and docstrings: - def __init__(self, nin, nmed, netype, extension=mp_conv_type.ORIG_WITH_DIFF, with_residual=True, with_hop=False): Residual block for graph conv network. :param ni...
Implement the Python class `mp_conv_residual` described below. Class description: Implement the mp_conv_residual class. Method signatures and docstrings: - def __init__(self, nin, nmed, netype, extension=mp_conv_type.ORIG_WITH_DIFF, with_residual=True, with_hop=False): Residual block for graph conv network. :param ni...
d7d480aa63d1e69cb94128610ec72938cc7873e8
<|skeleton|> class mp_conv_residual: def __init__(self, nin, nmed, netype, extension=mp_conv_type.ORIG_WITH_DIFF, with_residual=True, with_hop=False): """Residual block for graph conv network. :param nin: number of input units :param nmed: number of units in the graph conv layer :param netype: number of ed...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class mp_conv_residual: def __init__(self, nin, nmed, netype, extension=mp_conv_type.ORIG_WITH_DIFF, with_residual=True, with_hop=False): """Residual block for graph conv network. :param nin: number of input units :param nmed: number of units in the graph conv layer :param netype: number of edge types :para...
the_stack_v2_python_sparse
lib/mpnn/mp_nn_residual.py
richardodliu/Factor-Graph-Neural-Network
train
0
62ab12c509c4f0594b4c7b1dfffa017d440cca99
[ "x = str(x)\nlength = len(x) // 2\nfor i in range(length):\n if x[i] != x[-(i + 1)]:\n return False\n i += 1\nreturn True", "if x < 0:\n return False\ny, z = (x, 0)\nwhile y:\n z = z * 10 + y % 10\n y //= 10\nreturn y == x", "if x < 0:\n return False\nranger = 1\nwhile x / ranger >= 10:...
<|body_start_0|> x = str(x) length = len(x) // 2 for i in range(length): if x[i] != x[-(i + 1)]: return False i += 1 return True <|end_body_0|> <|body_start_1|> if x < 0: return False y, z = (x, 0) while y: ...
给定一个数字,判断是否是回文数。(不能装换成字符串) Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not...
PalindromeNumber
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PalindromeNumber: """给定一个数字,判断是否是回文数。(不能装换成字符串) Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right t...
stack_v2_sparse_classes_75kplus_train_073494
2,017
no_license
[ { "docstring": "装换成字符串方式 :param x: int :rtype: bool", "name": "symb", "signature": "def symb(self, x)" }, { "docstring": "不转换成字符串 :param x: int :rtype: bool", "name": "noConvertToStr", "signature": "def noConvertToStr(self, x)" }, { "docstring": ":type x: int :rtype: bool", "...
3
null
Implement the Python class `PalindromeNumber` described below. Class description: 给定一个数字,判断是否是回文数。(不能装换成字符串) Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From lef...
Implement the Python class `PalindromeNumber` described below. Class description: 给定一个数字,判断是否是回文数。(不能装换成字符串) Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From lef...
7a6de1767eaabb6464ea4c90756606d59b868d7c
<|skeleton|> class PalindromeNumber: """给定一个数字,判断是否是回文数。(不能装换成字符串) Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PalindromeNumber: """给定一个数字,判断是否是回文数。(不能装换成字符串) Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -121 Output: false Explanation: From left to right, it reads -121. From right to left, it be...
the_stack_v2_python_sparse
demo/9.PalindromeNumber.py
symbooo/LeetCodeSymb
train
0
09d707a2eb39c19aa1b140514f7446f8baf7f4c0
[ "for i, (k, hero_id) in enumerate(asdict(self).items()):\n if hero_id == -1:\n continue\n if i < 5:\n faction = 'Radiant'\n else:\n faction = 'Dire'\n if i >= 10:\n faction = ''\n print(f\"{faction:>7} {k}: {const.HERO_LOOKUP.from_offset(hero_id)['pretty_name']}\")", "dr...
<|body_start_0|> for i, (k, hero_id) in enumerate(asdict(self).items()): if hero_id == -1: continue if i < 5: faction = 'Radiant' else: faction = 'Dire' if i >= 10: faction = '' print(f"{f...
Draft struct which represent the drafting state of the game
DraftStatus
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DraftStatus: """Draft struct which represent the drafting state of the game""" def summary(self): """Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane...
stack_v2_sparse_classes_75kplus_train_073495
9,052
permissive
[ { "docstring": "Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane", "name": "summary", "signature": "def summary(self)" }, { "docstring": "Generate a one-hot enco...
2
stack_v2_sparse_classes_30k_train_031369
Implement the Python class `DraftStatus` described below. Class description: Draft struct which represent the drafting state of the game Method signatures and docstrings: - def summary(self): Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Ra...
Implement the Python class `DraftStatus` described below. Class description: Draft struct which represent the drafting state of the game Method signatures and docstrings: - def summary(self): Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Ra...
bd0efd8fc2b064d6bf58993e59a6ad4ac6713b39
<|skeleton|> class DraftStatus: """Draft struct which represent the drafting state of the game""" def summary(self): """Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DraftStatus: """Draft struct which represent the drafting state of the game""" def summary(self): """Examples -------- >>> draft = DraftStatus() >>> draft.Pick4 = 1 >>> draft.Ban01 = 2 >>> draft.Pick5 = 3 >>> draft.summary() Radiant Pick4: Axe Dire Pick5: Bloodseeker Dire Ban01: Bane""" f...
the_stack_v2_python_sparse
luafun/draft.py
Delaunay/dota2env
train
3
83f3204fa991a623d37f90d788c34e45f3827d20
[ "cost_calc = cc.CostCalculator()\ncompressed_model_cost = cost_calc.compute_network_cost(compressed_layers)\nif cost_metric is CostMetric.memory:\n savings = network_cost.memory - compressed_model_cost.memory\n ratio = savings / network_cost.memory\nelse:\n savings = network_cost.mac - compressed_model_cos...
<|body_start_0|> cost_calc = cc.CostCalculator() compressed_model_cost = cost_calc.compute_network_cost(compressed_layers) if cost_metric is CostMetric.memory: savings = network_cost.memory - compressed_model_cost.memory ratio = savings / network_cost.memory else:...
A class for calculating the statistics for a model
ModelStats
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelStats: """A class for calculating the statistics for a model""" def compute_compression_ratio(compressed_layers, cost_metric, network_cost): """Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memo...
stack_v2_sparse_classes_75kplus_train_073496
4,927
permissive
[ { "docstring": "Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memory or mac :param network_cost: mac and memory cost calculated for the entire network :return: It returns the compression ratio for a network", "name": "compu...
3
stack_v2_sparse_classes_30k_train_051987
Implement the Python class `ModelStats` described below. Class description: A class for calculating the statistics for a model Method signatures and docstrings: - def compute_compression_ratio(compressed_layers, cost_metric, network_cost): Computes the compression ratio of a model :param compressed_layers: layers whi...
Implement the Python class `ModelStats` described below. Class description: A class for calculating the statistics for a model Method signatures and docstrings: - def compute_compression_ratio(compressed_layers, cost_metric, network_cost): Computes the compression ratio of a model :param compressed_layers: layers whi...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class ModelStats: """A class for calculating the statistics for a model""" def compute_compression_ratio(compressed_layers, cost_metric, network_cost): """Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelStats: """A class for calculating the statistics for a model""" def compute_compression_ratio(compressed_layers, cost_metric, network_cost): """Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memory or mac :pa...
the_stack_v2_python_sparse
TrainingExtensions/torch/src/python/aimet_torch/svd/model_stats_calculator.py
quic/aimet
train
1,676
b8e410bd007bb3e40d6c70652a925be9743f85c6
[ "current_graph = _ops.get_default_graph()\nassert current_graph, 'A channel is scoped within a tf.Graph'\nself._dtype = dtype\nself._send_device = send_device\nself._recv_device = recv_device\nself._name = current_graph.unique_name(name if name else 'channel')\nassert shape is not None\nshape = _tensor_shape.Tensor...
<|body_start_0|> current_graph = _ops.get_default_graph() assert current_graph, 'A channel is scoped within a tf.Graph' self._dtype = dtype self._send_device = send_device self._recv_device = recv_device self._name = current_graph.unique_name(name if name else 'channel') ...
A communication channel to transfer tensors in order.
Channel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Channel: """A communication channel to transfer tensors in order.""" def __init__(self, dtype, shape, send_device, recv_device, name=None): """Construct a channel. Args: dtype: The dtype of tensors sent through the channel. shape: The shape of tensors sent through the channel. Must b...
stack_v2_sparse_classes_75kplus_train_073497
8,532
permissive
[ { "docstring": "Construct a channel. Args: dtype: The dtype of tensors sent through the channel. shape: The shape of tensors sent through the channel. Must be a fully defined shape for TPUs. send_device: A fully-specified tensorflow device. recv_device: A fully-specified tensorflow device. name: A name for the ...
3
stack_v2_sparse_classes_30k_train_026805
Implement the Python class `Channel` described below. Class description: A communication channel to transfer tensors in order. Method signatures and docstrings: - def __init__(self, dtype, shape, send_device, recv_device, name=None): Construct a channel. Args: dtype: The dtype of tensors sent through the channel. sha...
Implement the Python class `Channel` described below. Class description: A communication channel to transfer tensors in order. Method signatures and docstrings: - def __init__(self, dtype, shape, send_device, recv_device, name=None): Construct a channel. Args: dtype: The dtype of tensors sent through the channel. sha...
2441edc7fee78903502ebd528ab4dc309db0001d
<|skeleton|> class Channel: """A communication channel to transfer tensors in order.""" def __init__(self, dtype, shape, send_device, recv_device, name=None): """Construct a channel. Args: dtype: The dtype of tensors sent through the channel. shape: The shape of tensors sent through the channel. Must b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Channel: """A communication channel to transfer tensors in order.""" def __init__(self, dtype, shape, send_device, recv_device, name=None): """Construct a channel. Args: dtype: The dtype of tensors sent through the channel. shape: The shape of tensors sent through the channel. Must be a fully def...
the_stack_v2_python_sparse
lingvo/core/sendrecv.py
yaq007/lingvo
train
4
a382d535819289cbc09352fc4023e17f6cd869e8
[ "if not nums:\n return\nmax_num = max(nums)\nmax_index = nums.index(max_num)\nroot = TreeNode(max_num)\nroot.left = self.constructMaximumBinaryTree(nums[:max_index])\nroot.right = self.constructMaximumBinaryTree(nums[max_index + 1:])\nreturn root", "stack = []\nleft = None\nroot = None\nnums.append(float('inf'...
<|body_start_0|> if not nums: return max_num = max(nums) max_index = nums.index(max_num) root = TreeNode(max_num) root.left = self.constructMaximumBinaryTree(nums[:max_index]) root.right = self.constructMaximumBinaryTree(nums[max_index + 1:]) return ro...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_0|> def __constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> def ___constructMaximumBinaryTree(self, n...
stack_v2_sparse_classes_75kplus_train_073498
4,039
permissive
[ { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "_constructMaximumBinaryTree", "signature": "def _constructMaximumBinaryTree(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "__constructMaximumBinaryTree", "signature": "def __constructMaxi...
4
stack_v2_sparse_classes_30k_train_031797
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def __constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def _...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def __constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode - def _...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_0|> def __constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> def ___constructMaximumBinaryTree(self, n...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def _constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" if not nums: return max_num = max(nums) max_index = nums.index(max_num) root = TreeNode(max_num) root.left = self.constructMaximumBinaryTree(nums[:max...
the_stack_v2_python_sparse
654.maximum-binary-tree.py
windard/leeeeee
train
0
29f9e77c9dd029e8d3b8fea2a9ea71203365d02a
[ "status = ErrorCode.SUCCESS\ntry:\n tid = self.get_argument('tid')\nexcept Exception as e:\n status = ErrorCode.ILLEGAL_DATA_FORMAT\n logging.exception('[UWEB] Invalid data format. Exception: %s', e.args)\n self.write_ret(status)\n return\ntry:\n res = QueryHelper.get_bind_single(tid, self.db)\n ...
<|body_start_0|> status = ErrorCode.SUCCESS try: tid = self.get_argument('tid') except Exception as e: status = ErrorCode.ILLEGAL_DATA_FORMAT logging.exception('[UWEB] Invalid data format. Exception: %s', e.args) self.write_ret(status) ...
Handle singles-bind for corp. :url /bindsingle
BindSingleHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BindSingleHandler: """Handle singles-bind for corp. :url /bindsingle""" def get(self): """Get all singles binded by the terminal.""" <|body_0|> def post(self): """Handle single bind.""" <|body_1|> <|end_skeleton|> <|body_start_0|> status = Error...
stack_v2_sparse_classes_75kplus_train_073499
2,433
no_license
[ { "docstring": "Get all singles binded by the terminal.", "name": "get", "signature": "def get(self)" }, { "docstring": "Handle single bind.", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `BindSingleHandler` described below. Class description: Handle singles-bind for corp. :url /bindsingle Method signatures and docstrings: - def get(self): Get all singles binded by the terminal. - def post(self): Handle single bind.
Implement the Python class `BindSingleHandler` described below. Class description: Handle singles-bind for corp. :url /bindsingle Method signatures and docstrings: - def get(self): Get all singles binded by the terminal. - def post(self): Handle single bind. <|skeleton|> class BindSingleHandler: """Handle single...
3b095a325581b1fc48497c234f0ad55e928586a1
<|skeleton|> class BindSingleHandler: """Handle singles-bind for corp. :url /bindsingle""" def get(self): """Get all singles binded by the terminal.""" <|body_0|> def post(self): """Handle single bind.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BindSingleHandler: """Handle singles-bind for corp. :url /bindsingle""" def get(self): """Get all singles binded by the terminal.""" status = ErrorCode.SUCCESS try: tid = self.get_argument('tid') except Exception as e: status = ErrorCode.ILLEGAL_DAT...
the_stack_v2_python_sparse
apps/uweb/handlers/bindsingle.py
jcsy521/ydws
train
0