code stringlengths 1 199k |
|---|
"""
take advantage of the example data shipped with pybedtools, but strip out read
names to save (slightly) on file size
"""
import os
import pysam
import pybedtools
import metaseq
x = pysam.Samfile(pybedtools.example_filename('x.bam'))
s = pysam.Samfile('x.bam.tmp', template=x, mode='wb')
for i, r in enumerate(x):
... |
"""gp -- a platform-independent interface to a gnuplot process.
This file imports a low-level, platform-independent interface to the
gnuplot program. Which interface is imported depends on the platform.
There are variations of this file for Unix, the Macintosh, and for
Windows called gp_unix.py, gp_mac.py, and gp_win3... |
from twisted.trial import unittest
from .util import FakeStorage, make_nodemaker
class DifferentEncoding(unittest.TestCase):
def setUp(self):
self._storage = s = FakeStorage()
self.nodemaker = make_nodemaker(s)
def test_filenode(self):
# create a file with 3-of-20, then modify it with a ... |
"""REMOVED: Communities module."""
import warnings
warnings.warn("Communities module has been externalised. "
"Please install 'invenio_communities' package.",
category=UserWarning) |
from matplotlib.axes import Axes
from matplotlib import cbook
from matplotlib.patches import Circle
from matplotlib.path import Path
from matplotlib.ticker import Formatter, Locator, NullLocator, FixedLocator, NullFormatter
from matplotlib.transforms import Affine2D, Affine2DBase, Bbox, \
BboxTransformTo, IdentityT... |
from __future__ import unicode_literals
from django.db import models, migrations
import practice.models.student
class Migration(migrations.Migration):
dependencies = [
('practice', '0026_remove_studentmodel_available_blocks'),
]
operations = [
#migrations.AddField(
# model_name='s... |
import sys
import time
from socket import timeout as socket_timeout_exception
from datetime import datetime
from invenio.bibtask import task_low_level_submission
from invenio.config import (CFG_PREFIX,
CFG_TMPSHAREDDIR,
CFG_LOGDIR)
from os.path import (join,
... |
import os
import opk, cfg, opkgcl
opk.regress_init()
o = opk.OpkGroup()
o.add(Package="x")
o.add(Package="a", Recommends="b, c")
o.add(Package="b")
o.add(Package="c", Conflicts="x")
o.write_opk()
o.write_list()
opkgcl.update()
opkgcl.install("x");
if not opkgcl.is_installed("x"):
opk.fail("Package 'x' installed but... |
import os
from kivy.uix.settings import (
SettingOptions, SettingNumeric, SettingPath, SettingString,
InterfaceWithNoMenu, Settings
)
from kivy.lang import Builder
from libs.programdata import string_lang_yes, string_lang_cancel, string_lang_title
from libs.uix.dialogs import card, input_dialog, file_dialog
fro... |
"""Utility functions for modifying an app's settings file using JSON."""
import json
import logging
def UnicodeToStr(data):
"""Recursively converts any Unicode to Python strings.
Args:
data: The data to be converted.
Return:
A copy of the given data, but with instances of Unicode converted to Python
s... |
"""Competitions for all-play-all tournaments."""
from gomill import ascii_tables
from gomill import game_jobs
from gomill import competitions
from gomill import tournaments
from gomill import tournament_results
from gomill.competitions import (
Competition, CompetitionError, ControlFileError)
from gomill.settings i... |
import socket
import threading
import sys
import time
from datetime import date
HOST = '' # Symbolic name meaning the local host
PORT = 50007 # Arbitrary non-privileged port
if len(sys.argv) > 2:
print "usage : %s [port]" % (sys.argv[0])
sys.exit(-2)
elif len(sys.argv) == 2:
# The user h... |
'''
these tables are generated from the STM32 datasheets for the
STM32F40x
'''
build = {
"CHIBIOS_STARTUP_MK" : "os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk",
"CHIBIOS_PLATFORM_MK" : "os/hal/ports/STM32/STM32F4xx/platform.mk"
}
mcu = {
# location of MCU serial number
'UDID_START'... |
import os
import sys
from datetime import datetime, timedelta
from jinja2 import Template
from openerp import tools
from openerp.osv import fields, orm
def ebay_str_split(s, sep):
if not s:
return list()
if sep == '\n':
s_list = s.splitlines()
else:
s_list = s.split(sep)
d = list... |
"""Test class for default_value_parameter_widget."""
import unittest
from safe.common.parameters.default_value_parameter import (
DefaultValueParameter)
from safe.common.parameters.default_value_parameter_widget import (
DefaultValueParameterWidget)
from safe.test.utilities import get_qgis_app
QGIS_APP, CANVAS,... |
import atexit
import readline
import sys
from contextlib import contextmanager
from tries import multiLevelTries
from tries.exception import pathNotExistsTriesException
from pyshell.addons import std
from pyshell.addons import system
from pyshell.command.procedure import FileProcedure
from pyshell.control import Contro... |
__all__ = ['BaseProcess', 'current_process', 'active_children']
import os
import sys
import signal
import itertools
from _weakrefset import WeakSet
try:
ORIGINAL_DIR = os.path.abspath(os.getcwd())
except OSError:
ORIGINAL_DIR = None
def current_process():
'''
Return process object representing the curre... |
"""
tests for functions in cylc.flow.workflow_events.py
"""
import pytest
from types import SimpleNamespace
from cylc.flow.workflow_events import WorkflowEventHandler
@pytest.mark.parametrize(
'key, expected, scheduler_mail_defined',
[
('handlers', ['stall'], True),
('hotel', None, True),
... |
from __future__ import unicode_literals
import os
import unittest
from shutil import rmtree
from tempfile import mkdtemp
from mach.logging import LoggingManager
from mozbuild.backend.configenvironment import ConfigEnvironment
from mozbuild.frontend.emitter import TreeMetadataEmitter
from mozbuild.frontend.reader import... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
class account_analytic_journal(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_analytic_journal, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time... |
"""Helpers for tests related to emitting events to the tracking logs."""
from datetime import datetime
from django.test import TestCase
from django.test.utils import override_settings
from eventtracking import tracker
from eventtracking.django import DjangoTracker
from freezegun import freeze_time
from pytz import UTC
... |
from twisted.internet import defer
from flumotion.common import testsuite
from flumotion.common import keycards
from flumotion.common.planet import moods
from flumotion.component.bouncers import ipbouncer
from flumotion.test import bouncertest
class TestIPBouncer(bouncertest.BouncerTestHelper):
bouncerClass = ipbou... |
from conans import ConanFile, CMake
import os
class ZlibTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = ("cmake", "cmake_paths")
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
self.run(os.path.join... |
'''
example program that dumps a Mavlink log file. The log file is
assumed to be in the format that qgroundcontrol uses, which consists
of a series of MAVLink packets, each with a 64 bit timestamp
header. The timestamp is in microseconds since 1970 (unix epoch)
'''
import sys, time, os, struct
from optparse import Opti... |
from rtc_handle import *
from BasicDataType_idl import *
from omniORB import any
import time
import commands
import SDOPackage
import socket
import RTM
env = RtmEnv(sys.argv, ["localhost:9898"])
mgr_name = socket.gethostname()+".host_cxt/manager.mgr"
naming = CorbaNaming(env.orb, "localhost:9898")
manager = naming.reso... |
import tvm_ext
import tvm
import tvm._ffi.registry
import tvm.testing
from tvm import te
import numpy as np
def test_bind_add():
def add(a, b):
return a + b
f = tvm_ext.bind_add(add, 1)
assert f(2) == 3
def test_ext_dev():
n = 10
A = te.placeholder((n,), name="A")
B = te.compute((n,), la... |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def glm_mean_residual_deviance():
cars = h2o.import_file(path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv"))
s = cars[0].runif()
train = cars[s > 0.2]
valid = cars[s <= 0.2]
predictors = ["displacement","pow... |
import pygame
from pygame.color import THECOLORS as colours
from pygame.draw import line
from pygame.rect import Rect
from guiShard import guiShard
from history import history
class grid(object):
def __init__(self, surface, x, y, maxw, maxh, xspacing = 75, yspacing = 36):
self.container = None #set by conta... |
import json
import mock
import six
from heat.common import exception
from heat.common import grouputils
from heat.common import template_format
from heat.engine.clients.os import nova
from heat.engine import function
from heat.engine import rsrc_defn
from heat.engine import scheduler
from heat.tests.autoscaling import ... |
"""Tests for tf.contrib.layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers.python.layers import layers as _layers
from tensorflow.python.ops import control_flow_ops
... |
import os
import re
import enum
from oslo_config import cfg
from oslo_log import log as logging
from six.moves import urllib
import webob
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder.i18n import _
from cinder import utils
api_common_opts = [
cfg.IntOpt('osapi_max_limit',
... |
from translator.osc import utils
DEFAULT_TRANSLATOR_API_VERSION = '1'
API_VERSION_OPTION = 'os_translator_api_version'
API_NAME = 'translator'
API_VERSIONS = {
'1': 'translator.v1.client.Client',
}
def make_client(instance):
# NOTE(stevemar): We don't need a client because
# heat-translator itself is a comm... |
"""Module implementing RNN Cells.
This module provides a number of basic commonly used RNN cells, such as LSTM
(Long Short Term Memory) or GRU (Gated Recurrent Unit), and a number of
operators that allow adding dropouts, projections, or embeddings for inputs.
Constructing multi-layer cells is supported by the class `Mu... |
"""Tests for tensorflow.ops.data_flow_ops.FIFOQueue."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import re
import time
import tensorflow.python.platform
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
... |
from math import sqrt, log
from operator import add
import numpy as np
from sklearn.metrics import classification_report
from sklearn.metrics import mean_squared_error
from sklearn.metrics import precision_recall_fscore_support
from sklearn.metrics import confusion_matrix
from pyspark.sql.types import *
from scipy.spat... |
'''
Provide authentication using OpenStack Keystone
:depends: - keystoneclient Python module
'''
from __future__ import absolute_import, print_function
try:
from keystoneclient.v2_0 import client
from keystoneclient.exceptions import AuthorizationFailure, Unauthorized
except ImportError:
pass
def get_auth... |
from debtcollector import moves
from tempest.lib.services.volume.v3 import types_client
TypesClient = moves.moved_class(
types_client.TypesClient, 'TypesClient',
__name__, version="Rocky", removal_version='?') |
IP_FABRIC_VN_FQ_NAME = ['default-domain', 'default-project', 'ip-fabric']
IP_FABRIC_RI_FQ_NAME = IP_FABRIC_VN_FQ_NAME + ['__default__']
LINK_LOCAL_VN_FQ_NAME = ['default-domain', 'default-project', '__link_local__']
LINK_LOCAL_RI_FQ_NAME = LINK_LOCAL_VN_FQ_NAME + ['__link_local__']
def obj_to_json(obj):
return dict... |
from __future__ import absolute_import
from django.db import transaction
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from sentry.api.base import Endpoint, SessionAuthentication
from sentry.api.paginator import OffsetPaginator
from sentry.api.serializers import ser... |
import os
import six
p = (
115792089210356248762697446949407573530086143415290314195533631308867097853951)
order = (
115792089210356248762697446949407573529996955224135760342422259061068512044369)
p256B = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b
baseX = 0x6b17d1f2e12c4247f8bce6e563a440... |
DATE_FORMAT = r'j \de F \de Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = r'j \de F \de Y \a \l\a\s H:i'
YEAR_MONTH_FORMAT = r'F \de Y'
MONTH_DAY_FORMAT = r'j \de F'
SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday
DATE_INPUT_FORMATS = (
# '31/12/2009', '31/12/09'
'%d/... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Metric'
db.create_table('user_metrics_metric', (
('id', self.gf('django.db.models.fields.AutoField')(primar... |
import Bybop_NetworkAL
import struct
import threading
class NetworkStatus:
OK = 0
ERROR = 1
TIMEOUT = 2
class Network(object):
"""
Simple implementation of the ARNetwork protocol.
This implementation does not support intenal fifos. If multiple threads tries to send data on the
same buffer at... |
from nose.tools import eq_, ok_
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from airmozilla.manage import related
from airmozilla.main.models import (
Event,
Tag,
UserProfile,
)
from airmozilla.base.tests.testbase import DjangoTestCase
class RelatedTestCase(Djang... |
import argparse
import optparse
from py_utils import camel_case
class ArgumentHandlerMixIn(object):
"""A structured way to handle command-line arguments.
In AddCommandLineArgs, add command-line arguments.
In ProcessCommandLineArgs, validate them and store them in a private class
variable. This way, each class e... |
from __future__ import absolute_import, division, print_function
from collections import Iterable
from datashape import DataShape
from odo.utils import copydoc
from .expressions import Expr, ndim, symbol
__all__ = 'Transpose', 'TensorDot', 'dot', 'transpose', 'tensordot'
class Transpose(Expr):
""" Transpose dimensi... |
import time
import json
import StringIO
from perf_tools import smoothness_metrics
from telemetry.page import page_measurement
class StatsCollector(object):
def __init__(self, events):
"""
Utility class for collecting rendering stats from traces.
events -- An iterable object containing trace events
"""... |
from __future__ import print_function, division
from sympy.core import S, sympify, expand
from sympy.functions import Piecewise, piecewise_fold
from sympy.functions.elementary.piecewise import ExprCondPair
from sympy.core.sets import Interval
def _add_splines(c, b1, d, b2):
"""Construct c*b1 + d*b2."""
if b1 ==... |
from __future__ import unicode_literals
from rest_framework import renderers
class WookieeRenderer(renderers.JSONRenderer):
media_type = "application/json"
charset = 'utf-8'
format = "wookiee"
lookup = {
"a": "ra",
"b": "rh",
"c": "oa",
"d": "wa",
"e": "wo",
... |
from django.core.urlresolvers import reverse_lazy
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_PATH, 'database.sqlite'),
}
}
STATIC_URL = '/s... |
import time
from zope.interface import implements
from buildbot import interfaces
from buildbot.util.eventual import eventually
class SlaveStatus:
implements(interfaces.ISlaveStatus)
admin = None
host = None
access_uri = None
version = None
connected = False
graceful_shutdown = False
pau... |
import re
def filter_chars(s):
return re.sub(r'[^\x00-\x7F]','?', s) |
import unittest
import sys
import os
import re
import random
from common import cli53_cmd, NonZeroExit
def _f(x):
return os.path.join(os.path.dirname(__file__), x)
class RegexEqual(object):
def __init__(self, r):
self.re = re.compile(r)
def __eq__(self, x):
return bool(self.re.search(x))
cla... |
""" Kafka Constants """
PRODUCE = 0
FETCH = 1
MULTIFETCH = 2
MULTIPRODUCE = 3
OFFSETS = 4 |
import unittest
import chainer
from chainer.dataset import tabular
from chainer import testing
from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
@testing.parameterize(
{'mode': tuple},
{'mode': dict},
{'mode': None},
)
class TestDelegateDataset(unittest.TestCase):
def test_delegate_dat... |
from .protected_item import ProtectedItem
class DPMProtectedItem(ProtectedItem):
"""Additional information on Backup engine specific backup item.
:param backup_management_type: Type of backup managemenent for the backed
up item. Possible values include: 'Invalid', 'AzureIaasVM', 'MAB', 'DPM',
'AzureBa... |
import enigma
import ctypes
import os
class ConsoleItem:
def __init__(self, containers, cmd, callback, extra_args):
self.extra_args = extra_args
self.callback = callback
self.container = enigma.eConsoleAppContainer()
self.containers = containers
# Create a unique name
name = cmd
if name in containers:
... |
''' Provide a base class for Bokeh Application handler classes.
When a Bokeh server session is initiated, the Bokeh server asks the Application
for a new Document to service the session. To do this, the Application first
creates a new empty Document, then it passes this new Document to the
``modify_document`` method of... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('maps', '0002_route'),
]
operations = [
migrations.AlterField(
model_name='route',
name='avg',
field=models.FloatField... |
"""
Interface module to TORQUE (PBS).
@author: Stijn De Weirdt (Ghent University)
@author: Toon Willems (Ghent University)
@author: Kenneth Hoste (Ghent University)
"""
from distutils.version import LooseVersion
import os
import re
import tempfile
from vsc.utils import fancylogger
from easybuild.tools.build_log import ... |
from Components.Harddisk import harddiskmanager
from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
from Tools.Directories import resolveFilename, SCOPE_HDD
from enigma import Misc_Options, setTunerTypePriorityOrder, eEnv;
from SystemInfo impor... |
"""Util functions and classes for cloudstorage_api."""
__all__ = ['set_default_retry_params',
'RetryParams',
]
import copy
import httplib
import logging
import math
import os
import threading
import time
import urllib
try:
from google.appengine.api import urlfetch
from google.appengine.datastor... |
from gnuradio import gr, gr_unittest, filter, blocks
class test_iir_filter(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def test_iir_direct_001(self):
src_data = (1, 2, 3, 4, 5, 6, 7, 8)
fftaps = ()
fbtaps = ()
... |
"""
Start DIRAC component using runsvctrl utility
"""
__RCSID__ = "$Id$"
from DIRAC.Core.Base import Script
Script.disableCS()
Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
'Usage:',
' %s [option|cfgfile] ... [system [service|ag... |
"""
$Id: __init__.py,v 1.1.1.1 2004/06/19 14:54:04 dreamcatcher Exp $
""" |
# -*- coding: utf-8 -*-
import urlparse,urllib2,urllib,re
import os
import sys
import scrapertools
import time
import config
import logger
thumbnail_type = config.get_setting("thumbnail_type")
if thumbnail_type=="":
thumbnail_type="2"
logger.info("thumbnail_type="+thumbnail_type)
if thumbnail_type=="0":
IMAGES... |
from odoo import api, fields, models, _
from odoo.tools.float_utils import float_round, float_is_zero
class AccountInvoice(models.Model):
_inherit = "account.invoice"
timesheet_ids = fields.One2many('account.analytic.line', 'timesheet_invoice_id', string='Timesheets', readonly=True, copy=False)
timesheet_co... |
"""
The AlertManager handles all the libtorrent alerts.
This should typically only be used by the Core. Plugins should utilize the
`:mod:EventManager` for similar functionality.
"""
import logging
from twisted.internet import reactor
import deluge.component as component
from deluge._libtorrent import lt
from deluge.co... |
import json
from django.db import connection
from django.http import HttpResponse
from catmaid.models import UserRole
from catmaid.control.authentication import requires_user_role
@requires_user_role(UserRole.Browse)
def treenode_table_content(request, project_id=None, skid=None):
project_id = int(project_id)
s... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Person.hidden'
db.add_column(u'core_person', 'hidden',
self.gf... |
"""
Course Outline page in Studio.
"""
import datetime
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support... |
from newrelic.agent import wrap_external_trace
def instrument(module):
def tsocket_open_url(socket, *args, **kwargs):
scheme = 'socket' if socket._unix_socket else 'http'
if socket.port:
url = '%s://%s:%s' % (scheme, socket.host, socket.port)
else:
url = '%s://%s' % (... |
"""
Tests for the Shopping Cart Models
"""
from factory import DjangoModelFactory
from mock import patch
from django.test import TestCase
from django.test.utils import override_settings
from django.core import mail
from django.conf import settings
from django.db import DatabaseError
from xmodule.modulestore.tests.djang... |
__author__ = 'noe'
import numpy as np
import unittest
import time
from bhmm.output_models.gaussian import GaussianOutputModel
print_speedup = False
class TestOutputGaussian(unittest.TestCase):
def setUp(self):
nstates = 3
means = np.array([-0.5, 0.0, 0.5])
sigmas = np.array([0.2, 0.2, 0.2... |
import time
class C(object):
def f(self):
for i in xrange(10000):
time.sleep(0)
a = C()
a.f() |
from typing import Optional
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.glue_crawler import AwsGlueCrawlerHook
from airflow.sensors.base import BaseSensorOperator
class AwsGlueCrawlerSensor(BaseSensorOperator):
"""
Waits for an AWS Glue crawler to reach any of the sta... |
from __future__ import absolute_import, division, print_function, unicode_literals
import h2o
from tests import pyunit_utils
import numpy as np
def test_4672():
# Compute means in numpy
width = 4
data = data_fixture(100, width)
data_means = np.mean(data, axis=0)
# Now upload data to H2O and compute ... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListCompanies(Choreography):
def __init__(self, temboo_session):
"""
Create a ne... |
"""
A generic resource for publishing objects via XML-RPC.
Maintainer: Itamar Shtull-Trauring
"""
import sys, xmlrpclib, urlparse
from twisted.web import resource, server, http
from twisted.internet import defer, protocol, reactor
from twisted.python import log, reflect, failure
NOT_FOUND = 8001
FAILURE = 8002
Fault = ... |
from tests.providers.google.cloud.operators.test_vision_system_helper import GCPVisionTestHelper
from tests.providers.google.cloud.utils.gcp_authenticator import GCP_AI_KEY
from tests.test_utils.gcp_system_helpers import CLOUD_DAG_FOLDER, provide_gcp_context, skip_gcp_system
from tests.test_utils.system_tests_class imp... |
import grpc
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities
import store_pb2 as store__pb2
class StoreStub(object):
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.AddItem = channel.unary_un... |
"""
This module contains manipulating baseline test through control utility.
"""
from ducktape.utils.util import wait_until
from ignitetest.services.ignite import IgniteService
from ignitetest.services.utils.control_utility import ControlUtility, ControlUtilityError
from ignitetest.services.utils.ignite_configuration i... |
import layers
__all__ = [
"simple_img_conv_pool",
"sequence_conv_pool",
"glu",
"scaled_dot_product_attention",
]
def simple_img_conv_pool(input,
num_filters,
filter_size,
pool_size,
pool_stride,
... |
"""Support for Radarr."""
import logging
import time
from datetime import datetime, timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
CONF_API_KEY,
CONF_HOST,
CONF_PORT,
CONF_MONITORED_CONDITIONS,
CONF_SSL,
)
fro... |
from time import time
import argparse
import os
from pprint import pprint
import numpy as np
from threadpoolctl import threadpool_limits
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.ensemble import HistGradientBoostingRegressor
from sklearn.ensemble import HistGradientBoostingClassif... |
'''
This module facilitates the process of creating ordered graph skeletons by topologically ordering them automatically.
'''
from graphskeleton import GraphSkeleton
class OrderedSkeleton(GraphSkeleton):
'''
This class represents a graph skeleton (see :doc:`graphskeleton`) that is always topologically ordered.
... |
'''Django static files for jQuery UI''' |
import sys
import string
import json
blink_protocol_path = sys.argv[1]
browser_protocol_path = sys.argv[2]
output_cc_path = sys.argv[3]
output_h_path = sys.argv[4]
header = """\
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// foun... |
from django.db import IntegrityError
from django.test import TestCase
from django.core.exceptions import ValidationError
from oscar.apps.catalogue.models import (Product, ProductClass,
ProductAttribute,
AttributeOption,
... |
from bisect import bisect
from biicode.common.utils.bii_logging import logger
import difflib
from biicode.common.exception import BiiException
def _lcs_unique(a, b):
# set index[line in a] = position of line in a unless
# a is a duplicate, in which case it's set to None
index = {}
for i in xrange(len(a)... |
"""Generate and work with PEP 425 Compatibility Tags."""
from __future__ import absolute_import
import distutils.util
import logging
import platform
import re
import sys
import sysconfig
import warnings
from collections import OrderedDict
import pip._internal.utils.glibc
logger = logging.getLogger(__name__)
_osx_arch_p... |
"""
Simple environment with known optimal policy and value function.
Action 0 then 0 yields 0 reward and terminates the session.
Action 0 then 1 yields 3 reward and terminates the session.
Action 1 then 0 yields 1 reward and terminates the session.
Action 1 then 1 yields 2 reward and terminates the session.
Optimal pol... |
"""
Class containing sanity checks on proteins
Parameters
----------
top : open mm topology object created from prmtop file as
from simtk.openmm.app import AmberPrmtopFile
prmtop = AmberPrmtopFile('../../examples/amber/coords.prmtop')
top = prmtop.topology
"""
import numpy as np
__all__ = ["sa... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: firewalld
short_description: Manage arbitrary ports/services w... |
"""
Tools for working with distributions
"""
import numpy as np
import dask.array as da
from dask.diagnostics import ProgressBar
from hyperspy.external.astroML.bayesian_blocks import bayesian_blocks
from scipy.special import gammaln
from scipy import optimize
def scotts_bin_width(data, return_bins=False):
r"""Retur... |
"""
This module contains multithread-safe cache implementations.
All Caches have
getorbuild(key, builder)
delentry(key)
methods and allow configuration when instantiating the cache class.
"""
from time import time as gettime
class BasicCache(object):
def __init__(self, maxentries=128):
self.maxentri... |
import gdb
class RooCollectionPrinter(object):
"Print a RooAbsCollection"
def __init__(self, val):
self.val = val
self.viz = gdb.default_visualizer(self.val['_list'])
def to_string(self):
ret = "{" + str(self.val.dynamic_type) + " " + str(self.val['_name']) +": "
try:
for name,... |
"""Support for Dexcom sensors."""
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
from homeassistant.helpers.entity import Entity
from .const import COORDINATOR, DOMAIN, GLUCOSE_TREND_ICON, GLUCOSE_VALUE_ICON, MG_DL
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set ... |
from __future__ import annotations
from typing import Union
def foo() -> int | Union[str, bool]:
return 42 |
import os
ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = '/usr/local/Cellar/arm-none-eabi-gcc/7-2017-q4-major/gcc/bin/'
elif CROSS_TOOL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.