blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
579330adbc74a9ae39a99d9346dca9e5053f66d9 | [
"x = torch.randn(4, 2)\nn_components = np.random.randint(1, 100)\nmodel = GaussianMixture(n_components, x.size(1))\nmodel.fit(x)\ny = model.predict(x)\nself.assertEqual(torch.Tensor(x.size(0)).size(), y.size())",
"x = torch.randn(4, 2)\nn_components = np.random.randint(1, 100)\nmodel = GaussianMixture(n_component... | <|body_start_0|>
x = torch.randn(4, 2)
n_components = np.random.randint(1, 100)
model = GaussianMixture(n_components, x.size(1))
model.fit(x)
y = model.predict(x)
self.assertEqual(torch.Tensor(x.size(0)).size(), y.size())
<|end_body_0|>
<|body_start_1|>
x = torch... | Basic tests for CPU models. | CpuCheck | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CpuCheck:
"""Basic tests for CPU models."""
def testPredictClasses(self):
"""Assert that torch.FloatTensor is handled correctly."""
<|body_0|>
def testPredictProbabilities(self):
"""Assert that torch.FloatTensor is handled correctly when returning class probabili... | stack_v2_sparse_classes_75kplus_train_070000 | 2,202 | permissive | [
{
"docstring": "Assert that torch.FloatTensor is handled correctly.",
"name": "testPredictClasses",
"signature": "def testPredictClasses(self)"
},
{
"docstring": "Assert that torch.FloatTensor is handled correctly when returning class probabilities.",
"name": "testPredictProbabilities",
... | 2 | stack_v2_sparse_classes_30k_val_002479 | Implement the Python class `CpuCheck` described below.
Class description:
Basic tests for CPU models.
Method signatures and docstrings:
- def testPredictClasses(self): Assert that torch.FloatTensor is handled correctly.
- def testPredictProbabilities(self): Assert that torch.FloatTensor is handled correctly when retu... | Implement the Python class `CpuCheck` described below.
Class description:
Basic tests for CPU models.
Method signatures and docstrings:
- def testPredictClasses(self): Assert that torch.FloatTensor is handled correctly.
- def testPredictProbabilities(self): Assert that torch.FloatTensor is handled correctly when retu... | df1c26047574fbe0a7b103ebc26687bc04739229 | <|skeleton|>
class CpuCheck:
"""Basic tests for CPU models."""
def testPredictClasses(self):
"""Assert that torch.FloatTensor is handled correctly."""
<|body_0|>
def testPredictProbabilities(self):
"""Assert that torch.FloatTensor is handled correctly when returning class probabili... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CpuCheck:
"""Basic tests for CPU models."""
def testPredictClasses(self):
"""Assert that torch.FloatTensor is handled correctly."""
x = torch.randn(4, 2)
n_components = np.random.randint(1, 100)
model = GaussianMixture(n_components, x.size(1))
model.fit(x)
... | the_stack_v2_python_sparse | util/gmm_torch/test.py | Vichoko/aidio | train | 2 |
31249ae905ad934bb55cf6f2816dfb0303606fc5 | [
"self.prefixSum = w\nfor i in range(1, len(self.prefixSum)):\n self.prefixSum[i] = self.prefixSum[i] + self.prefixSum[i - 1]",
"if len(self.prefixSum) == 0:\n return 0\ntarget = random.randint(1, self.prefixSum[-1])\nstart, end = (0, len(self.prefixSum))\nwhile start + 1 < end:\n mid = (start + end) // 2... | <|body_start_0|>
self.prefixSum = w
for i in range(1, len(self.prefixSum)):
self.prefixSum[i] = self.prefixSum[i] + self.prefixSum[i - 1]
<|end_body_0|>
<|body_start_1|>
if len(self.prefixSum) == 0:
return 0
target = random.randint(1, self.prefixSum[-1])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.prefixSum = w
for i in range(1, len(self.prefixSum)):
self.prefixSum[i]... | stack_v2_sparse_classes_75kplus_train_070001 | 887 | no_license | [
{
"docstring": ":type w: List[int]",
"name": "__init__",
"signature": "def __init__(self, w)"
},
{
"docstring": ":rtype: int",
"name": "pickIndex",
"signature": "def pickIndex(self)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, w): :type w: List[int]
- def pickIndex(self): :rtype: int
<|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|... | fdb6bcb4c721e03e853890dd89122f2c4196a1ea | <|skeleton|>
class Solution:
def __init__(self, w):
""":type w: List[int]"""
<|body_0|>
def pickIndex(self):
""":rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def __init__(self, w):
""":type w: List[int]"""
self.prefixSum = w
for i in range(1, len(self.prefixSum)):
self.prefixSum[i] = self.prefixSum[i] + self.prefixSum[i - 1]
def pickIndex(self):
""":rtype: int"""
if len(self.prefixSum) == 0:
... | the_stack_v2_python_sparse | python/binarySearch/randomPickWithWeight.py | XifeiNi/LeetCode-Traversal | train | 2 | |
c33e6a3b826bdb4fc6dfae6824405c1518d9b9e6 | [
"Package.__init__(self, model, extension, 'sor', unitnumber)\nself.url = 'sor.htm'\nself.mxiter = mxiter\nself.accl = accl\nself.hclose = hclose\nself.iprsor = iprsor\nself.parent.add_package(self)",
"f_sor = open(self.fn_path, 'w')\nf_sor.write('%10i\\n' % self.mxiter)\nf_sor.write('%10f%10f%10i\\n' % (self.accl... | <|body_start_0|>
Package.__init__(self, model, extension, 'sor', unitnumber)
self.url = 'sor.htm'
self.mxiter = mxiter
self.accl = accl
self.hclose = hclose
self.iprsor = iprsor
self.parent.add_package(self)
<|end_body_0|>
<|body_start_1|>
f_sor = open(se... | Slice-successive overrelaxation package class | ModflowSor | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModflowSor:
"""Slice-successive overrelaxation package class"""
def __init__(self, model, mxiter=200, accl=1, hclose=1e-05, iprsor=0, extension='sor', unitnumber=26):
"""Package constructor."""
<|body_0|>
def write_file(self):
"""Write the package input file."""
... | stack_v2_sparse_classes_75kplus_train_070002 | 2,445 | permissive | [
{
"docstring": "Package constructor.",
"name": "__init__",
"signature": "def __init__(self, model, mxiter=200, accl=1, hclose=1e-05, iprsor=0, extension='sor', unitnumber=26)"
},
{
"docstring": "Write the package input file.",
"name": "write_file",
"signature": "def write_file(self)"
}... | 3 | stack_v2_sparse_classes_30k_train_018873 | Implement the Python class `ModflowSor` described below.
Class description:
Slice-successive overrelaxation package class
Method signatures and docstrings:
- def __init__(self, model, mxiter=200, accl=1, hclose=1e-05, iprsor=0, extension='sor', unitnumber=26): Package constructor.
- def write_file(self): Write the pa... | Implement the Python class `ModflowSor` described below.
Class description:
Slice-successive overrelaxation package class
Method signatures and docstrings:
- def __init__(self, model, mxiter=200, accl=1, hclose=1e-05, iprsor=0, extension='sor', unitnumber=26): Package constructor.
- def write_file(self): Write the pa... | 04b640c8e492bec475eb5aadb812e3cd5d6d7d1e | <|skeleton|>
class ModflowSor:
"""Slice-successive overrelaxation package class"""
def __init__(self, model, mxiter=200, accl=1, hclose=1e-05, iprsor=0, extension='sor', unitnumber=26):
"""Package constructor."""
<|body_0|>
def write_file(self):
"""Write the package input file."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModflowSor:
"""Slice-successive overrelaxation package class"""
def __init__(self, model, mxiter=200, accl=1, hclose=1e-05, iprsor=0, extension='sor', unitnumber=26):
"""Package constructor."""
Package.__init__(self, model, extension, 'sor', unitnumber)
self.url = 'sor.htm'
... | the_stack_v2_python_sparse | flopy/modflow/mfsor.py | HydroLogic/flopy | train | 1 |
33992793e269ecbc5a5833ee5d0a23aa84880814 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | LearnerServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LearnerServicer:
"""Missing associated documentation comment in .proto file."""
def SendNumpyArray(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendBatchNumpyArray(self, request, context):
"""Missing assoc... | stack_v2_sparse_classes_75kplus_train_070003 | 6,898 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SendNumpyArray",
"signature": "def SendNumpyArray(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "SendBatchNumpyArray",
"signature": "def Se... | 4 | stack_v2_sparse_classes_30k_train_002058 | Implement the Python class `LearnerServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def SendNumpyArray(self, request, context): Missing associated documentation comment in .proto file.
- def SendBatchNumpyArray(self, request, co... | Implement the Python class `LearnerServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def SendNumpyArray(self, request, context): Missing associated documentation comment in .proto file.
- def SendBatchNumpyArray(self, request, co... | 28723664cd408e3e33c40658284ed24b0068027f | <|skeleton|>
class LearnerServicer:
"""Missing associated documentation comment in .proto file."""
def SendNumpyArray(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def SendBatchNumpyArray(self, request, context):
"""Missing assoc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LearnerServicer:
"""Missing associated documentation comment in .proto file."""
def SendNumpyArray(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')... | the_stack_v2_python_sparse | rls/distribute/pb2/apex_learner_pb2_grpc.py | nisheethjaiswal/RLs | train | 0 |
7f2af0ebde25c221a0a63c207324e765d46e704c | [
"super(SVRenderLayer, self).__init__()\nself.layer = render_layer\nself.camera = camera\nself.keep = keep_output\nself.attr = attr",
"self.layer.renderer.eye = self.camera\nself.layer.renderer.light_direction = -self.camera\nout = self.layer(input)\nif self.keep:\n setattr(input, self.attr, out)\nreturn out"
] | <|body_start_0|>
super(SVRenderLayer, self).__init__()
self.layer = render_layer
self.camera = camera
self.keep = keep_output
self.attr = attr
<|end_body_0|>
<|body_start_1|>
self.layer.renderer.eye = self.camera
self.layer.renderer.light_direction = -self.camera... | A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the output to Methods ------- forward(input) ret... | SVRenderLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SVRenderLayer:
"""A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the out... | stack_v2_sparse_classes_75kplus_train_070004 | 9,441 | permissive | [
{
"docstring": "Parameters ---------- render_layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep_output : bool (optional) if True keeps the output in an attribute of the input data (default is False) attr : str (optional) the name of the attribute to store the output to (defau... | 2 | stack_v2_sparse_classes_30k_train_009403 | Implement the Python class `SVRenderLayer` described below.
Class description:
A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the... | Implement the Python class `SVRenderLayer` described below.
Class description:
A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the... | 2615b66dd4addfd5c03d9d91a24c7da414294308 | <|skeleton|>
class SVRenderLayer:
"""A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the out... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SVRenderLayer:
"""A class representing a signle view rendering layer Attributes ---------- layer : RenderLayer a rendering layer camera : Tensor the positions of the camera keep : bool if True keeps the output in an attribute of the input data attr : str the name of the attribute to store the output to Method... | the_stack_v2_python_sparse | ACME/layer/RenderLayer.py | mauriziokovacic/ACME | train | 3 |
8cb832d67cd7ad8670fe37e2f739ca146f4dba92 | [
"self._logger = logger\nself._resource_config = resource_config\nself._service_provider = service_provider",
"deployment = self._service_provider.deployment_service.get_deployment_by_name(deployed_app.namespace, deployed_app.kubernetes_name)\ndeployment.spec.replicas = deployed_app.replicas\ndeployment.spec.templ... | <|body_start_0|>
self._logger = logger
self._resource_config = resource_config
self._service_provider = service_provider
<|end_body_0|>
<|body_start_1|>
deployment = self._service_provider.deployment_service.get_deployment_by_name(deployed_app.namespace, deployed_app.kubernetes_name)
... | PowerFlow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PowerFlow:
def __init__(self, logger, resource_config, service_provider):
"""Init. :param logging.Logger logger: :param cloudshell.cp.kubernetes.resource_config. KubernetesResourceConfig resource_config: :param cloudshell.cp.kubernetes.services.service_provider. ServiceProvider service_p... | stack_v2_sparse_classes_75kplus_train_070005 | 3,016 | no_license | [
{
"docstring": "Init. :param logging.Logger logger: :param cloudshell.cp.kubernetes.resource_config. KubernetesResourceConfig resource_config: :param cloudshell.cp.kubernetes.services.service_provider. ServiceProvider service_provider:",
"name": "__init__",
"signature": "def __init__(self, logger, resou... | 3 | stack_v2_sparse_classes_30k_train_001520 | Implement the Python class `PowerFlow` described below.
Class description:
Implement the PowerFlow class.
Method signatures and docstrings:
- def __init__(self, logger, resource_config, service_provider): Init. :param logging.Logger logger: :param cloudshell.cp.kubernetes.resource_config. KubernetesResourceConfig res... | Implement the Python class `PowerFlow` described below.
Class description:
Implement the PowerFlow class.
Method signatures and docstrings:
- def __init__(self, logger, resource_config, service_provider): Init. :param logging.Logger logger: :param cloudshell.cp.kubernetes.resource_config. KubernetesResourceConfig res... | 236920b17fdd4d6b80f67c9d8ca9fb27f3763252 | <|skeleton|>
class PowerFlow:
def __init__(self, logger, resource_config, service_provider):
"""Init. :param logging.Logger logger: :param cloudshell.cp.kubernetes.resource_config. KubernetesResourceConfig resource_config: :param cloudshell.cp.kubernetes.services.service_provider. ServiceProvider service_p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PowerFlow:
def __init__(self, logger, resource_config, service_provider):
"""Init. :param logging.Logger logger: :param cloudshell.cp.kubernetes.resource_config. KubernetesResourceConfig resource_config: :param cloudshell.cp.kubernetes.services.service_provider. ServiceProvider service_provider:"""
... | the_stack_v2_python_sparse | cloudshell/cp/kubernetes/flows/power.py | QualiSystems/cloudshell-cp-kubernetes | train | 0 | |
0e92fc0cc31387f1ae59ac44028ba37d9a2d664e | [
"convid = kwargs['convid']\nsender = kwargs['sender']\nlocation = kwargs['location']\nconv = Conversation.objects.get(convid=convid)\nassert sender in conv.members, f'sender_error {convid} {sender}'\nkwargs['location'] = location if isinstance(location, dict) else {}\nkwargs['symbol'] = kwargs.get('symbol') or conv... | <|body_start_0|>
convid = kwargs['convid']
sender = kwargs['sender']
location = kwargs['location']
conv = Conversation.objects.get(convid=convid)
assert sender in conv.members, f'sender_error {convid} {sender}'
kwargs['location'] = location if isinstance(location, dict) e... | MessageManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessageManager:
def _msg_create(self, **kwargs):
"""消息创建"""
<|body_0|>
def trigger_msg_add(self, contact, trigger, content, symbol, location=None, **kwargs):
"""触发消息添加"""
<|body_1|>
def stay_msg_add(self, contact, content, location=None):
"""留言消息... | stack_v2_sparse_classes_75kplus_train_070006 | 25,386 | no_license | [
{
"docstring": "消息创建",
"name": "_msg_create",
"signature": "def _msg_create(self, **kwargs)"
},
{
"docstring": "触发消息添加",
"name": "trigger_msg_add",
"signature": "def trigger_msg_add(self, contact, trigger, content, symbol, location=None, **kwargs)"
},
{
"docstring": "留言消息",
"... | 4 | stack_v2_sparse_classes_30k_train_017600 | Implement the Python class `MessageManager` described below.
Class description:
Implement the MessageManager class.
Method signatures and docstrings:
- def _msg_create(self, **kwargs): 消息创建
- def trigger_msg_add(self, contact, trigger, content, symbol, location=None, **kwargs): 触发消息添加
- def stay_msg_add(self, contact... | Implement the Python class `MessageManager` described below.
Class description:
Implement the MessageManager class.
Method signatures and docstrings:
- def _msg_create(self, **kwargs): 消息创建
- def trigger_msg_add(self, contact, trigger, content, symbol, location=None, **kwargs): 触发消息添加
- def stay_msg_add(self, contact... | b7ed6588e13d2916a4162d56509d2794742a1eb1 | <|skeleton|>
class MessageManager:
def _msg_create(self, **kwargs):
"""消息创建"""
<|body_0|>
def trigger_msg_add(self, contact, trigger, content, symbol, location=None, **kwargs):
"""触发消息添加"""
<|body_1|>
def stay_msg_add(self, contact, content, location=None):
"""留言消息... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MessageManager:
def _msg_create(self, **kwargs):
"""消息创建"""
convid = kwargs['convid']
sender = kwargs['sender']
location = kwargs['location']
conv = Conversation.objects.get(convid=convid)
assert sender in conv.members, f'sender_error {convid} {sender}'
... | the_stack_v2_python_sparse | server/applibs/convert/models/contact.py | fanshuai/kubrick | train | 0 | |
8828e66fe2db9dc500c592a04008f0b9a3720fe6 | [
"env = ZerosEnvironment(batch_size=batch_size, observation_shape=observation_shape)\n\n@common.function\ndef observation_and_reward():\n observation = env.reset().observation\n reward = env.step(tf.zeros(batch_size)).reward\n return (observation, reward)\nobservation, reward = observation_and_reward()\nexp... | <|body_start_0|>
env = ZerosEnvironment(batch_size=batch_size, observation_shape=observation_shape)
@common.function
def observation_and_reward():
observation = env.reset().observation
reward = env.step(tf.zeros(batch_size)).reward
return (observation, reward... | BanditTFEnvironmentTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BanditTFEnvironmentTest:
def testObservationAndRewardShapes(self, batch_size, observation_shape):
"""Exercise `reset` and `step`. Ensure correct shapes are returned."""
<|body_0|>
def testTwoConsecutiveSteps(self, batch_size, observation_shape):
"""Test two consecuti... | stack_v2_sparse_classes_75kplus_train_070007 | 5,763 | permissive | [
{
"docstring": "Exercise `reset` and `step`. Ensure correct shapes are returned.",
"name": "testObservationAndRewardShapes",
"signature": "def testObservationAndRewardShapes(self, batch_size, observation_shape)"
},
{
"docstring": "Test two consecutive calls to `step`.",
"name": "testTwoConse... | 3 | stack_v2_sparse_classes_30k_train_016455 | Implement the Python class `BanditTFEnvironmentTest` described below.
Class description:
Implement the BanditTFEnvironmentTest class.
Method signatures and docstrings:
- def testObservationAndRewardShapes(self, batch_size, observation_shape): Exercise `reset` and `step`. Ensure correct shapes are returned.
- def test... | Implement the Python class `BanditTFEnvironmentTest` described below.
Class description:
Implement the BanditTFEnvironmentTest class.
Method signatures and docstrings:
- def testObservationAndRewardShapes(self, batch_size, observation_shape): Exercise `reset` and `step`. Ensure correct shapes are returned.
- def test... | eca1093d3a047e538f17f6ab92ab4d8144284f23 | <|skeleton|>
class BanditTFEnvironmentTest:
def testObservationAndRewardShapes(self, batch_size, observation_shape):
"""Exercise `reset` and `step`. Ensure correct shapes are returned."""
<|body_0|>
def testTwoConsecutiveSteps(self, batch_size, observation_shape):
"""Test two consecuti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BanditTFEnvironmentTest:
def testObservationAndRewardShapes(self, batch_size, observation_shape):
"""Exercise `reset` and `step`. Ensure correct shapes are returned."""
env = ZerosEnvironment(batch_size=batch_size, observation_shape=observation_shape)
@common.function
def obse... | the_stack_v2_python_sparse | tf_agents/bandits/environments/bandit_tf_environment_test.py | tensorflow/agents | train | 2,755 | |
b2c0cda625673587eeef40d9586740af3e54afa2 | [
"self.started = False\nself.packages_to_install = list()\nif 'environment' not in kwargs:\n kwargs['environment'] = {}\nif 'RESOLUTION' not in kwargs['environment']:\n kwargs['environment']['RESOLUTION'] = resolution\nDocker.__init__(self, name, dimage='kali', dcmd='/init', ports=[VNC_DEFAULT, WEB_DEFAULT], p... | <|body_start_0|>
self.started = False
self.packages_to_install = list()
if 'environment' not in kwargs:
kwargs['environment'] = {}
if 'RESOLUTION' not in kwargs['environment']:
kwargs['environment']['RESOLUTION'] = resolution
Docker.__init__(self, name, di... | Kali | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Kali:
def __init__(self, name, resolution='1920x1080x24', vnc=VNC_DEFAULT, web=WEB_DEFAULT, **kwargs):
"""Creates a Kali host running a VNC server and NoVNC web server :param resolution: (Optional) String in the format WidthxHeightxColorDepth for the remote display. :type resolution: str... | stack_v2_sparse_classes_75kplus_train_070008 | 4,727 | no_license | [
{
"docstring": "Creates a Kali host running a VNC server and NoVNC web server :param resolution: (Optional) String in the format WidthxHeightxColorDepth for the remote display. :type resolution: string :param vnc: Port to bind VNC to on the host. :type vnc: int :param web: Port to bind NoVNC web server to on th... | 4 | stack_v2_sparse_classes_30k_train_037810 | Implement the Python class `Kali` described below.
Class description:
Implement the Kali class.
Method signatures and docstrings:
- def __init__(self, name, resolution='1920x1080x24', vnc=VNC_DEFAULT, web=WEB_DEFAULT, **kwargs): Creates a Kali host running a VNC server and NoVNC web server :param resolution: (Optiona... | Implement the Python class `Kali` described below.
Class description:
Implement the Kali class.
Method signatures and docstrings:
- def __init__(self, name, resolution='1920x1080x24', vnc=VNC_DEFAULT, web=WEB_DEFAULT, **kwargs): Creates a Kali host running a VNC server and NoVNC web server :param resolution: (Optiona... | 62d360feae7713565c3387d6d71b55fed1637dda | <|skeleton|>
class Kali:
def __init__(self, name, resolution='1920x1080x24', vnc=VNC_DEFAULT, web=WEB_DEFAULT, **kwargs):
"""Creates a Kali host running a VNC server and NoVNC web server :param resolution: (Optional) String in the format WidthxHeightxColorDepth for the remote display. :type resolution: str... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Kali:
def __init__(self, name, resolution='1920x1080x24', vnc=VNC_DEFAULT, web=WEB_DEFAULT, **kwargs):
"""Creates a Kali host running a VNC server and NoVNC web server :param resolution: (Optional) String in the format WidthxHeightxColorDepth for the remote display. :type resolution: string :param vnc... | the_stack_v2_python_sparse | container/kali.py | rubiruchi/DVNI | train | 0 | |
8ca738bb5b067d1d509738538218da45d12aec80 | [
"self.schema_blocks = schema_blocks\nself.required_fields = required_fields\nself.json_schema = self._build_json_schema()",
"try:\n jsonschema.validate(registration_responses, self.json_schema)\nexcept jsonschema.ValidationError as e:\n properties = self.json_schema.get('properties', {})\n relative_path ... | <|body_start_0|>
self.schema_blocks = schema_blocks
self.required_fields = required_fields
self.json_schema = self._build_json_schema()
<|end_body_0|>
<|body_start_1|>
try:
jsonschema.validate(registration_responses, self.json_schema)
except jsonschema.ValidationErro... | RegistrationResponsesValidator | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-warranty-disclaimer",
"AGPL-3.0-only",
"LGPL-2.0-or-later",
"LicenseRef-scancode-proprietary-license",
"MPL-1.1",
"CPAL-1.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistrationResponsesValidator:
def __init__(self, schema_blocks, required_fields):
"""For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that requ... | stack_v2_sparse_classes_75kplus_train_070009 | 17,225 | permissive | [
{
"docstring": "For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that required fields are present",
"name": "__init__",
"signature": "def __init__(self, schema_b... | 5 | stack_v2_sparse_classes_30k_train_020220 | Implement the Python class `RegistrationResponsesValidator` described below.
Class description:
Implement the RegistrationResponsesValidator class.
Method signatures and docstrings:
- def __init__(self, schema_blocks, required_fields): For validating `registration_responses` on Registrations and DraftRegistrations :p... | Implement the Python class `RegistrationResponsesValidator` described below.
Class description:
Implement the RegistrationResponsesValidator class.
Method signatures and docstrings:
- def __init__(self, schema_blocks, required_fields): For validating `registration_responses` on Registrations and DraftRegistrations :p... | a3e0a0b9ddda5dd75fc8248d58f3bcdeece0323e | <|skeleton|>
class RegistrationResponsesValidator:
def __init__(self, schema_blocks, required_fields):
"""For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that requ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegistrationResponsesValidator:
def __init__(self, schema_blocks, required_fields):
"""For validating `registration_responses` on Registrations and DraftRegistrations :params schema_blocks iterable of SchemaBlock instances :params required_fields boolean - do we want to enforce that required fields ar... | the_stack_v2_python_sparse | osf/models/validators.py | CenterForOpenScience/osf.io | train | 683 | |
76b32fa7c5391276630065e732f3ea6cd35f34c3 | [
"end = self.end\nu = Mi32SlidingWindow()\nu.ADDR_WIDTH = end.ADDR_WIDTH\nu.DATA_WIDTH = end.DATA_WIDTH\nu.WINDOW_SIZE = window_size\nu.M_ADDR_WIDTH = new_addr_width\nsetattr(self.parent, self._findSuitableName('mi32SlidingWindow'), u)\nself._propagateClkRstn(u)\nu.s(self.end)\nself.lastComp = u\nself.end = u.m\nret... | <|body_start_0|>
end = self.end
u = Mi32SlidingWindow()
u.ADDR_WIDTH = end.ADDR_WIDTH
u.DATA_WIDTH = end.DATA_WIDTH
u.WINDOW_SIZE = window_size
u.M_ADDR_WIDTH = new_addr_width
setattr(self.parent, self._findSuitableName('mi32SlidingWindow'), u)
self._propa... | Mi32Builder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mi32Builder:
def sliding_window(self, window_size: int, new_addr_width: int):
"""Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space"""
<|body_0|>
def from_axi(cls, parent, axi, name=None):
"""convertor A... | stack_v2_sparse_classes_75kplus_train_070010 | 2,536 | permissive | [
{
"docstring": "Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space",
"name": "sliding_window",
"signature": "def sliding_window(self, window_size: int, new_addr_width: int)"
},
{
"docstring": "convertor AXI/AxiLite -> Mi32",
"na... | 3 | stack_v2_sparse_classes_30k_train_054687 | Implement the Python class `Mi32Builder` described below.
Class description:
Implement the Mi32Builder class.
Method signatures and docstrings:
- def sliding_window(self, window_size: int, new_addr_width: int): Instanciate a sliding window with an offset register which allows to virtually extend the addressable memor... | Implement the Python class `Mi32Builder` described below.
Class description:
Implement the Mi32Builder class.
Method signatures and docstrings:
- def sliding_window(self, window_size: int, new_addr_width: int): Instanciate a sliding window with an offset register which allows to virtually extend the addressable memor... | 4c1d54c7b15929032ad2ba984bf48b45f3549c49 | <|skeleton|>
class Mi32Builder:
def sliding_window(self, window_size: int, new_addr_width: int):
"""Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space"""
<|body_0|>
def from_axi(cls, parent, axi, name=None):
"""convertor A... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Mi32Builder:
def sliding_window(self, window_size: int, new_addr_width: int):
"""Instanciate a sliding window with an offset register which allows to virtually extend the addressable memory space"""
end = self.end
u = Mi32SlidingWindow()
u.ADDR_WIDTH = end.ADDR_WIDTH
u.... | the_stack_v2_python_sparse | hwtLib/cesnet/mi32/builder.py | Nic30/hwtLib | train | 36 | |
e1d1e6b795c8505aa2a77c98326146a83a312cb6 | [
"assert isinstance(ends, (numpy.ndarray, list)), 'ends is neither a numpy array nor a list'\nassert len(ends) == 2, 'the size of end nodes array should be two'\nassert isinstance(n, (int, numpy.int_)), 'the number of nodes, n, is not an integer'\nassert n >= 2, 'the number of nodes, n, should be >= 2'\nself.ends = ... | <|body_start_0|>
assert isinstance(ends, (numpy.ndarray, list)), 'ends is neither a numpy array nor a list'
assert len(ends) == 2, 'the size of end nodes array should be two'
assert isinstance(n, (int, numpy.int_)), 'the number of nodes, n, is not an integer'
assert n >= 2, 'the number o... | General class for pure Legendre expansion That is, phi_p(x) = L_p(x) where L_p represents p-th order Legendre polynomial. This expansion is only for test purpose. | PureLegendreElem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PureLegendreElem:
"""General class for pure Legendre expansion That is, phi_p(x) = L_p(x) where L_p represents p-th order Legendre polynomial. This expansion is only for test purpose."""
def __init__(self, ends, n, tol=1e-12):
"""__init__ Args: ends: array of the two end nodes (their... | stack_v2_sparse_classes_75kplus_train_070011 | 2,062 | permissive | [
{
"docstring": "__init__ Args: ends: array of the two end nodes (their locations) n: number of modes in this element tol: tolerance for entities in mass matrix to be treat as zeros",
"name": "__init__",
"signature": "def __init__(self, ends, n, tol=1e-12)"
},
{
"docstring": "set up expansion pol... | 3 | stack_v2_sparse_classes_30k_train_047223 | Implement the Python class `PureLegendreElem` described below.
Class description:
General class for pure Legendre expansion That is, phi_p(x) = L_p(x) where L_p represents p-th order Legendre polynomial. This expansion is only for test purpose.
Method signatures and docstrings:
- def __init__(self, ends, n, tol=1e-12... | Implement the Python class `PureLegendreElem` described below.
Class description:
General class for pure Legendre expansion That is, phi_p(x) = L_p(x) where L_p represents p-th order Legendre polynomial. This expansion is only for test purpose.
Method signatures and docstrings:
- def __init__(self, ends, n, tol=1e-12... | d25e6c1bc609022189952d97488828113cfb2206 | <|skeleton|>
class PureLegendreElem:
"""General class for pure Legendre expansion That is, phi_p(x) = L_p(x) where L_p represents p-th order Legendre polynomial. This expansion is only for test purpose."""
def __init__(self, ends, n, tol=1e-12):
"""__init__ Args: ends: array of the two end nodes (their... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PureLegendreElem:
"""General class for pure Legendre expansion That is, phi_p(x) = L_p(x) where L_p represents p-th order Legendre polynomial. This expansion is only for test purpose."""
def __init__(self, ends, n, tol=1e-12):
"""__init__ Args: ends: array of the two end nodes (their locations) n... | the_stack_v2_python_sparse | utils/elems/one_d/PureLegendreElem.py | zhucer2003/SEM-Toolbox | train | 0 |
1b5bd54cd8f23cb3e78574ce88c8f4449197c9c5 | [
"self.materials = materials\nself.boltztrap = boltztrap\nself.bandstructure_fs = bandstructure_fs\nself.bta_fs = bta_fs\nself.query = query if query else {}\nsuper().__init__(sources=[materials], targets=[boltztrap], **kwargs)",
"self.logger.info('BoltzTrap Builder Started')\nq = dict(self.query)\nq.update(self.m... | <|body_start_0|>
self.materials = materials
self.boltztrap = boltztrap
self.bandstructure_fs = bandstructure_fs
self.bta_fs = bta_fs
self.query = query if query else {}
super().__init__(sources=[materials], targets=[boltztrap], **kwargs)
<|end_body_0|>
<|body_start_1|>
... | BoltztrapBuilder | [
"LicenseRef-scancode-hdf5",
"LicenseRef-scancode-generic-cla",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BoltztrapBuilder:
def __init__(self, materials, boltztrap, bandstructure_fs='bandstructure_fs', bta_fs=None, query=None, **kwargs):
"""Calculates conducitivty parameters using BoltzTrap Saves the boltztrap analyzer in bta_fs if set otherwise doesn't store it because it is too large usual... | stack_v2_sparse_classes_75kplus_train_070012 | 11,028 | permissive | [
{
"docstring": "Calculates conducitivty parameters using BoltzTrap Saves the boltztrap analyzer in bta_fs if set otherwise doesn't store it because it is too large usually to store in Mongo Args: materials (Store): Store of materials documents boltztrap (Store): Store of boltztrap bandstructure_fs (str): Name o... | 4 | stack_v2_sparse_classes_30k_train_050409 | Implement the Python class `BoltztrapBuilder` described below.
Class description:
Implement the BoltztrapBuilder class.
Method signatures and docstrings:
- def __init__(self, materials, boltztrap, bandstructure_fs='bandstructure_fs', bta_fs=None, query=None, **kwargs): Calculates conducitivty parameters using BoltzTr... | Implement the Python class `BoltztrapBuilder` described below.
Class description:
Implement the BoltztrapBuilder class.
Method signatures and docstrings:
- def __init__(self, materials, boltztrap, bandstructure_fs='bandstructure_fs', bta_fs=None, query=None, **kwargs): Calculates conducitivty parameters using BoltzTr... | 2540fd8f6905be7290ead1b8a9dadca84d5d03fa | <|skeleton|>
class BoltztrapBuilder:
def __init__(self, materials, boltztrap, bandstructure_fs='bandstructure_fs', bta_fs=None, query=None, **kwargs):
"""Calculates conducitivty parameters using BoltzTrap Saves the boltztrap analyzer in bta_fs if set otherwise doesn't store it because it is too large usual... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BoltztrapBuilder:
def __init__(self, materials, boltztrap, bandstructure_fs='bandstructure_fs', bta_fs=None, query=None, **kwargs):
"""Calculates conducitivty parameters using BoltzTrap Saves the boltztrap analyzer in bta_fs if set otherwise doesn't store it because it is too large usually to store in... | the_stack_v2_python_sparse | emmet/materials/boltztrap.py | jerrymlin/emmet | train | 2 | |
e263ef087a1d50b8beb390c144da1d2ee996e35e | [
"args = parse_base.parse_args()\nname = args.get('name')\nurl = args.get('url')\nmenu_id = args.get('menu_id')\nmethod = args.get('method')\n_data = Rule.query.filter_by(url=url, method=method, is_del='0').first()\nif _data:\n abort(RET.Forbidden, msg='权限规则已存在')\nmodel_data = Rule()\nmodel_data.name = name\nmode... | <|body_start_0|>
args = parse_base.parse_args()
name = args.get('name')
url = args.get('url')
menu_id = args.get('menu_id')
method = args.get('method')
_data = Rule.query.filter_by(url=url, method=method, is_del='0').first()
if _data:
abort(RET.Forbidd... | RuleResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RuleResource:
def post(self):
"""添加"""
<|body_0|>
def put(self):
"""修改"""
<|body_1|>
def get(self):
"""获取数据,如果有ID就是单个数据,没有就是全部数据"""
<|body_2|>
def delete(self):
"""删除"""
<|body_3|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_070013 | 5,478 | permissive | [
{
"docstring": "添加",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "修改",
"name": "put",
"signature": "def put(self)"
},
{
"docstring": "获取数据,如果有ID就是单个数据,没有就是全部数据",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "删除",
"name": "d... | 4 | stack_v2_sparse_classes_30k_train_024671 | Implement the Python class `RuleResource` described below.
Class description:
Implement the RuleResource class.
Method signatures and docstrings:
- def post(self): 添加
- def put(self): 修改
- def get(self): 获取数据,如果有ID就是单个数据,没有就是全部数据
- def delete(self): 删除 | Implement the Python class `RuleResource` described below.
Class description:
Implement the RuleResource class.
Method signatures and docstrings:
- def post(self): 添加
- def put(self): 修改
- def get(self): 获取数据,如果有ID就是单个数据,没有就是全部数据
- def delete(self): 删除
<|skeleton|>
class RuleResource:
def post(self):
""... | 35ddd2946bf4c97806bb38057a7dc9d6fa97c118 | <|skeleton|>
class RuleResource:
def post(self):
"""添加"""
<|body_0|>
def put(self):
"""修改"""
<|body_1|>
def get(self):
"""获取数据,如果有ID就是单个数据,没有就是全部数据"""
<|body_2|>
def delete(self):
"""删除"""
<|body_3|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RuleResource:
def post(self):
"""添加"""
args = parse_base.parse_args()
name = args.get('name')
url = args.get('url')
menu_id = args.get('menu_id')
method = args.get('method')
_data = Rule.query.filter_by(url=url, method=method, is_del='0').first()
... | the_stack_v2_python_sparse | service/app/apis/admin/rule.py | xuannanxan/maitul-manage | train | 0 | |
9fcf56722eb12d308e917e9dc1fd65371bb3ecfd | [
"self.account_id = account_id\nself.conference_id = conference_id\nself.name = name\nself.recording_id = recording_id\nself.duration = duration\nself.channels = channels\nself.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None\nself.end_time = APIHelper.RFC3339DateTime(end_time) if end_time ... | <|body_start_0|>
self.account_id = account_id
self.conference_id = conference_id
self.name = name
self.recording_id = recording_id
self.duration = duration
self.channels = channels
self.start_time = APIHelper.RFC3339DateTime(start_time) if start_time else None
... | Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id (string): TODO: type description here. duration (strin... | ConferenceRecordingMetadata | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConferenceRecordingMetadata:
"""Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id... | stack_v2_sparse_classes_75kplus_train_070014 | 4,419 | permissive | [
{
"docstring": "Constructor for the ConferenceRecordingMetadata class",
"name": "__init__",
"signature": "def __init__(self, account_id=None, conference_id=None, name=None, recording_id=None, duration=None, channels=None, start_time=None, end_time=None, file_format=None, status=None, media_url=None)"
... | 2 | stack_v2_sparse_classes_30k_train_018228 | Implement the Python class `ConferenceRecordingMetadata` described below.
Class description:
Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TO... | Implement the Python class `ConferenceRecordingMetadata` described below.
Class description:
Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TO... | 447df3cc8cb7acaf3361d842630c432a9c31ce6e | <|skeleton|>
class ConferenceRecordingMetadata:
"""Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConferenceRecordingMetadata:
"""Implementation of the 'ConferenceRecordingMetadata' model. TODO: type model description here. Attributes: account_id (string): TODO: type description here. conference_id (string): TODO: type description here. name (string): TODO: type description here. recording_id (string): TO... | the_stack_v2_python_sparse | bandwidth/voice/models/conference_recording_metadata.py | Bandwidth/python-sdk | train | 10 |
61a030acb2b103ecfb9397edcf5d5a11ea44b9af | [
"if not self.base_directory.exists():\n raise TestConnectionError(f'base_directory path: {self.base_directory.resolve()} does not exist.')\nif self.assets and test_assets:\n for asset in self.assets:\n asset.test_connection()",
"if kwargs:\n raise TypeError(f'_build_data_connector() got unexpected... | <|body_start_0|>
if not self.base_directory.exists():
raise TestConnectionError(f'base_directory path: {self.base_directory.resolve()} does not exist.')
if self.assets and test_assets:
for asset in self.assets:
asset.test_connection()
<|end_body_0|>
<|body_start_... | SparkFilesystemDatasource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparkFilesystemDatasource:
def test_connection(self, test_assets: bool=True) -> None:
"""Test the connection for the SparkDatasource. Args: test_assets: If assets have been passed to the SparkDatasource, whether to test them as well. Raises: TestConnectionError: If the connection test fa... | stack_v2_sparse_classes_75kplus_train_070015 | 3,300 | permissive | [
{
"docstring": "Test the connection for the SparkDatasource. Args: test_assets: If assets have been passed to the SparkDatasource, whether to test them as well. Raises: TestConnectionError: If the connection test fails.",
"name": "test_connection",
"signature": "def test_connection(self, test_assets: bo... | 2 | null | Implement the Python class `SparkFilesystemDatasource` described below.
Class description:
Implement the SparkFilesystemDatasource class.
Method signatures and docstrings:
- def test_connection(self, test_assets: bool=True) -> None: Test the connection for the SparkDatasource. Args: test_assets: If assets have been p... | Implement the Python class `SparkFilesystemDatasource` described below.
Class description:
Implement the SparkFilesystemDatasource class.
Method signatures and docstrings:
- def test_connection(self, test_assets: bool=True) -> None: Test the connection for the SparkDatasource. Args: test_assets: If assets have been p... | b0290e2fd2aa05aec6d7d8871b91cb4478e9501d | <|skeleton|>
class SparkFilesystemDatasource:
def test_connection(self, test_assets: bool=True) -> None:
"""Test the connection for the SparkDatasource. Args: test_assets: If assets have been passed to the SparkDatasource, whether to test them as well. Raises: TestConnectionError: If the connection test fa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SparkFilesystemDatasource:
def test_connection(self, test_assets: bool=True) -> None:
"""Test the connection for the SparkDatasource. Args: test_assets: If assets have been passed to the SparkDatasource, whether to test them as well. Raises: TestConnectionError: If the connection test fails."""
... | the_stack_v2_python_sparse | great_expectations/datasource/fluent/spark_filesystem_datasource.py | great-expectations/great_expectations | train | 8,931 | |
9a122ff0becb83acc80741eee0198875bb0e4008 | [
"params = super().get_default_params(with_embedding=True)\nparams.add(Param(name='filters', value=128, desc='The filter size in the convolution layer.'))\nparams.add(Param(name='conv_activation_func', value='relu', desc='The activation function in the convolution layer.'))\nparams.add(Param(name='max_ngram', value=... | <|body_start_0|>
params = super().get_default_params(with_embedding=True)
params.add(Param(name='filters', value=128, desc='The filter size in the convolution layer.'))
params.add(Param(name='conv_activation_func', value='relu', desc='The activation function in the convolution layer.'))
... | ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['exact_sigma'] = 0.001 >>>... | ConvKNRM | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvKNRM:
"""ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> mod... | stack_v2_sparse_classes_75kplus_train_070016 | 4,913 | permissive | [
{
"docstring": ":return: model default parameters.",
"name": "get_default_params",
"signature": "def get_default_params(cls) -> ParamTable"
},
{
"docstring": "Build model structure.",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "Forward.",
"name": "forwa... | 3 | stack_v2_sparse_classes_30k_train_022729 | Implement the Python class `ConvKNRM` described below.
Class description:
ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 ... | Implement the Python class `ConvKNRM` described below.
Class description:
ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 ... | 4198ebce942f4afe7ddca6a96ab6f4464ade4518 | <|skeleton|>
class ConvKNRM:
"""ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> mod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConvKNRM:
"""ConvKNRM Model. Examples: >>> model = ConvKNRM() >>> model.params['filters'] = 128 >>> model.params['conv_activation_func'] = 'tanh' >>> model.params['max_ngram'] = 3 >>> model.params['use_crossmatch'] = True >>> model.params['kernel_num'] = 11 >>> model.params['sigma'] = 0.1 >>> model.params['ex... | the_stack_v2_python_sparse | poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/conv_knrm.py | microsoft/ContextualSP | train | 332 |
7309c1a5226dcdfd7341a0e2d2b6bc5161404fc0 | [
"enterprise_client = EnterpriseApiClient(auth_token)\nenterprise_data = enterprise_client.get_with_access_to(user, enterprise_id)\nif not enterprise_data:\n return None\nreturn enterprise_data",
"enterprise_in_url = request.parser_context.get('kwargs', {}).get('enterprise_id', '')\nif 'enterprises_with_access'... | <|body_start_0|>
enterprise_client = EnterpriseApiClient(auth_token)
enterprise_data = enterprise_client.get_with_access_to(user, enterprise_id)
if not enterprise_data:
return None
return enterprise_data
<|end_body_0|>
<|body_start_1|>
enterprise_in_url = request.par... | Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise. | HasDataAPIDjangoGroupAccess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HasDataAPIDjangoGroupAccess:
"""Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise."""
def get_enterprise_with_access_to(self, auth_token, user, enterprise_id):
"""Get... | stack_v2_sparse_classes_75kplus_train_070017 | 4,847 | no_license | [
{
"docstring": "Get the enterprise customer data that the user has enterprise_data_api access to. Returns: enterprise or None if unable to get or user is not associated with an enterprise",
"name": "get_enterprise_with_access_to",
"signature": "def get_enterprise_with_access_to(self, auth_token, user, e... | 2 | stack_v2_sparse_classes_30k_train_027684 | Implement the Python class `HasDataAPIDjangoGroupAccess` described below.
Class description:
Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise.
Method signatures and docstrings:
- def get_enterprise_w... | Implement the Python class `HasDataAPIDjangoGroupAccess` described below.
Class description:
Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise.
Method signatures and docstrings:
- def get_enterprise_w... | d16a25b035b2e810b8ab2b0a2ac032b216562e26 | <|skeleton|>
class HasDataAPIDjangoGroupAccess:
"""Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise."""
def get_enterprise_with_access_to(self, auth_token, user, enterprise_id):
"""Get... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HasDataAPIDjangoGroupAccess:
"""Permission that checks to see if the request user is part of the enterprise_data_api django group. Also checks that the user is authorized for the request's enterprise."""
def get_enterprise_with_access_to(self, auth_token, user, enterprise_id):
"""Get the enterpri... | the_stack_v2_python_sparse | edx/app/analytics_api/venvs/analytics_api/lib/python2.7/site-packages/enterprise_data/permissions.py | JosiahKennedy/openedx-branded | train | 0 |
c5531fb392267ddeeff02183b2cc622e0ffd8e01 | [
"super(SysFSFanControl, self).__init__(dut)\nself._fans = []\nif fans_info is not None:\n for fan_info in fans_info:\n complete_info = fan_info.copy()\n assert 'fan_id' in complete_info, \"'fan_id' is missing in fans_info\"\n assert 'path' in complete_info, \"'path' is missing in fans_info\"... | <|body_start_0|>
super(SysFSFanControl, self).__init__(dut)
self._fans = []
if fans_info is not None:
for fan_info in fans_info:
complete_info = fan_info.copy()
assert 'fan_id' in complete_info, "'fan_id' is missing in fans_info"
assert... | System module for fan control using sysfs. Implementation for systems which able to control thermal with sysfs API. | SysFSFanControl | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SysFSFanControl:
"""System module for fan control using sysfs. Implementation for systems which able to control thermal with sysfs API."""
def __init__(self, dut, fans_info=None):
"""Constructor. Args: fans_info: A sequence of dicts. Each dict contains information of a fan: - "fan_id... | stack_v2_sparse_classes_75kplus_train_070018 | 5,738 | permissive | [
{
"docstring": "Constructor. Args: fans_info: A sequence of dicts. Each dict contains information of a fan: - \"fan_id\": The id used in SetFanRPM/GetFanRPM. - \"path\": The path containing files for fan operations. - \"control_mode_filename\": The file to switch auto/manual fan control mode. default is \"pwm1_... | 3 | stack_v2_sparse_classes_30k_val_002277 | Implement the Python class `SysFSFanControl` described below.
Class description:
System module for fan control using sysfs. Implementation for systems which able to control thermal with sysfs API.
Method signatures and docstrings:
- def __init__(self, dut, fans_info=None): Constructor. Args: fans_info: A sequence of ... | Implement the Python class `SysFSFanControl` described below.
Class description:
System module for fan control using sysfs. Implementation for systems which able to control thermal with sysfs API.
Method signatures and docstrings:
- def __init__(self, dut, fans_info=None): Constructor. Args: fans_info: A sequence of ... | a1b0fccd68987d8cd9c89710adc3c04b868347ec | <|skeleton|>
class SysFSFanControl:
"""System module for fan control using sysfs. Implementation for systems which able to control thermal with sysfs API."""
def __init__(self, dut, fans_info=None):
"""Constructor. Args: fans_info: A sequence of dicts. Each dict contains information of a fan: - "fan_id... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SysFSFanControl:
"""System module for fan control using sysfs. Implementation for systems which able to control thermal with sysfs API."""
def __init__(self, dut, fans_info=None):
"""Constructor. Args: fans_info: A sequence of dicts. Each dict contains information of a fan: - "fan_id": The id use... | the_stack_v2_python_sparse | py/device/fan.py | bridder/factory | train | 0 |
b46c3a2472f3607032461201875163ad77526868 | [
"super().__init__(cost_multiplier=cost_multiplier)\nself.state_count = target_states.shape[0]\nself.step_count = step_count\nself.target_states_dagger = conjugate_transpose(anp.stack(target_states))",
"fidelity = anp.sum(anp.square(anp.abs(anp.matmul(self.target_states_dagger, states)[:, 0, 0])), axis=0)\nfidelit... | <|body_start_0|>
super().__init__(cost_multiplier=cost_multiplier)
self.state_count = target_states.shape[0]
self.step_count = step_count
self.target_states_dagger = conjugate_transpose(anp.stack(target_states))
<|end_body_0|>
<|body_start_1|>
fidelity = anp.sum(anp.square(anp.a... | a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the gradient of the cost function with respect to the para... | TargetStateInfidelityTime | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TargetStateInfidelityTime:
"""a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the g... | stack_v2_sparse_classes_75kplus_train_070019 | 3,824 | permissive | [
{
"docstring": "See class definition for parameter specification. target_states :: numpy.ndarray - an array of states that correspond to the target state for each of the initial states used in optimization",
"name": "__init__",
"signature": "def __init__(self, step_count, target_states, cost_multiplier=... | 2 | stack_v2_sparse_classes_30k_train_050012 | Implement the Python class `TargetStateInfidelityTime` described below.
Class description:
a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) ->... | Implement the Python class `TargetStateInfidelityTime` described below.
Class description:
a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) ->... | 64c1eed34c9a4200a01a7152932482a29a1fd89e | <|skeleton|>
class TargetStateInfidelityTime:
"""a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the g... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TargetStateInfidelityTime:
"""a class to encapsulate the target state infidelity cost function for all time Fields: cost_multiplier :: float - the wieght factor for this cost dcost_dparams :: (params :: numpy.ndarray, states :: numpy.ndarray, step :: int) -> dcost_dparams :: numpy.ndarray - the gradient of th... | the_stack_v2_python_sparse | qoc/standard/costs/targetstateinfidelitytime.py | jmbaker94/qoc | train | 0 |
6ced3c0472633753126be4992303a1f4c315f026 | [
"assert isinstance(target_config, NormalTrainingConfig)\nassert isinstance(attack_config, AttackConfig)\ntarget_config.validate()\nattack_config.validate()\nself.target_config = target_config\n' (NormalTrainingConfig) Config. '\nself.attack_config = attack_config\n' (AttackConfig) Config. '\nself.log_dir = None\n' ... | <|body_start_0|>
assert isinstance(target_config, NormalTrainingConfig)
assert isinstance(attack_config, AttackConfig)
target_config.validate()
attack_config.validate()
self.target_config = target_config
' (NormalTrainingConfig) Config. '
self.attack_config = atta... | Regular attack interface. | AttackInterface | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttackInterface:
"""Regular attack interface."""
def __init__(self, target_config, attack_config):
"""Initialize. :param target_config: configuration :type target_config: [str] :param attack_config: configuration :type attack_config: [str]"""
<|body_0|>
def main(self):
... | stack_v2_sparse_classes_75kplus_train_070020 | 16,771 | no_license | [
{
"docstring": "Initialize. :param target_config: configuration :type target_config: [str] :param attack_config: configuration :type attack_config: [str]",
"name": "__init__",
"signature": "def __init__(self, target_config, attack_config)"
},
{
"docstring": "Main.",
"name": "main",
"sign... | 2 | stack_v2_sparse_classes_30k_train_053219 | Implement the Python class `AttackInterface` described below.
Class description:
Regular attack interface.
Method signatures and docstrings:
- def __init__(self, target_config, attack_config): Initialize. :param target_config: configuration :type target_config: [str] :param attack_config: configuration :type attack_c... | Implement the Python class `AttackInterface` described below.
Class description:
Regular attack interface.
Method signatures and docstrings:
- def __init__(self, target_config, attack_config): Initialize. :param target_config: configuration :type target_config: [str] :param attack_config: configuration :type attack_c... | 736c99b55a77d0c650eae5ced2d8312d13af0baf | <|skeleton|>
class AttackInterface:
"""Regular attack interface."""
def __init__(self, target_config, attack_config):
"""Initialize. :param target_config: configuration :type target_config: [str] :param attack_config: configuration :type attack_config: [str]"""
<|body_0|>
def main(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttackInterface:
"""Regular attack interface."""
def __init__(self, target_config, attack_config):
"""Initialize. :param target_config: configuration :type target_config: [str] :param attack_config: configuration :type attack_config: [str]"""
assert isinstance(target_config, NormalTrainin... | the_stack_v2_python_sparse | common/experiments.py | Adversarial-Intelligence-Group/color-adversarial-training | train | 0 |
e1a245c4498ccbece7c1f1b9c88f5099507f205e | [
"step = len(nums) // 2\ni = len(nums) // 2\nwhile step > 0:\n if i >= len(nums):\n i = len(nums) - 1\n if i == len(nums) - 1:\n if nums[i] <= pivot:\n return len(nums)\n else:\n return i\n if i == 0:\n if nums[i] > pivot:\n return 0\n if nums[... | <|body_start_0|>
step = len(nums) // 2
i = len(nums) // 2
while step > 0:
if i >= len(nums):
i = len(nums) - 1
if i == len(nums) - 1:
if nums[i] <= pivot:
return len(nums)
else:
return... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def find_next_biggest_in_sorted_list(self, nums, pivot: int) -> int:
"""return: first index in nums bigger then pivot, or len(nums) if all elements in nums are smaller or equal to pivot, Assumes len(nums) >= 1"""
<|body_0|>
def nextPermutation(self, nums) -> None:
... | stack_v2_sparse_classes_75kplus_train_070021 | 2,681 | no_license | [
{
"docstring": "return: first index in nums bigger then pivot, or len(nums) if all elements in nums are smaller or equal to pivot, Assumes len(nums) >= 1",
"name": "find_next_biggest_in_sorted_list",
"signature": "def find_next_biggest_in_sorted_list(self, nums, pivot: int) -> int"
},
{
"docstri... | 2 | stack_v2_sparse_classes_30k_train_050173 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find_next_biggest_in_sorted_list(self, nums, pivot: int) -> int: return: first index in nums bigger then pivot, or len(nums) if all elements in nums are smaller or equal to p... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def find_next_biggest_in_sorted_list(self, nums, pivot: int) -> int: return: first index in nums bigger then pivot, or len(nums) if all elements in nums are smaller or equal to p... | 068c020f29c1148495a86c875246b1d996874aff | <|skeleton|>
class Solution:
def find_next_biggest_in_sorted_list(self, nums, pivot: int) -> int:
"""return: first index in nums bigger then pivot, or len(nums) if all elements in nums are smaller or equal to pivot, Assumes len(nums) >= 1"""
<|body_0|>
def nextPermutation(self, nums) -> None:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def find_next_biggest_in_sorted_list(self, nums, pivot: int) -> int:
"""return: first index in nums bigger then pivot, or len(nums) if all elements in nums are smaller or equal to pivot, Assumes len(nums) >= 1"""
step = len(nums) // 2
i = len(nums) // 2
while step > 0... | the_stack_v2_python_sparse | 31_related_find_next_biggest_in_srted_list.py | ArniStarkware/leetcode | train | 0 | |
7166ecfdbeb363d923fc7f67bfe875ebf7bff458 | [
"self.numCorpus = numcorpus\nself.corpusLocation = corpuslocation\nself.classification = classification\nself.ratioFunny = 0.0\nself.ratioImpressive = 0.0\nself.ratioIntensity = 0.0\nself.ratioTerror = 0.0\nself.ratioTragic = 0.0",
"self.ratioFunny = round(float(numfunny) / GLOBAL_simioutputnum, 3)\nself.ratioImp... | <|body_start_0|>
self.numCorpus = numcorpus
self.corpusLocation = corpuslocation
self.classification = classification
self.ratioFunny = 0.0
self.ratioImpressive = 0.0
self.ratioIntensity = 0.0
self.ratioTerror = 0.0
self.ratioTragic = 0.0
<|end_body_0|>
<... | 用于描述corpus的分类(funny,impressive,...),相似列表中的分类百分比 数据源于 GLOBAL_simiresultsFolder *只在StatisticUtil中会用到,作统计分析* | Corpus | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Corpus:
"""用于描述corpus的分类(funny,impressive,...),相似列表中的分类百分比 数据源于 GLOBAL_simiresultsFolder *只在StatisticUtil中会用到,作统计分析*"""
def __init__(self, numcorpus, corpuslocation, classification):
"""初始化 corpus对象 :param numcorpus: corpus编号 :param corpuslocation: corpus位置 :param classification: cor... | stack_v2_sparse_classes_75kplus_train_070022 | 1,607 | no_license | [
{
"docstring": "初始化 corpus对象 :param numcorpus: corpus编号 :param corpuslocation: corpus位置 :param classification: corpus的归类 :return:",
"name": "__init__",
"signature": "def __init__(self, numcorpus, corpuslocation, classification)"
},
{
"docstring": "对四个ratio赋值,保留三位小数 :param numfunny: :param numimp... | 2 | stack_v2_sparse_classes_30k_train_041697 | Implement the Python class `Corpus` described below.
Class description:
用于描述corpus的分类(funny,impressive,...),相似列表中的分类百分比 数据源于 GLOBAL_simiresultsFolder *只在StatisticUtil中会用到,作统计分析*
Method signatures and docstrings:
- def __init__(self, numcorpus, corpuslocation, classification): 初始化 corpus对象 :param numcorpus: corpus编号 :... | Implement the Python class `Corpus` described below.
Class description:
用于描述corpus的分类(funny,impressive,...),相似列表中的分类百分比 数据源于 GLOBAL_simiresultsFolder *只在StatisticUtil中会用到,作统计分析*
Method signatures and docstrings:
- def __init__(self, numcorpus, corpuslocation, classification): 初始化 corpus对象 :param numcorpus: corpus编号 :... | adb9e34db832fef5bb0f629a6bd95f15a3e56f46 | <|skeleton|>
class Corpus:
"""用于描述corpus的分类(funny,impressive,...),相似列表中的分类百分比 数据源于 GLOBAL_simiresultsFolder *只在StatisticUtil中会用到,作统计分析*"""
def __init__(self, numcorpus, corpuslocation, classification):
"""初始化 corpus对象 :param numcorpus: corpus编号 :param corpuslocation: corpus位置 :param classification: cor... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Corpus:
"""用于描述corpus的分类(funny,impressive,...),相似列表中的分类百分比 数据源于 GLOBAL_simiresultsFolder *只在StatisticUtil中会用到,作统计分析*"""
def __init__(self, numcorpus, corpuslocation, classification):
"""初始化 corpus对象 :param numcorpus: corpus编号 :param corpuslocation: corpus位置 :param classification: corpus的归类 :retur... | the_stack_v2_python_sparse | Entity/Corpus.py | autterman/GensimLDATool-TSCemotion | train | 0 |
1db7c70561305e5cfdb03827c0d88d10e90df498 | [
"super().__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",
"seq_len = tf.... | <|body_start_0|>
super().__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(target_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, dm)
self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]
self.d... | class Decoder | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""class Decoder"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""init"""
<|body_0|>
def call(self, x, encoder_output, training, look_ahead_mask, padding_mask):
"""call method"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_070023 | 8,707 | no_license | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1)"
},
{
"docstring": "call method",
"name": "call",
"signature": "def call(self, x, encoder_output, training, look_ahead_mask, padding_mask)"
}
] | 2 | stack_v2_sparse_classes_30k_train_051677 | Implement the Python class `Decoder` described below.
Class description:
class Decoder
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): init
- def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): call method | Implement the Python class `Decoder` described below.
Class description:
class Decoder
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): init
- def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): call method
<|skeleton|>
class ... | e8a98d85b3bfd5665cb04bec9ee8c3eb23d6bd58 | <|skeleton|>
class Decoder:
"""class Decoder"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""init"""
<|body_0|>
def call(self, x, encoder_output, training, look_ahead_mask, padding_mask):
"""call method"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Decoder:
"""class Decoder"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""init"""
super().__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(target_vocab, dm)
self.positional_encoding = positi... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/5-transformer.py | AndrewMiranda/holbertonschool-machine_learning-1 | train | 0 |
b69b381a3671847a133a418d8b950dd064427f51 | [
"if stream is not None:\n self.stream = stream\nelse:\n self.stream = StringIO()",
"write = self.stream.write\ntptypes = getToolByName(target, 'portal_types', None)\nif tptypes is None:\n write('No portal_skins')\nelif not tptypes.getTypeInfo(type_name):\n tptypes.addType(type_name, fti[0])\n write... | <|body_start_0|>
if stream is not None:
self.stream = stream
else:
self.stream = StringIO()
<|end_body_0|>
<|body_start_1|>
write = self.stream.write
tptypes = getToolByName(target, 'portal_types', None)
if tptypes is None:
write('No portal_sk... | A suite of methods deploying CMF site | ManageCMFContent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManageCMFContent:
"""A suite of methods deploying CMF site"""
def __init__(self, stream=None):
"""Stream is expected to be some writable file object, like a StringIO, that output will be sent to"""
<|body_0|>
def deploy_class(self, target, type_name, fti):
"""Reg... | stack_v2_sparse_classes_75kplus_train_070024 | 3,370 | no_license | [
{
"docstring": "Stream is expected to be some writable file object, like a StringIO, that output will be sent to",
"name": "__init__",
"signature": "def __init__(self, stream=None)"
},
{
"docstring": "Register a new type",
"name": "deploy_class",
"signature": "def deploy_class(self, targ... | 4 | stack_v2_sparse_classes_30k_val_001821 | Implement the Python class `ManageCMFContent` described below.
Class description:
A suite of methods deploying CMF site
Method signatures and docstrings:
- def __init__(self, stream=None): Stream is expected to be some writable file object, like a StringIO, that output will be sent to
- def deploy_class(self, target,... | Implement the Python class `ManageCMFContent` described below.
Class description:
A suite of methods deploying CMF site
Method signatures and docstrings:
- def __init__(self, stream=None): Stream is expected to be some writable file object, like a StringIO, that output will be sent to
- def deploy_class(self, target,... | bdf3ad7c1ec4bcdec08000bf4ac5315ca6a0ad19 | <|skeleton|>
class ManageCMFContent:
"""A suite of methods deploying CMF site"""
def __init__(self, stream=None):
"""Stream is expected to be some writable file object, like a StringIO, that output will be sent to"""
<|body_0|>
def deploy_class(self, target, type_name, fti):
"""Reg... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ManageCMFContent:
"""A suite of methods deploying CMF site"""
def __init__(self, stream=None):
"""Stream is expected to be some writable file object, like a StringIO, that output will be sent to"""
if stream is not None:
self.stream = stream
else:
self.stre... | the_stack_v2_python_sparse | ExpressSuiteTools/ManageCMFContent.py | ichar/Express-Suite-DMS | train | 0 |
9b45b5e32a65a1c676355e87736fb3306db20f5e | [
"if isinstance(quality, Quantity):\n quality = quality.value\nresult = []\nfor flag in cls.STRINGS.keys():\n if quality & flag > 0:\n result.append(cls.STRINGS[flag])\nreturn result",
"if bitmask is None:\n return np.ones(len(quality_array), dtype=bool)\nif isinstance(quality_array, u.Quantity):\n... | <|body_start_0|>
if isinstance(quality, Quantity):
quality = quality.value
result = []
for flag in cls.STRINGS.keys():
if quality & flag > 0:
result.append(cls.STRINGS[flag])
return result
<|end_body_0|>
<|body_start_1|>
if bitmask is None... | Abstract class | QualityFlags | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QualityFlags:
"""Abstract class"""
def decode(cls, quality):
"""Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in Kepler/K2/TESS' pixel and light curve files and converts into a list of huma... | stack_v2_sparse_classes_75kplus_train_070025 | 26,156 | permissive | [
{
"docstring": "Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in Kepler/K2/TESS' pixel and light curve files and converts into a list of human-readable strings explaining the flags raised (if any). Parameters --------... | 2 | stack_v2_sparse_classes_30k_train_030833 | Implement the Python class `QualityFlags` described below.
Class description:
Abstract class
Method signatures and docstrings:
- def decode(cls, quality): Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in Kepler/K2/TESS' pix... | Implement the Python class `QualityFlags` described below.
Class description:
Abstract class
Method signatures and docstrings:
- def decode(cls, quality): Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in Kepler/K2/TESS' pix... | 7d485b69e9bbe58a1e7ba8d988387dc5d469ab36 | <|skeleton|>
class QualityFlags:
"""Abstract class"""
def decode(cls, quality):
"""Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in Kepler/K2/TESS' pixel and light curve files and converts into a list of huma... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QualityFlags:
"""Abstract class"""
def decode(cls, quality):
"""Converts a QUALITY value into a list of human-readable strings. This function takes the QUALITY bitstring that can be found for each cadence in Kepler/K2/TESS' pixel and light curve files and converts into a list of human-readable st... | the_stack_v2_python_sparse | src/lightkurve/utils.py | lightkurve/lightkurve | train | 148 |
a0f04b7b4bc7be9eba1accb20774218679784e70 | [
"self.manager_filename = manager_filename\nself.manager_directory = os.path.dirname(manager_filename)\nutils.make_directories([self.manager_directory])\ndb_connection = sqlite3.connect(manager_filename, detect_types=sqlite3.PARSE_DECLTYPES)\ndb_cursor = db_connection.cursor()\ndb_cursor.execute('CREATE TABLE IF NOT... | <|body_start_0|>
self.manager_filename = manager_filename
self.manager_directory = os.path.dirname(manager_filename)
utils.make_directories([self.manager_directory])
db_connection = sqlite3.connect(manager_filename, detect_types=sqlite3.PARSE_DECLTYPES)
db_cursor = db_connection.... | Persistent object to append and read numpy arrays to unique keys. This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to keep data in RAM as much as possible and saves data to files on disk to manage memory and ... | BufferedNumpyDiskMap | [
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BufferedNumpyDiskMap:
"""Persistent object to append and read numpy arrays to unique keys. This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to keep data in RAM as much as possible and s... | stack_v2_sparse_classes_75kplus_train_070026 | 7,164 | permissive | [
{
"docstring": "Create file manager object. Args: manager_filename (string): path to store file manager database. Additional files will be created in this directory to store binary data as needed. max_bytes_to_buffer (int): number of bytes to hold in memory at one time. Returns: None",
"name": "__init__",
... | 5 | stack_v2_sparse_classes_30k_train_004087 | Implement the Python class `BufferedNumpyDiskMap` described below.
Class description:
Persistent object to append and read numpy arrays to unique keys. This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to kee... | Implement the Python class `BufferedNumpyDiskMap` described below.
Class description:
Persistent object to append and read numpy arrays to unique keys. This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to kee... | 16fc64c06a24077ff4dbda0b1163d7fd3e24b1c2 | <|skeleton|>
class BufferedNumpyDiskMap:
"""Persistent object to append and read numpy arrays to unique keys. This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to keep data in RAM as much as possible and s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BufferedNumpyDiskMap:
"""Persistent object to append and read numpy arrays to unique keys. This object is abstractly a key/value pair map where the operations are to append, read, and delete numpy arrays associated with those keys. The object attempts to keep data in RAM as much as possible and saves data to ... | the_stack_v2_python_sparse | src/natcap/invest/recreation/buffered_numpy_disk_map.py | natcap/invest | train | 108 |
74ba213d4fab33b0a7cfabe35671d93818512ca4 | [
"self.mu_g = mu_g\nself.s_g = s_g\nself.s_s = s_s\nself.h = h\nself.alpha = alpha",
"assert len(f1.shape) == 1, 'input must be 1d ndarray'\nassert len(f2.shape) == 1, 'input must be 1d ndarray'\nassert f1.shape == f2.shape\nn_trial = len(f1)\nf1_ = np.tile(f1, (n_samp, 1)) + self.s_s * np.random.randn(n_samp, n_t... | <|body_start_0|>
self.mu_g = mu_g
self.s_g = s_g
self.s_s = s_s
self.h = h
self.alpha = alpha
<|end_body_0|>
<|body_start_1|>
assert len(f1.shape) == 1, 'input must be 1d ndarray'
assert len(f2.shape) == 1, 'input must be 1d ndarray'
assert f1.shape == f2... | Same as recency model except that gaussian prior mean is set somewhere between - average of previous tones - long term prior mean | LocalGlobalModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocalGlobalModel:
"""Same as recency model except that gaussian prior mean is set somewhere between - average of previous tones - long term prior mean"""
def __init__(self, mu_g, s_g, h, s_s, alpha=0.0):
"""Constructor :param mu_g: mean of gaussian part of unigauss :param s_g: std of... | stack_v2_sparse_classes_75kplus_train_070027 | 11,426 | no_license | [
{
"docstring": "Constructor :param mu_g: mean of gaussian part of unigauss :param s_g: std of gaussian part of unigauss :param h: weight of flat prior in unigauss mixture assuming unnormalized gaussian p(x) 1/Z*( h + exp((x-mu)/2/s^2) ) :param s_s: std of likelihood :param alpha: interpolation factor 1=local,0=... | 2 | stack_v2_sparse_classes_30k_train_036989 | Implement the Python class `LocalGlobalModel` described below.
Class description:
Same as recency model except that gaussian prior mean is set somewhere between - average of previous tones - long term prior mean
Method signatures and docstrings:
- def __init__(self, mu_g, s_g, h, s_s, alpha=0.0): Constructor :param m... | Implement the Python class `LocalGlobalModel` described below.
Class description:
Same as recency model except that gaussian prior mean is set somewhere between - average of previous tones - long term prior mean
Method signatures and docstrings:
- def __init__(self, mu_g, s_g, h, s_s, alpha=0.0): Constructor :param m... | 2a05aa98b501c8633e1fe2baf611d137740709de | <|skeleton|>
class LocalGlobalModel:
"""Same as recency model except that gaussian prior mean is set somewhere between - average of previous tones - long term prior mean"""
def __init__(self, mu_g, s_g, h, s_s, alpha=0.0):
"""Constructor :param mu_g: mean of gaussian part of unigauss :param s_g: std of... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LocalGlobalModel:
"""Same as recency model except that gaussian prior mean is set somewhere between - average of previous tones - long term prior mean"""
def __init__(self, mu_g, s_g, h, s_s, alpha=0.0):
"""Constructor :param mu_g: mean of gaussian part of unigauss :param s_g: std of gaussian par... | the_stack_v2_python_sparse | model/simple_model.py | ItayLieder/GMM_simulations | train | 0 |
9419298407bf2c2ee1aafb71a1378315f2810685 | [
"self.module = module\nself.exclude = exclude\nself.include = include",
"if self.exclude:\n self.actions = [a for a in self.actions if a.__name__ not in self.exclude]\nif self.include:\n self.actions = [a for a in self.actions if a.__name__ in self.include]\nif self.exclude:\n self.cleanup = [c for c in ... | <|body_start_0|>
self.module = module
self.exclude = exclude
self.include = include
<|end_body_0|>
<|body_start_1|>
if self.exclude:
self.actions = [a for a in self.actions if a.__name__ not in self.exclude]
if self.include:
self.actions = [a for a in sel... | Model | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
def __init__(self, module, exclude, include):
"""initializations common to all derived classes"""
<|body_0|>
def revise_actions(self):
"""Revise lists of actions and cleanups accounting for -e --exclude -a --add Alter the copies, results might differ from self... | stack_v2_sparse_classes_75kplus_train_070028 | 2,307 | permissive | [
{
"docstring": "initializations common to all derived classes",
"name": "__init__",
"signature": "def __init__(self, module, exclude, include)"
},
{
"docstring": "Revise lists of actions and cleanups accounting for -e --exclude -a --add Alter the copies, results might differ from self.module.act... | 3 | stack_v2_sparse_classes_30k_train_014378 | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def __init__(self, module, exclude, include): initializations common to all derived classes
- def revise_actions(self): Revise lists of actions and cleanups accounting for -e --exclude... | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- def __init__(self, module, exclude, include): initializations common to all derived classes
- def revise_actions(self): Revise lists of actions and cleanups accounting for -e --exclude... | 457ea284ea20703885f8e57fa5c1891051be9b03 | <|skeleton|>
class Model:
def __init__(self, module, exclude, include):
"""initializations common to all derived classes"""
<|body_0|>
def revise_actions(self):
"""Revise lists of actions and cleanups accounting for -e --exclude -a --add Alter the copies, results might differ from self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Model:
def __init__(self, module, exclude, include):
"""initializations common to all derived classes"""
self.module = module
self.exclude = exclude
self.include = include
def revise_actions(self):
"""Revise lists of actions and cleanups accounting for -e --exclude... | the_stack_v2_python_sparse | pymodel/model.py | jon-jacky/PyModel | train | 75 | |
9141a8064c5c84334e89c4e793aa60b310a9613c | [
"self.services = services_definition['services']\nself.builders = {}\nfor service in self.services:\n service_builder = service.get('service-builder')\n if not service_builder:\n continue\n if isinstance(service_builder, dict):\n for name, builder in service_builder.items():\n full... | <|body_start_0|>
self.services = services_definition['services']
self.builders = {}
for service in self.services:
service_builder = service.get('service-builder')
if not service_builder:
continue
if isinstance(service_builder, dict):
... | ServiceBuilder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceBuilder:
def __init__(self, services_definition=services_config):
"""@brief @brief Create a ServiceBuilder. @param services_definition Complete services definition, services.xml."""
<|body_0|>
def buildServiceURL(self, name, context):
"""@brief given the envir... | stack_v2_sparse_classes_75kplus_train_070029 | 4,026 | no_license | [
{
"docstring": "@brief @brief Create a ServiceBuilder. @param services_definition Complete services definition, services.xml.",
"name": "__init__",
"signature": "def __init__(self, services_definition=services_config)"
},
{
"docstring": "@brief given the environment on construction, return a ser... | 2 | stack_v2_sparse_classes_30k_train_047086 | Implement the Python class `ServiceBuilder` described below.
Class description:
Implement the ServiceBuilder class.
Method signatures and docstrings:
- def __init__(self, services_definition=services_config): @brief @brief Create a ServiceBuilder. @param services_definition Complete services definition, services.xml.... | Implement the Python class `ServiceBuilder` described below.
Class description:
Implement the ServiceBuilder class.
Method signatures and docstrings:
- def __init__(self, services_definition=services_config): @brief @brief Create a ServiceBuilder. @param services_definition Complete services definition, services.xml.... | 00645a93b672dd3ce5e02bd620a90b8e275aba01 | <|skeleton|>
class ServiceBuilder:
def __init__(self, services_definition=services_config):
"""@brief @brief Create a ServiceBuilder. @param services_definition Complete services definition, services.xml."""
<|body_0|>
def buildServiceURL(self, name, context):
"""@brief given the envir... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ServiceBuilder:
def __init__(self, services_definition=services_config):
"""@brief @brief Create a ServiceBuilder. @param services_definition Complete services definition, services.xml."""
self.services = services_definition['services']
self.builders = {}
for service in self.se... | the_stack_v2_python_sparse | indra/lib/python/indra/ipc/servicebuilder.py | OS-Development/VW.Meerkat | train | 1 | |
a9a2a6f06e0e5eded6370af5c23256b1992246d1 | [
"if isinstance(value, int):\n buffer = None\n if cls.validate_range(value):\n buffer = value.to_bytes(1, 'little')\n return buffer\n else:\n raise ValueError('value is not in valid cip range')\nelse:\n raise TypeError('value must be int')",
"if isinstance(buffer, bytes):\n valu... | <|body_start_0|>
if isinstance(value, int):
buffer = None
if cls.validate_range(value):
buffer = value.to_bytes(1, 'little')
return buffer
else:
raise ValueError('value is not in valid cip range')
else:
raise... | Class to implement USINT datatype of CIP especification. Methods ------- class encode class decode classmethod validate_range classmethod GetIDCode staticmethod Identify classmethod set_flag classmethod get_flag | BYTE | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BYTE:
"""Class to implement USINT datatype of CIP especification. Methods ------- class encode class decode classmethod validate_range classmethod GetIDCode staticmethod Identify classmethod set_flag classmethod get_flag"""
def encode(cls, value):
"""encode a value in a byte array Pa... | stack_v2_sparse_classes_75kplus_train_070030 | 4,557 | permissive | [
{
"docstring": "encode a value in a byte array Parameters ----------- value: int range from -2^63 to 2^63-1 Value to encode Return ------- Byte Array -- encoded value in a byte array to send trough a network",
"name": "encode",
"signature": "def encode(cls, value)"
},
{
"docstring": "decode a va... | 4 | stack_v2_sparse_classes_30k_train_000110 | Implement the Python class `BYTE` described below.
Class description:
Class to implement USINT datatype of CIP especification. Methods ------- class encode class decode classmethod validate_range classmethod GetIDCode staticmethod Identify classmethod set_flag classmethod get_flag
Method signatures and docstrings:
- ... | Implement the Python class `BYTE` described below.
Class description:
Class to implement USINT datatype of CIP especification. Methods ------- class encode class decode classmethod validate_range classmethod GetIDCode staticmethod Identify classmethod set_flag classmethod get_flag
Method signatures and docstrings:
- ... | 288a741e5cf1e9df366ed62437e0b99f6920ef90 | <|skeleton|>
class BYTE:
"""Class to implement USINT datatype of CIP especification. Methods ------- class encode class decode classmethod validate_range classmethod GetIDCode staticmethod Identify classmethod set_flag classmethod get_flag"""
def encode(cls, value):
"""encode a value in a byte array Pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BYTE:
"""Class to implement USINT datatype of CIP especification. Methods ------- class encode class decode classmethod validate_range classmethod GetIDCode staticmethod Identify classmethod set_flag classmethod get_flag"""
def encode(cls, value):
"""encode a value in a byte array Parameters ----... | the_stack_v2_python_sparse | data_type/byte.py | hsocarras/pycip | train | 0 |
a750e6b3e8f7c309a97abc5c4a24c98aad8dcd63 | [
"img = AccumulableImage(12, 8)\nself.assertEqual(img.width, 12)\nself.assertEqual(img.height, 8)\nfor pos in [(i, j) for i in range(12) for j in range(8)]:\n self.assertEqual(img[pos], Vec3())\n self.assertTrue(np.allclose(img.bytes_at(pos), np.array([0, 0, 0], dtype='uint8')))\n self.assertEqual(img.sampl... | <|body_start_0|>
img = AccumulableImage(12, 8)
self.assertEqual(img.width, 12)
self.assertEqual(img.height, 8)
for pos in [(i, j) for i in range(12) for j in range(8)]:
self.assertEqual(img[pos], Vec3())
self.assertTrue(np.allclose(img.bytes_at(pos), np.array([0, ... | Tests for AccumulableImage class. | AccumulableImageTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccumulableImageTests:
"""Tests for AccumulableImage class."""
def test_accimg_basic(self):
"""Tests for basic class functionalities."""
<|body_0|>
def test_accimg_addition(self):
"""Tests adding samples and whole images."""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_070031 | 4,079 | permissive | [
{
"docstring": "Tests for basic class functionalities.",
"name": "test_accimg_basic",
"signature": "def test_accimg_basic(self)"
},
{
"docstring": "Tests adding samples and whole images.",
"name": "test_accimg_addition",
"signature": "def test_accimg_addition(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006963 | Implement the Python class `AccumulableImageTests` described below.
Class description:
Tests for AccumulableImage class.
Method signatures and docstrings:
- def test_accimg_basic(self): Tests for basic class functionalities.
- def test_accimg_addition(self): Tests adding samples and whole images. | Implement the Python class `AccumulableImageTests` described below.
Class description:
Tests for AccumulableImage class.
Method signatures and docstrings:
- def test_accimg_basic(self): Tests for basic class functionalities.
- def test_accimg_addition(self): Tests adding samples and whole images.
<|skeleton|>
class ... | 609dbe6b80580212bd9d8e93afb6902091040d7a | <|skeleton|>
class AccumulableImageTests:
"""Tests for AccumulableImage class."""
def test_accimg_basic(self):
"""Tests for basic class functionalities."""
<|body_0|>
def test_accimg_addition(self):
"""Tests adding samples and whole images."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccumulableImageTests:
"""Tests for AccumulableImage class."""
def test_accimg_basic(self):
"""Tests for basic class functionalities."""
img = AccumulableImage(12, 8)
self.assertEqual(img.width, 12)
self.assertEqual(img.height, 8)
for pos in [(i, j) for i in range(... | the_stack_v2_python_sparse | ptrace/oop/util_tests.py | xann16/py-path-tracing | train | 0 |
8349c92543090b969e112f860861f1d6b93f458e | [
"if cds_start:\n start += cds_start\n if end is not None:\n end += cds_start\nif start and (not end):\n ref_sequence = self.seqrepo_access.get_sequence(ac, start)\nelif start is not None and end is not None:\n ref_sequence = self.seqrepo_access.get_sequence(ac, start, end)\nelse:\n ref_sequenc... | <|body_start_0|>
if cds_start:
start += cds_start
if end is not None:
end += cds_start
if start and (not end):
ref_sequence = self.seqrepo_access.get_sequence(ac, start)
elif start is not None and end is not None:
ref_sequence = sel... | The Deletion Validator Base class. | DeletionBase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeletionBase:
"""The Deletion Validator Base class."""
def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]:
"""Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list erro... | stack_v2_sparse_classes_75kplus_train_070032 | 2,684 | permissive | [
{
"docstring": "Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list errors: List of errors :param int cds_start: Coding start site :return: Reference sequence of nucleotides",
"name": "get_reference_sequence",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_048394 | Implement the Python class `DeletionBase` described below.
Class description:
The Deletion Validator Base class.
Method signatures and docstrings:
- def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: Get deleted reference sequence. :param str ac: Accession :param int start: Sta... | Implement the Python class `DeletionBase` described below.
Class description:
The Deletion Validator Base class.
Method signatures and docstrings:
- def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]: Get deleted reference sequence. :param str ac: Accession :param int start: Sta... | d41e9ee786b14f47d17ea8e458eed08ec00ba339 | <|skeleton|>
class DeletionBase:
"""The Deletion Validator Base class."""
def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]:
"""Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list erro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeletionBase:
"""The Deletion Validator Base class."""
def get_reference_sequence(self, ac, start, end, errors, cds_start=None) -> Optional[str]:
"""Get deleted reference sequence. :param str ac: Accession :param int start: Start position :param int end: End position :param list errors: List of e... | the_stack_v2_python_sparse | variation/validators/deletion_base.py | richardhj/vicc-variation-normalization | train | 0 |
1ee8408840a9a39bfa23b860a8b996735a87722c | [
"argv = ['foo', 'bar']\noptions, salt = parse_args(argv)\nresult = generate_password(salt, options)\nself.assertEqual('VNy+Z9IdXrOUk9Rtia4fQS071t4', result)",
"argv = ['foo', 'bar', '-a']\noptions, salt = parse_args(argv)\nresult = generate_password(salt, options)\nself.assertEqual('VNyZ9IdXrOUk9Rtia4fQS071t4', r... | <|body_start_0|>
argv = ['foo', 'bar']
options, salt = parse_args(argv)
result = generate_password(salt, options)
self.assertEqual('VNy+Z9IdXrOUk9Rtia4fQS071t4', result)
<|end_body_0|>
<|body_start_1|>
argv = ['foo', 'bar', '-a']
options, salt = parse_args(argv)
... | GeneratePasswordTest | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneratePasswordTest:
def test_generate(self):
"""Default."""
<|body_0|>
def test_generate_alpha(self):
"""Set alpha_num_mode on."""
<|body_1|>
def test_generate_size(self):
"""Set Size."""
<|body_2|>
def test_generate_alpha_size(sel... | stack_v2_sparse_classes_75kplus_train_070033 | 6,529 | permissive | [
{
"docstring": "Default.",
"name": "test_generate",
"signature": "def test_generate(self)"
},
{
"docstring": "Set alpha_num_mode on.",
"name": "test_generate_alpha",
"signature": "def test_generate_alpha(self)"
},
{
"docstring": "Set Size.",
"name": "test_generate_size",
... | 4 | stack_v2_sparse_classes_30k_train_008180 | Implement the Python class `GeneratePasswordTest` described below.
Class description:
Implement the GeneratePasswordTest class.
Method signatures and docstrings:
- def test_generate(self): Default.
- def test_generate_alpha(self): Set alpha_num_mode on.
- def test_generate_size(self): Set Size.
- def test_generate_al... | Implement the Python class `GeneratePasswordTest` described below.
Class description:
Implement the GeneratePasswordTest class.
Method signatures and docstrings:
- def test_generate(self): Default.
- def test_generate_alpha(self): Set alpha_num_mode on.
- def test_generate_size(self): Set Size.
- def test_generate_al... | 7c4176b734d8dc421a64c45815142e789687d934 | <|skeleton|>
class GeneratePasswordTest:
def test_generate(self):
"""Default."""
<|body_0|>
def test_generate_alpha(self):
"""Set alpha_num_mode on."""
<|body_1|>
def test_generate_size(self):
"""Set Size."""
<|body_2|>
def test_generate_alpha_size(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GeneratePasswordTest:
def test_generate(self):
"""Default."""
argv = ['foo', 'bar']
options, salt = parse_args(argv)
result = generate_password(salt, options)
self.assertEqual('VNy+Z9IdXrOUk9Rtia4fQS071t4', result)
def test_generate_alpha(self):
"""Set alph... | the_stack_v2_python_sparse | genpasswd | fuktommy/homebin | train | 2 | |
1e9733a1bb65d3e6086cfcdff7d7530c54ef74a8 | [
"start = 0\nend = len(search_space) - 1\ntarget_index = -1\nwhile start <= end:\n mid = start + (end - start) // 2\n if search_space[mid] == target:\n target_index = mid\n if find_first:\n end = mid - 1\n else:\n start = mid + 1\n elif search_space[mid] > target:\... | <|body_start_0|>
start = 0
end = len(search_space) - 1
target_index = -1
while start <= end:
mid = start + (end - start) // 2
if search_space[mid] == target:
target_index = mid
if find_first:
end = mid - 1
... | This class is a python implementation of the problem discussed in the following videos by mycodeschool: 1) First or Last Occurrence - https://www.youtube.com/watch?v=OE7wUUpJw6I 2) Target Count - https://www.youtube.com/watch?v=pLT_9jwaPLs :Authors: pranaychandekar | TargetCount | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TargetCount:
"""This class is a python implementation of the problem discussed in the following videos by mycodeschool: 1) First or Last Occurrence - https://www.youtube.com/watch?v=OE7wUUpJw6I 2) Target Count - https://www.youtube.com/watch?v=pLT_9jwaPLs :Authors: pranaychandekar"""
def fin... | stack_v2_sparse_classes_75kplus_train_070034 | 2,904 | permissive | [
{
"docstring": "This method performs a binary search on the sorted search space to find the index of the target. Depending on the find_first boolean parameter it either the index of first occurrence or last occurrence. :param search_space: The sorted list of elements on which target needs to be searched. :param... | 2 | stack_v2_sparse_classes_30k_train_038559 | Implement the Python class `TargetCount` described below.
Class description:
This class is a python implementation of the problem discussed in the following videos by mycodeschool: 1) First or Last Occurrence - https://www.youtube.com/watch?v=OE7wUUpJw6I 2) Target Count - https://www.youtube.com/watch?v=pLT_9jwaPLs :A... | Implement the Python class `TargetCount` described below.
Class description:
This class is a python implementation of the problem discussed in the following videos by mycodeschool: 1) First or Last Occurrence - https://www.youtube.com/watch?v=OE7wUUpJw6I 2) Target Count - https://www.youtube.com/watch?v=pLT_9jwaPLs :A... | 355a72ceb3537e8ec242b6aea4b214deac4432d8 | <|skeleton|>
class TargetCount:
"""This class is a python implementation of the problem discussed in the following videos by mycodeschool: 1) First or Last Occurrence - https://www.youtube.com/watch?v=OE7wUUpJw6I 2) Target Count - https://www.youtube.com/watch?v=pLT_9jwaPLs :Authors: pranaychandekar"""
def fin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TargetCount:
"""This class is a python implementation of the problem discussed in the following videos by mycodeschool: 1) First or Last Occurrence - https://www.youtube.com/watch?v=OE7wUUpJw6I 2) Target Count - https://www.youtube.com/watch?v=pLT_9jwaPLs :Authors: pranaychandekar"""
def find_occurrence(... | the_stack_v2_python_sparse | src/binary_search/target_count.py | pranaychandekar/dsa | train | 5 |
81c1418eaebce2dd6bde64f83caf23e6e0533c5a | [
"start = time.time()\ncmvns = []\nfor speaker in speakers:\n coded_sps, f0s = ([], [])\n for audio_file in entries_person_wavs[speaker]:\n wav, _ = librosa.load(audio_file, sr=fs, mono=True, dtype=np.float64)\n if enable_load_from_disk:\n samples = np.load(audio_file)\n f0,... | <|body_start_0|>
start = time.time()
cmvns = []
for speaker in speakers:
coded_sps, f0s = ([], [])
for audio_file in entries_person_wavs[speaker]:
wav, _ = librosa.load(audio_file, sr=fs, mono=True, dtype=np.float64)
if enable_load_from_dis... | World Feature Normalizer | WorldFeatureNormalizer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorldFeatureNormalizer:
"""World Feature Normalizer"""
def compute_world_cmvn(self, enable_load_from_disk, entries_person_wavs, sp_dim, fft_size, fs, speakers):
"""compuate cmvn of f0 and sp using pyworld"""
<|body_0|>
def load_cmvn(self):
"""load codedsp_mean, c... | stack_v2_sparse_classes_75kplus_train_070035 | 12,356 | permissive | [
{
"docstring": "compuate cmvn of f0 and sp using pyworld",
"name": "compute_world_cmvn",
"signature": "def compute_world_cmvn(self, enable_load_from_disk, entries_person_wavs, sp_dim, fft_size, fs, speakers)"
},
{
"docstring": "load codedsp_mean, codedsp_var, f0_mean, f0_var for vc dataset",
... | 2 | stack_v2_sparse_classes_30k_train_016718 | Implement the Python class `WorldFeatureNormalizer` described below.
Class description:
World Feature Normalizer
Method signatures and docstrings:
- def compute_world_cmvn(self, enable_load_from_disk, entries_person_wavs, sp_dim, fft_size, fs, speakers): compuate cmvn of f0 and sp using pyworld
- def load_cmvn(self):... | Implement the Python class `WorldFeatureNormalizer` described below.
Class description:
World Feature Normalizer
Method signatures and docstrings:
- def compute_world_cmvn(self, enable_load_from_disk, entries_person_wavs, sp_dim, fft_size, fs, speakers): compuate cmvn of f0 and sp using pyworld
- def load_cmvn(self):... | 5d4d6d13075b8ee9fd824ce6258cb8f55dd157eb | <|skeleton|>
class WorldFeatureNormalizer:
"""World Feature Normalizer"""
def compute_world_cmvn(self, enable_load_from_disk, entries_person_wavs, sp_dim, fft_size, fs, speakers):
"""compuate cmvn of f0 and sp using pyworld"""
<|body_0|>
def load_cmvn(self):
"""load codedsp_mean, c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorldFeatureNormalizer:
"""World Feature Normalizer"""
def compute_world_cmvn(self, enable_load_from_disk, entries_person_wavs, sp_dim, fft_size, fs, speakers):
"""compuate cmvn of f0 and sp using pyworld"""
start = time.time()
cmvns = []
for speaker in speakers:
... | the_stack_v2_python_sparse | athena/data/feature_normalizer.py | shuaijiang/athena-2 | train | 1 |
8eccf0e5cf8e669b0ab4df4a7084aa00f6db75bc | [
"dup_workflow_names = get_dups([w.name for w in to_check])\nif dup_workflow_names:\n raise ValueError(f\"Workflow names were redefined: {', '.join(dup_workflow_names)}.\")\nreturn to_check",
"for workflow in self.workflows:\n if workflow.name == workflow_name:\n return workflow\nraise ValueError(f\"W... | <|body_start_0|>
dup_workflow_names = get_dups([w.name for w in to_check])
if dup_workflow_names:
raise ValueError(f"Workflow names were redefined: {', '.join(dup_workflow_names)}.")
return to_check
<|end_body_0|>
<|body_start_1|>
for workflow in self.workflows:
... | This class defines the config file | Config | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
"""This class defines the config file"""
def unique_workflow_names(cls, to_check):
"""Do not allow duplicated workflow names"""
<|body_0|>
def get_workflow(self, workflow_name: str) -> Workflow:
"""Returns workflow with workflow_name or ValueError"""
... | stack_v2_sparse_classes_75kplus_train_070036 | 12,746 | permissive | [
{
"docstring": "Do not allow duplicated workflow names",
"name": "unique_workflow_names",
"signature": "def unique_workflow_names(cls, to_check)"
},
{
"docstring": "Returns workflow with workflow_name or ValueError",
"name": "get_workflow",
"signature": "def get_workflow(self, workflow_n... | 4 | stack_v2_sparse_classes_30k_train_052978 | Implement the Python class `Config` described below.
Class description:
This class defines the config file
Method signatures and docstrings:
- def unique_workflow_names(cls, to_check): Do not allow duplicated workflow names
- def get_workflow(self, workflow_name: str) -> Workflow: Returns workflow with workflow_name ... | Implement the Python class `Config` described below.
Class description:
This class defines the config file
Method signatures and docstrings:
- def unique_workflow_names(cls, to_check): Do not allow duplicated workflow names
- def get_workflow(self, workflow_name: str) -> Workflow: Returns workflow with workflow_name ... | 909ede3d1fe75fa5d64c6ff1b4c6016dc3df6746 | <|skeleton|>
class Config:
"""This class defines the config file"""
def unique_workflow_names(cls, to_check):
"""Do not allow duplicated workflow names"""
<|body_0|>
def get_workflow(self, workflow_name: str) -> Workflow:
"""Returns workflow with workflow_name or ValueError"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Config:
"""This class defines the config file"""
def unique_workflow_names(cls, to_check):
"""Do not allow duplicated workflow names"""
dup_workflow_names = get_dups([w.name for w in to_check])
if dup_workflow_names:
raise ValueError(f"Workflow names were redefined: {'... | the_stack_v2_python_sparse | metatlas/tools/config.py | biorack/metatlas | train | 10 |
b5ca4ee454b3e6834ac5f77607186cc7449c22d1 | [
"self.param = param\nself.riskfree = riskfree\nself.maturity = maturity",
"rho = self.param.rho\ndelta = self.param.delta\nmu = self.param.mu\nsigma = self.param.sigma\nphi = self.param.phi\ntheta1 = self.param.theta1\ntheta2 = self.param.theta2\nscale = mu * (1 - rho) / delta\nbetap = rho / scale\nn = int(self.m... | <|body_start_0|>
self.param = param
self.riskfree = riskfree
self.maturity = maturity
<|end_body_0|>
<|body_start_1|>
rho = self.param.rho
delta = self.param.delta
mu = self.param.mu
sigma = self.param.sigma
phi = self.param.phi
theta1 = self.para... | Autoregressive Gamma Process. Attributes ---------- param Model parameters Methods ------- charfun Characteristic function cos_restriction Restrictions used in COS function | ARG | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ARG:
"""Autoregressive Gamma Process. Attributes ---------- param Model parameters Methods ------- charfun Characteristic function cos_restriction Restrictions used in COS function"""
def __init__(self, param, riskfree, maturity):
"""Initialize the class. Parameters ---------- param ... | stack_v2_sparse_classes_75kplus_train_070037 | 4,104 | permissive | [
{
"docstring": "Initialize the class. Parameters ---------- param : ARGParam instance Model parameters riskfree : float Risk-free rate, annualized maturity : float Fraction of a year",
"name": "__init__",
"signature": "def __init__(self, param, riskfree, maturity)"
},
{
"docstring": "Characteris... | 3 | null | Implement the Python class `ARG` described below.
Class description:
Autoregressive Gamma Process. Attributes ---------- param Model parameters Methods ------- charfun Characteristic function cos_restriction Restrictions used in COS function
Method signatures and docstrings:
- def __init__(self, param, riskfree, matu... | Implement the Python class `ARG` described below.
Class description:
Autoregressive Gamma Process. Attributes ---------- param Model parameters Methods ------- charfun Characteristic function cos_restriction Restrictions used in COS function
Method signatures and docstrings:
- def __init__(self, param, riskfree, matu... | 463d32a61a760d076656c73c9f8c9fadf262438d | <|skeleton|>
class ARG:
"""Autoregressive Gamma Process. Attributes ---------- param Model parameters Methods ------- charfun Characteristic function cos_restriction Restrictions used in COS function"""
def __init__(self, param, riskfree, maturity):
"""Initialize the class. Parameters ---------- param ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ARG:
"""Autoregressive Gamma Process. Attributes ---------- param Model parameters Methods ------- charfun Characteristic function cos_restriction Restrictions used in COS function"""
def __init__(self, param, riskfree, maturity):
"""Initialize the class. Parameters ---------- param : ARGParam in... | the_stack_v2_python_sparse | AsymptoticExpansion/fangoosterlee/fangoosterlee/argamma.py | jeffsnguyen/Python-1 | train | 0 |
8d429ae268f5979724de54ebe0075e38f857c830 | [
"nvars = 3\nsuper().__init__(init=(nvars, None, np.dtype('float64')))\nself._makeAttributeAndRegister('nvars', localVars=locals(), readOnly=True)\nself._makeAttributeAndRegister('sigma', 'rho', 'beta', 'newton_tol', 'newton_maxiter', localVars=locals(), readOnly=False)\nself.work_counters['newton'] = WorkCounter()\... | <|body_start_0|>
nvars = 3
super().__init__(init=(nvars, None, np.dtype('float64')))
self._makeAttributeAndRegister('nvars', localVars=locals(), readOnly=True)
self._makeAttributeAndRegister('sigma', 'rho', 'beta', 'newton_tol', 'newton_maxiter', localVars=locals(), readOnly=False)
... | Simple script to run a Lorenz attractor problem. The Lorenz attractor is a system of three ordinary differential equations (ODEs) that exhibits some chaotic behaviour. It is well known for the "Butterfly Effect", because the solution looks like a butterfly (solve to :math:`T_{end} = 100` or so to see this with these in... | LorenzAttractor | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LorenzAttractor:
"""Simple script to run a Lorenz attractor problem. The Lorenz attractor is a system of three ordinary differential equations (ODEs) that exhibits some chaotic behaviour. It is well known for the "Butterfly Effect", because the solution looks like a butterfly (solve to :math:`T_{... | stack_v2_sparse_classes_75kplus_train_070038 | 7,847 | permissive | [
{
"docstring": "Initialization routine",
"name": "__init__",
"signature": "def __init__(self, sigma=10.0, rho=28.0, beta=8.0 / 3.0, newton_tol=1e-09, newton_maxiter=99)"
},
{
"docstring": "Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of... | 4 | stack_v2_sparse_classes_30k_train_001064 | Implement the Python class `LorenzAttractor` described below.
Class description:
Simple script to run a Lorenz attractor problem. The Lorenz attractor is a system of three ordinary differential equations (ODEs) that exhibits some chaotic behaviour. It is well known for the "Butterfly Effect", because the solution look... | Implement the Python class `LorenzAttractor` described below.
Class description:
Simple script to run a Lorenz attractor problem. The Lorenz attractor is a system of three ordinary differential equations (ODEs) that exhibits some chaotic behaviour. It is well known for the "Butterfly Effect", because the solution look... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class LorenzAttractor:
"""Simple script to run a Lorenz attractor problem. The Lorenz attractor is a system of three ordinary differential equations (ODEs) that exhibits some chaotic behaviour. It is well known for the "Butterfly Effect", because the solution looks like a butterfly (solve to :math:`T_{... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LorenzAttractor:
"""Simple script to run a Lorenz attractor problem. The Lorenz attractor is a system of three ordinary differential equations (ODEs) that exhibits some chaotic behaviour. It is well known for the "Butterfly Effect", because the solution looks like a butterfly (solve to :math:`T_{end} = 100` o... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/Lorenz.py | Parallel-in-Time/pySDC | train | 30 |
e72d01f48281749c8c2d37e9a11e344b222ee612 | [
"l1_int = self.getIntegerValue(l1)\nl2_int = self.getIntegerValue(l2)\nsum_int = l1_int + l2_int\nprint(sum_int)\nif sum_int == 0:\n return [0]\nsum_node = self.getLinkedList(sum_int)\nsum_list = []\nwhile sum_node is not None:\n sum_list.append(sum_node.val)\n sum_node = sum_node.next\nreturn sum_list",
... | <|body_start_0|>
l1_int = self.getIntegerValue(l1)
l2_int = self.getIntegerValue(l2)
sum_int = l1_int + l2_int
print(sum_int)
if sum_int == 0:
return [0]
sum_node = self.getLinkedList(sum_int)
sum_list = []
while sum_node is not None:
... | 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 getIntegerValue(self, l):
""":param l: ListNode :return: Integer"""
<|body_1|>
def getLinkedList(self, i):
""":param i: Integer... | stack_v2_sparse_classes_75kplus_train_070039 | 2,545 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1, l2)"
},
{
"docstring": ":param l: ListNode :return: Integer",
"name": "getIntegerValue",
"signature": "def getIntegerValue(self, l)"
},
{
"d... | 3 | 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 getIntegerValue(self, l): :param l: ListNode :return: Integer
- def getLinkedList(se... | 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 getIntegerValue(self, l): :param l: ListNode :return: Integer
- def getLinkedList(se... | ddbd9bec12e98f1ea1cb8a9cc8cc56d032ab1073 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def getIntegerValue(self, l):
""":param l: ListNode :return: Integer"""
<|body_1|>
def getLinkedList(self, i):
""":param i: Integer... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
l1_int = self.getIntegerValue(l1)
l2_int = self.getIntegerValue(l2)
sum_int = l1_int + l2_int
print(sum_int)
if sum_int == 0:
return [0]
s... | the_stack_v2_python_sparse | linked_list_add.py | sagarbhowmik/home | train | 0 | |
6096e372e76eb63a4164831121e2e16d888753a9 | [
"if len(s) <= 1:\n return s\nmax_length = 0\nmax_pos = 0\nfor pos in range(0, len(s) - 1):\n odd_pos, odd_length = self._center_palindrome(s, pos, pos)\n even_pos, even_length = self._center_palindrome(s, pos, pos + 1)\n if even_length > max_length:\n max_length = even_length\n max_pos = e... | <|body_start_0|>
if len(s) <= 1:
return s
max_length = 0
max_pos = 0
for pos in range(0, len(s) - 1):
odd_pos, odd_length = self._center_palindrome(s, pos, pos)
even_pos, even_length = self._center_palindrome(s, pos, pos + 1)
if even_length... | Center_Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Center_Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def _center_palindrome(self, s, i, j):
"""从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) <= 1:
return s
... | stack_v2_sparse_classes_75kplus_train_070040 | 1,359 | no_license | [
{
"docstring": ":type s: str :rtype: str",
"name": "longestPalindrome",
"signature": "def longestPalindrome(self, s)"
},
{
"docstring": "从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度",
"name": "_center_palindrome",
"signature": "def _center_palindrome(self, s, i, j)"
}
] | 2 | stack_v2_sparse_classes_30k_train_045123 | Implement the Python class `Center_Solution` described below.
Class description:
Implement the Center_Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): :type s: str :rtype: str
- def _center_palindrome(self, s, i, j): 从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度 | Implement the Python class `Center_Solution` described below.
Class description:
Implement the Center_Solution class.
Method signatures and docstrings:
- def longestPalindrome(self, s): :type s: str :rtype: str
- def _center_palindrome(self, s, i, j): 从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度
<|skeleton|>
class Center_Solution:
... | 14a56b5eca8d292c823a028b196fe0c780a57e10 | <|skeleton|>
class Center_Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
<|body_0|>
def _center_palindrome(self, s, i, j):
"""从i和j的中间位置不停的往两边扩散,返回能扩散的最大长度"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Center_Solution:
def longestPalindrome(self, s):
""":type s: str :rtype: str"""
if len(s) <= 1:
return s
max_length = 0
max_pos = 0
for pos in range(0, len(s) - 1):
odd_pos, odd_length = self._center_palindrome(s, pos, pos)
even_pos, ... | the_stack_v2_python_sparse | dynamic_program/q5_longestPalindrome/center_solution.py | ttomchy/LeetCodeInAction | train | 0 | |
868e583099e17392f353d6a90a6b0508104b26ec | [
"super().__init__(parser, path)\nself.lambda_gp = parser.get('lambda_gp')\nself.lambda_gp_ct = parser.get('lambda_gp_ct')\nself.m_param = parser.get('m_param')\nself.model = wgan_gp_ct(self.generator, self.discriminator, self.train_loader, optimizer_D=self.doptimizer, optimizer_G=self.goptimizer, nz=self.latent_siz... | <|body_start_0|>
super().__init__(parser, path)
self.lambda_gp = parser.get('lambda_gp')
self.lambda_gp_ct = parser.get('lambda_gp_ct')
self.m_param = parser.get('m_param')
self.model = wgan_gp_ct(self.generator, self.discriminator, self.train_loader, optimizer_D=self.doptimizer,... | WGAN_GP_CT | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WGAN_GP_CT:
def __init__(self, parser, path):
"""To init a wasserstein GAN with gradient penalty and a consistency term - https://arxiv.org/pdf/1803.01541.pdf"""
<|body_0|>
def train(self):
"""Training function for wasserstein GAN with gradient penalty and a consiste... | stack_v2_sparse_classes_75kplus_train_070041 | 14,265 | no_license | [
{
"docstring": "To init a wasserstein GAN with gradient penalty and a consistency term - https://arxiv.org/pdf/1803.01541.pdf",
"name": "__init__",
"signature": "def __init__(self, parser, path)"
},
{
"docstring": "Training function for wasserstein GAN with gradient penalty and a consistency ter... | 2 | stack_v2_sparse_classes_30k_val_002216 | Implement the Python class `WGAN_GP_CT` described below.
Class description:
Implement the WGAN_GP_CT class.
Method signatures and docstrings:
- def __init__(self, parser, path): To init a wasserstein GAN with gradient penalty and a consistency term - https://arxiv.org/pdf/1803.01541.pdf
- def train(self): Training fu... | Implement the Python class `WGAN_GP_CT` described below.
Class description:
Implement the WGAN_GP_CT class.
Method signatures and docstrings:
- def __init__(self, parser, path): To init a wasserstein GAN with gradient penalty and a consistency term - https://arxiv.org/pdf/1803.01541.pdf
- def train(self): Training fu... | 7cc3abf0704733278d370399f0173ff1b68a577e | <|skeleton|>
class WGAN_GP_CT:
def __init__(self, parser, path):
"""To init a wasserstein GAN with gradient penalty and a consistency term - https://arxiv.org/pdf/1803.01541.pdf"""
<|body_0|>
def train(self):
"""Training function for wasserstein GAN with gradient penalty and a consiste... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WGAN_GP_CT:
def __init__(self, parser, path):
"""To init a wasserstein GAN with gradient penalty and a consistency term - https://arxiv.org/pdf/1803.01541.pdf"""
super().__init__(parser, path)
self.lambda_gp = parser.get('lambda_gp')
self.lambda_gp_ct = parser.get('lambda_gp_ct... | the_stack_v2_python_sparse | vegans_modified/gan_models.py | San-Holo/Adversarial-generation | train | 1 | |
8cf94462b2b84ebd056b60bd9f37cebb8b25487f | [
"super().__init__()\nself.hass = hass\nself.gateway = gateway",
"stack = []\nif record.levelno >= logging.WARN and (not record.exc_info):\n stack = [f for f, _, _, _ in traceback.extract_stack()]\nhass_path: str = HOMEASSISTANT_PATH[0]\nconfig_dir = self.hass.config.config_dir\npaths_re = re.compile('(?:{})/(.... | <|body_start_0|>
super().__init__()
self.hass = hass
self.gateway = gateway
<|end_body_0|>
<|body_start_1|>
stack = []
if record.levelno >= logging.WARN and (not record.exc_info):
stack = [f for f, _, _, _ in traceback.extract_stack()]
hass_path: str = HOMEAS... | Log handler for error messages. | LogRelayHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogRelayHandler:
"""Log handler for error messages."""
def __init__(self, hass: HomeAssistant, gateway: ZHAGateway) -> None:
"""Initialize a new LogErrorHandler."""
<|body_0|>
def emit(self, record: LogRecord) -> None:
"""Relay log message via dispatcher."""
... | stack_v2_sparse_classes_75kplus_train_070042 | 31,557 | permissive | [
{
"docstring": "Initialize a new LogErrorHandler.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, gateway: ZHAGateway) -> None"
},
{
"docstring": "Relay log message via dispatcher.",
"name": "emit",
"signature": "def emit(self, record: LogRecord) -> None"
}
... | 2 | stack_v2_sparse_classes_30k_train_039917 | Implement the Python class `LogRelayHandler` described below.
Class description:
Log handler for error messages.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, gateway: ZHAGateway) -> None: Initialize a new LogErrorHandler.
- def emit(self, record: LogRecord) -> None: Relay log message vi... | Implement the Python class `LogRelayHandler` described below.
Class description:
Log handler for error messages.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, gateway: ZHAGateway) -> None: Initialize a new LogErrorHandler.
- def emit(self, record: LogRecord) -> None: Relay log message vi... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class LogRelayHandler:
"""Log handler for error messages."""
def __init__(self, hass: HomeAssistant, gateway: ZHAGateway) -> None:
"""Initialize a new LogErrorHandler."""
<|body_0|>
def emit(self, record: LogRecord) -> None:
"""Relay log message via dispatcher."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LogRelayHandler:
"""Log handler for error messages."""
def __init__(self, hass: HomeAssistant, gateway: ZHAGateway) -> None:
"""Initialize a new LogErrorHandler."""
super().__init__()
self.hass = hass
self.gateway = gateway
def emit(self, record: LogRecord) -> None:
... | the_stack_v2_python_sparse | homeassistant/components/zha/core/gateway.py | home-assistant/core | train | 35,501 |
220f5db2230c39c0965c5ea48e25b483480f167e | [
"self.l_motor = hal.simulation.PWMSim(1)\nself.r_motor = hal.simulation.PWMSim(2)\nself.navx = hal.simulation.SimDeviceSim('navX-Sensor[4]')\nself.navx_yaw = self.navx.getDouble('Yaw')\nself.physics_controller = physics_controller\nbumper_width = 3.25 * units.inch\nself.drivetrain = tankmodel.TankModel.theory(motor... | <|body_start_0|>
self.l_motor = hal.simulation.PWMSim(1)
self.r_motor = hal.simulation.PWMSim(2)
self.navx = hal.simulation.SimDeviceSim('navX-Sensor[4]')
self.navx_yaw = self.navx.getDouble('Yaw')
self.physics_controller = physics_controller
bumper_width = 3.25 * units.i... | PhysicsEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhysicsEngine:
def __init__(self, physics_controller: PhysicsInterface):
""":param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to"""
<|body_0|>
def update_sim(self, now, tm_diff):
"""Called when the simulation pa... | stack_v2_sparse_classes_75kplus_train_070043 | 2,262 | no_license | [
{
"docstring": ":param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to",
"name": "__init__",
"signature": "def __init__(self, physics_controller: PhysicsInterface)"
},
{
"docstring": "Called when the simulation parameters for the program need... | 2 | stack_v2_sparse_classes_30k_train_039286 | Implement the Python class `PhysicsEngine` described below.
Class description:
Implement the PhysicsEngine class.
Method signatures and docstrings:
- def __init__(self, physics_controller: PhysicsInterface): :param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to
-... | Implement the Python class `PhysicsEngine` described below.
Class description:
Implement the PhysicsEngine class.
Method signatures and docstrings:
- def __init__(self, physics_controller: PhysicsInterface): :param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to
-... | ec511d4841a39d4b9e9043340d1199c1a633aa7d | <|skeleton|>
class PhysicsEngine:
def __init__(self, physics_controller: PhysicsInterface):
""":param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to"""
<|body_0|>
def update_sim(self, now, tm_diff):
"""Called when the simulation pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhysicsEngine:
def __init__(self, physics_controller: PhysicsInterface):
""":param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to"""
self.l_motor = hal.simulation.PWMSim(1)
self.r_motor = hal.simulation.PWMSim(2)
self.navx ... | the_stack_v2_python_sparse | navx-rotate-to-angle-arcade/physics.py | smilelsb/examples | train | 0 | |
8482cb45a4bee33f86e0bcd37119d88c0454b041 | [
"self.uf = [-1 for i in range(n)]\nself.sets_count = n\nself.connect_sets = set([i for i in range(n)])",
"if self.uf[p] < 0:\n return p\nself.uf[p] = self.find(self.uf[p])\nreturn self.uf[p]",
"proot = p\nqroot = q\nif self.uf[proot] > self.uf[qroot]:\n self.uf[qroot] += self.uf[proot]\n self.uf[proot]... | <|body_start_0|>
self.uf = [-1 for i in range(n)]
self.sets_count = n
self.connect_sets = set([i for i in range(n)])
<|end_body_0|>
<|body_start_1|>
if self.uf[p] < 0:
return p
self.uf[p] = self.find(self.uf[p])
return self.uf[p]
<|end_body_1|>
<|body_start_... | 并查集类 | UnionFind | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnionFind:
"""并查集类"""
def __init__(self, n):
"""长度为n的并查集"""
<|body_0|>
def find(self, p):
"""尾递归"""
<|body_1|>
def union(self, p, q):
"""连通p,q 让q指向p"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.uf = [-1 for i in rang... | stack_v2_sparse_classes_75kplus_train_070044 | 1,693 | no_license | [
{
"docstring": "长度为n的并查集",
"name": "__init__",
"signature": "def __init__(self, n)"
},
{
"docstring": "尾递归",
"name": "find",
"signature": "def find(self, p)"
},
{
"docstring": "连通p,q 让q指向p",
"name": "union",
"signature": "def union(self, p, q)"
}
] | 3 | stack_v2_sparse_classes_30k_train_041497 | Implement the Python class `UnionFind` described below.
Class description:
并查集类
Method signatures and docstrings:
- def __init__(self, n): 长度为n的并查集
- def find(self, p): 尾递归
- def union(self, p, q): 连通p,q 让q指向p | Implement the Python class `UnionFind` described below.
Class description:
并查集类
Method signatures and docstrings:
- def __init__(self, n): 长度为n的并查集
- def find(self, p): 尾递归
- def union(self, p, q): 连通p,q 让q指向p
<|skeleton|>
class UnionFind:
"""并查集类"""
def __init__(self, n):
"""长度为n的并查集"""
<|b... | 3bf3209791b902ec9086e230a3e3316aaced4a5f | <|skeleton|>
class UnionFind:
"""并查集类"""
def __init__(self, n):
"""长度为n的并查集"""
<|body_0|>
def find(self, p):
"""尾递归"""
<|body_1|>
def union(self, p, q):
"""连通p,q 让q指向p"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnionFind:
"""并查集类"""
def __init__(self, n):
"""长度为n的并查集"""
self.uf = [-1 for i in range(n)]
self.sets_count = n
self.connect_sets = set([i for i in range(n)])
def find(self, p):
"""尾递归"""
if self.uf[p] < 0:
return p
self.uf[p] = se... | the_stack_v2_python_sparse | LeetCode/1319.py | yaoMYZ/LeetCode | train | 0 |
1dde1989edbc3ec619c4edf24ea611f8632a3b63 | [
"super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_input, drop_rate)\nself.linear = tf.keras.layers.Dense(units=target_vocab)",
"out1, _ = self.mha(x, x, x, mask)\nout1 = self.dropout1(out1, training=... | <|body_start_0|>
super().__init__()
self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)
self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_input, drop_rate)
self.linear = tf.keras.layers.Dense(units=target_vocab)
<|end_body_0|>
<|body_start_1|>
... | DecoderBlock class | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""DecoderBlock class"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units... | stack_v2_sparse_classes_75kplus_train_070045 | 1,800 | no_license | [
{
"docstring": "Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop_rate: (float) the dropout rate.",
"name": "__init__",
"signature": "def __init__(self, N, dm, h, hidden, input_vocab, ta... | 2 | stack_v2_sparse_classes_30k_train_026956 | Implement the Python class `Transformer` described below.
Class description:
DecoderBlock class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the ... | Implement the Python class `Transformer` described below.
Class description:
DecoderBlock class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the ... | 75274394adb52d740f6cd4000cc00bbde44b9b72 | <|skeleton|>
class Transformer:
"""DecoderBlock class"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Transformer:
"""DecoderBlock class"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/11-transformer.py | jdarangop/holbertonschool-machine_learning | train | 2 |
bf8684cf75da8be70745cd71dbcab027ced6eef9 | [
"super(GaussianSmoothing, self).__init__()\nself.shift = shift\nself.fft_centered = fft_centered\nself.fft_normalization = fft_normalization\nself.spatial_dims = spatial_dims\nif isinstance(kernel_size, int):\n kernel_size = [kernel_size] * dim\nif isinstance(sigma, float):\n sigma = [sigma] * dim\nkernel = 1... | <|body_start_0|>
super(GaussianSmoothing, self).__init__()
self.shift = shift
self.fft_centered = fft_centered
self.fft_normalization = fft_normalization
self.spatial_dims = spatial_dims
if isinstance(kernel_size, int):
kernel_size = [kernel_size] * dim
... | Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input using a depthwise convolution. | GaussianSmoothing | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaussianSmoothing:
"""Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input using a depthwise convolution."""
def __init__(self, channels: int, kernel_size: Union[Optional[List[int]], int], sigma: float, dim: int=2, shift: bool=Fal... | stack_v2_sparse_classes_75kplus_train_070046 | 48,550 | permissive | [
{
"docstring": "Initialize the module with the gaussian kernel size and standard deviation. Parameters ---------- channels : int Number of channels in the input tensor. kernel_size : Union[Optional[List[int]], int] Gaussian kernel size. sigma : float Gaussian kernel standard deviation. dim : int Number of dimen... | 2 | stack_v2_sparse_classes_30k_train_025646 | Implement the Python class `GaussianSmoothing` described below.
Class description:
Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input using a depthwise convolution.
Method signatures and docstrings:
- def __init__(self, channels: int, kernel_size: Union[... | Implement the Python class `GaussianSmoothing` described below.
Class description:
Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input using a depthwise convolution.
Method signatures and docstrings:
- def __init__(self, channels: int, kernel_size: Union[... | 6d15dd55ca5ed6fc9fbfd31d8488ee7bab453066 | <|skeleton|>
class GaussianSmoothing:
"""Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input using a depthwise convolution."""
def __init__(self, channels: int, kernel_size: Union[Optional[List[int]], int], sigma: float, dim: int=2, shift: bool=Fal... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GaussianSmoothing:
"""Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed separately for each channel in the input using a depthwise convolution."""
def __init__(self, channels: int, kernel_size: Union[Optional[List[int]], int], sigma: float, dim: int=2, shift: bool=False, fft_cente... | the_stack_v2_python_sparse | mridc/collections/quantitative/parts/transforms.py | wdika/mridc | train | 40 |
88db030b9eb300107bb82893981f1b6c2e245a18 | [
"subscription = subscription_api.subscription_get(subscription_id)\ncurrent_user = user_api.user_get(request.current_user_id)\nif subscription.user_id != request.current_user_id and (not current_user.is_superuser):\n abort(403, _('You do not have access to this record.'))\nreturn Subscription.from_db_model(subsc... | <|body_start_0|>
subscription = subscription_api.subscription_get(subscription_id)
current_user = user_api.user_get(request.current_user_id)
if subscription.user_id != request.current_user_id and (not current_user.is_superuser):
abort(403, _('You do not have access to this record.'))... | REST controller for Subscriptions. Provides Create, Delete, and search methods for resource subscriptions. | SubscriptionsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubscriptionsController:
"""REST controller for Subscriptions. Provides Create, Delete, and search methods for resource subscriptions."""
def get_one(self, subscription_id):
"""Retrieve a specific subscription record. Example:: curl https://my.example.org/api/v1/subscriptions/4 \\ -H... | stack_v2_sparse_classes_75kplus_train_070047 | 7,850 | permissive | [
{
"docstring": "Retrieve a specific subscription record. Example:: curl https://my.example.org/api/v1/subscriptions/4 \\\\ -H 'Authorization: Bearer MY_ACCESS_TOKEN' :param subscription_id: The unique id of this subscription.",
"name": "get_one",
"signature": "def get_one(self, subscription_id)"
},
... | 4 | stack_v2_sparse_classes_30k_test_000804 | Implement the Python class `SubscriptionsController` described below.
Class description:
REST controller for Subscriptions. Provides Create, Delete, and search methods for resource subscriptions.
Method signatures and docstrings:
- def get_one(self, subscription_id): Retrieve a specific subscription record. Example::... | Implement the Python class `SubscriptionsController` described below.
Class description:
REST controller for Subscriptions. Provides Create, Delete, and search methods for resource subscriptions.
Method signatures and docstrings:
- def get_one(self, subscription_id): Retrieve a specific subscription record. Example::... | 5833f87e20722c524a1e4a0b8e1fb82206fb4e5c | <|skeleton|>
class SubscriptionsController:
"""REST controller for Subscriptions. Provides Create, Delete, and search methods for resource subscriptions."""
def get_one(self, subscription_id):
"""Retrieve a specific subscription record. Example:: curl https://my.example.org/api/v1/subscriptions/4 \\ -H... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SubscriptionsController:
"""REST controller for Subscriptions. Provides Create, Delete, and search methods for resource subscriptions."""
def get_one(self, subscription_id):
"""Retrieve a specific subscription record. Example:: curl https://my.example.org/api/v1/subscriptions/4 \\ -H 'Authorizati... | the_stack_v2_python_sparse | storyboard/api/v1/subscriptions.py | Sitcode-Zoograf/storyboard | train | 0 |
5a4cfa9c0d80f42dec3f864be95d26f08165ca8c | [
"self.__predict_season = predict_season\nself.__train_seasons = train_seasons\nself.__pca_components = pca_components\nself.__unlikely_z_score = unlikely_z_score\nself.__random_generator = random_generator",
"raw_train_data = WikipediaParser.parse(self.__train_seasons)\ntrain_output = np.array([1.0 if get_is_mol(... | <|body_start_0|>
self.__predict_season = predict_season
self.__train_seasons = train_seasons
self.__pca_components = pca_components
self.__unlikely_z_score = unlikely_z_score
self.__random_generator = random_generator
<|end_body_0|>
<|body_start_1|>
raw_train_data = Wiki... | The Wikipedia Extractor transforms an array of features in a new array of features which can be used by the classification algorithm. | WikipediaExtractor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WikipediaExtractor:
"""The Wikipedia Extractor transforms an array of features in a new array of features which can be used by the classification algorithm."""
def __init__(self, predict_season: int, train_seasons: Set[int], pca_components: int, unlikely_z_score: float, random_generator: Ran... | stack_v2_sparse_classes_75kplus_train_070048 | 5,120 | no_license | [
{
"docstring": "Constructor of the Wikipedia Extractor. Arguments: predict_season (int): The season for which we make the prediction. train_seasons (Set[int]): The seasons which are used as train data. pca_components (int): The number of PCA components extracted from the job features before LDA is applied. unli... | 5 | stack_v2_sparse_classes_30k_train_051115 | Implement the Python class `WikipediaExtractor` described below.
Class description:
The Wikipedia Extractor transforms an array of features in a new array of features which can be used by the classification algorithm.
Method signatures and docstrings:
- def __init__(self, predict_season: int, train_seasons: Set[int],... | Implement the Python class `WikipediaExtractor` described below.
Class description:
The Wikipedia Extractor transforms an array of features in a new array of features which can be used by the classification algorithm.
Method signatures and docstrings:
- def __init__(self, predict_season: int, train_seasons: Set[int],... | 1676543d484dfde038a7130e44e480aa227b2db4 | <|skeleton|>
class WikipediaExtractor:
"""The Wikipedia Extractor transforms an array of features in a new array of features which can be used by the classification algorithm."""
def __init__(self, predict_season: int, train_seasons: Set[int], pca_components: int, unlikely_z_score: float, random_generator: Ran... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WikipediaExtractor:
"""The Wikipedia Extractor transforms an array of features in a new array of features which can be used by the classification algorithm."""
def __init__(self, predict_season: int, train_seasons: Set[int], pca_components: int, unlikely_z_score: float, random_generator: RandomState):
... | the_stack_v2_python_sparse | moldel/Layers/Wikipedia/WikipediaExtractor.py | Multifacio/Moldel | train | 41 |
06c0fcfbc7a04ef95670ddba3889f66c1b6c2c84 | [
"self.readservice = readservice\nif u_context:\n self.user_context = u_context\n self.username = u_context.user\n if u_context.context == u_context.ChoicesOfView.COMMON:\n self.use_user = None\n else:\n self.use_user = u_context.user",
"from bl.person import Person\nsource = self.readser... | <|body_start_0|>
self.readservice = readservice
if u_context:
self.user_context = u_context
self.username = u_context.user
if u_context.context == u_context.ChoicesOfView.COMMON:
self.use_user = None
else:
self.use_user = u_... | Public methods for accessing active database. Returns a PersonResult object | DbReader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DbReader:
"""Public methods for accessing active database. Returns a PersonResult object"""
def __init__(self, readservice, u_context=None):
"""Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver"""
<|body_0|>
def ge... | stack_v2_sparse_classes_75kplus_train_070049 | 3,432 | no_license | [
{
"docstring": "Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver",
"name": "__init__",
"signature": "def __init__(self, readservice, u_context=None)"
},
{
"docstring": "Read the source, repository and events etc referencing this source. R... | 2 | stack_v2_sparse_classes_30k_train_038207 | Implement the Python class `DbReader` described below.
Class description:
Public methods for accessing active database. Returns a PersonResult object
Method signatures and docstrings:
- def __init__(self, readservice, u_context=None): Create a reader object with db driver and user context. - readservice Neo4jReadServ... | Implement the Python class `DbReader` described below.
Class description:
Public methods for accessing active database. Returns a PersonResult object
Method signatures and docstrings:
- def __init__(self, readservice, u_context=None): Create a reader object with db driver and user context. - readservice Neo4jReadServ... | 0f8d6ba035e3cca8dc756531b7cc51029a549a4f | <|skeleton|>
class DbReader:
"""Public methods for accessing active database. Returns a PersonResult object"""
def __init__(self, readservice, u_context=None):
"""Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver"""
<|body_0|>
def ge... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DbReader:
"""Public methods for accessing active database. Returns a PersonResult object"""
def __init__(self, readservice, u_context=None):
"""Create a reader object with db driver and user context. - readservice Neo4jReadService or Neo4jWriteDriver"""
self.readservice = readservice
... | the_stack_v2_python_sparse | pe/db_reader.py | kkujansuu/stk | train | 0 |
1e0cf35213cfbae4d0b980ef575dfd01d30b6dc6 | [
"super().__init__()\nself.dropout = nn.Dropout(dropout)\nself.softmax = nn.Softmax(dim=-1)",
"d_k = query.size(-1)\nscores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)\nif mask is not None:\n scores = scores.masked_fill_(mask == 0, -1000000000.0)\np_attn = self.softmax(scores)\np_attn = self.d... | <|body_start_0|>
super().__init__()
self.dropout = nn.Dropout(dropout)
self.softmax = nn.Softmax(dim=-1)
<|end_body_0|>
<|body_start_1|>
d_k = query.size(-1)
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
scores = sc... | Compute 'Scaled Dot Product Attention' | ScaledDotProductAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScaledDotProductAttention:
"""Compute 'Scaled Dot Product Attention'"""
def __init__(self, dropout=0.0):
""":param dropout: attention dropout rate"""
<|body_0|>
def forward(self, query, key, value, mask=None):
""":param query: (batch_num, query_length, d_model) :... | stack_v2_sparse_classes_75kplus_train_070050 | 2,730 | permissive | [
{
"docstring": ":param dropout: attention dropout rate",
"name": "__init__",
"signature": "def __init__(self, dropout=0.0)"
},
{
"docstring": ":param query: (batch_num, query_length, d_model) :param key: (batch_num, key_length, d_model) :param value: (batch_num, key_length, d_model)",
"name"... | 2 | null | Implement the Python class `ScaledDotProductAttention` described below.
Class description:
Compute 'Scaled Dot Product Attention'
Method signatures and docstrings:
- def __init__(self, dropout=0.0): :param dropout: attention dropout rate
- def forward(self, query, key, value, mask=None): :param query: (batch_num, que... | Implement the Python class `ScaledDotProductAttention` described below.
Class description:
Compute 'Scaled Dot Product Attention'
Method signatures and docstrings:
- def __init__(self, dropout=0.0): :param dropout: attention dropout rate
- def forward(self, query, key, value, mask=None): :param query: (batch_num, que... | 9962747725d226c645fe82780b3df43b1af3f47f | <|skeleton|>
class ScaledDotProductAttention:
"""Compute 'Scaled Dot Product Attention'"""
def __init__(self, dropout=0.0):
""":param dropout: attention dropout rate"""
<|body_0|>
def forward(self, query, key, value, mask=None):
""":param query: (batch_num, query_length, d_model) :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScaledDotProductAttention:
"""Compute 'Scaled Dot Product Attention'"""
def __init__(self, dropout=0.0):
""":param dropout: attention dropout rate"""
super().__init__()
self.dropout = nn.Dropout(dropout)
self.softmax = nn.Softmax(dim=-1)
def forward(self, query, key, ... | the_stack_v2_python_sparse | models/qanet2/modules/attention.py | arpadtamasi/cs224-final-squad | train | 0 |
72979148901096a10ab30bedb07b3d1b2de27d05 | [
"self.username = username\nself.password = password\nself.connection_urls = connection_urls\nself._auth_token = None",
"connection_indices = list(range(len(self.connection_urls)))\nif not pick_random_server:\n return connection_indices\n_random.shuffle(connection_indices)\nreturn connection_indices",
"if sel... | <|body_start_0|>
self.username = username
self.password = password
self.connection_urls = connection_urls
self._auth_token = None
<|end_body_0|>
<|body_start_1|>
connection_indices = list(range(len(self.connection_urls)))
if not pick_random_server:
return con... | TokenGenrator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TokenGenrator:
def __init__(self, username, password, connection_urls):
"""Init the credentials for getting the auth token. Parameters ---------- username : string username that exists in db. password : string password for the given user. connection_urls : list(string) list of connection... | stack_v2_sparse_classes_75kplus_train_070051 | 5,829 | no_license | [
{
"docstring": "Init the credentials for getting the auth token. Parameters ---------- username : string username that exists in db. password : string password for the given user. connection_urls : list(string) list of connection strings for the db instances.",
"name": "__init__",
"signature": "def __in... | 3 | stack_v2_sparse_classes_30k_test_001566 | Implement the Python class `TokenGenrator` described below.
Class description:
Implement the TokenGenrator class.
Method signatures and docstrings:
- def __init__(self, username, password, connection_urls): Init the credentials for getting the auth token. Parameters ---------- username : string username that exists i... | Implement the Python class `TokenGenrator` described below.
Class description:
Implement the TokenGenrator class.
Method signatures and docstrings:
- def __init__(self, username, password, connection_urls): Init the credentials for getting the auth token. Parameters ---------- username : string username that exists i... | 7620bf742b7b286f35f2dd58e418537f3363b1c2 | <|skeleton|>
class TokenGenrator:
def __init__(self, username, password, connection_urls):
"""Init the credentials for getting the auth token. Parameters ---------- username : string username that exists in db. password : string password for the given user. connection_urls : list(string) list of connection... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TokenGenrator:
def __init__(self, username, password, connection_urls):
"""Init the credentials for getting the auth token. Parameters ---------- username : string username that exists in db. password : string password for the given user. connection_urls : list(string) list of connection strings for t... | the_stack_v2_python_sparse | graph_curation/db/connection.py | narendra-nextsteps/text-graph | train | 0 | |
1b1b63662c27ab1c05caf7bae67974547dbf2bbb | [
"get_info = self.session.get('https://zlapp.fudan.edu.cn/ncov/wap/fudan/get-info')\nlast_info = get_info.json()\ndate = last_info['d']['info']['date']\nposition = last_info['d']['info']['geo_api_info']\nposition = json.loads(position)\naddress = position['formattedAddress']\nmessage = ' 日期:{},地址:{}'.format(date, ad... | <|body_start_0|>
get_info = self.session.get('https://zlapp.fudan.edu.cn/ncov/wap/fudan/get-info')
last_info = get_info.json()
date = last_info['d']['info']['date']
position = last_info['d']['info']['geo_api_info']
position = json.loads(position)
address = position['forma... | 检查是否已提交平安复旦的信息,并根据上一次填写的地理位置填报 | Zlapp | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Zlapp:
"""检查是否已提交平安复旦的信息,并根据上一次填写的地理位置填报"""
def check(self):
"""check whether submitted today, log last submission date and address"""
<|body_0|>
def checkin(self):
"""submit, and log submission status"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_070052 | 6,021 | permissive | [
{
"docstring": "check whether submitted today, log last submission date and address",
"name": "check",
"signature": "def check(self)"
},
{
"docstring": "submit, and log submission status",
"name": "checkin",
"signature": "def checkin(self)"
}
] | 2 | null | Implement the Python class `Zlapp` described below.
Class description:
检查是否已提交平安复旦的信息,并根据上一次填写的地理位置填报
Method signatures and docstrings:
- def check(self): check whether submitted today, log last submission date and address
- def checkin(self): submit, and log submission status | Implement the Python class `Zlapp` described below.
Class description:
检查是否已提交平安复旦的信息,并根据上一次填写的地理位置填报
Method signatures and docstrings:
- def check(self): check whether submitted today, log last submission date and address
- def checkin(self): submit, and log submission status
<|skeleton|>
class Zlapp:
"""检查是否已提... | 508922cfa0558c58b95206dd8fbf51d10525fa1e | <|skeleton|>
class Zlapp:
"""检查是否已提交平安复旦的信息,并根据上一次填写的地理位置填报"""
def check(self):
"""check whether submitted today, log last submission date and address"""
<|body_0|>
def checkin(self):
"""submit, and log submission status"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Zlapp:
"""检查是否已提交平安复旦的信息,并根据上一次填写的地理位置填报"""
def check(self):
"""check whether submitted today, log last submission date and address"""
get_info = self.session.get('https://zlapp.fudan.edu.cn/ncov/wap/fudan/get-info')
last_info = get_info.json()
date = last_info['d']['info'... | the_stack_v2_python_sparse | pafd/fudan.py | ivanfei-1/fduhole | train | 0 |
8d7dc9502f0f7db20754735fc3f6f0b4faddf318 | [
"super().__init__()\nif isinstance(coupling_map, Target):\n self.target = coupling_map\n self.coupling_map = self.target.build_coupling_map()\nelse:\n self.target = None\n self.coupling_map = coupling_map\nself.search_depth = search_depth\nself.search_width = search_width\nself.fake_run = fake_run",
"... | <|body_start_0|>
super().__init__()
if isinstance(coupling_map, Target):
self.target = coupling_map
self.coupling_map = self.target.build_coupling_map()
else:
self.target = None
self.coupling_map = coupling_map
self.search_depth = search_de... | Map input circuit onto a backend topology via insertion of SWAPs. Implementation of Sven Jandura's swap mapper submission for the 2018 Qiskit Developer Challenge, adapted to integrate into the transpiler architecture. The role of the swapper pass is to modify the starting circuit to be compatible with the target device... | LookaheadSwap | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LookaheadSwap:
"""Map input circuit onto a backend topology via insertion of SWAPs. Implementation of Sven Jandura's swap mapper submission for the 2018 Qiskit Developer Challenge, adapted to integrate into the transpiler architecture. The role of the swapper pass is to modify the starting circui... | stack_v2_sparse_classes_75kplus_train_070053 | 15,025 | permissive | [
{
"docstring": "LookaheadSwap initializer. Args: coupling_map (Union[CouplingMap, Target]): CouplingMap of the target backend. search_depth (int): lookahead tree depth when ranking best SWAP options. search_width (int): lookahead tree width when ranking best SWAP options. fake_run (bool): if true, it only prete... | 2 | stack_v2_sparse_classes_30k_train_019231 | Implement the Python class `LookaheadSwap` described below.
Class description:
Map input circuit onto a backend topology via insertion of SWAPs. Implementation of Sven Jandura's swap mapper submission for the 2018 Qiskit Developer Challenge, adapted to integrate into the transpiler architecture. The role of the swappe... | Implement the Python class `LookaheadSwap` described below.
Class description:
Map input circuit onto a backend topology via insertion of SWAPs. Implementation of Sven Jandura's swap mapper submission for the 2018 Qiskit Developer Challenge, adapted to integrate into the transpiler architecture. The role of the swappe... | 0b51250e219ca303654fc28a318c21366584ccd3 | <|skeleton|>
class LookaheadSwap:
"""Map input circuit onto a backend topology via insertion of SWAPs. Implementation of Sven Jandura's swap mapper submission for the 2018 Qiskit Developer Challenge, adapted to integrate into the transpiler architecture. The role of the swapper pass is to modify the starting circui... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LookaheadSwap:
"""Map input circuit onto a backend topology via insertion of SWAPs. Implementation of Sven Jandura's swap mapper submission for the 2018 Qiskit Developer Challenge, adapted to integrate into the transpiler architecture. The role of the swapper pass is to modify the starting circuit to be compa... | the_stack_v2_python_sparse | qiskit/transpiler/passes/routing/lookahead_swap.py | 1ucian0/qiskit-terra | train | 6 |
bf247cd7a12bcb6cee54e675b997588a34f796cf | [
"file_list = gzip.open(template_file)\ninput_dict = pickle.load(file_list)\nself.interpolator = UnstructuredInterpolator(input_dict, remember_last=False)",
"array = np.stack((energy, impact, xmax), axis=-1)\ninterpolated_value = self.interpolator(array)\nreturn interpolated_value"
] | <|body_start_0|>
file_list = gzip.open(template_file)
input_dict = pickle.load(file_list)
self.interpolator = UnstructuredInterpolator(input_dict, remember_last=False)
<|end_body_0|>
<|body_start_1|>
array = np.stack((energy, impact, xmax), axis=-1)
interpolated_value = self.int... | Class for interpolating between the time gradient predictions | TimeGradientInterpolator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TimeGradientInterpolator:
"""Class for interpolating between the time gradient predictions"""
def __init__(self, template_file):
"""Parameters ---------- template_file: str Location of pickle file containing ImPACT NN templates"""
<|body_0|>
def __call__(self, energy, im... | stack_v2_sparse_classes_75kplus_train_070054 | 2,989 | permissive | [
{
"docstring": "Parameters ---------- template_file: str Location of pickle file containing ImPACT NN templates",
"name": "__init__",
"signature": "def __init__(self, template_file)"
},
{
"docstring": "Evaluate expected time gradient for a set of shower parameters and pixel positions Parameters ... | 2 | stack_v2_sparse_classes_30k_train_000024 | Implement the Python class `TimeGradientInterpolator` described below.
Class description:
Class for interpolating between the time gradient predictions
Method signatures and docstrings:
- def __init__(self, template_file): Parameters ---------- template_file: str Location of pickle file containing ImPACT NN templates... | Implement the Python class `TimeGradientInterpolator` described below.
Class description:
Class for interpolating between the time gradient predictions
Method signatures and docstrings:
- def __init__(self, template_file): Parameters ---------- template_file: str Location of pickle file containing ImPACT NN templates... | 10b058f8dcc166177d1eb5b2af638ca37722a021 | <|skeleton|>
class TimeGradientInterpolator:
"""Class for interpolating between the time gradient predictions"""
def __init__(self, template_file):
"""Parameters ---------- template_file: str Location of pickle file containing ImPACT NN templates"""
<|body_0|>
def __call__(self, energy, im... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TimeGradientInterpolator:
"""Class for interpolating between the time gradient predictions"""
def __init__(self, template_file):
"""Parameters ---------- template_file: str Location of pickle file containing ImPACT NN templates"""
file_list = gzip.open(template_file)
input_dict = ... | the_stack_v2_python_sparse | ctapipe/utils/template_network_interpolator.py | cta-sst-1m/ctapipe | train | 1 |
ffbcf06dfb4ca6f267808f4235baf87d86dcaf11 | [
"E0 = a0 * m_e * c ** 2 * k0 / e\nzr = 0.5 * k0 * waist ** 2\nself.m = m\nself.n = n\nself.k0 = k0\nself.waist = waist\nself.zr = zr\nself.inv_tau = 1.0 / tau\nself.t_peak = t_peak\nself.E0 = E0\nself.v_antenna = source_v\nself.focal_length = focal_length\nself.boost = boost\nself.temporal_order = temporal_order\ns... | <|body_start_0|>
E0 = a0 * m_e * c ** 2 * k0 / e
zr = 0.5 * k0 * waist ** 2
self.m = m
self.n = n
self.k0 = k0
self.waist = waist
self.zr = zr
self.inv_tau = 1.0 / tau
self.t_peak = t_peak
self.E0 = E0
self.v_antenna = source_v
... | Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and m are specific parameters to calculate the Laguerre... | LaguerreGaussianProfile | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LaguerreGaussianProfile:
"""Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and ... | stack_v2_sparse_classes_75kplus_train_070055 | 34,589 | permissive | [
{
"docstring": "Define a Laguerre-Gaussian laser profile. (Laguerre-Gaussian transversally, hypergaussian longitudinally) This object can then be passed to the `EM3D` class, as the argument `laser_func`, in order to have a LG laser emitted by the antenna. Parameters: ----------- m, n: integer (dimensionless) La... | 2 | stack_v2_sparse_classes_30k_train_018208 | Implement the Python class `LaguerreGaussianProfile` described below.
Class description:
Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2... | Implement the Python class `LaguerreGaussianProfile` described below.
Class description:
Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2... | 091c982f82788209017315e13eb7d0e743687d46 | <|skeleton|>
class LaguerreGaussianProfile:
"""Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LaguerreGaussianProfile:
"""Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and m are specifi... | the_stack_v2_python_sparse | scripts/field_solvers/laser/laser_profiles.py | giadarol/warp | train | 0 |
d7c20511daef565075a9d6db95be30728e9bf467 | [
"self.supported_attr = f5_virtualservice_attributes['VS_supported_attr']\nself.ignore_for_value = f5_virtualservice_attributes['VS_ignore_for_value']\nself.unsupported_types = f5_virtualservice_attributes['VS_unsupported_types']\nself.vs_na_attr = f5_virtualservice_attributes['VS_na_attr']\nself.vs_indirect_attr = ... | <|body_start_0|>
self.supported_attr = f5_virtualservice_attributes['VS_supported_attr']
self.ignore_for_value = f5_virtualservice_attributes['VS_ignore_for_value']
self.unsupported_types = f5_virtualservice_attributes['VS_unsupported_types']
self.vs_na_attr = f5_virtualservice_attribute... | class for vs conversion for v11 version | VSConfigConvV11 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VSConfigConvV11:
"""class for vs conversion for v11 version"""
def __init__(self, f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings, distinct_app_profile):
""":param f5_virtualservice_attributes: yaml attribute file for object :param prefix: prefix for object :param... | stack_v2_sparse_classes_75kplus_train_070056 | 49,577 | permissive | [
{
"docstring": ":param f5_virtualservice_attributes: yaml attribute file for object :param prefix: prefix for object :param con_snatpool: flag for snat conversion :param custom_mappings: custom config to migrate irules",
"name": "__init__",
"signature": "def __init__(self, f5_virtualservice_attributes, ... | 3 | stack_v2_sparse_classes_30k_train_028522 | Implement the Python class `VSConfigConvV11` described below.
Class description:
class for vs conversion for v11 version
Method signatures and docstrings:
- def __init__(self, f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings, distinct_app_profile): :param f5_virtualservice_attributes: yaml attribut... | Implement the Python class `VSConfigConvV11` described below.
Class description:
class for vs conversion for v11 version
Method signatures and docstrings:
- def __init__(self, f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings, distinct_app_profile): :param f5_virtualservice_attributes: yaml attribut... | f2386af42908d3c503ec0ec6f1b00f2095b0b004 | <|skeleton|>
class VSConfigConvV11:
"""class for vs conversion for v11 version"""
def __init__(self, f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings, distinct_app_profile):
""":param f5_virtualservice_attributes: yaml attribute file for object :param prefix: prefix for object :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VSConfigConvV11:
"""class for vs conversion for v11 version"""
def __init__(self, f5_virtualservice_attributes, prefix, con_snatpool, custom_mappings, distinct_app_profile):
""":param f5_virtualservice_attributes: yaml attribute file for object :param prefix: prefix for object :param con_snatpool... | the_stack_v2_python_sparse | python/avi/migrationtools/f5_converter/vs_converter.py | vmware/alb-sdk | train | 30 |
02774c1261595edc12f3a21ea68dcdbe2bf3c05f | [
"identities = {'identity-uuid': {'uuid': 'identity-uuid', 'msisdns': ['+27820001001']}}\nprocess_registration(identities, 'identity-uuid', {'edd': '2020-01-01', 'faccode': '12345', 'id_type': 'sa_id', 'mom_dob': '1990-01-01', 'mom_given_name': 'test name', 'mom_family_name': 'test family name', 'uuid_device': 'iden... | <|body_start_0|>
identities = {'identity-uuid': {'uuid': 'identity-uuid', 'msisdns': ['+27820001001']}}
process_registration(identities, 'identity-uuid', {'edd': '2020-01-01', 'faccode': '12345', 'id_type': 'sa_id', 'mom_dob': '1990-01-01', 'mom_given_name': 'test name', 'mom_family_name': 'test family ... | ProcessRegistrationTests | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcessRegistrationTests:
def test_all_fields(self):
"""It should extract the relevant fields from the registration onto the identity"""
<|body_0|>
def test_no_overwrite(self):
"""Should not overwrite existing fields"""
<|body_1|>
def test_no_fields(self... | stack_v2_sparse_classes_75kplus_train_070057 | 17,808 | permissive | [
{
"docstring": "It should extract the relevant fields from the registration onto the identity",
"name": "test_all_fields",
"signature": "def test_all_fields(self)"
},
{
"docstring": "Should not overwrite existing fields",
"name": "test_no_overwrite",
"signature": "def test_no_overwrite(s... | 3 | stack_v2_sparse_classes_30k_train_011866 | Implement the Python class `ProcessRegistrationTests` described below.
Class description:
Implement the ProcessRegistrationTests class.
Method signatures and docstrings:
- def test_all_fields(self): It should extract the relevant fields from the registration onto the identity
- def test_no_overwrite(self): Should not... | Implement the Python class `ProcessRegistrationTests` described below.
Class description:
Implement the ProcessRegistrationTests class.
Method signatures and docstrings:
- def test_all_fields(self): It should extract the relevant fields from the registration onto the identity
- def test_no_overwrite(self): Should not... | e1ea0beaf079f4f4d5f9562fb9d9a4f0670f459f | <|skeleton|>
class ProcessRegistrationTests:
def test_all_fields(self):
"""It should extract the relevant fields from the registration onto the identity"""
<|body_0|>
def test_no_overwrite(self):
"""Should not overwrite existing fields"""
<|body_1|>
def test_no_fields(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProcessRegistrationTests:
def test_all_fields(self):
"""It should extract the relevant fields from the registration onto the identity"""
identities = {'identity-uuid': {'uuid': 'identity-uuid', 'msisdns': ['+27820001001']}}
process_registration(identities, 'identity-uuid', {'edd': '202... | the_stack_v2_python_sparse | scripts/migrate_to_rapidpro/test_collect_information.py | praekeltfoundation/ndoh-hub | train | 0 | |
d9e48603ba503b1478c83547a02cc732b27a845e | [
"if game.num_players <= game.players.count():\n return response.bad_request('Game is full')\nif game.players.filter(nickname=request.player.nickname):\n return response.bad_request('A player by that name is already in this game.')\nrequest.player.join_game(game)\nresponse.set(instance=game)",
"if game.state... | <|body_start_0|>
if game.num_players <= game.players.count():
return response.bad_request('Game is full')
if game.players.filter(nickname=request.player.nickname):
return response.bad_request('A player by that name is already in this game.')
request.player.join_game(game)... | GamePlayerController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GamePlayerController:
def create(self, request, response, game):
"""Join a game API Handler: POST /game/<game>/player"""
<|body_0|>
def update(self, request, response, game):
"""Update ready status in the lobby API Handler: PUT /game/<game>/player/"""
<|body_... | stack_v2_sparse_classes_75kplus_train_070058 | 7,016 | no_license | [
{
"docstring": "Join a game API Handler: POST /game/<game>/player",
"name": "create",
"signature": "def create(self, request, response, game)"
},
{
"docstring": "Update ready status in the lobby API Handler: PUT /game/<game>/player/",
"name": "update",
"signature": "def update(self, requ... | 3 | stack_v2_sparse_classes_30k_train_008058 | Implement the Python class `GamePlayerController` described below.
Class description:
Implement the GamePlayerController class.
Method signatures and docstrings:
- def create(self, request, response, game): Join a game API Handler: POST /game/<game>/player
- def update(self, request, response, game): Update ready sta... | Implement the Python class `GamePlayerController` described below.
Class description:
Implement the GamePlayerController class.
Method signatures and docstrings:
- def create(self, request, response, game): Join a game API Handler: POST /game/<game>/player
- def update(self, request, response, game): Update ready sta... | a2550bf835d97c54976237d5a02eb44e8eaabe3e | <|skeleton|>
class GamePlayerController:
def create(self, request, response, game):
"""Join a game API Handler: POST /game/<game>/player"""
<|body_0|>
def update(self, request, response, game):
"""Update ready status in the lobby API Handler: PUT /game/<game>/player/"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GamePlayerController:
def create(self, request, response, game):
"""Join a game API Handler: POST /game/<game>/player"""
if game.num_players <= game.players.count():
return response.bad_request('Game is full')
if game.players.filter(nickname=request.player.nickname):
... | the_stack_v2_python_sparse | apiserver/main/controllers.py | joelsemar/space-race | train | 0 | |
950d5c0b2a63e51107ebbc14bbad5ca7dc47dffa | [
"l = 0\nr = 0\nlength = float('inf')\nwhile l < len(nums) and r < len(nums) and (l <= r):\n if sum(nums[l:r + 1]) >= target:\n if r + 1 - l < length:\n length = r - l + 1\n l = l + 1\n else:\n r = r + 1\nreturn 0 if length == float('inf') else length",
"l = 0\nr = 0\nn = len(... | <|body_start_0|>
l = 0
r = 0
length = float('inf')
while l < len(nums) and r < len(nums) and (l <= r):
if sum(nums[l:r + 1]) >= target:
if r + 1 - l < length:
length = r - l + 1
l = l + 1
else:
r ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minSubArrayLen(self, target, nums):
""":type target: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLen(self, target, nums):
""":type target: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_75kplus_train_070059 | 2,347 | no_license | [
{
"docstring": ":type target: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen",
"signature": "def minSubArrayLen(self, target, nums)"
},
{
"docstring": ":type target: int :type nums: List[int] :rtype: int",
"name": "minSubArrayLen",
"signature": "def minSubArrayLen(self, ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen(self, target, nums): :type target: int :type nums: List[int] :rtype: int
- def minSubArrayLen(self, target, nums): :type target: int :type nums: List[int] :rty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minSubArrayLen(self, target, nums): :type target: int :type nums: List[int] :rtype: int
- def minSubArrayLen(self, target, nums): :type target: int :type nums: List[int] :rty... | 860590239da0618c52967a55eda8d6bbe00bfa96 | <|skeleton|>
class Solution:
def minSubArrayLen(self, target, nums):
""":type target: int :type nums: List[int] :rtype: int"""
<|body_0|>
def minSubArrayLen(self, target, nums):
""":type target: int :type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minSubArrayLen(self, target, nums):
""":type target: int :type nums: List[int] :rtype: int"""
l = 0
r = 0
length = float('inf')
while l < len(nums) and r < len(nums) and (l <= r):
if sum(nums[l:r + 1]) >= target:
if r + 1 - l < ... | the_stack_v2_python_sparse | LeetCode/p0209/II/minimum-size-subarray-sum.py | Ynjxsjmh/PracticeMakesPerfect | train | 0 | |
25c8b638be29ad7f9e06a034492bff3d322efe89 | [
"i = 0\ntryAgain = True\nwhile tryAgain and i < Parameters.MAX_SEND_TRY:\n try:\n serializedMessage = Params.CODEC.encode(message)\n params = {Parameters.POST_MESSAGE_KEYWORD: serializedMessage}\n params = urllib.parse.urlencode(params, doseq=True, encoding=Parameters.POST_MESSAGE_ENCODING)\... | <|body_start_0|>
i = 0
tryAgain = True
while tryAgain and i < Parameters.MAX_SEND_TRY:
try:
serializedMessage = Params.CODEC.encode(message)
params = {Parameters.POST_MESSAGE_KEYWORD: serializedMessage}
params = urllib.parse.urlencode(p... | HTTP request maker Uses http.client request method to create outgoing requests | Sender | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sender:
"""HTTP request maker Uses http.client request method to create outgoing requests"""
def send(connection, message):
"""Send the message via http on given connection :param message: message to send :param connection: connection to use to send the message"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_070060 | 8,302 | no_license | [
{
"docstring": "Send the message via http on given connection :param message: message to send :param connection: connection to use to send the message",
"name": "send",
"signature": "def send(connection, message)"
},
{
"docstring": "Request list of probes on given connection :param connection: c... | 3 | stack_v2_sparse_classes_30k_train_042914 | Implement the Python class `Sender` described below.
Class description:
HTTP request maker Uses http.client request method to create outgoing requests
Method signatures and docstrings:
- def send(connection, message): Send the message via http on given connection :param message: message to send :param connection: con... | Implement the Python class `Sender` described below.
Class description:
HTTP request maker Uses http.client request method to create outgoing requests
Method signatures and docstrings:
- def send(connection, message): Send the message via http on given connection :param message: message to send :param connection: con... | ca59600c973fb63ec974fa4a3b03784784f30a31 | <|skeleton|>
class Sender:
"""HTTP request maker Uses http.client request method to create outgoing requests"""
def send(connection, message):
"""Send the message via http on given connection :param message: message to send :param connection: connection to use to send the message"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Sender:
"""HTTP request maker Uses http.client request method to create outgoing requests"""
def send(connection, message):
"""Send the message via http on given connection :param message: message to send :param connection: connection to use to send the message"""
i = 0
tryAgain =... | the_stack_v2_python_sparse | app/common/protocols/http.py | netixx/NetProbes | train | 2 |
7e62e6c49f8f2778fee55552069eed9614fe3032 | [
"def postorder(root):\n return postorder(root.left) + postorder(root.right) + [root.val] if root else []\nreturn ' '.join(map(str, postorder(root)))",
"def helper(lower=float('-inf'), upper=float('inf')):\n if not data or data[-1] < lower or data[-1] > upper:\n return None\n val = data.pop()\n ... | <|body_start_0|>
def postorder(root):
return postorder(root.left) + postorder(root.right) + [root.val] if root else []
return ' '.join(map(str, postorder(root)))
<|end_body_0|>
<|body_start_1|>
def helper(lower=float('-inf'), upper=float('inf')):
if not data or data[-1] ... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def postorder(root):
return postorde... | stack_v2_sparse_classes_75kplus_train_070061 | 4,762 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049664 | 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.
- def deserialize(self, data): 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): Encodes a tree to a single string.
- def deserialize(self, data): Decodes your encoded data to tree.
<|skeleton|>
class Codec:
def serialize(self, root... | 59f70dc4466e15df591ba285317e4a1fe808ed60 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string."""
def postorder(root):
return postorder(root.left) + postorder(root.right) + [root.val] if root else []
return ' '.join(map(str, postorder(root)))
def deserialize(self, data):
"""Decodes y... | the_stack_v2_python_sparse | leet/amazon/trees_and_graphs/449_serialize_and_deserialize_BST.py | arsamigullin/problem_solving_python | train | 0 | |
0ea797110b1440559ef11ad8584a681ecbe04625 | [
"super(Ex2Net, self).__init__()\nself.hidden = hidden_nodes\nself.hidden_layer = nn.Linear(28 * 28, self.hidden)\nself.output_layer = nn.Linear(self.hidden, 10)",
"x = x.view(-1, 28 * 28)\nx = F.relu(self.hidden_layer(x))\nx = F.relu(self.output_layer(x))\nreturn x"
] | <|body_start_0|>
super(Ex2Net, self).__init__()
self.hidden = hidden_nodes
self.hidden_layer = nn.Linear(28 * 28, self.hidden)
self.output_layer = nn.Linear(self.hidden, 10)
<|end_body_0|>
<|body_start_1|>
x = x.view(-1, 28 * 28)
x = F.relu(self.hidden_layer(x))
... | Ex2Net | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ex2Net:
def __init__(self, hidden_nodes=10):
"""Define layers (connections between layers) :param hidden_nodes:"""
<|body_0|>
def forward(self, x):
"""Define forward propagation. Backward propagation definition is done automatically. :param x: :return:"""
<|b... | stack_v2_sparse_classes_75kplus_train_070062 | 4,231 | no_license | [
{
"docstring": "Define layers (connections between layers) :param hidden_nodes:",
"name": "__init__",
"signature": "def __init__(self, hidden_nodes=10)"
},
{
"docstring": "Define forward propagation. Backward propagation definition is done automatically. :param x: :return:",
"name": "forward... | 2 | stack_v2_sparse_classes_30k_train_014253 | Implement the Python class `Ex2Net` described below.
Class description:
Implement the Ex2Net class.
Method signatures and docstrings:
- def __init__(self, hidden_nodes=10): Define layers (connections between layers) :param hidden_nodes:
- def forward(self, x): Define forward propagation. Backward propagation definiti... | Implement the Python class `Ex2Net` described below.
Class description:
Implement the Ex2Net class.
Method signatures and docstrings:
- def __init__(self, hidden_nodes=10): Define layers (connections between layers) :param hidden_nodes:
- def forward(self, x): Define forward propagation. Backward propagation definiti... | 71d86c8fa74d5e93d46e45ccf50ec0c42a5c3e19 | <|skeleton|>
class Ex2Net:
def __init__(self, hidden_nodes=10):
"""Define layers (connections between layers) :param hidden_nodes:"""
<|body_0|>
def forward(self, x):
"""Define forward propagation. Backward propagation definition is done automatically. :param x: :return:"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ex2Net:
def __init__(self, hidden_nodes=10):
"""Define layers (connections between layers) :param hidden_nodes:"""
super(Ex2Net, self).__init__()
self.hidden = hidden_nodes
self.hidden_layer = nn.Linear(28 * 28, self.hidden)
self.output_layer = nn.Linear(self.hidden, 10... | the_stack_v2_python_sparse | Sheet9/PyTorchOpt.py | julianbrummer/2d-vision | train | 0 | |
273b04e3dbab7e97ebfb72468d1455c64c7cc81b | [
"code.InteractiveConsole.__init__(self, locals=local_vars)\nself.histfile = os.path.expanduser('~/.ACAT.history')\nif readline:\n readline.parse_and_bind('tab: complete')\n readline.set_completer(string_copleter(object_dict=local_vars))\n try:\n readline.read_history_file(self.histfile)\n except ... | <|body_start_0|>
code.InteractiveConsole.__init__(self, locals=local_vars)
self.histfile = os.path.expanduser('~/.ACAT.history')
if readline:
readline.parse_and_bind('tab: complete')
readline.set_completer(string_copleter(object_dict=local_vars))
try:
... | @brief Class used enter to a interactive shell. | HistoryConsole | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistoryConsole:
"""@brief Class used enter to a interactive shell."""
def __init__(self, local_vars):
"""@brief Initialises the console object @param[in] self Pointer to the current object @param[in] locals Local variables."""
<|body_0|>
def push(self, line):
"""... | stack_v2_sparse_classes_75kplus_train_070063 | 14,820 | no_license | [
{
"docstring": "@brief Initialises the console object @param[in] self Pointer to the current object @param[in] locals Local variables.",
"name": "__init__",
"signature": "def __init__(self, local_vars)"
},
{
"docstring": "Push a line to the interpreter. see code.InteractiveConsole.push for more.... | 2 | stack_v2_sparse_classes_30k_train_009123 | Implement the Python class `HistoryConsole` described below.
Class description:
@brief Class used enter to a interactive shell.
Method signatures and docstrings:
- def __init__(self, local_vars): @brief Initialises the console object @param[in] self Pointer to the current object @param[in] locals Local variables.
- d... | Implement the Python class `HistoryConsole` described below.
Class description:
@brief Class used enter to a interactive shell.
Method signatures and docstrings:
- def __init__(self, local_vars): @brief Initialises the console object @param[in] self Pointer to the current object @param[in] locals Local variables.
- d... | 726ec248c371c22c63309bed9ed8bb6b96b5f11a | <|skeleton|>
class HistoryConsole:
"""@brief Class used enter to a interactive shell."""
def __init__(self, local_vars):
"""@brief Initialises the console object @param[in] self Pointer to the current object @param[in] locals Local variables."""
<|body_0|>
def push(self, line):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HistoryConsole:
"""@brief Class used enter to a interactive shell."""
def __init__(self, local_vars):
"""@brief Initialises the console object @param[in] self Pointer to the current object @param[in] locals Local variables."""
code.InteractiveConsole.__init__(self, locals=local_vars)
... | the_stack_v2_python_sparse | audio/kalimba/kymera/tools/ACAT/ACAT/Interpreter/Interactive.py | Fangxihu/W1_V006 | train | 2 |
4ece046735739e3557e9a59bdccd0629bd8648e8 | [
"Canvas.__init__(self)\nself.configure(width=larg, height=haut)\nself.boss = boss\nself.larg = larg\nself.haut = haut\npas = (larg - 25) / 8\nfor t in range(0, 9):\n stx = 10 + t * pas\n self.create_line(stx, haut - 12, stx, 15, fill='grey')\npas = (haut - 25) / 10\nfor t in range(-5, 6):\n sty = haut / 2 ... | <|body_start_0|>
Canvas.__init__(self)
self.configure(width=larg, height=haut)
self.boss = boss
self.larg = larg
self.haut = haut
pas = (larg - 25) / 8
for t in range(0, 9):
stx = 10 + t * pas
self.create_line(stx, haut - 12, stx, 15, fill=... | Canevas pour le dessin de courbes élongation/temps | OscilloGraphe | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OscilloGraphe:
"""Canevas pour le dessin de courbes élongation/temps"""
def __init__(self, boss=None, larg=400, haut=350):
"""Constructeur du graphique : axes et échelle horizontale"""
<|body_0|>
def axes(self):
"""Création des axes de références"""
<|bod... | stack_v2_sparse_classes_75kplus_train_070064 | 3,176 | no_license | [
{
"docstring": "Constructeur du graphique : axes et échelle horizontale",
"name": "__init__",
"signature": "def __init__(self, boss=None, larg=400, haut=350)"
},
{
"docstring": "Création des axes de références",
"name": "axes",
"signature": "def axes(self)"
},
{
"docstring": "Tra... | 3 | stack_v2_sparse_classes_30k_train_053188 | Implement the Python class `OscilloGraphe` described below.
Class description:
Canevas pour le dessin de courbes élongation/temps
Method signatures and docstrings:
- def __init__(self, boss=None, larg=400, haut=350): Constructeur du graphique : axes et échelle horizontale
- def axes(self): Création des axes de référe... | Implement the Python class `OscilloGraphe` described below.
Class description:
Canevas pour le dessin de courbes élongation/temps
Method signatures and docstrings:
- def __init__(self, boss=None, larg=400, haut=350): Constructeur du graphique : axes et échelle horizontale
- def axes(self): Création des axes de référe... | 14b306447e227ddc5cb04b8819f388ca9f91a1d6 | <|skeleton|>
class OscilloGraphe:
"""Canevas pour le dessin de courbes élongation/temps"""
def __init__(self, boss=None, larg=400, haut=350):
"""Constructeur du graphique : axes et échelle horizontale"""
<|body_0|>
def axes(self):
"""Création des axes de références"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OscilloGraphe:
"""Canevas pour le dessin de courbes élongation/temps"""
def __init__(self, boss=None, larg=400, haut=350):
"""Constructeur du graphique : axes et échelle horizontale"""
Canvas.__init__(self)
self.configure(width=larg, height=haut)
self.boss = boss
s... | the_stack_v2_python_sparse | Course/Book/Programmer_avec_Python3/13-ClasseEtInterfacesGraphiques/oscillo.py | BjaouiAya/Cours-Python | train | 0 |
95f3531f3ae1ea29fd583b832f85de20d0c6523b | [
"fields = ['a.admin_id', 'a.name', 'account.account']\ncondition = '1 = 1'\nvalues = []\nif not self.util.is_empty('shop_id', params):\n condition += ' and a.shop_id = %s'\n values.append(params['shop_id'])\nif not self.util.is_empty('admin_id', params):\n condition += ' and a.admin_id = %s'\n values.ap... | <|body_start_0|>
fields = ['a.admin_id', 'a.name', 'account.account']
condition = '1 = 1'
values = []
if not self.util.is_empty('shop_id', params):
condition += ' and a.shop_id = %s'
values.append(params['shop_id'])
if not self.util.is_empty('admin_id', pa... | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
async def query_one_and_account(self, params):
"""获取一条用户信息记录 :param params: :return: { id: admin_id: name: }"""
<|body_0|>
async def modify(self, params):
"""修改用户信息 @param params: @return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
field... | stack_v2_sparse_classes_75kplus_train_070065 | 1,846 | no_license | [
{
"docstring": "获取一条用户信息记录 :param params: :return: { id: admin_id: name: }",
"name": "query_one_and_account",
"signature": "async def query_one_and_account(self, params)"
},
{
"docstring": "修改用户信息 @param params: @return:",
"name": "modify",
"signature": "async def modify(self, params)"
... | 2 | stack_v2_sparse_classes_30k_train_040374 | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- async def query_one_and_account(self, params): 获取一条用户信息记录 :param params: :return: { id: admin_id: name: }
- async def modify(self, params): 修改用户信息 @param params: @return: | Implement the Python class `Model` described below.
Class description:
Implement the Model class.
Method signatures and docstrings:
- async def query_one_and_account(self, params): 获取一条用户信息记录 :param params: :return: { id: admin_id: name: }
- async def modify(self, params): 修改用户信息 @param params: @return:
<|skeleton|>... | 9ab7dc87b678fc2a105cf883448cb7aada8494d2 | <|skeleton|>
class Model:
async def query_one_and_account(self, params):
"""获取一条用户信息记录 :param params: :return: { id: admin_id: name: }"""
<|body_0|>
async def modify(self, params):
"""修改用户信息 @param params: @return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Model:
async def query_one_and_account(self, params):
"""获取一条用户信息记录 :param params: :return: { id: admin_id: name: }"""
fields = ['a.admin_id', 'a.name', 'account.account']
condition = '1 = 1'
values = []
if not self.util.is_empty('shop_id', params):
conditio... | the_stack_v2_python_sparse | src/module/v1/user/admin/model.py | yuiitsu/DSSP | train | 0 | |
f5580ffd94fa2f0d2acc2acadd10b1f2f786a297 | [
"self.axes = ax\nself.canvas = ax.figure.canvas\nself.Nxy = len(x)\nself.xys = []\nfor i in range(len(x)):\n self.xys.append((x[i], y[i]))\nself.cid = self.canvas.mpl_connect('button_press_event', self.onpress)",
"p = path.Path(verts)\nself.ind = p.contains_points(self.xys)\nself.canvas.widgetlock.release(self... | <|body_start_0|>
self.axes = ax
self.canvas = ax.figure.canvas
self.Nxy = len(x)
self.xys = []
for i in range(len(x)):
self.xys.append((x[i], y[i]))
self.cid = self.canvas.mpl_connect('button_press_event', self.onpress)
<|end_body_0|>
<|body_start_1|>
... | Simple Lasso manager to allow user to lasso points and get indices Adapted from version from Google search on matplotlib lasso | LassoManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LassoManager:
"""Simple Lasso manager to allow user to lasso points and get indices Adapted from version from Google search on matplotlib lasso"""
def __init__(self, ax, x, y):
"""Initialize manager with axes, x, and y data arrays"""
<|body_0|>
def callback(self, verts):... | stack_v2_sparse_classes_75kplus_train_070066 | 16,415 | permissive | [
{
"docstring": "Initialize manager with axes, x, and y data arrays",
"name": "__init__",
"signature": "def __init__(self, ax, x, y)"
},
{
"docstring": "Once a Lasso is marked with mouse, get points within the path",
"name": "callback",
"signature": "def callback(self, verts)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_023091 | Implement the Python class `LassoManager` described below.
Class description:
Simple Lasso manager to allow user to lasso points and get indices Adapted from version from Google search on matplotlib lasso
Method signatures and docstrings:
- def __init__(self, ax, x, y): Initialize manager with axes, x, and y data arr... | Implement the Python class `LassoManager` described below.
Class description:
Simple Lasso manager to allow user to lasso points and get indices Adapted from version from Google search on matplotlib lasso
Method signatures and docstrings:
- def __init__(self, ax, x, y): Initialize manager with axes, x, and y data arr... | e134409dc14b20f69e68a0d4d34b2c1b5056a901 | <|skeleton|>
class LassoManager:
"""Simple Lasso manager to allow user to lasso points and get indices Adapted from version from Google search on matplotlib lasso"""
def __init__(self, ax, x, y):
"""Initialize manager with axes, x, and y data arrays"""
<|body_0|>
def callback(self, verts):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LassoManager:
"""Simple Lasso manager to allow user to lasso points and get indices Adapted from version from Google search on matplotlib lasso"""
def __init__(self, ax, x, y):
"""Initialize manager with axes, x, and y data arrays"""
self.axes = ax
self.canvas = ax.figure.canvas
... | the_stack_v2_python_sparse | external/tools/python/tools/plots.py | sdss/apogee | train | 5 |
6f79b7cd4314eda133ae7c827d24981aa75f4639 | [
"super(AccountAuthenticationForm, self).__init__(*args, **kwargs)\nself.fields['email'].label = 'E-Mail'\nself.fields['password'].label = 'Passwort'",
"if self.is_valid():\n email = self.cleaned_data['email'].lower()\n password = self.cleaned_data['password']\n if not authenticate(email=email, password=p... | <|body_start_0|>
super(AccountAuthenticationForm, self).__init__(*args, **kwargs)
self.fields['email'].label = 'E-Mail'
self.fields['password'].label = 'Passwort'
<|end_body_0|>
<|body_start_1|>
if self.is_valid():
email = self.cleaned_data['email'].lower()
passw... | Klasse des Anmelde Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Für das Einlogen wird die Email und das Passwort benötigt. | AccountAuthenticationForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountAuthenticationForm:
"""Klasse des Anmelde Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Für das Einlogen wird die Email und das Passwort benötigt."""
def __init__(self, *args, **kwargs):
"""Wird nur verwendet um die Labels... | stack_v2_sparse_classes_75kplus_train_070067 | 5,396 | no_license | [
{
"docstring": "Wird nur verwendet um die Labels der Felder zu ändern. Bei den Account Feldern geht das Ändern der Labels nur auf diese Art und Weise.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Hier wird geprüft ob die eingegebenen Nutzerdaten gül... | 2 | stack_v2_sparse_classes_30k_test_000549 | Implement the Python class `AccountAuthenticationForm` described below.
Class description:
Klasse des Anmelde Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Für das Einlogen wird die Email und das Passwort benötigt.
Method signatures and docstrings:
- def __init__... | Implement the Python class `AccountAuthenticationForm` described below.
Class description:
Klasse des Anmelde Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Für das Einlogen wird die Email und das Passwort benötigt.
Method signatures and docstrings:
- def __init__... | 65465c5ceb6d95f9d333b3399ccd988034b475ba | <|skeleton|>
class AccountAuthenticationForm:
"""Klasse des Anmelde Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Für das Einlogen wird die Email und das Passwort benötigt."""
def __init__(self, *args, **kwargs):
"""Wird nur verwendet um die Labels... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccountAuthenticationForm:
"""Klasse des Anmelde Formulars. Hier werden die angezeigten Formularfelder, deren CSS Klassen und ihr Aussehen definiert. Für das Einlogen wird die Email und das Passwort benötigt."""
def __init__(self, *args, **kwargs):
"""Wird nur verwendet um die Labels der Felder z... | the_stack_v2_python_sparse | src/account/forms.py | RBHSMA/TechTrader | train | 0 |
178b9feef02172cf624586a2297447f07cb94888 | [
"try:\n from pymatgen.core import Structure\nexcept:\n raise ImportError('This class requires pymatgen to be installed.')\nif type(structure) is not Structure:\n structure = Structure(**structure)\nself.aos = aos\nself.cutoff = np.around(cutoff, 2)\nself.setup_env = _load_primitive_cell(structure, aos, pbc... | <|body_start_0|>
try:
from pymatgen.core import Structure
except:
raise ImportError('This class requires pymatgen to be installed.')
if type(structure) is not Structure:
structure = Structure(**structure)
self.aos = aos
self.cutoff = np.around(... | Calculates the 2-D Surface graph features in 6 different permutations- Based on the implementation of Lattice Graph Convolution Neural Network (LCNN). This method produces the Atom wise features ( One Hot Encoding) and Adjacent neighbour in the specified order of permutations. Neighbors are determined by first extracti... | LCNNFeaturizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LCNNFeaturizer:
"""Calculates the 2-D Surface graph features in 6 different permutations- Based on the implementation of Lattice Graph Convolution Neural Network (LCNN). This method produces the Atom wise features ( One Hot Encoding) and Adjacent neighbour in the specified order of permutations. ... | stack_v2_sparse_classes_75kplus_train_070068 | 28,058 | permissive | [
{
"docstring": "Parameters ---------- structure: : PymatgenStructure Pymatgen Structure object of the primitive cell used for calculating neighbors from lattice transformations.It also requires site_properties attribute with \"Sitetypes\"(Active or spectator site). aos: List[str] A list of all the active site s... | 2 | stack_v2_sparse_classes_30k_train_012799 | Implement the Python class `LCNNFeaturizer` described below.
Class description:
Calculates the 2-D Surface graph features in 6 different permutations- Based on the implementation of Lattice Graph Convolution Neural Network (LCNN). This method produces the Atom wise features ( One Hot Encoding) and Adjacent neighbour i... | Implement the Python class `LCNNFeaturizer` described below.
Class description:
Calculates the 2-D Surface graph features in 6 different permutations- Based on the implementation of Lattice Graph Convolution Neural Network (LCNN). This method produces the Atom wise features ( One Hot Encoding) and Adjacent neighbour i... | ee6e67ebcf7bf04259cf13aff6388e2b791fea3d | <|skeleton|>
class LCNNFeaturizer:
"""Calculates the 2-D Surface graph features in 6 different permutations- Based on the implementation of Lattice Graph Convolution Neural Network (LCNN). This method produces the Atom wise features ( One Hot Encoding) and Adjacent neighbour in the specified order of permutations. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LCNNFeaturizer:
"""Calculates the 2-D Surface graph features in 6 different permutations- Based on the implementation of Lattice Graph Convolution Neural Network (LCNN). This method produces the Atom wise features ( One Hot Encoding) and Adjacent neighbour in the specified order of permutations. Neighbors are... | the_stack_v2_python_sparse | deepchem/feat/material_featurizers/lcnn_featurizer.py | deepchem/deepchem | train | 4,876 |
90afdc512039bb722b75b668f4fcf1aa2a511ad9 | [
"self.DNA = DNA\nself.k = kmer\nself.pseudocounts = pseudocount\nself.MotifMatrix = None\nself.ProfileMatrix = None\nself.BestProfileMatrix = None\nself.BestMotif = None\nself.setOfMotifs = {x: [] for x in range(len(DNA))}\nfor i in self.setOfMotifs:\n for kmerSeq in range(len(DNA[i]) - self.k + 1):\n seq... | <|body_start_0|>
self.DNA = DNA
self.k = kmer
self.pseudocounts = pseudocount
self.MotifMatrix = None
self.ProfileMatrix = None
self.BestProfileMatrix = None
self.BestMotif = None
self.setOfMotifs = {x: [] for x in range(len(DNA))}
for i in self.se... | The following class will find the consensus kmer. | RandomizedMotif | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedMotif:
"""The following class will find the consensus kmer."""
def __init__(self, DNA, kmer, pseudocount):
"""Set up the class for needed action."""
<|body_0|>
def RandomMotifSearch(self):
"""Main algorithm to find the consensus Motif."""
<|body... | stack_v2_sparse_classes_75kplus_train_070069 | 10,527 | no_license | [
{
"docstring": "Set up the class for needed action.",
"name": "__init__",
"signature": "def __init__(self, DNA, kmer, pseudocount)"
},
{
"docstring": "Main algorithm to find the consensus Motif.",
"name": "RandomMotifSearch",
"signature": "def RandomMotifSearch(self)"
},
{
"docst... | 6 | stack_v2_sparse_classes_30k_train_042647 | Implement the Python class `RandomizedMotif` described below.
Class description:
The following class will find the consensus kmer.
Method signatures and docstrings:
- def __init__(self, DNA, kmer, pseudocount): Set up the class for needed action.
- def RandomMotifSearch(self): Main algorithm to find the consensus Mot... | Implement the Python class `RandomizedMotif` described below.
Class description:
The following class will find the consensus kmer.
Method signatures and docstrings:
- def __init__(self, DNA, kmer, pseudocount): Set up the class for needed action.
- def RandomMotifSearch(self): Main algorithm to find the consensus Mot... | 0faa3fb468c784a1f7afb078cb3753d8ac356222 | <|skeleton|>
class RandomizedMotif:
"""The following class will find the consensus kmer."""
def __init__(self, DNA, kmer, pseudocount):
"""Set up the class for needed action."""
<|body_0|>
def RandomMotifSearch(self):
"""Main algorithm to find the consensus Motif."""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandomizedMotif:
"""The following class will find the consensus kmer."""
def __init__(self, DNA, kmer, pseudocount):
"""Set up the class for needed action."""
self.DNA = DNA
self.k = kmer
self.pseudocounts = pseudocount
self.MotifMatrix = None
self.ProfileM... | the_stack_v2_python_sparse | Assignment3/randomizedMotifSearch.py | mabdulqa/BME205 | train | 0 |
4376d13f7146e98bc561c9c88a953ad60ea85fab | [
"super(Dataset, self).__init__(resource_id=dataset_id, resource_type=resource.ResourceType.DATASET, name=name, display_name=display_name, parent=parent, locations=locations, lifecycle_state=lifecycle_state)\nself.full_name = full_name\nself.data = data",
"dataset_dict = json.loads(json_string)\ndataset_id = datas... | <|body_start_0|>
super(Dataset, self).__init__(resource_id=dataset_id, resource_type=resource.ResourceType.DATASET, name=name, display_name=display_name, parent=parent, locations=locations, lifecycle_state=lifecycle_state)
self.full_name = full_name
self.data = data
<|end_body_0|>
<|body_start_... | Dataset resource. | Dataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
"""Dataset resource."""
def __init__(self, dataset_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=DatasetLifecycleState.UNSPECIFIED):
"""Initialize. Args: dataset_id (int): The dataset id. full_name (str): The full r... | stack_v2_sparse_classes_75kplus_train_070070 | 3,182 | permissive | [
{
"docstring": "Initialize. Args: dataset_id (int): The dataset id. full_name (str): The full resource name and ancestry. data (str): Resource representation of the dataset. name (str): The dataset's unique GCP name, with the format \"datasets/{id}\". display_name (str): The dataset's display name. locations (L... | 2 | stack_v2_sparse_classes_30k_test_002868 | Implement the Python class `Dataset` described below.
Class description:
Dataset resource.
Method signatures and docstrings:
- def __init__(self, dataset_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=DatasetLifecycleState.UNSPECIFIED): Initialize. Args: data... | Implement the Python class `Dataset` described below.
Class description:
Dataset resource.
Method signatures and docstrings:
- def __init__(self, dataset_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=DatasetLifecycleState.UNSPECIFIED): Initialize. Args: data... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class Dataset:
"""Dataset resource."""
def __init__(self, dataset_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=DatasetLifecycleState.UNSPECIFIED):
"""Initialize. Args: dataset_id (int): The dataset id. full_name (str): The full r... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dataset:
"""Dataset resource."""
def __init__(self, dataset_id, full_name=None, data=None, name=None, display_name=None, parent=None, locations=None, lifecycle_state=DatasetLifecycleState.UNSPECIFIED):
"""Initialize. Args: dataset_id (int): The dataset id. full_name (str): The full resource name ... | the_stack_v2_python_sparse | google/cloud/forseti/common/gcp_type/dataset.py | kevensen/forseti-security | train | 1 |
a07c16a5b72b532b1a389a464ee96ed17f27153e | [
"Renderable.__init__(self, parent)\nself.client = None\nlog.debug('Load appropriate iDevices')\nself.prototypes = {}\nself.ideviceStore.register(self)\nfor prototype in self.ideviceStore.getIdevices():\n log.debug('add ' + prototype.title)\n self.prototypes[prototype.id] = prototype",
"log.debug('Process' +... | <|body_start_0|>
Renderable.__init__(self, parent)
self.client = None
log.debug('Load appropriate iDevices')
self.prototypes = {}
self.ideviceStore.register(self)
for prototype in self.ideviceStore.getIdevices():
log.debug('add ' + prototype.title)
... | IdevicePane is responsible for creating the XHTML for iDevice links | IdevicePane | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdevicePane:
"""IdevicePane is responsible for creating the XHTML for iDevice links"""
def __init__(self, parent):
"""Initialize"""
<|body_0|>
def process(self, request):
"""Process the request arguments to see if we're supposed to add an iDevice"""
<|bod... | stack_v2_sparse_classes_75kplus_train_070071 | 2,881 | no_license | [
{
"docstring": "Initialize",
"name": "__init__",
"signature": "def __init__(self, parent)"
},
{
"docstring": "Process the request arguments to see if we're supposed to add an iDevice",
"name": "process",
"signature": "def process(self, request)"
},
{
"docstring": "Adds an iDevice... | 5 | stack_v2_sparse_classes_30k_train_014984 | Implement the Python class `IdevicePane` described below.
Class description:
IdevicePane is responsible for creating the XHTML for iDevice links
Method signatures and docstrings:
- def __init__(self, parent): Initialize
- def process(self, request): Process the request arguments to see if we're supposed to add an iDe... | Implement the Python class `IdevicePane` described below.
Class description:
IdevicePane is responsible for creating the XHTML for iDevice links
Method signatures and docstrings:
- def __init__(self, parent): Initialize
- def process(self, request): Process the request arguments to see if we're supposed to add an iDe... | 1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad | <|skeleton|>
class IdevicePane:
"""IdevicePane is responsible for creating the XHTML for iDevice links"""
def __init__(self, parent):
"""Initialize"""
<|body_0|>
def process(self, request):
"""Process the request arguments to see if we're supposed to add an iDevice"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IdevicePane:
"""IdevicePane is responsible for creating the XHTML for iDevice links"""
def __init__(self, parent):
"""Initialize"""
Renderable.__init__(self, parent)
self.client = None
log.debug('Load appropriate iDevices')
self.prototypes = {}
self.idevice... | the_stack_v2_python_sparse | eXe/rev2735-2828/left-trunk-2828/exe/xului/idevicepane.py | joliebig/featurehouse_fstmerge_examples | train | 3 |
04ca1952a65713c3134c2aa184be1675d4de20a0 | [
"self.parent = GeneticDrawing.create_random(polygon_amount=1)\nself.image_size = target_image.size\nself.target_image = target_image",
"parent_img = self.parent.produce_image()\nparent_fitness = image_diff(parent_img, self.target_image)\nchild = self.parent.mutate()\nchild_img = child.produce_image()\nchild_fitne... | <|body_start_0|>
self.parent = GeneticDrawing.create_random(polygon_amount=1)
self.image_size = target_image.size
self.target_image = target_image
<|end_body_0|>
<|body_start_1|>
parent_img = self.parent.produce_image()
parent_fitness = image_diff(parent_img, self.target_image)
... | Class responsible for pooling and choosing best fit drawing. | SingleChildGeneticLearner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleChildGeneticLearner:
"""Class responsible for pooling and choosing best fit drawing."""
def __init__(self, target_image):
"""Initializes this instance :param target_image: the image to replicate."""
<|body_0|>
def run_generation(self):
"""Runs a single gene... | stack_v2_sparse_classes_75kplus_train_070072 | 1,202 | no_license | [
{
"docstring": "Initializes this instance :param target_image: the image to replicate.",
"name": "__init__",
"signature": "def __init__(self, target_image)"
},
{
"docstring": "Runs a single generation. :return: the current best fit drawing, the fitness, the image, and whether or not the current ... | 2 | null | Implement the Python class `SingleChildGeneticLearner` described below.
Class description:
Class responsible for pooling and choosing best fit drawing.
Method signatures and docstrings:
- def __init__(self, target_image): Initializes this instance :param target_image: the image to replicate.
- def run_generation(self... | Implement the Python class `SingleChildGeneticLearner` described below.
Class description:
Class responsible for pooling and choosing best fit drawing.
Method signatures and docstrings:
- def __init__(self, target_image): Initializes this instance :param target_image: the image to replicate.
- def run_generation(self... | 7a335838ef4f28c63365a9a1cb2c06d3801e5db4 | <|skeleton|>
class SingleChildGeneticLearner:
"""Class responsible for pooling and choosing best fit drawing."""
def __init__(self, target_image):
"""Initializes this instance :param target_image: the image to replicate."""
<|body_0|>
def run_generation(self):
"""Runs a single gene... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SingleChildGeneticLearner:
"""Class responsible for pooling and choosing best fit drawing."""
def __init__(self, target_image):
"""Initializes this instance :param target_image: the image to replicate."""
self.parent = GeneticDrawing.create_random(polygon_amount=1)
self.image_size... | the_stack_v2_python_sparse | GeneticPool.py | ElikBelik77/polypic | train | 1 |
0e7f094c3e2819b891604cf03a96e1c540f36f32 | [
"file_name = FileTools.add_extension(file_name, extension)\nf = open(f'{file_name}', 'w')\nf.write(content)\nf.close()\nreturn file_name",
"if file_name.endswith('.' + extension):\n return file_name\nelse:\n return file_name + '.' + extension"
] | <|body_start_0|>
file_name = FileTools.add_extension(file_name, extension)
f = open(f'{file_name}', 'w')
f.write(content)
f.close()
return file_name
<|end_body_0|>
<|body_start_1|>
if file_name.endswith('.' + extension):
return file_name
else:
... | Collection of methods to simplify working with files. | FileTools | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileTools:
"""Collection of methods to simplify working with files."""
def save_to_file(file_name: str, content: str, extension: str='ispl') -> str:
"""Saves file with the given name, content and extension :param file_name: name of the file :param content: content of the file :param ... | stack_v2_sparse_classes_75kplus_train_070073 | 1,101 | permissive | [
{
"docstring": "Saves file with the given name, content and extension :param file_name: name of the file :param content: content of the file :param extension: extension of the file :return: name of the created file",
"name": "save_to_file",
"signature": "def save_to_file(file_name: str, content: str, ex... | 2 | stack_v2_sparse_classes_30k_train_010209 | Implement the Python class `FileTools` described below.
Class description:
Collection of methods to simplify working with files.
Method signatures and docstrings:
- def save_to_file(file_name: str, content: str, extension: str='ispl') -> str: Saves file with the given name, content and extension :param file_name: nam... | Implement the Python class `FileTools` described below.
Class description:
Collection of methods to simplify working with files.
Method signatures and docstrings:
- def save_to_file(file_name: str, content: str, extension: str='ispl') -> str: Saves file with the given name, content and extension :param file_name: nam... | fc73fd50ad1ab6a36a6b4d6b1aec02c4bcd1b094 | <|skeleton|>
class FileTools:
"""Collection of methods to simplify working with files."""
def save_to_file(file_name: str, content: str, extension: str='ispl') -> str:
"""Saves file with the given name, content and extension :param file_name: name of the file :param content: content of the file :param ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileTools:
"""Collection of methods to simplify working with files."""
def save_to_file(file_name: str, content: str, extension: str='ispl') -> str:
"""Saves file with the given name, content and extension :param file_name: name of the file :param content: content of the file :param extension: ex... | the_stack_v2_python_sparse | stv/tools/file_tools.py | Ghalya22/stv | train | 0 |
802b140501e2e4fa4a08c5199ede2efb439cba17 | [
"dp = [i for i in range(n + 1)]\nsquares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]\nfor i in range(1, n + 1):\n for s in squares:\n if i < s:\n break\n dp[i] = min(dp[i], dp[i - s] + 1)\nreturn dp[-1]",
"visited = [False] * (n + 1)\nqueue = [n]\nsquares = {i: i ** 2 for i in rang... | <|body_start_0|>
dp = [i for i in range(n + 1)]
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
for i in range(1, n + 1):
for s in squares:
if i < s:
break
dp[i] = min(dp[i], dp[i - s] + 1)
return dp[-1]
<|end_body_0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numSquares(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numSquaresBFS(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [i for i in range(n + 1)]
squares = [i ** 2 for i in ra... | stack_v2_sparse_classes_75kplus_train_070074 | 1,657 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "numSquares",
"signature": "def numSquares(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "numSquaresBFS",
"signature": "def numSquaresBFS(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_022686 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n): :type n: int :rtype: int
- def numSquaresBFS(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numSquares(self, n): :type n: int :rtype: int
- def numSquaresBFS(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def numSquares(self, n):
""":t... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def numSquares(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def numSquaresBFS(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numSquares(self, n):
""":type n: int :rtype: int"""
dp = [i for i in range(n + 1)]
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
for i in range(1, n + 1):
for s in squares:
if i < s:
break
d... | the_stack_v2_python_sparse | cs_notes/BFS/perfect_squares.py | hwc1824/LeetCodeSolution | train | 0 | |
4bd26a9c2cfd415e14a474cbc9fed01debf6c186 | [
"question = '你喜欢什么?'\nmy_answer = Wenjuan(question)\nmy_answer.tj_answer('money')\nself.assertIn('money', my_answer.answers)",
"question = '你喜欢的是什么?'\nmy_answer = Wenjuan(question)\nanswers = ['money', 'big', 'full']\nfor answer in answers:\n my_answer.tj_answer(answer)\nfor answer in answers:\n self.assert... | <|body_start_0|>
question = '你喜欢什么?'
my_answer = Wenjuan(question)
my_answer.tj_answer('money')
self.assertIn('money', my_answer.answers)
<|end_body_0|>
<|body_start_1|>
question = '你喜欢的是什么?'
my_answer = Wenjuan(question)
answers = ['money', 'big', 'full']
... | 针对类的测试 | TestWenjuan | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestWenjuan:
"""针对类的测试"""
def test_show_question(self):
"""测试单个答案是否被存储成功"""
<|body_0|>
def test_three_answer(self):
"""测试多个答案是否都被存储"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
question = '你喜欢什么?'
my_answer = Wenjuan(question)
... | stack_v2_sparse_classes_75kplus_train_070075 | 776 | no_license | [
{
"docstring": "测试单个答案是否被存储成功",
"name": "test_show_question",
"signature": "def test_show_question(self)"
},
{
"docstring": "测试多个答案是否都被存储",
"name": "test_three_answer",
"signature": "def test_three_answer(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030953 | Implement the Python class `TestWenjuan` described below.
Class description:
针对类的测试
Method signatures and docstrings:
- def test_show_question(self): 测试单个答案是否被存储成功
- def test_three_answer(self): 测试多个答案是否都被存储 | Implement the Python class `TestWenjuan` described below.
Class description:
针对类的测试
Method signatures and docstrings:
- def test_show_question(self): 测试单个答案是否被存储成功
- def test_three_answer(self): 测试多个答案是否都被存储
<|skeleton|>
class TestWenjuan:
"""针对类的测试"""
def test_show_question(self):
"""测试单个答案是否被存储成功"... | 93fe784a3127e76995e9ae018605efbe78238385 | <|skeleton|>
class TestWenjuan:
"""针对类的测试"""
def test_show_question(self):
"""测试单个答案是否被存储成功"""
<|body_0|>
def test_three_answer(self):
"""测试多个答案是否都被存储"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestWenjuan:
"""针对类的测试"""
def test_show_question(self):
"""测试单个答案是否被存储成功"""
question = '你喜欢什么?'
my_answer = Wenjuan(question)
my_answer.tj_answer('money')
self.assertIn('money', my_answer.answers)
def test_three_answer(self):
"""测试多个答案是否都被存储"""
... | the_stack_v2_python_sparse | 学习笔记/yanzhengleifangfa.py | huangno27/learn | train | 0 |
6f5dd294ad55df4bafaf58136d7f79820b3dca5a | [
"if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nself.mst = None\nself.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))\nself.parent = dict(((node, None) for node in self.graph.iternodes()))\nself._in_queue = dict(((node, True) for node in self.g... | <|body_start_0|>
if graph.is_directed():
raise ValueError('the graph is directed')
self.graph = graph
self.mst = None
self.distance = dict(((node, float('inf')) for node in self.graph.iternodes()))
self.parent = dict(((node, None) for node in self.graph.iternodes()))
... | Prim's algorithm for finding a minimum spanning tree. The algorithm runs in O(V**2) time. It is suitable for dense graphs. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with nodes (MST) _in_queue : dict, private Examples -------- >... | PrimMatrixMST | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrimMatrixMST:
"""Prim's algorithm for finding a minimum spanning tree. The algorithm runs in O(V**2) time. It is suitable for dense graphs. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with nodes (MST) _in_... | stack_v2_sparse_classes_75kplus_train_070076 | 14,685 | permissive | [
{
"docstring": "The algorithm initialization. Parameters ---------- graph : undirected weighted graph or multigraph",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Finding MST.",
"name": "run",
"signature": "def run(self, source=None)"
},
{
"docs... | 3 | stack_v2_sparse_classes_30k_train_044852 | Implement the Python class `PrimMatrixMST` described below.
Class description:
Prim's algorithm for finding a minimum spanning tree. The algorithm runs in O(V**2) time. It is suitable for dense graphs. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with no... | Implement the Python class `PrimMatrixMST` described below.
Class description:
Prim's algorithm for finding a minimum spanning tree. The algorithm runs in O(V**2) time. It is suitable for dense graphs. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with no... | 0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60 | <|skeleton|>
class PrimMatrixMST:
"""Prim's algorithm for finding a minimum spanning tree. The algorithm runs in O(V**2) time. It is suitable for dense graphs. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with nodes (MST) _in_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrimMatrixMST:
"""Prim's algorithm for finding a minimum spanning tree. The algorithm runs in O(V**2) time. It is suitable for dense graphs. Attributes ---------- graph : input undirected weighted graph or multigraph mst : graph (MST) distance : dict with nodes parent : dict with nodes (MST) _in_queue : dict,... | the_stack_v2_python_sparse | graphtheory/spanningtrees/prim.py | kgashok/graphs-dict | train | 0 |
b4084bc0d7b769058e26c19c10430fffc3b2b790 | [
"super().__init__()\nself.finetuning = finetuning\nModel, Tokenizer, weight = LANG_MODELS[arch]\nbert = Model.from_pretrained(weight, output_hidden_states=True)\nif not pretrained:\n bert.init_weights()\nif not self.finetuning:\n for param in bert.parameters():\n param.requires_grad = False\nbackbone_d... | <|body_start_0|>
super().__init__()
self.finetuning = finetuning
Model, Tokenizer, weight = LANG_MODELS[arch]
bert = Model.from_pretrained(weight, output_hidden_states=True)
if not pretrained:
bert.init_weights()
if not self.finetuning:
for param i... | Sent_LangModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sent_LangModel:
def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False):
""":param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: f... | stack_v2_sparse_classes_75kplus_train_070077 | 11,314 | permissive | [
{
"docstring": ":param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model",
"name": "__init__",
"signature": "def __init__(self, dim, arch='BERT', layers=(-1,), p... | 2 | stack_v2_sparse_classes_30k_val_002298 | Implement the Python class `Sent_LangModel` described below.
Class description:
Implement the Sent_LangModel class.
Method signatures and docstrings:
- def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): :param dim: dimension of the output :param arch: backbone architecture, :param ... | Implement the Python class `Sent_LangModel` described below.
Class description:
Implement the Sent_LangModel class.
Method signatures and docstrings:
- def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): :param dim: dimension of the output :param arch: backbone architecture, :param ... | 51ac07d1de564c26fbf038b07031a55660bbcb27 | <|skeleton|>
class Sent_LangModel:
def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False):
""":param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Sent_LangModel:
def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False):
""":param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: finetune the mo... | the_stack_v2_python_sparse | retrieval_model/xmatching/model.py | CJJ2923/Maria | train | 0 | |
e4ceabb3c20504f422f05403c896f12c18adb84f | [
"self.config = json.load(open('faucet_config.json', 'r'))\nself.wallet = Wallet()\nself.wallet.generate_address_randomKey()\nit = iter(self.wallet.addresses)\nself.faucet_address = next(it)\nself.sent_transactions = {}",
"from_address = self.faucet_address\nif amount is None:\n amount = self.config['coins_to_s... | <|body_start_0|>
self.config = json.load(open('faucet_config.json', 'r'))
self.wallet = Wallet()
self.wallet.generate_address_randomKey()
it = iter(self.wallet.addresses)
self.faucet_address = next(it)
self.sent_transactions = {}
<|end_body_0|>
<|body_start_1|>
f... | Faucet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Faucet:
def __init__(self):
"""Constructor"""
<|body_0|>
def send_coins(self, to_address, amount=None):
"""Sends configurable amount of coins to the provided address :param to_address: :return:"""
<|body_1|>
def generate_transaction(self, from_address, t... | stack_v2_sparse_classes_75kplus_train_070078 | 3,085 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Sends configurable amount of coins to the provided address :param to_address: :return:",
"name": "send_coins",
"signature": "def send_coins(self, to_address, amount=None)"
},
{
... | 5 | stack_v2_sparse_classes_30k_val_001747 | Implement the Python class `Faucet` described below.
Class description:
Implement the Faucet class.
Method signatures and docstrings:
- def __init__(self): Constructor
- def send_coins(self, to_address, amount=None): Sends configurable amount of coins to the provided address :param to_address: :return:
- def generate... | Implement the Python class `Faucet` described below.
Class description:
Implement the Faucet class.
Method signatures and docstrings:
- def __init__(self): Constructor
- def send_coins(self, to_address, amount=None): Sends configurable amount of coins to the provided address :param to_address: :return:
- def generate... | acaee6b4ff3a60d1857119b02e74a1d5dc1d43f4 | <|skeleton|>
class Faucet:
def __init__(self):
"""Constructor"""
<|body_0|>
def send_coins(self, to_address, amount=None):
"""Sends configurable amount of coins to the provided address :param to_address: :return:"""
<|body_1|>
def generate_transaction(self, from_address, t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Faucet:
def __init__(self):
"""Constructor"""
self.config = json.load(open('faucet_config.json', 'r'))
self.wallet = Wallet()
self.wallet.generate_address_randomKey()
it = iter(self.wallet.addresses)
self.faucet_address = next(it)
self.sent_transactions ... | the_stack_v2_python_sparse | Faucet/faucet.py | tsonev85/BeerChainNetwork | train | 0 | |
577ae3925eac1b8ae72ec67fe6e5544791ca7674 | [
"if not graph:\n return False\nnode_sets = [set(), set()]\nvisited = [False] * len(graph)\nfor k in range(len(graph)):\n if visited[k]:\n continue\n queue = [[k, 0]]\n for i, set_idx in queue:\n alt_set_idx = (set_idx + 1) % 2\n this_set = node_sets[set_idx]\n alt_set = node_... | <|body_start_0|>
if not graph:
return False
node_sets = [set(), set()]
visited = [False] * len(graph)
for k in range(len(graph)):
if visited[k]:
continue
queue = [[k, 0]]
for i, set_idx in queue:
alt_set_idx ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBipartite_v1(self, graph: List[List[int]]) -> bool:
"""Use two sets to track two groups."""
<|body_0|>
def isBipartite_v2(self, graph: List[List[int]]) -> bool:
"""Use one color array to track two colors (0, 1)."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_75kplus_train_070079 | 3,413 | no_license | [
{
"docstring": "Use two sets to track two groups.",
"name": "isBipartite_v1",
"signature": "def isBipartite_v1(self, graph: List[List[int]]) -> bool"
},
{
"docstring": "Use one color array to track two colors (0, 1).",
"name": "isBipartite_v2",
"signature": "def isBipartite_v2(self, grap... | 2 | stack_v2_sparse_classes_30k_train_027294 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBipartite_v1(self, graph: List[List[int]]) -> bool: Use two sets to track two groups.
- def isBipartite_v2(self, graph: List[List[int]]) -> bool: Use one color array to tra... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBipartite_v1(self, graph: List[List[int]]) -> bool: Use two sets to track two groups.
- def isBipartite_v2(self, graph: List[List[int]]) -> bool: Use one color array to tra... | 97a2386f5e3adbd7138fd123810c3232bdf7f622 | <|skeleton|>
class Solution:
def isBipartite_v1(self, graph: List[List[int]]) -> bool:
"""Use two sets to track two groups."""
<|body_0|>
def isBipartite_v2(self, graph: List[List[int]]) -> bool:
"""Use one color array to track two colors (0, 1)."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isBipartite_v1(self, graph: List[List[int]]) -> bool:
"""Use two sets to track two groups."""
if not graph:
return False
node_sets = [set(), set()]
visited = [False] * len(graph)
for k in range(len(graph)):
if visited[k]:
... | the_stack_v2_python_sparse | python3/trees_and_graphs/bipartite_graph.py | victorchu/algorithms | train | 0 | |
2f8e94dd4de6db0b49673e27b220bd8d13830f0a | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn WorkbookFilter()",
"from .entity import Entity\nfrom .workbook_filter_criteria import WorkbookFilterCriteria\nfrom .entity import Entity\nfrom .workbook_filter_criteria import WorkbookFilterCriteria\nfields: Dict[str, Callable[[Any], N... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return WorkbookFilter()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .workbook_filter_criteria import WorkbookFilterCriteria
from .entity import Entity
from .... | WorkbookFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkbookFilter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter:
"""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 Retur... | stack_v2_sparse_classes_75kplus_train_070080 | 2,232 | 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: WorkbookFilter",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_valu... | 3 | stack_v2_sparse_classes_30k_train_044658 | Implement the Python class `WorkbookFilter` described below.
Class description:
Implement the WorkbookFilter class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: Creates a new instance of the appropriate class based on discriminator va... | Implement the Python class `WorkbookFilter` described below.
Class description:
Implement the WorkbookFilter class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter: Creates a new instance of the appropriate class based on discriminator va... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class WorkbookFilter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter:
"""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 Retur... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorkbookFilter:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> WorkbookFilter:
"""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: WorkbookFi... | the_stack_v2_python_sparse | msgraph/generated/models/workbook_filter.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
403e9ea96fbe85646a9b856d519ef02afda2cc45 | [
"def memoize(i, j):\n if i == 0:\n return 1\n if j == 0:\n return 1\n if cache[i][j] != 0:\n return cache[i][j]\n cache[i][j] = memoize(i, j - 1) + memoize(i - 1, j)\n return cache[i][j]\nif m <= 0 or n <= 0:\n return 0\ncache = [[0 for _ in range(n)] for _ in range(m)]\nretur... | <|body_start_0|>
def memoize(i, j):
if i == 0:
return 1
if j == 0:
return 1
if cache[i][j] != 0:
return cache[i][j]
cache[i][j] = memoize(i, j - 1) + memoize(i - 1, j)
return cache[i][j]
if m <= 0... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
"""状态转移方程:自顶向下 dp[m][n] = dp[m][n-1] + dp[m-1][n]"""
<|body_0|>
def uniquePaths1(self, m: int, n: int) -> int:
"""状态转移方程:自底向上 dp[m][n] = dp[m][n-1] + dp[m-1][n]"""
<|body_1|>
def uniquePaths2(self, ... | stack_v2_sparse_classes_75kplus_train_070081 | 3,174 | permissive | [
{
"docstring": "状态转移方程:自顶向下 dp[m][n] = dp[m][n-1] + dp[m-1][n]",
"name": "uniquePaths",
"signature": "def uniquePaths(self, m: int, n: int) -> int"
},
{
"docstring": "状态转移方程:自底向上 dp[m][n] = dp[m][n-1] + dp[m-1][n]",
"name": "uniquePaths1",
"signature": "def uniquePaths1(self, m: int, n: ... | 3 | stack_v2_sparse_classes_30k_train_008658 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m: int, n: int) -> int: 状态转移方程:自顶向下 dp[m][n] = dp[m][n-1] + dp[m-1][n]
- def uniquePaths1(self, m: int, n: int) -> int: 状态转移方程:自底向上 dp[m][n] = dp[m][n-1] + ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m: int, n: int) -> int: 状态转移方程:自顶向下 dp[m][n] = dp[m][n-1] + dp[m-1][n]
- def uniquePaths1(self, m: int, n: int) -> int: 状态转移方程:自底向上 dp[m][n] = dp[m][n-1] + ... | e8a1c6cae6547cbcb6e8494be6df685f3e7c837c | <|skeleton|>
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
"""状态转移方程:自顶向下 dp[m][n] = dp[m][n-1] + dp[m-1][n]"""
<|body_0|>
def uniquePaths1(self, m: int, n: int) -> int:
"""状态转移方程:自底向上 dp[m][n] = dp[m][n-1] + dp[m-1][n]"""
<|body_1|>
def uniquePaths2(self, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def uniquePaths(self, m: int, n: int) -> int:
"""状态转移方程:自顶向下 dp[m][n] = dp[m][n-1] + dp[m-1][n]"""
def memoize(i, j):
if i == 0:
return 1
if j == 0:
return 1
if cache[i][j] != 0:
return cache[i][j]
... | the_stack_v2_python_sparse | 62-unique-paths.py | yuenliou/leetcode | train | 0 | |
8a982a0f10b674c316a354fb7b8c85459aaeea5c | [
"self.stopping_criterion = stopping_criterion\nself.integrand = integrand\nself.measure = self.integrand.measure\nself.distribution = self.measure.distribution\nself.replications = replications\nself.muhat_r = zeros(int(self.replications))\nself.solution = nan\nself.muhat = inf\nself.sighat = inf\nself.t_eval = 0\n... | <|body_start_0|>
self.stopping_criterion = stopping_criterion
self.integrand = integrand
self.measure = self.integrand.measure
self.distribution = self.measure.distribution
self.replications = replications
self.muhat_r = zeros(int(self.replications))
self.solution... | Update and store mean and variance estimates with repliations. See the stopping criterion that utilize this object for references. | MeanVarDataRep | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeanVarDataRep:
"""Update and store mean and variance estimates with repliations. See the stopping criterion that utilize this object for references."""
def __init__(self, stopping_criterion, integrand, n_init, replications):
"""Args: stopping_criterion (StoppingCriterion): a Stoppin... | stack_v2_sparse_classes_75kplus_train_070082 | 2,622 | permissive | [
{
"docstring": "Args: stopping_criterion (StoppingCriterion): a StoppingCriterion instance integrand (Integrand): an Integrand instance n_init (int): initial number of samples replications (int): number of replications",
"name": "__init__",
"signature": "def __init__(self, stopping_criterion, integrand,... | 2 | stack_v2_sparse_classes_30k_train_050307 | Implement the Python class `MeanVarDataRep` described below.
Class description:
Update and store mean and variance estimates with repliations. See the stopping criterion that utilize this object for references.
Method signatures and docstrings:
- def __init__(self, stopping_criterion, integrand, n_init, replications)... | Implement the Python class `MeanVarDataRep` described below.
Class description:
Update and store mean and variance estimates with repliations. See the stopping criterion that utilize this object for references.
Method signatures and docstrings:
- def __init__(self, stopping_criterion, integrand, n_init, replications)... | 0ed9da2f10b9ac0004c993c01392b4c86002954c | <|skeleton|>
class MeanVarDataRep:
"""Update and store mean and variance estimates with repliations. See the stopping criterion that utilize this object for references."""
def __init__(self, stopping_criterion, integrand, n_init, replications):
"""Args: stopping_criterion (StoppingCriterion): a Stoppin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MeanVarDataRep:
"""Update and store mean and variance estimates with repliations. See the stopping criterion that utilize this object for references."""
def __init__(self, stopping_criterion, integrand, n_init, replications):
"""Args: stopping_criterion (StoppingCriterion): a StoppingCriterion in... | the_stack_v2_python_sparse | qmcpy/accumulate_data/mean_var_data_rep.py | kachiann/QMCSoftware | train | 1 |
bd5a610f6d333f4e87c846117f5d66e5d1ec6e81 | [
"ids = self.cur_devs.ids\nrail_cache = {dev.id: dev.cur_rail for dev in self.cur_devs}\nold_dev_ids = self.plan_infos.mapped('cur_train_id.id')\nitems = []\nlocation = self.env.user.cur_location\nuser_location_id = location.id\nexchange_rail1 = self.env['metro_park_base.rails_sec'].search([('alias', '=', '转换轨1'), (... | <|body_start_0|>
ids = self.cur_devs.ids
rail_cache = {dev.id: dev.cur_rail for dev in self.cur_devs}
old_dev_ids = self.plan_infos.mapped('cur_train_id.id')
items = []
location = self.env.user.cur_location
user_location_id = location.id
exchange_rail1 = self.env[... | 添加新的发车计划 | AddNewOutPlan | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddNewOutPlan:
"""添加新的发车计划"""
def on_change_cur_devs(self):
"""要据选择的设备添加具体的信息 :return:"""
<|body_0|>
def on_ok(self):
"""添加新的出车计划 :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ids = self.cur_devs.ids
rail_cache = {dev.id: dev.... | stack_v2_sparse_classes_75kplus_train_070083 | 4,758 | no_license | [
{
"docstring": "要据选择的设备添加具体的信息 :return:",
"name": "on_change_cur_devs",
"signature": "def on_change_cur_devs(self)"
},
{
"docstring": "添加新的出车计划 :return:",
"name": "on_ok",
"signature": "def on_ok(self)"
}
] | 2 | null | Implement the Python class `AddNewOutPlan` described below.
Class description:
添加新的发车计划
Method signatures and docstrings:
- def on_change_cur_devs(self): 要据选择的设备添加具体的信息 :return:
- def on_ok(self): 添加新的出车计划 :return: | Implement the Python class `AddNewOutPlan` described below.
Class description:
添加新的发车计划
Method signatures and docstrings:
- def on_change_cur_devs(self): 要据选择的设备添加具体的信息 :return:
- def on_ok(self): 添加新的出车计划 :return:
<|skeleton|>
class AddNewOutPlan:
"""添加新的发车计划"""
def on_change_cur_devs(self):
"""要据选... | 13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9 | <|skeleton|>
class AddNewOutPlan:
"""添加新的发车计划"""
def on_change_cur_devs(self):
"""要据选择的设备添加具体的信息 :return:"""
<|body_0|>
def on_ok(self):
"""添加新的出车计划 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AddNewOutPlan:
"""添加新的发车计划"""
def on_change_cur_devs(self):
"""要据选择的设备添加具体的信息 :return:"""
ids = self.cur_devs.ids
rail_cache = {dev.id: dev.cur_rail for dev in self.cur_devs}
old_dev_ids = self.plan_infos.mapped('cur_train_id.id')
items = []
location = self... | the_stack_v2_python_sparse | mdias_addons/metro_park_dispatch/models/add_new_out_plan.py | rezaghanimi/main_mdias | train | 0 |
45f6b3d60d9b2c70ac6b1db52dd450c3845fe8b2 | [
"gtid_list = list()\nfor gtid_item in str(gtid_set).split(','):\n gtid_item = str(gtid_item).replace('\\n', '').strip()\n tmp_list = gtid_item.split(':')\n server_id = tmp_list[0]\n for index in range(1, len(tmp_list)):\n id_range = tmp_list[index]\n if id_range.find('-') < 0:\n ... | <|body_start_0|>
gtid_list = list()
for gtid_item in str(gtid_set).split(','):
gtid_item = str(gtid_item).replace('\n', '').strip()
tmp_list = gtid_item.split(':')
server_id = tmp_list[0]
for index in range(1, len(tmp_list)):
id_range = tmp... | GtidHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GtidHelper:
def split_gtid_set(gtid_set):
"""将gtid set转换成gtid list, 如将5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca:1-4,e0a86c29-f20d-11e8-93c2-04b0e7954a65:10410:104934:104936-104938 拆分为:[('5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca', 1, 4), ('e0a86c29-f20d-11e8-93c2-04b0e7954a65', 10410, 10410), ('e0... | stack_v2_sparse_classes_75kplus_train_070084 | 2,937 | no_license | [
{
"docstring": "将gtid set转换成gtid list, 如将5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca:1-4,e0a86c29-f20d-11e8-93c2-04b0e7954a65:10410:104934:104936-104938 拆分为:[('5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca', 1, 4), ('e0a86c29-f20d-11e8-93c2-04b0e7954a65', 10410, 10410), ('e0a86c29-f20d-11e8-93c2-04b0e7954a65', 104934, 104934),... | 2 | stack_v2_sparse_classes_30k_train_020843 | Implement the Python class `GtidHelper` described below.
Class description:
Implement the GtidHelper class.
Method signatures and docstrings:
- def split_gtid_set(gtid_set): 将gtid set转换成gtid list, 如将5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca:1-4,e0a86c29-f20d-11e8-93c2-04b0e7954a65:10410:104934:104936-104938 拆分为:[('5aeb6d6... | Implement the Python class `GtidHelper` described below.
Class description:
Implement the GtidHelper class.
Method signatures and docstrings:
- def split_gtid_set(gtid_set): 将gtid set转换成gtid list, 如将5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca:1-4,e0a86c29-f20d-11e8-93c2-04b0e7954a65:10410:104934:104936-104938 拆分为:[('5aeb6d6... | f7bdf8b3f5c90ff71b884a2520f4d076a1033ef3 | <|skeleton|>
class GtidHelper:
def split_gtid_set(gtid_set):
"""将gtid set转换成gtid list, 如将5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca:1-4,e0a86c29-f20d-11e8-93c2-04b0e7954a65:10410:104934:104936-104938 拆分为:[('5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca', 1, 4), ('e0a86c29-f20d-11e8-93c2-04b0e7954a65', 10410, 10410), ('e0... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GtidHelper:
def split_gtid_set(gtid_set):
"""将gtid set转换成gtid list, 如将5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca:1-4,e0a86c29-f20d-11e8-93c2-04b0e7954a65:10410:104934:104936-104938 拆分为:[('5aeb6d6a-45a1-11ea-8a7e-080027b9d8ca', 1, 4), ('e0a86c29-f20d-11e8-93c2-04b0e7954a65', 10410, 10410), ('e0a86c29-f20d-11... | the_stack_v2_python_sparse | gtid_helper.py | gaogao67/mysql_master_ha | train | 1 | |
b72494013d0c70a7d2dac223a4b3851734505098 | [
"nonexistent_las = 'nonexistent.las'\nnonexistent_ply = 'nonexistent.ply'\nload(nonexistent_las, nonexistent_ply)\nload_las_mock.assert_called_once_with(nonexistent_las)",
"nonexistent_las = 'nonexistent.las'\nnonexistent_ply = 'nonexistent.ply'\nload(nonexistent_las, nonexistent_ply)\nwrite_ply_mock.assert_calle... | <|body_start_0|>
nonexistent_las = 'nonexistent.las'
nonexistent_ply = 'nonexistent.ply'
load(nonexistent_las, nonexistent_ply)
load_las_mock.assert_called_once_with(nonexistent_las)
<|end_body_0|>
<|body_start_1|>
nonexistent_las = 'nonexistent.las'
nonexistent_ply = 'n... | TestLoad | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLoad:
def test_load(self, load_las_mock, write_ply_mock):
"""Load module should call load_las to get the file."""
<|body_0|>
def test_write(self, load_las_mock, write_ply_mock):
"""Load module should call write_ply to get the file."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus_train_070085 | 1,251 | permissive | [
{
"docstring": "Load module should call load_las to get the file.",
"name": "test_load",
"signature": "def test_load(self, load_las_mock, write_ply_mock)"
},
{
"docstring": "Load module should call write_ply to get the file.",
"name": "test_write",
"signature": "def test_write(self, load... | 2 | stack_v2_sparse_classes_30k_train_031941 | Implement the Python class `TestLoad` described below.
Class description:
Implement the TestLoad class.
Method signatures and docstrings:
- def test_load(self, load_las_mock, write_ply_mock): Load module should call load_las to get the file.
- def test_write(self, load_las_mock, write_ply_mock): Load module should ca... | Implement the Python class `TestLoad` described below.
Class description:
Implement the TestLoad class.
Method signatures and docstrings:
- def test_load(self, load_las_mock, write_ply_mock): Load module should call load_las to get the file.
- def test_write(self, load_las_mock, write_ply_mock): Load module should ca... | 8053cf6f31a7e62b0c4d1d2586284c37da8f13fb | <|skeleton|>
class TestLoad:
def test_load(self, load_las_mock, write_ply_mock):
"""Load module should call load_las to get the file."""
<|body_0|>
def test_write(self, load_las_mock, write_ply_mock):
"""Load module should call write_ply to get the file."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestLoad:
def test_load(self, load_las_mock, write_ply_mock):
"""Load module should call load_las to get the file."""
nonexistent_las = 'nonexistent.las'
nonexistent_ply = 'nonexistent.ply'
load(nonexistent_las, nonexistent_ply)
load_las_mock.assert_called_once_with(non... | the_stack_v2_python_sparse | laserchicken/test_load.py | rubenvalpue/laserchicken | train | 0 | |
a1eadd59f41dec1e35d389eed1a18764c0330263 | [
"self.func = func\nself.x_min = x_min\nself.x_max = x_max\nself.x_interval = x_interval\nself.param_dict = param_dict\nself.series_name = series_name\nself.ci_func = ci_func",
"x_range = numpy.arange(self.x_min, self.x_max, self.x_interval)\nif log_scale:\n y_range = [math.log(self.func(x)) for x in x_range] i... | <|body_start_0|>
self.func = func
self.x_min = x_min
self.x_max = x_max
self.x_interval = x_interval
self.param_dict = param_dict
self.series_name = series_name
self.ci_func = ci_func
<|end_body_0|>
<|body_start_1|>
x_range = numpy.arange(self.x_min, self... | PlotFunc | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlotFunc:
def __init__(self, func, x_min=0, x_max=10, x_interval=1, param_dict={}, series_name='y', ci_func=None):
"""Args: func (lambda : (x --> y))"""
<|body_0|>
def plot(self, series_id=0, log_scale=False):
"""Args: series_id (int) log_scale (bool) use_legend (boo... | stack_v2_sparse_classes_75kplus_train_070086 | 3,840 | no_license | [
{
"docstring": "Args: func (lambda : (x --> y))",
"name": "__init__",
"signature": "def __init__(self, func, x_min=0, x_max=10, x_interval=1, param_dict={}, series_name='y', ci_func=None)"
},
{
"docstring": "Args: series_id (int) log_scale (bool) use_legend (bool) Summary: Make a basic plot, pas... | 2 | null | Implement the Python class `PlotFunc` described below.
Class description:
Implement the PlotFunc class.
Method signatures and docstrings:
- def __init__(self, func, x_min=0, x_max=10, x_interval=1, param_dict={}, series_name='y', ci_func=None): Args: func (lambda : (x --> y))
- def plot(self, series_id=0, log_scale=F... | Implement the Python class `PlotFunc` described below.
Class description:
Implement the PlotFunc class.
Method signatures and docstrings:
- def __init__(self, func, x_min=0, x_max=10, x_interval=1, param_dict={}, series_name='y', ci_func=None): Args: func (lambda : (x --> y))
- def plot(self, series_id=0, log_scale=F... | 212dfe4a2360eaf80f907dbe4aaf3d158d0d44ef | <|skeleton|>
class PlotFunc:
def __init__(self, func, x_min=0, x_max=10, x_interval=1, param_dict={}, series_name='y', ci_func=None):
"""Args: func (lambda : (x --> y))"""
<|body_0|>
def plot(self, series_id=0, log_scale=False):
"""Args: series_id (int) log_scale (bool) use_legend (boo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlotFunc:
def __init__(self, func, x_min=0, x_max=10, x_interval=1, param_dict={}, series_name='y', ci_func=None):
"""Args: func (lambda : (x --> y))"""
self.func = func
self.x_min = x_min
self.x_max = x_max
self.x_interval = x_interval
self.param_dict = param_d... | the_stack_v2_python_sparse | func_plotting.py | apragupta/IB_SA_simple_rl | train | 0 | |
d67b74109768d9e365b61646f3162ea5ebbd4307 | [
"initial = []\nfor prefix in result:\n description, objects = result[prefix]\n initial += [{'prefix': prefix, 'description': description, 'objects': ', '.join(objects)}]\nAddAddressFormSet = formset_factory(self.AddAddressForm, extra=0, can_delete=True)\nformset = AddAddressFormSet(initial=initial)\nreturn se... | <|body_start_0|>
initial = []
for prefix in result:
description, objects = result[prefix]
initial += [{'prefix': prefix, 'description': description, 'objects': ', '.join(objects)}]
AddAddressFormSet = formset_factory(self.AddAddressForm, extra=0, can_delete=True)
... | Route import application | RouteImportAppplication | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RouteImportAppplication:
"""Route import application"""
def render_result(self, request, result):
"""Display form with imported data :param request: :param result: :return:"""
<|body_0|>
def view_submit(self, request):
"""Submit imported data :param request: :ret... | stack_v2_sparse_classes_75kplus_train_070087 | 5,449 | permissive | [
{
"docstring": "Display form with imported data :param request: :param result: :return:",
"name": "render_result",
"signature": "def render_result(self, request, result)"
},
{
"docstring": "Submit imported data :param request: :return:",
"name": "view_submit",
"signature": "def view_subm... | 2 | stack_v2_sparse_classes_30k_train_054190 | Implement the Python class `RouteImportAppplication` described below.
Class description:
Route import application
Method signatures and docstrings:
- def render_result(self, request, result): Display form with imported data :param request: :param result: :return:
- def view_submit(self, request): Submit imported data... | Implement the Python class `RouteImportAppplication` described below.
Class description:
Route import application
Method signatures and docstrings:
- def render_result(self, request, result): Display form with imported data :param request: :param result: :return:
- def view_submit(self, request): Submit imported data... | 2ab0ab7718bb7116da2c3953efd466757e11d9ce | <|skeleton|>
class RouteImportAppplication:
"""Route import application"""
def render_result(self, request, result):
"""Display form with imported data :param request: :param result: :return:"""
<|body_0|>
def view_submit(self, request):
"""Submit imported data :param request: :ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RouteImportAppplication:
"""Route import application"""
def render_result(self, request, result):
"""Display form with imported data :param request: :param result: :return:"""
initial = []
for prefix in result:
description, objects = result[prefix]
initial ... | the_stack_v2_python_sparse | ip/apps/routeimport/views.py | DreamerDDL/noc | train | 0 |
d64f1531904cd18f62496545a8b0f020a4d220c8 | [
"self.sensor = sensor\nself.pump = pump\nself.decider = decider\nself.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}",
"try:\n self.pump.set_state(self.decider.decide(self.sensor.measure(), self.pump.get_state(), self.actions))\nexcept TypeError:\n return False\nre... | <|body_start_0|>
self.sensor = sensor
self.pump = pump
self.decider = decider
self.actions = {'PUMP_IN': pump.PUMP_IN, 'PUMP_OUT': pump.PUMP_OUT, 'PUMP_OFF': pump.PUMP_OFF}
<|end_body_0|>
<|body_start_1|>
try:
self.pump.set_state(self.decider.decide(self.sensor.measu... | Encapsulates command and coordination for the water-regulation module | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
"""Encapsulates command and coordination for the water-regulation module"""
def __init__(self, sensor, pump, decider):
"""Create a new controller"""
<|body_0|>
def tick(self):
"""On each call to tick, the controller shall: 1. query the sensor for the ... | stack_v2_sparse_classes_75kplus_train_070088 | 1,365 | no_license | [
{
"docstring": "Create a new controller",
"name": "__init__",
"signature": "def __init__(self, sensor, pump, decider)"
},
{
"docstring": "On each call to tick, the controller shall: 1. query the sensor for the current height of liquid in the tank 2. query the pump for its current state (pumping ... | 2 | stack_v2_sparse_classes_30k_train_052535 | Implement the Python class `Controller` described below.
Class description:
Encapsulates command and coordination for the water-regulation module
Method signatures and docstrings:
- def __init__(self, sensor, pump, decider): Create a new controller
- def tick(self): On each call to tick, the controller shall: 1. quer... | Implement the Python class `Controller` described below.
Class description:
Encapsulates command and coordination for the water-regulation module
Method signatures and docstrings:
- def __init__(self, sensor, pump, decider): Create a new controller
- def tick(self): On each call to tick, the controller shall: 1. quer... | b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1 | <|skeleton|>
class Controller:
"""Encapsulates command and coordination for the water-regulation module"""
def __init__(self, sensor, pump, decider):
"""Create a new controller"""
<|body_0|>
def tick(self):
"""On each call to tick, the controller shall: 1. query the sensor for the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Controller:
"""Encapsulates command and coordination for the water-regulation module"""
def __init__(self, sensor, pump, decider):
"""Create a new controller"""
self.sensor = sensor
self.pump = pump
self.decider = decider
self.actions = {'PUMP_IN': pump.PUMP_IN, 'P... | the_stack_v2_python_sparse | students/MicahBraun/Lesson 6/water-regulation/waterregulation/controller.py | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | train | 4 |
86550f24bab8ba49d549dc3b09d1bf7f6a33cb93 | [
"if method == 'every_visit':\n return self.MC_every_vist(alpha)\nelif method == 'first_visit':\n return self.MC_first_visit()\nelse:\n return 'The method given is not valid'",
"counts = dict.fromkeys(self.states_list, 0)\nvalue_function = dict.fromkeys(self.states_list, 0)\nfor episode in self.episodes_d... | <|body_start_0|>
if method == 'every_visit':
return self.MC_every_vist(alpha)
elif method == 'first_visit':
return self.MC_first_visit()
else:
return 'The method given is not valid'
<|end_body_0|>
<|body_start_1|>
counts = dict.fromkeys(self.states_li... | Derived class of RL class to implemente Monte-Carlo learning in Model-Free prediction. MC requires complete episodes. @param episodes_data list List of episodes of type dict((state, action, time_step) : (next_state, reward)) Sequence of episodes | MC | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MC:
"""Derived class of RL class to implemente Monte-Carlo learning in Model-Free prediction. MC requires complete episodes. @param episodes_data list List of episodes of type dict((state, action, time_step) : (next_state, reward)) Sequence of episodes"""
def get_value_function_estimate(self... | stack_v2_sparse_classes_75kplus_train_070089 | 3,936 | no_license | [
{
"docstring": "Estimation of state value function using Monte-Carlo incremental update. @param[in] method str Whether every-visit or first-visit method. @param[in] alpha float Learning rate between [0,1].",
"name": "get_value_function_estimate",
"signature": "def get_value_function_estimate(self, metho... | 3 | stack_v2_sparse_classes_30k_test_002614 | Implement the Python class `MC` described below.
Class description:
Derived class of RL class to implemente Monte-Carlo learning in Model-Free prediction. MC requires complete episodes. @param episodes_data list List of episodes of type dict((state, action, time_step) : (next_state, reward)) Sequence of episodes
Meth... | Implement the Python class `MC` described below.
Class description:
Derived class of RL class to implemente Monte-Carlo learning in Model-Free prediction. MC requires complete episodes. @param episodes_data list List of episodes of type dict((state, action, time_step) : (next_state, reward)) Sequence of episodes
Meth... | 58aa921b61d19a7e7e708813eb4b5ccc951898a2 | <|skeleton|>
class MC:
"""Derived class of RL class to implemente Monte-Carlo learning in Model-Free prediction. MC requires complete episodes. @param episodes_data list List of episodes of type dict((state, action, time_step) : (next_state, reward)) Sequence of episodes"""
def get_value_function_estimate(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MC:
"""Derived class of RL class to implemente Monte-Carlo learning in Model-Free prediction. MC requires complete episodes. @param episodes_data list List of episodes of type dict((state, action, time_step) : (next_state, reward)) Sequence of episodes"""
def get_value_function_estimate(self, method, alp... | the_stack_v2_python_sparse | code/RL/prediction/MC.py | greedythib/cme241-thibaudb | train | 0 |
90071782505b333fc8a404df4e139a34af8af9f7 | [
"runningSumList = dict()\nrunningSumList[0] = 1\nrunningSum = 0\ncount = 0\nfor item in nums:\n runningSum += item\n count += runningSumList.get(runningSum - k, 0)\n runningSumList[runningSum] = runningSumList.get(runningSum, 0) + 1\nreturn count",
"runningSum = 0\nN = 0\nrunningList = [0]\nfor item in n... | <|body_start_0|>
runningSumList = dict()
runningSumList[0] = 1
runningSum = 0
count = 0
for item in nums:
runningSum += item
count += runningSumList.get(runningSum - k, 0)
runningSumList[runningSum] = runningSumList.get(runningSum, 0) + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def subarraySumN2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
runningSumL... | stack_v2_sparse_classes_75kplus_train_070090 | 2,155 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "subarraySum",
"signature": "def subarraySum(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: int",
"name": "subarraySumN2",
"signature": "def subarraySumN2(self, nums, k)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def subarraySumN2(self, nums, k): :type nums: List[int] :type k: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subarraySum(self, nums, k): :type nums: List[int] :type k: int :rtype: int
- def subarraySumN2(self, nums, k): :type nums: List[int] :type k: int :rtype: int
<|skeleton|>
cl... | 035d760182094cf4a6ad44a9112bea4dcb8d58c1 | <|skeleton|>
class Solution:
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_0|>
def subarraySumN2(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def subarraySum(self, nums, k):
""":type nums: List[int] :type k: int :rtype: int"""
runningSumList = dict()
runningSumList[0] = 1
runningSum = 0
count = 0
for item in nums:
runningSum += item
count += runningSumList.get(running... | the_stack_v2_python_sparse | SubarraySumEqualsK.py | jingtaisong/LeetCodePython | train | 0 | |
44660b0d3693e2d32dc6452cbe31cc794502553b | [
"self.add_summary_images()\nsummary_writer = tf.summary.FileWriter(log + '/train', graph=self.sess.graph)\nmerged_summaries = self.summarise_model()\nif test_record is not None:\n merged_test_summaries = self.summarise_model(train=False)\n summary_test_writer = tf.summary.FileWriter(log + '/test', graph=self.... | <|body_start_0|>
self.add_summary_images()
summary_writer = tf.summary.FileWriter(log + '/train', graph=self.sess.graph)
merged_summaries = self.summarise_model()
if test_record is not None:
merged_test_summaries = self.summarise_model(train=False)
summary_test_wr... | SegmentationSummaries | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegmentationSummaries:
def setup_summary(self, log, test_record):
"""Creates tensorflow summary writters that will write their output to log. And if test_record is given write also the test metrics. Args: log: string, where to writte the summaries. test_record: string, if not none will p... | stack_v2_sparse_classes_75kplus_train_070091 | 3,644 | permissive | [
{
"docstring": "Creates tensorflow summary writters that will write their output to log. And if test_record is given write also the test metrics. Args: log: string, where to writte the summaries. test_record: string, if not none will prepare the test summary writter. Returns: The summary tensorflow object and t... | 3 | null | Implement the Python class `SegmentationSummaries` described below.
Class description:
Implement the SegmentationSummaries class.
Method signatures and docstrings:
- def setup_summary(self, log, test_record): Creates tensorflow summary writters that will write their output to log. And if test_record is given write al... | Implement the Python class `SegmentationSummaries` described below.
Class description:
Implement the SegmentationSummaries class.
Method signatures and docstrings:
- def setup_summary(self, log, test_record): Creates tensorflow summary writters that will write their output to log. And if test_record is given write al... | 9af94854a662d9529ca6f4bb774bf2603a434a3a | <|skeleton|>
class SegmentationSummaries:
def setup_summary(self, log, test_record):
"""Creates tensorflow summary writters that will write their output to log. And if test_record is given write also the test metrics. Args: log: string, where to writte the summaries. test_record: string, if not none will p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SegmentationSummaries:
def setup_summary(self, log, test_record):
"""Creates tensorflow summary writters that will write their output to log. And if test_record is given write also the test metrics. Args: log: string, where to writte the summaries. test_record: string, if not none will prepare the tes... | the_stack_v2_python_sparse | segmentation_net/segmentation_class/segmentation_summaries.py | PeterJackNaylor/segmentation_net | train | 0 | |
e8ecf3a65a14aaa3e31e1c6d74db17afadde32b2 | [
"super().__init__(n_inducing_points=n_inducing_points, n_random_samples=n_random_samples, n_parameters=1, correlations=False, name_prefix=name_prefix, **kwargs)\nself.likelihood = CauchyLikelihood\nself._learn_scale_shift = False",
"with torch.no_grad():\n Xmean, Xvariance = self._get_input(X)\nn_dims = Xmean.... | <|body_start_0|>
super().__init__(n_inducing_points=n_inducing_points, n_random_samples=n_random_samples, n_parameters=1, correlations=False, name_prefix=name_prefix, **kwargs)
self.likelihood = CauchyLikelihood
self._learn_scale_shift = False
<|end_body_0|>
<|body_start_1|>
with torch.... | GP-Cauchy recalibration method for regression uncertainty calibration that consumes an uncalibrated Gaussian distribution but converts it to a calibrated Cauchy distribution. This method uses a Gaussian process (GP) for a flexible estimation of the recalibration parameter (cf. [1]_). Similar to :class:`netcal.regressio... | GPCauchy | [
"MPL-2.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GPCauchy:
"""GP-Cauchy recalibration method for regression uncertainty calibration that consumes an uncalibrated Gaussian distribution but converts it to a calibrated Cauchy distribution. This method uses a Gaussian process (GP) for a flexible estimation of the recalibration parameter (cf. [1]_).... | stack_v2_sparse_classes_75kplus_train_070092 | 10,091 | permissive | [
{
"docstring": "Constructor. For detailed parameter description, see class docs.",
"name": "__init__",
"signature": "def __init__(self, n_inducing_points: int=12, n_random_samples: int=128, *, name_prefix: str='gpcauchy', **kwargs)"
},
{
"docstring": "Transform the given stddev to a distribution... | 2 | stack_v2_sparse_classes_30k_train_009296 | Implement the Python class `GPCauchy` described below.
Class description:
GP-Cauchy recalibration method for regression uncertainty calibration that consumes an uncalibrated Gaussian distribution but converts it to a calibrated Cauchy distribution. This method uses a Gaussian process (GP) for a flexible estimation of ... | Implement the Python class `GPCauchy` described below.
Class description:
GP-Cauchy recalibration method for regression uncertainty calibration that consumes an uncalibrated Gaussian distribution but converts it to a calibrated Cauchy distribution. This method uses a Gaussian process (GP) for a flexible estimation of ... | 45bebd15c873ae399348b8148eb2ea5c89254d27 | <|skeleton|>
class GPCauchy:
"""GP-Cauchy recalibration method for regression uncertainty calibration that consumes an uncalibrated Gaussian distribution but converts it to a calibrated Cauchy distribution. This method uses a Gaussian process (GP) for a flexible estimation of the recalibration parameter (cf. [1]_).... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GPCauchy:
"""GP-Cauchy recalibration method for regression uncertainty calibration that consumes an uncalibrated Gaussian distribution but converts it to a calibrated Cauchy distribution. This method uses a Gaussian process (GP) for a flexible estimation of the recalibration parameter (cf. [1]_). Similar to :... | the_stack_v2_python_sparse | netcal/regression/gp/GPCauchy.py | EFS-OpenSource/calibration-framework | train | 79 |
64560331438594658b32b78d71c110f7649592a6 | [
"if type(skills) is not dict:\n raise serializers.ValidationError(f'skills must be object with key -> skill any value ')\nelse:\n return skills",
"user = self.context['request'].user\nif user.account_type not in [users_constants.USER_ACCOUNT_TYPE_ORGANIZATION, users_constants.USER_ACCOUNT_TYPE_HIRER]:\n ... | <|body_start_0|>
if type(skills) is not dict:
raise serializers.ValidationError(f'skills must be object with key -> skill any value ')
else:
return skills
<|end_body_0|>
<|body_start_1|>
user = self.context['request'].user
if user.account_type not in [users_const... | RecruiterVacanciesSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RecruiterVacanciesSerializer:
def validate_skills(skills):
"""Набор навыков должен быть объектом. :param skills: :return:"""
<|body_0|>
def create(self, validated_data):
"""При создании вакансии проставляется создавший ее пользователь. Вакансии может создавать только... | stack_v2_sparse_classes_75kplus_train_070093 | 7,268 | no_license | [
{
"docstring": "Набор навыков должен быть объектом. :param skills: :return:",
"name": "validate_skills",
"signature": "def validate_skills(skills)"
},
{
"docstring": "При создании вакансии проставляется создавший ее пользователь. Вакансии может создавать только пользоваетль стипом аккаунта '__HI... | 2 | stack_v2_sparse_classes_30k_train_042712 | Implement the Python class `RecruiterVacanciesSerializer` described below.
Class description:
Implement the RecruiterVacanciesSerializer class.
Method signatures and docstrings:
- def validate_skills(skills): Набор навыков должен быть объектом. :param skills: :return:
- def create(self, validated_data): При создании ... | Implement the Python class `RecruiterVacanciesSerializer` described below.
Class description:
Implement the RecruiterVacanciesSerializer class.
Method signatures and docstrings:
- def validate_skills(skills): Набор навыков должен быть объектом. :param skills: :return:
- def create(self, validated_data): При создании ... | aa36e7de1e84ab40ff1c2d35ae95602408d3035e | <|skeleton|>
class RecruiterVacanciesSerializer:
def validate_skills(skills):
"""Набор навыков должен быть объектом. :param skills: :return:"""
<|body_0|>
def create(self, validated_data):
"""При создании вакансии проставляется создавший ее пользователь. Вакансии может создавать только... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RecruiterVacanciesSerializer:
def validate_skills(skills):
"""Набор навыков должен быть объектом. :param skills: :return:"""
if type(skills) is not dict:
raise serializers.ValidationError(f'skills must be object with key -> skill any value ')
else:
return skills... | the_stack_v2_python_sparse | vacancies/serializers.py | McMayday/Marketplace | train | 0 | |
600fb6e7f7b30b17903933e01785f6081a15ae99 | [
"now = __dt__.now()\nnow = str(now)\nnow = '[@' + now + ']: '\nreturn now",
"message = str(Log.timestamp()) + msg\nif print_msg is True:\n print(str(Log.timestamp()), msg)\nreturn message"
] | <|body_start_0|>
now = __dt__.now()
now = str(now)
now = '[@' + now + ']: '
return now
<|end_body_0|>
<|body_start_1|>
message = str(Log.timestamp()) + msg
if print_msg is True:
print(str(Log.timestamp()), msg)
return message
<|end_body_1|>
| Log | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Log:
def timestamp(self=None):
"""Returns the current time and date with lots of precision. Args: self(NoneType): unused parameter that does absolutely nothing. (default None) Returns: str: string describing the current time and date."""
<|body_0|>
def msg(msg=None, print_ms... | stack_v2_sparse_classes_75kplus_train_070094 | 2,667 | permissive | [
{
"docstring": "Returns the current time and date with lots of precision. Args: self(NoneType): unused parameter that does absolutely nothing. (default None) Returns: str: string describing the current time and date.",
"name": "timestamp",
"signature": "def timestamp(self=None)"
},
{
"docstring"... | 2 | stack_v2_sparse_classes_30k_train_014022 | Implement the Python class `Log` described below.
Class description:
Implement the Log class.
Method signatures and docstrings:
- def timestamp(self=None): Returns the current time and date with lots of precision. Args: self(NoneType): unused parameter that does absolutely nothing. (default None) Returns: str: string... | Implement the Python class `Log` described below.
Class description:
Implement the Log class.
Method signatures and docstrings:
- def timestamp(self=None): Returns the current time and date with lots of precision. Args: self(NoneType): unused parameter that does absolutely nothing. (default None) Returns: str: string... | 53a5dc2d1006ada20911f672daf2e3827296a4fd | <|skeleton|>
class Log:
def timestamp(self=None):
"""Returns the current time and date with lots of precision. Args: self(NoneType): unused parameter that does absolutely nothing. (default None) Returns: str: string describing the current time and date."""
<|body_0|>
def msg(msg=None, print_ms... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Log:
def timestamp(self=None):
"""Returns the current time and date with lots of precision. Args: self(NoneType): unused parameter that does absolutely nothing. (default None) Returns: str: string describing the current time and date."""
now = __dt__.now()
now = str(now)
now = ... | the_stack_v2_python_sparse | qbitkit/error/error.py | qbitkit/qbitkit | train | 5 | |
2328ea021016837fb5391277e2d0e8bc9a646ad8 | [
"if len(lists) == 0:\n return []\nif len(lists) == 1:\n return lists[0]\nmerge_node = ListNode(0)\nresult = merge_node\nnode_list = []\nfor node in lists:\n while node:\n node_list.append(node.val)\n node = node.next\nnode_list.sort()\nwhile node_list:\n merge_node.next = ListNode(node_lis... | <|body_start_0|>
if len(lists) == 0:
return []
if len(lists) == 1:
return lists[0]
merge_node = ListNode(0)
result = merge_node
node_list = []
for node in lists:
while node:
node_list.append(node.val)
nod... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists: [ListNode]) -> ListNode:
"""将所有元素取出来放在列表中排序再逐个添加至新链表 :param lists: :return:"""
<|body_0|>
def showNode(self, node: ListNode) -> list:
"""show all value of ListNode :param node: :return:"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_75kplus_train_070095 | 3,032 | no_license | [
{
"docstring": "将所有元素取出来放在列表中排序再逐个添加至新链表 :param lists: :return:",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists: [ListNode]) -> ListNode"
},
{
"docstring": "show all value of ListNode :param node: :return:",
"name": "showNode",
"signature": "def showNode(self, node: Li... | 2 | stack_v2_sparse_classes_30k_train_053174 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists: [ListNode]) -> ListNode: 将所有元素取出来放在列表中排序再逐个添加至新链表 :param lists: :return:
- def showNode(self, node: ListNode) -> list: show all value of ListNode :pa... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists: [ListNode]) -> ListNode: 将所有元素取出来放在列表中排序再逐个添加至新链表 :param lists: :return:
- def showNode(self, node: ListNode) -> list: show all value of ListNode :pa... | fa45cd44c3d4e7b0205833efcdc708d1638cbbe4 | <|skeleton|>
class Solution:
def mergeKLists(self, lists: [ListNode]) -> ListNode:
"""将所有元素取出来放在列表中排序再逐个添加至新链表 :param lists: :return:"""
<|body_0|>
def showNode(self, node: ListNode) -> list:
"""show all value of ListNode :param node: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeKLists(self, lists: [ListNode]) -> ListNode:
"""将所有元素取出来放在列表中排序再逐个添加至新链表 :param lists: :return:"""
if len(lists) == 0:
return []
if len(lists) == 1:
return lists[0]
merge_node = ListNode(0)
result = merge_node
node_list... | the_stack_v2_python_sparse | Python/t23.py | g-lyc/LeetCode | train | 15 | |
e3c88a6465c474fd5f106c0862951b9ed13c632c | [
"b = d.lower()\nif b == 'chrome' or b == 'c':\n option = webdriver.ChromeOptions()\n option.add_argument('disable-infobars')\n option.add_argument('--window-size=' + x + ',' + y)\n driver = webdriver.Chrome(chrome_options=option, executable_path=chrome_path)\n print('driver=chrome')\nelif b == 'firef... | <|body_start_0|>
b = d.lower()
if b == 'chrome' or b == 'c':
option = webdriver.ChromeOptions()
option.add_argument('disable-infobars')
option.add_argument('--window-size=' + x + ',' + y)
driver = webdriver.Chrome(chrome_options=option, executable_path=chr... | browserdriver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class browserdriver:
def brower_driver(d='chrome', x=x, y=y):
""":param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver"""
<|body_0|>
def brower_driver_no_gui(d='chrom... | stack_v2_sparse_classes_75kplus_train_070096 | 4,122 | no_license | [
{
"docstring": ":param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver",
"name": "brower_driver",
"signature": "def brower_driver(d='chrome', x=x, y=y)"
},
{
"docstring": "工具方法,无界面操作... | 2 | stack_v2_sparse_classes_30k_train_013491 | Implement the Python class `browserdriver` described below.
Class description:
Implement the browserdriver class.
Method signatures and docstrings:
- def brower_driver(d='chrome', x=x, y=y): :param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值... | Implement the Python class `browserdriver` described below.
Class description:
Implement the browserdriver class.
Method signatures and docstrings:
- def brower_driver(d='chrome', x=x, y=y): :param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值... | 1e2ed4aa169cbe8d19f6aecc5cf8d96b274eea4d | <|skeleton|>
class browserdriver:
def brower_driver(d='chrome', x=x, y=y):
""":param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver"""
<|body_0|>
def brower_driver_no_gui(d='chrom... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class browserdriver:
def brower_driver(d='chrome', x=x, y=y):
""":param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver"""
b = d.lower()
if b == 'chrome' or b == 'c':
... | the_stack_v2_python_sparse | object/brower_driver.py | q739369242/webUItest | train | 1 | |
da302379e1510589f43ac90cc4faf9af97f6fe46 | [
"try:\n super().clean()\nexcept ValidationError as e:\n if 'Enter a valid URL.' not in str(e):\n raise e",
"for allowed_uri in self.redirect_uris.split():\n if fnmatch(uri, allowed_uri):\n return True\nreturn False"
] | <|body_start_0|>
try:
super().clean()
except ValidationError as e:
if 'Enter a valid URL.' not in str(e):
raise e
<|end_body_0|>
<|body_start_1|>
for allowed_uri in self.redirect_uris.split():
if fnmatch(uri, allowed_uri):
retu... | Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs. This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used in production and local development. | StagingApplication | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StagingApplication:
"""Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs. This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used in production and local development."""
def clean(self):
"""Validate model fields. O... | stack_v2_sparse_classes_75kplus_train_070097 | 1,308 | no_license | [
{
"docstring": "Validate model fields. Overrides this method to ignore URL format errors so we can support wildcards.",
"name": "clean",
"signature": "def clean(self)"
},
{
"docstring": "Check whether or not `uri` is a valid redirect_uri using wildcard matching.",
"name": "redirect_uri_allow... | 2 | null | Implement the Python class `StagingApplication` described below.
Class description:
Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs. This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used in production and local development.
Method signatures an... | Implement the Python class `StagingApplication` described below.
Class description:
Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs. This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used in production and local development.
Method signatures an... | 95eaa3fd6ea362d8583c277abb1975fbbe25c58a | <|skeleton|>
class StagingApplication:
"""Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs. This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used in production and local development."""
def clean(self):
"""Validate model fields. O... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StagingApplication:
"""Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs. This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used in production and local development."""
def clean(self):
"""Validate model fields. Overrides this... | the_stack_v2_python_sparse | dandiapi/api/models/oauth.py | dandi/dandi-archive | train | 13 |
4531302889252776345ebf63ca0c94bf352152a7 | [
"super(rdma_core, self).__init__(**kwargs)\nself.__baseurl = kwargs.pop('baseurl', 'https://github.com/linux-rdma/rdma-core/archive')\nself.__default_repository = 'https://github.com/linux-rdma/rdma-core.git'\nself.__ospackages = kwargs.pop('ospackages', [])\nself.__prefix = kwargs.pop('prefix', '/usr/local/rdma-co... | <|body_start_0|>
super(rdma_core, self).__init__(**kwargs)
self.__baseurl = kwargs.pop('baseurl', 'https://github.com/linux-rdma/rdma-core/archive')
self.__default_repository = 'https://github.com/linux-rdma/rdma-core.git'
self.__ospackages = kwargs.pop('ospackages', [])
self.__p... | The `rdma_core` building block configures, builds, and installs the [RDMA Core](https://github.com/linux-rdma/rdma-core) component. The [CMake](#cmake) building block should be installed prior to this building block. # Parameters annotate: Boolean flag to specify whether to include annotations (labels). The default is ... | rdma_core | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class rdma_core:
"""The `rdma_core` building block configures, builds, and installs the [RDMA Core](https://github.com/linux-rdma/rdma-core) component. The [CMake](#cmake) building block should be installed prior to this building block. # Parameters annotate: Boolean flag to specify whether to include ... | stack_v2_sparse_classes_75kplus_train_070098 | 9,309 | permissive | [
{
"docstring": "Initialize building block",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Based on the Linux distribution, set values accordingly. A user specified value overrides any defaults.",
"name": "__distro",
"signature": "def __distro(self)"
... | 4 | stack_v2_sparse_classes_30k_train_016697 | Implement the Python class `rdma_core` described below.
Class description:
The `rdma_core` building block configures, builds, and installs the [RDMA Core](https://github.com/linux-rdma/rdma-core) component. The [CMake](#cmake) building block should be installed prior to this building block. # Parameters annotate: Bool... | Implement the Python class `rdma_core` described below.
Class description:
The `rdma_core` building block configures, builds, and installs the [RDMA Core](https://github.com/linux-rdma/rdma-core) component. The [CMake](#cmake) building block should be installed prior to this building block. # Parameters annotate: Bool... | 60fd2a51c171258a6b3f93c2523101cb7018ba1b | <|skeleton|>
class rdma_core:
"""The `rdma_core` building block configures, builds, and installs the [RDMA Core](https://github.com/linux-rdma/rdma-core) component. The [CMake](#cmake) building block should be installed prior to this building block. # Parameters annotate: Boolean flag to specify whether to include ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class rdma_core:
"""The `rdma_core` building block configures, builds, and installs the [RDMA Core](https://github.com/linux-rdma/rdma-core) component. The [CMake](#cmake) building block should be installed prior to this building block. # Parameters annotate: Boolean flag to specify whether to include annotations (... | the_stack_v2_python_sparse | hpccm/building_blocks/rdma_core.py | NVIDIA/hpc-container-maker | train | 419 |
60c13a34616c0cec74a1fc963ab431056b44bbe8 | [
"if scheduler != 'PNDM':\n raise ValueError(f'Inpainting only supports PNDM scheduler')\nsuper(InpaintPipeline, self).__init__(*args, **kwargs, inpaint=True, scheduler=scheduler, stages=['vae_encoder', 'clip', 'unet', 'vae'])",
"batch_size = len(prompt)\nassert len(prompt) == len(negative_prompt)\nlatent_heigh... | <|body_start_0|>
if scheduler != 'PNDM':
raise ValueError(f'Inpainting only supports PNDM scheduler')
super(InpaintPipeline, self).__init__(*args, **kwargs, inpaint=True, scheduler=scheduler, stages=['vae_encoder', 'clip', 'unet', 'vae'])
<|end_body_0|>
<|body_start_1|>
batch_size =... | Application showcasing the acceleration of Stable Diffusion Inpainting v1.5, v2.0 pipeline using NVidia TensorRT w/ Plugins. | InpaintPipeline | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"ISC",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InpaintPipeline:
"""Application showcasing the acceleration of Stable Diffusion Inpainting v1.5, v2.0 pipeline using NVidia TensorRT w/ Plugins."""
def __init__(self, scheduler='PNDM', *args, **kwargs):
"""Initializes the Inpainting Diffusion pipeline. Args: scheduler (str): The sche... | stack_v2_sparse_classes_75kplus_train_070099 | 4,835 | permissive | [
{
"docstring": "Initializes the Inpainting Diffusion pipeline. Args: scheduler (str): The scheduler to guide the denoising process. Must be one of the [PNDM].",
"name": "__init__",
"signature": "def __init__(self, scheduler='PNDM', *args, **kwargs)"
},
{
"docstring": "Run the diffusion pipeline.... | 2 | stack_v2_sparse_classes_30k_train_045693 | Implement the Python class `InpaintPipeline` described below.
Class description:
Application showcasing the acceleration of Stable Diffusion Inpainting v1.5, v2.0 pipeline using NVidia TensorRT w/ Plugins.
Method signatures and docstrings:
- def __init__(self, scheduler='PNDM', *args, **kwargs): Initializes the Inpai... | Implement the Python class `InpaintPipeline` described below.
Class description:
Application showcasing the acceleration of Stable Diffusion Inpainting v1.5, v2.0 pipeline using NVidia TensorRT w/ Plugins.
Method signatures and docstrings:
- def __init__(self, scheduler='PNDM', *args, **kwargs): Initializes the Inpai... | a167852705d74bcc619d8fad0af4b9e4d84472fc | <|skeleton|>
class InpaintPipeline:
"""Application showcasing the acceleration of Stable Diffusion Inpainting v1.5, v2.0 pipeline using NVidia TensorRT w/ Plugins."""
def __init__(self, scheduler='PNDM', *args, **kwargs):
"""Initializes the Inpainting Diffusion pipeline. Args: scheduler (str): The sche... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InpaintPipeline:
"""Application showcasing the acceleration of Stable Diffusion Inpainting v1.5, v2.0 pipeline using NVidia TensorRT w/ Plugins."""
def __init__(self, scheduler='PNDM', *args, **kwargs):
"""Initializes the Inpainting Diffusion pipeline. Args: scheduler (str): The scheduler to guid... | the_stack_v2_python_sparse | demo/Diffusion/inpaint_pipeline.py | NVIDIA/TensorRT | train | 8,026 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.