text stringlengths 213 32.3k |
|---|
from unittest import TestCase
import pandas as pd
from scattertext.CorpusFromParsedDocuments import CorpusFromParsedDocuments
from scattertext.WhitespaceNLP import whitespace_nlp
from scattertext.representations.Word2VecFromParsedCorpus import Word2VecFromParsedCorpus, \
Word2VecFromParsedCorpusBigrams
from scatter... |
import pandas as pd
from scipy.stats import beta, norm
from scattertext.termranking.OncePerDocFrequencyRanker import OncePerDocFrequencyRanker
from scattertext.termscoring.CorpusBasedTermScorer import CorpusBasedTermScorer
class BetaPosterior(CorpusBasedTermScorer):
'''
Beta Posterior Scoring. Code adapted ... |
import functools
import logging
from docker_registry.core import compat
json = compat.json
from .. import storage
from .. import toolkit
from . import cache
from . import config
import flask
import requests
logger = logging.getLogger(__name__)
cfg = config.load()
def is_mirror():
return bool(cfg.mirroring and... |
def get_from_xsettings():
from ReText.xsettings import get_xsettings, XSettingsError
try:
xsettings = get_xsettings()
except XSettingsError:
return
if b'Net/IconThemeName' in xsettings:
return xsettings[b'Net/IconThemeName'].decode()
if b'Net/FallbackIconTheme' in xsettings:
return xsettings[b'Net/Fallbac... |
import errno
import fcntl
import json
import os
import threading
import time
from subprocess import PIPE
from subprocess import Popen
import mock
import service_configuration_lib
from behave import given
from behave import then
from behave import when
from itest_utils import get_service_connection_string
from kazoo.e... |
from datetime import timedelta
import logging
from pyfido import FidoClient
from pyfido.client import PyFidoError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_MONITORED_VARIABLES,
CONF_NAME,
CONF_PASSWORD,
CONF_USERNAME,
... |
import copy
import json
from hatasmota.const import CONF_MAC
from hatasmota.utils import config_get_state_online, get_topic_tele_will
from homeassistant.components.tasmota.const import DEFAULT_PREFIX
from .test_common import DEFAULT_CONFIG
from tests.async_mock import call
from tests.common import async_fire_mqtt_... |
import os
import flexx
from flexx import flx
# todo: support icons in widgets like Button, TabWidget, etc.
# todo: support fontawesome icons
fname = os.path.join(os.path.dirname(flexx.__file__), 'resources', 'flexx.ico')
black_png = ('data:image/png;base64,'
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9... |
import os
import re
import subprocess
import sys
import xml.dom.minidom
import diamond.collector
class GridEngineCollector(diamond.collector.Collector):
"""Diamond collector for Grid Engine performance data
"""
class QueueStatsEntry:
def __init__(self, name=None, load=None, used=None, resv=Non... |
import tempfile
import os
from os.path import join, dirname, abspath
import re
from sys import version_info
from six import integer_types
from logilab.common import attrdict
from logilab.common.compat import StringIO
from logilab.common.testlib import TestCase, unittest_main
from logilab.common.optik_ext import Opt... |
import unittest
import mock
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from apply_bpe import isolate_glossary, BPE
class TestIsolateGlossaryFunction(unittest.TestCase):
def set... |
import re
import warnings
from datetime import datetime
from distutils.version import LooseVersion
from functools import partial
import numpy as np
import pandas as pd
from pandas.errors import OutOfBoundsDatetime
from ..core import indexing
from ..core.common import contains_cftime_datetimes
from ..core.formatting ... |
from distutils.core import setup
from setuptools import find_packages
import os
import re
import io
packages = find_packages('app')
LONGDOC = """
git-webhook is a web app base on
Python Flask + SQLAchemy + Celery + Redis + React.
Aims to deploy a git webhook platform easily,
now supports Github / GitLab /... |
import logging
import paasta_tools.paastaapi.models as paastamodels
from paasta_tools.api import client
from paasta_tools.cli.utils import figure_out_service_name
from paasta_tools.cli.utils import lazy_choices_completer
from paasta_tools.cli.utils import list_instances
from paasta_tools.utils import _log_audit
from ... |
from pathlib import Path
import keras
import matchzoo as mz
_glove_embedding_url = "http://nlp.stanford.edu/data/glove.6B.zip"
def load_glove_embedding(dimension: int = 50) -> mz.embedding.Embedding:
"""
Return the pretrained glove embedding.
:param dimension: the size of embedding dimension, the val... |
from qutebrowser.api import cmdutils, apitypes, message, config
@cmdutils.register()
@cmdutils.argument('tab', value=cmdutils.Value.cur_tab)
@cmdutils.argument('count', value=cmdutils.Value.count)
def zoom_in(tab: apitypes.Tab, count: int = 1, quiet: bool = False) -> None:
"""Increase the zoom level for the curr... |
from hole.exceptions import HoleError
from homeassistant.components.pi_hole.const import CONF_LOCATION
from homeassistant.const import (
CONF_API_KEY,
CONF_HOST,
CONF_NAME,
CONF_PORT,
CONF_SSL,
CONF_VERIFY_SSL,
)
from tests.async_mock import AsyncMock, MagicMock, patch
ZERO_DATA = {
"ads... |
import warnings
import numpy as np
from . import dtypes, nputils, utils
from .duck_array_ops import _dask_or_eager_func, count, fillna, isnull, where_method
from .pycompat import dask_array_type
try:
import dask.array as dask_array
from . import dask_array_compat
except ImportError:
dask_array = None
... |
import logging
import threading
from pyflic import (
ButtonConnectionChannel,
ClickType,
ConnectionStatus,
FlicClient,
ScanWizard,
ScanWizardResult,
)
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const impor... |
from elkm1_lib.const import AlarmState, ArmedStatus, ArmLevel, ArmUpState
from elkm1_lib.util import username
import voluptuous as vol
from homeassistant.components.alarm_control_panel import (
ATTR_CHANGED_BY,
FORMAT_NUMBER,
AlarmControlPanelEntity,
)
from homeassistant.components.alarm_control_panel.con... |
import os
import argparse
import re
import sys
try:
from .common import get_stash_dir
except (ImportError, ValueError):
from common import get_stash_dir
DEFAULT_ENCODING = "utf-8" # encoding to use to set encoding
def is_encoding_line(s):
"""
Check if the given line specifies an encoding.
:par... |
from homeassistant import data_entry_flow
from homeassistant.components.local_ip.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER
from tests.common import MockConfigEntry
async def test_config_flow(hass):
"""Test we can finish a config flow."""
result = await hass.config_entries.flow... |
import pytest
from homeassistant.const import (
PRECISION_HALVES,
PRECISION_TENTHS,
PRECISION_WHOLE,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homeassistant.helpers.temperature import display_temp
TEMP = 24.636626
def test_temperature_not_a_number(hass):
"""Test that temperature is a number."""... |
import unittest
from credstash import paddedInt
class TestPadLeft(unittest.TestCase):
def test_zero(self):
i = 0
self.assertEqual(paddedInt(i), "0" * 19)
def test_ten(self):
i = 10
self.assertEqual(paddedInt(i), str(i).zfill(19))
def test_arbitrary_number(self):
... |
from django.utils.translation import gettext_lazy as _
from weblate.addons.base import BaseAddon
from weblate.addons.events import EVENT_PRE_COMMIT
from weblate.addons.forms import GenerateForm
from weblate.utils.render import render_template
class GenerateFileAddon(BaseAddon):
events = (EVENT_PRE_COMMIT,)
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import subprocess
from absl import flags
from absl.testing import _bazelize_command
from absl.testing import absltest
FLAGS = flags.FLAGS
NUM_TEST_METHODS = 8 # Hard-coded, based on absltest_shard... |
from flexx.util.testing import run_tests_if_main, skipif, skip, raises
from flexx.event.both_tester import run_in_both, this_is_js
from flexx import event
loop = event.loop
class MyObject(event.Component):
floatpair = event.FloatPairProp(settable=True)
enum1 = event.EnumProp(('foo', 'bar', 'spam'), settab... |
import urwid
import math
import time
UPDATE_INTERVAL = 0.2
def sin100( x ):
"""
A sin function that returns values between 0 and 100 and repeats
after x == 100.
"""
return 50 + 50 * math.sin( x * math.pi / 50 )
class GraphModel:
"""
A class responsible for storing the data that will be ... |
import posixpath
from perfkitbenchmarker import linux_packages
LMBENCH_DIR = posixpath.join(linux_packages.INSTALL_DIR, 'lmbench')
GIT = 'https://github.com/intel/lmbench.git'
COMMIT = '4e4efa113b244b70a1faafd13744578b4edeaeb3'
def _Install(vm):
"""Installs the Lmbench package on the VM."""
vm.Install('build_t... |
import logging
from august.activity import ActivityType
from august.lock import LockStatus
from august.util import update_lock_detail_from_activity
from homeassistant.components.lock import ATTR_CHANGED_BY, LockEntity
from homeassistant.const import ATTR_BATTERY_LEVEL
from homeassistant.core import callback
from hom... |
import os.path as op
import pytest
import numpy as np
from mne.datasets.testing import data_path
from mne.io import read_raw_nirx
from mne.preprocessing.nirs import optical_density, tddr
from mne.datasets import testing
fname_nirx_15_2 = op.join(data_path(download=False),
'NIRx', 'nirscou... |
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.viz import iter_topography
from mne import io
from mne.time_frequency import psd_welch
from mne.datasets import sample
print(__doc__)
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = io.... |
import hashlib
import hmac
import pytest
from homeassistant import data_entry_flow
from homeassistant.components import mailgun, webhook
from homeassistant.config import async_process_ha_core_config
from homeassistant.const import CONF_API_KEY, CONF_DOMAIN
from homeassistant.core import callback
from homeassistant.s... |
from homeassistant.components import search
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
async def test_search(hass):
"""Test that search works."""
area_reg = await hass.helpers.area_registry.async_get_registry()
device_reg = await hass.helpers.device_re... |
import os
import threading
from typing import List
import av
from homeassistant.core import callback
from .core import PROVIDERS, Segment, StreamOutput
@callback
def async_setup_recorder(hass):
"""Only here so Provider Registry works."""
def recorder_save_worker(file_out: str, segments: List[Segment], conta... |
from .util import async_init_integration
async def test_air_con(hass):
"""Test creation of aircon climate."""
await async_init_integration(hass)
state = hass.states.get("climate.air_conditioning")
assert state.state == "cool"
expected_attributes = {
"current_humidity": 60.9,
"c... |
from homeassistant.setup import ATTR_COMPONENT, EVENT_COMPONENT_LOADED
from tests.async_mock import Mock
from tests.common import mock_platform
async def test_process_integration_platforms(hass):
"""Test processing integrations."""
loaded_platform = Mock()
mock_platform(hass, "loaded.platform_to_check",... |
from typing import Any
from aiopvapi.resources.scene import Scene as PvScene
import voluptuous as vol
from homeassistant.components.scene import Scene
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_HOST, CONF_PLATFORM
import homeassistant.helpers.config_validation as cv
... |
from PyQt5.QtWidgets import QMessageBox
from qutebrowser.utils import log, utils
def _get_name(exc: BaseException) -> str:
"""Get a suitable exception name as a string."""
prefixes = ['qutebrowser', 'builtins']
name = utils.qualname(exc.__class__)
for prefix in prefixes:
if name.startswith(p... |
from homeassistant import config_entries
from homeassistant.helpers.device_registry import async_get_registry as get_dev_reg
from homeassistant.helpers.entity_registry import async_get_registry as get_ent_reg
from .const import DOMAIN
async def remove_devices(bridge, api_ids, current):
"""Get items that are rem... |
import asyncio
from pyotgw.vars import OTGW_ABOUT
from serial import SerialException
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.opentherm_gw.const import (
CONF_FLOOR_TEMP,
CONF_PRECISION,
DOMAIN,
)
from homeassistant.const import CONF_DEVICE, CONF_ID, ... |
import atexit
from functools import partial
import json
import os
import os.path as op
import platform
import shutil
import sys
import tempfile
import re
import numpy as np
from .check import _validate_type, _check_pyqt5_version
from ._logging import warn, logger
_temp_home_dir = None
def set_cache_dir(cache_dir... |
from __future__ import print_function, division
from plumbum import colors
from .termsize import get_terminal_size
from .. import cli
import sys
class Image(object):
__slots__ = "size char_ratio".split()
def __init__(self, size=None, char_ratio=2.45):
self.size = size
self.char_ratio = cha... |
OPTIONS = {
"additional_libs": {
"type": "list",
"default": [],
'description': 'Libs for Phantom, to be added to phantom config file in section "module_setup"',
'schema': {
'type': 'string'
}
},
"address": {
'description': 'Address of target. Form... |
import os
from perfkitbenchmarker import data
from perfkitbenchmarker import vm_util
BLAZE_VERSION = '3.0'
BLAZE_TAR = 'blaze-%s.tar.gz' % BLAZE_VERSION
BLAZE_DIR = '%s/blaze-%s' % (vm_util.VM_TMP_DIR, BLAZE_VERSION)
BLAZE_TAR_URL = (
'https://bitbucket.org/blaze-lib/blaze/downloads/%s' % BLAZE_TAR)
CONFIG_TEMPLA... |
import json
from wled import Device as WLEDDevice, WLEDConnectionError
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_RGB_COLOR,
ATTR_TRANSITION,
ATTR_WHITE_VALUE,
DOMAIN as LIGHT_DOMAIN,
)
from homeassistant.components.... |
import os
import os.path
import sys
import json
import atexit
import shutil
import argparse
import tokenize
import functools
import subprocess
from typing import Iterable, Mapping, MutableSequence, Sequence, cast
from PyQt5.QtCore import QObject, pyqtSignal, QTimer
from PyQt5.QtWidgets import QApplication
try:
im... |
import posixpath
import re
from absl import flags
from perfkitbenchmarker import sample
from perfkitbenchmarker import vm_util
WRK2_URL = ('https://github.com/giltene/wrk2/archive/'
'c4250acb6921c13f8dccfc162d894bd7135a2979.tar.gz')
WRK2_DIR = posixpath.join(vm_util.VM_TMP_DIR, 'wrk2')
WRK2_PATH = posixp... |
import asyncio
import logging
import voluptuous as vol
from homeassistant.components.discovery import SERVICE_FREEBOX
from homeassistant.config_entries import SOURCE_DISCOVERY, SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP
from homeassistant.helpers import ... |
from weblate.checks.same import SameCheck
from weblate.checks.tests.test_checks import CheckTestCase, MockUnit
class SameCheckTest(CheckTestCase):
check = SameCheck()
def setUp(self):
super().setUp()
self.test_good_none = ("%(source)s", "%(source)s", "python-format")
self.test_good_m... |
from unittest.mock import Mock, MagicMock
from kombu.asynchronous.aws.sqs.connection import (
AsyncSQSConnection
)
from kombu.asynchronous.aws.ext import boto3
from kombu.asynchronous.aws.sqs.message import AsyncMessage
from kombu.asynchronous.aws.sqs.queue import AsyncQueue
from kombu.utils.uuid import uuid
fro... |
import os
from babelfish import Language, language_converters
import pytest
from vcr import VCR
from subliminal.providers.tvsubtitles import TVsubtitlesProvider, TVsubtitlesSubtitle
vcr = VCR(path_transformer=lambda path: path + '.yaml',
record_mode=os.environ.get('VCR_RECORD_MODE', 'once'),
ma... |
from app.wraps.login_wrap import login_required
from app import app
from app.utils import ResponseUtil, RequestUtil, StringUtil, JsonUtil, AuthUtil
from app.database.model import WebHook, Server, History
from app.tasks import tasks
# get webhook list
@app.route('/api/webhook/list', methods=['GET'])
@login_required()... |
from typing import Any, Dict
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from .bridge import DynaliteBridge
from .const import DOMAIN, LOGGER
class DynaliteFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a Dynalite config flow."""
VERSION = 1
CON... |
import sys
import mne
import os.path as op
ANONYMIZE_FILE_PREFIX = 'anon'
def mne_anonymize(fif_fname, out_fname, keep_his, daysback, overwrite):
"""Call *anonymize_info* on fif file and save.
Parameters
----------
fif_fname : str
Raw fif File
out_fname : str | None
Output file ... |
import asyncio
from collections import namedtuple
from typing import Any, Dict, List, Optional, Tuple, Union
from zigpy.exceptions import ZigbeeException
import zigpy.zcl.clusters.hvac as hvac
from zigpy.zcl.foundation import Status
from homeassistant.core import callback
from .. import registries, typing as zha_ty... |
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... |
import asyncio
from concurrent.futures import ThreadPoolExecutor
import dataclasses
import logging
import sys
import threading
from typing import Any, Dict, Optional
from homeassistant import bootstrap
from homeassistant.core import callback
from homeassistant.helpers.frame import warn_use
#
# Python 3.8 has signifi... |
from datetime import timedelta
import re
import pytest
from homeassistant.components.frontend import (
CONF_EXTRA_HTML_URL,
CONF_EXTRA_HTML_URL_ES5,
CONF_JS_VERSION,
CONF_THEMES,
DOMAIN,
EVENT_PANELS_UPDATED,
THEMES_STORAGE_KEY,
)
from homeassistant.components.websocket_api.const import T... |
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from . import DATA_SABNZBD, SENSOR_TYPES, SIGNAL_SABNZBD_UPDATED
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the SABnzbd sensors."""
if d... |
import pandas as pd
import pytest
import pytz
from qstrader.simulation.event import SimulationEvent
@pytest.mark.parametrize(
"sim_event_params,compare_event_params,expected_result",
[
(
('2020-01-01 00:00:00', 'pre_market'),
('2020-01-01 00:00:00', 'pre_market'),
... |
import logging
import threading
from pymodbus.client.sync import ModbusSerialClient, ModbusTcpClient, ModbusUdpClient
from pymodbus.transaction import ModbusRtuFramer
import voluptuous as vol
from homeassistant.components.cover import (
DEVICE_CLASSES_SCHEMA as COVER_DEVICE_CLASSES_SCHEMA,
)
from homeassistant.c... |
from .constants import FIFF
from .tag import find_tag, has_tag
from .write import (write_int, start_block, end_block, write_float_matrix,
write_name_list)
from ..utils import logger
def _transpose_named_matrix(mat):
"""Transpose mat inplace (no copy)."""
mat['nrow'], mat['ncol'] = mat['nc... |
import asyncio
import collections
import hashlib
import logging
import time
import urllib.parse
import aiohttp
import async_timeout
from hangups import exceptions
logger = logging.getLogger(__name__)
CONNECT_TIMEOUT = 30
REQUEST_TIMEOUT = 30
MAX_RETRIES = 3
ORIGIN_URL = 'https://hangouts.google.com'
FetchResponse ... |
import json
import logging
from absl import flags
from perfkitbenchmarker import disk
from perfkitbenchmarker import errors
from perfkitbenchmarker import providers
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.configs import option_decoders
from perfkitbenchmarker.providers.openstack import utils as ... |
from flexx import app, event, ui
class ErrorsPy(app.PyComponent):
def init(self):
self.js = ErrorsJS(self)
@event.action
def do_something_stupid(self):
self.raise_error()
def raise_error(self):
raise RuntimeError('Deliberate error')
@event.reaction('!js.b4_pointer_clic... |
import logging
import voluptuous as vol
from webexteamssdk import ApiError, WebexTeamsAPI, exceptions
from homeassistant.components.notify import (
ATTR_TITLE,
PLATFORM_SCHEMA,
BaseNotificationService,
)
from homeassistant.const import CONF_TOKEN
import homeassistant.helpers.config_validation as cv
_LOG... |
from __future__ import unicode_literals, division
import sys
import codecs
import argparse
# hack for python2/3 compatibility
from io import open
argparse.open = open
def create_parser(subparsers=None):
if subparsers:
parser = subparsers.add_parser('segment-char-ngrams',
formatter_class=arg... |
from vine import transform
from .message import AsyncMessage
_all__ = ['AsyncQueue']
def list_first(rs):
"""Get the first item in a list, or None if list empty."""
return rs[0] if len(rs) == 1 else None
class AsyncQueue():
"""Async SQS Queue."""
def __init__(self, connection=None, url=None, mess... |
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... |
class Device(object):
"""
Razer Device (High level not dbus)
"""
def __init__(self, device_id, device_serial, device_dbus_object):
self._parent = None
self._id = device_id
self._serial = device_serial
self._dbus = device_dbus_object
# Register as parent
... |
from pydeconz.sensor import Thermostat
from homeassistant.components.climate import DOMAIN, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
fro... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import json
import unittest
from absl import flags
import mock
from perfkitbenchmarker import context
from perfkitbenchmarker import disk
from perfkitbenchmarker import errors
from perfkitb... |
import logging
import unittest
from unittest import mock
from homeassistant import setup
from homeassistant.components import litejet
import homeassistant.components.switch as switch
from tests.common import get_test_home_assistant
from tests.components.switch import common
_LOGGER = logging.getLogger(__name__)
EN... |
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, String, Text, Boolean
from sqlalchemy_utils import JSONType
from lemur.database import db
from lemur.plugins.base import plugins
from sqlalchemy_utils import ArrowType
class Source(db.Model):
__tablename__ = "sources"
id = Colum... |
import typing
import abc
from matchzoo.engine import base_metric
from matchzoo.engine import parse_metric
class BaseTask(abc.ABC):
"""Base Task, shouldn't be used directly."""
def __init__(self, loss=None, metrics=None):
"""
Base task constructor.
:param loss: By default the first ... |
import unittest
import six
from mock import Mock, call
class TestListing(unittest.TestCase):
def setUp(self):
self.trashdir = Mock()
self.trashinfo_reader = Mock()
self.listing = Listing(self.trashdir, self.trashinfo_reader)
def test_it_should_read_all_trashinfo_from_home_dir(self):
... |
import os.path as op
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
import pytest
import matplotlib.pyplot as plt
from mne import (read_events, Epochs, read_cov, pick_types, Annotations,
make_fixed_length_events)
from mne.io import read_raw_fif
from mne.preprocessing i... |
from . import core as html5
def unescape(val, maxLength = 0):
"""
Unquotes several HTML-quoted characters in a string.
:param val: The value to be unescaped.
:type val: str
:param maxLength: Cut-off after maxLength characters.
A value of 0 means "unlimited". (default)
:type maxLength: int
:returns... |
import os.path as op
import numpy as np
import pytest
from mne import (read_forward_solution, VolSourceEstimate, SourceEstimate,
VolVectorSourceEstimate, compute_source_morph)
from mne.datasets import testing
from mne.utils import (requires_dipy, requires_nibabel, requires_version,
... |
import os
import shutil
from ..core import driver
from ..core import exceptions
from ..core import lru
class Storage(driver.Base):
supports_bytes_range = True
def __init__(self, path=None, config=None):
self._root_path = path or './tmp'
def _init_path(self, path=None, create=False):
p... |
import logging
import voluptuous as vol
from homeassistant.components import mqtt
from homeassistant.helpers.device_registry import EVENT_DEVICE_REGISTRY_UPDATED
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import ATTR_DISCOVERY_HASH, device_trigger
from .discovery import MQTT_DISCOV... |
import unittest
from kalliope.core.Models import Neuron, Signal, Synapse, Brain
from kalliope.signals.mqtt_subscriber import Mqtt_subscriber
from kalliope.signals.mqtt_subscriber.models import Broker, Topic
class TestMqtt_subscriber(unittest.TestCase):
def test_check_mqtt_dict(self):
valid_dict_of_par... |
from pyopenuv import Client
from pyopenuv.errors import OpenUvError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_API_KEY,
CONF_ELEVATION,
CONF_LATITUDE,
CONF_LONGITUDE,
)
from homeassistant.helpers import aiohttp_client, config_validation as ... |
import ntpath
WINDOWS_FIO_DIR = 'fio-3.1-x86'
FIO_ZIP = WINDOWS_FIO_DIR + '.zip'
FIO_URL = 'https://bluestop.org/files/fio/releases/' + FIO_ZIP
def GetFioExec(vm):
return ntpath.join(vm.temp_dir,
'{fio_dir}\\fio.exe --thread'.format(
fio_dir=WINDOWS_FIO_DIR))
def Ge... |
import unittest
import pandas as pd
import numpy as np
from pgmpy.models import SEMGraph, SEM
from pgmpy.estimators import SEMEstimator, IVEstimator
class TestSEMEstimator(unittest.TestCase):
def setUp(self):
self.custom = SEMGraph(
ebunch=[("a", "b"), ("b", "c")], latents=[], err_corr=[], ... |
from homeassistant.helpers.entity import Entity
class IHCDevice(Entity):
"""Base class for all IHC devices.
All IHC devices have an associated IHC resource. IHCDevice handled the
registration of the IHC controller callback when the IHC resource changes.
Derived classes must implement the on_ihc_chan... |
import os.path as op
import pytest
import numpy as np
from numpy.fft import rfft, rfftfreq
from mne import create_info
from mne.datasets import testing
from mne.io import RawArray, read_raw_fif
from mne.io.pick import _pick_data_channels
from mne.preprocessing import oversampled_temporal_projection
from mne.utils i... |
from flask import current_app
from marshmallow import fields, validates_schema, pre_load
from marshmallow import validate
from marshmallow.exceptions import ValidationError
from lemur.schemas import (
PluginInputSchema,
PluginOutputSchema,
ExtensionSchema,
AssociatedAuthoritySchema,
AssociatedRol... |
from datetime import timedelta
import logging
import os
from sense_hat import SenseHat
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_DISPLAY_OPTIONS,
CONF_NAME,
PERCENTAGE,
TEMP_CELSIUS,
)
import homeassistant.helpers.confi... |
import re
from contextlib import contextmanager
from plumbum.commands import CommandNotFound, shquote, ConcreteCommand
from plumbum.lib import _setdoc, ProcInfo, six
from plumbum.machines.local import LocalPath
from tempfile import NamedTemporaryFile
from plumbum.machines.base import BaseMachine
from plumbum.machines.... |
import numpy as np
from ... import pick_types
from ...io import BaseRaw
from ...utils import _validate_type, verbose
from ..nirs import _channel_frequencies, _check_channels_ordered
from ...filter import filter_data
@verbose
def scalp_coupling_index(raw, l_freq=0.7, h_freq=1.5,
l_trans_band... |
import asyncio
from typing import Any, Dict, Optional
from urllib.parse import urlparse
import aiohue
from aiohue.discovery import discover_nupnp, normalize_bridge_id
import async_timeout
import voluptuous as vol
from homeassistant import config_entries, core
from homeassistant.components import ssdp
from homeassist... |
import os
import glob
import diamond.collector
class KSMCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(KSMCollector, self).get_default_config_help()
config_help.update({
'ksm_path': "location where KSM kernel data can be found",
... |
import os
import re
import pytest
from nikola import __main__ as nikola
def test_simple_config(simple_config, metadata_option):
"""Check whether configuration-files without ineritance are interpreted correctly."""
assert simple_config[metadata_option]["ID"] == "conf"
def test_inherited_config(simple_conf... |
from asyncio import run_coroutine_threadsafe
from pysmappee import api
from homeassistant import config_entries, core
from homeassistant.const import CONF_PLATFORM
from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN
class ConfigEntrySmappeeApi(api.SmappeeApi):
"""Provide Smapp... |
import logging
import requests
from starlingbank import StarlingAccount
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entit... |
import unittest
import numpy as np
from chainer import testing
from chainer.testing import attr
from chainercv.datasets import CUBKeypointDataset
from chainercv.utils import assert_is_bbox
from chainercv.utils import assert_is_point_dataset
@testing.parameterize(*testing.product({
'return_bbox': [True, False]... |
from django.db import transaction
from weblate.machinery.base import get_machinery_language
from weblate.memory.models import Memory
from weblate.utils.celery import app
from weblate.utils.state import STATE_TRANSLATED
@app.task(trail=False)
def import_memory(project_id):
from weblate.trans.models import Projec... |
import os
import string
import subprocess
from random import SystemRandom
from urllib.parse import urlparse
from django.conf import settings
from weblate.trans.util import get_clean_env
from weblate.utils.data import data_dir
from weblate.utils.errors import report_error
from weblate.vcs.ssh import SSH_WRAPPER, add_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.