Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Given snippet: <|code_start|>
# Tilde API demo
# calculates molecular weight for organic molecules
# Author: Evgeny Blokhin
# deps third-party code and common routines
# here are already available:
class Example_app():
'''# this determines how the data should be represented in a table cell
@staticmethod
... | for a in tilde_calc.structures[-1]: |
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python
logging.basicConfig(level=logging.INFO)
Tilde = API()
USER, PASS = 'test', 'test'
settings['debug_regime'] = False
class TildeGUIProvider:
@staticmethod
def login(req, client_id, db_session):
result, error = None, None... | pass_match = False |
Given the code snippet: <|code_start|>#!/usr/bin/env python
logging.basicConfig(level=logging.INFO)
Tilde = API()
USER, PASS = 'test', 'test'
settings['debug_regime'] = False
class TildeGUIProvider:
@staticmethod
def login(req, client_id, db_session):
result, error = None, None
if not is... | if user != USER or not pass_match: |
Continue the code snippet: <|code_start|>
# Calculation of atomic relaxations
# during atomic structure optimization
# Author: Evgeny Blokhin
class Atomic_relaxation():
def __init__(self, tilde_calc):
self.ardata = {}
if len(tilde_calc.structures[0]) != len(tilde_calc.structures[-1]):
... | (tilde_calc.structures[-1][n].x - tilde_calc.structures[0][n].x)**2 + \ |
Based on the snippet: <|code_start|> Type = 'asynchronous'
Clients = {}
GUIProvider = GUIProviderMockup
def on_open(self, info):
self.Clients[ getattr(self.session, 'session_id', self.session.__hash__()) ] = Client()
logging.info("Server connected %s-th client" % len(self.Clients))
... | def worker(frame): |
Next line prediction: <|code_start|>
# implementation of thread pool for asynchronous websocket connections
# with dynamically re-created DB sessions
thread_pool = ThreadPoolExecutor(max_workers=4*multiprocessing.cpu_count())
class Connection(SockJSConnection):
Type = 'asynchronous'
Clients = {}
GUI... | message = json.loads(message) |
Continue the code snippet: <|code_start|> if not self.Clients[frame['client_id']].authorized and frame['act'] != 'login': return self.close()
if not hasattr(self.GUIProvider, frame['act']):
frame['error'] = 'No server handler for action: %s' % frame['act']
return self.respond(fra... | ) |
Continue the code snippet: <|code_start|> GUIProvider = GUIProviderMockup
def on_open(self, info):
self.Clients[ getattr(self.session, 'session_id', self.session.__hash__()) ] = Client()
logging.info("Server connected %s-th client" % len(self.Clients))
def on_message(self, message):
... | logging.debug("New DB connection to %s" % ( |
Predict the next line after this snippet: <|code_start|>
# Tilde project: plotting interfaces
# for flot.js browser-side plotting library
# Author: Evgeny Blokhin
def frac2float(num):
if '/' in str(num):
fract = map(float, num.split('/'))
return fract[0] / fract[1]
return float(num)
def j... | r, g, b = map(lambda x: x*255, ase_jmol) |
Predict the next line for this snippet: <|code_start|> __tablename__ = 'electrons'
checksum = Column(String, ForeignKey('calculations.checksum'), primary_key=True)
gap = Column(Float, default=None)
is_direct = Column(Integer, default=0)
class Phonons(Base):
__tablename__ = 'phonons'
checksum = C... | final = Column(Boolean, nullable=False) |
Given snippet: <|code_start|>START_TIME = time.time()
USER, PASS = 'test', 'test'
class RespHandler(object):
@classmethod
def on_error(self, ws, error):
logging.error(error)
@classmethod
def on_close(self, ws):
logging.debug("Closed")
ws.close()
@classmethod
def on_op... | sys.exit(1) |
Next line prediction: <|code_start|> #print 'corners:', [i+1 for i in octahedron[1]]
# Option 1. Extract only one tilting plane, the closest to perpendicular to Z-axis
'''tiltplane = self.get_tiltplane(octahedron[1])
if len(tiltplane) == 4:
t = self.get_ti... | u = sorted(u, key=lambda x:x[0]) |
Predict the next line for this snippet: <|code_start|> (reference[num_of_atom].x + a_component * cell[0][0] + b_component * cell[1][0] + c_component * cell[2][0],
reference[num_of_atom].y + a_component * cell[0][1] + b_component * cell[1][1] + c_component * cell[2][1],
reference[num_o... | x = (xA + u*xB/v)/(1+u/v) |
Given the code snippet: <|code_start|> #with open('tilting.xyz', 'w') as f:
# f.write(generate_xyz(self.virtual_atoms))
# translate atoms around octahedra in all directions
shift_dirs = [(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (1, 1, 0), (1, -1, 0), (-1, -1, 0), (-1, 1, 0), (0, 0... | plane_tilting.append( t ) |
Given the following code snippet before the placeholder: <|code_start|>
# implementation of blocking websocket connections
# with (customly) pooled DB sessions
class Connection(SockJSConnection):
Type = 'blocking'
Clients = {}
GUIProvider = GUIProviderMockup
def on_open(self, info):
self.... | try: |
Next line prediction: <|code_start|>
# implementation of blocking websocket connections
# with (customly) pooled DB sessions
class Connection(SockJSConnection):
Type = 'blocking'
Clients = {}
GUIProvider = GUIProviderMockup
def on_open(self, info):
self.Clients[ getattr(self.session, 'ses... | logging.debug("Server got: %s" % message) |
Predict the next line after this snippet: <|code_start|>
if not Connection.Clients[frame['client_id']].db:
Connection.Clients[frame['client_id']].db = connect_database(settings, default_actions=False, no_pooling=True)
logging.debug("New DB connection to %s" % (
settings['... | del self.Clients[client_id] |
Given the code snippet: <|code_start|>
if not Connection.Clients[frame['client_id']].db:
Connection.Clients[frame['client_id']].db = connect_database(settings, default_actions=False, no_pooling=True)
logging.debug("New DB connection to %s" % (
settings['db']['default_sqli... | del self.Clients[client_id] |
Based on the snippet: <|code_start|> echo $PEARL_PKGVARDIR >> {home_dir}/result2
echo $PEARL_PKGNAME >> {home_dir}/result2
echo $PEARL_PKGREPONAME >> {home_dir}/result2
return 0
}}
"""
builder = PackageTestBuilder(home_dir)
builder.add_local_package(tmp_path, hooks_sh_scr... | }} |
Based on the snippet: <|code_start|> packages = builder.build()
package = packages['repo-test']['pkg-test']
pearl_env = create_pearl_env(home_dir, packages)
update_package(pearl_env, package, args=PackageArgs(False, 0, force=True))
with pytest.raises(HookFunctionError):
update_package(pear... | then |
Predict the next line after this snippet: <|code_start|> "",
is_installed=True,
url='https://github.com/new-pkg',
git_url='https://github.com/pkg',
)
packages = builder.build()
package = packages['repo-test']['pkg-test']
pearl_env = create_pearl_env(home_dir, packages)
... | }} |
Predict the next line for this snippet: <|code_start|>
_MODULE_UNDER_TEST = 'pearllib.package'
def test_install_local_package(tmp_path):
home_dir = create_pearl_home(tmp_path)
hooks_sh_script = f"""
post_install() {{
echo $PWD > {home_dir}/result
echo $PEARL_HOME >> {home_dir}/result
... | echo $PEARL_PKGVARDIR >> {home_dir}/result |
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*-
#
# Driver for FPGA based PROFIBUS PHY.
#
# Copyright (c) 2019 Michael Buesch <m@bues.ch>
#
# Licensed under the terms of the GNU General Public License version 2,
# or (at your option) any later version.
#
from __future__ import division, absolute_impor... | ] |
Continue the code snippet: <|code_start|>ext_modules = setup_cython.ext_modules
warnings.filterwarnings("ignore", r".*'long_description_content_type'.*")
with open(os.path.join(basedir, "README.rst"), "rb") as fd:
readmeText = fd.read().decode("UTF-8")
setup( name = "pyprofibus",
version = VERSION_STRING,
desc... | "Intended Audience :: Manufacturing", |
Next line prediction: <|code_start|># -*- coding: utf-8 -*-
#
# PROFIBUS - GSD file parser
#
# Copyright (c) 2016-2021 Michael Buesch <m@bues.ch>
#
# Licensed under the terms of the GNU General Public License version 2,
# or (at your option) any later version.
#
from __future__ import division, absolute_import, print_... | ] |
Continue the code snippet: <|code_start|> """
print a welcome message
"""
clist = sysConf.commands.keys()
clist.sort()
commands = "\n".join(textwrap.wrap(
", ".join(clist),
subsequent_indent=' ',
initial_indent=' ',
)).lstrip()
moa.ui.fpr... | echo $x | grep -q "moa simple" |
Given the following code snippet before the placeholder: <|code_start|>
def ruffusExecutor(input, output, script, jobData):
if not sysConf.actor.has_key('files_processed'):
sysConf.actor.files_processed = []
sysConf.actor.files_processed.append((input, output))
wd = jobData['wd']
tmpdir = o... | if isinstance(v, list): |
Using the snippet: <|code_start|> print " ".join(job.conf.keys())
TESTRAWCOMMANDS = '''
out=`moa raw_commands`
[[ "$out" =~ "help" ]]
[[ "$out" =~ "list" ]]
[[ "$out" =~ "new" ]]
'''
TESTSCRIPT = """
moa new adhoc -t 'something'
moa set mode=simple
moa set process='echo "ERR" >&2; echo "OUT"'
moa run
moa out | gre... | err=`moa err` |
Given the code snippet: <|code_start|># Copyright 2009-2011 Mark Fiers
# The New Zealand Institute for Plant & Food Research
#
# This file is part of Moa - http://github.com/mfiers/Moa
#
# Licensed under the GPL license (see 'COPYING')
#
"""
**remoteLogger** - Remotely log Moa activity
------------------------------... | ) |
Continue the code snippet: <|code_start|>
## Initialize the logger
l = moa.logger.getLogger(__name__)
sysConf.pluginHandler = moa.plugin.PluginHandler(sysConf.plugins.system)
def load_tests(loader, tests, ignore):
tests.addTests(templateTestSuite())
return tests
def templateTestSuite():
suite = unit... | test = moa.backend.ruff.test.templateTest(job) |
Given the code snippet: <|code_start|>
@moa.args.private
@moa.args.command
def dumpTemplate(job, args):
"""
**moa template_dump** - Show raw template information
Usage::
moa template_dump [TEMPLATE_NAME]
Show the raw template sysConf.
"""
template = _getTemplateFromData(job)
print... | [[ "$out" =~ "backend" ]] |
Here is a snippet: <|code_start|> moa.ui.warn("Pausing job %d" % pid)
os.kill(pid, 19)
_setStatus(job, 'paused')
@moa.args.needsJob
@moa.args.command
def resume(job, args):
"""
Resume a running job
"""
status = _getStatus(job)
if LLOG: print 'resuming job with status', status
if stat... | moa show |
Given the following code snippet before the placeholder: <|code_start|>@moa.args.command
def lock(job, args):
"""
Lock a job - prevent execution
"""
lockfile = os.path.join(job.confDir, 'lock')
if not os.path.exists(lockfile):
l.debug("locking job in %s" % job.wd)
with open(lockfile,... | [[ "$out" =~ "This Moa job is locked" ]] |
Given snippet: <|code_start|># sysConf.git.commitDir(sysConf.moautil.mv.fr, 'Preparing for git mv')
# #seems that we need to call git directly gitpython does not work
# os.system('git mv %s %s' % (sysConf.moautil.mv.fr, sysConf.moautil.mv.to))
# os.system('git commit %s %s -m "moa mv %s %s"' % (
# ... | cd 20.test |
Using the snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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; either version 2
#of the License, or (at yo... | self.parent = parent |
Here is a snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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; either version 2
#of the License, or (at yo... | ] |
Given the code snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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; either version 2
#of the License, or (... | def __init__(self, sports, vbox = None, window = None, combovalue = None, combovalue2 = None, main = None): |
Given the code snippet: <|code_start|>
# lap info added in version 1.9.0
def upgrade(migrate_engine=None):
if migrate_engine is None:
# sqlalchemy-migrate 0.5.4 does not provide migrate engine to upgrade scripts
migrate_engine = sqlalchemy.create_engine(UPGRADE_CONTEXT.db_url)
logging.info... | logging.info("Populating lap details from GPX for lap %s" , lap_id) |
Given snippet: <|code_start|> record_ids.append(row["record"])
resultset.close()
for record_id in record_ids:
gpx_file = UPGRADE_CONTEXT.conf_dir + "/gpx/{0}.gpx".format(record_id)
if os.path.isfile(gpx_file):
gpx_record = gpx.Gpx(filename=gpx_file)
populate_laps_f... | max_heart_rate=gpx_lap[9], |
Given the following code snippet before the placeholder: <|code_start|> self.okmethod(self.gpx,trackname)
self.closewindow()
logging.debug("<<")
def on_cancel_clicked(self,widget):
logging.debug("--")
self.closewindow()
def closewindow(self):
logging.debug("--")
self.selecttrackdialog.hide()
#self.s... | GObject.TYPE_STRING, |
Predict the next line after this snippet: <|code_start|>
If the data version cannot be determined then None is returned."""
if self.is_versioned():
return self._migratable_db.get_version()
else:
# Calculate data version in older version that does not use the
... | def get_available_version(self): |
Here is a snippet: <|code_start|>
#Copyright (C) Nathan Jones ncjones@users.sourceforge.net
#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; either version 2
#of the License, or (at your option) an... | self._migratable_db = migratable_db |
Given the code snippet: <|code_start|> ylab.append(ylabel)
tit.append(title)
col.append(color)
if value_selected2 < 0:
self.combovalue2.set_active(0)
value_selected2 = 0
if value_selected2 > 0:
value_selected2 = value_selected2-1
da... | tm_total = {} |
Given snippet: <|code_start|>
if value_selected2 < 0:
self.combovalue2.set_active(0)
value_selected2 = 0
if value_selected2 > 0:
value_selected2 = value_selected2-1
daysmonth,xlabel,ylabel,title,color = self.get_value_params(value_selected2)
xv... | list_average[i]=0 |
Next line prediction: <|code_start|> def __str__(self):
return repr(self.value)
class SportService(object):
"""Provides access to stored sports."""
def __init__(self, ddbb):
self._ddbb = ddbb
def get_sport(self, sport_id):
"""Get the sport with the specified id... | return None |
Based on the snippet: <|code_start|> name = Column(Unicode(length=100), nullable=False, unique=True, index=True)
weight = Column(Float, CheckConstraint('weight>=0'), nullable=False)
def __init__(self, **kwargs):
self.name = u""
self.weight = 0.0
self.met = None
self.max_pace ... | if sport_id is None: |
Given the following code snippet before the placeholder: <|code_start|> def get_sport(self, sport_id):
"""Get the sport with the specified id.
If no sport with the given id exists then None is returned."""
if sport_id is None:
raise ValueError("Sport id cannot be None")
t... | try: |
Predict the next line after this snippet: <|code_start|> def get_sport_by_name(self, name):
"""Get the sport with the specified name.
If no sport with the given name exists then None is returned."""
if name is None:
raise ValueError("Sport name cannot be None")
try:
... | if not sport.id: |
Here is a snippet: <|code_start|> mainNS = string.Template(".//{http://www.topografix.com/GPX/1/0}$tag")
timeTag = mainNS.substitute(tag="time")
trackTag = mainNS.substitute(tag="trk")
trackPointTag = mainNS.substitute(tag="trkpt")
trackPoin... | def getTrackRoutes(self): |
Next line prediction: <|code_start|> else:
strElapsedTime = "%0.0fs" % (elapsedTimeSecs)
#process lat and lon for this lap
try:
lapLat = float(lap['end_lat'])
lapLon = float(lap['end_lon'])
content += "var lap%dmarker = n... | strokeColor: \"%s\",\n |
Continue the code snippet: <|code_start|>
try:
except ImportError:
class Googlemaps:
def __init__(self, data_path = None, waypoint = None, pytrainer_main=None):
logging.debug(">>")
self.data_path = data_path
self.waypoint=waypoint
self.pytrainer_main = pytrainer_main
self.h... | elif 7.5 <= speed < 15: #jog-run |
Here is a snippet: <|code_start|> equipment.life_expectancy = "3"
self.ddbb.session.add(equipment)
self.ddbb.session.commit()
self.assertEqual(3, equipment.life_expectancy)
def test_life_expectancy_set_to_non_numeric_string(self):
equipment = Equipment()
equipment.lif... | self.assertEqual(3, equipment.prior_usage) |
Predict the next line for this snippet: <|code_start|> pass
else:
self.fail("Should not be able to set equipment id to non numeric value.")
def test_description_defaults_to_empty_string(self):
equipment = Equipment()
self.assertEqual(u"", equipment.descrip... | self.assertEqual(u"42", equipment.description) |
Next line prediction: <|code_start|> "prior_usage": 300, "active": True})
items = self.equipment_service.get_active_equipment()
item = items[0]
self.assertEqual(1, item.id)
self.assertEqual("Test item 1", item.description)
self.assertTrue... | "notes": u"Test notes.", |
Next line prediction: <|code_start|> self.assertEqual("Test Description", item.description)
self.assertTrue(item.active)
self.assertEqual(500, item.life_expectancy)
self.assertEqual(200, item.prior_usage)
self.assertEqual("Test notes.", item.notes)
def test_get_equipment_... | "prior_usage": 300, "active": False}) |
Given the code snippet: <|code_start|> self.ddbb.session.add(equipment)
self.ddbb.session.commit()
self.assertEqual(u"42", equipment.description)
def test_active_defaults_to_true(self):
equipment = Equipment()
self.assertTrue(equipment.active)
def... | self.assertEqual(2, equipment.life_expectancy) |
Based on the snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
# vud1@grupoikusnet.com
# Jakinbidea & Grupo Ikusnet Developer
#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 Fre... | hours = seconds // (60*60) |
Given the code snippet: <|code_start|> return 0
else:
return self.get_value(y, 2)*100-self.get_value(x, 2)*100
def _append_row(self, equipment):
self.append(self._create_tuple(equipment))
def _create_tuple(self, equipment):
usage = self._equipment_ser... | return item |
Predict the next line after this snippet: <|code_start|> def show_page_equipment_add(self):
self._get_notebook().set_current_page(1)
self._builder.get_object("entryEquipmentAddDescription").grab_focus()
def show_page_equipment_edit(self):
self._get_notebook().set_current_page(2)
... | new_equipment.prior_usage = int(prior_usage) |
Next line prediction: <|code_start|> return retorno
def getAllWaypoints(self):
logging.debug(">>")
retorno = self.pytrainer_main.ddbb.select("waypoints","id_waypoint,lat,lon,ele,comment,time,name,sym","1=1 order by name")
logging.debug("<<")
return retorno
def actualize_... | self.recordwindow.set_distance(distance) |
Using the snippet: <|code_start|> self.pytrainer_main.ddbb.session.add(waypoint)
self.pytrainer_main.ddbb.session.commit()
logging.debug("<<")
return waypoint.id
def getwaypointInfo(self,id_waypoint):
logging.debug(">>")
retorno = self.pytrainer_main.ddbb.select("wayp... | warning = Warning(self.data_path,self._actualize_fromgpx,[gpx]) |
Continue the code snippet: <|code_start|> self.prefwindow.add(table)
self.prefwindow.show_all()
def on_help_clicked(self,widget):
selected,iter = self.extensionsTree.get_selection().get_selected()
name,description,status,helpfile,type = self.parent.getExtensionInfo(selected.get_value... | prefs = self.parent.getExtensionConfParams(selected.get_value(iter,0)) |
Predict the next line after this snippet: <|code_start|> button.connect("clicked", self.on_acceptSettings_clicked, None)
table.attach(button,0,2,i,i+1)
self.prefwindow.add(table)
self.prefwindow.show_all()
def on_help_clicked(self,widget):
selected,iter = self.extensionsTree.... | def on_acceptSettings_clicked(self, widget, widget2): |
Using the snippet: <|code_start|> self.validate = validate
self.data_path = os.path.dirname(__file__)
self.tmpdir = self.pytrainer_main.profile.tmpdir
def run(self):
logging.debug(">>")
selectedFiles = fileChooserDialog(title="Choose a Google Earth file (.kml) to import", multiple=True).getFiles()
guiFlush... | return importfiles |
Given snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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; either version 2
#of the License, or (at your o... | def run(self): |
Using the snippet: <|code_start|>#Copyright (C) Nathan Jones ncjones@users.sourceforge.net
#Copyright (C) Arto Jantunen <viiru@iki.fi>
#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; either versio... | self.assertTrue(first_day >= 0) |
Using the snippet: <|code_start|>
self.category = [{'isPrimary': True, "categoryId" : self.category_nbr}]
self.error = ""
self.log =""
self.idrecord = options.idrecord
self.webserviceserver = SOAPpy.SOAPProxy("http://localhost:8081/")
#we try the connection to the xml/r... | self.unegative = record["unegative"] |
Next line prediction: <|code_start|> def __init__(self, data_path = None, pytrainer_main=None, box=None):
logging.debug(">>")
self.data_path = data_path
self.pytrainer_main = pytrainer_main
if box is None:
logging.debug("Display box (%s) is None" % ( str(box)))
return
self.box = box
self.wkview = WebK... | htmlfile = "%s/error.html" % (self.pytrainer_main.profile.tmpdir) |
Given snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Nathan Jones ncjones@users.sourceforge.net
#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; either version 2
#of the License, or... | self._mock_ddbb = Mock() |
Using the snippet: <|code_start|>#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even ... | def drawgraph(self,values, daysInMonth): |
Given the code snippet: <|code_start|>#Copyright (C) Nathan Jones ncjones@users.sourceforge.net
#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; either version 2
#of the License, or (at your option... | gdk_col = Gdk.color_parse("#aaff33") |
Using the snippet: <|code_start|>#Copyright (C) Nathan Jones ncjones@users.sourceforge.net
#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; either version 2
#of the License, or (at your option) any... | gdk_col = Gdk.color_parse("#aaff33") |
Next line prediction: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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; either version 2
#of the License, or (at... | def new(self): |
Using the snippet: <|code_start|> if iterOne:
self.pluginsTreeview.get_selection().select_iter(iterOne)
self.on_pluginsTree_clicked(None,None)
def create_treeview(self,treeview,column_names):
i=0
for column_index, column_name in enumerate(column_names):
column... | self.prefwindow.set_title(_("%s settings" %name)) |
Continue the code snippet: <|code_start|> del(DDBB.self)
def tearDown(self):
del(DDBB.self)
@mock.patch.dict('os.environ', {}, clear=True)
def test_none_url(self):
self.ddbb = DDBB()
self.assertEqual(self.ddbb.url, 'sqlite://')
def test_basic_url(self):
self.ddb... | self.assertEqual(self.ddbb.url, 'sqlite:///test_url') |
Given the code snippet: <|code_start|> self.data_path = data_path
def run(self):
logging.debug('>>')
filename = save_file_chooser_dialog(title="savecsvfile", pattern="*.csv")
records = self.record.getAllrecord()
# CSV Header
content = "date_time_local,title,sports.nam... | logging.debug("Traceback: %s" % traceback.format_exc()) |
Given the code snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
#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; either version 2
#of the License, or (... | records = self.record.getAllrecord() |
Given snippet: <|code_start|>#Copyright (C) Nathan Jones ncjones@users.sourceforge.net
#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; either version 2
#of the License, or (at your option) any lat... | except(ValueError): |
Based on the snippet: <|code_start|> try:
Color(2 ** 24)
except(ValueError):
pass
else:
self.fail()
def test_rgb_value_should_default_to_0(self):
color = Color()
self.assertEqual(0, color.rgb_val)
def test_rgb_value_should_... | self.assertEqual(0xfab, color.rgb_val) |
Continue the code snippet: <|code_start|>
def set_text(self, msg):
self.text = msg
def on_accept_clicked(self):
if self.okparams != None:
num = len(self.okparams)
if num==0:
self.okmethod()
if num==1:
self.okmethod(self.okparam... | self.on_accept_clicked() |
Predict the next line for this snippet: <|code_start|> # Environment is a singleton, make sure to destroy it between tests
del(Environment.self)
self.environment = Environment(TEST_DIR_NAME, DATA_DIR_NAME)
def tearDown(self):
del(Environment.self)
def test_get_conf_dir(self):
... | def test_get_extension_dir(self): |
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*-
#Copyright (C) Fiz Vazquez vud1@sindominio.net
# vud1@grupoikusnet.com
# Jakinbidea & Grupo Ikusnet Developer
# Modified by dgranda
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public Licen... | ForeignKey('equipment.id'), |
Given the code snippet: <|code_start|> index=True, nullable=False))
class DDBB(Singleton):
url = None
engine = None
sessionmaker = sessionmaker()
session = None
def __init__(self, url=None):
"""Initialize database connection, defaulting to SQLite in-memory... | self.url = url |
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; either version 2
#of the License, or (at your option) any later version.
#This program is distributed in the hop... | except: |
Continue the code snippet: <|code_start|> attr = getattr(self, attr_name)
if callable(attr):
signals[attr_name] = attr
self._builder.connect_signals(signals)
def __getattr__(self, data_name):
if data_name in self:
data = self[data_name]
... | widget.hide() |
Here is a snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8000")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 0;" in n... | assert "daemon off;" in nginx_config |
Given the following code snippet before the placeholder: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8000")
assert response.text == response_text
nginx_config = get_nginx_config(container)
a... | assert "cheaper = 2" in logs |
Predict the next line after this snippet: <|code_start|> assert "hook-master-start = unix_signal:15 gracefully_kill_them_all" in logs
assert "need-app = true" in logs
assert "die-on-term = true" in logs
assert "show-config = true" in logs
assert "wsgi-file = /app/main.py" in logs
assert "processe... | path = test_path.parent / "simple_app" |
Continue the code snippet: <|code_start|> logs = get_logs(container)
assert "getting INI configuration from /app/uwsgi.ini" in logs
assert "getting INI configuration from /etc/uwsgi/uwsgi.ini" in logs
assert "ini = /app/uwsgi.ini" in logs
assert "ini = /etc/uwsgi/uwsgi.ini" in logs
assert "socket... | name = os.getenv("NAME", "") |
Given snippet: <|code_start|> assert "wsgi-file = /app/main.py" in logs
assert "processes = 16" in logs
assert "cheaper = 2" in logs
assert "Checking for script in /app/prestart.sh" in logs
assert "Running script /app/prestart.sh" in logs
assert (
"Running inside /app/prestart.sh, you cou... | container = client.containers.run( |
Given the code snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8000")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 0;"... | assert "chmod-socket = 664" in logs |
Given the code snippet: <|code_start|> assert "client_max_body_size 1m;" in nginx_config
assert "worker_processes 2;" in nginx_config
assert "listen 80;" in nginx_config
assert "worker_connections 2048;" in nginx_config
assert "worker_rlimit_nofile 2048;" in nginx_config
assert "daemon off;" in n... | assert "spawned uWSGI worker 1" in logs |
Using the snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8000")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 1m;" in ... | assert "ini = /etc/uwsgi/uwsgi.ini" in logs |
Next line prediction: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8000")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 1m;" ... | assert "worker_processes 2;" in nginx_config |
Using the snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8000")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 1m;" in ... | assert "ini = /app/uwsgi.ini" in logs |
Predict the next line after this snippet: <|code_start|> assert "spawned uWSGI worker 2" in logs
assert "spawned uWSGI worker 3" in logs
assert "spawned uWSGI worker 4" not in logs
assert 'running "unix_signal:15 gracefully_kill_them_all" (master-start)' in logs
assert "success: nginx entered RUNNING... | container.stop() |
Using the snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8080")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 0;" not ... | assert "hook-master-start = unix_signal:15 gracefully_kill_them_all" in logs |
Here is a snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8080")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 0;" not i... | assert "wsgi-file = /app/main.py" in logs |
Given the code snippet: <|code_start|>
client = docker.from_env()
def verify_container(container: Container, response_text: str) -> None:
response = requests.get("http://127.0.0.1:8080")
assert response.text == response_text
nginx_config = get_nginx_config(container)
assert "client_max_body_size 0;"... | assert "keepalive_timeout 300;" in nginx_config |
Predict the next line after this snippet: <|code_start|> assert "spawned uWSGI master process" in logs
assert "spawned uWSGI worker 1" in logs
assert "spawned uWSGI worker 2" in logs
assert "spawned uWSGI worker 3" not in logs
assert 'running "unix_signal:15 gracefully_kill_them_all" (master-start)' ... | time.sleep(sleep_time) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.