Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' TNX_ID_RE = re.compile(ur'^\w{1,30}$') class RequestPaymentForm(forms.Form): txn_id = forms.RegexField(regex=TNX_ID_RE, label=_(u'unique payment number'), widget=for...
label=u'{0} {1}% {2}'.format(_('sum with'), QIWI_PERCENT, _('percent')),
Using the snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', url(r'^add-money/(?P<account_uid>\d+)/(?P<invoice_uid>\d+)$', login_required(AddMoneyView.as_view()), name='accounts_add_money'), url(r'^add-money/(?P<accou...
url(r'^add-account/currency/(?P<currency>\w{3})$', login_required(AddAccountView.as_view()), name='accounts_add_account'),
Given the following code snippet before the placeholder: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', <|code_end|> , predict the next line using imports from the current file: from django.conf.urls.defaults import patterns, url...
url(r'^add-money/(?P<account_uid>\d+)/(?P<invoice_uid>\d+)$', login_required(AddMoneyView.as_view()), name='accounts_add_money'),
Here is a snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', url(r'^add-money/(?P<account_uid>\d+)/(?P<invoice_uid>\d+)$', login_required(AddMoneyView.as_view()), name='accounts_add_money'), url(r'^add-money/(?P<accou...
url(r'^invoices/(?P<account_uid>\d+)/$', login_required(InvoicesListListView.as_view()), name='accounts_invoices'),
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', url(r'^add-money/(?P<account_uid>\d+)/(?P<invoice_uid>\d+)$', login_required(AddMoneyView.as_view()), name='accounts_add_money'), url(r...
url(r'^list/$', login_required(AccountsListView.as_view()), name='accounts_list'),
Given the code snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', url(r'^add-money/(?P<account_uid>\d+)/(?P<invoice_uid>\d+)$', login_required(AddMoneyView.as_view()), name='accounts_add_money'), url(r'^add-money/(?P<...
url(r'^statement/(?P<account_uid>\d+)/$', login_required(AccountStatementView.as_view()), name='accounts_statement'),
Using the snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', <|code_end|> , determine the next line of code. You have imports: from django.conf.urls.defaults import patterns, url from django.contrib.auth.decorators import log...
url(r'add-money/(?P<invoice_uid>\d+)/$', login_required(QiwiView.as_view()), name='qiwi_add_money'),
Given the following code snippet before the placeholder: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class PaymentRequestFormTests(TestCase): def setUp(self): self.valid_data = { 'LMI_PAYEE_PURSE': 'Z123412341234', 'LM...
form = RequestPaymentForm(data=self.valid_data)
Here is a snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class BaseTestCase(TestCase): def setUp(self): self.user = User.objects.create_user( 'user', 'user@example.com', 'abc123', ) <|code_en...
self.account = Account.objects.create(user=self.user)
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AddAccountView(TemplateView): template_name = 'accounts/list.html' MESSAGES = { 'WRONG_CURRENCY': _('Currency not allowed!'), } def get(s...
if currency not in dict(CURRENCY_CHOICES).keys():
Given the following code snippet before the placeholder: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountsListView(TemplateView): template_name = 'accounts/list.html' def get(self, request): accounts_page = create_paginated_page( ...
objects_per_page=ACCOUNTS_PER_PAGE
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountsListView(TemplateView): template_name = 'accounts/list.html' def get(self, request): accounts_page = create_paginated_page( <|code_end|> wit...
query_set=Account.objects.filter(user=request.user).order_by('-id'),
Predict the next line for this snippet: <|code_start|> self.assert_correct_currency(money) if money < Money(0, self.currency): raise ValueError("You can't add a negative money amount") return Transaction.objects.create( account=self, money_amount=money, ...
objects = ChainableQuerySetManager(TransactionQuerySet)
Based on the snippet: <|code_start|> account=to_account, money_amount=money, ) def assert_correct_currency(self, money): if money.currency != self.currency: raise ValueError("You can't add money with %s currency. Current currency %s" % (money.currency, self.curren...
objects = ChainableQuerySetManager(InvoiceQuerySet)
Predict the next line after this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiView(TemplateView): template_name = 'qiwi/add_money_request.html' def get(self, request, *args, **kwargs): context = super(QiwiView, self).get...
invoice = get_object_or_404(Invoice, uid=invoice_uid)
Given the code snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiView(TemplateView): template_name = 'qiwi/add_money_request.html' def get(self, request, *args, **kwargs): context = super(QiwiView, self).get_context_data(**kw...
'lifetime': QIWI_BILL_LIFETIME,
Based on the snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiView(TemplateView): template_name = 'qiwi/add_money_request.html' def get(self, request, *args, **kwargs): context = super(QiwiView, self).get_context_data(**kwar...
'check_agt': QIWI_CHECK_AGT
Continue the code snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiView(TemplateView): template_name = 'qiwi/add_money_request.html' def get(self, request, *args, **kwargs): context = super(QiwiView, self).get_context_data(*...
invoice.update_money_amount_with_percent(QIWI_PERCENT)
Here is a snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiView(TemplateView): template_name = 'qiwi/add_money_request.html' def get(self, request, *args, **kwargs): context = super(QiwiView, self).get_context_data(**kwargs)...
context['request_form'] = RequestPaymentForm(initial={
Based on the snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiView(TemplateView): template_name = 'qiwi/add_money_request.html' def get(self, request, *args, **kwargs): context = super(QiwiView, self).get_context_data(**kwar...
'from': QIWI_LOGIN,
Given the following code snippet before the placeholder: <|code_start|> return response class checkBill(complextypes.ComplexType): login = str password = str txn = str class checkBillResponse(complextypes.ComplexType): user = str amount = str date = str lifetime = str status = ...
response.status = Bill.STATUS.MADE
Here is a snippet: <|code_start|> amount = str comment = str txn = str lifetime = str alarm = int create = bool class createBillResponse(complextypes.ComplexType): createBillResult = int RECEIVED_DATA = {} BILLING_DATE = '10.01.2012 13:00:00' class MockCreateBillService(soaphandler.SoapHan...
if not all([login==QIWI_LOGIN, password==QIWI_PASSWORD]):
Based on the snippet: <|code_start|> amount = str comment = str txn = str lifetime = str alarm = int create = bool class createBillResponse(complextypes.ComplexType): createBillResult = int RECEIVED_DATA = {} BILLING_DATE = '10.01.2012 13:00:00' class MockCreateBillService(soaphandler.Soap...
if not all([login==QIWI_LOGIN, password==QIWI_PASSWORD]):
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' MIN_MONEY_VALUE = 1.0 PAYMENT_SYSTEM_CHOICES = ( ('webmoney_add_money', 'Webmoney WMR'), ('qiwi_add_money', 'Qiwi RUB'), ) class AddMoneyForm(forms.Form): money_amount = form...
decimal_places=MAX_MONEY_PLACES,
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' MIN_MONEY_VALUE = 1.0 PAYMENT_SYSTEM_CHOICES = ( ('webmoney_add_money', 'Webmoney WMR'), ('qiwi_add_money', 'Qiwi RUB'), ) class AddMoneyForm(forms.Form): m...
max_digits=MAX_MONEY_DIGITS,
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class Order(TimeStampedModel): PAYMENT_STATUS = Choices( (False, 'NOT_PAID', _('not paid')), (True, 'PAID', _('paid')), ) user = models.ForeignKey(User, related...
sum = fields.MoneyField(_('sum'), max_digits=MAX_MONEY_DIGITS, decimal_places=MAX_MONEY_PLACES)
Predict the next line after this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class Order(TimeStampedModel): PAYMENT_STATUS = Choices( (False, 'NOT_PAID', _('not paid')), (True, 'PAID', _('paid')), ) user = models.Fore...
sum = fields.MoneyField(_('sum'), max_digits=MAX_MONEY_DIGITS, decimal_places=MAX_MONEY_PLACES)
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class Order(TimeStampedModel): PAYMENT_STATUS = Choices( (False, 'NOT_PAID', _('not paid')), (True, 'PAID', _('paid')), ) user = models.Foreig...
account = models.ForeignKey(Account, related_name='orders', verbose_name=_('account'))
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class Order(TimeStampedModel): PAYMENT_STATUS = Choices( (False, 'NOT_PAID', _('not paid')), (True, 'PAID', _('paid')), ) user = models.ForeignKey(User, related...
merchant = models.ForeignKey(Merchant, related_name='orders', verbose_name=_('merchant'))
Based on the snippet: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class QiwiSoa...
def createBill(cls, login=QIWI_LOGIN, password=QIWI_PASSWORD, user='', amount='', comment='', txn='', lifetime=QIWI_BILL_LIFETIME, alarm=QIWI_ALARM, create=QIWI_CREATE):
Using the snippet: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class QiwiSoapCl...
def createBill(cls, login=QIWI_LOGIN, password=QIWI_PASSWORD, user='', amount='', comment='', txn='', lifetime=QIWI_BILL_LIFETIME, alarm=QIWI_ALARM, create=QIWI_CREATE):
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class QiwiSoa...
url = QIWI_SOAP_CLIENT_URL
Given the code snippet: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class QiwiS...
def createBill(cls, login=QIWI_LOGIN, password=QIWI_PASSWORD, user='', amount='', comment='', txn='', lifetime=QIWI_BILL_LIFETIME, alarm=QIWI_ALARM, create=QIWI_CREATE):
Given snippet: <|code_start|>sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class QiwiSoapClient(object): url = QIWI_SOAP_CLIENT_URL @classmethod def createBill(cls, login=QIWI_LOGIN, password=QIWI_PASSWORD, user='',...
return now.strftime(QIWI_DATETIME_FORMAT)
Continue the code snippet: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class Qi...
def createBill(cls, login=QIWI_LOGIN, password=QIWI_PASSWORD, user='', amount='', comment='', txn='', lifetime=QIWI_BILL_LIFETIME, alarm=QIWI_ALARM, create=QIWI_CREATE):
Here is a snippet: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds class QiwiSoapClientException(Exception): pass class QiwiSoapCl...
def createBill(cls, login=QIWI_LOGIN, password=QIWI_PASSWORD, user='', amount='', comment='', txn='', lifetime=QIWI_BILL_LIFETIME, alarm=QIWI_ALARM, create=QIWI_CREATE):
Given the following code snippet before the placeholder: <|code_start|># -*- coding: UTF-8 -*- logger = logging.getLogger(__name__) __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' <|code_end|> , predict the next line using imports from the current file: import datetime import logging from suds....
sxbasic.Import.bind('http://www.w3.org/2001/XMLSchema', XML_SCHEMA_PATH) # for suds
Given snippet: <|code_start|> u'LMI_SYS_TRANS_NO': u'315', u'LMI_TELEPAT_PHONENUMBER': u'', u'LMI_PAYMER_NUMBER': u'', u'LMI_CAPITALLER_WMID': u'', u'LMI_PAYMER_EMAIL': u'', u'LMI_TELEPAT_ORDERID': u'', } def test_prerequest(self): ...
account = Account.objects.filter(user=self.user)[0]
Given the following code snippet before the placeholder: <|code_start|> u'LMI_DBLCHK': u'SMS', u'LMI_SYS_TRANS_NO': u'315', u'LMI_TELEPAT_PHONENUMBER': u'', u'LMI_PAYMER_NUMBER': u'', u'LMI_CAPITALLER_WMID': u'', u'LMI_PAYMER_EMAIL': u'', ...
success_payments_count = ResultResponsePayment.objects.count()
Continue the code snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' def mock_MerchantHttpClient_success_execute(): class ResponseMock(object): text = RESPONSE_STATUS.OK <|code_end|> . Use current file imports: from mock import Mock from r...
MerchantHttpClient.execute = Mock(return_value=ResponseMock())
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' def mock_MerchantHttpClient_success_execute(): class ResponseMock(object): <|code_end|> . Use current file imports: (from mock import Mock from requests.exceptions import ConnectionEr...
text = RESPONSE_STATUS.OK
Given the following code snippet before the placeholder: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountAdmin(admin.ModelAdmin): list_display = ( 'uid', 'currency_code', 'user', ) class InvoiceAdmin(admin.ModelAdm...
admin.site.register(Account, AccountAdmin)
Using the snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountAdmin(admin.ModelAdmin): list_display = ( 'uid', 'currency_code', 'user', ) class InvoiceAdmin(admin.ModelAdmin): list_display = ( 'uid...
admin.site.register(Transaction)
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountAdmin(admin.ModelAdmin): list_display = ( 'uid', 'currency_code', 'user', ) class InvoiceAdmin(admin.ModelAdmin): list_display = ( 'uid', ...
admin.site.register(Invoice, InvoiceAdmin)
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiSoapClientTestCase(TestCase): mock_qiwi_provider = None @classmethod def setUpClass(cls): cls.mock_qiwi_provider = MockQiwiProviderRunner...
self.assertEquals(TERMINATION_CODES.SUCCESS, self.createBill())
Continue the code snippet: <|code_start|> __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiSoapClientTestCase(TestCase): mock_qiwi_provider = None @classmethod def setUpClass(cls): cls.mock_qiwi_provider = MockQiwiProviderRunner() cls.mock_qiwi_provider.start...
QiwiSoapClient.url = 'http://127.0.0.1:{0}/createBill?wsdl'.format(MockQiwiProviderRunner.PORT)
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiSoapClientTestCase(TestCase): mock_qiwi_provider = None @classmethod def setUpClass(cls): <|code_end|> , continue by predicting the next line. Consider current file impor...
cls.mock_qiwi_provider = MockQiwiProviderRunner()
Given the following code snippet before the placeholder: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class QiwiSoapClientTestCase(TestCase): mock_qiwi_provider = None @classmethod def setUpClass(cls): cls.mock_qiwi_provider = MockQ...
self.assertDictContainsSubset(self.bill_data, RECEIVED_DATA['createBill'])
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', url(r'^payment/$', login_required(csrf_exempt(OrderPaymentView.as_view())), name='orders_payment'), <|code_end|> , continue by predicting the next line. Consider cur...
url(r'^list/$', login_required(OrderListView.as_view()), name='orders_list'),
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' urlpatterns = patterns('', <|code_end|> , continue by predicting the next line. Consider current file imports: from django.conf.urls.defaults import patterns, url from django.contrib.auth.decorat...
url(r'^payment/$', login_required(csrf_exempt(OrderPaymentView.as_view())), name='orders_payment'),
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class InvoicesListListView(TemplateView): template_name = 'accounts/invoices_list.html' def get(self, request, *args, **kwargs): account_uid = int(kwargs.get('account_uid'...
objects_per_page=INVOICES_PER_PAGE
Continue the code snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class InvoicesListListView(TemplateView): template_name = 'accounts/invoices_list.html' def get(self, request, *args, **kwargs): account_uid = int(kwargs.get('account...
account = get_object_or_404(Account, uid=account_uid)
Here is a snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class MerchantHttpClientTestCase(TestCase): fixtures = [ "payway_merchants_merchants.json", "payway_orders_orders.json", ] def setUp(self): <|code_end|> . Write ...
self.merchant = Merchant.objects.get(uid=972855239)
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class OrderForm(forms.Form): uid = forms.IntegerField( label=_('order number'), min_value=0, max_value=RandomUIDAbstractModel.MAX_UID, widget=forms.TextInput(...
max_digits=MAX_MONEY_DIGITS,
Based on the snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class OrderForm(forms.Form): uid = forms.IntegerField( label=_('order number'), min_value=0, max_value=RandomUIDAbstractModel.MAX_UID, widget=forms.Tex...
decimal_places=MAX_MONEY_PLACES,
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class OrderForm(forms.Form): uid = forms.IntegerField( label=_('order number'), min_value=0, max_value=RandomUIDAbstractModel.MAX_UID, widget=forms.Tex...
min_value=ORDER_MIN_SUM,
Next line prediction: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountStatementView(TemplateView): template_name = 'accounts/statement.html' def get(self, request, *args, **kwargs): account_uid = int(kwargs.get('account_uid', -1)...
objects_per_page=TRANSACTIONS_PER_PAGE
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountStatementView(TemplateView): template_name = 'accounts/statement.html' def get(self, request, *args, **kwargs): account_uid = int(kwargs.get('account_uid', -1)) <|cod...
account = get_object_or_404(Account, uid=account_uid)
Predict the next line for this snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AccountStatementView(TemplateView): template_name = 'accounts/statement.html' def get(self, request, *args, **kwargs): account_uid = int(kwargs.get(...
query_set=Transaction.objects.filter(account=account).order_by('-created'),
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class Command(NoArgsCommand): def handle_noargs(self, **options): <|code_end|> , continue by predicting the next line. Consider current file imports: from django.core.management.base import...
run_qiwi_soap_server()
Given snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' class AddAccountViewTests(BaseViewTestCase): def setUp(self): self.create_new_user_with_account() self._url = reverse("accounts_add_account", args=['RUB']) def test_get(s...
message=AddAccountView.MESSAGES['WRONG_CURRENCY'],
Continue the code snippet: <|code_start|># -*- coding: UTF-8 -*- __author__ = 'Razzhivin Alexander' __email__ = 'admin@httpbots.com' TERMINATION_CODES = Choices( (0, 'SUCCESS',_('0 Success')), (13, 'SERVER_IS_BUSY', _('13 Server is busy, please repeat your request later')), (150, 'AUTHORIZATION_ERROR', _...
class Bill(ResponsePayment):
Predict the next line for this snippet: <|code_start|> code = "```py\n{0}\n```" class Moderation(Cog): def __init__(self, bot): super().__init__(bot) self.cursor = bot.mysql.cursor self.discord_path = bot.path.discord self.files_path = bot.path.files self.nick_massing = [] self.nick_unmassing = [] @comm...
@checks.mod_or_perm(manage_messages=True)
Predict the next line for this snippet: <|code_start|> chatbot = ChatBot("NotSoBot", trainer='chatterbot.trainers.ChatterBotCorpusTrainer', storage_adapter="chatterbot.storage.MongoDatabaseAdapter", output_adapter="chatterbot.output.OutputFormatAdapter", output_format='text', ...
class AI(Cog):
Here is a snippet: <|code_start|> output_format='text', database='chatterbot-database', database_uri='mongodb://localhost:27017/') cb = Cleverbot() class AI(Cog): def __init__(self, bot): super().__init__(bot) self.ai_target = {} @commands.command(aliases=['cb']) async def cleverbot(s...
@checks.mod_or_perm(manage_server=True)
Continue the code snippet: <|code_start|> def __init__(self, bot): super().__init__(bot) self.cursor = bot.mysql.cursor self.escape = bot.escape self.bytes_download = bot.bytes_download self.get_json = bot.get_json async def banned_tags(self, ctx, search): if ctx.message.channel.is_private: return Fals...
@checks.mod_or_perm(manage_server=True)
Predict the next line for this snippet: <|code_start|> class Commands(Cog): def __init__(self, bot): super().__init__(bot) self.cursor = bot.mysql.cursor self.escape = bot.escape @commands.group(pass_context=True, aliases=['setprefix', 'changeprefix'], invoke_without_command=True, no_pm=True) <|code_end|> wit...
@checks.admin_or_perm(manage_server=True)
Predict the next line after this snippet: <|code_start|> cool = "```xl\n{0}\n```" code = "```py\n{0}\n```" #hard coded color roles cause I don't want to rewrite this and deal with discord roles, lul class Utils(Cog): def __init__(self, bot): super().__init__(bot) self.cursor = bot.mysql.cursor self.discord_path...
@checks.is_owner()
Given the code snippet: <|code_start|> #mainly from https://github.com/Rapptz/RoboDanny/blob/master/cogs/repl.py class Repl(Cog): def __init__(self, bot): super().__init__(bot) self.sessions = set() self.cursor = bot.mysql.cursor async def cleanup_code(self, content): """Automatically removes code blocks f...
@checks.is_owner()
Using the snippet: <|code_start|> except KeyError: content = '' else: content = fromstring(content) content = format(content) parsed_posts.append({ 'content': content, 'url': url, }) return parsed_posts def get_discord_posts(board): ...
class Chan(Cog):
Given the following code snippet before the placeholder: <|code_start|> results = "" for s in result: owner_id = s['user'] tag = s['tag'] tag = self.tag_formatter(tag) if owner_id == ctx.message.author.id: results += "Tag: `{0}` | Owner: <@{1}>\n".format(tag, owner_id) else: user = awa...
@checks.is_owner()
Given the code snippet: <|code_start|> #old code (hence the sql mess), y fix cool = "```xl\n{0}\n```" code = "```py\n{0}\n```" def check_int(k): if k[0] in ('-', '+'): return k[1:].isdigit() return k.isdigit() <|code_end|> , generate the next line using the imports in this file: import asyncio impor...
class Tags(Cog):
Based on the snippet: <|code_start|> cool = "```xl\n{0}\n```" code = "```py\n{0}\n```" class Logs(Cog): def __init__(self, bot): super().__init__(bot) self.cursor = bot.mysql.cursor self.escape = bot.escape self.discord_path = bot.path.discord self.files_path = bot.path.files self.download = bo...
@checks.admin_or_perm(manage_server=True)
Given snippet: <|code_start|> def edge(pixels, image, angle): img = Image.open(image) img = img.rotate(angle, expand=True) edges = img.filter(ImageFilter.FIND_EDGES) edges = edges.convert('RGBA') edge_data = edges.load() filter_pixels = [] edge_pixels = [] intervals = [] for ...
edge_pixels[y].append(constants.white_pixel)
Here is a snippet: <|code_start|> parser = mods.Tags.Tags.parser default_join = 'Welcome to **{server}** - {mention}! You are the {servercount} member to join.' default_leave = '**{user}#{discrim}** has left the server.' #http://stackoverflow.com/a/16671271 def number_formating(n): return str(n)+("th" if 4<=n%100<=20...
@checks.admin_or_perm(manage_server=True)
Continue the code snippet: <|code_start|> parser = mods.Tags.Tags.parser default_join = 'Welcome to **{server}** - {mention}! You are the {servercount} member to join.' default_leave = '**{user}#{discrim}** has left the server.' #http://stackoverflow.com/a/16671271 def number_formating(n): return str(n)+("th" if 4<=n...
class JoinLeave(Cog):
Based on the snippet: <|code_start|> class SteamId(object): def __init__(self): super(SteamId, self).__init__() self._universe = None self._accountType = None self._instance = None self._accountId = None @property def universe(self): return self._universe @property def a...
if self.universe != SteamAccountUniverse.Public: x = "?"
Given snippet: <|code_start|> self._instance = None self._accountId = None @property def universe(self): return self._universe @property def accountType(self): return self._accountType @property def instance(self): return self._instance @property def accountId(self): ret...
character = SteamAccountType.toCharacter(self.accountType)
Based on the snippet: <|code_start|> path = self.files_path('markov/{0}/'.format(message.server.id)) await self.add_markov(path, message.content) if message.author.id in self.users.keys() and self.users[message.author.id] == message.server.id: path = self.files_path('markov/{0}_{1}/'.format(message...
@checks.is_owner()
Continue the code snippet: <|code_start|> thing = '{0}\n{1}'.format(max_server.name, max_) return max_server.name, max_ async def get_channels(self): text_channels = 0 voice_channels = 0 for server in self.bot.servers: for channel in server.channels: if channel.type == discord.Channe...
@checks.is_owner()
Based on the snippet: <|code_start|> PYTHON, "%s/plans/k8s_2t.py" % APP_PATH, ] print("exec[%s] -> %s\n" % (os.getpid(), " ".join(cmd))) with open(ec.plan_pid_file, "w") as f: f.write("%d" % os.getpid()) os.execve(cmd[0], cmd, os.environ) def validate(): cmd = [ PYTH...
f = parser.parse_args().configs
Continue the code snippet: <|code_start|> class TestConfigSyncSchedules(TestCase): unit_path = "%s" % os.path.dirname(__file__) tests_path = "%s" % os.path.split(unit_path)[0] test_matchbox_path = "%s/test_matchbox" % tests_path api_uri = "http://127.0.0.1:5000" def test_00(self): <|code_end|> . ...
s = sync.ConfigSyncSchedules(
Given the code snippet: <|code_start|> class TestTools(TestCase): unit_path = "%s" % os.path.dirname(__file__) tests_path = "%s" % os.path.split(unit_path)[0] def test_00(self): <|code_end|> , generate the next line using the imports in this file: import os from unittest import TestCase from app import ...
self.assertIsNone(tools.get_verified_dns_query({
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3 RUNTIME_PATH = os.path.dirname(os.path.abspath(__file__)) PROJECT_PATH = os.path.dirname(RUNTIME_PATH) sys.path.append(PROJECT_PATH) sys.path.append(RUNTIME_PATH) for p in os.listdir(os.path.join(PROJECT_PATH, "env/lib/")): PYTHON_LI...
config.rkt_path_d(RUNTIME_PATH)
Continue the code snippet: <|code_start|> matchbox = os.getenv("CHECK_MATCHBOX_PATH", "%s/matchbox" % cwd) assets = "%s/assets" % matchbox def test_discoveryC(self): rule = "%s/%s/serve" % (self.assets, self.test_discoveryC.__name__.replace("test_", "")) list_dir = os.listdir(rule) s...
ec = configs.EnjoliverConfig(importer=__file__)
Given snippet: <|code_start|>Partial Least Squares using SVD moduleauthor:: Derek Tucker <dtucker@stat.fsu.edu> """ def pls_svd(time, qf, qg, no, alpha=0.0): """ This function computes the partial least squares using SVD :param time: vector describing time samples :param qf: numpy ndarray of shape ...
D4x = diffop(nx, binsize)
Predict the next line for this snippet: <|code_start|> moduleauthor:: Derek Tucker <dtucker@stat.fsu.edu> """ def pls_svd(time, qf, qg, no, alpha=0.0): """ This function computes the partial least squares using SVD :param time: vector describing time samples :param qf: numpy ndarray of shape (M,N) o...
values, Lmat, Mmat = geigen(Kfg, np.eye(nx) + alpha * D4x, np.eye(nx) + alpha * D4x)
Given snippet: <|code_start|> def pls_svd(time, qf, qg, no, alpha=0.0): """ This function computes the partial least squares using SVD :param time: vector describing time samples :param qf: numpy ndarray of shape (M,N) of N functions with M samples :param qg: numpy ndarray of shape (M,N) of N funct...
wf[:, ii] = wf[:, ii] / np.sqrt(innerprod_q(time, wf[:, ii], wf[:, ii]))
Continue the code snippet: <|code_start|> """ print ("Initializing...") binsize = np.diff(time) binsize = binsize.mean() eps = np.finfo(np.double).eps M = f.shape[0] N = f.shape[1] f0 = f g0 = g if showplot: plot.f_plot(time, f, title="f Original Data") plot.f_plo...
wqf1, wqg1, alpha, values, costmp = pls_svd(time, qfi[:, :, itr],
Predict the next line after this snippet: <|code_start|> f.write(str(i) + '\t') f.write(str(len(b)) + '\t') f.write(str(len(c)) + '\t') f.write(str(ed) + '\t') f.write(str(wer)) f.write('\n') f.write(' '.join(a)) f.write('\n'...
tokenizer = Tokenizer(args)
Given the code snippet: <|code_start|> acts.append(id2act[id]) actions.append(acts) directory = fn + "/attention" if not os.path.exists(directory): os.makedirs(directory) with open(fn + '/output.txt', 'w') as f: for i, (a, b, c, d, e) in enumerate(zip(test_X, test_Y, act...
dg = get_data_generator(args.data_name, args)
Based on the snippet: <|code_start|>def process(args): # prepare data dg = get_data_generator(args.data_name, args) train_X, train_Y = dg.get_train_data() test_X, test_Y = dg.get_test_data() if args.use_start_symbol: train_X = [['S'] + x for x in train_X] test_X = [['S'] + x for x i...
model = get_model(args.model_name, args)
Here is a snippet: <|code_start|> name=name, import_name=import_name, static_folder=static_folder, static_url_path=static_url_path, template_folder=template_folder, url_prefix=url_prefix, subdomain=subdomain, url_defaults=url...
self.storage = SessionStorage()
Given the code snippet: <|code_start|> self.logged_in_funcs = [] self.from_config = {} def invalidate_token(d): try: invalidate_cached_property(self.session, "token") except KeyError: pass self.config = CallbackDict(on_update=inval...
obj = getattrd(self, body)
Given snippet: <|code_start|> @storage.deleter def storage(self): del self._storage @property def token(self): """ This property functions as pass-through to the token storage. If you read from this property, you will receive the current value from the token stora...
_token["expires_at"] = timestamp_from_datetime(expires_at)
Based on the snippet: <|code_start|> login_url = login_url or "/{bp.name}" authorized_url = authorized_url or "/{bp.name}/authorized" rule_kwargs = rule_kwargs or {} self.add_url_rule( rule=login_url.format(bp=self), endpoint="login", view_func=self.l...
invalidate_cached_property(self.session, "token")
Given snippet: <|code_start|> def test_first(): assert first([1, 2, 3]) == 1 assert first([None, 2, 3]) == 2 assert first([None, 0, False, [], {}]) == None assert first([None, 0, False, [], {}], default=42) == 42 first([1, 1, 3, 4, 5], key=lambda x: x % 2 == 0) == 4 class C: d = "foo" class...
assert getattrd(A, "B.C.d") == "foo"
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- logger = logging.getLogger(__name__) class Command(NoArgsCommand): help = 'Loops through all subscribers and marks each ticket appropriately.' def handle_noargs(self, **options): # Prepare our request. headers ...
Ticket.objects.invalidate_tickets()
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class QuoteAdmin(admin.ModelAdmin): fieldsets = ( (None, {'fields': ('text', ('timestamp', 'subject'),)}), ('Metadata', {'fields': ('creator', 'broadcast', 'game')}) ) list_display = ['text', 't...
admin.site.register(Quote, QuoteAdmin)
Given snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import division class BroadcastDetailView(DetailView): model = Broadcast slug_field = 'number' class BroadcastListView(ListView): model = Broadcast def calculate_highlights_per_episode(self, **kwargs): episodes = Broadc...
context['games'] = Game.objects.all()