Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|> "Number of Object Storage storage zones; this number " "MUST be no larger than the number of configured " "storage devices.", "CONFIG_SWIFT_STORAGE_ZONES", '1', ...
Controller.get().add_group(group, conf[group])
Given the code snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # ...
Argument("swift-ks-pw",
Predict the next line for this snippet: <|code_start|> Argument("swift-storage-replicas", "Number of Object Storage storage replicas; this number " "MUST be no larger than the number of configured " "storage zones.", "CONFIG_...
if util.str2bool(conf['CONFIG_SWIFT_INSTALL']):
Predict the next line for this snippet: <|code_start|># Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # # 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 ...
utils.generate_random_pw(),
Based on the snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # # 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://...
validators=[validators.not_empty]),
Given snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
Argument("amqp-auth-user",
Given snippet: <|code_start|># WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # def init_config(): conf = { "AMQP": [ Argument("amqp-auth-user", ...
Controller.get().add_group(group, conf[group])
Predict the next line after this snippet: <|code_start|># You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDIT...
util.get_ip(),
Predict the next line after this snippet: <|code_start|> "cirros", validators=[validators.not_empty]), Argument("provision-image-url", 'A URL or local file location for an image to download' 'and provision in Glance (defaults...
recipe += utils.get_template(template)
Next line prediction: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lic...
validators=[validators.y_or_n])
Here is a snippet: <|code_start|> ], "PROVISION_DEMO": [ Argument("provision-demo-floatrange", "CIDR network address for the floating IP subnet.", "CONFIG_PROVISION_DEMO_FLOATRANGE", "172.24.4.224/28", validat...
Controller.get().add_group(group, conf[group])
Predict the next line for this snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compl...
Argument("provision-demo",
Given the following code snippet before the placeholder: <|code_start|> validators=[validators.cidr]), Argument("privision-image-format", 'Format for the demo image (default "qcow2").', "CONFIG_PROVISION_IMAGE_FORMAT", "qcow2...
if util.str2bool(conf['CONFIG_PROVISION_DEMO']):
Given snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
LOG.info(self.description)
Predict the next line after this snippet: <|code_start|> "KEYSTONE": [ Argument("keystone-db-pw", "Password for keystone to access DB", "CONFIG_KEYSTONE_DB_PW", utils.generate_random_pw(), validators=[validators.not_e...
Controller.get().add_group(group, conf[group])
Based on the snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License...
Argument("keystone-db-pw",
Given the code snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licen...
utils.generate_random_pw(),
Given the following code snippet before the placeholder: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ex...
validators=[validators.not_empty]),
Here is a snippet: <|code_start|># distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # def init_config(): conf = { ...
Controller.get().add_group(group, conf[group])
Predict the next line after this snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complia...
Argument("mariadb-host",
Predict the next line after this snippet: <|code_start|># you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License...
utils.generate_random_pw(),
Given snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
validators=[validators.ip_or_hostname]),
Continue the code snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
util.get_ip(),
Given the code snippet: <|code_start|> except AttributeError: LOG.debug("missing attribute: init_config in %s", plugin.__file__) def add_arguments(parser): load_plugins() for group in Controller.get().get_all_groups(): for argument in group.get_all_arguments():...
utils.copy_resources()
Continue the code snippet: <|code_start|># http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the Lice...
LOG.debug("missing attribute: init_config in %s",
Given the following code snippet before the placeholder: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in ...
for group in Controller.get().get_all_groups():
Predict the next line for this snippet: <|code_start|> for group in Controller.get().get_all_groups(): for argument in group.get_all_arguments(): f.write("# {0}\n".format(argument.description)) value = variables_cmd.get(argument.conf_name, ...
LOG.warn("clearstack: variable {0} is not"
Continue the code snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
utils.generate_random_pw(),
Given the following code snippet before the placeholder: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ex...
validators=[validators.not_empty]),
Given the following code snippet before the placeholder: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ex...
Controller.get().add_group(group, conf[group])
Based on the snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License...
Argument("glance-db-pw",
Here is a snippet: <|code_start|># See the License for the specific language governing permissions and # limitations under the License. # def init_config(): conf = { "GLANCE": [ Argument("glance-db-pw", "Password for glance to access DB", "CONFIG_GLAN...
if util.str2bool(conf['CONFIG_GLANCE_INSTALL']):
Here is a snippet: <|code_start|># You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe...
AnswerFile.get().generate(filename, {})
Based on the snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
Controller.get().add_group(group, conf[group])
Given the following code snippet before the placeholder: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in ...
help_text = utils.shell('--help')
Continue the code snippet: <|code_start|># # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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/...
Controller.get().add_group(group, conf[group])
Given snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # # ht...
Argument("mongodb-host",
Given snippet: <|code_start|># See the License for the specific language governing permissions and # limitations under the License. # def init_config(): conf = { "MONGODB": [ Argument("mongodb-host", "The IP address or hostname of the MongoDB server", ...
recipe = utils.get_template('mongodb')
Given snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # # ht...
validators=[validators.ip_or_hostname])
Given snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # # ht...
util.get_ip(),
Given the following code snippet before the placeholder: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # # 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...
_shell = clearstack_shell.ClearstackConfiguratorShell()
Given the following code snippet before the placeholder: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file ex...
utils.generate_random_pw(),
Predict the next line after this snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complia...
validators=[validators.not_empty]),
Given the following code snippet before the placeholder: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either ex...
Controller.get().add_group(group, conf[group])
Based on the snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License...
Argument("nova-db-pw",
Predict the next line for this snippet: <|code_start|># See the License for the specific language governing permissions and # limitations under the License. # def init_config(): conf = { "NOVA": [ Argument("nova-db-pw", "Password for nova to access DB", ...
if util.str2bool(conf['CONFIG_NOVA_INSTALL']):
Based on the snippet: <|code_start|> return parser def main(self, argv): self.parser = self.get_base_parser() run_setup.add_arguments(self.parser) (options, args) = self.parser.parse_known_args(argv) utils.setup_debugging(options.debug) LOG.debug('Starting clearstac...
ansfile = AnswerFile.get()
Here is a snippet: <|code_start|> parser.add_argument('--version', action='version', version=clearstack.__version__, help="Shows the client version and exits.") parser.add_argument('-d', '--d...
run_setup.add_arguments(self.parser)
Predict the next line after this snippet: <|code_start|> action='version', version=clearstack.__version__, help="Shows the client version and exits.") parser.add_argument('-d', '--debug', ...
utils.setup_debugging(options.debug)
Predict the next line after this snippet: <|code_start|> help="Shows the client version and exits.") parser.add_argument('-d', '--debug', action='store_true', help="Enable debug mode in clearstack") ...
LOG.debug('Starting clearstack')
Predict the next line after this snippet: <|code_start|># Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governi...
self.assertRaises(Exception, util.run_command, "inexistente")
Given snippet: <|code_start|># DEBUG = False @Singleton class Controller: CONF = {} _plugins = [] _groups = [] _sequences = [] def add_sequence(self, desc, function, args=None): self._sequences.append(Sequence(desc, function, args)) def run_all_sequences(self): for seq in s...
self._groups.append(Group(name, args))
Next line prediction: <|code_start|># Copyright (c) 2015 Intel Corporation # # Author: Julio Montes <julio.montes@intel.com> # Author: Victor Morales <victor.morales@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
self._sequences.append(Sequence(desc, function, args))
Next line prediction: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # # ...
utils.generate_random_pw(),
Using the snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # # ...
validators=[validators.not_empty]),
Here is a snippet: <|code_start|> "CONFIG_HEAT_DB_PW", utils.generate_random_pw(), validators=[validators.not_empty]), Argument("heat-ks-pw", "Password to use for Heat to" " authenticate with Keystone", ...
Controller.get().add_group(group, conf[group])
Next line prediction: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # # 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 # # ...
Argument("heat-db-pw",
Given the code snippet: <|code_start|> "CONFIG_HEAT_KS_PW", utils.generate_random_pw(), validators=[validators.not_empty]), Argument("heat-domain", "Name of the Identity domain for Orchestration.", "CONFI...
if util.str2bool(conf['CONFIG_HEAT_INSTALL']):
Using the snippet: <|code_start|># # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Argument("debug-mode",
Given snippet: <|code_start|> " OpenStack Networking (neutron)", "CONFIG_NEUTRON_INSTALL", "y", options=['y', 'n'], validators=[validators.y_or_n]), Argument("ceilometer-install", "Se...
Controller.get().add_group(group, conf[group])
Predict the next line after this snippet: <|code_start|># # Copyright (c) 2015 Intel Corporation # # Author: Alberto Murillo <alberto.murillo.silva@intel.com> # Author: Julio Montes <julio.montes@intel.com> # Author: Obed Munoz <obed.n.munoz@intel.com> # # Licensed under the Apache License, Version 2.0 (the "License");...
validators.file(ssh_key)
Predict the next line after this snippet: <|code_start|># Command line entry point for cancat2candump def main(): argv = sys.argv[1:] parser = argparse.ArgumentParser( prog='cancat2candump', description='Utility to convert a CanCat session into a candump log') parser.add_argument...
convert.cancat2candump(args.session, args.output)
Given the code snippet: <|code_start|># Command line entry point for cancat2pcap # This requires scapy to be installed def main(): argv = sys.argv[1:] parser = argparse.ArgumentParser( prog='cancat2pcap', desc...
convert.cancat2pcap(args.session, args.output)
Given the following code snippet before the placeholder: <|code_start|># Command line entry point for candump2cancat def main(): argv = sys.argv[1:] parser = argparse.ArgumentParser( prog='candump2cancat', ...
convert.candump2cancat(args.log, args.output)
Next line prediction: <|code_start|># Command line entry point for candump2cancat # This requires scapy to be installed def main(): argv = sys.argv[1:] parser = argparse.ArgumentParser( prog='pcap2cancat', description='Utility to convert a pcap with CAN messages into a CanCat session...
convert.pcap2cancat(args.pcap, args.output)
Continue the code snippet: <|code_start|> def __iter__(self): return self def __len__(self): if hasattr(self, 'count'): return self.count elif self.values is not None: return len(self.values) else: return 0 def __next__(self): retu...
return response_objects[as_plural(self.object_type)]
Based on the snippet: <|code_start|> end_time = self._response_json.get('end_time', None) # If we are calling an incremental API, make sure to honour the restrictions if end_time: # We can't request updates from an incremental api if the # start_time value is less than 5 m...
except SearchResponseLimitExceeded:
Predict the next line after this snippet: <|code_start|> elif value: parameters[key] = value elif key in ('since_id', 'ticket_id', 'issue_id'): # Jira integration parameters[key] = value # this is a bit of a hack ...
raise ZenpyException(
Predict the next line after this snippet: <|code_start|> """ def __call__(self, **kwargs): parameters = {} path = self.endpoint for key, value in kwargs.items(): if key == 'id': path += "/{}.json".format(value) elif key == 'ids': pat...
] if not is_iterable_but_not_string(value) else value
Given the following code snippet before the placeholder: <|code_start|> return Url(self.endpoint % dict(id=id), params=kwargs) class MultipleIDEndpoint(BaseEndpoint): def __call__(self, *args): if not args or len(args) < 2: raise ZenpyException( "This endpoint requires a...
unix_time = to_unix_ts(start_time)
Continue the code snippet: <|code_start|> class TestCategoryCreateUpdateDelete( SingleUpdateApiTestCase, SingleCreateApiTestCase, SingleDeleteApiTestCase ): __test__ = True <|code_end|> . Use current file imports: from zenpy.lib.api_objects.help_centre_objects import Category from test_api.fixtures import ( ...
ZenpyType = Category
Here is a snippet: <|code_start|> self.stream = environment._tokenize(source, name, filename, state) self.name = name self.filename = filename self.closed = False self.extensions = {} for extension in environment.extensions.itervalues(): for tag in extension.ta...
rv = object.__new__(nodes.InternalName)
Given the following code snippet before the placeholder: <|code_start|> :copyright: 2008 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ _statement_keywords = frozenset(['for', 'if', 'block', 'extends', 'print', 'macro', 'include', 'from', 'import', ...
def fail(self, msg, lineno=None, exc=TemplateSyntaxError):
Using the snippet: <|code_start|> node = nodes.Import(lineno=self.stream.next().lineno) node.template = self.parse_expression() self.stream.expect('name:as') node.target = self.parse_assign_target(name_only=True).name return self.parse_import_context(node, False) def parse_fr...
exc=TemplateAssertionError)
Given the code snippet: <|code_start|> locals = {} for name, value in real_locals.iteritems(): if name.startswith('l_'): locals[name[2:]] = value # if there is a local called __jinja_exception__, we get # rid of it to not break the debug functionality. locals.pop('__jinja_exc...
code = CodeType(0, code.co_nlocals, code.co_stacksize,
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- """ jinja2.defaults ~~~~~~~~~~~~~~~ Jinja default filters and tags. :copyright: 2007-2008 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ # defaults for the parser / lexer BLOCK_START_STRING = '{%...
'lipsum': generate_lorem_ipsum,
Given the code snippet: <|code_start|> and modify the AST in place so that it should be easier to evaluate it. Because the AST does not contain all the scoping information and the compiler has to find that out, we cannot do all the optimizations we want. For example loop unrolling doesn't work because ...
if node.find(nodes.Block) is not None:
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ jinja2.optimizer ~~~~~~~~~~~~~~~~ The jinja optimizer is currently trying to constant fold a few expressions and modify the AST in place so that it should be easier to evaluate it. Because the AST does not contain all the scoping...
class Optimizer(NodeTransformer):
Here is a snippet: <|code_start|> """Put the bucket into the cache.""" self.dump_bytecode(bucket) class FileSystemBytecodeCache(BytecodeCache): """A bytecode cache that stores bytecode on the filesystem. It accepts two arguments: The directory where the cache items are stored and a pattern...
f = open_if_exists(self._get_cache_filename(bucket), 'rb')
Here is a snippet: <|code_start|> def test_odd(value): """Return true if the variable is odd.""" return value % 2 == 1 def test_even(value): """Return true if the variable is even.""" return value % 2 == 0 def test_divisibleby(value, num): """Check if a variable is divisible by a number.""" ...
return not isinstance(value, Undefined)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ # these variables are exported to the template runtime __all__ = ['LoopContext', 'Context', 'TemplateReference', 'Macr...
return Markup(u'').join(chain(buf, iterator))
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ # these variables are exported to the template runtime __all__ = ['LoopContext', 'Context', 'TemplateReference', 'Macr...
iterator = imap(soft_unicode, seq)
Next line prediction: <|code_start|># -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ # these variables are exported to the template runtime __all__ = ['LoopContext', 'Context', 'TemplateReference', 'Macro'...
return concat(buf)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ # these variables are exported to the template runtime __all__ = ['LoopContext', 'Con...
_context_function_types = (FunctionType, MethodType)
Given snippet: <|code_start|># -*- coding: utf-8 -*- """ jinja2.runtime ~~~~~~~~~~~~~~ Runtime helpers. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ # these variables are exported to the template runtime __all__ = ['LoopContext', 'Context', 'TemplateReference', 'Macro', 'Mark...
_context_function_types = (FunctionType, MethodType)
Predict the next line for this snippet: <|code_start|> arguments.append(args[self._argument_count:]) elif len(args) > self._argument_count: raise TypeError('macro %r takes not more than %d argument(s)' % (self.name, len(self.arguments))) return self._fu...
def __init__(self, hint=None, obj=None, name=None, exc=UndefinedError):
Given the code snippet: <|code_start|> def visit(self, node, *args, **kwargs): """Visit a node.""" f = self.get_visitor(node) if f is not None: return f(node, *args, **kwargs) return self.generic_visit(node, *args, **kwargs) def generic_visit(self, node, *args, **kwa...
if isinstance(value, Node):
Next line prediction: <|code_start|>#!/usr/bin/python if __name__ == '__main__': if not os.path.exists("logs"): os.makedirs("logs") redis = Redis(host=os.environ['REDIS_HOST'], port=int(os.environ['REDIS_PORT']), db=int(os.environ['REDIS_DB'])) <|code_end|> . Use current file imports: (from redis ...
sql = sm()
Predict the next line for this snippet: <|code_start|>#!/usr/bin/python if __name__ == '__main__': if not os.path.exists("logs"): os.makedirs("logs") redis = Redis(host=os.environ['REDIS_HOST'], port=int(os.environ['REDIS_PORT']), db=int(os.environ['REDIS_DB'])) sql = sm() current_time = d...
export_chat(redis, sql, chat)
Next line prediction: <|code_start|> abort(404) if log.url is not None: return redirect(url_for('view_log', chat=log.url)) abort(404) @app.route('/chat/<chat>/log') def view_log(chat=None): try: log = g.mysql.query(Log).filter(Log.url==chat).one() except NoResultFound: a...
lines = filter(lambda x: x is not None, map(lambda _: parse_line(_, 0), lines))
Continue the code snippet: <|code_start|># Export config app.config['PROPAGATE_EXCEPTIONS'] = True app.config['EXPORT_URL'] = os.environ.get("EXPORT_URL", "http://unsupportedlogs.msparp.com") app.wsgi_app = ProxyFix(app.wsgi_app, 2) # Pre and post request stuff app.before_request(connect_mysql) app.teardown_request(d...
log = g.mysql.query(Log).filter(Log.id==log_id).one()
Next line prediction: <|code_start|>@app.route('/logs/group/<chat>') def old_view_log(chat): return redirect(url_for('view_log', chat=chat)) @app.route('/logs/<log_id>') def view_log_by_id(log_id=None): try: log_id = int(log_id) except ValueError: abort(400) try: log = g.mysql.q...
log_page = g.mysql.query(LogPage).filter(and_(LogPage.log_id==log.id, LogPage.number==current_page)).one()
Given the code snippet: <|code_start|> app = Flask(__name__) # Export config app.config['PROPAGATE_EXCEPTIONS'] = True app.config['EXPORT_URL'] = os.environ.get("EXPORT_URL", "http://unsupportedlogs.msparp.com") app.wsgi_app = ProxyFix(app.wsgi_app, 2) # Pre and post request stuff <|code_end|> , generate the next ...
app.before_request(connect_mysql)
Predict the next line for this snippet: <|code_start|> app = Flask(__name__) # Export config app.config['PROPAGATE_EXCEPTIONS'] = True app.config['EXPORT_URL'] = os.environ.get("EXPORT_URL", "http://unsupportedlogs.msparp.com") app.wsgi_app = ProxyFix(app.wsgi_app, 2) # Pre and post request stuff app.before_reques...
app.teardown_request(disconnect_mysql)
Given the code snippet: <|code_start|> colored(gethostname(), 'blue'), colored(':', 'cyan'), colored('rpl-attacks', 'red'), colored('>>', 'cyan'), )) welcome = "\nType help or ? to list commands.\n" def __init__(self, parallel): self.continuation_prompt = self.prompt ...
for name, func in get_commands():
Based on the snippet: <|code_start|>def read_config(path, sep=' = '): """ This helper function reads a simple configuration file with the following format: max_range = 50.0 repeat = 1 blocks = [] goal = "" ... :param path: path to the configuration file :param sep: ...
logger.error("Configuration file 'simulation.conf' does not exist !")
Based on the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- @task def console(): """ Open framework's console. """ with settings(remote_interrupt=False): local('python main.py') <|code_end|> , predict the immediate next line with the help of imports: from fabric.api import lo...
for name, func in get_commands(exclude=['list']):
Continue the code snippet: <|code_start|> source = f.read() for line in source.split('\n'): if pattern in line: return True return False def modify_cooja(cooja_dir): """ This function inserts a block in the IF statement for parsing Cooja's input arguments. It searches fo...
logger.debug(" > Cooja.java modified" if changed else " > Cooja.java already up-to-date")
Next line prediction: <|code_start|>class ExperimentTestCase(unittest.TestCase): path = expanduser(join(EXPERIMENT_FOLDER, JSON)) backup = path + '.backup' class Test6Prepare(ExperimentTestCase): """ 6. Prepare a simulation campaign """ @classmethod def setUpClass(cls): if exists(cls.path...
drop(JSON, ask=False, silent=True)
Based on the snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- JSON = 'test-campaign.json' class ExperimentTestCase(unittest.TestCase): path = expanduser(join(EXPERIMENT_FOLDER, JSON)) backup = path + '.backup' class Test6Prepare(ExperimentTestCase): """ 6. Prepare a simulation cam...
prepare(JSON, ask=False, silent=True)