Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Predict the next line after this snippet: <|code_start|>
class BaseCorrector(object):
def __init__(self):
self.data = file(os.path.join(settings.DATA_PATH, "big.txt")).read()
<|code_end|>
using the current file's imports:
from scan import settings
import re
import os
and any relevant context from other ... | def words(self, text): |
Here is a snippet: <|code_start|> min_samples_leaf=3,
random_state=1
)
self.fit_feats()
self.fit_done = False
def fit_feats(self):
self.feature_generator.fit(self.text, self.scores)
def get_features(self):
feats = []
for t in ... | def predict(self, text): |
Given the following code snippet before the placeholder: <|code_start|> path_string = "{0}_{1}.pickle".format(self.question.id, timestamp)
model = Model(
question=self.question,
error=scorer.cv_score,
path=path_string
)
db.session.add(model)
j... | n_estimators=100, |
Based on the snippet: <|code_start|> path_string = "{0}_{1}.pickle".format(self.question.id, timestamp)
model = Model(
question=self.question,
error=scorer.cv_score,
path=path_string
)
db.session.add(model)
joblib.dump(scorer, os.path.join(set... | n_estimators=100, |
Here is a snippet: <|code_start|>
unique_scores = set(scores)
if len(unique_scores) <= self.classification_max:
self.classifier = RandomForestClassifier(
n_estimators=100,
min_samples_split=4,
min_samples_leaf=3,
random_state=1
... | self.cv_score = self.cv_scores.mean() |
Here is a snippet: <|code_start|>
question_id = db.Column(db.Integer, db.ForeignKey('questions.id'))
question = db.relationship("Question", backref=db.backref('essays', order_by=id))
created = db.Column(db.DateTime(timezone=True), default=datetime.utcnow)
updated = db.Column(db.DateTime(timezone=True),... | question = db.relationship("Question", backref=db.backref('models', order_by=id)) |
Next line prediction: <|code_start|> description = db.Column(db.String(STRING_MAX))
def __repr__(self):
return "<Role(name='%s')>" % (self.name)
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
first_name = db.Column(db.String(STRING_MAX))
last_name = db.Column(... | prompt = db.Column(db.Text) |
Using the snippet: <|code_start|>
def single_instance_task():
def task_exc(func):
@functools.wraps(func)
<|code_end|>
, determine the next line of code. You have imports:
import functools
from celery.signals import worker_shutdown
from app import cache
and context (class names, function names, or code) av... | def wrapper(*args, **kwargs): |
Given the following code snippet before the placeholder: <|code_start|>
def make_celery(app):
celery = Celery(app.import_name, broker=app.config['BROKER_URL'])
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **k... | app = create_app() |
Based on the snippet: <|code_start|>
def make_celery(app):
celery = Celery(app.import_name, broker=app.config['BROKER_URL'])
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
<|code_end|>
, predict the immediate next line with the help of imports:... | def __call__(self, *args, **kwargs): |
Given the following code snippet before the placeholder: <|code_start|>
def make_celery(app):
celery = Celery(app.import_name, broker=app.config['BROKER_URL'])
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **k... | app = create_app() |
Given the code snippet: <|code_start|>
def make_celery(app):
celery = Celery(app.import_name, broker=app.config['BROKER_URL'])
celery.conf.update(app.config)
<|code_end|>
, generate the next line using the imports in this file:
from flask import Flask
from flask.ext.security import Security, SQLAlchemyUserData... | TaskBase = celery.Task |
Given the following code snippet before the placeholder: <|code_start|>
def make_celery(app):
celery = Celery(app.import_name, broker=app.config['BROKER_URL'])
celery.conf.update(app.config)
TaskBase = celery.Task
class ContextTask(TaskBase):
abstract = True
def __call__(self, *args, **k... | celery.Task = ContextTask |
Next line prediction: <|code_start|>
log = logging.getLogger(__name__)
class DataLoader(object):
def __init__(self, pathname):
self.pathname = pathname
def load_text_files(self, pathname):
filenames = os.listdir(pathname)
text = []
for filename in filenames:
data = ... | return text |
Here is a snippet: <|code_start|>
log = logging.getLogger(__name__)
class DataLoader(object):
def __init__(self, pathname):
self.pathname = pathname
def load_text_files(self, pathname):
filenames = os.listdir(pathname)
text = []
for filename in filenames:
data = ope... | def load_data(self): |
Given the following code snippet before the placeholder: <|code_start|>
log = logging.getLogger(__name__)
class DataLoader(object):
def __init__(self, pathname):
self.pathname = pathname
def load_text_files(self, pathname):
filenames = os.listdir(pathname)
text = []
<|code_end|>
, pred... | for filename in filenames: |
Next line prediction: <|code_start|>
log = logging.getLogger(__name__)
class DataLoader(object):
def __init__(self, pathname):
<|code_end|>
. Use current file imports:
(from core.tests.base import ScanTest
from scan.log import logging
from core.tests.base import db
from mock import patch
from core.algo.scorer imp... | self.pathname = pathname |
Given the code snippet: <|code_start|>
class SqlAlchemyTask(celery.Task):
"""An abstract Celery Task that ensures that the connection the the
database is closed on task completion"""
abstract = True
def after_return(self, status, retval, task_id, args, kwargs, einfo):
db.session.remove()
@cele... | score_essay(e[0]) |
Continue the code snippet: <|code_start|>
class SqlAlchemyTask(celery.Task):
"""An abstract Celery Task that ensures that the connection the the
database is closed on task completion"""
abstract = True
def after_return(self, status, retval, task_id, args, kwargs, einfo):
db.session.remove()
@c... | create_model(question_id) |
Using the snippet: <|code_start|>
class SqlAlchemyTask(celery.Task):
"""An abstract Celery Task that ensures that the connection the the
database is closed on task completion"""
abstract = True
def after_return(self, status, retval, task_id, args, kwargs, einfo):
db.session.remove()
@celery.ta... | def create_and_score(question_id): |
Given snippet: <|code_start|>
class SqlAlchemyTask(celery.Task):
"""An abstract Celery Task that ensures that the connection the the
database is closed on task completion"""
abstract = True
def after_return(self, status, retval, task_id, args, kwargs, einfo):
db.session.remove()
@celery.task(b... | for e in essay_ids: |
Based on the snippet: <|code_start|>
class Vectorizer(object):
max_features = settings.MAX_FEATURES / 2
def __init__(self):
self.fit_done = False
def fit(self, input_text, input_scores):
self.initial_vectorizer = CountVectorizer(ngram_range=(1, 2), min_df = 3 / len(input_text), max_df=.4)
... | self.vectorizer = CountVectorizer(ngram_range=(1, 2), vocabulary=self.vocab) |
Given snippet: <|code_start|>
app = create_test_app()
db.app = app
db.init_app(app)
log = logging.getLogger(__name__)
class ScanTest(TestCase):
def create_app(self):
return app
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from flask.ext.testing import TestCase
fro... | def setUp(self): |
Continue the code snippet: <|code_start|>
app = create_test_app()
db.app = app
db.init_app(app)
log = logging.getLogger(__name__)
class ScanTest(TestCase):
def create_app(self):
<|code_end|>
. Use current file imports:
from flask.ext.testing import TestCase
from mock import patch
from app import create_test_app... | return app |
Given the following code snippet before the placeholder: <|code_start|>
app = create_test_app()
db.app = app
db.init_app(app)
log = logging.getLogger(__name__)
class ScanTest(TestCase):
def create_app(self):
<|code_end|>
, predict the next line using imports from the current file:
from flask.ext.testing import ... | return app |
Using the snippet: <|code_start|> if line[-2:] == ["\r", "\n"]:
yield "".join(line).strip()
line.clear()
async def _async_event_lines(ret: AsyncIterable[str]) -> AsyncIterator[str]:
line = []
async for char in ret:
line.append(char)
if line[-2:] == ["\r", "\n"]:
... | def alarm_config(self) -> str: |
Predict the next line after this snippet: <|code_start|> @property
def video_loss_detect_config(self) -> str:
return self.event_handler_config("LossDetect")
@property
async def async_video_loss_detect_config(self) -> str:
return await self.async_event_handler_config("LossDetect")
@p... | return await self.async_event_handler_config("StorageFailure") |
Continue the code snippet: <|code_start|> @property
async def async_alarm_states_input_channels(self) -> str:
return await self.async_alarm_handler("getInState")
@property
def alarm_states_output_channels(self) -> str:
return self.alarm_handler("getOutState")
@property
async def... | return self.event_handler_config("LoginFailureAlarm") |
Predict the next line after this snippet: <|code_start|> @property
def alarm_states_input_channels(self) -> str:
return self.alarm_handler("getInState")
@property
async def async_alarm_states_input_channels(self) -> str:
return await self.async_alarm_handler("getInState")
@property
... | return await self.async_event_handler_config("LossDetect") |
Predict the next line after this snippet: <|code_start|>
_LOGGER = logging.getLogger(__name__)
class Media(Http):
def factory_create(self) -> str:
ret = self.command("mediaFileFind.cgi?action=factory.create")
return ret.content.decode()
def factory_close(self, factory_id: str) -> str:
... | types: Sequence[str] = (), |
Based on the snippet: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT AN... | ) |
Predict the next line for this snippet: <|code_start|>
_LOGGER = logging.getLogger(__name__)
class Snapshot(Http):
@property
def snapshot_config(self) -> str:
return self._get_config("Snap")
@property
async def async_snapshot_config(self) -> str:
return await self._async_get_config("... | path_file: Optional[str] = ..., |
Given the code snippet: <|code_start|># vim:sw=4:ts=4:et
_LOGGER = logging.getLogger(__name__)
class Snapshot(Http):
@property
def snapshot_config(self) -> str:
return self._get_config("Snap")
@property
async def async_snapshot_config(self) -> str:
return await self._async_get_conf... | *, |
Predict the next line after this snippet: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be usef... | def snapshot_config(self) -> str: |
Here is a snippet: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY W... | ] |
Given the following code snippet before the placeholder: <|code_start|># it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied... | Tuple[Optional[float], Optional[float], Optional[float], Optional[float]], |
Continue the code snippet: <|code_start|># the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public Lic... | ] |
Continue the code snippet: <|code_start|># but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# vim:sw=4:ts=4:et
_LOGGER = logging.getLogger(__name__)
_KEEPALIVE_OPTS = HTTPConnection.default... | class SOHTTPAdapter(HTTPAdapter): |
Given the following code snippet before the placeholder: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that ... | ] |
Next line prediction: <|code_start|># it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or F... | Tuple[Optional[float], Optional[float], Optional[float], Optional[float]], |
Using the snippet: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY W... | ] |
Next line prediction: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT AN... | ] |
Given snippet: <|code_start|># 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 Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRA... | pass |
Given the code snippet: <|code_start|>
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = "MySQLAutoXtrabackupdoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The pap... | master_doc, |
Using the snippet: <|code_start|>
class TestHelpers:
def test_get_latest_dir_name(self):
os.makedirs("tests/DELETE_ME", mode=777, exist_ok=True)
os.makedirs("tests/DELETE_ME/2021-05-06_11-48-31", mode=777, exist_ok=True)
os.makedirs("tests/DELETE_ME/2021-05-06_11-47-31", mode=777, exist_ok... | == "2021-05-06_11-48-31" |
Predict the next line for this snippet: <|code_start|> def check_matrix_combinations(self, node, distro, parsed_selectors):
def process_combinations(data, distro, parsed_selectors):
for k, v in data.items():
if k == DISTROINFO_GRP_DISTROS and distro not in v:
... | elif not self.has_spec_group_item(selector_name, selector_val): |
Here is a snippet: <|code_start|> self._validate_specs(self.raw_data.get('specs', None))
self._validate_matrix(self.raw_data.get('matrix', {}))
def _validate_version(self, version):
try:
v = int(version)
except TypeError:
self._validation_err(
... | for k, v in spec_group.items(): |
Using the snippet: <|code_start|> ('yumi', 'update', 'yum update foo bar'),
('yumni', 'update', 'yum -y update foo bar'),
('dnfi', 'install', 'dnf install foo bar'),
('dnfni', 'install', 'dnf -y install foo bar'),
('dnfi', 'reinstall', 'dnf reinstall foo bar'),
('dnfni', '... | assert self.mgrs[m].cleancache() == result |
Given the code snippet: <|code_start|>
class TestIndividualPkgManagers(object):
def setup_method(self, method):
class Config(object):
def __init__(self, interactive, container=None):
self.interactive = interactive
self.container = container
self.mgrs = {... | ('dnfi', 'update', 'dnf update foo bar'), |
Continue the code snippet: <|code_start|>
# Output file base name for HTML help builder.
htmlhelp_basename = 'distgendoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# Th... | u'Pavel Raiskup, Slavek Kabrda', 'manual'), |
Predict the next line for this snippet: <|code_start|>
class Project(AbstractProject):
def inst_init(self, specfiles, template, sysconfig):
self.somestuff = 'interesting'
<|code_end|>
with the help of current file imports:
from distgen.project import AbstractProject
and context from other files:
# Pat... | def inst_finish(self, specfiles, template, sysconfig, spec): |
Predict the next line after this snippet: <|code_start|>
project = "distgen"
datadir = "share"
pkgdatadir = datadir + "/" + project
tpldir = pkgdatadir + "/templates"
distconfdir = pkgdatadir + "/distconf"
try:
sys.path = [path.join(getcwd(), 'build_manpages')] + sys.path
except:
print("=====================... | raise |
Next line prediction: <|code_start|>
class TestMergeYaml(object):
def test_non_overlapping(self):
a = {'a': 1, 'aa': 2}
<|code_end|>
. Use current file imports:
(import os
from distgen.config import merge_yaml, load_config)
and context including class names, function names, or small code snippets from o... | b = {'b': 3, 'bb': 4} |
Predict the next line for this snippet: <|code_start|> else:
return None
path = self.get_path()
if prefered_path:
path = prefered_path + path
for i in path:
config_files = [os.path.join(i, filename)]
if self.suffix:
... | except IOError: |
Using the snippet: <|code_start|>
try:
except ImportError:
class TestDistroDetection(object):
@pytest.mark.parametrize('arch', [b'x86_64', b'i386'])
@pytest.mark.parametrize('distro, version, name, cversion', [
('fedora', 24, 'sth', 24),
('fedora', 25, 'sth', 25),
... | distro, cversion, arch.decode('ascii') |
Using the snippet: <|code_start|>
class ProfileRetriever:
def __init__(self, settings, fileDownloader, profileCache, diskIo, githubZipballExtractor):
self.settings = settings
self.fileDownloader = fileDownloader
self.profileCache = profileCache
self.diskIo = diskIo
self.gith... | def retrieve(self, profile): |
Here is a snippet: <|code_start|>
class ProfileRetriever:
def __init__(self, settings, fileDownloader, profileCache, diskIo, githubZipballExtractor):
self.settings = settings
self.fileDownloader = fileDownloader
self.profileCache = profileCache
self.diskIo = diskIo
<|code_end|>
. Wr... | self.githubZipballExtractor = githubZipballExtractor |
Predict the next line for this snippet: <|code_start|>
class ProfileRetriever:
def __init__(self, settings, fileDownloader, profileCache, diskIo, githubZipballExtractor):
self.settings = settings
<|code_end|>
with the help of current file imports:
from .DiskIo import getDiskIo
from .FileDownloader import... | self.fileDownloader = fileDownloader |
Given the code snippet: <|code_start|>
class ProfileRetriever:
def __init__(self, settings, fileDownloader, profileCache, diskIo, githubZipballExtractor):
self.settings = settings
self.fileDownloader = fileDownloader
self.profileCache = profileCache
self.diskIo = diskIo
<|code_end|>... | self.githubZipballExtractor = githubZipballExtractor |
Next line prediction: <|code_start|>
class TestApplicationDirs(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
app = Application()
app.settings = Settings(self.getWorkingDir())
self.settings = app.settings
self.diskIo = getDiskIo(app)
self.applic... | dirExists = self.diskIo.dirExists |
Using the snippet: <|code_start|>
class TestApplicationDirs(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
app = Application()
app.settings = Settings(self.getWorkingDir())
self.settings = app.settings
self.diskIo = getDiskIo(app)
self.applicati... | def test_createIfNone_applicationDirsExist_doesNothing(self): |
Based on the snippet: <|code_start|>
class TestApplicationDirs(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
app = Application()
app.settings = Settings(self.getWorkingDir())
<|code_end|>
, predict the immediate next line with the help of imports:
from .FileSystemTes... | self.settings = app.settings |
Using the snippet: <|code_start|>
class TestApplicationDirs(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
app = Application()
app.settings = Settings(self.getWorkingDir())
self.settings = app.settings
self.diskIo = getDiskIo(app)
self.applicati... | self.applicationDirs.createIfNone() |
Given the code snippet: <|code_start|>
class TestApplicationDirs(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
app = Application()
app.settings = Settings(self.getWorkingDir())
self.settings = app.settings
self.diskIo = getDiskIo(app)
self.appl... | self.assertTrue(dirExists(self.settings.cachePath)) |
Given snippet: <|code_start|>
class TestCommandLineParser(BaseTestCase):
def setUp(self):
self.commandLineParser = CommandLineParser()
def test_parse_emptyArgs_setsShowCurrentProfileAction(self):
argv = './vimswitch'.split()
self.commandLineParser.parse(argv)
self.assertEqual(... | self.assertEqual(self.commandLineParser.action, 'switchProfile') |
Given the code snippet: <|code_start|>
class TestCommandLineParser(BaseTestCase):
def setUp(self):
self.commandLineParser = CommandLineParser()
def test_parse_emptyArgs_setsShowCurrentProfileAction(self):
argv = './vimswitch'.split()
self.commandLineParser.parse(argv)
self.ass... | def test_parse_setsSwitchProfileAction(self): |
Continue the code snippet: <|code_start|>
class TestCommandLineParser(BaseTestCase):
def setUp(self):
self.commandLineParser = CommandLineParser()
def test_parse_emptyArgs_setsShowCurrentProfileAction(self):
argv = './vimswitch'.split()
<|code_end|>
. Use current file imports:
from .BaseTest... | self.commandLineParser.parse(argv) |
Given the following code snippet before the placeholder: <|code_start|>
class TestZipFile(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
self.diskIo = DiskIo()
def test_extract_extractsFile(self):
zipPath = self.getDataPath('simple.zip')
destPath = self.ge... | self.assertTrue(file1Actual, file1Expected) |
Predict the next line after this snippet: <|code_start|>
class ProfileCache:
def __init__(self, settings, diskIo):
self.settings = settings
self.diskIo = diskIo
def contains(self, profile):
profileLocation = self.getProfileLocation(profile)
return self.diskIo.dirExists(profileL... | profileDirPath = self.getProfileLocation(profile) |
Given snippet: <|code_start|>
class ProfileCache:
def __init__(self, settings, diskIo):
self.settings = settings
self.diskIo = diskIo
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import os
from .Settings import getSettings
from .DiskIo import getDiskIo
and ... | def contains(self, profile): |
Predict the next line for this snippet: <|code_start|>
class SwitchProfileAction(Action):
def __init__(self, settings, profileCache, profileCopier, profileRetriever):
Action.__init__(self)
self.settings = settings
self.profileCache = profileCache
self.profileCopier = profileCopier
... | if not self.profileCache.contains(profile) or self.update: |
Given snippet: <|code_start|> def __init__(self, settings, profileCache, profileCopier, profileRetriever):
Action.__init__(self)
self.settings = settings
self.profileCache = profileCache
self.profileCopier = profileCopier
self.profileRetriever = profileRetriever
self.u... | return currentProfile |
Continue the code snippet: <|code_start|>
class SwitchProfileAction(Action):
def __init__(self, settings, profileCache, profileCopier, profileRetriever):
Action.__init__(self)
self.settings = settings
self.profileCache = profileCache
<|code_end|>
. Use current file imports:
from .Action i... | self.profileCopier = profileCopier |
Using the snippet: <|code_start|>
class SwitchProfileAction(Action):
def __init__(self, settings, profileCache, profileCopier, profileRetriever):
Action.__init__(self)
self.settings = settings
self.profileCache = profileCache
self.profileCopier = profileCopier
self.profileR... | self.profileCopier.copyFromHome(currentProfile) |
Given snippet: <|code_start|>
class SwitchProfileAction(Action):
def __init__(self, settings, profileCache, profileCopier, profileRetriever):
Action.__init__(self)
self.settings = settings
self.profileCache = profileCache
self.profileCopier = profileCopier
self.profileRetrie... | currentProfile = self.settings.defaultProfile |
Based on the snippet: <|code_start|>
if __name__ == '__main__':
vimSwitch = VimSwitch()
exitCode = vimSwitch.main(sys.argv)
<|code_end|>
, predict the immediate next line with the help of imports:
from vimswitch.VimSwitch import VimSwitch
import sys
and context (classes, functions, sometimes code) from other... | sys.exit(exitCode) |
Given snippet: <|code_start|>
class TestProfile(BaseTestCase):
def test_getDirName_withSlashes_replacedByDot(self):
profile = Profile('user/repo')
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from .BaseTestCase import BaseTestCase
from vimswitch.Profile import Profi... | self.assertEquals(profile.getDirName(), 'user.repo') |
Given the code snippet: <|code_start|>
class TestProfile(BaseTestCase):
def test_getDirName_withSlashes_replacedByDot(self):
profile = Profile('user/repo')
<|code_end|>
, generate the next line using the imports in this file:
from .BaseTestCase import BaseTestCase
from vimswitch.Profile import Profile
a... | self.assertEquals(profile.getDirName(), 'user.repo') |
Next line prediction: <|code_start|>
class ShowCurrentProfileAction(Action):
def __init__(self, settings):
Action.__init__(self)
<|code_end|>
. Use current file imports:
(from .Action import Action
from .Settings import getSettings)
and context including class names, function names, or small code snippet... | self.settings = settings |
Using the snippet: <|code_start|>
class ShowCurrentProfileAction(Action):
def __init__(self, settings):
Action.__init__(self)
self.settings = settings
def execute(self):
if self.settings.currentProfile is None:
<|code_end|>
, determine the next line of code. You have imports:
from .Ac... | profileName = 'None' |
Here is a snippet: <|code_start|>
class ProfileCopier:
def __init__(self, settings, profileCache, profileDataIo):
self.settings = settings
self.profileCache = profileCache
self.profileDataIo = profileDataIo
<|code_end|>
. Write the next line using the current file imports:
from .Settings ... | def copyToHome(self, profile): |
Using the snippet: <|code_start|>
class ProfileCopier:
def __init__(self, settings, profileCache, profileDataIo):
self.settings = settings
<|code_end|>
, determine the next line of code. You have imports:
from .Settings import getSettings
from .ProfileCache import getProfileCache
from .ProfileDataIo impor... | self.profileCache = profileCache |
Based on the snippet: <|code_start|>
class ProfileCopier:
def __init__(self, settings, profileCache, profileDataIo):
self.settings = settings
self.profileCache = profileCache
self.profileDataIo = profileDataIo
<|code_end|>
, predict the immediate next line with the help of imports:
from .... | def copyToHome(self, profile): |
Using the snippet: <|code_start|>
class ApplicationDirs:
def __init__(self, settings, diskIo):
self.settings = settings
self.diskIo = diskIo
def createIfNone(self):
self._createDir(self.settings.configPath)
self._createDir(self.settings.cachePath)
self._createDir(self.s... | def getApplicationDirs(app): |
Next line prediction: <|code_start|>
class ApplicationDirs:
def __init__(self, settings, diskIo):
self.settings = settings
self.diskIo = diskIo
def createIfNone(self):
self._createDir(self.settings.configPath)
self._createDir(self.settings.cachePath)
self._createDir(sel... | def createApplicationDirs(app): |
Based on the snippet: <|code_start|>
class ProfileDataIo:
def __init__(self, settings, diskIo):
self.settings = settings
<|code_end|>
, predict the immediate next line with the help of imports:
import os
from .Settings import getSettings
from .DiskIo import getDiskIo
and context (classes, functions, some... | self.diskIo = diskIo |
Predict the next line after this snippet: <|code_start|>
class TestShowCurrentProfileAction(BaseTestCase):
def setUp(self):
self.app = Application()
self.action = createShowCurrentProfileAction(self.app)
<|code_end|>
using the current file's imports:
from .BaseTestCase import BaseTestCase
from m... | @patch('sys.stdout', new_callable=StringIO) |
Given the following code snippet before the placeholder: <|code_start|>
class TestShowCurrentProfileAction(BaseTestCase):
def setUp(self):
self.app = Application()
self.action = createShowCurrentProfileAction(self.app)
@patch('sys.stdout', new_callable=StringIO)
def test_execute_printsCurr... | self.app.settings.currentProfile = None |
Given the following code snippet before the placeholder: <|code_start|>
class TestShowCurrentProfileAction(BaseTestCase):
def setUp(self):
self.app = Application()
self.action = createShowCurrentProfileAction(self.app)
@patch('sys.stdout', new_callable=StringIO)
def test_execute_printsCurr... | self.action.execute() |
Here is a snippet: <|code_start|> self.assertFileContents('extractionDir/.vim/plugin/dummy_plugin.vim', '" dummy vim plugin')
def test_extract_multipleRootDirs_raisesError(self):
self.copyDataToWorkingDir('github_zipball_multiple_root_dirs.zip', 'zipball.zip')
zipballPath = self.getTestPath(... | self.assertEqual(actualContents, expectedContents) |
Here is a snippet: <|code_start|> self.copyDataToWorkingDir('vimrc-master.zip', 'zipball.zip')
zipballPath = self.getTestPath('zipball.zip')
extractionDirPath = self.getTestPath('extractionDir')
self.diskIo.createDir(extractionDirPath)
self.githubZipballExtractor.extractZipball(z... | self.githubZipballExtractor.extractZipball(zipballPath, extractionDirPath) |
Based on the snippet: <|code_start|>
class TestGithubZipballExtractor(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
app = Application()
self.githubZipballExtractor = getGithubZipballExtractor(app)
self.diskIo = app.diskIo
def test_extract_extractsRepoFile... | zipballPath = self.getTestPath('zipball.zip') |
Here is a snippet: <|code_start|>
class ShowVersionAction(Action):
def __init__(self):
Action.__init__(self)
def execute(self):
appVersion = vimswitch.version.__version__
pythonVersion = platform.python_version()
print("vimswitch %s (python %s)" % (appVersion, pythonVersion))
... | def createShowVersionAction(app): |
Based on the snippet: <|code_start|>
def DiskIoStub():
diskIo = MagicMock(DiskIo)
return diskIo
def ProfileDataIoStub():
profileDataIo = MagicMock(ProfileDataIo)
<|code_end|>
, predict the immediate next line with the help of imports:
from mock import MagicMock
from vimswitch.DiskIo import DiskIo
from v... | return profileDataIo |
Continue the code snippet: <|code_start|>
class TestConfigFile(FileSystemTestCase):
def setUp(self):
FileSystemTestCase.setUp(self)
self.app = Application()
self.configFile = getConfigFile(self.app)
# ConfigFile.loadSettings()
def test_loadSettings_allAttributes(self):
sel... | self.configFile.loadSettings(settings, nonExistantPath) |
Predict the next line for this snippet: <|code_start|>
class UpdateProfileAction(Action):
def __init__(self, settings, switchProfileAction):
Action.__init__(self)
self.settings = settings
self.switchProfileAction = switchProfileAction
self.profile = None
<|code_end|>
with the help... | def execute(self): |
Next line prediction: <|code_start|> Action.__init__(self)
self.settings = settings
self.switchProfileAction = switchProfileAction
self.profile = None
def execute(self):
self.profile = self._getProfile()
if self.profile == self.settings.defaultProfile:
pr... | updateProfileAction = UpdateProfileAction(settings, switchProfileAction) |
Given the code snippet: <|code_start|>
class UpdateProfileAction(Action):
def __init__(self, settings, switchProfileAction):
Action.__init__(self)
self.settings = settings
self.switchProfileAction = switchProfileAction
self.profile = None
def execute(self):
self.profile... | def _getProfile(self): |
Given the following code snippet before the placeholder: <|code_start|>
class InvalidArgsAction(Action):
def __init__(self):
Action.__init__(self)
self.errorMessage = ''
<|code_end|>
, predict the next line using imports from the current file:
from .Action import Action
and context including clas... | self.helpText = '' |
Given the code snippet: <|code_start|>
def test_copyToHome_deletesHomeData(self):
self.profileCopier.copyToHome(self.profile)
homePath = os.path.normpath('/home/foo')
self.profileDataIo.delete.assert_called_with(homePath)
def test_copyToHome_deletesHomeDir_fromSettings(self):
s... | def test_copyToHome_copiesToHomeDir_fromSettings(self): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.