Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given snippet: <|code_start|>class ProgramForm(forms.ModelForm): def clean(self): cleaned_data = super(ProgramForm, self).clean() join_year = cleaned_data.get('join_year') graduation_year = cleaned_data.get('graduation_year') if join_year and graduation_year: if graduati...
attrs={'class': 'form-control', },
Given snippet: <|code_start|> class ProfilePictureForm(forms.Form): profile_picture = forms.ImageField() def clean_profile_picture(self): profile_picture = self.cleaned_data['profile_picture'] content_type = profile_picture.content_type.split('/')[0] if content_type in ['image']: ...
return profile_picture
Using the snippet: <|code_start|> urlpatterns = [ url(r'^authorize/$', CustomAuthorizationView.as_view(), name='authorize'), url(r'^applications/register/$', ApplicationRegistrationView.as_view(), name='register'), url(r'^applications/(?P<pk>\d+)/update/$', ApplicationUpdateView.as_view(), name='update'), ...
]
Predict the next line after this snippet: <|code_start|> logger = logging.getLogger(__name__) class UserViewset(viewsets.GenericViewSet): required_scopes = ['basic'] permission_classes = [TokenHasScope] serializer_class = UserSerializer def get_queryset(self): token = self.request.auth ...
user_queryset = self.get_queryset().first()
Here is a snippet: <|code_start|> logger = logging.getLogger(__name__) class UserViewset(viewsets.GenericViewSet): required_scopes = ['basic'] permission_classes = [TokenHasScope] serializer_class = UserSerializer def get_queryset(self): <|code_end|> . Write the next line using the current file imp...
token = self.request.auth
Given the following code snippet before the placeholder: <|code_start|> allowed_fields = list(set(fields).intersection(set(granted_fields))) user_serialized = UserSerializer(user_queryset, context={'fields': allowed_fields}).data return Response(user_serialized) @list_route(methods=['POST']...
sender=app,
Given snippet: <|code_start|> logger = logging.getLogger(__name__) class UserViewset(viewsets.GenericViewSet): required_scopes = ['basic'] permission_classes = [TokenHasScope] serializer_class = UserSerializer def get_queryset(self): token = self.request.auth user = token.user ...
for scope in granted_scopes:
Here is a snippet: <|code_start|> logger = logging.getLogger(__name__) class UserViewset(viewsets.GenericViewSet): required_scopes = ['basic'] permission_classes = [TokenHasScope] serializer_class = UserSerializer def get_queryset(self): token = self.request.auth user = token.user ...
fields = request.query_params.get('fields')
Next line prediction: <|code_start|> required_scopes = ['basic'] permission_classes = [TokenHasScope] serializer_class = UserSerializer def get_queryset(self): token = self.request.auth user = token.user return User.objects.all().filter(pk=user.id) def list(self, request): ...
return Response(error_message, status=HTTP_400_BAD_REQUEST)
Predict the next line for this snippet: <|code_start|> @click.group( "pipelimit", help="Manage pipelimit module", short_help="Manage pipelimit module", ) @pass_context def cli(ctx): <|code_end|> with the help of current file imports: import click from sqlalchemy import create_engine from kamcli.ioutils i...
pass
Here is a snippet: <|code_start|> @click.group( "pipelimit", help="Manage pipelimit module", short_help="Manage pipelimit module", ) @pass_context def cli(ctx): pass @cli.command("db-add", short_help="Add a new pipelimit record to database") @click.option( "dbtname", "--dbtname", default=...
"--alg",
Here is a snippet: <|code_start|> @click.group( "aliasdb", help="Manage database user aliases", short_help="Manage database user aliases", ) @pass_context <|code_end|> . Write the next line using the current file imports: import click from sqlalchemy import create_engine from kamcli.ioutils import ioutils...
def cli(ctx):
Given the following code snippet before the placeholder: <|code_start|> @click.group( "aliasdb", help="Manage database user aliases", short_help="Manage database user aliases", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a user-alias pair") @click.option( "table", "...
help="Name of database table (default: dbaliases)",
Next line prediction: <|code_start|> @click.group( "aliasdb", help="Manage database user aliases", short_help="Manage database user aliases", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a user-alias pair") @click.option( "table", <|code_end|> . Use current file imports:...
"--table",
Predict the next line after this snippet: <|code_start|> @click.group( "pkg", help="Private memory (pkg) management", short_help="Private memory (pkg) management", ) @pass_context def cli(ctx): <|code_end|> using the current file's imports: import click from kamcli.cli import pass_context from kamcli.ior...
pass
Given the code snippet: <|code_start|>) @click.option( "colusername", "--colusername", default="username", help='Column name for uuid (default: "username")', ) @click.option( "coldomain", "--coldomain", default="domain", help='Column name for domain (default: "domain")', ) @click.option(...
)
Predict the next line after this snippet: <|code_start|>@click.option( "colusername", "--colusername", default="username", help='Column name for uuid (default: "username")', ) @click.option( "coldomain", "--coldomain", default="domain", help='Column name for domain (default: "domain")', ...
@click.option(
Continue the code snippet: <|code_start|> @click.group( "avp", help="Manage AVP user preferences", short_help="Manage AVP user preferences", ) @pass_context def cli(ctx): pass @cli.command("db-add", short_help="Add a new AVP to database") @click.option( <|code_end|> . Use current file imports: impor...
"dbtname",
Predict the next line after this snippet: <|code_start|> @click.group( "speeddial", help="Manage speed dial records", short_help="Manage speed dial records", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a speed dial record") @click.option( "table", "--table", def...
@click.argument("shortdial", metavar="<shortdial>")
Using the snippet: <|code_start|> @click.group( "speeddial", help="Manage speed dial records", short_help="Manage speed dial records", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a speed dial record") @click.option( "table", "--table", default="speed_dial", <|co...
help="Name of database table (default: speed_dial)",
Predict the next line after this snippet: <|code_start|> @click.group( "config", help="Manage the config file", <|code_end|> using the current file's imports: import os import sys import json import click import shutil from kamcli.cli import pass_context from kamcli.cli import COMMAND_ALIASES and any releva...
short_help="Manage the config file",
Here is a snippet: <|code_start|> @click.group( "domain", help="Manage domain module (multi-domain records)", short_help="Manage domain module", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new domain") @click.argument("domain", metavar="<domain>") @pass_context <|code_end...
def domain_add(ctx, domain):
Using the snippet: <|code_start|> @click.group( "domain", help="Manage domain module (multi-domain records)", short_help="Manage domain module", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new domain") @click.argument("domain", metavar="<domain>") @pass_context <|code_end...
def domain_add(ctx, domain):
Continue the code snippet: <|code_start|> @click.group( "ul", help="Manage user location records", short_help="Manage user location records", ) @pass_context <|code_end|> . Use current file imports: import click from sqlalchemy import create_engine from kamcli.ioutils import ioutils_dbres_print from kamcl...
def cli(ctx):
Here is a snippet: <|code_start|> @click.group( "ul", help="Manage user location records", short_help="Manage user location records", ) @pass_context def cli(ctx): pass @cli.command("show", short_help="Show details for location records in memory") @click.option( <|code_end|> . Write the next line usi...
"brief", "--brief", is_flag=True, help="Show brief format of the records."
Given the code snippet: <|code_start|> @click.group( "ul", help="Manage user location records", short_help="Manage user location records", ) @pass_context def cli(ctx): <|code_end|> , generate the next line using the imports in this file: import click from sqlalchemy import create_engine from kamcli.iouti...
pass
Predict the next line for this snippet: <|code_start|> @click.group( "ul", help="Manage user location records", short_help="Manage user location records", ) @pass_context def cli(ctx): <|code_end|> with the help of current file imports: import click from sqlalchemy import create_engine from kamcli.ioutil...
pass
Given the following code snippet before the placeholder: <|code_start|> @click.group( "shv", help="Manage $shv(name) variables", <|code_end|> , predict the next line using imports from the current file: import click from kamcli.cli import pass_context from kamcli.iorpc import command_ctl and context includin...
short_help="Manage $shv(name) variables",
Next line prediction: <|code_start|> @click.group( "htable", help="Management of htable module", short_help="Management of htable module", ) @pass_context def cli(ctx): pass @cli.command("list", short_help="List the content of hash table named htname") <|code_end|> . Use current file imports: (impor...
@click.argument("htname", metavar="<htname>")
Given the following code snippet before the placeholder: <|code_start|> @click.group( "htable", help="Management of htable module", short_help="Management of htable module", ) @pass_context def cli(ctx): pass @cli.command("list", short_help="List the content of hash table named htname") <|code_end|> ...
@click.argument("htname", metavar="<htname>")
Given snippet: <|code_start|> @click.group( "htable", help="Management of htable module", short_help="Management of htable module", ) @pass_context def cli(ctx): pass @cli.command("list", short_help="List the content of hash table named htname") <|code_end|> , continue by predicting the next line. Co...
@click.argument("htname", metavar="<htname>")
Given the following code snippet before the placeholder: <|code_start|> @click.command("stats", short_help="Print internal statistics") @click.option( "single", "--single", "-s", is_flag=True, help="The name belong to one statistic (otherwise the name is " "for a group)", ) <|code_end|> , predi...
@click.option(
Here is a snippet: <|code_start|> @click.command("stats", short_help="Print internal statistics") @click.option( "single", "--single", "-s", is_flag=True, help="The name belong to one statistic (otherwise the name is " "for a group)", <|code_end|> . Write the next line using the current file im...
)
Based on the snippet: <|code_start|> @click.group( "uacreg", help="Manage uac remote registrations", short_help="Manage uac registrations", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new remote registration account") @click.option("realm", "--realm", default="", help='Re...
@click.option(
Next line prediction: <|code_start|> "regdelay", "--reg-delay", type=int, default=0, help="Registration delay (default: 0)", ) @click.option( "socket", "--socket", default="", help='Local socket (default: "")' ) @click.argument("l_uuid", metavar="<l_uuid>") @click.argument("l_username", metavar="...
r_domain,
Predict the next line for this snippet: <|code_start|>) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new remote registration account") @click.option("realm", "--realm", default="", help='Realm (default: "")') @click.option( "authha1", "--auth-ha1", is_flag=True, help="Auth password i...
@click.argument("auth_password", metavar="<auth_password>")
Using the snippet: <|code_start|> @click.group( "dialplan", help="Manage dialplan module (regexp translations)", short_help="Manage dialplan module", <|code_end|> , determine the next line of code. You have imports: import click from sqlalchemy import create_engine from kamcli.ioutils import ioutils_dbres...
)
Using the snippet: <|code_start|> @click.group( "dialplan", help="Manage dialplan module (regexp translations)", short_help="Manage dialplan module", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new dialplan rule") <|code_end|> , determine the next line of code. You have i...
@click.option(
Using the snippet: <|code_start|> @click.group( "dialplan", help="Manage dialplan module (regexp translations)", short_help="Manage dialplan module", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new dialplan rule") @click.option( <|code_end|> , determine the next line of c...
"priority",
Using the snippet: <|code_start|> @click.group( "address", help="Manage permissions address records", short_help="Manage permissions address records", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new record to address table") @click.option( "mask", "--mask", type=int, ...
@click.argument("group", metavar="<group>", type=int)
Predict the next line after this snippet: <|code_start|> @click.group( "address", help="Manage permissions address records", short_help="Manage permissions address records", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new record to address table") @click.option( "mask...
@click.argument("address", metavar="<address>")
Predict the next line after this snippet: <|code_start|> @click.group( "address", help="Manage permissions address records", <|code_end|> using the current file's imports: import click from sqlalchemy import create_engine from kamcli.ioutils import ioutils_dbres_print from kamcli.cli import pass_context from...
short_help="Manage permissions address records",
Predict the next line after this snippet: <|code_start|> @click.group( "apiban", help="Manage APIBan records", short_help="Manage APIBan records", ) @pass_context def cli(ctx): pass def apiban_key(ctx, key): if key is None: key = ctx.gconfig.get("apiban", "key", fallback=None) if key is N...
conn = http.client.HTTPSConnection("apiban.org", timeout=4)
Here is a snippet: <|code_start|> @click.group( "apiban", help="Manage APIBan records", short_help="Manage APIBan records", ) @pass_context def cli(ctx): pass def apiban_key(ctx, key): if key is None: key = ctx.gconfig.get("apiban", "key", fallback=None) if key is None: return...
ctx.vlog(
Given the following code snippet before the placeholder: <|code_start|> @click.group( "rtpengine", help="Manage rtpengine module", short_help="Manage rtpengine module", ) @pass_context def cli(ctx): pass @cli.command("showdb", short_help="Show the rtpengine records in database") @click.option( "o...
@click.option(
Predict the next line after this snippet: <|code_start|> @click.group( "rtpengine", help="Manage rtpengine module", short_help="Manage rtpengine module", ) @pass_context def cli(ctx): pass @cli.command("showdb", short_help="Show the rtpengine records in database") @click.option( "oformat", "-...
)
Here is a snippet: <|code_start|> @click.group( "rtpengine", help="Manage rtpengine module", short_help="Manage rtpengine module", ) @pass_context def cli(ctx): pass <|code_end|> . Write the next line using the current file imports: import click from sqlalchemy import create_engine from kamcli.iouti...
@cli.command("showdb", short_help="Show the rtpengine records in database")
Given the following code snippet before the placeholder: <|code_start|> @click.group( "dlgs", help="Manage dlgs module (active calls stats)", short_help="Manage dlgs module", ) @pass_context def cli(ctx): pass @cli.command("list", short_help="Show details for dialog records in memory") @pass_context ...
def dlgs_list(ctx):
Next line prediction: <|code_start|> @click.command("ping", short_help="Send an OPTIONS ping request") @click.option( "nowait", "--nowait", "-n", is_flag=True, help="Do wait for response", ) @click.option("furi", "--furi", default="", help='From URI (default: "")') <|code_end|> . Use current file imports: (import...
@click.argument("uri", nargs=1, metavar="[<uri>]")
Here is a snippet: <|code_start|> @click.command("ping", short_help="Send an OPTIONS ping request") @click.option( "nowait", "--nowait", "-n", is_flag=True, help="Do wait for response", ) @click.option("furi", "--furi", default="", help='From URI (default: "")') <|code_end|> . Write the next line using the current...
@click.argument("uri", nargs=1, metavar="[<uri>]")
Based on the snippet: <|code_start|> """ command_ctl(ctx, "tls.list", []) @cli.command("info", short_help="Summary of tls usage") @pass_context def tls_info(ctx): """Summary of tls usage \b """ command_ctl(ctx, "tls.info", []) @cli.command( "sqlprint", short_help="Print SQL statement to ...
`verify_depth` INT DEFAULT 9 NOT NULL,
Given the code snippet: <|code_start|> @click.group( "shm", help="Shared memory (shm) management", short_help="Shared memory (shm) management", ) @pass_context def cli(ctx): pass @cli.command("stats", short_help="Show the stats for shared (shm) memory") @pass_context <|code_end|> , generate the next ...
def shm_stats(ctx):
Here is a snippet: <|code_start|> @click.group( "subscriber", help="Manage the subscribers", short_help="Manage the subscribers", ) @pass_context <|code_end|> . Write the next line using the current file imports: import click import hashlib from sqlalchemy import create_engine from kamcli.ioutils import i...
def cli(ctx):
Next line prediction: <|code_start|> @click.group( "subscriber", help="Manage the subscribers", short_help="Manage the subscribers", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new subscriber") @click.option( "dbtname", "--dbtname", "-T", default="subscrib...
help="Store password in clear text (default yes)",
Using the snippet: <|code_start|> @click.group( "subscriber", help="Manage the subscribers", short_help="Manage the subscribers", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new subscriber") @click.option( "dbtname", "--dbtname", "-T", default="subscriber"...
"pwtext",
Using the snippet: <|code_start|> @click.group( "dispatcher", help="Manage dispatcher module (load balancer)", short_help="Manage dispatcher module", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new dispatcher destination") <|code_end|> , determine the next line of code. Y...
@click.option("flags", "--flags", type=int, default=0, help="Flags value")
Continue the code snippet: <|code_start|> @click.group( "dispatcher", help="Manage dispatcher module (load balancer)", short_help="Manage dispatcher module", ) @pass_context def cli(ctx): pass @cli.command("add", short_help="Add a new dispatcher destination") <|code_end|> . Use current file imports: ...
@click.option("flags", "--flags", type=int, default=0, help="Flags value")
Continue the code snippet: <|code_start|> @click.group( "dispatcher", help="Manage dispatcher module (load balancer)", short_help="Manage dispatcher module", ) @pass_context def cli(ctx): pass <|code_end|> . Use current file imports: import click from sqlalchemy import create_engine from kamcli.iout...
@cli.command("add", short_help="Add a new dispatcher destination")
Predict the next line after this snippet: <|code_start|> @click.command( "pstrap", help="Store runtime details and gdb full backtrace for all Kamailio processes to a file", short_help="Get runtime details and gdb backtrace with ps", ) @click.option( "all", "--all", "-a", is_flag=True, h...
)
Predict the next line after this snippet: <|code_start|> @click.group( "mtree", help="Manage mtree module (memory trees)", short_help="Manage mtree module", ) @pass_context <|code_end|> using the current file's imports: import click from sqlalchemy import create_engine from kamcli.ioutils import ioutils_...
def cli(ctx):
Based on the snippet: <|code_start|> @click.group( "mtree", help="Manage mtree module (memory trees)", short_help="Manage mtree module", ) @pass_context def cli(ctx): <|code_end|> , predict the immediate next line with the help of imports: import click from sqlalchemy import create_engine from kamcli.iout...
pass
Given the code snippet: <|code_start|> short_help="Manage mtree module", ) @pass_context def cli(ctx): pass @cli.command("db-add", short_help="Add a new mtree record to database") @click.option( "tname", "--tname", default="", help='Tree name to be stored in column tname (default: "")', ) @clic...
def mtree_dbadd(ctx, tname, coltprefix, coltvalue, dbtname, tprefix, tvalue):
Based on the snippet: <|code_start|> @click.command("sipreq", short_help="Send a SIP request via RPC command") @click.option( "nowait", "--nowait", "-n", is_flag=True, help="Do not wait for response", ) @click.option( "method", "--method", "-m", <|code_end|> , predict the immediate next line with the h...
default="OPTIONS",
Given the following code snippet before the placeholder: <|code_start|> @click.command("sipreq", short_help="Send a SIP request via RPC command") @click.option( "nowait", "--nowait", "-n", is_flag=True, help="Do not wait for response", ) @click.option( "method", "--method", "-m", default="OPTIONS",...
@click.option(
Using the snippet: <|code_start|> @click.command("moni", short_help="Monitor relevant statistics") @click.option( "norefresh", "--no-refresh", is_flag=True, help="Do not refresh (execute once)", <|code_end|> , determine the next line of code. You have imports: import os import time import click import...
)
Continue the code snippet: <|code_start|> if len(sys.argv) < 2: delay = 200 else: delay = int(sys.argv[1]) if len(sys.argv) < 3: sol = 'low' else: sol = sys.argv[2] if sol != 'low' and sol != 'high': print("You must provide either 'low' or 'high' as a possible solution.") sys.exit() #### ...
chains_flat = np.load("../data/J0513_flatsfh_" + sol + "_chain.npy")
Here is a snippet: <|code_start|> # # Load traditional population synthesis results # trad_x_i = np.load("../data/J0513_trad_chain.npy") # trad_likelihood = np.load("../data/J0513_trad_likelihood.npy") # trad_likelihood = np.exp(trad_likelihood) # Since ln likelihoods are actually provided # trad_derived = np.load...
ax[k,j].hist(chains_nosfh.T[i], range=plt_range[i], bins=20, normed=True, histtype='step', color='C4', label='No SFH', linestyle='dashed', zorder=10)
Given the code snippet: <|code_start|>matplotlib.use('Agg') N_times = 500 # Colors C0 = 'C0' <|code_end|> , generate the next line using the imports in this file: import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import matplotlib.patches as mpatches from ....
C1 = 'C1'
Continue the code snippet: <|code_start|># Create a corner plot to show the posterior distribution # fontProperties = {'family':'serif', 'serif':['Times New Roman'], 'weight':'normal', 'size':12} # ticks_font = font_manager.FontProperties(family='Times New Roman', style='normal', \ # ...
trad_x_i = trad_x_i[int(length*frac):,:]
Continue the code snippet: <|code_start|> 'page': 1, }) warnings = service.collect_response_warnings() return { 'status': 'OK' if len(warnings) == 0 else 'WR', 'warnings': warnings, 'response': response } def _test_licensing_component(service, test_config, contex...
'response': response
Using the snippet: <|code_start|> logger = logging.getLogger('management') def _test_search_component(service, test_config, context): query = test_config.get('text_search_query', 'dogs') service.clear_response_warnings() response = service.text_search( context=context, q=query, f=None, s=None, com...
service.clear_response_warnings()
Using the snippet: <|code_start|> urlpatterns = [ url(r'^clients/$', dev_views.ApplicationList.as_view(), name="developers-app-list"), url(r'^clients/register/$', dev_views.ApplicationRegistration.as_view(), name="developers-app-register"), url(r'^clients/(?P<pk>\d+)/$', dev_views.Applicatio...
name="developers-app-detail"),
Given the code snippet: <|code_start|>setattr(Field, 'is_checkbox', lambda self: isinstance(self.widget, forms.CheckboxInput)) # Used in the template class ApiClientForm(ModelForm): # We define a number of predefined combinations of client type and authorization grant type # from which developers can choose...
PUBLIC_PASSWORD = 'public_password'
Based on the snippet: <|code_start|> @override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend') class AccountRegistrationTestCase(TestCase): def test_user_registration(self): # Register new account post_data = { 'password1': '123456', 'password2': '1...
self.assertEquals('the user you are trying to activate does not exist' in resp.content.decode("utf-8"), True)
Next line prediction: <|code_start|> # Auth urls # https://stackoverflow.com/questions/6930982/how-to-use-a-variable-inside-a-regular-expression # domainPrefix = "authenticate/" domainPrefix = "" urlpatterns = [ # Home url(r'^%s$' % domainPrefix, home, name='home'), url(r'^%sabout/$' % domainPrefix, views....
template_name='accounts/authorized-tokens.html',
Continue the code snippet: <|code_start|> # Auth urls # https://stackoverflow.com/questions/6930982/how-to-use-a-variable-inside-a-regular-expression # domainPrefix = "authenticate/" domainPrefix = "" urlpatterns = [ # Home url(r'^%s$' % domainPrefix, home, name='home'), url(r'^%sabout/$' % domainPrefix, v...
url(r'^%sauthorized_clients/$' % domainPrefix, AuthorizedTokensListView.as_view(
Here is a snippet: <|code_start|> # Auth urls # https://stackoverflow.com/questions/6930982/how-to-use-a-variable-inside-a-regular-expression # domainPrefix = "authenticate/" domainPrefix = "" urlpatterns = [ url(r'^%scrash/$' % domainPrefix, crash_me, name='crash_me'), url(r'^%sregister/$' % domainPrefix, re...
url(r'^%slogout/$' % domainPrefix, auth_views.logout, {'next_page': settings.LOGOUT_URL}, name='logout'),
Based on the snippet: <|code_start|> template_name='accounts/password_reset_form.html', subject_template_name='emails/password_reset_subject.txt', email_template_name='emails/password_reset.txt', ), name='password_reset'), url(r'^%spassword_reset/done/$' % domainPrefix, au...
]
Given the code snippet: <|code_start|> # Auth urls # https://stackoverflow.com/questions/6930982/how-to-use-a-variable-inside-a-regular-expression # domainPrefix = "authenticate/" domainPrefix = "" urlpatterns = [ url(r'^%scrash/$' % domainPrefix, crash_me, name='crash_me'), url(r'^%sregister/$' % domainPrefi...
), name='password_reset_confirm'),
Next line prediction: <|code_start|># domainPrefix = "authenticate/" domainPrefix = "" urlpatterns = [ url(r'^%scrash/$' % domainPrefix, crash_me, name='crash_me'), url(r'^%sregister/$' % domainPrefix, registration, name='registration'), url(r'^%sactivate/(?P<username>[^\/]+)/(?P<uid_hash>[^\/]+)/.*$' % do...
url(r'^developers/', include('developers.urls')),
Given snippet: <|code_start|> urlpatterns = [ url(r'^v1/services/$', views.services, name='api-services'), url(r'^v1/collect/$', views.collect_response, name='api-collect'), url(r'^v1/search/text/$', views.text_search, name='api-text-search'), url(r'^v1/license/$', views.licensing, name='api-licensing')...
url(r'^o/', include('api.oauth2_urls', namespace='oauth2_provider')),
Using the snippet: <|code_start|>logger = logging.getLogger('management') class Command(BaseCommand): help = 'Renew access tokens to 3rd party services whose refresh tokens are about to expire. ' \ 'Use as `python manage.py renew_access_tokens`.' def add_arguments(self, parser): pass <|co...
def handle(self, *args, **options):
Given the code snippet: <|code_start|>logger = logging.getLogger('management') class Command(BaseCommand): help = 'Renew access tokens to 3rd party services whose refresh tokens are about to expire. ' \ 'Use as `python manage.py renew_access_tokens`.' def add_arguments(self, parser): <|code_end|> ...
pass
Predict the next line for this snippet: <|code_start|> request_distributor = get_request_distributor() response_aggregator = get_response_aggregator() def get_request_context(request): user_account_id = None dev_account_id = None if hasattr(request, 'successful_authenticator') and request.successful_authe...
'format': response_format,
Based on the snippet: <|code_start|> if exclude is not None: exclude = exclude.split(',') wait_until_complete = \ request.GET.get(QUERY_PARAM_WAIT_UNTIL_COMPLETE, False) # This option is left intentionally undocumented return { QUERY_PARAM_INCLUDE: include, QUERY_PARAM_EXCLUD...
raise ACAPIBadRequest("Invalid '{0}' value".format(QUERY_PARAM_PAGE))
Given snippet: <|code_start|> 'dev_account_id': dev_account_id, 'format': response_format, # NOTE: we use id's instead of the objects so that the dict can be serialized and passed to Celery } def parse_request_distributor_query_params(request): include = request.GET.get(QUERY_PARAM_INCL...
fields = fields.split(',')
Using the snippet: <|code_start|> if request.user.is_authenticated(): user_account_id = request.user.id dev_account_id = user_account_id else: if settings.DEBUG and settings.ALLOW_UNAUTHENTICATED_API_REQUESTS_ON_DEBUG: user_account_id = Account.objects....
QUERY_PARAM_INCLUDE: include,
Predict the next line for this snippet: <|code_start|> self.assertEqual(resp.json()['error'], 'invalid_client') # Return 'unsupported_grant_type' when grant type does not exist resp = self.client.post( reverse('oauth2_provider:token'), { 'client_id': clien...
'client_id': client.client_id,
Given the following code snippet before the placeholder: <|code_start|> self.service.configure({'service_id': 'downloadserviceid', 'enabled': 'yes'}) management.available_services = [self.service] def test_get_download_link(self): # Make unauthenticated request and assert it returns 401 ...
self.assertEqual(resp.status_code, 404)
Here is a snippet: <|code_start|> ) email1 = forms.EmailField(label=_("Email"), help_text=_("We will send you a confirmation/activation email, so make " "sure this is correct!.")) email2 = forms.EmailField(label=_("Email confirmation")) password...
email1 = self.cleaned_data.get("email1", "")
Predict the next line after this snippet: <|code_start|> response_aggregator = get_response_aggregator() @shared_task def perform_request_and_aggregate(request, response_id, service_id): service = get_service_by_id(service_id) try: print('Requesting response from {0} ({1})'.format(service.name, respon...
service.clear_response_warnings()
Using the snippet: <|code_start|> response_aggregator = get_response_aggregator() @shared_task def perform_request_and_aggregate(request, response_id, service_id): service = get_service_by_id(service_id) try: print('Requesting response from {0} ({1})'.format(service.name, response_id)) service...
except (ACException, ACAPIException) as e:
Predict the next line for this snippet: <|code_start|> response_aggregator = get_response_aggregator() @shared_task def perform_request_and_aggregate(request, response_id, service_id): service = get_service_by_id(service_id) try: print('Requesting response from {0} ({1})'.format(service.name, response...
response_aggregator.aggregate_response(response_id, service.name, e)
Continue the code snippet: <|code_start|> def _encode_jwt( algorithm: str, audience: Union[str, Iterable[str]], claim_overrides: dict, csrf: bool, expires_delta: ExpiresDelta, fresh: bool, header_overrides: dict, identity: Any, identity_claim_key: str, <|code_end|> . Use current f...
issuer: str,
Given the following code snippet before the placeholder: <|code_start|> fresh = datetime.timestamp(now + fresh) token_data = { "fresh": fresh, "iat": now, "jti": str(uuid.uuid4()), "type": token_type, identity_claim_key: identity, } if nbf: token_data...
secret,
Given snippet: <|code_start|> def _encode_jwt( algorithm: str, audience: Union[str, Iterable[str]], claim_overrides: dict, csrf: bool, expires_delta: ExpiresDelta, fresh: bool, header_overrides: dict, identity: Any, identity_claim_key: str, issuer: str, json_encoder: Type[...
token_data = {
Next line prediction: <|code_start|> #extract calib data from cam_config self.a = cam_config["a"] self.n = cam_config["n"] self.cam = cv2.VideoCapture(cam_num) self.cam.set(3, 1280) self.cam.set(4, 720) self.resX = int(self.cam.get(3)) sel...
while not self.stopped:
Predict the next line for this snippet: <|code_start|> # QR scanning tools self.scanner = zbar.ImageScanner() self.scanner.parse_config('enable') (self.grabbed, self.frame) = self.cam.read() self.stopped = True def start(self): # sta...
def stop(self):
Using the snippet: <|code_start|> def find_name(symlink): # find where symlink is pointing (/dev/vide0, video1, etc) cmd = "readlink -f /dev/" + symlink process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) out = process.communicate()[0] #extract ints from name video0, etc nums = ...
cam_num = find_name(udev_name)
Based on the snippet: <|code_start|> # Some helpers for random. def randloc(): return randint(-100, 100) def randrot(): <|code_end|> , predict the immediate next line with the help of imports: from random import randint, uniform from elixir_models import Object from sys import maxint import ...
return randint(-360, 360)