content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
"""
***************************************************************************
spatialite_utils.py
---------------------
Date : November 2015
Copyright : (C) 2015 by René-Luc Dhont
Email : volayaf at gmail dot com
******************... |
"""
IDLRelease for PPAPI
This file defines the behavior of the AST namespace which allows for resolving
a symbol as one or more AST nodes given a Release or range of Releases.
"""
import sys
from idl_log import ErrOut, InfoOut, WarnOut
from idl_option import GetOption, Option, ParseOptions
Option('release_debug', '... |
"""
Constants for data group of map and navigation curves
"""
from math import cos, pi
from enum import Enum
from zipfile import ZIP_STORED, ZIP_DEFLATED, ZIP_BZIP2
class ConnectionsStorage:
"""Constants related for storage of connections used in custom drawing
"""
collection_name = ".scs_connection_sto... |
# Reads SpringerLink URLs from stdin then:
# - Generates a BibTex file containing formatted references.
# - Stores all PDF in current directory, linking them from the BibTex file.
import os, re, sys
from hashlib import sha1 as hashfunc
from urllib.request import urlopen, url2pathname
from urllib.parse import unqu... |
from flask import Flask, request
from flask_restplus import Resource, Api
from flask_jwt import JWT, jwt_required
from security import authenticate, identity
app = Flask(__name__)
app.secret_key = 'Wojciech'
api = Api(app)
# JWT creates a new endpoint /auth
jwt = JWT(app, authenticate, identity)
# List for storing ... |
"""
Scheduler host filters
"""
from manila.scheduler.filters import base
class BaseHostFilter(base.BaseFilter):
"""Base class for host filters."""
def _filter_one(self, obj, filter_properties):
"""Return True if the object passes the filter, otherwise False."""
return self.host_passes(obj, fi... |
"""Arduino pin interface.
Inherits from generic hardware interface in
hardware.py.
Has a PinDealer class that keeps track of available
"pins" to control. When PinDealer.get_pin() is called,
a Pin instance is returned. The Pin instance
has enable, disable, and toggle methods on it. When
the Pin instance is no longer... |
import re
import socket
import time
SEL_LDR_RSP_SOCKET_ADDR = ('localhost', 4014)
def EnsurePortIsAvailable(addr=SEL_LDR_RSP_SOCKET_ADDR):
# As a sanity check, check that the TCP port is available by binding
# to it ourselves (and then unbinding). Otherwise, we could end up
# talking to an old instance of se... |
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.models import TimeStampedModel
from .managers import FavoriteManage... |
import unittest
import os
from mock import call
from mock import MagicMock
import dcm.agent.tests.utils.general as test_utils
from dcm.agent.ossec import AlertSender
from dcm.agent.ossec import parse_file
TEST_STRING_LONG="""
** Alert 1446578476.4335: - syslog,sshd,authentication_success,
2015 Nov 03 19:21:16 vagran... |
"""Compatibility fixes for older version of python, numpy and scipy
If you add content to this file, please give the version of the package
at which the fixe is no longer needed.
"""
# Authors: Emmanuelle Gouillart <<EMAIL>>
# Gael Varoquaux <<EMAIL>>
# Fabian Pedregosa <<EMAIL>>
# Lars Buit... |
"""
This is an implementation of the bottom-up intersection by Nederhof and Satta (2008) described in the paper:
@inproceedings{Nederhof+2008:probparsing,
Author = {Mark-Jan Nederhof and Giorgio Satta},
Booktitle = {New Developments in Formal Languages and Applications, Studies in Computational Int... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.bbcode
~~~~~~~~~~~~~~~~~~~~~~~~~~
BBcode formatter.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.util import get_bool_opt
__al... |
""" This module manages access to tables.
It provides simple reports for adding, deleting, and editing records
within tables.
"""
import pyflag.Reports as Reports
import pyflag.FlagFramework as FlagFramework
from pyflag.FlagFramework import Curry, query_type
import pyflag.conf
config=pyflag.conf.ConfObject()
import py... |
"""TensorFlow Eager Execution: Sanity tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
from tensorflow.contrib.eager.python import tfe
from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
f... |
from spack import *
class AlsaLib(AutotoolsPackage):
"""The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
functionality to the Linux operating system. alsa-lib contains the user
space library that developers compile ALSA applications against."""
homepage = "https://www.alsa-project... |
from __future__ import print_function, absolute_import
import os
import numpy as np
import random
import cv2
from six.moves import cPickle as pickle
# Destination folder for final pickle file.
PICKLE_FOLDER = '.'
# Name of final pickle file.
FINAL_PICKLE = 'emotion_dataset.pickle'
# Name of folders containing image ... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urllib_parse
from ..utils import (
ExtractorError,
unescapeHTML
)
class EroProfileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?eroprofile\.com/m/videos/view/(?P<id>[^/]+)'
_LOGIN_U... |
# coding=utf-8
"""
Collect out of band stats from ntp
Uses output from ntpdate:
```
$ ntpdate -q pool.ntp.org
server 12.34.56.1, stratum 2, offset -0.000277, delay 0.02878
server 12.34.56.2, stratum 1, offset -0.000128, delay 0.02896
server 12.34.56.3, stratum 2, offset 0.000613, delay 0.02870
server 12.34.56.4, str... |
from django.test import TestCase
from django.core.management.color import no_style
from django.db import connection
class ModelTestCase(TestCase):
temporary_models = tuple()
def setUp(self):
self._map_over_temporary_models('create_table')
super(ModelTestCase, self).setUp()
def tearDown(s... |
"""
Script that trains TF multitask models on MUV dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import numpy as np
import shutil
import deepchem as dc
from deepchem.molnet import load_muv
np.random.seed(123)
# Load MUV data
muv_ta... |
from __future__ import print_function
import os
import sys
import tempfile
try:
import cStringIO as io
BytesIO = io.StringIO
except ImportError:
import io
BytesIO = io.BytesIO
import fixtures
import testscenarios
from pbr import packaging
from pbr import tests
class DiveDir(fixtures.Fixture):
... |
from __future__ import unicode_literals
import transaction
from flask_pluginengine import current_plugin
from flask_script import Manager
from terminaltables import AsciiTable
from indico.core.db import db, DBMgr
from indico.core.db.sqlalchemy.util.session import update_session_options
from indico.util.console import... |
# -*- coding:utf8 -*-
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from base.logger import LOG
class MusicTableWidget(QTableWidget):
"""显示音乐信息的tablewidget
"""
signal_play_music = pyqtSignal([int], name='play_music')
signal_remove_music_from_list = pyqtSignal([... |
import os
import csv
import operator
from django.core import serializers
from django.http import HttpResponse
from msd.settings import PROJECT_ROOT
from naivebayes.models import Range, Count, NBModel, TestData, TestResult
TEST_RESULT = '/meta/test_result.csv'
def frange(start, end, count):
"A range function, that do... |
import sys
from oslo.config import cfg
import webob
from neutron.api import extensions
from neutron.api.v2.attributes import convert_to_int
from neutron.api.v2 import base
from neutron.api.v2 import resource
from neutron.common import exceptions as q_exc
from neutron.manager import NeutronManager
from neutron.opensta... |
from .common import *
from .analog import BaseAnalogSensor
from .digital import BaseDigitalSensor, find_class
from .generic import Touch, Light, Sound, Ultrasonic, Color20, Temperature
from . import mindsensors
MSSumoEyes = mindsensors.SumoEyes
MSCompassv2 = mindsensors.Compassv2
MSDIST = mindsensors.DIST
MSRTC = minds... |
from oslo_log import log as logging
import six
from six.moves import http_client
import webob.dec
import webob.exc
from karbor.api.openstack import wsgi
from karbor import exception
from karbor import utils
from karbor.wsgi import common as base_wsgi
LOG = logging.getLogger(__name__)
class FaultWrapper(base_wsgi.M... |
"""
Io Ops Weigher. Weigh hosts by their io ops number.
The default is to preferably choose light workload compute hosts. If you prefer
choosing heavy workload compute hosts, you can set 'io_ops_weight_multiplier'
option to a positive number and the weighing has the opposite effect of the
default.
"""
from oslo_confi... |
# -*- coding: utf-8 -*-
'''
@author: Andreas Schiweck
'''
import ConfigParser
import os
import re
import sys
HOME = os.path.expanduser('~')
CONFIG = os.path.join(HOME, '.mutt-atlassian.ini')
ISSUEKEY = re.compile('(\w+-\d+)')
TERMWIDTH = 80
def create_configfile(path):
"""
"""
config = ConfigParser.R... |
import FWCore.ParameterSet.Config as cms
from HeavyIonsAnalysis.JetAnalysis.jets.akPu4CaloJetSequence_PbPb_mc_cff import *
#PU jets with 6 GeV threshold for subtraction
akPu4Calomatch6 = akPu4Calomatch.clone(src = cms.InputTag("akPu4CaloJets6"))
akPu4Caloparton6 = akPu4Caloparton.clone(src = cms.InputTag("akPu4CaloJe... |
from loguru import logger
from requests.exceptions import RequestException
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.event import event
from flexget.plugin import PluginWarning
from flexget.utils.requests import Session as RequestSession
from flexget.utils.requests import Ti... |
#!/usr/bin/python
## Revision history ############################################################
__author__ = 'Wouter Eerdekens <<EMAIL>>'
__date__ = '2011-08-12'
__version__ = 0.1
__history__ = """
2011-08-12 - Prepare for initial release <<EMAIL>>
2006-07-26 - initial version.
"""
#############################... |
"""This module contains Splittable DoFn logic that is specific to DirectRunner.
"""
from __future__ import absolute_import
from builtins import object
from threading import Lock
from threading import Timer
import apache_beam as beam
from apache_beam import TimeDomain
from apache_beam import pvalue
from apache_beam.i... |
from sys import argv
from os import system, getcwd, chdir
def setup_hg_repo(repo, rev):
ori_dir = getcwd();
chdir(repo);
system("hg update -r " + rev + " -C");
chdir(ori_dir);
def build_repo(repo, build_cmd):
cmd = build_cmd + " " + repo;
system(cmd);
def test_case(repo, test_dir, work_dir, t... |
import networkx as nx
import numpy as np
import pandas as pd
import net_metrics as met
import PHRG
import probabilistic_cfg as pcfg
# StarLog
# [-] generate a synthetic graph when GCD is requested
# - build compute_net_properties_modularity using igraph and networkx
#def compute_degree_distribution(G):
#def compute_... |
"""Updates generated docs from Python doc comments.
Both updates the files in the file-system and executes g4 commands to
make sure any changes are ready to be submitted.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import os
import re... |
# basic setup for JavaOne demo
# define constants
directoryname = "javaone"+java.io.File.separator
fileprefix = jmri.util.FileUtil.getUserFilesPath()+directoryname
addressA = 4802
longA = True
nameA = "black SP 4802"
addressB = 164
longB = True
nameB = "red Digitrax 164"
slow = 0.3
fast = 0.6
initSensorA = "LS160... |
from rdflib.term import BNode
from rdflib.term import Literal
from rdflib.term import URIRef
from rdflib.syntax.serializers.AbstractSerializer import AbstractSerializer
from rdflib.namespace import RDF, RDFS
class RecursiveSerializer(AbstractSerializer):
topClasses = [RDFS.Class]
predicateOrder = [RDF.type... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from distutils.util import convert_path
# To use a consistent encoding
from codecs import op... |
import os
import sys
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
import transaction
from zope.sqlalchemy import ZopeTransactionExtension
from kubb_match.data.m... |
"""Benchmark problems for nonlinear least squares."""
from __future__ import division
from collections import OrderedDict
import inspect
import sys
import numpy as np
from numpy.polynomial.chebyshev import Chebyshev
from scipy.integrate import odeint
class LSQBenchmarkProblem(object):
"""Template class for nonl... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class TopLevelDomainsOperations(object):
"""TopLevelDomainsOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client... |
import sys
sys.path.insert(0, '../..')
import pgi
pgi.install_as_gi()
from gi.repository import Gtk, GObject
class EntryWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Entry Demo")
self.set_size_request(200, 100)
self.timeout_id = None
vbox = Gtk.Box(ori... |
import mock
import os
from functools import wraps
from distutils.version import LooseVersion
from configman import ConfigurationManager
from nose import SkipTest
from socorro.external.elasticsearch import crashstorage
from socorro.middleware.middleware_app import MiddlewareApp
from socorro.unittest.testbase import Te... |
"""
Tests For Scheduler Host Filter Drivers.
"""
import json
from nova import exception
from nova import flags
from nova import test
from nova.scheduler import host_filter
FLAGS = flags.FLAGS
class FakeZoneManager:
pass
class HostFilterTestCase(test.TestCase):
"""Test case for host filter drivers."""
... |
from django.contrib.auth import get_user_model
from django.template import Context, Template
from django.test import TestCase
class TemplateTagsTests(TestCase):
def test_user_avatar_filter(self):
"""avatar filter returns url to avatar image"""
User = get_user_model()
user = User.objects.cr... |
"""
Tests for the Chartbeat template tags and filters.
"""
import re
from django.contrib.sites.models import Site
from django.http import HttpRequest
from django.template import Context
from django.test import TestCase
from django.test.utils import override_settings
from analytical.templatetags.chartbeat import Char... |
"""
@file soletta.py
"""
##
# @addtogroup soletta
# @brief This is soletta component
# @{
# @addtogroup soletta
# @brief This is soletta module
# @{
##
import os
import time
import subprocess
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.helper import shell_cmd_timeout
from oeqa.utils.helper import get_files_... |
# -*- coding:utf-8 -*-
"""
抓取主逻辑,分三个进程:解析三级目录,抓取种子,解析详情
@version: 1.0
@author: kevin
@license: Apache Licence
@contact: <EMAIL>
@site:
@software: PyCharm Community Edition
@file: fetch.py
@time: 16/11/26 下午5:21
"""
import sys
import getopt
from dataBase.mysql import M
from detail import *
from dataMin.ETL import ET... |
import logging
from django.utils.encoding import smart_str
from desktop.lib import export_csvxls
LOG = logging.getLogger(__name__)
DL_FORMATS = [ 'csv', 'xls' ]
def download(results, format, collection):
"""
download(results, format) -> HttpResponse
Transform the search result set to the specified format a... |
"""Tests for the Web category"""
import logging
import platform
import subprocess
import os
import pexpect
from tests.large import LargeFrameworkTests
from tests.tools import UMAKE
logger = logging.getLogger(__name__)
class FirefoxDevTests(LargeFrameworkTests):
"""Tests for Firefox Developer Edition"""
TIME... |
"""Test util methods."""
from unittest.mock import patch, MagicMock
import pytest
from homeassistant.components.recorder import util
from homeassistant.components.recorder.const import DATA_INSTANCE
from tests.common import get_test_home_assistant, init_recorder_component
@pytest.fixture
def hass_recorder():
""... |
from re import sub
from traceback import print_exc
from discord.ext import commands
from discord.errors import HTTPException
from aiohttp import ClientSession
from async_timeout import timeout
from pyfiglet import Figlet
class Translations:
def __init__(self, lambdabot):
self.lambdabot = lambdabot
... |
from base import base
from openerp.tools.safe_eval import safe_eval
class openerp_standard(base):
'''No search at all. Use OpenERP's standard mechanism to attach mails to
mail.thread objects. Note that this algorithm always matches.'''
name = 'OpenERP standard'
readonly_fields = ['model_field', 'mail_... |
import numpy as np
from numpy.linalg import eigh, solve
from ..coefficient_array import PwCoeffs
def matview(x):
return np.matrix(x, copy=False)
def lagrangeMult(p, c0, P=None):
"""
Keyword Arguments:
p --
c0 --
"""
from ..coefficient_array import CoefficientArray
if isinstance(p, C... |
"""
EasyBuild support for building and installing NCL, implemented as an easyblock
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
"""
import fileinpu... |
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_browse as h2b, h2o_exec as h2e, h2o_import as h2i
# '(def anon {x} ( (var %x "null" %FALSE "null");;(var %x "null" %FALSE "null") );;;)',
from copy import copy
from h2o_xl import Assign, If, IfElse, Return, Xbase,... |
"""
500px (Images)
@website https://500px.com
@provide-api yes (https://developers.500px.com/)
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, thumbnail, img_src, content
@todo rewrite to api
"""
from json import loads
from urllib import urlencode
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Command line utility named `rdcli`
"""
from datetime import datetime
import config
from getopt import GetoptError, gnu_getopt
from json import load
from os import path, makedirs, getcwd, access, W_OK, X_OK
from sys import argv
from config import VERSION
from RDWor... |
from collections import namedtuple
from datetime import datetime, timedelta
import logging
import os
import cPickle
logger = logging.getLogger(__name__)
class Spot(namedtuple('Spot', 'call freq time source spotter')):
__slots__ = ()
class SpotSource:
def __init__ (self):
self.spots = set()
self.last = datetime... |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the main LMS Dashboard (aka, Student Dashboard).
"""
import datetime
import pytest
from common.test.acceptance.fixtures.course import CourseFixture
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.dashboard im... |
import os.path
import sys
import getopt
import math
import pandas as pd
import numpy as np
from log import logger
from Codecs.AdcpCodec import AdcpCodec
import Ensemble.Ensemble as Ensemble
import matplotlib.pyplot as plt
import seaborn as sns
class PlotMagnitude:
def __init__(self):
self.ens_receiver = ... |
import sys
sys.path.append("./CommonTestScripts")
import System
import Test
import StatechartEditorUtil
import StatechartEditorSample
doc = atfDocService.OpenNewDocument(editor)
startState = editingContext.Insert[StartState](DomNode(Schema.startStateType.Type), 200, 100, None)
state1 = editingContext.Insert[State](Do... |
from __future__ import unicode_literals
from django.test import TestCase
from .models import Person, Movie, Event, Screening, ScreeningNullFK, Package, PackageNullFK
# These are tests for #16715. The basic scheme is always the same: 3 models with
# 2 relations. The first relation may be null, while the second is no... |
from gcompris import gcompris_gettext as _
import gcompris.utils
import xml.dom.minidom
def isNode(e, name):
return e.nodeType == e.ELEMENT_NODE and e.localName == name
class Triplet:
def __init__(self, elem, translations):
self.description = None
self.descriptionTranslated = None
sel... |
#!/usr/bin/env python3
import os, io, sys, fileinput, glob, zipfile, re, ntpath, shutil, uuid, tempfile, lzma, json
def gettempdir():
#return str(uuid.uuid1())
return os.path.join(tempfile.gettempdir(), str(uuid.uuid1()))
def is_subdir(path, directory):
path = os.path.realpath(path)
directory = os.pa... |
from evaluator.evaluator import evaluate_cards
def example1():
print('Example 1: A Texas Holdem example')
a = 7 * 4 + 0 # 9c
b = 2 * 4 + 0 # 4c
c = 2 * 4 + 3 # 4s
d = 7 * 4 + 1 # 9d
e = 2 * 4 + 2 # 4h
# Player 1
f = 10 * 4 + 0 # Qc
g = 4 * 4 + 0 # 6c
# Player 2
h = 0 * 4 + 0 # 2c
i = 7 * 4... |
import tarfile
import os
import shutil
class NotAByteArrayError(Exception): pass
class ReplayFile:
read = 'r'
write = 'w'
def __init__(self, id, mode, path):
self._id = id
self._mode = mode
self._path = path
self._fp = None
if self._mode == ReplayFile.write:
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
import os
import sys
import csv
import math
import anyjson
import psycopg2
import matplotlib
import matplotlib.pyplot as plt
from pylab import *
from PIL import Image
from pprint import pprint
from matplotlib import cm
from datetime import datetime, timedelta
from mpl_toolkits.basemap import Basemap
from matplotlib.co... |
from org.gluu.oxauth.client.fcm import FirebaseCloudMessagingResponse
from org.gluu.oxauth.client.fcm import FirebaseCloudMessagingClient
from org.gluu.oxauth.client.fcm import FirebaseCloudMessagingRequest
from org.gluu.oxauth.util import RedirectUri
from org.gluu.model.custom.script.type.ciba import EndUserNotificati... |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline ... |
# -*- coding:utf-8 -*-
import json
import urllib2
# download list
complete_list = []
# init the download list
def init_list():
# params to get data,view aria2 jsonrpc api @ https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface
jsonreq = json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': 'aria2.tellS... |
import sublime
import sublime_plugin
import json
import re
import os
import fnmatch
from collections import OrderedDict
def jsonencode(str):
return jsonencode_with_indent(str, 4)
def jsonencode_with_indent(str, _indent):
return json.dumps(str, sort_keys=False, ensure_ascii=False, indent=_indent, separators=(',', ':... |
import os
# toolchains options
ARCH='arm'
CPU='zynq7000'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = '/home/grissiom/'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = 'C:/Keil'
elif CROSS_TOOL == 'ia... |
#!/usr/bin/python
import sys
import os
import logging
from optparse import OptionParser
from io import StringIO
import json
import locale
from lxml import etree
from lxml.etree import ParserError
from lxml.etree import XMLSyntaxError
import requests
from requests.exceptions import ConnectionError
from requests.excepti... |
#!/usr/bin/env python
# Test whether a client sends a correct PUBLISH to a topic with QoS 0.
# The client should connect to port 1888 with keepalive=60, clean session set,
# and client id publish-qos0-test
# The test will send a CONNACK message to the client with rc=0. Upon receiving
# the CONNACK and verifying that ... |
import numpy as Num
import scipy.special
import numpy.fft as FFT
def sinc(xs):
"""
sinc(xs):
Return the sinc function [i.e. sin(pi * xs)/(pi * xs)]
for the values xs.
"""
pxs = Num.pi*xs
return Num.where(Num.fabs(pxs)<1e-3, 1.0-pxs*pxs/6.0, Num.sin(pxs)/pxs)
def kaiser_window(x... |
"""Helper methods for creating & verifying XSRF tokens."""
__authors__ = [
'"Doug Coker" <<EMAIL>>',
'"Joe Gregorio" <<EMAIL>>',
]
import base64
import hmac
import time
from oauth2client import util
# Delimiter character
DELIMITER = ':'
# 1 hour in seconds
DEFAULT_TIMEOUT_SECS = 1*60*60
@util.positional... |
from django.conf import settings
from wagtail.wagtailimages.utils import crop
class BaseImageBackend(object):
def __init__(self, params):
self.quality = getattr(settings, 'IMAGE_COMPRESSION_QUALITY', 85)
def open_image(self, input_file):
"""
Open an image and return the backend speci... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# TODO: # 001 Don't know how to deal with the situation
# that a user signs into the system form other accesses,
# i.e. Google Chrome, after our service has started.
# TODO: # 002 Handle successful selection and the user is signed
# out by the server. I... |
#!/usr/bin/env python3
"""Python binding of Color Click wrapper of LetMeCreate library.
You must initialise and select the right I2C bus before using any of these
functions.
"""
import ctypes
_LIB = ctypes.CDLL('libletmecreate_click.so')
def enable():
"""Enable the Color Click.
Note: An exception is throw... |
"""
Form classes
"""
from __future__ import unicode_literals
import copy
from collections import OrderedDict
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
# BoundField is imported for backwards compatibility in Django 1.9
from django.forms.boundfield import BoundField # NOQA
from django.forms... |
'''
EVENT_MANAGER.PY
================
Event manager for uzbl written in python.
'''
import atexit
import configparser
import imp
import logging
import os
import sys
import time
import weakref
import re
import errno
from collections import defaultdict
from functools import partial
from glob import glob
from itertools ... |
from Guest import Guest
class FullVirtGuest(Guest):
_default_os_type = "hvm"
def __init__(self, type=None, arch=None, connection=None,
hypervisorURI=None, emulator=None, installer=None,
caps=None, conn=None):
Guest.__init__(self, type, connection, hypervisorURI, inst... |
from django.conf.urls import include
from django.conf.urls import url
from openstack_dashboard.dashboards.admin.volumes.snapshots \
import urls as snapshot_urls
from openstack_dashboard.dashboards.admin.volumes import views
from openstack_dashboard.dashboards.admin.volumes.volume_types \
import urls as volume_... |
import logging
import os
import struct
from datetime import datetime
from typing import Iterable, List, Optional
from sqlalchemy import BigInteger, Column, String, Text, exists
from airflow.exceptions import AirflowException, DagCodeNotFound
from airflow.models.base import Base
from airflow.settings import STORE_DAG_... |
#! /usr/bin/env python
"""
This script tests some of the base functionalities of MORSE.
"""
import sys
import math
import roslib; roslib.load_manifest('roscpp'); roslib.load_manifest('rospy'); roslib.load_manifest('nav_msgs');
roslib.load_manifest('geometry_msgs')
import rospy
import std_msgs
from nav_msgs.msg import... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operati... |
import logging
from datetime import datetime
import json
if __name__ == "__main__":
input = sys.argv[1]
output = sys.argv[2]
processor = consolidate_change_dates().process(input,output)
KIND_SCORES = { 'approval' : 3,
'approved-approx' : 1,
'pending' : 2 }
KIND_TYPES = { 'a... |
import numpy as np
import shapely.geometry as S
import math
import blendit.GraphPLE as G
import blendit.velocity_field as T
import blendit.geometric_tools as GT
class Individual:
"""The class independant from Blender describing an individual"""
def __init__(self, x, y, z, vmax, vopt, es, ew, radius, goal):
... |
import sys
import threading
import weakref
from django.utils.inspect import func_accepts_kwargs
from django.utils.six.moves import range
if sys.version_info < (3, 4):
from .weakref_backports import WeakMethod
else:
from weakref import WeakMethod
def _make_id(target):
if hasattr(target, '__func__'):
... |
from decimal import Decimal
import pytest
from prices import Money
from saleor.account.models import Address
from saleor.product.models import Product
from saleor.search.backends.postgresql import search_storefront
PRODUCTS = [
("Arabica Coffee", "The best grains in galactic"),
("Cool T-Shirt", "Blue and big... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License (G... |
from ...java import opcodes as JavaOpcodes
##########################################################################
# Local variables are stored in a dictionary, keyed by name,
# and with the value of the local variable register they are stored in.
#
# If an attempt is used to use a name that has been deleted, an e... |
import boost.parallel.mpi as mpi
from generators import *
def reduce_test(comm, generator, kind, op, op_kind, root):
if comm.rank == root:
print ("Reducing to %s of %s at root %d..." % (op_kind, kind, root)),
my_value = generator(comm.rank)
result = mpi.reduce(comm, my_value, op, root)
... |
"""Cluster Resolvers are used for dynamic cluster IP/hostname resolution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
from tensorflow.python.training.server_lib import ClusterSpec
class ClusterResolver(object):
"""Abstract class for a... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
import re
from . import Image, ImageFile
__version__ = "0.2"
#
# --------------------------------------------------------------------
field = re.compile(br"([a-z]*) ([^ \r\n]*)")
##
# Image plugin for IM Tools images.
class ImtImageFile(ImageFile.ImageFile):
format = "IMT"
format_description = "IM Tool... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.