blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
41f2d0fbc2abd71d6dbef70aef3cf10488ee5d60
[ "def _not_none(o):\n return [getattr(o, a) is not None for a in ['scalar', 'image', 'video']]\nexpected = _not_none(list_out[0])\nfor o in list_out[1:]:\n actual = _not_none(o)\n assert np.array_equal(expected, actual)", "EvaluatorOutput._assert_same_attrs(list_out)\nscalars = None\nif list_out[0].scalar...
<|body_start_0|> def _not_none(o): return [getattr(o, a) is not None for a in ['scalar', 'image', 'video']] expected = _not_none(list_out[0]) for o in list_out[1:]: actual = _not_none(o) assert np.array_equal(expected, actual) <|end_body_0|> <|body_start_1|> ...
The output of an evaluator.
EvaluatorOutput
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluatorOutput: """The output of an evaluator.""" def _assert_same_attrs(list_out): """Ensures a list of this class instance have the same attributes.""" <|body_0|> def merge(list_out): """Merge a list of this class instance into one.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_022800
3,670
permissive
[ { "docstring": "Ensures a list of this class instance have the same attributes.", "name": "_assert_same_attrs", "signature": "def _assert_same_attrs(list_out)" }, { "docstring": "Merge a list of this class instance into one.", "name": "merge", "signature": "def merge(list_out)" }, { ...
3
null
Implement the Python class `EvaluatorOutput` described below. Class description: The output of an evaluator. Method signatures and docstrings: - def _assert_same_attrs(list_out): Ensures a list of this class instance have the same attributes. - def merge(list_out): Merge a list of this class instance into one. - def ...
Implement the Python class `EvaluatorOutput` described below. Class description: The output of an evaluator. Method signatures and docstrings: - def _assert_same_attrs(list_out): Ensures a list of this class instance have the same attributes. - def merge(list_out): Merge a list of this class instance into one. - def ...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class EvaluatorOutput: """The output of an evaluator.""" def _assert_same_attrs(list_out): """Ensures a list of this class instance have the same attributes.""" <|body_0|> def merge(list_out): """Merge a list of this class instance into one.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EvaluatorOutput: """The output of an evaluator.""" def _assert_same_attrs(list_out): """Ensures a list of this class instance have the same attributes.""" def _not_none(o): return [getattr(o, a) is not None for a in ['scalar', 'image', 'video']] expected = _not_none(li...
the_stack_v2_python_sparse
xirl/xirl/evaluators/base.py
Jimmy-INL/google-research
train
1
03ea92b7d3a998b9eec90f5254ee8546e829c74b
[ "self.log = logger.getLogger(log_name)\nself.shell = shell.ShellCommands(log_name=log_name)\nself.distro = None\nself.packages_dict = packages_dict\nself.install_process = {'apt': \"apt-get update && apt-get -o Dpkg::Options:='--force-confold' -o Dpkg::Options:='--force-confdef' -y install %s\", 'yum': 'yum -y inst...
<|body_start_0|> self.log = logger.getLogger(log_name) self.shell = shell.ShellCommands(log_name=log_name) self.distro = None self.packages_dict = packages_dict self.install_process = {'apt': "apt-get update && apt-get -o Dpkg::Options:='--force-confold' -o Dpkg::Options:='--forc...
PackageInstaller
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackageInstaller: def __init__(self, packages_dict, log_name=__name__): """Install packages on a local Linux Operating System. :param packages_dict: ``dict`` :param log_name: ``str`` This is used to log against an existing log handler.""" <|body_0|> def _installer(self, pack...
stack_v2_sparse_classes_36k_train_022801
3,299
permissive
[ { "docstring": "Install packages on a local Linux Operating System. :param packages_dict: ``dict`` :param log_name: ``str`` This is used to log against an existing log handler.", "name": "__init__", "signature": "def __init__(self, packages_dict, log_name=__name__)" }, { "docstring": "Install op...
3
stack_v2_sparse_classes_30k_val_001128
Implement the Python class `PackageInstaller` described below. Class description: Implement the PackageInstaller class. Method signatures and docstrings: - def __init__(self, packages_dict, log_name=__name__): Install packages on a local Linux Operating System. :param packages_dict: ``dict`` :param log_name: ``str`` ...
Implement the Python class `PackageInstaller` described below. Class description: Implement the PackageInstaller class. Method signatures and docstrings: - def __init__(self, packages_dict, log_name=__name__): Install packages on a local Linux Operating System. :param packages_dict: ``dict`` :param log_name: ``str`` ...
5038111ce02521caa2558117e3bae9e1e806d315
<|skeleton|> class PackageInstaller: def __init__(self, packages_dict, log_name=__name__): """Install packages on a local Linux Operating System. :param packages_dict: ``dict`` :param log_name: ``str`` This is used to log against an existing log handler.""" <|body_0|> def _installer(self, pack...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackageInstaller: def __init__(self, packages_dict, log_name=__name__): """Install packages on a local Linux Operating System. :param packages_dict: ``dict`` :param log_name: ``str`` This is used to log against an existing log handler.""" self.log = logger.getLogger(log_name) self.shel...
the_stack_v2_python_sparse
cloudlib/package_installer.py
cloudnull/cloudlib
train
0
07a5a08de00dfad9ee22820ed6e10c7b44eca0e9
[ "if len(names) == 0:\n self._leader = None\nelse:\n self._leader = Person(names[0])\n current_person = self._leader\n for name in names[1:]:\n current_person.next = Person(name)\n current_person = current_person.next", "if self._leader is None:\n raise ShortChainError\nelse:\n retu...
<|body_start_0|> if len(names) == 0: self._leader = None else: self._leader = Person(names[0]) current_person = self._leader for name in names[1:]: current_person.next = Person(name) current_person = current_person.next <|en...
A chain of people.
PeopleChain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeopleChain: """A chain of people.""" def __init__(self, names): """Create people linked together in the order provided in <names>. The leader of the chain is the first person in <names>. @type self: PeopleChain @type names: list[str] @rtype: None""" <|body_0|> def get_l...
stack_v2_sparse_classes_36k_train_022802
2,417
no_license
[ { "docstring": "Create people linked together in the order provided in <names>. The leader of the chain is the first person in <names>. @type self: PeopleChain @type names: list[str] @rtype: None", "name": "__init__", "signature": "def __init__(self, names)" }, { "docstring": "Return the name of...
2
stack_v2_sparse_classes_30k_train_021530
Implement the Python class `PeopleChain` described below. Class description: A chain of people. Method signatures and docstrings: - def __init__(self, names): Create people linked together in the order provided in <names>. The leader of the chain is the first person in <names>. @type self: PeopleChain @type names: li...
Implement the Python class `PeopleChain` described below. Class description: A chain of people. Method signatures and docstrings: - def __init__(self, names): Create people linked together in the order provided in <names>. The leader of the chain is the first person in <names>. @type self: PeopleChain @type names: li...
e00ae4246165e031b00cb7be0e9c0c1d60d49a75
<|skeleton|> class PeopleChain: """A chain of people.""" def __init__(self, names): """Create people linked together in the order provided in <names>. The leader of the chain is the first person in <names>. @type self: PeopleChain @type names: list[str] @rtype: None""" <|body_0|> def get_l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PeopleChain: """A chain of people.""" def __init__(self, names): """Create people linked together in the order provided in <names>. The leader of the chain is the first person in <names>. @type self: PeopleChain @type names: list[str] @rtype: None""" if len(names) == 0: self._...
the_stack_v2_python_sparse
python_class_proj/pycharm/csc148/exercises/ex2/tsets.py
Mohan-Zhang-u/From_UofT
train
0
6e93b97043bbea1c2bb82f67cd3013ef7c0e9b5a
[ "if not root:\n return '[]'\nresult = [root.val]\nq = collections.deque([root])\nwhile q:\n front = q.popleft()\n if front.left:\n q.append(front.left)\n if front.right:\n q.append(front.right)\n result.append(front.left.val if front.left else 'null')\n result.append(front.right.val ...
<|body_start_0|> if not root: return '[]' result = [root.val] q = collections.deque([root]) while q: front = q.popleft() if front.left: q.append(front.left) if front.right: q.append(front.right) r...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022803
1,789
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
dc47ee290352473d28243b43ec6f0e5b6bdec828
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '[]' result = [root.val] q = collections.deque([root]) while q: front = q.popleft() if front.left: ...
the_stack_v2_python_sparse
Top Interview Questions/Medium Collection/Design/Serialize and Deserialize Binary Tree.py
probaku1234/LeetCodeAlgorithmSolution
train
0
a6dd249bf13e529ec0ab7caf68571e9f2d57ad46
[ "super().__init__()\nself.in_channels = in_channels\nself.hidden_channels = hidden_channels\npadding = (kernel_size // 2, kernel_size // 2)\nkernel_size = (kernel_size, kernel_size)\nself.conv_x = nn.Conv2d(in_channels=in_channels, out_channels=hidden_channels * 2, kernel_size=kernel_size, padding=padding, stride=(...
<|body_start_0|> super().__init__() self.in_channels = in_channels self.hidden_channels = hidden_channels padding = (kernel_size // 2, kernel_size // 2) kernel_size = (kernel_size, kernel_size) self.conv_x = nn.Conv2d(in_channels=in_channels, out_channels=hidden_channels ...
GradientHighwayUnit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientHighwayUnit: def __init__(self, in_channels: int, hidden_channels: int, kernel_size: int): """:param in_channels: 输入通道 :param hidden_channels: 状态通道 :param kernel_size: 卷积核""" <|body_0|> def forward(self, x: Tensor, z: Tensor) -> Tensor: """:param x: 输入的 Tenso...
stack_v2_sparse_classes_36k_train_022804
1,896
permissive
[ { "docstring": ":param in_channels: 输入通道 :param hidden_channels: 状态通道 :param kernel_size: 卷积核", "name": "__init__", "signature": "def __init__(self, in_channels: int, hidden_channels: int, kernel_size: int)" }, { "docstring": ":param x: 输入的 Tensor :param z: GHU 的状态 Tensor :return: z", "name"...
2
stack_v2_sparse_classes_30k_train_019093
Implement the Python class `GradientHighwayUnit` described below. Class description: Implement the GradientHighwayUnit class. Method signatures and docstrings: - def __init__(self, in_channels: int, hidden_channels: int, kernel_size: int): :param in_channels: 输入通道 :param hidden_channels: 状态通道 :param kernel_size: 卷积核 ...
Implement the Python class `GradientHighwayUnit` described below. Class description: Implement the GradientHighwayUnit class. Method signatures and docstrings: - def __init__(self, in_channels: int, hidden_channels: int, kernel_size: int): :param in_channels: 输入通道 :param hidden_channels: 状态通道 :param kernel_size: 卷积核 ...
d8079d6ceb3a41a06552bb3d88298327d0645d57
<|skeleton|> class GradientHighwayUnit: def __init__(self, in_channels: int, hidden_channels: int, kernel_size: int): """:param in_channels: 输入通道 :param hidden_channels: 状态通道 :param kernel_size: 卷积核""" <|body_0|> def forward(self, x: Tensor, z: Tensor) -> Tensor: """:param x: 输入的 Tenso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradientHighwayUnit: def __init__(self, in_channels: int, hidden_channels: int, kernel_size: int): """:param in_channels: 输入通道 :param hidden_channels: 状态通道 :param kernel_size: 卷积核""" super().__init__() self.in_channels = in_channels self.hidden_channels = hidden_channels ...
the_stack_v2_python_sparse
study/models/PredRNNpp/GradientHighwayUnit.py
hechentao/STudy
train
0
83569443e35a57b8a489b7b74e4b49760d2ae5da
[ "self.x = input\nself.y = label\nself.sigmoid_layers = []\nself.rbm_layers = []\nself.n_layers = len(hidden_layer_size)\nif rng == None:\n rng = np.random.RandomState(111)\nassert self.n_layers > 0\nfor i in range(self.n_layers):\n if i == 0:\n input_size = n_ins\n else:\n input_size = hidden...
<|body_start_0|> self.x = input self.y = label self.sigmoid_layers = [] self.rbm_layers = [] self.n_layers = len(hidden_layer_size) if rng == None: rng = np.random.RandomState(111) assert self.n_layers > 0 for i in range(self.n_layers): ...
深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。
DBN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DBN: """深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。""" def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None): """:...
stack_v2_sparse_classes_36k_train_022805
5,851
no_license
[ { "docstring": ":param input: 输入数据的属性 :param label: 输入数据的标签 :param n_ins: 输入层, 数据属性的数量 :param hidden_layer_size: :param n_out: 输出层,总共要输出几个标签 :param rng: 随机数发生器", "name": "__init__", "signature": "def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_012413
Implement the Python class `DBN` described below. Class description: 深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。 Method signatures and docstrings: - def __init__(self, input=None, label=None,...
Implement the Python class `DBN` described below. Class description: 深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。 Method signatures and docstrings: - def __init__(self, input=None, label=None,...
8fda025b7fea0fd4ad9e9fafd4736f75ec452b2f
<|skeleton|> class DBN: """深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。""" def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None): """:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DBN: """深度置信网络 几个问题:为什么引入sigmoid层(隐层),这是一个MLP和RBMs共存的网络,我们在训练RBMs的同时得到的更新参数值是与MLP共享的,即我们 其实是采用无监督预训练层层的RBM得到的参数,其实的得到的就是MLP的参数,然后最后再接一个Logstic层,用于做监督学习的,然 后再利用的finetune的方式微调一下参数。""" def __init__(self, input=None, label=None, n_ins=2, hidden_layer_size=[3, 3], n_out=2, rng=None): """:param input: ...
the_stack_v2_python_sparse
Deep_learning/Simplify_model/DBN.py
chunchunya/machine_learning_algorithms
train
0
15798e43839f90647b603e93dde540c9b0a761b8
[ "self.sid = sid\nself.uid = uid.encode()\nself.ch_type = channel_type\nself.cb_obj = callback_obj\nself.ip = ip\nself.port = int(port)\nself.udp_timeout = timeout\nself.tcp_timeout = timeout * 5\nself.tx = init_tx\nself.chunks_size = chunks_size\nself.cap = 2 ** 31\nself.loop = asyncio.get_event_loop()\nself.udp = ...
<|body_start_0|> self.sid = sid self.uid = uid.encode() self.ch_type = channel_type self.cb_obj = callback_obj self.ip = ip self.port = int(port) self.udp_timeout = timeout self.tcp_timeout = timeout * 5 self.tx = init_tx self.chunks_size =...
Creates an instance of a sender channel
SenderChannel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SenderChannel: """Creates an instance of a sender channel""" def __init__(self, sid, uid, channel_type, callback_obj, ip, port, timeout=2, init_tx=None, chunks_size=1024): """Define all parameters that is specific to this channel""" <|body_0|> async def receive(self, tok...
stack_v2_sparse_classes_36k_train_022806
6,029
permissive
[ { "docstring": "Define all parameters that is specific to this channel", "name": "__init__", "signature": "def __init__(self, sid, uid, channel_type, callback_obj, ip, port, timeout=2, init_tx=None, chunks_size=1024)" }, { "docstring": "Waits for data on either tcp or udp port to be received and...
6
stack_v2_sparse_classes_30k_train_007040
Implement the Python class `SenderChannel` described below. Class description: Creates an instance of a sender channel Method signatures and docstrings: - def __init__(self, sid, uid, channel_type, callback_obj, ip, port, timeout=2, init_tx=None, chunks_size=1024): Define all parameters that is specific to this chann...
Implement the Python class `SenderChannel` described below. Class description: Creates an instance of a sender channel Method signatures and docstrings: - def __init__(self, sid, uid, channel_type, callback_obj, ip, port, timeout=2, init_tx=None, chunks_size=1024): Define all parameters that is specific to this chann...
c44b71b782afcae360fb3ed90b1d43da78eae338
<|skeleton|> class SenderChannel: """Creates an instance of a sender channel""" def __init__(self, sid, uid, channel_type, callback_obj, ip, port, timeout=2, init_tx=None, chunks_size=1024): """Define all parameters that is specific to this channel""" <|body_0|> async def receive(self, tok...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SenderChannel: """Creates an instance of a sender channel""" def __init__(self, sid, uid, channel_type, callback_obj, ip, port, timeout=2, init_tx=None, chunks_size=1024): """Define all parameters that is specific to this channel""" self.sid = sid self.uid = uid.encode() s...
the_stack_v2_python_sparse
self-stabilizing-coded-atomic-storage/code/channel/SenderChannel.py
eladschiller/self-stabilizing-cloud
train
0
19061058277b741103d22274c44cc76a4c9ff706
[ "self.InstanceModel = calls.Call.all()\nself.AllowedMethods = ['GET']\nself.AllowedFilters = {'GET': [['To', '='], ['From', '='], ['Status', '='], ['StartTime', '='], ['EndTime', '=']]}\nself.ListName = 'Calls'\nself.InstanceModelName = 'Call'", "format = response.response_format(self.request.path.split('/')[-1])...
<|body_start_0|> self.InstanceModel = calls.Call.all() self.AllowedMethods = ['GET'] self.AllowedFilters = {'GET': [['To', '='], ['From', '='], ['Status', '='], ['StartTime', '='], ['EndTime', '=']]} self.ListName = 'Calls' self.InstanceModelName = 'Call' <|end_body_0|> <|body_s...
CallList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CallList: def __init__(self): """To Only show calls to this phone number. From Only show calls from this phone number. Status Only show calls currently in this status. May be queued, ringing, in-progress, completed, failed, busy, or no-answer. StartTime Only show calls that started on th...
stack_v2_sparse_classes_36k_train_022807
7,459
no_license
[ { "docstring": "To Only show calls to this phone number. From Only show calls from this phone number. Status Only show calls currently in this status. May be queued, ringing, in-progress, completed, failed, busy, or no-answer. StartTime Only show calls that started on this date, given as YYYY-MM-DD. Also suppor...
2
stack_v2_sparse_classes_30k_train_011273
Implement the Python class `CallList` described below. Class description: Implement the CallList class. Method signatures and docstrings: - def __init__(self): To Only show calls to this phone number. From Only show calls from this phone number. Status Only show calls currently in this status. May be queued, ringing,...
Implement the Python class `CallList` described below. Class description: Implement the CallList class. Method signatures and docstrings: - def __init__(self): To Only show calls to this phone number. From Only show calls from this phone number. Status Only show calls currently in this status. May be queued, ringing,...
857f919d9190aceb1273ea5b357e6eeef1a0d36f
<|skeleton|> class CallList: def __init__(self): """To Only show calls to this phone number. From Only show calls from this phone number. Status Only show calls currently in this status. May be queued, ringing, in-progress, completed, failed, busy, or no-answer. StartTime Only show calls that started on th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CallList: def __init__(self): """To Only show calls to this phone number. From Only show calls from this phone number. Status Only show calls currently in this status. May be queued, ringing, in-progress, completed, failed, busy, or no-answer. StartTime Only show calls that started on this date, given...
the_stack_v2_python_sparse
handlers/calls.py
youngj/Fake-Twilio-Api
train
0
2b21ef1c80899255fdce4476aa5fdea9999f2482
[ "parityBitOdd = Parity.Field('odd')\nparityBitOdd.setData(0)\nself.assertEqual(parityBitOdd.pack(), 1 << 31, 'Parity Not Calculated Properly')\nparityBitEven = Parity.Field('even')\nparityBitEven.setData(0)\nself.assertEqual(parityBitEven.pack(), 0, 'Parity Not Calculated Properly')", "parityBitOdd = Parity.Field...
<|body_start_0|> parityBitOdd = Parity.Field('odd') parityBitOdd.setData(0) self.assertEqual(parityBitOdd.pack(), 1 << 31, 'Parity Not Calculated Properly') parityBitEven = Parity.Field('even') parityBitEven.setData(0) self.assertEqual(parityBitEven.pack(), 0, 'Parity Not...
Test Parity Pack/Unpack Algorithm
testParity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class testParity: """Test Parity Pack/Unpack Algorithm""" def testEmptyMessage(self): """Verify Case of no bit set in message""" <|body_0|> def testFullMessage(self): """Verify Case of all bits set in message""" <|body_1|> def testAFewCases(self): ...
stack_v2_sparse_classes_36k_train_022808
5,073
permissive
[ { "docstring": "Verify Case of no bit set in message", "name": "testEmptyMessage", "signature": "def testEmptyMessage(self)" }, { "docstring": "Verify Case of all bits set in message", "name": "testFullMessage", "signature": "def testFullMessage(self)" }, { "docstring": "Further ...
5
stack_v2_sparse_classes_30k_train_019054
Implement the Python class `testParity` described below. Class description: Test Parity Pack/Unpack Algorithm Method signatures and docstrings: - def testEmptyMessage(self): Verify Case of no bit set in message - def testFullMessage(self): Verify Case of all bits set in message - def testAFewCases(self): Further test...
Implement the Python class `testParity` described below. Class description: Test Parity Pack/Unpack Algorithm Method signatures and docstrings: - def testEmptyMessage(self): Verify Case of no bit set in message - def testFullMessage(self): Verify Case of all bits set in message - def testAFewCases(self): Further test...
077c979c7eb2aae206f6052c2a67e68ecc5b35a8
<|skeleton|> class testParity: """Test Parity Pack/Unpack Algorithm""" def testEmptyMessage(self): """Verify Case of no bit set in message""" <|body_0|> def testFullMessage(self): """Verify Case of all bits set in message""" <|body_1|> def testAFewCases(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class testParity: """Test Parity Pack/Unpack Algorithm""" def testEmptyMessage(self): """Verify Case of no bit set in message""" parityBitOdd = Parity.Field('odd') parityBitOdd.setData(0) self.assertEqual(parityBitOdd.pack(), 1 << 31, 'Parity Not Calculated Properly') pa...
the_stack_v2_python_sparse
ARINC429/UnitTests/ParityTest.py
superliujian/Py429
train
1
f7402382a1e976e698070e4b78a43590d06b4a90
[ "receptor_mixin_instance = receptor_template_class()\nreceptor_mixin_instance.CANONIC_DOMAIN = domain_of_values_synsets.keys()\nreceptor_mixin_instance.synsets = domain_of_values_synsets\nreceptor_mixin_instance.flat_norm = ReceptorFactory.synsets_to_flat_norm_index(domain_of_values_synsets)\nreturn receptor_mixin_...
<|body_start_0|> receptor_mixin_instance = receptor_template_class() receptor_mixin_instance.CANONIC_DOMAIN = domain_of_values_synsets.keys() receptor_mixin_instance.synsets = domain_of_values_synsets receptor_mixin_instance.flat_norm = ReceptorFactory.synsets_to_flat_norm_index(domain_o...
Constructs a pair of receptor function (SlotReceptorMixin) + domain of allowed values
ReceptorFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReceptorFactory: """Constructs a pair of receptor function (SlotReceptorMixin) + domain of allowed values""" def make_receptor(cls, receptor_template_class, domain_of_values_synsets): """Constructs a Receptor Instance which may be mixed into slot declaration :param receptor_template_...
stack_v2_sparse_classes_36k_train_022809
16,105
no_license
[ { "docstring": "Constructs a Receptor Instance which may be mixed into slot declaration :param receptor_template_class: :param domain_of_values_synsets: :return:", "name": "make_receptor", "signature": "def make_receptor(cls, receptor_template_class, domain_of_values_synsets)" }, { "docstring": ...
2
stack_v2_sparse_classes_30k_train_016652
Implement the Python class `ReceptorFactory` described below. Class description: Constructs a pair of receptor function (SlotReceptorMixin) + domain of allowed values Method signatures and docstrings: - def make_receptor(cls, receptor_template_class, domain_of_values_synsets): Constructs a Receptor Instance which may...
Implement the Python class `ReceptorFactory` described below. Class description: Constructs a pair of receptor function (SlotReceptorMixin) + domain of allowed values Method signatures and docstrings: - def make_receptor(cls, receptor_template_class, domain_of_values_synsets): Constructs a Receptor Instance which may...
7a0bc78ca03ee8ca1202e8ad2a6860444f0ce75d
<|skeleton|> class ReceptorFactory: """Constructs a pair of receptor function (SlotReceptorMixin) + domain of allowed values""" def make_receptor(cls, receptor_template_class, domain_of_values_synsets): """Constructs a Receptor Instance which may be mixed into slot declaration :param receptor_template_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReceptorFactory: """Constructs a pair of receptor function (SlotReceptorMixin) + domain of allowed values""" def make_receptor(cls, receptor_template_class, domain_of_values_synsets): """Constructs a Receptor Instance which may be mixed into slot declaration :param receptor_template_class: :param...
the_stack_v2_python_sparse
hello_bot/components/slots/slots.py
acriptis/dj_bot
train
3
fc1a0f521c4f55b68a385a0d806fa03b6f149374
[ "super().__init__(**kwargs)\nself.exists = exists\nself.startdir = startdir", "value = super()._validate(cfg, value)\nif not value:\n return value\nif not os.path.isabs(value) and self.startdir:\n value = os.path.abspath(os.path.expanduser(os.path.join(self.startdir, value)))\nif os.path.sep == '\\\\':\n ...
<|body_start_0|> super().__init__(**kwargs) self.exists = exists self.startdir = startdir <|end_body_0|> <|body_start_1|> value = super()._validate(cfg, value) if not value: return value if not os.path.isabs(value) and self.startdir: value = os.pa...
A field for representing a filename on disk.
FilenameField
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilenameField: """A field for representing a filename on disk.""" def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): """The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - `...
stack_v2_sparse_classes_36k_train_022810
2,849
permissive
[ { "docstring": "The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - ``False`` - validate that the filename does not exist - ``True`` - validate that the filename does exist - ``\"dir\"`` - validate that the filename is a directory that exists - ``\"file\...
2
stack_v2_sparse_classes_30k_train_016737
Implement the Python class `FilenameField` described below. Class description: A field for representing a filename on disk. Method signatures and docstrings: - def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): The *exists* parameter can be set to one of the follow...
Implement the Python class `FilenameField` described below. Class description: A field for representing a filename on disk. Method signatures and docstrings: - def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): The *exists* parameter can be set to one of the follow...
1499ff8f00a43a592571a10666823e125d5fbc49
<|skeleton|> class FilenameField: """A field for representing a filename on disk.""" def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): """The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - `...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilenameField: """A field for representing a filename on disk.""" def __init__(self, *, exists: Optional[Union[bool, str]]=None, startdir: Optional[str]=None, **kwargs): """The *exists* parameter can be set to one of the following values: - ``None`` - don't check file's existence - ``False`` - va...
the_stack_v2_python_sparse
cincoconfig/fields/file_field.py
ameily/cincoconfig
train
6
e2063b4154f217d2ff5041f56af8865f22ccaa65
[ "challenges: List[Dict[str, Any]] = []\nchallenges = WeeklyChallengesBR.Table(self, challenges)\nUtility.WriteFile(self, f'{self.eXAssets}/weeklyChallengesBR.json', challenges)\nlog.info(f'Compiled {len(challenges):,} Weekly Battle Royale Challenges')", "table: List[Dict[str, Any]] = Utility.ReadCSV(self, f'{self...
<|body_start_0|> challenges: List[Dict[str, Any]] = [] challenges = WeeklyChallengesBR.Table(self, challenges) Utility.WriteFile(self, f'{self.eXAssets}/weeklyChallengesBR.json', challenges) log.info(f'Compiled {len(challenges):,} Weekly Battle Royale Challenges') <|end_body_0|> <|body_...
Weekly Battle Royale Challenges XAssets.
WeeklyChallengesBR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeeklyChallengesBR: """Weekly Battle Royale Challenges XAssets.""" def Compile(self: Any) -> None: """Compile the Weekly Battle Royale Challenges XAssets.""" <|body_0|> def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Compile the...
stack_v2_sparse_classes_36k_train_022811
13,794
permissive
[ { "docstring": "Compile the Weekly Battle Royale Challenges XAssets.", "name": "Compile", "signature": "def Compile(self: Any) -> None" }, { "docstring": "Compile the br_weekly_challenges.csv XAsset.", "name": "Table", "signature": "def Table(self: Any, challenges: List[Dict[str, Any]]) ...
2
stack_v2_sparse_classes_30k_train_010259
Implement the Python class `WeeklyChallengesBR` described below. Class description: Weekly Battle Royale Challenges XAssets. Method signatures and docstrings: - def Compile(self: Any) -> None: Compile the Weekly Battle Royale Challenges XAssets. - def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[st...
Implement the Python class `WeeklyChallengesBR` described below. Class description: Weekly Battle Royale Challenges XAssets. Method signatures and docstrings: - def Compile(self: Any) -> None: Compile the Weekly Battle Royale Challenges XAssets. - def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[st...
82d3198a64eb2905e96dd536ce2f0acb52f9ce77
<|skeleton|> class WeeklyChallengesBR: """Weekly Battle Royale Challenges XAssets.""" def Compile(self: Any) -> None: """Compile the Weekly Battle Royale Challenges XAssets.""" <|body_0|> def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Compile the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeeklyChallengesBR: """Weekly Battle Royale Challenges XAssets.""" def Compile(self: Any) -> None: """Compile the Weekly Battle Royale Challenges XAssets.""" challenges: List[Dict[str, Any]] = [] challenges = WeeklyChallengesBR.Table(self, challenges) Utility.WriteFile(sel...
the_stack_v2_python_sparse
ModernWarfare/XAssets/challenges.py
dbuentello/Hyde
train
0
66dd28e44b76347bfa348687a783a2a7da5f63de
[ "time = timezone.now() + datetime.timedelta(days=30)\nfuture_question = Question(pub_date=time)\nself.assertIs(future_question.was_published_recently(), False)", "time = timezone.now() - datetime.timedelta(days=1, seconds=1)\nold_question = Question(pub_date=time)\nself.assertIs(old_question.was_published_recentl...
<|body_start_0|> time = timezone.now() + datetime.timedelta(days=30) future_question = Question(pub_date=time) self.assertIs(future_question.was_published_recently(), False) <|end_body_0|> <|body_start_1|> time = timezone.now() - datetime.timedelta(days=1, seconds=1) old_questio...
QuestionModelTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuestionModelTests: def test_was_pub_recently_with_future_question(self): """was_published_recently() returns False for questions whose pub_date is in the future.""" <|body_0|> def test_was_pub_recently_with_old_question(self): """was_published_recently() returns Fal...
stack_v2_sparse_classes_36k_train_022812
935
no_license
[ { "docstring": "was_published_recently() returns False for questions whose pub_date is in the future.", "name": "test_was_pub_recently_with_future_question", "signature": "def test_was_pub_recently_with_future_question(self)" }, { "docstring": "was_published_recently() returns False for question...
2
stack_v2_sparse_classes_30k_train_006929
Implement the Python class `QuestionModelTests` described below. Class description: Implement the QuestionModelTests class. Method signatures and docstrings: - def test_was_pub_recently_with_future_question(self): was_published_recently() returns False for questions whose pub_date is in the future. - def test_was_pub...
Implement the Python class `QuestionModelTests` described below. Class description: Implement the QuestionModelTests class. Method signatures and docstrings: - def test_was_pub_recently_with_future_question(self): was_published_recently() returns False for questions whose pub_date is in the future. - def test_was_pub...
86e2c4a48d7a23aba03900510ea06e812b008347
<|skeleton|> class QuestionModelTests: def test_was_pub_recently_with_future_question(self): """was_published_recently() returns False for questions whose pub_date is in the future.""" <|body_0|> def test_was_pub_recently_with_old_question(self): """was_published_recently() returns Fal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuestionModelTests: def test_was_pub_recently_with_future_question(self): """was_published_recently() returns False for questions whose pub_date is in the future.""" time = timezone.now() + datetime.timedelta(days=30) future_question = Question(pub_date=time) self.assertIs(futu...
the_stack_v2_python_sparse
polls/tests.py
deepakgd/django-pratice
train
0
e7f9a0ea9d8d9d000acfc82d06edff6487b404b2
[ "super(CaseFeature, self).__init__(self.__get_str_case_for_token, '_case')\nself.tagset = corpus2.get_named_tagset(tagset_str)\nself.mask = self.tagset.parse_symbol(mask_symbol)", "token = ud.syntax_relation.np_adjp_phrase().annotated_sentence().tokens()[ud.syntax_relation.np_adjp_phrase().segments()[tok_pos]]\nt...
<|body_start_0|> super(CaseFeature, self).__init__(self.__get_str_case_for_token, '_case') self.tagset = corpus2.get_named_tagset(tagset_str) self.mask = self.tagset.parse_symbol(mask_symbol) <|end_body_0|> <|body_start_1|> token = ud.syntax_relation.np_adjp_phrase().annotated_sentence(...
Ekstraktor przypadka dla elementow relacji semantycznej
CaseFeature
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseFeature: """Ekstraktor przypadka dla elementow relacji semantycznej""" def __init__(self, tagset_str='nkjp', mask_symbol='cas'): """mask_symbol - depends on the tagset type - for nkjp is 'cas'""" <|body_0|> def __get_str_case_for_token(self, ud, tok_pos): """...
stack_v2_sparse_classes_36k_train_022813
992
no_license
[ { "docstring": "mask_symbol - depends on the tagset type - for nkjp is 'cas'", "name": "__init__", "signature": "def __init__(self, tagset_str='nkjp', mask_symbol='cas')" }, { "docstring": "Zwraca przypadek w postaci stringa ud - decyzja uzytkownika tok_pos - pozycja tokenu wzgledem poczatku fra...
2
stack_v2_sparse_classes_30k_train_019956
Implement the Python class `CaseFeature` described below. Class description: Ekstraktor przypadka dla elementow relacji semantycznej Method signatures and docstrings: - def __init__(self, tagset_str='nkjp', mask_symbol='cas'): mask_symbol - depends on the tagset type - for nkjp is 'cas' - def __get_str_case_for_token...
Implement the Python class `CaseFeature` described below. Class description: Ekstraktor przypadka dla elementow relacji semantycznej Method signatures and docstrings: - def __init__(self, tagset_str='nkjp', mask_symbol='cas'): mask_symbol - depends on the tagset type - for nkjp is 'cas' - def __get_str_case_for_token...
01b4412246c877eb30c82cefa3f2ec0b05612f9c
<|skeleton|> class CaseFeature: """Ekstraktor przypadka dla elementow relacji semantycznej""" def __init__(self, tagset_str='nkjp', mask_symbol='cas'): """mask_symbol - depends on the tagset type - for nkjp is 'cas'""" <|body_0|> def __get_str_case_for_token(self, ud, tok_pos): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CaseFeature: """Ekstraktor przypadka dla elementow relacji semantycznej""" def __init__(self, tagset_str='nkjp', mask_symbol='cas'): """mask_symbol - depends on the tagset type - for nkjp is 'cas'""" super(CaseFeature, self).__init__(self.__get_str_case_for_token, '_case') self.ta...
the_stack_v2_python_sparse
npsemrel/npsemrel/ml/features/syntax/case.py
Barkar19/wsd-nlp
train
0
33a2ac08dc9e84c9c63506f28e21e09c483995ca
[ "for field in self.model._meta.get_fields():\n if hasattr(field, 'related_model') and issubclass(field.related_model, Fitting):\n return field.related_model._meta.model_name", "if not issubclass(self.model, Condenser):\n raise TypeError('model must be a type of condenser')\nchoices = ()\nquery = self...
<|body_start_0|> for field in self.model._meta.get_fields(): if hasattr(field, 'related_model') and issubclass(field.related_model, Fitting): return field.related_model._meta.model_name <|end_body_0|> <|body_start_1|> if not issubclass(self.model, Condenser): rai...
Defines autocomplete rules for target_field on a Fitting admin page.
FilterTargetFieldsByCondenser
[ "LicenseRef-scancode-proprietary-license", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilterTargetFieldsByCondenser: """Defines autocomplete rules for target_field on a Fitting admin page.""" def fitting(self): """Returns the model_name of the Conderser's Fitting.""" <|body_0|> def choices_for_request(self): """Filters target_field options based o...
stack_v2_sparse_classes_36k_train_022814
4,745
permissive
[ { "docstring": "Returns the model_name of the Conderser's Fitting.", "name": "fitting", "signature": "def fitting(self)" }, { "docstring": "Filters target_field options based on a selected Bottle/Condenser and previously selected target_fields.", "name": "choices_for_request", "signature...
2
null
Implement the Python class `FilterTargetFieldsByCondenser` described below. Class description: Defines autocomplete rules for target_field on a Fitting admin page. Method signatures and docstrings: - def fitting(self): Returns the model_name of the Conderser's Fitting. - def choices_for_request(self): Filters target_...
Implement the Python class `FilterTargetFieldsByCondenser` described below. Class description: Defines autocomplete rules for target_field on a Fitting admin page. Method signatures and docstrings: - def fitting(self): Returns the model_name of the Conderser's Fitting. - def choices_for_request(self): Filters target_...
a379a134c0c5af14df4ed2afa066c1626506b754
<|skeleton|> class FilterTargetFieldsByCondenser: """Defines autocomplete rules for target_field on a Fitting admin page.""" def fitting(self): """Returns the model_name of the Conderser's Fitting.""" <|body_0|> def choices_for_request(self): """Filters target_field options based o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilterTargetFieldsByCondenser: """Defines autocomplete rules for target_field on a Fitting admin page.""" def fitting(self): """Returns the model_name of the Conderser's Fitting.""" for field in self.model._meta.get_fields(): if hasattr(field, 'related_model') and issubclass(f...
the_stack_v2_python_sparse
Incident-Response/Tools/cyphon/cyphon/sifter/condensers/autocomplete.py
foss2cyber/Incident-Playbook
train
1
45262da79ecc757b5e51e116c36bbc7fb3e4d3b2
[ "super().__init__(**kwargs)\nself.authtoken = validate_regex(authtoken)\nif not self.authtoken:\n msg = 'An invalid Faast Authentication Token ({}) was specified.'.format(authtoken)\n self.logger.warning(msg)\n raise TypeError(msg)\nself.include_image = include_image\nreturn", "headers = {'User-Agent': s...
<|body_start_0|> super().__init__(**kwargs) self.authtoken = validate_regex(authtoken) if not self.authtoken: msg = 'An invalid Faast Authentication Token ({}) was specified.'.format(authtoken) self.logger.warning(msg) raise TypeError(msg) self.include...
A wrapper for Faast Notifications
NotifyFaast
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotifyFaast: """A wrapper for Faast Notifications""" def __init__(self, authtoken, include_image=True, **kwargs): """Initialize Faast Object""" <|body_0|> def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """Perform Faast Notification""" ...
stack_v2_sparse_classes_36k_train_022815
7,177
permissive
[ { "docstring": "Initialize Faast Object", "name": "__init__", "signature": "def __init__(self, authtoken, include_image=True, **kwargs)" }, { "docstring": "Perform Faast Notification", "name": "send", "signature": "def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs)" ...
4
null
Implement the Python class `NotifyFaast` described below. Class description: A wrapper for Faast Notifications Method signatures and docstrings: - def __init__(self, authtoken, include_image=True, **kwargs): Initialize Faast Object - def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): Perform Faast...
Implement the Python class `NotifyFaast` described below. Class description: A wrapper for Faast Notifications Method signatures and docstrings: - def __init__(self, authtoken, include_image=True, **kwargs): Initialize Faast Object - def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): Perform Faast...
be3baed7e3d33bae973f1714df4ebbf65aa33f85
<|skeleton|> class NotifyFaast: """A wrapper for Faast Notifications""" def __init__(self, authtoken, include_image=True, **kwargs): """Initialize Faast Object""" <|body_0|> def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """Perform Faast Notification""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotifyFaast: """A wrapper for Faast Notifications""" def __init__(self, authtoken, include_image=True, **kwargs): """Initialize Faast Object""" super().__init__(**kwargs) self.authtoken = validate_regex(authtoken) if not self.authtoken: msg = 'An invalid Faast ...
the_stack_v2_python_sparse
apprise/plugins/NotifyFaast.py
caronc/apprise
train
8,426
cf46d268daf11fc3cb0caeba175306d955a6c142
[ "for i in range(len(lists) - 1, -1, -1):\n if lists[i] is None:\n lists.pop(i)\nif len(lists) == 0:\n return lists\nwhile len(lists) > 1:\n newlist = [self.merge2Lists(lists[2 * i], lists[2 * i + 1]) for i in range(len(lists) / 2)]\n if len(lists) % 2 != 0:\n newlist.append(lists[-1])\n ...
<|body_start_0|> for i in range(len(lists) - 1, -1, -1): if lists[i] is None: lists.pop(i) if len(lists) == 0: return lists while len(lists) > 1: newlist = [self.merge2Lists(lists[2 * i], lists[2 * i + 1]) for i in range(len(lists) / 2)] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def merge2Lists(self, listA, listB): """:type lists: List[ListNode] :rtype: ListNode : merge two sorted lists and return a sorted list Node""" <|body_1|> <|...
stack_v2_sparse_classes_36k_train_022816
1,575
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode : merge two sorted lists and return a sorted list Node", "name": "merge2Lists", "signature": "...
2
stack_v2_sparse_classes_30k_train_019373
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def merge2Lists(self, listA, listB): :type lists: List[ListNode] :rtype: ListNode : merge two sorted ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def merge2Lists(self, listA, listB): :type lists: List[ListNode] :rtype: ListNode : merge two sorted ...
59de9ba6620c64efbd2cc0aab8c22a82b2c0df21
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def merge2Lists(self, listA, listB): """:type lists: List[ListNode] :rtype: ListNode : merge two sorted lists and return a sorted list Node""" <|body_1|> <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" for i in range(len(lists) - 1, -1, -1): if lists[i] is None: lists.pop(i) if len(lists) == 0: return lists while len(lists) > 1: newlis...
the_stack_v2_python_sparse
leet23.py
shach934/leetcode
train
0
fd9c87a41a3c0b049ef3bd5c2e960f248cbd6960
[ "self.tree = KDTree(x, leafsize=leafsize)\nself.x = x\nself.nnear = nnear", "node_xy = np.asarray(node_xy)\nqdim = node_xy.ndim\nif qdim == 1:\n node_xy = np.array([node_xy])\nself.distances, self.ix = self.tree.query(node_xy, k=self.nnear, eps=eps)\nw = 1 / self.distances ** p\nif weights is not None:\n w ...
<|body_start_0|> self.tree = KDTree(x, leafsize=leafsize) self.x = x self.nnear = nnear <|end_body_0|> <|body_start_1|> node_xy = np.asarray(node_xy) qdim = node_xy.ndim if qdim == 1: node_xy = np.array([node_xy]) self.distances, self.ix = self.tree.q...
Inverse-distance-weighted interpolation using KDTree Examples -------- tree = interp_2d.Invdisttree(obs_xy) # initialize KDTree with observational points tree.weights(node_xy) # calculate weights for each node. values_v = tree.interp(obs.temperature.values) # perform spatial interpolation with the calculated weights fr...
Invdisttree
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Invdisttree: """Inverse-distance-weighted interpolation using KDTree Examples -------- tree = interp_2d.Invdisttree(obs_xy) # initialize KDTree with observational points tree.weights(node_xy) # calculate weights for each node. values_v = tree.interp(obs.temperature.values) # perform spatial inter...
stack_v2_sparse_classes_36k_train_022817
4,669
permissive
[ { "docstring": "Constructor using coordinates and data Parameters ---------- x : np.ndarray, shape (n,2) Coordinates of data points n is the number of data points nnear : positive int, optional The number of nearest neighbors to be included, the default is 10. leafsize: positive int, optional The number of poin...
3
null
Implement the Python class `Invdisttree` described below. Class description: Inverse-distance-weighted interpolation using KDTree Examples -------- tree = interp_2d.Invdisttree(obs_xy) # initialize KDTree with observational points tree.weights(node_xy) # calculate weights for each node. values_v = tree.interp(obs.temp...
Implement the Python class `Invdisttree` described below. Class description: Inverse-distance-weighted interpolation using KDTree Examples -------- tree = interp_2d.Invdisttree(obs_xy) # initialize KDTree with observational points tree.weights(node_xy) # calculate weights for each node. values_v = tree.interp(obs.temp...
45b132fe0b287a87e26add8300b38b04a7ab2dbe
<|skeleton|> class Invdisttree: """Inverse-distance-weighted interpolation using KDTree Examples -------- tree = interp_2d.Invdisttree(obs_xy) # initialize KDTree with observational points tree.weights(node_xy) # calculate weights for each node. values_v = tree.interp(obs.temperature.values) # perform spatial inter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Invdisttree: """Inverse-distance-weighted interpolation using KDTree Examples -------- tree = interp_2d.Invdisttree(obs_xy) # initialize KDTree with observational points tree.weights(node_xy) # calculate weights for each node. values_v = tree.interp(obs.temperature.values) # perform spatial interpolation with...
the_stack_v2_python_sparse
schimpy/interp_2d.py
CADWRDeltaModeling/schimpy
train
7
0dc767eede6d702c292036ba8f68b6b17fd85c1a
[ "label = Label.objects.filter(name=request.data.get('name', None)).first()\nif not label:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\ntry:\n label.labelfollow_set.update_or_create(user_id=request._request.uid, defaults=None)\nexcept:\n return self.error(errorcode.MSG_DB_ERROR, errorcode....
<|body_start_0|> label = Label.objects.filter(name=request.data.get('name', None)).first() if not label: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) try: label.labelfollow_set.update_or_create(user_id=request._request.uid, defaults=None) except: ...
LabelFollowView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelFollowView: def post(self, request): """关注标签""" <|body_0|> def delete(self, request): """取消关注标签""" <|body_1|> def get(self, request): """查看本人关注的标签。""" <|body_2|> <|end_skeleton|> <|body_start_0|> label = Label.objects.filte...
stack_v2_sparse_classes_36k_train_022818
9,306
no_license
[ { "docstring": "关注标签", "name": "post", "signature": "def post(self, request)" }, { "docstring": "取消关注标签", "name": "delete", "signature": "def delete(self, request)" }, { "docstring": "查看本人关注的标签。", "name": "get", "signature": "def get(self, request)" } ]
3
stack_v2_sparse_classes_30k_train_009531
Implement the Python class `LabelFollowView` described below. Class description: Implement the LabelFollowView class. Method signatures and docstrings: - def post(self, request): 关注标签 - def delete(self, request): 取消关注标签 - def get(self, request): 查看本人关注的标签。
Implement the Python class `LabelFollowView` described below. Class description: Implement the LabelFollowView class. Method signatures and docstrings: - def post(self, request): 关注标签 - def delete(self, request): 取消关注标签 - def get(self, request): 查看本人关注的标签。 <|skeleton|> class LabelFollowView: def post(self, requ...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class LabelFollowView: def post(self, request): """关注标签""" <|body_0|> def delete(self, request): """取消关注标签""" <|body_1|> def get(self, request): """查看本人关注的标签。""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelFollowView: def post(self, request): """关注标签""" label = Label.objects.filter(name=request.data.get('name', None)).first() if not label: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) try: label.labelfollow_set.update_or_create(user_id=r...
the_stack_v2_python_sparse
apps/labels/views.py
Slowhalfframe/fanyijiang-API
train
0
48053f704fc781fe9a47f72a11b33fc0f7c2b513
[ "if n == 1:\n return n\nreturn self.search(n)", "if n == 1 or n == 0:\n return 1\nm = n // 2\na, b = (isBadVersion(m + offset), isBadVersion(m + 1 + offset))\nif not a and b:\n return m + 1 + offset\nelif a and b:\n return self.search(m, offset)\nelse:\n return self.search(n - m, offset + m)" ]
<|body_start_0|> if n == 1: return n return self.search(n) <|end_body_0|> <|body_start_1|> if n == 1 or n == 0: return 1 m = n // 2 a, b = (isBadVersion(m + offset), isBadVersion(m + 1 + offset)) if not a and b: return m + 1 + offset ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstBadVersion(self, n): """:type n: int :rtype: int""" <|body_0|> def search(self, n, offset): """offset term is to calibrate the value.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 1: return n return s...
stack_v2_sparse_classes_36k_train_022819
835
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "firstBadVersion", "signature": "def firstBadVersion(self, n)" }, { "docstring": "offset term is to calibrate the value.", "name": "search", "signature": "def search(self, n, offset)" } ]
2
stack_v2_sparse_classes_30k_train_001461
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstBadVersion(self, n): :type n: int :rtype: int - def search(self, n, offset): offset term is to calibrate the value.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstBadVersion(self, n): :type n: int :rtype: int - def search(self, n, offset): offset term is to calibrate the value. <|skeleton|> class Solution: def firstBadVersio...
54d777e11b91c5debe49c1aef723234c66a5d2cc
<|skeleton|> class Solution: def firstBadVersion(self, n): """:type n: int :rtype: int""" <|body_0|> def search(self, n, offset): """offset term is to calibrate the value.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstBadVersion(self, n): """:type n: int :rtype: int""" if n == 1: return n return self.search(n) def search(self, n, offset): """offset term is to calibrate the value.""" if n == 1 or n == 0: return 1 m = n // 2 ...
the_stack_v2_python_sparse
leetcode_solution/binary search/#278.First_Bad_Version.py
HsiangHung/Code-Challenges
train
0
bb0342287ef95e0fe6e85b91b5cfac4993d3814d
[ "import tensorflow.compat.v1 as tf\nsuper().__init__(size=size, batch_size=batch_size)\nself.sess = sess\nself._iterator = iterator\nself.iterator_type = iterator_type\nself.iterator_arg = iterator_arg\nif not isinstance(iterator, tf.data.Iterator):\n raise TypeError('Only support object tf.data.Iterator')\nif i...
<|body_start_0|> import tensorflow.compat.v1 as tf super().__init__(size=size, batch_size=batch_size) self.sess = sess self._iterator = iterator self.iterator_type = iterator_type self.iterator_arg = iterator_arg if not isinstance(iterator, tf.data.Iterator): ...
Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`.
TensorFlowDataGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TensorFlowDataGenerator: """Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`.""" def __init__(self, sess: 'tf.Session', iterator: 'tf.data.Iterator', iterator_type: str, iterator_arg: Union[Dict, Tuple, 'tf.Operation'], size: int, batch_size: int) -> None: ...
stack_v2_sparse_classes_36k_train_022820
15,829
permissive
[ { "docstring": "Create a data generator wrapper for TensorFlow. Supported iterators: initializable, reinitializable, feedable. :param sess: TensorFlow session. :param iterator: Data iterator from TensorFlow. :param iterator_type: Type of the iterator. Supported types: `initializable`, `reinitializable`, `feedab...
2
stack_v2_sparse_classes_30k_train_012068
Implement the Python class `TensorFlowDataGenerator` described below. Class description: Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`. Method signatures and docstrings: - def __init__(self, sess: 'tf.Session', iterator: 'tf.data.Iterator', iterator_type: str, iterator_arg: Union[D...
Implement the Python class `TensorFlowDataGenerator` described below. Class description: Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`. Method signatures and docstrings: - def __init__(self, sess: 'tf.Session', iterator: 'tf.data.Iterator', iterator_type: str, iterator_arg: Union[D...
6b424dadac60631c126e864551bd7202c2e19478
<|skeleton|> class TensorFlowDataGenerator: """Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`.""" def __init__(self, sess: 'tf.Session', iterator: 'tf.data.Iterator', iterator_type: str, iterator_arg: Union[Dict, Tuple, 'tf.Operation'], size: int, batch_size: int) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TensorFlowDataGenerator: """Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`.""" def __init__(self, sess: 'tf.Session', iterator: 'tf.data.Iterator', iterator_type: str, iterator_arg: Union[Dict, Tuple, 'tf.Operation'], size: int, batch_size: int) -> None: """Crea...
the_stack_v2_python_sparse
art/data_generators.py
kztakemoto/adversarial-robustness-toolbox
train
0
56c02404210aa566a66086395a04f0234cd33ad3
[ "if n == 0:\n return 1\nif n == 1 or n == 2:\n return n\nreturn (self.numWays(n - 1) + self.numWays(n - 2)) % MOD", "p, q = (1, 1)\nfor i in range(1, n):\n p, q = (q, p + q)\nreturn q % MOD" ]
<|body_start_0|> if n == 0: return 1 if n == 1 or n == 2: return n return (self.numWays(n - 1) + self.numWays(n - 2)) % MOD <|end_body_0|> <|body_start_1|> p, q = (1, 1) for i in range(1, n): p, q = (q, p + q) return q % MOD <|end_body...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numWays2(self, n: int) -> int: """超时""" <|body_0|> def numWays(self, n: int) -> int: """滚动数组""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return 1 if n == 1 or n == 2: return n retu...
stack_v2_sparse_classes_36k_train_022821
721
no_license
[ { "docstring": "超时", "name": "numWays2", "signature": "def numWays2(self, n: int) -> int" }, { "docstring": "滚动数组", "name": "numWays", "signature": "def numWays(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numWays2(self, n: int) -> int: 超时 - def numWays(self, n: int) -> int: 滚动数组
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numWays2(self, n: int) -> int: 超时 - def numWays(self, n: int) -> int: 滚动数组 <|skeleton|> class Solution: def numWays2(self, n: int) -> int: """超时""" <|bo...
c0dd577481b46129d950354d567d332a4d091137
<|skeleton|> class Solution: def numWays2(self, n: int) -> int: """超时""" <|body_0|> def numWays(self, n: int) -> int: """滚动数组""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numWays2(self, n: int) -> int: """超时""" if n == 0: return 1 if n == 1 or n == 2: return n return (self.numWays(n - 1) + self.numWays(n - 2)) % MOD def numWays(self, n: int) -> int: """滚动数组""" p, q = (1, 1) for i...
the_stack_v2_python_sparse
leetcode/剑指offer/剑指 Offer 10- II. 青蛙跳台阶问题.py
tenqaz/crazy_arithmetic
train
0
fc3253a8f435fce1e554dd3bc715f9e734215f45
[ "url = 'https://passport.cnblogs.com/user/signin'\nheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Language': 'zh-CN,zh;q=0.8', 'Accept-Encoding': 'gzip, defla...
<|body_start_0|> url = 'https://passport.cnblogs.com/user/signin' headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'Accept-Language': 'zh-CN,zh;q=0.8', 'Acc...
BlogLogin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogLogin: def login(self, user, pwd, reme=True): """三个参数:账号: username,密码: psw,记住登录: reme=False""" <|body_0|> def test01(self): """测试登录:正确账号,正确密码""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = 'https://passport.cnblogs.com/user/signin' ...
stack_v2_sparse_classes_36k_train_022822
2,451
no_license
[ { "docstring": "三个参数:账号: username,密码: psw,记住登录: reme=False", "name": "login", "signature": "def login(self, user, pwd, reme=True)" }, { "docstring": "测试登录:正确账号,正确密码", "name": "test01", "signature": "def test01(self)" } ]
2
stack_v2_sparse_classes_30k_train_001020
Implement the Python class `BlogLogin` described below. Class description: Implement the BlogLogin class. Method signatures and docstrings: - def login(self, user, pwd, reme=True): 三个参数:账号: username,密码: psw,记住登录: reme=False - def test01(self): 测试登录:正确账号,正确密码
Implement the Python class `BlogLogin` described below. Class description: Implement the BlogLogin class. Method signatures and docstrings: - def login(self, user, pwd, reme=True): 三个参数:账号: username,密码: psw,记住登录: reme=False - def test01(self): 测试登录:正确账号,正确密码 <|skeleton|> class BlogLogin: def login(self, user, p...
7e85e9e323d43019d04194ca925e7c6d31ae470d
<|skeleton|> class BlogLogin: def login(self, user, pwd, reme=True): """三个参数:账号: username,密码: psw,记住登录: reme=False""" <|body_0|> def test01(self): """测试登录:正确账号,正确密码""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlogLogin: def login(self, user, pwd, reme=True): """三个参数:账号: username,密码: psw,记住登录: reme=False""" url = 'https://passport.cnblogs.com/user/signin' headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', '...
the_stack_v2_python_sparse
jiekou/3-5/unittest_login_blog.py
674312023/pythontest
train
0
cc2cbd62e2e134badf0efadc6be8dcab27e17b82
[ "if y is None:\n raise ValueError('y cannot be none')\nreturn self", "X = infer_feature_types(X)\nif y is None:\n raise ValueError('y cannot be none')\ny = infer_feature_types(y)\nreturn (X, y)", "X = infer_feature_types(X)\nif y is not None:\n y = infer_feature_types(y)\nreturn (X, None)", "y_unique...
<|body_start_0|> if y is None: raise ValueError('y cannot be none') return self <|end_body_0|> <|body_start_1|> X = infer_feature_types(X) if y is None: raise ValueError('y cannot be none') y = infer_feature_types(y) return (X, y) <|end_body_1|> ...
Base Sampler component. Used as the base class of all sampler components. Arguments: parameters (dict): Dictionary of parameters for the component. Defaults to None. component_obj (obj): Third-party objects useful in component implementation. Defaults to None. random_seed (int): Seed for the random number generator. De...
BaseSampler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseSampler: """Base Sampler component. Used as the base class of all sampler components. Arguments: parameters (dict): Dictionary of parameters for the component. Defaults to None. component_obj (obj): Third-party objects useful in component implementation. Defaults to None. random_seed (int): S...
stack_v2_sparse_classes_36k_train_022823
9,704
permissive
[ { "docstring": "Resample the data using the sampler. Since our sampler doesn't need to be fit, we do nothing here. Arguments: X (pd.DataFrame): Training features y (pd.Series): Target features Returns: self", "name": "fit", "signature": "def fit(self, X, y)" }, { "docstring": "Transforms the inp...
5
null
Implement the Python class `BaseSampler` described below. Class description: Base Sampler component. Used as the base class of all sampler components. Arguments: parameters (dict): Dictionary of parameters for the component. Defaults to None. component_obj (obj): Third-party objects useful in component implementation....
Implement the Python class `BaseSampler` described below. Class description: Base Sampler component. Used as the base class of all sampler components. Arguments: parameters (dict): Dictionary of parameters for the component. Defaults to None. component_obj (obj): Third-party objects useful in component implementation....
3b5bf62b08a5a5bc6485ba5387a08c32e1857473
<|skeleton|> class BaseSampler: """Base Sampler component. Used as the base class of all sampler components. Arguments: parameters (dict): Dictionary of parameters for the component. Defaults to None. component_obj (obj): Third-party objects useful in component implementation. Defaults to None. random_seed (int): S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseSampler: """Base Sampler component. Used as the base class of all sampler components. Arguments: parameters (dict): Dictionary of parameters for the component. Defaults to None. component_obj (obj): Third-party objects useful in component implementation. Defaults to None. random_seed (int): Seed for the r...
the_stack_v2_python_sparse
evalml/pipelines/components/transformers/samplers/base_sampler.py
ObinnaObeleagu/evalml
train
1
46c1bf38178e10091bce874178c79c8292b3cf46
[ "current = redis.get('fm:player:current')\nif current is None:\n return (None, None)\nuri, user = json.loads(current).values()\ntrack = Track.query.filter(Track.spotify_uri == uri).first()\nuser = User.query.filter(User.id == user).first()\nreturn (track, user)", "now = datetime.utcnow()\nnow = now.replace(tzi...
<|body_start_0|> current = redis.get('fm:player:current') if current is None: return (None, None) uri, user = json.loads(current).values() track = Track.query.filter(Track.spotify_uri == uri).first() user = User.query.filter(User.id == user).first() return (tr...
Operates on the currently playing track.
CurrentView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentView: """Operates on the currently playing track.""" def get_current_track(self): """Returns the currently playing track from redis. Returns ------- fm.models.spotify.Teack The currently playing track or None""" <|body_0|> def elapsed(self, paused=False): ...
stack_v2_sparse_classes_36k_train_022824
12,943
no_license
[ { "docstring": "Returns the currently playing track from redis. Returns ------- fm.models.spotify.Teack The currently playing track or None", "name": "get_current_track", "signature": "def get_current_track(self)" }, { "docstring": "Calculates the current playhead (durration) of the track based ...
4
stack_v2_sparse_classes_30k_train_009635
Implement the Python class `CurrentView` described below. Class description: Operates on the currently playing track. Method signatures and docstrings: - def get_current_track(self): Returns the currently playing track from redis. Returns ------- fm.models.spotify.Teack The currently playing track or None - def elaps...
Implement the Python class `CurrentView` described below. Class description: Operates on the currently playing track. Method signatures and docstrings: - def get_current_track(self): Returns the currently playing track from redis. Returns ------- fm.models.spotify.Teack The currently playing track or None - def elaps...
817766c6d2e2660291b723274d345ce5eb40ab77
<|skeleton|> class CurrentView: """Operates on the currently playing track.""" def get_current_track(self): """Returns the currently playing track from redis. Returns ------- fm.models.spotify.Teack The currently playing track or None""" <|body_0|> def elapsed(self, paused=False): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurrentView: """Operates on the currently playing track.""" def get_current_track(self): """Returns the currently playing track from redis. Returns ------- fm.models.spotify.Teack The currently playing track or None""" current = redis.get('fm:player:current') if current is None: ...
the_stack_v2_python_sparse
fm/views/player.py
thisissoon/FM-API
train
3
2b5dfb686d9c171a41895ab370823ccbb514b542
[ "gcc, *_ = packager.identify(installation=self)\nself.version, _ = packager.info(package=gcc)\nflavor = self.flavor\nself.wrapper = gcc\nwrapper = 'bin/{.wrapper}'.format(self)\nprefix = packager.findfirst(target=wrapper, contents=packager.contents(package=gcc))\nself.bindir = [prefix / 'bin'] if prefix else []\nse...
<|body_start_0|> gcc, *_ = packager.identify(installation=self) self.version, _ = packager.info(package=gcc) flavor = self.flavor self.wrapper = gcc wrapper = 'bin/{.wrapper}'.format(self) prefix = packager.findfirst(target=wrapper, contents=packager.contents(package=gcc)...
Support for GCC installations
Default
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Default: """Support for GCC installations""" def dpkg(self, packager): """Attempt to repair my configuration""" <|body_0|> def macports(self, packager): """Attempt to repair my configuration""" <|body_1|> def retrieveVersion(self): """Get my ...
stack_v2_sparse_classes_36k_train_022825
9,096
permissive
[ { "docstring": "Attempt to repair my configuration", "name": "dpkg", "signature": "def dpkg(self, packager)" }, { "docstring": "Attempt to repair my configuration", "name": "macports", "signature": "def macports(self, packager)" }, { "docstring": "Get my version number directly f...
3
null
Implement the Python class `Default` described below. Class description: Support for GCC installations Method signatures and docstrings: - def dpkg(self, packager): Attempt to repair my configuration - def macports(self, packager): Attempt to repair my configuration - def retrieveVersion(self): Get my version number ...
Implement the Python class `Default` described below. Class description: Support for GCC installations Method signatures and docstrings: - def dpkg(self, packager): Attempt to repair my configuration - def macports(self, packager): Attempt to repair my configuration - def retrieveVersion(self): Get my version number ...
d741c44ffb3e9e1f726bf492202ac8738bb4aa1c
<|skeleton|> class Default: """Support for GCC installations""" def dpkg(self, packager): """Attempt to repair my configuration""" <|body_0|> def macports(self, packager): """Attempt to repair my configuration""" <|body_1|> def retrieveVersion(self): """Get my ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Default: """Support for GCC installations""" def dpkg(self, packager): """Attempt to repair my configuration""" gcc, *_ = packager.identify(installation=self) self.version, _ = packager.info(package=gcc) flavor = self.flavor self.wrapper = gcc wrapper = 'bi...
the_stack_v2_python_sparse
packages/pyre/externals/GCC.py
pyre/pyre
train
27
92a7d6e5472aa9665025041a18880d4bb209f293
[ "app, created = SocialApp.objects.get_or_create(provider=Provider.google.name)\nrefresh_user_access_token(self.ada, 'Google', 'new-access-token')\ntoken = get_user_social_token(self.ada, Provider.google)\nassert token.token == 'new-access-token'\nassert token.token_secret == ''\nrefresh_user_access_token(self.ada, ...
<|body_start_0|> app, created = SocialApp.objects.get_or_create(provider=Provider.google.name) refresh_user_access_token(self.ada, 'Google', 'new-access-token') token = get_user_social_token(self.ada, Provider.google) assert token.token == 'new-access-token' assert token.token_se...
TokensTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokensTestCase: def test_no_existing_token(self): """A user that does not yet have a token.""" <|body_0|> def test_an_existing_refresh_token(self): """A user that has an existing refresh token.""" <|body_1|> <|end_skeleton|> <|body_start_0|> app, cr...
stack_v2_sparse_classes_36k_train_022826
1,995
permissive
[ { "docstring": "A user that does not yet have a token.", "name": "test_no_existing_token", "signature": "def test_no_existing_token(self)" }, { "docstring": "A user that has an existing refresh token.", "name": "test_an_existing_refresh_token", "signature": "def test_an_existing_refresh_...
2
null
Implement the Python class `TokensTestCase` described below. Class description: Implement the TokensTestCase class. Method signatures and docstrings: - def test_no_existing_token(self): A user that does not yet have a token. - def test_an_existing_refresh_token(self): A user that has an existing refresh token.
Implement the Python class `TokensTestCase` described below. Class description: Implement the TokensTestCase class. Method signatures and docstrings: - def test_no_existing_token(self): A user that does not yet have a token. - def test_an_existing_refresh_token(self): A user that has an existing refresh token. <|ske...
b0edf060f4cc5494eef81fce62a563bd5b4e8e31
<|skeleton|> class TokensTestCase: def test_no_existing_token(self): """A user that does not yet have a token.""" <|body_0|> def test_an_existing_refresh_token(self): """A user that has an existing refresh token.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TokensTestCase: def test_no_existing_token(self): """A user that does not yet have a token.""" app, created = SocialApp.objects.get_or_create(provider=Provider.google.name) refresh_user_access_token(self.ada, 'Google', 'new-access-token') token = get_user_social_token(self.ada,...
the_stack_v2_python_sparse
manager/users/socialaccount/tokens_tests.py
stencila/hub
train
31
56f629dc7536570908a1eda8630ddce477afd9c9
[ "filename_, (start, end) = filename\ndata = []\nwith open(filename_, encoding='utf-8') as f:\n for idx, line in enumerate(f):\n if start <= idx < end and (not line.startswith('%')):\n data.append(line)\nreturn read_abc_string(''.join(data))", "if not self.raw_filenames:\n filenames = sorte...
<|body_start_0|> filename_, (start, end) = filename data = [] with open(filename_, encoding='utf-8') as f: for idx, line in enumerate(f): if start <= idx < end and (not line.startswith('%')): data.append(line) return read_abc_string(''.join...
Class for datasets storing ABC files in a folder. See Also -------- :class:`muspy.FolderDataset` : Class for datasets storing files in a folder.
ABCFolderDataset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ABCFolderDataset: """Class for datasets storing ABC files in a folder. See Also -------- :class:`muspy.FolderDataset` : Class for datasets storing files in a folder.""" def read(self, filename: Tuple[str, Tuple[int, int]]) -> Music: """Read a file into a Music object.""" <|bo...
stack_v2_sparse_classes_36k_train_022827
40,954
permissive
[ { "docstring": "Read a file into a Music object.", "name": "read", "signature": "def read(self, filename: Tuple[str, Tuple[int, int]]) -> Music" }, { "docstring": "Enable on-the-fly mode and convert the data on the fly. Returns ------- Object itself.", "name": "on_the_fly", "signature": ...
2
stack_v2_sparse_classes_30k_train_021364
Implement the Python class `ABCFolderDataset` described below. Class description: Class for datasets storing ABC files in a folder. See Also -------- :class:`muspy.FolderDataset` : Class for datasets storing files in a folder. Method signatures and docstrings: - def read(self, filename: Tuple[str, Tuple[int, int]]) -...
Implement the Python class `ABCFolderDataset` described below. Class description: Class for datasets storing ABC files in a folder. See Also -------- :class:`muspy.FolderDataset` : Class for datasets storing files in a folder. Method signatures and docstrings: - def read(self, filename: Tuple[str, Tuple[int, int]]) -...
b2d4265c6279e730903d8abe9dddda8484511903
<|skeleton|> class ABCFolderDataset: """Class for datasets storing ABC files in a folder. See Also -------- :class:`muspy.FolderDataset` : Class for datasets storing files in a folder.""" def read(self, filename: Tuple[str, Tuple[int, int]]) -> Music: """Read a file into a Music object.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ABCFolderDataset: """Class for datasets storing ABC files in a folder. See Also -------- :class:`muspy.FolderDataset` : Class for datasets storing files in a folder.""" def read(self, filename: Tuple[str, Tuple[int, int]]) -> Music: """Read a file into a Music object.""" filename_, (start...
the_stack_v2_python_sparse
muspy/datasets/base.py
salu133445/muspy
train
380
ab17cf43d470bae792572fdf151859586c7ac814
[ "self.__wordshash__ = {}\nfor index, part in enumerate(words):\n if part not in self.__wordshash__:\n self.__wordshash__[part] = [index]\n else:\n self.__wordshash__[part].append(index)", "if not word1 or not word2:\n return 0\nminidistance = float('inf')\nif word1 in self.__wordshash__:\n ...
<|body_start_0|> self.__wordshash__ = {} for index, part in enumerate(words): if part not in self.__wordshash__: self.__wordshash__[part] = [index] else: self.__wordshash__[part].append(index) <|end_body_0|> <|body_start_1|> if not word1 o...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.__wordshash__ = {} for i...
stack_v2_sparse_classes_36k_train_022828
1,243
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_013373
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
96fdc45d15b4150cefe12361b236de6aae3bdc6a
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.__wordshash__ = {} for index, part in enumerate(words): if part not in self.__wordshash__: self.__wordshash__[part] = [index] else: self.__wordshash__[part...
the_stack_v2_python_sparse
python/244 - Shortest Word Distance II/main.py
or0986113303/LeetCodeLearn
train
0
1698208cb4b2b4c21cdc09b0fe41e8fce1547f43
[ "if num_bn_adaptation_samples < 0:\n raise ValueError('Number of adaptation samples must be >= 0')\nself._device = device\nself._data_loader = data_loader\nself._num_bn_adaptation_steps = math.ceil(num_bn_adaptation_samples / data_loader.batch_size)", "backend = get_backend(model)\nif backend is BackendType.TO...
<|body_start_0|> if num_bn_adaptation_samples < 0: raise ValueError('Number of adaptation samples must be >= 0') self._device = device self._data_loader = data_loader self._num_bn_adaptation_steps = math.ceil(num_bn_adaptation_samples / data_loader.batch_size) <|end_body_0|> ...
This algorithm updates the statistics of the batch normalization layers passing several batches of data through the model. This allows to correct the compression-induced bias in the model and reduce the corresponding accuracy drop even before model training.
BatchnormAdaptationAlgorithm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchnormAdaptationAlgorithm: """This algorithm updates the statistics of the batch normalization layers passing several batches of data through the model. This allows to correct the compression-induced bias in the model and reduce the corresponding accuracy drop even before model training.""" ...
stack_v2_sparse_classes_36k_train_022829
4,270
permissive
[ { "docstring": "Initializes the batch-norm statistics adaptation algorithm. :param data_loader: NNCF data loader. :param num_bn_adaptation_samples: Number of samples from the training dataset to pass through the model at initialization in order to update batch-norm statistics of the original model. The actual n...
2
null
Implement the Python class `BatchnormAdaptationAlgorithm` described below. Class description: This algorithm updates the statistics of the batch normalization layers passing several batches of data through the model. This allows to correct the compression-induced bias in the model and reduce the corresponding accuracy...
Implement the Python class `BatchnormAdaptationAlgorithm` described below. Class description: This algorithm updates the statistics of the batch normalization layers passing several batches of data through the model. This allows to correct the compression-induced bias in the model and reduce the corresponding accuracy...
c027c8b43c4865d46b8de01d8350dd338ec5a874
<|skeleton|> class BatchnormAdaptationAlgorithm: """This algorithm updates the statistics of the batch normalization layers passing several batches of data through the model. This allows to correct the compression-induced bias in the model and reduce the corresponding accuracy drop even before model training.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchnormAdaptationAlgorithm: """This algorithm updates the statistics of the batch normalization layers passing several batches of data through the model. This allows to correct the compression-induced bias in the model and reduce the corresponding accuracy drop even before model training.""" def __init...
the_stack_v2_python_sparse
nncf/common/initialization/batchnorm_adaptation.py
openvinotoolkit/nncf
train
558
2e2815d219e8bf0a68f19565490051aa28e248da
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('soohyeok_soojee', 'soohyeok_soojee')\nneighborhoodData = repo['soohyeok_soojee.get_neighborhoods'].find()\ncrimeData = repo['soohyeok_soojee.get_crimeData'].find()\nneighborhoods = {}\nrate = {}\nfor n i...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('soohyeok_soojee', 'soohyeok_soojee') neighborhoodData = repo['soohyeok_soojee.get_neighborhoods'].find() crimeData = repo['soohyeok_soojee.get_cri...
crimeRate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class crimeRate: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything hap...
stack_v2_sparse_classes_36k_train_022830
4,680
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `crimeRate` described below. Class description: Implement the crimeRate class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N...
Implement the Python class `crimeRate` described below. Class description: Implement the crimeRate class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=N...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class crimeRate: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything hap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class crimeRate: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('soohyeok_soojee', 'soohyeok_soojee') ...
the_stack_v2_python_sparse
soohyeok_soojee/crimeRate.py
maximega/course-2019-spr-proj
train
2
55411e7880092d9bf3cd6fabee5fcf03da3530a7
[ "self._namespace = namespace\nself._name = name\nself._formatter = formatter\nself._records = collections.deque(maxlen=_MAX_NUM_RECORD)", "message = str(message)\nif args:\n message %= args\nrecord = Record(message)\nif self._formatter:\n self._formatter.Format(record)\nif len(record.message) > _MAX_MSG_SIZ...
<|body_start_0|> self._namespace = namespace self._name = name self._formatter = formatter self._records = collections.deque(maxlen=_MAX_NUM_RECORD) <|end_body_0|> <|body_start_1|> message = str(message) if args: message %= args record = Record(messag...
Logger class.
QuickLogger
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuickLogger: """Logger class.""" def __init__(self, namespace, name, formatter=None): """Initializes logger. Args: namespace: The namespace of logger. name: Name of logger. formatter: Formatter object to format logs.""" <|body_0|> def Log(self, message, *args): "...
stack_v2_sparse_classes_36k_train_022831
7,866
permissive
[ { "docstring": "Initializes logger. Args: namespace: The namespace of logger. name: Name of logger. formatter: Formatter object to format logs.", "name": "__init__", "signature": "def __init__(self, namespace, name, formatter=None)" }, { "docstring": "Add a message with 'message % args'. Must ca...
3
null
Implement the Python class `QuickLogger` described below. Class description: Logger class. Method signatures and docstrings: - def __init__(self, namespace, name, formatter=None): Initializes logger. Args: namespace: The namespace of logger. name: Name of logger. formatter: Formatter object to format logs. - def Log(...
Implement the Python class `QuickLogger` described below. Class description: Logger class. Method signatures and docstrings: - def __init__(self, namespace, name, formatter=None): Initializes logger. Args: namespace: The namespace of logger. name: Name of logger. formatter: Formatter object to format logs. - def Log(...
e71f21b9b4b9b839f5093301974a45545dad2691
<|skeleton|> class QuickLogger: """Logger class.""" def __init__(self, namespace, name, formatter=None): """Initializes logger. Args: namespace: The namespace of logger. name: Name of logger. formatter: Formatter object to format logs.""" <|body_0|> def Log(self, message, *args): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuickLogger: """Logger class.""" def __init__(self, namespace, name, formatter=None): """Initializes logger. Args: namespace: The namespace of logger. name: Name of logger. formatter: Formatter object to format logs.""" self._namespace = namespace self._name = name self._f...
the_stack_v2_python_sparse
third_party/catapult/dashboard/dashboard/quick_logger.py
zenoalbisser/chromium
train
0
e5cc880b02159a7538823f39706235009b6e31c8
[ "Weapon.__init__(self, name, power)\nself.weaponAngle = 45\nself.ammo = 6 * 5\nself.image = load_image('crosshair.png')\nself.rect = self.image.get_rect()", "if self.ammo > 0:\n if self.snail:\n self.shootableObject = Bullet(self.snail, self.weaponAngle)\nelse:\n raise ValueError(\"You can't shoot an...
<|body_start_0|> Weapon.__init__(self, name, power) self.weaponAngle = 45 self.ammo = 6 * 5 self.image = load_image('crosshair.png') self.rect = self.image.get_rect() <|end_body_0|> <|body_start_1|> if self.ammo > 0: if self.snail: self.shoota...
@ivar name: The name of this weapon @ivar power: Amount of hitpoints this weapon will damage @ivar ammo: The amount of ammo this weapon ha @ivar weaponAngle: The aiming angle in degrees @ivar rect: The rect which should be used to draw the image
Cannon
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cannon: """@ivar name: The name of this weapon @ivar power: Amount of hitpoints this weapon will damage @ivar ammo: The amount of ammo this weapon ha @ivar weaponAngle: The aiming angle in degrees @ivar rect: The rect which should be used to draw the image""" def __init__(self, name, power):...
stack_v2_sparse_classes_36k_train_022832
3,434
no_license
[ { "docstring": "@param name: The name of this cannon @param power: Amount of hitpoints this weapon will damage @summary: Initializes a cannon", "name": "__init__", "signature": "def __init__(self, name, power)" }, { "docstring": "@summary: Shoot the ammo from the launcher", "name": "shoot", ...
5
stack_v2_sparse_classes_30k_train_010700
Implement the Python class `Cannon` described below. Class description: @ivar name: The name of this weapon @ivar power: Amount of hitpoints this weapon will damage @ivar ammo: The amount of ammo this weapon ha @ivar weaponAngle: The aiming angle in degrees @ivar rect: The rect which should be used to draw the image ...
Implement the Python class `Cannon` described below. Class description: @ivar name: The name of this weapon @ivar power: Amount of hitpoints this weapon will damage @ivar ammo: The amount of ammo this weapon ha @ivar weaponAngle: The aiming angle in degrees @ivar rect: The rect which should be used to draw the image ...
b3eb66518e63c5b47f5dd983adfbf9fecff23796
<|skeleton|> class Cannon: """@ivar name: The name of this weapon @ivar power: Amount of hitpoints this weapon will damage @ivar ammo: The amount of ammo this weapon ha @ivar weaponAngle: The aiming angle in degrees @ivar rect: The rect which should be used to draw the image""" def __init__(self, name, power):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cannon: """@ivar name: The name of this weapon @ivar power: Amount of hitpoints this weapon will damage @ivar ammo: The amount of ammo this weapon ha @ivar weaponAngle: The aiming angle in degrees @ivar rect: The rect which should be used to draw the image""" def __init__(self, name, power): """@...
the_stack_v2_python_sparse
src/weapons/cannon.py
ryuken/gravity-snails
train
0
93d4a6de46cf490fd6e017795fda6b170544ae91
[ "self.legal_frequency_threshold = legal_frequency_threshold\nself.vowels = vowels\nself.legal_onsets = self.find_legal_onsets(tokenized_source_text)", "onsets = [self.onset(word) for word in words]\nlegal_onsets = [k for k, v in Counter(onsets).items() if v / len(onsets) > self.legal_frequency_threshold]\nreturn ...
<|body_start_0|> self.legal_frequency_threshold = legal_frequency_threshold self.vowels = vowels self.legal_onsets = self.find_legal_onsets(tokenized_source_text) <|end_body_0|> <|body_start_1|> onsets = [self.onset(word) for word in words] legal_onsets = [k for k, v in Counter(...
Syllabifies words based on the Legality Principle and Onset Maximization. >>> from nltk.tokenize import LegalitySyllableTokenizer >>> from nltk import word_tokenize >>> from nltk.corpus import words >>> text = "This is a wonderful sentence." >>> text_words = word_tokenize(text) >>> LP = LegalitySyllableTokenizer(words....
LegalitySyllableTokenizer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-NC-ND-3.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LegalitySyllableTokenizer: """Syllabifies words based on the Legality Principle and Onset Maximization. >>> from nltk.tokenize import LegalitySyllableTokenizer >>> from nltk import word_tokenize >>> from nltk.corpus import words >>> text = "This is a wonderful sentence." >>> text_words = word_tok...
stack_v2_sparse_classes_36k_train_022833
6,089
permissive
[ { "docstring": ":param tokenized_source_text: List of valid tokens in the language :type tokenized_source_text: list(str) :param vowels: Valid vowels in language or IPA representation :type vowels: str :param legal_frequency_threshold: Lowest frequency of all onsets to be considered a legal onset :type legal_fr...
4
null
Implement the Python class `LegalitySyllableTokenizer` described below. Class description: Syllabifies words based on the Legality Principle and Onset Maximization. >>> from nltk.tokenize import LegalitySyllableTokenizer >>> from nltk import word_tokenize >>> from nltk.corpus import words >>> text = "This is a wonderf...
Implement the Python class `LegalitySyllableTokenizer` described below. Class description: Syllabifies words based on the Legality Principle and Onset Maximization. >>> from nltk.tokenize import LegalitySyllableTokenizer >>> from nltk import word_tokenize >>> from nltk.corpus import words >>> text = "This is a wonderf...
582e6e35f0e6c984b44ec49dcb8846d9c011d0a8
<|skeleton|> class LegalitySyllableTokenizer: """Syllabifies words based on the Legality Principle and Onset Maximization. >>> from nltk.tokenize import LegalitySyllableTokenizer >>> from nltk import word_tokenize >>> from nltk.corpus import words >>> text = "This is a wonderful sentence." >>> text_words = word_tok...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LegalitySyllableTokenizer: """Syllabifies words based on the Legality Principle and Onset Maximization. >>> from nltk.tokenize import LegalitySyllableTokenizer >>> from nltk import word_tokenize >>> from nltk.corpus import words >>> text = "This is a wonderful sentence." >>> text_words = word_tokenize(text) >...
the_stack_v2_python_sparse
nltk/tokenize/legality_principle.py
nltk/nltk
train
11,860
3844a9123512736479432099fdfb581220e7f580
[ "self._hardware_api = hardware_api\nself._state_store = state_store\nself._action_dispatcher = action_dispatcher\nself._equipment = equipment\nself._movement = movement\nself._gantry_mover = gantry_mover\nself._labware_movement = labware_movement\nself._pipetting = pipetting\nself._tip_handler = tip_handler\nself._...
<|body_start_0|> self._hardware_api = hardware_api self._state_store = state_store self._action_dispatcher = action_dispatcher self._equipment = equipment self._movement = movement self._gantry_mover = gantry_mover self._labware_movement = labware_movement ...
CommandExecutor container class. CommandExecutor manages various child handlers that define procedures to execute the side-effects of commands.
CommandExecutor
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandExecutor: """CommandExecutor container class. CommandExecutor manages various child handlers that define procedures to execute the side-effects of commands.""" def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, action_dispatcher: ActionDispatcher, equipment:...
stack_v2_sparse_classes_36k_train_022834
5,180
permissive
[ { "docstring": "Initialize the CommandExecutor with access to its dependencies.", "name": "__init__", "signature": "def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, action_dispatcher: ActionDispatcher, equipment: EquipmentHandler, movement: MovementHandler, gantry_mover: Gan...
2
null
Implement the Python class `CommandExecutor` described below. Class description: CommandExecutor container class. CommandExecutor manages various child handlers that define procedures to execute the side-effects of commands. Method signatures and docstrings: - def __init__(self, hardware_api: HardwareControlAPI, stat...
Implement the Python class `CommandExecutor` described below. Class description: CommandExecutor container class. CommandExecutor manages various child handlers that define procedures to execute the side-effects of commands. Method signatures and docstrings: - def __init__(self, hardware_api: HardwareControlAPI, stat...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class CommandExecutor: """CommandExecutor container class. CommandExecutor manages various child handlers that define procedures to execute the side-effects of commands.""" def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, action_dispatcher: ActionDispatcher, equipment:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommandExecutor: """CommandExecutor container class. CommandExecutor manages various child handlers that define procedures to execute the side-effects of commands.""" def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, action_dispatcher: ActionDispatcher, equipment: EquipmentHan...
the_stack_v2_python_sparse
api/src/opentrons/protocol_engine/execution/command_executor.py
Opentrons/opentrons
train
326
c7cbbbba0cc8df5d3cc1cedc4c4e3452340c54fd
[ "def buildString(node):\n if node is None:\n self.s += 'None,'\n else:\n self.s += f'{node.val},'\n buildString(node.left)\n buildString(node.right)\nself.s = ''\nbuildString(root)\nreturn self.s.rstrip(',')", "def buildTree():\n val = self.nodes.pop(0)\n if val == 'None':\...
<|body_start_0|> def buildString(node): if node is None: self.s += 'None,' else: self.s += f'{node.val},' buildString(node.left) buildString(node.right) self.s = '' buildString(root) return self.s.rst...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022835
1,560
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_009276
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:...
8d9e3736d87daaa0caca2555018fe0c2bbd2dc13
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def buildString(node): if node is None: self.s += 'None,' else: self.s += f'{node.val},' buildString(node.left) ...
the_stack_v2_python_sparse
code/topics/4-trees-and-graphs/H297-serialize-and-deserialize-binary-tree.py
jeremyyew/tech-prep-jeremy.io
train
0
3f581e4e02cea3aef0b9397244c92c05c435c56d
[ "start = 0\nresult = []\ncounter_result = []\nfrom collections import Counter\n\ndef inner_combine(s, p):\n if sum(p) == target:\n if Counter(p) not in counter_result:\n result.append(p)\n counter_result.append(Counter(p))\n return\n elif sum(p) > target:\n return\n ...
<|body_start_0|> start = 0 result = [] counter_result = [] from collections import Counter def inner_combine(s, p): if sum(p) == target: if Counter(p) not in counter_result: result.append(p) counter_result.appen...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _combinationSum2(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def combinationSum2(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]"""...
stack_v2_sparse_classes_36k_train_022836
2,652
permissive
[ { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]", "name": "_combinationSum2", "signature": "def _combinationSum2(self, candidates, target)" }, { "docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]", "name": "combinationSum...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _combinationSum2(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] - def combinationSum2(self, candidates, target): :type candi...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _combinationSum2(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] - def combinationSum2(self, candidates, target): :type candi...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _combinationSum2(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" <|body_0|> def combinationSum2(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _combinationSum2(self, candidates, target): """:type candidates: List[int] :type target: int :rtype: List[List[int]]""" start = 0 result = [] counter_result = [] from collections import Counter def inner_combine(s, p): if sum(p) == tar...
the_stack_v2_python_sparse
40.combination-sum-ii.py
windard/leeeeee
train
0
b284e70494ae7cc4251454a9d1c6094f976bfa00
[ "userSettings = self.context.dmd.ZenUsers.getUserSettings()\nstate_container = getattr(userSettings, '_browser_state', None)\nif isinstance(state_container, basestring) or state_container is None:\n state_container = PersistentMapping()\n userSettings._browser_state = state_container\nif state != state_contai...
<|body_start_0|> userSettings = self.context.dmd.ZenUsers.getUserSettings() state_container = getattr(userSettings, '_browser_state', None) if isinstance(state_container, basestring) or state_container is None: state_container = PersistentMapping() userSettings._browser_s...
A JSON/ExtDirect interface to operations on messages
MessagingRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessagingRouter: """A JSON/ExtDirect interface to operations on messages""" def setBrowserState(self, state): """Save the browser state for the current user. @param state: The browser state as a JSON-encoded string @type state: str""" <|body_0|> def getBrowserState(self)...
stack_v2_sparse_classes_36k_train_022837
3,688
no_license
[ { "docstring": "Save the browser state for the current user. @param state: The browser state as a JSON-encoded string @type state: str", "name": "setBrowserState", "signature": "def setBrowserState(self, state)" }, { "docstring": "Retur the browser state for the current user.", "name": "getB...
4
null
Implement the Python class `MessagingRouter` described below. Class description: A JSON/ExtDirect interface to operations on messages Method signatures and docstrings: - def setBrowserState(self, state): Save the browser state for the current user. @param state: The browser state as a JSON-encoded string @type state:...
Implement the Python class `MessagingRouter` described below. Class description: A JSON/ExtDirect interface to operations on messages Method signatures and docstrings: - def setBrowserState(self, state): Save the browser state for the current user. @param state: The browser state as a JSON-encoded string @type state:...
1ea508c3d2b51742bc3b448c445cd0a3dba9e798
<|skeleton|> class MessagingRouter: """A JSON/ExtDirect interface to operations on messages""" def setBrowserState(self, state): """Save the browser state for the current user. @param state: The browser state as a JSON-encoded string @type state: str""" <|body_0|> def getBrowserState(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessagingRouter: """A JSON/ExtDirect interface to operations on messages""" def setBrowserState(self, state): """Save the browser state for the current user. @param state: The browser state as a JSON-encoded string @type state: str""" userSettings = self.context.dmd.ZenUsers.getUserSettin...
the_stack_v2_python_sparse
Products/Zuul/routers/messaging.py
zenoss/zenoss-prodbin
train
27
b3f231c843628ecf72fc90920d0cdefc144a19c6
[ "super(TextInput, self).__init__(aresObj, text, None)\nsize = self.aresObj.pyStyleDfl['fontSize'] if size is None else '%spx' % size\ncolor = color if color is not None else 'black'\nself.css({'color': color, 'font-size': '%spx' % size, 'width': '%s%s' % (width, widthUnit)})", "items = ['<div ondblclick=\"$(\\'#i...
<|body_start_0|> super(TextInput, self).__init__(aresObj, text, None) size = self.aresObj.pyStyleDfl['fontSize'] if size is None else '%spx' % size color = color if color is not None else 'black' self.css({'color': color, 'font-size': '%spx' % size, 'width': '%s%s' % (width, widthUnit)})...
special HTML object in charge of changing properties when double clicked
TextInput
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextInput: """special HTML object in charge of changing properties when double clicked""" def __init__(self, aresObj, text, width, widthUnit, size, color): """Instantiate the Python object :param aresObj: The ares report object :param text: The default value when the editable div is ...
stack_v2_sparse_classes_36k_train_022838
14,706
permissive
[ { "docstring": "Instantiate the Python object :param aresObj: The ares report object :param text: The default value when the editable div is empty :param width: The size of the div :param size: The font size :param color: The font color :param cssCls: (Optional) The optional CSS classes", "name": "__init__"...
2
null
Implement the Python class `TextInput` described below. Class description: special HTML object in charge of changing properties when double clicked Method signatures and docstrings: - def __init__(self, aresObj, text, width, widthUnit, size, color): Instantiate the Python object :param aresObj: The ares report object...
Implement the Python class `TextInput` described below. Class description: special HTML object in charge of changing properties when double clicked Method signatures and docstrings: - def __init__(self, aresObj, text, width, widthUnit, size, color): Instantiate the Python object :param aresObj: The ares report object...
3cf5068f874b3f6fe898968b2a7efa86fadca99d
<|skeleton|> class TextInput: """special HTML object in charge of changing properties when double clicked""" def __init__(self, aresObj, text, width, widthUnit, size, color): """Instantiate the Python object :param aresObj: The ares report object :param text: The default value when the editable div is ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextInput: """special HTML object in charge of changing properties when double clicked""" def __init__(self, aresObj, text, width, widthUnit, size, color): """Instantiate the Python object :param aresObj: The ares report object :param text: The default value when the editable div is empty :param ...
the_stack_v2_python_sparse
Lib/html/AresHtmlSystem.py
jeamick/ares-visual
train
0
018b3dfef5d4cf446c9a60e46600573054b1a36e
[ "self.crash_report_fname = 'Crash_report_%s.txt' % app.name\nself.app = app\nself.call_pdb = call_pdb\nself.show_crash_traceback = show_crash_traceback\nself.info = dict(app_name=app.name, contact_name=contact_name, contact_email=contact_email, bug_tracker=bug_tracker, crash_report_fname=self.crash_report_fname)", ...
<|body_start_0|> self.crash_report_fname = 'Crash_report_%s.txt' % app.name self.app = app self.call_pdb = call_pdb self.show_crash_traceback = show_crash_traceback self.info = dict(app_name=app.name, contact_name=contact_name, contact_email=contact_email, bug_tracker=bug_tracker...
Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb)
CrashHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrashHandler: """Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb)""" def __init__(self, app, contact_name: Opti...
stack_v2_sparse_classes_36k_train_022839
8,508
permissive
[ { "docstring": "Create a new crash handler Parameters ---------- app : Application A running :class:`Application` instance, which will be queried at crash time for internal information. contact_name : str A string with the name of the person to contact. contact_email : str A string with the email address of the...
3
null
Implement the Python class `CrashHandler` described below. Class description: Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb) Method sig...
Implement the Python class `CrashHandler` described below. Class description: Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb) Method sig...
e5103f971233fd66b558585cce7a4f52a716cd56
<|skeleton|> class CrashHandler: """Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb)""" def __init__(self, app, contact_name: Opti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrashHandler: """Customizable crash handlers for IPython applications. Instances of this class provide a :meth:`__call__` method which can be used as a ``sys.excepthook``. The :meth:`__call__` signature is:: def __call__(self, etype, evalue, etb)""" def __init__(self, app, contact_name: Optional[str]=Non...
the_stack_v2_python_sparse
IPython/core/crashhandler.py
ipython/ipython
train
13,673
10bd7da75baf5e9d7905d66f4c2f70dbe6188669
[ "list(args).clear()\nresult = False\nif not isinstance(mapping[pattern], tuple):\n if flags[mapping[pattern].value]['count'] > 0:\n result = True\nelse:\n for flag in mapping[pattern]:\n if flags[flag.value]['count'] > 0:\n result = True\n break\nreturn result", "list([in...
<|body_start_0|> list(args).clear() result = False if not isinstance(mapping[pattern], tuple): if flags[mapping[pattern].value]['count'] > 0: result = True else: for flag in mapping[pattern]: if flags[flag.value]['count'] > 0: ...
Rules for matching subpatterns
OpSubPatternRules
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OpSubPatternRules: """Rules for matching subpatterns""" def simple_pattern_rule(flags: dict, pattern, mapping, *args) -> bool: """Simple pattern rule""" <|body_0|> def reduce_atomic_sub_pattern_rule(flags: dict, input_tensors: list, output_tensors: list, *args) -> bool: ...
stack_v2_sparse_classes_36k_train_022840
31,661
no_license
[ { "docstring": "Simple pattern rule", "name": "simple_pattern_rule", "signature": "def simple_pattern_rule(flags: dict, pattern, mapping, *args) -> bool" }, { "docstring": "check reduce atomic pattern", "name": "reduce_atomic_sub_pattern_rule", "signature": "def reduce_atomic_sub_pattern...
3
stack_v2_sparse_classes_30k_val_000626
Implement the Python class `OpSubPatternRules` described below. Class description: Rules for matching subpatterns Method signatures and docstrings: - def simple_pattern_rule(flags: dict, pattern, mapping, *args) -> bool: Simple pattern rule - def reduce_atomic_sub_pattern_rule(flags: dict, input_tensors: list, output...
Implement the Python class `OpSubPatternRules` described below. Class description: Rules for matching subpatterns Method signatures and docstrings: - def simple_pattern_rule(flags: dict, pattern, mapping, *args) -> bool: Simple pattern rule - def reduce_atomic_sub_pattern_rule(flags: dict, input_tensors: list, output...
148511a31bfd195df889291946c43bb585acb546
<|skeleton|> class OpSubPatternRules: """Rules for matching subpatterns""" def simple_pattern_rule(flags: dict, pattern, mapping, *args) -> bool: """Simple pattern rule""" <|body_0|> def reduce_atomic_sub_pattern_rule(flags: dict, input_tensors: list, output_tensors: list, *args) -> bool: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OpSubPatternRules: """Rules for matching subpatterns""" def simple_pattern_rule(flags: dict, pattern, mapping, *args) -> bool: """Simple pattern rule""" list(args).clear() result = False if not isinstance(mapping[pattern], tuple): if flags[mapping[pattern].valu...
the_stack_v2_python_sparse
convertor/huawei/te/lang/cce/te_schedule/cce_schedule_distribution_rules.py
jizhuoran/caffe-huawei-atlas-convertor
train
4
0bce5d590b96e434cd8aee7531a321bc648c1981
[ "self.graph = graph\nself.color = dict(((node, 'WHITE') for node in self.graph.iternodes()))\nself.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))\nself.parent = dict(((node, None) for node in self.graph.iternodes()))\nself.dag = self.graph.__class__(self.graph.v(), directed=True)\nfor no...
<|body_start_0|> self.graph = graph self.color = dict(((node, 'WHITE') for node in self.graph.iternodes())) self.distance = dict(((node, float('inf')) for node in self.graph.iternodes())) self.parent = dict(((node, None) for node in self.graph.iternodes())) self.dag = self.graph....
Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.structures.graphs import Graph >...
BFSWithQueue
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BFSWithQueue: """Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from grap...
stack_v2_sparse_classes_36k_train_022841
6,370
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None, pre_action=None, post_action=None)" }, { "docstring": "Explore the conn...
4
stack_v2_sparse_classes_30k_train_012168
Implement the Python class `BFSWithQueue` described below. Class description: Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.str...
Implement the Python class `BFSWithQueue` described below. Class description: Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.str...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class BFSWithQueue: """Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from grap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BFSWithQueue: """Breadth-First Search. Attributes ---------- graph : input graph color : dict with nodes, private distance : dict with nodes (distances to source node) parent : dict (BFS tree) dag : graph (BFS tree) Examples -------- >>> from graphtheory.structures.edges import Edge >>> from graphtheory.struc...
the_stack_v2_python_sparse
graphtheory/traversing/bfs.py
kgashok/graphs-dict
train
0
c87ba6ad7088bdda68e193c1a19e0d1d1ea3d5c4
[ "logger.info('Overriding class: Optimizer -> GWO.')\nsuper(GWO, self).__init__()\nself.build(params)\nlogger.info('Class overrided.')", "r1 = r.generate_uniform_random_number()\nr2 = r.generate_uniform_random_number()\nA = 2 * a * r1 - a\nC = 2 * r2\nreturn (A, C)", "space.agents.sort(key=lambda x: x.fit)\nalph...
<|body_start_0|> logger.info('Overriding class: Optimizer -> GWO.') super(GWO, self).__init__() self.build(params) logger.info('Class overrided.') <|end_body_0|> <|body_start_1|> r1 = r.generate_uniform_random_number() r2 = r.generate_uniform_random_number() A = ...
A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).
GWO
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GWO: """A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).""" def __init__(self, params=None): """Initializat...
stack_v2_sparse_classes_36k_train_022842
3,452
permissive
[ { "docstring": "Initialization method. Args: params (dict): Contains key-value parameters to the meta-heuristics.", "name": "__init__", "signature": "def __init__(self, params=None)" }, { "docstring": "Calculates the mathematical coefficients. Args: a (float): Linear constant. Returns: Both `A` ...
3
stack_v2_sparse_classes_30k_test_000315
Implement the Python class `GWO` described below. Class description: A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014). Method signatures and d...
Implement the Python class `GWO` described below. Class description: A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014). Method signatures and d...
09e5485b9e30eca622ad404e85c22de0c42c8abd
<|skeleton|> class GWO: """A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).""" def __init__(self, params=None): """Initializat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GWO: """A GWO class, inherited from Optimizer. This is the designed class to define GWO-related variables and methods. References: S. Mirjalili, S. Mirjalili and A. Lewis. Grey Wolf Optimizer. Advances in Engineering Software (2014).""" def __init__(self, params=None): """Initialization method. A...
the_stack_v2_python_sparse
opytimizer/optimizers/population/gwo.py
himanshuRepo/opytimizer
train
0
f9c1321e217783f89e0983c14623e997a8ee3a25
[ "database = 'scratch/chr11_and_Tcf3.db'\ntry:\n subprocess.check_output(['talon_abundance', '--db', database, '-a', 'gencode_vM7', '-b', 'mm10', '--o', 'scratch/chr11_and_Tcf3_base'])\nexcept:\n pytest.fail('Talon abundance crashed on basic case')\nabd = 'scratch/chr11_and_Tcf3_base_talon_abundance.tsv'\ndata...
<|body_start_0|> database = 'scratch/chr11_and_Tcf3.db' try: subprocess.check_output(['talon_abundance', '--db', database, '-a', 'gencode_vM7', '-b', 'mm10', '--o', 'scratch/chr11_and_Tcf3_base']) except: pytest.fail('Talon abundance crashed on basic case') abd = ...
Make sure that the abundance utility is working correctly
TestAbundance
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAbundance: """Make sure that the abundance utility is working correctly""" def test_base_settings(self): """Test abundance utility without a datasets or whitelist file.""" <|body_0|> def test_with_whitelist(self): """Test abundance utility with a transcript w...
stack_v2_sparse_classes_36k_train_022843
6,002
permissive
[ { "docstring": "Test abundance utility without a datasets or whitelist file.", "name": "test_base_settings", "signature": "def test_base_settings(self)" }, { "docstring": "Test abundance utility with a transcript whitelist", "name": "test_with_whitelist", "signature": "def test_with_whit...
4
stack_v2_sparse_classes_30k_train_010675
Implement the Python class `TestAbundance` described below. Class description: Make sure that the abundance utility is working correctly Method signatures and docstrings: - def test_base_settings(self): Test abundance utility without a datasets or whitelist file. - def test_with_whitelist(self): Test abundance utilit...
Implement the Python class `TestAbundance` described below. Class description: Make sure that the abundance utility is working correctly Method signatures and docstrings: - def test_base_settings(self): Test abundance utility without a datasets or whitelist file. - def test_with_whitelist(self): Test abundance utilit...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestAbundance: """Make sure that the abundance utility is working correctly""" def test_base_settings(self): """Test abundance utility without a datasets or whitelist file.""" <|body_0|> def test_with_whitelist(self): """Test abundance utility with a transcript w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAbundance: """Make sure that the abundance utility is working correctly""" def test_base_settings(self): """Test abundance utility without a datasets or whitelist file.""" database = 'scratch/chr11_and_Tcf3.db' try: subprocess.check_output(['talon_abundance', '--db...
the_stack_v2_python_sparse
testing_suite/test_abundance_utility.py
kopardev/TALON
train
0
64331b86df954f27de3f2e0c292da9430c104986
[ "self.require_action_permitted('grant')\nq = model.Account.all().filter('requested_actions !=', None)\nrequests = []\nfor account in q.fetch(100):\n for action in account.requested_actions:\n if check_action_permitted(self.account, 'grant'):\n requests.append({'email': account.email, 'requested...
<|body_start_0|> self.require_action_permitted('grant') q = model.Account.all().filter('requested_actions !=', None) requests = [] for account in q.fetch(100): for action in account.requested_actions: if check_action_permitted(self.account, 'grant'): ...
GrantAccess
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrantAccess: def get(self): """Shows all access requests that are waiting for approval.""" <|body_0|> def post(self): """Grants or denies a single request.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.require_action_permitted('grant') ...
stack_v2_sparse_classes_36k_train_022844
3,812
permissive
[ { "docstring": "Shows all access requests that are waiting for approval.", "name": "get", "signature": "def get(self)" }, { "docstring": "Grants or denies a single request.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_006686
Implement the Python class `GrantAccess` described below. Class description: Implement the GrantAccess class. Method signatures and docstrings: - def get(self): Shows all access requests that are waiting for approval. - def post(self): Grants or denies a single request.
Implement the Python class `GrantAccess` described below. Class description: Implement the GrantAccess class. Method signatures and docstrings: - def get(self): Shows all access requests that are waiting for approval. - def post(self): Grants or denies a single request. <|skeleton|> class GrantAccess: def get(s...
7715276b3c588f7c457de04944559052c8170f7e
<|skeleton|> class GrantAccess: def get(self): """Shows all access requests that are waiting for approval.""" <|body_0|> def post(self): """Grants or denies a single request.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GrantAccess: def get(self): """Shows all access requests that are waiting for approval.""" self.require_action_permitted('grant') q = model.Account.all().filter('requested_actions !=', None) requests = [] for account in q.fetch(100): for action in account.re...
the_stack_v2_python_sparse
app/grant_access.py
Princessgladys/googleresourcefinder
train
0
7f5cb45902c54551313011131dc9adc5ce593d03
[ "client_ip = get_client_ip(request)\nclient_dns = get_reverse_dns(client_ip)\nuser_agent = request.META['HTTP_USER_AGENT'] if 'HTTP_USER_AGENT' in request.META else ''\nObjectView.objects.create(obj=upload, viewee_ip=client_ip, viewee_dns=client_dns, viewee_user_agent=user_agent)\nLOGGER.info('Logged view', client_...
<|body_start_0|> client_ip = get_client_ip(request) client_dns = get_reverse_dns(client_ip) user_agent = request.META['HTTP_USER_AGENT'] if 'HTTP_USER_AGENT' in request.META else '' ObjectView.objects.create(obj=upload, viewee_ip=client_ip, viewee_dns=client_dns, viewee_user_agent=user_a...
View to show upload
ObjectViewFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObjectViewFile: """View to show upload""" def count_view(upload: Object, request: HttpRequest): """Create ObjectView entry from request""" <|body_0|> def resolve_hash(self, file_hash: str) -> QuerySet: """Resolve hash to QuerySet based on string length""" ...
stack_v2_sparse_classes_36k_train_022845
2,885
permissive
[ { "docstring": "Create ObjectView entry from request", "name": "count_view", "signature": "def count_view(upload: Object, request: HttpRequest)" }, { "docstring": "Resolve hash to QuerySet based on string length", "name": "resolve_hash", "signature": "def resolve_hash(self, file_hash: st...
3
stack_v2_sparse_classes_30k_train_007765
Implement the Python class `ObjectViewFile` described below. Class description: View to show upload Method signatures and docstrings: - def count_view(upload: Object, request: HttpRequest): Create ObjectView entry from request - def resolve_hash(self, file_hash: str) -> QuerySet: Resolve hash to QuerySet based on str...
Implement the Python class `ObjectViewFile` described below. Class description: View to show upload Method signatures and docstrings: - def count_view(upload: Object, request: HttpRequest): Create ObjectView entry from request - def resolve_hash(self, file_hash: str) -> QuerySet: Resolve hash to QuerySet based on str...
84bf18262af59e45502a9e862d1a85c5cecd63ac
<|skeleton|> class ObjectViewFile: """View to show upload""" def count_view(upload: Object, request: HttpRequest): """Create ObjectView entry from request""" <|body_0|> def resolve_hash(self, file_hash: str) -> QuerySet: """Resolve hash to QuerySet based on string length""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ObjectViewFile: """View to show upload""" def count_view(upload: Object, request: HttpRequest): """Create ObjectView entry from request""" client_ip = get_client_ip(request) client_dns = get_reverse_dns(client_ip) user_agent = request.META['HTTP_USER_AGENT'] if 'HTTP_USER_...
the_stack_v2_python_sparse
pyazo/core/views/view.py
BeryJu/pyazo
train
5
d44601b703d8c2dd1d7270e847125c0bb5c79035
[ "self.path = path\nself.bot = bot\nself.user = user\nself.save_data = save_data\nself.overwrite = overwrite\nself.files_to_save = files_to_save", "DataImporter.processor.prepare_training_data_for_validation(self.bot, self.path, REQUIREMENTS - self.files_to_save)\ndata_path = os.path.join(self.path, DEFAULT_DATA_P...
<|body_start_0|> self.path = path self.bot = bot self.user = user self.save_data = save_data self.overwrite = overwrite self.files_to_save = files_to_save <|end_body_0|> <|body_start_1|> DataImporter.processor.prepare_training_data_for_validation(self.bot, self.p...
Class to import training data into kairon. A validation is run over training data before initiating the import process.
DataImporter
[ "MIT", "CC0-1.0", "CC-BY-3.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Python-2.0", "ISC", "Apache-2.0", "BSD-2-Clause", "AFL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataImporter: """Class to import training data into kairon. A validation is run over training data before initiating the import process.""" def __init__(self, path: Text, bot: Text, user: Text, files_to_save: set, save_data: bool=True, overwrite: bool=True): """Initialize data import...
stack_v2_sparse_classes_36k_train_022846
2,648
permissive
[ { "docstring": "Initialize data importer", "name": "__init__", "signature": "def __init__(self, path: Text, bot: Text, user: Text, files_to_save: set, save_data: bool=True, overwrite: bool=True)" }, { "docstring": "Validates domain and data files to check for possible mistakes and logs them into...
3
null
Implement the Python class `DataImporter` described below. Class description: Class to import training data into kairon. A validation is run over training data before initiating the import process. Method signatures and docstrings: - def __init__(self, path: Text, bot: Text, user: Text, files_to_save: set, save_data:...
Implement the Python class `DataImporter` described below. Class description: Class to import training data into kairon. A validation is run over training data before initiating the import process. Method signatures and docstrings: - def __init__(self, path: Text, bot: Text, user: Text, files_to_save: set, save_data:...
6a2f0a056dbfe5c041fd9e00a6f5b878e339309e
<|skeleton|> class DataImporter: """Class to import training data into kairon. A validation is run over training data before initiating the import process.""" def __init__(self, path: Text, bot: Text, user: Text, files_to_save: set, save_data: bool=True, overwrite: bool=True): """Initialize data import...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataImporter: """Class to import training data into kairon. A validation is run over training data before initiating the import process.""" def __init__(self, path: Text, bot: Text, user: Text, files_to_save: set, save_data: bool=True, overwrite: bool=True): """Initialize data importer""" ...
the_stack_v2_python_sparse
kairon/importer/data_importer.py
rtilabs/kairon
train
0
519d8d428a05e407267b3acf7b29ef3992a0bb32
[ "if matrix == [] or matrix[0] == []:\n return []\nrows = len(matrix)\ncolomns = len(matrix[0])\ntotal = rows * colomns\nvisitied = [[False] * colomns for _ in range(rows)]\nans = [0] * total\ndirections = [[0, 1], [1, 0], [0, -1], [-1, 0]]\ndirec_idx = 0\nrow, colomn = (0, 0)\nfor i in range(total):\n ans[i] ...
<|body_start_0|> if matrix == [] or matrix[0] == []: return [] rows = len(matrix) colomns = len(matrix[0]) total = rows * colomns visitied = [[False] * colomns for _ in range(rows)] ans = [0] * total directions = [[0, 1], [1, 0], [0, -1], [-1, 0]] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def spiralOrder(self, matrix): """方法一:模拟 可以模拟螺旋矩阵的路径。初始位置是矩阵的左上角,初始方向是向右,当路径超出界限或者进入之前访问过的位置时,则顺时针旋转,进入下一个方向。 判断路径是否进入之前访问过的位置需要使用一个与输入矩阵大小相同的辅助矩阵 visited extit{visited}visited,其中的每个元素表示该位置 是否被访问过。当一个元素被访问时,将 visited extit{visited}visited 中的对应位置的元素设为已访问。 如何判断路径是否结束?由于矩阵中的每个元素都被...
stack_v2_sparse_classes_36k_train_022847
5,333
no_license
[ { "docstring": "方法一:模拟 可以模拟螺旋矩阵的路径。初始位置是矩阵的左上角,初始方向是向右,当路径超出界限或者进入之前访问过的位置时,则顺时针旋转,进入下一个方向。 判断路径是否进入之前访问过的位置需要使用一个与输入矩阵大小相同的辅助矩阵 visited extit{visited}visited,其中的每个元素表示该位置 是否被访问过。当一个元素被访问时,将 visited extit{visited}visited 中的对应位置的元素设为已访问。 如何判断路径是否结束?由于矩阵中的每个元素都被访问一次,因此路径的长度即为矩阵中的元素数量,当路径的长度达到矩阵中的元素数量时即为完整路 径,将该路径...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def spiralOrder(self, matrix): 方法一:模拟 可以模拟螺旋矩阵的路径。初始位置是矩阵的左上角,初始方向是向右,当路径超出界限或者进入之前访问过的位置时,则顺时针旋转,进入下一个方向。 判断路径是否进入之前访问过的位置需要使用一个与输入矩阵大小相同的辅助矩阵 visited extit{visited}visited,其中的每...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def spiralOrder(self, matrix): 方法一:模拟 可以模拟螺旋矩阵的路径。初始位置是矩阵的左上角,初始方向是向右,当路径超出界限或者进入之前访问过的位置时,则顺时针旋转,进入下一个方向。 判断路径是否进入之前访问过的位置需要使用一个与输入矩阵大小相同的辅助矩阵 visited extit{visited}visited,其中的每...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def spiralOrder(self, matrix): """方法一:模拟 可以模拟螺旋矩阵的路径。初始位置是矩阵的左上角,初始方向是向右,当路径超出界限或者进入之前访问过的位置时,则顺时针旋转,进入下一个方向。 判断路径是否进入之前访问过的位置需要使用一个与输入矩阵大小相同的辅助矩阵 visited extit{visited}visited,其中的每个元素表示该位置 是否被访问过。当一个元素被访问时,将 visited extit{visited}visited 中的对应位置的元素设为已访问。 如何判断路径是否结束?由于矩阵中的每个元素都被...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def spiralOrder(self, matrix): """方法一:模拟 可以模拟螺旋矩阵的路径。初始位置是矩阵的左上角,初始方向是向右,当路径超出界限或者进入之前访问过的位置时,则顺时针旋转,进入下一个方向。 判断路径是否进入之前访问过的位置需要使用一个与输入矩阵大小相同的辅助矩阵 visited extit{visited}visited,其中的每个元素表示该位置 是否被访问过。当一个元素被访问时,将 visited extit{visited}visited 中的对应位置的元素设为已访问。 如何判断路径是否结束?由于矩阵中的每个元素都被访问一次,因此路径的长度即为...
the_stack_v2_python_sparse
LeetCode/Offer/顺时针打印矩阵.py
XyK0907/for_work
train
0
0985bfbd2365501d77a0cd68fa92eb909cedfe54
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.room'.casefold():\n from .room import Ro...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
Place
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Place: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Place: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Place""" ...
stack_v2_sparse_classes_36k_train_022848
3,774
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Place", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_n...
3
null
Implement the Python class `Place` described below. Class description: Implement the Place class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Place: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
Implement the Python class `Place` described below. Class description: Implement the Place class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Place: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The p...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Place: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Place: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Place""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Place: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Place: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Place""" if not pars...
the_stack_v2_python_sparse
msgraph/generated/models/place.py
microsoftgraph/msgraph-sdk-python
train
135
bb20598c03fd3065d83bdca54e9cf29e7ae7cbd4
[ "self.original_graph = graph_dict\nself.graph = graph_dict\nself.nodes = {}\nself.counter = 0\nself.neighbour_colors = []\nself.wrong_nodes = []", "for node in self.graph:\n node_obj = Node(node, self.graph[node])\n self.nodes[node] = node_obj\nfor node in self.nodes:\n obj = self.nodes[node]\n n_list...
<|body_start_0|> self.original_graph = graph_dict self.graph = graph_dict self.nodes = {} self.counter = 0 self.neighbour_colors = [] self.wrong_nodes = [] <|end_body_0|> <|body_start_1|> for node in self.graph: node_obj = Node(node, self.graph[node])...
Graph class, representing a country with provinces or states
Graph
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: """Graph class, representing a country with provinces or states""" def __init__(self, graph_dict): """initialize object by giving it a dictonary representing the adjecency list""" <|body_0|> def create_graph(self): """creates nodes and connects them in the...
stack_v2_sparse_classes_36k_train_022849
2,866
no_license
[ { "docstring": "initialize object by giving it a dictonary representing the adjecency list", "name": "__init__", "signature": "def __init__(self, graph_dict)" }, { "docstring": "creates nodes and connects them in the graph", "name": "create_graph", "signature": "def create_graph(self)" ...
5
stack_v2_sparse_classes_30k_test_000017
Implement the Python class `Graph` described below. Class description: Graph class, representing a country with provinces or states Method signatures and docstrings: - def __init__(self, graph_dict): initialize object by giving it a dictonary representing the adjecency list - def create_graph(self): creates nodes and...
Implement the Python class `Graph` described below. Class description: Graph class, representing a country with provinces or states Method signatures and docstrings: - def __init__(self, graph_dict): initialize object by giving it a dictonary representing the adjecency list - def create_graph(self): creates nodes and...
50411bb6814a30008a83a3ecabab2ce49dae1fea
<|skeleton|> class Graph: """Graph class, representing a country with provinces or states""" def __init__(self, graph_dict): """initialize object by giving it a dictonary representing the adjecency list""" <|body_0|> def create_graph(self): """creates nodes and connects them in the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: """Graph class, representing a country with provinces or states""" def __init__(self, graph_dict): """initialize object by giving it a dictonary representing the adjecency list""" self.original_graph = graph_dict self.graph = graph_dict self.nodes = {} self....
the_stack_v2_python_sparse
datastructure/graph.py
matt-mrf/QuMaDel
train
0
4422acca830f4a9655593caba658adf316d3a8c7
[ "image_file = StringIO.StringIO(temp_image.read())\nimage = Image.open(image_file)\nreturn image", "try:\n for orientation in ExifTags.TAGS.keys():\n if ExifTags.TAGS[orientation] == 'Orientation':\n exif = dict(image._getexif().items())\n if exif[orientation] == 3:\n ...
<|body_start_0|> image_file = StringIO.StringIO(temp_image.read()) image = Image.open(image_file) return image <|end_body_0|> <|body_start_1|> try: for orientation in ExifTags.TAGS.keys(): if ExifTags.TAGS[orientation] == 'Orientation': ex...
Assisting methods to help with file upload processes.
PhotoUpload
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhotoUpload: """Assisting methods to help with file upload processes.""" def open_image(temp_image): """Open a this image using StringIO.""" <|body_0|> def check_image_orientation(image): """Digital photo devices attach EXIF data to an image when a photo is taken...
stack_v2_sparse_classes_36k_train_022850
3,690
no_license
[ { "docstring": "Open a this image using StringIO.", "name": "open_image", "signature": "def open_image(temp_image)" }, { "docstring": "Digital photo devices attach EXIF data to an image when a photo is taken. In order to display an image appropriately without it getting rotated, we need to check...
6
stack_v2_sparse_classes_30k_train_016611
Implement the Python class `PhotoUpload` described below. Class description: Assisting methods to help with file upload processes. Method signatures and docstrings: - def open_image(temp_image): Open a this image using StringIO. - def check_image_orientation(image): Digital photo devices attach EXIF data to an image ...
Implement the Python class `PhotoUpload` described below. Class description: Assisting methods to help with file upload processes. Method signatures and docstrings: - def open_image(temp_image): Open a this image using StringIO. - def check_image_orientation(image): Digital photo devices attach EXIF data to an image ...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class PhotoUpload: """Assisting methods to help with file upload processes.""" def open_image(temp_image): """Open a this image using StringIO.""" <|body_0|> def check_image_orientation(image): """Digital photo devices attach EXIF data to an image when a photo is taken...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhotoUpload: """Assisting methods to help with file upload processes.""" def open_image(temp_image): """Open a this image using StringIO.""" image_file = StringIO.StringIO(temp_image.read()) image = Image.open(image_file) return image def check_image_orientation(image...
the_stack_v2_python_sparse
common/service/photo_upload.py
wcirillo/ten
train
0
4be61a93cd39fd5a2c04be4ecfc16ceeceaa8a98
[ "self._uri = uri\nself._download_list = download_list\nself._hashes = hashes\nif hashes:\n self.validate = self._validate\nelse:\n self.validate = self._validate_legacy", "for file_path in self._download_list:\n if self.validate(file_path):\n continue\n uri = '%s/%s' % (self._uri, os.path.basen...
<|body_start_0|> self._uri = uri self._download_list = download_list self._hashes = hashes if hashes: self.validate = self._validate else: self.validate = self._validate_legacy <|end_body_0|> <|body_start_1|> for file_path in self._download_list: ...
A helper to fetch multiple artifacts.
Downloader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Downloader: """A helper to fetch multiple artifacts.""" def __init__(self, uri, download_list, hashes): """Initializes a download helper for android based images.""" <|body_0|> def download(self): """Downloads and validates the download list.""" <|body_1|...
stack_v2_sparse_classes_36k_train_022851
4,060
no_license
[ { "docstring": "Initializes a download helper for android based images.", "name": "__init__", "signature": "def __init__(self, uri, download_list, hashes)" }, { "docstring": "Downloads and validates the download list.", "name": "download", "signature": "def download(self)" }, { "...
5
stack_v2_sparse_classes_30k_train_002538
Implement the Python class `Downloader` described below. Class description: A helper to fetch multiple artifacts. Method signatures and docstrings: - def __init__(self, uri, download_list, hashes): Initializes a download helper for android based images. - def download(self): Downloads and validates the download list....
Implement the Python class `Downloader` described below. Class description: A helper to fetch multiple artifacts. Method signatures and docstrings: - def __init__(self, uri, download_list, hashes): Initializes a download helper for android based images. - def download(self): Downloads and validates the download list....
b9716c9cb682e3288780e13226e7f0862c5b74f3
<|skeleton|> class Downloader: """A helper to fetch multiple artifacts.""" def __init__(self, uri, download_list, hashes): """Initializes a download helper for android based images.""" <|body_0|> def download(self): """Downloads and validates the download list.""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Downloader: """A helper to fetch multiple artifacts.""" def __init__(self, uri, download_list, hashes): """Initializes a download helper for android based images.""" self._uri = uri self._download_list = download_list self._hashes = hashes if hashes: se...
the_stack_v2_python_sparse
phabletutils/downloads.py
Silv3rSurf3r/phablet-tools
train
1
437b9007bf90c846834771329bd0406d5bf74247
[ "print('Getting building and property violations...')\nstartTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('liweixi_mogujzhu', 'liweixi_mogujzhu')\nurl = 'https://data.boston.gov/dataset/5e634724-fe64-4762-9648-b4ceb3da5510/resource/90ed3816-5e70-443c-803d-...
<|body_start_0|> print('Getting building and property violations...') startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('liweixi_mogujzhu', 'liweixi_mogujzhu') url = 'https://data.boston.gov/dataset/5e634724-fe64-4...
building_and_property_violations
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class building_and_property_violations: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document de...
stack_v2_sparse_classes_36k_train_022852
4,316
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `building_and_property_violations` described below. Class description: Implement the building_and_property_violations class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.m...
Implement the Python class `building_and_property_violations` described below. Class description: Implement the building_and_property_violations class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.m...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class building_and_property_violations: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class building_and_property_violations: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" print('Getting building and property violations...') startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() rep...
the_stack_v2_python_sparse
liweixi_mogujzhu/building_and_property_violations.py
maximega/course-2019-spr-proj
train
2
f99f6b3997256d761085d9b0f6d480db3bd1349e
[ "if root is None:\n return None\nres = TreeNode(root.val)\nif len(root.children) != 0:\n res.left = self.encode(root.children[0])\ncur = res.left\nfor i in range(1, len(root.children)):\n cur.right = self.encode(root.children[i])\n cur = cur.right\nreturn res", "if not root:\n return None\nres = No...
<|body_start_0|> if root is None: return None res = TreeNode(root.val) if len(root.children) != 0: res.left = self.encode(root.children[0]) cur = res.left for i in range(1, len(root.children)): cur.right = self.encode(root.children[i]) ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, root): """Decodes your binary tree to an n-ary tree. :type root: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_022853
893
permissive
[ { "docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode", "name": "encode", "signature": "def encode(self, root)" }, { "docstring": "Decodes your binary tree to an n-ary tree. :type root: TreeNode :rtype: Node", "name": "decode", "signature": "def decode...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, root): Decodes your binary tree to an n-ary tree. :type root: TreeN...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, root): Decodes your binary tree to an n-ary tree. :type root: TreeN...
1dbd18114ed688ddeaa3ee83181d373dcc1429e5
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, root): """Decodes your binary tree to an n-ary tree. :type root: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" if root is None: return None res = TreeNode(root.val) if len(root.children) != 0: res.left = self.encode(root.children[0]) cur = res.le...
the_stack_v2_python_sparse
source/All_Solutions/0431.将N叉树编码为二叉树/0431-将N叉树编码为二叉树.py
zhangwang0537/LeetCode-Notebook
train
0
4986d7562765fae465ddffef852a0071fca82fc4
[ "for k, v in filters.items():\n if len(v) <= 0:\n continue\n if 'LIKE' in v:\n where_info[k + '__contains'] = v['LIKE']\n if 'START' in v:\n where_info[k + '__gte'] = v['START']\n if 'END' in v:\n where_info[k + '__lte'] = v['END']\n if 'LIST' in v:\n where_info[k +...
<|body_start_0|> for k, v in filters.items(): if len(v) <= 0: continue if 'LIKE' in v: where_info[k + '__contains'] = v['LIKE'] if 'START' in v: where_info[k + '__gte'] = v['START'] if 'END' in v: whe...
Common
[ "Apache-2.0", "BSD-3-Clause", "LGPL-3.0-only", "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Common: def convert_filters(cls, filters, where_info): """[概要] jsフィルターをDjangoORM filterに変換する [引数] filters : dict where_info : dict DjangoORM filter""" <|body_0|> def get_mail_notification_list(cls): """[概要] メール通知先リストを取得する [戻り値] mail_list : list メールリスト""" <|bo...
stack_v2_sparse_classes_36k_train_022854
9,642
permissive
[ { "docstring": "[概要] jsフィルターをDjangoORM filterに変換する [引数] filters : dict where_info : dict DjangoORM filter", "name": "convert_filters", "signature": "def convert_filters(cls, filters, where_info)" }, { "docstring": "[概要] メール通知先リストを取得する [戻り値] mail_list : list メールリスト", "name": "get_mail_notific...
2
stack_v2_sparse_classes_30k_train_007690
Implement the Python class `Common` described below. Class description: Implement the Common class. Method signatures and docstrings: - def convert_filters(cls, filters, where_info): [概要] jsフィルターをDjangoORM filterに変換する [引数] filters : dict where_info : dict DjangoORM filter - def get_mail_notification_list(cls): [概要] メ...
Implement the Python class `Common` described below. Class description: Implement the Common class. Method signatures and docstrings: - def convert_filters(cls, filters, where_info): [概要] jsフィルターをDjangoORM filterに変換する [引数] filters : dict where_info : dict DjangoORM filter - def get_mail_notification_list(cls): [概要] メ...
c00ea4fe1bf4b4a18d545aabeaaf1d95c7664b94
<|skeleton|> class Common: def convert_filters(cls, filters, where_info): """[概要] jsフィルターをDjangoORM filterに変換する [引数] filters : dict where_info : dict DjangoORM filter""" <|body_0|> def get_mail_notification_list(cls): """[概要] メール通知先リストを取得する [戻り値] mail_list : list メールリスト""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Common: def convert_filters(cls, filters, where_info): """[概要] jsフィルターをDjangoORM filterに変換する [引数] filters : dict where_info : dict DjangoORM filter""" for k, v in filters.items(): if len(v) <= 0: continue if 'LIKE' in v: where_info[k + '_...
the_stack_v2_python_sparse
oase-root/libs/webcommonlibs/common.py
exastro-suite/oase
train
10
a24a4c20d40bdcb7673427c50a95fcd71e5db044
[ "super(FunctionComponent, self).__init__(opts)\nself.res_options = opts.get('resilient', {})\nself.options = opts.get('pagerduty', {})\nvalidate_fields(['api_token', 'from_email'], self.options)\nself.log = logging.getLogger(__name__)", "self.res_options = opts.get('resilient', {})\nself.options = opts.get('pager...
<|body_start_0|> super(FunctionComponent, self).__init__(opts) self.res_options = opts.get('resilient', {}) self.options = opts.get('pagerduty', {}) validate_fields(['api_token', 'from_email'], self.options) self.log = logging.getLogger(__name__) <|end_body_0|> <|body_start_1|> ...
Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved
FunctionComponent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved""" def __init__(self, opts): """constructor provides a...
stack_v2_sparse_classes_36k_train_022855
2,316
permissive
[ { "docstring": "constructor provides access to the configuration options", "name": "__init__", "signature": "def __init__(self, opts)" }, { "docstring": "Configuration options have changed, save new values", "name": "_reload", "signature": "def _reload(self, event, opts)" }, { "d...
3
stack_v2_sparse_classes_30k_train_019679
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved Method signatures and docst...
Implement the Python class `FunctionComponent` described below. Class description: Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved Method signatures and docst...
6878c78b94eeca407998a41ce8db2cc00f2b6758
<|skeleton|> class FunctionComponent: """Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved""" def __init__(self, opts): """constructor provides a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FunctionComponent: """Component that implements Resilient function 'pagerduty_transition_incident Transitioning an incident can be used to update specific fields (such as priority) or Change the status to acknowledged or resolved""" def __init__(self, opts): """constructor provides access to the ...
the_stack_v2_python_sparse
fn_pagerduty/fn_pagerduty/components/funct_pagerduty_transition_incident.py
ibmresilient/resilient-community-apps
train
81
1bc37225bc197a721a20e29fb5c647295f4571f9
[ "def MatchCore(s, p, s_check, p_check, length_s, length_p):\n if s_check >= length_s and p_check >= length_p:\n return True\n if s_check != length_s and p_check >= length_p:\n return False\n if p[p_check + 1] == '*':\n if p[p_check] == s[s_check] or (p[p_check] == '.' and s_check != le...
<|body_start_0|> def MatchCore(s, p, s_check, p_check, length_s, length_p): if s_check >= length_s and p_check >= length_p: return True if s_check != length_s and p_check >= length_p: return False if p[p_check + 1] == '*': if p[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch2(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> def isMatch3(self, s, p): """note----------------------- '.'匹配任意字符,'*'只能匹...
stack_v2_sparse_classes_36k_train_022856
5,762
no_license
[ { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch", "signature": "def isMatch(self, s, p)" }, { "docstring": ":type s: str :type p: str :rtype: bool", "name": "isMatch2", "signature": "def isMatch2(self, s, p)" }, { "docstring": "note----------------------...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch2(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch3(self, s, p): note---------------...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isMatch(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch2(self, s, p): :type s: str :type p: str :rtype: bool - def isMatch3(self, s, p): note---------------...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_0|> def isMatch2(self, s, p): """:type s: str :type p: str :rtype: bool""" <|body_1|> def isMatch3(self, s, p): """note----------------------- '.'匹配任意字符,'*'只能匹...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isMatch(self, s, p): """:type s: str :type p: str :rtype: bool""" def MatchCore(s, p, s_check, p_check, length_s, length_p): if s_check >= length_s and p_check >= length_p: return True if s_check != length_s and p_check >= length_p: ...
the_stack_v2_python_sparse
isMatch.py
NeilWangziyu/Leetcode_py
train
2
cb42949a9214564ad26592c66e839898d2b3695c
[ "try:\n user_message = MessageService.get_message_as_dto(message_id, token_auth.current_user())\n return (user_message.to_primitive(), 200)\nexcept MessageServiceError as e:\n return ({'Error': str(e).split('-')[1], 'SubCode': str(e).split('-')[0]}, 403)", "try:\n MessageService.delete_message(message...
<|body_start_0|> try: user_message = MessageService.get_message_as_dto(message_id, token_auth.current_user()) return (user_message.to_primitive(), 200) except MessageServiceError as e: return ({'Error': str(e).split('-')[1], 'SubCode': str(e).split('-')[0]}, 403) <|en...
NotificationsRestAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationsRestAPI: def get(self, message_id): """Gets the specified message --- tags: - notifications produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - nam...
stack_v2_sparse_classes_36k_train_022857
7,889
permissive
[ { "docstring": "Gets the specified message --- tags: - notifications produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: message_id in: path description: The unique message requi...
2
null
Implement the Python class `NotificationsRestAPI` described below. Class description: Implement the NotificationsRestAPI class. Method signatures and docstrings: - def get(self, message_id): Gets the specified message --- tags: - notifications produces: - application/json parameters: - in: header name: Authorization ...
Implement the Python class `NotificationsRestAPI` described below. Class description: Implement the NotificationsRestAPI class. Method signatures and docstrings: - def get(self, message_id): Gets the specified message --- tags: - notifications produces: - application/json parameters: - in: header name: Authorization ...
45bf3937c74902226096aee5b49e7abea62df524
<|skeleton|> class NotificationsRestAPI: def get(self, message_id): """Gets the specified message --- tags: - notifications produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - nam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationsRestAPI: def get(self, message_id): """Gets the specified message --- tags: - notifications produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: message_id ...
the_stack_v2_python_sparse
backend/api/notifications/resources.py
hotosm/tasking-manager
train
526
46eaff679d7537647f4bc1f3722d59179c6db870
[ "try:\n content_type = decide_content_type(self.request.headers.getall(hdrs.ACCEPT), SUPPORTED_CONTENT_TYPES)\nexcept NoAgreeableContentTypeError as e:\n raise web.HTTPNotAcceptable() from e\ncatalogs = await fetch_catalogs()\nbody = catalogs.serialize(format=content_type, encoding='utf-8')\nreturn web.Respon...
<|body_start_0|> try: content_type = decide_content_type(self.request.headers.getall(hdrs.ACCEPT), SUPPORTED_CONTENT_TYPES) except NoAgreeableContentTypeError as e: raise web.HTTPNotAcceptable() from e catalogs = await fetch_catalogs() body = catalogs.serialize(fo...
Class representing catalogs resoweb.urce.
Catalogs
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Catalogs: """Class representing catalogs resoweb.urce.""" async def get(self) -> web.Response: """Get all catalogs.""" <|body_0|> async def post(self) -> web.Response: """Create a catalog and return the resulting graph.""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_022858
3,608
permissive
[ { "docstring": "Get all catalogs.", "name": "get", "signature": "async def get(self) -> web.Response" }, { "docstring": "Create a catalog and return the resulting graph.", "name": "post", "signature": "async def post(self) -> web.Response" } ]
2
stack_v2_sparse_classes_30k_train_011578
Implement the Python class `Catalogs` described below. Class description: Class representing catalogs resoweb.urce. Method signatures and docstrings: - async def get(self) -> web.Response: Get all catalogs. - async def post(self) -> web.Response: Create a catalog and return the resulting graph.
Implement the Python class `Catalogs` described below. Class description: Class representing catalogs resoweb.urce. Method signatures and docstrings: - async def get(self) -> web.Response: Get all catalogs. - async def post(self) -> web.Response: Create a catalog and return the resulting graph. <|skeleton|> class Ca...
86d1525d9bd58644384e1760711968adb948956e
<|skeleton|> class Catalogs: """Class representing catalogs resoweb.urce.""" async def get(self) -> web.Response: """Get all catalogs.""" <|body_0|> async def post(self) -> web.Response: """Create a catalog and return the resulting graph.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Catalogs: """Class representing catalogs resoweb.urce.""" async def get(self) -> web.Response: """Get all catalogs.""" try: content_type = decide_content_type(self.request.headers.getall(hdrs.ACCEPT), SUPPORTED_CONTENT_TYPES) except NoAgreeableContentTypeError as e: ...
the_stack_v2_python_sparse
dataservice_publisher/resources/catalogs.py
Informasjonsforvaltning/dataservice-publisher
train
1
697d43254289ce54ac3ea2745d14ddcfda16c393
[ "repeat = set()\nma, mi = (0, 14)\nfor num in nums:\n if num == 0:\n continue\n ma = max(ma, num)\n mi = min(mi, num)\n if num in repeat:\n return False\n repeat.add(num)\nreturn ma - mi < 5", "repeat = set()\nma, mi = (0, 14)\nfor num in nums:\n if num == 0:\n continue\n ...
<|body_start_0|> repeat = set() ma, mi = (0, 14) for num in nums: if num == 0: continue ma = max(ma, num) mi = min(mi, num) if num in repeat: return False repeat.add(num) return ma - mi < 5 <|end_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isStraight_1(self, nums: List[int]) -> bool: """方法一: 集合 Set + 遍历 时间复杂度 O(N) = O(5) = O(1): 其中 N 为 nums 长度,本题中 N≡5 ;遍历数组使用 O(N) 时间。 空间复杂度 O(N) = O(5) = O(1): 用于判重的辅助 Set 使用 O(N) 额外空间。 :param nums: :return:""" <|body_0|> def isStraight_2(self, nums: List[int]) ->...
stack_v2_sparse_classes_36k_train_022859
2,241
no_license
[ { "docstring": "方法一: 集合 Set + 遍历 时间复杂度 O(N) = O(5) = O(1): 其中 N 为 nums 长度,本题中 N≡5 ;遍历数组使用 O(N) 时间。 空间复杂度 O(N) = O(5) = O(1): 用于判重的辅助 Set 使用 O(N) 额外空间。 :param nums: :return:", "name": "isStraight_1", "signature": "def isStraight_1(self, nums: List[int]) -> bool" }, { "docstring": "方法二:排序 + 遍历 时间复...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isStraight_1(self, nums: List[int]) -> bool: 方法一: 集合 Set + 遍历 时间复杂度 O(N) = O(5) = O(1): 其中 N 为 nums 长度,本题中 N≡5 ;遍历数组使用 O(N) 时间。 空间复杂度 O(N) = O(5) = O(1): 用于判重的辅助 Set 使用 O(N) ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isStraight_1(self, nums: List[int]) -> bool: 方法一: 集合 Set + 遍历 时间复杂度 O(N) = O(5) = O(1): 其中 N 为 nums 长度,本题中 N≡5 ;遍历数组使用 O(N) 时间。 空间复杂度 O(N) = O(5) = O(1): 用于判重的辅助 Set 使用 O(N) ...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def isStraight_1(self, nums: List[int]) -> bool: """方法一: 集合 Set + 遍历 时间复杂度 O(N) = O(5) = O(1): 其中 N 为 nums 长度,本题中 N≡5 ;遍历数组使用 O(N) 时间。 空间复杂度 O(N) = O(5) = O(1): 用于判重的辅助 Set 使用 O(N) 额外空间。 :param nums: :return:""" <|body_0|> def isStraight_2(self, nums: List[int]) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isStraight_1(self, nums: List[int]) -> bool: """方法一: 集合 Set + 遍历 时间复杂度 O(N) = O(5) = O(1): 其中 N 为 nums 长度,本题中 N≡5 ;遍历数组使用 O(N) 时间。 空间复杂度 O(N) = O(5) = O(1): 用于判重的辅助 Set 使用 O(N) 额外空间。 :param nums: :return:""" repeat = set() ma, mi = (0, 14) for num in nums: ...
the_stack_v2_python_sparse
剑指 Offer(第 2 版)/isStraight.py
MaoningGuan/LeetCode
train
3
292b2af961701b74eb5760c8c5e176b697f4f05c
[ "self._pi = _pi\nself.A = state_transitions\nself.B = observations", "if sequences and len(sequences) != 0:\n observation = sequences[0]\nreturn None" ]
<|body_start_0|> self._pi = _pi self.A = state_transitions self.B = observations <|end_body_0|> <|body_start_1|> if sequences and len(sequences) != 0: observation = sequences[0] return None <|end_body_1|>
HiddenMarkovModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HiddenMarkovModel: def __init__(self, _pi, state_transitions, observations): """:param _pi: 初始状态概率向量 numpy.array (n,) 状态长度n :param A: 状态转移矩阵 numpy.array (n,n) 状态长度n :param B: 观测概率矩阵 numpy.array (n,m) 状态长度n,观测集合长度为m""" <|body_0|> def predict(self, sequences): """:para...
stack_v2_sparse_classes_36k_train_022860
751
no_license
[ { "docstring": ":param _pi: 初始状态概率向量 numpy.array (n,) 状态长度n :param A: 状态转移矩阵 numpy.array (n,n) 状态长度n :param B: 观测概率矩阵 numpy.array (n,m) 状态长度n,观测集合长度为m", "name": "__init__", "signature": "def __init__(self, _pi, state_transitions, observations)" }, { "docstring": ":param sequences: 已知观测序列 {0,1,2,...
2
null
Implement the Python class `HiddenMarkovModel` described below. Class description: Implement the HiddenMarkovModel class. Method signatures and docstrings: - def __init__(self, _pi, state_transitions, observations): :param _pi: 初始状态概率向量 numpy.array (n,) 状态长度n :param A: 状态转移矩阵 numpy.array (n,n) 状态长度n :param B: 观测概率矩阵 ...
Implement the Python class `HiddenMarkovModel` described below. Class description: Implement the HiddenMarkovModel class. Method signatures and docstrings: - def __init__(self, _pi, state_transitions, observations): :param _pi: 初始状态概率向量 numpy.array (n,) 状态长度n :param A: 状态转移矩阵 numpy.array (n,n) 状态长度n :param B: 观测概率矩阵 ...
49e1db9ecbfbf886a11ce416eea402d214cf2049
<|skeleton|> class HiddenMarkovModel: def __init__(self, _pi, state_transitions, observations): """:param _pi: 初始状态概率向量 numpy.array (n,) 状态长度n :param A: 状态转移矩阵 numpy.array (n,n) 状态长度n :param B: 观测概率矩阵 numpy.array (n,m) 状态长度n,观测集合长度为m""" <|body_0|> def predict(self, sequences): """:para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HiddenMarkovModel: def __init__(self, _pi, state_transitions, observations): """:param _pi: 初始状态概率向量 numpy.array (n,) 状态长度n :param A: 状态转移矩阵 numpy.array (n,n) 状态长度n :param B: 观测概率矩阵 numpy.array (n,m) 状态长度n,观测集合长度为m""" self._pi = _pi self.A = state_transitions self.B = observati...
the_stack_v2_python_sparse
NLP/Viterbi/Hidden_Markov_model.py
DaiJitao/machine_learning
train
3
71810d4ab61c3807d87baae1f7679e9739d71cff
[ "test_layer = talking_heads_attention.TalkingHeadsAttention(num_heads=12, key_size=64)\nfrom_tensor = tf.keras.Input(shape=(40, 80))\nto_tensor = tf.keras.Input(shape=(20, 80))\noutput = test_layer([from_tensor, to_tensor])\nself.assertEqual(output.shape.as_list(), [None, 40, 80])", "test_layer = talking_heads_at...
<|body_start_0|> test_layer = talking_heads_attention.TalkingHeadsAttention(num_heads=12, key_size=64) from_tensor = tf.keras.Input(shape=(40, 80)) to_tensor = tf.keras.Input(shape=(20, 80)) output = test_layer([from_tensor, to_tensor]) self.assertEqual(output.shape.as_list(), [N...
MultiHeadAttentionTest
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttentionTest: def test_non_masked_attention(self): """Test that the attention layer can be created without a mask tensor.""" <|body_0|> def test_non_masked_self_attention(self): """Test with one input (self-attenntion) and no mask tensor.""" <|body_...
stack_v2_sparse_classes_36k_train_022861
4,090
permissive
[ { "docstring": "Test that the attention layer can be created without a mask tensor.", "name": "test_non_masked_attention", "signature": "def test_non_masked_attention(self)" }, { "docstring": "Test with one input (self-attenntion) and no mask tensor.", "name": "test_non_masked_self_attention...
4
stack_v2_sparse_classes_30k_train_008435
Implement the Python class `MultiHeadAttentionTest` described below. Class description: Implement the MultiHeadAttentionTest class. Method signatures and docstrings: - def test_non_masked_attention(self): Test that the attention layer can be created without a mask tensor. - def test_non_masked_self_attention(self): T...
Implement the Python class `MultiHeadAttentionTest` described below. Class description: Implement the MultiHeadAttentionTest class. Method signatures and docstrings: - def test_non_masked_attention(self): Test that the attention layer can be created without a mask tensor. - def test_non_masked_self_attention(self): T...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class MultiHeadAttentionTest: def test_non_masked_attention(self): """Test that the attention layer can be created without a mask tensor.""" <|body_0|> def test_non_masked_self_attention(self): """Test with one input (self-attenntion) and no mask tensor.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadAttentionTest: def test_non_masked_attention(self): """Test that the attention layer can be created without a mask tensor.""" test_layer = talking_heads_attention.TalkingHeadsAttention(num_heads=12, key_size=64) from_tensor = tf.keras.Input(shape=(40, 80)) to_tensor = ...
the_stack_v2_python_sparse
models/official/nlp/modeling/layers/talking_heads_attention_test.py
finnickniu/tensorflow_object_detection_tflite
train
60
0bcf036944c3dc030f749defa74bfef1fc79f57b
[ "l3 = []\nvalue2 = 0\nvalue1 = 0\nwhile l1 or l2:\n value1, value2 = self._addTwoNumbers(l1.val, l2.val, value2)\n l3.append(value1)\n if l1 and l2:\n l1 = l1.next\n l2 = l2.next\n elif l1:\n l1 = l1.next\n l2 = 0\n elif l2:\n l1 = 0\n l2 = l2.next\nif [value...
<|body_start_0|> l3 = [] value2 = 0 value1 = 0 while l1 or l2: value1, value2 = self._addTwoNumbers(l1.val, l2.val, value2) l3.append(value1) if l1 and l2: l1 = l1.next l2 = l2.next elif l1: l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def _addTwoNumbers(self, node1, node2, value=0): """:param node1:第1个数 :param node2:第2个数 :param value:是否需要向上进制1位 :return:返回相加后的余数,以及是否需要向前进制""" <...
stack_v2_sparse_classes_36k_train_022862
1,495
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2)" }, { "docstring": ":param node1:第1个数 :param node2:第2个数 :param value:是否需要向上进制1位 :return:返回相加后的余数,以及是否需要向前进制", "name": "_addTwoNumbers", "signatu...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def _addTwoNumbers(self, node1, node2, value=0): :param node1:第1个数 :param node2:第2个数 :pa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def _addTwoNumbers(self, node1, node2, value=0): :param node1:第1个数 :param node2:第2个数 :pa...
96e847591aa6ea7ea285dbcfc1c9bcfc32026de5
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def _addTwoNumbers(self, node1, node2, value=0): """:param node1:第1个数 :param node2:第2个数 :param value:是否需要向上进制1位 :return:返回相加后的余数,以及是否需要向前进制""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" l3 = [] value2 = 0 value1 = 0 while l1 or l2: value1, value2 = self._addTwoNumbers(l1.val, l2.val, value2) l3.append(value1) if l1...
the_stack_v2_python_sparse
L02_AddTwoNumbers2.py
lihujun101/LeetCode
train
0
a7c9cccf997df46595059f63c117d1fcc0f7aaae
[ "self.start = 0\nself.input_edges = [[[1, 7]], [[2, 6], [3, 20], [4, 3]], [[3, 14]], [[4, 2]], [], []]\nself.output = [0, 7, 13, 27, 10, -1]\nreturn (self.start, self.input_edges, self.output)", "start, edges, output = self.setUp()\noutput_method = dijkstra_sAlgorithm(start, edges)\nself.assertEqual(output, outpu...
<|body_start_0|> self.start = 0 self.input_edges = [[[1, 7]], [[2, 6], [3, 20], [4, 3]], [[3, 14]], [[4, 2]], [], []] self.output = [0, 7, 13, 27, 10, -1] return (self.start, self.input_edges, self.output) <|end_body_0|> <|body_start_1|> start, edges, output = self.setUp() ...
Class with unittests for Dijkstra_sAlgorithm.py
test_Dijkstra_sAlgorithm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_Dijkstra_sAlgorithm: """Class with unittests for Dijkstra_sAlgorithm.py""" def setUp(self): """Sets up input.""" <|body_0|> def test_user_input(self): """Checks if method works properly.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_022863
1,097
no_license
[ { "docstring": "Sets up input.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if method works properly.", "name": "test_user_input", "signature": "def test_user_input(self)" } ]
2
null
Implement the Python class `test_Dijkstra_sAlgorithm` described below. Class description: Class with unittests for Dijkstra_sAlgorithm.py Method signatures and docstrings: - def setUp(self): Sets up input. - def test_user_input(self): Checks if method works properly.
Implement the Python class `test_Dijkstra_sAlgorithm` described below. Class description: Class with unittests for Dijkstra_sAlgorithm.py Method signatures and docstrings: - def setUp(self): Sets up input. - def test_user_input(self): Checks if method works properly. <|skeleton|> class test_Dijkstra_sAlgorithm: ...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_Dijkstra_sAlgorithm: """Class with unittests for Dijkstra_sAlgorithm.py""" def setUp(self): """Sets up input.""" <|body_0|> def test_user_input(self): """Checks if method works properly.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_Dijkstra_sAlgorithm: """Class with unittests for Dijkstra_sAlgorithm.py""" def setUp(self): """Sets up input.""" self.start = 0 self.input_edges = [[[1, 7]], [[2, 6], [3, 20], [4, 3]], [[3, 14]], [[4, 2]], [], []] self.output = [0, 7, 13, 27, 10, -1] return (s...
the_stack_v2_python_sparse
AlgoExpert_algorithms/Hard/DijkstrasAlgorithm/test_Dijkstra_sAlgorithm.py
JakubKazimierski/PythonPortfolio
train
9
d26bde711392fb9f2dc0159181349e9c1e429268
[ "filter_query_data = AdvancedCourseSettingsView.FilterQuery(request.query_params)\nif not filter_query_data.is_valid():\n raise ValidationError(filter_query_data.errors)\ncourse_key = CourseKey.from_string(course_id)\nif not has_studio_read_access(request.user, course_key):\n self.permission_denied(request)\n...
<|body_start_0|> filter_query_data = AdvancedCourseSettingsView.FilterQuery(request.query_params) if not filter_query_data.is_valid(): raise ValidationError(filter_query_data.errors) course_key = CourseKey.from_string(course_id) if not has_studio_read_access(request.user, cou...
View for getting and setting the advanced settings for a course.
AdvancedCourseSettingsView
[ "MIT", "AGPL-3.0-only", "AGPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdvancedCourseSettingsView: """View for getting and setting the advanced settings for a course.""" def get(self, request: Request, course_id: str): """Get an object containing all the advanced settings in a course. **Example Request** GET /api/contentstore/v0/advanced_settings/{cours...
stack_v2_sparse_classes_36k_train_022864
6,997
permissive
[ { "docstring": "Get an object containing all the advanced settings in a course. **Example Request** GET /api/contentstore/v0/advanced_settings/{course_id} **Response Values** If the request is successful, an HTTP 200 \"OK\" response is returned. The HTTP 200 response contains a single dict that contains keys th...
2
null
Implement the Python class `AdvancedCourseSettingsView` described below. Class description: View for getting and setting the advanced settings for a course. Method signatures and docstrings: - def get(self, request: Request, course_id: str): Get an object containing all the advanced settings in a course. **Example Re...
Implement the Python class `AdvancedCourseSettingsView` described below. Class description: View for getting and setting the advanced settings for a course. Method signatures and docstrings: - def get(self, request: Request, course_id: str): Get an object containing all the advanced settings in a course. **Example Re...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class AdvancedCourseSettingsView: """View for getting and setting the advanced settings for a course.""" def get(self, request: Request, course_id: str): """Get an object containing all the advanced settings in a course. **Example Request** GET /api/contentstore/v0/advanced_settings/{cours...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdvancedCourseSettingsView: """View for getting and setting the advanced settings for a course.""" def get(self, request: Request, course_id: str): """Get an object containing all the advanced settings in a course. **Example Request** GET /api/contentstore/v0/advanced_settings/{course_id} **Respo...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/cms/djangoapps/contentstore/rest_api/v0/views/advanced_settings.py
luque/better-ways-of-thinking-about-software
train
3
a6bd5408f79b2c52f1f1677df3da3f21e634fc84
[ "if k == 1 or not head:\n return head\ncur = head\nfor i in range(k - 1):\n if cur.next:\n cur = cur.next\n else:\n return head\ncur.next, next_head = (None, cur.next)\nnew_head = self.reverseNodes(head)\nhead.next = self.reverseKGroup(next_head, k)\nreturn new_head", "dummy = ListNode(floa...
<|body_start_0|> if k == 1 or not head: return head cur = head for i in range(k - 1): if cur.next: cur = cur.next else: return head cur.next, next_head = (None, cur.next) new_head = self.reverseNodes(head) ...
Solution_A
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_A: def reverseKGroup(self, head: ListNode, k: int) -> ListNode: """Recursively use reverse whole linked list""" <|body_0|> def reverseNodes(self, head: ListNode) -> ListNode: """Helper for both Solution A and Solution B 参见Leetcode LC206, reverse the whole li...
stack_v2_sparse_classes_36k_train_022865
4,335
permissive
[ { "docstring": "Recursively use reverse whole linked list", "name": "reverseKGroup", "signature": "def reverseKGroup(self, head: ListNode, k: int) -> ListNode" }, { "docstring": "Helper for both Solution A and Solution B 参见Leetcode LC206, reverse the whole linked-list", "name": "reverseNodes...
2
null
Implement the Python class `Solution_A` described below. Class description: Implement the Solution_A class. Method signatures and docstrings: - def reverseKGroup(self, head: ListNode, k: int) -> ListNode: Recursively use reverse whole linked list - def reverseNodes(self, head: ListNode) -> ListNode: Helper for both S...
Implement the Python class `Solution_A` described below. Class description: Implement the Solution_A class. Method signatures and docstrings: - def reverseKGroup(self, head: ListNode, k: int) -> ListNode: Recursively use reverse whole linked list - def reverseNodes(self, head: ListNode) -> ListNode: Helper for both S...
143422321cbc3715ca08f6c3af8f960a55887ced
<|skeleton|> class Solution_A: def reverseKGroup(self, head: ListNode, k: int) -> ListNode: """Recursively use reverse whole linked list""" <|body_0|> def reverseNodes(self, head: ListNode) -> ListNode: """Helper for both Solution A and Solution B 参见Leetcode LC206, reverse the whole li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_A: def reverseKGroup(self, head: ListNode, k: int) -> ListNode: """Recursively use reverse whole linked list""" if k == 1 or not head: return head cur = head for i in range(k - 1): if cur.next: cur = cur.next else: ...
the_stack_v2_python_sparse
LeetCode/LC025_reverse_nodes_in_k_group.py
jxie0755/Learning_Python
train
0
1a41ae22e1ac2f7db6f7bc1918aa114fcbd5912f
[ "self._paddle = paddle\nself._image_sequence = load_png_sequence(image_sequence_name)\nself._animation = None\nself._update_count = 0", "if self._update_count % 80 == 0:\n self._animation = itertools.chain(self._image_sequence, reversed(self._image_sequence))\n self._update_count = 0\nelif self._animation:\...
<|body_start_0|> self._paddle = paddle self._image_sequence = load_png_sequence(image_sequence_name) self._animation = None self._update_count = 0 <|end_body_0|> <|body_start_1|> if self._update_count % 80 == 0: self._animation = itertools.chain(self._image_sequence,...
Helper class for pulsating the lights at the end of the paddle.
_PaddlePulsator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _PaddlePulsator: """Helper class for pulsating the lights at the end of the paddle.""" def __init__(self, paddle, image_sequence_name): """Initialise with the name of the image sequence corresponding to each pulsating paddle frame. Args: paddle: The paddle. image_sequence_name: The n...
stack_v2_sparse_classes_36k_train_022866
24,387
no_license
[ { "docstring": "Initialise with the name of the image sequence corresponding to each pulsating paddle frame. Args: paddle: The paddle. image_sequence_name: The name of theimage sequence representing each pulsating frame.", "name": "__init__", "signature": "def __init__(self, paddle, image_sequence_name)...
2
stack_v2_sparse_classes_30k_train_001374
Implement the Python class `_PaddlePulsator` described below. Class description: Helper class for pulsating the lights at the end of the paddle. Method signatures and docstrings: - def __init__(self, paddle, image_sequence_name): Initialise with the name of the image sequence corresponding to each pulsating paddle fr...
Implement the Python class `_PaddlePulsator` described below. Class description: Helper class for pulsating the lights at the end of the paddle. Method signatures and docstrings: - def __init__(self, paddle, image_sequence_name): Initialise with the name of the image sequence corresponding to each pulsating paddle fr...
533dedae16ba81bf262298d64beff642296a6c29
<|skeleton|> class _PaddlePulsator: """Helper class for pulsating the lights at the end of the paddle.""" def __init__(self, paddle, image_sequence_name): """Initialise with the name of the image sequence corresponding to each pulsating paddle frame. Args: paddle: The paddle. image_sequence_name: The n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _PaddlePulsator: """Helper class for pulsating the lights at the end of the paddle.""" def __init__(self, paddle, image_sequence_name): """Initialise with the name of the image sequence corresponding to each pulsating paddle frame. Args: paddle: The paddle. image_sequence_name: The name of theima...
the_stack_v2_python_sparse
arkanoid/sprites/paddle.py
moretea/arkanoid
train
0
87ba21ab4977176f06a9a27646d4a9ccd241fdf8
[ "layer = QgsMapLayerRegistry.instance().mapLayersByName(layerName)[0]\nlayer.setCustomProperty('labeling', 'pal')\nlayer.setCustomProperty('labeling/enabled', 'True')\nlayer.setCustomProperty('labeling/fieldName', fieldName)\nlayer.setCustomProperty('labeling/fontFamily', fontFamily)\nlayer.setCustomProperty('label...
<|body_start_0|> layer = QgsMapLayerRegistry.instance().mapLayersByName(layerName)[0] layer.setCustomProperty('labeling', 'pal') layer.setCustomProperty('labeling/enabled', 'True') layer.setCustomProperty('labeling/fieldName', fieldName) layer.setCustomProperty('labeling/fontFami...
Class that deals with vector layer labels
Label
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Label: """Class that deals with vector layer labels""" def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): """Set label and format based on the parameters passed""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_022867
2,279
no_license
[ { "docstring": "Set label and format based on the parameters passed", "name": "nameLabel", "signature": "def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False)" }, { "docstring": "Show font dialog and p...
3
stack_v2_sparse_classes_30k_train_010398
Implement the Python class `Label` described below. Class description: Class that deals with vector layer labels Method signatures and docstrings: - def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): Set label and forma...
Implement the Python class `Label` described below. Class description: Class that deals with vector layer labels Method signatures and docstrings: - def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): Set label and forma...
ba1fd3a139580e00eca4aa87ad8e49f46718d58a
<|skeleton|> class Label: """Class that deals with vector layer labels""" def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): """Set label and format based on the parameters passed""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Label: """Class that deals with vector layer labels""" def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): """Set label and format based on the parameters passed""" layer = QgsMapLayerRegistr...
the_stack_v2_python_sparse
labels.py
Charlotteg/QGISforSchools
train
1
343c0d5a3e94e2d683e6701f051c26dd8ab4e08e
[ "self.id = id\nself.title = title\nself.icon_image = icon_image\nself.is_active = is_active\nself.routing_url = routing_url\nself.display_priority = display_priority\nself.icon_position = icon_position\nself.general_terms = general_terms", "if dictionary is None:\n return None\nid = dictionary.get('id')\ntitle...
<|body_start_0|> self.id = id self.title = title self.icon_image = icon_image self.is_active = is_active self.routing_url = routing_url self.display_priority = display_priority self.icon_position = icon_position self.general_terms = general_terms <|end_bod...
Implementation of the 'InsuranceCentrePolicyTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. icon_image (string): TODO: type description here. is_active (bool): TODO: type description here. routing_url (string): TODO: type d...
InsuranceCentrePolicyTypes
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InsuranceCentrePolicyTypes: """Implementation of the 'InsuranceCentrePolicyTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. icon_image (string): TODO: type description here. is_active (bool): TODO: typ...
stack_v2_sparse_classes_36k_train_022868
3,196
permissive
[ { "docstring": "Constructor for the InsuranceCentrePolicyTypes class", "name": "__init__", "signature": "def __init__(self, id=None, title=None, icon_image=None, is_active=None, routing_url=None, icon_position=None, display_priority=None, general_terms=None)" }, { "docstring": "Creates an instan...
2
stack_v2_sparse_classes_30k_train_019001
Implement the Python class `InsuranceCentrePolicyTypes` described below. Class description: Implementation of the 'InsuranceCentrePolicyTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. icon_image (string): TODO: type descri...
Implement the Python class `InsuranceCentrePolicyTypes` described below. Class description: Implementation of the 'InsuranceCentrePolicyTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. icon_image (string): TODO: type descri...
b574a76a8805b306a423229b572c36dae0159def
<|skeleton|> class InsuranceCentrePolicyTypes: """Implementation of the 'InsuranceCentrePolicyTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. icon_image (string): TODO: type description here. is_active (bool): TODO: typ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InsuranceCentrePolicyTypes: """Implementation of the 'InsuranceCentrePolicyTypes' model. TODO: type model description here. Attributes: id (int): TODO: type description here. title (string): TODO: type description here. icon_image (string): TODO: type description here. is_active (bool): TODO: type description...
the_stack_v2_python_sparse
easybimehlanding/models/insurance_centre_policy_types.py
kmelodi/EasyBimehLanding_Python
train
0
60dfebbf7e17ad808dc88026523469f4eca9367f
[ "try:\n\n def generate(vo):\n for exception in list_exceptions(exception_id, vo=vo):\n yield (dumps(exception, cls=APIEncoder) + '\\n')\n return try_stream(generate(vo=request.environ.get('vo')))\nexcept LifetimeExceptionNotFound as error:\n return generate_http_error_flask(404, error)", ...
<|body_start_0|> try: def generate(vo): for exception in list_exceptions(exception_id, vo=vo): yield (dumps(exception, cls=APIEncoder) + '\n') return try_stream(generate(vo=request.environ.get('vo'))) except LifetimeExceptionNotFound as error:...
REST APIs for Lifetime Model exception.
LifetimeExceptionId
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LifetimeExceptionId: """REST APIs for Lifetime Model exception.""" def get(self, exception_id): """--- summary: Get Exception description: Get a single Lifetime Exception. tags: - Lifetime Exceptions parameters: - name: exception_id in: path description: The id of the lifetime except...
stack_v2_sparse_classes_36k_train_022869
12,043
permissive
[ { "docstring": "--- summary: Get Exception description: Get a single Lifetime Exception. tags: - Lifetime Exceptions parameters: - name: exception_id in: path description: The id of the lifetime exception. schema: type: string style: simple responses: 200: description: OK content: application/x-json-stream: sch...
2
stack_v2_sparse_classes_30k_train_014428
Implement the Python class `LifetimeExceptionId` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self, exception_id): --- summary: Get Exception description: Get a single Lifetime Exception. tags: - Lifetime Exceptions parameters: - name: excepti...
Implement the Python class `LifetimeExceptionId` described below. Class description: REST APIs for Lifetime Model exception. Method signatures and docstrings: - def get(self, exception_id): --- summary: Get Exception description: Get a single Lifetime Exception. tags: - Lifetime Exceptions parameters: - name: excepti...
7f0d229ac0b3bc7dec12c6e158bea2b82d414a3b
<|skeleton|> class LifetimeExceptionId: """REST APIs for Lifetime Model exception.""" def get(self, exception_id): """--- summary: Get Exception description: Get a single Lifetime Exception. tags: - Lifetime Exceptions parameters: - name: exception_id in: path description: The id of the lifetime except...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LifetimeExceptionId: """REST APIs for Lifetime Model exception.""" def get(self, exception_id): """--- summary: Get Exception description: Get a single Lifetime Exception. tags: - Lifetime Exceptions parameters: - name: exception_id in: path description: The id of the lifetime exception. schema: ...
the_stack_v2_python_sparse
lib/rucio/web/rest/flaskapi/v1/lifetime_exceptions.py
rucio/rucio
train
232
20776725c21ee332b17e9e1182e6e93771ca1309
[ "self.bundle_distr = bundle_distr\nself.bundle_var = RandomVariable(self.bundle_distr, sims)\nself.nb = nb\nself.eval()\nself.n = self.bundle_var.n\nself.x = self.bundle_var.x", "def pdf_min(cdf, pdf):\n return self.nb * pow(1.0 - cdf, self.nb - 1.0) * pdf\npdf_min_func = frompyfunc(pdf_min, 2, 1)\nself.pdf = ...
<|body_start_0|> self.bundle_distr = bundle_distr self.bundle_var = RandomVariable(self.bundle_distr, sims) self.nb = nb self.eval() self.n = self.bundle_var.n self.x = self.bundle_var.x <|end_body_0|> <|body_start_1|> def pdf_min(cdf, pdf): return se...
@brief Random variable for a chain of bundles. This variable is constructed using a BundleDistribution.
RandomChainOfBundlesVariable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomChainOfBundlesVariable: """@brief Random variable for a chain of bundles. This variable is constructed using a BundleDistribution.""" def __init__(self, bundle_distr, nb, sims): """@brief Constructor @param bundle_distr Instance of DanielsSmithDistrib to represent a single bund...
stack_v2_sparse_classes_36k_train_022870
12,843
no_license
[ { "docstring": "@brief Constructor @param bundle_distr Instance of DanielsSmithDistrib to represent a single bundle with a specified length @param nb number of bundles chained @param sims number of sampling points to use for the bundle and chain-of-bundles variable.", "name": "__init__", "signature": "d...
2
stack_v2_sparse_classes_30k_train_016604
Implement the Python class `RandomChainOfBundlesVariable` described below. Class description: @brief Random variable for a chain of bundles. This variable is constructed using a BundleDistribution. Method signatures and docstrings: - def __init__(self, bundle_distr, nb, sims): @brief Constructor @param bundle_distr I...
Implement the Python class `RandomChainOfBundlesVariable` described below. Class description: @brief Random variable for a chain of bundles. This variable is constructed using a BundleDistribution. Method signatures and docstrings: - def __init__(self, bundle_distr, nb, sims): @brief Constructor @param bundle_distr I...
00de9f0eec52835d839a3c6c1407cac11a496339
<|skeleton|> class RandomChainOfBundlesVariable: """@brief Random variable for a chain of bundles. This variable is constructed using a BundleDistribution.""" def __init__(self, bundle_distr, nb, sims): """@brief Constructor @param bundle_distr Instance of DanielsSmithDistrib to represent a single bund...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomChainOfBundlesVariable: """@brief Random variable for a chain of bundles. This variable is constructed using a BundleDistribution.""" def __init__(self, bundle_distr, nb, sims): """@brief Constructor @param bundle_distr Instance of DanielsSmithDistrib to represent a single bundle with a spe...
the_stack_v2_python_sparse
bmcs/ytta/chob/chob.py
simvisage/bmcs
train
1
140d64bbe6e2b26e919f1a3108ae1544d533a0d2
[ "super(TestPrintRoutes, self).setUp()\nself.output = StringIO()\nsys.stdout = self.output", "super(TestPrintRoutes, self).tearDown()\nself.output.close()\ndel self.output\nsys.stdout = STDOUT", "print_routes.traverse(_api._router._roots, verbose=True)\nroute, options = self.output.getvalue().strip().split('\\n'...
<|body_start_0|> super(TestPrintRoutes, self).setUp() self.output = StringIO() sys.stdout = self.output <|end_body_0|> <|body_start_1|> super(TestPrintRoutes, self).tearDown() self.output.close() del self.output sys.stdout = STDOUT <|end_body_1|> <|body_start_2|...
TestPrintRoutes
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPrintRoutes: def setUp(self): """Capture stdout""" <|body_0|> def tearDown(self): """Reset stdout""" <|body_1|> def test_traverse_with_verbose(self): """Ensure traverse finds the proper routes and adds verbose output.""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_022871
1,338
no_license
[ { "docstring": "Capture stdout", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Reset stdout", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Ensure traverse finds the proper routes and adds verbose output.", "name": "test_travers...
4
null
Implement the Python class `TestPrintRoutes` described below. Class description: Implement the TestPrintRoutes class. Method signatures and docstrings: - def setUp(self): Capture stdout - def tearDown(self): Reset stdout - def test_traverse_with_verbose(self): Ensure traverse finds the proper routes and adds verbose ...
Implement the Python class `TestPrintRoutes` described below. Class description: Implement the TestPrintRoutes class. Method signatures and docstrings: - def setUp(self): Capture stdout - def tearDown(self): Reset stdout - def test_traverse_with_verbose(self): Ensure traverse finds the proper routes and adds verbose ...
a062c118f12b93172e31e8ca115ce3f871b64461
<|skeleton|> class TestPrintRoutes: def setUp(self): """Capture stdout""" <|body_0|> def tearDown(self): """Reset stdout""" <|body_1|> def test_traverse_with_verbose(self): """Ensure traverse finds the proper routes and adds verbose output.""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPrintRoutes: def setUp(self): """Capture stdout""" super(TestPrintRoutes, self).setUp() self.output = StringIO() sys.stdout = self.output def tearDown(self): """Reset stdout""" super(TestPrintRoutes, self).tearDown() self.output.close() ...
the_stack_v2_python_sparse
python/falcon/2016/12/test_cmd_print_api.py
rosoareslv/SED99
train
1
20b019f7b14eb857bbc29b4770f5a8a382bfe157
[ "count = 0\nfor s in range(len(A) - 2):\n d = A[s + 1] - A[s]\n for e in range(s + 2, len(A)):\n if A[e] - A[e - 1] == d:\n count += 1\n else:\n break\nreturn count", "dp = [0] * len(A)\nsum = 0\nfor i in range(2, len(A)):\n if A[i] - A[i - 1] == A[i - 1] - A[i - 2]:\n...
<|body_start_0|> count = 0 for s in range(len(A) - 2): d = A[s + 1] - A[s] for e in range(s + 2, len(A)): if A[e] - A[e - 1] == d: count += 1 else: break return count <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numberOfArithmeticSlices_bruteforce(self, A): """time O(n^2) space O(1) :type A: List[int] :rtype: int""" <|body_0|> def numberOfArithmeticSlices_dp(self, A): """time O(n) space O(n) :param A: :return:""" <|body_1|> def numberOfArithmeticSl...
stack_v2_sparse_classes_36k_train_022872
1,251
no_license
[ { "docstring": "time O(n^2) space O(1) :type A: List[int] :rtype: int", "name": "numberOfArithmeticSlices_bruteforce", "signature": "def numberOfArithmeticSlices_bruteforce(self, A)" }, { "docstring": "time O(n) space O(n) :param A: :return:", "name": "numberOfArithmeticSlices_dp", "sign...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberOfArithmeticSlices_bruteforce(self, A): time O(n^2) space O(1) :type A: List[int] :rtype: int - def numberOfArithmeticSlices_dp(self, A): time O(n) space O(n) :param A:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numberOfArithmeticSlices_bruteforce(self, A): time O(n^2) space O(1) :type A: List[int] :rtype: int - def numberOfArithmeticSlices_dp(self, A): time O(n) space O(n) :param A:...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def numberOfArithmeticSlices_bruteforce(self, A): """time O(n^2) space O(1) :type A: List[int] :rtype: int""" <|body_0|> def numberOfArithmeticSlices_dp(self, A): """time O(n) space O(n) :param A: :return:""" <|body_1|> def numberOfArithmeticSl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numberOfArithmeticSlices_bruteforce(self, A): """time O(n^2) space O(1) :type A: List[int] :rtype: int""" count = 0 for s in range(len(A) - 2): d = A[s + 1] - A[s] for e in range(s + 2, len(A)): if A[e] - A[e - 1] == d: ...
the_stack_v2_python_sparse
LeetCode/DynamicProgramming/413_arithmetric_slices.py
XyK0907/for_work
train
0
6ce5c4a7122a3635ffa1c02d3ba6fc41e2e35804
[ "self.keys = kwargs.pop('keys')\nself.workflow = kwargs.pop('workflow', None)\nkey = kwargs.pop('key', '')\natt_value = kwargs.pop('value', '')\nsuper().__init__(*args, **kwargs)\nself.fields['key'].initial = key\nself.fields['attr_value'].initial = att_value", "form_data = super().clean()\nattr_name = form_data[...
<|body_start_0|> self.keys = kwargs.pop('keys') self.workflow = kwargs.pop('workflow', None) key = kwargs.pop('key', '') att_value = kwargs.pop('value', '') super().__init__(*args, **kwargs) self.fields['key'].initial = key self.fields['attr_value'].initial = att_...
Form to get a key/value pair as attribute.
AttributeItemForm
[ "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 AttributeItemForm: """Form to get a key/value pair as attribute.""" def __init__(self, *args, **kwargs): """Set keys and values.""" <|body_0|> def clean(self) -> Dict: """Check that the name is correct and is not duplicated.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k_train_022873
3,730
permissive
[ { "docstring": "Set keys and values.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Check that the name is correct and is not duplicated.", "name": "clean", "signature": "def clean(self) -> Dict" } ]
2
null
Implement the Python class `AttributeItemForm` described below. Class description: Form to get a key/value pair as attribute. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Set keys and values. - def clean(self) -> Dict: Check that the name is correct and is not duplicated.
Implement the Python class `AttributeItemForm` described below. Class description: Form to get a key/value pair as attribute. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Set keys and values. - def clean(self) -> Dict: Check that the name is correct and is not duplicated. <|skeleton|> cla...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class AttributeItemForm: """Form to get a key/value pair as attribute.""" def __init__(self, *args, **kwargs): """Set keys and values.""" <|body_0|> def clean(self) -> Dict: """Check that the name is correct and is not duplicated.""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttributeItemForm: """Form to get a key/value pair as attribute.""" def __init__(self, *args, **kwargs): """Set keys and values.""" self.keys = kwargs.pop('keys') self.workflow = kwargs.pop('workflow', None) key = kwargs.pop('key', '') att_value = kwargs.pop('value...
the_stack_v2_python_sparse
ontask/workflow/forms/attribute_shared.py
abelardopardo/ontask_b
train
43
9c66927d7d2d87205b5b676197d5cb828af2072e
[ "infoStr = ''\nclueNum = int(removeSpace(getNumber(self.get_argument('clueNum', default='100'))))\nclueNum = 8000 if clueNum > 8000 else clueNum\nsearchFilter = {}\nsearchFilter['ID'] = self.get_argument('ID', default='')\nsearchFilter['recoMode'] = removeSpace(self.get_argument('recoMode', default='justSearch')).l...
<|body_start_0|> infoStr = '' clueNum = int(removeSpace(getNumber(self.get_argument('clueNum', default='100')))) clueNum = 8000 if clueNum > 8000 else clueNum searchFilter = {} searchFilter['ID'] = self.get_argument('ID', default='') searchFilter['recoMode'] = removeSpace...
getRecommend的Handler
RecommendHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecommendHandler: """getRecommend的Handler""" def parseInput(self): """处理输入参数""" <|body_0|> def post(self): """根据给定的推荐方法获取推荐线索""" <|body_1|> <|end_skeleton|> <|body_start_0|> infoStr = '' clueNum = int(removeSpace(getNumber(self.get_argum...
stack_v2_sparse_classes_36k_train_022874
7,774
no_license
[ { "docstring": "处理输入参数", "name": "parseInput", "signature": "def parseInput(self)" }, { "docstring": "根据给定的推荐方法获取推荐线索", "name": "post", "signature": "def post(self)" } ]
2
null
Implement the Python class `RecommendHandler` described below. Class description: getRecommend的Handler Method signatures and docstrings: - def parseInput(self): 处理输入参数 - def post(self): 根据给定的推荐方法获取推荐线索
Implement the Python class `RecommendHandler` described below. Class description: getRecommend的Handler Method signatures and docstrings: - def parseInput(self): 处理输入参数 - def post(self): 根据给定的推荐方法获取推荐线索 <|skeleton|> class RecommendHandler: """getRecommend的Handler""" def parseInput(self): """处理输入参数"""...
53a7d08918538f55383982c21d36c0440da37e3a
<|skeleton|> class RecommendHandler: """getRecommend的Handler""" def parseInput(self): """处理输入参数""" <|body_0|> def post(self): """根据给定的推荐方法获取推荐线索""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecommendHandler: """getRecommend的Handler""" def parseInput(self): """处理输入参数""" infoStr = '' clueNum = int(removeSpace(getNumber(self.get_argument('clueNum', default='100')))) clueNum = 8000 if clueNum > 8000 else clueNum searchFilter = {} searchFilter['ID'...
the_stack_v2_python_sparse
webapp_ziwei/webapp.py
chrgu000/pythonPro
train
0
0effc22b3ce6ddb34dae9a2200c07d3506aa2e6a
[ "super().__init__(coordinator, block)\nself.attribute = attribute\nself.entity_description = description\nself._attr_unique_id: str = f'{super().unique_id}-{self.attribute}'\nself._attr_name = get_block_entity_name(coordinator.device, block, description.name)", "if (value := getattr(self.block, self.attribute)) i...
<|body_start_0|> super().__init__(coordinator, block) self.attribute = attribute self.entity_description = description self._attr_unique_id: str = f'{super().unique_id}-{self.attribute}' self._attr_name = get_block_entity_name(coordinator.device, block, description.name) <|end_bo...
Helper class to represent a block attribute.
ShellyBlockAttributeEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShellyBlockAttributeEntity: """Helper class to represent a block attribute.""" def __init__(self, coordinator: ShellyBlockCoordinator, block: Block, attribute: str, description: BlockEntityDescription) -> None: """Initialize sensor.""" <|body_0|> def attribute_value(self...
stack_v2_sparse_classes_36k_train_022875
21,943
permissive
[ { "docstring": "Initialize sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: ShellyBlockCoordinator, block: Block, attribute: str, description: BlockEntityDescription) -> None" }, { "docstring": "Value of sensor.", "name": "attribute_value", "signature": "def at...
4
null
Implement the Python class `ShellyBlockAttributeEntity` described below. Class description: Helper class to represent a block attribute. Method signatures and docstrings: - def __init__(self, coordinator: ShellyBlockCoordinator, block: Block, attribute: str, description: BlockEntityDescription) -> None: Initialize se...
Implement the Python class `ShellyBlockAttributeEntity` described below. Class description: Helper class to represent a block attribute. Method signatures and docstrings: - def __init__(self, coordinator: ShellyBlockCoordinator, block: Block, attribute: str, description: BlockEntityDescription) -> None: Initialize se...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ShellyBlockAttributeEntity: """Helper class to represent a block attribute.""" def __init__(self, coordinator: ShellyBlockCoordinator, block: Block, attribute: str, description: BlockEntityDescription) -> None: """Initialize sensor.""" <|body_0|> def attribute_value(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShellyBlockAttributeEntity: """Helper class to represent a block attribute.""" def __init__(self, coordinator: ShellyBlockCoordinator, block: Block, attribute: str, description: BlockEntityDescription) -> None: """Initialize sensor.""" super().__init__(coordinator, block) self.att...
the_stack_v2_python_sparse
homeassistant/components/shelly/entity.py
home-assistant/core
train
35,501
06dc991152e0a2395a8932e86f03f0e2dfb4a380
[ "result = 0\ntry:\n sha_1 = hashlib.sha1(password.encode('utf-8')).hexdigest()\n sha_1_first_5 = sha_1[:5]\n headers = {'User-Agent': '{}-pwnage-checker'.format(tg.config.get('site_name', 'Allura'))}\n resp = requests.get(f'https://api.pwnedpasswords.com/range/{sha_1_first_5}', timeout=1, headers=header...
<|body_start_0|> result = 0 try: sha_1 = hashlib.sha1(password.encode('utf-8')).hexdigest() sha_1_first_5 = sha_1[:5] headers = {'User-Agent': '{}-pwnage-checker'.format(tg.config.get('site_name', 'Allura'))} resp = requests.get(f'https://api.pwnedpassword...
HIBPClient
[ "OFL-1.1", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HIBPClient: def check_breached_password(cls, password): """Checks the Have I Been Pwned API for a known compromised password. Raises a named HIBPCompromisedCredentials exception if any found :param password: user-supplied password""" <|body_0|> def scan_response(self, resp, ...
stack_v2_sparse_classes_36k_train_022876
21,312
permissive
[ { "docstring": "Checks the Have I Been Pwned API for a known compromised password. Raises a named HIBPCompromisedCredentials exception if any found :param password: user-supplied password", "name": "check_breached_password", "signature": "def check_breached_password(cls, password)" }, { "docstri...
2
null
Implement the Python class `HIBPClient` described below. Class description: Implement the HIBPClient class. Method signatures and docstrings: - def check_breached_password(cls, password): Checks the Have I Been Pwned API for a known compromised password. Raises a named HIBPCompromisedCredentials exception if any foun...
Implement the Python class `HIBPClient` described below. Class description: Implement the HIBPClient class. Method signatures and docstrings: - def check_breached_password(cls, password): Checks the Have I Been Pwned API for a known compromised password. Raises a named HIBPCompromisedCredentials exception if any foun...
7e602764a67883d49736a72271987060dab47ecc
<|skeleton|> class HIBPClient: def check_breached_password(cls, password): """Checks the Have I Been Pwned API for a known compromised password. Raises a named HIBPCompromisedCredentials exception if any found :param password: user-supplied password""" <|body_0|> def scan_response(self, resp, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HIBPClient: def check_breached_password(cls, password): """Checks the Have I Been Pwned API for a known compromised password. Raises a named HIBPCompromisedCredentials exception if any found :param password: user-supplied password""" result = 0 try: sha_1 = hashlib.sha1(pas...
the_stack_v2_python_sparse
Allura/allura/lib/security.py
apache/allura
train
130
ce4e0583e9320114c9d072d46e4abc5f473299ec
[ "try:\n return Client.objects.get(pk=pk)\nexcept ObjectDoesNotExist:\n raise Http404", "client = self._get_object(pk=pk)\nserializer_obj = ClientSerializer(client)\nreturn JsonResponse(serializer_obj.data, status=200)", "client = self._get_object(pk=pk)\nserializer_obj = ClientSerializer(client, data=requ...
<|body_start_0|> try: return Client.objects.get(pk=pk) except ObjectDoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> client = self._get_object(pk=pk) serializer_obj = ClientSerializer(client) return JsonResponse(serializer_obj.data, status=200)...
Class based view for Client for updating, getting and deleting.
ClientDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientDetailView: """Class based view for Client for updating, getting and deleting.""" def _get_object(self, pk): """First we see if client exists.""" <|body_0|> def get(self, request, pk, format=None): """Get client by id view.""" <|body_1|> def pu...
stack_v2_sparse_classes_36k_train_022877
2,528
no_license
[ { "docstring": "First we see if client exists.", "name": "_get_object", "signature": "def _get_object(self, pk)" }, { "docstring": "Get client by id view.", "name": "get", "signature": "def get(self, request, pk, format=None)" }, { "docstring": "Update client.", "name": "put"...
4
null
Implement the Python class `ClientDetailView` described below. Class description: Class based view for Client for updating, getting and deleting. Method signatures and docstrings: - def _get_object(self, pk): First we see if client exists. - def get(self, request, pk, format=None): Get client by id view. - def put(se...
Implement the Python class `ClientDetailView` described below. Class description: Class based view for Client for updating, getting and deleting. Method signatures and docstrings: - def _get_object(self, pk): First we see if client exists. - def get(self, request, pk, format=None): Get client by id view. - def put(se...
93c3106ab90fb9aed85658f93f51686ba4734091
<|skeleton|> class ClientDetailView: """Class based view for Client for updating, getting and deleting.""" def _get_object(self, pk): """First we see if client exists.""" <|body_0|> def get(self, request, pk, format=None): """Get client by id view.""" <|body_1|> def pu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientDetailView: """Class based view for Client for updating, getting and deleting.""" def _get_object(self, pk): """First we see if client exists.""" try: return Client.objects.get(pk=pk) except ObjectDoesNotExist: raise Http404 def get(self, request...
the_stack_v2_python_sparse
client/client_apis.py
saadali5997/tms
train
0
6100f1a09996674b67a958a7026ada368ae699fb
[ "nn.Module.__init__(self)\nself.eta = eta\nself.eps = eps", "dist, _ = torch.min(torch.norm(c.unsqueeze(0) - input.unsqueeze(1), p=2, dim=2), dim=1)\nlosses = torch.where(semi_target == 0, dist ** 2, self.eta * (dist ** 2 + self.eps) ** semi_target.float())\nloss = torch.mean(losses)\nreturn loss" ]
<|body_start_0|> nn.Module.__init__(self) self.eta = eta self.eps = eps <|end_body_0|> <|body_start_1|> dist, _ = torch.min(torch.norm(c.unsqueeze(0) - input.unsqueeze(1), p=2, dim=2), dim=1) losses = torch.where(semi_target == 0, dist ** 2, self.eta * (dist ** 2 + self.eps) ** ...
Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)
DMSADLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DMSADLoss: """Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)""" def __init__(self, eta, eps=1e-06): """Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives e...
stack_v2_sparse_classes_36k_train_022878
18,386
permissive
[ { "docstring": "Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives equal weights, <1.0 gives more weight | to the unknown samples, >1.0 gives more weight to the | known samples. |---- eps (float) epsilon to ensure numerical sta...
2
stack_v2_sparse_classes_30k_train_021495
Implement the Python class `DMSADLoss` described below. Class description: Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020) Method signatures and docstrings: - def __init__(self, eta, eps=1e-06): Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the im...
Implement the Python class `DMSADLoss` described below. Class description: Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020) Method signatures and docstrings: - def __init__(self, eta, eps=1e-06): Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the im...
850b6195d6290a50eee865b4d5a66f5db5260e8f
<|skeleton|> class DMSADLoss: """Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)""" def __init__(self, eta, eps=1e-06): """Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DMSADLoss: """Implementation of the DMSAD loss inspired by Ghafoori et al. (2020) and Ruff et al. (2020)""" def __init__(self, eta, eps=1e-06): """Constructor of the DMSAD loss. ---------- INPUT |---- eta (float) control the importance given to known or unknonw | samples. 1.0 gives equal weights,...
the_stack_v2_python_sparse
Code/src/models/optim/CustomLosses.py
antoine-spahr/X-ray-Anomaly-Detection
train
3
9d2a96c22863de4ae01db19901fa985c4fedc346
[ "A.sort()\nB = sorted([(num, index) for index, num in enumerate(B)])\nremain = []\nj = 0\nret = [0 for _ in range(len(A))]\nfor i, num in enumerate(A):\n if num > B[j][0]:\n ret[B[j][1]] = num\n j += 1\n else:\n remain.append(num)\nfor i in range(j, len(B)):\n ret[B[i][1]] = remain.pop...
<|body_start_0|> A.sort() B = sorted([(num, index) for index, num in enumerate(B)]) remain = [] j = 0 ret = [0 for _ in range(len(A))] for i, num in enumerate(A): if num > B[j][0]: ret[B[j][1]] = num j += 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def advantageCount(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_0|> def advantageCount2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022879
1,330
no_license
[ { "docstring": ":type A: List[int] :type B: List[int] :rtype: List[int]", "name": "advantageCount", "signature": "def advantageCount(self, A, B)" }, { "docstring": ":type A: List[int] :type B: List[int] :rtype: List[int]", "name": "advantageCount2", "signature": "def advantageCount2(self...
2
stack_v2_sparse_classes_30k_train_020248
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def advantageCount(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] - def advantageCount2(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def advantageCount(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] - def advantageCount2(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int]...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def advantageCount(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_0|> def advantageCount2(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def advantageCount(self, A, B): """:type A: List[int] :type B: List[int] :rtype: List[int]""" A.sort() B = sorted([(num, index) for index, num in enumerate(B)]) remain = [] j = 0 ret = [0 for _ in range(len(A))] for i, num in enumerate(A): ...
the_stack_v2_python_sparse
python/leetcode/870_Advantage_Shuffle.py
bobcaoge/my-code
train
0
34d35f0c80c9909be9550bcd9aebd32189f9a9ba
[ "def encode(node):\n if node:\n vals.append(str(node.val))\n encode(node.left)\n encode(node.right)\n else:\n vals.append('#')\nvals = []\nencode(root)\nreturn ' '.join(vals)", "def decode():\n val = next(vals)\n if val == '#':\n return None\n node = TreeNode(int(...
<|body_start_0|> def encode(node): if node: vals.append(str(node.val)) encode(node.left) encode(node.right) else: vals.append('#') vals = [] encode(root) return ' '.join(vals) <|end_body_0|> <|body_s...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_022880
9,842
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0ba027d9b8bc7c80bc89ce2da3543ce7a49a403c
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def encode(node): if node: vals.append(str(node.val)) encode(node.left) encode(node.right) else: v...
the_stack_v2_python_sparse
cs15211/SerializeandDeserializeBinaryTree.py
JulyKikuAkita/PythonPrac
train
1
700791f4aa23b0ff4d3d0de924ec7c9d69a29d54
[ "self.dirty_properties = dirty_properties\nself.dirty_project_options = dirty_project_options\nself.changed_dependencies = changed_dependencies", "messages = []\nif self.dirty_properties:\n humanized_properties = formatting_utils.humanize_list(self.dirty_properties, 'and')\n pluralized_connection = formatti...
<|body_start_0|> self.dirty_properties = dirty_properties self.dirty_project_options = dirty_project_options self.changed_dependencies = changed_dependencies <|end_body_0|> <|body_start_1|> messages = [] if self.dirty_properties: humanized_properties = formatting_uti...
The DirtyReport class explains why a given step is dirty. A dirty step is defined to be a step that has run, but since doing so one of the following things have happened: - One or more YAML properties used by the step (e.g. `stage-packages`) have changed. - One of more project options (e.g. the `--target-arch` CLI opti...
DirtyReport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirtyReport: """The DirtyReport class explains why a given step is dirty. A dirty step is defined to be a step that has run, but since doing so one of the following things have happened: - One or more YAML properties used by the step (e.g. `stage-packages`) have changed. - One of more project opt...
stack_v2_sparse_classes_36k_train_022881
5,453
no_license
[ { "docstring": "Create a new DirtyReport. :param list dirty_properties: YAML properties that have changed. :param list dirty_project_options: Project options that have changed. :param list changed_dependencies: Dependencies that have changed.", "name": "__init__", "signature": "def __init__(self, *, dir...
3
stack_v2_sparse_classes_30k_test_000427
Implement the Python class `DirtyReport` described below. Class description: The DirtyReport class explains why a given step is dirty. A dirty step is defined to be a step that has run, but since doing so one of the following things have happened: - One or more YAML properties used by the step (e.g. `stage-packages`) ...
Implement the Python class `DirtyReport` described below. Class description: The DirtyReport class explains why a given step is dirty. A dirty step is defined to be a step that has run, but since doing so one of the following things have happened: - One or more YAML properties used by the step (e.g. `stage-packages`) ...
edbd256dacaa3df0417398760033f16746576818
<|skeleton|> class DirtyReport: """The DirtyReport class explains why a given step is dirty. A dirty step is defined to be a step that has run, but since doing so one of the following things have happened: - One or more YAML properties used by the step (e.g. `stage-packages`) have changed. - One of more project opt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DirtyReport: """The DirtyReport class explains why a given step is dirty. A dirty step is defined to be a step that has run, but since doing so one of the following things have happened: - One or more YAML properties used by the step (e.g. `stage-packages`) have changed. - One of more project options (e.g. th...
the_stack_v2_python_sparse
partbuilder/sequencer/state_manager/_dirty_report.py
cmatsuoka/partbuilder-spike2
train
0
9ba46b93a94feb252896217120877ff6eb7a2bd1
[ "try:\n book = BookInfo.objects.get(pk=pk)\nexcept BookInfo.DoesNotExist:\n return HttpResponse(status=404)\nreturn JsonResponse({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comment': book.comment, 'image': book.image.url if book.image else ''})", "try:\n book = Boo...
<|body_start_0|> try: book = BookInfo.objects.get(pk=pk) except BookInfo.DoesNotExist: return HttpResponse(status=404) return JsonResponse({'id': book.id, 'title': book.title, 'pub_date': book.pub_date, 'read': book.read, 'comment': book.comment, 'image': book.image.url i...
BookAPIView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/""" <|body_0|> def put(self, request, pk): """修改图书信息 路由: PUT /books/<pk>""" <|body_1|> def delete(self, request, pk): """删除图书 路由: DELETE /books/<pk>/""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_022882
5,895
no_license
[ { "docstring": "获取单个图书信息 路由: GET /books/<pk>/", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "修改图书信息 路由: PUT /books/<pk>", "name": "put", "signature": "def put(self, request, pk)" }, { "docstring": "删除图书 路由: DELETE /books/<pk>/", "name": "delete"...
3
stack_v2_sparse_classes_30k_train_020654
Implement the Python class `BookAPIView` described below. Class description: Implement the BookAPIView class. Method signatures and docstrings: - def get(self, request, pk): 获取单个图书信息 路由: GET /books/<pk>/ - def put(self, request, pk): 修改图书信息 路由: PUT /books/<pk> - def delete(self, request, pk): 删除图书 路由: DELETE /books/<...
Implement the Python class `BookAPIView` described below. Class description: Implement the BookAPIView class. Method signatures and docstrings: - def get(self, request, pk): 获取单个图书信息 路由: GET /books/<pk>/ - def put(self, request, pk): 修改图书信息 路由: PUT /books/<pk> - def delete(self, request, pk): 删除图书 路由: DELETE /books/<...
0f123a99856238af5f1aab0b555f6501e635fc52
<|skeleton|> class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/""" <|body_0|> def put(self, request, pk): """修改图书信息 路由: PUT /books/<pk>""" <|body_1|> def delete(self, request, pk): """删除图书 路由: DELETE /books/<pk>/""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BookAPIView: def get(self, request, pk): """获取单个图书信息 路由: GET /books/<pk>/""" try: book = BookInfo.objects.get(pk=pk) except BookInfo.DoesNotExist: return HttpResponse(status=404) return JsonResponse({'id': book.id, 'title': book.title, 'pub_date': book.p...
the_stack_v2_python_sparse
DRF_Tutorial/app/views.py
YDongY/PythonCode
train
1
b2c8849b114ffbfe4722b43a1884203fb935c767
[ "self._min_level = min_level\nself._max_level = max_level\nself._num_classes = num_classes\nself._anchors_per_location = anchors_per_location\nself._num_convs = num_convs\nself._num_filters = num_filters\nself._use_separable_conv = use_separable_conv\nif activation == 'relu':\n self._activation = tf.nn.relu\neli...
<|body_start_0|> self._min_level = min_level self._max_level = max_level self._num_classes = num_classes self._anchors_per_location = anchors_per_location self._num_convs = num_convs self._num_filters = num_filters self._use_separable_conv = use_separable_conv ...
RetinaNet head.
RetinanetHead
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetinanetHead: """RetinaNet head.""" def __init__(self, min_level, max_level, num_classes, anchors_per_location, num_convs=4, num_filters=256, use_separable_conv=False, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchNormActivation(activation='relu')): """In...
stack_v2_sparse_classes_36k_train_022883
46,218
permissive
[ { "docstring": "Initialize params to build RetinaNet head. Args: min_level: `int` number of minimum feature level. max_level: `int` number of maximum feature level. num_classes: `int` number of classification categories. anchors_per_location: `int` number of anchors per pixel location. num_convs: `int` number o...
4
null
Implement the Python class `RetinanetHead` described below. Class description: RetinaNet head. Method signatures and docstrings: - def __init__(self, min_level, max_level, num_classes, anchors_per_location, num_convs=4, num_filters=256, use_separable_conv=False, activation='relu', use_batch_norm=True, batch_norm_acti...
Implement the Python class `RetinanetHead` described below. Class description: RetinaNet head. Method signatures and docstrings: - def __init__(self, min_level, max_level, num_classes, anchors_per_location, num_convs=4, num_filters=256, use_separable_conv=False, activation='relu', use_batch_norm=True, batch_norm_acti...
0f7adb97a93ec3e3485c261d030c507eb16b33e4
<|skeleton|> class RetinanetHead: """RetinaNet head.""" def __init__(self, min_level, max_level, num_classes, anchors_per_location, num_convs=4, num_filters=256, use_separable_conv=False, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchNormActivation(activation='relu')): """In...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetinanetHead: """RetinaNet head.""" def __init__(self, min_level, max_level, num_classes, anchors_per_location, num_convs=4, num_filters=256, use_separable_conv=False, activation='relu', use_batch_norm=True, batch_norm_activation=nn_ops.BatchNormActivation(activation='relu')): """Initialize para...
the_stack_v2_python_sparse
models/official/detection/modeling/architecture/heads.py
tensorflow/tpu
train
5,627
7beb758e8a72bba98d486525aa38614503eb8682
[ "self.save_score(period)\nself.open_task = None\nself.current_heat = 0\nself.is_started = False\nself.is_paused = False\nself.reset_game = False", "if period.elapsed > period.hiscore:\n period.hiscore = period.elapsed\nlogger.debug(f'Saving score... {period.elapsed:.2f}s survived')\nuser_data.save()" ]
<|body_start_0|> self.save_score(period) self.open_task = None self.current_heat = 0 self.is_started = False self.is_paused = False self.reset_game = False <|end_body_0|> <|body_start_1|> if period.elapsed > period.hiscore: period.hiscore = period.ela...
Class keeps variables and states related to the gameplay.
GameState
[ "CC0-1.0", "CC-BY-4.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameState: """Class keeps variables and states related to the gameplay.""" def reset(self, period: Period) -> None: """Reset game state - called when game ends.""" <|body_0|> def save_score(self, period: Period) -> None: """Save current score for this period.""" ...
stack_v2_sparse_classes_36k_train_022884
1,517
permissive
[ { "docstring": "Reset game state - called when game ends.", "name": "reset", "signature": "def reset(self, period: Period) -> None" }, { "docstring": "Save current score for this period.", "name": "save_score", "signature": "def save_score(self, period: Period) -> None" } ]
2
null
Implement the Python class `GameState` described below. Class description: Class keeps variables and states related to the gameplay. Method signatures and docstrings: - def reset(self, period: Period) -> None: Reset game state - called when game ends. - def save_score(self, period: Period) -> None: Save current score...
Implement the Python class `GameState` described below. Class description: Class keeps variables and states related to the gameplay. Method signatures and docstrings: - def reset(self, period: Period) -> None: Reset game state - called when game ends. - def save_score(self, period: Period) -> None: Save current score...
3c2a1d1937aeed89bb891f5b6f93a6ce053af42a
<|skeleton|> class GameState: """Class keeps variables and states related to the gameplay.""" def reset(self, period: Period) -> None: """Reset game state - called when game ends.""" <|body_0|> def save_score(self, period: Period) -> None: """Save current score for this period.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameState: """Class keeps variables and states related to the gameplay.""" def reset(self, period: Period) -> None: """Reset game state - called when game ends.""" self.save_score(period) self.open_task = None self.current_heat = 0 self.is_started = False s...
the_stack_v2_python_sparse
various_vipers/project/gameplay/game_state.py
python-discord/code-jam-5
train
32
cb8d1c29e4d100f255e322fc08b9e95c7620a776
[ "rate = ec.ComputeErrorRate(error_count=0, truth_count=0)\nself.assertEqual(rate, 100.0)\nrate = ec.ComputeErrorRate(error_count=1, truth_count=0)\nself.assertEqual(rate, 100.0)\nrate = ec.ComputeErrorRate(error_count=10, truth_count=1)\nself.assertEqual(rate, 100.0)\nrate = ec.ComputeErrorRate(error_count=0, truth...
<|body_start_0|> rate = ec.ComputeErrorRate(error_count=0, truth_count=0) self.assertEqual(rate, 100.0) rate = ec.ComputeErrorRate(error_count=1, truth_count=0) self.assertEqual(rate, 100.0) rate = ec.ComputeErrorRate(error_count=10, truth_count=1) self.assertEqual(rate, ...
ErrorcounterTest
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorcounterTest: def testComputeErrorRate(self): """Tests that the percent calculation works as expected.""" <|body_0|> def testCountErrors(self): """Tests that the error counter works as expected.""" <|body_1|> def testCountWordErrors(self): ""...
stack_v2_sparse_classes_36k_train_022885
4,913
permissive
[ { "docstring": "Tests that the percent calculation works as expected.", "name": "testComputeErrorRate", "signature": "def testComputeErrorRate(self)" }, { "docstring": "Tests that the error counter works as expected.", "name": "testCountErrors", "signature": "def testCountErrors(self)" ...
3
stack_v2_sparse_classes_30k_test_000147
Implement the Python class `ErrorcounterTest` described below. Class description: Implement the ErrorcounterTest class. Method signatures and docstrings: - def testComputeErrorRate(self): Tests that the percent calculation works as expected. - def testCountErrors(self): Tests that the error counter works as expected....
Implement the Python class `ErrorcounterTest` described below. Class description: Implement the ErrorcounterTest class. Method signatures and docstrings: - def testComputeErrorRate(self): Tests that the percent calculation works as expected. - def testCountErrors(self): Tests that the error counter works as expected....
92ec5ec3efeee852aec5c057798298cd3a8e58ae
<|skeleton|> class ErrorcounterTest: def testComputeErrorRate(self): """Tests that the percent calculation works as expected.""" <|body_0|> def testCountErrors(self): """Tests that the error counter works as expected.""" <|body_1|> def testCountWordErrors(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorcounterTest: def testComputeErrorRate(self): """Tests that the percent calculation works as expected.""" rate = ec.ComputeErrorRate(error_count=0, truth_count=0) self.assertEqual(rate, 100.0) rate = ec.ComputeErrorRate(error_count=1, truth_count=0) self.assertEqual...
the_stack_v2_python_sparse
model_zoo/models/street/python/errorcounter_test.py
coderSkyChen/Action_Recognition_Zoo
train
246
890982c070a691ce9a9da4c352776cdab4afe8ee
[ "vals = []\n\ndef preOrder(node):\n if node:\n vals.append(str(node.val))\n preOrder(node.left)\n preOrder(node.right)\npreOrder(root)\nreturn ' '.join(vals)", "vals = collections.deque((int(val) for val in data.split()))\n\ndef build(minVal, maxVal):\n if vals and minVal < vals[0] < ma...
<|body_start_0|> vals = [] def preOrder(node): if node: vals.append(str(node.val)) preOrder(node.left) preOrder(node.right) preOrder(root) return ' '.join(vals) <|end_body_0|> <|body_start_1|> vals = collections.deque(...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: Optional[TreeNode]) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> Optional[TreeNode]: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022886
3,064
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: Optional[TreeNode]) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> Optional[TreeNode...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree. <...
5e2f6ceacf5dec8260ce87e9a5f4e28e86ceba7a
<|skeleton|> class Codec: def serialize(self, root: Optional[TreeNode]) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> Optional[TreeNode]: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: Optional[TreeNode]) -> str: """Encodes a tree to a single string.""" vals = [] def preOrder(node): if node: vals.append(str(node.val)) preOrder(node.left) preOrder(node.right) preOrder...
the_stack_v2_python_sparse
lc/python/0449_serialize_and_deserialize_bst.py
boknowswiki/mytraning
train
1
28064495d9885cfdd97ab3bd4c489ca967eb1d7c
[ "t_argsTuples = []\nif len(_cls_functionClass.getCstArgs()) == 0:\n return None\nfor t_tuple in _cls_functionClass.getCstArgs():\n t_widgetArgs = copy.copy(t_tuple[_cls_functionClass.U_CST_ARG_KWARGS_INDEX])\n s_key = t_tuple[_cls_functionClass.U_CST_ARG_KEY_INDEX]\n s_label = t_widgetArgs.pop('_s_label...
<|body_start_0|> t_argsTuples = [] if len(_cls_functionClass.getCstArgs()) == 0: return None for t_tuple in _cls_functionClass.getCstArgs(): t_widgetArgs = copy.copy(t_tuple[_cls_functionClass.U_CST_ARG_KWARGS_INDEX]) s_key = t_tuple[_cls_functionClass.U_CST_A...
QArkFunctionFactory
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QArkFunctionFactory: def functionToWidget(cls, parent, _cls_functionClass): """Construct a generic widget to enter the function arguments @param _cls_functionClass : the function class for which we want to generate a widget""" <|body_0|> def widgetToFunction(cls, _o_widget, ...
stack_v2_sparse_classes_36k_train_022887
3,810
permissive
[ { "docstring": "Construct a generic widget to enter the function arguments @param _cls_functionClass : the function class for which we want to generate a widget", "name": "functionToWidget", "signature": "def functionToWidget(cls, parent, _cls_functionClass)" }, { "docstring": "Generate a functi...
2
null
Implement the Python class `QArkFunctionFactory` described below. Class description: Implement the QArkFunctionFactory class. Method signatures and docstrings: - def functionToWidget(cls, parent, _cls_functionClass): Construct a generic widget to enter the function arguments @param _cls_functionClass : the function c...
Implement the Python class `QArkFunctionFactory` described below. Class description: Implement the QArkFunctionFactory class. Method signatures and docstrings: - def functionToWidget(cls, parent, _cls_functionClass): Construct a generic widget to enter the function arguments @param _cls_functionClass : the function c...
46e03095028d2a2f153959d910ceab06a633223d
<|skeleton|> class QArkFunctionFactory: def functionToWidget(cls, parent, _cls_functionClass): """Construct a generic widget to enter the function arguments @param _cls_functionClass : the function class for which we want to generate a widget""" <|body_0|> def widgetToFunction(cls, _o_widget, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QArkFunctionFactory: def functionToWidget(cls, parent, _cls_functionClass): """Construct a generic widget to enter the function arguments @param _cls_functionClass : the function class for which we want to generate a widget""" t_argsTuples = [] if len(_cls_functionClass.getCstArgs()) =...
the_stack_v2_python_sparse
src/pyQArk/Core/QArkFunctionFactory.py
arnaudkelbert/pyQArk
train
1
5ecc442826717d82c7d6b02bbad9ced2c15562f3
[ "scope = parent.create_child_scope()\nif self.action_pattern is not None:\n self.action_pattern.declare_in(scope)\nreturn scope", "scope = automaton.scope\nself.location.validate(automaton)\nif self.location not in automaton.locations:\n raise errors.ModelingError(f'source location of edge {self} is not a l...
<|body_start_0|> scope = parent.create_child_scope() if self.action_pattern is not None: self.action_pattern.declare_in(scope) return scope <|end_body_0|> <|body_start_1|> scope = automaton.scope self.location.validate(automaton) if self.location not in autom...
Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation: An optional annotation of the ...
Edge
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Edge: """Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation...
stack_v2_sparse_classes_36k_train_022888
17,705
permissive
[ { "docstring": "Creates an *edge scope* with the given parent scope. .. warning:: Used for *value passing* an experimental Momba feature. Value passing is not part of the official JANI specification.", "name": "create_edge_scope", "signature": "def create_edge_scope(self, parent: context.Scope) -> conte...
2
stack_v2_sparse_classes_30k_train_008454
Implement the Python class `Edge` described below. Class description: Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: Th...
Implement the Python class `Edge` described below. Class description: Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: Th...
3f49b83b0107fab13406f9e5ecc3c597c8b85ab9
<|skeleton|> class Edge: """Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Edge: """Represents an edge of an automaton. Attributes ---------- location: The source location of the edge. destinations: The destinations of the edge. action_pattern: The optional action pattern of the edge. guard: The optional guard of the edge. rate: The optional rate of the edge. annotation: An optional...
the_stack_v2_python_sparse
momba/model/automata.py
koehlma/momba
train
23
bcf1b9c13fa954c345b9ae9778b1cea8e402d049
[ "super(KleinToPoincare, self).__init__()\nself.min_norm = min_norm\nself.sqrt = Sqrt()\nself.sum = ReduceSum(keep_dims=True)\nself.proj = Proj(self.min_norm)", "x_poincare = x / (1.0 + self.sqrt(1.0 - self.sum(x * x, -1)))\nx_poincare = self.proj(x_poincare, c)\nreturn x_poincare" ]
<|body_start_0|> super(KleinToPoincare, self).__init__() self.min_norm = min_norm self.sqrt = Sqrt() self.sum = ReduceSum(keep_dims=True) self.proj = Proj(self.min_norm) <|end_body_0|> <|body_start_1|> x_poincare = x / (1.0 + self.sqrt(1.0 - self.sum(x * x, -1))) ...
klein to poincare class
KleinToPoincare
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KleinToPoincare: """klein to poincare class""" def __init__(self, min_norm): """init""" <|body_0|> def construct(self, x, c): """class construction""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(KleinToPoincare, self).__init__() s...
stack_v2_sparse_classes_36k_train_022889
8,596
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, min_norm)" }, { "docstring": "class construction", "name": "construct", "signature": "def construct(self, x, c)" } ]
2
null
Implement the Python class `KleinToPoincare` described below. Class description: klein to poincare class Method signatures and docstrings: - def __init__(self, min_norm): init - def construct(self, x, c): class construction
Implement the Python class `KleinToPoincare` described below. Class description: klein to poincare class Method signatures and docstrings: - def __init__(self, min_norm): init - def construct(self, x, c): class construction <|skeleton|> class KleinToPoincare: """klein to poincare class""" def __init__(self,...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class KleinToPoincare: """klein to poincare class""" def __init__(self, min_norm): """init""" <|body_0|> def construct(self, x, c): """class construction""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KleinToPoincare: """klein to poincare class""" def __init__(self, min_norm): """init""" super(KleinToPoincare, self).__init__() self.min_norm = min_norm self.sqrt = Sqrt() self.sum = ReduceSum(keep_dims=True) self.proj = Proj(self.min_norm) def constru...
the_stack_v2_python_sparse
research/nlp/hypertext/src/poincare.py
mindspore-ai/models
train
301
60f3b373fe11221e2b6366267ecc2526c7daef65
[ "new_doctor_request = json.loads(request.body.decode('utf-8'))\nDoctorView.validate_new_doctor_request(new_doctor_request)\nnew_doctor_id = DoctorService.add_doctor(new_doctor_request)\nreturn JsonResponse(new_doctor_id)", "if 'name' not in new_doctor_request:\n raise ValidationError('Missing doctor name!')\ni...
<|body_start_0|> new_doctor_request = json.loads(request.body.decode('utf-8')) DoctorView.validate_new_doctor_request(new_doctor_request) new_doctor_id = DoctorService.add_doctor(new_doctor_request) return JsonResponse(new_doctor_id) <|end_body_0|> <|body_start_1|> if 'name' not...
All endpoints related to doctors actions
DoctorView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoctorView: """All endpoints related to doctors actions""" def post(request): """Action when calling the endpoint with POST""" <|body_0|> def validate_new_doctor_request(new_doctor_request): """Validates the new doctor information received in the request body :pa...
stack_v2_sparse_classes_36k_train_022890
2,888
no_license
[ { "docstring": "Action when calling the endpoint with POST", "name": "post", "signature": "def post(request)" }, { "docstring": "Validates the new doctor information received in the request body :param new_doctor_request: Doctor information received in the request", "name": "validate_new_doc...
2
null
Implement the Python class `DoctorView` described below. Class description: All endpoints related to doctors actions Method signatures and docstrings: - def post(request): Action when calling the endpoint with POST - def validate_new_doctor_request(new_doctor_request): Validates the new doctor information received in...
Implement the Python class `DoctorView` described below. Class description: All endpoints related to doctors actions Method signatures and docstrings: - def post(request): Action when calling the endpoint with POST - def validate_new_doctor_request(new_doctor_request): Validates the new doctor information received in...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class DoctorView: """All endpoints related to doctors actions""" def post(request): """Action when calling the endpoint with POST""" <|body_0|> def validate_new_doctor_request(new_doctor_request): """Validates the new doctor information received in the request body :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoctorView: """All endpoints related to doctors actions""" def post(request): """Action when calling the endpoint with POST""" new_doctor_request = json.loads(request.body.decode('utf-8')) DoctorView.validate_new_doctor_request(new_doctor_request) new_doctor_id = DoctorSer...
the_stack_v2_python_sparse
backend/martin_helder/views/doctor_view.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
05e51e2bbc093f36e603d9a832ba4b4c3ac55091
[ "if element:\n self.id = element.id\n self.id_type = element.idType\n return\nself.id_type = id_type\nself.id = id", "elem = melding.ctAdressat()\nelem.id = self.id\nelem.idType = self.id_type\nreturn elem" ]
<|body_start_0|> if element: self.id = element.id self.id_type = element.idType return self.id_type = id_type self.id = id <|end_body_0|> <|body_start_1|> elem = melding.ctAdressat() elem.id = self.id elem.idType = self.id_type ...
NEW brreg:basic:AdressatType Used for recipient or sender
BrregAdressee
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrregAdressee: """NEW brreg:basic:AdressatType Used for recipient or sender""" def __init__(self, id=None, id_type=None, element=None): """If element is provided, all other arguments are ignored. :param id: Identifier for addressee :type id: basestring :param id_type: Type of identif...
stack_v2_sparse_classes_36k_train_022891
12,499
permissive
[ { "docstring": "If element is provided, all other arguments are ignored. :param id: Identifier for addressee :type id: basestring :param id_type: Type of identifier :type id_type: basestring :param element: PyXB element of AdressatType :type element: :py:class: pybrreg.xml.generated.basic.ctAdressat", "name...
2
stack_v2_sparse_classes_30k_train_002098
Implement the Python class `BrregAdressee` described below. Class description: NEW brreg:basic:AdressatType Used for recipient or sender Method signatures and docstrings: - def __init__(self, id=None, id_type=None, element=None): If element is provided, all other arguments are ignored. :param id: Identifier for addre...
Implement the Python class `BrregAdressee` described below. Class description: NEW brreg:basic:AdressatType Used for recipient or sender Method signatures and docstrings: - def __init__(self, id=None, id_type=None, element=None): If element is provided, all other arguments are ignored. :param id: Identifier for addre...
ecb471065795ae4bba1d5b3466756df8e8db848e
<|skeleton|> class BrregAdressee: """NEW brreg:basic:AdressatType Used for recipient or sender""" def __init__(self, id=None, id_type=None, element=None): """If element is provided, all other arguments are ignored. :param id: Identifier for addressee :type id: basestring :param id_type: Type of identif...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BrregAdressee: """NEW brreg:basic:AdressatType Used for recipient or sender""" def __init__(self, id=None, id_type=None, element=None): """If element is provided, all other arguments are ignored. :param id: Identifier for addressee :type id: basestring :param id_type: Type of identifier :type id_...
the_stack_v2_python_sparse
pybrreg/models/new_inquiry.py
unicornis/pybrreg
train
0
0c08651b9bcdffc0b9f45fe8a5f7fd02376d69aa
[ "self._verbose = verbose\nself._print_prefix = print_prefix\nself._lock = lock\nreturn", "if self._verbose:\n if args or kwargs:\n with self._lock:\n print(self._print_prefix, *args, flush=flush, **kwargs)\nreturn" ]
<|body_start_0|> self._verbose = verbose self._print_prefix = print_prefix self._lock = lock return <|end_body_0|> <|body_start_1|> if self._verbose: if args or kwargs: with self._lock: print(self._print_prefix, *args, flush=flush,...
LockPrinter
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockPrinter: def __init__(self, verbose: bool, print_prefix: str, lock: ParallelPool.LockType) -> None: """Construct a `LockPrinter` Parameters ---------- verbose : whether to print at all print_prefix : the prefix string to prepend to all print output lock : the lock to acquire before p...
stack_v2_sparse_classes_36k_train_022892
6,591
permissive
[ { "docstring": "Construct a `LockPrinter` Parameters ---------- verbose : whether to print at all print_prefix : the prefix string to prepend to all print output lock : the lock to acquire before printing", "name": "__init__", "signature": "def __init__(self, verbose: bool, print_prefix: str, lock: Para...
2
stack_v2_sparse_classes_30k_train_010290
Implement the Python class `LockPrinter` described below. Class description: Implement the LockPrinter class. Method signatures and docstrings: - def __init__(self, verbose: bool, print_prefix: str, lock: ParallelPool.LockType) -> None: Construct a `LockPrinter` Parameters ---------- verbose : whether to print at all...
Implement the Python class `LockPrinter` described below. Class description: Implement the LockPrinter class. Method signatures and docstrings: - def __init__(self, verbose: bool, print_prefix: str, lock: ParallelPool.LockType) -> None: Construct a `LockPrinter` Parameters ---------- verbose : whether to print at all...
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
<|skeleton|> class LockPrinter: def __init__(self, verbose: bool, print_prefix: str, lock: ParallelPool.LockType) -> None: """Construct a `LockPrinter` Parameters ---------- verbose : whether to print at all print_prefix : the prefix string to prepend to all print output lock : the lock to acquire before p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LockPrinter: def __init__(self, verbose: bool, print_prefix: str, lock: ParallelPool.LockType) -> None: """Construct a `LockPrinter` Parameters ---------- verbose : whether to print at all print_prefix : the prefix string to prepend to all print output lock : the lock to acquire before printing""" ...
the_stack_v2_python_sparse
lib/petsc/bin/maint/petsclinter/petsclinter/queue_main.py
petsc/petsc
train
341
d129618291b99cc885a809c4653a6a2aa12793f8
[ "if head is None:\n return head\nwhile head.val == val:\n head = head.next\n if head is None:\n return head\nslow = head\nfast = slow.next\nwhile fast:\n if fast.val == val:\n slow.next = fast.next\n fast = fast.next\n else:\n slow = slow.next\n fast = fast.next\nre...
<|body_start_0|> if head is None: return head while head.val == val: head = head.next if head is None: return head slow = head fast = slow.next while fast: if fast.val == val: slow.next = fast.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def removeElements2(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_022893
1,438
no_license
[ { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements", "signature": "def removeElements(self, head, val)" }, { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements2", "signature": "def removeElements2(self,...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def removeElements2(self, head, val): :type head: ListNode :type val: int :rtype: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def removeElements2(self, head, val): :type head: ListNode :type val: int :rtype: List...
41365b549f1e6b04aac9f1632a66e71c1e05b322
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def removeElements2(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" if head is None: return head while head.val == val: head = head.next if head is None: return head slow = head fa...
the_stack_v2_python_sparse
python practice/LinkedList/e_removeEle.py
SuzyWu2014/coding-practice
train
1
f99174d4f6583ad6b8091d276c16a7601d0c7c6e
[ "with io.open('completer_data\\\\keywords.txt', 'r', encoding='utf-8') as f:\n lowercase_keywords = [k.rstrip().lower() for k in f.readlines()]\n uppercase_keywords = [k.upper() for k in lowercase_keywords]\n titlecase_keywords = [k.title() for k in lowercase_keywords]\nwith io.open('completer_data\\\\func...
<|body_start_0|> with io.open('completer_data\\keywords.txt', 'r', encoding='utf-8') as f: lowercase_keywords = [k.rstrip().lower() for k in f.readlines()] uppercase_keywords = [k.upper() for k in lowercase_keywords] titlecase_keywords = [k.title() for k in lowercase_keywords...
Comleter class to use in the query text editor.
Completer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Completer: """Comleter class to use in the query text editor.""" def __init__(self): """Initialize Completer class with the keywords and functions.""" <|body_0|> def update_completer_string_list(self, items): """Update completer string list to include additional ...
stack_v2_sparse_classes_36k_train_022894
2,377
permissive
[ { "docstring": "Initialize Completer class with the keywords and functions.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Update completer string list to include additional strings. The list of additional strings include geodatabase items.", "name": "update_compl...
2
stack_v2_sparse_classes_30k_train_019999
Implement the Python class `Completer` described below. Class description: Comleter class to use in the query text editor. Method signatures and docstrings: - def __init__(self): Initialize Completer class with the keywords and functions. - def update_completer_string_list(self, items): Update completer string list t...
Implement the Python class `Completer` described below. Class description: Comleter class to use in the query text editor. Method signatures and docstrings: - def __init__(self): Initialize Completer class with the keywords and functions. - def update_completer_string_list(self, items): Update completer string list t...
d46629a3f3768e7004d22a0693361f2f32002e34
<|skeleton|> class Completer: """Comleter class to use in the query text editor.""" def __init__(self): """Initialize Completer class with the keywords and functions.""" <|body_0|> def update_completer_string_list(self, items): """Update completer string list to include additional ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Completer: """Comleter class to use in the query text editor.""" def __init__(self): """Initialize Completer class with the keywords and functions.""" with io.open('completer_data\\keywords.txt', 'r', encoding='utf-8') as f: lowercase_keywords = [k.rstrip().lower() for k in f....
the_stack_v2_python_sparse
src/completer.py
geogubd/GDBee
train
0
e249b29ad072651ab373783ea7e7f8af5ad7e4b2
[ "Idevice.__init__(self, x_(u'Java Applet'), x_(u'University of Auckland'), u'', u'', u'', parentNode)\nself.emphasis = Idevice.NoEmphasis\nself.appletCode = u''\nself._fileInstruc = x_(u'Add all the files provided for the applet\\nexcept the .txt file one at a time using the add files and upload buttons. The \\nfil...
<|body_start_0|> Idevice.__init__(self, x_(u'Java Applet'), x_(u'University of Auckland'), u'', u'', u'', parentNode) self.emphasis = Idevice.NoEmphasis self.appletCode = u'' self._fileInstruc = x_(u'Add all the files provided for the applet\nexcept the .txt file one at a time using the ...
Java Applet Idevice. Enables you to embed java applet in the browser
AppletIdevice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppletIdevice: """Java Applet Idevice. Enables you to embed java applet in the browser""" def __init__(self, parentNode=None): """Sets up the idevice title and instructions etc""" <|body_0|> def uploadFile(self, filePath): """Store the upload files in the package...
stack_v2_sparse_classes_36k_train_022895
2,445
no_license
[ { "docstring": "Sets up the idevice title and instructions etc", "name": "__init__", "signature": "def __init__(self, parentNode=None)" }, { "docstring": "Store the upload files in the package Needs to be in a package to work.", "name": "uploadFile", "signature": "def uploadFile(self, fi...
3
stack_v2_sparse_classes_30k_train_009058
Implement the Python class `AppletIdevice` described below. Class description: Java Applet Idevice. Enables you to embed java applet in the browser Method signatures and docstrings: - def __init__(self, parentNode=None): Sets up the idevice title and instructions etc - def uploadFile(self, filePath): Store the upload...
Implement the Python class `AppletIdevice` described below. Class description: Java Applet Idevice. Enables you to embed java applet in the browser Method signatures and docstrings: - def __init__(self, parentNode=None): Sets up the idevice title and instructions etc - def uploadFile(self, filePath): Store the upload...
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
<|skeleton|> class AppletIdevice: """Java Applet Idevice. Enables you to embed java applet in the browser""" def __init__(self, parentNode=None): """Sets up the idevice title and instructions etc""" <|body_0|> def uploadFile(self, filePath): """Store the upload files in the package...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppletIdevice: """Java Applet Idevice. Enables you to embed java applet in the browser""" def __init__(self, parentNode=None): """Sets up the idevice title and instructions etc""" Idevice.__init__(self, x_(u'Java Applet'), x_(u'University of Auckland'), u'', u'', u'', parentNode) ...
the_stack_v2_python_sparse
eXe/rev2283-2409/base-trunk-2283/exe/idevices/appletidevice.py
joliebig/featurehouse_fstmerge_examples
train
3
009a2a7597be6ec2cbaa6bdd198206977102fa06
[ "dist = dist.coalesce((input,) + (sum(others, ()),) + (output,))\nconstraints = [[0, 2], [1, 2]]\nsuper(BROJAOptimizer, self).__init__(dist, marginals=constraints, rv_mode=rv_mode)\nself._input = {0}\nself._others = {1}\nself._output = {2}", "cmi = self._conditional_mutual_information(self._input, self._output, s...
<|body_start_0|> dist = dist.coalesce((input,) + (sum(others, ()),) + (output,)) constraints = [[0, 2], [1, 2]] super(BROJAOptimizer, self).__init__(dist, marginals=constraints, rv_mode=rv_mode) self._input = {0} self._others = {1} self._output = {2} <|end_body_0|> <|bod...
Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.
BROJAOptimizer
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BROJAOptimizer: """Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.""" def __init__(self, dist, input, others, output, rv_mode=None): """Initialize the optimizer. Parameters -------...
stack_v2_sparse_classes_36k_train_022896
3,861
permissive
[ { "docstring": "Initialize the optimizer. Parameters ---------- dist : Distribution The distribution to base the optimization on. input : iterable Variables to treat as inputs. others : iterable of iterables The other input variables. output : iterable The output variable. rv_mode : bool Unused, provided for co...
2
stack_v2_sparse_classes_30k_train_002606
Implement the Python class `BROJAOptimizer` described below. Class description: Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation. Method signatures and docstrings: - def __init__(self, dist, input, others, output, rv...
Implement the Python class `BROJAOptimizer` described below. Class description: Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation. Method signatures and docstrings: - def __init__(self, dist, input, others, output, rv...
ebd0c11600e559bf34cf12a6b4e451057838e324
<|skeleton|> class BROJAOptimizer: """Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.""" def __init__(self, dist, input, others, output, rv_mode=None): """Initialize the optimizer. Parameters -------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BROJAOptimizer: """Optimizer for computing the max mutual information between inputs and outputs. In the bivariate case, this corresponds to maximizing the coinformation.""" def __init__(self, dist, input, others, output, rv_mode=None): """Initialize the optimizer. Parameters ---------- dist : Di...
the_stack_v2_python_sparse
dit/pid/ibroja.py
heleibin/dit
train
1
837ffc10a6bc2246bb6ff755143c9a9288c425a5
[ "try:\n return Products.objects.get(pk=p_k)\nexcept Products.DoesNotExist:\n raise ProductNotFound", "serializer = ProductsSerializer(data=request.data, context={'request': request})\nif serializer.is_valid(raise_exception=True):\n serializer.save()\n return Response(serializer.data, status=201)\nretu...
<|body_start_0|> try: return Products.objects.get(pk=p_k) except Products.DoesNotExist: raise ProductNotFound <|end_body_0|> <|body_start_1|> serializer = ProductsSerializer(data=request.data, context={'request': request}) if serializer.is_valid(raise_exception=T...
Products view. Adds, edit, view and delete products in the store.
ProductsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductsView: """Products view. Adds, edit, view and delete products in the store.""" def get_object(self, p_k): """Get a product object.""" <|body_0|> def post(self, request): """POST request. Adds a product to the store.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_022897
2,106
permissive
[ { "docstring": "Get a product object.", "name": "get_object", "signature": "def get_object(self, p_k)" }, { "docstring": "POST request. Adds a product to the store.", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_018991
Implement the Python class `ProductsView` described below. Class description: Products view. Adds, edit, view and delete products in the store. Method signatures and docstrings: - def get_object(self, p_k): Get a product object. - def post(self, request): POST request. Adds a product to the store.
Implement the Python class `ProductsView` described below. Class description: Products view. Adds, edit, view and delete products in the store. Method signatures and docstrings: - def get_object(self, p_k): Get a product object. - def post(self, request): POST request. Adds a product to the store. <|skeleton|> class...
a5f5b3df935d35c7d874b41bffb57069239dcdfd
<|skeleton|> class ProductsView: """Products view. Adds, edit, view and delete products in the store.""" def get_object(self, p_k): """Get a product object.""" <|body_0|> def post(self, request): """POST request. Adds a product to the store.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProductsView: """Products view. Adds, edit, view and delete products in the store.""" def get_object(self, p_k): """Get a product object.""" try: return Products.objects.get(pk=p_k) except Products.DoesNotExist: raise ProductNotFound def post(self, req...
the_stack_v2_python_sparse
items/views.py
Njaya2019/Store
train
0
a0430fcd70bcf82fc53ed985d9c75e06cc7fad34
[ "__tracebackhide__ = datatest.validation._pytest_tracebackhide\nrequirement = normalize(requirement, lazy_evaluation=False, default_type=set)\nif isinstance(requirement, (Mapping, IterItems)):\n factory = RequiredSubset_090\n requirement = datatest.requirements.RequiredMapping(requirement, factory)\nelse:\n ...
<|body_start_0|> __tracebackhide__ = datatest.validation._pytest_tracebackhide requirement = normalize(requirement, lazy_evaluation=False, default_type=set) if isinstance(requirement, (Mapping, IterItems)): factory = RequiredSubset_090 requirement = datatest.requirements....
ValidateType
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidateType: def subset(self, data, requirement, msg=None): """Implements API 0.9.x subset behavior.""" <|body_0|> def superset(self, data, requirement, msg=None): """Implements API 0.9.x superset behavior.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022898
2,833
permissive
[ { "docstring": "Implements API 0.9.x subset behavior.", "name": "subset", "signature": "def subset(self, data, requirement, msg=None)" }, { "docstring": "Implements API 0.9.x superset behavior.", "name": "superset", "signature": "def superset(self, data, requirement, msg=None)" } ]
2
stack_v2_sparse_classes_30k_train_001919
Implement the Python class `ValidateType` described below. Class description: Implement the ValidateType class. Method signatures and docstrings: - def subset(self, data, requirement, msg=None): Implements API 0.9.x subset behavior. - def superset(self, data, requirement, msg=None): Implements API 0.9.x superset beha...
Implement the Python class `ValidateType` described below. Class description: Implement the ValidateType class. Method signatures and docstrings: - def subset(self, data, requirement, msg=None): Implements API 0.9.x subset behavior. - def superset(self, data, requirement, msg=None): Implements API 0.9.x superset beha...
bf136eab23c2b6ea36c201e1446fca9243c3fba6
<|skeleton|> class ValidateType: def subset(self, data, requirement, msg=None): """Implements API 0.9.x subset behavior.""" <|body_0|> def superset(self, data, requirement, msg=None): """Implements API 0.9.x superset behavior.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValidateType: def subset(self, data, requirement, msg=None): """Implements API 0.9.x subset behavior.""" __tracebackhide__ = datatest.validation._pytest_tracebackhide requirement = normalize(requirement, lazy_evaluation=False, default_type=set) if isinstance(requirement, (Mappi...
the_stack_v2_python_sparse
datatest/__past__/api09.py
Dev4Data/datatest
train
0
66630797fc499b9201d31fbebad0c3ad25434d1d
[ "super(MoveFiles, self).__init__()\nself.filenames = filenames\nself.storage = storage\nreturn", "for name in self.filenames:\n self.logger.debug('Moving {0}'.format(name))\n self.storage.move(name)\nreturn" ]
<|body_start_0|> super(MoveFiles, self).__init__() self.filenames = filenames self.storage = storage return <|end_body_0|> <|body_start_1|> for name in self.filenames: self.logger.debug('Moving {0}'.format(name)) self.storage.move(name) return <|e...
A tool to move files to storage.
MoveFiles
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MoveFiles: """A tool to move files to storage.""" def __init__(self, filenames, storage): """:param: - `filenames`: an iterator of filenames to move - `storage`: The mover""" <|body_0|> def run(self): """Moves the files in filenames to storage.""" <|body_...
stack_v2_sparse_classes_36k_train_022899
681
permissive
[ { "docstring": ":param: - `filenames`: an iterator of filenames to move - `storage`: The mover", "name": "__init__", "signature": "def __init__(self, filenames, storage)" }, { "docstring": "Moves the files in filenames to storage.", "name": "run", "signature": "def run(self)" } ]
2
null
Implement the Python class `MoveFiles` described below. Class description: A tool to move files to storage. Method signatures and docstrings: - def __init__(self, filenames, storage): :param: - `filenames`: an iterator of filenames to move - `storage`: The mover - def run(self): Moves the files in filenames to storag...
Implement the Python class `MoveFiles` described below. Class description: A tool to move files to storage. Method signatures and docstrings: - def __init__(self, filenames, storage): :param: - `filenames`: an iterator of filenames to move - `storage`: The mover - def run(self): Moves the files in filenames to storag...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class MoveFiles: """A tool to move files to storage.""" def __init__(self, filenames, storage): """:param: - `filenames`: an iterator of filenames to move - `storage`: The mover""" <|body_0|> def run(self): """Moves the files in filenames to storage.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MoveFiles: """A tool to move files to storage.""" def __init__(self, filenames, storage): """:param: - `filenames`: an iterator of filenames to move - `storage`: The mover""" super(MoveFiles, self).__init__() self.filenames = filenames self.storage = storage return...
the_stack_v2_python_sparse
apetools/tools/movefiles.py
russell-n/oldape
train
0