prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):<|fim_middle|> class For...
pass
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'forward' self.m = movement def execute(self): self.m.moveCM(10)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
assert isinstance(movement, Movement) self.name = 'forward' self.m = movement
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
self.m.moveCM(10)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'reverse' self.m = movement def execute(self): self.m.moveCM(10)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
assert isinstance(movement, Movement) self.name = 'reverse' self.m = movement
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
self.m.moveCM(10)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'left' self.m = movement def execute(self): self.m.turnDegrees(-90)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
assert isinstance(movement, Movement) self.name = 'left' self.m = movement
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
self.m.turnDegrees(-90)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'right' self.m = movement def execute(self): self.m.turnDegrees(90)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
assert isinstance(movement, Movement) self.name = 'right' self.m = movement
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
self.m.turnDegrees(90)
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def <|fim_middle|>(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(...
__init__
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def <|fim_middle|>(selfself):pass class Forward...
execute
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
__init__
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
execute
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
__init__
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
execute
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
__init__
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
execute
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
__init__
<|file_name|>TurtleCommands.py<|end_file_name|><|fim▁begin|>__author__ = 'Alex' from Movement import Movement class BaseCommand: def __init__(self, movement): assert isinstance(movement, Movement) self.name = 'unknown' self.m = movement def execute(selfself):pass class Forward(BaseCo...
execute
<|file_name|>grove_electricity_sensor.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python # # GrovePi Example for using the Grove Electricity Sensor (http://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor) # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http:/...
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
<|file_name|>construct_erc2-chromatin15state-all_files.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys import os output_dir = "erc2-chromatin15state-all-files" if not os.path.exists(output_dir): sys.stderr.write("Creating dir [%s]...\n" % (output_dir)) os.makedirs(output_dir) prefix = "/home/c...
'E110', 'E111', 'E112', 'E113',
<|file_name|>construct_erc2-chromatin15state-all_files.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys import os output_dir = "erc2-chromatin15state-all-files" if not os.path.exists(output_dir): <|fim_middle|> prefix = "/home/cbreeze/for_Alex" suffix = "_15_coreMarks_mnemonics.bed" marks = ...
sys.stderr.write("Creating dir [%s]...\n" % (output_dir)) os.makedirs(output_dir)
<|file_name|>mailgun.py<|end_file_name|><|fim▁begin|><|fim▁hole|> data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>", "to": "nick <nicorellius@gmail.com>", "subject": "Hello nick", "text": "Congratulations nick, you just sent...
def send_simple_message(): return requests.post( "https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages", auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"),
<|file_name|>mailgun.py<|end_file_name|><|fim▁begin|>def send_simple_message(): <|fim_middle|> # cURL command to send mail aith API key # curl -s --user 'api:key-679dc79b890e700f11f001a6bf86f4a1' \ # https://api.mailgun.net/v3/mail.pdxpixel.com/messages \ # -F from='Excited User <mailgun@pdxpixel.com>' \...
return requests.post( "https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages", auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"), data={"from": "Mailgun Sandbox <postmaster@sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org>", "to": "nick <...
<|file_name|>mailgun.py<|end_file_name|><|fim▁begin|>def <|fim_middle|>(): return requests.post( "https://api.mailgun.net/v3/sandbox049ff464a4d54974bb0143935f9577ef.mailgun.org/messages", auth=("api", "key-679dc79b890e700f11f001a6bf86f4a1"), data={"from": "Mailgun Sandbox <postmaster@sandbox...
send_simple_message
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) HOST = "127.0.0.1"
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
kc = win32console.PyINPUT_RECORDType (win32console.KEY_EVENT) kc.KeyDown = True kc.RepeatCount = 1 cnum = ord(c) if cnum == 3: pid_list = win32console.GetConsoleProcessList() win32console.GenerateConsoleCtrlEvent(win32con.CTRL_C_EVENT, 0) return else: kc...
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
pid_list = win32console.GetConsoleProcessList() win32console.GenerateConsoleCtrlEvent(win32con.CTRL_C_EVENT, 0) return
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
kc.Char = unicode(c) if str(cnum) in CONQUE_WINDOWS_VK: kc.VirtualKeyCode = CONQUE_WINDOWS_VK[str(cnum)] else: kc.VirtualKeyCode = ctypes.windll.user32.VkKeyScanA(cnum) #kc.VirtualKeyCode = ctypes.windll.user32.VkKeyScanA(cnum+96) #kc.Control...
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
kc.VirtualKeyCode = CONQUE_WINDOWS_VK[str(cnum)]
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
kc.VirtualKeyCode = ctypes.windll.user32.VkKeyScanA(cnum) #kc.VirtualKeyCode = ctypes.windll.user32.VkKeyScanA(cnum+96) #kc.ControlKeyState = win32con.LEFT_CTRL_PRESSED
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
break
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
con_stdin.WriteConsoleInput(keys)
<|file_name|>cmss.py<|end_file_name|><|fim▁begin|>import win32pipe import win32console import win32process import time import win32con import codecs import ctypes user32 = ctypes.windll.user32 CONQUE_WINDOWS_VK = { '3' : win32con.VK_CANCEL, '8' : win32con.VK_BACK, '9' : win32con.VK_TAB, ...
make_input_key
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): <|fim_middle|> def test_reader_raw(stream): r = CsvReader(stream, replac...
csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') return six.StringIO(csv)
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
r = CsvReader(stream, replacements=(), preserve_quotes=True, symbols=(), replace_digits=False) assert list(r) == [['''"a\x96b\\"c'd\\re\\nf,g\\\\"''', '1', 'NULL', '""']]
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
r = CsvReader(stream, replacements=(), preserve_quotes=True, replace_digits=False) assert list(r) == [['''"a\x96b\\"c'd\\re\\nf,g\\\\"''', '1', None, '""']]
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
r = CsvReader(stream, replacements=(), replace_digits=False) assert list(r) == [['''a\x96b\\"c'd\\re\\nf,g\\\\''', '1', None, '']]
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
r = CsvReader(stream, replace_digits=False) assert list(r) == [['''a\x96b"c'd\re\nf,g\\''', '1', None, '']]
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
r = CsvReader(stream) assert list(r) == [['''a\x96b"c'd\re\nf,g\\''', 1, None, '']]
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def <|fim_middle|>(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8...
stream
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
test_reader_raw
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
test_reader_none
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
test_reader_quotes
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
test_reader_replace
<|file_name|>test_compact_csv_reader.py<|end_file_name|><|fim▁begin|>from __future__ import unicode_literals from django.utils import six import pytest from nicedjango.utils.compact_csv import CsvReader @pytest.fixture def stream(): csv = b'''"a\xc2\x96b\\"c'd\\re\\nf,g\\\\",1,NULL,""\n'''.decode('utf-8') r...
test_reader_replace_digit
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
[(id, title, url, text)...]
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): <|fim_middle|> def retrieve_news(person=0, royal=0, ca...
'''Parse news item return is a tuple(id, title, url) ''' url = 'http://www.spa.gov.sa' + item['href'] url_parsed = urlparse(url) qs = parse_qs(url_parsed[4]) id = qs['newsid'][0] title = item.h2.contents[0] title = " ".join(title.split()) item_parsed = (id, title, url) return...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
'''Retrieve news for person or royal person 1= king, 2= crown prince and 3= deputy crown prince if royal is = 1 news will be retriveved if last_id not definend it will return the max return list of news tuples up to MAX_PAGES_TO_SEARCH (page = 10 news) [(id, title, url)...] ''' all_news ...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
'''Retrive detaill for news item return is tuple (id, title, url, text) ''' url = item[2] html = urlopen(url) soup = BeautifulSoup(html, 'html.parser') detail = soup.find(class_='divNewsDetailsText') detail = detail.get_text() _list = list(item) _list.insert(3, detail) item ...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
'''Retrive royal orders if last_id not defiend it will return the max return list of royal orders tuples up to MAX_PAGES_TO_SEARCH (page=10) [(id, title, url, text)...] ''' orders = [] _news = retrieve_news(royal=1, last_id=last_id) for item in _news: _detail = retrieve_detail(it...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
'''Retrive cabinet decisions if last_id not defiend it will return the max return list of cabinet decisions tuples up to MAX_PAGES_TO_SEARCH (page=10) [(id, title, url, text)...] ''' decisions = [] _news = retrieve_news(cabinet=1, last_id=last_id) for item in _news: _detail = ret...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
'''Retrive only arrival news for person if last_id not defiend it will return the max return list of arrival news tuples up to MAX_PAGES_TO_SEARCH (page = 10 news) [(id, title, url, location)...] ''' arrival_news = [] all_news = retrieve_news(person=person, last_id= last_id) for item in ...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
e news for person if last_id not defiend it will return the max return list of leave news tuples up to MAX_PAGES_TO_SEARCH (page = 10 news) [(id, title, url, locationFromTo)...] ''' leave_news = [] all_news = retrieve_news(person=person, last_id= last_id) for item in all_news: if...
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
found = True break
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
raise
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
= list(item) _list.insert(3, (item[1].split('يصل إلى'))[1].split('قادماً من')[0]) item = tuple(_list) arrival_news.append(item) return arrival_
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
_list.insert(3, item[1].split('يغادر')[1]) item = tuple(_list) leave_news.append(item) return leave_news if __
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
print(news)
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def <|fim_middle|>(item): '''Parse news item return is a tuple(id, title, u...
parse_news
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
retrieve_news
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
retrieve_detail
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
royal_order
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
cabinet_decision
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
arrival_news
<|file_name|>spa.py<|end_file_name|><|fim▁begin|>from urllib.request import urlopen from urllib.parse import urlparse, parse_qs from socket import error as SocketError import errno from bs4 import BeautifulSoup MAX_PAGES_TO_SEARCH = 3 def parse_news(item): '''Parse news item return is a tuple(id, title, url) ...
ast_id=-1)
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
if not sys.argv[1:]: print("Syntax: python player.py imagefile(s)")
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
def __init__(self, master, im): if isinstance(im, list): # list of images self.im = im[1:] im = self.im[0] else: # sequence self.im = im if im.mode == "1": self.image = ImageTk.BitmapImage(im, foreground="white") ...
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
if isinstance(im, list): # list of images self.im = im[1:] im = self.im[0] else: # sequence self.im = im if im.mode == "1": self.image = ImageTk.BitmapImage(im, foreground="white") else: self.image = Ima...
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
if isinstance(self.im, list): try: im = self.im[0] del self.im[0] self.image.paste(im) except IndexError: return # end of list else: try: im = self.im im.seek(im.tell()...
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: <|fim_middle|> else: import Tkinter as tkinter from PIL import Image, ImageTk ...
import tkinter
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: <|fim_middle|> from PIL import Image, ImageTk # --------...
import Tkinter as tkinter
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
self.im = im[1:] im = self.im[0]
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
self.im = im
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
self.image = ImageTk.BitmapImage(im, foreground="white")
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
self.image = ImageTk.PhotoImage(im)
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
try: im = self.im[0] del self.im[0] self.image.paste(im) except IndexError: return # end of list
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
try: im = self.im im.seek(im.tell() + 1) self.image.paste(im) except EOFError: return # end of file
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
if not sys.argv[1:]: print("Syntax: python player.py imagefile(s)") sys.exit(1) filename = sys.argv[1] root = tkinter.Tk() root.title(filename) if len(sys.argv) > 2: # list of images print("loading...") im = [] for filename in sys.argv[1:]: ...
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
print("Syntax: python player.py imagefile(s)") sys.exit(1)
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
print("loading...") im = [] for filename in sys.argv[1:]: im.append(Image.open(filename))
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
im = Image.open(filename)
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
__init__
<|file_name|>player.py<|end_file_name|><|fim▁begin|>#!/Users/wuga/Documents/website/wuga/env/bin/python2.7 # # The Python Imaging Library # $Id$ # from __future__ import print_function import sys if sys.version_info[0] > 2: import tkinter else: import Tkinter as tkinter from PIL import Image, ImageTk # --...
next
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
assert isinstance(body.body.body.body, tvm.tir.Store) def test_if_likely():
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
ib = tvm.tir.ir_builder.create() A = ib.pointer("float32", name="A") C = ib.pointer("float32", name="C") n = te.size_var("n") with ib.for_range(0, n, name="i") as i: with ib.if_scope(i < 12): A[i] = C[i] body = tvm.tir.LetStmt(n, 10, ib.get()) mod = tvm.IRModule.from_exp...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
ib = tvm.tir.ir_builder.create() A = ib.pointer("float32", name="A") C = ib.pointer("float32", name="C") n = te.size_var("n") tx = te.thread_axis("threadIdx.x") ty = te.thread_axis("threadIdx.y") ib.scope_attr(tx, "thread_extent", n) ib.scope_attr(tx, "thread_extent", n) ib.scope_att...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
ib = tvm.tir.ir_builder.create() A = ib.pointer("float32", name="A") C = ib.pointer("float32", name="C") n = te.size_var("n") tx = te.thread_axis("threadIdx.x") ty = te.thread_axis("threadIdx.y") ib.scope_attr(tx, "thread_extent", 32) ib.scope_attr(ty, "thread_extent", 32) with ib.if...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
n = te.size_var("n") X = te.placeholder(shape=(n,), name="x") W = te.placeholder(shape=(n + 1,), dtype="int32", name="w") def f(i): start = W[i] extent = W[i + 1] - W[i] rv = te.reduce_axis((0, extent)) return te.sum(X[rv + start], axis=rv) Y = te.compute(X.shape, f...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
start = W[i] extent = W[i + 1] - W[i] rv = te.reduce_axis((0, extent)) return te.sum(X[rv + start], axis=rv)
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
def cumsum(X): """ Y[i] = sum(X[:i]) """ (m,) = X.shape s_state = te.placeholder((m + 1,), dtype="int32", name="state") s_init = te.compute((1,), lambda _: tvm.tir.const(0, "int32")) s_update = te.compute((m + 1,), lambda l: s_state[l - 1] + X[l - 1]) ...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
""" Y[i] = sum(X[:i]) """ (m,) = X.shape s_state = te.placeholder((m + 1,), dtype="int32", name="state") s_init = te.compute((1,), lambda _: tvm.tir.const(0, "int32")) s_update = te.compute((m + 1,), lambda l: s_state[l - 1] + X[l - 1]) return tvm.te.scan(...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
oshape = list(data.shape) oshape[0] = lengths.shape[0] length_offsets = cumsum(lengths) def sls(n, d): gg = te.reduce_axis((0, lengths[n])) indices_idx = length_offsets[n] + gg data_idx = indices[indices_idx] data_val = data[data_idx, d] ...
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
gg = te.reduce_axis((0, lengths[n])) indices_idx = length_offsets[n] + gg data_idx = indices[indices_idx] data_val = data[data_idx, d] return te.sum(data_val, axis=gg)
<|file_name|>test_tir_transform_simplify.py<|end_file_name|><|fim▁begin|># Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to y...
test_stmt_simplify() test_thread_extent_simplify() test_if_likely() test_basic_likely_elimination() test_complex_likely_elimination()