Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|> # show depots in organization class DepotInline(admin.TabularInline): model = Depot extra = 0 can_delete = False show_change_link = True <|code_end|> . Use current file imports: from depot.models import Depot, Organization from django.contrib import admin and...
fields = ('name', 'description', 'active')
Using the snippet: <|code_start|> def increase_header_level(elem, doc): if type(elem)==Header: if elem.level < 6: elem.level += 1 else: return [] <|code_end|> , determine the next line of code. You have imports: from panflute import run_filter, Header and context (class ...
def main(doc=None):
Given the following code snippet before the placeholder: <|code_start|> def increase_header_level(elem, doc): if type(elem)==Header: if elem.level < 6: <|code_end|> , predict the next line using imports from the current file: from panflute import run_filter, Header and context including class names, func...
elem.level += 1
Next line prediction: <|code_start|> def myChordFunctionAirliner(Epsilon): """User-defined function describing the variation of chord as a function of the leading edge coordinate""" ChordLengths = np.array([0.5, 0.3792, 0.2867, 0.232, 0.1763, 0.1393, 0.1155, 0.093, 0.0713, 0.055...
return np.interp(Epsilon, EpsArray, SweepAngles)
Given the following code snippet before the placeholder: <|code_start|># (planform similar to that of the Boeing 787 family) # ============================================================================== def myDihedralFunctionAirliner(Epsilon): """User-defined function describing the variation of dihedral as a ...
EpsArray = np.linspace(0, 1, 11)
Next line prediction: <|code_start|># -*- coding: utf-8 -*- # @Author: p-chambers # @Date: 2016-07-26 17:37:52 # @Last Modified by: p-chambers # @Last Modified time: 2016-10-03 12:21:03 def SimpleDihedralFunction(Epsilon): """User-defined function describing the variation of dihedral as a function of the ...
def SimpleChordFunction(Epsilon):
Next line prediction: <|code_start|> Rotation=DihedralFunct(Epsilon), Twist=TwistFunct(Epsilon), Naca4Profile='0012') return Af def SimpleSweepFunction(Epsilon): """User-defined function describing the variation of sweep angle ...
SimpleDihedralFunction,
Predict the next line after this snippet: <|code_start|> """User-defined function describing the variation of the fin sweep angle as a function of the leading edge coordinate""" # Data for SweepAngles is included in the airconics distribution: # load using pkg_resources rawdata = resource_string(__n...
return np.interp(Epsilon, EpsArray, ChordLengths)
Given the code snippet: <|code_start|> # A deliberate copy of GitAdapter's error message: ERR_MSG = "fatal: Not a hg repository (or any of the parent directories): .hg" def get_hlib_client_and_path(): try: client = hglib.open() repopath = client.root() return client, repopath except...
if status == 'M' and path not in unmerged:
Given snippet: <|code_start|> ) output_array = [line.split() for line in output.splitlines()] if not output_array: return [] if len(output_array) % 3 != 0: # TODO should be something else sys.stderr.write( "Can't find the conflicting notebook. Qu...
)
Continue the code snippet: <|code_start|> # ignore unmerged files, get unique names fnames = list(set(fnames) - set(unmerged_array_names)) git_root_path = subprocess.check_output( "git rev-parse --show-toplevel".split() ).splitlines()[0] nb_diff = [] for name...
output_array = [line.split() for line in output.splitlines()]
Given the following code snippet before the placeholder: <|code_start|> def test_home(): client = app.test_client() result = client.get('/1') assert result.status_code == 200 def test_notebookjson(): client = app.test_client() app.add_notebook({'metadata': {}}, 'foo.ipynb') result = client.ge...
result = client.put('/notebooks/test_notebook0', contents)
Given snippet: <|code_start|> file = open(path, 'w') file.write("modified") file.close() self.assertEqual(d.read('first/second/1.ipynb'), 'modified') os.chdir(os.path.join(d.path, 'first')) os.remove(path) adapter = HgAdapter() result = adapter.get_modifie...
self.assertTrue(len(result) == 1)
Continue the code snippet: <|code_start|> assert isinstance( rs.get_class(classname).newInstance(), ducmd.DiffURLCommand ) def test_process(self): ducmd.redirect = mock_redirect ducmd.render_template = mock_render_template mainurl = "https://raw.github...
mcmd.render_template = mock_render_template
Continue the code snippet: <|code_start|> elif args.model == 'ssadgm': X_train_lbl, y_train_lbl, X_train_unl, y_train_unl \ = data.split_semisup(X_train, y_train, n_lbl=args.n_labeled) model = models.SSADGM(X_labeled=X_train_lbl, y_labeled=y_train_lbl, n_out=n_out, n_superbatch=...
curves2 = []
Predict the next line for this snippet: <|code_start|> elif args.model == 'resnet': model = models.Resnet(n_dim=n_dim, n_out=n_out, n_chan=n_channels, n_superbatch=args.n_superbatch, opt_alg=args.alg, opt_params=p) elif args.model == 'vae': model = models.VAE(n_dim=n_dim, n_out=...
model = models.DADGM(n_dim=n_dim, n_out=n_out, n_chan=n_channels,
Based on the snippet: <|code_start|> choices=['two', 'many', 'one-vs-many', 'many-vs-many']) plot_parser.add_argument('--out', required=True) plot_parser.add_argument('--double', nargs='+', default=[0], type=int) plot_parser.add_argument('--col', type=int, default=2) plot_parser.add_ar...
n_dim, n_out, n_channels = 8, 10, 1
Given snippet: <|code_start|> limit = list(range(10)) stop = list(range(3,7)) target = list(range(10, 20)) sets = itertools.product(limit, stop, target) sets = list(sets) N = len(sets) ind = pd.date_range(start="2000-01-01", freq="D", periods=N) class TestMultiIndexGetter(TestCase): def __init__(self, *args, ...
def test_multiindexgetter(self):
Here is a snippet: <|code_start|> limit = list(range(10)) stop = list(range(3,7)) target = list(range(10, 20)) sets = itertools.product(limit, stop, target) sets = list(sets) N = len(sets) ind = pd.date_range(start="2000-01-01", freq="D", periods=N) class TestMultiIndexGetter(TestCase): <|code_end|> . Write the ...
def __init__(self, *args, **kwargs):
Based on the snippet: <|code_start|> td = TemporaryDirectory() class TestClass(object): def __init__(self): self.count = 0 @cacher(td.name + '/test/test_meth', method=True) def test_meth(self): self.count += 1 return self.count def test_meth2(self): self.count += 1 ...
pass
Predict the next line after this snippet: <|code_start|># !/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): t1 = TextField() t1.x = t1.y = 50 t1.size = 30 t1.text = "Hello World!" addChild(t1) t2 = TextField() t2.x = 50 t2.y = 150 <|code_end|> using the current file's imports: from pylash.core impo...
t2.text = "Hello Pylash~"
Given the code snippet: <|code_start|># !/usr/bin/env python3 # -*- coding: utf-8 -*- def main(): t1 = TextField() t1.x = t1.y = 50 t1.size = 30 t1.text = "Hello World!" addChild(t1) t2 = TextField() t2.x = 50 t2.y = 150 t2.text = "Hello Pylash~" t2.rotation = 30 t2.size = 50 <|code_end|> , generate the n...
t2.textColor = "#FF4500"
Predict the next line for this snippet: <|code_start|> self._onComplete = None def load(self, loadList, onUpdate = None, onComplete = None): self._loadNum = len(loadList) self._onUpdate = onUpdate self._onComplete = onComplete for o in loadList: path = None fileType = None if "path" in o: path...
loader = ImageLoader()
Predict the next line for this snippet: <|code_start|> e = Event(LoaderEvent.COMPLETE) e.target = self.content self.dispatchEvent(e) def _onError(self, err): e = Event(LoaderEvent.ERROR) e.target = Exception("MediaLoader: cannot load file in the given path (%s)." % self.content.errorString()) self.d...
self._loadIndex = 0
Predict the next line for this snippet: <|code_start|> class LoaderEvent(object): COMPLETE = Event("loader_complete") ERROR = Event("loader_error") def __init__(self): raise Exception("LoaderEvent cannot be instantiated.") class Loader(EventDispatcher): def __init__(self): super(Loader, self).__init__() ...
def doLoad(self):
Given snippet: <|code_start|> e.target = self.content self.dispatchEvent(e) def _onError(self, err): e = Event(LoaderEvent.ERROR) e.target = Exception("MediaLoader: cannot load file in the given path (%s)." % self.content.errorString()) self.dispatchEvent(e) def load(self, path): fullpath = QtCore.QDir...
self._onUpdate = None
Based on the snippet: <|code_start|> def skew(self, kx, ky): mtx = Matrix(1, ky, kx, 1, 0, 0, 0, 0, 1) self.add(mtx) return self def add(self, mtx): a = self.a * mtx.a + self.b * mtx.c + self.u * mtx.tx b = self.a * mtx.b + self.b * mtx.d + self.u * mtx.ty u = self.a * mtx.u + self.b * mtx.v + self.u * m...
c = self.c * mtx.a + self.d * mtx.c + self.v * mtx.tx
Next line prediction: <|code_start|> if (t / 2) < 1: return c / 2 * math.pow(2, 10 * (t - 1)) + b t -= 1 return c / 2 * (-math.pow(2, -10 * t) + 2) + b class Circ(object): def __init__(self): raise Exception("Circ cannot be instantiated.") def easeIn(t, b, c, d): t /= d return -c * (math.sqrt(1 ...
return c / 2 * (math.sqrt(1 - t * t) + 1) + b
Predict the next line for this snippet: <|code_start|> def easeOut(t, b, c, d, s = None): if not s: s = 1.70158 t = t / d - 1 return c * (t * t * ((s + 1) * t + s) + 1) + b def easeInOut(t, b, c, d, s = None): if not s: s = 1.70158 t /= d if (t / 2) < 1: s *= 1.525 return c / 2 * (t * ...
def easeIn(t, b, c, d):
Given the following code snippet before the placeholder: <|code_start|>setattr(Easing, "Strong", Strong) setattr(Easing, "Expo", Expo) setattr(Easing, "Circ", Circ) setattr(Easing, "Elastic", Elastic) setattr(Easing, "Back", Back) setattr(Easing, "Bounce", Bounce) class TweenLiteChild(Object): def __init__(self, tar...
self.__duration *= 1000
Using the snippet: <|code_start|> self.copyFrom(e) elif isinstance(e, str): self.eventType = e self.currentTarget = None self.target = None else: raise TypeError("Event.__init__(e): parameter 'e' is either a str or an Event object.") class LoopEvent(object): ENTER_FRAME = Event("loop_enter_frame") ...
def __init__(self):
Given snippet: <|code_start|> MOUSE_DOWN = Event("mouse_down") MOUSE_UP = Event("mouse_up") MOUSE_MOVE = Event("mouse_move") MOUSE_OVER = Event("mouse_over") MOUSE_OUT = Event("mouse_out") DOUBLE_CLICK = Event("mouse_dbclick") def __init__(self): raise Exception("MouseEvent cannot be instantiated.") class Ke...
def _addEventListenerInList(self, e, listener, eventList):
Predict the next line for this snippet: <|code_start|> COPULA = "SAME AS" # the textual value of a copula node PROP = "PROP" # the textual value of a property node RCMOD_PROP = "PROP" # the textual value of a property for rcmod node POSSESSIVE = "POSSESS" # the textual value of a possessive nod...
("Modifier",lambda t:"modifer: "+t)]
Given the code snippet: <|code_start|> COPULA = "SAME AS" # the textual value of a copula node PROP = "PROP" # the textual value of a property node RCMOD_PROP = "PROP" # the textual value of a property for rcmod node POSSESSIVE = "POSSESS" # the textual value of a possessive node APPOSITION = ...
LOCATION = "LOCATION" # the textual value of a location node
Given the following code snippet before the placeholder: <|code_start|>POSSESSIVE = "POSSESS" # the textual value of a possessive node APPOSITION = "appos" # the textual value of an appositio n node PREP = "PREP" # the textual value of a preposition node PREP_TYPE = "TYPE" # the textual value of a pre...
class Node:
Predict the next line for this snippet: <|code_start|> COPULA = "SAME AS" # the textual value of a copula node PROP = "PROP" # the textual value of a property node RCMOD_PROP = "PROP" # the textual value of a property for rcmod node POSSESSIVE = "POSSESS" # the textual value of a possessive nod...
("Time Value",lambda t:"date: "+t),
Given snippet: <|code_start|> COPULA = "SAME AS" # the textual value of a copula node PROP = "PROP" # the textual value of a property node RCMOD_PROP = "PROP" # the textual value of a property for rcmod node POSSESSIVE = "POSSESS" # the textual value of a possessive node APPOSITION = "appos" ...
("Time Value",lambda t:"date: "+t),
Given snippet: <|code_start|> COPULA = "SameAs" # the textual value of a copula node PROP = "PROP" # the textual value of a property node RCMOD_PROP = "PROP" # the textual value of a property for rcmod node POSSESSIVE = "have" # the textual value of a possessive node APPOSITION = "appos" # t...
RECT_NODE_SHAPE = "rect"
Continue the code snippet: <|code_start|>POSSESSIVE = "have" # the textual value of a possessive node APPOSITION = "appos" # the textual value of an appositio n node PREP = "PREP" # the textual value of a preposition node PREP_TYPE = "TYPE" # the textual value of a preposition node's type COND = "CON...
nodeCounter = 0
Given the code snippet: <|code_start|>COND = "COND" # the textual value of a conditional node TIME = "TIME" # the textual value of a time node LOCATION = "LOCATION" # the textual value of a location node CONJUNCTION = "CONJ -" # the textual value of a conjunction node ADVERB = "ADV" # the...
class Node:
Given the following code snippet before the placeholder: <|code_start|> COPULA = "SameAs" # the textual value of a copula node PROP = "PROP" # the textual value of a property node RCMOD_PROP = "PROP" # the textual value of a property for rcmod node POSSESSIVE = "have" # the textual value of a p...
PREP = "PREP" # the textual value of a preposition node
Here is a snippet: <|code_start|> self.outputType = outputType for ent in self.args: (rel,arg) = ent if rel == POSSESSOR_LABEL: ent[1] = fixPossessor(arg) def find_ent(self,ent): ret = [] for i,(rel,arg) in enumerate(self.args): ...
HTML = (self.outputType == "html")
Continue the code snippet: <|code_start|> self.outputType = outputType for ent in self.args: (rel,arg) = ent if rel == POSSESSOR_LABEL: ent[1] = fixPossessor(arg) def find_ent(self,ent): ret = [] for i,(rel,arg) in enumerate(self.ar...
HTML = (self.outputType == "html")
Here is a snippet: <|code_start|> return 1 if rel in object_dependencies: return 2 if rel.startswith("prep"): return 3 if rel == SOURCE_LABEL: return 5 else: return 4 def __str__(self): PDF = (self...
"their":"they"}
Given snippet: <|code_start|> return 0 if rel == ARG_LABEL: return 1 if rel in object_dependencies: return 2 if rel.startswith("prep"): return 3 if rel == SOURCE_LABEL: return 5 else: return 4 ...
"his":"he",
Predict the next line after this snippet: <|code_start|>class Proposition: def __init__(self,pred,args,outputType): self.pred = pred self.args = args self.outputType = outputType for ent in self.args: (rel,arg) = ent if rel == POSSESSOR_LABEL: ...
if rel.startswith("prep"):
Given the code snippet: <|code_start|># for line in fin: # w = line.strip() # if w: # intransitive_verbs.append(w) # fin.close() # DepTree is a class representing a dependency tree class DepTree(object): def __init__(self,pos,word,id,parent=None,parent_id = None,parent_relation=None,child...
def get_parent(self): return self.parent
Based on the snippet: <|code_start|> #mark head as matching pattern's head ret = [self] # find a child matching each of the pattern's children availableChildren = [(i,c) for i,c in enumerate(self.children)] lastMatch = -1 for c_pat in pat: for i...
return ret
Given the following code snippet before the placeholder: <|code_start|>18 9,came VBD 1 1 24 8,just RB 0 0 mod,18 26 10,back RB 0 0 mod,18 27 12,Russia NNP 0 0 prep_from,18''', ), ('She said that the boy is tall', ''' She said that the boy...
unittest.main()
Predict the next line for this snippet: <|code_start|># import graph_representation.node # from graph_representation.node import isRcmodProp # from graph_representation.node import Node def accessibility_wo_self(graph): ret = accessibility(graph) for k in ret: ret[k].remove(k) <|code_end|> wit...
return ret
Given snippet: <|code_start|># import graph_representation.node # from graph_representation.node import isRcmodProp # from graph_representation.node import Node def accessibility_wo_self(graph): ret = accessibility(graph) for k in ret: ret[k].remove(k) return ret # def isRCmod(graph, nod...
def duplicate_node(graph, node, connectToNeighbours):
Based on the snippet: <|code_start|>#! /usr/bin/env python3 def main(args): ar, rs = count_reads_stats(args.reads) print(rs, ar) if args.config: with open(str(args.config)) as f: config = json.load(f) config['reads_size'] = rs config['r'] = ar with open(str(arg...
parser.add_argument('-c', '--config', type=Path, help='Add to config')
Using the snippet: <|code_start|> 'estimated_genome_size', 'estimated_genome_size_std', ] print(format_table( header, titles, sorted( list(table_lines.values()), key=lambda x: ( x['original_coverage'], x['original_er...
main(args)
Predict the next line for this snippet: <|code_start|> 'csv': 'templates/csv.tpl', 'tex': 'templates/tex.tpl', } format_escape = { 'tex': lambda x: x.replace('_', '\\_'), } titles = { 'original_coverage': 'Coverage', 'original_error_rate': 'Error Rate', '...
titles,
Predict the next line for this snippet: <|code_start|> def other(base): b = random.randrange(len(BASES) - 1) if BASES[b] == base: return BASES[-1] return BASES[b] def reverse_complement(seq): complement = { 'G': 'C', 'C': 'G', 'A': 'T', 'T': 'A', 'N': 'N...
'V': ('A', 'C', 'G'),
Continue the code snippet: <|code_start|> if dest.exists(): dest.unlink() src = str(run_script_filename.resolve()) dst = str(dest) if link: os.symlink(src, dst) else: shutil.copy2(src, dst) else: print('File does not exist: {}'.forma...
if 'r' not in config or 'reads_size' not in config:
Next line prediction: <|code_start|> print('read length: %d, size: %d' % (read_length, reads_size), file=sys.stderr) config.update({ 'reads_size': reads_size, 'r': read_length, }) return config def generate_histogram(reads_file, dest_dir, config, clean=False): print('Generating...
def create_run_script(run_script_filename, dest_dir, link=True):
Next line prediction: <|code_start|> rs = config['reads_size'] del config['reads_size'] else: _, rs = count_reads_stats(str(reads_file)) c = rs / gs factor = c / tc print( 'Current coverage: {c}, target coverage: {tc}, genome size: {gs}, ' ...
reads_file.suffix = '.fa'
Predict the next line for this snippet: <|code_start|>#! /usr/bin/env python SEPARATE_EF = True def kmer_to_read_coverage(c, k, read_length=100): if c is not None: return c * read_length / (read_length - k + 1) def compute_average(table_lines, std_key_suffix='_std'): table_cnt = defaultdict(lambda...
table_avg[key][k] = None
Next line prediction: <|code_start|>#! /usr/bin/env python SEPARATE_EF = True def kmer_to_read_coverage(c, k, read_length=100): if c is not None: <|code_end|> . Use current file imports: (import argparse from collections import defaultdict from tools import templates from tools.experiment_parser import parse_a...
return c * read_length / (read_length - k + 1)
Given snippet: <|code_start|> def compute_average(table_lines, std_key_suffix='_std'): table_cnt = defaultdict(lambda: defaultdict(int)) table_sum = defaultdict(lambda: defaultdict(float)) table_avg = defaultdict(lambda: defaultdict(float)) table_std_sum = defaultdict(lambda: defaultdict(float)) for...
if table_cnt[key][k] <= 1:
Next line prediction: <|code_start|>#! /usr/bin/env python3 BASES = ['A', 'C', 'G', 'T', ] DEFAULT_FACTOR = 2 if __name__ == '__main__': parser = argparse.ArgumentParser(description='Subsample reads randomly form other reads') parser.add_argument('-f', '--factor', type=float, default...
parser.add_argument('reads', help='Reads file')
Next line prediction: <|code_start|> def correct_c(self, c): return c * (self.r - self.k + 1) / self.r @lru_cache(maxsize=None) def _get_lambda_s(self, c, err): return [ c * (3 ** -s) * (1.0 - err) ** (self.k - s) * err ** s for s in range(self.max_error) ] ...
def compute_loglikelihood(self, *args):
Predict the next line for this snippet: <|code_start|> MODEL_CLASS_SUFFIX = 'Model' class BasicModel: params = ('coverage', 'error_rate') def __init__(self, k, r, hist, tail, max_error=None, max_cov=None, *args, **kwargs): self.repeats = False self.k = k self.r = r self.bounds...
self.max_error = min(self.k + 1, max_error)
Predict the next line for this snippet: <|code_start|> return [probs.get(i, 0) for i in range(max_j)] hs = float(sum(self.hist.values())) hp = adjust_probs({k: f / hs for k, f in self.hist.items()}, hist=True) ep = adjust_probs(self.compute_probabilities(*est)) gp = adjus...
label='orig: {}'.format(fmt(orig)),
Predict the next line for this snippet: <|code_start|> return x def verbose_print(message): if not constants.VERBOSE: return sys.stderr.write(message + "\n") def safe_int(x): return int(x) if x != float('inf') else None def fix_zero(x, val=1): if x == 0: return val else: ...
def kmer_to_read_coverage(coverage, k, r):
Continue the code snippet: <|code_start|> r = s / ss r = round(r, constants.AUTO_TRIM_PRECISION) if r >= 1: trim = i break return trim def trim_hist(hist, threshold): if threshold >= max(hist): return hist, 0 h = {k: v for k, v in hist.items() if k < ...
else:
Continue the code snippet: <|code_start|>def trim_hist(hist, threshold): if threshold >= max(hist): return hist, 0 h = {k: v for k, v in hist.items() if k < threshold} tail = sum(v for k, v in hist.items() if k >= threshold) # remove 0 elements return {k: v for k, v in h.items() if v > 0}, t...
hist, tail = trim_hist(hist, trim)
Predict the next line after this snippet: <|code_start|> def compute_coverage_apx(hist, k, r): observed_ones = hist.get(1, 0) all_kmers = sum(i * h for i, h in hist.items()) total_unique_kmers = sum(h for h in hist.values()) if total_unique_kmers == 0: return 0.0, 1.0 # discard first co...
unique_kmers /= (1.0 - exp(-cov) - cov * exp(-cov))
Given the code snippet: <|code_start|> all_kmers = sum(i * h for i, h in hist.items()) total_unique_kmers = sum(h for h in hist.values()) if total_unique_kmers == 0: return 0.0, 1.0 # discard first column all_kmers -= observed_ones unique_kmers = total_unique_kmers - observed_ones #...
return 0.0, 1.0
Next line prediction: <|code_start|> def auto_sample_hist(hist, k, r, trim=None): h = dict(hist) f = 1 s = 1 c, e = compute_coverage_apx(hist, k, r) while c > constants.AUTO_SAMPLE_TARGET_COVERAGE: f += s s *= 2 h = sample_histogram(hist, factor=f, trim=trim) c, e = ...
total = sum(hist.values())
Predict the next line after this snippet: <|code_start|> ['alt E', 'Finder', ['UIElementRole::custom_ui']], ['__FlipScrollWheel__', 'flipscrollwheel_vertical', ['Finder', 'cmd', 'built_in_keyboard_and_trackpad']], ['ctrl cmd F', 'cmd F', ['VIRTUALMACHINE']], ] result = ''' <appde...
<replacementdef>
Continue the code snippet: <|code_start|># coding: utf-8 from __future__ import print_function __all__ = ['get_app_info', 'get_all_app_info', 'get_peripheral_info', 'get_all_peripheral_info'] <|code_end|> . Use current file imports: import os import subprocess from . import util from .fucking_string impo...
def call(cmd, **kwargs):
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function class Generator(BaseXML): """Construct Karabiner favorite XML tree >>> g = Generator() >>> s = ''' ... <root> ... <Easy-Karabiner>{version}</Easy-Karabiner> ... <item> <|code_en...
... <name>Easy-Karabiner</name>
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function class Generator(BaseXML): """Construct Karabiner favorite XML tree >>> g = Generator() >>> s = ''' ... <root> ... <Easy-Karabiner>{version}</Easy-Karabiner> ... <item> .....
... <identifier>private.easy_karabiner</identifier>
Given the code snippet: <|code_start|> </vkchangeinputsourcedef>''' util.assert_xml_equal(d, s) def test_vkopenurldef(): d = VKOpenURL('KeyCode::VK_OPEN_URL_karabiner', 'https://pqrs.org/osx/karabiner/') s = ''' <vkopenurldef> <name>KeyCode::VK_OPEN_URL_karabiner</name> ...
d = VKOpenURL('KeyCode::VK_OPEN_URL_date_pbcopy', '#! /bin/date | /usr/bin/pbcopy')
Predict the next line for this snippet: <|code_start|> for tag_name, tag_val in tag_val_pairs: if len(tag_name) > 0: tag_name, tag_attrs = self.split_name_and_attrs(tag_name) tag = self.create_tag(tag_name, tag_val, attrib=tag_attrs) xml_tree.append(tag...
... <appname>BILIBILI</appname>
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function def is_defined_filter(val): return query_filter_class_names(val, scope='all') def is_defined_key(val): if get_key_alias(val.lower()): return True else: for k in [val, val.upper(), val.lowe...
return len(parts) == 2 and parts[0] == 'ModifierFlag'
Given the code snippet: <|code_start|> g = Generator(maps=MAPS, definitions=DEFINITIONS) s = ''' <root> <Easy-Karabiner>{version}</Easy-Karabiner> <item> <name>Easy-Karabiner</name> <appdef> <appname>BILIBILI</appname> <equal>com.typ...
<device_not> DeviceVendor::APPLE_COMPUTER, DeviceProduct::ANY </device_not>
Based on the snippet: <|code_start|> <autogen> __KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L </autogen> </block> <block> <device_not> DeviceVendor::APPLE_COMPUTER, DeviceProduct::ANY </device_not> <autogen> __FlipScrollWheel__ Option::FLIPS...
<item>
Continue the code snippet: <|code_start|> return saxutils.unescape(s, { "&quot;": '"', "&apos;": "'", }) @classmethod def parse(cls, filepath): return etree.parse(filepath).getroot() @classmethod def parse_string(cls, xml_str): return ...
@classmethod
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function def read_python_file(pypath): vars = {} with open(pypath, 'rb') as fp: <|code_end|> , generate the next line using the imports in this file: import shlex import click import traceback from hashlib impo...
exec(compile(fp.read(), pypath, 'exec'), {}, vars)
Given snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function def read_python_file(pypath): vars = {} with open(pypath, 'rb') as fp: exec(compile(fp.read(), pypath, 'exec'), {}, vars) return vars <|code_end|> , continue by predicting the next line. Consider current f...
def get_checksum(s):
Continue the code snippet: <|code_start|> # ------------------------------------------------------------------------------------------------------------------ @classmethod def setup_categories(cls): cls.category1 = Category.objects.create(category_name='category1') cls.category2 = Category.o...
'name': 'First Book',
Given the code snippet: <|code_start|> AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Third Book')) AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Sixth Book')) AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.o...
@classmethod
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- TEST_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DATA_DIR = os.path.join(TEST_DIR, 'fixtures') # ---------------------------------------------------------------------------------------------------------------------- class ModelTest(TestCase)...
@classmethod
Predict the next line after this snippet: <|code_start|> 'category': cls.category1, 'language': cls.language_ru, 'file': SimpleUploadedFile('test_book.pdf', open(test_book_path, 'rb').read()), 'photo': SimpleUploadedFile('test_book_image.png', open(test_boo...
'file': SimpleUploadedFile('test_book.pdf', open(test_book_path, 'rb').read()),
Based on the snippet: <|code_start|> test_book_path = os.path.join(TEST_DATA_DIR, 'test_book.pdf') test_book_image_path = os.path.join(TEST_DATA_DIR, 'test_book_image.png') books_setup = [ { 'name': 'First Book', 'author': cls.author1, ...
'who_added': cls.the_user1,
Predict the next line for this snippet: <|code_start|> ] for book in books_setup: Book.objects.create( book_name=book['name'], id_author=book['author'], id_category=book['category'], description='TEST description', ...
def setup_book_rating(cls):
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- TEST_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DATA_DIR = os.path.join(TEST_DIR, 'fixtures') # ---------------------------------------------------------------------------------------------------------------------- class ModelTest(TestCase): ...
cls.setup_authors()
Predict the next line after this snippet: <|code_start|> cls.anonymous_user = auth.get_user(client) cls.user1 = User.objects.create_user('user1', 'user1@user1.com', 'testpassword1') cls.user2 = User.objects.create_user('user2', 'user2@user2.com', 'testpassword2') cls.user3 = User.objects...
@classmethod
Predict the next line for this snippet: <|code_start|> cls.language_en = Language.objects.create(language='English') cls.language_ru = Language.objects.create(language='Russian') # ------------------------------------------------------------------------------------------------------------------ ...
'name': 'Third Book',
Predict the next line for this snippet: <|code_start|> AddedBook.objects.create(id_user=cls.the_user2, id_book=Book.objects.get(book_name='Second Book')) AddedBook.objects.create(id_user=cls.the_user5, id_book=Book.objects.get(book_name='Sixth Book')) AddedBook.objects.create(id_user=cls.the_user...
def setup_post_messages(cls):
Continue the code snippet: <|code_start|> # ------------------------------------------------------------------------------------------------------------------ @classmethod def setup_categories(cls): cls.category1 = Category.objects.create(category_name='category1') cls.category2 = Category.o...
'name': 'First Book',
Given the code snippet: <|code_start|> 'name': 'Fourth Book', 'author': cls.author1, 'category': cls.category1, 'language': cls.language_ru, 'file': SimpleUploadedFile('test_book.pdf', open(test_book_path, 'rb').read()), 'pho...
'category': cls.category2,
Next line prediction: <|code_start|> cls.the_user = TheUser.objects.get(id_user=cls.user) cls.client = APIClient() cls.api_key = settings.API_SECRET_KEY # ------------------------------------------------------------------------------------------------------------------ def test_us...
self.assertEqual(response.status_code, 400)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # ---------------------------------------------------------------------------------------------------------------------- class IndexViewsTestCase(TestCase): # -----------------------------------------------------------------------------...
cls.client = APIClient()
Predict the next line after this snippet: <|code_start|> url(r'comment-add', selected_book_views.add_comment, name='add_comment_app'), url(r'load-comments', selected_book_views.load_comments, name='load_comments_app'), url(r'report-book', selected_book_views.report_book, name='report-book'), # Library u...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Using the snippet: <|code_start|># -*- coding: utf-8 -*- handler404 = 'app.views.error_views.not_found_404' handler400 = 'app.views.error_views.bad_request_400' handler403 = 'app.views.error_views.permission_denied_403' <|code_end|> , determine the next line of code. You have imports: from django.conf.urls import ...
handler500 = 'app.views.error_views.internal_error_500'
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- handler404 = 'app.views.error_views.not_found_404' handler400 = 'app.views.error_views.bad_request_400' handler403 = 'app.views.error_views.permission_denied_403' handler500 = 'app.views.error_views.internal_error_500' <|code_end|> , generate the next l...
urlpatterns = [