text stringlengths 213 32.3k |
|---|
import io
import os
from setuptools import setup, find_packages
def _get_version():
curr_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(curr_dir, 'smart_open', 'version.py')) as fin:
line = fin.readline().strip()
parts = line.split(' ')
assert len(parts) == 3... |
from asyncio import Event, gather
from collections import OrderedDict
from typing import Dict, Iterable, List, MutableMapping, Optional, cast
import attr
from homeassistant.core import callback
from homeassistant.loader import bind_hass
import homeassistant.util.uuid as uuid_util
from .typing import HomeAssistantTy... |
from __future__ import print_function
import json
import os.path
import time
import vim # noqa
from ._compat import PY2
class VimPymodeEnviroment(object):
"""Vim User interface."""
prefix = '[Pymode]'
def __init__(self):
"""Init VIM environment."""
self.current = vim.current
... |
import numpy as np
import unittest
import chainer
from chainer import optimizers
from chainer import testing
from chainer.testing import attr
from chainercv.links.model.ssd import GradientScaling
class SimpleLink(chainer.Link):
def __init__(self, w, g):
super(SimpleLink, self).__init__()
with ... |
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.util import slugify
from . import DATA_KEY, SIGNAL_STATE_UPDATED
async def async_setup_scanner(hass, config, async_see, discovery_info=None):
"""Set up the... |
import os
import pytest
import sh
from molecule import config
from molecule import util
from molecule.verifier import testinfra
from molecule.verifier.lint import flake8
@pytest.fixture
def _patched_testinfra_get_tests(mocker):
m = mocker.patch('molecule.verifier.testinfra.Testinfra._get_tests')
m.return_v... |
import pytest
from yandextank.validator.validator import TankConfig, ValidationError, PatchedValidator
CFG_VER_I_0 = {
"version": "1.9.3",
"core": {
'operator': 'fomars',
'artifacts_base_dir': './'
},
'telegraf': {
'package': 'yandextank.plugins.Telegraf',
'enabled': T... |
import logging
from typing import Callable
from .board import FirmataBoard, FirmataPinType
from .const import PIN_MODE_INPUT, PIN_MODE_PULLUP, PIN_TYPE_ANALOG
_LOGGER = logging.getLogger(__name__)
class FirmataPinUsedException(Exception):
"""Represents an exception when a pin is already in use."""
class Firm... |
from functools import partial
import logging
from miio import DeviceException, Vacuum # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.vacuum import (
ATTR_CLEANED_AREA,
PLATFORM_SCHEMA,
STATE_CLEANING,
STATE_DOCKED,
STATE_ERROR,
STATE_IDLE,
STATE_PAU... |
from datetime import timedelta
from typing import Any, Dict
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
import homeassistant.util.dt as dt_util
from . import DOMAIN, GeniusDevice, GeniusEntity
GH_STATE_ATTR = "batteryLevel"
... |
import math
from datetime import date, datetime, timedelta, timezone
from itertools import chain
from radicale import xmlutils
from radicale.log import logger
DAY = timedelta(days=1)
SECOND = timedelta(seconds=1)
DATETIME_MIN = datetime.min.replace(tzinfo=timezone.utc)
DATETIME_MAX = datetime.max.replace(tzinfo=time... |
from homeassistant.const import (
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
TEMPERATURE,
UNIT_NOT_RECOGNIZED_TEMPLATE,
)
def fahrenheit_to_celsius(fahrenheit: float, interval: bool = False) -> float:
"""Convert a temperature in Fahrenheit to Celsius."""
if interval:
return fahrenheit / 1.8
r... |
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
import numpy as np
import unittest
from chainercv import functions
from tests.functions_tests.test_ps_ro... |
import argparse
import glob
import os
import time
import random
COLOURS = (b'\xFF\x00\x00', b'\x00\xFF\x00', b'\x00\x00\xFF', b'\xFF\xFF\x00', b'\xFF\x00\xFF', b'\x00\xFF\xFF')
def write_binary(driver_path, device_file, payload):
with open(os.path.join(driver_path, device_file), 'wb') as open_file:
ope... |
from pybotvac.exceptions import NeatoLoginException, NeatoRobotException
import pytest
from homeassistant import data_entry_flow
from homeassistant.components.neato import config_flow
from homeassistant.components.neato.const import CONF_VENDOR, NEATO_DOMAIN
from homeassistant.const import CONF_PASSWORD, CONF_USERNAM... |
import numpy as np
import pandas as pd
from . import parameterized
class MultiIndexSeries:
def setup(self, dtype, subset):
data = np.random.rand(100000).astype(dtype)
index = pd.MultiIndex.from_product(
[
list("abcdefhijk"),
list("abcdefhijk"),
... |
from __future__ import print_function
import argparse
import locale
import os
import re
import sys
from distutils.version import StrictVersion
from socket import timeout as SocketTimeout
from six.moves import input
import paramiko
__version__ = '0.8.0'
def install_module_from_github(username, package_name, versi... |
import asyncio
import logging
from pathlib import Path
import lavalink
from redbot.core import data_manager
from redbot.core.i18n import Translator
from ...errors import LavalinkDownloadFailed
from ...manager import ServerManager
from ..abc import MixinMeta
from ..cog_utils import CompositeMetaClass
log = logging.g... |
from homeassistant.util import dt as dt_util
from homeassistant.util.decorator import Registry
from .models import Event
PARSERS = Registry()
@PARSERS.register("tns1:VideoSource/MotionAlarm")
# pylint: disable=protected-access
async def async_parse_motion_alarm(uid: str, msg) -> Event:
"""Handle parsing event ... |
from collections import namedtuple
from pathlib import Path
import json
import subprocess as sp
import shutil
import pytest
from redbot.cogs.downloader.repo_manager import RepoManager, Repo, ProcessFormatter
from redbot.cogs.downloader.installable import Installable, InstalledModule
__all__ = [
"repo_manager",
... |
from typing import Any
from homeassistant.components.scene import Scene
from . import FIBARO_DEVICES, FibaroDevice
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Perform the setup for Fibaro scenes."""
if discovery_info is None:
return
async_add_entit... |
import functools
from typing import Mapping, Callable, MutableMapping, Union, Set, cast
import attr
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QObject, QEvent
from PyQt5.QtGui import QKeyEvent
from PyQt5.QtWidgets import QApplication
from qutebrowser.commands import runners
from qutebrowser.keyinput import m... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import functools
import logging
import warnings
import typing
if typing.TYPE_CHECKING:
from typing import Callable
def warn_logging(logger):
# type: (logging.Logger) -> Callable
"""Creat... |
import builtins
import configparser
import operator
import sys
from cherrypy._cpcompat import text_or_bytes
class NamespaceSet(dict):
"""A dict of config namespace names and handlers.
Each config entry should begin with a namespace name; the corresponding
namespace handler will be called once for each... |
from datapoint.exceptions import APIException
import pytest
from tests.async_mock import patch
@pytest.fixture()
def mock_simple_manager_fail():
"""Mock datapoint Manager with default values for testing in config_flow."""
with patch("datapoint.Manager") as mock_manager:
instance = mock_manager.retur... |
import asyncio
import logging
from pyinsteon import async_close, async_connect, devices
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
from homeassistant.exceptions import ConfigEntryNotReady
from .const import (
CONF_CAT,
CONF_... |
import argparse
import logging
import os
import sys
def extract_preamble(fin):
end_preamble = False
preamble, body = [], []
for line in fin:
if end_preamble:
body.append(line)
elif line.startswith('#'):
preamble.append(line)
else:
end_preamble ... |
import abodepy.helpers.constants as CONST
from homeassistant.components.cover import CoverEntity
from . import AbodeDevice
from .const import DOMAIN
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Abode cover devices."""
data = hass.data[DOMAIN]
entities = []
for de... |
import os
import re
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_hostname(host):
assert re.search(r'instance-[12]', host.check_output('hostname -s'))
def test_etc_molecule_directory(h... |
from datetime import timedelta
from django.urls import reverse
from django.utils import timezone
from weblate.trans.tests.test_views import ViewTestCase
from weblate.trans.views.reports import generate_counts, generate_credits
COUNTS_DATA = [
{
"count": 1,
"count_edit": 0,
"count_new": 1... |
class cached_property:
"""Cached property descriptor.
Caches the return value of the get method on first call.
Examples:
.. code-block:: python
@cached_property
def connection(self):
return Connection()
@connection.setter # Prepares stored va... |
import functools
import logging
import redis
logger = logging.getLogger(__name__)
redis_conn = None
cache_prefix = None
def init(enable=True,
host='localhost', port=6379, db=0, password=None, path='/'):
global redis_conn, cache_prefix
if not enable:
redis_conn = None
return
log... |
from homeassistant.components import logbook
from homeassistant.components.alexa.const import EVENT_ALEXA_SMART_HOME
from homeassistant.setup import async_setup_component
from tests.components.logbook.test_init import MockLazyEventPartialState
async def test_humanify_alexa_event(hass):
"""Test humanifying Alexa... |
import pandas as pd
import pytest
import json
import os
from numpy.testing import assert_array_equal
from yandextank.plugins.NeUploader.plugin import Plugin
try:
from yatest import common
PATH = common.source_path('load/projects/yandex-tank/yandextank/plugins/NeUploader/tests')
except ImportError:
PATH =... |
import os
import sys
from PyQt5.QtCore import (QT_VERSION_STR, PYQT_VERSION_STR, qVersion,
QStandardPaths, QCoreApplication)
def print_header():
"""Show system information."""
print("Python {}".format(sys.version))
print("os.name: {}".format(os.name))
print("sys.platform: {... |
from datetime import datetime, timedelta
from functools import wraps
import logging
import re
from babelfish import Country
import guessit
import requests
from .. import __short_version__
from ..cache import REFINER_EXPIRATION_TIME, region
from ..utils import sanitize
from ..video import Episode
logger = logging.ge... |
import urllib2
from urlparse import urlparse, parse_qs
try:
from xml.etree import ElementTree
except ImportError:
ElementTree = None
from test import CollectorTestCase
from test import get_collector_config
from test import run_only
from test import unittest
from mock import patch
from diamond.collector impo... |
import json
import logging
import posixpath
from absl import flags
from perfkitbenchmarker import errors
from perfkitbenchmarker import os_types
from perfkitbenchmarker import sample
from perfkitbenchmarker import vm_util
FLAGS = flags.FLAGS
flags.DEFINE_boolean('enterprise_redis_tune_on_startup', True,
... |
from base64 import b64decode
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv
from .const import DOMAIN
def data_packet(value):
"""Decode a data packet given for a Broadlink remote."""
value = cv.string(value)
extra ... |
from threading import Lock
from itertools import islice
from operator import itemgetter
__all__ = ('LamportClock', 'timetuple')
R_CLOCK = '_lamport(clock={0}, timestamp={1}, id={2} {3!r})'
class timetuple(tuple):
"""Tuple of event clock information.
Can be used as part of a heap to keep events ordered.
... |
import numpy as np
import unittest
from chainer.dataset import DatasetMixin
from chainer import testing
from chainercv.utils import assert_is_label_dataset
class LabelDataset(DatasetMixin):
def __init__(self, color, *options):
self.color = color
self.options = options
def __len__(self):
... |
import logging
import os
import sys
import colorama
from ansible.module_utils.parsing.convert_bool import boolean as to_bool
def should_do_markup():
py_colors = os.environ.get('PY_COLORS', None)
if py_colors is not None:
return to_bool(py_colors, strict=False)
return sys.stdout.isatty() and os.... |
import json
import sqlite3
from hypothesis import example, given, settings
from hypothesis.strategies import sets, integers
from coverage import env
from coverage.backward import byte_to_int
from coverage.numbits import (
nums_to_numbits, numbits_to_nums, numbits_union, numbits_intersection,
numbits_any_inte... |
import pytest
from matchzoo import tasks
@pytest.mark.parametrize("task_type", [
tasks.Ranking, tasks.Classification
])
def test_task_listings(task_type):
assert task_type.list_available_losses()
assert task_type.list_available_metrics()
@pytest.mark.parametrize("arg", [None, -1, 0, 1])
def test_class... |
import os
import re
import subprocess
import diamond.collector
from diamond.collector import str_to_bool
class DiskTemperatureCollector(diamond.collector.Collector):
def process_config(self):
super(DiskTemperatureCollector, self).process_config()
self.devices = re.compile(self.config['devices']... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datetime
import json
import logging
import time
from absl import flags
from perfkitbenchmarker import data
from perfkitbenchmarker import relational_db
from perfkitbenchmarker.providers import gcp
from... |
from typing import Callable, List, Optional
from pyisy.constants import (
CMD_CLIMATE_FAN_SETTING,
CMD_CLIMATE_MODE,
PROP_HEAT_COOL_STATE,
PROP_HUMIDITY,
PROP_SETPOINT_COOL,
PROP_SETPOINT_HEAT,
PROP_UOM,
PROTO_INSTEON,
)
from homeassistant.components.climate import ClimateEntity
from ... |
import subprocess
import tempfile
from base64 import b64encode
from django.http.request import HttpRequest
from django.urls import reverse
from weblate.gitexport.models import get_export_url
from weblate.gitexport.views import authenticate
from weblate.trans.models import Project
from weblate.trans.tests.test_models... |
from statistics import mean
from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_PRECIPITATION,
ATTR_FORECAST_PRECIPITATION_PROBABILITY,
ATTR_FORECAST_TEMP,
ATTR_FORECAST_TEMP_LOW,
ATTR_FORECAST_TIME,
ATTR_FORECAST_WIND_BEARING,
ATTR_FORECAST_WIND_SPEED... |
from itertools import count
from .common import maybe_declare
from .compression import compress
from .connection import maybe_channel, is_connection
from .entity import Exchange, Queue, maybe_delivery_mode
from .exceptions import ContentDisallowed
from .serialization import dumps, prepare_accept_content
from .utils.f... |
import logging
from aioasuswrt.asuswrt import AsusWrt
from homeassistant.const import DATA_GIGABYTES, DATA_RATE_MEGABITS_PER_SECOND
from homeassistant.helpers.entity import Entity
from . import DATA_ASUSWRT
_LOGGER = logging.getLogger(__name__)
UPLOAD_ICON = "mdi:upload-network"
DOWNLOAD_ICON = "mdi:download-netw... |
import mock
from StringIO import StringIO
from contextlib import contextmanager
from paramiko import SSHClient
import app.utils.SshUtil as ssh
from . import RSA_PRIVATE_KEY
@contextmanager
def patch_ssh(stdout='', stderr=''):
def mock_exec_command(*args, **kwargs):
stdin = StringIO()
stdin.close(... |
from pathlib import Path
import aiohttp
from redbot.core.i18n import Translator
_ = Translator("Audio", Path(__file__))
class AudioError(Exception):
"""Base exception for errors in the Audio cog."""
class LavalinkDownloadFailed(AudioError, RuntimeError):
"""Downloading the Lavalink jar failed.
Attr... |
import ast
import asyncio
import aiohttp
import inspect
import io
import textwrap
import traceback
import types
import re
from contextlib import redirect_stdout
from copy import copy
import discord
from . import checks, commands
from .commands import NoParseOptional as Optional
from .i18n import Translator
from .uti... |
import os
import unittest
from integration_tests.files import require_empty_dir
from trashcli.put import TrashDirectoryForPut, RealFs
from mock import Mock
join = os.path.join
class TestTrashDirectory_persit_trash_info(unittest.TestCase):
def setUp(self):
self.trashdirectory_base_dir = os.path.realpath(... |
import logging
from Plugwise_Smile.Smile import Smile
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from .const import COORDINATOR, DOMAIN
from .gateway import SmileGateway
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, asy... |
from math import ceil
import abodepy.helpers.constants as CONST
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
LightEntity,
)
from homeassistant.util.color import (
color_temperature_... |
from paasta_tools.autoscaling.pause_service_autoscaler import (
delete_service_autoscale_pause_time,
)
from paasta_tools.autoscaling.pause_service_autoscaler import (
get_service_autoscale_pause_time,
)
from paasta_tools.autoscaling.pause_service_autoscaler import (
update_service_autoscale_pause_time,
)
f... |
import asyncio
from contextlib import suppress
import logging
from typing import Optional
from aiohttp import WSMsgType, web
import async_timeout
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
from homeassis... |
from time import time
import pytest
from homeassistant import config_entries, core
from homeassistant.components.almond import const
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import EVENT_HOMEASSISTANT_START
from homeassistant.setup import async_setup_component
from homea... |
from collections import namedtuple
from datetime import timedelta
import logging
from getmac import get_mac_address
from nmap import PortScanner, PortScannerError
import voluptuous as vol
from homeassistant.components.device_tracker import (
DOMAIN,
PLATFORM_SCHEMA,
DeviceScanner,
)
from homeassistant.co... |
import sys
import pygogo as gogo
from difflib import unified_diff
from os import path as p
from io import StringIO, open
from timeit import default_timer as timer
from scripttest import TestFileEnvironment
sys.path.append('../riko')
try:
from riko.bado import _isasync
except ImportError:
_isasync = False
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
import logging
import math
import posixpath
import time
from absl import flags
from perfkitbenchmarker import configs
from perfkitbenchmarker import data
from perfkitbenchma... |
import os
import shlex
import shutil
import sqlite3
import subprocess
import sys
import unittest
def run_cmd(cmd):
"""Run a command and return a tuple with (stdout, stderr, exit_code)"""
process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE,
stderr=subprocess.PIPE... |
class BaseInstanceLoader:
"""
Base abstract implementation of instance loader.
"""
def __init__(self, resource, dataset=None):
self.resource = resource
self.dataset = dataset
def get_instance(self, row):
raise NotImplementedError
class ModelInstanceLoader(BaseInstanceLoa... |
import os
from nikola.plugin_categories import Task
from nikola import utils
class Sources(Task):
"""Copy page sources into the output."""
name = "render_sources"
def gen_tasks(self):
"""Publish the page sources into the output."""
kw = {
"translations": self.site.config["T... |
import io
import lxml.html
from pkg_resources import resource_filename
from mako.template import Template
from nikola.plugin_categories import Command
class CommandRst2Html(Command):
"""Compile reStructuredText to HTML, using Nikola architecture."""
name = "rst2html"
doc_usage = "infile"
doc_purpose... |
import io
def find_box(segment: io.BytesIO, target_type: bytes, box_start: int = 0) -> int:
"""Find location of first box (or sub_box if box_start provided) of given type."""
if box_start == 0:
box_end = segment.seek(0, io.SEEK_END)
segment.seek(0)
index = 0
else:
segment.... |
import logging
import pypca
from serial import SerialException
from homeassistant.components.switch import ATTR_CURRENT_POWER_W, SwitchEntity
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
_LOGGER = logging.getLogger(__name__)
ATTR_TOTAL_ENERGY_KWH = "total_energy_kwh"
DEFAULT_NAME = "PCA 301"
def set... |
import logging
from pycoolmasternet_async import CoolMasterNet
from homeassistant.components.climate import SCAN_INTERVAL
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFai... |
import logging
import threading
import aprslib
from aprslib import ConnectionError as AprsConnectionError, LoginError
import geopy.distance
import voluptuous as vol
from homeassistant.components.device_tracker import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_GPS_ACCURACY,
ATTR_LATITUDE,
ATTR... |
import sys
from .compression import decompress
from .exceptions import reraise, MessageStateError
from .serialization import loads
from .utils.functional import dictfilter
__all__ = ('Message',)
ACK_STATES = {'ACK', 'REJECTED', 'REQUEUED'}
IS_PYPY = hasattr(sys, 'pypy_version_info')
class Message:
"""Base cla... |
from homeassistant.components import switch
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import DATA_REMOVE_DISCOVER_COMPONENT, DOMAIN as TASMOTA_DOMAIN
from .discovery import TASMOTA_... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import os
from absl import flags
from absl.testing import parameterized
from compare_gan import datasets
from compare_gan import test_utils
from compare_gan.gans import consts as c
from compa... |
from collections import OrderedDict
import logging
from typing import Any, Mapping, MutableMapping, Optional
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import TemplateError
from homeassistant.helpers... |
import logging
from nessclient import ArmingState
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_TRIGGER,
)
from homeassistant.const import (
STATE_ALARM_ARMED_... |
from django.urls import reverse
from weblate.trans.tests.test_views import FixtureTestCase
class ChartsTest(FixtureTestCase):
"""Testing of charts."""
def test_activity_monthly(self):
"""Test of monthly activity charts."""
response = self.client.get(reverse("monthly_activity"))
self... |
import json
from flask import current_app
from lemur import database
from lemur.dns_providers.models import DnsProvider
def render(args):
"""
Helper that helps us render the REST Api responses.
:param args:
:return:
"""
query = database.session_query(DnsProvider)
return database.sort_a... |
import logging
import re
import voluptuous as vol
from homeassistant.components.alarm_control_panel import (
FORMAT_NUMBER,
FORMAT_TEXT,
PLATFORM_SCHEMA,
AlarmControlPanelEntity,
)
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,... |
from .common import setup_ozw
async def test_switch(hass, generic_data, sent_messages, switch_msg):
"""Test setting up config entry."""
receive_message = await setup_ozw(hass, fixture=generic_data)
# Test loaded
state = hass.states.get("switch.smart_plug_switch")
assert state is not None
ass... |
from __future__ import unicode_literals
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.test import RequestFactory
from django.test import TestCase
from django.test.utils import override_settings
from django.urls imp... |
from .nodes import Node
class NodeVisitor:
"""Walks the abstract syntax tree and call visitor functions for every
node found. The visitor functions may return values which will be
forwarded by the `visit` method.
Per default the visitor functions for the nodes are ``'visit_'`` +
class name of t... |
from datetime import timedelta
from django.test import TestCase
from django.utils import timezone
from weblate.checks.source import (
EllipsisCheck,
LongUntranslatedCheck,
OptionalPluralCheck,
)
from weblate.checks.tests.test_checks import MockUnit
from weblate.trans.tests.test_views import FixtureTestCa... |
from typing import List, Optional
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
)
from homeassistant.core import Context, HomeAssistant
from homeassistant.helpers import entity_registry
import homeassistant.helpe... |
import os
import sys
from pathlib import Path
from Foundation import NSBundle
__package__ = "meld"
__version__ = "3.21.0.osx3"
APPLICATION_NAME = 'Meld'
APPLICATION_ID = 'org.gnome.Meld'
SETTINGS_SCHEMA_ID = 'org.gnome.meld'
RESOURCE_BASE = '/org/gnome/meld'
# START; these paths are clobbered on install by meld.bui... |
from datetime import datetime
import pytest
from homeassistant.components import (
device_sun_light_trigger,
device_tracker,
group,
light,
)
from homeassistant.components.device_tracker.const import DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_PLATFORM,
EVENT_HOMEASSISTAN... |
import logging
from random import randrange
from pyintesishome import IHAuthenticationError, IHConnectionError, IntesisHome
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE,
HVAC_MODE_COOL,... |
import copy
from datetime import timedelta
import logging
from httplib2 import ServerNotFoundError # pylint: disable=import-error
from homeassistant.components.calendar import (
ENTITY_ID_FORMAT,
CalendarEventDevice,
calculate_offset,
is_offset_reached,
)
from homeassistant.helpers.entity import gen... |
import time
from typing import List
from paasta_tools.deployd.common import DelayDeadlineQueueProtocol
from paasta_tools.deployd.common import PaastaThread
from paasta_tools.deployd.workers import PaastaDeployWorker
from paasta_tools.metrics.metrics_lib import BaseMetrics
class MetricsThread(PaastaThread):
def ... |
import logging
from bimmer_connected.state import ChargingState
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_UNIT_SYSTEM_IMPERIAL,
LENGTH_KILOMETERS,
LENGTH_MILES,
PERCENTAGE,
TIME_HOURS,
VOLUME_GALLONS,
VOLUME_LITERS,
)
from homeassistant.helpers.entity import Entity
from... |
import numpy as np
from ..annotations import _annotations_starts_stops, Annotations
from ..io import BaseRaw
from ..io.pick import _picks_to_idx
from ..utils import (_validate_type, verbose, logger, _pl,
_mask_to_onsets_offsets, ProgressBar)
@verbose
def annotate_flat(raw, bad_percent=5., min_d... |
from __future__ import unicode_literals
import platform
# judge run platform
def is_Windows():
return platform.system() == "Windows"
def is_Linux():
return platform.system() == "Linux"
def is_Mac():
return platform.system() == "Darwin"
# Windows 10 (v1511) Adds Support for ANSI Escape Sequences
de... |
from typing import Optional
from homeassistant.components import zone
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ATTR_GPS_ACCURACY,
ATTR_LATITUDE,
ATTR_LONGITUDE,
STATE_HOME,
STATE_NOT_HOME,
)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_componen... |
import logging
from pyrainbird import RainbirdController
from homeassistant.helpers.entity import Entity
from . import (
DATA_RAINBIRD,
RAINBIRD_CONTROLLER,
SENSOR_TYPE_RAINDELAY,
SENSOR_TYPE_RAINSENSOR,
SENSOR_TYPES,
)
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, ad... |
from __future__ import division
import numpy as np
import six
import unittest
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import testing
from chainermn import create_communicator
from chainercv.links.model.ssd import multibox_loss
from chainercv.utils.testing import a... |
import os, shutil
class FileSystemListing:
def entries_if_dir_exists(self, path):
if os.path.exists(path):
for entry in os.listdir(path):
yield entry
def exists(self, path):
return os.path.exists(path)
class FileSystemReader(FileSystemListing):
def is_sticky_di... |
import json
import unittest
from absl import flags
from perfkitbenchmarker.providers.gcp import bigquery
from tests import pkb_common_test_case
PACKAGE_NAME = 'PACKAGE_NAME'
DATASET_ID = 'DATASET_ID'
PROJECT_ID = 'PROJECT_ID'
QUERY_NAME = 'QUERY_NAME'
_TEST_RUN_URI = 'fakeru'
_GCP_ZONE_US_CENTRAL_1_C = 'us-central1-c... |
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
# EC2 provides unique random hostnames.
def test_hostname(host):
pass
def test_etc_molecule_directory(host):
f = host.file('/etc/mole... |
from flask import abort, Blueprint, jsonify
from httpobs import SOURCE_URL, VERSION
from httpobs.database import get_cursor
monitoring_api = Blueprint('monitoring-api', __name__)
@monitoring_api.route('/__heartbeat__')
def heartbeat():
# TODO: check celery status
try:
# Check the database
... |
from __future__ import print_function
import collections
import time
from datetime import datetime
import pandas as pd
import ystockquote
from arctic import Arctic
################################################
# Getting started
################################################
# Install Arctic
# pip install ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.