text stringlengths 475 200k |
|---|
'''
An example for shared attributes using a central AttributeSharer object
'''
from __future__ import print_function
from shared_attribs import AttributeSharer, shared_attribute, shares_attributes
import gc
# Create an AttributeSharer
sharer1 = AttributeSharer()
# Insert attribute names and their default values in th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## translate script
## generate starting point
## usage : translate receptor ligand [options]
## receptor : receptor file in the reduce model
## ligand : ligand file in the reduce model
## to modify the density, use the -d option (the value must be > 1.0), default=10.0
... |
from typing import Optional, Any
import logging
from ..cmd import ExecResponse
logger = logging.getLogger(__name__) # type: logging.Logger
class CompilationOutcome(object):
"""
Records the outcome of a compilation attempt.
"""
@staticmethod
def from_dict(jsn: Any) -> 'CompilationOutcome':
... |
import re
# These statements don't require a AST regular expression node
m = re.search('(?<=-)\w+', 'spam-egg')
print m.group(0)
re.compile("a").match("ba", 1)
re.split('(\W+)', 'Words, words, words.')
re.sub(r'def\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\(\s*\):', r'static PyObject*\npy_\1(void)\n{', 'def myfunc():')
pattern = '... |
#!/usr/bin/env python2
"""Tests for the dox_parser module.
The parser results are very complex. We rely on parsing Doxygen-style
documentation and then dumping it back into this format.
We write the "full" test with the smallest amount of empty lines possible to
check that the tokenization works well in these corner... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... |
#!/usr/bin/env python
#
# Copyright 2007 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 o... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <[EMAIL]>'
__docformat__ = 'restructuredtext en'
'''
Contains various tweaks that affect calibre behavior. Only edit this file if
you know what you are doing. If you delete this file, it... |
#=========================================================================
# MeshRouterCL_test
#=========================================================================
from __future__ import print_function
import pytest
from pymtl import *
from pclib.test import TestSource, TestNetSink
from pclib.ifcs import ... |
#! /usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozi... |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
import time
log = CPLog(__name__)
class Automation(Plugin):
enabled_option = 'automation_enabled'
interval = 86400
la... |
from pypers.core.step import CmdLineStep
class DseqCount(CmdLineStep):
spec = {
"version" : "0.1.1.2",
"descr": [
"Runs DSEQ Count script which implements a method to test for differential exon usage",
"in comparative RNA-Seq experiments"
],
'url': 'http://bi... |
import os
import urllib.request
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.preprocessing import MinMaxScaler
# Original Date Source =================================================================================================
# Name: Appliances ene... |
import pandas as pd
# create descriptive statistics table
def descriptive_stats(df_offenses):
# disposed cases only
df = df_offenses[df_offenses['CASE DISPOSED STATUS'] == 'DISPOSED']
# select features
df = df[['access',
'BOND $',
'felony priors',
... |
# vim:fileencoding=utf-8:noet
from __future__ import absolute_import
from mercurial import hg, ui, match
class Repository(object):
__slots__ = ('directory', 'ui')
statuses = 'MARDUI'
repo_statuses = (1, 1, 1, 1, 2)
repo_statuses_str = (None, 'D ', ' U', 'DU')
def __init__(self, directory):
self.directory = d... |
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license noti... |
# Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2.
# Note:
# The length of both num1 and num2 is < 110.
# Both num1 and num2 contains only digits 0-9.
# Both num1 and num2 does not contain any leading zero.
# You must not use any built-in BigInteger library or... |
#!/usr/bin/python
"""
== VU Meter Calibration Toolkit ==
==== Pulse Width Modulation and standard RPi.GPIO Library ====
Software PWM
Loop trough the min and max value
uses limited growth function, instead of linear function
Requires:
- RPi.GPIO
MIT License
"""
from __future__ import division
import RPi.GPIO as... |
"""Utilities for search space exploration over linalg operations."""
from itertools import chain
import random
def rand_in_range(value_range):
return random.randrange(value_range.start, value_range.stop, value_range.step)
class Variable:
"Abstract class used as a base for all search variables."
def __init__... |
"""
xModule implementation of a learning sequence
"""
# pylint: disable=abstract-method
import json
import logging
from pkg_resources import resource_string
import warnings
from lxml import etree
from xblock.core import XBlock
from xblock.fields import Integer, Scope, Boolean
from xblock.fragment import Fragment
fr... |
# -*- coding: utf-8 -*-
#/#############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.tech-receptives.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under th... |
#!/usr/bin/python
"""
Created on Fri Jun 24 16:49:07 2016
@author: noel
For a description of the program, type:
python flower.py
"""
import os
import sys
import copy
import optparse
import string
import numpy as np
import em.describe.Molecular_Descriptors as md
import em.manipulate.Molecular_Rigid_Manipulations as MRM
... |
# Copyright 2015 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 a... |
"""
Django settings for django_get_started project.
"""
from os import path
PROJECT_ROOT = path.dirname(path.abspath(path.dirname(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = (
'localhost',
'anextraspace.azurewebsites.net',
)
ADMINS = (
# ('Your Name', '[EMAIL]'),
)
MANAGERS = ADMINS... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
# Yinon Ehrlich, 2009
"""
gcc/llvm detection.
"""
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_gcc(conf):
"""
Find the program gcc, and if present, try to detect its version num... |
import numpy as np
import theano
import theano.tensor as T
class LogisticRegression(object):
"""Multi-class Logistic Regression loss dangler."""
def __init__(self, linear_layer):
"""Dangle a logistic regression from the given linear layer.
The given linear layer should be a HiddenLayer (or su... |
#! /usr/bin/env python
#
# Issue 124, reported by muusclaus
#
# Install package 'a' version 1.0 which depends on package 'b' version 1.0. Then
# make available 'a' version 1.1 which depends on 'b' version 1.1. Attempt to
# upgrade 'b' to version 1.1.
#
# The upgrade should be blocked as the installed version of 'a' (1.... |
import unittest
from mjhmc.samplers.markov_jump_hmc import ContinuousTimeHMC, HMCBase, MarkovJumpHMC, HMC, ControlHMC
from mjhmc.misc.distributions import TestGaussian, Gaussian
import numpy as np
from mjhmc.misc.utils import overrides
n_seed = 1
eps = .05
class TestControl(unittest.TestCase):
"""
Serves as t... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# filemover.py
#
# Copyright 2013 IDex <[EMAIL]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
#... |
import re
from django.shortcuts import render, reverse
from bokeh.embed import components
from bokeh.client import pull_session
from bokeh.embed import server_document
from tethys_compute.models.dask.dask_scheduler import DaskScheduler
def dask_dashboard(request, dask_scheduler_id, page='status'):
dask_object = D... |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-branches
def main():
'''
ansible oc module for services
'''
module = AnsibleModule(
argument_spec=dict(
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
state=dict(default='present'... |
"""DEPRECATED. PyFMI-based model. Superseded by FMPy-based class.
Copyright (c) 2017, University of Southern Denmark
All rights reserved.
This code is licensed under BSD 2-clause license.
See LICENSE file in the project root for license terms.
"""
import logging
from pyfmi import load_fmu
from pyfmi.fmi import FMUExce... |
import re
import boto3
from botocore.exceptions import ClientError
from virga.common import VirgaException
class VirgaClient:
"""VirgaClient substitute the standard AWS client for more complex requests."""
@staticmethod
def find_certificate(resource_object: dict) -> any:
"""
Call boto3/a... |
# $Id: event.py,v 1.7 2007/06/10 14:11:58 mggrant Exp $
#
# Xlib.protocol.event -- definitions of core events
#
# Copyright (C) 2000-2002 Peter Liljenberg <[EMAIL]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... |
from sympy import (
Abs, And, Derivative, Dummy, Eq, Float, Function, Gt, I, Integral,
LambertW, Lt, Matrix, Or, Piecewise, Poly, Q, Rational, S, Symbol,
Wild, acos, asin, atan, atanh, cos, cosh, diff, erf, erfinv, erfc,
erfcinv, exp, im, log, pi, re, sec, sin,
sinh, solve, solve_linear, sqrt, sstr,... |
# Copyright 2020 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 ... |
# --------------------------------------------------------
# TensorFlow @ Dragon
# Copyright(c) 2017 SeetaTech
# Written by Ting Pan
# --------------------------------------------------------
import dragon.config as config
DEFAULT_GRAPH_SEED = 87654321
_MAXINT32 = 2**31 - 1
def _truncate_seed(seed):
return seed ... |
#encoding:utf-8
from utils import weighted_random_subreddit
subreddit = weighted_random_subreddit({
'AbandonedPorn': 593,
'AdPorn': 90,
'AdrenalinePorn': 146,
'AerialPorn': 20,
'AgriculturePorn': 12,
'AlbumArtPorn': 50,
'AnimalPorn': 85,
'ApocalypsePorn': 14,
'ArchitecturePorn': 2... |
#
# Copyright (c) 2009 Brad Taylor <[EMAIL]>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program i... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (t... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
... |
#
# Copyright 2016 The BigDL 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 or agreed to in ... |
import sys
from ..testcase import TestCase
class TestHelp(TestCase):
def test_get_function_list(self):
h = self.geosupport.help(return_as_string=True)
self.assertTrue("1" in h)
self.assertTrue("bbl" in h)
def test_function_help(self):
h = self.geosupport.help("bbl", return_... |
import logging
from collections import defaultdict
import yamlconf
from mw import Namespace, Timestamp, api
from .. import dependencies
from ..datasources import (Datasource, RevisionMetadata, UserInfo,
parent_revision, revision, site, user)
from ..errors import RevisionDocumentNotFound
fro... |
__all__ = [
"release"
]
__doc__ = "Utilities for restarting the optimization"
from Optizelle.Utility import *
from Optizelle.Properties import *
import Optizelle.InequalityConstrained.State
class X_Vectors(list):
"""Holds restart information for the vectors in the vector space X"""
pass
class Z_Vectors(l... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
PROVINCE_CHOICES = (
('01', _('Arava')),
('02', _('Albacete')),
('03', _('Alacant')),
('04', _('Almeria')),
('05', _('Avila')),
('06', _('Badajoz')),
('07', _('Illes Balears')),
('08', _('Barcelon... |
# coding: utf-8
"""
kinto
Kinto is a minimalist JSON storage service with synchronisation and sharing abilities. It is meant to be easy to use and easy to self-host. **Limitations of this OpenAPI specification:** 1. Validation on OR clauses is not supported (e.g. provide `data` or `permissions` in patch ... |
# -*- coding: utf-8 -*-
"""The Python :mod:`datetime` module's documentation describes how
to create a :class:`datetime.datetime`-compatible
:class:`datetime.tzinfo` subtype. It even provides a few examples.
The following module defines usable forms of the timezones in those
docs, as well as a couple other useful ones... |
#
# 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
# ... |
# Copyright (c) 2015,2016,2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test the `nexrad` module."""
import contextlib
from datetime import datetime
from io import BytesIO
import logging
from pathlib import Path
import numpy as np
import py... |
# coding=utf-8
from datetime import timedelta
import pytest
from errbot.backends.test import ShallowConfig
from errbot.bootstrap import CORE_STORAGE, bot_config_defaults
from errbot.backend_plugin_manager import BackendPluginManager
from errbot.storage.base import StoragePluginBase
from errbot.utils import *
from errb... |
#coding=UTF-8
import httplib
import xml.sax
# Парсер погоды с Яндекса
# Хост Яндекса и путь до файла с погодой
YANDEX_WEATHER_HOST = 'export.yandex.ru'
YANDEX_WEATHER_PATH = '/weather-ng/forecasts/{city_id}.xml'
WEATHER_STATE_MAP = {
'weather_type':'weatherInWords',
'wind_direction':'windDirection',
'wind_speed':... |
from ij.gui import GenericDialog
from ij.io import OpenDialog
from ij import IJ
from ij import WindowManager
from ij import ImageStack
from ij import ImagePlus
from ij.measure import ResultsTable
import re
import os
import sys
import shutil
import math
## Function definitions
def parse_tile_info_file(path):
metadata ... |
# coding=utf-8
# Author: Nic Wolfe <[EMAIL]>
# URL: https://SickRage.GitHub.io
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwar... |
# 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 applic... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tests/client/widget/managers.py
#
# 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
# notice, ... |
# 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 agreed to in... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import sys
from kombu.utils.url import _parse_url
from celery.local import Proxy
from celery.state import current_app
from celery.utils.imports import symbol_by_name
from celery.utils.functional import memoize
UNKNOWN_BACKEND = """\
Unknown result backe... |
#!/usr/bin/env python
# The Python version of Qwt-5.0.0/examples/bode
# To get an impression of the expressive power of Numeric,
# compare the Python and C++ versions of setDamp()
import sys
import qt as Qt
import Qwt5 as Qwt
from Qwt5.anynumpy import *
print_xpm = ['32 32 12 1',
'a c #ffffff',
... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [EMAIL], All rights reserved.
# LLNL-CODE-647188
#
# F... |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import gtk
import gobject
import pango
from date_widget import DateEntry
class CellRendererDate(gtk.GenericCellRenderer):
__gproperties__ = {
'text': (gobject.... |
# subusch - The python subtitle downloader
# Copyright (C) 2014 - Gilles RADRIZZI
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... |
import os
def argsProcessor():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--dataPath", help="path to main data folder")
parser.add_argument("-o", "--outputPath", help="output data")
return parser.parse_args()
if __name__ == '__main__':
args = argsProcessor(... |
#!/usr/bin/env python3
import time
from mediawords.db import connect_to_db
from mediawords.job import JobBroker
from mediawords.util.log import create_logger
from mediawords.util.perl import decode_object_from_bytes_if_needed
from extract_and_vector.dbi.stories.extractor_arguments import PyExtractorArguments
from ext... |
#==============================================================================
# DotProductCL_test
#==============================================================================
# TODO: clean this up!!!
import pytest
from pymtl import *
from pclib.test import TestSource, TestMemory
from pclib.ifcs import m... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... |
# coding: utf-8
from __future__ import unicode_literals
import numpy
import pytest
@pytest.fixture
def example(EN):
"""
This is to make sure the model works as expected. The tests make sure that
values are properly set. Tests are not meant to evaluate the content of the
output, only make sure the out... |
#!/usr/bin/env python
import sys
import math
from gnuradio import blocks, filter, gr
from gnuradio.eng_option import eng_option
from optparse import OptionParser
# Load it locally or from the module
try:
import cqpsk
except:
from tetra_demod import cqpsk
# accepts an input file in complex format
# applies f... |
# -*- coding: utf-8 -*-
#
# 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... |
import argparse
import logging
import re
from flask import (
Flask,
abort,
make_response,
redirect,
render_template,
request,
url_for
)
from pygments.lexers import get_all_lexers, get_lexer_by_name
from pygments.formatters.html import HtmlFormatter
from pygments import highlight
import ppa... |
from __future__ import unicode_literals
import functools
from . import base
class TestCase(base.TestCase):
"""
A test case for making assertions about messsages from
django.contrib.messages in the context of a response.
"""
def assertMessage(self, response, content, level=None, tags=None,
... |
"""distutils.command.build_clib
Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module."""
__revision__ = "$Id$"
# XXX this module has *lots* of code ripped-off quite transparently from
# build_ext.py -- not sur... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.data import logger
from lib.core.settings import IS_WIN
from lib.core.settings import PLATFORM
_readline = None
try:
from readline import *
import read... |
#!/usr/bin/env python
###################################
# Author: Kevin Ollivier
# Licence: wxWindows licence
###################################
import os
import re
import sys
import builder
import glob
import optparse
import platform
import shutil
import types
import subprocess
# builder object
wxBuilder = None
... |
"""Lowest-common-denominator implementations of platform functionality."""
from __future__ import absolute_import, division, print_function
import errno
import socket
import time
from tornado.platform import interface
from tornado.util import errno_from_exception
def try_close(f):
# Avoid issue #875 (race condi... |
import copy
import json
import urlparse
import requests
from keystoneclient import exceptions
from keystoneclient.v2_0 import tenants
from tests import utils
class TenantTests(utils.TestCase):
def setUp(self):
super(TenantTests, self).setUp()
self.TEST_REQUEST_HEADERS = {
'X-Auth-Tok... |
def test_click_option(session, inline):
session.url = inline("""
<select>
<option>first
<option>second
</select>""")
options = session.find.css("option")
assert options[0].selected
assert not options[1].selected
options[1].click()
assert options[1].selected
asse... |
# -*- coding: utf-8 -*-
# Импортируем нужные нам библиотеки
import sys, urllib, urllib2, re, os, cookielib, traceback, datetime
import xbmc, xbmcplugin, xbmcgui, xbmcaddon
from DialogXml import *
import __builtin__
def Notificator(title, message, timeout = 500):
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s,... |
#
# Copyright (c) 2015 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distrib... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import add_months, today
from erpnext import get_company_currency
from .blanket_order import make_order
class TestBlank... |
import sqlite3
from random import randint
with sqlite3.connect("cars.db") as conn:
c = conn.cursor()
c.execute("""DROP TABLE IF EXISTS orders""")
c.execute("""CREATE TABLE IF NOT EXISTS orders
(make TEXT, model TEXT, order_date TEXT)
""")
c.execute("SELECT... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# 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',
... |
import base64
import json
from io import BytesIO
from unittest.mock import Mock
import pytest
from flask_annex import Annex
from .helpers import AbstractTestAnnex, assert_key_value, get_upload_info
# -----------------------------------------------------------------------------
try:
import boto3
from moto im... |
from .kern import Kern
from ...core.parameterization import Param
from paramz.transformations import Logexp
import numpy as np
from ...util.multioutput import index_to_slices
class ODE_t(Kern):
def __init__(self, input_dim, a=1., c=1.,variance_Yt=3., lengthscale_Yt=1.5,ubias =1., active_dims=None, name='ode_... |
def kmp(text, pattern):
pattern = list(pattern)
#Partial match" table
t = kmp_partial_match_table(pattern)
def kmp_shift_table(pattern):
shifts = [None] * (len(pattern) + 1)
shift = 1
for pos in range(len(pattern) + 1):
while shift < pos and pattern[pos - 1] != pattern[pos - shift - ... |
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.template import RequestContext
from django.template.response import TemplateResponse
from . import models
def work(request, slug):
"""
:param request: Django request object.
:param event_id: The `id` associated with... |
#!/usr/bin/env python
import numpy as np
from horton import * # pylint: disable=wildcard-import,unused-wildcard-import
# specify the even tempered basis set
alpha_low = 5e-3
alpha_high = 5e2
nbasis = 30
lnratio = (np.log(alpha_high) - np.log(alpha_low))/(nbasis-1)
# build a list of "contractions". These aren't re... |
"""SendGrid notification service."""
import logging
import voluptuous as vol
from sendgrid import SendGridAPIClient
from homeassistant.const import (
CONF_API_KEY,
CONF_RECIPIENT,
CONF_SENDER,
CONTENT_TYPE_TEXT_PLAIN,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.componen... |
from typing import Any
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from confirmation.models import Confirmation, create_confirmation_link
from zerver.lib.response import json_success
from zerver.lib.subdomains import get_subdo... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright 2014-2016 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE 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 ... |
import requests
from scaffold.core.widget import base_widget_extended
from libs.recapture import verify_captcha
#~ from widgets import recaptcha
class control(base_widget_extended):
includes = ['<script src="https://www.google.com/recaptcha/api.js"></script>']
capture_url = 'https://www.google.com/recaptcha/a... |
import os
from django.conf import settings as django_settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.utils.datastructures import SortedDict
from setman import settings
from setman.helpers import get_config
from setman.utils.parsing import is... |
import os, sys, inspect
# use this if you want to include modules from a subfolder
def include_module_path(path):
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],path)))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_s... |
# Copyright (c) 2012 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.
r"""Code to validate and convert settings of the Microsoft build tools.
This file contains code to validate and convert settings of the Microsoft
build tools. Th... |
from builtins import zip
from builtins import str
import logging
from airflow.exceptions import AirflowException
from airflow.hooks import BaseHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class CheckOperator(BaseOperator):
"""
Performs checks against a db. ... |
# -*- coding: utf-8 -*-
import copy
import imp
import inspect
import os
import locale
import logging
from os.path import isabs
logger = logging.getLogger(__name__)
DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)),
"themes/notmyidea"])
_DEFAULT_CONFIG = {'PATH': ... |
import sys, os, yaml, glob
import subprocess
import argparse
def main(args):
workingDir = os.getcwd()
assemblers = sum(args.assemblers, [])
samples_data_dir = args.sample_data_dir
checkSupportedAssemblers(assemblers, args.global_config)
#The specified assembler are supported, at least they are pr... |
"""Tests for the Area Registry."""
import pytest
from homeassistant.core import callback
from homeassistant.helpers import area_registry
from tests.common import flush_store, mock_area_registry
@pytest.fixture
def registry(hass):
"""Return an empty, loaded, registry."""
return mock_area_registry(hass)
@py... |
#!/usr/bin/python
import serial
import time
import random
import sys
s = None
num_leds = 93
play_time = 0
def flush_input():
s.flushInput()
def wait_for_ack():
while s.inWaiting() <= 0:
pass ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.