Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the following code snippet before the placeholder: <|code_start|> class DummyExecutor(BaseExecutorPlugin): hook_prefix = 'executors.dummy' hooks = ('execute',) def _parse_args_dict(self, args_dict): if 'cmd' not in args_dict: raise PluginError('DummyExecutor got incorrect argumen...
def execute(self, args_dict):
Continue the code snippet: <|code_start|> class DummyExecutor(BaseExecutorPlugin): hook_prefix = 'executors.dummy' hooks = ('execute',) def _parse_args_dict(self, args_dict): <|code_end|> . Use current file imports: from pipelines.plugins.base_executor import BaseExecutorPlugin from pipelines.pipeline.ta...
if 'cmd' not in args_dict:
Using the snippet: <|code_start|> class DummyExecutor(BaseExecutorPlugin): hook_prefix = 'executors.dummy' hooks = ('execute',) def _parse_args_dict(self, args_dict): if 'cmd' not in args_dict: raise PluginError('DummyExecutor got incorrect arguments, got: {}'.format( <|code_end|> , de...
args_dict.keys()
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- class UserProfileView(UpdateView): template_name = "accounts/user_profile.html" model = User fields = ['first_name', 'last_name'] form_class = UserProfileForm def get_object(self): return self.request.user def get_succ...
context = super(PasswordChangeView, self).get_context_data(*args, **kwargs)
Given the following code snippet before the placeholder: <|code_start|> self.defects = set() @property def all_cards(self): return self.cards.union(self.defects) def add_card(self, card): defect_types = app.config.get('DEFECT_TYPES', ()) if card.type in defect_types: ...
def cycle_time(self):
Predict the next line after this snippet: <|code_start|> self.config['CARD_STATES'] = [ 'Todo', 'Doing', 'Done', ] self.Form = self._get_target_class() self.required_data = { 'key': u'CMSIF-199', 'title': u'You gotta lock that ...
self.assertEquals(0, len(f.errors))
Given the code snippet: <|code_start|> try: DEBUG_TOOLBAR = True except ImportError: DEBUG_TOOLBAR = False try: SENTRY_SUPPORT = True except ImportError: SENTRY_SUPPORT = False <|code_end|> , generate the next line using the imports in this file: import os import socket import path import statsd fr...
def get_app():
Given the code snippet: <|code_start|> try: DEBUG_TOOLBAR = True except ImportError: DEBUG_TOOLBAR = False try: SENTRY_SUPPORT = True except ImportError: SENTRY_SUPPORT = False def get_app(): app = Flask('kardboard') <|code_end|> , generate the next line using the imports in this file: import o...
app.config.from_object('kardboard.default_settings')
Continue the code snippet: <|code_start|> class Team(object): def __init__(self, name): self.name = name.strip() @property def slug(self): return slugify(self.name) class TeamList(list): def __init__(self, *args): super(TeamList, self).__init__(args) self.teams = args...
@property
Here is a snippet: <|code_start|>#!/usr/bin/env python from __future__ import absolute_import celery = Celery(app) manager = Manager(app) install_celery_commands(manager) if __name__ == "__main__": <|code_end|> . Write the next line using the current file imports: from flask.ext.script import Manager from flask.ex...
manager.run()
Using the snippet: <|code_start|> def report_on_cards(cards): data = {} for k in cards: class_cards = data.get(k.service_class.get('name'), []) class_cards.append(k) data[k.service_class.get('name')] = class_cards total = sum([len(v) for k, v in data.items()]) report = {} ...
'cards_hit_goal_percent': cards_hit_goal / float(len(cards)),
Here is a snippet: <|code_start|> def report_on_cards(cards): data = {} for k in cards: class_cards = data.get(k.service_class.get('name'), []) class_cards.append(k) data[k.service_class.get('name')] = class_cards total = sum([len(v) for k, v in data.items()]) report = {} ...
'wip': len(cards),
Given snippet: <|code_start|> def report_on_cards(cards): data = {} for k in cards: class_cards = data.get(k.service_class.get('name'), []) class_cards.append(k) data[k.service_class.get('name')] = class_cards total = sum([len(v) for k, v in data.items()]) report = {} for ...
'wip_percent': len(cards) / float(total),
Using the snippet: <|code_start|> def report_on_cards(cards): data = {} for k in cards: class_cards = data.get(k.service_class.get('name'), []) class_cards.append(k) data[k.service_class.get('name')] = class_cards total = sum([len(v) for k, v in data.items()]) report = {} ...
}
Predict the next line after this snippet: <|code_start|> class KardTimeMachineTests(KardboardTestCase): def setUp(self): super(KardTimeMachineTests, self).setUp() self._set_up_data() def _get_target_class(self): return self._get_card_class() def _make_one(self, **kwargs): ...
c.start_date = backlog_date.replace(day=31)
Using the snippet: <|code_start|> class State(object): def __init__(self, name, buffer, is_buffer): self.name = name self.buffer = buffer self.is_buffer = is_buffer def __unicode__(self): <|code_end|> , determine the next line of code. You have imports: from kardboard.app import app f...
return unicode(self.name)
Continue the code snippet: <|code_start|> class State(object): def __init__(self, name, buffer, is_buffer): self.name = name self.buffer = buffer self.is_buffer = is_buffer def __unicode__(self): return unicode(self.name) <|code_end|> . Use current file imports: from kardboar...
def __str__(self):
Given the code snippet: <|code_start|> d[c] += 1 return dict(d) def state_transition_counts(state, months, count_type="exit", raw=False): end = make_end_date(date=datetime.datetime.now()) start = end - relativedelta(months=months) start = make_start_date(date=start) counts = [] data =...
entered__gte=range_start,
Given the following code snippet before the placeholder: <|code_start|> exited__gte=range_start, exited__lte=range_end, ) elif count_type == "enter": kwargs = dict( entered__gte=range_start, entered__lte=range_end, ...
print "%s\t%s" % (k, hist[k])
Using the snippet: <|code_start|> current_date = current_date + relativedelta(days=1) counts.sort() print "%s\t%s" % (start, end) print "Median\t%s" % median(counts) print "Average\t%s" % average(counts) print "Min\t%s" % counts[0] print "Max\t%s" % counts[-1] hist = histogram(coun...
count_type = sys.argv[3]
Given the following code snippet before the placeholder: <|code_start|> def histogram(counts): d = defaultdict(int) for c in counts: d[c] += 1 return dict(d) def state_transition_counts(state, months, count_type="exit", raw=False): end = make_end_date(date=datetime.datetime.now()) star...
counts = []
Given snippet: <|code_start|> counts.sort() print "%s\t%s" % (start, end) print "Median\t%s" % median(counts) print "Average\t%s" % average(counts) print "Min\t%s" % counts[0] print "Max\t%s" % counts[-1] hist = histogram(counts) keys = hist.keys() keys.sort() for k in keys: ...
print "Usage: {{state}} {{months}} {{exit|enter}} {{raw data}}"
Given snippet: <|code_start|> team2 = self.teams[1] for team in (team1, team2): for i in xrange(0, 1): c = self.make_card( backlog_date=backlog_date, team=team, state=self.states.backlog, ) ...
done_date=done_date,
Given the code snippet: <|code_start|> # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after intern...
('index', 'kardboard', u'kardboard Documentation',
Continue the code snippet: <|code_start|>#source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'kardboard' copyright = u'2011, Chris Heisel' # The version info for the project you're documenting, acts as replacement for # |version| and ...
exclude_patterns = []
Using the snippet: <|code_start|> def _get_target_class(self): return Kard def test_worked_on_returns_assingee_if_present(self): k = self._get_target_class()() k._assignee = "cheisel" expected = ['cheisel', ] assert k.worked_on == expected def test_worked_on_return...
'gaeda',
Next line prediction: <|code_start|> class TicketDataSyncTests(unittest2.TestCase): def setUp(self): super(TicketDataSyncTests, self).setUp() self.service = ticketdatasync def test_due_date_changes_from_some_to_none(self): kard = Mock() <|code_end|> . Use current file imports: (from...
kard.due_date = datetime.now()
Here is a snippet: <|code_start|> class TicketHelper(object): def __init__(self, config, kard): self.app_config = config <|code_end|> . Write the next line using the current file imports: import urlparse import datetime import cPickle as pickle import statsd import dateutil from kardboard.app import cac...
self.card = kard
Based on the snippet: <|code_start|> class TicketHelper(object): def __init__(self, config, kard): self.app_config = config <|code_end|> , predict the immediate next line with the help of imports: import urlparse import datetime import cPickle as pickle import statsd import dateutil from kardboard.app i...
self.card = kard
Using the snippet: <|code_start|> class TicketHelper(object): def __init__(self, config, kard): self.app_config = config <|code_end|> , determine the next line of code. You have imports: import urlparse import datetime import cPickle as pickle import statsd import dateutil from kardboard.app import cach...
self.card = kard
Using the snippet: <|code_start|> def test_webhook_sample(): url = 'http://localhost:0' notify = WebHookNotify(value=url) with mock.patch.object(notify.session, 'post') as fake_post: notify('report') <|code_end|> , determine the next line of code. You have imports: from kibitzr.notifier.webhook i...
fake_post.assert_called_once_with(
Given the following code snippet before the placeholder: <|code_start|> def test_bash_unicode_is_handled(): content = u"\U0001F4A9" with tempfile.NamedTemporaryFile() as outfile: bash_notify = bash_factory({}, 'tee %s' % outfile.name) <|code_end|> , predict the next line using imports from the current...
bash_notify(content)
Using the snippet: <|code_start|> def test_bash_transform_sample(): ok, content = bash_transform( code="sed 's/A/B/g'", content="ACTGA", ) assert ok is True assert content.strip() == "BCTGB" def test_python_transform_sample(): ok, content = python_transform( code="content ...
def test_bash_transform_error_is_captured():
Predict the next line after this snippet: <|code_start|> assert content.strip() == "BCTGB" def test_python_transform_sample(): ok, content = python_transform( code="content = content.replace('A', 'B')", content="ACTGA", conf=None, ) assert ok is True assert content.strip() =...
assert ok is False
Given snippet: <|code_start|> self.post_key = post_key or self.POST_KEY self.configure_session() def load_url(self, creds_key, value): if value: return value else: webhook_creds = settings().creds[creds_key] return webhook_creds['url'] def pos...
return notify_factory
Given the following code snippet before the placeholder: <|code_start|> @contextlib.contextmanager def patch_creds(data): with patch_source(PlainYamlCreds, 'open_creds', data) as fake_method: yield fake_method @contextlib.contextmanager def patch_conf(data): with patch_source(ReloadableSettings, 'op...
fake_file,
Next line prediction: <|code_start|> @contextlib.contextmanager def patch_creds(data): with patch_source(PlainYamlCreds, 'open_creds', data) as fake_method: yield fake_method @contextlib.contextmanager def patch_conf(data): with patch_source(ReloadableSettings, 'open_conf', data) as fake_method: ...
yield fake_method
Here is a snippet: <|code_start|> def test_invalid_unit(): with pytest.raises(ConfigurationError): Timeline.parse_check({ 'name': 'x', 'schedule': { 'every': 2, 'unit': 'olympics' }, }) def test_invalid_every(): with pytest.r...
'at': 'noon',
Given the code snippet: <|code_start|> def test_dummy_schedule(app, settings, check_noop): check_noop.side_effect = interrupt_on_nth_call(app, 2) settings.checks.append({ 'name': 'A', 'script': {'python': 'ok, content = True, "ok"'}, 'schedule': [TimelineRule(interval=0, unit='seconds'...
def test_period_parse():
Continue the code snippet: <|code_start|> gotify_creds = settings().creds['gotify'] self.url = gotify_creds['url'].rstrip('/') + '/message' self.token = gotify_creds['token'] self.verify = gotify_creds.get('verify', True) if not self.verify: # Since certificate validat...
def json(self, report):
Given snippet: <|code_start|>from __future__ import absolute_import logger = logging.getLogger(__name__) class TelegramBot(object): def __init__(self, chat_id=None, split_on=None): telegram_creds = settings().creds['telegram'] token = telegram_creds['token'] if chat_id is not None: ...
if self.split_on:
Continue the code snippet: <|code_start|> logger = logging.getLogger(__name__) def pretty_json(text): json_dump = json.dumps( json.loads(text), indent=2, sort_keys=True, ensure_ascii=False, # encoding='utf-8', ) return True, u'\n'.join([ <|code_end|> . Use current...
line.rstrip()
Next line prediction: <|code_start|> logger = logging.getLogger(__name__) def pretty_json(text): json_dump = json.dumps( json.loads(text), <|code_end|> . Use current file imports: (import json import logging from .utils import wrap_dummy, bake_parametrized from kibitzr.compat import sh) and contex...
indent=2,
Given the following code snippet before the placeholder: <|code_start|> def test_loop_aborts_without_checks(app, settings): assert app.run() == 1 def test_main_executes_all_checks_before_loop(app, settings): with mock.patch.object(app, "check_forever", side_effect=app.on_interrupt) as the_loop: setti...
def test_main_filters_names(app, settings):
Next line prediction: <|code_start|> class MailgunNotify(WebHookNotify): CREDS_KEY = 'mailgun' def __init__(self, conf, value, **kwargs): self.mailgun_creds = settings().creds.get('mailgun', {}) self.mailgun_creds.update(value or {}) domain = self.mailgun_creds['domain'] self...
'to': [self.mailgun_creds['to']],
Next line prediction: <|code_start|> class MailgunNotify(WebHookNotify): CREDS_KEY = 'mailgun' def __init__(self, conf, value, **kwargs): self.mailgun_creds = settings().creds.get('mailgun', {}) self.mailgun_creds.update(value or {}) domain = self.mailgun_creds['domain'] self...
def load_url(self, creds_key, value):
Predict the next line for this snippet: <|code_start|> class MailgunNotify(WebHookNotify): CREDS_KEY = 'mailgun' def __init__(self, conf, value, **kwargs): self.mailgun_creds = settings().creds.get('mailgun', {}) self.mailgun_creds.update(value or {}) domain = self.mailgun_creds['dom...
text=report,
Using the snippet: <|code_start|> PYTHON_ERROR = "transform.python must set global variables ok and content" logger = logging.getLogger(__name__) def changes_transform_factory(value, conf): style = value.lower() if value else None return PageHistory(conf, style=style).report_changes def python_transform(...
return False, traceback.format_exc()
Predict the next line for this snippet: <|code_start|> PYTHON_ERROR = "transform.python must set global variables ok and content" logger = logging.getLogger(__name__) def changes_transform_factory(value, conf): <|code_end|> with the help of current file imports: import logging import traceback import six from ki...
style = value.lower() if value else None
Given the code snippet: <|code_start|> PYTHON_ERROR = "transform.python must set global variables ok and content" logger = logging.getLogger(__name__) def changes_transform_factory(value, conf): style = value.lower() if value else None return PageHistory(conf, style=style).report_changes def python_trans...
except:
Given the code snippet: <|code_start|> PYTHON_ERROR = "transform.python must set global variables ok and content" logger = logging.getLogger(__name__) def changes_transform_factory(value, conf): style = value.lower() if value else None return PageHistory(conf, style=style).report_changes def python_trans...
except:
Predict the next line after this snippet: <|code_start|> PYTHON_ERROR = "transform.python must set global variables ok and content" logger = logging.getLogger(__name__) def changes_transform_factory(value, conf): style = value.lower() if value else None return PageHistory(conf, style=style).report_changes ...
def python_transform(code, content, conf):
Predict the next line after this snippet: <|code_start|> class ZapierNotify(WebHookNotify): CREDS_KEY = "zapier" POST_KEY = "text" def configure_session(self): self.session.headers.update({ "Content-Type": "application/x-www-form-urlencoded" <|code_end|> using the current file's impor...
})
Next line prediction: <|code_start|> class ZapierNotify(WebHookNotify): CREDS_KEY = "zapier" POST_KEY = "text" def configure_session(self): self.session.headers.update({ "Content-Type": "application/x-www-form-urlencoded" <|code_end|> . Use current file imports: (from .webhook import ...
})
Predict the next line for this snippet: <|code_start|> def jinja_transform(code, content, conf=None): return JinjaTransform(code, conf or {})(content) def test_content_is_passed(): ok, content = jinja_transform('hello {{ content }}!', 'world') assert ok is True <|code_end|> with the help of current fil...
assert content == "hello world!"
Given the code snippet: <|code_start|> def jinja_transform(code, content, conf=None): return JinjaTransform(code, conf or {})(content) def test_content_is_passed(): ok, content = jinja_transform('hello {{ content }}!', 'world') assert ok is True assert content == "hello world!" def test_lines_are_...
assert content == "b"
Next line prediction: <|code_start|> logger = logging.getLogger(__name__) HOME_PAGE = 'https://kibitzr.github.io/' def persistent_firefox(): if not os.path.exists(PROFILE_DIR): os.makedirs(PROFILE_DIR) print("Kibitzr is running Firefox in persistent profile mode.") with firefox(headless=False) ...
)
Next line prediction: <|code_start|> driver.get(HOME_PAGE) while True: prompt_return() try: # Property raises when browser is closed: driver.title except: # All kinds of things happen when closing Firefox ...
"lock",
Predict the next line for this snippet: <|code_start|> # Property raises when browser is closed: driver.title except: # All kinds of things happen when closing Firefox break else: update_profile(driver) ...
),
Predict the next line for this snippet: <|code_start|> logger = logging.getLogger(__name__) HOME_PAGE = 'https://kibitzr.github.io/' def persistent_firefox(): if not os.path.exists(PROFILE_DIR): os.makedirs(PROFILE_DIR) print("Kibitzr is running Firefox in persistent profile mode.") with firefox(...
)
Continue the code snippet: <|code_start|> logger = logging.getLogger(__name__) def notify_factory(conf, value): @functools.wraps(notify) def baked_notify(report): return notify( conf=conf, report=report, notifier_conf=value, ) return baked_notify de...
user = credentials.get('user', '')
Based on the snippet: <|code_start|> logger = logging.getLogger(__name__) def notify_factory(conf, value): @functools.wraps(notify) def baked_notify(report): return notify( conf=conf, report=report, notifier_conf=value, ) return baked_notify def not...
try:
Here is a snippet: <|code_start|> @pytest.mark.parametrize("selector,expected", [ pytest.param('boolean(//body/h2/a)', 'True', id='boolean'), pytest.param("count(//div)", "2.0", id="float"), pytest.param("string(//a)", "Page", id="string"), pytest.param("//body/h2/a/@href", "page.html", id="attribute"...
u'<div class="footer"> Footer content </div>',
Given snippet: <|code_start|># -*- coding: utf-8 -*- @pytest.mark.parametrize("selector,expected", [ pytest.param('boolean(//body/h2/a)', 'True', id='boolean'), pytest.param("count(//div)", "2.0", id="float"), pytest.param("string(//a)", "Page", id="string"), pytest.param("//body/h2/a/@href", "page.h...
assert ok is True
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- def test_tag_selector(): ok, content = run_transform('tag', 'a', HTML) assert ok is True assert content == '<a href="page.html" id="page-link">Page</a>' def test_css_selector(): ok, content = run_transform('css', 'body h2...
u' Footer content',
Continue the code snippet: <|code_start|> def test_tag_selector(): ok, content = run_transform('tag', 'a', HTML) assert ok is True assert content == '<a href="page.html" id="page-link">Page</a>' def test_css_selector(): ok, content = run_transform('css', 'body h2.nav a#page-link', HTML) assert ok ...
assert content.strip() == u"\n".join([
Predict the next line for this snippet: <|code_start|> class BashNotify(object): def __init__(self, value): self.code = value def __call__(self, report): execute_bash(self.code, report) <|code_end|> with the help of current file imports: from ..bash import execute_bash and context from o...
def register(registry):
Given snippet: <|code_start|> scenario = ( (u"hello", True, u"test at web\n@@ -0,0 +1 @@\n+hello"), (u"world", True, u"test at web\n@@ -1 +1 @@\n-hello\n+world"), (u"world", False, None), ) for content, changed, report in scenario: result = page_his...
)
Continue the code snippet: <|code_start|> url: https://www.worldtimeserver.com/current_time_in_US-NY.aspx transform: - css: "span#theTime" - text notify: - python: print(content) schedule: every: 1 unit: day at: "20:30" - name...
mailgun:
Given snippet: <|code_start|> url: https://www.worldtimeserver.com/current_time_in_US-NY.aspx transform: - css: "span#theTime" - text notify: - python: print(content) schedule: every: day at: "6:30" - name: Noon alarm url: https://w...
- every: 1
Next line prediction: <|code_start|> sample_conf = """ notifiers: slack: url: XXX templates: teamcity: transforms: - text - changes: verbose <|code_end|> . Use current file imports: (import pytest from kibitzr.conf import ( settings, ReloadableSettings, Con...
scenario:
Given the following code snippet before the placeholder: <|code_start|> sample_conf = """ notifiers: slack: url: XXX templates: teamcity: transforms: - text <|code_end|> , predict the next line using imports from the current file: import pytest from kibitzr.conf import ( setti...
- changes: verbose
Continue the code snippet: <|code_start|>templates: teamcity: transforms: - text - changes: verbose scenario: login notify: - smtp: kibitzrrr@gmail.com period: 3600 scenarios: login: | driver.find_element_by_css_selector("....
url: https://www.worldtimeserver.com/current_time_in_US-NY.aspx
Continue the code snippet: <|code_start|> sample_conf = """ notifiers: slack: <|code_end|> . Use current file imports: import pytest from kibitzr.conf import ( settings, ReloadableSettings, ConfigurationError, ) from kibitzr.timeline import TimelineRule from ..compat import mock from .helpers import p...
url: XXX
Given snippet: <|code_start|> sample_conf = """ notifiers: slack: url: XXX templates: teamcity: transforms: - text - changes: verbose scenario: login notify: - smtp: kibitzrrr@gmail.com period: 3600 scenarios: login: ...
- name: Project Build Status
Using the snippet: <|code_start|> 'json': LazyJSON(content), 'css': html.css, 'xpath': xml.xpath, 'env': os.environ, } RE_NOT_FLOAT = re.compile(r'[^0-9\.]') def ignore_cast_error(func): @functools.wraps(func) def wrapper(*args, **kwargs): try: ...
return int(text)
Based on the snippet: <|code_start|> 'content': content, 'lines': content.splitlines(), 'json': LazyJSON(content), 'css': html.css, 'xpath': xml.xpath, 'env': os.environ, } RE_NOT_FLOAT = re.compile(r'[^0-9\.]') def ignore_cast_error(fun...
@ignore_cast_error
Given the code snippet: <|code_start|> @ignore_cast_error def dollars_filter(number): sign = '-' if number < 0 else '' return '{0}${1:,}'.format(sign, abs(number)) @ignore_cast_error def int_filter(text): return int(text) @ignore_cast_error def float_filter(text): return float(RE_NOT_FLOAT.sub('', ...
self.text = content
Using the snippet: <|code_start|> RE_NOT_FLOAT = re.compile(r'[^0-9\.]') def ignore_cast_error(func): @functools.wraps(func) def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except (TypeError, ValueError): logger.warning("Invalid value passed in Jinja tr...
return float(RE_NOT_FLOAT.sub('', text))
Given the following code snippet before the placeholder: <|code_start|> logger = logging.getLogger(__name__) class JinjaTransform(object): def __init__(self, code, conf): environment = Environment() environment.filters['text'] = text_filter environment.filters['int'] = int_filter ...
return False, None
Given the code snippet: <|code_start|> logger = logging.getLogger(__name__) NAME = 'python' class PythonNotify(object): def __init__(self, conf, value): <|code_end|> , generate the next line using the imports in this file: import logging from kibitzr.stash import LazyStash from ..conf import settings and con...
self.code = value
Given snippet: <|code_start|> logger = logging.getLogger(__name__) NAME = 'python' class PythonNotify(object): def __init__(self, conf, value): self.code = value self.context = { 'conf': conf, 'creds': settings().creds, } def __call__(self, report): ...
)
Given the code snippet: <|code_start|> class StashNotify(Stash): def __init__(self, conf, value): super(StashNotify, self).__init__() self.conf = conf self.data = value def render(self, report): context = None new_values = {} for key, code in self.data.items():...
ok, value = transform.render(report, context)
Here is a snippet: <|code_start|> class StashNotify(Stash): def __init__(self, conf, value): super(StashNotify, self).__init__() self.conf = conf self.data = value def render(self, report): context = None new_values = {} for key, code in self.data.items(): ...
self.write(new_values)
Continue the code snippet: <|code_start|> def test_fill_form_sample(target): conf = { 'name': 'Test page', 'url': "http://{0}:{1}/form.html".format(*target), 'form': [ {'id': 'name', 'value': '{{ "name" | sort | join("") }}'}, <|code_end|> . Use current file imports: from kibit...
{'css': '#pass', 'creds': 'pass'}
Given the following code snippet before the placeholder: <|code_start|> class SettingsMock(ReloadableSettings): def __init__(self): self.checks = [] self.notifiers = {} self.creds = {'pass': 'password'} @classmethod def instance(cls): ReloadableSettings._instance = cls()...
def stash_mock():
Continue the code snippet: <|code_start|> class SettingsMock(ReloadableSettings): def __init__(self): self.checks = [] <|code_end|> . Use current file imports: import contextlib import tempfile from kibitzr.conf import ReloadableSettings from kibitzr.stash import Stash from .compat import mock and con...
self.notifiers = {}
Given snippet: <|code_start|> class SettingsMock(ReloadableSettings): def __init__(self): self.checks = [] self.notifiers = {} self.creds = {'pass': 'password'} @classmethod def instance(cls): ReloadableSettings._instance = cls() return ReloadableSettings._instan...
@staticmethod
Continue the code snippet: <|code_start|> def test_fetch_by_python_script(): ok, content = run_script({'python': 'ok, content = True, "hello"'}) assert ok is True assert content == "hello" def test_python_script_must_define_content(): with pytest.raises(AssertionError): run_script({'python': '...
def test_python_script_has_stash():
Predict the next line for this snippet: <|code_start|> def run_script(script): return fetch_by_script({'script': script}) def test_fetch_by_script_default_is_bash(): ok, content = run_script('echo hello') assert ok is True assert content.strip() == "hello" def test_fetch_by_explicit_bash_script()...
run_script({'python': 'dummy'})
Given the following code snippet before the placeholder: <|code_start|> logger = logging.getLogger(__name__) PYTHON_ERROR = "script.python must set global variables ok and content" def fetch_by_script(conf): code = conf['script'] try: python_code = code['python'] except (KeyError, TypeError): ...
def fetch_by_python(code, conf):
Here is a snippet: <|code_start|> logger = logging.getLogger(__name__) PYTHON_ERROR = "script.python must set global variables ok and content" def fetch_by_script(conf): code = conf['script'] try: python_code = code['python'] except (KeyError, TypeError): # Not a python script pas...
assert 'content' in code, PYTHON_ERROR
Given the following code snippet before the placeholder: <|code_start|> ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class ModuleEntry: def __init__(self, cls: Module, *init_args, **init_kwargs): self.module = sys.modul...
if ('dependencies' in init_kwargs):
Predict the next line for this snippet: <|code_start|> ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class ModuleEntry: def __init__(self, cls: Module, *init_args, **init_kwargs): self.module = sys.modules[cls.__module__...
self.name = cls.__name__
Based on the snippet: <|code_start|> ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class DetailedItem(CommandItem): def __init__(self, discord_context, query, command, is_valid): self.discord_context = discord_context ...
self.channel_id = channel.id
Given the following code snippet before the placeholder: <|code_start|> self.user_id = int(author.id) self.user_name = "{}#{}".format(author.name, author.discriminator) self.timestamp = int(self.discord_context.message.created_at.timestamp() * 1000) # float to milliseconds timestamp se...
'is_valid': bool(self.is_valid),
Given the following code snippet before the placeholder: <|code_start|> ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class AnonymousItem(CommandItem): def __init__(self, discord_context, command, query, is_valid): self.t...
self.query = query
Given the code snippet: <|code_start|> ## Config CONFIG_OPTIONS = utilities.load_config() ## Logging logger = utilities.initialize_logging(logging.getLogger(__name__)) class DynamoManager: def __init__(self): self.enabled = CONFIG_OPTIONS.get('database_enable', False) self.credentials_path = CON...
self.region_name = CONFIG_OPTIONS.get('database_region_name', 'us-east-2')
Given the code snippet: <|code_start|># GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Additional permission under GNU GPL version 3 section 7 # # If you modify this program, or...
def put(self, id, key, remember=False):
Predict the next line for this snippet: <|code_start|> if not passphrase: return None return PBKDF2(passphrase, salt, 16, 1000) def der_pack(*values): return b''.join([int2byte(t) + int2byte(len(v)) + v for t, v in zip( values[0::2], values[1::2])]) def der_read(der_data, expected_t=None)...
l *= 256