src stringlengths 721 1.04M |
|---|
import os
import urllib
import gzip
import numpy as np
import tensorflow as tf
from menpo.image import Image
from menpo.visualize import print_dynamic
from digitrecognition.base import src_dir_path
# MNIST url
SOURCE_URL = 'http://yann.lecun.com/exdb/mnist/'
# MNIST filenames
TRAIN_IMAGES = 'train-images-idx3-ubyt... |
# -*- coding: UTF-8 -*-
# Copyright 2015-2020 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
import datetime
from lino.api import rt, dd, _
from lino.utils import Cycler, i2d
from lino.core.roles import SiteAdmin
from lino_xl.lib.cal.choicelists import DurationUnits
from lino_xl.lib.working.roles impo... |
"""
Make synthetic PNW population for CTA 1DC
"""
import numpy as np
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table, Column
from gammapy.astro.population import make_base_catalog_galactic
from gammapy.utils.random import get_random_state
from gammapy.utils import coor... |
# -*- coding: utf-8 -*-
import os
import sys
from cffi import FFI
ffi = FFI()
USE_SHARED_BROTLI = os.environ.get("USE_SHARED_BROTLI")
if USE_SHARED_BROTLI != "1":
libraries = ['libbrotli']
else:
libraries = ['brotlienc', 'brotlidec']
if 'win32' not in str(sys.platform).lower():
libraries.append('stdc++')... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... |
"""
Prints all wikis to stdout.
Usage:
determine_wikis (-h|--help)
determine_wikis [--debug]
[--verbose]
Options:
-h, --help This help message is printed
--debug Print debug logging to stderr
--verbose Print dots ... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... |
"""Logic for representing operators in state in various bases.
TODO:
* Get represent working with continuous hilbert spaces.
* Document default basis functionality.
"""
from __future__ import print_function, division
from sympy import Add, Expr, I, integrate, Mul, Pow
from sympy.physics.quantum.matrixutils import f... |
import argparse
import asyncio
import ssl
import aiohttp
@asyncio.coroutine
def main(conn, url):
with aiohttp.ClientSession(connector=conn) as session:
try:
response = yield from session.get(url)
yield from response.release()
except aiohttp.errors.ClientOSError as exc:
... |
import logging
import re
from rdrf.models.definition.models import Registry, CDEFile
from rdrf.helpers.utils import models_from_mongo_key
logger = logging.getLogger(__name__)
__all__ = ["get_id", "delete_file_wrapper", "get_file",
"store_file", "store_file_by_key"]
def get_id(value):
if isinstance(va... |
#coding: utf-8
__all__ = ['covert','line_resize','parse','draw_line','draw_screen','move','draw_input','check_pos']
import locale
import logging
locale.setlocale(locale.LC_ALL,'')
code = locale.getpreferredencoding()
def covert(string,code):
new_string = string.decode('utf-8')
lenth = len(new_string)
ret... |
# -*- coding: utf-8 -*-
"""
1st RUN:
- Run update_check if needed.
- Import the S3 Framework Extensions
- If needed, copy deployment templates to the live installation.
"""
# Debug why Eclipse breakpoints are ignored
# http://stackoverflow.com/questions/29852426/pydev-ignoring-breakpoints
#import sys
#... |
# -*- coding: utf-8 *-*
from sqlalchemy import *
from sqlalchemy.sql import select
import math
ENGINE = None
CONNECTION = None
USING_DATABASE = False
META = None
CONFIG = None
class Schema:
pass
def connect():
global CONFIG, ENGINE, CONNECTION, USING_DATABASE, META
try:
import Config
except... |
# Copyright (c) 2012 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.
"""Start and stop Web Page Replay.
Of the public module names, the following one is key:
ReplayServer: a class to start/stop Web Page Replay.
"""
imp... |
from . import compat
class _symbol(int):
def __new__(self, name, doc=None, canonical=None):
"""Construct a new named symbol."""
assert isinstance(name, compat.string_types)
if canonical is None:
canonical = hash(name)
v = int.__new__(_symbol, canonical)
v.name =... |
#!/usr/bin/env python3
# vim:fileencoding=utf-8
from pytoons.camera import Camera
from pytoons.common import Size
from pytoons.controls import Key
from pytoons.level import Level
from pytoons.states import BouncingBallState
from pytoons.states import State
import logging
from pytmx import load_pygame
from pygame impo... |
from toee import *
def OnBeginSpellCast( spell ):
print "Fascinate OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
def OnSpellEffect( spell ):
print "Fascinate OnSpellEffect"
spell.duration = spell.caster_level
print "Du... |
# Copyright 2020 Tensorforce Team. 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 la... |
""" The module that produces statistics, maps and plots. """
from m5.model import Order, Checkin, Checkpoint, Client
from sqlalchemy.orm.session import Session as DatabaseSession
from m5.user import User
class Stats():
def __init__(self, database_session: DatabaseSession):
self.session = database_sess... |
# Copyright 2015-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Space objects."""
import datetime
import re
from django.core.exceptions import PermissionDenied, ValidationError
from django.db.models import CharField, Manager, TextFie... |
from grammar import Grammar
from makelr import make_lr_parser
preface = "from toycalc.lex import tokenizer"
rules = {
# stat -> HELLO | IF cond THEN stat | IF cond THEN stat ELSE stat
"stat": [(("HELLO",), "lambda ctx, a: 'hello'"),
(("IF", "cond", "THEN", "stat"),
"lambda ctx, a, b... |
# -*- coding: utf-8 -*-
from flask import Markup, current_app
from flask.ext.wtf import Form
from flask.ext.wtf.html5 import URLField, EmailField, TelField
from wtforms import (ValidationError, BooleanField, TextField, HiddenField, PasswordField,
SubmitField, TextAreaField, IntegerField, RadioField,FileField,
... |
"""
Idealised channel flow in 3D
============================
Solves shallow water equations in closed rectangular domain
with sloping bathymetry.
Initially water elevation is set to a piecewise linear function
with a slope in the deeper (left) end of the domain. This results
in a wave that develops a shock as it rea... |
from gettext import gettext as _
import glob
import gzip
import logging
import os
import shutil
import traceback
from xml.sax.saxutils import XMLGenerator
from pulp.common import error_codes
from pulp.server.exceptions import PulpCodedValidationException, PulpCodedException
from pulp.server.util import CHECKSUM_FUNC... |
# Copyright 2009 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at ... |
# -*- coding: utf-8 -*-
'''
@author: Hung-Hsin Chen
@mail: chenhh@par.cse.nsysu.edu.tw
Markowitz mean variance model
'''
from __future__ import division
from coopr.pyomo import *
from time import time
from datetime import date
import numpy as np
import pandas as pd
import os
import time
from coopr.opt import SolverF... |
from tron.entity.player import Player
import tron.ai.lukasAI.aiutils as util
import copy
class AI(Player):
def __init__(self, pos, field, name="Lukas' AI"):
super(AI, self).__init__(pos, field, name)
self.live_enemies = [] # tracks whether enemies are still alive
self.enemy_positions = [... |
import sys
from eventlet import greenio
from eventlet import greenthread
from eventlet import greenpool
from eventlet.green import socket
from eventlet.support import greenlets as greenlet
def connect(addr, family=socket.AF_INET, bind=None):
"""Convenience function for opening client sockets.
:param addr: Ad... |
# -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///task2.db'
db = SQLAlchemy(app)
class Users(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
name = db.Colu... |
#!/usr/bin/env python
# vim: set syn=python et :
#============================================================
#
# Pan Ruochen <ijkxyz@msn.com>
#
#============================================================
import os, sys, re, struct, subprocess, optparse
import platform, locale
class FileDesc() :
def __init__(self... |
from django.core.management.base import BaseCommand
from django.apps import apps
from django.contrib.auth.models import Group, Permission
from six.moves import input
try:
import readline
except ImportError:
pass
class Command(BaseCommand):
help = 'Create default groups and permissions for standard dance... |
<<<<<<< HEAD
<<<<<<< HEAD
""" Python Character Mapping Codec cp500 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP500.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
... |
# Copyright DataStax, 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, softwa... |
import time
def timed_function(f):
def f_timer(*args, **kwargs):
start = time.time()
result = f(*args, **kwargs)
end = time.time()
print('> %s took %s seconds' % (f.__name__, end - start))
return result
return f_timer
def read_swopods():
words = []
with open('so... |
#!/usr/bin/env python
#------------------------------------------------------------
# Purpose: Demonstrate quality improvement weighted vs
# unweighted fit for Wolberg data. Wolberg's
# best fit parameters for a weighted fit is not
# accurate (a,b) = (1.8926, 4.9982)
# Improved val... |
import ptypes
from ptypes import *
ptypes.setbyteorder(ptypes.config.byteorder.bigendian)
### definitions
class bit0(ptype.definition): cache = {}
class bit1(ptype.definition): cache = {}
class bit2container(ptype.definition): cache = {}
class bit2msgtype(ptype.definition): cache = {}
class bit3arraymap(ptype.definit... |
import datetime
import time
class CountdownManager(object):
def __init__(self, root_tk_app):
self.start_time = time.time()
self.minutes = 0
self.seconds = 0
self.time_change_callbacks = []
self.count_down_total = datetime.timedelta(days=-1, minutes=0, seconds=0)
se... |
# -*- coding: utf-8 -*-
import pytest
from checktestlib import BasicCheckResult
pytestmark = pytest.mark.checks
@pytest.mark.parametrize('info,discoveries_expected,checks_expected', [
( # internal temperature
[[[u'2070', u'', u'']], []],
[
('ra32e_sensors', [('Internal', {})]),
... |
from typing import Callable
from vnpy.trader.object import (
TickData,
OrderData,
TradeData,
PositionData,
AccountData,
ContractData,
OrderRequest,
CancelRequest,
SubscribeRequest,
HistoryRequest,
)
from vnpy.trader.constant import (
Direction,
Offset,
Exchange,
... |
# Copyright (C) 2016 Swift Navigation Inc.
# Contact: Valeri Atamaniouk <valeri@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF A... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010, 2011, 2012 Andrey Golovizin
#
# 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... |
def aop_h5refl2array(refl_filename):
"""read in NEON AOP reflectance hdf5 file, convert to a cleaned reflectance
array and return associated metadata (spatial information and band center
wavelengths)
Parameters
----------
refl_filename : string
reflectance hdf5 file... |
import numpy as np
import sys
from PyQt4 import QtGui
from PyQt4.uic import loadUiType
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
Ui_MainWindow, QMainWindow = loadUiType('ZarcFit2015-11... |
import unittest
from resources.lib.model.game import Game
class TestGame(unittest.TestCase):
def testGameMergeSelfNone(self):
game1 = Game('Name')
game2 = Game('Name')
game2.genre = ['Action', 'Adventure']
game2.posters = ['/path/to/poster']
game2.fanarts = ['path/to/art/... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
update task status handlers
"""
import tornado.web
import tornado.escape
from db import db_task, db_machine
import json
import check
# 调用更新脚本
class TaskStatusHandler(tornado.web.RequestHandler):
def data_received(self, chunk):
pass
def __init__(self,... |
#!/usr/bin/env python
from __future__ import print_function
from datetime import datetime, timedelta
import optparse, time
__description__ = "Displays current, timeshifted and converts time commonly used by Incident Responders"
__author__ = 'Josh Lemon'
__version__ = '0.0.1'
__date__ = '2017/11/13'
"""
Source code p... |
#!/usr/bin/env python
# Copyright (C) <2015> EMBL-European Bioinformatics Institute
# 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 la... |
from grazyna.request import RequestBot
from grazyna.test_mocks.sender import SayMessage, Message
from grazyna.irc.models import User
def make_bot(protocol, **kwargs):
return RequestBot(protocol, user=User('socek!a@b'), chan='#czarnobyl', **kwargs)
def test_init(protocol):
bot = RequestBot(protocol)
asse... |
#!/usr/bin/python
import os
from PIL import Image
import uuid
import shutil
import sys
WIDTH=52
HEIGHT=13
COUNTRY='trucks2'
#WIDTH=52
#HEIGHT=13
#COUNTRY='eu'
#constants
OPENCV_DIR= '/usr/bin'
SAMPLE_CREATOR = OPENCV_DIR + '/opencv_createsamples'
BASE_DIR = './'
OUTPUT_DIR = BASE_DIR + "out... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# sudo zypper in python-setuptools
# http://docs.python.org/2/distutils/setupscript.html#installing-additional-files
#
from __future__ import print_function
import sys,os,glob,re
from distutils.core import setup
from setuptools.command.test import test as TestCommand
im... |
# Copyright 2016 OpenMarket Ltd
#
# 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 writin... |
# #
# Copyright 2012-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... |
"""
WSGI config for supersalon 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... |
# 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
# distrib... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2016 Gluu
#
# 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 limi... |
# 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 (t... |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
#!/usr/bin/env python
# coding: utf-8
import kwl2text
import semantics as s
import unittest
class KWLTest(unittest.TestCase):
def setUp(self):
self.psr = kwl2text.kwl2textParser()
self.sem = s.Semantics()
self.maxDiff = None
self.adj = 'adj:red'
self.nom = 'nom:food'
def testToken(self):
... |
# Copyright 2017 ProjectQ-Framework (www.projectq.ch)
#
# 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 app... |
from __future__ import unicode_literals
import boto3
from moto import mock_secretsmanager
from botocore.exceptions import ClientError
import string
import unittest
import pytz
from datetime import datetime
from nose.tools import assert_raises
from six import b
DEFAULT_SECRET_NAME = 'test-secret'
@mock_secretsmanag... |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
The Representer is an important module for beginning to visualize
the structures of the instanced variables in the environnment.
The idea is to use the indenting representation like in the jso... |
# Copyright (C) 2020 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... |
from rcat import RCAT
import pandas as pd
import numpy as np
from cobra.core import Metabolite, Reaction
from cobra.io.sbml import create_cobra_model_from_sbml_file
from cobra.manipulation.modify import convert_to_irreversible
from copy import deepcopy
from cobra.flux_analysis.variability import flux_variability_analys... |
from collections import defaultdict
import csv
class Taxonomy:
def __init__(self, filename: str):
self.tax = self.parse_taxonomy(filename)
@classmethod
def parse_taxonomy(cls, filename: str) -> dict:
with open(filename) as inf:
csv_inf = csv.reader(inf, delimiter='\t')
... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# Copyright (c) 2009, Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# d... |
from __future__ import print_function
import shutil
import os.path
import os
import sys
def build(source_path, build_path, install_path, targets):
def _copy(src, dest):
print("copying %s to %s..." % (src, dest))
if os.path.exists(dest):
shutil.rmtree(dest)
shutil.copytree(src... |
"""Interactive shell tools for the Halfspan formalism.
These tools concern song recognition and allow utilities for recognising
songs to be called from the shell.
"""
"""
============================== License ========================================
Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granrot... |
# Licensed to Hortonworks, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Hortonworks, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this f... |
import re
import string
from scarf import app
from flask import redirect, url_for, render_template, session, request, flash
from core import redirect_back, SiteUser, NoUser, new_user, AuthFail, check_email
from main import PageData
import logging
import config
app.secret_key = config.SECRETKEY
BANNED = ['.*\.pl$',
... |
from datetime import timedelta
import numpy as np
import warnings
import copy
from textwrap import dedent
import pandas as pd
from pandas.core.groupby.base import GroupByMixin
from pandas.core.groupby.ops import BinGrouper
from pandas.core.groupby.groupby import (
_GroupBy, GroupBy, groupby, _pipe_template
)
from ... |
from django.contrib import admin
from django.contrib import messages
from django.db import models
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.urls import path
if False: # pragma: nocover
from .models import CustomModelPage # noqa
class EtcAdmin(admin.ModelAdmin):
"""... |
import socket
import time
class Client():
def __init__(self, host, port):
global dns
self.host = host
self.ip = host
self.port = int(port)
self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.conn.setblocking(1)
def connect(self):
self.conn... |
# admin/views.py
# Jake Malley
# 19/02/15
"""
Define the routes for the admin blueprint.
"""
# Imports
from flask import redirect, render_template, \
request, url_for, Blueprint, abort, flash
from flask.ext.login import fresh_login_required, current_user
from traininglog import db
from traininglog.mod... |
# Copyright 2013, 2014 Philipp Winter <phw@nymity.ch>
#
# This file is part of exitmap.
#
# exitmap 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 la... |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 SUSE Linux GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be usef... |
#!/usr/bin/env python3
"""
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
import setup_commands
__author__ = 'Christof Pieloth'
install_re... |
<<<<<<< HEAD
<<<<<<< HEAD
"""distutils.dist
Provides the Distribution class, which represents the module distribution
being built/installed/distributed.
"""
import sys, os, re
from email import message_from_file
try:
import warnings
except ImportError:
warnings = None
from distutils.errors import *
from dis... |
import copy
import itertools
import re
import operator
from datetime import datetime, timedelta
from collections import defaultdict
import numpy as np
from pandas.core.base import PandasObject
from pandas.core.common import (_possibly_downcast_to_dtype, isnull,
_NS_DTYPE, _TD_DTYPE, AB... |
# -*- coding: utf-8 -*-
"""
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 ... |
#coding=utf-8
"""
Flask-WeRoBot
---------------
Adds WeRoBot support to Flask.
:copyright: (c) 2013 by whtsky.
:license: BSD, see LICENSE for more details.
Links
`````
* `documentation <https://flask-werobot.readthedocs.org/>`_
"""
__version__ = '0.1.2'
from werobot.robot import BaseRoBot
from flask import Flask
... |
import datetime
import os
import random
import requests
import subprocess
import time
import traceback
import twitter
RATE = 60 * 30
MENTION_RATE = 65
INPUT_FOLDER = ''
OUTPUT_FOLDER = ''
FLICKR_API_KEY = None
TWITTER_CONSUMER_KEY = None
TWITTER_CONSUMER_SECRET = None
TWITTER_ACCESS_TOKEN_KEY = None
TWITTER_ACCESS_T... |
import math
import numpy as np
from WAGEOS import WAGEOS
from WAPBL import WAPBL
from WASBL import WASBL
# Perform wind adjustments
# INPUT
# uobs: observed windspeed
# zobs: elevation of wind observation
# delt: air-sea temperature difference
# F: fetch length
# tobs: duration of wind observation
# tf... |
# KYLE'S CHANGE COUNTER VERSION 1000
# INCLUDES UNSOLVABLE PENNY ERROR
import math
dict = {
100: 'hundred dollar bill',
50: 'fifty dollar bill',
20: 'twenty dollar bill',
10: 'ten dollar bill',
5: 'five dollar bill',
2: 'toonie',
1: 'loonie',
... |
import random
import string
from functools import wraps
import hashlib
from datetime import datetime
from flask import Blueprint
from flask import abort
from flask import request
from flask import redirect
from flask import render_template
from flask import session
from flask import url_for
from flask import flash
fro... |
"""
This file will contain the code to create the XPD view GUI
"""
from xray_vision.qt_widgets import CrossSectionMainWindow
from PyQt4 import QtGui, QtCore
import os
import sys
import numpy as np
from Tif_File_Finder import TifFileFinder
from plot_analysis import reducedRepPlot
def data_gen(length):
... |
#
# Simple example scene (hello world)
# Simulation of a buoyant smoke density plume (with noise texture as smoke source)
#
#import pdb; pdb.set_trace()
from manta import *
# solver params
res = 64
gs = vec3(res, int(1.5*res), res)
s = FluidSolver(name='main', gridSize = gs)
# prepare grids
flags = s.create(F... |
#!/usr/bin/env python
from scikits.image._build import cython
import os.path
base_path = os.path.abspath(os.path.dirname(__file__))
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
config = Configuration('io', parent_package, t... |
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/lib/abag.py
__version__='3.3.0'
__doc__='''Data structure to hold a collection of attributes, used by styles.'''
class ABag:
"""
'Attrib... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2015 CERN.
#
# INSPIRE 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... |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2016 VoltDB Inc.
#
# 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 limitati... |
from apps.catastro.models import Ciudad
from apps.core.models import Recorrido
from django.contrib.gis.geos import Point
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.conf import settings
from django.contrib.sites.models impo... |
# -*- coding: utf-8 -*-
"""
Celery pattern. Some interesting read here:
http://blog.miguelgrinberg.com/post/celery-and-the-flask-application-factory-pattern
Of course that discussion is not enough for
a flask templating framework like ours.
So we made some improvement along the code.
"""
from rapydo.server import ... |
from django import template
from django.contrib.sites.models import Site
from django.core import urlresolvers
from askbot.deps.livesettings import config_value
from askbot.deps.livesettings.utils import url_join
import logging
log = logging.getLogger('configuration.config_tags')
register = template.Library()
def for... |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... |
from scipy.signal import convolve2d
import numpy as np
import graphics
import random
import driver
import game
import time
rows = 15
cols = 112
class Life(game.Game):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.start = time.time()
self.randomize()
def r... |
# SIMPLE MNIST CNN
# Source: https://www.tensorflow.org/tutorials/layers
def cnn_model_fn(features, labels, mode):
"""Model function for CNN."""
# Input Layer
input_layer = tf.reshape(features, [-1, 28, 28, 1])
# Convolutional Layer #1
conv1 = tf.layers.conv2d(
inputs=input_layer,
filters=32,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.