Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Here is a snippet: <|code_start|>
class Alina(Decoder):
decoder_name = "Alina"
decoder__version = 1
decoder_author = ["@botnet_hunter, @kevthehermit"]
<|code_end|>
. Write the next line using the current file imports:
from malwareconfig import crypto
from malwareconfig.common import Decoder
from malwareco... | decoder_description = "Point of sale malware designed to extract credit card information from RAM" |
Based on the snippet: <|code_start|>
def test_review(qtbot):
dlg = DlgReview('some content', 'log content', None, None)
assert dlg.ui.edit_main.toPlainText() == 'some content'
assert dlg.ui.edit_log.toPlainText() == 'log content'
qtbot.keyPress(dlg.ui.edit_main, 'A')
<|code_end|>
, predict the immediat... | assert dlg.ui.edit_main.toPlainText() == 'Asome content' |
Here is a snippet: <|code_start|>
def test_format_body():
description = 'A description'
traceback = 'A traceback'
<|code_end|>
. Write the next line using the current file imports:
from qcrash.formatters.markdown import MardownFormatter
and context from other files:
# Path: qcrash/formatters/markdown.py
# c... | sys_info = '''OS: Linux |
Given the following code snippet before the placeholder: <|code_start|>
EMAIL = 'your.email@provider.com'
def get_backend():
return EmailBackend(EMAIL, 'TestQCrash')
<|code_end|>
, predict the next line using imports from the current file:
from qcrash.backends.email import EmailBackend
and context including ... | def test_send_report(): |
Based on the snippet: <|code_start|>
def test_qsettings():
b = BaseBackend(None, '', '', None)
assert b.qsettings() is not None
def test_set_formatter():
b = BaseBackend(None, '', '', None)
<|code_end|>
, predict the immediate next line with the help of imports:
from qcrash.backends.base import BaseBac... | assert b.formatter is None |
Next line prediction: <|code_start|>
def test_set_qsettings():
assert api._qsettings.organizationName() == 'QCrash'
api.set_qsettings(QtCore.QSettings('TestQCrash'))
assert api._qsettings.organizationName() == 'TestQCrash'
<|code_end|>
. Use current file imports:
(import sys
import pytest
from qcrash i... | def test_value_errors(): |
Here is a snippet: <|code_start|>
def test_set_qsettings():
assert api._qsettings.organizationName() == 'QCrash'
api.set_qsettings(QtCore.QSettings('TestQCrash'))
assert api._qsettings.organizationName() == 'TestQCrash'
<|code_end|>
. Write the next line using the current file imports:
import sys
impor... | def test_value_errors(): |
Here is a snippet: <|code_start|>
def test_github_login_dialog():
dlg = DlgGitHubLogin(None, '', False, False)
assert not dlg.ui.bt_sign_in.isEnabled()
dlg.ui.le_username.setText('user')
dlg.ui.le_password.setText('password')
assert dlg.ui.cb_remember.isChecked() is False
assert dlg.ui.cb_remem... | assert dlg.ui.bt_sign_in.isEnabled() |
Next line prediction: <|code_start|>
def test_format_title():
title = 'test'
appname = 'TestQCrash'
expected = '[%s] %s' % (appname, title)
assert EmailFormatter(app_name=appname).format_title(title) == expected
assert EmailFormatter().format_title(title) == title
def test_format_body():
appn... | description = 'A description' |
Given the following code snippet before the placeholder: <|code_start|> }
''')
assert self.space.int_w(w_res) == 13
def test_simple_args(self):
w_res = self.interpret('''
def foo(a, b) {
return a + b
}
def main() {
... | return a * 10 + b |
Next line prediction: <|code_start|>
class W_BoolObject(W_Root):
def __init__(self, boolval):
self._boolval = boolval
def is_true(self, space):
<|code_end|>
. Use current file imports:
(from nolang.objects.root import W_Root)
and context including class names, function names, or small code snippets ... | return self._boolval |
Given snippet: <|code_start|>
class TestClasses(BaseTest):
def test_simple_class(self):
w_res = self.interpret('''
class X {
def __init__(self) {
self.x = 13
}
}
def main() {
let x
x = ... | } |
Continue the code snippet: <|code_start|> def setitem(self, space, w_index, w_value):
self._items_w[self.unwrap_index(space, w_index)] = w_value
def iter(self, space):
return W_ListIterator(self)
def append(self, space, w_obj):
self._items_w.append(w_obj)
def extend(self, space... | def __init__(self, w_list): |
Using the snippet: <|code_start|> def listview(self, space):
return self._items_w
def len(self, space):
return len(self._items_w)
def contains(self, space, w_obj):
for w_item in self._items_w:
if space.binop_eq(w_obj, w_item):
return True
return F... | return W_ListIterator(self) |
Given snippet: <|code_start|>
class W_ListObject(W_Root):
def __init__(self, items_w):
self._items_w = items_w[:]
def str(self, space):
return '[' + ', '.join([space.str(i) for i in self._items_w]) + ']'
def listview(self, space):
return self._items_w
<|code_end|>
, continue by p... | def len(self, space): |
Predict the next line after this snippet: <|code_start|>
def str(self, space):
return '[' + ', '.join([space.str(i) for i in self._items_w]) + ']'
def listview(self, space):
return self._items_w
def len(self, space):
return len(self._items_w)
def contains(self, space, w_obj):
... | def setitem(self, space, w_index, w_value): |
Continue the code snippet: <|code_start|>
class W_FrameWrapper(W_Root):
def __init__(self, frameref):
self.frameref = frameref
def get_filename(self, space):
return space.newtext(self.frameref.bytecode.filename)
W_FrameWrapper.spec = TypeSpec(
<|code_end|>
. Use current file imports:
from n... | 'Frame', |
Here is a snippet: <|code_start|>
class W_FrameWrapper(W_Root):
def __init__(self, frameref):
self.frameref = frameref
def get_filename(self, space):
return space.newtext(self.frameref.bytecode.filename)
W_FrameWrapper.spec = TypeSpec(
'Frame',
constructor=None,
methods={},
p... | } |
Given snippet: <|code_start|>
class W_Exception(W_UserObject):
def __init__(self, w_tp, message):
W_UserObject.__init__(self, w_tp)
self.message = message
def get_message(self, space):
return space.newtext(self.message)
def __repr__(self):
<|code_end|>
, continue by predicting the... | return '<%s %s>' % (self.w_type.name, self.message) |
Predict the next line after this snippet: <|code_start|>
class W_Exception(W_UserObject):
def __init__(self, w_tp, message):
W_UserObject.__init__(self, w_tp)
self.message = message
def get_message(self, space):
return space.newtext(self.message)
def __repr__(self):
return... | 'message': (W_Exception.get_message, None) |
Next line prediction: <|code_start|>
class W_Exception(W_UserObject):
def __init__(self, w_tp, message):
W_UserObject.__init__(self, w_tp)
self.message = message
<|code_end|>
. Use current file imports:
(from nolang.builtins.spec import unwrap_spec, TypeSpec
from nolang.objects.userobject import ... | def get_message(self, space): |
Based on the snippet: <|code_start|>
def utf8_w(self, space):
return self.utf8val
def str(self, space):
return self.utf8_w(space)
def len(self, space):
if self.lgt == -1:
# XXX compute it better once utf8 lands
self.lgt = len(self.utf8val.decode('utf-8'))
... | def new_str(space, value): |
Here is a snippet: <|code_start|>
class W_StrObject(W_Root):
def __init__(self, utf8val, lgt=-1):
assert isinstance(utf8val, str)
self.utf8val = utf8val
<|code_end|>
. Write the next line using the current file imports:
from rpython.rlib.objectmodel import compute_hash
from nolang.error import Ap... | self.lgt = lgt |
Given the code snippet: <|code_start|>
class W_StrObject(W_Root):
def __init__(self, utf8val, lgt=-1):
assert isinstance(utf8val, str)
self.utf8val = utf8val
self.lgt = lgt
def utf8_w(self, space):
return self.utf8val
def str(self, space):
return self.utf8_w(space... | return compute_hash(self.utf8val) |
Predict the next line for this snippet: <|code_start|> w_ls = self.space.listview(w_res)
assert [self.space.int_w(w) for w in w_ls] == [0, 1, 2, 3]
def test_merge(self):
w_res = self.interpret_expr('''
let a, b, ab;
a = {"a": "foo", 1: "bar"};
b = {"b": "b... | return [a.pop(1), a]; |
Predict the next line after this snippet: <|code_start|>
class Frame(W_Root):
def __init__(self, bytecode, name=None):
self.name = name
self.bytecode = bytecode
if bytecode.module is not None: # for tests
self.globals_w = bytecode.module.functions
self.locals_w = [None]... | def push(self, w_val): |
Given the code snippet: <|code_start|>
class W_DictObject(W_Root):
def __init__(self, key_eq, key_hash, items_w):
self._items_w = r_dict(key_eq, key_hash)
for k, v in items_w:
self._items_w[k] = v
def str(self, space):
return '{' + ', '.join([space.str(k) + ': ' + space.st... | def get(self, space, w_key, w_default=None): |
Predict the next line for this snippet: <|code_start|> return self._items_w[w_key]
def get(self, space, w_key, w_default=None):
if w_key not in self._items_w:
return w_default
return self._items_w[w_key]
def dict_pop(self, space, w_key):
if w_key not in self._items_w... | def allocate(space, w_tp, items_w): |
Predict the next line for this snippet: <|code_start|>
def setitem(self, space, w_key, w_value):
self._items_w[w_key] = w_value
def merge(self, space, w_other):
other_w = space.dictview(w_other)
w_res = space.newdict([])
w_res._items_w.update(self._items_w)
w_res._items_... | 'get': W_DictObject.get, |
Predict the next line for this snippet: <|code_start|> x = ["foo"];
x.append("bar");
return x;
''')
space = self.space
assert space.len(w_res) == 2
assert space.utf8_w(space.getitem(w_res, space.newint(1))) == "bar"
def test_extend(self):
w... | List.append(1, 2) |
Continue the code snippet: <|code_start|>
@unwrap_spec()
def len(space, w_obj):
return space.newint(space.len(w_obj))
@parameters(name='isinstance')
def builtin_isinstance(space, w_obj, w_type):
if not isinstance(w_type, W_UserType):
# typename = space.type(w_type).name
# XXX improve the erro... | return space.newtext(space.str(w_obj)) |
Given the code snippet: <|code_start|>
@unwrap_spec()
def len(space, w_obj):
return space.newint(space.len(w_obj))
@parameters(name='isinstance')
<|code_end|>
, generate the next line using the imports in this file:
from nolang.builtins.spec import unwrap_spec, parameters
from nolang.objects.usertype import W_U... | def builtin_isinstance(space, w_obj, w_type): |
Using the snippet: <|code_start|>
@unwrap_spec()
def len(space, w_obj):
return space.newint(space.len(w_obj))
@parameters(name='isinstance')
<|code_end|>
, determine the next line of code. You have imports:
from nolang.builtins.spec import unwrap_spec, parameters
from nolang.objects.usertype import W_UserType
... | def builtin_isinstance(space, w_obj, w_type): |
Given snippet: <|code_start|>
class TestMain(object):
def test_main(self, tmpdir):
fname = tmpdir.join("foo.q")
fname.write(reformat_code("""
def main() {
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import re
from support import reformat_code
from ... | print(3); |
Given the code snippet: <|code_start|>
class W_StringBuilder(W_Root):
def __init__(self, length):
self._s = StringBuilder(length)
@unwrap_spec(txt='utf8')
def append(self, txt):
self._s.append(txt)
def build(self, space):
return space.newtext(self._s.build())
@unwrap_spec(... | 'build': W_StringBuilder.build, |
Continue the code snippet: <|code_start|>
class W_StringBuilder(W_Root):
def __init__(self, length):
self._s = StringBuilder(length)
@unwrap_spec(txt='utf8')
def append(self, txt):
self._s.append(txt)
def build(self, space):
<|code_end|>
. Use current file imports:
from rpython.rli... | return space.newtext(self._s.build()) |
Here is a snippet: <|code_start|>
class W_StringBuilder(W_Root):
def __init__(self, length):
self._s = StringBuilder(length)
@unwrap_spec(txt='utf8')
def append(self, txt):
self._s.append(txt)
<|code_end|>
. Write the next line using the current file imports:
from rpython.rlib.rstring ... | def build(self, space): |
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*-
if 'DJANGO_TEST' in os.environ:
else: # pragma: no cover
PAGES_COLORS = {
"A": "green", "B": "deep-orange", "C": "blue-grey", "D": "brown",
"E": "lime", "F": "light-blue", "G": "teal", "H": "deep-purple",
"... | other_pages = list(set(PAGES_COLORS.keys()) - set(besides)) |
Based on the snippet: <|code_start|># -*- coding: utf-8 -*-
UserInfo.get_sex_display.short_description = "Sex"
@admin.register(UserInfo)
class UserInfoAdmin(admin.ModelAdmin):
list_display = ['id', 'age', 'get_sex_display', 'avg1',
'avg_time_pages', 'visits_pages', 'avg_time_pages_a',
<|cod... | 'visits_pages_a', 'cluster_1'] |
Here is a snippet: <|code_start|># -*- coding: utf-8 -*-
UserInfo.get_sex_display.short_description = "Sex"
@admin.register(UserInfo)
class UserInfoAdmin(admin.ModelAdmin):
list_display = ['id', 'age', 'get_sex_display', 'avg1',
'avg_time_pages', 'visits_pages', 'avg_time_pages_a',
... | }), |
Continue the code snippet: <|code_start|>
@admin.register(UserInfo)
class UserInfoAdmin(admin.ModelAdmin):
list_display = ['id', 'age', 'get_sex_display', 'avg1',
'avg_time_pages', 'visits_pages', 'avg_time_pages_a',
'visits_pages_a', 'cluster_1']
fieldsets = (
(... | ('visits_pages', 'avg_time_pages', ), |
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*-
UserInfo.get_sex_display.short_description = "Sex"
@admin.register(UserInfo)
class UserInfoAdmin(admin.ModelAdmin):
list_display = ['id', 'age', 'get_sex_display', 'avg1',
'avg_time_pages', 'visits_pages', 'avg_time_pages_a',
... | ('visits_pages_g', 'avg_time_pages_g', ), |
Predict the next line for this snippet: <|code_start|> new_thread_count = 0
for sthread in new_threads:
if linked_threads.filter(url=sthread.permalink).exists():
pass
else:
thread_list.append([sthread.... | notifications_sent += 1 |
Predict the next line for this snippet: <|code_start|>
class Command(BaseCommand):
help = "Checks watched subreddits and notifies users of updates"
def handle(self, *args, **options):
watched_subreddits = WatchedSubreddit.objects.all()
subreddit_count = watched_subreddits.count()
notifi... | new_thread_count = 0 |
Using the snippet: <|code_start|> if current_time - timedelta(hours=subreddit.watch_interval) < subreddit.last_checked_date:
pass
else:
subreddit.last_checked_date = current_time
subreddit.save()
new_threads = get_subreddit_threads(s... | for thr in thread_list: |
Using the snippet: <|code_start|> linked_threads = WatchedSubredditThread.objects.filter(parent_subreddit=subreddit)
# keep db from growing, only need the newest 100 submissions as a comparison
if linked_threads.count() > 200:
# This works, but probably... | username = subreddit.user.username |
Here is a snippet: <|code_start|> for user in watched_users:
current_time = timezone.now()
if current_time - timedelta(hours=user.watch_interval) < user.last_checked_date:
pass
else:
user.last_checked_date = current_time
user.sav... | c.save() |
Given snippet: <|code_start|>
class Command(BaseCommand):
help = "Checks watched users and notifies users of updates"
def handle(self, *args, **options):
watched_users = WatchedUser.objects.all()
user_count = watched_users.count()
notifications_sent = 0
for user in watched_user... | title=thread.title, thread_date=thread.created) |
Using the snippet: <|code_start|> else:
formatted_comments = ''
# only grab 3 comments as to not reach character limit
limit_comments = 3
for comment in comment_list:
if limit_comments > 0:
... | notifications_sent += 1 |
Predict the next line after this snippet: <|code_start|> else:
thread_list.append([thread.title, thread.permalink])
t = WatchedUserThread(parent_user=user, url=thread.permalink,
title=thread.title, thre... | else: |
Next line prediction: <|code_start|> linked_threads = WatchedUserThread.objects.filter(parent_user=user)
thread_list = []
new_thread_count = 0
for thread in new_threads:
if linked_threads.filter(url=thread.permalink).exists():
... | limit_comments = 3 |
Given the following code snippet before the placeholder: <|code_start|>
class Command(BaseCommand):
help = "Checks watched users and notifies users of updates"
def handle(self, *args, **options):
watched_users = WatchedUser.objects.all()
user_count = watched_users.count()
notifications... | else: |
Here is a snippet: <|code_start|> linked_comments = WatchedComment.objects.filter(parent_thread=thread)
new_comments = get_reddit_comments_from_thread(praw_thread)
new_comment_count = 0
comment_list = []
for comment in new_comments:
... | .format(new_comment_count, thread.title, thread.url, formatted_comments)) |
Given the following code snippet before the placeholder: <|code_start|>
def handle(self, *args, **options):
watched_threads = WatchedThread.objects.all()
thread_count = watched_threads.count()
notifications_sent = 0
for thread in watched_threads:
current_time = timezone.n... | '(http://www.reddit.com)'.format(thread.title)) |
Continue the code snippet: <|code_start|> notify_user(username, 'The author of thread "{}" has changed the submission text.'
' You can view the post [here](https://reddit.com/{})'
.format(thread.title, thread.url))
... | limit_comments = 5 |
Based on the snippet: <|code_start|>
class Command(BaseCommand):
help = "Checks watched threads and notifies users of updates"
def handle(self, *args, **options):
watched_threads = WatchedThread.objects.all()
thread_count = watched_threads.count()
notifications_sent = 0
for thr... | username = thread.user.username |
Next line prediction: <|code_start|># TODO move this here?
class colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def exec_terraform_apply():
print(
colors.O... | 'terraform', 'apply', '--auto-approve', |
Given snippet: <|code_start|> return check_output(['terraform', 'output', varname], workdir=get_terraform_folder()).rstrip().decode('utf8')
except subprocess.CalledProcessError:
print("Failed getting output variable {0} from terraform!".format(varname))
sys.exit()
# All we're doing here is ... | key_codeq_list = OrderedDict([("sonarhome", "Sonar Home"), |
Given the following code snippet before the placeholder: <|code_start|># TODO move this here?
class colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
<|code_end|>
, predict the next line using imports from the current f... | BOLD = '\033[1m' |
Given snippet: <|code_start|> colors.OKBLUE + 'Initializing and running Terraform.\n' + colors.ENDC)
print(
colors.OKBLUE + datetime.datetime.now().strftime('%c') + '\n' + colors.ENDC)
call(['terraform', 'init'], workdir=get_terraform_folder())
# TODO see if we can avoid passing in AWS cred... | def exec_terraform_destroy(): |
Predict the next line for this snippet: <|code_start|>
# TODO revisit the use of an env var here, only the destroy script uses it, and it probably shouldn't
def get_installer_root():
# Set the repo root path as an env var here,
# so subsequent scripts don't need to hardcode absolute paths.
return os.enviro... | return get_terraform_folder() + "terraform.tfvars" |
Given snippet: <|code_start|>
def update_sonarqube_terraform(sonarelb, sonaruserpass, sonarip):
replace_tfvars('sonar_server_elb', sonarelb, get_tfvars_file())
replace_tfvars('sonar_username', sonaruserpass[0], get_tfvars_file())
replace_tfvars('sonar_passwd', sonaruserpass[1], get_tfvars_file())
repla... | def check_sonar_user(url, username, passwd, token): |
Continue the code snippet: <|code_start|>
@click.command()
# Sonarqube (container)
@click.option(
'--sonarqube/--no-sonarqube',
default=False
)
<|code_end|>
. Use current file imports:
import click
from installer.cli.click_required import Required
from installer.configurators.jenkins_container import configur... | @click.option( |
Continue the code snippet: <|code_start|>
@click.command()
# Sonarqube (container)
@click.option(
'--sonarqube/--no-sonarqube',
default=False
)
@click.option(
"--vpcid",
<|code_end|>
. Use current file imports:
import click
from installer.cli.click_required import Required
from installer.configurators.jen... | help='Specify the ID of an existing VPC to use for ECS configuration', |
Given snippet: <|code_start|>
@click.command()
@click.option(
'--mode',
type=click.Choice(['all', 'frameworkonly']),
help='`all` to remove Jazz and all deployed services, \
`frameworkonly` to remove Jazz but leave deployed services alone',
required=True
)
<|code_end|>
, continue by predicting the n... | @click.option('--aws_access_key', prompt=True, envvar='AWS_ACCESS_KEY_ID') |
Based on the snippet: <|code_start|>
@click.command()
@click.option(
'--mode',
type=click.Choice(['all', 'frameworkonly']),
help='`all` to remove Jazz and all deployed services, \
`frameworkonly` to remove Jazz but leave deployed services alone',
required=True
<|code_end|>
, predict the immediate n... | ) |
Given snippet: <|code_start|>#!/usr/bin/env python
#
# Copyright 2015 BMC Software, Inc.
#
# 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
#
... | "unit": "number", |
Next line prediction: <|code_start|>
while not universal.orphaned_results.empty():
try:
# We want to create a whole new socket everytime so we don't
# stack messages up in the queue. We also don't want to just
# send it once and let ZMQ take care of it... | shepherd, timeout = 1000 * 5 |
Predict the next line after this snippet: <|code_start|>
# Load up the configuration for the email validation regular expression
config = load_config("global")
class User(Document):
email = EmailField(unique = True, primary_key = True,
regex = config["EMAIL_VALIDATION_REGEX"])
seal = Str... | classes = ListField(ObjectIdField()) |
Predict the next line after this snippet: <|code_start|>
# Load Galah's configuration.
config = load_config("shepherd")
class FlockManager:
class SheepInfo:
<|code_end|>
using the current file's imports:
from galah.base.prioritydict import PriorityDict
from collections import namedtuple
from galah.base.flockmail im... | __slots__ = ("environment", "servicing_request") |
Given snippet: <|code_start|>
# Load Galah's configuration.
config = load_config("sheep/vz")
vzctlPath = "/usr/sbin/vzctl"
vzlistPath = "/usr/sbin/vzlist"
containerDirectory = None
nullFile = open("/dev/null", "w")
def check_call(*args, **kwargs):
"Essentially subprocess.check_call. Added for compatibilty with <v... | elif return_value != 0: |
Given the code snippet: <|code_start|>
# Load Galah's configuration.
config = load_config("sheep/vz")
vzctlPath = "/usr/sbin/vzctl"
vzlistPath = "/usr/sbin/vzlist"
containerDirectory = None
<|code_end|>
, generate the next line using the imports in this file:
import subprocess, ConfigParser, sys, os, datetime
from ga... | nullFile = open("/dev/null", "w") |
Based on the snippet: <|code_start|> # FASTA style names
assert parse_region("gb|accession|locus") == ("gb|accession|locus", 0, None)
assert parse_region("gb|accession|locus:1000-2000") == (
"gb|accession|locus",
1000,
2000,
)
assert parse_region("gb|accession|locus:1,000-2,00... | with pytest.raises(ValueError): |
Predict the next line for this snippet: <|code_start|>
def test_to_ucsc_string():
assert stringops.to_ucsc_string(("chr21", 1, 4)) == "chr21:1-4"
def test_parse_region():
# UCSC-style names
assert parse_region("chr21") == ("chr21", 0, None)
assert parse_region("chr21:1000-2000") == ("chr21", 1000, 2... | ) |
Here is a snippet: <|code_start|>
DEFAULT_FACECOLOR = "skyblue"
DEFAULT_EDGECOLOR = "dimgray"
__all__ = ["plot_intervals"]
def _plot_interval(
start, end, level, facecolor=None, edgecolor=None, height=0.6, ax=None
):
facecolor = DEFAULT_FACECOLOR if facecolor is None else facecolor
edgecolor = DEFAULT_... | facecolor=facecolor, |
Predict the next line after this snippet: <|code_start|> ["chr1", 10, 20],
[pd.NA, pd.NA, pd.NA],
[pd.NA, pd.NA, pd.NA],
],
columns=["chrom", "start", "end"],
)
sanitized_df1 = sanitized_df1.astype(
{"chrom": object, "start": pd.Int64Dtype(), "end": pd.... | ) |
Continue the code snippet: <|code_start|> d = """ chrom_1 start_1 end_1 chrom_2 start_2 end_2 distance
0 chrX 1 8 chrX 2 10 0
1 chrX 2 10 chrX 1 8 0"""
df_closest = pd.read_csv(StringIO(d), sep=r"\s+")
df_cat = pd.CategoricalDtype(categories=["chrX", ... | columns=["chrom", "start", "end"], |
Given snippet: <|code_start|>
def test_is_cataloged():
### chr2q is not in view
view_df = pd.DataFrame(
[
["chr1", 0, 12, "chr1p"],
["chr1", 13, 26, "chr1q"],
["chrX", 1, 8, "chrX_0"],
],
columns=["chrom", "start", "end", "name"],
)
<|code_end|>... | df = pd.DataFrame( |
Predict the next line for this snippet: <|code_start|>
try:
except ImportError:
bbi = None
try:
except ImportError:
pyBigWig = None
__all__ = [
"read_table",
"read_chromsizes",
"read_tabix",
<|code_end|>
with the help of current file imports:
from collections import OrderedDict
from contextli... | "read_pairix", |
Next line prediction: <|code_start|>
try:
except ImportError:
bbi = None
try:
except ImportError:
<|code_end|>
. Use current file imports:
(from collections import OrderedDict
from contextlib import closing
from ..core.stringops import parse_region
from ..core.arrops import argnatsort
from .schemas import SCHEMA... | pyBigWig = None |
Next line prediction: <|code_start|>
try:
except ImportError:
bbi = None
try:
except ImportError:
pyBigWig = None
__all__ = [
"read_table",
"read_chromsizes",
"read_tabix",
"read_pairix",
"read_bam",
<|code_end|>
. Use current file imports:
(from collections import OrderedDict
from con... | "load_fasta", |
Continue the code snippet: <|code_start|>
try:
except ImportError:
bbi = None
try:
except ImportError:
pyBigWig = None
__all__ = [
<|code_end|>
. Use current file imports:
from collections import OrderedDict
from contextlib import closing
from ..core.stringops import parse_region
from ..core.arrops import... | "read_table", |
Next line prediction: <|code_start|>
def test_get_default_colnames():
assert specs._get_default_colnames() == ("chrom", "start", "end")
def test_update_default_colnames():
new_names = ("C", "chromStart", "chromStop")
specs.update_default_colnames(new_names)
assert specs._get_default_colnames() == n... | ) |
Based on the snippet: <|code_start|>
def test_01():
data = loadfile(TESTDIR + "test01.21")
cn, c1, yd, yo, zd, zo = calccumsum(data)
<|code_end|>
, predict the immediate next line with the help of imports:
from nose.tools import assert_equal, assert_almost_equal, assert_true, \
assert_false, assert_r... | pass |
Given the following code snippet before the placeholder: <|code_start|>
def test_01():
data = loadfile(TESTDIR + "test01.21")
cn, c1, yd, yo, zd, zo = calccumsum(data)
<|code_end|>
, predict the next line using imports from the current file:
from nose.tools import assert_equal, assert_almost_equal, asser... | pass |
Continue the code snippet: <|code_start|>#!/usr/bin/env python
'''This is a curve-fitting tool for interpreting kmer spectra'''
mpl.use('Agg')
def weightedleastsquares(parameters, yvalues, xvalues, order=None):
'''Returns vector of weighted residuals. Used for initial fits.'''
err = (yvalues - fitfn(xvalue... | sqerr2 = np.sqrt(-err2) |
Given the code snippet: <|code_start|>
class DBHandler(logging.Handler):
def emit(self, record):
if type(record.msg) is dict:
# Pull the project name, hostname, and revision out of the record
filters = {}
for key in ('project_name', 'hostname', 'revision'):
... | filters[key] = record.msg.pop(key) |
Predict the next line after this snippet: <|code_start|>
logger = logging.getLogger('debug.logger')
for HandlerClass in LOGGING_CONFIG["LOGGING_HANDLERS"]:
logger.addHandler(HandlerClass)
<|code_end|>
using the current file's imports:
import logging
from django.conf import settings
from django.core.urlresolve... | class DebugLoggingMiddleware(DebugToolbarMiddleware): |
Given the code snippet: <|code_start|>
if options['sitemap']:
sitemaps = import_from_string(options['sitemap'])
if isinstance(sitemaps, dict):
for sitemap in sitemaps.values():
urls.extend(map(sitemap.location, sitemap.items()))
elif isins... | test_run.save() |
Next line prediction: <|code_start|> verbosity = int(options.get('verbosity', 1))
self.quiet = verbosity < 1
self.verbose = verbosity > 1
# Dtermine if the DBHandler is used
if True in [isinstance(handler, DBHandler) for handler in
LOGGING_CONFIG["LOGGING_HAND... | existing_runs = TestRun.objects.filter(end__isnull=True, **filters) |
Predict the next line after this snippet: <|code_start|> dest='manual_end',
help='End a TestRun that was started manually.'
),
make_option('-n', '--name',
action='store',
dest='name',
metavar='NAME',
help='Add a name to the test run.... | metavar='PASSWORD', |
Predict the next line after this snippet: <|code_start|>
DEBUG=False
class Skeleton(Actor):
def __init__(self,
<|code_end|>
using the current file's imports:
import numpy as np
import fos.util
from pyglet.gl import *
from PySide.QtGui import QMatrix4x4
from fos.shader.lib import *
from fos.vsml import vsml
fr... | name, |
Predict the next line after this snippet: <|code_start|># it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY W... | </body> |
Using the snippet: <|code_start|><br><br>
%s
<br><br>
%s
</font>
</p>
<p>
<wxp module="wx" class="Button">
<param name="id" value="ID_OK">
</wxp>
</p>
</center>
</body>
</html>
''' % (colours, '''<img src="%s"><br><h2> Wammu %s</h2>
%s<br>
%s<br>
%s<br>
''' % (Wammu.Paths.AppIconPath('wammu'),
... | This program is free software: you can redistribute it and/or modify |
Next line prediction: <|code_start|># -*- coding: UTF-8 -*-
#
# Copyright © 2003 - 2018 Michal Čihař <michal@cihar.com>
#
# This file is part of Wammu <https://wammu.eu/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... | ('P&AVkA7QFh-ern&ARs- &AX4-lu&AWU-ou&AQ0-k&AP0- k&AW8BSA- &APo-p&ARs-l &AQ8A4Q-belsk&AOk- &APM-dy', 40), |
Predict the next line for this snippet: <|code_start|>
def log_message(agent, message):
agent.log_info('Received: %s' % message)
def annoy(agent, say, more=None):
message = say if not more else say + ' ' + more + '!'
agent.send('annoy', message)
if __name__ == '__main__':
ns = run_nameserver()
... | orange.each(1.4142, annoy, 'Apple') |
Given snippet: <|code_start|>
def log_a(agent, message):
agent.log_info('Log a: %s' % message)
def log_b(agent, message):
agent.log_info('Log b: %s' % message)
def send_messages(agent):
agent.send('main', 'Apple', topic='a')
agent.send('main', 'Banana', topic='b')
if __name__ == '__main__':
... | bob.subscribe('listener', handler={'b': log_b}) |
Predict the next line after this snippet: <|code_start|>
def log_a(agent, message):
agent.log_info('Log a: %s' % message)
def log_b(agent, message):
agent.log_info('Log b: %s' % message)
def send_messages(agent):
agent.send('main', 'Apple', topic='a')
agent.send('main', 'Banana', topic='b')
if __... | bob.subscribe('listener', handler={'b': log_b}) |
Continue the code snippet: <|code_start|>
def log_a(agent, message):
agent.log_info('Log a: %s' % message)
def log_b(agent, message):
agent.log_info('Log b: %s' % message)
if __name__ == '__main__':
# System deployment
ns = run_nameserver()
alice = run_agent('Alice')
bob = run_agent('Bob'... | eve.connect(addr, handler={'a': log_a}) |
Predict the next line after this snippet: <|code_start|>
def log_a(agent, message):
agent.log_info('Log a: %s' % message)
def log_b(agent, message):
agent.log_info('Log b: %s' % message)
if __name__ == '__main__':
# System deployment
ns = run_nameserver()
alice = run_agent('Alice')
bob = ... | eve.connect(addr, handler={'a': log_a}) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.