src stringlengths 721 1.04M |
|---|
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'EVS.aa_ac_alt'
db.alter_column('evs', 'aa_ac_alt', self.gf('django.db.models.fields.Char... |
# vim:expandtab:smarttab
import logging, os, fileprocess
import os.path as path
from filemq.configuration import config
from nextaction import na
from baseaction import BaseAction
import guid
from hashlib import sha1
log = logging.getLogger(__name__)
class Transcoder(BaseAction):
"""
This class converts a fil... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
"""
Views related to content libraries.
A content library is a structure containing XBlocks which can be re-used in the
multiple courses.
"""
from __future__ import absolute_import
import logging
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions imp... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Writing Q_phi into a C code ------------------------------------------
#Q_phi_time=Q2n
#Q_phi_convection=Q1n
#Q_phi_diffusion=Q3n
#unassigning variables Q_phi_time and Q_phi_convection in order to write a more readable C code
var('Q_phi_time, Q_phi_convection, Q_phi_diffusion')
Q_phi=Q_phi_time+Q_phi_convection+... |
"""
A Simple server used to show altair graphics from a prompt or script.
This is adapted from the mpld3 package; see
https://github.com/mpld3/mpld3/blob/master/mpld3/_server.py
"""
import sys
import threading
import webbrowser
import socket
import itertools
import random
from ._py3k_compat import server, IO
JUPYTER_... |
# Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2012 OpenStack Foundation.
# 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 req... |
# This file is part of OtfBot.
#
# OtfBot 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.
#
# OtfBot is distributed in the hope that it... |
#!/usr/bin/env python
import codecs
import os
import sys
os.environ['TENSORLAYER_PACKAGE_BUILDING'] = 'True'
try:
from setuptools import find_packages, setup, Extension
from setuptools.command.build_ext import build_ext
except ImportError:
from distutils.core import (
setup,
find_package... |
"""
Loadable.Loadable subclass
"""
# This file is part of Munin.
# Munin 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.
# Munin is... |
import os
from cStringIO import StringIO
from django.conf import settings
from django.template.loader import get_template
from django.template import Context
from wkhtmltopdf.utils import wkhtmltopdf
from django.contrib.auth import login
from django.contrib.auth.models import User
import smartfile
from smartclip impor... |
# -*- coding: utf-8 -*-
""" Convolutional Neural Network for MNIST dataset classification task.
References:
Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. "Gradient-based
learning applied to document recognition." Proceedings of the IEEE,
86(11):2278-2324, November 1998.
Links:
[MNIST Dataset] http://... |
# Problem a
def solve(n, l, ip):
assert n < 30, "n should be less than 300"
s = sum(ip)
rem = n - s
pc = [round_pc(v / n) for v in ip]
res = sum(pc)
if rem == 0:
return res
extra = [round_pc(i / n) for i in range(rem + 1)]
for v, p in zip(ip, pc):
if rem == 0:
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import argparse
import logging
import pkgutil
import string
from cloudenvy.config import EnvyConfig,Config
import cloudenvy.commands
#TODO(bcwaldon): replace this with entry points!
def _load_commands():
"""Iterate through modules in command and import suspected comm... |
"""A python module for manipulating deeply nested data structures
without mutating them.
A simple overview for this module is available in the readme or
at [http://github.com/ingolemo/python-lenses] . More detailed
information for each object is available in the relevant
docstrings. `help(lenses.UnboundLens)` is parti... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import json
import pytz
from datetime import datetime
from psycopg2 import IntegrityError
from werkzeug.exceptions import BadRequest
from odoo import http, SUPERUSER_ID, _
from odoo.http import request
fr... |
from rgf.dsl import *
from rgf.core.examples import ExampleGroup, ExampleSuite
def first_test_function(world):
world.has_been_run = True
def before_func(world):
world.before_was_run = True
with subject('DSL'):
@it('provides subject helper context to create and set current ExampleGroup')
def spec(wor... |
from gi.repository import GLib, GObject
import os
import sqlite3
import logging
import threading
import queue
logger = logging.getLogger('trifle')
from trifle.utils import const, async, get_data_path
class SQLite(threading.Thread):
def __init__(self, *args, **kwargs):
super(SQLite, self).__init__()
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado, #
# Diego Muñoz Escalante. #
# (pacoqueen@users.sourceforge.ne... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 to us... |
# Import Modules as needed
import numpy as np
#import seaborn as sn
import pandas as pd
from pylab import *
from mylocal_functions import *
# ======== T2 MSME============= #
# Make list of all T2.txt files
T2_list = get_ipython().getoutput('ls ../Study_03_CBA/*T2.txt')
# Allocate variables needed for analysis
T2DF=pd... |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Openstack, LLC.
# 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
#
# ... |
"""
ESRF-BCU acquisition with internal master:
counter 11 counts the acquisition time (using internal clock);
counter 12 counts the number of points
"""
import os
import sys
import time
import pprint
import logging
import argparse
import datetime
import numpy
from bliss.controllers.ct2.card import (P201Card, Clock, ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2015 RyePDX LLC
# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
# Copyright (C) 2004-2010 OpenERP SA (<http://www.ope... |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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
#
# Un... |
#/usr/bin/python
from __future__ import division
from __future__ import with_statement
import math
import matplotlib
from matplotlib import pyplot
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy
from numpy import mean as amean
import os
import re
from scipy.spatial import Delaunay
from scipy.spatia... |
"""
Django settings for atm project.
Generated by 'django-admin startproject' using Django 1.8.2.
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 in... |
import asyncio
import sys
from notepadqq_api.message_channel import MessageChannel
from notepadqq_api.message_interpreter import MessageInterpreter
from notepadqq_api.stubs import Stubs
class NotepadqqApi():
"""Provides access to the Notepadqq Api."""
_NQQ_STUB_ID = 1
def __init__(self, socket_path=None... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Evaporation'
db.delete_table('rainman_evaporation')
# Adding model 'Environment... |
from django.db import models
from ckeditor.fields import RichTextField
# Create your models here.
## -------------------------------------------------
## Meta Class contenant certaines donnees de bases
## -------------------------------------------------
DEF_TFAC='DEFAUT'
class HoroDatage(models.Model):
h_datcre ... |
#!/usr/bin/env python3
# mkobt --light white --dark black --active blue --inactive darkgrey
# --box grey --notify yellow --menu orange -w red
import configparser
import os
import argparse
def get_config(configfile):
''' Get config from config file. Overwrited by command line options. '''
# FIXME: Need to val... |
""" test code to make a design matrix
"""
import numpy as np
from nipy.neurospin.utils.design_matrix import dmtx_light
tr = 1.0
frametimes = np.linspace(0,127*tr,128)
conditions = [0,0,0,1,1,1,3,3,3]
onsets=[30,70,100,10,30,90,30,40,60]
hrf_model = 'Canonical'
motion = np.cumsum(np.random.randn(128,6),0)
add_reg_name... |
"""@file deepclusteringnoise_reconstructor.py
contains the reconstor class using deep clustering for modified noise architecture"""
from sklearn.cluster import KMeans
import mask_reconstructor
from nabu.postprocessing import data_reader
import numpy as np
import os
class DeepclusteringnoiseReconstructor(mask_reconst... |
print "importing stuff..."
import numpy as np
import pdb
# import matplotlib
# matplotlib.use('Agg')
import matplotlib.pylab as plt
from scipy import special
from .context import aep
from .datautils import step, spiral
from .context import config
def run_regression_1D():
np.random.seed(42)
print "create dat... |
# coding=UTF8
# Строчка выше нужна на случай использования Non-ASCII символов, например кириллицы.
ms_RxTx = {
# RX .1.3.6.1.2.1.31.1.1.1.6 ifHCInOctets
'~RX.1' : '.1.3.6.1.2.1.31.1.1.1.6.1',
'~RX.2' : '.1.3.6.1.2.1.31.1.1.1.6.2',
'~RX.3' : '.1.3.6.1.2.1.31.1.1.1.6.3',
'~RX... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Product.language'
db.add_column('wlansi_store_product', 'language',
se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#########################################################################
# BotTelegram Zabbix
# Filename: botTelegram-zabbix.py
##########################################################################
from telegram.ext import Updater, CommandHandler
import logging
imp... |
# coding: utf-8
"""
Здесь будем проверять запросы к ресурсу типа адрес
"""
import json
import requests_mock
from .common import CommonTestCase
from dadata import DaDataClient
ADDRESS_REQUEST = "мск сухонска 11/-89"
ADDRESS_RESPONSE = """[
{
"source": "мск сухонска 11/-89",
"result": "г Москва, ул Сухонс... |
#
# Simulation of a 3D buoyant smoke density plume
# guided by a low res sim
#
# parameterss:
# W = guiding weight (constant value of wScalar)
# beta = blur radius
#
from manta import *
# params from original simulation
# res1 = before interp, res2 = after interp
timestep = 0.65
res1 = 40
numFrames = 200
factor ... |
#This file was originally generated by PyScripter's unitest wizard
import unittest
from gol03 import Gol03
def dummy():
""" Dummy function for comparison of the return values """
return
class Gol03Test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pa... |
# -*- coding: utf-8 -*-
from __future__ import division
import os
from ..model.base import *
dir_path = os.path.join(os.path.dirname(__file__), 'parameters')
# TODO: les baisses de charges n'ont pas été codées car annulées (toute ou en partie ?)
# par le Conseil constitutionnel
class plfr2014(Reform):
name ... |
import logging
from src.configuration import settings
from src.configuration.settings import LOG_DIR
def init():
level_mode = logging.DEBUG if settings.DEBUG else logging.INFO
logging.basicConfig(level=level_mode)
logger = logging.getLogger()
logger_matching_engine = logging.getLogger('DATA... |
# JACK MIDI LOOPER
# Copyright (C) 2014 Joshua Otto
#
# 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 any later version.
#
# This program is dis... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import librosa
import numpy as np
from scipy.spatial.distance import cdist
from nose.tools import raises
from test_core import srand
import warnings
warnings.resetwarnings()
warnings.simplefilter('always')
@raises(librosa.ParameterError)
def test_1d_input():
X = ... |
"""
Keep track of which players are connected.
Each player is connected through a tweb server, so each PlayerConnection
is associated with a WebConnIOStream. (In fact, the way tworld is currently
set up, each PlayerConnection is associated with the *same* WebConnIOStream.
We only have one.)
"""
from bson.objectid imp... |
#!/usr/bin/python
import sys
import logging
from m3_common import m3_common
m3_common.configure_root_logger()
logger = logging.getLogger(__name__)
class mbus_message_generator(m3_common):
TITLE = "MBus Message Generator"
def parse_args(self):
if len(sys.argv) not in (2,):
logger.info("U... |
import numpy, h5py, os
from PnSC_main import *
from PnSC_h5io import *
from PnSC_math import *
p='C:/Users/JohnnyG/Documents/PythonCode/Vlassak/NanoCalorimetry/20110816_Zr-Hf-B.h5'
h5f=h5py.File(p, mode='r')
ehl=[\
('quadlinheating2_0817', 'cell9_25mAlinquad2_first_1_of_1', 'Zr-B, 1st'),\
('quadlinheating2_0817', 'ce... |
#!/usr/bin/env python3
import functools
import http.client
import json
import math
import os
import subprocess
import shutil
import time
import uuid
from xml.etree import ElementTree
import bs4
import opster
import requests
#NOTE: if the website is protected by cloudflare, removing User-Agent header will help to pas... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import sys
import setuptools
from distutils.command.clean import clean as _clean
from distutils.command.build import build as _build
from setuptools.command.sdist import sdist as _sdist
from setuptools.command.build_ext import build_ext as _build_ext
try:
... |
from CommonServerPython import *
from CheckContextValue import poll_field
context = {
'id': 1,
'name': 'This is incident1',
'type': 'Phishing',
'severity': 0,
'status': 1,
'created': '2019-01-02',
'closed': '0001-01-01T00:00:00Z',
'foo': 'bar',
}
missing_context = {
'id': 2,
'n... |
## Just some utility functions for logging messages. Most important is getLogger.
import sys, pprint, json, logging, configuration
### Constants ###
#################
## Can only log in stderr (or environ['wsgi.errors']) when using WSGI:
def dbg(msg):
print >> sys.stderr, msg
def pp(obj):
"""
shortcut ... |
# Test passed :)
# TODO: split right here before the conditional.
import sys
def handle_input_output():
# handle input
graph = {}
while True:
try:
line = sys.stdin.readline().rstrip('\n')
left, right = line.split(' -> ')
if left in graph.keys():
... |
"""
An H2OConnection represents the latest active handle to a cloud. No more than a single
H2OConnection object will be active at any one time.
"""
from __future__ import print_function
from __future__ import absolute_import
import requests
import math
import tempfile
import os
import re
import sys
import time
import s... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
import string
import types
## json.py implements a JSON (http://json.org) reader and writer.
## Copyright (C) 2005 Patrick D. Logan
## Contact mailto:patrickdlogan@stardecisions.com
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser Genera... |
# coding=utf-8
import re
import urllib
import json
import os, random
BASE_DOWN_DIR = './download'
BASE_DOWN_POSTS_DIR = BASE_DOWN_DIR + '/posts'
BASE_URL = 'http://www.douban.com/photos/photo/2230938262/'
class AppURLopener(urllib.FancyURLopener):
version = "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/5... |
#!python
# coding=utf-8
from pyaxiom.netcdf import CFDataset
from pyaxiom import logger
class ContiguousRaggedTimeseries(CFDataset):
@classmethod
def is_mine(cls, dsg):
try:
rvars = dsg.get_variables_by_attributes(cf_role='timeseries_id')
assert len(rvars) == 1
as... |
"""
Non linear waves
"""
from proteus import Domain, Context
from proteus.mprans import SpatialTools as st
from proteus import WaveTools as wt
import math
import numpy as np
opts=Context.Options([
# predefined test cases
("water_level", 0.4, "Water level from y=0"),
# tank
("tank_dim", (7.8, 0.7), "Dim... |
from __future__ import print_function
import argparse
import ast
import cProfile
import imp
import locale
import os
import pkgutil
import select
import sys
from collections import OrderedDict
from contextlib import contextmanager
from copy import deepcopy
from datetime import datetime
from json import dumps, loads
fr... |
import time, calendar
from Ft.Lib import Time
def utcTupleToLocal8601(utctuple):
loc_tuple = time.localtime(calendar.timegm(utctuple))
if loc_tuple[8] == 1:
offset_secs = time.altzone
else:
offset_secs = time.timezone
if offset_secs == 0:
offset_str = 'Z'
else:
offse... |
"Test searchengine, coverage 99%."
from idlelib import searchengine as se
import unittest
# from test.support import requires
from tkinter import BooleanVar, StringVar, TclError # ,Tk, Text
from tkinter import messagebox
from idlelib.idle_test.mock_tk import Var, Mbox
from idlelib.idle_test.mock_tk import Text as mo... |
# --- IMPORTS ---
import simplejson
import numpy as np
import os
import sys
import traceback
import time
try:
import urllib.parse as urllibParse
except ImportError:
import urllib as urllibParse
try:
import urllib.request as urllibRequest
except ImportError:
import urllib as urllibRequest
# Before using th... |
"""Graphical user interface to Delta-Elektronika SM-700 Series
controllers."""
import sys
import pyhard2.driver as drv
import pyhard2.driver.virtual as virtual
import pyhard2.driver.deltaelektronika as delta
import pyhard2.ctrlr as ctrlr
def createController():
"""Initialize controller."""
config = ctrlr.Co... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Card.multiverse_id'
db.alter_column(u'cards_card', 'mu... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import shutil
try:
from io import BytesIO
except ImportError:
from cStringIO import StringIO as BytesIO
import logbook
from django.utils.text import slugify
from django.core.management import call_command
from instance.con... |
# Copyright 2015 The Shaderc Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
from cs231n.layers import *
from cs231n.fast_layers import *
def affine_relu_forward(x, w, b):
"""
Convenience layer that perorms an affine transform followed by a ReLU
Inputs:
- x: Input to the affine layer
- w, b: Weights for the affine layer
Returns a tuple of:
- out: Output from the R... |
#!/usr/bin/python
# CC0, 2017 :: Kirinn Bunnylin / Mooncore
# https://creativecommons.org/publicdomain/zero/1.0/
import sys, re, time, subprocess
#from subprocess import check_output
if len(sys.argv) < 2:
print("Usage: python translate.py inputfile.tsv >outputfile.tsv")
print("The input file should be a tsv. The ... |
# -*- coding: utf-8 -*-
#
# File : echotorch/nn/ESN.py
# Description : An Echo State Network module.
# Date : 26th of January, 2018
#
# This file is part of EchoTorch. EchoTorch 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 Sof... |
import datetime
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from scrivo.models import Post
from scrivo.settings import DEFAULT_PAGINATE_BY, INDEX_POST_COUNT
from scrivo.tests.base import BlogPostTest, f
class PostViewTest(BlogPos... |
# coding=utf-8
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from PIL import Image
path = "../datasets/demo_picture/cat.jpg"
img = Image.open(path)
# 获取长宽
print img.size
image_raw_data = tf.gfile.FastGFile("../datasets/demo_picture/cat.jpg", 'r').read()
img_data = tf.image.decode_jpeg(im... |
# Lots Of Sprites
"""
Results (us per sprite per frame):
sprites AMD64/mesa AMD64/nv6.6k MacBook Pro AMD/nv7.8k
2000 28.3 29.3 20.6 22.0
after __slots__ removal
sprites AMD64/mesa AMD64/nv6.6k MacBook Pro AMD/nv7.8k
2000
"""
import os
import sys
import random
from pyglet ... |
import pickle
import uuid
try:
import kombu
except ImportError:
kombu = None
from .pubsub_manager import PubSubManager
class KombuManager(PubSubManager): # pragma: no cover
"""Client manager that uses kombu for inter-process messaging.
This class implements a client manager backend for event shari... |
from datetime import datetime, timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import Index, Timedelta, TimedeltaIndex, timedelta_range
import pandas.util.testing as tm
class TestGetItem:
def test_ellipsis(self):
# GH#21282
idx = timedelta_range('1 day', '31 day', freq... |
# -*- coding: utf-8 -*-
#
# Xentriq documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 26 16:44:14 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
#!/usr/bin/env python3
"""
Print arguments with first letter in upper case (camel case).
"""
import argparse
import glob
import os
import signal
import sys
from typing import List
class Options:
"""
Options class
"""
def __init__(self) -> None:
self._args: argparse.Namespace = None
s... |
from django.db import models
from django.contrib.staticfiles import finders
class Video(models.Model):
annotation = models.TextField(blank=True,
help_text="A JSON blob containing all user annotation sent from client.")
source = models.CharField(max_length=1048, blank=True,
help_text=("Name of v... |
file = open("input.txt", "r")
input = file.next()
sequence = input.split(", ")
class walker:
def __init__(self):
self.east = 0
self.south = 0
self.facing = 0
self.tiles = {}
def turnL(self):
if self.facing == 0:
self.facing = 3
else:
self.facing -= 1
def turnR(self):
i... |
import matplotlib
#Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import scipy.io as sio
import os
import sys
import numpy
import theano
import theano.tensor as T
import gzip
import cPickle
from convolutional_mlp import LeNetConvPoolLayer
from logi... |
# this is the magic interpreted by Sonata, referring to on_enable etc. below:
### BEGIN PLUGIN INFO
# [plugin]
# plugin_format: 0, 0
# name: Test plugin
# version: 0, 0, 1
# description: A simple test plugin.
# author: Tuukka Hastrup
# author_email: Tuukka.Hastrup@iki.fi
# url: http://sonata.berlios.de
# license: GPL... |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of mozaik_sample_accounting, an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# mozaik_sample_accounting is free software:
# you can redistribute it and/... |
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
from flask import abort
from flask.ext.restful import Resource, reqparse, fields, marshal
from bson.objectid import ObjectId
from abacuspb import db
import pymongo
category_fields = { # Request validator
'name': fields.String,
'parent_id': fields.String,
'budget_tracked': fields.Boolean,
'uri': fields.... |
from ROOT import TMVA
from array import array
from rootpy.extern import ordereddict
import logging
log = logging.getLogger('DecisionTool')
class DecisionTool:
def __init__(self,tree,name,weight_file,var_file,cutval):
""" A class to handle the decision of the BDT"""
TMVA.Tools.Instance()
s... |
from flask import *
from app.mod_streams.models import Stream
from app.mod_streams import stream_api
from .forms import ConfigForm
from app.mod_adminpanel.views import register_adminpanel
from flask_login import login_required
mod_streams = Blueprint('streams', __name__, url_prefix='/streams', template_folder='templat... |
import os
import shutil
import sys
import click
import apistar
from apistar import schema
APISTAR_PACKAGE_DIR = os.path.dirname(apistar.__file__)
LAYOUTS_DIR = os.path.join(APISTAR_PACKAGE_DIR, 'layouts')
LAYOUT_CHOICES = os.listdir(LAYOUTS_DIR)
IGNORED_DIRECTORIES = ['__pycache__']
class TargetDir(schema.String):... |
class Solution:
# @param board, a 9x9 2D array
# Solve the Sudoku by modifying the input board in-place.
# Do not return any value.
def solveSudoku(self, board):
rowUsable = [set(xrange(1, 10)) for i in xrange(9)]
colUsable = [set(xrange(1, 10)) for i in xrange(9)]
blockUsable = ... |
#!/usr/bin/python
#-*-coding:utf8-*-
__author__ = 'laixintao'
import socket
import fcntl
import time
import struct
import smtplib
import urllib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
import re
import urllib2
# the e-mail config
# thi... |
# AUTHOR: Kale Miller
# DESCRIPTION: The 'main brain' of the program is held in here.
# 50726f6772616d6d696e6720697320627265616b696e67206f66206f6e652062696720696d706f737369626c65207461736b20696e746f20736576
# 6572616c207665727920736d616c6c20706f737369626c65207461736b732e
# DEVELOPMENT LOG:
# 07/12/16: Initi... |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
# Copyright 2013 eNovance
# Copyright 2014 Red Hat, Inc
#
# Authors: Doug Hellmann <doug.hellmann@dreamhost.com>
# Julien Danjou <julien@danjou.info>
# Eoghan Glynn <eglynn@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "Licens... |
# -*- coding: utf-8 -*-
from nntplib import NNTP
from time import strftime, time, localtime
from email import message_from_string
from urllib import urlopen
import textwrap
import re
day = 24 * 60 * 60 # 一天的秒数
def wrap(string, max = 70):
"""
将字符串调整为最大行宽
:param string:
:par... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Package containg pyflakes adapted for Qt.
"""
""" License
Copyright 2005-2011 Divmod, Inc.
Copyright 2013-2014 Florent Xicluna
Permission is hereby granted, free of charge, to any person obtaining
a copy of this so... |
# -*- coding: UTF-8 -*-
#
# (c) 2010 Mandriva, http://www.mandriva.com/
#
# This file is part of Mandriva Server Setup
#
# MSS 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, o... |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... |
# Copyright 2017-present Open Networking Foundation
#
# 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 agr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
Created on April 18, 2012
@author: Young-Min Kim, Jade Tavernier
"""
from bilbo.reference.Balise import Balise
from bilbo.reference.Feature import Feature
class Word(object):
"""
A class corresponding to a word in a reference. It contains word na... |
from hypergan.gan_component import GANComponent
import numpy as np
import tensorflow as tf
class BaseLoss(GANComponent):
def __init__(self, gan, config, discriminator=None, generator=None, x=None, split=2, d_fake=None, d_real=None, reuse=False, name="BaseLoss"):
self.sample = None
self.ops = None
... |
# Copyright 2008 by Bartek Wilczynski
# Adapted from Bio.MEME.Parser by Jason A. Hackney. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
from __future__ import print_function
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.