src stringlengths 721 1.04M |
|---|
import re
RAW_INTERVAR_CLASS_BENIGN = "Benign"
RAW_INTERVAR_CLASS_LIKELY_BENIGN = "Likelybenign"
RAW_INTERVAR_CLASS_UNCERTAIN_SIGNIFICANCE = "UncertainSignificance"
RAW_INTERVAR_CLASS_LIKELY_PATHOGENIC = "Likelypathogenic"
RAW_INTERVAR_CLASS_PATHOGENIC = "Pathogenic"
INTERVAR_CLASS_BENIGN = "Benign"
INTERVAR_CLASS_LI... |
from gogapi import names
GOG_TO_IETF = {
"brazilian": "pt-BR",
"brazilian-portuguese": "pt-BR",
"czech": "cs-CZ",
"english": "en-US",
"french": "fr-FR",
"german": "de-DE",
"hungarian": "hu-HU",
"italian": "it-IT",
"japanese": "ja-JP",
"neutral": "*",
"polish": "pl-PL",
... |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import json
import requests
import re
import random
import time
import sys
import csv
from genericKB import genericHandler
from esHealth import esHealthHandler
from wikiFinder import findWikiEn
#from io import open
import codecs
#from pttChat import pttHandler
#from wik... |
from flask import Flask
from flask_bootstrap import Bootstrap
from flask import render_template
import bootstrap
import xmlrpclib
from io import BytesIO
import base64
app = Flask(__name__)
import xmlrpclib
username = 'username' #the user
pwd = 'password' #the password of the user
dbname = 'ctpug' #the databa... |
# Copyright 2018, The TensorFlow Federated 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 o... |
# -*- coding: utf-8 -*-
import types
import hashlib
import logging
import cPickle as pickle
from django.conf import settings
from django.core.cache import cache
from django.utils.encoding import smart_str
from keyedcache.utils import is_string_like, is_list_or_tuple
log = logging.getLogger('cdc_cache')
# The debuggi... |
from .ActuatorCommand import ActuatorCommand
from .ActuatorCommandType import ActuatorCommandType
from .ActuatorState import ActuatorState
from .ActuatorStatus import ActuatorStatus
from .Alarm import Alarm
from .ConfigurationCommand import ConfigurationCommand
from .ConfigurationCommandType import ConfigurationCommand... |
import unittest as ut
import re
from querpy import Query
class TestQuerpyFunctionality(ut.TestCase):
def test_building_and_modifying_query(self):
# John Doe needs to query a database with financial info
# He begins by instantiating a Query() object
query = Query()
# He needs the... |
import numpy as np
import pytest
import cirq
from cirq import value
from cirq_google.optimizers.two_qubit_gates.math_utils import (
weyl_chamber_mesh,
kak_vector_infidelity,
random_qubit_unitary,
)
def test_weyl_chamber_mesh_spacing_too_small_throws_error():
with pytest.raises(ValueError, match='may ... |
# 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.
from telemetry import multi_page_benchmark
from telemetry import multi_page_benchmark_unittest_base
from perf_tools import smoothness_benchmark
from tele... |
from chiplotle import *
from py.test import raises
def test_coordinate__sub__01( ):
'''Coordinate pair can substract with other coordinate pairs.'''
a = Coordinate(1, 2)
b = Coordinate(0.5, 0.5)
t = a - b
assert isinstance(t, Coordinate)
assert t == Coordinate(0.5, 1.5)
def test_coordinate__s... |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from os import curdir, sep
import urlparse, pickle, os
p = 'htmlsnips/'
nofile = 'Bud, I can\'t find the file.'
def makePage():
if not os.path.isfile('login.html'):
try:
with open(p+'header.xml', 'r') as h, open(p+'login.xml','r') as i, open(p+'login.h... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import hs_core.models
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('pages', '__first__'),
migrations.swappable_d... |
#coding=utf-8
'''
Created on Jun 16, 2015
@author: danimar
'''
from httplib import HTTPSConnection
class HttpClient(object):
def __init__(self, url, chave_pem, certificado_pem):
self.url = url
self.chave_pem = chave_pem
self.certificado_pem = certificado_pem
def _headers(self... |
import random
import re
import six
from six.moves import zip, xrange
from .lang_detect_exception import ErrorCode, LangDetectException
from .language import Language
from .utils.ngram import NGram
from .utils.unicode_block import unicode_block
class Detector(object):
'''
Detector class is to detect language... |
import json
import re
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
import forms
import utils
import personality_analyzer
import commit_to_sql
de... |
#! /usr/bin/env python3
"""
Example to sniff all HTTP traffic on eth0 interface:
sudo ./sniff.py eth0 "port 80"
"""
import sys
import pcap
import time
import socket
import struct
if sys.version_info[0] > 2:
IPPROTO = bytes ((0x08, 0x00))
bord = int
else:
IPPROTO = '\x08\x00'
bord = ord
protoc... |
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT n... |
##########################################################################
# This file is part of WTFramework.
#
# WTFramework 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 L... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventario', '0006_auto_20170930_1629'),
]
operations = [
migrations.CreateModel(
name='ComandoRemoto',
... |
# Standard modules
from expects import *
# Our modules
import arkInit
arkInit.init()
import tryout
import arkMath
from arkMath import Mat44
class test(tryout.TestSuite):
title = 'test/test_helpers.py'
def is_vector(self):
vec = arkMath.Vec(1,2,3,4)
self.assertEqual(arkMath.isVector(vec), True)
self.assertE... |
#!/usr/bin/env python
import numpy as np
import os
import shutil
import wx
import matplotlib
matplotlib.use('WXAgg')
from datetime import datetime
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas
from utils import take_screenshot, XboxController
SAMPLE... |
#!/usr/bin/env python3
# pecryptfs - Portable Userspace eCryptfs
# Copyright (C) 2015 Ingo Ruhnke <grumbel@gmail.com>
#
# 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 L... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# CTA API CLI YAH
import sys
import requests
#from bs4 import BeautifulSoup
from xmltodict import parse
import datetime
from time import gmtime, strftime
# enable debugging
import cgitb
cgitb.enable()
# get API key from file
f = open('./.cta-api.key', 'r')
APIKEY = "?key=" + ... |
import mock
import datetime
from tests import TestCaseBase
from auth_core.internal.entities import AuthUserEntity, AuthUserMethodEntity
from auth_core.models import AuthUser
from auth_core.appengine_tools import get_resource_id_from_key
from auth_core.api import access_tokens as access_tokens_api
from auth_core.error... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
parses JCVI software NUCMER (http://mummer.sourceforge.net/manual/)
output - mostly as *.coords file.
"""
import sys
import logging
from math import exp
from itertools import groupby
from maize.formats.base import LineFile, must_open
from maize.algorithms.graph impo... |
from __future__ import unicode_literals
from StringIO import StringIO
COMPILE_INCLUDES = [
"Stone\\Decoder.cs",
"Stone\\Empty.cs",
"Stone\\Encoder.cs",
"Stone\\IEncoder.cs",
"Stone\\IDecoder.cs",
"Stone\\IJsonReader.cs",
"Stone\\IJsonWriter.cs",
"Stone\\ITransport.cs",
"Stone\\Jso... |
import sys
import logging
from raven.utils.testutils import TestCase
from raven.base import Client
from raven import breadcrumbs
from io import StringIO
class DummyClass(object):
def dummy_method(self):
pass
class BreadcrumbTestCase(TestCase):
def test_crumb_buffer(self):
for enable in 1... |
from setuptools import setup, find_packages
import requests
import semantic_version
install_requires = [
'boto3>=1.17.78',
'botocore>=1.20.78',
'simplejson==3.17.2'
]
def get_LucidDynamodb_version():
url = "https://pypi.org/pypi/LucidDynamodb/json"
response = requests.request("GET", url, headers={... |
#!/usr/bin/env python
from setuptools import setup, find_packages
readme = open("README.rst").read()
setup(
name = "intercoop",
version = "0.2.1",
description =
"Intercooperation library",
author = "Som Energia SCCL",
author_email = "info@somenergia.coop",
url = 'https://github.com/Som-Energia/intercoop',
lo... |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... |
import datetime
import numpy as np
import os
import sys
from sklearn.linear_model import Ridge, RidgeClassifier
sys.path.insert(0, os.getcwd())
from hyperopt import hp, fmin, tpe
import qml_workdir.classes.config
from qml.cv import QCV
from qml.models import QXgb, QAvg, QRankedByLineAvg, QNN1, QStackModel
from qml... |
from pycipher.simplesubstitution import SimpleSubstitution
import unittest
class TestSimple(unittest.TestCase):
def test_encipher(self):
keys = ('abronjdfuetchiszlgwqvxkymp',
'mufykewgqtnrlopcbadsvxzijh',
'rtuzesbxjaniypqclghmvwodkf',
'ymdsvtxizewurqfnbgjlck... |
# Generated by Django 2.2.14 on 2021-02-01 17:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('base', '0576_populate_not_null_fields'),
# ('continuing_education', '0084_auto_20210127_1119'),
('dissertat... |
# Generated by Django 2.2.10 on 2021-03-03 17:08
from django.conf import settings
from django.db import (
migrations,
models,
)
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('accelerato... |
import logging
import json
import argparse
from ConfigParser import SafeConfigParser
import panda
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
logger = logging.getLogger('requests.packages.urllib3')
logger.setLevel(logging.DEBUG)
logger.propagate = True
class ServiceError(Exception):
pass
... |
## Copyright 2003-2007 Luc Saffre
## This file is part of the Lino project.
## Lino 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 versio... |
# -*- coding: utf-8 -*-
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser Genera... |
from tkinter import *
from face_photo import *
from PIL import Image, ImageTk
window = Tk() # cria uma janela
window.title('Facebook profile photo') # seta o título da janela
window.geometry('450x300') # seta o tamanho da janela
entry = Entry(window, width=25, justify='center') # cria uma entrada de texto
entry.inser... |
import zope.interface
import zope.schema
# XXX exceptions from upstream
from oauthlib.oauth1.rfc5849.errors import OAuth1Error
from pmr2.oauth import MessageFactory as _
class KeyExistsError(KeyError):
__doc__ = "key exists error"
class BaseInvalidError(KeyError):
__doc__ = "base invalid error."
class T... |
#!/usr/bin/env python3
import sys
from bs4 import BeautifulSoup
from colorama import Fore, Style
import colorama
import requests
def main():
with open('htdocs/index.html') as f:
html_doc = f.read()
soup = BeautifulSoup(html_doc, 'html.parser')
for anchor in soup.find_all('a'):
url = an... |
from django.forms import formsets
from django.contrib import messages
from django.db.models import Q
from detail import *
from edit import *
from dbe.shared.utils import *
class SearchFormViewMixin(BaseFormView):
ignore_get_keys = ["page"]
def get_form_kwargs(self):
""" Returns the keyword arguments... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import random
import logging
from concurrent.futures import ThreadPoolExecutor
import requests
from requests.packages.urllib3.util import is_connection_dropped
import xmltodict
from .protocol import (UserProtocol, TradeProtocol,
MoneyP... |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... |
"""empty message
Revision ID: 4a0b77571480
Revises: None
Create Date: 2014-07-28 14:50:21.815680
"""
# revision identifiers, used by Alembic.
revision = '4a0b77571480'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... |
# raptiye
# Copyright (C) 2009 Alper Kanat <alperkanat@raptiye.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, either version 3 of the License, or
# (at your option) any later vers... |
from flask import Flask, render_template, request, g
import os
import subprocess
import requests
import sqlite3
import yaml
app = Flask(__name__)
dnat_cmd = "sudo iptables -t nat %s PREROUTING -d %s -j DNAT --to-destination %s"
port_fwd_cmd = "sudo iptables -t nat %s PREROUTING -p %s -d %s --dport %s -j DNAT --to-de... |
'''
Implementation of running variance/standard deviation.
The MIT License (MIT)
Copyright (c) 2015 Yauhen Yakimovich <eugeny.yakimovitch@gmail.com>
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 Softw... |
# Configuration file for ipython-notebook.
c = get_config()
# Kernel config
c.IPKernelApp.pylab = 'inline' # if you want plotting support always
# Notebook config
### nbServer Config
c.NotebookApp.ip = '192.168.20.59'
c.NotebookApp.port = 8888
# c.NotebookApp.file_to_run = ''
## Env Set
# The IPython profile to use... |
# Copyright 2013 Dale Sedivec
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the h... |
from eventDictClassMethods import *
from astropy.time import Time
client = "https://gracedb-test.ligo.org/api/"
g = initGraceDb(client)
# Get ER11 Data from 6/16 08:00:00 UTC to 6/26 08:00:00 UTC
query_string = "1181635218 .. 1182499218"
allEvents = g.events(query_string)
V1events = {}
injectionCommentTimes = {}
DQC... |
"""Copyright 2016 The OpenConfig 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 writing, s... |
from django.shortcuts import render_to_response, redirect
import riak
import urllib, json
import urllib.parse
import urllib.request
from importer.models import ndl_search_opensearch
import pprint
from django.core.context_processors import csrf
from django.http import HttpResponseNotFound
from django.conf import setting... |
"""
:class:`EpicsDbDirective` implements the ``epicsdb`` -directive.
"""
import os, sys, re
import encodings
from docutils.parsers.rst import Directive, directives
from docutils import nodes, utils
from sphinx import addnodes
from sphinx.locale import _
#TODO handle expand keyword
def normalize_ref(text):
ret = ... |
"""
This connects to multiple controllers running across numerous physical
servers to control large scale experiments.
(c) 2015 Massachusetts Institute of Technology
"""
# Native
import multiprocessing
import random
import logging
logger = logging.getLogger(__name__)
# LO-PHI
import lophi.globals as G
# ... |
# -*- coding: utf-8 -*-
"""
Created on 2017-11-23
@author: cheng.li
"""
import unittest
import numpy as np
from alphamind.portfolio.evolver import evolve_positions
class TestEvolver(unittest.TestCase):
def test_evolve_positions_with_all_positive_position(self):
positions = np.array([0.2, 0.2, 0.8])
... |
############################################################################
# NHL GAMECENTER
# XBMC ADD-ON
############################################################################
import xbmcgui
from resources.lib.userinterface import *
from resources.lib.scoring_updates import *
params = get_params()
print para... |
"""
Copyright 2011-2015 Ryan Fobel and Christian Fobel
This file is part of MicroDrop.
MicroDrop 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 ver... |
#!/usr/bin/env python
"""Django model to DOT (Graphviz) converter
by Antonio Cavedoni <antonio@cavedoni.org>
Make sure your DJANGO_SETTINGS_MODULE is set to your project or
place this script in the same directory of the project and call
the script like this:
$ python modelviz.py [-h] [-d] [-i <model_names>] [-e <mode... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# http://ip.taobao.com/instructions.php
import socket
#
common_headers = \
"Host: ip.taobao.com\r\n" + \
"Connection: Keep-Alive\r\n" + \
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" + \
"User-Agent: Mozilla/5.0 (X11; Lin... |
import math
def measurements():
programOn = True
subTotal = 0
program_continue = input("Do you want to keep a running total of your measurements? 1 for yes, 2 for no: ");
if (program_continue == 1):
print " "
feet = input("Enter feet portion of distance: ");
inch = input("Ent... |
import copy
import pickle
from django.http import (QueryDict, HttpResponse, SimpleCookie, BadHeaderError,
parse_cookie)
from django.utils import unittest
class QueryDictTests(unittest.TestCase):
def test_missing_key(self):
q = QueryDict('')
self.assertRaises(KeyError, q.__getitem__, 'foo')... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Criado em 17 de Agosto 2016.
Descricao: este modulo possui como input uma serie de dados obtidos pelo CCDs, retornando o valor da mediana dos pixels
de cada imagem em funcao do tempo, assim como o desvio padrao absoluto. Alem disso, e calculada a transform... |
################################################################################
##
## Janus -- GUI Software for Processing Thermal-Ion Measurements from the
## Wind Spacecraft's Faraday Cups
##
## Copyright (C) 2016 Bennett A. Maruca (bmaruca@udel.edu)
##
## This program is free software: you can redistribute... |
"""Leetcode 695. Max Area of Island
Medium
URL: https://leetcode.com/problems/max-area-of-island/
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's
(representing land) connected 4-directionally (horizontal or vertical.)
You may assume all four edges of the grid are surrounded by water.
Find... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... |
'''
Module for importing audio and computing spectrograms to be fed to hierarchies
as list-of-lists representations.
Think of this as analogous to what it would take to convert a video into
something that one could feed to a hierarchy, except for sound instead.
This uses only mono WAV files. Convert your mp3 ... |
import random
def generateTBA(rda):
if rda == 0:
return 4
elif rda >= 1 and rda <= 25:
return 1
elif rda >= 26 and rda <= 65:
return 2
elif rda >= 66 and rda <= 85:
return 3
else:
return 4
def ward_1_service_time(rds):
if rds == 0:
return 6
elif rds >= 1 and rds <= 20:
return 4
e... |
from . import BOOL, INT, types
class Expression:
"""
A representation of an expression.
## Methods:
* stringify: function that takes a `namer` as an argument. This function renders the expression as text.
Expressions can be empty or parameterized. An empty expression when called creates a new ex... |
from __future__ import print_function
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_samples, silhouette_score
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
from numpy import genfromtxt
print(__doc__)
# Generating the... |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... |
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.template import RequestContext, loader
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.db.models import Q
from website import secrets
import datetime
... |
# -*- coding: utf-8 -*-
import os
import argparse
from datetime import date
from flaskup.models import SharedFile
from flaskup.filters import filesizeformat
def action_clean(quiet):
today = date.today()
count = 0
deleted_files = []
for f in SharedFile.find_all():
if f.expire_date < today:
... |
#!/usr/bin/env python
#
# Import all necessary libraries
#
import argparse
from lcrequest import LCRequest
#
# Define some global constants
#
VERSION= '0.1.0'
GRADES= map(chr, range(ord('A'), ord('G')+1))
# Lending Club API data structure keys
KEY_COUNT= 'count'
KEY_TOTAL= 'total'
KEY_NOTES= 'myNotes'
KEY_GRADE... |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 16 23:34:00 2015
@author: boland
"""
from seissuite.ant import (pscrosscorr)
import glob
import os
import pickle
#PICKLE_PATH = '/storage/ANT/PROGRAMS/ANT_OUTPUT/OUTPUT/CROSS/06.05.2015-15:53:28/XCORR-STACK_01.01.2014-31.12.2014_datalesspaz.pickle'
#PICKLE_PATH = '/home/... |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of perseo-fe
#
# perseo-fe 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 ... |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2010 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... |
import lib.record_rate
import lib.puylogger
import lib.record_rate
import lib.getconfig
import lib.commonclient
import lib.basecheck
import json
solr_url = lib.getconfig.getparam('Solr', 'stats')
check_type = 'solr'
class Check(lib.basecheck.CheckBase):
def precheck(self):
try:
stats_json ... |
from keras.engine import Layer, InputSpec
from keras import initializers, regularizers
from keras import backend as K
class FixedBatchNormalization(Layer):
def __init__(self, epsilon=1e-3, axis=-1,
weights=None, beta_init='zero', gamma_init='one',
gamma_regularizer=None... |
# Copyright (C) 2008 Antti Laine <antti.a.laine@tut.fi>
#
# This file is part of subtitle2spu.
#
# subtitle2spu 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
# ... |
# Code in file autograd/two_layer_net_custom_function.py
import torch
from torch.autograd import Variable
class MyReLU(torch.autograd.Function):
"""
We can implement our own custom autograd Functions by subclassing
torch.autograd.Function and implementing the forward and backward passes
which operate on Tensor... |
from rtmlparse import RTML
from rtmlparse.elements import *
from rtmlparse.misc import units, unitvalues
def main():
# create rtml
rtml = RTML('rtml://monet.uni-goettingen.de/resource', RTML.Mode.resource)
# telescope
telescope = Telescope(rtml, name='MONET/S')
telescope.Aperture = unitvalues.Ape... |
from pika.adapters.twisted_connection import TwistedProtocolConnection
from pika.connection import ConnectionParameters
from twisted.internet import protocol, reactor, task
from twisted.python import log
import uuid
import json
import os
class Consumer(object):
def on_connected(self, connection):
d = conn... |
# -*- coding: utf-8 -*-
#
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
from sqlalchemy.sql import select, func
metadata = MetaData()
users = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('usernam... |
# -*- coding: cp1252 -*-
#!/usr/bin/python
# Input / Output for the induction simulation
#Kommentar zeigt Verlauf an: Step-Nr. ist Schrittnummer
#Optionen:
# Option 1: import pylab siehe unten. Importiert Schnittstelle mit MatLab
# Kurvenzeichnungen
# Option 2: Non-MI-Mean-Out siehe unten. Per Default wird Non-MI-Mea... |
import perl
#if (perl.MULTI_PERL):
# print "1..0"
# raise SystemExit
print "1..14"
def ok(a, b=None):
return "a=" + str(a) + ", b=" + str(b)
perl.eval("""
use Python qw(apply);
$| = 1;
sub {
my $f = shift;
# First some tests that are expected to blow up
eval {
apply($f);
};
#... |
# Copyright 2019 Google 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""
Ax_Metrics - Test foundation metricdef package (not including MDefL parsing)
------------------------------------------------------------------------------
Author: Dan Kamins <dos at axonchisel dot net>
Copyright (c) 2014 Dan Kamins, AxonChisel.net
"""
# ----------------------------------------------------------... |
__author__ = "yulya"
class SessionHelper:
def __init__(self, app):
self.app = app
def Login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by... |
# This file is adapted from python code released by WellDone International
# under the terms of the LGPLv3. WellDone International's contact information is
# info@welldone.org
# http://welldone.org
#
# Modifications to this file from the original created at WellDone International
# are copyright Arch Systems Inc.
"""T... |
# 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... |
#! /usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import
from functools import wraps
import json
import requests
from .auth.client_credentials import ClientCredentialsMixin
from .auth.authorization_code import AuthorizationCodeMixin
from .upload import UploadMixin
class VimeoClient(ClientCrede... |
# -*- coding: utf-8-*-
from direct.showbase.DirectObject import DirectObject
import sys, time
class InputHandler(DirectObject):
def __init__(self, world):
self.world = world
#setting it active by default
self.setActive()
def setInactive(self):
# Main Modifier
... |
# -*- coding: utf-8 -*-
#
# outdoors documentation build configuration file, created by
# sphinx-quickstart.
#
# 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.
#
# All configuration values have ... |
"""
(C) Copyright 2009 Igor V. Custodio
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
any later version.
This program is distributed in the hope that it will b... |
# Copyright 2011-2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
# make pytest happy
# in pytest context module dependencies are not loaded
# thus geo fields are unknown
from odoo.addons import base_geoengine # noqa
class DummyAbstractModel(models.... |
#!/usr/bin/env python
"""
Integration (not unit) tests for pylast.py
"""
import unittest
import pylast
from .test_pylast import TestPyLastWithLastFm
class TestPyLastArtist(TestPyLastWithLastFm):
def test_repr(self):
# Arrange
artist = pylast.Artist("Test Artist", self.network)
# Act
... |
import time
import signal
import sys
import smbus
import robot_data_pb2
from oled_display import OledDisplay
class RobotDriver:
SERVO_STOP = 90
def __init__(self, i2c_address=0x04, i2c_bus=1, oled_display=None):
self.i2c_address = i2c_address
self.i2c_bus = smbus.SMBus(i2c_bus)
self.ol... |
"""
Module extracts metadata from NetCDF file to complete the required MyHPOM NetCDF
Science Metadata
References
reprojection
http://gis.stackexchange.com/questions/78838/how-to-convert-projected-coordinates-to-
lat-lon-using-python
datatype
http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html
... |
#Andrew Tan, 3/25, Section 010
import myfunctions
import random
#Ask user for inputs and check validity
while True:
qns = int(input("How many problems would you like to attempt? "))
if qns <= 0:
print("Invalid number, try again\n")
continue
else:
break
while True:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.