Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Based on the snippet: <|code_start|># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# Module API
class Spider(CrawlSpider):
# Public
<|code_end|>
, predict the immediate next line with ... | name = 'actrn' |
Using the snippet: <|code_start|>with betamax.Betamax.configure() as cfg:
cfg.cassette_library_dir = 'tests/cassettes/'
record_mode = 'none' if os.environ.get('CI') else 'once'
cfg.default_cassette_options['record_mode'] = record_mode
cfg.default_cassette_options['match_requests_on'] = [
'uri',... | def _get_url(url, request_kwargs={}): |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
<|code_end|>
with the help of current file imports:
import logging
import xmltodict
im... | try: |
Given the code snippet: <|code_start|>from __future__ import unicode_literals
try:
except ImportError:
def parse_record(url, review_file):
tree = etree.parse(review_file)
study_robs = []
studies = []
# Get risk of bias
root = tree.getroot()
doi_id = root.attrib.get('DOI', '')
quality_it... | group_id = group.attrib.get('ID') |
Using the snippet: <|code_start|># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# Module API
class Spider(CrawlSpider):
# Public
name = 'jprn'
allowed_domains = ['upload.umin.a... | if page_from is None: |
Here is a snippet: <|code_start|># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
class Spider(CrawlSpider):
name = 'fda_dap'
allowed_domains = ['accessdata.fda.gov']
def __init__... | ) |
Next line prediction: <|code_start|># -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
logger = logging.getLogger(__name__)
# Module API
def parse_record(res):
# Init data
data = {}
... | value = res.css(path).extract_first() |
Given the code snippet: <|code_start|>from __future__ import unicode_literals
# Module API
class Spider(CrawlSpider):
# Public
name = 'isrctn'
allowed_domains = ['isrctn.com']
def __init__(self, conf=None, conn=None, date_from=None, date_to=None):
# Save conf/conn
self.conf = con... | allow=r'page=\d+', |
Based on the snippet: <|code_start|># coding=utf-8
# Copyright 2022 The init2winit Authors.
#
# 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
... | 'eval_split': 'test', |
Predict the next line after this snippet: <|code_start|> remainder = tf.constant(1.0, tf.float32,[self.batch_size]) - prob
remainder_expanded = tf.expand_dims(remainder,1)
tiled_remainder = tf.tile(remainder_expanded,[1,self.hidden_size])
acc_state = tf.nn.relu(tf.matmul(... | self.max_input_len = max_input_len |
Here is a snippet: <|code_start|>class Adaptive_Episodes(object):
""" Implements Iterative Alternating Attention for Machine Reading
http://arxiv.org/pdf/1606.02245v3.pdf """
def __init__(self, config, pretrained_embeddings=None,
update_embeddings=True, is_training=False):
se... | gate_input = tf.nn.dropout(gate_input, self.config.keep_prob) |
Based on the snippet: <|code_start|>
router = fastapi.APIRouter()
oauth = OAuth()
oauth.register(
name="sso",
server_metadata_url=aurweb.config.get("sso", "openid_configuration"),
client_kwargs={"scope": "openid"},
client_id=aurweb.config.get("sso", "client_id"),
client_secret=aurweb.config.ge... | ) |
Using the snippet: <|code_start|>
router = fastapi.APIRouter()
oauth = OAuth()
oauth.register(
name="sso",
<|code_end|>
, determine the next line of code. You have imports:
import time
import uuid
import fastapi
import aurweb.config
import aurweb.db
from urllib.parse import urlencode
from authlib.integration... | server_metadata_url=aurweb.config.get("sso", "openid_configuration"), |
Based on the snippet: <|code_start|>
router = fastapi.APIRouter()
oauth = OAuth()
oauth.register(
name="sso",
server_metadata_url=aurweb.config.get("sso", "openid_configuration"),
client_kwargs={"scope": "openid"},
client_id=aurweb.config.get("sso", "client_id"),
client_secret=aurweb.config.ge... | ) |
Based on the snippet: <|code_start|> raise InvalidUserException("test")
except InvalidUserException as exc:
assert str(exc) == "unknown user: test"
def test_not_voted_exception():
try:
raise NotVotedException("test")
except NotVotedException as exc:
assert str(exc) == "missi... | assert str(exc) == "invalid repository name: test" |
Here is a snippet: <|code_start|>
def test_aurweb_exception():
try:
raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
try:
raise MaintenanceException("test")
except MaintenanceException as exc:
asse... | def test_banned_exception(): |
Continue the code snippet: <|code_start|>
def test_aurweb_exception():
try:
raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
<|code_end|>
. Use current file imports:
from aurweb.exceptions import (AlreadyVotedException, ... | try: |
Given the code snippet: <|code_start|>
def test_banned_exception():
try:
raise BannedException("test")
except BannedException as exc:
assert str(exc) == "test"
def test_already_voted_exception():
try:
raise AlreadyVotedException("test")
except AlreadyVotedException as exc:
... | def test_invalid_packagebase_exception(): |
Continue the code snippet: <|code_start|>
def test_already_voted_exception():
try:
raise AlreadyVotedException("test")
except AlreadyVotedException as exc:
assert str(exc) == "already voted for package base: test"
def test_broken_update_hook_exception():
try:
raise BrokenUpdateHook... | try: |
Using the snippet: <|code_start|>
def test_aurweb_exception():
try:
raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
try:
raise MaintenanceException("test")
except MaintenanceException as exc:
asse... | def test_already_voted_exception(): |
Predict the next line for this snippet: <|code_start|>
def test_aurweb_exception():
try:
raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
try:
raise MaintenanceException("test")
except MaintenanceException... | try: |
Given the code snippet: <|code_start|> raise InvalidArgumentsException("test")
except InvalidArgumentsException as exc:
assert str(exc) == "test"
def test_invalid_packagebase_exception():
try:
raise InvalidPackageBaseException("test")
except InvalidPackageBaseException as exc:
... | assert str(exc) == "unknown user: test" |
Predict the next line for this snippet: <|code_start|>
def test_aurweb_exception():
try:
raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
try:
raise MaintenanceException("test")
except MaintenanceException... | def test_banned_exception(): |
Continue the code snippet: <|code_start|>
def test_banned_exception():
try:
raise BannedException("test")
except BannedException as exc:
assert str(exc) == "test"
def test_already_voted_exception():
try:
raise AlreadyVotedException("test")
except AlreadyVotedException as exc:
... | def test_invalid_packagebase_exception(): |
Using the snippet: <|code_start|> raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
try:
raise MaintenanceException("test")
except MaintenanceException as exc:
assert str(exc) == "test"
def test_banned_... | assert str(exc) == "broken update hook: test" |
Given the following code snippet before the placeholder: <|code_start|>
def test_aurweb_exception():
try:
raise AurwebException("test")
except AurwebException as exc:
assert str(exc) == "test"
def test_maintenance_exception():
try:
raise MaintenanceException("test")
except Mai... | assert str(exc) == "test" |
Continue the code snippet: <|code_start|>
app = FastAPI()
session_secret = aurweb.config.get("fastapi", "session_secret")
if not session_secret:
raise Exception("[fastapi] session_secret must not be empty")
<|code_end|>
. Use current file imports:
import http
import aurweb.config
from fastapi import FastAPI, ... | app.add_middleware(SessionMiddleware, secret_key=session_secret) |
Based on the snippet: <|code_start|>
class Test_remove_thousand_sep:
@pytest.mark.parametrize(
["value", "expected"],
[
["1,000,000,000,000", "1000000000000"],
["100,000,000,000", "100000000000"],
["10,000,000,000", "10000000000"],
["9,999,999,999", ... | def test_normal(self, value, expected): |
Using the snippet: <|code_start|> try:
if self.connect():
ftp_client= self.client.open_sftp()
ftp_client.put(uploadlocalfilepath,uploadremotefilepath)
ftp_client.close()
self.client.close()
else:
print("Could ... | result_flag = False |
Based on the snippet: <|code_start|>
# self.connect()
def connect(self, raise_errors=True):
# try:
# self.imap = imaplib.IMAP4_SSL(self.GMAIL_IMAP_HOST, self.GMAIL_IMAP_PORT)
# except socket.error:
# if raise_errors:
# raise Exception('Connection fa... | mailbox.external_name = mailbox_name |
Given the code snippet: <|code_start|>sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
#get details from conf file for POM
src_pom_files_list = conf.src_pom_files_list
dst_folder_pom = conf.dst_folder_pom
#check if POM folder exists and then copy files
if os.path.exists(dst_folder_pom):
f... | shutil.copy2(every_src_pom_file,dst_folder_pom) |
Given snippet: <|code_start|> if response == "Remote Flag status":
remote_flag = get_remote_flag_status()
if response == "Testrail Flag status":
testrail_flag = get_testrailflag_status()
if response == "Tesults Flag status":
tesults_flag = get_tesultsflag_sta... | app_name,app_path) |
Here is a snippet: <|code_start|> "Other Devices"]).ask()
if device_name == "Other Devices":
device_name = questionary.text("Enter the device name").ask()
elif mobile_os_version == "8.1":
device_name = questionary.select("Select the device name",... | device_name = questionary.text("Enter the device name").ask() |
Using the snippet: <|code_start|> choices=["Yes","No"]).ask()
if tesults_flag == "Yes":
tesults_flag = "Y"
else:
tesults_flag = "N"
return tesults_flag
def set_remote_credentials():
"set remote credentials file to run the test on browserstack or s... | if remote_flag == "Yes": |
Predict the next line after this snippet: <|code_start|>
class GitStashWindowCmd(GitCmd, GitStashHelper, GitErrorHelper):
def pop_or_apply_from_panel(self, action):
repo = self.get_repo()
if not repo:
return
stashes = self.get_stashes(repo)
if not stashes:
... | window = sublime.active_window() |
Predict the next line after this snippet: <|code_start|># coding: utf-8
class GitStashWindowCmd(GitCmd, GitStashHelper, GitErrorHelper):
def pop_or_apply_from_panel(self, action):
repo = self.get_repo()
<|code_end|>
using the current file's imports:
import time
import sublime
from sublime_plugin impo... | if not repo: |
Next line prediction: <|code_start|># coding: utf-8
class GitStashWindowCmd(GitCmd, GitStashHelper, GitErrorHelper):
def pop_or_apply_from_panel(self, action):
repo = self.get_repo()
<|code_end|>
. Use current file imports:
(import time
import sublime
from sublime_plugin import WindowCommand
from .uti... | if not repo: |
Next line prediction: <|code_start|># coding: utf-8
class GitStashWindowCmd(GitCmd, GitStashHelper, GitErrorHelper):
def pop_or_apply_from_panel(self, action):
repo = self.get_repo()
if not repo:
return
<|code_end|>
. Use current file imports:
(import time
import sublime
from subl... | stashes = self.get_stashes(repo) |
Predict the next line after this snippet: <|code_start|>
enabled = True
__all__ = ['LegitSwitchCommand', 'LegitSyncCommand', 'LegitPublishCommand', 'LegitUnpublishCommand',
'LegitHarvestCommand', 'LegitSproutCommand', 'LegitGraftCommand', 'LegitBranchesCommand']
class LegitWindowCmd(LegitCmd):
de... | choices.append(['%s%s' % (current, name.strip()), ' %s' % pub]) |
Here is a snippet: <|code_start|>
def is_visible(self):
return enabled
def is_enabled(self):
return enabled
def get_branch_choices(self, repo, filter=('published', 'unpublished')):
lines = self.legit_lines(['branches'], cwd=repo)
branches, choices = [], []
for l in ... | self.window.show_quick_panel(choices, on_done, sublime.MONOSPACE_FONT) |
Continue the code snippet: <|code_start|> branches, choices = [], []
for l in lines:
if not l:
continue
current = l[0:2]
name, pub = l[2:].split(None, 1)
pub = pub.strip(' \t()')
if not pub in filter:
continue
... | runner.start() |
Here is a snippet: <|code_start|># coding: utf-8
RE_DIFF_HEAD = re.compile(r'(---|\+\+\+){3} (a|b)/(dev/null)?')
GIT_DIFF_TITLE = '*git-diff*'
GIT_DIFF_TITLE_PREFIX = GIT_DIFF_TITLE + ': '
GIT_DIFF_CACHED_TITLE = '*git-diff-cached*'
GIT_DIFF_CACHED_TITLE_PREFIX = GIT_DIFF_CACHED_TITLE + ': '
GIT_DIFF_CLEAN = "No... | GIT_DIFF_VIEW_SYNTAX = 'Packages/SublimeGit/syntax/SublimeGit Diff.tmLanguage' |
Predict the next line for this snippet: <|code_start|># coding: utf-8
RE_DIFF_HEAD = re.compile(r'(---|\+\+\+){3} (a|b)/(dev/null)?')
GIT_DIFF_TITLE = '*git-diff*'
GIT_DIFF_TITLE_PREFIX = GIT_DIFF_TITLE + ': '
GIT_DIFF_CACHED_TITLE = '*git-diff-cached*'
GIT_DIFF_CACHED_TITLE_PREFIX = GIT_DIFF_CACHED_TITLE + ': '
... | GIT_DIFF_CLEAN = "Nothing to stage (no difference between working tree and index)" |
Given the code snippet: <|code_start|> return
self.kind = kind
self.base = base
self.window.show_input_panel('%s:' % self.kind.capitalize(), '', partial(self.on_select, repo), noop, noop)
def on_select(self, repo, selection):
selection = selection.strip()
if not ... | return |
Continue the code snippet: <|code_start|> def on_select(self, repo, selection):
selection = selection.strip()
if not selection:
return
if self.base:
self.window.show_input_panel('Base:', '', partial(self.on_complete, repo, selection), noop, noop)
else:
... | progress = "Finishing %s: %s" % (self.kind, selection) |
Based on the snippet: <|code_start|> stderr = stderr.strip()
if stderr:
for line in stderr.splitlines():
stdout += "# %s\n" % line
old_msg = ''
if amend:
old_msg = self.git_lines(['rev-list', '--format=%B', '--max-count=1', 'HEAD'], cwd=repo)
... | self.window.run_command('show_panel', {'panel': 'output.git-commit'}) |
Predict the next line after this snippet: <|code_start|> '--verbose' if self.is_verbose else None]
exit, stdout, stderr = self.git(cmd, cwd=repo)
stderr = stderr.strip()
if stderr:
for line in stderr.splitlines():
stdout += "# %s\n" % line
old_... | def show_commit_panel(self, content): |
Predict the next line for this snippet: <|code_start|>GIT_COMMIT_TEMPLATE = u"""{old_msg}
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
{status}"""
GIT_AMEND_PUSHED = (u"It is discouraged to rewrite history which has already been ... | stderr = stderr.strip() |
Given the code snippet: <|code_start|>
CUT_LINE = u"------------------------ >8 ------------------------\n"
CUT_EXPLANATION = u"# Do not touch the line above.\n# Everything below will be removed.\n"
class GitCommit(object):
windows = {}
class GitCommitWindowCmd(GitCmd, GitStatusHelper):
@property
def ... | old_msg = self.git_lines(['rev-list', '--format=%B', '--max-count=1', 'HEAD'], cwd=repo) |
Given snippet: <|code_start|>
class GitCommitWindowCmd(GitCmd, GitStatusHelper):
@property
def is_verbose(self):
return get_setting('git_commit_verbose', False)
def get_commit_template(self, repo, add=False, amend=False):
cmd = ['commit', '--dry-run', '--status',
'--all' if ... | else: |
Using the snippet: <|code_start|>GIT_COMMIT_TEMPLATE = u"""{old_msg}
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
{status}"""
GIT_AMEND_PUSHED = (u"It is discouraged to rewrite history which has already been pushed. "
... | stderr = stderr.strip() |
Next line prediction: <|code_start|>
return repo
def get_repo_from_view(self, view=None, silent=True):
if view is None:
return
# first try the view settings (for things like status, diff, etc)
view_repo = view.settings().get('git_repo')
if view_repo:
... | return active_view_repo |
Using the snippet: <|code_start|># coding: utf-8
NO_REMOTES = u"No remotes have been configured. Remotes can be added with the Git: Add Remote command. Do you want to add a remote now?"
DELETE_REMOTE = u"Are you sure you want to delete the remote %s?"
NO_ORIGIN_REMOTE = u"You are not on any branch and no origin ha... | CURRENT_NO_UPSTREAM = u"No upstream currently is currently specified for {branch}. Do you want to set the upstream to {merge} on {remote}?" |
Given the code snippet: <|code_start|># coding: utf-8
NO_REMOTES = u"No remotes have been configured. Remotes can be added with the Git: Add Remote command. Do you want to add a remote now?"
DELETE_REMOTE = u"Are you sure you want to delete the remote %s?"
NO_ORIGIN_REMOTE = u"You are not on any branch and no orig... | NO_BRANCH_REMOTES = u"No remotes have been configured for the branch %s and no origin exists. Please run Git: Remote Add to add a remote." |
Given the following code snippet before the placeholder: <|code_start|># coding: utf-8
NO_REMOTES = u"No remotes have been configured. Remotes can be added with the Git: Add Remote command. Do you want to add a remote now?"
DELETE_REMOTE = u"Are you sure you want to delete the remote %s?"
NO_ORIGIN_REMOTE = u"You ... | REMOTE_SHOW_TITLE_PREFIX = '*git-remote*: ' |
Predict the next line after this snippet: <|code_start|># coding: utf-8
GIT_INIT_NO_DIR_ERROR = "No directory provided. Aborting git init."
GIT_INIT_DIR_NOT_EXISTS_MSG = "The directory %s does not exist. Create directory?"
GIT_INIT_NOT_ISDIR_ERROR = "%s is not a directory. Aborting git init."
GIT_INIT_DIR_EXISTS_ER... | GIT_INIT_DIR_LABEL = "Directory:" |
Here is a snippet: <|code_start|># -*- coding: utf-8 -*-
class MatterlloWizard(SessionWizardView):
form_list = [WebhookCreateForm, BridgeCreateForm]
template_name = "core/wizard.html"
def done(self, form_list, **kwargs):
<|code_end|>
. Write the next line using the current file imports:
from django.con... | return HttpResponseRedirect("/") |
Here is a snippet: <|code_start|># -*- coding: utf-8 -*-
class BridgeListView(ListView):
model = Bridge
template_name = "core/index.html"
class BridgeDetailView(DetailView):
model = Bridge
class BridgeCreateView(SuccessMessageMixin, CreateView):
model = Bridge
form_class = BridgeCreateForm
... | return super(BridgeCreateView, self).form_valid(form) |
Given the code snippet: <|code_start|># -*- coding: utf-8 -*-
class WebhookDetailView(DetailView):
model = Webhook
class WebhookCreateView(SuccessMessageMixin, CreateView):
model = Webhook
form_class = WebhookCreateForm
success_message = "%(name)s was created successfully"
def form_valid(self,... | def get_success_url(self): |
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*-
class WebhookDetailView(DetailView):
model = Webhook
class WebhookCreateView(SuccessMessageMixin, CreateView):
model = Webhook
form_class = WebhookCreateForm
success_message = "%(name)s was created successfully"
def ... | board_id = self.kwargs.get("board_id") |
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*-
class WebhookDetailView(DetailView):
model = Webhook
class WebhookCreateView(SuccessMessageMixin, CreateView):
model = Webhook
form_class = WebhookCreateForm
success_message = "%(name)s was created successfully"
def form_valid(se... | def get_context_data(self, **kwargs): |
Based on the snippet: <|code_start|># -*- coding: utf-8 -*-
class BridgeCreateForm(forms.ModelForm):
events = forms.MultipleChoiceField(
choices=Bridge.EVENT_CHOICES,
widget=forms.CheckboxSelectMultiple,
)
def __init__(self, *args, **kwargs):
super(BridgeCreateForm, self).__init_... | layout = helper.layout = Layout() |
Based on the snippet: <|code_start|> HTML(
'<button class="btn btn-info" type="button" onclick="document.querySelectorAll(\'.board-event\').forEach(x => x.checked = false);">Uncheck all</button>'
)
)
)
layout.append(FormActions(Submit("save"... | placeholder="https://mattermost.gitlab.com/hooks/b5g6pyoqsjy88fa6kzn7xi1rzy", |
Predict the next line after this snippet: <|code_start|>
_FASTQ_TYPE_TO_FLAG = {"sanger": "sanger",
"illumina_1.3+": "illumina",
"illumina_1.5+": "illumina",
"illumina_1.8+": "sanger",
"solexa": "solexa"}
def _get_quality_type... | else: |
Given the code snippet: <|code_start|>
logger = logging.getLogger("bipy")
_FASTQ_TYPE_TO_FLAG = {"sanger": "sanger",
"illumina_1.3+": "illumina",
"illumina_1.5+": "illumina",
"illumina_1.8+": "sanger",
"solexa": "solexa"}
def... | out_files = run_as_pe(first, second, config) |
Predict the next line for this snippet: <|code_start|>
STAGENAME = "piranha"
class TestPiranha(unittest.TestCase):
def setUp(self):
self.config_file = os.path.join("test", STAGENAME, "test_" +
STAGENAME + ".yaml")
<|code_end|>
with the help of current file imports... | with open(self.config_file) as in_handle: |
Using the snippet: <|code_start|>
class TestPiranha(unittest.TestCase):
def setUp(self):
self.config_file = os.path.join("test", STAGENAME, "test_" +
STAGENAME + ".yaml")
with open(self.config_file) as in_handle:
self.config = yaml.load(in_handle)... | out_dir = self.out_dir) |
Given the following code snippet before the placeholder: <|code_start|> correct_file = [os.path.join(cur_dir, "data", "correct_fastqc.txt"),
os.path.join(cur_dir, "data", "correct_fastqc.txt")]
run_result = self.stage(input_paired)
out_table = map(self._get_result, run_res... | suite = unittest.TestLoader().loadTestsFromTestCase(TestFastqc) |
Given snippet: <|code_start|>
CONFIG_FILE = "test/novoalign/test_novoalign.yaml"
class TestNovoalign(unittest.TestCase):
def setUp(self):
with open(CONFIG_FILE) as in_handle:
self.config = yaml.load(in_handle)
self.input_files = self.config["input"]
self.db = os.path.basename(... | def test_novoindex(self): |
Predict the next line after this snippet: <|code_start|>
CONFIG_FILE = "test/novoalign/test_novoalign.yaml"
class TestNovoalign(unittest.TestCase):
def setUp(self):
with open(CONFIG_FILE) as in_handle:
self.config = yaml.load(in_handle)
self.input_files = self.config["input"]
... | def test_novoalign(self): |
Predict the next line for this snippet: <|code_start|>
CONFIG_FILE = "test/novoalign/test_novoalign.yaml"
class TestNovoalign(unittest.TestCase):
def setUp(self):
with open(CONFIG_FILE) as in_handle:
self.config = yaml.load(in_handle)
self.input_files = self.config["input"]
se... | self.config) |
Continue the code snippet: <|code_start|>
STAGENAME = "trim_galore"
class TestTrimgalore(unittest.TestCase):
def setUp(self):
self.config_file = "test/trim_galore/test_trim_galore.yaml"
with open(self.config_file) as in_handle:
self.config = yaml.load(in_handle)
<|code_end|>
. Use cu... | self.input_file = self.config["input"] |
Given snippet: <|code_start|>
CONFIG_FILE = "test/bowtie/test_bowtie.yaml"
class TestBowtie(unittest.TestCase):
def setUp(self):
with open(CONFIG_FILE) as in_handle:
self.config = yaml.load(in_handle)
self.stage_config = self.config["stage"]["bowtie"]
def test_single(self):
... | single = self.config["input_single"] |
Here is a snippet: <|code_start|> self.assertTrue(isinstance(repository, StageRepository))
def test_builtin_plugins(self):
"""
test that we can find some of the built in plugins
"""
fastqc = self.repository["fastqc"]
self.assertTrue(issubclass(fastqc, AbstractStage))... | def __init__(self, config): |
Predict the next line for this snippet: <|code_start|> """
repository = StageRepository(self.config)
self.assertTrue(isinstance(repository, StageRepository))
def test_builtin_plugins(self):
"""
test that we can find some of the built in plugins
"""
fastqc = s... | stage = "test_plugin" |
Given the following code snippet before the placeholder: <|code_start|>
class TestDss(unittest.TestCase):
def setUp(self):
self.count_file = "test/data/pasilla_gene_counts.tsv"
self.conds = ["untreat", "untreat", "untreat", "untreat",
"treat", "treat", "treat"]
def test_... | out_prefix = "results/tests/dss/test_dss" |
Given the code snippet: <|code_start|>
if file_exists(out_file):
return out_file
if exclude:
exclude_arg = "-v"
else:
exclude_arg = "-u"
sh.bedtools.intersect(exclude_arg, "-abam", bam_file, b=bed_file,
_out=out_file)
return out_file
def count_o... | cmd = ["coverageBed", "-abam", in_file, "-b", bed] |
Given the code snippet: <|code_start|>"""reporting.py provides classes to inherit from to provide output
reports for stages of pipelines.
"""
def safe_latex(to_fix):
"""Escape characters that make LaTeX unhappy.
Lifted from Brad Chapman (bcbio)
"""
chars = ["%", "_", "&", "#"]
for char in chars:... | latex_file = "latex.tex" |
Using the snippet: <|code_start|>
logger = logging.getLogger('config_test')
logger.setLevel(logging.INFO)
class ConfigValidator(object):
def __init__(self):
<|code_end|>
, determine the next line of code. You have imports:
import unittest
import yaml
import logging
import os
from bcbio.utils import file_exists
... | pass |
Predict the next line for this snippet: <|code_start|>TOPHAT_2_CONFIG = "test/tophat/test_tophat2_bowtie2.yaml"
def _load_config(config_file):
with open(config_file) as in_handle:
config = yaml.load(in_handle)
return config
def _run_fixture(input_files, config):
if len(input_files) == 2:
o... | for input_files in config["input"]: |
Next line prediction: <|code_start|>
def program_exists(path):
return which(path)
def _results_dir(config, prefix=""):
def _make_dir(base):
out_dir = os.path.join(base, "rseqc",
prefix)
safe_makedir(out_dir)
return out_dir
if "dir" not in config:
... | if not program_exists(PROGRAM): |
Given the code snippet: <|code_start|>
def program_exists(path):
return which(path)
def _results_dir(config, prefix=""):
def _make_dir(base):
out_dir = os.path.join(base, "rseqc",
prefix)
safe_makedir(out_dir)
return out_dir
if "dir" not in config:
... | exit(1) |
Given the code snippet: <|code_start|>
def program_exists(path):
return which(path)
def _results_dir(config, prefix=""):
def _make_dir(base):
out_dir = os.path.join(base, "rseqc",
prefix)
safe_makedir(out_dir)
return out_dir
if "dir" not in config:... | if not program_exists(PROGRAM): |
Predict the next line for this snippet: <|code_start|>
def program_exists(path):
return which(path)
def _results_dir(config, prefix=""):
def _make_dir(base):
out_dir = os.path.join(base, "rseqc",
prefix)
safe_makedir(out_dir)
return out_dir
<|code_end|... | if "dir" not in config: |
Given snippet: <|code_start|> new_figures = []
for figure in figures:
filename = os.path.basename(figure[0])
caption = self.CAPTIONS.get(filename, "")
new_figures.append((figure[0], caption, figure[2]))
return new_figures
def clean_figures(self, figures):
... | % for i, (figure, caption, size) in enumerate (figures): |
Next line prediction: <|code_start|> return new_figures
def clean_figures(self, figures):
new_figures = []
for figure in figures:
filename = safe_latex(figure[0])
new_figures.append((filename, figure[1], figure[2]))
return new_figures
def generate_repor... | \end{figure} |
Using the snippet: <|code_start|>
def program_exists(path):
return which(path)
def _results_dir(config, prefix=""):
def _make_dir(base):
out_dir = os.path.join(base, "rseqc",
prefix)
safe_makedir(out_dir)
return out_dir
if "dir" not in config:
... | logger.error("%s is not in the path or is not executable. Make sure " |
Predict the next line after this snippet: <|code_start|>
def _fetch_chrom_sizes(config):
PROGRAM = "fetchChromSizes"
if not program_exists(PROGRAM):
logger.error("%s is not in the path or is not executable. Make sure "
"it is installed or go to "
"http://hgdow... | logger.error("chromosome size file does not exist. Check " |
Next line prediction: <|code_start|> os.unlink(out_file)
def test_bamstat(self):
out_file = rseqc.bam_stat(self.input_file, self.config)
self.assertTrue(file_exists(out_file))
os.unlink(out_file)
def test_clipping_profile(self):
out_file = rseqc.clipping_profile(self.inp... | self.config) |
Given the following code snippet before the placeholder: <|code_start|>STAGENAME = "htseq-count"
class TestHtseqcount(unittest.TestCase):
def setUp(self):
self.config_file = "test/htseq-count/test_htseq_count.yaml"
with open(self.config_file) as in_handle:
self.config = yaml.load(in_h... | self.assertTrue(os.path.getsize(run_result) > 0) |
Predict the next line after this snippet: <|code_start|> r('''
cds = estimateDispersions(cds, method="blind", sharingMode="fit-only")
''')
else:
r('''
cds = estimateDispersions(cds)
''')
_plot_disp_ests(r, dispersion_plot_out)
# if there are two conditions us... | plotDispEsts <- function(cds) { |
Next line prediction: <|code_start|> "duplication_levels.png": "",
"per_bases_n_content.png": "",
"per_sequence_quality.png": "",
"sequence_length_distribution.png": ""}
def template(self):
return self._template
def _add_captions(self, fig... | \begin{table}[h] |
Given the code snippet: <|code_start|> def template(self):
return self._template
def _add_captions(self, figures):
new_figures = []
for figure in figures:
filename = os.path.basename(figure)
caption = self.CAPTIONS.get(filename, "")
new_figures.append(... | ${k} & ${v} \\\ |
Given the following code snippet before the placeholder: <|code_start|> \hline
\end{tabular}
\caption{Summary of lane results}
\end{table}
% endif
% if figures:
% for i, (figure, caption, size) in enumerate(figures):
\begin{figure}[htbp]
\centering
\includegraphics[width=... | \end{table} |
Continue the code snippet: <|code_start|> filename = os.path.basename(figure)
caption = self.CAPTIONS.get(filename, "")
new_figures.append((figure[0], caption, figure[2]))
return new_figures
@classmethod
def generate_report(self, name=None, summary=None, figures=None,... | % endif |
Given snippet: <|code_start|> \hline
% for k, v in summary.items():
${k} & ${v} \\\
% endfor
\hline
\end{tabular}
\caption{Summary of lane results}
\end{table}
% endif
% if figures:
% for i, (figure, caption, size) in enumerate(figures):
\begin{figure}[htbp]
\ce... | % endfor |
Using the snippet: <|code_start|> out_md5 = map(self._get_md5, output)
correct_files = self._correct_files(output)
correct_md5 = map(self._get_md5, correct_files)
self.assertTrue(out_md5 == correct_md5)
#map(os.remove, output)
def _get_md5(self, out_file):
with open(o... | def test_downsample_bam_with_memoize(self): |
Here is a snippet: <|code_start|>
CONFIG_FILE = "test/utils/test_utils.yaml"
PAIRED_FILES = ["FA14dayrep1_1.fastq", "FA14dayrep1_2.fastq",
"FA1dayrep1_1.fastq", "FA1dayrep1_2.fastq",
"FA28dayrep1_1.fastq", "FA28dayrep1_2.fastq",
"FA3dayrep3_1.fastq", "FA3dayrep3_2.fastq",... | with open(CONFIG_FILE) as in_handle: |
Given snippet: <|code_start|>
manager = Manager(app)
manager.add_command('db', MigrateCommand)
@manager.command
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand
from flask.ext import migrate
from dat... | def reset(): |
Given the following code snippet before the placeholder: <|code_start|>from __future__ import with_statement
config = context.config
config.set_main_option('sqlalchemy.url', app.config['SQLALCHEMY_DATABASE_URI'])
target_metadata = db.metadata
def run_migrations_offline():
url = config.get_main_option("sqlalchem... | engine = engine_from_config( |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.