Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Given snippet: <|code_start|>
@todo: Add stencil components to L{texture_formats}.
@author: Stephan Wenger
@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
_gl.GL_RED: 1,
_gl.GL_GREEN: 1,
_gl.GL_BLUE... | ((uint8, 1), _gl.GL_R8UI, (_gl.GL_UNSIGNED_BYTE, _gl.GL_RED_INTEGER )), |
Given the code snippet: <|code_start|>
@author: Stephan Wenger
@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
_gl.GL_RED: 1,
_gl.GL_GREEN: 1,
_gl.GL_BLUE: 1,
_gl.GL_ALPHA: 1,
_gl.GL_... | ((uint16, 1), _gl.GL_R16UI, (_gl.GL_UNSIGNED_SHORT, _gl.GL_RED_INTEGER )), |
Using the snippet: <|code_start|>@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
_gl.GL_RED: 1,
_gl.GL_GREEN: 1,
_gl.GL_BLUE: 1,
_gl.GL_ALPHA: 1,
_gl.GL_RGB: 3,
_gl.GL_BGR: 3,... | ((uint32, 1), _gl.GL_R32UI, (_gl.GL_UNSIGNED_INT, _gl.GL_RED_INTEGER )), |
Predict the next line for this snippet: <|code_start|>@todo: Add stencil components to L{texture_formats}.
@author: Stephan Wenger
@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
_gl.GL_RED: 1,
_gl.GL_GREEN... | ((int8, 1), _gl.GL_R8I, (_gl.GL_BYTE, _gl.GL_RED_INTEGER )), |
Given snippet: <|code_start|>"""Constants and enums.
@todo: Add stencil components to L{texture_formats}.
@author: Stephan Wenger
@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
_gl.GL_RED: 1,
_gl.GL_GREEN... | ((int16, 1), _gl.GL_DEPTH_COMPONENT16, (_gl.GL_SHORT, _gl.GL_DEPTH_COMPONENT)), |
Given the following code snippet before the placeholder: <|code_start|>"""Constants and enums.
@todo: Add stencil components to L{texture_formats}.
@author: Stephan Wenger
@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
... | ((int32, 1), _gl.GL_DEPTH_COMPONENT24, (_gl.GL_INT, _gl.GL_DEPTH_COMPONENT)), |
Here is a snippet: <|code_start|>"""Constants and enums.
@todo: Add stencil components to L{texture_formats}.
@author: Stephan Wenger
@date: 2012-02-29
"""
format_to_length = {
#_gl.GL_COLOR_INDEX: 1,
_gl.GL_STENCIL_INDEX: 1,
_gl.GL_DEPTH_COMPONENT: 1,
_gl.GL_RED: 1,
_gl.GL_G... | ((float32, 1), _gl.GL_DEPTH_COMPONENT32F, (_gl.GL_FLOAT, _gl.GL_DEPTH_COMPONENT)), |
Based on the snippet: <|code_start|> ((int32, 2), _gl.GL_RG32I, (_gl.GL_INT, _gl.GL_RG_INTEGER )),
((float32, 2), _gl.GL_RG32F, (_gl.GL_FLOAT, _gl.GL_RG )),
((uint8, 3), _gl.GL_RGB8UI, (_gl.GL_UNSIGNED_BYTE, _gl.GL_RGB_INTEGER )),
((int8, 3), ... | texture_compare_funcs = Enum( |
Given snippet: <|code_start|> self._setter = setter
self._set_args = set_args
self._dtype = dtype if dtype else int32
self._shape = None if shape is None else tuple(shape) if hasattr(shape, "__iter__") and not isinstance(shape, str) else (shape,)
self._enum = enum
self._na... | _value = coerce_array(_value, dtype=self._dtype) |
Continue the code snippet: <|code_start|>"""Base classes for descriptors and descriptor owners.
@bug: L{Proxy} is currently unaware of its context.
@author: Stephan Wenger
@date: 2012-02-29
"""
class Proxy(object):
def __init__(self, getter=None, get_args=(), setter=None, set_args=(), dtype=None, shape=(), enum... | self._dtype = dtype if dtype else int32 |
Given the following code snippet before the placeholder: <|code_start|> return getattr(self._obj, self._name)
def __set__(self, obj, value):
setattr(self._obj, self._name, value)
def __delete__(self, obj):
delattr(self._obj, self._name)
class ItemProxy(object):
def __init__(self, o... | setattr(parent, key, with_obj(parent, value)) |
Given the following code snippet before the placeholder: <|code_start|>"""Datatypes for use with L{ShaderProgram}s.
@author: Stephan Wenger
@date: 2012-02-29
"""
class ShaderDatatype(object):
_gltype_db = {}
_db = {}
def __init__(self, name, _gltype, dtype=int32, shape=1, texture=False, atomic=True):
... | Datatype._gltype_db[self._gltype] = self |
Given the following code snippet before the placeholder: <|code_start|>"""Datatypes for use with L{ShaderProgram}s.
@author: Stephan Wenger
@date: 2012-02-29
"""
class ShaderDatatype(object):
_gltype_db = {}
_db = {}
def __init__(self, name, _gltype, dtype=int32, shape=1, texture=False, atomic=True):
... | if self._dtype == int32 or self._dtype == bool8: |
Given snippet: <|code_start|>"""Datatypes for use with L{ShaderProgram}s.
@author: Stephan Wenger
@date: 2012-02-29
"""
class ShaderDatatype(object):
_gltype_db = {}
_db = {}
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import numpy as _np
import glitter.raw as _gl
f... | def __init__(self, name, _gltype, dtype=int32, shape=1, texture=False, atomic=True): |
Predict the next line after this snippet: <|code_start|>
@author: Stephan Wenger
@date: 2012-02-29
"""
class ShaderDatatype(object):
_gltype_db = {}
_db = {}
def __init__(self, name, _gltype, dtype=int32, shape=1, texture=False, atomic=True):
self._name = name
self._gltype = _gltype
... | elif self._dtype == uint32: |
Predict the next line after this snippet: <|code_start|>@date: 2012-02-29
"""
class ShaderDatatype(object):
_gltype_db = {}
_db = {}
def __init__(self, name, _gltype, dtype=int32, shape=1, texture=False, atomic=True):
self._name = name
self._gltype = _gltype
self._dtype = dtype
... | elif self._dtype == float32: |
Continue the code snippet: <|code_start|>
class ShaderDatatype(object):
_gltype_db = {}
_db = {}
def __init__(self, name, _gltype, dtype=int32, shape=1, texture=False, atomic=True):
self._name = name
self._gltype = _gltype
self._dtype = dtype
self._shape = (shape,) if not ... | elif self._dtype == float64: |
Given snippet: <|code_start|> fovy = 45.0 * np.pi / 180.0
aspect = self.width / float(self.height)
znear = 0.001
zfar = 1000.0
focal = 1.0 / np.tan(fovy / 2.0)
persp_mat = np.zeros((4, 4))
persp_mat[0, 0] = focal / aspect
persp_mat[1, 1] = focal
pe... | if get_shift_state(): |
Continue the code snippet: <|code_start|>'''
Created on Jan 4, 2017
@author: lubo
'''
def test_multiplier(model_fixture):
<|code_end|>
. Use current file imports:
import numpy as np
import pytest
from scgv.views.sample import SamplesViewer
and context (classes, functions, or code) from other files:
# Path: scgv/... | sample = SamplesViewer(model_fixture) |
Using the snippet: <|code_start|>'''
Created on Dec 21, 2016
@author: lubo
'''
# import pytest
def test_data_model_make_01(example_data):
<|code_end|>
, determine the next line of code. You have imports:
import numpy as np
from scgv.models.model import DataModel # , gate_compare
from scgv.models.featuremat_model i... | model = DataModel(example_data) |
Using the snippet: <|code_start|>'''
Created on Dec 21, 2016
@author: lubo
'''
# import pytest
def test_data_model_make_01(example_data):
model = DataModel(example_data)
assert model is not None
model.make()
sectors_legend = model.make_sectors_legend()
print(sectors_legend)
def test_make_featu... | featuremat_model = FeaturematModel(model) |
Given the following code snippet before the placeholder: <|code_start|>'''
Created on Dec 2, 2016
@author: lubo
'''
@pytest.fixture
def example_data():
return 'exampledata/example.archive.zip'
@pytest.fixture
def example_dir():
return 'exampledata/example.directory'
@pytest.fixture
def model_fixture(exam... | model = DataModel(example_data) |
Based on the snippet: <|code_start|> QApplication.setOverrideCursor(Qt.ArrowCursor)
print("UCSC Genome Broser position not found....")
return
QApplication.setOverrideCursor(Qt.ArrowCursor)
chrom_end, pos_end = self.browse_position
chrom_start, pos_start = se... | samples_viewer = SamplesViewer(self.model) |
Based on the snippet: <|code_start|>'''
Created on Jan 18, 2017
@author: lubo
'''
def test_data_model_make_01(example_data):
model = DataModel(example_data)
assert model is not None
model.make()
<|code_end|>
, predict the immediate next line with the help of imports:
import numpy as np
from scgv.model... | sector_model = SectorsDataModel(model) |
Continue the code snippet: <|code_start|> print(model.column_labels[m - 1])
assert sector_model.sector[0] == 1
assert sector_model.column_labels[0] == model.column_labels[m]
def test_sector_order_experiments():
elements = np.array([0, 1, 2, 3])
leaves = np.array([3, 1, 2, 0])
sectors = np.arra... | single_sector_model = SingleSectorDataModel(model, 1) |
Next line prediction: <|code_start|>'''
Created on Jan 18, 2017
@author: lubo
'''
def test_data_model_make_01(example_data):
<|code_end|>
. Use current file imports:
(import numpy as np
from scgv.models.sector_model import SectorsDataModel, SingleSectorDataModel
from scgv.models.model import DataModel)
and contex... | model = DataModel(example_data) |
Continue the code snippet: <|code_start|>
'''
Change filepath = your data file from ncbi
Change column_num = Column number of data file
'''
filepath = r""
column_num = 0
if not DATABASE_URI.startswith('mysql+pymysql://'):
DATABASE_URI = 'mysql+pymysql://'+DATABASE_URI.split('://')[1]
<|code_end|>
. Use current fi... | upload(DATABASE_URI, filepath, gene_commit, column_num, cache_size=100000, echo=True, log=True) |
Given the code snippet: <|code_start|>'''
'''
class TestFunctions(unittest.TestCase):
# replace the function:multiply that we import
# if not decorated,the function imported is used
@mock.patch('test_sample.function_as_sample.multiply')
def test_add_and_multiply(self,mock_multiply):
x = 3
... | addition, multiple = add_and_multiply(x, y) |
Based on the snippet: <|code_start|>
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
self.owner = owner
self.title = title
self.text = text
self.description = 'not support ... | class Pano(Plugin): |
Given the following code snippet before the placeholder: <|code_start|>
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
self.owner = owner
self.title = title
self.text = text
... | text = Column(Text()) |
Here is a snippet: <|code_start|>
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
self.owner = owner
self.title = title
self.text = text
self.description = 'not support des... | text = Column(Text()) |
Here is a snippet: <|code_start|>
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
self.owner = owner
self.title = title
self.text = text
self.description = 'not support des... | created = Column(Integer()) |
Given the code snippet: <|code_start|>
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
self.owner = owner
self.title = title
self.text = text
self.description = 'not suppor... | public = Column(Boolean()) |
Using the snippet: <|code_start|>
class PanoDocument(TableBase, PluginDocument):
__tablename__ = 'pano'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
self.owner = owner
self.title = title
self.text = text
self.description = 'not support des... | PanoDocument.__table__.create(engine) |
Given snippet: <|code_start|>
def list(self, **kwargs):
docs = self.documents.list(self.user.id)
return dict(ids=list(map(lambda x:x.id, docs)))
def load(self, id, **kwargs):
id = int(id)
doc = self.documents.get(id)
if not (doc and (doc.owner == self.user.id or doc.publ... | for i in session.query(PanoDocument).filter(PanoDocument.last_modified > time()-7*24*3600).all(): |
Continue the code snippet: <|code_start|> doc.comments = repr(comments)
self.documents.update(doc)
return {}
def submit_praise(self, modify, event_id, **kwargs):
modify = modify=='true' if type(modify) is str else bool(modify)
id = int(event_id)
doc = self.documents.g... | for res in session.query(Gene).filter(Gene.gene_id == s): |
Predict the next line for this snippet: <|code_start|>
class user_model(Plugin):
def __init__(self):
super().__init__()
print('user_model plugin loaded')
self.name = 'user_model'
def process(self, request):
if request['action'] == 'validate_login':
print('Login: ',... | session.add(user) |
Given the following code snippet before the placeholder: <|code_start|>
class user_model(Plugin):
def __init__(self):
super().__init__()
print('user_model plugin loaded')
self.name = 'user_model'
def process(self, request):
if request['action'] == 'validate_login':
... | user = User.get_user_by_email(email) |
Given the code snippet: <|code_start|>"""This is an example plugin for BioHub. It manages all text files, and print some debug messages."""
class TextFileDocument(TableBase, PluginDocument):
__tablename__ = 'textfile'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
... | class TextFile(Plugin): |
Predict the next line after this snippet: <|code_start|>"""This is an example plugin for BioHub. It manages all text files, and print some debug messages."""
class TextFileDocument(TableBase, PluginDocument):
__tablename__ = 'textfile'
def __init__(self, owner, title='Untitled', text=''):
super()... | text = Column(Text()) |
Using the snippet: <|code_start|>"""This is an example plugin for BioHub. It manages all text files, and print some debug messages."""
class TextFileDocument(TableBase, PluginDocument):
__tablename__ = 'textfile'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
sel... | text = Column(Text()) |
Based on the snippet: <|code_start|>"""This is an example plugin for BioHub. It manages all text files, and print some debug messages."""
class TextFileDocument(TableBase, PluginDocument):
__tablename__ = 'textfile'
def __init__(self, owner, title='Untitled', text=''):
super().__init__()
... | TextFileDocument.__table__.create(engine) |
Given the code snippet: <|code_start|>
SPFA_time = datetime.now()
time_point["SPFA"] = SPFA_time - convert_time
path_list = []
for j in Astar(s, t, k):
# not founded
if j == -1:
break
# overtime
if j == 0:
break
path = []
for nod... | class Path_Finder_New(Plugin): |
Predict the next line for this snippet: <|code_start|>
home = Blueprint('home', __name__)
@home.route('/')
def index():
if current_user.is_authenticated:
return redirect(url_for('static', filename='projects.html'))
return redirect(url_for('static', filename='login.html'))
@home.route('/validateLogin... | login_user(session.query(User).get(id)) |
Continue the code snippet: <|code_start|>
home = Blueprint('home', __name__)
@home.route('/')
def index():
if current_user.is_authenticated:
return redirect(url_for('static', filename='projects.html'))
return redirect(url_for('static', filename='login.html'))
@home.route('/validateLogin', methods=['... | login_user(session.query(User).get(id)) |
Predict the next line for this snippet: <|code_start|>
class PluginDocument(object):
"""Abstract class for all plugins to make their own document type."""
def __init__(self):
super().__init__()
if self.__class__ is PluginDocument:
raise NotImplementedError
<|code_end|>
with the ... | id = Column(Integer(), primary_key=True) |
Based on the snippet: <|code_start|>
class PluginDocument(object):
"""Abstract class for all plugins to make their own document type."""
def __init__(self):
super().__init__()
if self.__class__ is PluginDocument:
raise NotImplementedError
<|code_end|>
, predict the immediate next... | id = Column(Integer(), primary_key=True) |
Given snippet: <|code_start|>
class PluginDocument(object):
"""Abstract class for all plugins to make their own document type."""
def __init__(self):
super().__init__()
if self.__class__ is PluginDocument:
raise NotImplementedError
id = Column(Integer(), primary_key=True)
... | title = Column(String(256)) |
Next line prediction: <|code_start|>
class PluginDocument(object):
"""Abstract class for all plugins to make their own document type."""
def __init__(self):
super().__init__()
if self.__class__ is PluginDocument:
raise NotImplementedError
id = Column(Integer(), primary_key=Tr... | return Column(Integer(), ForeignKey('user.id')) |
Using the snippet: <|code_start|>
class PluginDocument(object):
"""Abstract class for all plugins to make their own document type."""
def __init__(self):
super().__init__()
if self.__class__ is PluginDocument:
raise NotImplementedError
id = Column(Integer(), primary_key=True)... | description = Column(Text()) |
Next line prediction: <|code_start|> works = Column(VARCHAR(10))
favorite = Column(INTEGER(4))
specified_u_list = Column(LONGTEXT)
deep_u_list = Column(LONGTEXT)
deep_count = Column(INTEGER(11))
ps_string = Column(LONGTEXT)
scars = Column(VARCHAR(20))
default_scars = Column(VARCHAR(20))
... | owner = Column(Integer, ForeignKey('user.user_id')) |
Here is a snippet: <|code_start|> works = Column(VARCHAR(10))
favorite = Column(INTEGER(4))
specified_u_list = Column(LONGTEXT)
deep_u_list = Column(LONGTEXT)
deep_count = Column(INTEGER(11))
ps_string = Column(LONGTEXT)
scars = Column(VARCHAR(20))
default_scars = Column(VARCHAR(20))
... | owner = Column(Integer, ForeignKey('user.user_id')) |
Given the code snippet: <|code_start|>
class BiobrickUser(TableBase):
__tablename__ = 'parts_by_user'
part_id = Column(INTEGER(11), primary_key=True)
<|code_end|>
, generate the next line using the imports in this file:
from database import TableBase, Column, ForeignKey, \
Integer, INTEGER, TINYINT, VARC... | ok = Column(TINYINT(1)) |
Given the following code snippet before the placeholder: <|code_start|>
class BiobrickUser(TableBase):
__tablename__ = 'parts_by_user'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
<|code_end|>
, predict the next line using imports from the current file:
from database import Tab... | part_name = Column(VARCHAR(255)) |
Here is a snippet: <|code_start|>
class BiobrickUser(TableBase):
__tablename__ = 'parts_by_user'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
part_name = Column(VARCHAR(255))
short_desc = Column(VARCHAR(100))
<|code_end|>
. Write the next line using the current file impo... | description = Column(LONGTEXT) |
Predict the next line after this snippet: <|code_start|>
class BiobrickUser(TableBase):
__tablename__ = 'parts_by_user'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
part_name = Column(VARCHAR(255))
short_desc = Column(VARCHAR(100))
description = Column(LONGTEXT)
... | creation_date = Column(DATE) |
Given the following code snippet before the placeholder: <|code_start|>
class BiobrickUser(TableBase):
__tablename__ = 'parts_by_user'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
part_name = Column(VARCHAR(255))
short_desc = Column(VARCHAR(100))
description = Column... | m_datetime = Column(DATETIME) |
Next line prediction: <|code_start|> short_desc = Column(VARCHAR(100))
description = Column(LONGTEXT)
part_type = Column(VARCHAR(20))
author = Column(VARCHAR(200))
owning_group_id = Column(INTEGER(11))
status = Column(VARCHAR(20))
dominant = Column(TINYINT(1))
informational = Column(TINYI... | sources = Column(TEXT) |
Continue the code snippet: <|code_start|> owning_group_id = Column(INTEGER(11))
status = Column(VARCHAR(20))
dominant = Column(TINYINT(1))
informational = Column(TINYINT(1))
discontinued = Column(INTEGER(11))
part_status = Column(VARCHAR(40))
sample_status = Column(VARCHAR(40))
p_status_c... | sequence_sha1 = Column(BINARY(20)) |
Continue the code snippet: <|code_start|> informational = Column(TINYINT(1))
discontinued = Column(INTEGER(11))
part_status = Column(VARCHAR(40))
sample_status = Column(VARCHAR(40))
p_status_cache = Column(VARCHAR(1000))
s_status_cache = Column(VARCHAR(1000))
creation_date = Column(DATE)
... | review_result = Column(DOUBLE(12, 0)) |
Next line prediction: <|code_start|> plt.plot(self.t_range, self.data_all[i, :], label='y' + str(i))
if self.unstable is not None:
plt.axvline(x=self.unstable, linewidth=3, color='r')
plt.show()
def main():
str_eqs ="""dy0dt = -10*y[0] + 10*y[1]
dy1dt = 28*y[0] - ... | class Simulation(Plugin): |
Continue the code snippet: <|code_start|>"""This is an ABACUS plugin.
request = {
"action": "design" or "singleMutationScan"
"id": user_id
"inpath": inputFilePath
"filename": filename
"amount": amount #optional
"tag":tag
"design": desginpath
"mutationScan": scanpath
"abacuspath":... | class ABACUS(Plugin): |
Predict the next line for this snippet: <|code_start|>
class FeatureUser(TableBase):
__tablename__ = 'parts_seq_features_by_user'
feature_id = Column(INTEGER(11), primary_key=True)
feature_type = Column(VARCHAR(200))
start_pos = Column(INTEGER(11))
end_pos = Column(INTEGER(11))
label = Column(... | part_id = Column(INTEGER(11), ForeignKey('parts.part_id')) |
Continue the code snippet: <|code_start|>
class FeatureUser(TableBase):
__tablename__ = 'parts_seq_features_by_user'
feature_id = Column(INTEGER(11), primary_key=True)
<|code_end|>
. Use current file imports:
from database import TableBase, Column, ForeignKey, INTEGER, VARCHAR
and context (classes, function... | feature_type = Column(VARCHAR(200)) |
Next line prediction: <|code_start|>
class FeatureOfficial(TableBase):
__tablename__ = 'parts_seq_features'
feature_id = Column(INTEGER(11), primary_key=True)
feature_type = Column(VARCHAR(200))
start_pos = Column(INTEGER(11))
end_pos = Column(INTEGER(11))
label = Column(VARCHAR(200))
<|code_e... | part_id = Column(INTEGER(11), ForeignKey('parts.part_id')) |
Continue the code snippet: <|code_start|>
class FeatureOfficial(TableBase):
__tablename__ = 'parts_seq_features'
feature_id = Column(INTEGER(11), primary_key=True)
<|code_end|>
. Use current file imports:
from database import TableBase, Column, ForeignKey, INTEGER, VARCHAR
and context (classes, functions, o... | feature_type = Column(VARCHAR(200)) |
Next line prediction: <|code_start|>
class Document(TableBase):
"""An object refer to an actual plugin-managed document.
Every actual document is not only saved in plugins' table, but also has an entry here, so that we can easily get all documents belong to a specific user."""
__tablename__ = 'document'
... | def __init__(self, plugin_name: str, doc: PluginDocument): |
Using the snippet: <|code_start|>
class Document(TableBase):
"""An object refer to an actual plugin-managed document.
Every actual document is not only saved in plugins' table, but also has an entry here, so that we can easily get all documents belong to a specific user."""
__tablename__ = 'document'
... | document_id = Column(Integer(), primary_key=True) |
Given the following code snippet before the placeholder: <|code_start|>
class Document(TableBase):
"""An object refer to an actual plugin-managed document.
Every actual document is not only saved in plugins' table, but also has an entry here, so that we can easily get all documents belong to a specific user."... | document_id = Column(Integer(), primary_key=True) |
Using the snippet: <|code_start|>
class Document(TableBase):
"""An object refer to an actual plugin-managed document.
Every actual document is not only saved in plugins' table, but also has an entry here, so that we can easily get all documents belong to a specific user."""
__tablename__ = 'document'
... | plugin_name = Column(String(256)) |
Given snippet: <|code_start|>
class Document(TableBase):
"""An object refer to an actual plugin-managed document.
Every actual document is not only saved in plugins' table, but also has an entry here, so that we can easily get all documents belong to a specific user."""
__tablename__ = 'document'
de... | owner = Column(Integer(), ForeignKey('user.id')) |
Given the code snippet: <|code_start|>
plugin = Blueprint('plugin', __name__)
@plugin.route('/', methods=['GET', 'POST'])
def plugin_request():
plugin_name = request.values['plugin'] if 'plugin' in request.values else ''
req = {v: request.values[v] for v in request.values}
if 'file' in request.files and r... | rtv = plugin_manager.send_request(plugin_name, req) |
Given snippet: <|code_start|>
class Link(TableBase):
"""A link between two nodes, for path_finder."""
__tablename__ = 'link'
link_id = Column(Integer, primary_key=True, autoincrement=True)
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from database import TableBase, ... | tax_id = Column(String(10)) |
Given the following code snippet before the placeholder: <|code_start|>dis = {}
node_count = 0
class State:
def __init__(self, f, g, cur, prepath): # f is the distance to src, g is the distance to dst
self.f = f
self.g = g
self.cur = cur
self.prepath = prepath
def __lt__(self... | for u_node in session.query(biosys_single).filter(biosys_single.gene_id == u): |
Predict the next line for this snippet: <|code_start|> p_queue.put(State(s.g + 1 + dis[v], s.g + 1, v, s.prepath + [v]))
if (datetime.now() - time_monitor).seconds > 5:
yield "Timeout"
return
def path_finder(s, t, k, maxlen): # s:starting point, t:terminal point, k:num... | class Path_Finder(Plugin): |
Based on the snippet: <|code_start|>dis = {}
node_count = 0
class State:
def __init__(self, f, g, cur, prepath): # f is the distance to src, g is the distance to dst
self.f = f
self.g = g
self.cur = cur
self.prepath = prepath
def __lt__(self, x):
if self.f == x.f:
... | for u_node in session.query(biosys_single).filter(biosys_single.gene_id == u): |
Here is a snippet: <|code_start|> return
p_queue.put(State(dis[src], 0, src, [src]))
while not p_queue.empty():
s = p_queue.get()
if s.cur == dst:
yield s.prepath
cnt += 1
if cnt == pathnum:
break
for v in Graph[s.cur]:
... | node = session.query(Gene).get(gene_id) |
Given the following code snippet before the placeholder: <|code_start|>
#from .FeatureOfficial import FeatureOfficial
class BiobrickOfficial(TableBase):
__tablename__ = 'parts'
part_id = Column(INTEGER(11), primary_key=True)
<|code_end|>
, predict the next line using imports from the current file:
from data... | ok = Column(TINYINT(1)) |
Given snippet: <|code_start|>
#from .FeatureOfficial import FeatureOfficial
class BiobrickOfficial(TableBase):
__tablename__ = 'parts'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from database... | part_name = Column(VARCHAR(255)) |
Here is a snippet: <|code_start|>
#from .FeatureOfficial import FeatureOfficial
class BiobrickOfficial(TableBase):
__tablename__ = 'parts'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
part_name = Column(VARCHAR(255))
short_desc = Column(VARCHAR(100))
<|code_end|>
. Writ... | description = Column(LONGTEXT) |
Predict the next line for this snippet: <|code_start|>
#from .FeatureOfficial import FeatureOfficial
class BiobrickOfficial(TableBase):
__tablename__ = 'parts'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
part_name = Column(VARCHAR(255))
short_desc = Column(VARCHAR(100)... | creation_date = Column(DATE) |
Predict the next line after this snippet: <|code_start|>
#from .FeatureOfficial import FeatureOfficial
class BiobrickOfficial(TableBase):
__tablename__ = 'parts'
part_id = Column(INTEGER(11), primary_key=True)
ok = Column(TINYINT(1))
part_name = Column(VARCHAR(255))
short_desc = Column(VARCHAR(10... | m_datetime = Column(DATETIME) |
Given the code snippet: <|code_start|> short_desc = Column(VARCHAR(100))
description = Column(LONGTEXT)
part_type = Column(VARCHAR(20))
author = Column(VARCHAR(200))
owning_group_id = Column(INTEGER(11))
status = Column(VARCHAR(20))
dominant = Column(TINYINT(1))
informational = Column(TIN... | source = Column(TEXT) |
Using the snippet: <|code_start|> owning_group_id = Column(INTEGER(11))
status = Column(VARCHAR(20))
dominant = Column(TINYINT(1))
informational = Column(TINYINT(1))
discontinued = Column(INTEGER(11))
part_status = Column(VARCHAR(40))
sample_status = Column(VARCHAR(40))
p_status_cache = C... | sequence_sha1 = Column(BINARY(20)) |
Predict the next line after this snippet: <|code_start|> informational = Column(TINYINT(1))
discontinued = Column(INTEGER(11))
part_status = Column(VARCHAR(40))
sample_status = Column(VARCHAR(40))
p_status_cache = Column(VARCHAR(1000))
s_status_cache = Column(VARCHAR(1000))
creation_date = Co... | review_result = Column(DOUBLE(12, 0)) |
Given snippet: <|code_start|> return {'success': False, 'reason': 'plugin not found'}
try:
rtv = self.plugins[plugin].process(request)
if 'success' not in rtv:
rtv['success'] = True
except Exception as e:
rtv = {'success': False, 'reason': t... | return session.query(self.document_table).get(pid) |
Next line prediction: <|code_start|> def get_plugins(self):
return self.plugins
def send_request(self, plugin, request):
if plugin not in self.plugins:
return {'success': False, 'reason': 'plugin not found'}
try:
rtv = self.plugins[plugin].process(request)
... | table.__table__.create(engine) |
Next line prediction: <|code_start|>
plugin_manager = PluginManager()
class Documents:
def __init__(self, plugin: Plugin):
self.plugin = plugin
self.type_name = None
self.document_table = None
def set_document_type(self, name: str):
self.type_name = name
def set_document... | doc = Document(self.plugin.name, pdoc) |
Given the code snippet: <|code_start|> except Exception as e:
rtv = {'success': False, 'reason': type(e).__name__ + ': ' + str(e)}
return rtv
plugin_manager = PluginManager()
class Documents:
def __init__(self, plugin: Plugin):
self.plugin = plugin
self.type_name = Non... | def create(self, pdoc: PluginDocument): |
Continue the code snippet: <|code_start|>"""This plugin can search other plugins, list them and auto-load some plugins."""
class Plugins(Plugin):
auto_load_list_file = 'plugins/plugins/auto_load_list'
def __init__(self):
super().__init__()
for p in self.auto_load_list:
<|code_end|>
. Use cu... | plugin_manager.load_plugin(p) |
Using the snippet: <|code_start|>
def random_string(N):
return ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for i in range(N))
class User(TableBase, UserMixin):
"""A user."""
__tablename__ = 'user'
<|code_end|>
, determine the next line of code. You have imports... | id = Column(Integer, primary_key=True) |
Here is a snippet: <|code_start|>
def random_string(N):
return ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for i in range(N))
class User(TableBase, UserMixin):
"""A user."""
__tablename__ = 'user'
<|code_end|>
. Write the next line using the current file import... | id = Column(Integer, primary_key=True) |
Using the snippet: <|code_start|>
def random_string(N):
return ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for i in range(N))
class User(TableBase, UserMixin):
"""A user."""
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
<|code_end|>
, determ... | email = Column(String(63), unique=True) |
Predict the next line for this snippet: <|code_start|> if os.getenv('FLASK_TESTING'):
avatar = Column(String(16777215))
else:
avatar = Column(MEDIUMTEXT())
description = Column(Text())
education = Column(Text())
major = Column(Text())
def __init__(self, email, password, username)... | return session.query(cls).filter_by(email=email).first() |
Here is a snippet: <|code_start|>
def random_string(N):
return ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for i in range(N))
class User(TableBase, UserMixin):
"""A user."""
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
email = Column(St... | description = Column(Text()) |
Predict the next line for this snippet: <|code_start|>
def random_string(N):
return ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for i in range(N))
class User(TableBase, UserMixin):
"""A user."""
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
... | avatar = Column(MEDIUMTEXT()) |
Using the snippet: <|code_start|> subprocess.check_output('gcc -o ../logparser/SLCT/slct -O2 ../logparser/SLCT/cslct.c',
stderr=subprocess.STDOUT, shell=True)
except:
print("Compile error! Please check GCC installed.\n")
raise
headers, regex = gener... | matcher = regexmatch.PatternMatch(outdir=para['savePath'], logformat=log_format)
|
Given the following code snippet before the placeholder: <|code_start|>
class Chromosome:
""" A chromosome in this class is a dictionary
key: int
value: List[Templates]
"""
def __init__(self, p_templates: dict()):
""" The constructor with an attribute of type List of Tem... | def add_template(self, template: Template):
|
Predict the next line after this snippet: <|code_start|>
is_hex1 = re.findall('(^|\s)([0-9a-f]){8,}(\s|$)', log_message)
if is_hex1:
log_message = re.sub('(^|\s)([0-9a-f]){8,}(\s|$)', sub_sign, log_message)
is_mac_address = re.findall('([0-9A-F]{2}[:-]){5,}([0-9A-F]{2})', log_message)
if ... | message = Message(log_message.split())
|
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python
sys.path.append('../')
input_dir = '../logs/HDFS/' # The input directory
output_dir = 'logmatch_result/' # The result directory
log_filepath = input_dir + 'HDFS_2k.log' # The input log file path
log_format = '<Date> <Time> <Pid>... | matcher = regexmatch.PatternMatch(outdir=output_dir, n_workers=n_workers, logformat=log_format)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.