Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the following code snippet before the placeholder: <|code_start|># Copyright (c) 2010-2012 OpenStack Foundation # Copyright (c) 2016-2020 OpenIO SAS # # 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...
'x-versions-location']
Continue the code snippet: <|code_start|># 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-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on a...
def GETorHEAD(self, req):
Predict the next line after this snippet: <|code_start|># 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-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is d...
def GETorHEAD(self, req):
Continue the code snippet: <|code_start|># 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-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on a...
def GETorHEAD(self, req):
Given the code snippet: <|code_start|># See the License for the specific language governing permissions and # limitations under the License. # Hack PYTHONPATH so "test" is swift's test directory sys.path.insert(1, os.path.abspath(os.path.join(__file__, '../../../../..'))) class TestOioServerSideCopyMiddleware(Test...
self.assertEqual(status, '201 Created')
Given the code snippet: <|code_start|> ('DELETE', '/v1/a/c/o'), ]) def test_delete_latest_version_no_marker_success(self): self.skipTest("Disabled for oio-swift") def test_delete_latest_version_restores_marker_success(self): self.skipTest("Disabled for oio-swift") def t...
def test_list_no_versions_with_delimiter(self):
Next line prediction: <|code_start|># # 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-2.0 # # Unless required by applicable law or agreed to in wri...
return self.app(env, start_response)
Predict the next line for this snippet: <|code_start|> self.authorized.append(req) if 'swift.authorize' not in req.environ: req.environ['swift.authorize'] = authorize req.headers.setdefault("User-Agent", "Melted Cheddar") status = [None] headers = [None] ...
'/v1/OPENIO/6C800/prefix/229/358493922_something')
Predict the next line for this snippet: <|code_start|># 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-2.0 # # Unless required by applicable law or ...
'Missing X-Amz-Server-Side-Encryption-Customer-Key header')
Given snippet: <|code_start|> self.assertEqual(resp[0], '200 OK') def test_fallback_listing(self): if self.filter_conf['stop_at_first_match'] == 'true': self.skipTest("require openio-sds >= 4.2") self.app.register('GET', '/v1/a/11122249?prefix=/111/222/...
def test_copy(self):
Continue the code snippet: <|code_start|># Copyright (c) 2015-2016 OpenStack Foundation # Copyright (c) 2018 OpenIO SAS # # 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.apach...
'-' + 'a' * 43)
Given snippet: <|code_start|># implied. # See the License for the specific language governing permissions and # limitations under the License. try: except ImportError: # Before Queens def get_response_headers(info): resp_headers = { 'X-Account-Container-Count': info['containers'], 'X-Acco...
if response_content_type != 'application/json':
Predict the next line for this snippet: <|code_start|> elif response_content_type.endswith('/xml'): output_list = ['<?xml version="1.0" encoding="UTF-8"?>', '<account name=%s>' % saxutils.quoteattr(account)] for (name, object_count, bytes_used, is_subdir, mtime) in listing: ...
def handle_account_not_found_autocreate(fnc):
Predict the next line for this snippet: <|code_start|> if response_content_type == 'application/json': data = [] for (name, object_count, bytes_used, is_subdir, mtime) in listing: if is_subdir: if not s3_buckets_only: data.append({'subdir': name}) ...
resp = HTTPNoContent(request=req, headers=resp_headers)
Given the following code snippet before the placeholder: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express...
class StreamRangeIterator(object):
Given the code snippet: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License ...
class StreamRangeIterator(object):
Continue the code snippet: <|code_start|># Copyright (c) 2010-2012 OpenStack Foundation # Copyright (c) 2016-2020 OpenIO SAS # # 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.apa...
SUPPORT_VERSIONING = False
Based on the snippet: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License fo...
class StreamRangeIterator(object):
Here is a snippet: <|code_start|># 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-2.0 # # Unless required by applicable law or agreed to in writing, so...
return ObjectController
Given the code snippet: <|code_start|># Copyright (c) 2010-2012 OpenStack Foundation # Copyright (c) 2016-2020 OpenIO SAS # # 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...
SUPPORT_VERSIONING = False
Given snippet: <|code_start|># Copyright (c) 2010-2012 OpenStack Foundation # Copyright (c) 2016-2020 OpenIO SAS # # 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/lice...
SLO = 'x-static-large-object'
Predict the next line for this snippet: <|code_start|> return '.'.join(parts) def _make_cookie_domain(domain): if domain is None: return None domain = _encode_idna(domain) if b':' in domain: domain = domain.split(b':', 1)[0] if b'.' in domain: return domain raise ValueEr...
jWlPKJvR2yhRI7xFPdzPuc6adXu6ovwXwRPXXnZHxlPtkSkqWHilsOrGrvcVWXgGP3daXomCj317
Given the code snippet: <|code_start|> def url_fix(s, charset='utf-8'): r"""Sometimes you get an URL by a user that just isn't a real URL because it contains unsafe characters like ' ' and so on. This function can fix some of the problems in a similar way browsers handle data entered by the user: ...
u'http://\xfcser:p\xe4ssword@\u2603.net/p\xe5th'
Here is a snippet: <|code_start|> :license: BSD, see LICENSE for more details. """ # A regular expression for what a valid schema looks like _scheme_re = re.compile(r'^[a-zA-Z0-9+-.]+$') # Characters that are safe in any part of an URL. _always_safe = (b'abcdefghijklmnopqrstuvwxyz' b'ABCDEFGHIJKLM...
@property
Using the snippet: <|code_start|> u'http://\xfcser:p\xe4ssword@\u2603.net/p\xe5th' Query strings are left unchanged: >>> uri_to_iri('/?foo=24&x=%26%2f') u'/?foo=24&x=%26%2f' .. versionadded:: 0.6 :param uri: The URI to convert. :param charset: The charset of the URI. :param errors: Th...
Examples for IRI versus URI:
Given snippet: <|code_start|> :param s: the string with the URL to fix. :param charset: The target charset for the URL if the url was given as unicode string. """ scheme, netloc, path, qs, anchor = url_parse(to_unicode(s, charset, 'replace')) path = url_quote(path, charset, safe='...
:param errors: The error handling on decode.
Given snippet: <|code_start|> .. versionadded:: 0.6 :param uri: The URI to convert. :param charset: The charset of the URI. :param errors: The error handling on decode. """ if isinstance(uri, tuple): uri = url_unparse(uri) uri = url_parse(to_unicode(uri, charset)) path = url_unqu...
.. versionadded:: 0.6
Predict the next line after this snippet: <|code_start|> u'http://\u2603.net/' >>> uri_to_iri(b'http://%C3%BCser:p%C3%A4ssword@xn--n3h.net/p%C3%A5th') u'http://\xfcser:p\xe4ssword@\u2603.net/p\xe5th' Query strings are left unchanged: >>> uri_to_iri('/?foo=24&x=%26%2f') u'/?foo=24&x=%26%2f' ...
and converts it into a URI.
Given the following code snippet before the placeholder: <|code_start|> 'http://de.wikipedia.org/wiki/Elf%20(Begriffskl%C3%A4rung)' :param s: the string with the URL to fix. :param charset: The target charset for the URL if the url was given as unicode string. """ scheme, netloc,...
:param uri: The URI to convert.
Using the snippet: <|code_start|> >>> url_fix(u'http://de.wikipedia.org/wiki/Elf (Begriffskl\xe4rung)') 'http://de.wikipedia.org/wiki/Elf%20(Begriffskl%C3%A4rung)' :param s: the string with the URL to fix. :param charset: The target charset for the URL if the url was given as unicod...
.. versionadded:: 0.6
Next line prediction: <|code_start|> if isinstance(s, text_type): s = s.replace(u'+', u' ') else: s = s.replace(b'+', b' ') return url_unquote(s, charset, errors) def url_fix(s, charset='utf-8'): r"""Sometimes you get an URL by a user that just isn't a real URL because it contains u...
Examples for URI versus IRI:
Given the following code snippet before the placeholder: <|code_start|> u'http://\xfcser:p\xe4ssword@\u2603.net/p\xe5th' Query strings are left unchanged: >>> uri_to_iri('/?foo=24&x=%26%2f') u'/?foo=24&x=%26%2f' .. versionadded:: 0.6 :param uri: The URI to convert. :param charset: The cha...
Examples for IRI versus URI:
Using the snippet: <|code_start|> u'http://\xfcser:p\xe4ssword@\u2603.net/p\xe5th' Query strings are left unchanged: >>> uri_to_iri('/?foo=24&x=%26%2f') u'/?foo=24&x=%26%2f' .. versionadded:: 0.6 :param uri: The URI to convert. :param charset: The charset of the URI. :param errors: Th...
Examples for IRI versus URI:
Based on the snippet: <|code_start|># -*- python -*- # pylogsparser - Logs parsers python library # # Copyright (C) 2011 Wallix Inc. # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; eit...
year = int(datetime.now().year)
Next line prediction: <|code_start|># -*- python -*- # pylogsparser - Logs parsers python library # # Copyright (C) 2011 Wallix Inc. # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by the # Free Software Foundation; eit...
d = datetime(year, *args)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Module tests.""" from __future__ import absolut...
{% block page_body %}{{ super() }}{% endblock %}
Next line prediction: <|code_start|># -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Module tests.""" from __future__ import abso...
{% block css %}{% endblock %}
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Module tests.""" from __future__ import abso...
{% block page_body %}{{ super() }}{% endblock %}
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2016-2019 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Module tests.""" from __fu...
{% extends 'invenio_deposit/edit.html' %}
Here is a snippet: <|code_start|> if self._label_encoder is None or self._onehot_encoder is None: self._label_encoder = [None] * len(Xenc.columns) self._onehot_encoder = [None] * len(Xenc.columns) del_columns = [] for i in range(len(Xenc.columns)): if Xenc.dt...
self._standardizer = StandardScaler().fit(X)
Here is a snippet: <|code_start|># coding: utf-8 class Introduction(Content): def __init__(self, parent=None, button_func=None, params=None): super().__init__(parent, 'Introduction', params) self.button_func = button_func path = os.path.abspath(os.path.dirname(__file__)) + '...
if self.params.lang == 'en':
Next line prediction: <|code_start|># coding: utf-8 class TypeOfTask(Content): def __init__(self, parent=None, button_func=None, params=None): super().__init__(parent, 'Task', params) self.button_func = button_func path = os.path.abspath(os.path.dirname(__file__)) + '/static...
if self.params.lang == 'en':
Using the snippet: <|code_start|> (dname, algorithm.estimator.__class__.__name__), bbox_inches='tight', dpi=75) plt.close() @classmethod def calc_scores(cls, model, data, min_clusters, max_clusters, random_state=0): silhouettes = [] davi...
return
Based on the snippet: <|code_start|> return inertia @classmethod def calc_gap(cls, model, data, min_clusters, max_clusters, num_iter=50, random_state=0, svd=True): if svd: U, s, V = np.linalg.svd(data, full_matrices=True) X = np.dot(data, V) else: ...
if svd:
Given snippet: <|code_start|># coding: utf-8 class Error(Content): def __init__(self, parent=None, button_func=None, params=None): super().__init__(parent, 'Error', params) <|code_end|> , continue by predicting the next line. Consider current file imports: from PyQt5.QtWidgets import (QHBoxLayo...
if self.params.lang == 'en':
Predict the next line after this snippet: <|code_start|># coding: utf-8 class BiasVariance(Content): def __init__(self, parent=None, button_func=None, params=None): super().__init__(parent, 'Bias and Variance', params) self.button_func = button_func path = os.path.abspath(os...
if self.params.lang == 'en':
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # TODO write it with pytest... def exception(): raise ValueError, "Test Test ä" def exception2(): raise ValueError, u"Test Test ä" def exception3(): raise ValueError, u"Test Test" def exception4(): raise ValueError, "Test Test" app = Qt...
widget.clicked.connect(exception)
Given the following code snippet before the placeholder: <|code_start|> self._addedBars = 0 self._minHeight = 50 self._width = parent.width() * 0.38 self._margin = margin self._totalProgress = 0 self.initUi() for worker in workers: self._addProgressBa...
self.glayout.addWidget(self.totalProgressBar, 0, 0, 1, 1)
Here is a snippet: <|code_start|> class OverlayProgressWidget(QtGui.QFrame): def __init__(self, parent, workers=[], debug=True, margin=0): super(OverlayProgressWidget, self).__init__(parent) self._debug = debug self._workers = workers self._detailProgressBars = [] self._added...
self._margin = margin
Given snippet: <|code_start|> separator = u'-' * 80 logFile = os.path.join(tempfile.gettempdir(), "error.log") notice = """An unhandled exception occurred. Please report the problem.\n""" notice += """A log has been written to "{}".\n\nError information:""".format(logFile) timeString = time.strftime...
if not _isQAppRunning():
Given the following code snippet before the placeholder: <|code_start|> class ProgressWorker(QtCore.QObject): progressChanged = Signal(int) # set value of OverlayProgressView finished = Signal() <|code_end|> , predict the next line using imports from the current file: from pandasqt.compat import Qt...
def __init__(self, name):
Given the code snippet: <|code_start|> class ProgressWorker(QtCore.QObject): progressChanged = Signal(int) # set value of OverlayProgressView finished = Signal() <|code_end|> , generate the next line using the imports in this file: from pandasqt.compat import QtCore, QtGui, Qt, Signal, Slot and co...
def __init__(self, name):
Continue the code snippet: <|code_start|> class ProgressWorker(QtCore.QObject): progressChanged = Signal(int) # set value of OverlayProgressView finished = Signal() <|code_end|> . Use current file imports: from pandasqt.compat import QtCore, QtGui, Qt, Signal, Slot and context (classes, functions,...
def __init__(self, name):
Given the code snippet: <|code_start|>from __future__ import with_statement # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_fi...
def run_migrations_offline():
Based on the snippet: <|code_start|> # noinspection PyUnusedLocal @app.teardown_appcontext def shutdown_session(exception=None): """Remove the database session at the end of the request or when the application shuts down. This is needed to use SQLAlchemy in a declarative way.""" db_session.remove() def g...
if g.player and g.player.locked:
Using the snippet: <|code_start|>if config.LOG_FILE: file_handler = RotatingFileHandler(config.LOG_FILE, maxBytes=5 * 1024 * 1024, backupCount=5) file_handler.setLevel(logging.INFO) logger.setLevel(logging.INFO) file_handler.setFormatter(logging.Formatter( '%(asctime)s %(levelname)s: %(message)...
return session['_csrf_token']
Here is a snippet: <|code_start|>logger = logging.getLogger(__name__) if config.LOG_FILE: file_handler = RotatingFileHandler(config.LOG_FILE, maxBytes=5 * 1024 * 1024, backupCount=5) file_handler.setLevel(logging.INFO) logger.setLevel(logging.INFO) file_handler.setFormatter(logging.Formatter( '...
session['_csrf_token'] = hashlib.sha1(os.urandom(64)).hexdigest()
Predict the next line after this snippet: <|code_start|> db_session.remove() def generate_csrf_token(): if '_csrf_token' not in session: session['_csrf_token'] = hashlib.sha1(os.urandom(64)).hexdigest() return session['_csrf_token'] app.jinja_env.globals['csrf_token'] = generate_csrf_token # de...
def inject_constants():
Given the code snippet: <|code_start|> response = make_response(buf.getvalue()) response.headers['Content-Type'] = 'application/tar' response.headers['Content-Disposition'] = 'attachment; filename=' + secure_filename("replays.tar") return response @app.route('/payout/<clan>') @require_login @require_r...
return [b for b in ordered_battles if battle.date - before_dt <= b.date <=
Here is a snippet: <|code_start|> if request.method == "POST": token = session.pop('_csrf_token', None) if not token or token != request.form.get('_csrf_token'): flash('Invalid CSRF token. Please try again or contact an administrator for help.') return redirect(url_for('index'...
def lookup_current_user():
Based on the snippet: <|code_start|> db_session.remove() def generate_csrf_token(): if '_csrf_token' not in session: session['_csrf_token'] = hashlib.sha1(os.urandom(64)).hexdigest() return session['_csrf_token'] app.jinja_env.globals['csrf_token'] = generate_csrf_token # decorates a decorator ...
def inject_constants():
Here is a snippet: <|code_start|> "exists": False }, { "challenge": 40, "step": 1 }, { "challenge": 42, "step": 1, "exists": False ...
"children": [
Using the snippet: <|code_start|>chest = { "name": ".chest", "challenges": [ { "challenge": 15, "step": 1 } ], "children": [ { "name": "CAT", "contents": get_story_file("CAT") }, { "name": "CD", ...
"children": [
Continue the code snippet: <|code_start|># challenge_24.py # # Copyright (C) 2014-2016 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A chapter of the story # ---------------------------------------------------------------------------------------- class Step1(StepTemplateMkdir...
_("{{rb:Look around with}} {{yb:ls}}{{rb:.}}")
Based on the snippet: <|code_start|> _("{{rb:Look around with}} {{yb:ls}}{{rb:.}}") ] deleted_items = ["~/town/Eleanor"] file_list = [{"path": "~/town/east/Eleanor"}] companion_speech = _("Eleanor: {{Bb:I can't see my parents anywhere...but there's a weird building there.}}") def next(self)...
return 24, 3
Given snippet: <|code_start|> hints = [ _("{{rb:Use}} {{yb:cd library}} {{rb:to go inside the library.}}") ] companion_speech = _("Eleanor: {{Bb:I love the library! Let's go inside!}}") def block_command(self, line): return unblock_cd_commands(line) def next(self): return 2...
file_list = [
Given the following code snippet before the placeholder: <|code_start|> _("{{Bb:\"What is that}} {{lb:NANO}} {{Bb:paper?\"}}\n"), _("{{Bb:\"Let's}} {{lb:examine}} {{Bb:it.\"}}") ] start_dir = "~/town/east/library" end_dir = "~/town/east/library" commands = [ "cat public-section/N...
start_dir = "~/town/east/library"
Given the code snippet: <|code_start|> commands = [ "ls", "ls -a" ] deleted_items = ["~/town/east/Eleanor"] file_list = [ { "path": "~/town/east/library/Eleanor", "contents": get_story_file("Eleanor") } ] companion_speech = _("Eleanor: {{Bb:...
"{{lb:look inside}}{{Bb:.\"}}")
Using the snippet: <|code_start|> "step": 1, "exists": False }, { "challenge": 13, "step": 2 }, { "challenge": 13, "step": 5, "exists": False }, { "challenge": 14, "...
}
Predict the next line after this snippet: <|code_start|> class PlayerLocation: def __init__(self, start_dir, end_dir): self.__fake_path = start_dir self.__end_dir = end_dir def get_fake_path(self): return self.__fake_path def get_real_path(self): return generate_real_path(...
def set_fake_path(self, fake_path):
Predict the next line after this snippet: <|code_start|> "step": 6, "exists": False }, { "challenge": 12, "step": 1 }, { "challenge": 23, "step": 4, "exists": False } ] } dog_hidden_shelter = ...
"step": 2
Predict the next line for this snippet: <|code_start|> "challenges": [ { "challenge": 21, "step": 10 } ] } ] }, { "name":...
"name": "hammer",
Using the snippet: <|code_start|> { "user": _("\"Why don't you like Bernard?\""), "clara": \ _("Clara: {{Bb:\"He makes very simple tools and charges a fortune " +\ "for them.}}" +\ "\n{{Bb:His father was a very clever man and spent all " +\ ...
story_replies["echo 1"][step - 2]["clara"],
Based on the snippet: <|code_start|> "clara": \ _("Clara: {{Bb:\"I heard a bell ring, and saw the " +\ "lead librarian disappear in front of me. I was " +\ "so scared I ran away, and found this}} {{bb:.cellar}}" +\ "{{Bb:.\"}}") }, ...
"clara": \
Given snippet: <|code_start|> poss_step = challenge_dict["step"] if self.__challenge_step_earlier_or_equal(challenge, step, poss_challenge, poss_step): challenge_data = challenge_dict if self.__challenge_step_higher(lower_bound_challenge, lower_bound_step, poss_ch...
def mkdir_p(path):
Next line prediction: <|code_start|> @staticmethod def __get_default_owner(): return os.environ['LOGNAME'] def __get_contents_path(self, tree): if self.KEY_CONTENTS not in tree: raise Exception("No contents associated with the file: " + tree["name"]) return tree[self.KEY...
return oct(os.stat(path).st_mode & 0777)
Given the code snippet: <|code_start|> challenge_data = {} for challenge_dict in tree[self.KEY_CHALLENGES]: if self.KEY_CHALLENGE not in challenge_dict or self.KEY_STEP not in challenge_dict: raise Exception("missing challenge key in " + str(challenge_dict)) poss_c...
if not os.path.exists(path): # check permissions
Predict the next line for this snippet: <|code_start|> "challenges": [ { "challenge": 36, "step": 1, "exists": False } ] }, { "name": "scroll", "contents": get_story...
"challenge": 32,
Here is a snippet: <|code_start|># # Copyright (C) 2014, 2015 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A terminal for one of the challenges class TerminalSudo(TerminalRm): terminal_commands = [ "ls", "cat", "cd", "mv", "echo", "mkdir", "nano", "chmod", "rm", "s...
return
Based on the snippet: <|code_start|># terminal_nano.py # # Copyright (C) 2014-2016 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A terminal for one of the challenges class TerminalNano(TerminalMkdir): terminal_commands = ["ls", "cat", "cd", "mv", "echo", "mkdir", "nano"...
self._step_nano = step.get_nano_logic()
Based on the snippet: <|code_start|> def do_nano(self, line): ########################################## # set up step_nano self._step_nano.set_nano_running(True) self._step_nano.opened_nano(line) # Read contents of the file text = self.read_goal_contents() s...
)
Given the code snippet: <|code_start|> ] file_list = [ { "path": "~/town/east/shed-shop/Bernards-hat", "contents": get_story_file("bernards-hat") } ] companion_speech = _("Eleanor: {{Bb:......}}") def next(self): return 30, 2 class Step2(StepNano): ...
def next(self):
Given the following code snippet before the placeholder: <|code_start|> _("{{Bb:\"}}{{gb:%s}}" +\ "{{Bb:, you look like you can take care of yourself, but " +\ "I don't feel happy with Eleanor going outside.\"}}")\ % os.environ['LOGNAME'], _("\n{{Bb:\"}}{{gb:%s}}{{Bb:, will you le...
)
Continue the code snippet: <|code_start|> "ls -a" ] hints = [ _("{{rb:Use}} {{yb:ls}} {{rb:to check everyone is still present.}}") ] deleted_items = [ "~/town/east/shed-shop/Bernard" ] file_list = [ { "path": "~/town/east/shed-shop/Bernards-hat", ...
hints = [
Using the snippet: <|code_start|> greenhouse = { "name": "greenhouse", "children": [ { "name": "carrots", "contents": get_story_file("carrots") }, { "name": "pumpkin", "contents": get_story_file("pumpkin") }, { "...
"name": "onion",
Continue the code snippet: <|code_start|> "step": 3 }, { "challenge": 42, "step": 6, "exists": False } ] ...
{
Here is a snippet: <|code_start|># terminal_cd.py # # Copyright (C) 2014-2016 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # The a terminal for one of the challenges def not_locked(directory): uid = os.geteuid() gid = os.getegid() s = os.stat(directory) mode = ...
return (
Next line prediction: <|code_start|> def not_locked(directory): uid = os.geteuid() gid = os.getegid() s = os.stat(directory) mode = s[stat.ST_MODE] return ( ((s[stat.ST_UID] == uid) and (mode & stat.S_IXUSR)) or ((s[stat.ST_GID] == gid) and (mode & stat.S_IXGRP)) or (mode & s...
print (_("Nice try! But you entered an unexpected destination path."))
Given the following code snippet before the placeholder: <|code_start|># terminal_cd.py # # Copyright (C) 2014-2016 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # The a terminal for one of the challenges def not_locked(directory): uid = os.geteuid() gid = os.getegid() ...
((s[stat.ST_UID] == uid) and (mode & stat.S_IXUSR)) or
Next line prediction: <|code_start|># # Animation.py # # Copyright (C) 2014-2017 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A simple running bird animation for terminal quest, heavily based on the rabbit animation. # # class Animation: def __init__(self, filename): ...
self.__init_curses()
Given the following code snippet before the placeholder: <|code_start|> _("{{rb:Use}} {{yb:cat best-horn-in-the-world.sh}} {{rb:to examine the " +\ "tool.}}") ] companion_speech = ( _("Eleanor: {{Bb:I think this tool is a bit broken.}}") ) def check_command(self, line): ...
_("Eleanor: {{Bb:\"If we need extra help, we can go to the library, it was just outside.\"}}"),
Here is a snippet: <|code_start|> ] companion_speech = _("Eleanor: {{Bb:I don't think this will work...}}") def next(self): return 25, 5 class Step5(StepTemplateMkdir): story = [ _("You get the error {{yb:mkdir: cannot create directory `shed': " +\ "File exists}}"), _("...
"cat best-horn-in-the-world.sh",
Given the code snippet: <|code_start|>#!/usr/bin/env python # # Copyright (C) 2014, 2015 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A terminal for one of the challenges class TerminalRm(TerminalChmod): terminal_commands = [ "ls", "cat", "cd", "mv", "echo", "mkd...
return completions
Based on the snippet: <|code_start|>#!/usr/bin/env python # # Copyright (C) 2014, 2015 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # A terminal for one of the challenges class TerminalRm(TerminalChmod): terminal_commands = [ "ls", "cat", "cd", "mv", "echo", "mkdir...
]
Given the following code snippet before the placeholder: <|code_start|># rabbithole.py # # Copyright (C) 2014-2017 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # cage = { "name": "cage", "challenges": [ { "challenge": 0, "step": 1, ...
],
Predict the next line after this snippet: <|code_start|># east.py # # Copyright (C) 2014-2017 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # restaurant = { "name": "restaurant", "children": [ { "name": "", "children": [ { ...
{
Predict the next line for this snippet: <|code_start|> "exists": False }, { "challenge": 46, "step": 1 } ] } edith = { "name": "Edith", "contents": get_story_file("Edith"), "challenges": [ { "challenge": 0, "step...
{
Given snippet: <|code_start|> def set_goal_nano_end_content(self, goal_nano_end_content): self.__goal_nano_end_content = goal_nano_end_content def get_goal_nano_end_content(self): return self.__goal_nano_end_content def get_last_prompt(self): return self.__last_nano_prompt def...
_("\n{{gb:Type}} {{yb:%s}} {{gb:and press}} {{yb:Enter}}") % self.get_goal_nano_save_name()
Based on the snippet: <|code_start|># MessageServer.py # # Copyright (C) 2014-2016 Kano Computing Ltd. # License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 # # Controls communicating between the GUI and the terminal class MessageServer: HOST = "localhost" PORT = 9959 def __init__(self, queue, w...
self.__exiting = True
Using the snippet: <|code_start|> "name": "ECHO", "contents": get_story_file("ECHO"), }, { "name": "map", "contents": get_story_file("map"), } ] } parents_room = { "name": "parents-room", "children": [ { "name": "pic...
]