Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Based on the snippet: <|code_start|> def __init__(self, expr): self.expr = expr class SeqOp(ASTNode): _slots = ('value',) def __init__(self, value): self.value = value class Stmt(ASTNode): _slots = ('value',) def __init__(self, value): self.value = value class Term(AST...
def __init__(self, op, right):
Predict the next line for this snippet: <|code_start|> class Boolean(ASTNode): _slots = ('value',) def __init__(self, value): if not value in ['true', 'false']: raise ValueError self.value = value class Identifier(ASTNode): <|code_end|> with the help of current file imports: f...
_slots = ('value',)
Given snippet: <|code_start|> try: return self.vars.index(luavalue) except ValueError: self.vars.append(luavalue) return len(self.vars) - 1 def emit(self, opcode): self.code.append(opcode) def add_operand(self, val): if type(val) == obj.LVar:...
if left:
Based on the snippet: <|code_start|> def add_const(self, luavalue): try: return self.consts.index(luavalue) except ValueError: self.consts.append(luavalue) return len(self.consts) - 1 def add_var(self, luavalue): try: return self.vars.index...
if right:
Given snippet: <|code_start|> self.consts = [] self.vars = [] self.binops = { '+': ops.BinaryAdd, '-': ops.BinarySubtract, } def compile(self, node): self.visit(node) return Frame(self.code, self.consts, self.vars) def generic_visit(self,...
def emit(self, opcode):
Here is a snippet: <|code_start|> def test_ass1(interp_stmt): frame = interp_stmt('a = 1') assert frame.env == { obj.LVar('a'): obj.LNumber(1.0), <|code_end|> . Write the next line using the current file imports: from luna import objects as obj and context from other files: # Path: luna/objects.py #...
}
Next line prediction: <|code_start|> self.commentStartExpression = QtCore.QRegExp("/\\*") self.commentEndExpression = QtCore.QRegExp("\\*/") #---------------------------------------------------------------------- def highlightBlock(self, text): for pattern, format_ in self.highlightingR...
def buildComment(self, start, end, format_, text):
Predict the next line after this snippet: <|code_start|> HEAD = os.getenv("PINGUINO_NAME") + " " + os.getenv("PINGUINO_VERSION") + "\n" + "Python " + sys.version + " on " + sys.platform HELP = QtWidgets.QApplication.translate("PythonShell", "Commands available:") + ' "clear", "restart"' START = ">>> " NEW_LINE = "......
self.multiline_commands = []
Based on the snippet: <|code_start|> menu.setStyleSheet(""" QMenu { font-family: inherit; font-weight: normal; } """) menu.exec_(event.globalPos()) #---------------------------------------------------------------------- def step_font_size(s...
background-color: #000;
Using the snippet: <|code_start|> done = False while not done: try: ret = self.devhandle.interruptRead(PK2_INT_READ, INT_PKT_SZ) ### We ignore failures here because we're just polling for ### the return from the device except: ...
icsp_pins = icsp_pins | PK2_IO_ICSP_2_SET
Next line prediction: <|code_start|>#!/usr/bin/env python #-*- coding: utf-8 -*- ######################################################################## class InsertBlock(QtWidgets.QDialog): def __init__(self, KIT): super(InsertBlock, self).__init__() self.insert = Ui_InsertBlock() se...
self.graphical = KIT
Continue the code snippet: <|code_start|> class VideoDisplay(object): """Displays a Voctomix-Video-Stream into a GtkWidget""" def __init__(self, video_drawing_area, audio_display, port, name, width=None, height=None, play_audio=False): self.log = logging.getLogger('VideoDisplay:%s'...
name=tcpsrc-{name}
Given the code snippet: <|code_start|> ! glimagesinkelement name=imagesink-{name} """.format(name=name) elif videosystem == 'xv': pipe += """ ! xvimagesink name=imagesink-{name} ...
name=lvl
Given snippet: <|code_start|>#!/usr/bin/env python3 gi.require_version('GstController', '1.0') class VideoMix(object): log = logging.getLogger('VideoMix') def __init__(self): # read sources from confg file self.bgSources = Config.getBackgroundSources() <|code_end|> , continue by predicting ...
self.sources = Config.getSources()
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python3 gi.require_version('GstController', '1.0') class VideoMix(object): log = logging.getLogger('VideoMix') def __init__(self): # read sources from confg file self.bgSources = Config.getBackgroundSources() self....
self.transitions = Config.getTransitions(self.composites)
Given the following code snippet before the placeholder: <|code_start|> self.bin += """\ ! identity name=sig ! {vcaps} ! queue max-size-time=3000000000 ! tee name=video-mix """.format( vcaps=Co...
max-size-time=3000000000
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3 gi.require_version('GstController', '1.0') class VideoMix(object): log = logging.getLogger('VideoMix') def __init__(self): # read sources from confg file self.bgSources = Config.getBackgroundSources() sel...
self.bgScene = None
Given the following code snippet before the placeholder: <|code_start|> def get_video(self): """gets the current video-status, consisting of the name of video-source A and video-source B""" status = self.pipeline.vmix.getVideoSources() return OkResponse('video_status', *status) ...
})
Continue the code snippet: <|code_start|>#!/usr/bin/env python3 class ControlServerCommands(object): def __init__(self, pipeline): self.log = logging.getLogger('ControlServerCommands') self.pipeline = pipeline self.stored_values = {} <|code_end|> . Use current file imports: import logg...
self.sources = Config.getSources()
Given snippet: <|code_start|> composite_status = self.pipeline.vmix.getCompositeMode() video_status = self.pipeline.vmix.getVideoSources() return [ NotifyResponse('composite_mode', composite_status), NotifyResponse('video_status', *video_status), NotifyRespon...
status = self._get_stream_status()
Continue the code snippet: <|code_start|> except BlockingIOError: pass data = "".join(leftovers) del leftovers[:] lines = data.split('\n') for line in lines[:-1]: self.log.debug("got line: %r", line) line = line.strip() # 'quit' =...
return True
Based on the snippet: <|code_start|> self.mainloop.run() except KeyboardInterrupt: self.log.info('Terminated via Ctrl-C') def quit(self): self.log.info('Quitting.') self.mainloop.quit() # run mainclass def main(): # parse command-line args args.parse() ...
logging.info('Python Version: %s', sys.version_info)
Predict the next line after this snippet: <|code_start|> def __init__(self): self.log = logging.getLogger('Voctogui') # Load UI file path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui/voctogui.ui') self.log.info('Loading ui-file from file %s', path) if os.p...
)
Here is a snippet: <|code_start|> # time interval to re-fetch queue timings TIMER_RESOLUTION = 5.0 COLOR_OK = ("white", "darkgreen") COLOR_WARN = ("darkred", "darkorange") COLOR_ERROR = ("white", "red") class PortsWindowController(): def __init__(self, uibuilder): self.log = logging.getLogger('QueuesWi...
if port.connections > 0:
Continue the code snippet: <|code_start|> if Args.cross: # mark center lines drawFg.line((size[X] / 2, 0, size[X] / 2, size[Y]), fill=(0, 0, 0, 128)) drawFg.line((0, size[Y] / 2, size[X], size[Y] / 2), fill=(0, 0, 0, 128)) # simulate swapping sourc...
images = []
Predict the next line after this snippet: <|code_start|> r = re.match( r'^\s*(\d+)\s*x\s*(\d+)\s*$', Args.size) else: r = re.match( r'^.*width\s*=\s*(\d+).*height\s*=\s*(\d+).*$', config.get('mix', 'videocaps')) if r: size = [int(r.group(1)), int(r.group(2))] #...
if Args.list:
Predict the next line after this snippet: <|code_start|> parser.add_argument('-G', '--nogif', action='count', help="when using -g: do not generate animated GIFS") parser.add_argument('-v', '--verbose', action='count', default=0, help="also print WARNING (-v), INFO ...
config.read(filename)
Next line prediction: <|code_start|> def render_sequence(size, fps, sequence, transitions, composites): global log log.debug("rendering generated sequence (%d items):\n\t%s\t" % (len(sequence), '\n\t'.join(sequence))) # begin at first transition prev_name = sequence[0] prev = composi...
log.debug("transition found: %s\n%s" %
Here is a snippet: <|code_start|> help="list of composites to generate transitions between (use all available if not given)") parser.add_argument('-f', '--config', action='store', default="voctocore/default-config.ini", help="name of the configuration file to load") ...
help="set frame size 'WxH' W and H must be pixels")
Here is a snippet: <|code_start|> draw.text([x, y], text, font=font, fill=fill) def draw_composite(size, composite, swap=False): # indices in size and tsize X, Y = 0, 1 # create an image to draw into imageBg = Image.new('RGBA', size, (40, 40, 40, 255)) imageA = Image.new('RGBA', size, (0, 0, 0,...
if Args.crop:
Based on the snippet: <|code_start|> help="draw calculated interpolation corners") parser.add_argument('-C', '--cross', action='count', default=0, help="draw image cross through center") parser.add_argument('-r', '--crop', action='count', default=0, ...
logging.root.setLevel([logging.ERROR, logging.WARNING,
Next line prediction: <|code_start|>def render_sequence(size, fps, sequence, transitions, composites): global log log.debug("rendering generated sequence (%d items):\n\t%s\t" % (len(sequence), '\n\t'.join(sequence))) # begin at first transition prev_name = sequence[0] prev = composite...
found.append(transition.name())
Predict the next line for this snippet: <|code_start|> nothing else is happening (registered as GObject idle callback)''' global command_queue log.debug('on_loop called') if command_queue.empty(): log.debug('command_queue is empty again, stopping on_loop scheduling') return False ...
def send(command, *args):
Continue the code snippet: <|code_start|> # Setup Preview Controller self.video_previews = VideoPreviewsController( self.find_widget_recursive(self.win, 'preview_box'), audio_box, win=self.win, uibuilder=self ) if Config.getPreviewsEnabled()...
if Config.getPreviewsEnabled():
Next line prediction: <|code_start|># -*- coding: utf-8 -*- """ templatetricks.use_markdown ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using the markdown language http://flask.pocoo.org/snippets/19/ """ sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) html_content = """ <html> <|co...
<head>
Given snippet: <|code_start|> def get_redirect_target(): for target in request.values.get('next'), request.referrer: if not target: continue if is_safe_url(target): return target def redirect_back(endpoint, **values): target = request.form['next'] if not target or n...
<form action="" method=post>
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- """ templatetricks.generate_pdf ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Generating PDF from Flask template (using xhtml2pdf) http://flask.pocoo.org/snippets/68/ """ sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) html_con...
</tbody>
Given the following code snippet before the placeholder: <|code_start|> utilities.cms_pages ~~~~~~~~~~~~~~~~~~~ CMS Pages http://flask.pocoo.org/snippets/114/ """ sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) class Page(Base): __tablename__='pages' id Colum...
</div>
Given the following code snippet before the placeholder: <|code_start|> self.id = None self.desc_map = { self.data: "data", self.event: "event", self.id: "id" } def encode(self): if not self.data: return "" lines = ["%s: %s" % (...
var evtSrc = new EventSource("/subscribe");
Here is a snippet: <|code_start|> def token_span(self, start_address=0): '''returns the words (im)mediately depending on the given address in a dependency graph in correct linear order, except for the root node ''' addresses = self.address_span(start_address) return [self.n...
assert field_name not in STANDARD_FIELDS
Predict the next line for this snippet: <|code_start|> '''returns a sorted list of the addresses of all dependencies of the node at the specified address''' deps_dict = self.nodes[address].get(DEPS, {}) return sorted([e for l in deps_dict.values() for e in l]) def address_span(sel...
print("Warning: No root address", file=sys.stderr)
Predict the next line for this snippet: <|code_start|> '''returns a sorted list of the addresses of all dependencies of the node at the specified address''' deps_dict = self.nodes[address].get(DEPS, {}) return sorted([e for l in deps_dict.values() for e in l]) def address_span(sel...
print("Warning: No root address", file=sys.stderr)
Continue the code snippet: <|code_start|> while len(worklist) != 0: address = worklist.pop(0) addresses.append(address) for _rel, deps in self.nodes[address][DEPS].items(): worklist.extend(deps) return sorted(addresses) def token_span(self, start_a...
return len(self.nodes) - 1
Using the snippet: <|code_start|>try: except ImportError: class TestPluginManager(ut.TestCase): def setUp(self): self.manager = PluginManager() if hasattr(sys, 'frozen'): module_path = os.path.dirname(sys.executable) else: file_path = os.path.abspath(os.path.dirnam...
self.assertGreater(self.manager.root.childCount(), 0,
Predict the next line for this snippet: <|code_start|># # Eff 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 3 of the License, or # (at your option) any later version. # # Eff is distributed in...
suite.addTest(testClientSummary.suite())
Based on the snippet: <|code_start|>os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings' if __name__ == '__main__': date_format = "%Y%m%d%H%M" args = sys.argv[1:] if len(args) != 4: print ("Usage: $ dp2eff.py <client-name> <source-name>" " <from-date> <to-date>") pr...
sys.exit(1)
Given the code snippet: <|code_start|># # You should have received a copy of the GNU General Public License # along with Eff. If not, see <http://www.gnu.org/licenses/>. path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')) sys.path.insert(1, path) os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_s...
print 'Source with name: %s does not exist' % source_name
Based on the snippet: <|code_start|> self.assert_(self.client.login(username='test1', password='test1')) response = self.client.get('/efi/semanaactual/', {}) self.assertEqual(response.status_code, 302) # Esta es la unica forma que encontre de conocer a donde redirecciona. url = ...
def test_unsuccessful_password_change_do_not_match(self):
Based on the snippet: <|code_start|># -*- coding: utf-8 *-* # This script call a view of eff, this view send an email each user with # receive report email in True, and not is a user client path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')) sys.path.insert(1, path) os.environ['DJANGO_SETTINGS...
6: 'Sunday'}
Continue the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/ # # This file is part of Eff. # # Eff is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the...
if __name__ == '__main__':
Predict the next line after this snippet: <|code_start|># # Eff 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 License for more details. # # You should have received ...
print 'Source with name: %s does not exist' % source_name
Predict the next line after this 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. # # You should have received a copy of the GNU General Public License # along with Eff. ...
name='login'),
Using the snippet: <|code_start|>templates_dir = join(CURRENT_ABS_DIR, 'templates/') images_dir = join(CURRENT_ABS_DIR, 'templates/images/') urlpatterns = patterns('', url(r'^$', index, name='root'), url(r'^clients/home/$', eff_client_home, name='client_home'), url(r'^clients/projects/$', eff_client_projec...
{'template_name': 'password_reset.html',
Given the following code snippet before the placeholder: <|code_start|> # password reset url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', {'template_name': 'password_reset.html', 'email_template_name': 'password_reset_email.html'}, name='password_res...
url(r'^accounts/change_password/done/$',
Continue the code snippet: <|code_start|> url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'), url(r'^efi/next/$', eff_next, name='eff_next'), url(r'^efi/prev/$', eff_prev, name='eff_prev'), url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'), url(r'^efi/charts/$', eff_...
url(r'^comments/', include('django.contrib.comments.urls')),
Based on the snippet: <|code_start|> url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail, name='profiles_detail'), url(r'^profiles/', include('profiles.urls'), name='profiles'), # password reset url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', ...
{'template_name': 'password_change.html',
Predict the next line for this snippet: <|code_start|> name='eff_admin_add_user'), url(r'^efi/administration/client_reports/$', eff_client_reports_admin, name='eff_client_reports_admin'), url(r'^efi/administration/fixed_price_client_reports/$', eff_fixed_price_client_reports, name='eff_fi...
)
Predict the next line after this snippet: <|code_start|> url(r'^clients/summary/$', eff_client_summary, name='client_summary'), # django-profiles url(r'^accounts/login/$', login, {'template_name': 'login.html'}, name='login'), url(r'^accounts/logout/$', logout, {'template_name': 'logout.h...
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
Predict the next line for this snippet: <|code_start|>sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/') templates_dir = join(CURRENT_ABS_DIR, 'templates/') images_dir = join(CURRENT_ABS_DIR, 'templates/images/') urlpatterns = patterns('', url(r'^$', index, name='root'), url(r'^clients/home/$', eff...
'django.contrib.auth.views.password_reset',
Continue the code snippet: <|code_start|> name='profiles_detail'), url(r'^profiles/', include('profiles.urls'), name='profiles'), # password reset url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', {'template_name': 'password_reset.html', 'email_te...
'post_change_redirect': '/accounts/change_password/done/'},
Predict the next line after this snippet: <|code_start|> name='password_reset_complete'), # password change url(r'^accounts/change_password/$', 'django.contrib.auth.views.password_change', {'template_name': 'password_change.html', 'post_change_redirect': '/accounts/change_passwor...
name='eff_admin_change_profile'),
Using the snippet: <|code_start|> url(r'^efi/administration/add_user/$', eff_admin_add_user, name='eff_admin_add_user'), url(r'^efi/administration/client_reports/$', eff_client_reports_admin, name='eff_client_reports_admin'), url(r'^efi/administration/fixed_price_client_reports/$', ef...
'document_root': settings.MEDIA_ROOT}),
Here is a snippet: <|code_start|> 'django.contrib.auth.views.password_change_done', {'template_name': 'password_change_done.html'}, name='password_change_done'), url(r'^password_change/$', redirect_to, {'url': '/accounts/password_change/'}, name='redir_password_change'), u...
name='eff_dump_csv_upload'),
Based on the snippet: <|code_start|># along with Eff. If not, see <http://www.gnu.org/licenses/>. admin.autodiscover() jscalendar_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/') js_dir = join(CURRENT_ABS_DIR, 'addons/js/') jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/') calendar_d...
name='redir_login'),
Based on the snippet: <|code_start|> url(r'^clients/home/$', eff_client_home, name='client_home'), url(r'^clients/projects/$', eff_client_projects, name='client_projects'), url(r'^clients/summary/period/$', eff_client_summary_period, name='client_summary_period'), url(r'^clients/summary/$', eff_c...
url(r'^accounts/password_reset/done/$',
Given the code snippet: <|code_start|> url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'), url(r'^efi/next/$', eff_next, name='eff_next'), url(r'^efi/prev/$', eff_prev, name='eff_prev'), url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'), url(r'^efi/charts/$', eff_cha...
url(r'^comments/', include('django.contrib.comments.urls')),
Based on the snippet: <|code_start|> urlpatterns = patterns('', url(r'^$', index, name='root'), url(r'^clients/home/$', eff_client_home, name='client_home'), url(r'^clients/projects/$', eff_client_projects, name='client_projects'), url(r'^clients/summary/period/$', eff_client_summary_period, nam...
name='password_reset'),
Here is a snippet: <|code_start|> 'django.contrib.auth.views.password_reset', {'template_name': 'password_reset.html', 'email_template_name': 'password_reset_email.html'}, name='password_reset'), url(r'^password_reset/$', redirect_to, {'url': '/accounts/password_reset/'}, nam...
{'template_name': 'password_change_done.html'},
Given the code snippet: <|code_start|>js_dir = join(CURRENT_ABS_DIR, 'addons/js/') jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/') calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/') sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/') templates_dir = join(CURRENT_ABS_DI...
url(r'^profiles/', include('profiles.urls'), name='profiles'),
Given the following code snippet before the placeholder: <|code_start|>jscalendar_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/') js_dir = join(CURRENT_ABS_DIR, 'addons/js/') jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/') calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/') ...
name='profiles_detail'),
Predict the next line after this snippet: <|code_start|> url(r'^accounts/password_reset/$', 'django.contrib.auth.views.password_reset', {'template_name': 'password_reset.html', 'email_template_name': 'password_reset_email.html'}, name='password_reset'), url(r'^password_reset/$', ...
'django.contrib.auth.views.password_change_done',
Predict the next line for this snippet: <|code_start|> {'template_name': 'password_reset.html', 'email_template_name': 'password_reset_email.html'}, name='password_reset'), url(r'^password_reset/$', redirect_to, {'url': '/accounts/password_reset/'}, name='redir_password_reset'), ...
name='password_change_done'),
Given snippet: <|code_start|> url(r'^clients/projects/$', eff_client_projects, name='client_projects'), url(r'^clients/summary/period/$', eff_client_summary_period, name='client_summary_period'), url(r'^clients/summary/$', eff_client_summary, name='client_summary'), # django-profiles ...
'django.contrib.auth.views.password_reset_done',
Given snippet: <|code_start|> name='redir_login'), url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'}, name='redir_logout'), url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'), url(r'^profiles/edit', 'eff.views.edit_profile', {'form_class': UserProfileF...
'django.contrib.auth.views.password_reset_complete',
Given the code snippet: <|code_start|>images_dir = join(CURRENT_ABS_DIR, 'templates/images/') urlpatterns = patterns('', url(r'^$', index, name='root'), url(r'^clients/home/$', eff_client_home, name='client_home'), url(r'^clients/projects/$', eff_client_projects, name='client_projects'), url(r'^clients...
'email_template_name': 'password_reset_email.html'},
Using the snippet: <|code_start|> {'template_name': 'password_change.html', 'post_change_redirect': '/accounts/change_password/done/'}, name='password_change'), url(r'^accounts/change_password/done/$', 'django.contrib.auth.views.password_change_done', {'template_name': 'passw...
name='eff_client_reports_admin'),
Given snippet: <|code_start|># Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/ # # This file is part of Eff. # # Eff 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 3 of the License...
urlpatterns = patterns('',
Given the following code snippet before the placeholder: <|code_start|> url(r'^efi/administration/add_user/$', eff_admin_add_user, name='eff_admin_add_user'), url(r'^efi/administration/client_reports/$', eff_client_reports_admin, name='eff_client_reports_admin'), url(r'^efi/administration/fix...
'document_root': settings.MEDIA_ROOT}),
Next line prediction: <|code_start|> name='password_change_done'), url(r'^password_change/$', redirect_to, {'url': '/accounts/password_change/'}, name='redir_password_change'), url(r'^updatehours/([A-Za-z_0-9]*)/$', update_hours, name='update_hours'), url(r'^efi/$', eff, name='eff'), ...
name='eff_client_report'),
Predict the next line for this snippet: <|code_start|> 'post_change_redirect': '/accounts/change_password/done/'}, name='password_change'), url(r'^accounts/change_password/done/$', 'django.contrib.auth.views.password_change_done', {'template_name': 'password_change_done.html'}, ...
url(r'^efi/administration/fixed_price_client_reports/$',
Given the following code snippet before the placeholder: <|code_start|> url(r'^efi/$', eff, name='eff'), url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'), url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'), url(r'^efi/mesactual/$', eff_current_month, name='ef...
name='eff_client_summary_period'),
Given the following code snippet before the placeholder: <|code_start|> url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'), url(r'^efi/charts/$', eff_charts, name='eff_charts'), url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'), url(r'^efi/update-db/$', eff_update_db, n...
url(r'^attachments/delete/(?P<attachment_pk>\d+)/$',
Given the following code snippet before the placeholder: <|code_start|>images_dir = join(CURRENT_ABS_DIR, 'templates/images/') urlpatterns = patterns('', url(r'^$', index, name='root'), url(r'^clients/home/$', eff_client_home, name='client_home'), url(r'^clients/projects/$', eff_client_projects, name='clie...
'email_template_name': 'password_reset_email.html'},
Next line prediction: <|code_start|> path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')) sys.path.insert(1, path) os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings' def generate_timelog_data(): users = User.objects.all() projects = Project.objects.all() dumps = Dump.objec...
hours_booked=hours,
Using the snippet: <|code_start|>path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..')) sys.path.insert(1, path) os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings' def generate_timelog_data(): users = User.objects.all() projects = Project.objects.all() dumps = Dump.objects.a...
description=description,
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/ # # This file is part of Eff. # # Eff 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 S...
from_date = forms.DateField(required=True,
Given snippet: <|code_start|># (at your option) any later version. # # Eff 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 License for more details. # # You should hav...
if to_date < from_date:
Given the following code snippet before the placeholder: <|code_start|># (at your option) any later version. # # Eff 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 Li...
if to_date < from_date:
Given the code snippet: <|code_start|># # You should have received a copy of the GNU General Public License # along with Eff. If not, see <http://www.gnu.org/licenses/>. class AvgHoursForm(forms.Form): ah_date = forms.DateField(required=True) hours = forms.IntegerField(required=True) class EffQueryForm(f...
class UserProfileForm(ModelForm):
Continue the code snippet: <|code_start|> if self.config.get('debug', False): log.msg("[%s] Tick: %s" % (self.config['service'], event)) defer.returnValue(event) @defer.inlineCallbacks def tick(self): """Called for every timer tick. Calls self.get which can be a deferred ...
hostname=None, aggregation=None, evtime=None):
Given the code snippet: <|code_start|> def _qb(self, result): pass def test_basic_cpu(self): self.skip_if_no_hostname() s = basic.CPU( {'interval': 1.0, 'service': 'cpu', 'ttl': 60}, self._qb, None) try: s.get() s.get() except: ...
events = s.get()
Given snippet: <|code_start|> def qb(src, ev): events.append(ev) f = open('foo.log', 'wt') f.write('192.168.0.1 - - [16/Jan/2015:16:31:29 +0200] "GET /foo HTTP/1.1" 200 210 "-" "My Browser"\n') f.write('192.168.0.1 - - [16/Jan/2015:16:51:29 +0200] "GET /foo HTTP/1.1" 200 410 ...
if i.service=='nginx.client.192.168.0.1.bytes':
Given the following code snippet before the placeholder: <|code_start|> events = [] f.write('192.168.0.1 - - [16/Jan/2015:17:10:31 +0200] "GET /foo HTTP/1.1" 200 410 "-" "My Browser"\n') f.write('192.168.0.1 - - [16/Jan/2015:17:10:34 +0200] "GET /bar HTTP/1.1" 200 410 "-" "My Browser"\n') ...
endpoint = endpoints.TCP4ServerEndpoint(reactor, 0)
Continue the code snippet: <|code_start|> except: pass events = [] def qb(src, ev): events.append(ev) f = open('foo.log', 'wt') f.write('192.168.0.1 - - [16/Jan/2015:16:31:29 +0200] "GET /foo HTTP/1.1" 200 210 "-" "My Browser"\n') f.write('192.16...
for i in ev1:
Using the snippet: <|code_start|> for i in events[0]: if i.service=='nginx.client.192.168.0.1.requests': self.assertEquals(i.metric, 2) if i.service=='nginx.user-agent.My Browser.bytes': self.assertEquals(i.metric, 820) if i.service=='nginx.req...
'hostname': 'localhost',
Based on the snippet: <|code_start|> log = open('test.log', 'wt') log.write('foo\nbar\n') log.flush() f = follower.LogFollower('test.log', tmp_path=".", history=True) r = f.get() log.write('test') log.flush() r2 = f.get() log.write('ing\n') ...
log.write('foo2\nbar2\n')
Next line prediction: <|code_start|> testKey = """-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,A6588464A721D661311DBCE44C76337E /bqr0AEIbiWubFiPEcdlNw8WdDrFqELOCZo78ohtDX/2HJhkMCCtAuv46is5UCvj pweYupJQgZZ9g+6rKLhTo6d0VYwaSOuR6OJWEecIr7quyQBgCPOvun2fVGrx6/7U D9HiXBdBDVc4vcEUviZu5V+E9xLm...
ZefHS5wV1KNZBK+vh08HvX/AY9WBHPH+DEbrpymn/9oAKVmhH+f73ADqVOanMPk0
Continue the code snippet: <|code_start|> try: except: SSL=None if SSL: class ClientTLSContext(ssl.ClientContextFactory): def __init__(self, key, cert): self.key = key self.cert = cert <|code_end|> . Use current file imports: import time import random from twisted.internet ...
def getContext(self):
Here is a snippet: <|code_start|> try: except: SSL=None <|code_end|> . Write the next line using the current file imports: import time import random from twisted.internet import reactor, defer, task from twisted.python import log from OpenSSL import SSL from twisted.internet import ssl from tensor.prot...
if SSL:
Given snippet: <|code_start|> class Tests(unittest.TestCase): def test_persistent_cache(self): pc = utils.PersistentCache(location='test.cache') pc.set('foo', 'bar') pc.set('bar', 'baz') pc2 = utils.PersistentCache(location='test.cache') <|code_end|> , continue by predicting the...
self.assertEquals(pc2.get('foo')[1], 'bar')