prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | int (self.path)
#print (self.path)
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
if self.path == '/' :
html = self.get_main_page()
self.wfile.write(bytes(html,'utf8'))
elif self.path == '/receive... |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | ml = self.get_main_page()
self.wfile.write(bytes(html,'utf8'))
|
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | ents = self.get_event()
medicamentos = self.get_drug(events)
html = self.drug_page(medicamentos)
self.wfile.write(bytes(html,'utf8'))
|
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | ents = self.get_event()
com_num = self.get_com_num(events)
html = self.drug_page(com_num)
self.wfile.write(bytes(html,'utf8'))
|
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | ug=self.path.split('=')[1]
print (drug)
events = self.get_med(drug)
com_num = self.get_com_num(events)
html = self.drug_page(com_num)
self.wfile.write(bytes(html,'utf8'))
|
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | m_num = self.path.split('=')[1]
print (com_num)
events = self.get_medicinalproduct(com_num)
medicinalproduct = self.get_drug(events)
html = self.drug_page(medicinalproduct)
self.wfile.write(bytes(html,'utf8'))
|
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | t_main_page(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | t_med(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | t_medicinalproduct(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | t_event(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | t_drug(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | t_com_num(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | ug_page(s |
<|file_name|>web.py<|end_file_name|><|fim▁begin|># Copyright [2017] [name of copyright owner]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# U... | _GET(s |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | final_argument_whitespace = True
option_spec = {'class': directives.class_option,
'name': directives.unchanged}
has_content = True
node_class = None
"""Subclasses must set this to the appropriate admonition node class."""
def run(self):
set_classes(self.options)
... |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | set_classes(self.options)
self.assert_has_content()
text = '\n'.join(self.content)
admonition_node = self.node_class(text, **self.options)
self.add_name(admonition_node)
if self.node_class is nodes.admonition:
title_text = self.arguments[0]
textnod... |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | required_arguments = 1
node_class = nodes.admonition |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.attention |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.caution |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.danger |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.error |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.hint |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.important |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.note |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.tip |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | node_class = nodes.warning |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | title_text = self.arguments[0]
textnodes, messages = self.state.inline_text(title_text,
self.lineno)
title = nodes.title(title_text, '', *textnodes)
title.source, title.line = (
self.state_machin... |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | admonition_node['classes'] += ['admonition-' +
nodes.make_id(title_text)] |
<|file_name|>admonitions.py<|end_file_name|><|fim▁begin|># $Id: admonitions.py 7681 2013-07-12 07:52:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Admonition directives.
"""
__docformat__ = 'reStructuredText'
from docutils.parsers.rst imp... | run |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial<|fim▁hol... |
def serial_ports():
""" Lists serial port names |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def se... | """ Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
:returns:
A list of the serial ports available on the system
"""
if sys.platform.startswith('win'):
ports = ['COM%s' % (i + 1) for i in range(256)]
elif sys.platform... |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def se... | ports = ['COM%s' % (i + 1) for i in range(256)] |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def se... | ports = glob.glob('/dev/cu[A-Za-z]*') |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def se... | ports = glob.glob('/dev/cu.*') |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def se... | raise EnvironmentError('Unsupported platform') |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def se... | print(serial_ports()) |
<|file_name|>serial_ports.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def <|... | serial_ports |
<|file_name|>update.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
"""
Deprecated. Use ``update-tld-names`` command instead.
"""
__title__ = 'tld.update'
__author__ = 'Artur Barseghyan'
__copyright__ = '2013-2015 Artur Barseghyan'<|fim▁hole|>_ = lambda x: x
if __name__ == '__main__':
updat... | __license__ = 'GPL 2.0/LGPL 2.1'
from tld.utils import update_tld_names
|
<|file_name|>update.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
"""
Deprecated. Use ``update-tld-names`` command instead.
"""
__title__ = 'tld.update'
__author__ = 'Artur Barseghyan'
__copyright__ = '2013-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
from tld.utils import update_t... | update_tld_names()
print(_("Local TLD names file has been successfully updated!")) |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... |
result = spell_checker.check(paragraph)
|
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
<|fim_middle|>
<|fim▁end|> | def setUp(self):
pass
def test_basic_check(self):
result = spell_checker.check(u'안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.')
assert result.errors == 4
assert result.checked == u'안녕하세요. 저는 한국인입니다. 이 문장은 한글로 작성됐습니다.'
def test_words(self):
result = spell_checker.check(u'한아... |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
<|fim_middle|>
def test_basic_chec... | pass |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | result = spell_checker.check(u'안녕 하세요. 저는 한국인 입니다. 이문장은 한글로 작성됬습니다.')
assert result.errors == 4
assert result.checked == u'안녕하세요. 저는 한국인입니다. 이 문장은 한글로 작성됐습니다.'
def test_words(self):
result = spell_checker.check(u'한아이가 장난깜을 갖고놀고있다. 그만하게 할가?')
|
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | items = result.words
assert items[u'한'] == CheckResult.WRONG_SPACING
assert items[u'아이가'] == CheckResult.WRONG_SPACING
assert items[u'장난감을'] == CheckResult.STATISTICAL_CORRECTION
assert items[u'갖고'] == CheckResult.WRONG_SPACING
assert items[u'놀고'] == CheckResult.WR... |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | ph(self):
paragraph = trim("""
ubit.info(유빗인포)는 코나미 리듬게임, 유비트의 플레이 데이터 관리 및 열람 서비스입니다. 등록 후에 자신과 친구의 기록을 p.eagate.573.jp에 접속할 필요 없이 본 웹 사이트에서 바로 확인할 수 있습니다.
등록 후에는 "https://ubit.info/별칭 |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | 습니다. 다른 친구에게 기록을 보여주고 싶다면 본인의 인포 주소를 알려주면 됩니다.
이 사이트는 최신 브라우저 환경만을 제대로 지원합니다. 만약 크롬, 파이어폭스 등의 최신 브라우저 안정버전(stable)을 사용하고 있는데도 페이지 레이아웃이 깨지는 경우 사이트 관리자에게 문의해주세요.
등록 과정은 간단합니다. 상단 메뉴에서 등록을 클릭한 후 양식에 맞게 입력하시면 자동으로 공개설정이 완료됨과 동시에 유빗인포 계정이 생성됩니다.
""")
result = spell_checker.check(par... |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def <|fim_middle|>(self):
pass
def test_basic_check(... | setUp |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def <|fim_middle|>(self):
... | test_basic_check |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | ult.errors |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | def t |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import unittest
from hanspell import spell_checker
from hanspell.constants import CheckResult
from textwrap import dedent as trim
class SpellCheckerTests(unittest.TestCase):
def setUp(self):
pass
def test_basic_check(self):
... | 페이지가 생성되며 이 주소(별칭) |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | raise "Robot should have light sensors!"
return Vehicle('Braitenberg2a', engine) |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | def setup(self):
self.robot.light[0].units = "SCALED"
def step(self):
leftSpeed = max([s.value for s in self.robot.light[0]["right"]])
rightSpeed = max([s.value for s in self.robot.light[0]["left"]])
print "leftSpeed, rightSpeed:", leftSpeed, rightSpeed
self.motors(leftSpeed, right... |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | self.robot.light[0].units = "SCALED" |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | leftSpeed = max([s.value for s in self.robot.light[0]["right"]])
rightSpeed = max([s.value for s in self.robot.light[0]["left"]])
print "leftSpeed, rightSpeed:", leftSpeed, rightSpeed
self.motors(leftSpeed, rightSpeed) |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | if engine.robot.type not in ['K-Team', 'Pyrobot']:
raise "Robot should have light sensors!"
return Vehicle('Braitenberg2a', engine) |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | raise "Robot should have light sensors!" |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | setup |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | step |
<|file_name|>BraitenbergVehicle2b.py<|end_file_name|><|fim▁begin|>"""
Braitenberg Vehicle2b
The more light sensed on the left side the faster the right motor moves.
The more light sensed on the right side the faster the left motor moves.
This causes the robot to turn towards a light source.
"""
from pyrobot.brain impo... | INIT |
<|file_name|>arm_32_arm_capstone.py<|end_file_name|><|fim▁begin|># ScratchABit - interactive disassembler
#<|fim▁hole|># Copyright (c) 2018 Paul Sokolovsky
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | |
<|file_name|>arm_32_arm_capstone.py<|end_file_name|><|fim▁begin|># ScratchABit - interactive disassembler
#
# Copyright (c) 2018 Paul Sokolovsky
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation,... | return _any_capstone.Processor("arm_32", dis) |
<|file_name|>arm_32_arm_capstone.py<|end_file_name|><|fim▁begin|># ScratchABit - interactive disassembler
#
# Copyright (c) 2018 Paul Sokolovsky
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation,... | PROCESSOR_ENTRY |
<|file_name|>foursquares.py<|end_file_name|><|fim▁begin|><|fim▁hole|>"""
File: foursquares.py
Draws squares in the corners of a turtle window.
One square is black, another is gray, and the
remaining two are in random colors.
"""
from turtlegraphics import Turtle
import random
def drawSquare(turtle, x, y, length):
... | |
<|file_name|>foursquares.py<|end_file_name|><|fim▁begin|>"""
File: foursquares.py
Draws squares in the corners of a turtle window.
One square is black, another is gray, and the
remaining two are in random colors.
"""
from turtlegraphics import Turtle
import random
def drawSquare(turtle, x, y, length):
<|fim_midd... | turtle.up()
turtle.move(x, y)
turtle.setDirection(270)
turtle.down()
for count in xrange(4):
turtle.move(length)
turtle.turn(90) |
<|file_name|>foursquares.py<|end_file_name|><|fim▁begin|>"""
File: foursquares.py
Draws squares in the corners of a turtle window.
One square is black, another is gray, and the
remaining two are in random colors.
"""
from turtlegraphics import Turtle
import random
def drawSquare(turtle, x, y, length):
turtle.up(... | turtle = Turtle()
#turtle.setWidth(1)
# Length of square
length = 40
# Relative distances to corners from origin
width = turtle.getWidth() / 2
height = turtle.getHeight() / 2
# Black
turtle.setColor(0, 0, 0)
# Upper left corner
drawSquare(turtle, -width, height, length)
#... |
<|file_name|>foursquares.py<|end_file_name|><|fim▁begin|>"""
File: foursquares.py
Draws squares in the corners of a turtle window.
One square is black, another is gray, and the
remaining two are in random colors.
"""
from turtlegraphics import Turtle
import random
def <|fim_middle|>(turtle, x, y, length):
turtle... | drawSquare |
<|file_name|>foursquares.py<|end_file_name|><|fim▁begin|>"""
File: foursquares.py
Draws squares in the corners of a turtle window.
One square is black, another is gray, and the
remaining two are in random colors.
"""
from turtlegraphics import Turtle
import random
def drawSquare(turtle, x, y, length):
turtle.up(... | main |
<|file_name|>google.py<|end_file_name|><|fim▁begin|>import json
import urllib
import urllib2
def shorten(url):<|fim▁hole|> req.add_header('User-Agent','toolbar')
results = json.load(urllib2.urlopen(req))
return results['short_url']<|fim▁end|> | gurl = 'http://goo.gl/api/url?url=%s' % urllib.quote(url)
req = urllib2.Request(gurl, data='') |
<|file_name|>google.py<|end_file_name|><|fim▁begin|>import json
import urllib
import urllib2
def shorten(url):
<|fim_middle|>
<|fim▁end|> | gurl = 'http://goo.gl/api/url?url=%s' % urllib.quote(url)
req = urllib2.Request(gurl, data='')
req.add_header('User-Agent','toolbar')
results = json.load(urllib2.urlopen(req))
return results['short_url'] |
<|file_name|>google.py<|end_file_name|><|fim▁begin|>import json
import urllib
import urllib2
def <|fim_middle|>(url):
gurl = 'http://goo.gl/api/url?url=%s' % urllib.quote(url)
req = urllib2.Request(gurl, data='')
req.add_header('User-Agent','toolbar')
results = json.load(urllib2.urlopen(req))
retu... | shorten |
<|file_name|>dev.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
class Dev(Common):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'ffrpg.sql', # Or path to database file if us... | from settings.common import Common |
<|file_name|>dev.py<|end_file_name|><|fim▁begin|>from settings.common import Common
class Dev(Common):
<|fim_middle|>
<|fim▁end|> | DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'ffrpg.sql', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|><|fim▁end|> | default_app_config = 'providers.com.dailyssrn.apps.AppConfig' |
<|file_name|>Prob3.py<|end_file_name|><|fim▁begin|># Declaring a Function
def recurPowerNew(base, exp):
# Base case is when exp = 0
if exp <= 0:<|fim▁hole|>
# Recursive Call
elif exp % 2 == 0:
return recurPowerNew(base*base, exp/2)
return base * recurPowerNew(base, exp - 1)<|fim▁en... | return 1 |
<|file_name|>Prob3.py<|end_file_name|><|fim▁begin|># Declaring a Function
def recurPowerNew(base, exp):
# Base case is when exp = 0
<|fim_middle|>
<|fim▁end|> | if exp <= 0:
return 1
# Recursive Call
elif exp % 2 == 0:
return recurPowerNew(base*base, exp/2)
return base * recurPowerNew(base, exp - 1) |
<|file_name|>Prob3.py<|end_file_name|><|fim▁begin|># Declaring a Function
def recurPowerNew(base, exp):
# Base case is when exp = 0
if exp <= 0:
<|fim_middle|>
# Recursive Call
elif exp % 2 == 0:
return recurPowerNew(base*base, exp/2)
return base * recurPowerNew(b... | return 1 |
<|file_name|>Prob3.py<|end_file_name|><|fim▁begin|># Declaring a Function
def recurPowerNew(base, exp):
# Base case is when exp = 0
if exp <= 0:
return 1
# Recursive Call
elif exp % 2 == 0:
<|fim_middle|>
return base * recurPowerNew(base, exp - 1)
<|fim▁end|> | return recurPowerNew(base*base, exp/2) |
<|file_name|>Prob3.py<|end_file_name|><|fim▁begin|># Declaring a Function
def <|fim_middle|>(base, exp):
# Base case is when exp = 0
if exp <= 0:
return 1
# Recursive Call
elif exp % 2 == 0:
return recurPowerNew(base*base, exp/2)
return base * recurPowerNew(base, exp - 1)
... | recurPowerNew |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | multiprocessing pool with the specified number of threads.
"""
if mpi: |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | def close(self):
return
def map(self, *args, **kwargs):
return map(*args, **kwargs) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | return |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | return map(*args, **kwargs) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | """ Get a pool object to pass to emcee for parallel processing.
If mpi is False and threads is None, pool is None.
Parameters
----------
mpi : bool
Use MPI or not. If specified, ignores the threads kwarg.
threads : int (optional)
If mpi is False and t... |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | """ Modified Gram-Schmidt orthonormalization of the matrix y(n,n) """
n = y.shape[0]
if y.shape[1] != n:
raise ValueError("Invalid shape: {}".format(y.shape))
mo = np.zeros(n)
# Main loop
for i in range(n):
# Remove component in direction i
for j in range(i):
... |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | def __init__(self, backend):
import matplotlib.pyplot as plt
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.pylabtools import backend2gui
self.shell = InteractiveShell.instance()
self.old_backend = backend2gui[str(plt.get_backend())]
sel... |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | import matplotlib.pyplot as plt
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.pylabtools import backend2gui
self.shell = InteractiveShell.instance()
self.old_backend = backend2gui[str(plt.get_backend())]
self.new_backend = backend |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | gui, backend = self.shell.enable_matplotlib(self.new_backend) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | gui, backend = self.shell.enable_matplotlib(self.old_backend) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | for name, func in vars(cls).items():
if not func.__doc__:
for parent in cls.__bases__:
try:
parfunc = getattr(parent, name)
except AttributeError: # parent doesn't have function
break
if parfunc and getattr(p... |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | def __init__(self, somedict):
self._dict = dict(somedict) # make a copy
self._hash = None
def __getitem__(self, key):
return self._dict[key]
def __len__(self):
return len(self._dict)
def __iter__(self):
return iter(self._dict)
def __hash__(self):
... |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | self._dict = dict(somedict) # make a copy
self._hash = None |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | return self._dict[key] |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | return len(self._dict) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | return iter(self._dict) |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | if self._hash is None:
self._hash = hash(frozenset(self._dict.items()))
return self._hash |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | return self._dict == other._dict |
<|file_name|>util.py<|end_file_name|><|fim▁begin|># coding: utf-8
""" General utilities. """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import collections
import sys
import logging
import multiprocessing
# Third-party
import numpy as np
__all__... | from emcee.utils import MPIPool
# Initialize the MPI pool
pool = MPIPool()
# Make sure the thread we're running on is the master
if not pool.is_master():
pool.wait()
sys.exit(0)
logger.debug("Running with MPI...") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.