Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Here is a snippet: <|code_start|> self.w_tab.set_title(i,tab_labels[name]) self.create_button = w.Button(description="Write project",button_style="info",disabled=True) self.create_button.on_click(self.write) self.create_info = w.HTML("Please enter a valid project directory.") ...
os.makedirs(proj_dir)
Given the following code snippet before the placeholder: <|code_start|> class DisplayFitness(CellModule): def __init__(self,Notebook): super(DisplayFitness, self).__init__(Notebook) self.button = widgets.Button(description="Display fitness",disabled=True) self.display_area = widgets.HTML(val...
self.notebook.dependencies_dict["project"].append(self)
Here is a snippet: <|code_start|> class DisplayFitness(CellModule): def __init__(self,Notebook): super(DisplayFitness, self).__init__(Notebook) self.button = widgets.Button(description="Display fitness",disabled=True) self.display_area = widgets.HTML(value=None, placeholder='<p></p>',descrip...
self.notebook.dependencies_dict["project"].append(self)
Given the following code snippet before the placeholder: <|code_start|> class TestDownloadFunctions(unittest.TestCase): def test_download_tools(self): AnalyseRun="test_AnalyseRun.py" run_evolution = "test_run_evolution.py" download_tools(run_evolution=run_evolution,AnalyseRun=AnalyseRun) ...
def test_download_example(self):
Given the following code snippet before the placeholder: <|code_start|># Copyright (C) 2019 ACSONE SA/NV (https://www.acsone.eu/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation...
super(LimitedDict, self).__setitem__(key, value)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- class PasswordForm(Form): next = HiddenField() password = PasswordField('Current password', [Required()]) new_password = PasswordField('New password', [Required(), ...
submit = SubmitField(u'Save')
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- class PasswordForm(Form): next = HiddenField() password = PasswordField('Current password', [Required()]) new_password = PasswordField('New password', [Required(), ...
raise ValidationError("Password is wrong.")
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class PasswordForm(Form): next = HiddenField() password = PasswordField('Current password', [Required()]) new_password = PasswordField('New password', [Required(), ...
raise ValidationError("Password is wrong.")
Using the snippet: <|code_start|> Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX)], description=u'%s characters or more! Be tricky.' % PASSWORD_LEN_MIN) name = TextField(u'Choose your username', [Required(), ...
password_again = PasswordField(u'Password again',
Given the following code snippet before the placeholder: <|code_start|> submit = SubmitField('Sign up') def validate_name(self, field): if User.query.filter_by(name=field.data).first() is not None: raise ValidationError(u'This username is taken') def validate_email(self, field): ...
submit = SubmitField('Reauthenticate')
Based on the snippet: <|code_start|> PASSWORD_LEN_MIN) name = TextField(u'Choose your username', [Required(), Length(USERNAME_LEN_MIN, USERNAME_LEN_MAX)], description=u"Don't worry. you can change it later.") agree = Boo...
message="Passwords don't match")])
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class LoginForm(Form): next = HiddenField() login = TextField(u'Username or email', [Required()]) password = PasswordField('Password', [Required(), Length(PASSWORD_LEN_MIN, PASSWORD_...
name = TextField(u'Choose your username',
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class LoginForm(Form): next = HiddenField() login = TextField(u'Username or email', [Required()]) password = PasswordField('Password', [Required(), Length(PASSWORD_LEN_MIN, PASSWORD_...
submit = SubmitField('Sign in')
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- settings = Blueprint('settings', __name__, url_prefix='/settings') @settings.route('/password', methods=['GET', 'POST']) @login_required def password(): user = User.query.filter_by(name=current_user.name).first_or_404() form = P...
active="password", form=form)
Given snippet: <|code_start|># -*- coding: utf-8 -*- settings = Blueprint('settings', __name__, url_prefix='/settings') @settings.route('/password', methods=['GET', 'POST']) @login_required def password(): user = User.query.filter_by(name=current_user.name).first_or_404() form = PasswordForm(next=request....
flash('Password updated.', 'success')
Predict the next line for this snippet: <|code_start|> EMAIL_LEN_MIN = 4 EMAIL_LEN_MAX = 64 MESSAGE_LEN_MIN = 16 MESSAGE_LEN_MAX = 1024 TIMEZONE_LEN_MIN = 1 TIMEZONE_LEN_MAX = 64 TIMEZONES = { "TZ1": [("-8.00", "(GMT -8:00) Pacific Time (US & Canada)"), ("-7.00", "(GMT -7:00) Mountain Time (US & Can...
("0.00", "(GMT) Western Europe Time, London, Lisbon, Casablanca"),
Based on the snippet: <|code_start|> ("-5.00", "(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima")], "TZ2": [("8.00", "(GMT +8:00) Beijing, Perth, Singapore, Hong Kong")], "TZ3": [("-12.00", "(GMT -12:00) Eniwetok, Kwajalein"), ("-11.00", "(GMT -11:00) Midway Island, Samoa"), ...
("10.00", "(GMT +10:00) Eastern Australia, Guam, Vladivostok"),
Given the code snippet: <|code_start|> SECRET_KEY = 'secret key' INSTANCE_FOLDER_PATH = os.path.join('/tmp', 'instance') # Flask-Sqlalchemy: http://packages.python.org/Flask-SQLAlchemy/config.html SQLALCHEMY_ECHO = True # SQLITE for prototyping. SQLALCHEMY_DATABASE_URI = 'sqlite:///' + \ ...
MAIL_PASSWORD = 'password'
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class Appointment(db.Model): __tablename__ = 'appointments' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(USERNAME_LEN_MAX), nullable=False) email = db.Column(db.String(EMAIL_LEN_MAX), nullable=False) start_time ...
end_time = db.Column(db.Integer, nullable=False)
Predict the next line after this snippet: <|code_start|> form.email.data = wpic_no_send_email if not form.validate_on_submit(): message = "Illegal post data." return render_template('appointment/create.html', form=form, ...
Thank you for contacting us. If you have any questions, please email
Given the following code snippet before the placeholder: <|code_start|> def is_admin(self): return self.role_code == ADMIN # ================================================================ # One-to-many relationship between users and user_statuses. status_code = Column(db.SmallInteger, default...
for keyword in keywords.split():
Continue the code snippet: <|code_start|> @property def role(self): return USER_ROLE[self.role_code] def is_admin(self): return self.role_code == ADMIN # ================================================================ # One-to-many relationship between users and user_statuses. ...
@classmethod
Here is a snippet: <|code_start|> exclude = ('date', 'semester') class AddClientForm(ModelForm): class Meta: model = Client field = '__all__' exclude = () class AddDeptForm(ModelForm): class Meta: model = Department field = '__all__' exclude = () clas...
start_date = forms.DateField(required=False, widget=SelectDateWidget(empty_label=("Year", "Month", "Day"),
Continue the code snippet: <|code_start|> class LoginForm(forms.Form): username = forms.CharField(label="Username", max_length=100) password = forms.CharField(label="Password", widget=forms.PasswordInput) class AddProjectForm(ModelForm): client_first_name = forms.CharField(max_length=100, required=Fals...
'description': forms.Textarea(attrs={'cols': 50, 'rows': 5}),
Predict the next line after this snippet: <|code_start|> def __init__(self, *args, **kwargs): super(AddProjectForm, self).__init__(*args, **kwargs) self.fields['client'].required = False self.fields['users'].widget = forms.widgets.CheckboxSelectMultiple() self.fields['users'].queryset...
class Meta:
Predict the next line for this snippet: <|code_start|> class LoginForm(forms.Form): username = forms.CharField(label="Username", max_length=100) password = forms.CharField(label="Password", widget=forms.PasswordInput) class AddProjectForm(ModelForm): client_first_name = forms.CharField(max_length=100, ...
super(AddProjectForm, self).__init__(*args, **kwargs)
Given the code snippet: <|code_start|> class LoginForm(forms.Form): username = forms.CharField(label="Username", max_length=100) password = forms.CharField(label="Password", widget=forms.PasswordInput) class AddProjectForm(ModelForm): client_first_name = forms.CharField(max_length=100, required=False) ...
}
Predict the next line after this snippet: <|code_start|> class Meta: model = CurrentSemester fields = ('id', 'semester') class UserSerializer(serializers.ModelSerializer): queryset = User.objects.all() class Meta: model = User fields = '__all__' class ProjectSerializer(se...
completed=validated_data.get("completed", None)
Predict the next line after this snippet: <|code_start|> model = User fields = '__all__' class ProjectSerializer(serializers.ModelSerializer): queryset = Project.objects.filter(semester=CurrentSemester.objects.all()[0].semester) semester = serializers.PrimaryKeyRelatedField(queryset=Semester.ob...
'client': {'required': False}, 'type': {'required': False}}
Predict the next line for this snippet: <|code_start|> class DepartmentSerializer(serializers.ModelSerializer): queryset = Department.objects.all() class Meta: model = Department fields = ('id', 'name') class ClientSerializer(serializers.ModelSerializer): department = serializers.Prima...
class Meta:
Given the following code snippet before the placeholder: <|code_start|> class TypeSerializer(serializers.ModelSerializer): queryset = Type.objects.all() class Meta: model = Type fields = ('id', 'name') class SemesterSerializer(serializers.ModelSerializer): queryset = Semester.objects.all(...
fields = '__all__'
Here is a snippet: <|code_start|> class DepartmentSerializer(serializers.ModelSerializer): queryset = Department.objects.all() class Meta: model = Department fields = ('id', 'name') <|code_end|> . Write the next line using the current file imports: import datetime from django.contrib.auth...
class ClientSerializer(serializers.ModelSerializer):
Next line prediction: <|code_start|> self.percent_walk_in = 0 self.active_user_list = list(User.objects.filter(is_active=True)) self.user_objects_list = list() self.start_date = request['start_date'] self.end_date = request['end_date'] self.user = request['user'] s...
for x in request:
Using the snippet: <|code_start|> project_list = [] for x in self.user_objects_list: for y in x.projects_list: project_list.append(y) report = generate_stats(project_list) assert isinstance(report, dict) for x, y in report.it...
self.report_string += '''<tr><td>{}</td><td>{}</td><td>{}</td><td>{}</td><td>{}</td>
Predict the next line after this snippet: <|code_start|> except ObjectDoesNotExist: return [] def generate_stats(report): hours = 0 walk_ins = 0 users = dict() projects = list(Project.objects.all()) active = list(User.objects.filter(is_active=True)) for x in report: hours +=...
except(Exception):
Predict the next line for this snippet: <|code_start|> self.projects_hours += x.hours if x.walk_in: self.walk_in += 1 class Report(object): def __init__(self, request): self.date = datetime.today().strftime("%m/%d/%Y") try: self.semester = Semeste...
self.total_hours += x.projects_hours
Given snippet: <|code_start|> self.report_string += '<style> table, th, td { border: 1px solid black; padding: 5px; font-size: 10pt; }' \ '</style></head>' self.report_string += '<body><h1>Project Report</h1>' self.report_string += '''<a href="{% url 'projtrack3:repo...
else:
Predict the next line for this snippet: <|code_start|> class UserStats(object): def __init__(self, user): # try: # self.user_object = User.objects.get(username=user) # except ObjectDoesNotExist: # self.user_object = User.objects.get(pk=user) # except TypeError: ...
self.date = datetime.today().strftime("%m/%d/%Y")
Given the following code snippet before the placeholder: <|code_start|> def test_type(self): p = Project.objects.get(title="Test Project") self.assertEqual(p.type.name, "Test") def test_client(self): p = Project.objects.get(title="Test Project") self.assertEqual(p.client.em...
department=Department.objects.create(name="Testing"),
Based on the snippet: <|code_start|> semester=Semester.objects.create(name="Later"), completed=False) p3.save() p3.users.add(User.objects.create(username="harry")) def test_check_semester(self): sem = Semester.objects.get(na...
cli = Client.objects.get(email="roberts@email.com")
Using the snippet: <|code_start|> email="rsmith@email.com", department=Department.objects.get(name="Science")) p = Project.objects.create(title="Test Project", description="A project to test the application.", ...
p = Project.objects.get(title="Test Project")
Given the following code snippet before the placeholder: <|code_start|> class ProjectTestCase(django.test.TestCase): def setUp(self): u = User() u.username = "techconbob" u.save() Type.objects.create(name="Test") Department.objects.create(name="Science") Clien...
def test_description(self):
Given the following code snippet before the placeholder: <|code_start|> '72.0.3617.0', '71.0.3578.65', '70.0.3538.115', '72.0.3602.3', '71.0.3578.64', '72.0.3616.1', '72.0.3616.0', '71.0.3578.63', '70.0.3538.114', '71.0.3578.62', '72...
'72.0.3611.0',
Based on the snippet: <|code_start|> '75.0.3740.4', '73.0.3683.90', '74.0.3729.28', '75.0.3740.3', '73.0.3683.89', '75.0.3740.2', '74.0.3729.27', '75.0.3740.1', '75.0.3740.0', '74.0.3729.26', '73.0.3683.88', '73.0.3683.87', ...
'73.0.3683.83',
Predict the next line after this snippet: <|code_start|> '73.0.3635.3', '73.0.3646.2', '73.0.3646.1', '73.0.3646.0', '72.0.3626.30', '71.0.3578.105', '72.0.3626.29', '73.0.3645.2', '73.0.3645.1', '73.0.3645.0', '72.0.3626.28', ...
'72.0.3626.20',
Next line prediction: <|code_start|> if hours: duration += float(hours) * 60 * 60 if days: duration += float(days) * 24 * 60 * 60 if ms: duration += float(ms) return duration def prepend_extension(filename, ext, expected_real_ext=None): name, real_ext = os.path.splitext(file...
return False
Based on the snippet: <|code_start|> # URLs with protocols not in urlparse.uses_netloc are not handled correctly for scheme in ('socks', 'socks4', 'socks4a', 'socks5'): if scheme not in compat_urlparse.uses_netloc: compat_urlparse.uses_netloc.append(scheme) # This is not clearly defined oth...
'74.0.3729.123',
Given the following code snippet before the placeholder: <|code_start|> '68.0.3440.128', '70.0.3533.2', '70.0.3533.1', '70.0.3533.0', '69.0.3497.67', '68.0.3440.127', '70.0.3532.6', '70.0.3532.5', '70.0.3532.4', '69.0.3497.66', '68.0...
'69.0.3497.53',
Given the code snippet: <|code_start|> '74.0.3706.4', '74.0.3706.3', '74.0.3706.2', '74.0.3706.1', '74.0.3706.0', '73.0.3683.41', '72.0.3626.112', '74.0.3705.1', '74.0.3705.0', '73.0.3683.40', '72.0.3626.111', '73.0.3683.39',...
'74.0.3702.1',
Given snippet: <|code_start|> '70.0.3527.1', '70.0.3527.0', '69.0.3497.49', '68.0.3440.121', '70.0.3526.1', '70.0.3526.0', '68.0.3440.120', '69.0.3497.48', '69.0.3497.47', '68.0.3440.119', '68.0.3440.118', '70.0.3525.5', ...
'70.0.3505.9',
Predict the next line after this snippet: <|code_start|> '73.0.3683.9', '74.0.3688.1', '74.0.3688.0', '73.0.3683.8', '72.0.3626.83', '74.0.3687.2', '74.0.3687.1', '74.0.3687.0', '73.0.3683.7', '72.0.3626.82', '74.0.3686.4', '...
'73.0.3683.1',
Given the code snippet: <|code_start|> '70.0.3505.8', '70.0.3523.1', '70.0.3523.0', '69.0.3497.41', '68.0.3440.114', '70.0.3505.7', '69.0.3497.40', '70.0.3522.1', '70.0.3522.0', '70.0.3521.2', '69.0.3497.39', '68.0.3440.113',...
'69.0.3497.34',
Here is a snippet: <|code_start|> LockFileEx.argtypes = [ ctypes.wintypes.HANDLE, # hFile ctypes.wintypes.DWORD, # dwFlags ctypes.wintypes.DWORD, # dwReserved ctypes.wintypes.DWORD, # nNumberOfBytesToLockLow ctypes.wintypes.DWORD, # nNumberOfBytesToLock...
raise OSError('Locking file failed: %r' % ctypes.FormatError())
Given the following code snippet before the placeholder: <|code_start|> '73.0.3683.7', '72.0.3626.82', '74.0.3686.4', '72.0.3626.81', '74.0.3686.3', '74.0.3686.2', '74.0.3686.1', '74.0.3686.0', '73.0.3683.6', '72.0.3626.80', '74.0.36...
'73.0.3681.4',
Predict the next line for this snippet: <|code_start|> '72.0.3626.67', '71.0.3578.135', '73.0.3676.1', '73.0.3676.0', '73.0.3674.2', '72.0.3626.66', '71.0.3578.134', '73.0.3674.1', '73.0.3674.0', '72.0.3626.65', '71.0.3578.133', ...
'73.0.3670.1',
Given snippet: <|code_start|> '72.0.3604.0', '71.0.3578.41', '70.0.3538.98', '71.0.3578.40', '72.0.3603.2', '72.0.3603.1', '72.0.3603.0', '71.0.3578.39', '70.0.3538.97', '72.0.3602.2', '71.0.3578.38', '71.0.3578.37', ...
'72.0.3598.1',
Using the snippet: <|code_start|> '71.0.3563.0', '71.0.3562.2', '70.0.3538.37', '69.0.3497.113', '70.0.3538.36', '70.0.3538.35', '71.0.3562.1', '71.0.3562.0', '70.0.3538.34', '69.0.3497.112', '70.0.3538.33', '71.0.3561.1', ...
'71.0.3558.2',
Here is a snippet: <|code_start|> '70.0.3529.2', '70.0.3529.1', '70.0.3529.0', '69.0.3497.51', '70.0.3528.4', '68.0.3440.123', '70.0.3528.3', '70.0.3528.2', '70.0.3528.1', '70.0.3528.0', '69.0.3497.50', '68.0.3440.122', ...
'70.0.3525.0',
Here is a snippet: <|code_start|> '71.0.3561.1', '71.0.3561.0', '70.0.3538.32', '69.0.3497.111', '71.0.3559.6', '71.0.3560.1', '71.0.3560.0', '71.0.3559.5', '71.0.3559.4', '70.0.3538.31', '69.0.3497.110', '71.0.3559.3', ...
'70.0.3538.26',
Given snippet: <|code_start|> '74.0.3729.67', '75.0.3758.1', '75.0.3758.0', '74.0.3729.66', '73.0.3683.106', '74.0.3729.65', '75.0.3757.1', '75.0.3757.0', '74.0.3729.64', '73.0.3683.105', '74.0.3729.63', '75.0.3756.1', ...
'73.0.3683.101',
Next line prediction: <|code_start|> '73.0.3683.92', '74.0.3729.32', '74.0.3729.31', '73.0.3683.91', '75.0.3741.2', '75.0.3740.5', '74.0.3729.30', '75.0.3741.1', '75.0.3741.0', '74.0.3729.29', '75.0.3740.4', '73.0.3683.90', ...
'75.0.3738.2',
Continue the code snippet: <|code_start|> '74.0.3729.0', '74.0.3726.4', '73.0.3683.69', '74.0.3726.3', '74.0.3728.0', '74.0.3726.2', '73.0.3683.68', '74.0.3726.1', '74.0.3726.0', '74.0.3725.4', '73.0.3683.67', '73.0.3683.66',...
'74.0.3722.1',
Continue the code snippet: <|code_start|> '73.0.3660.2', '73.0.3660.1', '73.0.3660.0', '72.0.3626.44', '71.0.3578.119', '73.0.3659.1', '73.0.3659.0', '72.0.3626.43', '71.0.3578.118', '73.0.3658.1', '73.0.3658.0', '72.0.3626.4...
'73.0.3653.0',
Given snippet: <|code_start|> '73.0.3683.109', '75.0.3759.4', '75.0.3759.3', '74.0.3729.71', '75.0.3759.2', '74.0.3729.70', '73.0.3683.108', '74.0.3729.69', '75.0.3759.1', '75.0.3759.0', '74.0.3729.68', '73.0.3683.107', ...
'75.0.3755.1',
Predict the next line after this snippet: <|code_start|> '73.0.3683.84', '74.0.3729.22', '74.0.3729.21', '75.0.3737.1', '75.0.3737.0', '74.0.3729.20', '73.0.3683.83', '74.0.3729.19', '75.0.3736.1', '75.0.3736.0', '74.0.3729.18', ...
'74.0.3729.10',
Based on the snippet: <|code_start|> if ms: duration += float(ms) return duration def prepend_extension(filename, ext, expected_real_ext=None): name, real_ext = os.path.splitext(filename) return ( '{0}.{1}{2}'.format(name, ext, real_ext) if not expected_real_ext or real_ext[1:] ...
def get_exe_version(exe, args=['--version'],
Given the code snippet: <|code_start|> '69.0.3497.109', '71.0.3559.2', '71.0.3559.1', '71.0.3559.0', '70.0.3538.29', '69.0.3497.108', '71.0.3558.2', '71.0.3558.1', '71.0.3558.0', '70.0.3538.28', '69.0.3497.107', '71.0.3557.2'...
'70.0.3538.22',
Given snippet: <|code_start|>#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals def register_socks_protocols(): # "Register" SOCKS protocols # In Python < 2.6.5, urlsplit() suffers from bug https://bugs.python.org/issue7904 # URLs with protocols not in urlparse.uses_netloc a...
_USER_AGENT_TPL = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36'
Predict the next line for this snippet: <|code_start|> '72.0.3621.1', '72.0.3621.0', '71.0.3578.71', '70.0.3538.119', '72.0.3620.1', '72.0.3620.0', '71.0.3578.70', '70.0.3538.118', '71.0.3578.69', '72.0.3619.1', '72.0.3619.0', ...
'72.0.3615.0',
Continue the code snippet: <|code_start|> return fn = self._get_cache_fn(section, key, dtype) try: try: os.makedirs(os.path.dirname(fn)) except OSError as ose: if ose.errno != errno.EEXIST: raise write_js...
file_size = str(oe)
Continue the code snippet: <|code_start|> return self._ydl.params.get('cachedir') is not False def store(self, section, key, data, dtype='json'): assert dtype in ('json',) if not self.enabled: return fn = self._get_cache_fn(section, key, dtype) try: ...
with io.open(cache_fn, 'r', encoding='utf-8') as cachef:
Predict the next line for this snippet: <|code_start|> assert dtype in ('json',) if not self.enabled: return fn = self._get_cache_fn(section, key, dtype) try: try: os.makedirs(os.path.dirname(fn)) except OSError as ose: ...
try:
Predict the next line after this snippet: <|code_start|>from __future__ import unicode_literals def rsa_verify(message, signature, key): assert isinstance(message, bytes) byte_size = (len(bin(key[0])) - 2 + 8 - 1) // 8 signature = ('%x' % pow(int(signature, 16), key[1], key[0])).encode() <|code_end|> ...
signature = (byte_size * 2 - len(signature)) * b'0' + signature
Using the snippet: <|code_start|> try: urlh = opener.open(version['bin'][0]) newcontent = urlh.read() urlh.close() except (IOError, OSError): if verbose: to_screen(encode_compat_str(traceback.format_exc())) to_screen('ERROR: unab...
for v, vdata in sorted(versions.items()):
Given snippet: <|code_start|> if verbose: to_screen(encode_compat_str(traceback.format_exc())) to_screen('ERROR: unable to download latest version') to_screen('Visit https://github.com/blackjack4494/yt-dlc/releases/latest') return newcontent_hash =...
\n''' % (exe, exe, version_id))
Continue the code snippet: <|code_start|> def _hide_login_info(opts): PRIVATE_OPTS = set(['-p', '--password', '-u', '--username', '--video-password', '--ap-password', '--ap-username']) eqre = re.compile('^(?P<key>' + ('|'.join(re.escape(po) for po in PRIVATE_OPTS)) + ')=.+$') def _scrub_eq(o): m ...
if sys.version_info < (3,):
Here is a snippet: <|code_start|> def _hide_login_info(opts): PRIVATE_OPTS = set(['-p', '--password', '-u', '--username', '--video-password', '--ap-password', '--ap-username']) eqre = re.compile('^(?P<key>' + ('|'.join(re.escape(po) for po in PRIVATE_OPTS)) + ')=.+$') def _scrub_eq(o): m = eqre....
contents = optionf.read()
Next line prediction: <|code_start|> userConfFile = os.path.join(xdg_config_home, 'youtube-dlc', 'config') if not os.path.isfile(userConfFile): userConfFile = os.path.join(xdg_config_home, 'youtube-dlc.conf') else: userConfFile = os.path.join(compat_expanduser(...
userConf = []
Given the following code snippet before the placeholder: <|code_start|> optionf = open(filename_bytes) except IOError: return default # silently skip if file is not present try: # FIXME: https://github.com/ytdl-org/youtube-dl/commit/dfe5fa49aed02cf36ba9f743b11b0903554...
default=None)
Based on the snippet: <|code_start|> if sys.version_info < (3,): contents = contents.decode(preferredencoding()) res = compat_shlex_split(contents, comments=True) finally: optionf.close() return res def _readUserConf(): xdg_config_home = co...
if userConf is None:
Next line prediction: <|code_start|>from __future__ import unicode_literals def _hide_login_info(opts): PRIVATE_OPTS = set(['-p', '--password', '-u', '--username', '--video-password', '--ap-password', '--ap-username']) eqre = re.compile('^(?P<key>' + ('|'.join(re.escape(po) for po in PRIVATE_OPTS)) + ')=.+$...
else:
Given snippet: <|code_start|> try: optionf = open(filename_bytes) except IOError: return default # silently skip if file is not present try: # FIXME: https://github.com/ytdl-org/youtube-dl/commit/dfe5fa49aed02cf36ba9f743b11b0903554b5e56 contents = ...
os.path.join(appdata_dir, 'youtube-dlc', 'config'),
Given snippet: <|code_start|>def _hide_login_info(opts): PRIVATE_OPTS = set(['-p', '--password', '-u', '--username', '--video-password', '--ap-password', '--ap-username']) eqre = re.compile('^(?P<key>' + ('|'.join(re.escape(po) for po in PRIVATE_OPTS)) + ')=.+$') def _scrub_eq(o): m = eqre.match(o)...
finally:
Predict the next line for this snippet: <|code_start|> def _hide_login_info(opts): PRIVATE_OPTS = set(['-p', '--password', '-u', '--username', '--video-password', '--ap-password', '--ap-username']) eqre = re.compile('^(?P<key>' + ('|'.join(re.escape(po) for po in PRIVATE_OPTS)) + ')=.+$') def _scrub_eq(o...
if sys.version_info < (3,):
Given snippet: <|code_start|> contracts_idx = [ "drop index if exists usaspending_contract_agency_name_ft;", "drop index if exists usaspending_contract_contracting_agency_name_ft;", "drop index if exists usaspending_contract_requesting_agency_name_ft;", ...
"create index usaspending_contract_piid on usaspending_contract (piid);",
Based on the snippet: <|code_start|>class BaseImporter(BaseCommand): IN_DIR = None # '/home/datacommons/data/auto/nimsp/raw/IN' DONE_DIR = None # '/home/datacommons/data/auto/nimsp/raw/DONE' REJECTED_DIR = None # '/home/datacommons/data/auto/nimsp/raw/REJECTED' OUT_DIR = None # '/home/da...
self.pid_file_path = os.path.join(settings.TMP_DIRECTORY, self.module_name)
Given snippet: <|code_start|> self.refmon_client = self.cfg.get_refmon_client(self.logger) # Send flow rules for initial policies to the SDX's Reference Monitor self.initialize_dataplane() self.push_dp() # Start the event handlers ps_thread_arp = Thread(target=self.star...
policy['action']['fwd'] = 0
Predict the next line after this snippet: <|code_start|> return self._start(reporter) if self.error is None: self.parent.execute_hook('before_each', execution_context) if self.error is None: self._execute_test(execution_context) self.parent.execute_...
self.elapsed_time = datetime.utcnow() - self._begin
Continue the code snippet: <|code_start|> class ApplicationFactory(object): def __init__(self, arguments): self._instances = {} self.arguments = arguments self.settings = self._settings(self.arguments) def _settings(self, arguments): settings_ = settings.Settings() ...
def _configure_from_arguments(self, settings_):
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- class ApplicationFactory(object): def __init__(self, arguments): self._instances = {} self.arguments = arguments self.settings = self._settings(self.arguments) def _settings(self, arguments): settings_ = setti...
module = None
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- class ApplicationFactory(object): def __init__(self, arguments): self._instances = {} self.arguments = arguments self.settings = self._settings(self.arguments) def _settings(self, arguments): settings_ = settings.S...
if module is not None:
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class ApplicationFactory(object): def __init__(self, arguments): self._instances = {} self.arguments = arguments self.settings = self._settings(self.arguments) def _settings(self, arguments): settings_ = settings...
module = None
Using the snippet: <|code_start|>class ExampleCollector(object): def __init__(self, paths): self.paths = paths self._node_transformer = nodetransformers.TransformToSpecsNodeTransformer() def modules(self): modules = [] for path in self._collect_files_containing_examples(): ...
for file_ in files if file_.endswith('_spec.py')])
Here is a snippet: <|code_start|> def __iter__(self): return iter(self.examples) def execute(self, reporter, execution_context, tags=None): if not self.included_in_execution(tags): return self._start(reporter) try: self.execute_hook('before_all', executio...
def _start(self, reporter):
Predict the next line for this snippet: <|code_start|> if not self.included_in_execution(tags): return self._start(reporter) try: self.execute_hook('before_all', execution_context) for example in self: example_execution_context = copy.copy(exe...
def _bind_helpers_to(self, execution_context):
Given the code snippet: <|code_start|> raise Exception("Can't find title in db") title_id = title["_id"] collection = self.context.shots db_shots = collection.find({self.t_key: title_id}) if db_shots.count(): print("delete") collection.delete_many({self.t_key: title_id}) else: print("no delete") ...
collection.insert(dicts)
Continue the code snippet: <|code_start|> def connect(self, host, user, passwd, db_name): uri = "mongodb://{}:{}@{}/{}?authMechanism=SCRAM-SHA-1".format(user, passwd, host, db_name) self.client = MongoClient(uri) db = self.client[db_name] self.context = db return db def find_shots(self, title): title_obj...
def update_shots(self, project, shots):
Predict the next line after this snippet: <|code_start|> # soup = BeautifulSoup(str, 'lxml') except urllib.error.URLError as err: print(err) db.close() return None else: rows = soup.find_all("tr") movie_id_regex = re.compile("(?<=movie_ID=).*[0-9]") for row in rows: if "onclick" in row.attrs: oncl...
}
Here is a snippet: <|code_start|> class Direction(Enum): up = 1 left = 2 diagonal = 3 class GapPenalty(object): def __init__(self, gap): self.gap = gap def score(self, i, j, traceback, direction): return self.gap <|code_end|> . Write the next line using the current file imports: import editdistance fro...
class AdaptiveGapPenalty(GapPenalty):
Here is a snippet: <|code_start|>class Direction(Enum): up = 1 left = 2 diagonal = 3 class GapPenalty(object): def __init__(self, gap): self.gap = gap def score(self, i, j, traceback, direction): return self.gap class AdaptiveGapPenalty(GapPenalty): def __init__(self, gap, extended_gap): super().__init...
return self.extended_gap