gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
#!/usr/bin/env python
# Copyright 2010 Google Inc. All Rights Reserved.
"""Implements VFSHandlers for files on the client."""
import logging
import os
import platform
import re
import sys
import threading
from grr.client import client_utils
from grr.client import vfs
from grr.lib import utils
from grr.lib.rdfvalues i... | |
# Copyright 2013 Red Hat, 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 a... | |
# -*- coding: utf-8 -*-
import datetime
import json
import os
import os.path
import requests
from . import sitecfg
esi_proxies = None
def set_esi_proxies(proxies: dict):
global esi_proxies
esi_proxies = proxies
class ESIException(Exception):
def __init__(self, msg: str = ''):
self.msg = msg
... | |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import operator
import uuid
from functools import reduce
from itertools import chain
from django.conf import settings
from django.contrib import messages
from django.contrib.admin.models import ADDITION, CHANGE, LogEntry
from django.contrib.auth.decorat... | |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=1>
# probfit Basic Tutorial
# <markdowncell>
# [probfit](http://iminuit.github.io/probfit/) is a modeling / fitting package to be used together with [iminuit](http://iminuit.github.com/iminuit/).
#
# This tutorial is a fast-paced introduction ... | |
import pytest
from eth_utils import (
add_0x_prefix,
decode_hex,
remove_0x_prefix,
to_canonical_address,
to_checksum_address,
to_normalized_address,
)
from eth_accounts.ciphers import ciphers
from eth_accounts.kdfs import kdfs
from eth_accounts.validation import validate_keystore
from eth_acco... | |
# Copyright 2014 Open Source Robotics Foundation, 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... | |
# Copyright 2015 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... | |
import numpy as np
import pytest
from pandas import Float64Index, Int64Index, Series, UInt64Index
import pandas._testing as tm
@pytest.fixture
def index_large():
# large values used in UInt64Index tests where no compat needed with Int64/Float64
large = [2 ** 63, 2 ** 63 + 10, 2 ** 63 + 15, 2 ** 63 + 20, 2 **... | |
# Lint as: python3
# Copyright 2019 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 ... | |
# Copyright 2020 Google LLC
#
# 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 writing, ... | |
# Copyright 2015 Myriam Johnson
#
# 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 wri... | |
#!python
import argparse
import os
import cherrypy
import platform
import signal
import sys
import types
import ws4py.server
import tangelo
import tangelo.server
import tangelo.util
import tangelo.websocket
tangelo_version = "0.8.1-dev"
def tangelo_pkgdata():
print get_pkgdata_dir()
return 0
def tangelo_... | |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... | |
# Copyright 2008-2011 WebDriver committers
# Copyright 2008-2011 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 requ... | |
# Copyright 2020. ThingsBoard
#
# 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 ... | |
import sys
import time
import unittest
from django.conf import settings
from django.db import transaction, connection
from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError
from django.test import (TransactionTestCase, skipIfDBFeature,
skipUnlessDBFeature)
from django.utils.functional import... | |
##
# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy... | |
import django
from django.conf.urls import patterns, include
from django.core.exceptions import ValidationError
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.db import model... | |
"""
Module for applying conditional formatting to
DataFrames and Series.
"""
from collections import defaultdict
from contextlib import contextmanager
import copy
from functools import partial
from itertools import product
from uuid import uuid1
import numpy as np
from pandas.compat import range
from pandas.util._de... | |
#
# 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... | |
"""
This module exposes everything needed to generate a standard django form class
from a formidable object.
Given a formidable object, you can use :func:`get_dynamic_form_class` to get
its corresponding django form class.
"""
from collections import OrderedDict
from django import forms
from django.db.models import ... | |
# 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 ... | |
'''
Channels is where we store information for mapping virtual (qubit) channel to
real channels.
Split from Channels.py on Jan 14, 2016.
Moved to SQLAlchemy ORM from atom 2018
Original Author: Colm Ryan
Modified By: Graham Rowlands
Copyright 2016-2018 Raytheon BBN Technologies
Licensed under the Apache License, Ver... | |
#!/usr/bin/env python
#
# Utility script for ESP-IDF developers to work with the CODEOWNERS file.
#
# SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import re
import subprocess
import sys
from idf_ci_utils import IDF_PATH
CODEOWNE... | |
#!/usr/bin/env python
"""Tests for API client and hunts-related API calls."""
import csv
import io
import os
import stat
import zipfile
from absl import app
from grr_response_core.lib import rdfvalue
from grr_response_core.lib.rdfvalues import timeline as rdf_timeline
from grr_response_core.lib.util import chunked
f... | |
import os
import struct
import re
import sys
from xml.dom.minidom import parseString
generalDir = 'E:\\programming\\Node\\POESkillTree\\'
spellDir = generalDir + "spellsHTML\\"
attackDir = generalDir + "attacksHTML\\"
spells = []
attacks = []
dirs = [spellDir, attackDir]
f_escape = open(generalDir+"\POEspellDmgCalcula... | |
#
# This file is part of pySMT.
#
# Copyright 2014 Andrea Micheli and Marco Gario
#
# 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
... | |
# Copyright 2016 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.
import logging
import os
import re
import sys
from gpu_tests import gpu_helper
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
fr... | |
# 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 writing, software
# distributed under the Li... | |
import datetime
from django import http
from django.contrib import messages
from django.shortcuts import render, redirect, get_object_or_404
from django.utils import timezone
from django.db import transaction
from django.core.urlresolvers import reverse
from airmozilla.main.models import (
Event,
Template,
... | |
#!/usr/local/bin/python
import sys, os, time, traceback
from pyomo.environ import *
from pyomo.opt import SolverFactory, SolverStatus, TerminationCondition
def add_relative_path(*parts):
""" Adds a new path to sys.path.
The path should be specified relative to the current module,
and specified as a list... | |
# coding: utf-8
# In[ ]:
from __future__ import print_function
import numpy as np
from datetime import datetime as dt
from sklearn.linear_model import LogisticRegression
import pickle
import sys
import os
import errno
from rankpruning import RankPruning, other_pnlearning_methods
from util import get_dataset, dow... | |
from collections.abc import Iterable
from jsonschema.compat import str_types
from loguru import logger
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.cached_input import cached
logger = logger.bind(name='from... | |
#!/usr/bin/env python
"""Preprocess Amazon movies data to use as training or test data in the LSTM NN"""
import pandas as pd
import numpy as np
import gc
from nltk.tokenize.casual import TweetTokenizer
import emoji
from usherwood_ds.nlp.processing.word_embedding import WordEmbedding
__author__ = "Peter J Usherwoo... | |
# Webhooks for external integrations.
import logging
import re
from typing import Any, Dict, List, Optional, Tuple
import ujson
from django.conf import settings
from django.db.models import Q
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator imp... | |
#!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import gyp.input
import optparse
import os.path
import re
import shlex
import sys
import traceback
# Default debug modes for GY... | |
#!/usr/bin/python3 -u
import os
import numpy as np
import matplotlib as mpl; mpl.use('Agg'); print("plot WITHOUT Xserver"); # this makes it run without Xserver (e.g. on supercomputer) # see http://stackoverflow.com/questions/4931376/generating-matplotlib-graphs-without-a-running-x-server
import matplotlib.pyplot as p... | |
from collections import namedtuple
from enum import IntEnum, Enum
import os
ROOT_DIRECTORY = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)),
os.path.pardir)
)
DATA_DIRECTORY = os.path.join(ROOT_DIRECTORY, 'data')
# -------------------------------------------------------... | |
import taichi.lang
from taichi._lib import core as _ti_core
from taichi.lang.util import python_scope, to_numpy_type, to_pytorch_type
class Field:
"""Taichi field with SNode implementation.
A field is constructed by a list of field members.
For example, a scalar field has 1 field member, while a 3x3 matr... | |
# Copyright 2021 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | |
import sys
import json
import time
"""
Requirements:
users want to filter log messages by
severity (e.g. warn, info, debug, trace)
and / or
topic (e.g. p2p, vm)
topical logs may cross module boundaries
lazy logging (i.e. lazy evaluation of expensive log messages)
logs should be consumable by software
"""
#HOWTO:... | |
# Copyright (c) 2021 PaddlePaddle 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 appli... | |
# Copyright 2013: Mirantis 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 b... | |
#!/usr/local/bin/python
import copy, datetime, glob, os, re, stat, sys, time
import cmdline
import crcfile
import deanlib
import filelib
SHORT_HELP = '''dispatch <controls> <filters> <src> <dest> <files>'''
LONG_HELP = '''dispatch <controls> <filters> <src> <dest> <files>
Controls | Filters ... | |
# Copyright 2012 OpenStack Foundation
#
# 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... | |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a mxcoind or Mxco... | |
from typing import Callable
from pp.components.grating_coupler.elliptical_trenches import grating_coupler_te
from pp.components.grating_coupler.elliptical_trenches import grating_coupler_tm
import pp
from pp.add_tapers import add_tapers
from pp.components.taper import taper
from pp.container import container
from pp.... | |
#!/usr/bin/env python
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016,2018
import unittest
import sys
import itertools
import tempfile
import os
import uuid
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
def _create_tf():
with tempfile.NamedTemporaryFile(delete=Fal... | |
# # header
# coding: utf-8
if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
SHOWLINES = True
class Token(object):
__slots__ = 'start_mark', 'end_mark', '_comment',
def __init__(self, start_mark, end_mark):
# type: (Any, Any) -> None
self.start_mark = start_mark
... | |
# 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... | |
# Copyright 2010 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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.apach... | |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | |
# 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 ... | |
from __future__ import division, print_function, absolute_import
import os
import numpy as np
from numpy import array, asarray, pi, sin, cos, arange, dot, ravel, sqrt, round
from numpy.testing import (assert_equal, assert_allclose, assert_,
TestCase, run_module_suite, assert_almost_equal,
... | |
from scipy.sparse import csr_matrix, coo_matrix, diags
from scipy.sparse import isspmatrix
import random
class WordSaladMatrixBuilder():
"""Aids in the construction of a WordSaladMatrix. The WordSaladMatrix object
has some finicky requirements and this object helps construct one in a
reasonably efficient ... | |
import pytest
import operator
import numpy as np
from numpy.testing import assert_allclose
import scipy.sparse.linalg as spla
import quimb as qu
import quimb.tensor as qtn
from quimb.tensor import (
bonds,
tensor_contract,
tensor_direct_product,
Tensor,
TensorNetwork,
rand_tensor,
MPS_rand... | |
#
# Copyright 2014 Quantopian, 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 wr... | |
# -*- coding: utf-8 -*-
"""
flask.ctx
~~~~~~~~~
Implements the objects required to keep the context.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
from functools import update_wrapper
from werkzeug.excep... | |
"""
deviantart.api
^^^^^^^^^^^^^^
A Python wrapper for the DeviantArt API
:copyright: (c) 2015 by Kevin Eichhorn
"""
from __future__ import absolute_import
try:
from urllib import urlencode
from urllib2 import HTTPError
except ImportError:
from urllib.parse import urlencode
f... | |
#Distributed under the MIT licesnse.
#Copyright (c) 2014 Dave McCoy (dave.mccoy@cospandesign.com)
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#this software and associated documentation files (the "Software"), to deal in
#the Software without restriction, including without limitati... | |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
# Tests M3U8 class to make sure all attributes and methods use the correct
# data returned from parser.parse()
import arrow
import dat... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | |
from corehq.apps.accounting.utils import domain_is_on_trial
from corehq.apps.reminders.models import (Message, METHOD_SMS,
METHOD_SMS_CALLBACK, METHOD_SMS_SURVEY, METHOD_IVR_SURVEY,
METHOD_EMAIL, CaseReminderHandler, EmailUsage)
from corehq.apps.groups.models import Group
from corehq.apps.hqwebapp.tasks import ... | |
#
# 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 writing, software
# ... | |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""An implementation of a data store based on mysql."""
import Queue
import re
import thread
import threading
import time
import MySQLdb
from MySQLdb import cursors
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import data_store
f... | |
#!/usr/bin/python
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['st... | |
#!/usr/bin/python
import sys
import time
import serial
from serial.serialutil import SerialException
bootloader_error_codes = {
'0' : "OK",
'1' : "Intel HEX Invalid",
'2' : "Bad Checksum",
'3' : "Bad Address",
'4' : "Bad Record Type",
'5' : "Record Too Long"
}
def download_code(ihx_file, serial_port):
... | |
#!/usr/bin/env python
"""
Implementation of the p9sk1 authentication.
This module requires the Python Cryptography Toolkit from
http://www.amk.ca/python/writing/pycrypt/pycrypt.html
"""
import socket
import random
from Crypto.Cipher import DES
import py9p
class Error(py9p.Error):
pass
class AuthError(Error)... | |
# -*- coding: utf-8 -*-
# Unfortunately, we have to fix a few App Engine bugs here because otherwise
# not all of our features will work. Still, we should keep the number of bug
# fixes to a minimum and report everything to Google, please:
# http://code.google.com/p/googleappengine/issues/list
from google.appengine.ex... | |
"""
Module containing classes for high-level network parameters and methods
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import next
from builtins import open
from builtins import range
# requir... | |
# Copyright 2018 The TensorFlow Probability 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... | |
# Standard imports
import logging
import math
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy
from sklearn import metrics
import sys
from numpy import cross
from numpy.linalg import norm
import emission.storage.decorations.trip_queries as esdtq
import emission.storage.decorations.se... | |
import multiprocessing
import threading
import Queue
import signal, os
import time
"""
Runs a callable with given arguments and put the results on a queue.
@param queue The queue to put the results on
@param target The callable to run
@param args Arguments for the callable
@param kwargs Keyword arguments for the cal... | |
# Copyright (C) 2013 Nippon Telegraph and Telephone 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
#
# Unless required by appli... | |
# =============================================================================
# PROJECT CHRONO - http://projectchrono.org
#
# Copyright (c) 2014 projectchrono.org
# All rights reserved.
#
# Use of this source code is governed by a BSD-style license that can be found
# in the LICENSE file at the top level of the distr... | |
"""
Handlers for keys related to number theory: prime, even, odd, etc.
"""
from sympy.assumptions import Q, ask
from sympy.assumptions.handlers import CommonHandler
from sympy.ntheory import isprime
class AskPrimeHandler(CommonHandler):
"""
Handler for key 'prime'
Test that an expression represents a prime... | |
"""The tests for the Tasmota light platform."""
import copy
import json
from unittest.mock import patch
from hatasmota.const import CONF_MAC
from hatasmota.utils import (
get_topic_stat_result,
get_topic_tele_state,
get_topic_tele_will,
)
from homeassistant.components import light
from homeassistant.compo... | |
# encoding: utf-8
# FastCGI-to-WSGI bridge for files/pipes transport (not socket)
#
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <allan@saddi.com>
# Copyright (c) 2011 - 2013 Ruslan Keba <ruslan@helicontech.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modif... | |
from tethys_sdk.testing import TethysTestCase
from tethys_apps.models import TethysApp, PersistentStoreDatabaseSetting, PersistentStoreService
from django.core.exceptions import ValidationError
from django.conf import settings
from tethys_apps.exceptions import TethysAppSettingNotAssigned, PersistentStorePermissionErro... | |
"""
TeamDataCapsule
^^^^^^^^^^^^^^^
"""
import math
from collections import defaultdict
import rospy
from humanoid_league_msgs.msg import Strategy, TeamData
from geometry_msgs.msg import PointStamped
class TeamDataCapsule:
def __init__(self):
self.bot_id = rospy.get_param("bot_id", 1)
self.strate... | |
# Copyright 2020-2022 Google, LLC.
#
# 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 writ... | |
"""Support for Tado sensors for each zone."""
import logging
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_WINDOW,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.c... | |
# 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 writing, software
# distrib... | |
# 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 ... | |
'''
Created on Jul 18, 2011
@author: sean
'''
from ...asttools import Visitor, visit_children
import _ast
from ...asttools.visitors.symbol_visitor import get_symbols
try:
from networkx import DiGraph
except ImportError:
DiGraph = None
def collect_(self, node):
names = set()
for child in self.children... | |
"""Test zha sensor."""
from unittest import mock
import pytest
import zigpy.zcl.clusters.general as general
import zigpy.zcl.clusters.homeautomation as homeautomation
import zigpy.zcl.clusters.measurement as measurement
import zigpy.zcl.clusters.smartenergy as smartenergy
from homeassistant.components.sensor import D... | |
import os, sys
import pygame
from utils import Util
from pygame.locals import *
from threading import Timer
import threading
from sprite import *
import random
import sound
class RockSpanTimer(threading.Thread):
def __init__(self, controller, interval):
threading.Thread.__init__(self)
self.event = threading.... | |
import numpy as np
from numpy.random import normal
from namedlist import namedlist
from collections import namedtuple, ChainMap
pi = np.pi
pi2 = 2*pi
__all__ = ['SyntheticECG']
def get_respiratory_phase(num_samples, sampling_rate, frequency=15.0/60.0, stdev_factor=0.05):
"""
Returns:
array[num_sam... | |
from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:10332")
... | |
# Copyright (c) 2013-2014 Rackspace, 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 ... | |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | |
import os
import shutil
from django.db import models
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models.signals import post_save, post_delete, class_prepared
from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT, DATETIME
from whoosh.index import creat... | |
# coding: utf-8
"""
Tts API
Description # noqa: E501
The version of the OpenAPI document: 2.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_tts.configuration import Configuration
... | |
# Mini-project #6 - Blackjack
import simplegui
import random
# load card sprite - 936x384 - source: jfitz.com
CARD_SIZE = (72, 96)
CARD_CENTER = (36, 48)
card_images = simplegui.load_image("http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png")
CARD_BACK_SIZE = (72, 96)
CARD_BACK_CENTER = (36, 48)
card_... | |
import argparse
import calendar
import datetime as dt
import time
import tabulate
import pykafka
from pykafka.protocol import PartitionOffsetCommitRequest
#
# Helper Functions
#
def fetch_offsets(client, topic, offset):
"""Fetch raw offset data from a topic.
:param client: KafkaClient connected to the clu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.