Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given the following code snippet before the placeholder: <|code_start|> 'list_campaigns', 'list_experiments', 'list_wsn_gen_algorithms', 'render_campaign', 'render_templates', 'validated_parameters', ] # *********************************************** GET FUNCTIONS *****************************...
return_json=True, logger=logger) or {}
Continue the code snippet: <|code_start|> return self.command(*args, **kwargs) class MultiprocessedCommand(DefaultCommand): """ This class handles command multi-processing and is to be attached to a console through its constructor's arguments. """ is_multiprocessed = True def __init__...
self.tasklist[self]['expires'] = datetime.now() + timedelta(seconds=TASK_EXPIRATION)
Given the code snippet: <|code_start|> if path is not None else [] def run(self, *args, **kwargs): return self.command(*args, **kwargs) class MultiprocessedCommand(DefaultCommand): """ This class handles command multi-processing and is to be attached to a console through its co...
logger.debug(' > Process {} is over.'.format(self))
Using the snippet: <|code_start|> make(SIM, ask=False, silent=True) def test1_experiment_structure(self): """ > Is the new experiment correctly structured ? """ self.assertTrue(check_structure(self.path)) class Test4Remake(ExperimentTestCase): """ 4. Remake the same example experiment ...
clean(SIM, ask=False, silent=True)
Given the code snippet: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- SIM = 'test-simulation' class ExperimentTestCase(unittest.TestCase): path = expanduser(join(EXPERIMENT_FOLDER, SIM)) backup = path + '.backup' class Test3Make(ExperimentTestCase): """ 3. Make an example experiment """...
make(SIM, ask=False, silent=True)
Given the code snippet: <|code_start|> SIM = 'test-simulation' class ExperimentTestCase(unittest.TestCase): path = expanduser(join(EXPERIMENT_FOLDER, SIM)) backup = path + '.backup' class Test3Make(ExperimentTestCase): """ 3. Make an example experiment """ @classmethod def setUpClass(cls): ...
remake(SIM, silent=True)
Next line prediction: <|code_start|>#!/usr/bin/env python # -*- coding: utf-8 -*- SIM = 'test-simulation' class ExperimentTestCase(unittest.TestCase): path = expanduser(join(EXPERIMENT_FOLDER, SIM)) backup = path + '.backup' class Test3Make(ExperimentTestCase): """ 3. Make an example experiment """ ...
self.assertTrue(check_structure(self.path))
Given the following code snippet before the placeholder: <|code_start|> '-e', 'wpan.dst64', '-e', 'icmpv6.type', '-e', 'ipv6.src', '-e', 'ipv6.dst', '-e', 'icmpv6.code', '-e', 'data.data', ...
platforms = [p.capitalize() for p in get_available_platforms()]
Given snippet: <|code_start|> time_field = '{}_time'.format(it) row[time_field] = float(row[time_field] / 10 ** 6) writer.writerow(row) RELATIONSHIP_REGEX = r'^\d+\s+ID\:(?P<mote_id>\d+)\s+#L\s+(?P<parent_id>\d+)\s+(?P<flag>\d+)$' def __draw_dodag(path, logger=None): "...
motes = get_motes_from_simulation(join(path, 'simulation.csc'))
Predict the next line for this snippet: <|code_start|> k = 'web-port' else: k = '%s-port' % mon_method params['monitor']['method'][mon_method][k] = int(port) params['monitor']['override-port'] = int(port) # handle POST case for HTTP/HTTPS hm ...
except acos_errors.NotFound:
Here is a snippet: <|code_start|># # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
except acos_errors.NotFound:
Predict the next line for this snippet: <|code_start|># Copyright (C) 2016, A10 Networks Inc. All rights reserved. # 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://w...
self.target = vrid.VRID(self.client)
Predict the next line after this snippet: <|code_start|># # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
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. ...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
Given the code snippet: <|code_start|> conn_resume=None, conn_limit=None, health_check=None, **kwargs): params = self._set(name, ip_address, status=status, port_list=port_list, conn_resume=conn_resume, conn_limit=conn_limit, health_check=health_check, ...
return Port(self.client)
Predict the next line after this snippet: <|code_start|># Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
Predict the next line for this snippet: <|code_start|># 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 CONDITIO...
except acos_errors.NotFound:
Based on the snippet: <|code_start|># not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distribut...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
Given snippet: <|code_start|># Copyright (C) 2021, A10 Networks Inc. All rights reserved. # 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/LI...
return license.LicenseRequest(self.client)
Predict the next line after this snippet: <|code_start|># Copyright (C) 2021, A10 Networks Inc. All rights reserved. # 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:/...
return proxy.ProxyServer(self.client)
Based on the snippet: <|code_start|># not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distribut...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
Predict the next line after this snippet: <|code_start|># Copyright 2014, Jeff Buttars, A10 Networks. # # 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....
return Member(self.client)
Predict the next line after this snippet: <|code_start|> "used to define a new license: existing_org, " "existing_user, new_user, or name. These cannot " "be used in conjuction.") super(MultiLicenseException, self).__init__() class NewLice...
raise acos_errors.RequiredAttributeNotSpecified(
Continue the code snippet: <|code_start|># Copyright (C) 2016, A10 Networks Inc. All rights reserved. # 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...
self.target = dns.DNS(self.client)
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. Se...
raise ae.ACOSUnknownError()
Predict the next line after this snippet: <|code_start|># Copyright 2014, Doug Wiegley, A10 Networks. # # 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....
'*': ae.InUse
Using the snippet: <|code_start|># http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # ...
except ae.AxapiJsonFormatError:
Given the following code snippet before the placeholder: <|code_start|> def _set(self, name, start_ip, end_ip, mask, ip_rr=None, vrid=None, gateway=None): params = { "pool": self.minimal_dict( { 'pool-name': name, 's...
except acos_errors.NotFound:
Here is a snippet: <|code_start|># Copyright (C) 2021, A10 Networks Inc. All rights reserved. # 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/license...
class ProxyServer(base.BaseV30):
Given the code snippet: <|code_start|># Copyright 2015, Tobit Raff, A10 Networks. # # 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...
except acos_errors.NotFound:
Given the code snippet: <|code_start|># Copyright (C) 2021, A10 Networks Inc. All rights reserved. # 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/li...
def glm_license(self):
Here is a 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 # ...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
Next line prediction: <|code_start|> commands = [] if use_mgmt_port: commands += ["license-manager use-mgmt-port"] for host in llp_hosts: commands += ["license-manager host %s" % host] commands += [ "license-manager sn %s" % sn, "license-man...
except acos_errors.ACOSException as e:
Given the code snippet: <|code_start|># Copyright (C) 2016, A10 Networks Inc. All rights reserved. # 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/li...
class LicenseManager(base.BaseV30):
Using the snippet: <|code_start|> def _update( self, virtual_server_name, name, protocol, protocol_port, service_group_name, s_pers_name=None, c_pers_name=None, status=1, autosnat=None, ipinip=None, no_dest_nat=None, ...
raise ae.NotFound()
Here is a snippet: <|code_start|># Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
self.client = client.Client(HOSTNAME, '30', 'fake_username', 'fake_password')
Continue the code snippet: <|code_start|># Copyright 2015, Tobit Raff, A10 Networks. # # 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/LICE...
except acos_errors.NotFound:
Continue the code 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...
self.port = port.Port(self.client)
Predict the next line for this snippet: <|code_start|> @click.command(short_help='Creates and opens file with template code.') @click.argument('code_file', type=click.Path(writable=True, dir_okay=False), required=False) @click.option('--editor', help="Specify the editor to...
@handle_exceptions(BaseException)
Here is a snippet: <|code_start|> @click.command(short_help='Creates and opens file with template code.') @click.argument('code_file', type=click.Path(writable=True, dir_okay=False), required=False) @click.option('--editor', help="Specify the editor to launch the file with...
default=config.read('settings.yml', 'editor'))
Given the code snippet: <|code_start|> TODO [WIP]: If other code file(s) exist, it should suggests to open the most recently edited one. Template for the code is loaded based upon extension. See 'termicoder config' for editing default templates, editor, and language preferences. ''' if...
logger.debug(code_to_write)
Predict the next line for this snippet: <|code_start|> code_file = click.prompt( "Please enter a file name", default=default_name, type=click.Path(writable=True, dir_okay=False)) extension = code_file.split('.')[-1] template = config.read('lang/%s/template.yml' % extension) i...
launch(editor, code_file)
Predict the next line for this snippet: <|code_start|> If CODE_FILE is not passed, a default name of file is suggested based on current directory, language preferences and existing files in directory. Default CODE_FILE is <PROBLEM_NAME>.<DEFAULT_EXTENSION> if user is in a problem folder and no other...
status, editor = substitute(editor, template)
Based on the snippet: <|code_start|> type=click.Path(writable=True, dir_okay=False), required=False) @click.option('--editor', help="Specify the editor to launch the file with.", default=config.read('settings.yml', 'editor')) @handle_exceptions(BaseException) d...
default_name = get_default_code_name()
Here is a snippet: <|code_start|> @click.command() def main(): """ Remove the configuration directory. """ if(check_config_path()): <|code_end|> . Write the next line using the current file imports: import click import shutil from ...utils.config import get_config_path, check_config_path from ...util...
config_path = get_config_path()
Using the snippet: <|code_start|> @click.command() def main(): """ Remove the configuration directory. """ <|code_end|> , determine the next line of code. You have imports: import click import shutil from ...utils.config import get_config_path, check_config_path from ...utils.logging import logger and c...
if(check_config_path()):
Predict the next line for this snippet: <|code_start|> @click.command() def main(): """ Remove the configuration directory. """ if(check_config_path()): config_path = get_config_path() <|code_end|> with the help of current file imports: import click import shutil from ...utils.config import ...
logger.warn("This will completely erase %s" % config_path)
Using the snippet: <|code_start|> self.status = None self.submission_count = 0 self.testcases = None self.judge_name = "codechef" self.timelimit = float(3.0) if(data is not None): self._initialize() def _initialize(self): concerned_data = self.data...
logger.debug(myHtmlFragment)
Next line prediction: <|code_start|> self._initialize() def _initialize(self): concerned_data = self.data['result']['data']['content'] problem_content = namedtuple( "problem", concerned_data.keys())(*concerned_data.values()) self.name = problem_content.problemName ...
testcases = extract(html)
Predict the next line for this snippet: <|code_start|> @click.command(short_help='Copies code from file to clipboard.') @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) @handle_exceptions(BaseException) def main(code_file): ''' Copies co...
logger.info("copied %s to clipboard" % code_file)
Given snippet: <|code_start|> @click.command(short_help='Copies code from file to clipboard.') @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) <|code_end|> , continue by predicting the next line. Consider current file imports: import click imp...
@handle_exceptions(BaseException)
Predict the next line after this snippet: <|code_start|> @click.command(short_help='Copies code from file to clipboard.') @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) @handle_exceptions(BaseException) def main(code_file): ''' Copies ...
default_file = get_default_code_name()
Continue the code snippet: <|code_start|> judge_factory = JudgeFactory() @click.command() @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) @handle_exceptions(BaseException) def main(code_file): ''' Submit a solution. You should be in a problem dir...
logger.error("You should be in a problem directory to submit")
Given the code snippet: <|code_start|> judge_factory = JudgeFactory() @click.command() @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) <|code_end|> , generate the next line using the imports in this file: import click import os from ..utils.logging import lo...
@handle_exceptions(BaseException)
Next line prediction: <|code_start|> @click.command() @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) @handle_exceptions(BaseException) def main(code_file): ''' Submit a solution. You should be in a problem directory to submit \b Script wi...
problem = yaml.read('.problem.yml')
Using the snippet: <|code_start|> judge_factory = JudgeFactory() @click.command() @click.argument('code_file', type=click.Path(exists=True, dir_okay=False), required=False) @handle_exceptions(BaseException) def main(code_file): ''' Submit a solution. You should be in a problem directory t...
default_file = get_default_code_name()
Given the following code snippet before the placeholder: <|code_start|> judge_factory = JudgeFactory() OJs = judge_factory.available_judges if default_judge is None: try: default_judge = OJs[0] except IndexError: pass @click.command(short_help="List a particular contest.") @click.option('-j', ...
logger.error('Not implemented list contest in this version')
Continue the code snippet: <|code_start|> judge_factory = JudgeFactory() OJs = judge_factory.available_judges if default_judge is None: try: default_judge = OJs[0] except IndexError: pass @click.command(short_help="List a particular contest.") @click.option('-j', '--judge', type=click.Choice(O...
@handle_exceptions(BaseException)
Given the following code snippet before the placeholder: <|code_start|> @click.command() @handle_exceptions(BaseException) def main(): ''' Launches custom debug interface. Here you can use testcase generator, launch debugger for the particular language and visualize the output. NOTE: This ...
logger.info(
Continue the code snippet: <|code_start|> def transpose_running_oauth(x): return { 'code': x['code'], 'endDate': datetime.strptime(x['endDate'], '%Y-%m-%d %H:%M:%S'), 'startDate': datetime.strptime(x['endDate'], '%Y-%m-%d %H:%M:%S'), 'name': x['name'] } def running_contests(se...
logger.debug("got running")
Given the code snippet: <|code_start|> @click.command() def main(): """ Initialize the config directory. """ config_path = get_config_path() <|code_end|> , generate the next line using the imports in this file: import click import os import termicoder.data.config as config_data import shutil from ......
logger.info("Setting up configuration at '{config_dest}'".format(
Using the snippet: <|code_start|> @click.command() def main(): """ Initialize the config directory. """ <|code_end|> , determine the next line of code. You have imports: import click import os import termicoder.data.config as config_data import shutil from ...utils.logging import logger from ...utils.con...
config_path = get_config_path()
Given the code snippet: <|code_start|> directory_path = testcase_dir inp_path = os.path.join( directory_path, '%s.in' % testcase.code) ans_path = os.path.join( directory_path, '%s.ans' % testcase.code) logger.debug(inp_path) logger.debug(ans_path) o...
assert isinstance(problem, Problem)
Based on the snippet: <|code_start|> # output testcases try: assert isinstance(problem, Problem) directory_path = os.path.join(problem_dir, problem.code) problem_path = os.path.join(directory_path, '.problem.yml') logger.debug(problem_path) os.makedirs(directory_path) ...
assert isinstance(contest, Contest)
Using the snippet: <|code_start|> def output_testcase(testcase, testcase_dir): try: assert isinstance(testcase, Testcase) directory_path = testcase_dir inp_path = os.path.join( directory_path, '%s.in' % testcase.code) ans_path = os.path.join( directory_path, ...
logger.debug(inp_path)
Predict the next line after this snippet: <|code_start|> def output_testcase(testcase, testcase_dir): try: assert isinstance(testcase, Testcase) directory_path = testcase_dir inp_path = os.path.join( directory_path, '%s.in' % testcase.code) ans_path = os.path.join( ...
inp_file.write(testcase.inp)
Given the following code snippet before the placeholder: <|code_start|> def handle_exceptions(*exceptions): """ Used as a decorator. Takes exceptions and a function, returns function warpped with try except and debug functionality """ # TODO correct the line number def wrapper(function): ...
logger.debug(
Predict the next line for this snippet: <|code_start|>try: except ImportError: def read(file_path, key=None, safe=False): if(not os.path.exists(file_path)): return None data_file = click.open_file(file_path) value = None try: data = yaml.load(data_file, Loader=Loader) data_fil...
logger.debug("read data from file %s" % file_path)
Using the snippet: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("FOLDER", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @handle_exceptions(BaseException) def main(folder): ''' Display the termicoder contents in current/pa...
logger.warn('list is not colored in this version')
Given snippet: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("FOLDER", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') <|code_end|> , continue by predicting the next line. Consider current file imports: import click import subproce...
@handle_exceptions(BaseException)
Here is a snippet: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("FOLDER", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @handle_exceptions(BaseException) def main(folder): ''' Display the termicoder contents in current/pa...
p_or_c = get_problem_or_contest(folder)
Next line prediction: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("FOLDER", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @handle_exceptions(BaseException) def main(folder): ''' Display the termicoder contents in current...
assert(isinstance(p_or_c, Problem) or isinstance(p_or_c, Contest))
Predict the next line after this snippet: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("FOLDER", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @handle_exceptions(BaseException) def main(folder): ''' Display the termicoder...
assert(isinstance(p_or_c, Problem) or isinstance(p_or_c, Contest))
Using the snippet: <|code_start|> @click.command() def main(): """ Edit the configuration. Launches the config folder for modifying settings. """ <|code_end|> , determine the next line of code. You have imports: import click from ...utils.config import get_config_path and context (class names, func...
config_path = get_config_path(ensure_exists=True)
Given snippet: <|code_start|>#!/usr/bin/python # -*- coding: utf-8 -*- # ABC is the AbstractBaseClass in python class Testcase(ABC): @abstractmethod def __init__(self, ans, inp, code): self.ans = ans self.inp = inp self.code = code # judges can override this if they want # th...
diffobj = icdiff.ConsoleDiff(line_numbers=True, show_all_spaces=True)
Given snippet: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("dir_name", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @click.option("--browser", help='Browser to launch', default=config.read('settings.yml', 'browser...
@handle_exceptions(BaseException)
Next line prediction: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("dir_name", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @click.option("--browser", help='Browser to launch', default=config.read('settings.yml', '...
view.folder(dir_name, browser)
Given the following code snippet before the placeholder: <|code_start|> @click.command(short_help="View contents of folder.") @click.argument("dir_name", type=click.Path( exists=True, file_okay=False, dir_okay=True), default='.') @click.option("--browser", help='Browser to launch', <|code_end|> , p...
default=config.read('settings.yml', 'browser_local'))
Using the snippet: <|code_start|> judge_factory = JudgeFactory() OJs = judge_factory.available_judges @click.command() @click.option('-j', '--judge', 'judge_name', type=click.Choice(OJs), prompt="Please provide a judge ("+'|'.join(OJs)+")", <|code_end|> , determine the next line of code. You have import...
default=default_judge, show_default=True)
Given the following code snippet before the placeholder: <|code_start|> judge_factory = JudgeFactory() OJs = judge_factory.available_judges @click.command() @click.option('-j', '--judge', 'judge_name', type=click.Choice(OJs), prompt="Please provide a judge ("+'|'.join(OJs)+")", default=def...
@handle_exceptions(BaseException)
Given the code snippet: <|code_start|># for loading judge plugins # Takes care of instantiating judges and keeping their session_data # Decorates login logout methods of the judges to write session data class JudgeFactory: def __init__(self): self.available_judges = [] self._judge_classes = {} ...
assert(issubclass(judge_class, Judge))
Based on the snippet: <|code_start|> # decorate login and logout with _write_session_data judge_class.login = self._write_session_data( judge.name)(judge_class.login) judge_class.logout = self._write_session_data( judge.name)(judge_c...
raise JudgeNotFoundError
Using the snippet: <|code_start|> judge.name)(judge_class.logout) judge_class.refresh_login = self._write_session_data( judge.name)(judge_class.refresh_login) self._judge_classes[judge.name] = judge_class # TODO log about 'why could no...
session_data = config.read('judges/sessions.yml', judge_name)
Predict the next line for this snippet: <|code_start|> def __init__(self): self.available_judges = [] self._judge_classes = {} self._load_judges() def _load_judges(self): judges = iter_entry_points('termicoder.judge_plugins') for judge in judges: try: ...
logger.error("%s is not a subclass of Judge" % judge_class)
Predict the next line after this snippet: <|code_start|>"""PyTypes wrappers.""" c_backend = get_rs_lib() class MissingTypeHint(TypeError): pass @unique class PyEquivType(Enum): String = 1 Bool = 2 Int = 3 Double = 4 <|code_end|> using the current file's imports: import abc from collections ...
Float = 5
Predict the next line for this snippet: <|code_start|>"""PyTypes wrappers.""" c_backend = get_rs_lib() class MissingTypeHint(TypeError): pass @unique class PyEquivType(Enum): String = 1 Bool = 2 Int = 3 <|code_end|> with the help of current file imports: import abc from collections import deque...
Double = 4
Here is a snippet: <|code_start|> def _to_pytuple(signature): def dec(arg): return c_backend.pyarg_from_pytuple(PyTuple.from_tuple(arg, signature)) return dec def _to_pylist(signature): def dec(arg): return c_backend.pyarg_from_pylist(PyList.from_list(arg, signature)) return dec def ...
elif arg_t is UnsignedLongLong:
Using the snippet: <|code_start|>"""PyTypes wrappers.""" c_backend = get_rs_lib() class MissingTypeHint(TypeError): pass @unique class PyEquivType(Enum): String = 1 Bool = 2 Int = 3 Double = 4 Float = 5 <|code_end|> , determine the next line of code. You have imports: import abc from col...
Tuple = 6
Based on the snippet: <|code_start|> path, filename = os.path.split(f) rel_imp = [libname, None] while True: path, tail = os.path.split(path) if path == root or path == os.path.abspath(os.sep): break ...
elif arg_t is float or arg_t is Double or arg_t is Float:
Given the following code snippet before the placeholder: <|code_start|> path, filename = os.path.split(f) rel_imp = [libname, None] while True: path, tail = os.path.split(path) if path == root or path == os.path.abspath(os.sep): ...
elif arg_t is float or arg_t is Double or arg_t is Float:
Given snippet: <|code_start|> else: param = "c_double" elif arg_t is str: if pytypes: param = "PyString" else: param = "String" elif arg_t is bool: if pytypes: ...
elif issubclass(arg_t, Tuple):
Next line prediction: <|code_start|> self.m_dict = m_dict = {} if inspect.ismodule(self.root): module = self.root.__dict__ module_objs = m_dict[self.root.__name__] = [] imp_statement = module["__spec__"].name inspect_parameters() else: ...
@type_checkers
Given the code snippet: <|code_start|> HTTP_METHOD_GET = 'GET' HTTP_METHOD_POST = 'POST' INDEX_PAGE = 'admin_ui/index' LOGIN_PAGE = 'admin_ui/login' DEBUG = True SMART_SERVER_LOCATION = urlparse.urlparse(settings.SMART_API_SERVER_BASE) SMART_SERVER_LOCATION = { 'host': SMART_SERVER_LOCATION.hostname, 'scheme...
api = IndivoClient(settings.CONSUMER_KEY, settings.CONSUMER_SECRET, SMART_SERVER_LOCATION)
Given snippet: <|code_start|>""" Views for Indivo JS UI """ # todo: rm unused HTTP_METHOD_GET = 'GET' HTTP_METHOD_POST = 'POST' LOGIN_PAGE = 'ui/login' DEBUG = True passthrough_server = "/smart_passthrough" # init the IndivoClient python object SMART_SERVER_LOCATION = urlparse.urlparse(settings.SMART_API_SERVER_B...
api = IndivoClient(settings.CONSUMER_KEY, settings.CONSUMER_SECRET,
Next line prediction: <|code_start|> # perturbation of weight values perturbations = np.linspace(-span, span, 200) # Compute the loss when varying the study weight parameters = deepcopy(model.parameters) current_weight = float(get_parameter(parameters)) loss_range = [] old_parameters = list...
class RNN(Model):
Predict the next line after this snippet: <|code_start|> MAX_SENT_SIZE = 1000 MAX_NR_SENTENCES = 100000 MODEL_DIR = "/Users/graca/Projects/swm_src/feeds/models/all_data_postag/" def build_corpus_features(): corpus = pcc.PostagCorpus() <|code_end|> using the current file's imports: import os import sys import c...
train_seq = corpus.read_sequence_list_conll(data.find('train-02-21.conll'),
Continue the code snippet: <|code_start|>from __future__ import division # To sample from model def cast_float(variable, grad=True): return Variable(torch.from_numpy(variable).float(), requires_grad=grad) def cast_int(variable, grad=True): return Variable(torch.from_numpy(variable).long(), requires_grad=gr...
class PytorchRNN(RNN):
Given the following code snippet before the placeholder: <|code_start|> class NumpyLogLinear(Model): def __init__(self, **config): # Initialize parameters weight_shape = (config['input_size'], config['num_classes']) # after Xavier Glorot et al <|code_end|> , predict the next line using im...
self.weight = glorot_weight_init(weight_shape, 'softmax')
Predict the next line for this snippet: <|code_start|> # Initialize parameters weight_shape = (config['input_size'], config['num_classes']) # after Xavier Glorot et al self.weight = glorot_weight_init(weight_shape, 'softmax') self.bias = np.zeros((1, config['num_classes'])) ...
I = index2onehot(output, num_classes)
Given snippet: <|code_start|> class NumpyLogLinear(Model): def __init__(self, **config): # Initialize parameters weight_shape = (config['input_size'], config['num_classes']) # after Xavier Glorot et al self.weight = glorot_weight_init(weight_shape, 'softmax') self.bias = n...
log_tilde_z = z - logsumexp(z, axis=1, keepdims=True)