prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import
class BadOption(Exception):
""" Incorrect HTTP API arguments """
pass
class RenderError(Exception):
""" Error rendering page """
pass
class InternalError(Exception):
""" Unhan... | """ Error occured in JavaScript code """
pass |
<|file_name|>exceptions.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from __future__ import absolute_import
class BadOption(Exception):
""" Incorrect HTTP API arguments """
pass
class RenderError(Exception):
""" Error rendering page """
pass
class InternalError(Exception):
""" Unhan... | """ A one shot callback was called more than once. """
pass |
<|file_name|>test.py<|end_file_name|><|fim▁begin|><|fim▁hole|>result = subprocess.Popen('sh test.sh', shell=True)
text = result.communicate()[0]
sys.exit(result.returncode)<|fim▁end|> | import sys
import subprocess
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | dev = [] |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Set up the devices associated with the account."""
token = config.get(CONF_TOKEN)
username = config.get(CONF_USERNAME)
client = FoobotClient(
token, username, async_get_clientsession(hass), timeout=TIMEOUT
)
dev = []
try:
devices = await client.get_devices()
_LOGGE... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Implementation of a Foobot sensor."""
def __init__(self, data, device, sensor_type):
"""Initialize the sensor."""
self._uuid = device["uuid"]
self.foobot_data = data
self._name = "Foobot {} {}".format(device["name"], SENSOR_TYPES[sensor_type][0])
self.type = sensor_typ... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Initialize the sensor."""
self._uuid = device["uuid"]
self.foobot_data = data
self._name = "Foobot {} {}".format(device["name"], SENSOR_TYPES[sensor_type][0])
self.type = sensor_type
self._unit_of_measurement = SENSOR_TYPES[sensor_type][1]
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Return the name of the sensor."""
return self._name
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Icon to use in the frontend."""
return SENSOR_TYPES[self.type][2]
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Return the state of the device."""
try:
data = self.foobot_data.data[self.type]
except (KeyError, TypeError):
data = None
return data
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Return the unique id of this entity."""
return f"{self._uuid}_{self.type}"
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Return the unit of measurement of this entity."""
return self._unit_of_measurement
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Get the latest data."""
await self.foobot_data.async_update()
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Get data from Foobot API."""
def __init__(self, client, uuid):
"""Initialize the data object."""
self._client = client
self._uuid = uuid
self.data = {}
@Throttle(SCAN_INTERVAL)
async def async_update(self):
"""Get the data from Foobot API."""
interval ... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Initialize the data object."""
self._client = client
self._uuid = uuid
self.data = {}
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ""Get the data from Foobot API."""
interval = SCAN_INTERVAL.total_seconds()
try:
response = await self._client.get_last_data(
self._uuid, interval, interval + 1
)
except (
aiohttp.client_exceptions.ClientConnectorError,
asyn... |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ontinue
|
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | sync_setup_platform( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | _init__( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | ame( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | con( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | tate( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | nique_id( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | nit_of_measurement( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | sync_update( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | _init__( |
<|file_name|>sensor.py<|end_file_name|><|fim▁begin|>"""Support for the Foobot indoor air quality monitor."""
import asyncio
from datetime import timedelta
import logging
import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,... | sync_update( |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|><|fim▁hole|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of... | |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | """
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Swagger model
:param dict swaggerTypes: The key is attribute name and the value is attribute type.
:param dict attributeMap: The... |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | """
Swagger model
:param dict swaggerTypes: The key is attribute name and the value is attribute type.
:param dict attributeMap: The key is attribute name and the value is json key in definition.
"""
self.swagger_types = {
'status': 'str',
'messag... |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | properties = []
for p in self.__dict__:
if p != 'swaggerTypes' and p != 'attributeMap':
properties.append('{prop}={val!r}'.format(prop=p, val=self.__dict__[p]))
return '<{name} {props}>'.format(name=__name__, props=' '.join(properties)) |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | properties.append('{prop}={val!r}'.format(prop=p, val=self.__dict__[p])) |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | __init__ |
<|file_name|>json_error_response.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License... | __repr__ |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
<|fim_middle|>
def test_setup_only():
"""`setup... | """`fix.with_fixture` function exists"""
assert isinstance(with_fixture, FunctionType) |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """`setup_only` fixture works as expected"""
def setup_only(context):
"""A fixture with no `teardown()`."""
def setup():
"""Add something to the context."""
assert context == {}
context.squee = "kapow"
return setup
@with_fixture(setup_only)
... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """A fixture with no `teardown()`."""
def setup():
"""Add something to the context."""
assert context == {}
context.squee = "kapow"
return setup |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Add something to the context."""
assert context == {}
context.squee = "kapow" |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Check that the context has been set up."""
assert context == {"squee": "kapow"} |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """`setup_teardown` fixture works as expected"""
def setup_teardown(context):
"""A fixture with both `setup()` and `teardown()`."""
def setup():
"""Add something to the context."""
assert context == {}
context.squee = "kapow"
def teardown():
... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """A fixture with both `setup()` and `teardown()`."""
def setup():
"""Add something to the context."""
assert context == {}
context.squee = "kapow"
def teardown():
"""Check that `context.squee` has changed."""
assert context == {"sque... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Add something to the context."""
assert context == {}
context.squee = "kapow" |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Check that `context.squee` has changed."""
assert context == {"squee": "boing"} |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Alter the context."""
assert context == {"squee": "kapow"}
context.squee = "boing" |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """`multiple` fixture creates a fresh context each invocation"""
def multiple(context):
"""A fixture to be invoked multiple times."""
def setup():
"""Add something to the context."""
assert context == {}
context.squee = "kapow"
def teardown():
... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """A fixture to be invoked multiple times."""
def setup():
"""Add something to the context."""
assert context == {}
context.squee = "kapow"
def teardown():
"""Check that `context.squee` has changed."""
assert context == {"squee": "kap... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Add something to the context."""
assert context == {}
context.squee = "kapow" |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Check that `context.squee` has changed."""
assert context == {"squee": "kapow", "boing": "thunk"} |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Add to the context."""
assert context == {"squee": "kapow"}
context.boing = "thunk" |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """`external` fixture interacts as expected with the 'real world'."""
def external(context, files=3):
"""A fixture to manipulate temporary files and directories."""
def setup():
"""Create some temporary files."""
context.temp_dir = tempfile.mkdtemp()
context... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """A fixture to manipulate temporary files and directories."""
def setup():
"""Create some temporary files."""
context.temp_dir = tempfile.mkdtemp()
context.filenames = ["file_%03d" % i for i in range(files)]
for filename in context.filenames:
... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Create some temporary files."""
context.temp_dir = tempfile.mkdtemp()
context.filenames = ["file_%03d" % i for i in range(files)]
for filename in context.filenames:
with open(os.path.join(context.temp_dir, filename), "w") as f:
f.wri... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Delete the temporary files created in `setup()`."""
shutil.rmtree(context.temp_dir) |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | """Return the number of present and absent files."""
present = 0
absent = 0
for filename in context.filenames:
if os.path.exists(os.path.join(context.temp_dir, filename)):
present += 1
else:
absent += 1
return context.temp_d... |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | present += 1 |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | absent += 1 |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def <|fim_middle|>():
"""`fix.with_fixture` function exists"""
assert... | test_exists |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | test_setup_only |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | setup_only |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | setup |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | case |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | test_setup_teardown |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | setup_teardown |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | setup |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | teardown |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | case |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | test_multiple_invocation |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | multiple |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | setup |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | teardown |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | case |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | test_external |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | external |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | setup |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | teardown |
<|file_name|>test_with_fixture.py<|end_file_name|><|fim▁begin|>"""Tests for `fix.with_fixture`."""
from __future__ import with_statement
import os
import shutil
import tempfile
from types import FunctionType
from fix import with_fixture
def test_exists():
"""`fix.with_fixture` function exists"""
assert is... | check_files |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (C) 2014 Didotech srl (<http://www.didotech.com>).
#
# All Rights Reserved... | #
# This program is free software: you can redistribute it and/or modify |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | distance = unit.norm( positions[i]-positions[j] ) |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
<|fim_middle|>
def setGlobalForceParameter(force, key, value):
for i in range(force.getNumGlobalParameters()):
if force.getGlobalParame... | """ Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcetype):
return force
if add==True:
system.addForce(forcetype())
return findForce(system, forcetype)
return None |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | for i in range(force.getNumGlobalParameters()):
if force.getGlobalParameterName(i)==key:
print('setting force parameter', key, '=', value)
force.setGlobalParameterDefaultValue(i, value); |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | """ list of atom index in residue """
index=[]
for a in list(residue.atoms()):
index.append(a.index)
return index |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | """ Returns array w. atomic positions of residue """
ndx = atomIndexInResidue(residue)
return np.array(positions)[ndx] |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | """ list of unique, internal pairs """
return list(combinations( range(index[0],index[-1]+1),2 ) ) |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | """ add harmonic bonds between pairs if distance is smaller than threshold """
print('Constraint force constant =', k)
for i,j in pairlist:
distance = unit.norm( positions[i]-positions[j] )
if distance<threshold:
harmonicforce.addBond( i,j,
distance.value_in_unit(unit.nanometer),
... |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | """ add nonbonded exclusions between pairs """
for i,j in pairlist:
nonbondedforce.addExclusion(i,j) |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | """ make residue rigid by adding constraints and nonbonded exclusions """
index = atomIndexInResidue(residue)
pairlist = uniquePairs(index)
addHarmonicConstraint(harmonic, pairlist, pdb.positions, threshold, k)
if nonbondedforce is not None:
for i,j in pairlist:
print('added nonbonded exclusion b... |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | return force |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | system.addForce(forcetype())
return findForce(system, forcetype) |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | print('setting force parameter', key, '=', value)
force.setGlobalParameterDefaultValue(i, value); |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | harmonicforce.addBond( i,j,
distance.value_in_unit(unit.nanometer),
k.value_in_unit( unit.kilojoule/unit.nanometer**2/unit.mole ))
print("added harmonic bond between", i, j, 'with distance',distance) |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | for i,j in pairlist:
print('added nonbonded exclusion between', i, j)
nonbonded.addExclusion(i,j) |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def <|fim_middle|>(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, f... | findForce |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | setGlobalForceParameter |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | atomIndexInResidue |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | getResiduePositions |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | uniquePairs |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | addHarmonicConstraint |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | addExclusions |
<|file_name|>openmm.py<|end_file_name|><|fim▁begin|>from simtk.openmm import app
import simtk.openmm as mm
from simtk import unit
def findForce(system, forcetype, add=True):
""" Finds a specific force in the system force list - added if not found."""
for force in system.getForces():
if isinstance(force, forcet... | rigidifyResidue |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.