gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
"""Support for Android IP Webcam."""
import asyncio
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import (
CONF_NAME, CONF_HOST, CONF_PORT, CONF_USERNAME, CONF_PASSWORD,
CONF_SENSORS, CONF_SWITCHES, CONF_TIMEOUT, CONF_SC... | |
import numpy as np
import scipy.special
import lmfit
h = 6.626e-34 # J/s
hbar = 1.054571e-34 #J/s
kB = 1.38065e-23 #J/K
qC = 1.602e-19 # C
kBeV = kB/qC
def sigmas(fres,Tphys,Tc):
wres = fres*2*np.pi
xi = hbar*wres/(2*kB*Tphys)
Delta = 3.52*kB*Tc/2.0
sigma1 = (((4*Delta) / (hbar*wres)) *
... | |
import tempfile
import re
import os.path
from pip.util import call_subprocess
from pip.util import display_path, rmtree
from pip.vcs import vcs, VersionControl
from pip.log import logger
from pip.backwardcompat import url2pathname, urlparse
urlsplit = urlparse.urlsplit
urlunsplit = urlparse.urlunsplit
class Git(Versi... | |
#
# test_base.py
#
# test base class
#
#
import sys
import math
sys.path.append("../common")
from bsg_cache_trace_gen import *
class TestBase:
MAX_ADDR = (2**17)
# default constructor
def __init__(self):
addr_width_p = 30
self.data_width_p = 512/int(sys.argv[1])
self.tg = BsgCacheTraceGen(addr... | |
# -*- coding: utf-8 -*-
import sys
#sys.path.append('/home/camacho/Downloads/emcee-master')
#sys.path.append('/home/up200908455/Desktop/Github/Gedi')
#sys.path.append('/home/up200908455/Desktop/Github/Emcee')
#sys.path.append('/home/up200908455/Desktop/Github/George')
#sys.path.append('/home/up200908455/Desktop/Github/... | |
import logging
from mopidy import models
import spotify
from mopidy_spotify import countries, playlists, translator
from mopidy_spotify.utils import flatten
logger = logging.getLogger(__name__)
ROOT_DIR = models.Ref.directory(uri="spotify:directory", name="Spotify")
_TOP_LIST_DIR = models.Ref.directory(uri="spotif... | |
"""Queries."""
from collections import ChainMap
from sqlalchemy import or_
from sqlalchemy.orm import aliased
from . import db
from .models import (Characteristic, CharacteristicGroup, Country, Data,
EnglishString, Geography, Indicator, Survey, Translation)
# pylint: disable=too-many-public-met... | |
#!/usr/bin/python
# Copyright (c) 2010, Andrej Bauer, http://andrej.com/
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright n... | |
"""
This module is used for creating a ItemLookup response parser from amazon's AWS API.
"""
from base import BaseLookupWrapper, first_element, parse_bool, parse_float, parse_int
class Item(BaseLookupWrapper):
@property
@first_element
def asin(self):
return self.xpath('./a:ASIN/text()')
@pr... | |
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | |
import random
import string
from copy import copy, deepcopy
import json
from time import time
from pprint import pprint
import re
import numpy as np
from regex_finder import findregex
MAX_WIDTH = 13
X, Y, Z = 'x', 'y', 'z'
def main():
for i in range(10):
chars = set(random.sample(string.ascii_uppercase, ... | |
from __future__ import unicode_literals
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import no_oracle
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import override_settings
from django.utils import timezone
if HAS_GEOS... | |
import webapp2
import re
import weakref
from webapp2 import cached_property
from webapp2_extras import sessions
from google.appengine.api import users
from ferris.core.ndb import encode_key, decode_key
from ferris.core.uri import Uri
from ferris.core import inflector, auth, events, views, request_parsers, response_hand... | |
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
import os, sys
from time import time
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.cluster import estimate_bandwidth, MeanShift
import numpy as np
import matplotlib.pyplot as plt
import c... | |
from functools import wraps
from django.conf import settings
from django.db import transaction
from django.shortcuts import get_object_or_404, redirect
from prices import Money, TaxedMoney
from ..account.utils import store_user_address
from ..checkout import AddressType
from ..core.utils.taxes import (
ZERO_MONEY... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | |
#----------------------------------------------------------------------------
# Classes for new input type `desStarCatalog`; intended for use with Balrog,
# but should be extendable.
#
# Contributors:
# Spencer Everett (UCSC)
#----------------------------------------------------------------------------
import galsim
i... | |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
# -*- coding: utf-8 -*-
'''
The rcctl service module for OpenBSD
'''
from __future__ import absolute_import
# Import python libs
import os
# Import salt libs
import salt.utils
import salt.utils.decorators as decorators
from salt.exceptions import CommandNotFoundError
__func_alias__ = {
'reload_': 'reload'
}
# D... | |
# -*- coding: utf-8 -*-
"""
Strongly connected components.
"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
import networkx as nx
__authors__ = "\n".join(['Eben Kenah',
... | |
# -*- test-case-name: twisted.conch.test.test_filetransfer -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
import struct, errno
from twisted.internet import defer, protocol
from twisted.python import failure, log
from common import NS, getNS
from twisted.conch.interfaces import ISFTPSe... | |
"""
Filename: plot_water_budget.py
Author: Damien Irving, irving.damien@gmail.com
Description: Plot climatology and trends in precipitation and evaporation
Input: List of netCDF files to plot
Output: An image in either bitmap (e.g. .png) or vector (e.g. .svg, .eps) format
"""
# Import gener... | |
from collections import Iterable, MutableSequence, Mapping
from numbers import Real, Integral
import warnings
from xml.etree import ElementTree as ET
import sys
from six import string_types
import numpy as np
from openmc.clean_xml import clean_xml_indentation
import openmc.checkvalue as cv
from openmc import Nuclide,... | |
# -*- coding: utf-8 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Angelos Tzotsos <tzotsos@gmail.com>
#
# Copyright (c) 2015 Tom Kralidis
# Copyright (c) 2015 Angelos Tzotsos
#
# Permission is hereby granted, free of charge, to any p... | |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | |
from reviewboard.diffviewer.chunk_generator import RawDiffChunkGenerator
from reviewboard.testing import TestCase
class RawDiffChunkGeneratorTests(TestCase):
"""Unit tests for RawDiffChunkGenerator."""
@property
def generator(self):
"""Create a dummy generator for tests that need it.
Thi... | |
import pygame
import sys, os, random
import numpy as np
import cv2
##
sys.path.append('/usr/local/lib/python2.7/dist-packages/')
import freenect
import imutils
from collections import deque
# Global constants
# Colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLUE = (0, 0, 255)... | |
#!/usr/bin/env python
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | |
#!/usr/bin/env python
# Copyright 2016 DIANA-HEP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | |
import logging
import os
import textwrap
from optparse import Values
from typing import Any, List
import pip._internal.utils.filesystem as filesystem
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.exceptions import CommandError, PipError
... | |
import os
import json
import unittest
from decimal import Decimal
from urllib import urlencode
from urlparse import urlparse
from datetime import date, datetime, timedelta
from mock import Mock
from django.apps import apps
from django.db import models, connection, IntegrityError
from django.db.models import F
from dj... | |
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Helper for adding an include to a source file in the "right" place.
clang-format already provides header sorting functionality; how... | |
from sqlalchemy.testing import assert_raises, \
assert_raises_message, eq_
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy import Integer, String, ForeignKey
from sqlalchemy.testing.schema import Table
from sqlalchemy.testing.schema import Column
from sqlalchemy.orm import mapper, relationshi... | |
"""
This module has all the classes and functions related to waves in optics.
**Contains**
* TWave
"""
from __future__ import print_function, division
__all__ = ['TWave']
from sympy import (sympify, pi, sin, cos, sqrt, Symbol, S,
symbols, Derivative, atan2)
from sympy.core.expr import Expr
from sympy.physics.u... | |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Commander gather Variables to set them with an UpdateList.
The command process can be AllSetsForEach (ie a map of the update succesively for each)
or a EachSetForAll (ie each set is a map of ... | |
import astropy.io.fits as pyfits
import astropy.wcs as pywcs
import os
import numpy as np
import montage_wrapper as montage
import shutil
import sys
import glob
import time
from matplotlib.path import Path
from scipy.ndimage import zoom
from pdb import set_trace
_TOP_DIR = '/data/tycho/0/leroy.42/allsky/'
_INDEX_DIR ... | |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Migrates histogram_suffixes to patterned histograms"""
import argparse
import logging
import os
from xml.dom import minidom
import extract_histograms
im... | |
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | |
"""JSON parser for Stats Perform MA3 feeds."""
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
import pandas as pd
from ...base import MissingDataError
from .base import OptaJSONParser, _get_end_x, _get_end_y, assertget
class MA3JSONParser(OptaJSONParser):
"""Extract data from ... | |
#--- ### Header
bl_info = {
"name": "MORSE scene as Python API (.py)",
"author": "Gilberto Echeverria",
"version": (1, 0, 0),
"blender": (2, 5, 9),
"api": 36147,
"location": "File>Import-Export",
"category": "Import-Export",
"description": "Save a MORSE scene as a Python description",
... | |
from selenium.common.exceptions import StaleElementReferenceException, TimeoutException
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
impor... | |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# TODO: This is fairly repetiive and can definitely be
# condensed into a lot less code, but it's working for now
import numpy as np
import matplotlib.pyplot as plt
from .utils import calc_axis_breaks_and_limi... | |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | |
"""Utillity class for processing scansion and text."""
import unicodedata
import sys
import re
from typing import Dict, List, Tuple
__author__ = ['Todd Cook <todd.g.cook@gmail.com>']
__license__ = 'MIT License'
"""Helper methods for processing scansion"""
qu_matcher = re.compile("[qQ][uU]")
def remove_punctuation_... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
from ryu.base import app_manager
from ryu.lib import hub
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER, CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.lib.packet import packet, ethernet, arp, ... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 HashData Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | |
# Copyright 2014-2015 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
"""
defines all "built-in" classes that implement declarations compare
functionality according to some criteria
"""
import o... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
#!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | |
from gui.plugins.settings.create_simulation_impl import AbstractAddPlugin
import uuid
from tools.ecu_logging import ECULogger
import api
from gui.gui_builder import GBuilder
from PyQt4.Qt import QVBoxLayout
from PyQt4.QtGui import QHBoxLayout
from components.security.ecu.types.impl_ecu_secure import SecureECU, \
St... | |
"""
Functions that ignore NaN.
Functions
---------
- `nanmin` -- minimum non-NaN value
- `nanmax` -- maximum non-NaN value
- `nanargmin` -- index of minimum non-NaN value
- `nanargmax` -- index of maximum non-NaN value
- `nansum` -- sum of non-NaN values
- `nanmean` -- mean of non-NaN values
- `nanvar` -- variance of... | |
"""HTTP websocket server functional tests"""
import asyncio
import pytest
import aiohttp
from aiohttp import web
from aiohttp.http import WSMsgType
@pytest.fixture
def ceil(mocker):
def ceil(val):
return val
mocker.patch('aiohttp.helpers.ceil').side_effect = ceil
async def test_websocket_can_pre... | |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
# Find the best implementation available
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import caffe_pb2
import flask
import lmdb
import PIL.Image
from... | |
"""
JSON serializers for Company app
"""
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from sql_util.utils import SubqueryCount
from InvenTree.serializers import InvenTreeDecimalField
from InvenTree.serializers import InvenTreeImageSerializerField
from InvenTree.seri... | |
#!/usr/bin/env python
# Copyright (c) 2014 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | |
from __future__ import division, print_function
from functools import partial
from itertools import product
from itertools import chain
import numpy as np
import scipy.sparse as sp
import pytest
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import LabelBinarizer
from sklearn... | |
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2008 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# =============================================================================
"""... | |
# Copyright 2014 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | |
#***
#*********************************************************************
#*************************************************************************
#***
#*** GizmoDaemon Config Script
#*** LIRCMceUSB2 MythTV config
#***
#*****************************************
#*****************************************
... | |
from test.lib.testing import eq_, assert_raises, assert_raises_message
import datetime
from sqlalchemy.schema import CreateSequence, DropSequence
from sqlalchemy.sql import select, text, literal_column
import sqlalchemy as sa
from test.lib import testing, engines
from sqlalchemy import MetaData, Integer, String, Foreig... | |
# -*- coding: utf-8 -*-
"""
@file
@brief Defines blogpost directives.
See `Tutorial: Writing a simple extension
<https://www.sphinx-doc.org/en/master/development/tutorials/helloworld.html>`_,
`Creating reStructuredText Directives
<https://docutils.sourceforge.io/docs/howto/rst-directives.html>`_
"""
import os
import sp... | |
"""jsonstreamer provides a SAX-like push parser via the JSONStreamer class and a 'object' parser via the
class which emits top level entities in any JSON object.
Useful for parsing partial JSON coming over the wire or via disk
Uses 'again' python module's 'events.EventSource' framework for event boilerplate
again -> h... | |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | |
#!/usr/bin/env python
# Copyright 2016 the V8 project authors. All rights reserved.
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""MB - the Meta-Build wrapper around GN.
MB is a wrapper script for GN ... | |
import unittest
from pyramid import testing
class NewRequestEventTests(unittest.TestCase):
def _getTargetClass(self):
from pyramid.events import NewRequest
return NewRequest
def _makeOne(self, request):
return self._getTargetClass()(request)
def test_class_conforms_to_INewRequest(... | |
#!/usr/bin/env python
# Copyright 2015 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | |
"""
If you find this kernel helpful please upvote. Also any suggestion for improvement will be warmly welcomed.
I made cosmetic changes in the [code](https://www.kaggle.com/aharless/kaggle-runnable-version-of-baris-kanber-s-lightgbm/code).
Added some new features. Ran for 25mil chunk rows.
Also taken ideas from vario... | |
# coding: utf-8
"""
PhraseApp
PhraseApp API for the interaction with the PhraseApp localization platform
OpenAPI spec version: 2.0
Contact: support@phraseapp.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import io
import json
im... | |
import os
from base64 import b64encode
from django.conf import settings
from django.core.files.storage import default_storage as storage
import mock
import pytest
from olympia import amo
from olympia.amo.tests import addon_factory
from olympia.versions.models import VersionPreview
from olympia.versions.tasks import ... | |
"""
=======================================
Simulate raw data using subject anatomy
=======================================
This example illustrates how to generate source estimates and simulate raw data
using subject anatomy with the :class:`mne.simulation.SourceSimulator` class.
Once the raw data is simulated, gener... | |
# -*- coding: utf-8 -*-
from functools import update_wrapper
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from django.utils.six.moves.urllib.parse import urljoin
from cms import c... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | |
"""Test the Universal Devices ISY994 config flow."""
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components import ssdp
from homeassistant.components.isy994.config_flow import CannotConnect
from homeassistant.components.isy994.const import (
CONF_IGNORE_STRING,
CONF_REST... | |
from gusto import *
from gusto import thermodynamics
from firedrake import (as_vector, SpatialCoordinate,
PeriodicRectangleMesh, ExtrudedMesh,
exp, cos, sin, cosh, sinh, tanh, pi, Function, sqrt)
import sys
day = 24.*60.*60.
hour = 60.*60.
dt = 30.
if '--running-tests' in ... | |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | |
#! /usr/bin/env python
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
times. See also Tim Peters' introduction to the Algorithms chapter in
the Python Cookbook, published by O'Reilly.
Library usage: see the Timer class.
Command line ... | |
#!/usr/bin/python3.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by app... | |
# pylint: disable=line-too-long, no-member
from __future__ import division
from builtins import str # pylint: disable=redefined-builtin
import csv
import io
import json
import tempfile
import time
from zipfile import ZipFile
from past.utils import old_div
import arrow
import requests
from django.utils import tim... | |
# coding: utf-8
import math
VERSION = "3.2"
H_KEY = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
H_BASE = 20037508.34
H_DEG = math.pi * (30 / 180.0)
H_K = math.tan(H_DEG)
def calcHexSize(level):
return H_BASE / (3.0 ** (level + 3))
class Zone:
def __init__(self, lat, lon, x, y, code):
sel... | |
"""Test the Kodi config flow."""
import pytest
from homeassistant import config_entries
from homeassistant.components.kodi.config_flow import (
CannotConnectError,
InvalidAuthError,
)
from homeassistant.components.kodi.const import DEFAULT_TIMEOUT, DOMAIN
from .util import (
TEST_CREDENTIALS,
TEST_DIS... | |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
#!/usr/bin/env python
"""
Construct a neural network model, support vector and decision trees regression models from the data
"""
import pickle
import lasagne
import numpy as np
import sklearn
from lasagne.layers import DenseLayer
from lasagne.layers import InputLayer
from nolearn.lasagne import NeuralNet
from scipy... | |
# 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 at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | |
"""
MultipathDevices - command ``multipath -v4 -ll``
================================================
This function converts the output of the ``multipath -v4 -ll`` command and
stores the data around each multipath device given.
Examples:
>>> mpaths = shared[MultipathDevices]
>>> len(mpaths) # Can treat the ... | |
__author__ = 'Elahe'
import sqlite3 as lite
import csv
import numpy as np
import ephem
import NightDataGenerator as ndg
''' Connect to the FBDE data base '''
def DBreadNwrite(key, Date, Site, **keyword_parameters):
'''**keyword_parameters
sessionID
'''
if key == 'w':
FBDEcon = lite.connect(... | |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from errno import EACCES, ENOENT, EPERM
from functools import reduce
from logging import getLogger
from os import listdir
from os.path import basename, dirname, join
from tarfile import ReadError
from conda._ven... | |
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined
otherwis... | |
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import time
import tempfile
import warnings
import tables
from tables import Group, Leaf, Table, Array
from tables import StringCol, IntCol, Int16Col, FloatCol, Float32Col
from tables.tests impor... | |
# -*- coding: utf-8 -*-
'''Test cases for the ``ldap`` state module
This code is gross. I started out trying to remove some of the
duplicate code in the test cases, and before I knew it the test code
was an ugly second implementation.
I'm leaving it for now, but this should really be gutted and replaced
with somethi... | |
# Ryu Izawa
# Written 2017-10-15
# Last updated 2017-11-05
import csv
import math
import json
import string
import random
import os.path
import numpy as np
import pandas as pd
import urllib, urllib2
start_latitude = 40.363377
start_longitude = -74.013535
start_latitude = None
start_longitude = None
# Google Map... | |
"""
DataTypes used by this provider
"""
import inspect
import ipaddress
import logging
import os
import re
try:
from urllib.parse import urlparse
from urllib.parse import urljoin
except ImportError: # python 2
from urlparse import urlparse
from urlparse import urljoin
from keystoneclient.v3.regions i... | |
#!/usr/bin/python
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""Module to manage IDL files."""
import copy
import pickle
import logging
import os
im... | |
# stdlib
from types import ListType
import time
# 3p
from mock import Mock
from nose.plugins.attrib import attr
import pymongo
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest, load_check
PORT1 = 37017
PORT2 = 37018
MAX_WAIT = 150
GAUGE = AgentCheck.gauge
RATE = AgentCheck.rate... | |
# Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
import os
import sys
import six
import unittest2 as unittest
from mock.tests import support
from mock.tests.support import SomeClass, is_instance, callable
from mock impo... | |
"""The test for the History Statistics sensor platform."""
# pylint: disable=protected-access
from datetime import datetime, timedelta
import unittest
from unittest.mock import patch
import pytest
import pytz
from homeassistant.const import STATE_UNKNOWN
from homeassistant.setup import setup_component
from homeassista... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.