Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Given the code snippet: <|code_start|>
DATA = dict(
subject='Re: Test: "漢字" mid "漢字" tail',
from_='jamis@37signals.com',
to=('jamis@37signals.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 5, 2, 16, 7, 5, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_st... | from_values=EmailAddress('Jamis Buck', 'jamis@37signals.com', 'Jamis Buck <jamis@37signals.com>'), |
Next line prediction: <|code_start|>
DATA = dict(
subject='まみむめも',
from_='raasdnil@gmail.com',
to=('raasdnil@gmail.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1900, 1, 1, 0, 0),
date_str='',
text='すみません。\r\n\r\n',
html='',
headers={'mime-version': ('1.0',), 'su... | from_values=EmailAddress('Mikel Lindsaar', 'raasdnil@gmail.com', 'Mikel Lindsaar <raasdnil@gmail.com>'), |
Next line prediction: <|code_start|>
DATA = dict(
subject='Saying Hello',
from_='jdoe@machine.example',
to=('mary@example.net',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1997, 11, 21, 9, 55, 6, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_str='Fri, 21 Nov 199... | from_values=EmailAddress('John Doe', 'jdoe@machine.example', 'John Doe <jdoe@machine.example>'), |
Next line prediction: <|code_start|>
DATA = dict(
subject='Nicolas Fouché has accepted your invitation to Gmail',
from_='gmail-noreply@google.com',
to=('a.b@gmail.com',),
cc=(),
bcc=(),
reply_to=('x.y@gmail.com',),
date=datetime.datetime(2005, 6, 28, 1, 2, 11, tzinfo=datetime.timezone(dateti... | from_values=EmailAddress('Gmail Team', 'gmail-noreply@google.com', 'Gmail Team <gmail-noreply@google.com>'), |
Given snippet: <|code_start|>
DATA = dict(
subject='Meet the new MacBook Pro family. Now includes 13-inch.',
from_='News@InsideApple.Apple.com',
to=('karl.baum@gmail.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2009, 6, 11, 23, 25, 2, tzinfo=datetime.timezone(datetime.timedelta... | from_values=EmailAddress('Apple', 'News@InsideApple.Apple.com', 'Apple <News@InsideApple.Apple.com>'), |
Here is a snippet: <|code_start|>
class ImapUtf7Test(unittest.TestCase):
data = (
('Test', b'Test'),
('Test One more', b'Test One more'),
('Might & Magic', b'Might &- Magic'),
('Might & magic', b'Might &- magic'),
('Imap&\xffworld', b'Imap&-&AP8-world'),
('\xff\xfe\... | self.assertEqual(imap_utf7.encode(string), code) |
Predict the next line after this snippet: <|code_start|>
DATA = dict(
subject='Fwd: Signed email causes file attachments',
from_='xxxxxxxxx.xxxxxxx@gmail.com',
to=('xxxxx@xxxxxxxxx.com',),
cc=(),
bcc=(),
reply_to=('xxxxxxxxx.xxxxxxx@gmail.com',),
date=datetime.datetime(2005, 5, 8, 14, 9, 11,... | from_values=EmailAddress('xxxxxxxxx xxxxxxx', 'xxxxxxxxx.xxxxxxx@gmail.com', 'xxxxxxxxx xxxxxxx <xxxxxxxxx.xxxxxxx@gmail.com>'), |
Given snippet: <|code_start|>
class ConnectionTest(unittest.TestCase):
def test_connection(self):
# simple
for test_mailbox_name in TEST_MAILBOX_NAME_SET:
config = get_test_mailbox_config(test_mailbox_name)
<|code_end|>
, continue by predicting the next line. Consider current file impo... | mailbox = MailBox(config['host']) |
Based on the snippet: <|code_start|>
class ConnectionTest(unittest.TestCase):
def test_connection(self):
# simple
for test_mailbox_name in TEST_MAILBOX_NAME_SET:
<|code_end|>
, predict the immediate next line with the help of imports:
import unittest
from imap_tools import MailBox
from tests.util... | config = get_test_mailbox_config(test_mailbox_name) |
Next line prediction: <|code_start|>
DATA = dict(
subject='testing',
from_='foo@example.com',
to=('blah@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))),
date_str='Mon, 6 Jun 2005 22:21:22 +0... | from_values=EmailAddress('', 'foo@example.com', 'foo@example.com'), |
Given the code snippet: <|code_start|>
DATA = dict(
subject='testing',
from_='foo@example.com',
to=('blah@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))),
date_str='Mon, 6 Jun 2005 22:21:22 ... | from_values=EmailAddress('', 'foo@example.com', 'foo@example.com'), |
Given snippet: <|code_start|>
class FoldersTest(MailboxTestCase):
@classmethod
def setUpClass(cls):
# delete temp new folders
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import unittest
from tests.utils import MailboxTestCase, TEST_MAILBOX_NAME_SET, get_test_ma... | for test_mailbox_name in TEST_MAILBOX_NAME_SET: |
Given the following code snippet before the placeholder: <|code_start|>
class FoldersTest(MailboxTestCase):
@classmethod
def setUpClass(cls):
# delete temp new folders
for test_mailbox_name in TEST_MAILBOX_NAME_SET:
<|code_end|>
, predict the next line using imports from the current file:
imp... | mailbox = get_test_mailbox(test_mailbox_name) |
Here is a snippet: <|code_start|> mailbox.folder.rename(mailbox.folder_test_new, mailbox.folder_test_new1)
folder_list_names = [i.name for i in mailbox.folder.list(mailbox.folder_test)]
self.assertTrue(mailbox.folder_test_new1 in folder_list_names)
self.assertFalse(mailbox... | with self.assertRaises(MailboxFolderSelectError): |
Given the code snippet: <|code_start|>
DATA = dict(
subject='REDACTED',
from_='redacted@attglobal.net',
to=('', '@mailman.enron.com'),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2001, 11, 27, 15, 2, 35, tzinfo=datetime.timezone(datetime.timedelta(-1, 57600))),
date_str='Tue, 27 N... | from_values=EmailAddress('SCS_2', 'redacted@attglobal.net', 'SCS_2 <redacted@attglobal.net>'), |
Based on the snippet: <|code_start|>"""
Email modification is not common case operation
Most likely it will not be added to lib
Also, I have tried to add public attribute - MailMessage.orig_bytes (raw_message_data)
But it have increased memory consumption: ~10%
"""
<|code_end|>
, predict the immediate next line with... | with MailBox('imap.mail.com').login('test@mail.com', 'password') as mailbox: |
Given the code snippet: <|code_start|>
DATA = dict(
subject='TTT: 1/20.1.UFA Depart',
from_='bit@ufo.ru',
to=('aaa@u6.ru', 'Serg@ufo.ru', 'isg@ggg.ru'),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2021, 4, 20, 12, 31, 24, tzinfo=datetime.timezone(datetime.timedelta(0, 18000))),
da... | from_values=EmailAddress('', 'bit@ufo.ru', 'bit@ufo.ru'), |
Given snippet: <|code_start|>
DATA = dict(
subject='Re: Saying Hello',
from_='mary@example.net',
to=('jdoe@machine.example',),
cc=(),
bcc=(),
reply_to=('smith@home.example',),
date=datetime.datetime(1997, 11, 21, 10, 1, 10, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_s... | from_values=EmailAddress('Mary Smith', 'mary@example.net', 'Mary Smith <mary@example.net>'), |
Continue the code snippet: <|code_start|>
DATA = dict(
subject='',
from_='xxx@xxxx.xxx',
to=('xxxxxxxxxxx@xxxx.xxxx.xxx',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 5, 10, 15, 27, 3, tzinfo=datetime.timezone(datetime.timedelta(-1, 68400))),
date_str='Tue, 10 May 2005 15:2... | from_values=EmailAddress('', 'xxx@xxxx.xxx', 'xxx@xxxx.xxx'), |
Based on the snippet: <|code_start|>
DATA = dict(
subject='',
from_='xxx@xxxx.xxx',
to=('xxxxxxxxxxx@xxxx.xxxx.xxx',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 5, 10, 15, 27, 3, tzinfo=datetime.timezone(datetime.timedelta(-1, 68400))),
date_str='Tue, 10 May 2005 15:27:03 ... | from_values=EmailAddress('', 'xxx@xxxx.xxx', 'xxx@xxxx.xxx'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='NOTE: 한국말로 하는 것',
from_='jamis@37signals.com',
to=('willard15georgina@jamis.backpackit.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 5, 2, 16, 7, 5, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_s... | from_values=EmailAddress('Jamis Buck', 'jamis@37signals.com', 'Jamis Buck <jamis@37signals.com>'), |
Predict the next line after this snippet: <|code_start|>
DATA = dict(
subject='double_fields',
from_='kaukinvk@yandex.ru',
to=('aa@aa.ru', 'bb@aa.ru'),
cc=('cc@aa.ru', 'dd@aa.ru'),
bcc=('zz1@aa.ru', 'zz2@aa.ru'),
reply_to=('foma1@company.ru', 'petr1@company.ru', 'foma2@company.ru', 'petr2@compan... | from_values=EmailAddress('Каукин Владимир', 'kaukinvk@yandex.ru', 'Каукин Владимир <kaukinvk@yandex.ru>'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='this message JUST contains an attachment',
from_='rfinnie@domain.dom',
to=('bob@domain.dom',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2003, 10, 23, 22, 40, 49, tzinfo=datetime.timezone(datetime.timedelta(-1, 61200))),
da... | from_values=EmailAddress('Ryan Finnie', 'rfinnie@domain.dom', 'Ryan Finnie <rfinnie@domain.dom>'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='Daily',
from_='status@sender.com',
to=('my.name@domain.com', 'other.name@domain.com'),
cc=('third.name@domain.com', 'quoted-mailing-list-one@domain.com', 'quoted-mailing-list-two@domain.com'),
bcc=('my.name@domain.com', 'list1-one-name@domain.c... | from_values=EmailAddress('Sender', 'status@sender.com', 'Sender <status@sender.com>'), |
Predict the next line after this snippet: <|code_start|> for raw_flag_item in self._raw_flag_data:
size_match = re.search(r'RFC822\.SIZE\s+(?P<size>\d+)', raw_flag_item.decode())
if size_match:
return int(size_match.group('size'))
return 0
@property
@lru_c... | return ''.join(decode_value(*head_part) for head_part in decode_header(raw)) |
Given the code snippet: <|code_start|> @lru_cache()
def size(self) -> int:
"""Message size, bytes count"""
return len(bytes(self.obj))
@property
@lru_cache()
def flags(self) -> Tuple[str, ...]:
"""
Message flags
*This attribute will not be changed after "flag"... | result_set = parse_email_addresses(self.obj['From'] or '') |
Given the code snippet: <|code_start|> return tuple(chain(*(parse_email_addresses(i or '') for i in self.obj.get_all('Bcc', []))))
@property
@lru_cache()
def bcc(self) -> Tuple[str, ...]:
"""Blind carbon copy emails"""
return tuple(i.email for i in self.bcc_values)
@property
... | return parse_email_date(self.date_str) |
Next line prediction: <|code_start|>
@property
@lru_cache()
def size(self) -> int:
"""Message size, bytes count"""
return len(bytes(self.obj))
@property
@lru_cache()
def flags(self) -> Tuple[str, ...]:
"""
Message flags
*This attribute will not be changed... | def from_values(self) -> Optional[EmailAddress]: |
Using the snippet: <|code_start|> return cls([(b'', raw_message_data)])
@staticmethod
def _get_message_data_parts(fetch_data: list) -> (bytes, bytes, List[bytes]):
"""
:param fetch_data: Message object model
:returns (raw_message_data: bytes, raw_uid_data: bytes, raw_flag_data: [... | uid_match = re.search(UID_PATTERN, raw_uid_item.decode()) |
Given the code snippet: <|code_start|>
TEST_MESSAGE_DATA = b'From: Mikel <test@lindsaar.net>\nTo: Mikel <raasdnil@gmail.com>\nContent-Type: text/plain; charset=US-ASCII; format=flowed\nContent-Transfer-Encoding: 7bit\nMime-Version: 1.0 (Apple Message framework v929.2)\nSubject: _append_\nDate: Sat, 22 Nov 2008 11:04:5... | for test_mailbox_name in TEST_MAILBOX_NAME_SET: |
Based on the snippet: <|code_start|>
TEST_MESSAGE_DATA = b'From: Mikel <test@lindsaar.net>\nTo: Mikel <raasdnil@gmail.com>\nContent-Type: text/plain; charset=US-ASCII; format=flowed\nContent-Transfer-Encoding: 7bit\nMime-Version: 1.0 (Apple Message framework v929.2)\nSubject: _append_\nDate: Sat, 22 Nov 2008 11:04:59 ... | mailbox = get_test_mailbox(test_mailbox_name) |
Here is a snippet: <|code_start|> mailbox.folder.set(mailbox.folder_test_base)
# FETCH
found_msgs = tuple(mailbox.fetch(bulk=1, headers_only=1))
self.assertEqual(len(found_msgs), self.base_test_msg_cnt)
# NUMBERS
found_nums = mailbox.numbers()
... | with self.assertRaises(MailboxCopyError): |
Predict the next line after this snippet: <|code_start|> # cnt
self.assertTrue(
len(found_msgs) ==
len(found_nums) ==
len(found_uids) ==
self.base_test_msg_cnt
)
# COPY
mailbox.folder.set(mailbox.... | mailbox.flag(mailbox.uids(), MailMessageFlags.FLAGGED, True) |
Given snippet: <|code_start|> # YAHOO:
# imaplib.IMAP4.error: UID command error: BAD [b'[TRYCREATE] UID COPY failed -
# No mailbox exists with name - "__nonexistent_folder__"']
with self.assertRaises(MailboxCopyError):
mailbox.copy(m... | q = A(subject='_append_') |
Predict the next line after this snippet: <|code_start|>
DATA = dict(
subject='Formao FrenetikPolis: Mega Campanha Final Vero | Cursos de Setembro',
from_='info@formacaofrenetik.info',
to=('martin@internet.ao', 'iris@internet.ao', 'support@maxnet.ao'),
cc=(),
bcc=(),
reply_to=(),
date=dateti... | from_values=EmailAddress('Formação Frenetikpolis', 'info@formacaofrenetik.info', 'Formação Frenetikpolis <info@formacaofrenetik.info>'), |
Predict the next line for this snippet: <|code_start|>
DATA = dict(
subject='NOTE: 한국말로 하는 것',
from_='mikel@me.com',
to=('bob@bob.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2008, 9, 20, 20, 4, 30, tzinfo=datetime.timezone(datetime.timedelta(0, 10800))),
date_str='Sat, 20 ... | from_values=EmailAddress('', 'mikel@me.com', 'mikel@me.com'), |
Predict the next line for this snippet: <|code_start|>
DATA = dict(
subject='test',
from_='xxxxxxx@docomo.ne.jp',
to=('unknown@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2014, 5, 28, 17, 18, 19, tzinfo=datetime.timezone(datetime.timedelta(0, 32400))),
date_str='We... | from_values=EmailAddress('', 'xxxxxxx@docomo.ne.jp', 'xxxxxxx@docomo.ne.jp'), |
Given the following code snippet before the placeholder: <|code_start|>
TEST_MAILBOX_NAME_SET = {'YANDEX', 'ZIMBRA', 'MAIL_RU', 'OUTLOOK', 'GOOGLE', 'YAHOO'}
def get_test_mailbox_config(mailbox_name: str) -> dict:
config = configparser.ConfigParser()
for config_path in (r'../tests/credentials.ini', r'tests/cr... | class TestMailBox(MailBox): |
Using the snippet: <|code_start|>
DATA = dict(
subject='Säying Hello',
from_='jdöe@mächine.example',
to=('märy@exämple.net',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1900, 1, 1, 0, 0),
date_str='',
text='body\r\n',
html='',
headers={'from': ('"J\udcc3\udcb6hn Doe"... | from_values=EmailAddress('Jöhn Doe', 'jdöe@mächine.example', 'Jöhn Doe <jdöe@mächine.example>'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='Xxxxxx',
from_='xxxxxx@xxxxxxxx.xxx',
to=('xxxxxxx@xxxxxxxxxxx.xxx',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2012, 4, 6, 1, 1, 1, tzinfo=datetime.timezone.utc),
date_str='Fri, 6 Apr 2012 01:01:01 +0000',
text='Test\... | from_values=EmailAddress('Xxxxx', 'xxxxxx@xxxxxxxx.xxx', 'Xxxxx <xxxxxx@xxxxxxxx.xxx>'), |
Predict the next line for this snippet: <|code_start|>
DATA = dict(
subject='testing',
from_='foo@example.com',
to=('blah@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))),
date_str='Mon, 6 Ju... | from_values=EmailAddress('', 'foo@example.com', 'foo@example.com'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='/home/svn/public/minebox revision 214',
from_='tim@powerupdev.comconcierge',
to=('tim@powerupdev.comconcierge', '@powerupdev.com'),
cc=(),
bcc=(),
reply_to=('tim@powerupdev.comconcierge', '@powerupdev.com'),
date=datetime.datetime(2007,... | from_values=EmailAddress('', 'tim@powerupdev.comconcierge', 'tim@powerupdev.comconcierge'), |
Given the following code snippet before the placeholder: <|code_start|>"""
If you want to use really secure connection, you MUST read this articles:
https://docs.python.org/3/library/imaplib.html#imaplib.IMAP4_SSL
https://docs.python.org/3/library/ssl.html#ssl-security
"""
ssl_context = ssl.create_default_context... | with MailBox('imap.my.ru', ssl_context=ssl_context, starttls=True).login('acc', 'pwd', 'INBOX') as mailbox: |
Based on the snippet: <|code_start|>
DATA = dict(
subject='',
from_='pete@silly.example',
to=('c@a.test', 'joe@where.test', 'jdoe@one.test'),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1969, 2, 13, 23, 32, 54, tzinfo=datetime.timezone(datetime.timedelta(-1, 73800))),
date_str='Th... | from_values=EmailAddress('Pete', 'pete@silly.example', 'Pete <pete@silly.example>'), |
Continue the code snippet: <|code_start|>
DATA = dict(
subject='まみむめも',
from_='raasdnil@gmail.com',
to=('raasdnil@gmail.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1900, 1, 1, 0, 0),
date_str='',
text='かきくえこ\n\n-- \nhttp://lindsaar.net/\nRails, RSpec and Life blog....\... | from_values=EmailAddress('Mikel Lindsaar', 'raasdnil@gmail.com', 'Mikel Lindsaar <raasdnil@gmail.com>'), |
Given the following code snippet before the placeholder: <|code_start|>
DATA = dict(
subject='test',
from_='from@example.com',
to=('unknown@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2014, 5, 28, 17, 18, 19, tzinfo=datetime.timezone(datetime.timedelta(0, 32400))),
... | from_values=EmailAddress('', 'from@example.com', 'from@example.com'), |
Based on the snippet: <|code_start|>
DATA = dict(
subject='Redacted',
from_='redacted@flashmail.net',
to=('redacted@Enron.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1900, 1, 1, 0, 0),
date_str='',
text='foo\r\n',
html='<p>foo</p>\r\n',
headers={'from': ('<reda... | from_values=EmailAddress('', 'redacted@flashmail.net', 'redacted@flashmail.net'), |
Predict the next line after this snippet: <|code_start|>
DATA = dict(
subject='Sending messages include last little bit',
from_='tester1@test.com',
to=('tester2@test.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2009, 12, 2, 22, 39, 33, tzinfo=datetime.timezone(datetime.timedelt... | from_values=EmailAddress('Tester 1', 'tester1@test.com', 'Tester 1 <tester1@test.com>'), |
Using the snippet: <|code_start|># Python query builder
NOT(AND(OR(from_='11', to='22', text='33'), cc='44', bcc='55'))
# python to prefix notation steps:
1. OR(1=11, 2=22, 3=33) ->
"(OR OR FROM "11" TO "22" TEXT "33")"
2. AND("(OR OR FROM "11" TO "22" TEXT "33")", cc='44', bcc='55') ->
"AND(OR(from_='11',... | q5 = AND(seen=True, flagged=False) |
Given the code snippet: <|code_start|>"""
Query builder examples.
NOTES:
# Infix notation (natural to humans)
NOT ((FROM='11' OR TO="22" OR TEXT="33") AND CC="44" AND BCC="55")
# Prefix notation (Polish notation, IMAP version)
NOT (((OR OR FROM "11" TO "22" TEXT "33") CC "44" BCC "55"))
# Python query builder... | q1 = OR(date=[dt.date(2019, 10, 1), dt.date(2019, 10, 10), dt.date(2019, 10, 15)]) |
Predict the next line for this snippet: <|code_start|>"""
Query builder examples.
NOTES:
# Infix notation (natural to humans)
NOT ((FROM='11' OR TO="22" OR TEXT="33") AND CC="44" AND BCC="55")
# Prefix notation (Polish notation, IMAP version)
NOT (((OR OR FROM "11" TO "22" TEXT "33") CC "44" BCC "55"))
# Pyth... | q2 = NOT(OR(date=[dt.date(2019, 10, 1), dt.date(2019, 10, 10), dt.date(2019, 10, 15)])) |
Given the following code snippet before the placeholder: <|code_start|>Query builder examples.
NOTES:
# Infix notation (natural to humans)
NOT ((FROM='11' OR TO="22" OR TEXT="33") AND CC="44" AND BCC="55")
# Prefix notation (Polish notation, IMAP version)
NOT (((OR OR FROM "11" TO "22" TEXT "33") CC "44" BCC ... | q3 = A(subject='hello', date_gte=dt.date(2019, 10, 10)) |
Based on the snippet: <|code_start|>
# date in the date list (date=date1 OR date=date3 OR date=date2)
q1 = OR(date=[dt.date(2019, 10, 1), dt.date(2019, 10, 10), dt.date(2019, 10, 15)])
# '(OR OR ON 1-Oct-2019 ON 10-Oct-2019 ON 15-Oct-2019)'
# date not in the date list (NOT(date=date1 OR date=date3 OR date=date2))
q2 =... | q8 = A(header=[H('IsSpam', '++'), H('CheckAntivirus', '-')]) |
Based on the snippet: <|code_start|>
# date not in the date list (NOT(date=date1 OR date=date3 OR date=date2))
q2 = NOT(OR(date=[dt.date(2019, 10, 1), dt.date(2019, 10, 10), dt.date(2019, 10, 15)]))
# 'NOT ((OR OR ON 1-Oct-2019 ON 10-Oct-2019 ON 15-Oct-2019))'
# subject contains "hello" AND date greater than or equal ... | q9 = A(uid=U('1034', '*')) |
Predict the next line after this snippet: <|code_start|>
DATA = dict(
subject='worse when you use them.',
from_='xxxxx@xxxxx',
to=('',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 4, 27, 14, 15, 31, tzinfo=datetime.timezone(datetime.timedelta(-1, 61200))),
date_str='Wed, 27... | from_values=EmailAddress('xxxxx@xxxxx', 'xxxxx@xxxxx', 'xxxxx@xxxxx <xxxxx@xxxxx>'), |
Predict the next line after this snippet: <|code_start|>
DATA = dict(
subject='Re: TESTテストテスト',
from_='atsushi@example.com',
to=('rudeboyjet@gmail.com',),
cc=(),
bcc=(),
reply_to=('rudeboyjet@gmail.com',),
date=datetime.datetime(2011, 8, 19, 10, 47, 17, tzinfo=datetime.timezone(datetime.time... | from_values=EmailAddress('Atsushi Yoshida', 'atsushi@example.com', 'Atsushi Yoshida <atsushi@example.com>'), |
Given snippet: <|code_start|>
DATA = dict(
subject='testing',
from_='raasdnil@gmail.com',
to=('raasdnil@gmail.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2009, 10, 16, 23, 39, 34, tzinfo=datetime.timezone(datetime.timedelta(0, 39600))),
date_str='Fri, 16 Oct 2009 23:39:34 ... | from_values=EmailAddress('Mikel Lindsaar', 'raasdnil@gmail.com', 'Mikel Lindsaar <raasdnil@gmail.com>'), |
Given the code snippet: <|code_start|> poller = select.poll()
poller.register(sock.fileno(), select.POLLIN)
timeout = None if timeout is None else timeout * 1000
return poller.poll(timeout)
else:
# select.select fails if your process has more than 1024 file descriptors, needs ... | check_command_status((result, 'IDLE start'), MailboxTaggedResponseError, expected=None) |
Given the following code snippet before the placeholder: <|code_start|> poller = select.poll()
poller.register(sock.fileno(), select.POLLIN)
timeout = None if timeout is None else timeout * 1000
return poller.poll(timeout)
else:
# select.select fails if your process has more t... | check_command_status((result, 'IDLE start'), MailboxTaggedResponseError, expected=None) |
Predict the next line for this snippet: <|code_start|>
DATA = dict(
subject='',
from_='john.q.public@example.com',
to=('mary@x.test', 'jdoe@example.org', 'one@y.test'),
cc=('boss@nil.test', 'sysservices@example.net'),
bcc=(),
reply_to=(),
date=datetime.datetime(2003, 7, 1, 10, 52, 37, tzinfo... | from_values=EmailAddress('Joe Q. Public', 'john.q.public@example.com', 'Joe Q. Public <john.q.public@example.com>'), |
Continue the code snippet: <|code_start|>
DATA = dict(
subject='Fwd: Signed email causes file attachments',
from_='xxxxxxxxx.xxxxxxx@gmail.com',
to=('xxxxx@xxxxxxxxx.com',),
cc=(),
bcc=(),
reply_to=('xxxxxxxxx.xxxxxxx@gmail.com',),
date=datetime.datetime(2005, 5, 8, 14, 9, 11, tzinfo=datetim... | from_values=EmailAddress('xxxxxxxxx xxxxxxx', 'xxxxxxxxx.xxxxxxx@gmail.com', 'xxxxxxxxx xxxxxxx <xxxxxxxxx.xxxxxxx@gmail.com>'), |
Predict the next line for this snippet: <|code_start|>
DATA = dict(
subject='Testing outlook',
from_='mikel@nowhere.com',
to=('mikel@somewhere.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2007, 10, 21, 19, 38, 13, tzinfo=datetime.timezone(datetime.timedelta(0, 36000))),
dat... | from_values=EmailAddress('Mikel Lindsaar', 'mikel@nowhere.com', 'Mikel Lindsaar <mikel@nowhere.com>'), |
Given the following code snippet before the placeholder: <|code_start|>
DATA = dict(
subject='Re: Testing multipart/signed',
from_='test@test.lindsaar.net',
to=('mikel@test.lindsaar.net',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2007, 6, 4, 15, 1, 31, tzinfo=datetime.timezone(dat... | from_values=EmailAddress('Test', 'test@test.lindsaar.net', 'Test <test@test.lindsaar.net>'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='Saying Hello',
from_='jdoe@machine.example',
to=('mary@example.net',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1997, 11, 21, 9, 55, 6, tzinfo=datetime.timezone.utc),
date_str='21 Nov 97 09:55:06 GMT',
text='This is a ... | from_values=EmailAddress('John Doe', 'jdoe@machine.example', 'John Doe <jdoe@machine.example>'), |
Using the snippet: <|code_start|>
DATA = dict(
subject='undef method parameter bug',
from_='Big Bug bb@bug.com',
to=('rubymail@ruby-lang.org',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2010, 2, 19, 10, 8, 29, tzinfo=datetime.timezone(datetime.timedelta(0, 10800))),
date_str='F... | from_values=EmailAddress('', 'Big Bug bb@bug.com', 'Big Bug bb@bug.com'), |
Here is a snippet: <|code_start|>
DATA = dict(
subject='Redacted',
from_='redacted@example.com',
to=('redacted@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2002, 1, 22, 14, 35, 28, tzinfo=datetime.timezone.utc),
date_str='Tue, 22 Jan 2002 14:35:28 UT',
text='',
... | from_values=EmailAddress('', 'redacted@example.com', 'redacted@example.com'), |
Given snippet: <|code_start|>
DATA = dict(
subject='testing',
from_='foo@example.com',
to=('blah@example.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))),
date_str='Mon, 6 Jun 2005 22:21:22 +0200',
... | from_values=EmailAddress('', 'foo@example.com', 'foo@example.com'), |
Given the following code snippet before the placeholder: <|code_start|>
DATA = dict(
subject='NOTE: 한국말로 하는 것',
from_='jamis@37signals.com',
to=('willard15georgina@jamis.backpackit.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 5, 2, 16, 7, 5, tzinfo=datetime.timezone(datet... | from_values=EmailAddress('Jamis Buck', 'jamis@37signals.com', 'Jamis Buck <jamis@37signals.com>'), |
Here is a snippet: <|code_start|>
DATA = dict(
subject='Saying Hello',
from_='jdoe@machine.example',
to=('mary@example.net',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1997, 11, 21, 9, 55, 6, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))),
date_str='Fri, 21 Nov 1997 0... | from_values=EmailAddress('John Doe', 'jdoe@machine.example', 'John Doe <jdoe@machine.example>'), |
Given snippet: <|code_start|> def _gen_values(self, key: str, value: Any) -> Iterable[Any]:
"""Values generator"""
# single value
if key not in self.multi_key_allowed or isinstance(value, str):
yield value
else:
try:
# multiple values
... | return '{}-{}-{}'.format(value.day, SHORT_MONTH_NAMES[value.month - 1], value.year) |
Predict the next line for this snippet: <|code_start|> def cleaned_date(key: str, value: datetime.date) -> datetime.date:
if type(value) is not datetime.date:
raise TypeError('"{}" expected datetime.date value, "{}" received'.format(key, type(value)))
return value
@staticmethod
d... | return clean_uids(value) |
Given the code snippet: <|code_start|>"""IMAP Query builder"""
class Header:
__slots__ = ('name', 'value')
def __init__(self, name: str, value: str):
if not isinstance(name, str):
raise TypeError('Header-name expected str value, "{}" received'.format(type(name)))
<|code_end|>
, generate ... | self.name = quote(name) |
Given snippet: <|code_start|>
DATA = dict(
subject='',
from_='pete@silly.test',
to=('c@public.example', 'joe@example.org', 'jdoe@one.test'),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1969, 2, 13, 23, 32, tzinfo=datetime.timezone(datetime.timedelta(-1, 73800))),
date_str='Thu,\r\... | from_values=EmailAddress('Pete (A wonderful ) chap his account his host)', 'pete@silly.test', 'Pete (A wonderful ) chap his account his host) <pete@silly.test>'), |
Continue the code snippet: <|code_start|>
DATA = dict(
subject='Redacted',
from_='redacted@flashmail.net',
to=('redacted@Enron.com',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(1900, 1, 1, 0, 0),
date_str='',
text='foo\n',
html='<p>foo</p>\n',
headers={'from': ('<red... | from_values=EmailAddress('', 'redacted@flashmail.net', 'redacted@flashmail.net'), |
Next line prediction: <|code_start|> date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))),
date_str='Mon, 6 Jun 2005 22:21:22 +0200',
text='This is the first part.\r\n',
html='',
headers={'mime-version': ('1.0 (Apple Message framework v730)',), 'conten... | from_values=EmailAddress('', 'foo@example.com', 'foo@example.com'), |
Based on the snippet: <|code_start|>
def addMeasurementGroup(self, measurementGroup):
self.Measurements.append(measurementGroup)
def exportToJson(self, fileName):
with open(fileName, 'w') as fp:
json.dump(self._getAsDict(), fp, indent = 2)
def getJsonStr(self):
return json.dumps(self._get... | isinstance(obj, MeasurementGroup) or |
Predict the next line after this snippet: <|code_start|>
def addMeasurementGroup(self, measurementGroup):
self.Measurements.append(measurementGroup)
def exportToJson(self, fileName):
with open(fileName, 'w') as fp:
json.dump(self._getAsDict(), fp, indent = 2)
def getJsonStr(self):
return j... | isinstance(obj, MeasurementItem) or |
Using the snippet: <|code_start|> def addMeasurementGroup(self, measurementGroup):
self.Measurements.append(measurementGroup)
def exportToJson(self, fileName):
with open(fileName, 'w') as fp:
json.dump(self._getAsDict(), fp, indent = 2)
def getJsonStr(self):
return json.dumps(self._getAsDic... | isinstance(obj, CodeSequence)): |
Based on the snippet: <|code_start|>
class CLIPluggableActionModule(object):
"""Pluggable CLI action module.
Options:
id - The Asterisk id to execute the command on. This is optional and,
if not specified defaults to 0 (ast1).
cmd - The CLI command to execute
"""
def __ini... | PLUGGABLE_ACTION_REGISTRY.register("cli-cmds", CLIPluggableActionModule) |
Continue the code snippet: <|code_start|> host: '127.0.0.1'
port: 4573
commands:
- 'SET VARIABLE "CHANVAR1" "CHANVAL1"'
Instead of commands, a callback may be specified to interact with Asterisk:
callback:
module: fast_agi_callback_module
method: f... | method = load_and_parse_module(self.callback_module + '.' + self.callback_method) |
Continue the code snippet: <|code_start|> self.parse_mapping(config)
def parse_mapping(self, config):
"""Parse out the mapping and instantiate objects."""
for e_a_set in config["mapping"]:
plug_set = {"events": [], "actions": []}
for plug_name, plug_config in e_a_set... | elif PLUGGABLE_ACTION_REGISTRY.check(plug_name): |
Based on the snippet: <|code_start|> if "events" in config:
register_modules(config["events"], self.local_event_registry)
self.event_action_sets = []
self.parse_mapping(config)
def parse_mapping(self, config):
"""Parse out the mapping and instantiate objects."""
... | elif PLUGGABLE_EVENT_REGISTRY.check(plug_name): |
Using the snippet: <|code_start|> -
event-name:
event-config-goes-here
other-event-name:
event-config-goes-here
action-name:
action-config-goes-here
Or if no locally-defined events or actions are desired and only one set is
... | self.local_action_registry = PluggableRegistry() |
Here is a snippet: <|code_start|>
class OurStoryTestCase(TestCase):
def setUp(self):
story1 = OurStory.objects.create(text="title 1", color="#ff0000",order=5)
story2 = OurStory.objects.create(text="title 2",order=7)
def test_story_have_text(self):
"""OurStory Test
Fields t... | team1 = OurTeam.objects.create(text="team 1", us_team="us_team_us_team_us_team_us_team",peru_team="peru_teamperu_team_peru_team",board_team="board_team") |
Predict the next line for this snippet: <|code_start|>
def test_story_have_text(self):
"""OurStory Test
Fields tested : text,color
"""
story1 = OurStory.objects.get(text="title 1")
story2 = OurStory.objects.get(order=7)
self.assertEqual(story1.text, 'title 1')
... | storyTitle1 = OurStoryTitle.objects.create(title="LightandLeadership") |
Based on the snippet: <|code_start|>
def footer(request):
footer = FooterInfo.objects.all()
return {'footer': footer}
def navbar(request):
<|code_end|>
, predict the immediate next line with the help of imports:
from .models import FooterInfo, Menu
and context (classes, functions, sometimes code) from other files:... | categories = Menu.objects.all().order_by('order') |
Using the snippet: <|code_start|>
def footer(request):
footer = FooterInfo.objects.all()
return {'footer': footer}
def spanish_navbar(request):
<|code_end|>
, determine the next line of code. You have imports:
from .models import FooterInfo, Menu
and context (class names, function names, or code) available:
... | categories = Menu.objects.all().order_by('order') |
Next line prediction: <|code_start|> deletedId: UUID
}
'''
)
def test_merge_query_mutation(snapshot: Any) -> None:
assert_generated_pent(
snapshot, '''
type Query {
todoUser(id: UUID!): TodoUser @readPent
}
type Mutation {
createTodoUser(data: CreateTodoUserData!): CreateTodoUserPayload @createP... | assert to_python_typename('String') == 'str' |
Given the following code snippet before the placeholder: <|code_start|>
def assert_generated_pent(snapshot: Any, graphql: str) -> None:
grapple_document = parse_grapple(graphql)
generated_output = print_generated_pents_file_body(grapple_document)
snapshot.assert_match(generated_output)
<|code_end|>
, pre... | autopents_output = print_autopents_file_body(grapple_document) |
Given the following code snippet before the placeholder: <|code_start|> raise Exception('shards > 1 currently not supported')
shard = self._shards[0]
new_ids = []
for _ in range(0, len(datas)):
new_ids.append(uuid4())
await shard.gen_insert_objects(new_ids, type... | obj_dict_per_shard = await async_list(unawaited_gens) |
Predict the next line after this snippet: <|code_start|>
@pytest.mark.skip
def test_redis() -> None:
redis_instance = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=True)
redis_instance.set('foo', 'bar')
assert redis_instance.get('foo') == 'bar'
@pytest.mark.skip
def test_store_kv... | body = data_to_body(data) |
Continue the code snippet: <|code_start|>
@pytest.mark.skip
def test_redis() -> None:
redis_instance = redis.StrictRedis(host='localhost', port=6379, db=0, decode_responses=True)
redis_instance.set('foo', 'bar')
assert redis_instance.get('foo') == 'bar'
@pytest.mark.skip
def test_store_kvetch_obj() -> N... | out_data = body_to_data(out_body) |
Using the snippet: <|code_start|> async def _batch_load_fn(self, keys: List[int]) -> List[str]:
self.calls.append(keys)
return [str(key) for key in keys]
async def test_aiodataloader_singleload() -> None:
loader = StringLoader()
promise1 = loader.load(1)
value1 = await promise1
ass... | values = await async_list([loader.load(1), loader.load(2)]) |
Given the code snippet: <|code_start|>
@contextlib.contextmanager
def disable_pymysql_warnings() -> Iterator:
filterwarnings('ignore', category=pymysql.Warning) # type: ignore
yield
resetwarnings()
<|code_end|>
, generate the next line using the imports in this file:
import contextlib
import pymysql
... | def execute_ddl(shard: KvetchDbShard, ddl: str) -> str: |
Using the snippet: <|code_start|>
def create_scaffolding(base_dir: str, module_name: str) -> None:
# this creates a directory structure that mimics the dict hierarchy.
# leaf nodes are strings which are file contents
scaffold_structure = {
module_name: {
'graphql_schema': {
... | 'generated.py': print_graphql_file(document_ast, module_name) |
Using the snippet: <|code_start|> '__init__.py': GRAPHQL_INIT_SCAFFOLD,
},
'pent': {
'__init__.py': PENT_INIT_SCAFFOLD,
'pents.py': PENTS_SCAFFOLD,
},
'kvetch': {
'__init__.py': KVETCH_INIT_SCAFFOLD,
... | 'generated.py': print_kvetch_decls(document_ast) |
Here is a snippet: <|code_start|> write_scaffold(value, new_dir, overwrite=overwrite)
else:
raise Exception('internal structure')
def create_scaffolding(base_dir: str, module_name: str) -> None:
# this creates a directory structure that mimics the dict hierarchy.
# leaf nodes ar... | module_dir: str, document_ast: GrappleDocument, module_name: str |
Given snippet: <|code_start|> pents_text = read_file(pents_path)
written_once = False
pattern = r'^class Root\('
if not re.search(pattern, pents_text, re.MULTILINE):
class_text = MANUAL_PENT_TEMPLATE.format(name='Root')
append_to_file(pents_path, class_text)
for pent_type in mixins_... | def mixins_not_in_file(types: List[GrappleTypeDef], file_text: str) -> Iterable[GrappleTypeDef]: |
Predict the next line for this snippet: <|code_start|>
class {name}(generated.{name}Generated):
pass
"""
MANUAL_PENT_PAYLOAD_CLASS_TEMPLATE = """
class {name}(PentMutationPayload, generated.{name}DataMixin):
pass
"""
def mixins_not_in_file(types: List[GrappleTypeDef], file_text: str) -> Iterable[GrappleType... | document_ast = parse_grapple(graphql_text) |
Based on the snippet: <|code_start|> scaffold_structure = {
module_name: {
'graphql_schema': {
'__init__.py': GRAPHQL_INIT_SCAFFOLD,
},
'pent': {
'__init__.py': PENT_INIT_SCAFFOLD,
'pents.py': PENTS_SCAFFOLD,
},
... | 'generated.py': print_generated_pents_file(document_ast), |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.