src stringlengths 721 1.04M |
|---|
import json
import csv
from collections import OrderedDict
from datetime import datetime
from StringIO import StringIO
#import pandas as pd
from django.conf import settings
from django.http import JsonResponse, HttpResponse
from django.template.loader import render_to_string
from django.views.generic import View
# A... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import can
def set_timeout(timeout,callback):
'''
@summary: calls a function after a specified number of seconds
@param timeout: number of seconds
@param callback: function be called
@result:
'''
pass # TODO
def collect_all_leaf_subclasses(... |
import os
import random
import time
import json
from locust import HttpLocust, TaskSet, task
from task_sets.baseTaskSet import baseTaskSet
import task_funcs.keystone_v2_base as keystone_base
import task_funcs.heat_v1_base as heat_base
import task_funcs.heat_v1_utility as heat_util
import task_funcs.nova_v2_utility as... |
#!/usr/bin/env python
'''
Run this script to update all the copyright headers of files
that were changed this year.
For example:
// Copyright (c) 2009-2012 The NanoCoin Core developers
it will change it to
// Copyright (c) 2009-2015 The NanoCoin Core developers
'''
import os
import time
import re
year = time.gmtim... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio 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... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SocialTag.paid'
db.add_column('cart_socialtag', 'paid', self.gf('django.db.models.fields.D... |
from __future__ import division
from __future__ import print_function
import os
import sys
import functools
# Update path
root = os.path.join(os.getcwd().split('proj1')[0], 'proj1')
if root not in sys.path:
sys.path.append(root)
import numpy as np
import pandas as pd
import multiprocessing
from pdb import set_tra... |
from leaf.model import Entry, Leaderboard
from leaf import db
class EntryThingTrait(object):
def find(self, lid, eid):
data = db.query_one('SELECT eid, lid, score FROM entries WHERE lid=%s AND eid=%s', (lid, eid))
if data:
return self._load(data)
def find_by_score(self, leaderbo... |
#!/usr/bin/env python
# -*- coding:gbk -*-
import sys
import re
import os
import time
import string
import datetime
import tushare as ts
from internal.ts_common import *
from decimal import Decimal
today = datetime.date.today()
#˵Ã÷show_flag
#0£º²»»ñµÃÿһֻµÄÁ÷ͨÅÌ£¬²»»á¼ÆËã»»ÊÖÂÊ
#1£º»ñµÃÿһֻµÄÁ÷ͨÅÌ£¬²¢ÇÒ¼ÆËã»»... |
# Author: Giacomo Vianello (giacomov@stanford.edu)
import logging
import sys
import numexpr
import numpy as np
from threeML.io.progress_bar import progress_bar
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("bayesian_blocks")
__all__ = ["bayesian_blocks", "bayesian_blocks_not_unique"]
def bay... |
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os
import re
import configparser
from typing import Any, cast, Dict, Optional, List, Union
from PyQt5.QtWidgets import QMessageBox
from UM.Decorators import override
from UM.Settings.ContainerFormatError... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""Contains classes and functions that are necessary to implement
different bindings.
Bindings normally consists of three parts:
- rules about what to send
- how to package the information
- which protocol to use
"""
import urlparse
import saml2
import base64
import u... |
import unittest
import datetime
from loggerglue.util.parse_timestamp import parse_timestamp
class TestParseTimestamp(unittest.TestCase):
pairs = {
'2003-10-11T12:14:15.003000Z': datetime.datetime(2003, 10, 11, 12, 14, 15, 3000),
'2003-10-11T12:14:15.003Z': datetime.datetime(2003, 10,... |
import contextlib
import os
import torch
import pytest
from torchvision import io
from torchvision.datasets.video_utils import VideoClips, unfold
from common_utils import get_tmp_dir
from _assert_utils import assert_equal
@contextlib.contextmanager
def get_list_of_videos(num_videos=5, sizes=None, fps=None):
wit... |
"""
Tests of student.roles
"""
import ddt
import six
from django.test import TestCase
from opaque_keys.edx.keys import CourseKey
from lms.djangoapps.courseware.tests.factories import InstructorFactory, StaffFactory, UserFactory
from common.djangoapps.student.roles import (
CourseBetaTesterRole,
CourseInstruc... |
"""
Support gathering system information of hosts which are running netdata.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.netdata/
"""
import logging
from datetime import timedelta
from urllib.parse import urlsplit
import requests
import volupt... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# user - [insert a few words of module description on this line]
# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the ... |
#-----------------------------------------------------------------------------#
# channels.py #
# #
# Copyright (c) 2010-2012, Code A La Mode, original authors. #
... |
import torch
from .Module import Module
class JoinTable(Module):
def __init__(self, dimension):
super(JoinTable, self).__init__()
self.size = torch.Size()
self.dimension = dimension
self.gradInput = []
def _getPositiveDimension(self, input):
dimension = self.dimension... |
import ipyleaflet as ll
import traitlets
import ipywidgets as widgets
import vaex.image
class IpyleafletImage(traitlets.HasTraits):
x_min = traitlets.CFloat()
x_max = traitlets.CFloat()
y_min = traitlets.CFloat(None, allow_none=True)
y_max = traitlets.CFloat(None, allow_none=True)
x_label = trait... |
from sympy import (Symbol, symbols, factorial, factorial2, binomial,
rf, ff, gamma, polygamma, EulerGamma, O, pi, nan,
oo, zoo, simplify, expand_func)
from sympy.functions.combinatorial.factorials import subfactorial
from sympy.utilities.pytest import XFAIL, raises
def test_rf_ev... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DatabaseMigrate.origin_environment'
db.add_column(u'maint... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import PyV8
import urllib
from urlparse import urlparse
try:
import json
except ImportError:
import simplejson as json
class Wappalyzer(object):
def __init__(self, url):
self.file_dir = os.path.dirname(__file__)
f = ope... |
import asyncio
import dataclasses
import struct
from asyncio import StreamReader, StreamWriter
from typing import List, Optional, Dict
from randovania.game_connection.backend_choice import GameBackendChoice
from randovania.game_connection.connection_backend import ConnectionBackend, MemoryOperation, MemoryOperationExc... |
import sys
import re
import random
vevent = re.compile("V\s+([\-\d\w]+)\s+(\w+)")
sevent = re.compile("S\s+([\-\d\w]+)\s+([\-\d\w]+)")
aevent = re.compile("A\s+([\-\d\w]+)")
devent = re.compile("D\s+([\-\d\w]{2,})")
cevent = re.compile("C\s+([\-\d\w]+)\s+[\-\d]*\s*([\-\d\w]+)\s+([\-\d\w]+)")
animate = ["Goomba","Mario"... |
import os
import re
import sys
import glob
import platform
import sysconfig
import subprocess
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from setuptools.command.test import test
from distutils.version import LooseVersion
class CMakeExtension(Extension):
def __init_... |
import sys
from bs4 import BeautifulSoup
import glob
import pickle
from pprint import pprint
filenames = glob.glob('../web/data/html_per_year/*')
filenames = sorted(filenames,reverse=True)
# filenames = ['../web/data/html_per_year/NHL_1993_games.html']
nhl_dict = {}
tie_count=0
game_count=0
ppg = []
for fname in f... |
"""
Tests for Discussion API internal interface
"""
import itertools
from datetime import datetime, timedelta
from urllib import urlencode
from urlparse import parse_qs, urlparse, urlunparse
import ddt
import httpretty
import mock
from django.core.exceptions import ValidationError
from django.test.client import Reques... |
# encoding: utf-8
# module PyQt4.QtNetwork
# from /usr/lib/python3/dist-packages/PyQt4/QtNetwork.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QHostInfo(): # skipped bases: <class 'sip.simplewrapper'>
"""
QHostInfo(int id=-1)
QHostInfo... |
# The queries.py file contains a bunch of relatively complex database
# queries that probably shouldn't take place inside the views.
from patchwords.models import Category, Story, Paragraph, User, Favourite
#gets a list of
def getTopStories(start=0, end=5, category=None):
#getting the stories and zipping them with... |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from urllib import parse
import os
from nico_tools import nico_xml_parser
from nico_tools.nicowalker import NicoWalker
from nico_tools.mylist_items import GetMyListItems
from nico_tools.mylist import MyList
from progressbar import ProgressBar, Percentage, Bar, ETA
import s... |
import common
env_name = 'humanoid'
git_path = '/home/llt_lab/Documents/repo/'
run_dir = git_path + '/Buffe-2017/Applications/mgail/environments/' + env_name + '/'
env = __import__('environment').ENVIRONMENT(run_dir)
forward_model = __import__('forward_model').ForwardModel(state_size=env.state_size,
... |
"""
Frantic Accelerator uses jinja2 templates to make static html files.
"""
import jinja2
import FranticAccelerator.Filters
import FranticAccelerator.Config
class FaEnv(jinja2.Environment):
"""
A frantic accelerator environment,
extend a jinja environment; adding some extra filters, a template loader
... |
# coding=utf-8
from django import forms
import pyodbc
class LoginForm(forms.Form):
username = forms.CharField(label="Nombre de Usuario", max_length=50)
password = forms.CharField(label="Contraseña", widget=forms.PasswordInput)
widgets = {
"password" : forms.PasswordInput(),
}
def clean... |
from hb_res.storage import get_storage
from copy import copy
import time
__author__ = "mike"
_resource_blacklist = {'Resource'}
_resources_by_trunk = dict()
_built_trunks = set()
_building_trunks = set()
def build_deps(res_obj):
assert hasattr(res_obj, 'dependencies')
for dep in res_obj.dependencies:
... |
#!/usr/bin/env python
"""train.py
Usage:
train.py [--n_mem=<dim>] [--dropout=<p>]
Options:
--n_mem=<dim> Dimension of LSTM [default: 300]
--dropout=<p> strength of dropout [default: 0.3]
"""
import theano
import logging
import numpy as np
import pprint
import json
import cPickle as pkl
from collec... |
import numpy as np
from hyperspy.component import Component
from hyperspy.axes import AxesManager
from unittest import mock
class TestMultidimensionalActive:
def setup_method(self, method):
self.c = Component(["parameter"])
self.c._axes_manager = AxesManager([{"size": 3,
... |
from mock import Mock
from unittest import TestCase
from nose.tools import assert_equals, assert_raises
from wunderclient.utils import assert_is_instance
from wunderclient.client import WunderClient, User, List, ValidationError
TEST_NAME = 'Testy McTesterton'
TEST_EMAIL = 'testy@mctesterton.com'
mock_requests = Mock(... |
# -*- coding: utf-8 -*-
#
# This file is part of semantic_query.
# Copyright (C) 2016 CIAPPLE.
#
# This is a free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
# Semantic Query API
# Author: Hussein AL-NATSHEH <h.natsheh@ciapple.c... |
#!/usr/bin/python
#
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# 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... |
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
""" setup.py:
Real simple utility.
No "install to command line" option, because nobody has requested one.
"""
from typing import Union
from io import TextIOBase
import string
import argparse
import julius
# Some utilities.
num_to_word = {'1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five'... |
from django.db import models
from django.db.models import permalink
# Create your models here.
class Blog(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
content = models.TextField(default='', blank=True)
description = models.TextField(default='', blank=True... |
__author__ = 'dengzhihong'
from src.Cluster.base import *
from src.Cluster.kmeans import *
from src.Cluster.em import *
from src.Cluster.mean_shift import *
if __name__ == '__main__':
dataA_X = str(open('../data/ClusterData/cluster_data_dataA_X.txt', 'r').read()).split()
dataA_Y = str(open('../data/ClusterDat... |
import datetime
import json
import unittest2
from datafeeds.parsers.fms_api.fms_api_event_list_parser import FMSAPIEventListParser
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from consts.district_type import DistrictType
from consts.event_type import EventType
from models.event impo... |
# File: gitn_log.py
# Author: kmnk <kmnknmk at gmail.com>
# License: MIT license
from gitn.enum import Window
from gitn.util.gitn import Gitn
from denite.process import Process
import os
import re
import time
from .gitn import Source as Base
DATE_GRAPH_HIGHLIGHT = {
'container': {
'name': 'gitnLog_dateGr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, re, select, os, json
from datetime import datetime
class TimeServer:
def __init__(self, host = '', port = 8081):
self.host = host
self.port = port
self.sock_server = socket.socket(socket.AF_INET, socket.SOCK_DGRA... |
import datetime
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.timezone import utc
from django.utils.translation import ugettext_lazy as _
SEX_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)
optional = {
'blank': True,
'null': True,
}
class Teacher(... |
# -*- coding: utf-8 -*-
"""Providing automated testing functionality
.. module:: yoda.yoda
:platform: Unix
:synopsis: Providing automated testing functionality
.. moduleauthor:: Petr Czaderna <pc@hydratk.org>
"""
"""
Events:
-------
yoda_before_init_tests
yoda_before_append_test_file
yoda_before_process_tests
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Blueprint
from flask import g, request, flash
from flask import render_template, redirect
from models import Student,Account,Course,Xk,Teacher
from forms import SearchStudentFrom,adminProfileForm,UserProfileForm,SearchForm,CourseEditForm,UseraddForm
from ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
import scrapy
from selenium import webdriver
from scrapy.http import JsonRequest, Request
from scrapy import Selector
import time
import json
class Lq7mSpider(scrapy.Spider):
name = 'lq7m'
start_urls = ['http://lq.7m.com.cn/list/3/2.shtml']
custom_settings = {
'DATABASEPIPELINE_ENABLED': True,
... |
from datetime import date
import string
from pyparsing import Optional, Suppress, Word
from regparser.grammar import utils
class EffectiveDate:
pass
class Notice:
def __init__(self, volume, page):
self.volume = volume
self.page = page
def __repr__(self):
return 'Notice( volume... |
import base64
import re
import sys
ref = sys.argv[1]
match_stable = re.match(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)', ref)
match_snapshot = re.match(r'refs/tags/snapshot-([0-9]+)', ref)
if match_stable:
print('::set-output name=TYPE::stable')
print('::set-output name=NAME::v%s.%s.%s' % (match_stable.group(1), ma... |
from os.path import dirname, join
import core
import lsst
import filebrowser
import pbm
from lsst import admin
#from local import defaultDatabase, MY_SECRET_KEY
from local import dbaccess, MY_SECRET_KEY
### VIRTUALENV
#VIRTUALENV_PATH = '/data/virtualenv/django1.6.1__python2.6.6'
#VIRTUALENV_PATH = '/data/virtuale... |
import tensorflow
import tcga_encoder
import sys, os, yaml
import numpy as np
import scipy as sp
import pylab as pp
import pandas as pd
from sklearn.metrics import roc_auc_score, roc_curve
from sklearn.model_selection import KFold
from collections import *
import itertools
import pdb
def xval_folds( n, K, randomize = F... |
#!/usr/bin/env python
#
# Copyright 2015 Google 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 requir... |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from superdes... |
#!/usr/bin/env python
# Copyright (c) 2015, Scott D. Peckham
#------------------------------------------------------
# S.D. Peckham
# July 9, 2015
#
# Tool to extract the object part of every CSDMS Standard
# Variable Name and generate a list of objects that
# includes those as well as all parent objects.
#
# Example... |
from os import path
from fabric.api import env, run, sudo, prefix
from fabric.contrib import files as fabric_files
import fabtools
from . import scow_task, pkgs, users, python, web, db
@scow_task
def init_droplet(*args, **kwargs):
"""Set up admin users and a web stack on the droplet"""
pkgs.upgrade_packages(... |
import fauxfactory
import pytest
from widgetastic_patternfly import DropdownItemDisabled
from cfme import test_requirements
from cfme.cloud.provider import CloudProvider
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.openstack import OpenSta... |
#!/usr/bin/env python
# encoding: utf-8
"""
@version:
@author: Will
@license:
@contact:
@site: http://www.timesnotes.com
@file: shopping.py
@time: 15-11-3 上午8:48
"""
from collections import OrderedDict
########################################
# 预算金额
while True:
tmp_yusuan = raw_input("预算金额(最小单位:元):")
if... |
"""
Tests using API.
"""
import base64
import json
import time
import xmlrpclib # nosec
from test_process import TestProcessProto, TestProcessShutdown
class TestAPIProto(TestProcessProto):
"""Test case logic for testing API"""
_process_cmd = ['pybitmessage', '-t']
@classmethod
def setUpClass(cls):... |
import ephem
import matplotlib.pyplot as plt
def plot_access_time(start, gs, tle):
"""Plots Access Time in seconds/day.
Arguments:
start -- string formatted 'yyyy/mm/dd HH:MM:SS'
gs -- 4 element list containing desired [name,lat,lon,alt]
tle -- 3 element list containing desired tle [line0,line1,... |
import json
from django.test import TestCase, RequestFactory
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.exceptions import PermissionDenied
from hs_core import hydroshare
from hs_core.views import unshare_resource_wit... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0014_auto_20150814_0439'),
]
operations = [
migrations.AlterField(
model_name='application',
... |
# -*- coding: utf-8 -*-
"""The CLI tools classes."""
import abc
import datetime
import locale
import logging
import os
import sys
try:
import win32api
import win32console
except ImportError:
win32console = None
import plaso
from plaso.cli import views
from plaso.lib import errors
from plaso.lib import py2to3
... |
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from hearthbreaker.cards.base import MinionCard, ChoiceCard
from hearthbreaker.game_objects import Minion
from hearthbreaker.tags.action import Give, Damage, Silence, Transform, Draw, Heal, \
Summon, AddCard, GiveManaCrystal, Remove, Kill
from hearthbreaker.tags.base import Choice, Buff, Effect, Battlecry, Deathrat... |
import Adafruit_BBIO.PWM as PWM
import Adafruit_BBIO.GPIO as GPIO
#import Adafruit_BBIO.ADC as ADC #IR
import subprocess
import math
import pinout
class Fresonbot(object):
ticksPerTurn = 12 *100 # 12 counts per revolution * 100:1 reduction gearbox
## you have to take this measures accurately
# WheelRadius ... |
'''
new_bc.core.py
core api calls for new_bc api library
'''
import os
import requests
API_URL = 'https://basecamp.com/{}/api/v1/'
MY_BC_NUMBER = '2361076'
def make_api_url(account_num=None,call=None,*args):
if account_num is None:
account_num = MY_BC_NUMBER
if call is None:
call = ... |
from __future__ import division
import logging
import os
import random
import shutil
from collections import OrderedDict
from PIL import Image, ImageChops, ImageOps
from golem.core.common import timeout_to_deadline, get_golem_path, to_unicode
from golem.core.fileshelper import common_dir, find_file_with_ext... |
from PyQt4 import QtCore
from PyQt4 import QtGui
import os
import re
import stat
import qutepart
from workspace import WorkSpace
import output
from consts import FileRole
from gdbwrapper import GDBWrapper
from watchestree import WatchesTree
from breakpoints import BreakpointsDB, BreakpointDialog
from properties impor... |
#!/usr/bin/python
from gi.repository import Gtk, GObject
import sys
import unittest
sys.path.insert(0,"../..")
sys.path.insert(0,"..")
#from mock import Mock
TIMEOUT=300
import softwarecenter.paths
softwarecenter.paths.datadir = "../data"
class TestViews(unittest.TestCase):
def test_viewswitcher(self):
... |
# Copyright 2012 Pedro Navarro Perez
# Copyright 2013 Cloudbase Solutions Srl
# 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... |
# Copyright 2013 IBM Corporation
# 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 ... |
from django.db import models
DB_ROUTER={"bibles":('BibleTranslations', 'BibleBooks',
'BibleVerses', 'BibleConcordance',
'BibleDict', 'XRefs')}
class BibleColours(models.Model):
network = models.TextField()
room = models.TextField()
element = models.TextField()
mir... |
def bivariate_normal(X, Y, sigmax=1.0, sigmay=1.0, mux=0.0, muy=0.0, sigmaxy=0.0):
Xmu = X-mux
Ymu = Y-muy
rho = sigmaxy/(sigmax*sigmay)
z = Xmu**2/sigmax**2 + Ymu**2/sigmay**2 - 2*rho*Xmu*Ymu/(sigmax*sigmay)
denom = 2*np.pi*sigmax*sigmay*np.sqrt(1-rho**2)
return np.exp(-z/(2*(1-rho**2))) / deno... |
from django.contrib.auth.models import User
from blog.models import Post, Comment
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
displayName = serializers.SerializerMethodField('getDisplayName')
host = serializers.SerializerMethodField('getHostName')
url = seriali... |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.osm import Osm
from geocoder.w3w import W3W
from geocoder.bing import Bing
from geocoder.here import Here
from geocoder.tamu import Tamu
from geocoder.tgos import Tgos
from geocoder.yahoo import Yahoo
from geocoder.baidu import Baid... |
import os
import getopt
import sys
from ..utils.inject import assign_injectables
from ..utils.immutabledict import ImmutableDict
from manifestparser import ManifestParser
from galleryitemfactory import GalleryItemFactory
import exporter
import templatewriter
import copier
class GalleryGenerator(object):
"""
The to... |
from random import randint
from random import getrandbits
from copy import deepcopy
# Agent that will either be the human player or a secondary agent for the dual agent play
class DumbAgent:
#initialize the board for the first player
def __init__(self, board):
self.board = board
def __str__(self):
return "Hi, ... |
#!/usr/bin/env python2
import sip
sip.setapi('QString', 2)
from PyQt4 import QtGui, QtCore, QtNetwork
from connmeMain import connme
import sys,os
class SingleApplicationWithMessaging(QtGui.QApplication):
messageAvailable = QtCore.pyqtSignal(object)
def __init__(self, argv, key):
QtGui.QApplication._... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# Thinkopen Brasil
# Copyright (C) Thinkopen Solutions Brasil (<http://www.tkobr.com>).
#
# This ... |
# -*- coding: utf-8 -*-
import base64
import codecs
import io
import struct
from xml.etree import ElementTree
from .crypto import sha256
try:
file_types = (file, io.IOBase)
except NameError:
file_types = (io.IOBase,)
# file header
class HeaderDictionary(dict):
"""
A dictionary on steroids for comfor... |
from phystricks import *
def ExoXLVL():
pspict,fig = SinglePicture("ExoXLVL")
x=var('x')
dist=0.1
l=2.5
C1=Rectangle( Point(-l,l),Point(-dist,dist) )
C2=Rectangle( Point(0,0),Point(l,l) )
C3=Rectangle( Point(0,0),Point(-l,-l) )
C4=Rectangle( Point(dist,-dist),Point(l,-l) )
C1.para... |
from graphene.traversal import *
from graphene.query import ProjectStream
from graphene.expressions import MatchNode, MatchRelation
from graphene.errors import *
class PlannerErrors:
"""
A class to store common errors in the query planner
"""
@staticmethod
def property_dne(name):
"""
... |
# ***************************************************************************
# * (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
# * (c) 2009, 2010 Ken Cline <cline@frii.com> *
# * (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * ... |
import re
import urllib
from ocve.models import PageLegacy, SourceLegacy
from ocve.models import PageImage
from django.conf import settings
from django.utils.html import escape
import logging
__author__ = 'Elliot'
logger = logging.getLogger(__name__)
def buildOldPath(pi):
p = pi.page
pl = PageL... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import kombu_fernet
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
packages = [
'kombu_fernet',
'kombu... |
# -*- coding: utf-8 -*-
"""
OnionShare | https://onionshare.org/
Copyright (C) 2014-2021 Micah Lee, et al. <micah@micahflee.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 t... |
# coding=utf-8
#
# Copyright 2016 F5 Networks 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 ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.conf.urls import patterns, url
from apps.survey.routes import (reserve_blockface_page, cancel_reservation,
reserve_blockfaces, reservations,... |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
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 ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement
from cms.models import Page, CMSPlugin, PlaceholderField
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.urlresolve... |
import asyncio
import json
import time
from typing import Any, Dict, MutableMapping, Optional, cast
import nacl.secret
import nacl.utils
import pytest
from aiohttp import web
from aiohttp.test_utils import TestClient
from aiohttp.web_middlewares import _Handler
from nacl.encoding import Base64Encoder
from aiohttp_ses... |
"""
In order to decide how many hidden nodes the hidden layer should have,
split up the data set into training and testing data and create networks
with various hidden node counts (5, 10, 15, ... 45), testing the performance
for each.
The best-performing node count is used in the actual system. If multiple counts
perf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.