Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Based on the snippet: <|code_start|> def write(self, row, cells=None): """Independend write to cell method""" raise NotImplementedError def read(self, row, cells=None): """Independend read from cell method""" raise NotImplementedError def create(self, path): """Cre...
path = SETTINGS['path'](self.report, '', absolute=True)
Given the following code snippet before the placeholder: <|code_start|> class MtrSyncConfig(AppConfig): name = 'mtr.sync' label = 'mtr_sync' <|code_end|> , predict the next line using imports from the current file: from django.apps import AppConfig from .translation import gettext_lazy as _ and context incl...
verbose_name = _('Data sync')
Given the following code snippet before the placeholder: <|code_start|> class ErrorChoicesMixin(object): IMPORT_DATA = 0 UNDEFINED = 1 STEP_CHOICES = ( <|code_end|> , predict the next line using imports from the current file: from ..translation import gettext_lazy as _ and context including class names,...
(IMPORT_DATA, _('import data')),
Here is a snippet: <|code_start|> class MockInstance(object): action = 1 class SettingsTest(TestCase): def test_default_filepath_name(self): new_settings = { 'MEDIA_ROOT': '/some/path/' } instance = MockInstance() with self.settings(**new_settings): ...
SETTINGS['path'](instance, 'filename.xls'),
Using the snippet: <|code_start|> if fields is None: pass def filter_dataset(self, settings, dataset=None): if settings.filter_dataset and settings.filter_querystring: params = QueryDict(settings.filter_querystring).dict() orders = params.pop('o', '').split('.') ...
current_model = make_model_class(settings)
Given the following code snippet before the placeholder: <|code_start|> """Prepare data using filters from settings and return data with dimensions""" settings = processor.settings model = make_model_class(settings) msettings = model_settings(model, 'sync') exclude = mse...
process_attribute(item, field.attribute),
Given the following code snippet before the placeholder: <|code_start|> dataset = dataset(current_model, settings) else: dataset = current_model._default_manager.all() dataset = self.filter_dataset(settings, dataset) return dataset def prepare_export_data(self, proc...
mfields = model_fields(model)
Given snippet: <|code_start|> } def prepare_handlers(self, key_name, processor, model, context=None): prepares = [] handlers = self.all(key_name) or {} for handler in handlers.keys(): if processor.settings.data_action in handler: prepares.append(handlers[h...
context[field.name] = field.value or cell_value(
Continue the code snippet: <|code_start|> ordering = [] for order in orders: field = fields[abs(int(order))] if int(order) < 0: field = '-{}'.format(field) ordering.append(field) dataset = ...
msettings = model_settings(model, 'sync')
Predict the next line for this snippet: <|code_start|> def prepare_import_dataset(self, settings, processor, model, fields): """Get data from diferent source registered at dataset""" if settings.dataset: dataset = self.get('dataset', settings.dataset) dataset = dataset(model...
SETTINGS['actions'] + SETTINGS['processors'] + SETTINGS['converters'])
Given snippet: <|code_start|> class PersonAdmin(SyncAdminMixin, TabbedTranslationAdmin): list_display = ('name', 'surname', 'security_level', 'gender') list_filter = ('security_level', 'tags', 'office', 'name', 'gender') actions = ['copy_100'] def copy_100(self, request, queryset): for it...
class PersonStackedInline(SyncTabularInlineMixin, admin.TabularInline):
Based on the snippet: <|code_start|> class PersonAdmin(SyncAdminMixin, TabbedTranslationAdmin): list_display = ('name', 'surname', 'security_level', 'gender') list_filter = ('security_level', 'tags', 'office', 'name', 'gender') actions = ['copy_100'] def copy_100(self, request, queryset): ...
model = Person
Given the code snippet: <|code_start|> class PersonAdmin(SyncAdminMixin, TabbedTranslationAdmin): list_display = ('name', 'surname', 'security_level', 'gender') list_filter = ('security_level', 'tags', 'office', 'name', 'gender') actions = ['copy_100'] def copy_100(self, request, queryset): ...
admin.site.register(Office, OfficeAdmin)
Given snippet: <|code_start|> class PersonAdmin(SyncAdminMixin, TabbedTranslationAdmin): list_display = ('name', 'surname', 'security_level', 'gender') list_filter = ('security_level', 'tags', 'office', 'name', 'gender') actions = ['copy_100'] def copy_100(self, request, queryset): for item i...
admin.site.register(Tag, TagAdmin)
Using the snippet: <|code_start|># ayrton 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. # # ayrton is distributed in the hope that it...
self.c= castt.CrazyASTTransformer ({})
Given the code snippet: <|code_start|> t= self.c.modify (t) self.assertTrue ('x' in self.c.seen_names) self.assertTrue ('y' in self.c.seen_names) def testImport (self): t= ast.parse ("""import os""") t= self.c.modify (t) self.assertTrue ('os' in self.c.seen_names...
c= castt.CrazyASTTransformer ({ 'dict': dict, 'o': o})
Based on the snippet: <|code_start|> self.assertEqual (combined, 'argv[3].split') def testDottedSubscriptComplex (self): single, combined= castt.func_name2dotted_exec (parse_expression ('argv[3].split[:54]')) self.assertEqual (single, 'argv') # this is a very strange but possible ex...
c= castt.CrazyASTTransformer ({ 'o': o, 'cd': cd})
Given the code snippet: <|code_start|> c= castt.CrazyASTTransformer ({ 'o': o, 'dict': dict}) t= ayrton.parse ("""dict (p=True, False)""") self.assertRaises (SyntaxError, c.visit_Call, t.body[0].value) def testMinusMinusFunction (self): c= castt.CrazyASTTransformer ({ 'o': o, 'dict'...
c= castt.CrazyASTTransformer ({ 'define': define })
Using the snippet: <|code_start|> # If ICANON is also set, the ERASE character erases the preceding input character, and WERASE erases the preceding word # If ICANON is also set, the KILL character erases the current line # If ICANON is also set, echo the NL character even if ECHO is not set ...
copy_loop(self.copy_to, self.finished[0])
Using the snippet: <|code_start|> # If ICANON is also set, the KILL character erases the current line # If ICANON is also set, echo the NL character even if ECHO is not set # implementation-defined input processing lflag&= ~( ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL | IEXTEN ) ...
self.close ()
Using the snippet: <|code_start|># ayrton 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 a copy of the GNU Gene...
copy_loop ({ r: w }, buf_len=4)
Given the following code snippet before the placeholder: <|code_start|># (c) 2015 Marcos Dione <mdione@grulic.org.ar> # This file is part of ayrton. # # ayrton 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, ...
self.addCleanup (close, pipe[0])
Given the code snippet: <|code_start|> lnum = parenlev = continued = 0 namechars = NAMECHARS numchars = NUMCHARS contstr, needcont = '', 0 contline = None indents = [0] altindents = [0] last_comment = '' parenlevstart = (0, 0, "") # make the annotator happy endDFA = automata....
tok = (tokens.STRING, contstr + line[:end], strstart[0],
Given the code snippet: <|code_start|> if token[-1] == '\n': # continued string strstart = (lnum, start, line) endDFA = (endDFAs[initial] or endDFAs[token[1]] or endDFAs[token[2]]) ...
if token in python_opmap:
Given the code snippet: <|code_start|> token string; a 2-tuple (srow, scol) of ints specifying the row and column where the token begins in the source; a 2-tuple (erow, ecol) of ints specifying the row and column where the token ends in the source; and the line on which the token was foun...
raise TokenError(
Given the code snippet: <|code_start|> altcolumn = (altcolumn/alttabsize + 1)*alttabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '...
raise TokenIndentationError(err, line, lnum, 0, token_list)
Given snippet: <|code_start|> continue else: contstr = contstr + line contline = contline + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 altcolumn...
raise TabError(lnum, pos, line)
Predict the next line after this snippet: <|code_start|> pos = end = endmatch tok = (tokens.STRING, contstr + line[:end], strstart[0], strstart[1], line) token_list.append(tok) last_comment = '' contstr, needcont = '',...
column = (column/tabsize + 1)*tabsize
Given the following code snippet before the placeholder: <|code_start|> tok = (tokens.STRING, contstr + line[:end], strstart[0], strstart[1], line) token_list.append(tok) last_comment = '' contstr, needcont = '', 0 con...
altcolumn = (altcolumn/alttabsize + 1)*alttabsize
Next line prediction: <|code_start|> indents.append(column) altindents.append(altcolumn) token_list.append((tokens.INDENT, line[:pos], lnum, 0, line)) last_comment = '' else: while column < indents[-1]: indent...
start = whiteSpaceDFA.recognize(line, pos)
Predict the next line after this snippet: <|code_start|> continued = 0 while pos < max: pseudomatch = pseudoDFA.recognize(line, pos) if pseudomatch >= 0: # scan for tokens # JDR: Modified start = whiteSpaceDFA.recogni...
elif token in triple_quoted:
Given snippet: <|code_start|> while pos < max: pseudomatch = pseudoDFA.recognize(line, pos) if pseudomatch >= 0: # scan for tokens # JDR: Modified start = whiteSpaceDFA.recognize(line, pos) if start < 0: ...
endDFA = endDFAs[token]
Given the code snippet: <|code_start|> pos = end token, initial = line[start:end], line[start] if (initial in numchars or \ (initial == '.' and token != '.' and token != '...')): # ordinary number token_list.appen...
elif initial in single_quoted or \
Next line prediction: <|code_start|> elif column > indents[-1]: # count indents or dedents if altcolumn <= altindents[-1]: raise TabError(lnum, pos, line) indents.append(column) altindents.append(altcolumn) token_li...
pseudomatch = pseudoDFA.recognize(line, pos)
Predict the next line for this snippet: <|code_start|> continued = 1 else: if initial in '([{': if parenlev == 0: parenlevstart = (lnum, start, line) parenlev = parenlev + 1 ...
if not (flags & consts.PyCF_DONT_IMPLY_DEDENT):
Given the following code snippet before the placeholder: <|code_start|> self.doTest('testZEmptyString.ay', True) def testZNone(self): self.doTest('testZNone.ay', True) def testZString(self): self.doTest('testZString.ay', False) def testZInt(self): self.doTest('testZInt.ay',...
self.assertRaises (CommandNotFound, self.doTest,
Next line prediction: <|code_start|> node = ast.Str if is_unicode else ast.Bytes new_node = node(w_string) new_node.lineno = atom_node.lineno new_node.col_offset = atom_node.col_offset joined_pieces.append(new_node) def f_constant_string(astbuilder, joined_pieces, u, atom_node): add_constant_st...
consts.PyCF_SOURCE_IS_UTF8 |
Using the snippet: <|code_start|> import. * hidden_applevel: Will this code unit and sub units be hidden at the applevel? * optimize: optimization level: -1 = same as interpreter, 0 = no optmiziation, 1 = remove asserts, 2 = remove docstrings. """ def __ini...
def __init__(self, space, future_flags=future.futureFlags_3_5,
Based on the snippet: <|code_start|> * encoding: The source encoding. * last_future_import: The line number and offset of the last __future__ import. * hidden_applevel: Will this code unit and sub units be hidden at the applevel? * optimize: optimization level: -1 = same as interprete...
class PythonParser(parser.Parser):
Using the snippet: <|code_start|> return 'utf-8' for variant in ['latin-1', 'iso-latin-1', 'iso-8859-1']: if (encoding == variant or encoding.startswith(variant + '-')): return 'iso-8859-1' return encoding def _check_for_encoding(b): """You can use a different encodin...
return pytokenizer.match_encoding_declaration(line[i:]), True
Next line prediction: <|code_start|> """Stores information about the source being compiled. * filename: The filename of the source. * mode: The parse mode to use. ('exec', 'eval', or 'single') * flags: Parser and compiler flags. * encoding: The source encoding. * last_future_import: The line num...
'eval' : pygram.syms.eval_input,
Given the code snippet: <|code_start|>'exec' : pygram.syms.file_input, } class PythonParser(parser.Parser): def __init__(self, space, future_flags=future.futureFlags_3_5, grammar=pygram.python_grammar): parser.Parser.__init__(self, grammar) self.space = space self.future_f...
raise error.SyntaxError("UTF-8 BOM with %s coding cookie" % decl_enc,
Predict the next line for this snippet: <|code_start|> self.mode = mode self.encoding = None self.flags = flags self.optimize = optimize self.last_future_import = future_pos self.hidden_applevel = hidden_applevel _targets = { 'eval' : pygram.syms.eval_input, 'single' : p...
if compile_info.flags & consts.PyCF_SOURCE_IS_UTF8:
Here is a snippet: <|code_start|> register = template.Library() @register.simple_tag def bounty_total(): <|code_end|> . Write the next line using the current file imports: from django import template from website.models import Payment from django.db.models import Sum and context from other files: # Path: website/m...
_total = Payment.objects.aggregate(Sum('amount'))['amount__sum']
Given the following code snippet before the placeholder: <|code_start|> if not getattr(self.generator, 'doxy_tar', None): self.generator.add_install_files(install_to=self.generator.install_path, install_from=self.outputs, postpone=False, cwd=self.output_dir, relative_trick=True) class tar(Tas...
@feature('doxygen')
Next line prediction: <|code_start|> ltask = self.generator.link_task except AttributeError: pass else: ltask.set_run_after(c_tsk) # setting input nodes does not declare the build order # because the build already started, but it sets # the dependency to enable rebuilds ltask.inputs.append(c_tsk.outputs[...
@extension(*SWIG_EXTS)
Given the code snippet: <|code_start|> node = tsk.inputs[0].parent if tsk.outdir: node = tsk.outdir tsk.set_outputs(node.find_or_declare(tsk.module+'.py')) @swigf def swig_ocaml(tsk): node = tsk.inputs[0].parent if tsk.outdir: node = tsk.outdir tsk.set_outputs(node.find_or_declare(tsk.module+'.ml')) tsk.set_...
@feature('c', 'cxx', 'd', 'fc', 'asm')
Based on the snippet: <|code_start|> if tsk.outdir: node = tsk.outdir tsk.set_outputs(node.find_or_declare(tsk.module+'.py')) @swigf def swig_ocaml(tsk): node = tsk.inputs[0].parent if tsk.outdir: node = tsk.outdir tsk.set_outputs(node.find_or_declare(tsk.module+'.ml')) tsk.set_outputs(node.find_or_declare(ts...
@after_method('apply_link', 'process_source')
Here is a snippet: <|code_start|> @extension(*SWIG_EXTS) def i_file(self, node): # the task instance tsk = self.create_task('swig') tsk.set_inputs(node) tsk.module = getattr(self, 'swig_module', None) flags = self.to_list(getattr(self, 'swig_flags', [])) tsk.env.append_value('SWIGFLAGS', flags) tsk.outdir = No...
@conf
Using the snippet: <|code_start|> # call funs in the dict swig_langs for x in self.env['SWIGFLAGS']: # obtain the language x = x[1:] try: fun = swig_langs[x] except KeyError: pass else: fun(self) return super(swig, self).runnable_status() def scan(self): "scan for swig dep...
code = c_preproc.re_nl.sub('', code)
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python # encoding: utf-8 # DragoonX6 2018 """ Common routines for cross_clang.py and cross_clangxx.py """ def normalize_target_triple(target_triple): target_triple = target_triple[:-1] normalized_triple = target_triple.replace('-...
@conf
Predict the next line after this snippet: <|code_start|> """ This tool supports the export_symbols_regex to export the symbols in a shared library. by default, all symbols are exported by gcc, and nothing by msvc. to use the tool, do something like: def build(ctx): ctx(features='c cshlib syms', source='a.c b.c', expo...
syms = [m.group('symbol') for m in re_nm.finditer(self.generator.bld.cmd_and_log(cmd, quiet=STDOUT, **kw))]
Based on the snippet: <|code_start|> cmd = (self.env.DUMPBIN or ['dumpbin']) + ['/symbols', obj.abspath()] else: if self.env.DEST_BINFMT == 'pe': #gcc uses nm, and has a preceding _ on windows re_nm = re.compile(r'(T|D)\s+_(?P<symbol>%s)\b' % reg) elif self.env.DEST_BINFMT=='mac-o': re_nm=re.compile(r...
@feature('syms')
Next line prediction: <|code_start|> else: if self.env.DEST_BINFMT == 'pe': #gcc uses nm, and has a preceding _ on windows re_nm = re.compile(r'(T|D)\s+_(?P<symbol>%s)\b' % reg) elif self.env.DEST_BINFMT=='mac-o': re_nm=re.compile(r'(T|D)\s+(?P<symbol>_?(%s))\b' % reg) else: re_nm = re.compile(r'(...
@after_method('process_source', 'process_use', 'apply_link', 'process_uselib_local', 'propagate_uselib_vars')
Based on the snippet: <|code_start|> INST = ''' import sys, py_compile py_compile.compile(sys.argv[1], sys.argv[2], sys.argv[3], True) ''' """ Piece of Python code used in :py:class:`waflib.Tools.python.pyo` and :py:class:`waflib.Tools.python.pyc` for byte-compiling python files """ DISTUTILS_IMP = ['from distutils.sy...
@extension('.py')
Continue the code snippet: <|code_start|>#ifdef __cplusplus extern "C" { #endif void Py_Initialize(void); void Py_Finalize(void); #ifdef __cplusplus } #endif int main(int argc, char **argv) { (void)argc; (void)argv; Py_Initialize(); Py_Finalize(); return 0; } ''' """ Piece of C/C++ code used in :py:func:`...
@before_method('process_source')
Given snippet: <|code_start|> self.add_install_files(install_to=os.path.dirname(pyd), install_from=pyobj, cwd=node.parent.get_bld(), relative_trick=relative_trick) class pyc(Task.Task): """ Byte-compiling python files """ color = 'PINK' def __str__(self): node = self.outputs[0] return node.path_from(node.ct...
@after_method('apply_bundle')
Given the following code snippet before the placeholder: <|code_start|>extern "C" { #endif void Py_Initialize(void); void Py_Finalize(void); #ifdef __cplusplus } #endif int main(int argc, char **argv) { (void)argc; (void)argv; Py_Initialize(); Py_Finalize(); return 0; } ''' """ Piece of C/C++ code used in...
@feature('py')
Given snippet: <|code_start|> self.uselib = self.to_list(getattr(self, 'uselib', [])) if not 'PYEXT' in self.uselib: self.uselib.append('PYEXT') # override shlib_PATTERN set by the osx module self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.macbundle_PATTERN = self.env.pyext_PATTERN self.env.fcshlib...
@conf
Here is a snippet: <|code_start|>#! /usr/bin/env python # encoding: utf-8 # Calle Rosenquist, 2017 (xbreak) """ Create task that copies source files to the associated build node. This is useful to e.g. construct a complete Python package so it can be unit tested without installation. Source files to be copied can be s...
@TaskGen.before_method('process_source')
Given snippet: <|code_start|> v.CFLAGS_CRT_MULTITHREADED_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DBG = ['/MTd'] v.CFLAGS_CRT_MULTITHREADED_DLL_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DLL_DBG = ['/MDd'] v.LIB_ST = '%s.lib' v.LIBPATH_ST = '/LIBPATH:%s' v.STLIB_ST = '%s.lib' v.STLIBPATH_ST ...
@after_method('apply_link')
Given snippet: <|code_start|> v.CFLAGS_CRT_MULTITHREADED_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DBG = ['/MTd'] v.CFLAGS_CRT_MULTITHREADED_DLL_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DLL_DBG = ['/MDd'] v.LIB_ST = '%s.lib' v.LIBPATH_ST = '/LIBPATH:%s' v.STLIB_ST = '%s.lib' v.STLIBPATH_ST ...
@feature('c', 'cxx')
Predict the next line for this snippet: <|code_start|> v.CFLAGS_cshlib = [] v.CXXFLAGS_cxxshlib = [] v.LINKFLAGS_cshlib = v.LINKFLAGS_cxxshlib = ['/DLL'] v.cshlib_PATTERN = v.cxxshlib_PATTERN = '%s.dll' v.implib_PATTERN = '%s.lib' v.IMPLIB_ST = '/IMPLIB:%s' v.LINKFLAGS_cstlib = [] v.cstlib_P...
is_static = isinstance(self.link_task, ccroot.stlink_task)
Next line prediction: <|code_start|>(with extension _run.py) that are useful for debugging purposes. """ testlock = Utils.threading.Lock() SCRIPT_TEMPLATE = """#! %(python)s import subprocess, sys cmd = %(cmd)r # if you want to debug with gdb: #cmd = ['gdb', '-args'] + cmd env = %(env)r status = subprocess.call(cmd, ...
@feature('test_scripts')
Predict the next line for this snippet: <|code_start|> """Create interpreted unit tests.""" for x in ['test_scripts_source', 'test_scripts_template']: if not hasattr(self, x): Logs.warn('a test_scripts taskgen i missing %s' % x) return self.ut_run, lst = Task.compile_fun(self.test_scripts_template, shell=get...
@after_method('apply_link', 'process_use')
Given snippet: <|code_start|> bld.program(features='test', source='main2.cpp', target='app2') When the build is executed, the program 'test' will be built and executed without arguments. The success/failure is detected by looking at the return code. The status and the standard output/error are stored on the build con...
@taskgen_method
Predict the next line for this snippet: <|code_start|> paths = getattr(self, 'test_scripts_paths', {}) for (k,v) in paths.items(): p = self.ut_env.get(k, '').split(os.pathsep) if isinstance(v, str): v = v.split(os.pathsep) self.ut_env[k] = os.pathsep.join(p + v) @feature('test') @after_method('apply_link', ...
if not isinstance(y, ccroot.stlink_task):
Predict the next line after this snippet: <|code_start|> if 'd' in exts: feats.append('d') if 'java' in exts: feats.append('java') return 'java' if typ in ('program', 'shlib', 'stlib'): will_link = False for x in feats: if x in ('cxx', 'd', 'fc', 'c', 'asm'): feats.append(x + typ) will_link = T...
@conf
Predict the next line after this snippet: <|code_start|>#! /usr/bin/env python # encoding: utf-8 # DC 2008 # Thomas Nagy 2016-2018 (ita) """ Fortran support """ ccroot.USELIB_VARS['fc'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES', 'FCPPFLAGS']) ccroot.USELIB_VARS['fcprogram_test'] = ccroot.USELIB_VARS['fcprogram'] = set...
@extension('.f','.F','.f90','.F90','.for','.FOR','.f95','.F95','.f03','.F03','.f08','.F08')
Given snippet: <|code_start|>#! /usr/bin/env python # encoding: utf-8 # DC 2008 # Thomas Nagy 2016-2018 (ita) """ Fortran support """ ccroot.USELIB_VARS['fc'] = set(['FCFLAGS', 'DEFINES', 'INCLUDES', 'FCPPFLAGS']) ccroot.USELIB_VARS['fcprogram_test'] = ccroot.USELIB_VARS['fcprogram'] = set(['LIB', 'STLIB', 'LIBPATH'...
@conf
Given the following code snippet before the placeholder: <|code_start|> If yours has a different name, please report to hmgaudecker [at] gmail\n Else:\n Do not load the 'run_r_script' tool in the main wscript.\n\n""" % R_COMMANDS) ctx.env.RFLAGS = 'CMD BATCH --slave' class run_r_script_base(Task.Task): """Run a...
@TaskGen.feature('run_r_script')
Predict the next line for this snippet: <|code_start|>testEXPORT int lib_func(void); int main(int argc, char **argv) { (void)argc; (void)argv; return !(lib_func() == 9); } ''' @feature('link_lib_test') @before_method('process_source') def link_lib_test_fun(self): """ The configuration test :py:func:`waflib.Configu...
@conf
Using the snippet: <|code_start|># encoding: utf-8 # Thomas Nagy, 2016-2018 (ita) """ Various configuration tests. """ LIB_CODE = ''' #ifdef _MSC_VER #define testEXPORT __declspec(dllexport) #else #define testEXPORT #endif testEXPORT int lib_func(void) { return 9; } ''' MAIN_CODE = ''' #ifdef _MSC_VER #define testE...
@feature('link_lib_test')
Given the code snippet: <|code_start|># Thomas Nagy, 2016-2018 (ita) """ Various configuration tests. """ LIB_CODE = ''' #ifdef _MSC_VER #define testEXPORT __declspec(dllexport) #else #define testEXPORT #endif testEXPORT int lib_func(void) { return 9; } ''' MAIN_CODE = ''' #ifdef _MSC_VER #define testEXPORT __decls...
@before_method('process_source')
Here is a snippet: <|code_start|> ENDIAN_FRAGMENT = ''' short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x859...
@after_method('process_source')
Here is a snippet: <|code_start|>#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy 2009-2018 (ita) # DragoonX6 2018 """ Detect the Clang++ C++ compiler This version is an attempt at supporting the -target and -sysroot flag of Clang++. """ def options(opt): """ Target triplet for clang++:: $ waf configure --...
@conf
Based on the snippet: <|code_start|>#!/usr/bin/env python # encoding: utf-8 # Brant Young, 2007 "Process *.rc* files for C/C++: X{.rc -> [.res|.rc.o]}" @extension('.rc') def rc_file(self, node): """ Binds the .rc extension to a winrc task """ obj_ext = '.rc.o' if self.env.WINRC_TGT_F == '/fo': obj_ext = '.res...
class rc_parser(c_preproc.c_parser):
Next line prediction: <|code_start|>"""Support for Sphinx documentation This is a wrapper for sphinx-build program. Please note that sphinx-build supports only one output format which can passed to build via sphinx_output_format attribute. The default output format is html. Example wscript: def configure(cnf): c...
@feature('sphinx')
Given the code snippet: <|code_start|>#!/usr/bin/python # Grygoriy Fuchedzhy 2010 """ Support for converting linked targets to ihex, srec or binary files using objcopy. Use the 'objcopy' feature in conjunction with the 'cc' or 'cxx' feature. The 'objcopy' feature uses the following attributes: objcopy_bfdname Target...
@feature('objcopy')
Using the snippet: <|code_start|>#!/usr/bin/python # Grygoriy Fuchedzhy 2010 """ Support for converting linked targets to ihex, srec or binary files using objcopy. Use the 'objcopy' feature in conjunction with the 'cc' or 'cxx' feature. The 'objcopy' feature uses the following attributes: objcopy_bfdname Target obje...
@after_method('apply_link')
Predict the next line after this snippet: <|code_start|># flake8: noqa # ensure that the containing module is on sys.path # this is a hack for using alembic in our built virtualenv. mod_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..") if mod_dir not in sys.path: sys.path.append(mod_dir) # ...
ini_file = find_config_file(config.get_main_option("token_ini"))
Here is a snippet: <|code_start|># This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. """ Table schema for Sqlite """ __all__ = (get_cls,) class _SQLITENodesBase(_No...
class _SQLITEUsersBase(_UsersBase):
Based on the snippet: <|code_start|> Table schema for Sqlite """ __all__ = (get_cls,) class _SQLITENodesBase(_NodesBase): id = Column(Integer, primary_key=True) @declared_attr def __table_args__(cls): return () _add('nodes', _SQLITENodesBase) class _SQLITEUsersBase(_UsersBase): uid ...
class _SQLITESettingsBase(_SettingsBase):
Continue the code snippet: <|code_start|># This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. """ Table schema for Sqlite """ __all__ = (get_cls,) class _SQLITENodes...
id = Column(Integer, primary_key=True)
Based on the snippet: <|code_start|># This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. """ Table schema for Sqlite """ __all__ = (get_cls,) class _SQLITENodesBase(...
id = Column(Integer, primary_key=True)
Given snippet: <|code_start|>""" __all__ = (get_cls,) class _SQLITENodesBase(_NodesBase): id = Column(Integer, primary_key=True) @declared_attr def __table_args__(cls): return () _add('nodes', _SQLITENodesBase) class _SQLITEUsersBase(_UsersBase): uid = Column(Integer, primary_key=True)...
setting = Column(String(100), primary_key=True)
Given snippet: <|code_start|># This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. """ Table schema for Sqlite """ __all__ = (get_cls,) class _SQLITENodesBase(_NodesB...
_add('nodes', _SQLITENodesBase)
Using the snippet: <|code_start|># This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. """ Table schema for Sqlite """ __all__ = (get_cls,) class _SQLITENodesBase(_No...
@declared_attr
Given the following code snippet before the placeholder: <|code_start|># flake8: noqa # -*- coding: utf8 -*- # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. """ Runs the...
ini_file = find_config_file()
Continue the code snippet: <|code_start|> class mockobj(object): pass class TestLocalBrowserIdVerifier(unittest.TestCase): DEFAULT_SETTINGS = { # noqa; identation below is non-standard "tokenserver.backend": "tokenserver.assignment.memorynode.MemoryNodeAssignmentBackend", "brows...
self.assertTrue(isinstance(verifier, LocalBrowserIdVerifier))
Using the snippet: <|code_start|> class mockobj(object): pass class TestLocalBrowserIdVerifier(unittest.TestCase): DEFAULT_SETTINGS = { # noqa; identation below is non-standard "tokenserver.backend": "tokenserver.assignment.memorynode.MemoryNodeAssignmentBackend", "browserid.ba...
verifier = config.registry.getUtility(IBrowserIdVerifier)
Given the following code snippet before the placeholder: <|code_start|> } def _make_config(self, settings={}): all_settings = self.DEFAULT_SETTINGS.copy() all_settings.update(settings) config = Configurator(settings=all_settings) config.include("tokenserver") config.commi...
self.assertTrue(isinstance(verifier, RemoteBrowserIdVerifier))
Based on the snippet: <|code_start|> "tokenserver.verifiers.RemoteBrowserIdVerifier", } def _make_config(self, settings={}): all_settings = self.DEFAULT_SETTINGS.copy() all_settings.update(settings) config = Configurator(settings=all_settings) config.include("tokenser...
verifier = config.registry.getUtility(IBrowserIdVerifier)
Using the snippet: <|code_start|> "mozsvc.secrets.FixedSecrets", "tokenserver.secrets.secrets": "steve-let-the-dogs-out", } def _make_config(self, settings={}): all_settings = self.DEFAULT_SETTINGS.copy() all_settings.update(settings) config = Configurator...
verifier = config.registry.getUtility(IOAuthVerifier)
Predict the next line after this snippet: <|code_start|> responses.add( responses.GET, "https://oauth-server.my-self-hosted-setup.com/config", json={ "browserid": { "oh no": "the issuer is not configured here" }, ...
with self.assertRaises(ConnectionError):
Next line prediction: <|code_start|> "tokenserver.secrets.secrets": "steve-let-the-dogs-out", } def _make_config(self, settings={}): all_settings = self.DEFAULT_SETTINGS.copy() all_settings.update(settings) config = Configurator(settings=all_settings) config.i...
self.assertTrue(isinstance(verifier, RemoteOAuthVerifier))
Predict the next line for this snippet: <|code_start|> requests and does some basic sanity-checking on the results. """ server_url = 'https://token.stage.mozaws.net' def setUp(self): self.endpoint = urlparse.urljoin(self.server_url, '/1.0/sync/1.5') self.audience = self.server_url.rstri...
if server_config['oauth']['scope'] != DEFAULT_OAUTH_SCOPE:
Given snippet: <|code_start|># Copyright 2016 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
conf.register_opt(sahara_config.service_option,
Here is a snippet: <|code_start|> class FakeResponse(object): def __init__(self, set_id=None, set_status=None, status_description=None, node_groups=None, url=None, job_id=None, name=None, job_type=None, verification=None): self.id = set_id self.status = set_status ...
self.base_scenario = base.BaseTestCase()
Predict the next line for this snippet: <|code_start|> "source": "sahara_tests/scenario/defaults/" "edp-examples/edp-pig/" "top-todoers/data/input" }, "output_datasource...
timeouts.Defaults.init_defaults(self.base_scenario.testcase)