prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os class Config(object): DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = "super_secret_key" SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] class ProductionConfig(Config): DEBUG = False SECRET_KEY = os.environ['SECRET_KEY'] class DevelopmentConfig(Config): <|fim_middle|> class TestingConfig(Config): TESTING = True <|fim▁end|>
DEVELOPMENT = True DEBUG = True
<|file_name|>config.py<|end_file_name|><|fim▁begin|>import os class Config(object): DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = "super_secret_key" SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] class ProductionConfig(Config): DEBUG = False SECRET_KEY = os.environ['SECRET_KEY'] class DevelopmentConfig(Config): DEVELOPMENT = True DEBUG = True class TestingConfig(Config): <|fim_middle|> <|fim▁end|>
TESTING = True
<|file_name|>test_login.py<|end_file_name|><|fim▁begin|><|fim▁hole|>@pytest.fixture def driver(request): wd = webdriver.Firefox(capabilities={"marionette": True}) #(desired_capabilities={"chromeOptions": {"args": ["--start-fullscreen"]}}) request.addfinalizer(wd.quit) return wd def test_example(driver): driver.get("http://localhost/litecart/admin/") driver.find_element_by_xpath("//input[@name='username']").send_keys("admin") driver.find_element_by_xpath("//input[@name='password']").send_keys("admin") driver.find_element_by_xpath("//button[@name='login']").click()<|fim▁end|>
import pytest from selenium import webdriver
<|file_name|>test_login.py<|end_file_name|><|fim▁begin|>import pytest from selenium import webdriver @pytest.fixture def driver(request): <|fim_middle|> def test_example(driver): driver.get("http://localhost/litecart/admin/") driver.find_element_by_xpath("//input[@name='username']").send_keys("admin") driver.find_element_by_xpath("//input[@name='password']").send_keys("admin") driver.find_element_by_xpath("//button[@name='login']").click() <|fim▁end|>
wd = webdriver.Firefox(capabilities={"marionette": True}) #(desired_capabilities={"chromeOptions": {"args": ["--start-fullscreen"]}}) request.addfinalizer(wd.quit) return wd
<|file_name|>test_login.py<|end_file_name|><|fim▁begin|>import pytest from selenium import webdriver @pytest.fixture def driver(request): wd = webdriver.Firefox(capabilities={"marionette": True}) #(desired_capabilities={"chromeOptions": {"args": ["--start-fullscreen"]}}) request.addfinalizer(wd.quit) return wd def test_example(driver): <|fim_middle|> <|fim▁end|>
driver.get("http://localhost/litecart/admin/") driver.find_element_by_xpath("//input[@name='username']").send_keys("admin") driver.find_element_by_xpath("//input[@name='password']").send_keys("admin") driver.find_element_by_xpath("//button[@name='login']").click()
<|file_name|>test_login.py<|end_file_name|><|fim▁begin|>import pytest from selenium import webdriver @pytest.fixture def <|fim_middle|>(request): wd = webdriver.Firefox(capabilities={"marionette": True}) #(desired_capabilities={"chromeOptions": {"args": ["--start-fullscreen"]}}) request.addfinalizer(wd.quit) return wd def test_example(driver): driver.get("http://localhost/litecart/admin/") driver.find_element_by_xpath("//input[@name='username']").send_keys("admin") driver.find_element_by_xpath("//input[@name='password']").send_keys("admin") driver.find_element_by_xpath("//button[@name='login']").click() <|fim▁end|>
driver
<|file_name|>test_login.py<|end_file_name|><|fim▁begin|>import pytest from selenium import webdriver @pytest.fixture def driver(request): wd = webdriver.Firefox(capabilities={"marionette": True}) #(desired_capabilities={"chromeOptions": {"args": ["--start-fullscreen"]}}) request.addfinalizer(wd.quit) return wd def <|fim_middle|>(driver): driver.get("http://localhost/litecart/admin/") driver.find_element_by_xpath("//input[@name='username']").send_keys("admin") driver.find_element_by_xpath("//input[@name='password']").send_keys("admin") driver.find_element_by_xpath("//button[@name='login']").click() <|fim▁end|>
test_example
<|file_name|>setup.py<|end_file_name|><|fim▁begin|># coding: utf-8 import sys from setuptools import setup, find_packages NAME = "pollster" VERSION = "2.0.2" # To install the library, run the following # # python setup.py install # # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools <|fim▁hole|>REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil", "pandas >= 0.19.1"] setup( name=NAME, version=VERSION, description="Pollster API", author_email="Adam Hooper <[email protected]>", url="https://github.com/huffpostdata/python-pollster", keywords=["Pollster API"], install_requires=REQUIRES, packages=find_packages(), include_package_data=True, long_description="""Download election-related polling data from Pollster.""" )<|fim▁end|>
<|file_name|>split.py<|end_file_name|><|fim▁begin|>s="the quick brown fox jumped over the lazy dog" t = s.split(" ") for v in t: print(v) r = s.split("e") for v in r: print(v) x = s.split() for v in x: print(v) # 2-arg version of split not supported # y = s.split(" ",7) # for v in y:<|fim▁hole|><|fim▁end|>
# print v
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): <|fim▁hole|> Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True<|fim▁end|>
"""
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): "<|fim_middle|> <|fim▁end|>
""Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): s<|fim_middle|> def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
uper(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin()
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): "<|fim_middle|> #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
""Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state)
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): "<|fim_middle|> def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
""Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): "<|fim_middle|> def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
"" Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): "<|fim_middle|> def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
""Return a list of actions related to plugin""" return []
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): "<|fim_middle|> def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
""Register plugin in Spyder's main window""" self.main.add_dockwidget(self)
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): "<|fim_middle|> def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
""Refresh widget""" pass
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): "<|fim_middle|> <|fim▁end|>
""Perform actions before parent main window is closed""" return True
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: s <|fim_middle|> #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
elf.dockwidget.setVisible(state)
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def _<|fim_middle|>self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
_init__(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def t<|fim_middle|>self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
oggle(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def g<|fim_middle|>self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
et_plugin_title(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def g<|fim_middle|>self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
et_focus_widget(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def g<|fim_middle|>self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
et_plugin_actions(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def r<|fim_middle|>self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
egister_plugin(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def r<|fim_middle|>self): """Refresh widget""" pass def closing_plugin(self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
efresh_plugin(
<|file_name|>ipython.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright © 2011 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """IPython v0.11+ Plugin""" from spyderlib.qt.QtGui import QHBoxLayout # Local imports from spyderlib.widgets.ipython import create_widget from spyderlib.plugins import SpyderPluginWidget class IPythonPlugin(SpyderPluginWidget): """Find in files DockWidget""" CONF_SECTION = 'ipython' def __init__(self, parent, args, kernel_widget, kernel_name): super(IPythonPlugin, self).__init__(parent) self.kernel_widget = kernel_widget self.kernel_name = kernel_name self.ipython_widget = create_widget(argv=args.split()) layout = QHBoxLayout() layout.addWidget(self.ipython_widget) self.setLayout(layout) # Initialize plugin self.initialize_plugin() def toggle(self, state): """Toggle widget visibility""" if self.dockwidget: self.dockwidget.setVisible(state) #------ SpyderPluginWidget API --------------------------------------------- def get_plugin_title(self): """Return widget title""" return "IPython (%s) - Experimental!" % self.kernel_name def get_focus_widget(self): """ Return the widget to give focus to when this plugin's dockwidget is raised on top-level """ return self.ipython_widget._control def get_plugin_actions(self): """Return a list of actions related to plugin""" return [] def register_plugin(self): """Register plugin in Spyder's main window""" self.main.add_dockwidget(self) def refresh_plugin(self): """Refresh widget""" pass def c<|fim_middle|>self, cancelable=False): """Perform actions before parent main window is closed""" return True <|fim▁end|>
losing_plugin(
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self):<|fim▁hole|> def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location'])<|fim▁end|>
self.client.get(url_for("user.logout"))
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): <|fim_middle|> <|fim▁end|>
DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location'])
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): <|fim_middle|> def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): <|fim_middle|> def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
db.create_all() self.create_user("admin", "passW1")
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): <|fim_middle|> def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
db.session.remove() db.drop_all()
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): <|fim_middle|> def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one()
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): <|fim_middle|> def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
self.client.get(url_for("user.logout"))
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): <|fim_middle|> def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): <|fim_middle|> <|fim▁end|>
self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location'])
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def <|fim_middle|>(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
create_app
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def <|fim_middle|>(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
setUp
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def <|fim_middle|>(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
tearDown
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def <|fim_middle|>(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
login
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def <|fim_middle|>(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
logout
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def <|fim_middle|>(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def assertLoginRequired(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
create_user
<|file_name|>base.py<|end_file_name|><|fim▁begin|>import tempfile from datetime import datetime import flask_testing from flask import url_for import iis from iis.models import User from iis.extensions import db class BaseTestCase(flask_testing.TestCase): DB_FILE = tempfile.mkstemp() SQLALCHEMY_DATABASE_URI = "sqlite:///" + DB_FILE[1] LOGGING = {"version": 1} TESTING = True WTF_CSRF_ENABLED = False USER_ENABLE_LOGIN_WITHOUT_CONFIRM = True def create_app(self): ret = iis.create_app(self.__class__) app = ret[0] self.user_manager = ret[1] return app def setUp(self): db.create_all() self.create_user("admin", "passW1") def tearDown(self): db.session.remove() db.drop_all() def login(self, username=None, password=None): username = username or "admin" password = password or "passW1" self.client.post(url_for('user.login'), data=dict( username=username, password=password ), follow_redirects=False) return User.query.filter_by(username=username).one() def logout(self): self.client.get(url_for("user.logout")) def create_user(self, username, password): user = User(username=username, password=self.user_manager.hash_password(password), email=username + "@localhost", confirmed_at=datetime.fromtimestamp(0.0), active=True) db.session.add(user) db.session.commit() return user def <|fim_middle|>(self, url): self.logout() res = self.client.get(url) self.assertEqual(302, res.status_code) self.assertIn(url_for('user.login'), res.headers['Location']) <|fim▁end|>
assertLoginRequired
<|file_name|>package.py<|end_file_name|><|fim▁begin|># Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class XorgServer(AutotoolsPackage, XorgPackage): """X.Org Server is the free and open source implementation of the display server for the X Window System stewarded by the X.Org Foundation.""" homepage = "http://cgit.freedesktop.org/xorg/xserver" xorg_mirror_path = "xserver/xorg-server-1.18.99.901.tar.gz" version('1.18.99.901', sha256='c8425163b588de2ee7e5c8e65b0749f2710f55a7e02a8d1dc83b3630868ceb21') depends_on('[email protected]:') depends_on('font-util') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('libx11') depends_on('[email protected]:', type='build') depends_on('[email protected]:', type='build') depends_on('[email protected]:', type='build') depends_on('flex', type='build') depends_on('bison', type='build') depends_on('pkgconfig', type='build') depends_on('util-macros', type='build') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:')<|fim▁hole|> depends_on('[email protected]:') depends_on('[email protected]:') depends_on('videoproto') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('xineramaproto') depends_on('libxkbfile') depends_on('libxfont2') depends_on('libxext') depends_on('libxdamage') depends_on('libxfixes') depends_on('libepoxy')<|fim▁end|>
<|file_name|>package.py<|end_file_name|><|fim▁begin|># Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class XorgServer(AutotoolsPackage, XorgPackage): <|fim_middle|> <|fim▁end|>
"""X.Org Server is the free and open source implementation of the display server for the X Window System stewarded by the X.Org Foundation.""" homepage = "http://cgit.freedesktop.org/xorg/xserver" xorg_mirror_path = "xserver/xorg-server-1.18.99.901.tar.gz" version('1.18.99.901', sha256='c8425163b588de2ee7e5c8e65b0749f2710f55a7e02a8d1dc83b3630868ceb21') depends_on('[email protected]:') depends_on('font-util') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('libx11') depends_on('[email protected]:', type='build') depends_on('[email protected]:', type='build') depends_on('[email protected]:', type='build') depends_on('flex', type='build') depends_on('bison', type='build') depends_on('pkgconfig', type='build') depends_on('util-macros', type='build') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('videoproto') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('[email protected]:') depends_on('xineramaproto') depends_on('libxkbfile') depends_on('libxfont2') depends_on('libxext') depends_on('libxdamage') depends_on('libxfixes') depends_on('libepoxy')
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def setUp(self): self.fd, self.path = tempfile.mkstemp() def tearDown(self): os.remove(self.path) def test_create_exteriorfuelequipment(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory<|fim▁hole|> with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)<|fim▁end|>
idf = IDF() idf.add(obj) idf.save(self.path, check=False)
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): <|fim_middle|> <|fim▁end|>
def setUp(self): self.fd, self.path = tempfile.mkstemp() def tearDown(self): os.remove(self.path) def test_create_exteriorfuelequipment(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def setUp(self): <|fim_middle|> def tearDown(self): os.remove(self.path) def test_create_exteriorfuelequipment(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)<|fim▁end|>
self.fd, self.path = tempfile.mkstemp()
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def setUp(self): self.fd, self.path = tempfile.mkstemp() def tearDown(self): <|fim_middle|> def test_create_exteriorfuelequipment(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)<|fim▁end|>
os.remove(self.path)
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def setUp(self): self.fd, self.path = tempfile.mkstemp() def tearDown(self): os.remove(self.path) def test_create_exteriorfuelequipment(self): <|fim_middle|> <|fim▁end|>
pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def <|fim_middle|>(self): self.fd, self.path = tempfile.mkstemp() def tearDown(self): os.remove(self.path) def test_create_exteriorfuelequipment(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)<|fim▁end|>
setUp
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def setUp(self): self.fd, self.path = tempfile.mkstemp() def <|fim_middle|>(self): os.remove(self.path) def test_create_exteriorfuelequipment(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)<|fim▁end|>
tearDown
<|file_name|>test_exteriorfuelequipment.py<|end_file_name|><|fim▁begin|>import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.exterior_equipment import ExteriorFuelEquipment log = logging.getLogger(__name__) class TestExteriorFuelEquipment(unittest.TestCase): def setUp(self): self.fd, self.path = tempfile.mkstemp() def tearDown(self): os.remove(self.path) def <|fim_middle|>(self): pyidf.validation_level = ValidationLevel.error obj = ExteriorFuelEquipment() # alpha var_name = "Name" obj.name = var_name # alpha var_fuel_use_type = "Electricity" obj.fuel_use_type = var_fuel_use_type # object-list var_schedule_name = "object-list|Schedule Name" obj.schedule_name = var_schedule_name # real var_design_level = 0.0 obj.design_level = var_design_level # alpha var_enduse_subcategory = "End-Use Subcategory" obj.enduse_subcategory = var_enduse_subcategory idf = IDF() idf.add(obj) idf.save(self.path, check=False) with open(self.path, mode='r') as f: for line in f: log.debug(line.strip()) idf2 = IDF(self.path) self.assertEqual(idf2.exteriorfuelequipments[0].name, var_name) self.assertEqual(idf2.exteriorfuelequipments[0].fuel_use_type, var_fuel_use_type) self.assertEqual(idf2.exteriorfuelequipments[0].schedule_name, var_schedule_name) self.assertAlmostEqual(idf2.exteriorfuelequipments[0].design_level, var_design_level) self.assertEqual(idf2.exteriorfuelequipments[0].enduse_subcategory, var_enduse_subcategory)<|fim▁end|>
test_create_exteriorfuelequipment
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed]<|fim▁hole|> elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile}<|fim▁end|>
if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]]
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): <|fim_middle|> <|fim▁end|>
def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile}
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): <|fim_middle|> <|fim▁end|>
""" Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile}
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: <|fim_middle|> elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
cmd_args += ['-1', reads[0], '-2', reads[1]]
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: <|fim_middle|> else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
cmd_args += ['-U', reads[0]]
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: <|fim_middle|> self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
raise Exception('Bowtie plugin error')
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): <|fim_middle|> ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
raise Exception('Unable to complete alignment')
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: <|fim_middle|> else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment')
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): <|fim_middle|> else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
raise Exception('Unable to complete alignment')
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: <|fim_middle|> ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment')
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def run(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): <|fim_middle|> ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
raise Exception('Unable to complete alignment')
<|file_name|>bowtie2.py<|end_file_name|><|fim▁begin|>import glob import logging import os import subprocess from plugins import BaseAligner from yapsy.IPlugin import IPlugin from assembly import get_qual_encoding class Bowtie2Aligner(BaseAligner, IPlugin): def <|fim_middle|>(self): """ Map READS to CONTIGS and return alignment. Set MERGED_PAIR to True if reads[1] is a merged paired end file """ contig_file = self.data.contigfiles[0] reads = self.data.readfiles ## Index contigs prefix = os.path.join(self.outpath, 'bt2') cmd_args = [self.build_bin, '-f', contig_file, prefix] self.arast_popen(cmd_args, overrides=False) ### Align reads bamfiles = [] for i, readset in enumerate(self.data.readsets): samfile = os.path.join(self.outpath, 'align.sam') reads = readset.files cmd_args = [self.executable, '-x', prefix, '-S', samfile, '-p', self.process_threads_allowed] if len(reads) == 2: cmd_args += ['-1', reads[0], '-2', reads[1]] elif len(reads) == 1: cmd_args += ['-U', reads[0]] else: raise Exception('Bowtie plugin error') self.arast_popen(cmd_args, overrides=False) if not os.path.exists(samfile): raise Exception('Unable to complete alignment') ## Convert to BAM bamfile = samfile.replace('.sam', '.bam') cmd_args = ['samtools', 'view', '-bSho', bamfile, samfile] self.arast_popen(cmd_args) bamfiles.append(bamfile) ### Merge samfiles if multiple if len(bamfiles) > 1: bamfile = os.path.join(self.outpath, '{}_{}.bam'.format(os.path.basename(contig_file), i)) self.arast_popen(['samtools', 'merge', bamfile] + bamfiles) if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') else: bamfile = bamfiles[0] if not os.path.exists(bamfile): raise Exception('Unable to complete alignment') ## Convert back to sam samfile = bamfile.replace('.bam', '.sam') self.arast_popen(['samtools', 'view', '-h', '-o', samfile, bamfile]) return {'alignment': samfile, 'alignment_bam': bamfile} <|fim▁end|>
run
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<|fim▁hole|>## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': <|fim_middle|> # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
arguments.pop(0)
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): <|fim_middle|> config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config')
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): <|fim_middle|> config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
config_path = next_arg(arguments, '--config')
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag <|fim_middle|> if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
pull_data( next_arg(arguments, '--pull-data') )
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): <|fim_middle|> if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme')
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): <|fim_middle|> config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme'))
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): <|fim_middle|> if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name']))
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): <|fim_middle|> publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): config['optimisations']['do_nothing'] = True # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.')
<|file_name|>tumblrserv.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python ## tumblrserv.py implements a Tumblr (http://www.tumblr.com) markup parsing ## engine and compatible webserver. ## ## Version: 0.2 final ## ## Copyright (C) 2009 Jeremy Herbert ## Contact mailto:[email protected] ## ## 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; either version 2 ## of the License, or (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. import os, sys, ftplib, yaml, cherrypy, re, urllib2 from src.post_classes import * from src import json from src.constants import * from src.support import * from src.net import * from src.server import * post_types = ['Regular', 'Photo', 'Quote', 'Link', 'Conversation', 'Video', 'Audio', 'Conversation'] args_dict = { 'autoreload': 0, # Whether to add the meta refresh tag 'publish': False, # Whether to push the new theme data to tumblr 'data_source': DATA_LOCAL, # Whether to use local data in the theme } ######################################## # take the arguments and place them in a mutable list arguments = sys.argv # if the script has been run with the interpreter prefix, get rid of it if arguments[0] == 'python' or arguments[0] == 'ipython' \ or arguments[0] == 'python2.5': arguments.pop(0) # pop off the script name arguments.pop(0) # load the configuration file config_path = 'data/config.yml' if contains(arguments, '--config'): if os.path.exists(next_arg(arguments, '--config')): config_path = next_arg(arguments, '--config') config = get_config(config_path) # now we check if there are any data processing flags if contains(arguments, '--pull-data'): # call pull_data with the argument after the flag pull_data( next_arg(arguments, '--pull-data') ) if contains(arguments, '--theme'): if not os.path.exists("themes/" + next_arg(arguments, '--theme') + '.thtml'): err_exit("The theme file %s.thtml does not exist in the themes\ directory." % next_arg(arguments, '--theme')) config['defaults']['theme_name'] = next_arg(arguments, '--theme') if contains(arguments, '--publish'): if not has_keys(config['publishing_info'], \ ( 'url', 'username', 'password' )): err_exit('The configuration file is missing some critical publishing\ information. Please make sure you have specified your url, username and\ password.') publish_theme(config['publishing_info']['url'],\ config['publishing_info']['username'],\ config['publishing_info']['password'],\ get_markup('themes/%s.thtml' % config['defaults']['theme_name'])) if contains(arguments, '--do-nothing'): <|fim_middle|> # start the server up cherrypy.config.update('data/cherrypy.conf') cherrypy.quickstart(TumblrServ(config), '/')<|fim▁end|>
config['optimisations']['do_nothing'] = True
<|file_name|>asyncio_example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import time from nicfit.aio import Application async def _main(args): print(args) print("Sleeping 2...") time.sleep(2) print("Sleeping 0...") return 0<|fim▁hole|>def atexit(): print("atexit") app = Application(_main, atexit=atexit) app.arg_parser.add_argument("--example", help="Example cli") app.run() assert not"will not execute"<|fim▁end|>
<|file_name|>asyncio_example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import time from nicfit.aio import Application async def _main(args): <|fim_middle|> def atexit(): print("atexit") app = Application(_main, atexit=atexit) app.arg_parser.add_argument("--example", help="Example cli") app.run() assert not"will not execute" <|fim▁end|>
print(args) print("Sleeping 2...") time.sleep(2) print("Sleeping 0...") return 0
<|file_name|>asyncio_example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import time from nicfit.aio import Application async def _main(args): print(args) print("Sleeping 2...") time.sleep(2) print("Sleeping 0...") return 0 def atexit(): <|fim_middle|> app = Application(_main, atexit=atexit) app.arg_parser.add_argument("--example", help="Example cli") app.run() assert not"will not execute" <|fim▁end|>
print("atexit")
<|file_name|>asyncio_example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import time from nicfit.aio import Application async def <|fim_middle|>(args): print(args) print("Sleeping 2...") time.sleep(2) print("Sleeping 0...") return 0 def atexit(): print("atexit") app = Application(_main, atexit=atexit) app.arg_parser.add_argument("--example", help="Example cli") app.run() assert not"will not execute" <|fim▁end|>
_main
<|file_name|>asyncio_example.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import time from nicfit.aio import Application async def _main(args): print(args) print("Sleeping 2...") time.sleep(2) print("Sleeping 0...") return 0 def <|fim_middle|>(): print("atexit") app = Application(_main, atexit=atexit) app.arg_parser.add_argument("--example", help="Example cli") app.run() assert not"will not execute" <|fim▁end|>
atexit
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1)<|fim▁hole|>def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed()<|fim▁end|>
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): <|fim_middle|> source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): <|fim_middle|> source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): <|fim_middle|> reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} }
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: <|fim_middle|> source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
indices = inds['1d']['indices'] for i in indices: color[i] = "red"
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: <|fim_middle|> else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
[index] = inds radius = [0.1]*N radius[index] = 0.2
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: <|fim_middle|> source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
radius = [0.1]*N
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": <|fim_middle|> <|fim▁end|>
print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed()
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def <|fim_middle|>(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
on_selection_change1
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def <|fim_middle|>(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def on_reset_click(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
on_selection_change2
<|file_name|>linked_tap.py<|end_file_name|><|fim▁begin|>from __future__ import print_function import numpy as np from bokeh.client import push_session from bokeh.io import curdoc from bokeh.models import (ColumnDataSource, DataRange1d, Plot, Circle, WidgetBox, Row, Button, TapTool) N = 9 x = np.linspace(-2, 2, N) y = x**2 source1 = ColumnDataSource(dict(x = x, y = y, radius = [0.1]*N)) xdr1 = DataRange1d() ydr1 = DataRange1d() plot1 = Plot(x_range=xdr1, y_range=ydr1, plot_width=400, plot_height=400) plot1.title.text = "Plot1" plot1.tools.append(TapTool(plot=plot1)) plot1.add_glyph(source1, Circle(x="x", y="y", radius="radius", fill_color="red")) source2 = ColumnDataSource(dict(x = x, y = y, color = ["blue"]*N)) xdr2 = DataRange1d() ydr2 = DataRange1d() plot2 = Plot(x_range=xdr2, y_range=ydr2, plot_width=400, plot_height=400) plot2.title.text = "Plot2" plot2.tools.append(TapTool(plot=plot2)) plot2.add_glyph(source2, Circle(x="x", y="y", radius=0.1, fill_color="color")) def on_selection_change1(attr, _, inds): color = ["blue"]*N if inds['1d']['indices']: indices = inds['1d']['indices'] for i in indices: color[i] = "red" source2.data["color"] = color source1.on_change('selected', on_selection_change1) def on_selection_change2(attr, _, inds): inds = inds['1d']['indices'] if inds: [index] = inds radius = [0.1]*N radius[index] = 0.2 else: radius = [0.1]*N source1.data["radius"] = radius source2.on_change('selected', on_selection_change2) reset = Button(label="Reset") def <|fim_middle|>(): source1.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } source2.selected = { '0d': {'flag': False, 'indices': []}, '1d': {'indices': []}, '2d': {'indices': {}} } reset.on_click(on_reset_click) widgetBox = WidgetBox(children=[reset], width=150) row = Row(children=[widgetBox, plot1, plot2]) document = curdoc() document.add_root(row) if __name__ == "__main__": print("\npress ctrl-C to exit") session = push_session(document) session.show() session.loop_until_closed() <|fim▁end|>
on_reset_click
<|file_name|>test_add_project.py<|end_file_name|><|fim▁begin|>from model.project import Project def test_add_project(app): project=Project(name="students_project", description="about Project") try: ind = app.project.get_project_list().index(project)<|fim▁hole|> app.project.delete_named_project(project) except ValueError: pass old_projects = app.project.get_project_list() app.project.create(project) new_projects = app.project.get_project_list() assert len(old_projects) + 1 == len(new_projects) old_projects.append(project) assert sorted(old_projects,key=Project.id_or_max) == sorted(new_projects,key=Project.id_or_max)<|fim▁end|>
<|file_name|>test_add_project.py<|end_file_name|><|fim▁begin|>from model.project import Project def test_add_project(app): <|fim_middle|> <|fim▁end|>
project=Project(name="students_project", description="about Project") try: ind = app.project.get_project_list().index(project) app.project.delete_named_project(project) except ValueError: pass old_projects = app.project.get_project_list() app.project.create(project) new_projects = app.project.get_project_list() assert len(old_projects) + 1 == len(new_projects) old_projects.append(project) assert sorted(old_projects,key=Project.id_or_max) == sorted(new_projects,key=Project.id_or_max)
<|file_name|>test_add_project.py<|end_file_name|><|fim▁begin|>from model.project import Project def <|fim_middle|>(app): project=Project(name="students_project", description="about Project") try: ind = app.project.get_project_list().index(project) app.project.delete_named_project(project) except ValueError: pass old_projects = app.project.get_project_list() app.project.create(project) new_projects = app.project.get_project_list() assert len(old_projects) + 1 == len(new_projects) old_projects.append(project) assert sorted(old_projects,key=Project.id_or_max) == sorted(new_projects,key=Project.id_or_max) <|fim▁end|>
test_add_project
<|file_name|>test_source_notfound.py<|end_file_name|><|fim▁begin|>import source_navigation_steps import functional_test class TestSourceInterfaceNotFound(<|fim▁hole|> self._source_not_found()<|fim▁end|>
functional_test.FunctionalTest, source_navigation_steps.SourceNavigationStepsMixin): def test_not_found(self):
<|file_name|>test_source_notfound.py<|end_file_name|><|fim▁begin|>import source_navigation_steps import functional_test class TestSourceInterfaceNotFound( functional_test.FunctionalTest, source_navigation_steps.SourceNavigationStepsMixin): <|fim_middle|> <|fim▁end|>
def test_not_found(self): self._source_not_found()
<|file_name|>test_source_notfound.py<|end_file_name|><|fim▁begin|>import source_navigation_steps import functional_test class TestSourceInterfaceNotFound( functional_test.FunctionalTest, source_navigation_steps.SourceNavigationStepsMixin): def test_not_found(self): <|fim_middle|> <|fim▁end|>
self._source_not_found()
<|file_name|>test_source_notfound.py<|end_file_name|><|fim▁begin|>import source_navigation_steps import functional_test class TestSourceInterfaceNotFound( functional_test.FunctionalTest, source_navigation_steps.SourceNavigationStepsMixin): def <|fim_middle|>(self): self._source_not_found() <|fim▁end|>
test_not_found
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>import unittest import os from ui import main print os.getcwd() class TestMain(unittest.TestCase): def setUp(self): self.m = main.MainWindow() def test_mainWindow(self): assert(self.m) def test_dataframe(self): import numpy #Random 25x4 Numpy Matrix self.m.render_dataframe(numpy.random.rand(25,4) ,name='devel',rownames=xrange(0,25)) assert(self.m.active_robject) assert(self.m.active_robject.columns) assert(self.m.active_robject.column_data) def test_imports(self):<|fim▁hole|> self.m.sync_with_r() assert(a in self.m.robjects) unittest.main()<|fim▁end|>
datasets = ['iris','Nile','morley','freeny','sleep','mtcars'] for a in datasets: main.rsession.r('%s=%s' % (a,a))