Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Next line prediction: <|code_start|>"""SPADL schema for Wyscout data.""" class WyscoutCompetitionSchema(CompetitionSchema): """Definition of a dataframe containing a list of competitions and seasons.""" country_name: Series[str] competition_gender: Series[str] class WyscoutGameSchema(GameSchema): ...
class WyscoutPlayerSchema(PlayerSchema):
Given the code snippet: <|code_start|>"""SPADL schema for Wyscout data.""" class WyscoutCompetitionSchema(CompetitionSchema): """Definition of a dataframe containing a list of competitions and seasons.""" country_name: Series[str] competition_gender: Series[str] class WyscoutGameSchema(GameSchema): ...
class WyscoutTeamSchema(TeamSchema):
Next line prediction: <|code_start|> # | op_1 | # | op_2 | return rule_2 if op_2_from_in_op_1 and op_1_to_in_op_2: # overlap 1 # | op_1 | # | op_2 | return { "property": rule_1["property"], "oper...
format_decision_rules([rule_1]), format_decision_rules([rule_2])
Here is a snippet: <|code_start|> def _is_is_reducer(rule_1, rule_2): if rule_1["operand"] and (rule_1["operand"] != rule_2["operand"]): raise CraftAiError( "Operator '{}' can't have different value. Set to '{}' and receive '{}'".format( <|code_end|> . Write the next line using the current fil...
OPERATORS["IS"], rule_1["operand"], rule_2["operand"]
Given the code snippet: <|code_start|> expectations_files = os.listdir(EXPECTATIONS_DIR) for expectations_file in expectations_files: if os.path.splitext(expectations_file)[1] == ".json": # Loading the expectations for this tree with open(os.path.join(EXPECTAT...
self.assertRaises(errors.CraftAiError, format_decision_rules, rules)
Given the code snippet: <|code_start|> expectations_files = os.listdir(EXPECTATIONS_DIR) for expectations_file in expectations_files: if os.path.splitext(expectations_file)[1] == ".json": # Loading the expectations for this tree with open(os.path.join(EXPECTAT...
self.assertRaises(errors.CraftAiError, format_decision_rules, rules)
Continue the code snippet: <|code_start|> HERE = os.path.abspath(os.path.dirname(__file__)) DATA_DIR = os.path.join(HERE, "data", "interpreter") TREES_DIR = os.path.join(DATA_DIR, "decide", "trees") PATH_DIR = os.path.join(DATA_DIR, "tree_computations_expectations", "get_paths") NEIGHBOURS_DIR = os.path.join( DA...
self.assertRaises(errors.CraftAiError, extract_output_tree, tree)
Given snippet: <|code_start|> tree = json.load(f) self.assertIsInstance(extract_output_tree(tree), dict) def test_extract_output_tree_specific_output(self): path = os.path.join(DATA_DIR, "decide", "trees", "v2", "oneColor.json") tree = None with open(path) as f: ...
results = extract_decision_paths_from_tree(tree)
Predict the next line for this snippet: <|code_start|> # Loading the json tree tree = None with open(os.path.join(TREES_DIR, version, filename)) as f: tree = json.load(f) results = extract_decision_paths_from_tree(tree) ...
result = extract_decision_path_neighbors(
Predict the next line after this snippet: <|code_start|> HERE = os.path.abspath(os.path.dirname(__file__)) DATA_DIR = os.path.join(HERE, "data", "interpreter") TREES_DIR = os.path.join(DATA_DIR, "decide", "trees") PATH_DIR = os.path.join(DATA_DIR, "tree_computations_expectations", "get_paths") NEIGHBOURS_DIR = os.pa...
self.assertRaises(errors.CraftAiError, extract_output_tree, tree)
Predict the next line for this snippet: <|code_start|># To avoid conflicts between python's own 'time' and this 'time.py' # cf. https://stackoverflow.com/a/28854227 from __future__ import absolute_import _EPOCH = datetime(1970, 1, 1, tzinfo=pyutc) class Time(object): """Handles time in a useful way for craft...
raise CraftAiTimeError("You must provide at least one timezone")
Using the snippet: <|code_start|> # Handle format like : Time().timezone _time = datetime.fromtimestamp(timestamp, get_localzone()) except (OverflowError, OSError) as e: raise CraftAiTimeError( """Unable to instantiate T...
elif is_timezone(timezone):
Using the snippet: <|code_start|> except (OverflowError, OSError) as e: raise CraftAiTimeError( """Unable to instantiate Time from given timestamp. {}""".format( e.__str__() ) ) ...
offset = timezone_offset_in_sec(timezone)
Predict the next line for this snippet: <|code_start|> JWT_IO_EXAMPLE = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" # noqa: E501 class TestJwtDecode(unittest.TestCase): def test_decode_works(self): <|code...
(payload, _, header, _) = jwt_decode(JWT_IO_EXAMPLE)
Predict the next line after this snippet: <|code_start|> JWT_IO_EXAMPLE = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ" # noqa: E501 class TestJwtDecode(unittest.TestCase): def test_decode_works(self): ...
self.assertRaises(CraftAiTokenError, jwt_decode, "not a jwt")
Here is a snippet: <|code_start|> def test_reduce_decision_rules_tests_generator(self): expectations_files = os.listdir(EXPECTATIONS_DIR) for expectations_file in expectations_files: if os.path.splitext(expectations_file)[1] == ".json": with open(os.path.join(EXPECTATIONS_...
self.assertRaises(errors.CraftAiError, reduce_decision_rules, rules)
Given snippet: <|code_start|> def test_reduce_decision_rules_tests_generator(self): expectations_files = os.listdir(EXPECTATIONS_DIR) for expectations_file in expectations_files: if os.path.splitext(expectations_file)[1] == ".json": with open(os.path.join(EXPECTATIONS_DIR,...
self.assertRaises(errors.CraftAiError, reduce_decision_rules, rules)
Predict the next line after this snippet: <|code_start|> return "{} to {}".format(formatted_month_from, formatted_month_to) def _gte_formatter(property_name, operand, operand_formatter): if property_name: return "'{}' >= {}".format(property_name, operand_formatter(operand)) return ">= {}".format(op...
raise CraftAiError(
Continue the code snippet: <|code_start|> if (month_to - month_from == 1) or (month_from == 12 and month_to == 1): # One month in the interval if property_name: return "'{}' is {}".format(property_name, formatted_month_from) return formatted_month_from formatted_month_to = o...
OPERATORS["IS"]: {TYPE_ANY: _is_formatter},
Next line prediction: <|code_start|> "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ] def _time_formatter(time): if isinstance(time, datetime.datetime): if time.second == 0: return time.strftime("%H:%M") return time.strftime("%H:%M:%S"...
TYPES["continuous"]: lambda number: "{:.2f}".format(number).rstrip("0").rstrip("."),
Given the code snippet: <|code_start|> "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ] def _time_formatter(time): if isinstance(time, datetime.datetime): if time.second == 0: return time.strftime("%H:%M") return time.strfti...
TYPE_ANY: lambda value: value,
Here is a snippet: <|code_start|> # Initial code retrieved from PyJWT # cf. https://github.com/jpadilla/pyjwt/blob/ceff941/jwt/utils.py#L33-L42 def base64url_decode(base64_input): if isinstance(base64_input, str): base64_input = base64_input.encode("ascii") rem = len(base64_input) % 4 if rem > 0...
raise CraftAiTokenError(
Next line prediction: <|code_start|> return leaf # Finding the first element in this node's childrens matching the # operator condition with given context matching_child = InterpreterV1._find_matching_child(node, context) if not matching_child: prop = node.get("c...
except CraftAiDecisionError as err:
Based on the snippet: <|code_start|> ), TYPES["day_of_week"]: lambda value: ( isinstance(value, int) and value >= 0 and value <= 6 ), TYPES["day_of_month"]: lambda value: ( isinstance(value, int) and value >= 1 and value <= 31 ), TYPES["month_of_year"]: lambda value: ( isi...
raise CraftAiNullDecisionError(
Continue the code snippet: <|code_start|> final_result["standard_deviation"] = result.get("standard_deviation") return final_result @staticmethod def _find_matching_child(node, context): for child in node["children"]: property_name = child["decision_rule"]["property"] ...
if OPERATORS_FUNCTION[operator](context_value, operand):
Here is a snippet: <|code_start|> _DECISION_VERSION = "1.1.0" _VALUE_VALIDATORS = { TYPES["continuous"]: lambda value: isinstance(value, numbers.Real), TYPES["enum"]: lambda value: isinstance(value, str), <|code_end|> . Write the next line using the current file imports: import numbers from craft_ai.errors i...
TYPES["timezone"]: lambda value: is_timezone(value),
Given the code snippet: <|code_start|> :return: error corresponding to the status code. :rtype: Error. """ if status_code == 1007: err = CraftAiBadRequestError(message) elif status_code == 1003: err = CraftAiNotFoundError(message) elif status_code == 1002: err = CraftAiIn...
raise CraftAiCredentialsError(e)
Predict the next line for this snippet: <|code_start|> def get_error_from_websocket_status(status_code, message): """Give the error corresponding to the status code for websocket. :param int status_code: status code of the response to a request. :param str message: error message given by the response....
err = CraftAiBadRequestError(message)
Predict the next line after this snippet: <|code_start|> def get_error_from_websocket_status(status_code, message): """Give the error corresponding to the status code for websocket. :param int status_code: status code of the response to a request. :param str message: error message given by the respons...
err = CraftAiNotFoundError(message)
Given the following code snippet before the placeholder: <|code_start|> def get_error_from_websocket_status(status_code, message): """Give the error corresponding to the status code for websocket. :param int status_code: status code of the response to a request. :param str message: error message given...
err = CraftAiUnknownError(message)
Given the following code snippet before the placeholder: <|code_start|> def get_error_from_websocket_status(status_code, message): """Give the error corresponding to the status code for websocket. :param int status_code: status code of the response to a request. :param str message: error message given...
err = CraftAiInternalError(message)
Using the snippet: <|code_start|> if ( not isinstance(distribution, list) and "standard_deviation" in distribution ): leaf["standard_deviation"] = distribution.get("standard_deviation") leaf["min"] = distribution.get("min") ...
except CraftAiDecisionError as err:
Given the code snippet: <|code_start|> ), TYPES["month_of_year"]: lambda value: ( isinstance(value, int) and value >= 1 and value <= 12 ), } ############################ # Interpreter for V2 Trees # ############################ class InterpreterV2(object): @staticmethod def decide(configur...
raise CraftAiNullDecisionError(
Predict the next line after this snippet: <|code_start|> new_variance = None new_mean = None new_size = None for mean, std, size in zip(values, stds, sizes): variance = std * std if new_mean is None: new_variance = variance new_mean ...
if not isinstance(operator, str) or operator not in OPERATORS.values():
Based on the snippet: <|code_start|> new_variance = variance new_mean = mean new_size = size continue total_size = 1.0 * size + new_size if total_size == 0: continue new_variance = (1.0 / (total_size - 1.0...
if OPERATORS_FUNCTION[operator](context_value, operand):
Given the following code snippet before the placeholder: <|code_start|> _DECISION_VERSION = "2.0.0" _VALUE_VALIDATORS = { TYPES["continuous"]: lambda value: isinstance(value, numbers.Real), TYPES["enum"]: lambda value: isinstance(value, str), TYPES["boolean"]: lambda value: isinstance(value, bool), <|code...
TYPES["timezone"]: lambda value: is_timezone(value),
Predict the next line for this snippet: <|code_start|> return path0[:-1] == path1[:-1] and path0 != path1 def _get_neighbours(paths, decision_path): """ Collect all neighbours paths of the given decision path param: paths: paths aggregator param: decision_path: decision path to get neighbours from ...
raise CraftAiError(
Here is a snippet: <|code_start|> DUMMY_COLUMN_NAME = "CraftGeneratedDummy" SELECTED_NODE_REGEX = "^0(-\\d*)*$" def format_input(val): <|code_end|> . Write the next line using the current file imports: import json import re import string import importlib import pandas as pd from random import choice from semver im...
if val == MISSING_VALUE:
Here is a snippet: <|code_start|> DUMMY_COLUMN_NAME = "CraftGeneratedDummy" SELECTED_NODE_REGEX = "^0(-\\d*)*$" def format_input(val): if val == MISSING_VALUE: return None <|code_end|> . Write the next line using the current file imports: import json import re import string import importlib import pand...
if val == OPTIONAL_VALUE:
Given the code snippet: <|code_start|> for folded_node in folded_nodes: if not isinstance(folded_node, str) and not re.compile( SELECTED_NODE_REGEX ).match(folded_node): raise CraftAiError( """Invalid folded node format given, tt should ...
version=REACT_CRAFT_AI_DECISION_TREE_VERSION,
Predict the next line after this snippet: <|code_start|> </script> <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin defer> </script> <script src="https://unpkg.com/react-craft-ai-decision-tree@0.0.26" crossorigin defer> </script> <style...
raise CraftAiError("A strictly positive height value must be given.")
Here is a snippet: <|code_start|>try: except ImportError: class TestPostgresToS3Transfer(object): def test_its_created_successfully(self): <|code_end|> . Write the next line using the current file imports: import unittest.mock as mock import mock import subprocess import dags.utils.helpers as helpers fro...
operator = PostgresToS3Transfer(
Here is a snippet: <|code_start|>try: except ImportError: class TestHerokuOperator(object): def test_its_created_successfully(self): <|code_end|> . Write the next line using the current file imports: import unittest.mock as mock import mock import pytest import airflow.exceptions import requests.exceptio...
operator = HerokuOperator(
Given the code snippet: <|code_start|> class TestPythonSensor(object): @pytest.mark.parametrize('return_value, result', [ ('a string', False), (42, False), (0, False), (False, False), (True, True), ]) def test_poke_returns_false_if_callable_doesnt_return_true(self, r...
sensor = PythonSensor(
Continue the code snippet: <|code_start|>try: except ImportError: class TestDockerCLIOperator(object): def test_its_created_successfully(self): <|code_end|> . Use current file imports: import unittest.mock as mock import mock import collections import io import re import shlex import subprocess import py...
operator = DockerCLIOperator(
Next line prediction: <|code_start|> raw, options=cmarkgfmOptions.CMARK_OPT_UNSAFE ), } except ImportError: warnings.warn(_EXTRA_WARNING) variants = {} # Make code fences with `python` as the language default to highlighting as # Python 3. _LANG_ALIASES = { 'python': 'python3', } d...
cleaned = clean(highlighted)
Predict the next line for this snippet: <|code_start|> MD_FIXTURES = [ (fn, os.path.splitext(fn)[0] + ".html", variant) for variant in variants for fn in glob.iglob( os.path.join( os.path.dirname(__file__), "fixtures", "test_" + variant + "*.md" ) )...
assert render(md_markup, variant=variant) == expected
Using the snippet: <|code_start|> Checks if the long string fields are reST-compliant. """ # Warn that this command is deprecated # Don't use self.warn() because it will cause the check to fail. Command.warn( self, "This command has been deprecated. Use `tw...
markup = render(data, stream=stream)
Given the code snippet: <|code_start|># Copyright 2015 Donald Stufft # # 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 appl...
return clean(rendered, tags=["br"])
Given the code snippet: <|code_start|> @pytest.mark.skipif(variants, reason="Extra is installed") @pytest.mark.parametrize("variant", ('GFM', 'CommonMark')) def test_no_extra(variant): with pytest.warns(UserWarning) as warnings: <|code_end|> , generate the next line using the imports in this file: import pytest ...
assert render('Hello', variant=variant) is None
Given the code snippet: <|code_start|> # Use the short form of syntax highlighting so that the generated # Pygments CSS can be used to style the output. "syntax_highlight": "short", # Maximum width (in characters) for one-column field names. # 0 means "no limit" "field_name_limit": 0, } def re...
return clean(rendered)
Given the code snippet: <|code_start|> @pytest.mark.parametrize( ("rst_filename", "html_filename"), [ (fn, os.path.splitext(fn)[0] + ".html") for fn in glob.glob( os.path.join(os.path.dirname(__file__), "fixtures", "test_*.rst") ) ], ) def test_rst_fixtures(rst_filenam...
out = render(rst_markup)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class SystemCases(unittest.TestCase): @unittest.skipIf(os.getuid()==0, "Test mustn't be run as superuser") def test_is_running_no_access(self): with self.assertRaises(OSError): <|code_end|> , generate the next line using the imports in t...
is_running(1)
Predict the next line for this snippet: <|code_start|> self.assertFalse(is_running(pid)) self.assertLess(finished-started, 1) else: doublefork(pidfile, '/dev/null', '.', 0) time.sleep(3) os._exit(os.EX_OK) def test_terminate_false(self): pi...
safe_makedirs(file_path)
Predict the next line for this snippet: <|code_start|> is_running(1) def test_is_running_true(self): pid = os.fork() if pid: self.assertTrue(is_running(pid)) # Cleaning up os.kill(pid, signal.SIGKILL) os.waitpid(pid, 0) else: ...
success = terminate(pid, signal.SIGKILL, 0.5)
Predict the next line after this snippet: <|code_start|> os._exit(0) def test_terminate_child_true(self): pid = os.fork() if pid: started = time.time() success = terminate(pid, signal.SIGKILL, 0.5) finished = time.time() self.assertTrue(suc...
doublefork(pidfile, '/dev/null', '.', 0)
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- __all__ = ['URL'] if six.PY2: else:# pragma: no cover; we check coverage only in python2 part def construct_url(path, query, host, port, scheme, fragment=None): <|code_end|> , predict the immediate next line with the help of imports: import six from u...
query = ('?' + '&'.join('{}={}'.format(urlquote(k), urlquote(v))
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- def check_terms(conv, value): if not value: raise convs.ValidationError('Please, accept the terms os service') return value class FileForm(Form): fields = [ Field('accept', labe...
widget=widgets.CheckBox()),
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class HomeView(AdminIndexView): @expose("/") def index(self): return self.render('admin/home.html') class PostView(ModelView): column_default_sort = ('date', True) column_searchable_list = ('name', 'title', 'content') column...
(models.PostStatus.PUBLISH, 'Publish'),
Next line prediction: <|code_start|> form_widget_args = { 'title': { 'class': 'input-xxlarge' }, 'excerpt': { 'class': 'input-xxlarge' }, 'content': { 'rows': 10, 'class': 'input-xxlarge' } } form_args = { ...
admin.add_view(ModelView(models.Blog, db.session, category="Blog"))
Predict the next line after this snippet: <|code_start|> logger = app.logger @manager.command def create_db(): db.create_all() logger.info("Database was created") @manager.command def drop_db(remove=False, force=False): if not force: if not prompt_bool("Are you sure?"): return d...
create_admin()
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- logger = app.logger @manager.command def create_db(): <|code_end|> , generate the next line using the imports in this file: from subprocess import call from flask_debugtoolbar import DebugToolbarExtension from flask_script import prompt_bool from ato...
db.create_all()
Using the snippet: <|code_start|> @app.route("/uploads/<filename>") def uploaded_file(filename): return send_from_directory(app.config["UPLOADS_PATH"], filename) @app.route("/feed/atom/") def feed_latest_posts(): feed_url = request.url url_root = request.url_root.strip("/") if "SITE_URL" in app.conf...
posts = Post.query.order_by(desc(Post.date)).\
Using the snippet: <|code_start|> @app.route("/uploads/<filename>") def uploaded_file(filename): return send_from_directory(app.config["UPLOADS_PATH"], filename) @app.route("/feed/atom/") def feed_latest_posts(): feed_url = request.url url_root = request.url_root.strip("/") if "SITE_URL" in app.conf...
filter(Post.status == PostStatus.PUBLISH).\
Continue the code snippet: <|code_start|> @app.route("/uploads/<filename>") def uploaded_file(filename): return send_from_directory(app.config["UPLOADS_PATH"], filename) @app.route("/feed/atom/") def feed_latest_posts(): feed_url = request.url url_root = request.url_root.strip("/") if "SITE_URL" in ...
filter(Post.type == PostType.POST)
Here is a snippet: <|code_start|> def gen_post_status(): """ Show only published posts outside debug. """ if not app.config["DEBUG"]: <|code_end|> . Write the next line using the current file imports: from sqlalchemy import or_, and_ from atomicpress.app import app from atomicpress.models import Pos...
post_status = and_(Post.status == PostStatus.PUBLISH)
Continue the code snippet: <|code_start|> def gen_post_status(): """ Show only published posts outside debug. """ if not app.config["DEBUG"]: <|code_end|> . Use current file imports: from sqlalchemy import or_, and_ from atomicpress.app import app from atomicpress.models import Post, PostStatus and...
post_status = and_(Post.status == PostStatus.PUBLISH)
Next line prediction: <|code_start|> __default = { "host": "", "username": None, "password": None, } def set_default(host=None, username=None, password=None, **kwargs): __default["host"] = host __default["username"] = username __default["password"] = password def sync_folde...
client = FtpSync(**__default)
Given snippet: <|code_start|> from_ = 0 if size is not None: top_buckets = top_buckets[0:size] else: size = total first_page = self.new_first_page() buckets = [ReportBucket( search=first_page, ...
class ReportThreshold(Threshold):
Using the snippet: <|code_start|> #if from_ is not None: #assert from_ >= 0 #actual_size = actual_size + from_ #if size is not None: #assert size >= 0 #(query["aggs"]["top_buckets_filtered"]["aggs"] #["top_buckets"]["terms"]["size"]) = act...
buckets = [ReportBucket(
Here is a snippet: <|code_start|>class RestClient: def __init__(self, root_url="http://localhost:5000/"): self.origin = root_url.rstrip('/') @property def root_url(self): """ The root URL of the REST service. """ return self.origin + '/' def path_to(self, *...
crash = Crash(crash)
Predict the next line after this snippet: <|code_start|> # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This p...
self.searcher = MoreLikeThis(config=self.config, index=self.index)
Predict the next line after this snippet: <|code_start|># This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should ha...
matching_buckets = Buckets()
Predict the next line after this snippet: <|code_start|># This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This pr...
t: ReportThreshold(self.search, t) for t in self.search.thresholds
Based on the snippet: <|code_start|> class StringifiedList(list): def __init__(self, value=[], **kwargs): if isinstance(value, list): if len(value) == 0: return else: self.extend(value) else: raise AttributeError def exten...
stackframe_class = Stackframe
Predict the next line for this snippet: <|code_start|># Copyright (C) 2015, 2016 Joshua Charles Campbell # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, ...
raise BadProjectNameError(repr(project))
Predict the next line for this snippet: <|code_start|> # Copyright (C) 2015, 2016 Joshua Charles Campbell # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License,...
except BadKeyNameError as e:
Continue the code snippet: <|code_start|> "Stacktrace", "Stacktrace.gz", "Stacktrace.txt.1", ] trace = None first_crash = None for fname in try_files: stack_path = os.path.join(path, fname) ...
class LaunchpadCrash(Crash):
Predict the next line for this snippet: <|code_start|> except: ERROR(line) raise if frame.get('function') == '??': frame['function'] = None leftover_extras = [] if 'file' in frame: match = fl.match(frame['file']) if match is not ...
class LaunchpadStack(Stacktrace):
Using the snippet: <|code_start|> ch = u'?' #raise ValueError("Bad encoding %s in: %s" % (ch.encode('unicode_escape'), line.encode('utf-8'))) elif ch == u'\ufffd': ch = u'?' line += ch return line #number address in function (args) at file from lib naifafl = re.co...
class LaunchpadFrame(Stackframe):
Using the snippet: <|code_start|> "CompizPlugins", "version.xserver-xorg-video-nouveau", "version.xserver-xorg-video-ati", "DistUpgraded", "version.libdrm2", "version.xserver-xorg-video-intel", "LiveMediaBuild", "Candidate", "GraphicsCard", "version.compiz", "dmi.boa...
save_fields = [fix_key_for_es(k) for k in save_fields]
Here is a snippet: <|code_start|> } } return properties def termvectors(self, **kwargs): assert 'index' not in kwargs return self.esstore.es.termvectors( index=self.index_base, **kwargs ) # SMURT Proxy to the ES API ...
raise ESError(e)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright (C) 2017 Joshua Charles Campbell # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the Licens...
self.buckets = cached_threshold(search)
Next line prediction: <|code_start|># This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy o...
buckets = ReportThreshold(search, search['threshold'])
Next line prediction: <|code_start|># of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public Lice...
buckets = Thresholds(search)
Here is a snippet: <|code_start|> # Copyright (C) 2016 Eddie Antonio Santos <easantos@ualberta.ca> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at you...
class BadRequest(PartyCrasherError):
Given the following code snippet before the placeholder: <|code_start|> value_a=d[k], value_b=v) else: d[k] = v return d def merge(d, dest, src): if dest in d: if src in d: raise KeyConflictError(key=dest, ...
maybe_set(s, 'project', multi_project(args.get('project', None)))
Continue the code snippet: <|code_start|> client) ) p = Pool(8) results = reduce(operator.add, p.map(get_similarity, tocompute)) for crash, other, similarity in results: if crash not in similaritys: similaritys[crash] = {} similaritys[crash][other] = simi...
i = Threshold(i)
Given snippet: <|code_start|>#!/usr/bin/env python """ 6809 unittests ~~~~~~~~~~~~~~ Register changed Ops: TFR, EXG :created: 2014 by Jens Diemer - www.jensdiemer.de :copyleft: 2014-2015 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more deta...
class Test6809_TFR(BaseCPUTestCase):
Based on the snippet: <|code_start|>#!/usr/bin/env python """ 6809 unittests ~~~~~~~~~~~~~~ :created: 2013-2014 by Jens Diemer - www.jensdiemer.de :copyleft: 2013-2015 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ log = logg...
class Test6809_Arithmetic(BaseCPUTestCase):
Based on the snippet: <|code_start|>#!/usr/bin/env python """ 6809 unittests ~~~~~~~~~~~~~~ Test store and load ops :created: 2014 by Jens Diemer - www.jensdiemer.de :copyleft: 2014-2015 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more deta...
class Test6809_Store(BaseStackTestCase):
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python """ 6809 unittests ~~~~~~~~~~~~~~ Test store and load ops :created: 2014 by Jens Diemer - www.jensdiemer.de :copyleft: 2014-2015 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see L...
class Test6809_AddressModes_LowLevel(BaseCPUTestCase):
Based on the snippet: <|code_start|> print(f"Import error: {err}") print() print("Please install 'click' !") print("more info: http://click.pocoo.org") sys.exit(-1) @click.group() @click.version_option(MC6809.__version__) def cli(): """ MC6809 is a Open source (GPL v3 or later) emulator ...
run_benchmark(loops, multiply)
Here is a snippet: <|code_start|>#!/usr/bin/env python """ 6809 unittests ~~~~~~~~~~~~~~ Test CPU with some small Assembler programs :created: 2014 by Jens Diemer - www.jensdiemer.de :copyleft: 2014-2015 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICE...
class Test6809_Program(BaseStackTestCase):
Continue the code snippet: <|code_start|>""" MC6809 - 6809 CPU emulator in Python ======================================= :created: 2014 by Jens Diemer - www.jensdiemer.de :copyleft: 2014 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. ...
class TestCfg(BaseConfig):
Given snippet: <|code_start|>#!/usr/bin/env python """ MC6809 - 6809 CPU emulator in Python ======================================= 6809 is Big-Endian Links: http://dragondata.worldofdragon.org/Publications/inside-dragon.htm http://www.burgins.com/m6809.html http://koti.mbnet....
@opcode( # AND condition code register, then wait for interrupt
Continue the code snippet: <|code_start|>#!/usr/bin/env python """ 6809 unittests ~~~~~~~~~~~~~~ :created: 2013 by Jens Diemer - www.jensdiemer.de :copyleft: 2013-2014 by the MC6809 team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ <|code_end...
class CC_AccumulatorTestCase(BaseCPUTestCase):
Given the following code snippet before the placeholder: <|code_start|> addr = stack_pointer.value # log.info( # log.error( # "%x|\tpush word $%x to %s stack at $%x\t|%s", # self.last_op_address, word, stack_pointer.name, addr, # self.cfg.mem_info.get_shortest(sel...
@opcode( # Push A, B, CC, DP, D, X, Y, U, or PC onto stack
Next line prediction: <|code_start|> assert register in (self.system_stack_pointer, self.user_stack_pointer) def push(register_str, stack_pointer): register_obj = self.register_str2object[register_str] data = register_obj.value # log.debug("\tpush %s with data $%x", ...
push(REG_A, register) # 8 bit accumulator
Here is a snippet: <|code_start|> CC bits "HNZVC": ----- """ assert register in (self.system_stack_pointer, self.user_stack_pointer) def push(register_str, stack_pointer): register_obj = self.register_str2object[register_str] data = register_obj.value # ...
push(REG_B, register) # 8 bit accumulator