content stringlengths 4 20k |
|---|
#!/usr/bin/env python
# coding: utf8
from optparse import OptionParser
from struct import pack,unpack
import subprocess
import sys
import os
import io
class Helper(object):
def __htonq(self, value):
#
# convert little-endian to big-endian
#
if sys.byteorder == 'big':
... |
# coding: utf-8
from __future__ import unicode_literals
from .adobepass import AdobePassIE
from ..utils import (
int_or_none,
smuggle_url,
update_url_query,
)
class ScrippsNetworksWatchIE(AdobePassIE):
IE_NAME = 'scrippsnetworks:watch'
_VALID_URL = r'https?://watch\.(?:hgtv|foodnetwork|travelchan... |
import sys
from walletgenie_plugins import BasePlugin, BasePluginCoin
from walletgenie_plugins import WalletGenieConfig, WalletGenieConfigurationError, WalletGenieImportError
try:
from bitcoinrpc.authproxy import AuthServiceProxy
except ImportError:
print('Unable to import bitcoinrpc, install it with: `pip install p... |
"""
Main xmpppy mechanism. Provides library with methods to assign different handlers
to different XMPP stanzas.
Contains one tunable attribute: DefaultTimeout (25 seconds by default). It defines time that
Dispatcher.SendAndWaitForResponce method will wait for reply stanza before giving up.
"""
import simplexml,time,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import json
import textwrap
import intelmq.lib.harmonization
from intelmq import HARMONIZATION_CONF_FILE
print("""
Harmonization field names
=========================
|Section|Name|Type|Description|
|:------|:---|:---|:----------|""")
with open(HARMONIZATION_C... |
import math
import scipy.signal
import numpy
def result():
start = 0e-6 # part used for amplitude calculation
end = 50e-6 #
# ------------------------------------------------------------------------------
mag = MeasurementResult("Amplitude")
for timesignal ... |
import base64
import psycopg2
import openerp
from openerp import SUPERUSER_ID
from openerp import http
from openerp.http import request
from openerp.addons.web.controllers.main import content_disposition
import mimetypes
class MailController(http.Controller):
_cp_path = '/mail'
@http.route('/mail/download_a... |
from __future__ import print_function
from Numberjack import *
# Job Shop Scheduling
# Given a set of N job of various sizes, the job shop scheduling problem is to
# schedule these on M machies such that the overall makespan is minimized. The
# makespan is the total length of the schedule.
#
# This example using dic... |
import random
import chainer
import numpy
import chainerx
from chainer import utils
from chainerx_tests import array_utils
from chainerx_tests import dtype_utils
from chainerx_tests import op_utils
n_step_lstm_dtypes_valid = dtype_utils._permutate_dtype_mapping([
# Floats.
(('float16', ), ()),
(('float32'... |
"""
Defines ways to create FilterCollections (from a list of parameters
or a GET request that provides them).
"""
from varappx.main.filters.filters import FiltersCollection
from varappx.main.filters.variant_filters import *
from varappx.main.filters.genotype_filters import *
from varappx.main.samples.samples_service i... |
"""
Simple module to aid in working with calendars
"""
import calendar
import datetime
class Calendar(list):
"""
Calendar object consisting of a list of :class:`datetime.datetime`
objects.
>>> from chula import ecalendar
>>>
>>> # Calendar for this month
>>> c = ecalendar.Calendar()
>... |
from google_one_box import GoogleOneBox
def testSearch(driver):
"""This example shows how to use the page object pattern.
For more information about this pattern, see:
https://github.com/SeleniumHQ/selenium/wiki/PageObjects"""
google = GoogleOneBox(driver, "http://www.google.com")
res = google.se... |
#!/usr/bin/env python
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__author__ = '<EMAIL> (Wesley Chun)'
import httplib
import endpoints
from protorpc import me... |
from __future__ import print_function
import json
import os
import numpy as np
import sys
import h5py
from gensim.models import Word2Vec
from gensim.utils import simple_preprocess
from keras.layers import Embedding
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from ... |
#!/usr/bin/python
# -*- coding: iso-8859-2; -*-
"""
flow.py
Flow submodule for YAYPM.
Copyright (C) 2005 Maciek Kaminski
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 th... |
from math import sin, cos
from functools import partial
try:
from ompl import util as ou
from ompl import base as ob
from ompl import control as oc
from ompl import geometric as og
except:
# if the ompl module is not in the PYTHONPATH assume it is installed in a
# subdirectory of the parent dire... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
MUNCH_IMP_ERR = None
try:
from munch import Munch, unmunchify
HAS... |
import json
import requests
from requests.packages import urllib3
import six
import warnings
from wva.exceptions import WVAHttpRequestError, HTTP_STATUS_EXCEPTION_MAP, WVAHttpError
class WVAHttpClient(object):
"""Wrapper around requests for making WVA Web Service Calls"""
def __init__(self, hostname, usernam... |
import os
import sys
from flask import logging
from app import current_app as app, celery
from app.models import db
from app.models.setting import Environment
from app.settings import set_settings
from populate_db import populate
_basedir = os.path.abspath(os.path.dirname(__file__))
class Setup(object):
@stati... |
from sympy import symbols, sin, Matrix, Interval, Piecewise
from sympy.utilities.pytest import raises
from sympy.printing.lambdarepr import lambdarepr
x, y, z = symbols("x,y,z")
def test_basic():
assert lambdarepr(x*y) == "x*y"
assert lambdarepr(x + y) in ["y + x", "x + y"]
assert lambdarepr(x**y) == "x... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.api import basic_auth_argument_spec
from ansible.modu... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
try:
from msrestazure.azure_exceptions import CloudError
except:
# This is handled ... |
from datetime import time
from pandas.tseries.holiday import (
Holiday,
DateOffset,
MO,
weekend_to_monday,
GoodFriday
)
from pytz import timezone
from zipline.utils.calendars.trading_calendar import TradingCalendar, \
HolidayCalendar
from zipline.utils.calendars.us_holidays import Christmas
fro... |
"""Valgrind-style suppressions for heapchecker reports.
Suppressions are defined as follows:
# optional one-line comments anywhere in the suppressions file.
{
Toolname:Errortype
Short description of the error.
fun:function_name
fun:wildcarded_fun*_name
# an ellipsis wildcards zero or more functions in a sta... |
# test handling of failed heap allocation with bytearray
import micropython
class GetSlice:
def __getitem__(self, idx):
return idx
sl = GetSlice()[:]
# create bytearray
micropython.heap_lock()
try:
bytearray(4)
except MemoryError:
print("MemoryError: bytearray create")
micropython.heap_unlock(... |
from mixbox import fields
import maec
from . import _namespace
import maec.bindings.maec_package as package_binding
from maec.package.malware_subject_reference import MalwareSubjectReference
from cybox.common import vocabs
from maec.vocabs.vocabs import GroupingRelationship as GroupingRelationshipVocab
class... |
import ConfigParser
import os
from gwpy.segments import DataQualityFlag
import coherence_functions as cf
def config_section_map(c, section):
dict1 = {}
options = c.options(section)
for option in options:
dict1[option] = c.get(section, option)
return dict1
def config_list(c):
dict1 = {}
... |
from .controller import Controller
from . import commands as c
class NanoKontrol2(Controller):
SLIDERS = (0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23)
def is_button(self, code):
return code not in self.SLIDERS
def factory(*args, **kwargs):
nk2 = NanoKontrol2(*args, **kwargs)
nk2... |
"""Chromium presubmit script for src/base.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""
def _CheckNoInterfacesInBase(input_api, output_api):
"""Checks to make sure no files in libbase.a have |@interface|."""
pattern =... |
from fabric.api import env, task, local, cd, lcd, run, sudo, put
from tempfile import NamedTemporaryFile
env.use_ssh_config = True
env.hosts = ['skylines@skylines']
APP_DIR = '/home/skylines'
SRC_DIR = '%s/src' % APP_DIR
@task
def deploy(branch='master', force=False):
push(branch, force)
restart()
@task
... |
"""Module for parsing and testing package version predicate strings.
"""
import re
import distutils.version
import operator
re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)")
# (package) (rest)
re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses
re_splitComparis... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class grant_badge_wizard(osv.TransientModel):
""" Wizard allowing to grant a badge to a user"""
_name = 'gamification.badge.user.wizard'
_columns = {
'user_id': fields.many2one("res.users", string='User', required=True),
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os.path
from docutils import io, nodes, statemachine, utils
from docutils.utils.error_reporting import SafeString, ErrorString
from docutils.parsers.rst import directives, Directive
from pelican.rstdirectives import Pygments
class CodeInclude(D... |
import uuid
import django.contrib.postgres.fields.jsonb
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import extras.utils
from extras.choices import JobResultStatusChoices
def convert_job_results(apps, schema_editor):
"""
Convert ReportResult obje... |
"""Tests for SparseReshape."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.ops import array_ops
from tensorfl... |
import logging
from basil.HL.HardwareLayer import HardwareLayer
logger = logging.getLogger(__name__)
class MIO_PLL(HardwareLayer):
'''
CY22150 PLL
Output frequency range: 80 kHz to 200 MHz
Physical connection on MIO board:
- 48 MHz reference clock input from USB uC
- LCK1 PLL clock outpu... |
# -*- coding: utf-8 -*-
'''
Views for manage user, group, permission and session in Lucterios
@author: Laurent GAY
@organization: sd-libre.fr
@contact: <EMAIL>
@copyright: 2015 sd-libre.fr
@license: This file is part of Lucterios.
Lucterios is free software: you can redistribute it and/or modify
it under the terms of... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft, ifft
N = 256
M = 63
f0 = 1000
fs = 10000
A0 = .8
hN = N/2
hM = (M+1)/2
fftbuffer = np.zeros(N)
X1 = np.zeros(N, dtype='complex')
X2 = np.zeros(N, dtype='complex')
x = A0 * np.cos(2*np.pi*f0/fs*np.arange(-hM+1,hM))
plt.figure(1, figsi... |
from __future__ import unicode_literals
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields i... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
from ansible.module_utils.avi import (
avi_common_argument_spec, HAS_AVI, avi_ansible_api)
except ImportError:... |
from __future__ import absolute_import
from bokeh import protocol
from bokeh import session
from . import test_utils
from ..app import bokeh_app
ws_address = "ws://localhost:5006/bokeh/sub"
class TestSubscribeWebSocket(test_utils.BokehServerTestCase):
def test_basic_subscribe(self):
self.sess1 = session... |
import unittest
from test import test_support
from java.awt import Dimension
from java.awt.event import ActionEvent
from java.lang import Integer, String
from java.lang.Math import abs
from java.math import BigInteger
from java.util import Vector
from javax import swing
from javatests import ListTest
class PyListTe... |
import os
import logging
import random
from time import time
from ctypes import byref, c_ulong, create_string_buffer, c_int, sizeof
from shutil import copy
from lib.common.constants import PIPE, PATHS, SHUTDOWN_MUTEX
from lib.common.defines import KERNEL32, NTDLL, SYSTEM_INFO, STILL_ACTIVE
from lib.common.defines impo... |
import logging
from datetime import datetime
from dateutil.relativedelta import relativedelta
from operator import itemgetter
import time
import openerp
from openerp import SUPERUSER_ID, api
from openerp import tools
from openerp.osv import fields, osv, expression
from openerp.tools.translate import _
from openerp.too... |
"""
Template module
"""
from string import Template
from lxml import etree
from xmodule.raw_module import RawDescriptor
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, XModule
class CustomTagModule(XModule):
"""
This module supports tags of the form
<customtag option="val" option2="val2" impl="... |
from Policy import *
from Architecture import *
from Environment import *
from TrainingFunction import *
class RLAgent:
def __init__(self, environment, architecture, knowledge): # reward?
self.environment = environment
self.architecture = architecture
self.agent_function = Age... |
#!/usr/bin/env py.test
"""Unit tests for basic math functions"""
# Copyright (C) 2011-2014 Martin Alnaes
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, eit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import operator
import re
from .exceptions import ExtractorError
_OPERATORS = [
('|', operator.or_),
('^', operator.xor),
('&', operator.and_),
('>>', operator.rshift),
('<<', operator.lshift),
('... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name, pointless-string-statement
import json
import os
import sys
import pytest
import six
from ..api import guessit, properties, suggested_expected, GuessitException
__location__ = os.path.re... |
import datetime
import cherrypy
import sickbeard
MESSAGE = 'notice'
ERROR = 'error'
class Notifications(object):
"""
A queue of Notification objects.
"""
def __init__(self):
self._messages = []
self._errors = []
def message(self, title, message=''):
... |
#!/usr/bin/python
# from https://bitbucket.org/kent37/python-tutor-samples/src/f657aeba5328/BinPacking.py
#
# Original author: Kent S Johnson <<EMAIL>>
# Website: http://kentsjohnson.com/
# Adapted by Frank Scheiner 2014-2016
''' Partition a list into sublists whose sums don't exceed a maximum
using a First Fit... |
"""This example illustrates how to get a list of all the files for a profile."""
import argparse
import sys
from apiclient import sample_tools
from oauth2client import client
# Declare command-line flags.
argparser = argparse.ArgumentParser(add_help=False)
argparser.add_argument(
'profile_id', type=int,
help... |
from django.test import TestCase
from regressiontests.reverse_single_related.models import *
class ReverseSingleRelatedTests(TestCase):
"""
Regression tests for an object that cannot access a single related
object due to a restrictive default manager.
"""
def test_reverse_single_related(self):
... |
from sources import *
from utils import *
import string, re
#
# Regular expressions to detect code sequences. `Code sequences' are simply
# code fragments embedded in '{' and '}', as demonstrated in the following
# example.
#
# {
# x = y + z;
# if ( zookoo == 2 )
# {
# foobar();
# }
# }
... |
import json
import argparse
import os
tile_type = {
"E": "EMPTY",
"W": "WHIRLPOOL",
"C": "CENTER",
"O": "OBJECTIVE"
}
objective_type = [
"BLUE_MOON",
"YELLOW_WHEEL",
"GREEN_SATURN",
"RED_STAR",
"YELLOW_MOON",
"GREEN_WHEEL",
"RED_SATURN",
"BLUE_STAR",
"GREEN_MOON",
... |
import frappe
import frappe.share
def execute():
frappe.reload_doc("core", "doctype", "docperm")
frappe.reload_doc("core", "doctype", "docshare")
# default share to all writes
frappe.db.sql("""update tabDocPerm set `share`=1 where ifnull(`write`,0)=1 and ifnull(`permlevel`,0)=0""")
# every user must have access... |
import re
from netseen.common.logger import Logger
from pysnmp.hlapi import \
bulkCmd, getCmd, nextCmd, SnmpEngine, CommunityData, UdpTransportTarget, \
ContextData, ObjectType, ObjectIdentity, UsmUserData
class SnmpPoller(object):
'''
Snmp Mib Poller
v2c:
:router_ip: device ip string format
... |
import json
import uuid
import copy
from base64 import b64decode
from datetime import datetime
from django.http import HttpResponse, HttpResponseNotFound
from django.conf import settings
from django.utils.timezone import utc
from util import convert_to_dict
from retrieve_statement import complex_get, get_more_stateme... |
from datetime import datetime
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
DEFAULT_DATE = datetime(2016, 1, 1)
args = {
'owner': 'airflow',
'start_date': DEFAULT_DATE,
}
dag = DAG(dag_id='test_localtaskjob_double_trigger', default_args=args)
task = DummyOperator(... |
import pytest
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as splin
from numpy.testing import assert_allclose
try:
import sparse
except ImportError:
sparse = None
pytestmark = pytest.mark.skipif(sparse is None,
reason="pydata/sparse not installed")
... |
import sys
import threading
import warnings
from collections import Counter, OrderedDict, defaultdict
from functools import partial
from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured
from django.utils import lru_cache
from .config import AppConfig
class Apps(object):
"""
A registry... |
from .node import NodeVisitor, ValueNode, ListNode, BinaryExpressionNode
from .parser import atoms, precedence
atom_names = {v:"@%s" % k for (k,v) in atoms.items()}
named_escapes = {"\a", "\b", "\f", "\n", "\r", "\t", "\v"}
def escape(string, extras=""):
# Assumes input bytes are either UTF8 bytes or unicode.
... |
import logging
import sys
from divvy import config
from divvy import handle
from divvy import reply
log = logging.getLogger(__name__)
# --------------------------- Lambda Function ----------------------------------
def lambda_handler(event, context):
""" Route the incoming request based on type (LaunchRequest, I... |
'''
For generate Response in streaming with N files (chunked, happy memory server)
It uses multipart/mixed format
Example:
HTTP/1.0 200 OK
Connection: close
Date: Wed, 24 Jun 2009 23:41:40 GMT
Content-Type: multipart/mixed;boundary=AMZ90RFX875LKMFasdf09DDFF3
Client-Date: Wed, 24 Jun 2009 23:41:40 GMT
Client-Peer: 127.... |
"""English Content
""" |
import logging
from time import time
import numpy as np
class HDF5CacheBlock(object):
def __init__(self, shape, fillvalue, dtype):
self.has_new_data = True
self.flush_time = time()
self.data = np.full(shape, fillvalue, dtype)
class HDF5UnlimitedCache(object):
""" An object to repres... |
def test_import():
try:
import sprokit.pipeline.edge
except:
test_error("Failed to import the edge module")
def test_create():
from sprokit.pipeline import config
from sprokit.pipeline import edge
c = config.empty_config()
edge.Edge()
edge.Edge(c)
edge.Edges()
def t... |
import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
interface TestConsts {
const byte zero = 0;
const byte b = -1;
const octet o = 2;
const short s = -3;
const unsigned short us = 0x4;
const long l = -0X5;
const unsigned long... |
import os
import sys
import traceback
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.parsing.vault import VaultEditor
from ansible.cli import CLI
from ansible.utils.display import Display
class VaultCLI(CLI):
""" Vault command line class """
VALID... |
# doc:slow-example
"""
================================
Compute ICA components on epochs
================================
ICA is fit to MEG raw data.
We assume that the non-stationary EOG artifacts have already been removed.
The sources matching the ECG are automatically found and displayed.
Subsequently, artefact det... |
"""Test zha lock."""
from unittest.mock import patch
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED, STATE_UNAVAILABLE
from homeassistant.components.lock import DOMAIN
from tests.common import mock_coro
from .common import (
async_init_zigpy_device,
make_attribute,
make_entity_id,
async_en... |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the LMS.
"""
import time
from ..helpers import UniqueCourseTest
from ...pages.studio.auto_auth import AutoAuthPage
from ...pages.lms.create_mode import ModeCreationPage
from ...pages.studio.overview import CourseOutlinePage
from ...pages.lms.courseware import Courseware... |
from gnuradio import gr, filter
from gnuradio import blocks
import sys
try:
from gnuradio import qtgui
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
sys.stderr.write("Error: Program requires PyQt4 and gr-qtgui.\n")
sys.exit(1)
try:
from gnuradio import analog
except ImportErro... |
"""The test controller for the chromoting localhost browser_tests.
This test uses the legion framework to setup this controller which will run
the chromoting_browser_tests on a task machine. This is intended to
be an example Legion-based test for the chromoting team.
The controller will start a task machine to run br... |
from __future__ import unicode_literals
from django.core import signing
from django.http import HttpRequest, HttpResponse
from django.test import SimpleTestCase, override_settings
from django.test.utils import freeze_time
class SignedCookieTest(SimpleTestCase):
def test_can_set_and_read_signed_cookies(self):
... |
# coding=utf-8
import random
import time
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django_sae.contrib.tasks.settings import ORDER_QUEUE_NAME, PARALLEL_QUEUE_NAME
from django_sae.utils.taskqueue import get_queue
from sae.taskqueue import Task
class OperationBase(object):
... |
#!/usr/bin/python2 -O
# coding: UTF-8
"""
An example where the establishing and terminating process of a port
forwarding are not the same.
For example, this can happen in Web applications where the Web server
uses multiple processes to handle requests.
"""
from uuid import uuid4
from urllib2 import urlopen
from mult... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptDialog.py
---------------------
Date : December 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*******... |
"""The test for switch device automation."""
import pytest
from homeassistant.components.switch import DOMAIN
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
from homeassistant.setup import async_setup_component
import homeassistant.components.automation as automation
from homeassistant.components.d... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from units.compat.mock import patch
from ansible.modules.network.onyx import onyx_command
from units.modules.utils import set_module_args
from .onyx_module import TestOnyxModule, load_fixture
class TestOnyxCommandMod... |
'''
Nosvideo urlresolver plugin
Copyright (C) 2013 Vinnydude
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 later version.
This program is d... |
import numpy as np
import dill
class neural_network:
def __init__(self, num_layers, num_nodes, activation_function, cost_function):
self.num_layers = num_layers
self.num_nodes = num_nodes
self.layers = []
self.cost_function = cost_function
for i in range(num_layers):
... |
from django.conf import settings
from django.contrib.staticfiles.handlers import StaticFilesHandler
from django.core.management.commands.runserver import (
Command as RunserverCommand,
)
class Command(RunserverCommand):
help = "Starts a lightweight Web server for development and also serves static files."
... |
from eve.tests import TestBase
import time
class TestRateLimit(TestBase):
def setUp(self):
super(TestRateLimit, self).setUp()
try:
from redis import Redis, ConnectionError
self.app.redis = Redis()
try:
self.app.redis.flushdb()
except ... |
import unittest
import decimal
import prosperpy
def get_prices():
prices = ['90.704', '92.900', '92.978', '91.802', '92.665', '92.684', '92.302', '92.773', '92.537', '92.949',
'93.204', '91.067', '89.832', '89.744', '90.399', '90.739', '88.018', '88.087', '88.844', '90.778',
'90.542',... |
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core import serializers
from django.db import router, DEFAULT_DB_ALIAS
from django.utils.datastructures import SortedDict
from optparse import make_option
class Command(BaseCommand):
... |
from django.http import HttpResponseBadRequest, HttpResponseServerError
from django.shortcuts import render
from django_summernote.models import Attachment
from django_summernote.settings import summernote_config
from django_summernote.widgets import SummernoteWidgetBase
def editor(request, id):
return render(
... |
from pocketsphinx import * |
import re
from ansible.module_utils.network import Command, get_exception
from ansible.module_utils.netcfg import NetworkConfig, dumps
from ansible.module_utils.vyos import NetworkModule, NetworkError
DEFAULT_COMMENT = 'configured by vyos_config'
CONFIG_FILTERS = [
re.compile(r'set system login user \S+ authent... |
#! API access to CCSD amplitudes
import numpy as np
import psi4
Ne = psi4.geometry("""
0 1
Ne 0.0 0.0 0.0
symmetry c1
""")
psi4.set_options({'basis': 'cc-pvdz', 'freeze_core': 'false'})
_, wfn = psi4.energy('ccsd', return_wfn=True, molecule=Ne)
amps = wfn.get_amplitudes()
TIjAb = amps['tIjAb'].to_array()
TIA = amp... |
#!/usr/bin/env python
# coding=utf8
"""
debversion
@contact: Debian FTP Master <<EMAIL>>
@copyright: 2008 Michael Casadevall <<EMAIL>>
@copyright: 2008 Roger Leigh <<EMAIL>>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or modify
# it under... |
import unittest
import numpy as np
import h5py
from pyemma.coordinates.data.h5_reader import H5Reader
from pyemma.util.testing_tools import MockLoggingHandler
from pyemma.coordinates import source
class TestH5Reader(unittest.TestCase):
@classmethod
def setUpClass(cls):
import tempfile
# creat... |
import os
import pandas as pd
import warnings
import sys
if (sys.version_info > (3, 0)):
import pickle as pickle
else:
import cPickle as pickle
import tldextract
warnings.filterwarnings("ignore", 'This pattern has match groups')
LOCAL_DIR = os.path.dirname(os.path.realpath(__file__))
class TLDCheck(object)... |
from __future__ import print_function
# Copyright (c) 2014 Intel Corporation.
#
# 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 ... |
'''
main script for meta-pipeline, that run the scripts:
- quality_control.py
- generate_classify.py
with given parameters.
'''
#@author: Philipp Sehnert
#@contact: philipp.sehnert[a]gmail.com
# global imports
import sys, os
from argparse import ArgumentParser
import subprocess
import shlex
#import generate_classif... |
#!/usr/bin/env python
import sys
import roslib
roslib.load_manifest('nao_description')
import rospy
import tf
import numpy as np
from tf import TransformListener
from tf import transformations
try:
import motion
from naoqi import ALProxy
except ImportError:
print("Error importing NaoQI. Please make sure th... |
"""
Tests for block_structure.py
"""
# pylint: disable=protected-access
from collections import namedtuple
from copy import deepcopy
import ddt
import itertools
from unittest import TestCase
from openedx.core.lib.graph_traversals import traverse_post_order
from ..block_structure import BlockStructure, BlockStructureM... |
"""Generate and work with PEP 425 Compatibility Tags."""
import sys
import warnings
try:
import sysconfig
except ImportError: # pragma nocover
# Python < 2.7
import distutils.sysconfig as sysconfig
import distutils.util
def get_config_var(var):
try:
return sysconfig.get_config_var(var)
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
import os
import shlex
import sys
from ansible.module_utils.basic import Ansible... |
'''
Entry point module to start the interactive console.
'''
from _pydev_bundle._pydev_getopt import gnu_getopt
from _pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
from _pydev_imps._pydev_saved_modules import thread
start_new_thread = thread.start_new_thread
try:
from c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.