Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Next line prediction: <|code_start|> self.args = args self.model = model self.layers = self.args.layers if layers is None else layers self.layer_dim = self.args.layer_dim if layer_dim is None else layer_dim self.output_dim = self.args.output_dim if output_dim is None else output_d...
extra_value = value[:, -extra_dim:]
Next line prediction: <|code_start|> MLP_PARAM_PATTERN = re.compile(r"[Wb]\d+") class MultilayerPerceptron(SubModel): def __init__(self, config, args, model, layers=None, layer_dim=None, output_dim=None, num_labels=None, params=None, **kwargs): super().__init__(params=params, **kwargs) ...
def total_layers(self):
Predict the next line for this snippet: <|code_start|>MLP_PARAM_PATTERN = re.compile(r"[Wb]\d+") class MultilayerPerceptron(SubModel): def __init__(self, config, args, model, layers=None, layer_dim=None, output_dim=None, num_labels=None, params=None, **kwargs): super().__init__(params=par...
value = W0.as_array()
Predict the next line for this snippet: <|code_start|> MLP_PARAM_PATTERN = re.compile(r"[Wb]\d+") class MultilayerPerceptron(SubModel): def __init__(self, config, args, model, layers=None, layer_dim=None, output_dim=None, num_labels=None, params=None, **kwargs): super().__init__(params=...
def init_params(self, input_dim):
Using the snippet: <|code_start|> def strip_multitask(model, keep): if "amr" not in keep: # Remove AMR-specific features: node label and category delete_if_exists((model.feature_params, model.classifier.params), (NODE_LABEL_KEY, "c")) delete_if_exists((model.classifier.labels, model.classifier.axes),...
model.save()
Predict the next line for this snippet: <|code_start|> def strip_multitask(model, keep): if "amr" not in keep: # Remove AMR-specific features: node label and category delete_if_exists((model.feature_params, model.classifier.params), (NODE_LABEL_KEY, "c")) delete_if_exists((model.classifier.labels, mo...
def delete_if_exists(dicts, keys):
Predict the next line for this snippet: <|code_start|> def strip_multitask(model, keep): if "amr" not in keep: # Remove AMR-specific features: node label and category delete_if_exists((model.feature_params, model.classifier.params), (NODE_LABEL_KEY, "c")) delete_if_exists((model.classifier.labels, mo...
model.filename = os.path.join(args.out_dir, os.path.basename(filename))
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- __all__ = [ 'CMSMenuID', 'CMSSection', <|code_end|> . Write the next line using the current file imports: from datetime import datetime from django.db import models from django.conf import settings from django.core.urlresolvers import reverse from djan...
'CMSCategory',
Using the snippet: <|code_start|># -*- coding: utf-8 -*- __all__ = [ 'CMSMenuID', 'CMSSection', 'CMSCategory', 'CMSArticle', <|code_end|> , determine the next line of code. You have imports: from datetime import datetime from django.db import models from django.conf import settings from django.core.u...
]
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- #from cms_content.utils.cache import cache_nodes #from cms_content.menu_nodes import cache_nodes #@cache_page(60*30) @render_to('cms_content/content_index.html') def content_index(request): articles = list(CMSArticle.pub_manager.all()[:10]) return { ...
return {
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- #from cms_content.utils.cache import cache_nodes #from cms_content.menu_nodes import cache_nodes #@cache_page(60*30) @render_to('cms_content/content_index.html') def content_index(request): articles = list(CMSArticle.pub_manager.all()[:10]) return { ...
section = CMSSection.objects.get(slug=slug)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- section_info = { 'queryset': CMSSection.objects.all(), 'template_name': 'cms_content/section_list.html', } category_info = { 'queryset': CMSCategory.objects.all(), 'template_name': 'cms_content/category_list...
url(r'^article/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/del/$', article_del, name='cms_content_article_del'),
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- __all__ = [ 'CMSMenuID', 'CMSSection', 'CMSCategory', 'CMSArticle', <|code_end|> , predict the immediate next line with the help of imports: from datetime import datetime from django.db import models from django.conf import settings from dja...
]
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- register = Library() @register.filter @stringfilter def code_highlight(content): css = '' if CODE_HIGHLIGHT: soup = BeautifulSoup(content) code_blocks = soup.findAll(u'pre') if code_blocks: <|code_end|> with...
if CODE_HIGHLIGHT_LINENOS:
Next line prediction: <|code_start|> def simple_exception_app(environ, start_response): if environ['PATH_INFO'].startswith('/error/document'): start_response('200 OK', [('Content-type', 'text/plain')]) return ['Made it to the error'] else: start_response('404 Not Found', [('Content-type'...
def test_retains_request():
Given snippet: <|code_start|> 'footer_html', 'head_html', 'media_path'] log = logging.getLogger(__name__) media_path = os.path.join(os.path.dirname(__file__), 'media') head_html = """\ <link rel="stylesheet" href="{{prefix}}/media/pylons/style/itraceback.css" \ type="text/css" media="screen" />""" footer_...
<b>Looking for help?</b>
Here is a snippet: <|code_start|> def home(request): # chat_session_list = chatSessions.objects.order_by('start_date')[:3] # context_dict = {'chatSessions': chat_session_list} return render(request, 'index.html') def about(request): return render(request, 'about.html') def request_session(request):...
if request.method == 'POST':
Predict the next line after this snippet: <|code_start|> class ContestForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(ContestForm, self).__init__(*args, **kwargs) <|code_end|> using the current file's imports: from django import forms from crispy_forms.helper import FormHelper from .mod...
self.helper = FormHelper()
Predict the next line for this snippet: <|code_start|> try: except ImportError: def compare_version(config: dict, min_version: str, max_version: str): version = parse_version(config['version']) if version < parse_version(min_version): return -1 if version > parse_version(max_version): <|code_e...
return 1
Continue the code snippet: <|code_start|> try: except ImportError: def compare_version(config: dict, min_version: str, max_version: str): version = parse_version(config['version']) if version < parse_version(min_version): return -1 <|code_end|> . Use current file imports: import os import re impo...
if version > parse_version(max_version):
Given snippet: <|code_start|> try: except ImportError: def compare_version(config: dict, min_version: str, max_version: str): version = parse_version(config['version']) if version < parse_version(min_version): return -1 if version > parse_version(max_version): <|code_end|> , continue by predic...
return 1
Given the code snippet: <|code_start|> try: except ImportError: def compare_version(config: dict, min_version: str, max_version: str): version = parse_version(config['version']) if version < parse_version(min_version): return -1 if version > parse_version(max_version): return 1 ret...
if cmp > 0:
Based on the snippet: <|code_start|> try: except ImportError: def compare_version(config: dict, min_version: str, max_version: str): version = parse_version(config['version']) if version < parse_version(min_version): <|code_end|> , predict the immediate next line with the help of imports: import os impor...
return -1
Given snippet: <|code_start|> def _run_command(command: str, repo_path: str, repo_name: str, repo_branch: str, config: dict): module_path = '.'.join(('toolbox', get_crp_type(config), command)) module = import_module(module_path) module.run(repo_path, repo_name, repo_branch, config) if get_error_count...
def run(*commands):
Predict the next line after this snippet: <|code_start|> def _run_command(command: str, repo_path: str, repo_name: str, repo_branch: str, config: dict): module_path = '.'.join(('toolbox', get_crp_type(config), command)) module = import_module(module_path) module.run(repo_path, repo_name, repo_branch, conf...
def run(*commands):
Next line prediction: <|code_start|> def _run_command(command: str, repo_path: str, repo_name: str, repo_branch: str, config: dict): module_path = '.'.join(('toolbox', get_crp_type(config), command)) module = import_module(module_path) module.run(repo_path, repo_name, repo_branch, config) if get_erro...
for command in commands:
Based on the snippet: <|code_start|> def _run_command(command: str, repo_path: str, repo_name: str, repo_branch: str, config: dict): module_path = '.'.join(('toolbox', get_crp_type(config), command)) module = import_module(module_path) module.run(repo_path, repo_name, repo_branch, config) if get_erro...
for command in commands:
Here is a snippet: <|code_start|> def _run_command(command: str, repo_path: str, repo_name: str, repo_branch: str, config: dict): module_path = '.'.join(('toolbox', get_crp_type(config), command)) module = import_module(module_path) module.run(repo_path, repo_name, repo_branch, config) if get_error_c...
_run_command(command, repo_path, repo_name, repo_branch, config)
Predict the next line after this snippet: <|code_start|> def _run_command(command: str, repo_path: str, repo_name: str, repo_branch: str, config: dict): module_path = '.'.join(('toolbox', get_crp_type(config), command)) module = import_module(module_path) module.run(repo_path, repo_name, repo_branch, conf...
for command in commands:
Continue the code snippet: <|code_start|> lssOne = lssZero + zzOne + len(ssOne) ssTwo = '<' zzTwo = line[lssOne:].find(ssTwo) if zzTwo != -1: lssTwo = lssOne + zzTwo result = line[lssOne:lssTwo] return result def get_bookmark(line): ...
sThree = '</A>'
Next line prediction: <|code_start|> self._volt_del = volt_del self._valid = valid self._time = time self._volt_strt = (self._volt_cen - ( self._volt_del / 2. ) ) self._volt_stop = (self._volt_cen + ( self._volt_del / 2. ) ) self._vel_strt = 1E-3*( sqrt(2.0*const['q_p...
self._maglook = None
Next line prediction: <|code_start|> #----------------------------------------------------------------------- # DEFINE THE FUNCTION TO CALCULATE EXPECTED MAXWELLIAN CURRENT. #----------------------------------------------------------------------- def calc_curr( self, m, q, v0, n, dv, w ) : # Note. This function...
v_vec = [ v0[i] + dv * self['norm_b'][i]
Continue the code snippet: <|code_start|> elif ( key == 'azim' ) : return self._azim elif ( key == 'elev' ) : return self._elev elif ( key == 'time' ) : return self._time elif ( key == 'volt_cen' ) : return self._volt_cen elif ( key == 'volt_del' ) : return sel...
return self._the
Predict the next line for this snippet: <|code_start|> ###self.grd.addWidget( self.btn_cncl, 1, 3, 1, 1 ) # Initialize the object to be returned to the user on the close # of this dialog window. self.resp = None #----------------------------------------------------------------------- # DEFINE THE FUNCTION F...
self.exec_( )
Given snippet: <|code_start|> super( widget_ctrl_info, self ).__init__( ) # Store the Janus core. self.core = core # Initialize the the indicator of whether the text should be # cleared the next time a message is received. self.clear_for_next_mesg = True # Prepare to respond to signals received from ...
self.prnt_brk( )
Based on the snippet: <|code_start|>################################################################################ ################################################################################ ## LOAD THE NECESSARY MODULES. ################################################################################ # Load ...
self.core = core
Continue the code snippet: <|code_start|> # Append the first timestamp to the file name. name += '_' + t1 # If the provided coe only has only a signle result, return the file # name as is. if ( len( core.series ) == 1 ) : return name # Append the second timestamp to the file name. name += '_' + t2 # Ret...
'results', 'save',
Here is a snippet: <|code_start|> 'nln':QLabel( 'Non-Linear' ) } self.lab_dyn = { 'dyn': QLabel( 'Dynamic:' ), 'mom': QLabel( 'Moments' ), 'gss': QLabel( 'Init. Guess' ), 'sel': QLabel( 'Data Sel.' ), 'nln': QLabe...
self.grd.addWidget( self.lab_dsp[key], i, 0, 1, 2 )
Next line prediction: <|code_start|> #----------------------------------------------------------------------- # DEFINE THE FUNCTION FOR SETTING THE VALUES OF THE TICK BOXES. #----------------------------------------------------------------------- def make_box( self ) : # Set the values of the "display" tick box...
self.box_dyn['sel'].setChecked( self.core.dyn_sel )
Next line prediction: <|code_start|> self.box_dyn['mom'].setChecked( self.core.dyn_mom ) self.box_dyn['gss'].setChecked( self.core.dyn_gss ) self.box_dyn['sel'].setChecked( self.core.dyn_sel ) self.box_dyn['nln'].setChecked( self.core.dyn_nln ) #-----------------------------------------------------------------...
self.box_dsp['gsl'].setChecked( False )
Based on the snippet: <|code_start|> #----------------------------------------------------------------------- # DEFINE THE FUNCTION FOR SETTING THE VALUES OF THE TICK BOXES. #----------------------------------------------------------------------- def make_box( self ) : # Set the values of the "display" tick box...
self.box_dyn['sel'].setChecked( self.core.dyn_sel )
Based on the snippet: <|code_start|> elif ( key == 'q' ) : return self.q elif ( key == 'n' ) : arr_pop = self.my_plas.lst_pop( self ) if ( ( arr_pop is None ) or ( len( arr_pop ) == 0 ) ) : return None arr_n = [ p['n'] for p in arr_pop ] if ( None in arr_n ) : return None return sum...
if ( ( None in arr_n ) or ( None in arr_dv ) ) :
Next line prediction: <|code_start|> '&nbsp;&plusmn;&nbsp;' ) self.prnt_dcm( self.core.nln_res_plas[ 'sig_v0_z'], 3 ) self.prnt_htm( 'km/s' ) elif ( pop['drift'] ) : if ( self.core.opt['res_d'] ) : self.prnt_brk( ) self.prnt_...
self.prnt_htm(
Next line prediction: <|code_start|> self.moveCursor( QTextCursor.Start ) #----------------------------------------------------------------------- # DEFINE THE FUNCTION FOR RESPONDING TO THE "rset" SIGNAL. #----------------------------------------------------------------------- def resp_rset( self ) : # Reset...
self.make_txt( )
Based on the snippet: <|code_start|> if ( self.core.fc_spec is None ) : return # If a Wind/FC ion spectrum has been (successfully) loaded, but # there are no Wind/MFI data (yet), return. if ( self.core.n_mfi <= 0 ) : return # Print a summary of the Wind/MFI data. self.prnt_htm( 'Number of Data:&nb...
self.prnt_brk( )
Based on the snippet: <|code_start|> tmp_q = self.core.nln_plas.arr_spec[i]['q'] # Update each widget's text. if ( tmp_name is not None ) : self.arr_name[i].setTextUpdate( tmp_name ) if ( tmp_sym is not None ) : self.arr_sym[i].setTextUpdate( tmp_sym ) if ( tmp_m is not None ) : self.ar...
( len( self.arr_sym[i].text( ) ) > 0 ) ) :
Next line prediction: <|code_start|> for i in range( 6 ) : self.grd.setColumnStretch( i, 1 ) for i in range( self.core.nln_n_spc + 1 ) : self.grd.setRowStretch( i, 1 ) # Populate the text areas. self.make_txt( ) #----------------------------------------------------------------------- # DEFINE THE FU...
if ( tmp_name is not None ) :
Based on the snippet: <|code_start|> self.lab = QLabel( 'Note: closing this window will *NOT* ' + 'interrupt the automated analysis.' ) self.lab.setWordWrap( True ) # Row by row, add the bar and buttons to the grid layout. self.grd.addWidget( self.bar , 0, 0, 1, 1 ) self.grd.a...
if ( time_curr < self.bar.minimum( ) ) :
Predict the next line after this snippet: <|code_start|> # Set the title of this dialog window. self.setWindowTitle( 'Progress' ) # Give this widget a grid layout, "self.grd". self.grd = QGridLayout( ) self.grd.setContentsMargins( 6, 6, 6, 6 ) self.setLayout( self.grd ) # Initialize the progress bar...
'interrupt the automated analysis.' )
Here is a snippet: <|code_start|> CNAME = "sendmsg" def main(command): args = command.replace(CNAME, "").strip().split(" ", maxsplit=1) #print(args) if len(args) == 2: idstr = args[0] if str.isnumeric(idstr): <|code_end|> . Write the next line using the current file imports: import bot_header from vk_api.api ...
idn = int(idstr)
Predict the next line for this snippet: <|code_start|> CNAME = "sendmsg" def main(command): args = command.replace(CNAME, "").strip().split(" ", maxsplit=1) #print(args) if len(args) == 2: <|code_end|> with the help of current file imports: import bot_header from vk_api.api import get_api from vk_api.api import ...
idstr = args[0]
Predict the next line after this snippet: <|code_start|> def main(C): print("this is horosho") # get API instance api = get_api(account=bot_header.CURRENT_ACCOUNT) # get followers fws = api_request(api, "users.getFollowers", "") fwitems = fws['items'] for item in fwitems: add(item, api) def add(item, api):...
if "per second" in err.lower():
Predict the next line for this snippet: <|code_start|> CNAME = "audiobc" def main(command): args = command.replace(CNAME, "").strip() msg = args if not msg: raise Exception("Usage: audiobc 'OID_AID'") api = get_api(account=bot_header.CURRENT_ACCOUNT) r = api_request(api, "audio.setBroadcas...
return r
Given snippet: <|code_start|> time_each = None time_when = None action = None action_value = None def from_json(d): s = AutoexecRule(force=True) s.__dict__.update(d) return s def __init__(self, time_each=None, time_when=None, action_type=None, force=False): if no...
if time_each is not None:
Next line prediction: <|code_start|> def main(cmd): print("Starting thread...") bot_header.SET_ONLINE_THREAD_INSTANCE = OnlineThread(account=bot_header.CURRENT_ACCOUNT, lpt=bot_header.LONG_POOL_THREAD_INSTANCE) <|code_end|> . Use current file imports: (import bot_header from vk_api.set_online import OnlineThre...
bot_header.SET_ONLINE_THREAD_INSTANCE.setDaemon(True)
Continue the code snippet: <|code_start|> # Name for key of acc list ACCOUNT_LIST = "account list" class AccountManager: def __init__(self, location=config_file.CONF_FILE): self.location = location # location of file with users location = config_file.CONF_FILE def get_account_list_raw(self...
if accs == None:
Given snippet: <|code_start|> # Name for key of acc list ACCOUNT_LIST = "account list" class AccountManager: def __init__(self, location=config_file.CONF_FILE): self.location = location # location of file with users location = config_file.CONF_FILE def get_account_list_raw(self, accs): ...
return result
Here is a snippet: <|code_start|> def select_acc(list, num): if num is not '-1' and str.isnumeric(num): val = int(num) if len(list) < val: print("This account is not exists") exit(1) acc = list[val] return acc else: for acc in list: ...
id = input("Select Account: ")
Continue the code snippet: <|code_start|> self.interval = interval def print(self, text): print('[::OTHD] [%s] %s' % (self.account.first_last(), text)) def v(self, text): bot_header.v('[::OTHD] [%s] %s' % (self.account.first_last(), text)) def w(self, text): bot_header.w('...
while self.enabled:
Continue the code snippet: <|code_start|> def main(cmd): t = OnlineThread(bot_header.LONG_POOL_THREAD_INSTANCE) r = t.set_online(1) <|code_end|> . Use current file imports: import bot import bot_header from vk_api.set_online import OnlineThread and context (classes, functions, or code) from other files: # P...
print("Setting online... %s" % r)
Predict the next line after this snippet: <|code_start|> def get_action_type(param): if param == 'HC_CONSOLE': return AutoexecActionType.ACTION_HC_CONSOLE else: <|code_end|> using the current file's imports: from optparse import OptionParser from autoexec.autoexec_rules_manager import AutoexecRulesMa...
return None
Given the code snippet: <|code_start|> def get_action_type(param): if param == 'HC_CONSOLE': return AutoexecActionType.ACTION_HC_CONSOLE else: return None pass def main(c): parser = OptionParser() parser.set_usage(__name__.replace(".", " ") + " [OPTIONS]") parser.add_option("-...
parser.add_option("-T", "--time", dest="time", help="time: format: *s/m/h/d")
Given the code snippet: <|code_start|> def get_action_type(param): if param == 'HC_CONSOLE': return AutoexecActionType.ACTION_HC_CONSOLE else: return None pass def main(c): parser = OptionParser() parser.set_usage(__name__.replace(".", " ") + " [OPTIONS]") parser.add_option("-...
a_type = get_action_type(o['action'])
Continue the code snippet: <|code_start|> def get_action_type(param): if param == 'HC_CONSOLE': return AutoexecActionType.ACTION_HC_CONSOLE else: return None pass def main(c): parser = OptionParser() parser.set_usage(__name__.replace(".", " ") + " [OPTIONS]") parser.add_option...
parser.add_option("-?", "--?", default=None, action="callback", callback=help, help="show this help message")
Here is a snippet: <|code_start|> # set current path to root of project currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) class LongPoolThread(threading.Thread): # Account that will be used for Messages.Get...
account = None
Based on the snippet: <|code_start|> # execute when user started typing. def main(message, lpt): # get id of user typing_id = message[1] # get user from VK API by id user = User.from_json(api_request(get_api(lpt=lpt), "users.get", "user_ids=%s" % typing_id)[0]) # print some message to inform user t...
bot_header.v("%s started typing..." % user.first_last())
Based on the snippet: <|code_start|> # execute when user started typing. def main(message, lpt): # get id of user typing_id = message[1] # get user from VK API by id user = User.from_json(api_request(get_api(lpt=lpt), "users.get", "user_ids=%s" % typing_id)[0]) # print some message to inform user t...
bot_header.v("%s started typing..." % user.first_last())
Here is a snippet: <|code_start|> # execute when user started typing. def main(message, lpt): # get id of user typing_id = message[1] # get user from VK API by id user = User.from_json(api_request(get_api(lpt=lpt), "users.get", "user_ids=%s" % typing_id)[0]) # print some message to inform user that...
bot_header.v("%s started typing..." % user.first_last())
Next line prediction: <|code_start|> e = message.extra # Getting list of modules manager = mpm_manager.ModuleManager() modules = manager.get_modules() # Exec each modules and get result for module in modules: result = module.execute_module(message, lpt) if result is not None: ...
elif message.is_out():
Continue the code snippet: <|code_start|> # Exec each modules and get result for module in modules: result = module.execute_module(message, lpt) if result is not None: return result pass # entry point of MESSAGE_SEND event of long pool server # calling from long_pool_event.py de...
fpid = False
Using the snippet: <|code_start|> FORMAT_PID_STR = "longpool format peer id" currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) # THIS METHOD EXECUTING WHEN USER SENT A MESSAGE TO YOU # calling from main() <|co...
def on_message_received(message, lpt):
Next line prediction: <|code_start|> FORMAT_PID_STR = "longpool format peer id" currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) <|code_end|> . Use current file imports: (import inspect import os import random import sys import mpm_manager...
sys.path.insert(0,parentdir)
Here is a snippet: <|code_start|> # getting api instance api = get_api(lpt=lp_thread_ins) # looking at config file make_typing = config_file.has("typing") # checking typing filed in config file if make_typing: read_message_before_typing = config_file.has("read before typing") ### ...
if read_message_before_typing:
Given snippet: <|code_start|>#------------------------------------------------------------------------------- # Name: VK_API_CONSOLE # # Author: hydrogen-nt # # Created: 13.01.2018 # Copyright: (c) hydrogen-nt 2018 # # implements using VK api on console # by typing "vapi [method] [params (x='y',)]" #-...
c = c.replace("vapi", "").strip()
Given the following code snippet before the placeholder: <|code_start|> def print(self, text): print("[::AEXEC] %s" % text) def v(self, text): bot_header.v("[::AEXEC] %s" % text) def update_rules_list(self, q=False): if not q: self.print("Updating rules list...") ...
self.mgr.remove(rule.id)
Predict the next line after this snippet: <|code_start|> class AutoexecThread(Thread): aexec_rules = [] enabled = True interval = 1 exec_py_code = False mgr = AutoexecRulesManager() def stop(self): self.print("Stopping AutoExec thread...") self.enabled = False bot_heade...
print("[::AEXEC] %s" % text)
Given the code snippet: <|code_start|> class AutoexecThread(Thread): aexec_rules = [] enabled = True interval = 1 exec_py_code = False mgr = AutoexecRulesManager() def stop(self): self.print("Stopping AutoExec thread...") self.enabled = False bot_header.AUTO_EXEC_THREAD...
def print(self, text):
Given the following code snippet before the placeholder: <|code_start|> # INITIALIZE VARIABLES def __init__(self, username, password, authtype=VKApp.WIN, prevs='audio,wall,friends,messages,status'): username = username.strip() password = password.strip() if not username or not password: ...
def __make_request__(self, sms=force_sms):
Given the following code snippet before the placeholder: <|code_start|> @pytest.fixture() def workspace(): workspace = Harness("repos/confl_dep") workspace.initialize("repos/confl_dep?" + str(uuid.uuid4())) <|code_end|> , predict the next line using imports from the current file: from .harness import Harness ...
yield workspace
Based on the snippet: <|code_start|> assert "dependencies" in result dep_names = {d["attributes"]["name"] for d in result["dependencies"]} assert dep_names == { 'pytest', 'not_in_sys_path', 'numpy', '__main__', 'import_tree', 'recurse_class2', 'not_exis...
'name': 'jedi'
Given the code snippet: <|code_start|> 'package': { 'name': 'flask' }, 'position': { 'character': 4, 'line': 34 } } } assert symbol in result def test_cross_module_definition(): result = flask_workspace....
'file': 'app.py',
Given the code snippet: <|code_start|> @pytest.fixture() def workspace(): workspace = Harness("repos/dep_pkg_module_same_name") workspace.initialize("repos/dep_pkg_module_same_name" + str(uuid.uuid4())) yield workspace <|code_end|> , generate the next line using the imports in this file: from .harness imp...
workspace.exit()
Predict the next line after this snippet: <|code_start|> 'line': 138, 'character': 6 } }, 'location': { 'uri': 'file:///graphql/type/definition.py', 'range': { 'start': { ...
}
Continue the code snippet: <|code_start|> }, 'location': None } # from the import statement at the top of the file assignment = { 'symbol': { 'package': { 'name': 'fizzbuzz_service' }, 'name': 'Enum', 'container': 'fizzb...
}
Using the snippet: <|code_start|> tensorflow_models_workspace = Harness("repos/tensorflow-models") tensorflow_models_workspace.initialize( "git://github.com/tensorflow/models?" + str(uuid.uuid4())) def test_namespace_package_definition(): result = tensorflow_models_workspace.definition( "/inception/i...
},
Given snippet: <|code_start|> if __name__ == '__main__': looper = number_looper.NumberLooper(1, 16) for number_string in looper.get_number_strings(): <|code_end|> , continue by predicting the next line. Consider current file imports: from .loopers import number_looper and context: # Path: test/repos/fizzbuzz...
print(number_string)
Next line prediction: <|code_start|> @pytest.fixture(params=[ # tuples of the repo for the test, along # with the expected doc_string for the hover # in that repo ("repos/dep_versioning_fixed", "this is version 0.1"), ("repos/dep_versioning_between", "this is version 0.4"), ("repos/dep_versioni...
uri = "file:///test.py"
Here is a snippet: <|code_start|> class Module: def __init__(self, name, path, is_package=False): self.name = name self.path = path self.is_package = is_package def __repr__(self): return "PythonModule({}, {})".format(self.name, self.path) class DummyFile: <|code_end|> . W...
def __init__(self, contents):
Predict the next line after this snippet: <|code_start|> class Module: def __init__(self, name, path, is_package=False): self.name = name self.path = path self.is_package = is_package def __repr__(self): <|code_end|> using the current file's imports: from os import path as filepat...
return "PythonModule({}, {})".format(self.name, self.path)
Given the code snippet: <|code_start|> workspace = Harness("repos/global-variables") workspace.initialize("") def test_name_definition(): # The __name__ global variable should resolve to a symbol without # a corresponding location uri = "file:///name_global.py" line, col = 0, 4 result = workspace...
'container': 'name_global',
Given the code snippet: <|code_start|> for field, value in ast.iter_fields(node): if isinstance(value, list): for item in value: if isinstance(item, ast.AST): yield from self.visit(item, container) elif isinstance(value, ast.AST)...
symbols.append(sym.json_object())
Here is a snippet: <|code_start|> SymbolKind.Variable, node.lineno, node.col_offset, container=container ) break if n.asname and self.name == n.asname: yield Symbol( ...
node.lineno,
Next line prediction: <|code_start|> 'uri': 'file:///thefuck/argument_parser.py', 'range': { 'start': { 'line': 36, 'character': 21 }, 'end': { 'line': 36, 'character': ...
'character': 14
Given snippet: <|code_start|> class DeleteView(MethodView): def error(self, item, error): return render_template('error.html', heading=item.meta[FILENAME], body=error), 409 def response(self, name): return redirect_next_referrer('bepasty.index') def post(self, name): if not may(...
raise NotFound()
Here is a snippet: <|code_start|> class DeleteView(MethodView): def error(self, item, error): return render_template('error.html', heading=item.meta[FILENAME], body=error), 409 def response(self, name): return redirect_next_referrer('bepasty.index') def post(self, name): if not ...
if e.errno == errno.ENOENT:
Based on the snippet: <|code_start|> class DeleteView(MethodView): def error(self, item, error): return render_template('error.html', heading=item.meta[FILENAME], body=error), 409 def response(self, name): return redirect_next_referrer('bepasty.index') def post(self, name): if n...
raise Forbidden()
Next line prediction: <|code_start|> class DeleteView(MethodView): def error(self, item, error): return render_template('error.html', heading=item.meta[FILENAME], body=error), 409 def response(self, name): return redirect_next_referrer('bepasty.index') def post(self, name): if n...
raise Forbidden()
Predict the next line for this snippet: <|code_start|> try: magic = magic_module.Magic(mime=True) magic_bufsz = magic.getparam(magic_module.MAGIC_PARAM_BYTES_MAX) <|code_end|> with the help of current file imports: import re import time import mimetypes import magic as magic_module from werkzeug.exceptio...
except ImportError:
Predict the next line for this snippet: <|code_start|> try: magic = magic_module.Magic(mime=True) magic_bufsz = magic.getparam(magic_module.MAGIC_PARAM_BYTES_MAX) except ImportError: magic = None magic_bufsz = None # we limit to 250 characters as we do not want to accept arbitrarily long # filenames....
class Upload:
Next line prediction: <|code_start|> try: magic = magic_module.Magic(mime=True) magic_bufsz = magic.getparam(magic_module.MAGIC_PARAM_BYTES_MAX) except ImportError: magic = None magic_bufsz = None # we limit to 250 characters as we do not want to accept arbitrarily long # filenames. other than that, ...
MAX_FILENAME_LENGTH = 250