src stringlengths 721 1.04M |
|---|
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
import os
import threading
import urllib
import time
import subprocess
import fnmatch
import datetime
import sys
import shutil
import octoprint.util as uti... |
import MySQLdb
mysql_config = {
'host':'127.0.0.1',
'user':'root',
'password':'***',
'port':3306,
'database':'Center',
'charset':'utf8',
}
def isset(v):
try:
type (eval(v))
except:
return False
else:
return True
def LoadFile():
try:
cnn = MySQLdb.... |
from datetime import datetime
from decimal import Decimal
from flask import Flask, render_template
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restless import APIManager
from local_settings import SQLALCHEMY_DATABASE_URI, DEBUG_MODE
app = Flask(__name__)
app.url_map.strict_slashes = False
app.config['S... |
#!/usr/bin/python
import os
import sys
# Because of course Python has XML parsing built in.
import xml.etree.ElementTree as ET
# dbtool.py -- Quick and dirty tool to insert XML formatted storylines into the database.
def nodesearch(nodename, node):
for n in node:
if n.tag==nodename:
return n
... |
import random
def tunings(_ = None):
Within(txt="loc", lo=2, hi=2000)
prep([
# vlow low nom high vhigh xhigh
# scale factors:
'Flex', 5.07, 4.05, 3.04, 2.03, 1.01, _],[
'Pmat', 7.80, 6.24, 4.68, 3.12, 1.56, _],[
'Prec', 6.20, 4.96, 3.72, 2.48, 1.24, _],[
'Resl', 7.07, 5.65, 4.24... |
# Copyright 2020 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
# -*- coding: utf-8 -*-
# ==============================================================================
"""
运行以下命令
python retrain.py \
--bottleneck_dir=/home/clg/tf_files/bottlenecks \
--how_many_training_steps 60 \
--model_dir=/home/clg/tf_files/inception \
--output_graph=/home/clg/tf_files/retrained_graph.pb \
--ou... |
"""Entity class that represents Z-Wave node."""
import logging
from homeassistant.core import callback
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_WAKEUP
from homeassistant.helpers.entity import Entity
from homeassistant.util import slugify
from .const import ATTR_NODE_ID, DOMAIN, COMMAND_CLASS_WAKE_UP
f... |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth.views import login, logout_then_login
from django.views.static import serve
import logging
from importlib import import_module
from django.conf import settings
from TFG.apps.ha... |
#!/usr/bin/python
# This is a plugin that will work with Nagios for monitoring a uPMU
import argparse
import datetime
import math
import pymongo
parser = argparse.ArgumentParser()
parser.add_argument('serialnum', help='the serial number of the uPMU to check on')
parser.add_argument('-c', '--criticaltime', help='the ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
('assets', '0001_initial'),
('catalogue', '0009_auto__add_field_product_rating'),
('promotions', '0001_initial... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-26 19:03
from __future__ import unicode_literals
from django.db import migrations, models
import django_countries.fields
import localflavor.us.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0008... |
import base
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
# number of convolutional filters to use
nb_filters = 32
# size of pooling area for max pooling
pool_size = (2, 2)
# convolution kernel size
kernel_size = (3... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import vim
import re
import xml.etree.ElementTree as ET
import coqtop as CT
import project_file
from collections import deque
import vimbufsync
vimbufsync.check_version([0,1,0], who="coquille")
# Define un... |
# this is needed to load helper from the parent folder
import sys
sys.path.append('..')
# the rest of the imports
import helper as hlp
import pandas as pd
import numpy as np
import sklearn.linear_model as lm
@hlp.timeit
def regression_linear(x,y):
'''
Estimate a linear regression
'''
# create the ... |
from sys import stdout
from twisted.python.log import startLogging, err
from twisted.internet import reactor
from twisted.internet.defer import Deferred, succeed
from twisted.conch.ssh.common import NS
from twisted.conch.scripts.cftp import ClientOptions
from twisted.conch.ssh import filetransfer
from twisted.conch.... |
'''
share.py
'''
# Mountain Climate Simulator, meteorological forcing disaggregator
# Copyright (C) 2015 Joe Hamman
# 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 Lic... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
The signing module defines the various binary pieces of the Chrome application
bundle that need to be signed, as well as providing utilities to sign them.... |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
# Copyright (C) 2017 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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 p... |
# Copyright (C) 2004-2008 Paul Cochrane
#
# 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 (at your option) any later version.
#
# This program is distribut... |
__author__ = 'xiaoxiaoliu'
import platform
import pandas as pd
import numpy as np
import os
def copySnapshots(df_in, snapshots_dir, output_dir):
if not os.path.exists(output_dir):
os.mkdir(output_dir)
swc_files = df_in['swc_file']
if len(swc_files) > 0:
for afile in swc_files:
f... |
from typing import Callable, Union
from numpy import diag, sqrt
from scipy.optimize import curve_fit
from spectrum import Iterable, Spectrum, Tuple
def __linear_func( x: float, m: float, b: float ) -> float:
return m * x + b
def __quad_func( x: float, a: float, b: float, c: float ) -> float:
return a * (x... |
import ast
import logging
import datetime
from pylons import config
from rdflib.namespace import Namespace, RDF, SKOS
from rdflib import URIRef, BNode, Literal
import ckan.logic as logic
from ckanext.dcat.profiles import RDFProfile, DCAT, LOCN, VCARD, DCT, FOAF, ADMS
from ckanext.dcat.utils import catalog_uri, dat... |
#!/bin/python
class linkedinSort:
project_name=\"\";
project_month=\"\";
project_year=0;
def month_to_int(self):
month=self.project_month;
if month == \"January\":
return 1;
if month == \"February\":
return 2;
if month == \"March\":
return 3;
if month == \"April\":
return 4;... |
# -*- coding: utf-8 -*-
import os
import nipype.interfaces.base as nib
from tempfile import mkdtemp
from shutil import rmtree
from nipype.testing import assert_raises, assert_false
import nipype.pipeline.engine as pe
class InputSpec(nib.TraitedSpec):
input1 = nib.traits.Int(desc='a random int')
input2 = nib.... |
#! /usr/bin/env python
""" DESCRIPTION
"""
import glob, sys, csv
from tabulate import tabulate
from Bio.Blast.Applications import NcbiblastpCommandline
"""--- FUNCTIONS ---"""
def carga_csv(file_name):
""" creates a list of lists with a csv file """
tabla = []
cr = csv.reader(open(file_name,"rb"))
... |
import app.basic, settings, ui_methods
import logging, datetime
import tornado.web
from db.entrydb import Entry
########################
### AddEntry
### User clicked "Learn More"
### api/addentry
########################
class AddEntry(app.basic.BaseHandler):
def post(self):
logging.info("POST to /addent... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
from setuptools import setup
import versioneer
HERE = os.path.abspath(os.path.dirname(__file__))
__project__ = 'wine-vision'
__author__ = 'merry31'
__author_email__ = 'julien.rallo@gmail.com'
__url__ = 'https://github.com/PolarTeam/... |
#!/usr/bin/env python
"""
_delegate_
Main cirrus command that delegates the call to
the sub command verb enabling
git cirrus do_a_thing to be routed to the appropriate
command call for do_a_thing
"""
import os
import os.path
import pkg_resources
import sys
import signal
import subprocess
import cirrus.environment ... |
# -*- coding: utf-8 -*-
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
class bxinth (Exchange):
def describe(self):
return self.deep_extend(super(bxinth, self).describe(), {
'id': 'bxinth',
'name': 'BX.in.th',
'countries': 'TH', # ... |
from __future__ import unicode_literals
import threading
import weakref
from functools import wraps
import six
from psycopg2cffi._impl import consts
from psycopg2cffi._impl import encodings as _enc
from psycopg2cffi._impl import exceptions
from psycopg2cffi._impl.libpq import libpq, ffi
from psycopg2cffi._impl import... |
from mlxtend.classifier import LogisticRegression
from mlxtend.data import iris_data
import numpy as np
X, y = iris_data()
X = X[:, [0, 3]] # sepal length and petal width
X = X[0:100] # class 0 and class 1
y = y[0:100] # class 0 and class 1
# standardize
X[:, 0] = (X[:, 0] - X[:, 0].mean()) / X[:, 0].std()
X[:, 1... |
import operator
from collections import defaultdict
from itertools import groupby
from operator import itemgetter
from functools import reduce
from django.db.models import Q
from mi.models import (
HVCGroup,
SectorTeam,
Target,
)
from mi.utils import sort_campaigns_by
from mi.views.base_view import BaseWi... |
import logging
from time import sleep
import scorer.fetch_scores as fs
import scorer.notification as notify
from scorer.system import exitApp
from scorer.ui import getUserInput
logger = logging.getLogger("scorer.app")
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler("scorer.log")
fh.setLevel(logging.DEBUG)
ch ... |
# $Id: PlotItems.py 299 2007-03-30 12:52:17Z mhagger $
# Copyright (C) 1998-2003 Michael Haggerty <mhagger@alum.mit.edu>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""PlotItems.py -- Objects that can be plotted by Gnuplot.
This module contains severa... |
import py.test
from hippy.objects.floatobject import W_FloatObject
from testing.test_interpreter import BaseTestInterpreter
class TestVarFuncs(BaseTestInterpreter):
def test_print_r(self):
output = self.run('''
class A {
private $y = 5;
}
$a = new A;
$a->x = arra... |
# -*- coding: utf-8 -*-
"""
(c) 2014-2016 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
Ralph Bean <rbean@redhat.com>
"""
import logging
from defusedxml import ElementTree as ET
from anitya.lib.backends import BaseBackend, get_versions_by_regex, REGEX
from anitya.lib.exceptions... |
#!/usr/bin/env python
import ads
from ads.Looker import Looker
class ConvertBibcodes:
def __init__(self):
self.bib2alt = Looker(ads.alternates).look
self.bib2epr = Looker(ads.pub2arx).look
self.alt2bib = Looker(ads.altlist).look
self.epr2bib = Looker(ads.ematches).look
def get... |
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
# xierpa server
# Copyright (c) 2014+ buro@petr.com, www.petr.com, www.xierpa.com
#
# X I E R P A 3
# Distribution by the MIT License.
#
# ---------------------------------------------------------------... |
import collections
import httplib
import urllib
import urlparse
from django.conf import settings
from django.contrib.messages import error, success, warning
from django.core.urlresolvers import reverse_lazy
from django.db.models import F
from django.http import HttpResponseRedirect
from django.shortcuts import render_t... |
# -*- coding: utf-8 -*-
# Copyright (c) 2008 - 2009 Lukas Hetzenecker <LuHe@gmx.at>
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import logging
class QtStreamHandler(logging.Handler):
def __init__(self, parent, main):
logging.Handler.__init__(self)
self.parent = parent
self.main... |
# 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 distributed in the hope that it will be useful
# but... |
# -*- coding: utf-8 -*-
# Copyright 2021 Green Valley NV
#
# 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 l... |
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from .views import StudentListLectureView, InstructorListLectureView, RegisteredLectureCreateView, CreateLectureView, \
LectureDetailView, LectureListView, UserRegisteredLectureView, UserRegisteredLectureApproveView, \
CreateAtte... |
#!/usr/bin/python3
"""
my.installer.__init__
# TESTING "PHASE ONE", ONE LINE AT A TIME...
import os
from willywonka_installer import *
from my.installer import *
args = Object()
args.skipalltools = True
args.platform = 'RaspberryPi3'
args.debugip = '192.168.251.112'
args.usegzipo = True
args.outfile = '%s/testout.i... |
from setuptools import setup
setup(
name="dacite",
version="1.6.0",
description="Simple creation of data classes from dictionaries.",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
author="Konrad Hałas",
author_email="halas.konrad@gmail.com",
u... |
"""
Todo: cross-check the F-value with stats model
"""
import itertools
import numpy as np
from scipy import stats, sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_true
... |
"""Config flow to configure the Arcam FMJ component."""
import logging
from urllib.parse import urlparse
from arcam.fmj.client import Client, ConnectionFailed
from arcam.fmj.utils import get_uniqueid_from_host, get_uniqueid_from_udn
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.... |
"""Workflow to compute the derivate coupling between states.
The ``workflow_derivative_couplings`` expected a file with a trajectory-like
file with the molecular geometries to compute the couplings.
Index
-----
.. currentmodule:: nanoqm.workflows.workflow_coupling
.. autosummary::
"""
__all__ = ['workflow_derivative... |
# coding: utf-8
import os
import operator
PRODUCTION = os.environ.get('SERVER_SOFTWARE', '').startswith('Google App Eng')
DEBUG = DEVELOPMENT = not PRODUCTION
try:
# This part is surrounded in try/except because the config.py file is
# also used in the run.py script which is used to compile/minify the client
... |
#!/usr/bin/env python3
"""
This example provides a JSON-RPC API to query blockchain data, implementing `neo.api.JSONRPC.JsonRpcApi`
"""
import argparse
import os
from logzero import logger
from twisted.internet import reactor, task
from neo import __version__
from neo.Core.Blockchain import Blockchain
from neo.Imple... |
"""Fix update_courses
Revision ID: 7004250e3ef5
Revises: 8a786f9bf241
Create Date: 2017-09-27 09:34:46.069174
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7004250e3ef5'
down_revision = '8a786f9bf241'
branch_labels = None
depends_on = None
def upgrade():
... |
'''
Created on 2 de set de 2016
@author: fvj
'''
import pygame, chess
from random import choice
from traceback import format_exc
from sys import stderr
from time import strftime
from copy import deepcopy
pygame.init()
SQUARE_SIDE = 50
AI_SEARCH_DEPTH = 2
RED_CHECK = (240, 150, 150)
WHITE ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017,2018,2019 Jeremie DECOCK (http://www.jdhp.org)
# 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, inclu... |
#!/usr/bin/python
from math import log
from PIL import Image, ImageDraw
my_data=[['slashdot','USA','yes',18,'None'],
['google','France','yes',23,'Premium'],
['digg','USA','yes',24,'Basic'],
['kiwitobes','France','yes',23,'Basic'],
['google','UK','no',21,'Premium'],
['(direct)','New Zealand','no',12,'None'],
['(... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools import float_compare
class MrpProductProduce(models.TransientModel):
_name = "mrp.product... |
# https://github.com/django-nonrel/djangotoolbox/blob/master/djangotoolbox/fields.py
# All fields except for BlobField written by Jonas Haag <jonas@lophus.org>
from django.core.exceptions import ValidationError
from django.utils.importlib import import_module
from django.db import models
from django.db.models.fields.s... |
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
from __future__ import absolute_import, print_function
from itertools import imap
import logging
import toronado
from email.utils import parseaddr
from flask import current_app, render_template
from flask_mail import Message, sanitize_address
from jinja2 import Markup
from typing import List # NOQA
from changes.con... |
#!/usr/bin/python
###########################################################################
#
# FILE: plugin.program.tvhighlights/default.py
#
# AUTHOR: Tobias D. Oestreicher
#
# LICENSE: GPLv3 <http://www.gnu.org/licenses/gpl.txt>
# VERSION: 0.1.5
# CREATED: 05.02.2016
#
######... |
# -*- coding: utf-8 -*-
'''
This module produces SVG files with hemicycles representations.
'''
##
# Imports
##
from pysvg.structure import svg, g, defs, use, title
from pysvg.builders import TransformBuilder, ShapeBuilder
from pysvg.shape import path
from pysvg.style import style
from math import sin, cos, pi, flo... |
import unittest
import httplib2
import Queue
from pycrawler.Crawler.fetcher import Job, HtmlUrlExtractor, TextUrlExtractor, \
UrlExtractor, Fetcher
from pycrawler.Crawler.setting import PARAM
from pycrawler.Crawler.asyncdns import DnsCacher
class testFetcher(unittest.TestCase):
def test_Job(self):
ne... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
'''
* Copyright 2016 Hackers' Club, University Of Peradeniya
* Author : Irunika Weeraratne E/11/431
*
* 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-... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, 2014, Pyhrol, pyhrol@rambler.ru
# GEO: N55.703431,E37.623324 .. N48.742359,E44.536997
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistri... |
import os
import numpy as np
import scipy.misc
import h5py
import random
np.random.seed(123)
# loading data from .h5
class DataLoaderH5(object):
def __init__(self, **kwargs):
self.load_size = int(kwargs['load_size'])
self.fine_size = int(kwargs['fine_size'])
self.data_mean = np.array(kwar... |
"""
Django settings for site1 project.
Generated by 'django-admin startproject' using Django 1.8.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ... |
''' fakeEnvironment
this module allows to create the documentation without having to do
any kind of special installation. The list of mocked modules is:
GSI
'''
import mock
import sys
#...............................................................................
# mocks...
class MyMock(mock... |
# Copyright (C) 2015 ABRT Team
# Copyright (C) 2015 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# All rights reserved.
#
# 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
# no... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 6 10:49:45 2015
@author: wirkert
"""
import numpy as np
import time
from sklearn.ensemble import RandomForestRegressor
from sklearn.grid_search import GridSearchCV
from sklearn.cross_validation import KFold
from sklearn import decomposition
from setup imp... |
"""
Summary:
Main file loader for the API. This offers convenience methods to make it
simple to load any type of file from one place.
Author:
Duncan Runnacles
Created:
01 Apr 2016
Copyright:
Duncan Runnacles 2016
TODO:
Updates:
"""
from __future__ import unicode_literals
fro... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# -*- coding: utf-8 -*-
"""This is a generated class and is not intended for modification!
"""
from datetime import datetime
from infobip.util.models import DefaultObject, serializable
from infobip.api.model.nc.notify.NumberContextResponseDetails import NumberContextResponseDetails
class NumberContextResponse(Defau... |
#!/usr/bin/env python2
import ctypes
import platform
from logging import getLogger
logger = getLogger(__name__)
class c_cudaDeviceProp(ctypes.Structure):
"""
Passed to cudart.cudaGetDeviceProperties()
"""
_fields_ = [
('name', ctypes.c_char * 256),
('totalGlobalMem', ctypes.c_size_t)... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('../..')
from config.settings import Collection, db
import feedparser
col = Collection(db, 'feeds')
"""
f = open('db_id_list', 'r')
feed_ids = f.readlines()
feed_ids = [feed_id.strip() for feed_id i... |
#@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script contains useful classes and fuctions for orka package.
@author: e-science Dev-team
"""
import logging
import re
import subprocess
import yaml
import urllib
import requests
from urllib2 import urlopen, Request, HTTPError
from base64 import b64encode
from os... |
# Copyright 2018 Red Hat, Inc. and others. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
"""
run this with ./manage.py test website
see http://www.djangoproject.com/documentation/testing/ for details
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.template import Context
from django.template.loader import get_temp... |
'''
Created on 2012-10-20
@author: Gary
'''
from housemonitor.lib.base import Base
from housemonitor.lib.constants import Constants
from pprint import pprint
from SimpleXMLRPCServer import SimpleXMLRPCServer
import pprint
import threading
import time
import os
from housemonitor.inputs.dataenvelope import DataEnvelope... |
#coding:utf-8
#首先引入QUANTAXIS
import QUANTAXIS as QA
#引入random模块是为了如果用到多账户的时候的初始化
import random
#import (你的策略)
#继承QUANTAXIS的backtest类,backtest会自带account类,market(报价对象,撮合类),setting类(全局设置,局域网数据库,回测账户等等)
class backtest(QA.QA_Backtest):
#对回测过程进行初始化
def init(self):
#对账户进行初始化
self.account=QA.QA_Accoun... |
from __future__ import absolute_import
import sys
if (sys.version_info > (3, 0)):
# Python 3 code in this block
import urllib.request as urllib2
else:
# Python 2 code in this block
import urllib2
import socket, threading, os
'''''
Handles downloading subsets of grib2 files.
With this class you can do a once ... |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... |
import re
import json
import functools
import urllib, urllib2
import sublime, sublime_plugin, threading
import webbrowser
class RedmineError(Exception):
pass
def main_thread(callback, *args, **kwargs):
# sublime.set_timeout gets used to send things onto the main thread
# most sublime.[something] calls need to b... |
import threading, time, subprocess
from bluetooth import *
server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)
port = server_sock.getsockname()[1]
uuid = "c3091f5f-7e2f-4908-b628-18231dfb5034"
advertise_service( server_sock, "PiRecorder",
service_id = uuid,
... |
# -*- coding:utf-8 -*-
import sys
sys.path.append("..")
import os
from heat.openstack.common import log as logging
import json
import vcloud_proxy_data_handler
from pyvcloud import vcloudair
LOG=logging.getLogger(__name__)
_vcloud_proxy_install_conf = os.path.join("/home/hybrid_cloud/conf",
... |
import ply
import re
from .customised_lexer import CustomisedLexer
from ._lex_utilities import *
maximum_identifier_length = 99
states = (
('singleQuotedString', 'exclusive'),
('doubleQuotedString', 'exclusive'),
)
reserved_words = (
'boolean', 'number', 'vector', 'point', 'line', 'plane',
'horizonta... |
import gevent
import urllib
try:
import urllib.parse as urlparse
except ImportError:
import urlparse
from geventwebsocket import WebSocketError
from gevent.queue import Empty
class BaseTransport(object):
"""Base class for all transports. Mostly wraps handler class functions."""
def __init__(self, han... |
import asyncio
import random
from ircbot.persist import Persistent
from ircbot.text import parse_time
from ircbot.plugin import BotPlugin
from .helpers import public_api, mkurl, protect, full_pamela, spaceapi
from datetime import datetime
from time import time
from operator import itemgetter
minutes = 60
hours = 60 * ... |
"""
WSGI config for parilis project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... |
#!/usr/bin/env python
# Copyright 2013 AlchemyAPI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# -*- coding: utf-8 -*-
#
# This file is part of RERO ILS.
# Copyright (C) 2017 RERO.
#
# RERO ILS 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 (at your option) any lat... |
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # Django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
... |
# Copyright (c) 2020 Dell Inc. or its subsidiaries.
#
# 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... |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from widgetastic.exceptions import NoSuchElementException
from cfme import test_requirements
from cfme.automate.explorer.domain import DomainCollection
from cfme.automate.simulation import simulate
from cfme.common.vm import VM
from cfme.infrastructure.provider.... |
# onlineldavb.py: Package of functions for fitting Latent Dirichlet
# Allocation (LDA) with online variational Bayes (VB).
#
# Copyright (C) 2010 Matthew D. Hoffman
#
# 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... |
# Copyright 2011 James O'Neill
#
# This file is part of Kapua.
#
# Kapua 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.
#
# Kapua is d... |
import asyncio
import pytest
import async_timeout
from unittest.mock import patch
from aioredis import (
ReplyError,
PoolClosedError,
ConnectionClosedError,
ConnectionsPool,
MaxClientsError,
)
def _assert_defaults(pool):
assert isinstance(pool, ConnectionsPool)
assert pool.minsize ==... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.