Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the following code snippet before the placeholder: <|code_start|> def refresh_info(self): self.info = self.fetch_info() return self.info def commit_info(self): if self.info: self.cache.upload_single( self.meta.join(self.mesh_path, 'info'), jsonify(self.info), conten...
return self.info['@type'] == 'neuroglancer_multilod_draco'
Predict the next line for this snippet: <|code_start|>CredentialType = Dict[str,Union[str,int]] CredentialCacheType = Dict[str,CredentialType] PROJECT_NAME = default_google_project_name() GOOGLE_CREDENTIALS_CACHE:CredentialCacheType = {} google_credentials_path = secretpath('secrets/google-secret.json') def google_cr...
break
Continue the code snippet: <|code_start|> secretpath('project_name') ] def default_google_project_name(): if 'GOOGLE_PROJECT_NAME' in os.environ: return os.environ['GOOGLE_PROJECT_NAME'] else: for path in project_name_paths: if os.path.exists(path): with open(path, 'r') as f: ret...
if bucket in GOOGLE_CREDENTIALS_CACHE.keys():
Given snippet: <|code_start|> # NOTE: Plugins are registered in __init__.py # Set the interpreter bool try: INTERACTIVE = bool(sys.ps1) except AttributeError: INTERACTIVE = bool(sys.flags.interactive) REGISTERED_PLUGINS = {} def register_plugin(key, creation_function): REGISTERED_PLUGINS[key.lower()] = creati...
CacheType = Union[bool,str]
Next line prediction: <|code_start|> # NOTE: Plugins are registered in __init__.py # Set the interpreter bool try: INTERACTIVE = bool(sys.ps1) except AttributeError: <|code_end|> . Use current file imports: (import sys import time import multiprocessing as mp import numpy as np from typing import Optional, Union ...
INTERACTIVE = bool(sys.flags.interactive)
Predict the next line for this snippet: <|code_start|> # NOTE: Plugins are registered in __init__.py # Set the interpreter bool try: INTERACTIVE = bool(sys.ps1) except AttributeError: INTERACTIVE = bool(sys.flags.interactive) <|code_end|> with the help of current file imports: import sys import time import mu...
REGISTERED_PLUGINS = {}
Continue the code snippet: <|code_start|> return os.path.join( self._path.basepath, self._path.layer, file_path ) def put_file( self, file_path, content, content_type, compress, cache_control=None ): path = self.get_path_to_file(file_path) mkdir(os.path.dirname(path)) # keep...
f.write(content)
Given the following code snippet before the placeholder: <|code_start|> with open(path, 'wb') as f: f.write(content) def get_file(self, file_path, start=None, end=None): path = self.get_path_to_file(file_path) if os.path.exists(path + '.gz'): encoding = "gzip" path += '.gz' elif...
path = self.get_path_to_file(file_path)
Using the snippet: <|code_start|> def __exit__(self, exception_type, exception_value, traceback): self.release_connection() class FileInterface(StorageInterface): def __init__(self, path): super(StorageInterface, self).__init__() self._path = path def get_path_to_file(self, file_path): return os....
and type(content) is str:
Continue the code snippet: <|code_start|> if sys.version_info < (3,): integer_types = (int, long, np.integer) string_types = (str, basestring, unicode) else: integer_types = (int, np.integer) string_types = (str,) floating_types = (float, np.floating) COLORS = { 'RESET': "\033[m", 'YELLOW': "\033[1;93m"...
'RED': '\033[1;91m',
Here is a snippet: <|code_start|> ExtractedPath = namedtuple('ExtractedPath', ('format', 'protocol', 'bucket', 'basepath', 'no_bucket_basepath', 'dataset', 'layer') ) ALLOWED_PROTOCOLS = cloudfiles.paths.ALLOWED_PROTOCOLS ALLOWED_FORMATS = [ 'graphene', 'precomputed', 'boss' ] <|code_end|> . Write the next line...
def cloudpath_error(cloudpath):
Predict the next line for this snippet: <|code_start|> retry = tenacity.retry( reraise=True, stop=tenacity.stop_after_attempt(7), wait=tenacity.wait_random_exponential(0.5, 60.0), <|code_end|> with the help of current file imports: from six.moves import queue as Queue from functools import partial from goog...
)
Continue the code snippet: <|code_start|> NOTICE = { 'vertices': 0, 'num_vertices': 0, 'faces': 0, } def deprecation_notice(key): <|code_end|> . Use current file imports: import copy import re import struct import numpy as np import DracoPy import vtk from .exceptions import MeshDecodeError from .li...
if NOTICE[key] < 1:
Next line prediction: <|code_start|> # normal_vector_map = np.vectorize(lambda idx: normals[idx]) # eff_normals = normal_vector_map(uniq_idx) return Mesh(eff_verts, eff_faces, None, segid=self.segid, encoding_type=copy.deepcopy(self.encoding_type), encoding_options=copy.deepcopy(self.enco...
Actual Bytes: {}
Given the following code snippet before the placeholder: <|code_start|> # normal_vector_map = np.vectorize(lambda idx: normals[idx]) # eff_normals = normal_vector_map(uniq_idx) return Mesh(eff_verts, eff_faces, None, segid=self.segid, encoding_type=copy.deepcopy(self.encoding_type), encod...
Actual Bytes: {}
Next line prediction: <|code_start|> assert a.chunks == a2.chunks @pytest.mark.skipif(sys.version_info[0] < 3, reason="Python 2 not supported.") def test_roundtrip_4d_channel_rechunked(): da = pytest.importorskip('dask.array') du = pytest.importorskip('dask.utils') a = da.random.randint(100, size=(3, 3, 3, 3)...
du = pytest.importorskip('dask.utils')
Given snippet: <|code_start|> lru[i] = i assert 0 < lru.nbytes <= small_int_bytes * base_size for i in range(100): lru[i] = i assert 0 < lru.nbytes <= small_int_bytes * base_size assert len(lru) == 5 lru.resize(size * 2) for i in range(5): lru[i] = i assert 0 < lru.nbytes <= small_int_bytes ...
def test_lru_chaos():
Given snippet: <|code_start|> self.info = self.default_info() @property def spatial_index(self): if 'spatial_index' in self.info: return self.info['spatial_index'] return None @property def skeleton_path(self): if 'skeletons' in self.meta.info: return self.meta.info['skeletons']...
return self.meta.join(*paths)
Given the following code snippet before the placeholder: <|code_start|> def test_create_campaign(): campaign = models.Campaign('test') campaign.put() <|code_end|> , predict the next line using imports from the current file: import time from mothership import models and context including class names, funct...
assert campaign.id > 0
Given the code snippet: <|code_start|> class CampaignForm(Form): name = StringField('Name', validators=[validators.required()]) executable_name = StringField('Executable Name', validators=[validators.required()], default='executable') executable_args = StringField('Executable Args', default='@@') afl_args = Strin...
check_validate = super().validate()
Predict the next line after this snippet: <|code_start|> return 'Campaign already has a master', 400 instance = models.FuzzerInstance.create(hostname=hostname, master=True) instance.start_time = time.time() campaign.fuzzers.append(instance) campaign.commit() # avoid all hosts uploading at the same time from...
instance.commit()
Here is a snippet: <|code_start|> copy.desired_fuzzers = size copy.has_dictionary = original.has_dictionary copy.executable_name = original.executable_name copy.executable_args = original.executable_args copy.afl_args = original.afl_args copy.parent_id = original.id copy.put() dir = os.path.join(...
return redirect(url_for('campaigns.delete', campaign_id=campaign_id))
Predict the next line for this snippet: <|code_start|> def get_ldd(campaign_model): env = dict(os.environ) if 'LD_LIBRARY_PATH' in env: env['LD_LIBRARY_PATH'] = ':' + env['LD_LIBRARY_PATH'] else: env['LD_LIBRARY_PATH'] = '' env['LD_LIBRARY_PATH'] = os.path.join(current_app.config['DATA_DIRECTORY'], secure_file...
ldd_row = (parts[0], 'danger', 'Not Found')
Next line prediction: <|code_start|> return redirect(url_for('campaigns.campaign', campaign_id=original.id)) else: return render_template('make-tests.html', campaign=original, form=form) @campaigns.route('/campaigns/<int:campaign_id>', methods=['GET', 'POST']) def campaign(campaign_id): campaign_model = models.Ca...
child.put()
Given snippet: <|code_start|> if form.executable.has_file(): form.executable.data.save(os.path.join(dir, 'executable')) elif other: shutil.copy(os.path.join(other, 'executable'), os.path.join(dir, 'executable')) for config_files in ['libraries', 'testcases', 'ld_preload']: dest = os.path.join(dir, config...
return redirect(request.args.get('next') or url_for('campaigns.campaign', campaign_id=model.id))
Predict the next line after this snippet: <|code_start|> child.put() if 'deactivate_children' in request.form: for child in campaign_model.children: child.active = False child.put() if 'delete_children' in request.form: for child in campaign_model.children: delete_campaign(child) if 'reset_ch...
'PROBABLY_NOT_EXPLOITABLE': 3},
Given the code snippet: <|code_start|> def test_davidson(): np.random.seed(0) dim = 1000 A = np.diag(np.arange(dim,dtype=np.float64)) A[1:3,1:3] = 0 <|code_end|> , generate the next line using the imports in this file: import numpy as np from mmd.utils.davidson import davidson and context (functions...
M = np.random.randn(dim,dim)
Based on the snippet: <|code_start|> x, y = reshape_data(x, y) data_scaler = StandardScaler() x = data_scaler.fit_transform(x) lda = LDA() lda.fit(x, y) coef = lda.scalings_ * lda.coef_[:1].T channels = [] fbins = [] for c in range(n_channels): fbins.extend(range(n_fbins)) ...
plt.bar(range(0, n_fbins), abs(coef[i * n_fbins:i * n_fbins + n_fbins]))
Given the code snippet: <|code_start|> channels = [] fbins = [] for c in range(n_channels): fbins.extend(range(n_fbins)) # 0- delta, 1- theta ... channels.extend([c] * n_fbins) if plot: fig = plt.figure() for i in range(n_channels): if n_channels == 24: ...
def predict(subject, model, data_scaler, data_path, submission_path, test_labels, opt_threshold_train):
Based on the snippet: <|code_start|> def __init__(self, rng, input, nkerns, recept_width, pool_width, stride, training_mode, dropout_prob, activation, weights_variance, n_channels, n_timesteps, n_fbins, global_pooling): self.layer0 = ConvPoolLayer(rng, input=input, ...
training_mode=training_mode,
Given the code snippet: <|code_start|> class FeatureExtractor(object): def __init__(self, rng, input, nkerns, recept_width, pool_width, stride, training_mode, dropout_prob, activation, weights_variance, n_channels, n_timesteps, n_fbins, global_pooling): self.layer0 = ConvPoolLayer(rng, inp...
self.glob_pool = GlobalPoolLayer(self.layer1.output)
Using the snippet: <|code_start|> x_train = np.concatenate(x_train, axis=3) x_train = np.rollaxis(x_train, axis=3) y_train = np.array(y_train) x_valid = [x[..., np.newaxis] for x in x_valid] x_valid = np.concatenate(x_valid, axis=3) x_valid = np.rollaxis(x_valid, axis=3) ...
def run_trainer():
Continue the code snippet: <|code_start|> def predict(model, x_test, n_test_examples, n_timesteps): pred_1m = model.predict_proba(x_test)[:, 1] pred_10m = np.reshape(pred_1m, (n_test_examples, n_timesteps)) pred_10m = np.mean(pred_10m, axis=1) return pred_10m def cross_validate(subject, data_path, re...
for i in train_indexes:
Continue the code snippet: <|code_start|> def curve_per_subject(subject, data_path, test_labels): d = load_train_data(data_path, subject) x, y_10m = d['x'], d['y'] n_train_examples = x.shape[0] n_timesteps = x.shape[-1] print 'n_preictal', np.sum(y_10m) print 'n_inetrictal', np.sum(y_10m - 1)...
data_scaler = StandardScaler()
Predict the next line after this snippet: <|code_start|> def curve_per_subject(subject, data_path, test_labels): d = load_train_data(data_path, subject) x, y_10m = d['x'], d['y'] <|code_end|> using the current file's imports: import numpy as np import json import os import matplotlib.pyplot as plt import p...
n_train_examples = x.shape[0]
Next line prediction: <|code_start|> d = load_test_data(data_path, subject) x_test, id = d['x'], d['id'] n_test_examples = x_test.shape[0] n_timesteps = x_test.shape[3] x_test = reshape_data(x_test) x_test = data_scaler.transform(x_test) pred_1m = model.predict_proba(x_test)[:, 1] pred...
if not os.path.exists(data_path):
Given the code snippet: <|code_start|> def train(subject, data_path, reg_C=None): d = load_train_data(data_path, subject) x, y = d['x'], d['y'] x, y = reshape_data(x, y) data_scaler = StandardScaler() x = data_scaler.fit_transform(x) lda = LogisticRegression(C=reg_C) lda.fit(x, y) retur...
return pred_10m
Continue the code snippet: <|code_start|> def merge_csv_files(submission_path, subjects, submission_name): print subjects with open(submission_path + '/' + submission_name + '.csv', 'wb') as f: writer = csv.writer(f) writer.writerow(['clip', 'preictal']) <|code_end|> . Use current file imports...
for subject in subjects:
Given snippet: <|code_start|> if 'test' in raw_file_path or 'holdout' in raw_file_path: sequence = np.Inf else: sequence = d[sample][0][0][4][0][0] new_sampling_frequency = 400 new_x = filter(x, new_sampling_frequency, data_length_sec, lowcut, highcut) data_dict = {'data': new_x, 'd...
for subject in subjects:
Given snippet: <|code_start|>"""Abstract Handler with helper methods.""" log = logging.getLogger('handler') class CursorKindException(TypeError): """When a child node of a VAR_DECL is parsed as an initialization value, when its not actually part of that initiwlization value.""" <|code_end|> , continue by ...
pass
Predict the next line after this snippet: <|code_start|> elif literal_kind == CursorKind.STRING_LITERAL: return [TypeKind.CHAR16, TypeKind.CHAR32, TypeKind.CHAR_S, TypeKind.SCHAR, TypeKind.WCHAR] # DEBUG elif literal_kind == CursorKind.CHARACTER_LITERAL: retur...
return True
Predict the next line after this snippet: <|code_start|> # logging.basicConfig(level=logging.DEBUG) class StringConstantsTest(ClangTest): """Tests some string variations. """ def test_char(self): self.convert(""" char x = 'x'; <|code_end|> using the current file's imports: import loggi...
char zero = 0;
Next line prediction: <|code_start|> # include source file location in comments generate_locations: bool = False # do not include declaration defined outside of the source files filter_location: bool = True # dll to be loaded before all others (to resolve symbols) preloaded_dlls: list = [] # ...
self.filter_location = not options.generate_includes
Here is a snippet: <|code_start|> class CodegenConfig: # symbol to include, if empty, everything will be included symbols: list = [] # regular expression for symbols to include expressions: list = [] # verbose output verbose: bool = False # include source doxygen-style comments generat...
types: list = []
Predict the next line after this snippet: <|code_start|> int first; int last; }; struct example { int argsz; int flags; int count; struct example_detail details[2]; }; ''') self.assertIn("i", py_namespace) self.assertIn("c2", py_namespace) self.assertIn("s...
int argsz;
Based on the snippet: <|code_start|> def run(args): if hasattr(subprocess, 'run'): p = subprocess.run(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, stderr = p.stdout.decode(), p.stderr.decode() return p, output, stderr else: p = subprocess...
output, stderr = p.communicate()
Using the snippet: <|code_start|> for _ in range(3): for i in range(size*multiplier, size*(multiplier+1)): self.assertEqual(time, func(i)) def test_on_purge(self): test_index = 1 purges = [] @lru_cache(on_purge=lambda index: purges...
self.assertEqual(size, len(func._cache))
Predict the next line for this snippet: <|code_start|>######## # Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
'level': 'INFO',
Given the following code snippet before the placeholder: <|code_start|>######## # Copyright (c) 2013 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Lice...
def setUpClass(cls):
Next line prediction: <|code_start|> self.keeper = gate_keeper.GateKeeper( with_gate_keeper=True, gate_keeper_bucket_size=self.bucket_size, worker=mock.Mock()) def tearDown(self): for q in self.keeper._current.values(): self.assertTrue(q.empty()) ...
self.requests.append(request)
Based on the snippet: <|code_start|> def test_put_new_property_twice(self): node = NodeInstance('instance_id', 'node_id') node.put('key', 'value') node.put('key', 'v') self.assertEqual('v', node.get('key')) props = node.runtime_properties self.assertEqual(1, len(props...
runtime_properties={'preexisting-key': 'val'})
Given the code snippet: <|code_start|> node = NodeInstance('instance_id', 'node_id') node.put('key', 'value') node.put('key', 'v') self.assertEqual('v', node.get('key')) props = node.runtime_properties self.assertEqual(1, len(props)) self.assertEqual('v', props['ke...
del(node['preexisting-key'])
Based on the snippet: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
super(TestLoggingServer, self).setUp()
Using the snippet: <|code_start|> def test_disabled(self): server = self._start_server(enable=False) self.assertIsNone(server.logging_server) self.assertIsNone(server.socket_url) def test_handler_cache_size(self): num_loggers = 7 cache_size = 3 server = self._star...
self.assertIsNotNone(server_handler.stream)
Predict the next line after this snippet: <|code_start|> raise NotImplementedError() def get_resource(self, resource_path): with open(os.path.join(self.resources_root, resource_path)) as f: return f.read() def download_resource(self, resource_path, target_path=None): if not ...
instance['version'] += 1
Next line prediction: <|code_start|> workflow, workflow_name, parameters, allow_custom_parameters) return dispatch.dispatch(__cloudify_context=ctx, **merged_parameters) def init_env(blueprint_path, name='local', inputs=None, storage=None, ignored...
resolver=resolver)
Predict the next line after this snippet: <|code_start|> if not self.closed: logger.warning('Error raised during record processing', exc_info=True) def close(self): if not self.closed: self.closed = True self.sock...
@staticmethod
Continue the code snippet: <|code_start|> if not self.closed: logger.warning('Error raised during record processing', exc_info=True) def close(self): if not self.closed: self.closed = True self.socket.close() ...
@staticmethod
Predict the next line for this snippet: <|code_start|># you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License...
return None
Given snippet: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
with open(conf_file_path) as conf_handle:
Using the snippet: <|code_start|> options = '' # BROKER_URL is held in the config to avoid the password appearing # in ps listings URL_TEMPLATE = \ 'amqp://{username}:{password}@{hostname}:{port}/{vhost}{options}' if config.get('cluster'): BROKER_URL = ';'.join(URL_TEMPLATE.format(username=broker_username, ...
BROKER_URL += ';'
Predict the next line after this snippet: <|code_start|> self.sock.bind(self.socket_url) self.poller = zmq.Poller() self.poller.register(self.sock, zmq.POLLIN) def poll_and_process(self, timeout=1): state = dict(self.poller.poll(1000 * timeout)).get(self.sock) if not state ==...
port = port or get_unused_port()
Given the following code snippet before the placeholder: <|code_start|> class PathDictAccess(object): pattern = re.compile("(.+)\[(\d+)\]") def __init__(self, obj): self.obj = obj def set(self, prop_path, value): obj, prop_name = self._get_parent_obj_prop_name_by_path(prop_path) o...
current = current[property_name][index]
Continue the code snippet: <|code_start|> test_event = _event('cloudify_log', level='DEBUG') self.assertFalse(test_event.has_output) test_event = _event('cloudify_log', level='DEBUG', verbosity_level=event.MEDIUM_VERBOSE) self.assertTrue(test_event.has_output) ...
message=message,
Given the code snippet: <|code_start|> self.assertEqual(test_event.text, message) causes = [] test_event = _event('cloudify_event', event_type='task_failed', message=message, causes=causes) self.assertEqua...
causes=causes,
Continue the code snippet: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
target=None):
Predict the next line for this snippet: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
tenant=None,
Next line prediction: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
max_retries=3,
Based on the snippet: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache...
tenant=None,
Predict the next line after this snippet: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
max_retries=3,
Given the following code snippet before the placeholder: <|code_start|>######## # Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Lice...
tenant=None,
Predict the next line for this snippet: <|code_start|> # from slugify import slugify_url TOPIC_ID = "topic" LINK_ID = "link" class Topic(Object, RenderedTextMixin): __mapper_args__ = { 'polymorphic_identity': TOPIC_ID <|code_end|> with the help of current file imports: from beavy.models.object import O...
}
Given the following code snippet before the placeholder: <|code_start|> # from slugify import slugify_url TOPIC_ID = "topic" LINK_ID = "link" class Topic(Object, RenderedTextMixin): __mapper_args__ = { <|code_end|> , predict the next line using imports from the current file: from beavy.models.object import Obje...
'polymorphic_identity': TOPIC_ID
Using the snippet: <|code_start|> # from slugify import slugify_url TOPIC_ID = "topic" LINK_ID = "link" class Topic(Object, RenderedTextMixin): __mapper_args__ = { 'polymorphic_identity': TOPIC_ID } title = PayloadProperty('title') text = PayloadProperty('text') CAPABILITIES = [Object.C...
__mapper_args__ = {
Next line prediction: <|code_start|> def before_scenario(context, scenario): benv.before_scenario(context, scenario) context.personas = ensure_personas() def after_scenario(context, scenario): if getattr(context, "browser", None): has_warnings = False for entry in context.browser.driver....
has_warnings = True
Predict the next line after this snippet: <|code_start|># import os log = logging.Logger(__name__) BEHAVE_DEBUG_ON_ERROR = not os.getenv("CI", False) BEHAVE_ERROR_ON_BROWSER_WARNINGS = os.getenv("BEHAVE_ERROR_ON_BROWSER_WARNINGS", not BEHAVE_DEBUG_ON_ERROR) # noqa def before_all(context): context.default_bro...
context.default_browser_size = (1280, 1024)
Here is a snippet: <|code_start|># import os log = logging.Logger(__name__) BEHAVE_DEBUG_ON_ERROR = not os.getenv("CI", False) BEHAVE_ERROR_ON_BROWSER_WARNINGS = os.getenv("BEHAVE_ERROR_ON_BROWSER_WARNINGS", not BEHAVE_DEBUG_ON_ERROR) # noqa def before_all(context): context.default_browser = os.getenv("BEHAV...
def after_all(context):
Using the snippet: <|code_start|># , Schema, fields class PrivateMessageSchema(Schema): id = fields.Integer() created_at = fields.DateTime() <|code_end|> , determine the next line of code. You have imports: from beavy.common.paging_schema import makePaginationSchema from beavy.schemas.object import ObjectFi...
title = fields.String()
Using the snippet: <|code_start|># , Schema, fields class PrivateMessageSchema(Schema): id = fields.Integer() created_at = fields.DateTime() title = fields.String() type = fields.String(attribute="discriminator") <|code_end|> , determine the next line of code. You have imports: from beavy.common.pa...
class Meta:
Given snippet: <|code_start|> COMMENT_ID = "comment" class CommentObject(Object, RenderedTextMixin): __mapper_args__ = { 'polymorphic_identity': COMMENT_ID } CAPABILITIES = [Object.Capabilities.listed_for_activity] in_reply_to_id = db.Column(db.Integer, db.ForeignKey("objects.id"), ...
return
Given the code snippet: <|code_start|> COMMENT_ID = "comment" class CommentObject(Object, RenderedTextMixin): __mapper_args__ = { 'polymorphic_identity': COMMENT_ID } CAPABILITIES = [Object.Capabilities.listed_for_activity] in_reply_to_id = db.Column(db.Integer, db.ForeignKey("objects.id"), ...
nullable=True)
Using the snippet: <|code_start|> COMMENT_ID = "comment" class CommentObject(Object, RenderedTextMixin): __mapper_args__ = { 'polymorphic_identity': COMMENT_ID } CAPABILITIES = [Object.Capabilities.listed_for_activity] in_reply_to_id = db.Column(db.Integer, db.ForeignKey("objects.id"), ...
cls.owner_id == current_user.id)
Predict the next line for this snippet: <|code_start|># from marshmallow import Schema, fields # class BaseLike(Schema): # subject = fields.Nested(BaseUser) # created_at = fields.DateTime() # ActivityField.registry['like'] = BaseLike class UserLike(Schema): id = fields.Integer() created_at = field...
return item
Predict the next line for this snippet: <|code_start|># from marshmallow import Schema, fields # class BaseLike(Schema): # subject = fields.Nested(BaseUser) # created_at = fields.DateTime() # ActivityField.registry['like'] = BaseLike class UserLike(Schema): id = fields.Integer() created_at = field...
for key in self.REMAP_TUPLE_KEYS:
Given the code snippet: <|code_start|># , Schema, fields class CommentSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") text = fields.String(attribute='cooked') belongs_to_id = fields.Integer() ...
url_kwargs={'user_id': '<owner_id>'},
Here is a snippet: <|code_start|># , Schema, fields class CommentSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") text = fields.String(attribute='cooked') belongs_to_id = fields.Integer() in_re...
comment = CommentSchema()
Given snippet: <|code_start|># , Schema, fields class CommentSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") text = fields.String(attribute='cooked') belongs_to_id = fields.Integer() <|code_end|> ...
in_reply_to_id = fields.Integer()
Given snippet: <|code_start|># , Schema, fields class CommentSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") <|code_end|> , continue by predicting the next line. Consider current file imports: from beavy...
text = fields.String(attribute='cooked')
Using the snippet: <|code_start|> class TopicSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") title = fields.String(attribute='title') slug = fields.String(attribute='slug') text = fields.String(...
type = fields.String(attribute="discriminator")
Predict the next line for this snippet: <|code_start|># , Schema, fields class TopicSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") title = fields.String(attribute='title') slug = fields.String(at...
class Meta:
Based on the snippet: <|code_start|># , Schema, fields class TopicSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") title = fields.String(attribute='title') slug = fields.String(attribute='slug') ...
type_='user')
Using the snippet: <|code_start|>class TopicSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") title = fields.String(attribute='title') slug = fields.String(attribute='slug') text = fields.String(at...
slug = fields.String(attribute='slug')
Given the code snippet: <|code_start|># , Schema, fields class TopicSchema(Schema): id = fields.Integer() created_at = fields.DateTime() owner_id = fields.Integer() type = fields.String(attribute="discriminator") title = fields.String(attribute='title') slug = fields.String(attribute='slug') ...
class Meta:
Based on the snippet: <|code_start|> # Define models roles_users = db.Table('roles_users', db.Column('user_id', db.Integer(), db.ForeignKey('user.id'), <|code_end|> , predict the immediate next line with the help of imports: from ...
nullable=False),
Given the code snippet: <|code_start|> class ObjectQuery(AccessQuery): def by_capability(self, aborting=True, abort_code=404, *caps): caps = set(chain.from_iterable(map(lambda c: getattr(Object.TypesForCapability, ...
my_activities = aliased(Activity.query.filter(
Given the following code snippet before the placeholder: <|code_start|> class ObjectQuery(AccessQuery): def by_capability(self, aborting=True, abort_code=404, *caps): caps = set(chain.from_iterable(map(lambda c: getattr(Object.TypesForCapability, ...
if aborting:
Given snippet: <|code_start|> PM_ID = "private_message" # Define models PMParticipants = db.Table('{}_participants'.format(PM_ID), db.Column('user_id', db.Integer(), db.ForeignKey(User.id), <|code_end|> , continue by pr...
nullable=False),
Predict the next line for this snippet: <|code_start|> PM_ID = "private_message" # Define models PMParticipants = db.Table('{}_participants'.format(PM_ID), db.Column('user_id', db.Integer(), db.ForeignKey(User.id), ...
lazy='dynamic'))
Next line prediction: <|code_start|> PM_ID = "private_message" # Define models PMParticipants = db.Table('{}_participants'.format(PM_ID), db.Column('user_id', db.Integer(), db.ForeignKey(User.id), ...
nullable=False))
Based on the snippet: <|code_start|> PM_ID = "private_message" # Define models PMParticipants = db.Table('{}_participants'.format(PM_ID), db.Column('user_id', db.Integer(), db.ForeignKey(User.id), <|code_end|> , predict...
nullable=False),