Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Here is a snippet: <|code_start|> same data. It doesn't have sense to make multiple instances """ _instance = None _instance_lock = threading.Lock() @staticmethod def get_instance(): with XklWrapper._instance_lock: if not XklWrapper._instance: XklWrapper._in...
if diff > 0 and flags.can_touch_runtime_system("activate layouts"):
Continue the code snippet: <|code_start|> shutil.copy2(xconf_file_path, os.path.normpath(root + "/" + xconf_file_path)) except IOError: # The file may not exist (eg. text install) so don't raise pass # restore the origi...
fobj.write('FONT="%s"\n' % DEFAULT_VC_FONT)
Given the code snippet: <|code_start|> """ Normalize keyboard layout and variant specification given as a single string. E.g. for a 'layout(variant) string missing the space between the left parenthesis return 'layout (variant)' which is a proper layout and variant specification we use. :param l...
keyboard.vc_keymap = DEFAULT_KEYBOARD
Given the code snippet: <|code_start|> else: # activate VConsole keymap and get converted layout and variant c_lay_var = localed.set_and_convert_keymap(keyboard.vc_keymap) if not keyboard.x_layouts: if c_lay_var: # suggested by systemd-localed for a requested VCon...
threadMgr.add(AnacondaThread(name=THREAD_XKL_WRAPPER_INIT, target=XklWrapper.get_instance))
Given the code snippet: <|code_start|> else: # activate VConsole keymap and get converted layout and variant c_lay_var = localed.set_and_convert_keymap(keyboard.vc_keymap) if not keyboard.x_layouts: if c_lay_var: # suggested by systemd-localed for a requested VCon...
threadMgr.add(AnacondaThread(name=THREAD_XKL_WRAPPER_INIT, target=XklWrapper.get_instance))
Using the snippet: <|code_start|> else: # activate VConsole keymap and get converted layout and variant c_lay_var = localed.set_and_convert_keymap(keyboard.vc_keymap) if not keyboard.x_layouts: if c_lay_var: # suggested by systemd-localed for a requested VConsole ...
threadMgr.add(AnacondaThread(name=THREAD_XKL_WRAPPER_INIT, target=XklWrapper.get_instance))
Next line prediction: <|code_start|> # Add a handler for the duped stuff. No fancy formatting, thanks. self.addFileHandler(sys.stdout, stdoutLogger, fmtStr=STDOUT_FORMAT, minLevel=logging.INFO) # Stderr logger stderrLogger = logging.getLogger("anaconda.stderr...
if flags.imageInstall:
Predict the next line after this snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Author(s): Matt Wilson <msw@redhat.com> # Chris Lumens <clum...
with open(ROOT_PATH + "/etc/sysconfig/desktop", "w") as f:
Given the following code snippet before the placeholder: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # bu...
if int(runlevel) not in RUNLEVELS:
Based on the snippet: <|code_start|> class Desktop(object): def __init__(self): self._runlevel = 3 self.desktop = None @property def runlevel(self): return self._runlevel @runlevel.setter def runlevel(self, runlevel): if int(runlevel) not in RUNLEVELS: r...
sd_prefix = iutil.execWithCapture(
Here is a snippet: <|code_start|> locales configuration. """ def __init__(self): # the class inheriting from this class is responsible for populating # these items with actual objects self._languageStore = None self._languageStoreFilter = None self._languageEntry = N...
for lang in localization.get_available_translations():
Given the following code snippet before the placeholder: <|code_start|> else: self._arrow = Gtk.Image.new_from_file("/usr/share/anaconda/pixmaps/left-arrow-icon.png") self._langSelectedColumn.set_cell_data_func(self._langSelectedRenderer, se...
translit = strip_accents(unicode(native, "utf-8")).lower()
Based on the snippet: <|code_start|> else: renderer.set_property("pixbuf", None) def _add_language(self, store, native, english, lang): """Override this method with a valid implementation""" raise NotImplementedError() def _add_locale(self, store, native, locale): "...
lang_itr = set_treeview_selection(self._langView, parts["language"], col=2)
Given snippet: <|code_start|>screens handling languages or locales configuration. """ class LangLocaleHandler(object): """ Class that could be used as a mixin for screens handling languages or locales configuration. """ def __init__(self): # the class inheriting from this class is respo...
if get_default_widget_direction() == Gtk.TextDirection.LTR:
Given the following code snippet before the placeholder: <|code_start|>def gtk_call_once(func, *args): """Wrapper for GLib.idle_add call that ensures the func is called only once. """ def wrap(args): func(*args) return False GLib.idle_add(wrap, args) def gtk_action_wait(func): ...
if threadMgr.in_main_thread():
Continue the code snippet: <|code_start|> stderr=subprocess.STDOUT, preexec_fn=chroot, cwd=root, env=env) out = proc.communicate()[0] if out: for line in out.splitlines(): program_log.info...
if flags.testing:
Continue the code snippet: <|code_start|> service_name = service + ".service" ret = execWithRedirect("systemctl", [command, service_name]) return ret def start_service(service): return _run_systemctl("start", service) def stop_service(service): return _run_systemctl("stop", service) def restart_...
if not os.path.exists(DRACUT_SHUTDOWN_EJECT):
Continue the code snippet: <|code_start|># iutil.py - generic install utility functions # # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 # Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public Lic...
"ANA_INSTALL_PATH": ROOT_PATH
Given the following code snippet before the placeholder: <|code_start|> options = '' host = '' path = '' if nfsurl: s = nfsurl.split(":") s.pop(0) if len(s) >= 3: (options, host, path) = s[:3] elif len(s) == 2: (host, path) = s else: ...
if os.path.isdir(TRANSLATIONS_UPDATE_DIR):
Based on the snippet: <|code_start|> def conditional_chown(path, uid, gid, from_uid=None, from_gid=None): stats = os.stat(path) if (from_uid and stats.st_uid != from_uid) or \ (from_gid and stats.st_gid != from_gid): # owner UID or GID not matching, do nothing ...
status = bool(tainted & UNSUPPORTED_HW)
Here is a snippet: <|code_start|> log = logging.getLogger("anaconda") program_log = logging.getLogger("program") def augmentEnv(): env = os.environ.copy() env.update({"LC_ALL": "C", "ANA_INSTALL_PATH": ROOT_PATH }) return env def _run_program(argv, root='/', stdin=None, st...
with program_log_lock:
Using the snippet: <|code_start|> """ pass @property def window(self): """Return an object with show_all and hide methods that is to be used to display this UI object. """ raise TypeError("UIObject.window has to be overriden") @property def data(self):...
if environment == ANACONDA_ENVIRON:
Here is a snippet: <|code_start|> @property def window(self): """Return an object with show_all and hide methods that is to be used to display this UI object. """ raise TypeError("UIObject.window has to be overriden") @property def data(self): return self._dat...
elif environment == FIRSTBOOT_ENVIRON and data is None:
Predict the next line after this snippet: <|code_start|> fo, module_path, module_flags) # get the filenames without the extensions so we can compare those # with the .py[co]? equivalence in mind # - we do not have to care about files with...
except RemovedModuleError:
Based on the snippet: <|code_start|> log = logging.getLogger("anaconda") # A lot of effort, but it only allows a limited set of flags to be referenced class Flags(object): def __setattr__(self, attr, val): # pylint: disable-msg=E1101 if attr not in self.__dict__ and not self._in_init: ...
self.selinux = SELINUX_DEFAULT
Given snippet: <|code_start|> class UnknownMethodGetError(Exception): """Object does not have Get, most probably being invalid""" def __str__(self): return self.__repr__() def _get_proxy(bus_type=Gio.BusType.SYSTEM, flags=Gio.DBusProxyFlags.NONE, info=None, ...
DEFAULT_DBUS_TIMEOUT,
Continue the code snippet: <|code_start|> class CharacterAdmin(admin.ModelAdmin): list_display = ('name', 'level', 'race', 'cclass', 'player', 'created', 'modified') list_filter = ('cclass__name', 'race__name', 'created', 'modified') search_fields = ['name', 'background', 'race__name'...
admin.site.register(Character, CharacterAdmin)
Given the following code snippet before the placeholder: <|code_start|> class CharacterAdmin(admin.ModelAdmin): list_display = ('name', 'level', 'race', 'cclass', 'player', 'created', 'modified') list_filter = ('cclass__name', 'race__name', 'created', 'modified') search_fields = ['nam...
admin.site.register(Race)
Continue the code snippet: <|code_start|> class CharacterAdmin(admin.ModelAdmin): list_display = ('name', 'level', 'race', 'cclass', 'player', 'created', 'modified') list_filter = ('cclass__name', 'race__name', 'created', 'modified') search_fields = ['name', 'background', 'race__name'...
admin.site.register(Class)
Continue the code snippet: <|code_start|> class CharacterAdmin(admin.ModelAdmin): list_display = ('name', 'level', 'race', 'cclass', 'player', 'created', 'modified') list_filter = ('cclass__name', 'race__name', 'created', 'modified') search_fields = ['name', 'background', 'race__name'...
admin.site.register(Item)
Predict the next line after this snippet: <|code_start|> class CharacterIndexView(ListView): template_name = 'characters/index.html' context_object_name = 'all_characters' # better than 'object_list' def get_queryset(self): return Character.objects.all().order_by('name') class CharacterDetail...
form_class = CharacterForm
Continue the code snippet: <|code_start|> class CharacterIndexView(ListView): template_name = 'characters/index.html' context_object_name = 'all_characters' # better than 'object_list' def get_queryset(self): <|code_end|> . Use current file imports: from django.core.urlresolvers import reverse from dj...
return Character.objects.all().order_by('name')
Next line prediction: <|code_start|># -*- coding: utf-8 -*- from __future__ import unicode_literals def load_data(apps, schema_editor): Race(name="Human", description="Enh.").save() <|code_end|> . Use current file imports: (from django.db import models, migrations from characters.models import Race, Class) an...
Class(name="Generic", description="Meh.").save()
Given the code snippet: <|code_start|> it would be possible to get almost any object through a series of nested joins! """ super(MongoQuerySettingsDict, self).__init__() self.update({k: v for k, v in locals().items() if k not in {'__class_...
kwargs = pluck_kwargs_from(dict,
Here is a snippet: <|code_start|>``` #### Syntax The Group Operator, as you have seen, receives an array of column names. * Array syntax. List of column names, optionally suffixed by the sort direction: `-` for `DESC`, `+` for `ASC`. The default is `+`. Example: ```javascript { group: [ 'a+', '...
class MongoGroup(MongoSort):
Using the snippet: <|code_start|> class method_decorator_test(unittest.TestCase): def test_method_decorators(self): # === Test: method decorator # Create a class class A: @method_decorator_1(1) def a(self): pass @method_decorator_1(2) def b(...
self.assertTrue(isinstance(method_decorator.get_method_decorator(A, 'a'), method_decorator_1))
Continue the code snippet: <|code_start|> .format(list(invalid_keys))) # Validated "related_models": all keys must be models, not names invalid_keys = set(v for v in self._nested_model_settings.keys() if not isinstance(v, D...
kwargs = pluck_kwargs_from(self._settings, for_func=handler_cls.__init__)
Based on the snippet: <|code_start|> Then, we take the matching keys from the settings dict, we take defaults from the argument defaults, and make it all into `kwargs` that will be given to the class. In addition to that, if the settings contain `handler_name=False`, then it means it...
raise DisabledError('Query handler "{}" is disabled for "{}"'
Predict the next line after this snippet: <|code_start|> 'articles', {JSON_AGG}(a)), {JSON_AGG}(c) FROM u LEFT JOIN a ON(u.id=a.uid) LEFT JOIN c ON (a.id=c.aid) GROUP BY u.id; """ def test_semisingle_line_agg__json(n): """ Aggregate only 1st level objects; things that are nested deeper are ...
res = benchmark_parallel_funcs(
Next line prediction: <|code_start|>That's 500% overhead! That's alright if you load just one object. But when all we need is load a bunch of objects and immediately convert them to JSON, that's a huge, huge overhead for no added benefit. We don't need no ORM features for this task. Sidenote: joinedload() is somehow...
engine, Session = get_big_db_for_benchmarks(n_users=100,
Given snippet: <|code_start|>We can also win an additional 2x by not using `to_json()` on rows, but return tuples. Both this techniques let us fetch the results 3.5x faster than `selectinload()`, 2.7x faster than `joinedload()`. But this will give us tuples. If we try to use `to_json()` and fetch keyed objects, it's m...
users = ssn.query(User).options(
Here is a snippet: <|code_start|>Both this techniques let us fetch the results 3.5x faster than `selectinload()`, 2.7x faster than `joinedload()`. But this will give us tuples. If we try to use `to_json()` and fetch keyed objects, it's more convenient, but reduces the performance improvement to just 1.5x, which brings...
selectinload(User.articles).selectinload(Article.comments)
Given snippet: <|code_start|> return "".join( [ "\\begin{tikzpicture}[scale=.3,baseline=(current bounding box.center)]", f"\n{tab}\\foreach \\x in {{1,...,{n}}} {{\n{tab*2}", f"\\draw[ultra thin] (\\x,0)--(\\x,{n+1}); %vline\n{tab*2}", f...
HTMLViewer.open_svg(self.to_svg(image_scale=scale))
Given the following code snippet before the placeholder: <|code_start|> def pinnacle_set(self) -> List[int]: """Return the pinnacle set of self. See: https://arxiv.org/abs/2105.10388 https://arxiv.org/abs/1704.05494 https://arxiv.org/abs/2001.07325 Examples: >>> P...
return sum(1 for idx, val in enumerate(self) if is_prime(val + idx + 2))
Given the code snippet: <|code_start|># pylint: disable=super-init-not-called # pylint: disable=too-many-lines # pylint: disable=too-many-public-methods __all__ = ("Perm",) # Remove when pypy is 3.7 compatible andn replace TupleType with Tuple[int] if TYPE_CHECKING: TupleType = Tuple[int] else: TupleType =...
class Perm(TupleType, Patt):
Using the snippet: <|code_start|> class InsertionEncodingStrategy(EnumerationStrategy): """Enumeration strategies related to the insertion encoding.""" def applies(self) -> bool: return InsertionEncodablePerms.is_insertion_encodable( self.basis ) or InsertionEncodablePerms.is_inser...
rotate_90_clockwise_set(self.basis)
Given the following code snippet before the placeholder: <|code_start|> Returns keywords, literals, strings, numbers, arrays and dictionaries. Arrays and dictionaries are represented as Python lists and dictionaries. """ while not self.results: (pos, token) = self.nexttoken()...
d = dict((literal_name(k), v) for (k, v) in choplist(2, objs) if v is not None)
Based on the snippet: <|code_start|> def do_tag(self, tag, props=None): return def begin_page(self, page, ctm): return def end_page(self, page): return def begin_figure(self, name, bbox, matrix): return def end_figure(self, name): return def paint_path...
matrix = mult_matrix(textstate.matrix, self.ctm)
Next line prediction: <|code_start|> fontsize = textstate.fontsize scaling = textstate.scaling * .01 charspace = textstate.charspace * scaling wordspace = textstate.wordspace * scaling rise = textstate.rise if font.is_multibyte(): wordspace = 0 dxscale ...
x += self.render_char(translate_matrix(matrix, (x, y)),
Next line prediction: <|code_start|> return (x, y) def render_char(self, matrix, font, fontsize, scaling, rise, cid): return 0 ## TagExtractor ## class TagExtractor(PDFDevice): def __init__(self, rsrcmgr, outfp): PDFDevice.__init__(self, rsrcmgr) self.outfp = outfp se...
self.outfp.write(q(text))
Given snippet: <|code_start|> ## TagExtractor ## class TagExtractor(PDFDevice): def __init__(self, rsrcmgr, outfp): PDFDevice.__init__(self, rsrcmgr) self.outfp = outfp self.pageno = 0 self._stack = [] return def render_string(self, textstate, seq): font = text...
(self.pageno, bbox2str(page.mediabox), page.rotate))
Using the snippet: <|code_start|>## PDFTextDevice ## class PDFTextDevice(PDFDevice): def render_string(self, textstate, seq): matrix = mult_matrix(textstate.matrix, self.ctm) font = textstate.font fontsize = textstate.fontsize scaling = textstate.scaling * .01 charspace = t...
if isnumber(obj):
Predict the next line after this snippet: <|code_start|> y += wordspace needcharspace = True return (x, y) def render_char(self, matrix, font, fontsize, scaling, rise, cid): return 0 ## TagExtractor ## class TagExtractor(PDFDevice): def __init__(se...
except PDFUnicodeNotDefined:
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python # main def main(argv): def usage(): print('usage: %s [-c enc=codec] output_dir regname [cid2code.txt ...]' % argv[0]) return 100 try: (opts, args) = getopt.getopt(argv[1:], 'c:') except getopt.GetoptError: ...
convert_cmap(outdir, regname, enc2codec, args)
Given the code snippet: <|code_start|> for i in (0, 255): self.fp.write(struct.pack('BBBx', i, i, i)) elif ncols == 256: # grayscale color table for i in range(256): self.fp.write(struct.pack('BBBx', i, i, i)) self.pos0 = self.fp.tell() ...
if len(filters) == 1 and filters[0][0] in LITERALS_DCT_DECODE:
Given the code snippet: <|code_start|> # grayscale color table for i in range(256): self.fp.write(struct.pack('BBBx', i, i, i)) self.pos0 = self.fp.tell() self.pos1 = self.pos0 + self.datasize return def write_line(self, y, data): self.fp.seek(...
image.bits == 8 and image.colorspace in (LITERAL_DEVICE_RGB, LITERAL_DEVICE_GRAY)):
Next line prediction: <|code_start|> # grayscale color table for i in range(256): self.fp.write(struct.pack('BBBx', i, i, i)) self.pos0 = self.fp.tell() self.pos1 = self.pos0 + self.datasize return def write_line(self, y, data): self.fp.seek(se...
image.bits == 8 and image.colorspace in (LITERAL_DEVICE_RGB, LITERAL_DEVICE_GRAY)):
Based on the snippet: <|code_start|> self.fp.write(data) return ## ImageWriter ## class ImageWriter: def __init__(self, outdir): self.outdir = outdir if not os.path.exists(self.outdir): os.makedirs(self.outdir) return def export_image(self, image): ...
if LITERAL_DEVICE_CMYK in image.colorspace:
Continue the code snippet: <|code_start|> def setupUi(self, Form): Form.setObjectName("Form") Form.resize(529, 329) self.selInfoWidget = QtGui.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName("selInfoWidget") ...
self.view = FlowchartGraphicsView(Form)
Predict the next line after this snippet: <|code_start|># Created: Mon Dec 23 10:10:51 2013 # by: pyside-uic 0.2.14 running on PySide 1.1.2 # # WARNING! All changes made in this file will be lost! class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(529, 329)...
self.selectedTree = DataTreeWidget(self.selInfoWidget)
Based on the snippet: <|code_start|> """Builds an inverted index on the prefixes of the strings in the input column in the input table. Prefix index is used by p...
prefix_length = get_prefix_length(
Predict the next line after this snippet: <|code_start|> class PrefixIndex(Index): """Builds an inverted index on the prefixes of the strings in the input column in the input table. ...
index_attr_tokens = order_using_token_ordering(
Continue the code snippet: <|code_start|> class ProfileTableForJoinTestCases(unittest.TestCase): def setUp(self): self.table = pd.DataFrame([('1', 'data science'), ('2', None), ('3', 'data integration'), ...
profile_output = profile_table_for_join(self.table)
Given the following code snippet before the placeholder: <|code_start|> def validate_sim_measure_type(sim_measure_type): """Check if the input sim_measure_type is one of the supported types.""" sim_measure_types = ['COSINE', 'DICE', 'EDIT_DISTANCE', 'JACCARD', 'OVERLAP'] if sim_mea...
if comp_op not in COMP_OP_MAP.keys():
Here is a snippet: <|code_start|> def __init__(self, table, index_attr, tokenizer, sim_measure_type, threshold, token_ordering): self.table = table self.index_attr = index_attr self.tokenizer = tokenizer self.sim_measure_type = sim_measure_type self.threshol...
prefix_length = get_prefix_length(
Here is a snippet: <|code_start|> """Builds a position index on the input column in the input table. Position index is used by position filter, dice join, cosine join...
index_attr_tokens = order_using_token_ordering(
Continue the code snippet: <|code_start|> class OverlapJoinValidTestCases(unittest.TestCase): def test_overlap_join_using_tokenizer_with_return_set_false(self): A = pd.DataFrame([{'id':1, 'attr':'hello'}]) B = pd.DataFrame([{'id':1, 'attr':'he ll'}]) qg2_tok = QgramTokenizer(2) ...
c = overlap_join(A, B, 'id', 'id', 'attr', 'attr', qg2_tok, 1)
Given the code snippet: <|code_start|> candset_splits[job_index], candset_l_key_attr, candset_r_key_attr, ltable_projected, rtable_projected, l_key_attr, r_key_attr, ...
ltable_dict = build_dict_from_table(ltable, l_key_attr_index,
Next line prediction: <|code_start|> 'key attribute', 'left table') validate_attr(r_key_attr, rtable.columns, 'key attribute', 'right table') validate_attr(l_filter_attr, ltable.columns, 'filter attribute', 'left table') validate_a...
n_jobs = min(get_num_processes_to_launch(n_jobs), len(candset))
Given snippet: <|code_start|> # check if the key attributes are unique and do not contain # missing values validate_key_attr(l_key_attr, ltable, 'left table') validate_key_attr(r_key_attr, rtable, 'right table') # check for empty candset if candset.empty: re...
candset_splits = split_table(candset, n_jobs)
Based on the snippet: <|code_start|> r_key_attr (string): key attribute in right table. l_filter_attr (string): attribute in left table on which the filter should be applied. ...
validate_attr(candset_l_key_attr, candset.columns,
Given the code snippet: <|code_start|> Returns: An output table containing tuple pairs from the candidate set that survive the filter (DataFrame). """ # check if the input candset is a dataframe validate_input_table(candset, 'candset') # check if the ca...
validate_attr_type(l_filter_attr, ltable[l_filter_attr].dtype,
Predict the next line after this snippet: <|code_start|> validate_input_table(candset, 'candset') # check if the candset key attributes exist validate_attr(candset_l_key_attr, candset.columns, 'left key attribute', 'candset') validate_attr(candset_r_key_attr, candse...
validate_key_attr(l_key_attr, ltable, 'left table')
Here is a snippet: <|code_start|> l_key_attr (string): key attribute in left table. r_key_attr (string): key attribute in right table. l_filter_attr (string): attribute in left table on which the filter should be applied. ...
validate_input_table(candset, 'candset')
Predict the next line for this snippet: <|code_start|> class GetNumProcessesToLaunchTestCases(unittest.TestCase): def setUp(self): self.cpu_count = multiprocessing.cpu_count() def test_n_jobs_minus_1(self): <|code_end|> with the help of current file imports: import multiprocessing import unittest ...
assert_equal(get_num_processes_to_launch(-1), self.cpu_count)
Given snippet: <|code_start|> Args: input_table (DataFrame): input table to profile. profile_attrs (list): list of attribute names from the input table to be profiled (defaults to None). If not provided, all attributes in the input table will be profiled. Returns: ...
validate_attr(attr, input_table.columns,
Given the code snippet: <|code_start|>"""Profiling tools""" def profile_table_for_join(input_table, profile_attrs=None): """Profiles the attributes in the table to suggest implications for join. Args: input_table (DataFrame): input table to profile. profile_attrs (list): list of attribute ...
validate_input_table(input_table, 'input table')
Given the following code snippet before the placeholder: <|code_start|> def get_pairs_with_missing_value_disk(ltable, rtable, l_key_attr, r_key_attr, l_join_attr, r_join_attr, temp_dir, data_limit_per_cor...
l_out_attrs_indices = find_output_attribute_indices(l_columns, l_out_attrs)
Here is a snippet: <|code_start|> l_out_attrs_indices = find_output_attribute_indices(l_columns, l_out_attrs) # find column indices of key attr, join attr and output attrs in rtable r_columns = list(rtable.columns.values) r_key_attr_index = r_columns.index(r_key_attr) r_join_attr_index = r_columns.i...
record = get_output_row_from_tables(
Given the following code snippet before the placeholder: <|code_start|> def get_pairs_with_missing_value(ltable, rtable, l_key_attr, r_key_attr, l_join_attr, r_join_attr, l_out_attrs=None, r_out_attrs=None, ...
l_out_attrs_indices = find_output_attribute_indices(l_columns, l_out_attrs)
Next line prediction: <|code_start|> l_key_attr_index, r_key_attr_index, l_out_attrs_indices, r_out_attrs_indices) else: output_row = [l_row[l_key_attr_index], r_row[r_key_attr_index]] output_rows.append(output_row)...
output_header = get_output_header_from_tables(
Using the snippet: <|code_start|> l_out_attrs_indices = find_output_attribute_indices(l_columns, l_out_attrs) # find column indices of key attr, join attr and output attrs in rtable r_columns = list(rtable.columns.values) r_key_attr_index = r_columns.index(r_key_attr) r_join_attr_index = r_columns.i...
output_row = get_output_row_from_tables(
Given the following code snippet before the placeholder: <|code_start|> """ page = 1 numbers = [] while True: json_data = perform_request(f'pulls?per_page=100&page={page}') if not json_data: break for pr in json_data: numbers.append(pr['number']) ...
for container in dockerbot.dc.containers():
Continue the code snippet: <|code_start|> soc = socket.create_connection((addr, int(port)), timeout=2) except OSError: return False # docker-proxy opens the port immediately after container is started. # Receive data from the socket to check if VNC session is really running. if not soc.re...
dkb = SeleniumDocker(bindings={'VNC_PORT': (5999, vnc),
Predict the next line after this snippet: <|code_start|> gc.collect() map = map.add_attribute(i) assert map.get_index(1) == 0 assert map.get_index(2) == 1 assert map.get_index(3) == 2 assert map.get_index(4) == -1 assert map.storage_size() == 3 # Check to ensure we get the same ...
empty = make_map_type("__getitem__", W_ImpPropertyDescriptor).EMPTY
Given snippet: <|code_start|> DEBUG = False def make_primitive_table(ls_str): table = [None] * len(ls_str) for i, exposed_id in enumerate(ls_str): <|code_end|> , continue by predicting the next line. Consider current file imports: from pycket.values import W_Symbol from pycket.prims.expose import define_nyi, ...
table[i] = W_Symbol.make(exposed_id)
Using the snippet: <|code_start|>#! /usr/bin/env python # -*- coding: utf-8 -*- class TestConses(object): def test_basics(self): _1, _2, _3 = W_Fixnum(1), W_Fixnum(2), W_Fixnum(3) c = W_Cons.make(_1, _2) assert c.car().value == _1.value assert c.cdr().value == _2.value ...
run_fix("(car (cons 1 2))", 1)
Predict the next line for this snippet: <|code_start|>#! /usr/bin/env python # -*- coding: utf-8 -*- class TestConses(object): def test_basics(self): _1, _2, _3 = W_Fixnum(1), W_Fixnum(2), W_Fixnum(3) c = W_Cons.make(_1, _2) assert c.car().value == _1.value assert c.cdr().value...
run("(equal? (cons 1 2) (cons 1 2))", w_true)
Predict the next line for this snippet: <|code_start|> def set_config_val(self, name, val): self.config[name] = val def set_pycketconfig(self, c): self.pycketconfig = c def get_pycketconfig(self): return self.pycketconfig def is_expander_loaded(self): return self.confi...
class Env(W_Object):
Based on the snippet: <|code_start|> def test_flonum_tostring(): s = '3.141592653589793' # racket -e "pi" def float_tostring(x): print W_Flonum(x).tostring() return s in W_Flonum(x).tostring() res = interpret(float_tostring, [math.pi]) assert res def test_mul_zero(): <|code_end|> , pred...
run_fix("(* 0 1.2)", 0)
Given snippet: <|code_start|> res = interpret(float_tostring, [math.pi]) assert res def test_mul_zero(): run_fix("(* 0 1.2)", 0) run_fix("(* 1.2 0)", 0) def test_quotient(): run_fix("(quotient 0 1)", 0) run_fix("(quotient 0 -1)", 0) run_fix("(quotient 0 2)", 0) run_fix("(quotient 0 -2)"...
res = run(str(big / 2))
Predict the next line after this snippet: <|code_start|> newgs.append((og, ng)) return newgs # ================================================ # # FIGURES # # ================================================ def make_figure(standard_id, scores, collection, args): print_fi...
cmap = color.get_cmap(args.colormap)
Next line prediction: <|code_start|> help="Use nucleotide sequences for alignment. Default is amino acid sequences. \ Ensure standard format matches.") parser.add_argument('-x', '--xmin', dest='x_min', type=int, default=-1, help="Minimum X-axis ...
output=None, temp=None, log=None, cluster=False,
Given snippet: <|code_start|> seq_counter = 0 if fastas: files.append(write_to_temp_file(fastas, temp_dir)) return files def write_to_temp_file(fastas, temp_dir): tfile = tempfile.NamedTemporaryFile(dir=temp_dir, delete=False) tfile.write('\n'.join(fastas)) tfile.close() ret...
mongodb.index(db, collection, ['chain'])
Given the following code snippet before the placeholder: <|code_start|> def chunker(l, n): 'Generator that produces n-length chunks from iterable l.' for i in xrange(0, len(l), n): yield l[i:i + n] def update_db(db, standard, scores, collection, args): db = mongodb.get_db(args.db, args.ip, args.p...
progbar.progress_bar(g + args.update_threads, len(groups))
Using the snippet: <|code_start|> will be imported ip (str): IP address of the MongoDB server. Default is ``localhost``. port (int): Port of the MongoDB database. Default is ``27017``. user (str): Username for the MongoDB database, if authentication is enabled. Default ...
logger = log.get_logger('mongodb')
Next line prediction: <|code_start|> parser.add_argument('-J', '--join', dest='join_plot', default=None, help="Plot the distribution of joining families or genes. \ Only option is 'gene'. \ If not provided, no plot will be made.") parser.add...
def __init__(self, output=None, temp=None, log=None,
Based on the snippet: <|code_start|> def print_collection_info(collection): print('') print('') print('-' * 25) print(collection) print('-' * 25) print('') def run(**kwargs): args = Args(**kwargs) main(args) def run_standalone(args): logfile = args.log if args.log else os.p...
db = mongodb.get_db(args.db, ip=args.ip, port=args.port, user=args.user, password=args.password)
Predict the next line after this snippet: <|code_start|># License: The MIT license (http://opensource.org/licenses/MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the "Software"), to deal in the Software without restriction, # ...
progbar.progress_bar(finished, jobs)
Next line prediction: <|code_start|> help="Port for the MongoDB server. Defaults to 27017.") parser.add_argument('-u', '--user', dest='user', default=None, help="Username for the MongoDB server. Not used if not provided.") parser.add_argument('-p', '--password', d...
def __init__(self, output=None, log=None, db=None,