Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Using the snippet: <|code_start|> def in_jasper_session(self): return False def use_server(self): try: doc_jasper_server = self.doc.use_jasper_server.lower() return doc_jasper_server == "jasperserver only" or doc_jasper_server == "both" except: return False def use_local(self): doc_jasper_server =...
if data:
Next line prediction: <|code_start|> def reset_data_session(self): self.data = frappe._dict({'data': frappe._dict({})}) def in_jasper_session(self): return False def use_server(self): try: doc_jasper_server = self.doc.use_jasper_server.lower() return doc_jasper_server == "jasperserver only" or doc_jaspe...
return
Next line prediction: <|code_start|>from __future__ import unicode_literals __author__ = 'luissaguas' _logger = frappe.logger("jasper_erpnext_report") <|code_end|> . Use current file imports: (from frappe.model.document import Document from frappe import _ from io import BytesIO from jasper_erpnext_report.utils.fi...
jasper_fields_not_supported = ["parent", "owner", "modified_by", "parenttype", "parentfield", "docstatus", "doctype", "name", "idx"]
Given the following code snippet before the placeholder: <|code_start|> ### Constants ################################################################## ROW_SIZE = 8 COL_SIZE = 4 SPEED_INCREASE = .15 #In pixels per frame ################################################################################ ###...
ENEMY_GROUP = None
Predict the next line after this snippet: <|code_start|> ### Constants ################################################################## ROW_SIZE = 8 COL_SIZE = 4 SPEED_INCREASE = .15 #In pixels per frame ################################################################################ ### Globals ######...
ENEMY_GROUP = None
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import unicode_literals BASE_PATH = os.path.dirname(os.path.abspath(__file__)) OUTPUT_PATH = os.path.join(BASE_PATH, 'index.html') BUNDLE_PATH = os.path.join(BASE_PATH, 'src', 'bundle.js') template = """<!DOCTYPE html> <html> <head> ...
</head>
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import unicode_literals BASE_PATH = os.path.dirname(os.path.abspath(__file__)) OUTPUT_PATH = os.path.join(BASE_PATH, 'index.html') BUNDLE_PATH = os.path.join(BASE_PATH, 'src', 'bundle.js') template = """<!DOCTYPE html> <html> <head...
</script>
Given the following code snippet before the placeholder: <|code_start|> logging.disable(logging.CRITICAL) _global = '__global' @contextmanager def js_file(data): if isinstance(data, six.text_type): data = data.encode('utf-8') temp = tempfile.NamedTemporaryFile(delete=False) temp.write(data) ...
def test_set_up(self):
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import unicode_literals try: except ImportError: logging.disable(logging.CRITICAL) <|code_end|> with the help of current file imports: from unittest.mock import patch from mock import patch from react.react ...
class ReactTest(unittest.TestCase):
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- BASE_PATH = os.path.dirname(os.path.abspath(__file__)) OUTPUT_PATH = os.path.join(BASE_PATH, 'index.html') BUNDLE_PATH = os.path.join(BASE_PATH, 'src', 'bundle.js') template = """<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Exa...
<div id="content">{pre_rendered_content}</div>
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- BASE_PATH = os.path.dirname(os.path.abspath(__file__)) OUTPUT_PATH = os.path.join(BASE_PATH, 'index.html') BUNDLE_PATH = os.path.join(BASE_PATH, 'src', 'bundle.js') template = """<!DOCTYPE html> <|code_end|> , predict t...
<html>
Here is a snippet: <|code_start|> cred_issued = cred_secret_issue(params, pub, EGenc, ipub, isec, public_attr) u, EncE, sig_s = decode(encode(cred_issued)) ## The user decrypts the amac mac = cred_secret_issue_user_decrypt(params, keypair, u, EncE, ipub, public_attr, EGenc, sig_s) mac = decode(encod...
env.z0, env.z1 = zis[0], zis[1]
Given the code snippet: <|code_start|> try: _OPENSSL_VERSION = get_openssl_version(_C) except: _OPENSSL_VERSION = OpenSSLVersion.V1_1 # Store constants class Const: POINT_CONVERSION_COMPRESSED = 2, POINT_CONVERSION_UNCOMPRESSED = 4, POINT_CONVERSION_HYBRID = 6 _inited = False def version(): ...
while err != 0:
Continue the code snippet: <|code_start|> errors += [err] err = _C.ERR_get_error() assert isinstance(errors, list) return errors class InitCiphers(object): # pylint: disable=global-statement def __init__(self): global _inited self.on = False self._C = _C ...
_C.setup_ssl_threads()
Predict the next line for this snippet: <|code_start|> except AttributeError: return self.mod_inverse(Bn.from_num(m)) def mod_pow(self, other, m, ctx=None): """ Performs the modular exponentiation of self ** other % m. Example: >>> one100 = Bn(100) ...
return (dv, rem)
Predict the next line for this snippet: <|code_start|>_thread_local = threading.local() def get_ctx(): global _thread_local try: return _thread_local.ctx except BaseException: _thread_local.ctx = BnCtx() return _thread_local.ctx @python_2_unicode_compatible class Bn(object): ...
if isinstance(num, int):
Given the code snippet: <|code_start|> except BaseException: _thread_local.ctx = BnCtx() return _thread_local.ctx @python_2_unicode_compatible class Bn(object): """The core Big Number class. It supports all comparisons (<, <=, ==, !=, >=, >), arithmetic operations (+, -, %, /,...
@staticmethod
Using the snippet: <|code_start|> ")" : None, "*" : "asterisk", "+" : "plus", "," : "comma", "-" : "minus", "." : None, "/" : "slash", ":" : "colon", ";" : "semicolon", "=" : "equal", ">" : "greater", ...
self.klist = None
Using the snippet: <|code_start|>class PsychoPyKeyboard(BaseKeyboard): # See _keyboard.basekeyboard.BaseKeyboard def __init__(self, keylist=settings.KEYLIST, timeout=settings.KEYTIMEOUT): # See _keyboard.basekeyboard.BaseKeyboard # try to copy docstring (but ignore it if it fai...
"," : "comma",
Continue the code snippet: <|code_start|> def set_timeout(self, timeout=None): # See _keyboard.basekeyboard.BaseKeyboard self.timeout = timeout def get_key(self, keylist="default", timeout="default", flush=False): # See _keyboard.basekeyboard.BaseKeyboard ...
if keylist == None or key in keylist:
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # # This file is part of PyGaze - the open-source toolbox for eye tracking # # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin...
except:
Given snippet: <|code_start|># -*- coding: utf-8 -*- # # This file is part of PyGaze - the open-source toolbox for eye tracking # # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalma...
print("Failed to import PIL.")
Given snippet: <|code_start|># it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY...
try:
Here is a snippet: <|code_start|> def __init__(self, **args): # See _display.basedisplay.BaseDisplay for documentation # try to import copy docstring (but ignore it if it fails, as we do # not need it for actual functioning of the code) try: copy_docstr(Ba...
def fill(self, screen=None):
Based on the snippet: <|code_start|># Copyright (C) 2012-2013 Edwin S. Dalmaijer # # 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 ...
self.__class__ = Keyboard
Next line prediction: <|code_start|># This file is part of PyGaze - the open-source toolbox for eye tracking # # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalmaijer ...
elif disptype == "psychopy":
Using the snippet: <|code_start|># PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalmaijer # # This program is free software: you can redistribute it and/or modify #...
else:
Predict the next line after this snippet: <|code_start|> # try to copy docstring (but ignore it if it fails, as we do # not need it for actual functioning of the code) try: copy_docstr(BaseSound, PyGameSound) except: # we're not even going to show a warning, s...
_func = self.square
Predict the next line after this snippet: <|code_start|> copy_docstr(BaseSound, PyGameSound) except: # we're not even going to show a warning, since the copied # docstring is useful for code editors; these load the docs # in a non-verbose manner, so warning mes...
else:
Here is a snippet: <|code_start|> def __init__(self, keylist=settings.KEYLIST, timeout=settings.KEYTIMEOUT): # See _keyboard.basekeyboard.BaseKeyboard # try to copy docstring (but ignore it if it fails, as we do # not need it for actual functioning of the code) try: ...
def get_key(self, keylist="default", timeout="default", flush=False):
Continue the code snippet: <|code_start|> # set keyboard characteristics self.set_keylist(keylist) self.set_timeout(timeout) def set_keylist(self, keylist=None): # See _keyboard.basekeyboard.BaseKeyboard if keylist == None or keylist == [...
keylist = self.klist
Continue the code snippet: <|code_start|># we try importing the copy_docstr function, but as we do not really need it # for a proper functioning of the code, we simply ignore it when it fails to # be imported correctly try: except: pass class PyGameKeyboard(BaseKeyboard): # See _keyboard.bas...
if i[:2] == "K_":
Based on the snippet: <|code_start|> code = eval("pygame.%s" % i) name1 = pygame.key.name(code).lower() name2 = name1.upper() name3 = i[2:].lower() name4 = name3.upper() self.key_codes[name1] = co...
self.timeout = timeout
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # # This file is part of PyGaze - the open-source toolbox for eye tracking # # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 20...
else:
Given the code snippet: <|code_start|># # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalmaijer # # This program is free software: you can redistribute it and/or modify...
def __init__(self):
Here is a snippet: <|code_start|>fixscreen.draw_fixation(fixtype='cross',pw=2) targetscreens = {} targetscreens['left'] = libscreen.Screen() targetscreens['left'].draw_circle(pos=(settings.DISPSIZE[0]*0.25,settings.DISPSIZE[1]/2), fill=True) targetscreens['right'] = libscreen.Screen() targetscreens['right'].draw_circle...
response, t1 = kb.get_key()
Predict the next line for this snippet: <|code_start|> # run 20 trials for trialnr in range(1,21): # prepare trial trialtype = random.choice(['left','right']) # present fixation disp.fill(screen=fixscreen) disp.show() libtime.pause(random.randint(750, 1250)) # present target disp.fill(targetscreens[trialtyp...
disp.show()
Here is a snippet: <|code_start|># example script for using PyGaze # # # # # # importing the relevant libraries # # # # # # setup the experiment # create display object disp = libscreen.Display() # create keyboard object kb = libinput.Keyboard(keylist=['left','right','escape'], timeout=2000) # create logfile objec...
feedbackscreens = {}
Continue the code snippet: <|code_start|>targetscreens['right'] = libscreen.Screen() targetscreens['right'].draw_circle(pos=(settings.DISPSIZE[0]*0.75,settings.DISPSIZE[1]/2), fill=True) feedbackscreens = {} feedbackscreens[1] = libscreen.Screen() feedbackscreens[1].draw_text(text='correct', colour=(0,255,0)) feedbacks...
break
Based on the snippet: <|code_start|> disp.show() libtime.pause(random.randint(750, 1250)) # present target disp.fill(targetscreens[trialtype]) t0 = disp.show() # wait for input response, t1 = kb.get_key() # end the experiment when 'escape' is pressed if response == 'escape': break # process input if ...
disp.close()
Here is a snippet: <|code_start|> # docstring is useful for code editors; these load the docs # in a non-verbose manner, so warning messages would be lost pass self.dispsize = dispsize self.fgc = fgc self.bgc = bgc self.screennr = screennr ...
def show_part(self, rect, screen=None):
Continue the code snippet: <|code_start|># but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with ...
except:
Using the snippet: <|code_start|> # get screen in window if screen: for s in screen.screen: s.draw() def show(self): # See _display.basedisplay.BaseDisplay for documentation pygaze.expdisplay.flip() return clock.get_time() def sh...
s.draw()
Next line prediction: <|code_start|> pygaze.expdisplay.setMouseVisible(self.mousevis) # get screen in window if screen: for s in screen.screen: s.draw() def show(self): # See _display.basedisplay.BaseDisplay for documentation pygaze.exp...
for s in screen.screen:
Next line prediction: <|code_start|># This file is part of PyGaze - the open-source toolbox for eye tracking # # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalmaijer ...
elif disptype == "psychopy":
Continue the code 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 3 of the License, or # (at your option) any later version. # # This...
self.__class__.__init__(self, **args)
Predict the next line for this snippet: <|code_start|># # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalmaijer # # This program is free software: you can redistri...
elif disptype == "opensesame":
Predict the next line after this snippet: <|code_start|># # PyGaze is a Python module for easily creating gaze contingent experiments # or other software (as well as non-gaze contingent experiments/software) # Copyright (C) 2012-2013 Edwin S. Dalmaijer # # This program is free software: you can redist...
class FRL:
Predict the next line for this snippet: <|code_start|># the Free Software Foundation, either version 3 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 # MERCHANTAB...
try:
Predict the next line after this snippet: <|code_start|> def show_part(self, rect, screen=None): # See _display.basedisplay.BaseDisplay for documentation if len(rect) > 1: for r in rect: pygaze.expdisplay.set_clip(r) if screen: ...
pygaze.expdisplay.fill(self.bgc)
Predict the next line for this snippet: <|code_start|> def __init__(self, dispsize=settings.DISPSIZE, fgc=settings.FGC, bgc=settings.BGC, screen=None, **args): # See _display.basedisplay.BaseDisplay for documentation # try to import copy docstring (but ignore it if it fails, ...
pygaze.expdisplay = pygame.display.set_mode(self.dispsize, mode)
Using the snippet: <|code_start|> # initialize PyGame display-module pygame.display.init() # make mouse invisible (should be so per default, but you never know) pygame.mouse.set_visible(self.mousevis) if settings.FULLSCREEN: mode = pygame.FULLSCREEN|pygame.HWSURFA...
if len(rect) > 1:
Continue the code snippet: <|code_start|> # # # # # # VIBRATION if RUMBLE: # define necessary structure class XINPUT_VIBRATION(ctypes.Structure): _fields_ = [("wLeftMotorSpeed", ctypes.c_ushort), ("wRightMotorSpeed", ctypes.c_ushort)] # load Xinput.dll try: print("trying to import xinput1_1.d...
xinput = ctypes.windll.xinput1_1
Next line prediction: <|code_start|> # # # # # # VIBRATION if RUMBLE: # define necessary structure class XINPUT_VIBRATION(ctypes.Structure): _fields_ = [("wLeftMotorSpeed", ctypes.c_ushort), ("wRightMotorSpeed", ctypes.c_ushort)] # load Xinput.dll try: print("trying to import xinput1_1.dll") ...
except:
Given the code snippet: <|code_start|> XInputSetState.argtypes = [ctypes.c_uint, ctypes.POINTER(XINPUT_VIBRATION)] XInputSetState.restype = ctypes.c_uint # define helper function def set_vibration(controller, left_motor, right_motor): vibration = XINPUT_VIBRATION(int(left_motor * 65535), int(right_motor * 6...
text = text="%s: %s" % (event, value)
Predict the next line after this snippet: <|code_start|> self.expbegintime = psychopy.core.getTime() * 1000 def get_time(self): # see pygaze._time.basetime.BaseTime return psychopy.core.getTime() * 1000 - self.expbegintime def pause(self, pausetime): # see pygaze._time.bas...
return endtime
Based on the snippet: <|code_start|>## the Free Software Foundation, either version 3 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 PART...
except:
Here is a snippet: <|code_start|> # supported operators operators = { ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul, ast.Div: op.truediv, ast.Pow: op.pow, ast.BitXor: op.xor, ast.USub: op.neg, ast.Invert: op.invert, } # eval_expr / _eval from: http://stackoverflow.com/a/9558001/23...
def get_date_string(the_date, the_format=None):
Next line prediction: <|code_start|> get_date(date_string) return True except ValueError: return False def is_integer(value): try: return re.sub(r"^[-+]", "", value).isdigit() except TypeError: return False def is_float(value): try: float(value) ...
def product(numbers):
Given the code snippet: <|code_start|> def get_plain_amount(amount, colwidth=1, decimals=2, prefix="$ "): amount_formatted = f"{prefix}{get_amount_str(amount, decimals)}" return f"{amount_formatted:>{colwidth}}" def get_colored_amount( amount, colwidth=1, decimals=2, prefix="$ ", positive="green", zero="...
message += f" {account}\n"
Predict the next line for this snippet: <|code_start|> # supported operators operators = { ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul, ast.Div: op.truediv, ast.Pow: op.pow, <|code_end|> with the help of current file imports: import ast import operator as op import re import shlex import s...
ast.BitXor: op.xor,
Given snippet: <|code_start|> args, ledger_args = grid.get_args(["food", "--transpose"]) report = grid.get_grid_report(args, ledger_args) helper = OutputFileTester("test_grid_end_to_end_flat_transposed") helper.save_out_file(report) helper.assert_out_equals_expected() def test_get_grid_report_flat_...
report = grid.get_grid_report(args, ledger_args)
Predict the next line after this snippet: <|code_start|>@mock.patch(__name__ + ".LEDGER", "fubar") def test_ledger_not_found(): assert ledger_not_found() def test_get_grid_report_flat_report_expenses(): args, ledger_args = grid.get_args(["expenses", "--sort", "row"]) report = grid.get_grid_report(args, le...
args, ledger_args = grid.get_args(["food", "--period", "2018"])
Given the code snippet: <|code_start|> ) assert Colorable.get_plain_string(report) == expected def test_get_grid_report_flat_report_single_row(): args, ledger_args = grid.get_args(["groceries"]) report = grid.get_grid_report(args, ledger_args) expected = ( " 2017 2018 ...
args, ledger_args = grid.get_args(["groceries", "--period", "2018"])
Predict the next line after this snippet: <|code_start|> history += f" {contrib_total_f} {transfers_total_f}\n" return history def get_comparison_report_column_headers(num_years, labels=True): header3 = "" if num_years < 3 else f"{'3yr %':>{COL_GAIN}}" header5 = "" if num_years < 5 else ...
"g": "gain_value",
Here is a snippet: <|code_start|> transfers_total += year.transfers gain_val_total += year.gain_value if len(years) > 1: contrib_total_f = util.get_colored_amount( contrib_total, colwidth=COL_CONTRIB, decimals=0 ) transfers_total_f = util.get_colored_amount( ...
totals[year]["contributions"] += 0
Continue the code snippet: <|code_start|> history += ( f" {year} {contrib_f} {transfers_f} {shares_f} " f"{price_f} {value_f} {gain_f}\n" ) previous_shares = shares previous_price = price previous_value = value contrib_total += contrib ...
return str(
Given snippet: <|code_start|> def get_ledger_command(args=None): files = [] for f in get_setting("LEDGER_FILES"): files += ["-f", os.path.join(get_setting("LEDGER_DIR"), f)] return get_setting("LEDGER_COMMAND") + tuple(files) + (args or ()) def get_ledger_output(args=None): <|code_end|> , contin...
cmd = get_ledger_command(args)
Predict the next line for this snippet: <|code_start|> else: match = DOLLARS_REGEX.match(line) if match: amount, account = match.groups() symbol = "$" if not match: return None return AccountBalance( account.strip() if strip_account else account, get_...
DOLLARS = 0
Given the code snippet: <|code_start|> # (ledgerthing noqa'ed: is used in patch but reported as unused) def test_repr(): lines = ["2018/01/08 blah", " e: xyz", " l: abc $-10"] thing = LedgerThing(lines) assert repr(thing) == f"LedgerThing({lines}, reconcile_account=None)" assert isinsta...
def test_str():
Next line prediction: <|code_start|> # (ledgerthing noqa'ed: is used in patch but reported as unused) def test_repr(): lines = ["2018/01/08 blah", " e: xyz", " l: abc $-10"] thing = LedgerThing(lines) assert repr(thing) == f"LedgerThing({lines}, reconcile_account=None)" assert isinstanc...
def test_str():
Based on the snippet: <|code_start|> # (ledgerthing noqa'ed: is used in patch but reported as unused) def test_repr(): lines = ["2018/01/08 blah", " e: xyz", " l: abc $-10"] thing = LedgerThing(lines) assert repr(thing) == f"LedgerThing({lines}, reconcile_account=None)" assert isinstanc...
def test_non_transaction_date():
Given the following code snippet before the placeholder: <|code_start|> # (ledgerthing noqa'ed: is used in patch but reported as unused) def test_repr(): lines = ["2018/01/08 blah", " e: xyz", " l: abc $-10"] thing = LedgerThing(lines) assert repr(thing) == f"LedgerThing({lines}, reconcile_...
def test_str():
Here is a snippet: <|code_start|> # (ledgerthing noqa'ed: is used in patch but reported as unused) def test_repr(): lines = ["2018/01/08 blah", " e: xyz", " l: abc $-10"] thing = LedgerThing(lines) assert repr(thing) == f"LedgerThing({lines}, reconcile_account=None)" assert isinstance(e...
def test_non_transaction_date():
Given snippet: <|code_start|>#!/usr/bin/env python3 def main(argv=None): if argv is None: argv = sys.argv[1:] command = argv[0] if argv else "" other = { "grid": grid, "inv": investments, "investments": investments, "pass": passthrough, "port": portfolio,...
if command not in other:
Using the snippet: <|code_start|>#!/usr/bin/env python3 def main(argv=None): if argv is None: argv = sys.argv[1:] command = argv[0] if argv else "" other = { "grid": grid, "inv": investments, "investments": investments, "pass": passthrough, "port": portfo...
if command not in other:
Using the snippet: <|code_start|>#!/usr/bin/env python3 def main(argv=None): if argv is None: argv = sys.argv[1:] command = argv[0] if argv else "" other = { "grid": grid, "inv": investments, "investments": investments, "pass": passthrough, "port": portfo...
}
Given the code snippet: <|code_start|>#!/usr/bin/env python3 def main(argv=None): if argv is None: argv = sys.argv[1:] command = argv[0] if argv else "" other = { "grid": grid, "inv": investments, "investments": investments, "pass": passthrough, "port": p...
else:
Given snippet: <|code_start|> @mock.patch(__name__ + ".scheduler.handle_error") def test_scheduler_error(mock_error): schedulefiledata = ";; scheduler enter 321 days" with FT.temp_file(schedulefiledata) as temp_schedule_filename: ledgerfile = None # is going to error before we use ledgerfile s...
assert return_value is None
Predict the next line for this snippet: <|code_start|> def get_schedule_file(the_date, schedule, enter_days=7): return ( f";; scheduler ; enter {enter_days} days\n" "\n" f"{the_date} bananas unlimited\n" f" ;; schedule ; {schedule}\n" " e: misc\n" " l: cre...
util.get_date_string(after_date), schedule, enter_days
Using the snippet: <|code_start|> def get_investment_command_options(accounts, end_date, shares=False): options = ["--no-total"] if shares: options += ["--exchange", "."] # override --market options += ["--end", end_date] return tuple(["bal"] + parse_args(accounts) + options) def warn_nega...
def get_lines(args, shares=False):
Using the snippet: <|code_start|> def get_investment_command_options(accounts, end_date, shares=False): options = ["--no-total"] if shares: options += ["--exchange", "."] # override --market options += ["--end", end_date] return tuple(["bal"] + parse_args(accounts) + options) def warn_nega...
options = get_investment_command_options(args.accounts, args.end, shares)
Predict the next line after this snippet: <|code_start|> def get_investment_command_options(accounts, end_date, shares=False): options = ["--no-total"] if shares: options += ["--exchange", "."] # override --market options += ["--end", end_date] return tuple(["bal"] + parse_args(accounts) + o...
f'{warning} Negative dollar amount {amount} for "{account.strip()}". '
Given snippet: <|code_start|> def get_investment_command_options(accounts, end_date, shares=False): options = ["--no-total"] if shares: options += ["--exchange", "."] # override --market options += ["--end", end_date] return tuple(["bal"] + parse_args(accounts) + options) def warn_negative...
f'{warning} Negative dollar amount {amount} for "{account.strip()}". '
Given the following code snippet before the placeholder: <|code_start|> def get_investment_command_options(accounts, end_date, shares=False): options = ["--no-total"] if shares: options += ["--exchange", "."] # override --market options += ["--end", end_date] return tuple(["bal"] + parse_arg...
return output.split("\n")
Given the code snippet: <|code_start|> def setup_function(): settings_getter.settings = MockSettings() def teardown_function(): settings_getter.settings = settings.Settings() BIG_CO = 0 BONDS = 1 BIG_NAME = 2 BONDS_2 = 3 CLOSED = 4 portfolio_json_data = """\ [ { "account": "assets: 401k:...
"contributions": 1500.79,
Here is a snippet: <|code_start|> "contributions": 750, "transfers": 15000 } } }, { "account": "assets: 401k: long account name that goes on...", "labels": ["401k", "flurb", "intl", "active", "smactive"], "years": {} }, { "...
}
Using the snippet: <|code_start|> "401k", "flurb" ], "years": { "2016": { "symbol": "abcdx", "price": 80.23, "shares": 12200.78, "contributions": 1500.79, "transfers": 900000, "note": "optional..." ...
"bonds",
Given the following code snippet before the placeholder: <|code_start|> NO_PREVIOUS_DATE = "-" def run_reconciler(ledgerfiles): try: reconciler = Reconciler(ledgerfiles) except LdgReconcilerError as e: return util.handle_error(str(e)) reconciler.cmdloop() class Reconciler(cmd.Cmd): <|...
UNKNOWN_SYNTAX = "*** Unknown syntax: "
Predict the next line for this snippet: <|code_start|> NO_PREVIOUS_DATE = "-" def run_reconciler(ledgerfiles): try: reconciler = Reconciler(ledgerfiles) except LdgReconcilerError as e: return util.handle_error(str(e)) reconciler.cmdloop() <|code_end|> with the help of current file imp...
class Reconciler(cmd.Cmd):
Using the snippet: <|code_start|>NO_PREVIOUS_DATE = "-" def run_reconciler(ledgerfiles): try: reconciler = Reconciler(ledgerfiles) except LdgReconcilerError as e: return util.handle_error(str(e)) reconciler.cmdloop() class Reconciler(cmd.Cmd): UNKNOWN_SYNTAX = "*** Unknown syntax: ...
"start": self.do_statement,
Predict the next line after this snippet: <|code_start|> "m": self.do_mark, "u": self.do_unmark, "un": self.do_unmark, "q": self.do_quit, "r": self.do_reload, "s": self.do_show, "start": self.do_statement, } util.assert_...
pass # pragma: no cover
Next line prediction: <|code_start|> "s": self.do_show, "start": self.do_statement, } util.assert_only_one_matching_account( [ ledgerfile.rec_account_matched for ledgerfile in ledgerfiles if ledgerfile.rec_account_matche...
if command == "EOF":
Given the following code snippet before the placeholder: <|code_start|> class MockSettings: NETWORTH_ACCOUNTS = "(^fu ^bar)" DATE_FORMAT_MONTH = settings_getter.defaults["DATE_FORMAT_MONTH"] class MockSettingsAltDateFormat: NETWORTH_ACCOUNTS = "(^bar ^fu)" <|code_end|> , predict the next line using imp...
DATE_FORMAT_MONTH = "%Y-%m"
Continue the code snippet: <|code_start|> period_names = ("lemon",) actual = grid.get_rows(row_headers, columns, period_names) expected = [["lemon", grid.EMPTY_VALUE], [100, "expenses: car: gas"]] assert actual == expected def test_get_csv_report(): """csv report should turn whatever it's given int...
["a", "b", '"c"', "d e f", "g\th"],
Given the following code snippet before the placeholder: <|code_start|> @pytest.mark.parametrize("test_input", [FT.alpha_sortedfile, FT.alpha_unsortedfile]) def test_main_no_options(test_input): """main should parse and write sorted and unsorted files unchanged""" expected = FT.read_file(test_input) with ...
DATE_FORMAT = "%Y-%m-%d"
Predict the next line after this snippet: <|code_start|> expected = "error: -f/--file is required" mock_handle_error.assert_called_once_with(expected) def test_main_investments_with_argv_none_retun_value(): with mock.patch("sys.argv", ["/script"]): assert ledgerbil.main() == ERROR_RETURN_VALUE @m...
@mock.patch(__name__ + ".scheduler.handle_error")
Predict the next line for this snippet: <|code_start|> mock_handle_error.assert_called_once_with(expected) def test_main_investments_with_argv_none_retun_value(): with mock.patch("sys.argv", ["/script"]): assert ledgerbil.main() == ERROR_RETURN_VALUE @mock.patch(__name__ + ".scheduler.handle_error") ...
def test_scheduler_exception(mock_handle_error):
Given the following code snippet before the placeholder: <|code_start|> # Many queries with no results will come up empty on period names and # return above, but some, for example queries with "and" in them, may not if not row_headers: return "" rows = get_rows( row_headers, colu...
if args.transpose:
Predict the next line for this snippet: <|code_start|> the_header.append(first_part) for part in parts: if len("".join(row_in_progress + [part.rstrip()])) <= padded_width: row_in_progress.append(part) else: if row_in_progress: ...
end = ("--end", args.end) if args.end else ()