src stringlengths 721 1.04M |
|---|
# Copyright 2018 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
#!/usr/local/bin/python
# Code Fights Group Dating Problem
def groupDating(male, female):
return ([list(t) for t in zip(*filter(lambda x: x[0] != x[1],
zip(male, female)))] if male != female else [[], []])
def main():
tests = [
[
[5, 28, 14, 99, 17],
[5, 14, 28, 9... |
#!/usr/bin/env python3.4
#
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
from django.utils import timezone
from django.test import TestCase
from .models import Config, UserAgent, IPAddress, Referer, PageURL, Visitor, ViewCounter
class ConfigMethodTests(TestCase):
def setUp(self):
Config.objects.create(name='Ono Yoko')
Config.objects.create(name='John Lennon')
... |
import nose.tools
from palm.blink_factory import SingleDarkBlinkFactory,\
DoubleDarkBlinkFactory,\
ConnectedDarkBlinkFactory
from palm.blink_model import BlinkModel
from palm.blink_parameter_set import SingleDarkParameterSet,\
... |
""" Python Character Mapping Codec generated from 'CP737.TXT' with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(s... |
import sublime
import os.path
import shutil
import textwrap
import time
import uuid
from YetAnotherCodeSearch.tests import CommandTestCase
_NEEDLE_IN_HAYSTACK = 'cc5b252b-e7fb-5145-bf8a-ed272e3aa7bf'
class CsearchCommandTest(CommandTestCase):
def setUp(self):
super(CsearchCommandTest, self).setUp()
... |
"""
Course API Views
"""
from django.core.exceptions import ValidationError
from django.core.paginator import InvalidPage
from edx_rest_framework_extensions.paginators import NamespacedPageNumberPagination
from django.http import HttpResponseRedirect
from django.urls import reverse
from rest_framework.generics import... |
# Test the FT Calibration state by calling the python class and doing the calculation here
# Moritz Schappler, schappler@irt.uni-hannover.de, 2015-05
# Institut fuer Regelungstechnik, Universitaet Hannover
# remotedebug
# import pydevd
# pydevd.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=Tru... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import argparse
import logging
import os
from functools import wraps
from flask import Flask
from flask import current_app
from flask import jsonify
from flask import req... |
from functools import partial
from itertools import islice, product
import numpy as np
import xarray as xr
def __where_not_nan(arr: np.ndarray):
"""Finds position of not nan values in an nd-array
Args:
arr (numpy.ndarray): nd-array with nan values
Returns:
data (xr.DataArray):... |
#!/usr/bin/env python
# Copyright (C) 2011 Fabiano Fidencio
#
# 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 ... |
# Copyright (c) 2013 Eslam Mostafa <cseslam@gmail.com>
# Copyright (c) 2013 Vadim Rutkovsky <vrutkovs@redhat.com>
# Copyright (c) 2013 Sai Suman Prayaga <suman.sai14@gmail.com>
# Copyright (c) 2013 Arnel A. Borja <kyoushuu@yahoo.com>
# Copyright (c) 2013 Shivani Poddar <shivani.poddar92@gmail.com>
# Copyright (c) 2013 ... |
from datetime import timedelta, date
from ..core import WesternCalendar, SUN, MON, FRI
from ..exceptions import CalendarError
from ..registry_tools import iso_register
@iso_register('ZA')
class SouthAfrica(WesternCalendar):
"South Africa"
include_good_friday = True
include_christmas = True
def holid... |
import json
from urllib.parse import urlencode
from urllib.request import urlopen, Request
# HTTP URL is constructed accordingly with JSON query results format in mind.
def sparqlQuery(query, baseURL, format="application/json"):
params = {
"default-graph": "",
"should-sponge": "soft",
"que... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import dimagi.utils.couch.migration
class Migration(migrations.Migration):
dependencies = [
('sms', '0015_rename_phonenumber_to_phoneblacklist'),
]
operations = [
migrations.CreateMo... |
#!/usr/bin/env python
# Copyright 2015 Fortinet, Inc.
#
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
#!/usr/bin/python
# coding: utf-8
#
# Copyright 2017 Red Hat | Ansible, Alex Grönholm <alex.gronholm@nextday.fi>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'meta... |
# 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... |
import logging
import threading
import uuid
from smqtk.algorithms.relevancy_index import get_relevancy_index_impls
from smqtk.representation.descriptor_index.memory import MemoryDescriptorIndex
from smqtk.utils import SmqtkObject
from smqtk.utils import plugin
DFLT_REL_INDEX_CONFIG = {
"type": "LibSvmHikRelevanc... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.http.response import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from .forms import WalletOneConfirmForm
from . import signals
logger = logging.getLogger(__name__)
@csrf_exempt
... |
# vim: set tabstop=4 expandtab sw=4:
import urllib
import string
import MasterServer
class Watcher(object):
def __init__(self):
self.server_info = dict()
def update_server_list(self):
server_list = MasterServer.getServerList()
if not server_list: # Master server didn't answer
... |
# Copyright (c) 2015 Huawei Technologies Co., Ltd.
# 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
#
# ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import lxml.etree as etree
import xml.dom.minidom as minidom
import xml.sax.saxutils as saxutils
from . import exception
from .fucking_string import ensure_utf8
class BaseXML(object):
xml_parser = etree.XMLParser(strip_cdata=False)
@classmethod
... |
#------------------------------------------------------------------------------
#
# Copyright (c) 2007, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in /LICENSE.txt and may be redistributed only
# under the conditions described ... |
import difflib
import json
import posixpath
import sys
import threading
import unittest
from collections import Counter
from contextlib import contextmanager
from copy import copy
from difflib import get_close_matches
from functools import wraps
from unittest.suite import _DebugResult
from unittest.util import safe_rep... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
"""
Django settings for wwwgaseng project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pa... |
from unittest import TestCase
from AHLexer import *
# Tests and helper methods that are common for PreLexer and AHLexer
class CommonLexerTestCase:
class BasicErrorListener:
def syntaxError(self, recogn, sym, line, column, msg, exc):
raise LexerError("some error %s" % msg, line, column, None)
... |
from email.headerregistry import Address
from email.message import EmailMessage
from typing import Union, Iterable
import pytest
from asphalt.mailer.api import Mailer
class DummyMailer(Mailer):
def __init__(self, **message_defaults):
super().__init__(message_defaults)
self.messages = []
asy... |
#!/usr/bin/python
import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.patches as mpatches
import pyLeaflet
fig, ax = plt.subplots()
Path = mpath.Path
path_data = [
(Path.MOVETO, (1.58-85, 35-2.57)),
(Path.CURVE4, (0.35-85, 35-1.1)),
(Path.CURVE4, (-1.85-85, 35+2.0)),
(Pa... |
#-----------------------
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'selectUI.ui'
# Created: Thu Feb 26 13:45:32 2015 by: PyQt4 UI code generator 4.11.3
#
# Created by Emily Conklin
# February 2015
# This program is connected to the main widget (NeuroGUI.py) and is a sub-user interface... |
from thywill_server.component import Component
from thywill_server.settings import THYWILL_CONFIG
class LogComponent(Component):
'''
The parent class for log component definitions.
'''
singleton = None
DEBUG = 'debug'
INFO = 'info'
WARNING = 'warning'
ERROR = 'error'
CRITICAL ... |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-#
#
# Copyright 2007 The Python-Twitter Developers
#
# 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... |
# Virtual memory analysis scripts.
# Developed 2012-2014 by Peter Hornyack, pjh@cs.washington.edu
# Copyright (c) 2012-2014 Peter Hornyack and University of Washington
import trace.vm_common as vm
'''
Describes trace events that caused the rss page count (resident in physical
memory) to change.
'''
class RssEvent:
t... |
import numpy as np
from matplotlib import pyplot as plt
import time
class Plotter:
def __init__(self, id):
self.id = id
self.initialize_canvas()
def initialize_canvas(self):
plt.ion()
self.fig = plt.figure()
self.ay = self.fig.add_subplot(211)
self.dline, = plt.plot([0], [0])
# ay.set_xlim([-1, 99])
... |
#!/usr/bin/env python
"""
"""
#from distutils.core import setup
import os, sys, re
from distutils.core import setup
import warnings
with open('README.md') as file:
long_description = file.read()
#
# Track version after pandas' setup.py
#
MAJOR = 0
MINOR = 0
MICRO = 0
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJ... |
#!/usr/bin/env python
"""Chainer example: autoencoder of a solar image.
"""
# c.f.
# http://nonbiri-tereka.hatenablog.com/entry/2015/06/21/220506
# http://qiita.com/kenmatsu4/items/99d4a54d5a57405ecaf8
import argparse
import numpy as np
import operator
import re
import six
import subprocess
import random
import cha... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009 Benny Malengier
#
# 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) ... |
__author__ = 'ZSGX'
from selenium import webdriver
from fixture.Session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, homeurl):
if browser == "firefox":
self.wd = webdriver.Firefox()
... |
#!/usr/bin/python
"""Test of HTML list presentation."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
# Work around some new quirk in Gecko that causes this test to fail if
# run via the test harness rather than manually.
sequence.append(KeyComboAction("<Control>r"))
sequence.append(utils... |
import numpy as np
import scipy.io as sio
import os
from PIL import Image
class BatchDatset:
imgs = []
max_batch = 0
batch_size = 0
cur_imgs = []
cur_labels = []
cur_batch = 0 # index of batch generated
cur_ind = 0 # index of current image in imgs
img_width = 600
img_height = 800
... |
from __future__ import division
from math import sin, cos
from .. import gl, glu
class CameraBase(object):
def __init__(self):
self.item = None
def reset(self):
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
class Camera(CameraBase):
def __init__(self):
super(C... |
############################################################
'''
testForks.py
Written by: Brian O'Dell, Spetember 2017
A program to run each program a 500 times per thread count.
Then uses the data collected to make graphs and tables that
are useful to evaluate the programs running time.
'''
######... |
#! /usr/bin/env python
"""
Print a list of tests to see whether all required tools for Ebe calculations
are present.
"""
from os import getcwd, unlink, path
from subprocess import call
numberOfSpaces = 5
def printWarning(warningString):
print("-"*(numberOfSpaces-2) + "> " + warningString)
def printMsg(m... |
N = 0 # character never appears in text
A = 1 # character appears in plain ASCII text
I = 2 # character appears in ISO-8859 text
X = 3 # character appears in non-ISO extended ASCII (Mac, IBM PC)
text_chars = [
# BEL BS HT LF VT FF CR
N, N, N, N, N, N, N, A, A, A, A, A, A, A, N, N, # ... |
#!/usr/bin/env python
"""
Downloads torrent files from RSS feeds
"""
from os.path import expanduser
import urllib.request
import argparse
import feedparser as fp
import yaml
PARSER = argparse.ArgumentParser(description='Downloads files from RSS feeds')
PARSER.add_argument('-c', '--config', help='Configuration fil... |
from decimal import Decimal as D
import sqlalchemy as sa
import logging
from sqlalchemy.sql import func
from sqlalchemy.dialects.postgresql import JSONB
from .ThreadStrategy import ThreadStrategy, OrderThread
class VolumeThread(OrderThread):
FLAG_NAME = 'is_exceed'
logger = logging.getLogger(__name__)
as... |
#coding=utf-8
'''
Created on 2014年12月10日
@author: Ancheel
'''
from flask import Blueprint, render_template, abort, request, flash, \
redirect, url_for
from flask.ext import login
from flask.ext.login import current_user
from firys import db, login_manager
from models import Entries, U... |
#! /Library/Frameworks/Python.framework/Versions/3.5/bin/python3
# -*- coding: utf-8 -*-
# 163服务器地址:
# POP3服务器: pop.163.com
# SMTP服务器: smtp.163.com
# IMAP服务器: imap.163.com
# sina服务器地址:
# POP3服务器:pop.sina.com
# SMTP服务器:smtp.sina.com
from email import encoders
from email.header import Header
from email.mime.multipart ... |
from __future__ import with_statement
from kombu.common import maybe_declare
from kombu.pools import producers
from queues import task_exchange
priority_to_routing_key = {'high': 'hipri',
'mid': 'midpri',
'low': 'lopri'}
def send_as_task(connection, fun, args=(... |
from elasticsearch_dsl import DocType
from elasticsearch_dsl.connections import connections
from elasticsearch_dsl.field import InnerObjectWrapper, Nested, String, Integer, Float
class Timestamp(InnerObjectWrapper):
word = String()
time = Float()
class YoutubeVideo(DocType):
title = String()
duratio... |
'''
Created on Nov 26, 2012
@author: stefanotranquillini
'''
from django.contrib.auth.models import User, Group
from rest_framework.authtoken.models import Token
from general.models import Application
from uuid import uuid4
def init():
initAppsAndCC()
def initAppsAndCC():
try:
user, c = User.objects... |
# -*- coding: utf-8 -*-
# Copyright 2010 Mats Ekberg
#
# 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... |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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... |
import json
from unittest import skip
import pytest
import responses
from django.test import TestCase
from mainapp.functions.citytools import import_outline, import_streets
from mainapp.models import Body, SearchStreet
@skip
class TestCitytools(TestCase):
fixtures = ["initdata"]
ags_munich = "09162000"
... |
# -*- coding: utf-8 -*-
#
# 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, soft... |
#!/usr/bin/python
########################################################################
# 28 Apr 2014
# Patrick Lombard, Centre for Stem Stem Research
# Core Bioinformatics Group
# University of Cambridge
# All right reserved.
########################################################################
import argparse... |
# coding=utf-8
"""Monkey-patch logger functions to accept enhanced format styles."""
from __future__ import unicode_literals
import logging
from builtins import object
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getfullargspec
from six import text_type
clas... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- 7oars.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import time
"""stopwatch is a very simple Python module for measuring time.
Great for ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# FreshMail API documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 13 17:01:53 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in thi... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... |
# Duhhhh
import numpy as np
import matplotlib.pyplot as plt
import seaborn
plt.close('all')
# Define the parameters
r = 20 # the production rate
gamma = 1 / 30 # the degradation rate
k = 200 # in units of concentration
max_R = 1000 # maximum number of R1 and R2
R1 = np.linspace(0, max_R, 500)
R2 = np.linspace(0, m... |
# -*- encoding:utf-8 -*-
"""股票基本信息图形可视化"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import logging
import ipywidgets as widgets
from abc import ABCMeta, abstractmethod
from IPython.display import display
from ..CoreBu.ABuFixes import six, partial
... |
"""
Horizontal Split Panel: Left and Right layouts with a movable splitter.
/*
* Copyright 2008 Google Inc.
* Copyright 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
*
* Licensed under the Apache License, Version 2.0 (the "License") you may not
* use this file except in compliance with the License. You m... |
import logging
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from ..auth.decorators import admin_required, deny_restricted
from .forms import GroupForm
from .models import Group
logger = logging.getLogger(__name__)
# thi... |
"""
"""
import datetime
import logging
import os
import time
import cv2
import numpy as np
import tensorflow as tf
import cnn_lstm_otc_ocr
import utils
import helper
FLAGS = utils.FLAGS
logger = logging.getLogger('Traing for OCR using CNN+LSTM+CTC')
logger.setLevel(logging.INFO)
def train(train_dir=None, val_di... |
"""Support for wired binary sensors attached to a Konnected device."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_STATE,
CONF_BINARY_SENSORS,
CONF_DEVICES,
CONF_NAME,
CONF_TYPE,
)
from homeassistant... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-18 05:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('appconf', '0001_initial'),
]
... |
#!/usr/bin/env python
"""
MIT License
Copyright (c) 2017 Guillaume Papin
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 use, copy,... |
from keras.models import Model
from keras.layers import Dense, ZeroPadding2D, BatchNormalization, Conv2D, MaxPooling2D, Activation, Input, Concatenate
from keras.optimizers import RMSprop
from layers.SpatialPyramidPooling import SpatialPyramidPooling
from keras.applications.resnet50 import identity_block, conv_block
... |
"""A generalization of the classification accuracy with cross-class scores.
Soften the accuracy score by giving scores through certain misclassifications
defined by the score matrix. For example, in ordinal regression we may want
not to penalize too much misclassifications to neighbor classes. The score also
generaliz... |
import unittest
from insights.parsers.tuned import Tuned
from insights.tests import context_wrap
TUNED_OUTPUT = '''
Available profiles:
- balanced
- desktop
- latency-performance
- network-latency
- network-throughput
- powersave
- throughput-performance
- virtual-guest
- virtual-host
Current active profile: virtual-g... |
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You may use it, redistribute it and/or modify
# it, in whole or in part, provided that you do so at your own risk and do not
# hold the developers or copyright holders liable for any claim, damages, or
# other l... |
'''
optics elements
'''
# from numpy import sin, cos, pi, sqrt, log, array, random, sign
#from numpy.linalg import norm
import numpy as np
def debug(*args):
print(' '.join( map(str, args) ))
def warn(*args):
print(' '.join( map(str, args) ))
def info(*args):
print(' '.join( map(str, args) ))
class Op... |
from __future__ import unicode_literals
import pytest
from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document
from pgcli.packages.function_metadata import FunctionMetadata
metadata = {
'tables': {
'public': {
'users': [... |
from base64 import b64encode
from couchpotato.core.downloaders.base import Downloader, StatusList
from couchpotato.core.helpers.encoding import isInt
from couchpotato.core.logger import CPLog
from couchpotato.environment import Env
from datetime import timedelta
import httplib
import json
import os.path
import re
impor... |
import os
import random
import csv
import numpy as np
import matplotlib.pyplot as plt
from skimage import measure
from astropy.io import fits
class create_stamps(object):
def __init__(self):
return
def load_lightcurves(self, lc_filename, lc_index_filename):
lc = []
lc_index = []
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MyUI\MyWidgetUI.ui'
#
# Created: Tue Apr 01 09:40:20 2014
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... |
import logging
import time
import os.path
import sys
if isinstance(u"", str):
# Python 3
codecs = None
else:
# Python 2
import codecs
FORMAT = '[%(asctime)s] %(levelname)5s -- : %(message)s'
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S'
class Logger(logging.Logger):
def __reduce__(self):
... |
"""
Copyright 2017, J. Poderys, Technical University of Denmark
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 ... |
"""Person model"""
from sqlalchemy import Column, UniqueConstraint, ForeignKey
from sqlalchemy import schema as saschema
from sqlalchemy.types import Integer, String, Unicode, Float, UnicodeText, Date, SmallInteger
from discariche.model.meta import Base
class Comune(Base):
__tablename__ = "comune"
id = Colum... |
# -*- coding: utf-8 -*-
""" Sahana Eden Common Alerting Protocol (CAP) Model
@copyright: 2009-2015 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to dea... |
from dataclasses import dataclass, field
from typing import *
from . import TestSetup
__all__ = [
"HParams",
"RunConfig",
"TrainConfig",
"TaskHyperParameters",
"HyperParameters",
]
@dataclass
class HParams(TestSetup):
"""
Model Hyper-parameters
"""
# Number of examples per batch
... |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.fixture_group import GroupHelper
from fixture.navigation import NavigationHelper
from fixture.fixture_contact import *
class Application:
def __init__(self, browser, baseurl):
if browser == 'firefox':
self.wd... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import codecs
import sys
import string
import zipfile
import codecs
import shutil
import uuid
from ConfigParser import SafeConfigParser
from datetime import date
from PyQt4.QtGui import QApplication, QDialog, QMainWindow, QFileDialog
from PyQt4.QtGui import QTableWid... |
from __future__ import unicode_literals
from threading import Timer
from datetime import datetime
from rtmbot.core import Plugin
from utils import word_checking as wc_utils
from utils.db import update_user_counts, get_user_counts
from utils.utils import load_json, write_json, add_plurals
import threading
OPT_IN_FIL... |
# ****************************************************************************
# Copyright 2018 The Apollo Authors. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... |
#
# Copyright (c) SAS Institute 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 w... |
import pytest
from sqlalchemy_utils import database_exists, create_database, drop_database
from repositories.config import Base
from repositories.config import engine
from repositories.session import session_manager
@pytest.fixture(scope="session", autouse=True)
def create_db(request):
print("\n===> Create and s... |
# -*- 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.CreateModel(
... |
# fora
# Xu [xw901103@gmail.com] Copyright 2015
from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from sqlalchemy import engine_from_config
from fora.core.dbsession import DBSession
from fora.core.model import Model
from fora.core.view import View
from fora.core.adminview ... |
#!/usr/bin/env python
from pyo import *
from time import sleep
s = Server(audio='jack')
s.setMidiInputDevice(99)
s.boot().start()
dummy = LFO(freq=0)
dummymidi = Notein()
dummytable = NewTable(length=1, chnls=1)
dummyinput = Input(chnl=0, mul=.7)
table_pyo4e06153256c49c = SndTable("webroot/AKWF_0019.wav")
pyocd2b6b... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages
from django.contrib.admin.models import DELETION, LogEntry
from django.contrib.admin.options import get_content_type_for_model
from django.core.urlresolvers import NoReverseMatch, Resolver404, resolve, reverse
from dja... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# Copyright 2016-2017 VMware Inc.
# This file is part of ETSI OSM
# 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
#
# ... |
"""python compute_test_set_embeddings.py pascal1k_crossnet_adadelta_emb_200.pickle"""
import cPickle
import sys
import numpy as np
from nnet_archs import CrossNet
with open(sys.argv[1], 'rb') as f:
nnet = cPickle.load(f)
transform_imgs = nnet.transform_img()
transform_snds = nnet.transform_snd()
dataset_path = ... |
from django.conf.urls import patterns, include, url
import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('',
(r'^admin/', i... |
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Public License version 2.1... |
""" plan_learning.py
- This module contain the procedure used for learning plans from experience.
Copyright (C) 2016 Stephan Chang
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.