Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Given snippet: <|code_start|># -*- coding: utf-8 -*-
handler404 = 'app.views.error_views.not_found_404'
handler400 = 'app.views.error_views.bad_request_400'
handler403 = 'app.views.error_views.permission_denied_403'
handler500 = 'app.views.error_views.internal_error_500'
urlpatterns = [
url(settings.ADMIN_URL,... | url(r'^api/v1/', include('api.urls')), |
Here is a snippet: <|code_start|> url(r'comment-add', selected_book_views.add_comment, name='add_comment_app'),
url(r'load-comments', selected_book_views.load_comments, name='load_comments_app'),
url(r'report-book', selected_book_views.report_book, name='report-book'),
# Library urls.
url(r'library'... | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
Using the snippet: <|code_start|># -*- coding: utf-8 -*-
handler404 = 'app.views.error_views.not_found_404'
handler400 = 'app.views.error_views.bad_request_400'
handler403 = 'app.views.error_views.permission_denied_403'
handler500 = 'app.views.error_views.internal_error_500'
urlpatterns = [
url(settings.ADMIN_... | url(r'^api/v1/', include('api.urls')), |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
handler404 = 'app.views.error_views.not_found_404'
handler400 = 'app.views.error_views.bad_request_400'
handler403 = 'app.views.error_views.permission_denied_403'
handler500 = 'app.views.error_views.internal_error_500'
urlpatterns = [
... | url(r'^api/v1/', include('api.urls')), |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
handler404 = 'app.views.error_views.not_found_404'
handler400 = 'app.views.error_views.bad_request_400'
handler403 = 'app.views.error_views.permission_denied_403'
handler500 = 'app.views.error_views.internal_error_500'
urlpatterns = [
... | url(r'^api/v1/', include('api.urls')), |
Using the snippet: <|code_start|># -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------------------------------------------------
class ReminderViewsTest(TestCase):
# ------------------------------------------------------------------------------------------------... | self.assertEqual(response.status_code, 404) |
Based on the snippet: <|code_start|> url(r'read-book', read_book_views.open_book),
url(r'set-current-page', read_book_views.set_current_page),
# Add book urls.
url(r'generate-authors', upload_book_views.generate_authors),
url(r'generate-books', upload_book_views.generate_books),
url(r'generate-l... | ] |
Using the snippet: <|code_start|> url(r'read-book', read_book_views.open_book),
url(r'set-current-page', read_book_views.set_current_page),
# Add book urls.
url(r'generate-authors', upload_book_views.generate_authors),
url(r'generate-books', upload_book_views.generate_books),
url(r'generate-lang... | ] |
Here is a snippet: <|code_start|> url(r'read-book', read_book_views.open_book),
url(r'set-current-page', read_book_views.set_current_page),
# Add book urls.
url(r'generate-authors', upload_book_views.generate_authors),
url(r'generate-books', upload_book_views.generate_books),
url(r'generate-lang... | ] |
Given snippet: <|code_start|># -*- coding: utf-8 -*-
AVATAR_WIDTH = 250
logger = logging.getLogger('changes')
# ----------------------------------------------------------------------------------------------------------------------
@api_view(['POST'])
<|code_end|>
, continue by predicting the next line. Conside... | def my_profile(request): |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
AVATAR_WIDTH = 250
logger = logging.getLogger('changes')
# ----------------------------------------------------------------------------------------------------------------------
@api_view(['POST'])
<|code_end|>
with the help of curr... | def my_profile(request): |
Based on the snippet: <|code_start|># -*- coding: utf-8 -*-
AVATAR_WIDTH = 250
logger = logging.getLogger('changes')
# ----------------------------------------------------------------------------------------------------------------------
@api_view(['POST'])
<|code_end|>
, predict the immediate next line with t... | def my_profile(request): |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
AVATAR_WIDTH = 250
logger = logging.getLogger('changes')
# ----------------------------------------------------------------------------------------------------------------------
@api_view(['POST'])
<|code_end|>
with the help of curr... | def my_profile(request): |
Using the snippet: <|code_start|># -*- coding: utf-8 -*-
AVATAR_WIDTH = 250
logger = logging.getLogger('changes')
# ----------------------------------------------------------------------------------------------------------------------
@api_view(['POST'])
<|code_end|>
, determine the next line of code. You have... | def my_profile(request): |
Next line prediction: <|code_start|># -*- coding: utf-8 -*-
AVATAR_WIDTH = 250
logger = logging.getLogger('changes')
# ----------------------------------------------------------------------------------------------------------------------
@api_view(['POST'])
<|code_end|>
. Use current file imports:
(import log... | def my_profile(request): |
Given snippet: <|code_start|> def setUpTestData(cls):
shutil.copy(os.path.join(TEST_DATA_DIR, 'test.txt'), DESTINATION_DIR.format('test.txt'))
shutil.copy(os.path.join(TEST_DATA_DIR, 'test.xml'), DESTINATION_DIR.format('test.xml'))
cls.user = User.objects.create_user(username='additional', e... | self.assertTrue(logged_user.is_authenticated()) |
Given snippet: <|code_start|># -*- coding: utf-8 -*-
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
TEST_DATA_DIR = os.path.join(TEST_DIR, '../fixtures')
DESTINATION_DIR = os.path.join(settings.BASE_DIR, 'Plamber/additional/{}')
# ---------------------------------------------------------------------------... | @classmethod |
Given snippet: <|code_start|> cls.anonymous_client = Client()
cls.logged_client = Client()
cls.logged_client.login(username='additional', password='Dummy#password')
# ------------------------------------------------------------------------------------------------------------------
@class... | self.assertRedirects(response, reverse('index'), status_code=302, target_status_code=200) |
Here is a snippet: <|code_start|> response = self.logged_client.get(reverse('logout'))
self.assertEqual(response.resolver_match.func, user_logout)
self.assertEqual(response.status_code, 404)
# --------------------------------------------------------------------------------------------------... | response_data = response.content.decode('utf-8') |
Predict the next line for this snippet: <|code_start|>TEST_DIR = os.path.dirname(os.path.abspath(__file__))
TEST_DATA_DIR = os.path.join(TEST_DIR, '../fixtures')
DESTINATION_DIR = os.path.join(settings.BASE_DIR, 'Plamber/additional/{}')
# ------------------------------------------------------------------------------... | def test_user_logout_not_post(self): |
Here is a snippet: <|code_start|> if query_params:
query_params = json.loads(query_params)
results = self.qmanager.execute_aql_query(aql_query, query_params, count_only)
return results
@exception_handler
def execute_query(self):
params = request.forms
results ... | self.logger.critical('An error has occurred: %s', e) |
Next line prediction: <|code_start|> log_level=log_level)
self.qmanager = QueryManager(driver, host, database, versioning_database,
patients_repository, ehr_repository,
ehr_versioning_repo... | inst._error(msg, 500) |
Given the following code snippet before the placeholder: <|code_start|> def _execute_query(self, params, count_only):
aql_query = params.get('query')
if not aql_query:
self._missing_mandatory_field('query')
query_params = params.get('query_params')
if query_params:
... | def start_service(self, host, port, engine, debug=False): |
Given the code snippet: <|code_start|> return f(inst, *args, **kwargs)
except pyehr_errors.UnknownDriverError, ude:
inst._error(str(ude), 500)
except HTTPError:
#if an abort was called in wrapped function, raise the generated HTTPError
... | aql_query = params.get('query') |
Given snippet: <|code_start|> inst.logger.error(traceback.print_stack())
msg = 'Unexpected error: %s' % e.message
inst._error(msg, 500)
return wrapper
def _error(self, msg, error_code):
self.logger.error(msg)
body = {
'SUCCESS': Fal... | return results |
Using the snippet: <|code_start|>
try:
except ImportError:
class MultiprocessQueryRunnerPM3(object):
def __init__(self, host, database, collection,
port, user, passwd):
self.host = host
self.database = database
self.collection_name = collection
self.port = port
... | ) |
Continue the code snippet: <|code_start|> sconf.get_db_service_configuration()['port'])
self.patient_paths = {
'add': 'patient',
'delete': 'patient'
}
self.ehr_paths = {
'add': 'ehr',
'delete': 'ehr',
... | request['active'] = active |
Given the code snippet: <|code_start|> logger.info('Index time search took %f seconds' % index_time)
return index_time
def get_expected_results_count(qmanager, expected_results_percentage, logger):
drf = qmanager._get_drivers_factory(qmanager.ehr_repository)
with drf.get_driver() as driver:
tot... | for query_label, query_conf in sorted(queries.iteritems()): |
Next line prediction: <|code_start|> def _build_new_record(self, record, record_id=None):
record_root = etree.Element('archetype_structure')
record_root.append(record)
record_hash = self._get_record_hash(record)
record_id = record_id or uuid4().hex
# new records are created wi... | self.connect() |
Using the snippet: <|code_start|> def add_query(self, query_label, aql_query):
if not query_label in self.queries:
self.queries[query_label] = aql_query
else:
raise KeyError('Query label %s already in use' % query_label)
def execute_queries(self):
results_queue = ... | except KeyError: |
Predict the next line after this snippet: <|code_start|> def to_json(self, add_columns_json=False):
json_res = {
'results_count': self.total_results,
'results': list(self.results)
}
if add_columns_json:
json_res['columns'] = [c.to_json() for c in self.colum... | self.rows.append(row) |
Continue the code snippet: <|code_start|>
class DriversFactory(object):
def __init__(self, driver, host, database, repository=None,
port=None, user=None, passwd=None, index_service=None,
logger=None):
self.driver = driver
self.host = host
self.database = d... | return MongoDriverPM3(self.host, self.database, self.repository, |
Continue the code snippet: <|code_start|> return self.num_params * _BYTES_FLOAT
@property
def num_params(self):
return self.cell.num_params
class RNNCell(object):
def __init__(self, inputs, outputs, cell_type):
self.inputs = list(inputs)
self.outputs = list(outputs)
... | self.U = [self.output_dim, self.output_dim] |
Predict the next line after this snippet: <|code_start|>from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class TimeMeasureTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_add(self):
# Ti... | self.assertEqual(t_sum.total_time, t1.total_time + t2.total_time) |
Next line prediction: <|code_start|> del load_config.config
plugins = load_plugin_config()
if hasattr(load_config, 'config'):
del load_config.config
assert plugins == ['Dummy'], plugins
@patch('elodie.config.config_file', '%s/config.ini-load-plugin-config-one-with-invalid' % gettempdir())... | [Plugins] |
Using the snippet: <|code_start|> del load_config.config
plugins = load_plugin_config()
if hasattr(load_config, 'config'):
del load_config.config
assert plugins == [], plugins
@patch('elodie.config.config_file', '%s/config.ini-load-plugin-config-exists-not-set' % gettempdir())
def test_lo... | plugins=Dummy |
Predict the next line for this snippet: <|code_start|>
def test_lookup_with_invalid_location():
res = geolocation.lookup(location='foobar dne')
assert res is None, res
def test_lookup_with_invalid_location():
res = geolocation.lookup(location='foobar dne')
assert res is None, res
def test_lookup_with_... | f.write(""" |
Given snippet: <|code_start|>from __future__ import absolute_import
# Project imports
try:
except ImportError:
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))))
def call_log_and_assert(func, args, expected):
saved_stdout = sys.stdout
try:
... | assert output == expected, (expected, func, output) |
Given the code snippet: <|code_start|>
try:
except ImportError:
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))))
def call_result_and_assert(result, expected):
saved_stdout = sys.stdout
try:
out = StringIO()
sys.stdout = out
... | def test_add_multiple_rows_with_failure(): |
Given snippet: <|code_start|>from __future__ import absolute_import
# Project imports
try:
reload # Python 2.7
except NameError:
try:
except ImportError:
sys.path.insert(0, os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))))
BASE_PATH = os.path.dirname(os.p... | if('ELODIE_APPLICATION_DIRECTORY' in os.environ): |
Predict the next line for this snippet: <|code_start|>
class SSHClient:
def __init__(self, host):
self.user, self.host = host_params(host)
self.client = ssh.SSHClient()
def connect(self):
self.client.load_system_host_keys()
self.client.set_missing_host_key_policy(ssh.WarningP... | for line in stdout.readlines(): |
Given the code snippet: <|code_start|>
class SSHClient:
def __init__(self, host):
self.user, self.host = host_params(host)
self.client = ssh.SSHClient()
def connect(self):
self.client.load_system_host_keys()
self.client.set_missing_host_key_policy(ssh.WarningPolicy())
... | def exec_command(self, command): |
Continue the code snippet: <|code_start|>
class UserManager(Blueprint):
def __init__(self, *args, **kwargs):
self._login_manager = None
self._principal = None
self.app = None
super(UserManager, self).__init__(*args, **kwargs)
def register(self, app, *args, **kwargs):
... | self._login_manager.user_callback = self.user_loader |
Given the code snippet: <|code_start|>
if not self._login_manager or self.app != app:
self._login_manager = LoginManager()
self._login_manager.user_callback = self.user_loader
self._login_manager.setup_app(app)
self._login_manager.login_view = 'urls.index'
... | return login_user(user) |
Continue the code snippet: <|code_start|>
class BaseCoreTest(TestCase):
def create_app(self):
return create_app(test)
<|code_end|>
. Use current file imports:
from flask_testing import TestCase
from ..app import create_app
from ..config import test
from ..ext import db
from ..ext import cache
... | def setUp(self): |
Given the following code snippet before the placeholder: <|code_start|>
class BaseCoreTest(TestCase):
def create_app(self):
return create_app(test)
def setUp(self):
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
def test_home(self):
re... | def test_cache(self): |
Predict the next line after this snippet: <|code_start|>
class BaseCoreTest(TestCase):
def create_app(self):
return create_app(test)
def setUp(self):
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
def test_home(self):
response = self.c... | self.assert200(response) |
Using the snippet: <|code_start|>
DEPLOYDIR = op.dirname(op.dirname(__file__))
def read_config(folder):
path = op.join(folder, CFGNAME)
parser = MakesiteParser()
parser.read(path)
try:
site = dict(parser.items('Main'))
except Exception:
return dict(project=None)
git_head = o... | if op.exists(git_head): |
Given the code snippet: <|code_start|> site = dict(parser.items('Main'))
except Exception:
return dict(project=None)
git_head = op.join(folder, 'source', '.git', 'HEAD')
if op.exists(git_head):
try:
head = open(git_head).read().split()[1]
site['revision'] = op... | return sites |
Here is a snippet: <|code_start|>
if full:
context = self.as_dict()
return "".join("{0:<25} = {1}\n".format(
key, context[key]) for key in sorted(context.iterkeys()))
return "%s [%s]" % (self.get_name(), self.template)
def get_name(self):
"... | def run_update(self, template_name=None, service_dir=None): |
Using the snippet: <|code_start|>
class Site(settings.MakesiteParser):
" Operations with site instance. "
def __init__(self, deploy_dir):
" Init site options. "
super(Site, self).__init__()
self.deploy_dir = deploy_dir.rstrip(op.sep)
self.read([op.join(self.deploy_dir, settin... | " Run checking scripts. " |
Continue the code snippet: <|code_start|> try:
path = self.get('Templates', template_name)
except settings.Error:
path = op.join(settings.TPL_DIR, template_name)
assert op.exists(path), "Template not found."
return path
def gen_sites(path):
" Seek sites by pa... | project, branch = site.split('.', 1) |
Next line prediction: <|code_start|>
class Site(settings.MakesiteParser):
" Operations with site instance. "
def __init__(self, deploy_dir):
" Init site options. "
super(Site, self).__init__()
self.deploy_dir = deploy_dir.rstrip(op.sep)
self.read([op.join(self.deploy_dir, s... | self.templates = self.template.split(',') |
Here is a snippet: <|code_start|> return "%s.%s" % (self.project, self.safe_branch or self.branch)
def run_check(self, template_name=None, service_dir=None):
" Run checking scripts. "
print_header('Check requirements', sep='-')
map(lambda cmd: call("bash %s" % cmd), self._gen_script... | def run_remove(self, template_name=None, service_dir=None): |
Given the following code snippet before the placeholder: <|code_start|> path = self.get('Templates', template_name)
except settings.Error:
path = op.join(settings.TPL_DIR, template_name)
assert op.exists(path), "Template not found."
return path
def gen_sites(path):
"... | return Site(op.join(path, project, branch)) |
Given the code snippet: <|code_start|>
class Site(settings.MakesiteParser):
" Operations with site instance. "
def __init__(self, deploy_dir):
" Init site options. "
super(Site, self).__init__()
self.deploy_dir = deploy_dir.rstrip(op.sep)
self.read([op.join(self.deploy_dir,... | assert self.project and self.branch, "Invalid site: %s" % self.deploy_dir |
Continue the code snippet: <|code_start|> continue
if not name in oauth.remote_apps:
remote_app = oauth.remote_app(name, **config)
else:
remote_app = oauth.remote_apps[name]
client_class = CLIENTS.get(name)
client_class(app, remote_app)
class OAuth... | remote_app.authorized_handler(self.authorize)) |
Given the following code snippet before the placeholder: <|code_start|>
@staticmethod
def get_token():
if current_user.is_authenticated() and current_user.oauth_token:
return current_user.oauth_token, current_user.oauth_secret
def authorize(self, resp):
pass
class OAuthTwitter... | user.oauth_token = resp['oauth_token'] |
Continue the code snippet: <|code_start|>
ASCII_LOWERCASE = 'abcdefghijklmnopqrstuvwxyz'
PROVIDERS = 'twitter',
CLIENTS = dict()
oauth = OAuth()
def config_oauth(app):
" Configure oauth support. "
for name in PROVIDERS:
config = app.config.get('OAUTH_%s' % name.upper())
if not config:
... | client_class(app, remote_app) |
Continue the code snippet: <|code_start|> )
@staticmethod
def run(name=None):
role = Role(name=name)
db.session.add(role)
db.session.commit()
print 'Role "%s" created successfully.' % name
manager.add_command('create_role', Create_role())
class Add_role(Command):
" ... | print "Role '%s' added to user '%s' successfully" % ( |
Given the code snippet: <|code_start|>
userroles = db.Table(
'users_userroles',
db.Column('user_id', db.Integer, db.ForeignKey('users_user.id')),
db.Column('role_id', db.Integer, db.ForeignKey('users_role.id'))
)
class Role(db.Model, BaseMixin):
" User roles. "
__tablename__ = 'users_role'
... | return self.name |
Given the following code snippet before the placeholder: <|code_start|>
class Role(db.Model, BaseMixin):
" User roles. "
__tablename__ = 'users_role'
name = db.Column(db.String(19), nullable=False, unique=True)
def __unicode__(self):
return self.name
def __repr__(self):
return '<... | def roles(self): |
Using the snippet: <|code_start|>
class BaseCoreTest(TestCase):
def create_app(self):
return create_app(test)
def setUp(self):
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
def test_users(self):
response = self.client.post('/users/lo... | email='test@test.com', |
Given the following code snippet before the placeholder: <|code_start|> return create_app(test)
def setUp(self):
db.create_all()
def tearDown(self):
db.session.remove()
db.drop_all()
def test_users(self):
response = self.client.post('/users/login/', data=dict())
... | action_save=True, |
Predict the next line after this snippet: <|code_start|>
def create_app(config=None, **skip):
app = Flask(__name__)
app.config.from_object(config or production)
app.config.from_envvar("APP_SETTINGS", silent=True)
config_extensions(app)
<|code_end|>
using the current file's imports:
from flask impo... | loader.register(app) |
Based on the snippet: <|code_start|> " Create database. "
db.create_all()
# Evolution support
evolution_db.init_app(current_app)
evolution_db.create_all()
print "Database created successfuly"
@manager.command
def drop_db():
" Drop all tables. "
if prompt_bool("Are you sure? You wil... | drop_db() |
Predict the next line after this snippet: <|code_start|>
babel = Babel()
cache = Cache()
db = SQLAlchemy()
main = Mail()
manager = Manager(create_app)
manager.add_option("-c", "--config", dest="config", required=False)
collect = Collect()
collect.init_script(manager)
<|code_end|>
using the current file's imports... | def config_extensions(app): |
Predict the next line after this snippet: <|code_start|> flash(_('Wrong email or password'), 'error-message')
return redirect(request.referrer or url_for(users._login_manager.login_view))
@users.route('/logout/', methods=['GET'])
@users.login_required
def logout():
" View function which handles a logou... | flash(_('Thanks for registering')) |
Using the snippet: <|code_start|>
@users.route('/logout/', methods=['GET'])
@users.login_required
def logout():
" View function which handles a logout request. "
users.logout()
return redirect(request.referrer or url_for(users._login_manager.login_view))
@users.route('/register/', methods=['GET', 'POST']... | return redirect(url_for('users.profile')) |
Given the following code snippet before the placeholder: <|code_start|> " View function which handles an authentication request. "
form = LoginForm(request.form)
# make sure data are valid, but doesn't validate password is right
if form.validate_on_submit():
user = User.query.filter_by(email=form... | email=form.email.data, |
Using the snippet: <|code_start|>@users.login_required
def profile():
return render_template("users/profile.html")
@users.route('/login/', methods=['POST'])
def login():
" View function which handles an authentication request. "
form = LoginForm(request.form)
# make sure data are valid, but doesn't va... | def register(): |
Predict the next line after this snippet: <|code_start|>
class TestTextToInt:
def setup(self):
pass
@pytest.mark.parametrize("text,expected,default_base", [
("12", 0x12, "hex"),
("$1234", 0x1234, "hex"),
("0xffff", 0xffff, "hex"),
("#12", 12, "hex"),
<|code_end|>
using... | ("%11001010", 202, "hex"), |
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# ... | pass |
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# ... | pass |
Given snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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/... | async def scan( |
Using the snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.... | async def scan( |
Here is a snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.... | pass |
Given the following code snippet before the placeholder: <|code_start|>
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# htt... | if self.RETURN_ERRORS: |
Continue the code snippet: <|code_start|>#
# 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | dr.plugin_names.extend(self.WORKERS) |
Next line prediction: <|code_start|># 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 is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY... | return dr |
Next line prediction: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.apac... | SHOULD_ARCHIVE = True |
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# ... | pass |
Given snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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/... | pass |
Continue the code snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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... | if self.RAISE_EXCEPTION: |
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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 L... | dr.errors.append( |
Here is a snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.... | pass |
Continue the code snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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... | pass |
Given snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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/... | pass |
Based on the snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.apac... | pass |
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# ... | def get_important_option(self): |
Given the code snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.ap... | pass |
Predict the next line for this snippet: <|code_start|>
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.or... | def getjson_option(self, option): |
Continue the code snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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... | return self.config.get('options', 'important_option') |
Next line prediction: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.apac... | return None |
Here is a snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.... | return None |
Continue the code snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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... | return None |
Given the code snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.ap... | return None |
Using the snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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.... | return None |
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# ... | return None |
Given the following code snippet before the placeholder: <|code_start|> self._loaded_plugins[plugin_name] = plugin
return plugin
def list_plugins(self) -> Dict[str, Dict[str, Any]]:
valid_classes = [
'ArchiverPlugin',
'BasePlugin',
'ProviderPlugin',
... | 'classes': plugin_classes, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.