src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
from functools import wraps
import odict
from dagny import conneg
class Skip(Exception):
"""
Move on to the next renderer backend.
This exception can be raised by a renderer backend to instruct the
`Renderer` to ignore the current backend and move on to the next-be... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) 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 Sof... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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.apach... |
# Copyright 2006 James Tauber and contributors
#
# 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 agre... |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
import random
def cv_carsDL(ip,port):
# read in the dataset and construct training set (and validation set)
cars = h2o.import_file(path=h2o.locate("smalldata/junit/cars_20mpg.csv"))
# choose the type model-building exercise (multinomial classi... |
"""
A simple smoke-test for C.I.SimplePresence
"""
import dbus
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber.client import IQ
from servicetest import assertEquals
from hazetest import exec_test
import constants as cs
def test(q, bus, conn, stream):
amy_handle = conn.RequestHan... |
"""
Various tools for extracting signal components from a fit of the amplitude
distribution
"""
from . import pdf
from .Classdef import Statfit
import numpy as np
import time
import random
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from lmfit import minimize, Parameters, report_fit
def pa... |
# -*- 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 2 of the License, or
# (at your option) any later version.
import sys
import time
__all__ = (
"Task... |
import pickle, json, requests, base64
from sklearn import datasets
iris = datasets.load_iris()
X = iris.data
Y = iris.target
# print(iris.DESCR)
from sklearn.neural_network import MLPClassifier
clf = MLPClassifier()
clf.fit(X, Y)
def test_ws_sql_gen(pickle_data):
WS_URL="https://sklearn2sql.herokuapp.com/mo... |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Eli
#
# Created: 18/12/2013
# Copyright: (c) Eli 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------
def m... |
from invenio_pages import InvenioPagesREST
from invenio_pages.rest import blueprint
# mock the rest API url prefix
blueprint.url_prefix = '/api/{}'.format(blueprint.url_prefix)
def test_page_content(pages_fixture):
"""Test page content."""
app = pages_fixture
app.register_blueprint(blueprint)
with a... |
from nose.tools import *
from source.ex48 import lexicon
def setup():
print "SETUP!"
def teardown():
print "TEAR DOWN!"
def test_basic():
print "I RAN!"
def test_directions():
assert_equal(lexicon.scan("north"), [("direction", "north")])
result = lexicon.scan("north south east")
assert_e... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
# Copyright 2011 - 2012, Red Hat, 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
#
# h... |
from django.template import Variable, Library, Node, TemplateSyntaxError,\
VariableDoesNotExist
from django.template.loader import render_to_string
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from actstream.mode... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the ESE database catalog extractor."""
import unittest
from esedbrc import catalog_extractor
from tests import test_lib
class TestOutputWriter(object):
"""Test output writer."""
def Close(self):
"""Closes the output writer object."""
return
... |
import neuralnet, numpy
SHIFT = -1
REDUCELEFT = 0
REDUCERIGHT = 1
def transition(stack, queue, arcs, dependencies):
if len(stack) < 2:
return (SHIFT, SHIFT, SHIFT)
for dependency in dependencies:
if stack[-1] == dependency[0] and stack[-2] == dependency[1]:
return dependency
for dependency in dependencies:
... |
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.shortcuts import render
from accounts.models import Account, AccountTeam, AccountTier, AccountUser
from accounts.tasks import set_image_from_socialaccounts
@admin.register(Account)
class AccountAdmin(admin.ModelAdmin):
"""A... |
__author__ = 'jwely'
import os
import shutil
import arcpy
from metric import textio
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True
def copyfile(path, dest_dir, workspace = ""):
"""
path the full filepath to a file
dest_dir destination for copy
returns the full filepath... |
'''
Brightness
==========
This API helps you to control the brightness of your primary display screen.
The :class:`Brightness` provides access to public methods to control the
brightness of screen.
NOTE:: For Android, make sure to add permission, WRITE_SETTINGS
Simple Examples
---------------
To know the current br... |
import os
import yaml
class AppConfig(object):
DB_URL_TEMPLATE = "{}://{}:{}@{}:{}/{}"
def __init__(self, db_type,
db_host, db_port, db_name,
db_username, db_password,
file_in_dir, file_out_dir,
posts_dir):
self.db_type = db_type
... |
"""
@author: Silvian Dragan
@Date: 05/05/2016
@Copyright: Copyright 2016, Samaritan CMA - Published under GNU General Public Licence v3
@Details: https://github.com/Silvian/samaritan
Main file for storing constants classes
"""
from django.conf import settings
from django.utils.timezone import now
class SettingsCons... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
"""This module imports some commonly used methods and classes.
You can use ``from pymor.basic import *`` in inter... |
#!/usr/bin/env python
import docker
import json
import consul
import logging
import requests
logging.basicConfig(filename='/var/log/docker-events/docker-events-consul.log',
level=logging.INFO,
format=' [%(levelname)s] %(asctime)s (%(threadName)-10s) %(message)s')
# Configuration
consul_host... |
from geopy.geocoders import GoogleV3
import csv
import logging
import os
import paramiko
import re
import time
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import NoArgsCommand
from django.conf import settings
from portal.models import Location
class Command(NoArgsCommand)... |
# -*- coding: utf-8 -*-
import scrapy
from egghead.items import LessonVideo
from egghead.spiders import LoginSpider
from urlparse import urlparse, urljoin
def lesson_filename(url):
file_name = urlparse(url).path.split('/')[-1]
return '{}.mp4'.format(file_name)
def lesson_urls(response):
return response.... |
from __future__ import absolute_import, print_function
import collections
import logging
import six
import warnings
from django.db import models
from django.db.models.signals import post_delete
from cobra.core.cache import memoize
from cobra.core.compat import pickle
from cobra.core.strings import decompress, compre... |
#!/usr/bin/env python
#
# CLUES - Cluster Energy Saving System
# Copyright (C) 2015 - GRyCAP - Universitat Politecnica de Valencia
#
# 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 versio... |
"""
.. function:: sqlite(dbfilename, query:None)
Connects to an SQLite DB and returns the results of query.
Examples:
>>> sql("select * from (sqlite 'testdb.db' select 5 as num, 'test' as text);")
num | text
-----------
5 | test
"""
import functions
import os
import vtbase
registered = True
ext... |
# coding: utf8
# network.py
# 12/13/2012 jichi
__all__ = 'WbNetworkAccessManager',
import os
from PySide.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkDiskCache
from sakurakit import skfileio, sknetwork
from sakurakit.skdebug import dprint
import proxy, rc
## Cookie ##
class WbNetworkCookieJar(sk... |
"""Event scheduler and interpolation."""
from time import time
from bisect import bisect
from math import cos, atan, exp
from random import randrange, expovariate
from functools import partial
from pygame.time import wait
from .conf import conf
from .util import ir
def _match_in_nest (obj, x):
"""Check if ever... |
import os
import sys
from bacon import native
#: Path to resources. Set to the script directory by default during development, and the executable
#: directory for frozen applications.
resource_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
if native._mock_native:
resource_dir = ''
# Or use frozen executab... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... |
from neopapi.explore.world.island.Exceptions import UnknownStatException,\
PetNotFoundException, PetNotOnCourseException, PetAlreadyOnCourseException,\
StatTooHighException
from neopapi.core.browse import register_page
from neopapi.core.browse.Browser import BROWSER
import re
from datetime import timedelta
"""... |
""" The engineering_conversions module
This provides two functions
eng_float() which behaves like float()
eng_str() which behaves like str()
but use engineering powers of 1000, and BIPM text multipliers like k and G
In the spirit of 'talk exact, listen forgiving', eng_float() understands all prefixes
defined by BIPM,... |
# Copyright 2011 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... |
"""Alternate import logic that provides for multiple dependency versions."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict
import contextlib
import inspect
import os
import sys
fr... |
import datetime
import subprocess
from macd.models import SeenEvent, Device
from django.shortcuts import render
from django.utils import timezone
def index(request):
now = timezone.now()
time_threshold = now - datetime.timedelta(minutes=10)
items = SeenEvent.objects.filter(date__gte=time_threshold)
de... |
import sublime_plugin
import sublime
import os
try: # Python 3
from ..HaxeHelper import HaxeComplete_inst, isType
except (ValueError): # Python 2
from HaxeHelper import HaxeComplete_inst, isType
class HaxeCreateType( sublime_plugin.WindowCommand ):
classpath = None
currentFile = None
currentSrc ... |
#! /usr/bin/env python
import serial
import sys
import os
import MySQLdb
from subprocess import call
from datetime import date
FORCE_WRITE = 0
HORIZONTAL = 0
VERTICAL = 90
today = date.today()
try:
address_array = []
# open data base
db = MySQLdb.connect(host="localhost", user="", passwd="team05", db="xbee_teensy"... |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ***************************************************************************
# Copyright (C) 2006-2009 Mathias Monnerville <tellico@monnerville.com>
# ***************************************************************************
#
# **************************************... |
''' IOUtil.py
'''
import os
import numpy as np
import glob
import joblib
import scipy.io
from skimage.data import imread
from distutils.dir_util import mkpath
def imgpath2list(imgpath):
''' Transform provided path (or path pattern) into a list of valid paths
Args
-------
imgpath : list or string
... |
# -*- coding: utf-8 -*-
ESQUEMA_ATUAL = u'pl_005f'
#
# Envelopes SOAP
#
from .soap_100 import SOAPEnvio as SOAPEnvio_110
from .soap_100 import SOAPRetorno as SOAPRetorno_110
#
# Emissão de NF-e
#
from .nfe_110 import NFe as NFe_110
from .nfe_110 import NFRef as NFRef_110
from .nfe_110 import Det as Det_110
from .nf... |
# -*- coding: utf-8 -*-
"""
plotting sanbox module for merlin.
This module is to be used for testing or development work.
"""
import plotbase
import copy
import plot1d
import getroot
import math
import plotresponse
import plotfractions
import plot2d
import plot_tagging
import fit
import os
def recogen_a... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... |
from flask.ext.script import Manager
from mock import Mock
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import unittest2 as unittest
from molly.config import ConfigLoader, ConfigError
from tests.test_providers.provider import Provider as TestProvider
from tests.test_... |
from __future__ import generators
True, False = 1==1, 0==1
import threading
import re
import warnings
import atexit
import os
import new
import sqlbuilder
from cache import CacheSet
import col
from joins import sorter
from converters import sqlrepr
import urllib
import weakref
warnings.filterwarnings("ignore", "DB-A... |
"""
This module manages creation, deletion, starting, and stopping of the systemd unit files for Pulp's
Celery workers. It accepts one parameter, which must be start or stop.
"""
from glob import glob
import multiprocessing
import os
import subprocess
import sys
_ENVIRONMENT_FILE = os.path.join('/', 'etc', 'default',... |
# Copyright 2021 The Magenta 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 applicable law or agreed to in ... |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import AbstractBaseUser
from django.core.urlresolvers import reverse
from django.db import models
from django.template.defaultfilters import slugify
from datetime import datetime
from django.conf import settings
from decimal import Decimal
from colorfield.... |
# Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... |
##@package lgiinterface
# Interface to list the generated instances.
#@author Sebastien MATHIEU
import os
import xml.etree.ElementTree as ElementTree
import asyncio,websockets
# Interact with the user to interact with the instance generator module.
# @param client Client we are interacting with.
@asyncio.co... |
#Copyright 2015 B. Johan G. Svensson
#Licensed under the terms of the MIT license (see LICENSE).
def datetest(y,m,d,bc=False):
# datetest(y ,m ,d [,bc])
if (type(y)!=type(1) and type(y)!=type(1L)) or \
(type(m)!=type(1) and type(y)!=type(1L)) or \
(type(d)!=type(1) and type(y)!=type(1L)):
... |
#-*- coding:utf-8 -*-
import time
from hashlib import md5
from datetime import datetime
from flask import Flask, request, session, url_for, redirect, \
render_template, abort, g, flash
from werkzeug.security import check_password_hash, generate_password_hash
from models import *
PER_PAGE = 10
app = Flask(__name_... |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS 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
#
#... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
# 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
# distributed under t... |
from square import Square
from street import Street
class Field:
def __init__(self, test=None):
self.streets = set()
if test != None:
blacks = test["blacks"]
values = test["values"]
self.squares = [Square(i, blacks[i] == "1", "123456789" if values[i] == "0" ... |
import os
import datetime
import sys
import time
import string
import random
import pandas as pd
import numpy as np
import gc
if(len(sys.argv) < 2):
print('Usage: CSVTrainer.py train.csv validation.csv model.h5 log.txt')
sys.exit(1)
trainingName = sys.argv[1]
validationName = sys.argv[2]
modelName = sys.... |
# Copyright 2017 Battelle Energy Alliance, LLC
#
# 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 t... |
# - *- coding: utf- 8 - *- .
# SNEAKS - Snooping Early Alert Knowledge Service
from datetime import timedelta
from boomslang import *
import math
import pygeoip
import socket
from ConfigParser import RawConfigParser
import html2text
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
... |
"""Contains target-specific objects and functions."""
from . import gtop
from . import pdb
from .interactions import Interaction, get_interaction_by_id
from .exceptions import NoSuchTargetError, NoSuchTargetFamilyError
from .shared import DatabaseLink, Gene, strip_html
def get_target_by_id(target_id):
"""Returns ... |
import json
import fnmatch
import os
import subprocess
import sys
import tempfile
import time
import psutil
import ray
class RayTestTimeoutException(Exception):
"""Exception used to identify timeouts from test utilities."""
pass
def _pid_alive(pid):
"""Check if the process with this PID is alive or no... |
#!/usr/bin/env python
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
'''
Phtevencoin base58 encoding and decoding.
Based on https://phtevencointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
ret... |
"""modified criteria tables
Revision ID: 316f3b73962c
Revises: 2fe3d8183c34
Create Date: 2014-09-10 15:42:55.963855
"""
# revision identifiers, used by Alembic.
revision = '316f3b73962c'
down_revision = '2fe3d8183c34'
import logging
from alembic import op
import sqlalchemy as sa
from sqlalchemy import UniqueConstra... |
#!/usr/bin/env python
import argparse
from pyfranca import Processor, LexerException, ParserException, \
ProcessorException
def dump_comments(item, prefix):
for key, value in item.comments.items():
print (prefix + key + ": " + value)
def dump_namespace(namespace):
if namespace.typedefs:
... |
# coding: utf-8
"""
Vericred API
Vericred's API allows you to search for Health Plans that a specific doctor
accepts.
## Getting Started
Visit our [Developer Portal](https://developers.vericred.com) to
create an account.
Once you have created an account, you can create one Application for
Production and an... |
from setuptools import setup, Extension, Command
extra_compile_args = "-std=c++11"
pyplatec = Extension('platec',
sources = [
'platec_src/platecmodule.cpp',
'platec_src/platecapi.cpp',
'platec_src/plate.cpp... |
#!/usr/bin/env python
#
# https://launchpad.net/wxbanker
# transparent.py: Copyright 2007-2010 Mike Rooney <mrooney@ubuntu.com>
#
# This file is part of wxBanker.
#
# wxBanker is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... |
# Copryright 2012 Drew Smathers, See LICENSE
from zope.interface import Interface, Attribute, directlyProvides
from twisted.python import log
class ILog(Interface):
"""
API for logging components that follow
Twisted's log interface: msg() and err().
"""
def msg(*message, **kw):
"""
... |
import numpy as np
"""
by jrr
"""
#
# output array as csv
#
def printArray( A ) :
if len(A.shape) == 1 :
r=A.shape[0]
# if python3
# for i in range(0,r) : print( ( '%5.2f' ) % ( A[i] ) ,end=',')
# print('')
for i in range(0,r) : print( ( '%5.2f,' ) % ( A[i] ) ) ,
pr... |
# -*- coding: utf-8 -*-
#!/usr/bin/enzl_v python
from pylab import *
from numpy import *
from math import *
def data_generator(N):
#生成向量函数F:ai*exp(bi*x)的系数数组
zl_mean = [3.4,4.5]
zl_cozl_v = [[1,0],[0,10]]
zl_coff = np.random.multivariate_normal(zl_mean,zl_cozl_v,N)
#生成观测值向量y
x = np.random.unif... |
#!/usr/bin/env python
#
# * Copyright 2012-2014 by Aerospike.
# *
# * 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... |
"""
Functions that create a machine learning model from training data
"""
import os
import sys
import logging
import numpy
#Define base path and add to sys path
base_path = os.path.dirname(__file__)
sys.path.append(base_path)
one_up_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..//'))
sys.path.appe... |
#
# Copyright 2018 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 ... |
from __future__ import absolute_import, division, print_function
from .common import Benchmark
from numpy.core.overrides import array_function_dispatch
import numpy as np
def _broadcast_to_dispatcher(array, shape, subok=None):
return (array,)
@array_function_dispatch(_broadcast_to_dispatcher)
def mock_broadca... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="artmr",
version="1.0",
author="mronkain",
author_email="mrnk@iki.fi",
description="Offline race timing console application",
long_description=long_description,
long_description_con... |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... |
# Copyright (C) 2011 OpenStack 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 agreed to... |
import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.sites.models import Site
from django.core.urlresolve... |
# -*- 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 model 'Policy'
db.create_table('privacy_policy', (
('id', self.gf('django.db.models.fie... |
"""
Generate timetable
https://www.youtube.com/watch?v=qhbuKbxJsk8
"""
import svgwrite
import numpy as np
(h,w) = (700, 1500)
svg = svgwrite.Drawing(filename = "timetable.svg", size = (str(w)+"px", str(h)+"px"))
def coordFromAngle(alpha):
x = cr*np.cos(alpha) + cx
y = cr*np.sin(alpha) + cy
return (x,y)
... |
#!/usr/bin/python -u
"""
For full details, see the README.md in
https://github.com/speculatrix/web_get_iplayer
This script operates in two modes:
1/ a web interface to find programs using the same APIs
that the android apps use to find TV and Radio programs,
and then queue them for downloading
2/ a cron job... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... |
import tvm
def test_copy2d():
m = tvm.var('m')
l = tvm.var('l')
A = tvm.placeholder((m, l), name='A')
B = tvm.compute((m, l), lambda i, j: A[i, j], name='B')
s = tvm.create_schedule(B.op)
s[B].pragma(B.op.axis[0], "memcpy")
bounds = tvm.schedule.InferBound(s)
stmt = tvm.schedule.Schedul... |
# -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (c) 2009-2011, Bolloré telecom
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# ... |
"""
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with cortical... |
from __future__ import print_function
import logging
import multiprocessing
from collections import defaultdict
import pybedtools
from defaults import MIN_INV_SUBALIGN_LENGTH, MIN_DEL_SUBALIGN_LENGTH
logger = logging.getLogger(__name__)
def get_insertion_breakpoints(age_records, intervals, expected_bp_pos, window=20... |
import numpy as np
import random
class NonLinearLeastSquares(object):
samples = []
grid_size = None
alpha = 2.0
def __init__(self, grid_size):
self.grid_size = np.array(grid_size)
def setSamples(self,samples):
self.samples = samples
def pkl(self,k,l):
return ... |
from fusesoc.config import Config
from fusesoc.coremanager import CoreManager
from fusesoc.utils import Launcher, pr_info, pr_err
import argparse
import shutil
import os
import logging
import sys
if sys.version_info[0] >= 3:
import urllib.request as urllib
from urllib.error import URLError
else:
import url... |
#!/usr/bin/python3
import pdb
import sys
from module import *
def print_it(tp, tl, time, s):
print("%s %s.%d: %s" % (time, tp, tl, s))
def print_if_9(tp, tl, time, s):
if tl >= 9:
print("%s %s.%d: %s" % (time, tp, tl, s))
tl = trace.Logger("debug", 9, print_if_9)
loggers = [
{'trace_point':... |
import os, os.path
import random
import sqlite3
import string
import time
import cherrypy
DB_STRING = "my.db"
class StringGenerator(object):
@cherrypy.expose
def index(self):
return file('index.html')
class StringGeneratorWebService(object):
exposed = True
@cherrypy.tools.accept(media='text/p... |
#!/usr/bin/env python
import argparse
from copy import deepcopy
import itertools
import logging
import operator
import os
import random
import webbrowser
from safire.data.text_browser import TextBrowser
import safire.utils
from safire.data.image_browser import ImageBrowser
from safire.data.loaders import MultimodalData... |
from functools import partial
from urllib.parse import urlencode
from geopy.geocoders.base import DEFAULT_SENTINEL, Geocoder
from geopy.location import Location
from geopy.util import logger
__all__ = ("MapQuest", )
class MapQuest(Geocoder):
"""Geocoder using the MapQuest API based on Licensed data.
Docume... |
#!/usr/bin/env python3
#-------------------------------------------------------------------------------
# Name: bot - simple example for a telegram bot
# Usage: ./bot.py
# Author: Christian Wichmann
# Created: 13.06.2019
# Copyright: (c) Christian Wichmann 2019
# Licence: GNU GPL
#--... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013, 2014, 2015, 2018 Martin Raspaud
# Author(s):
# Martin Raspaud <martin.raspaud@smhi.se>
# 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 Softwa... |
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on October, 2, 2012
@author: Sourabh Bajaj
@contact: sourabhbajaj@gatech.edu
@summary: Contains converter fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.