src stringlengths 721 1.04M |
|---|
# BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed i... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import (absolute_import, divi... |
# coding=utf-8
# --------------------------------------------------------------------------
# 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 ... |
#!/usr/bin/env python
#
# Copyright 2017 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... |
#!/usr/bin/env python
import pyaudio
import zmq
import socket
import sys
import time
import wave
from subprocess import Popen, call
from glob import glob
from os.path import join
import os
# Record over network usage example
# on remote machine
#$ ./streamr.py callisto stream sound
# on local machine
#$ ./streamr.py ... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2008 B. Malengier
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Nick Hall
#
# This program is free software; you can redistribute it ... |
import nmap
from time import time, sleep, gmtime, strftime
import os, os.path
import requests
import ConfigParser
import urllib2
import subprocess
import datetime
import fileinput
from firebase import firebase
config = ConfigParser.ConfigParser()
config.read([os.path.expanduser("~/netscan/.netscan"), '/etc/netscan'])
... |
# Copyright 2015 Mirantis, 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 ... |
from mudwyrm_users.admin.achaea import ScriptState
from mudwyrm_users.admin.achaea.common import AttrDict
from mudwyrm_users.admin.achaea.trigger import Trigger, Alias, OnEvent
from mudwyrm_users.admin.achaea.scripts import char
import re
p = None
s = ScriptState()
def init(processor):
assert processor is not N... |
import os, struct
from array import array
from cvxopt.base import matrix
def read(digits, dataset = "training", path = "."):
"""
Python function for importing the MNIST data set.
"""
if dataset is "training":
fname_img = os.path.join(path, 'train-images-idx3-ubyte')
fname_lbl = os.path... |
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.static import serve
from django.views.generic import RedirectView
from kuma.attachments import views as attachment_views
from kuma.core import views as core_views
from kuma.wiki.admin import pu... |
import theano as t
import numpy as np
import theano.tensor as tt
from theano.tensor.nnet import conv
from theano.tensor.signal import downsample
import common
rng = np.random.RandomState(23455)
class CONV_POOL(object):
"""Conv Pool Layer of a convolutional network """
def __init__(self, filter_shape, image_s... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# =============================================================================
# 2013+ Copyright (c) Kirill Smorodinnikov <shaitkir@gmail.com>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gener... |
# -*- coding: utf-8 -*-
### py_messenger
### GNU/GPL v2
### Author: Cody Rocker
### Author_email: cody.rocker.83@gmail.com
### 2016
#-----------------------------------
# Requires: """
# - Python 3 """
#-----------------------------------
import keyring
import getpass
from .st... |
# encoding: utf-8
"""
Copyright 2013 Jérémie BOUTOILLE
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 distri... |
import unittest
from .cards import Card
from .hands import Evaluator, HandValues
def _generate_hands(card_value: str) -> Card:
"""
Generates a card given a string input.
:param card_value: string input, with value first (i.e. AH)
:return: The appropriate card
"""
return Card(card_value[1], card_value[0])
clas... |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
from functools import partial
__author__ = 'stuart'
def get_object_attrs(obj):
if hasattr(obj, '__dict__'):
return obj.__dict__
elif hasattr(obj, '__slots__'):
return {key: getattr(obj, key) for key in obj.__slots__}
else:
return {}
class Union(object):
def __init__(self, at... |
"""The tests for the pilight component."""
from datetime import timedelta
import logging
import socket
import unittest
import pytest
from homeassistant import core as ha
from homeassistant.components import pilight
from homeassistant.setup import setup_component
from homeassistant.util import dt as dt_util
from test... |
# Copyright (c) 2003-2005 Jimmy Retzlaff, 2008 Konstantin Yegupov
#
# 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... |
########
# Copyright (c) 2015 GigaSpaces Technologies 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
#
# Unless... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth.models import User, Group
from geoprisma.models import Resource, Session
#Dummy decorator if schema is not supported
def schematize(original_class):
return original_class
#Import model that support PGSQL schema if dif... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' git implementation
git fetcher support the SRC_URI with format of:
SRC_URI = "git://some.host/somepath;OptionA=xxx;OptionB=xxx;..."
Supported SRC_URI options are:
- branch
The git branch to retrieve from. ... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ErrorX(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter"
_path_str = "scatter.error_x"
_valid_props = {
"array",
"arrayminus... |
import inspect
from collections import namedtuple
import math
from itsdangerous import BadSignature
from salty_tickets.database import db_session
from salty_tickets.discounts import discount_users
from salty_tickets.tokens import order_product_deserialize, order_product_token_expired, GroupToken
from sqlalchemy impor... |
from __future__ import unicode_literals
import base64
import json
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.test import TestCase
from courses.models import Course
from issues.model_issue_status im... |
from tools import color_print as cl
class ConditionIntegrate(object):
def read_node(self, node):
'''
Read the conditions of a node.
'''
if hasattr(node, 'conditions') is False:
return
cnds = node.conditions()
# cl('yellow', 'get conditions for node', no... |
import os
import tempfile
import unittest
from pyepw.epw import GroundTemperatures, GroundTemperature, EPW
class TestGroundTemperatures(unittest.TestCase):
def setUp(self):
self.fd, self.path = tempfile.mkstemp()
def tearDown(self):
os.remove(self.path)
def test_create_ground_temperatur... |
import bacon
class Rect(object):
def __init__(self, x1, y1, x2, y2):
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
@property
def width(self):
return self.x2 - self.x1
@property
def height(self):
return self.y2 - self.y1
@property
def ... |
import json
from nose.tools import eq_, ok_
from funfactory.urlresolvers import reverse
from airmozilla.main.models import Tag, Event
from .base import ManageTestCase
class TestTags(ManageTestCase):
def test_tags(self):
"""Tag management pages return successfully."""
response = self.client.get(... |
#!/usr/bin/env python3
import os.path, sys, json
from collections import OrderedDict
todo_list = OrderedDict()
file_path = os.path.expanduser('~/.todo_list.json')
if os.path.isfile(file_path):
with open(file_path, 'r') as todo_list_file:
todo_list.update(json.load(todo_list_file))
args = sys.argv[1:]
d... |
"""
This fabfile currently works to deploy this repo and mitx to a new server.
A lot of settings and names will need to be changed around for your specific config, so
look through carefully.
"""
from __future__ import with_statement
from fabric.api import local, lcd, run, env, cd, settings, prefix, sudo, shell_env
fro... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2017 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... |
"""
Name: u12.py
Desc: Defines the U12 class, which makes working with a U12 much easier. The
functions of the U12 class are divided into two categories: UW and
low-level.
Most of the UW functions are exposed as functions of the U12 class. With
the exception of the "e" functions, UW fun... |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test the gslib module."""
from __future__ import print_function
import base64
import datetime
import errno
import mox
import os
from chromite.li... |
from django.db import models, migrations
import djangocms_text_ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20150607_2207'),
('pages', '0007_activelearningratesplugin'),
]
operations = [
migrations.CreateModel(
name='ListP... |
# Copyright 2021 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 agreed to in writing, ... |
#!/usr/bin/python
# coding: utf-8
import argparse
import sys
SUIT_MAP = {
'club': '♣',
'diamond': '♦',
'heart': '♥',
'spade': '♠',
}
templateA = """
<div class="card %(suit)s" id="%(id)s" data-suit="%(suit)s" data-number="%(number)s">
<div class="flipper">
<div class="front">
<div class="corner t... |
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.brain import BrainFileConfiguration
class WeathersTestsClient(TestClient):
def __init__(self):
TestClient.__init__(self, debug=True)
def load_configuration(self, arguments):
super(WeathersTestsClient,... |
from flask_wtf import Form
from flask_babel import gettext
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
from .models import User
class LoginForm(Form):
openid = StringField('openid', validators=[DataRequired()])
remember_me = BooleanField('re... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © Manoel Vilela 2016
#
# @project: Decorating
# @author: Manoel Vilela
# @email: manoel_vilela@engineer.com
#
# pylint: disable=redefined-builtin
# pylint: disable=invalid-name
"""
An collection of usefull decorators for debug
and time... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 31 15:40:26 2017
@author: sakurai
"""
import numpy as np
import chainer.functions as F
def squared_distance_matrix(X):
n = X.shape[0]
XX = F.sum(X ** 2.0, axis=1)
distances = -2.0 * F.linear(X, X)
distances = distances + F.broadcast_to(XX, (n, n))
d... |
# -*- coding: utf-8 -*-
# @Author: chandan
# @Date: 2017-07-08 00:32:09
# @Last Modified by: chandan
# @Last Modified time: 2017-07-08 11:13:46
from data_utils import read_file
from config import DATA_DIR, SCORE_COLUMNS
import os
from model import train_model, test_model
import pandas as pd
import numpy as np
fr... |
#
# 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... |
###########################################################################################
###########################################################################################
## ##
## Nb Code Lines v 1.0 (c) 2015 Alok Gandhi... |
import unittest
import rx
from rx import operators as ops
from rx.testing import TestScheduler, ReactiveTest
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = ReactiveTest.subscribed
disposed = ReactiveTest.disposed... |
# Copyright (c) 2012-2013 Intel, Inc.
# License: GPLv2
# Author: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
# as published by the Free Software Foundation.
#
# This progra... |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six im... |
class Validator:
description = '' # Plain text description of what is being checked
expected_result = [] # optional
def __init__(self):
self.success = None # True or False
self.result_message = '' # optional extra information about test result
def validate(self, result):
r... |
# -*- coding: utf-8 -*-
#
## This file is part of INSPIRE.
## Copyright (C) 2014 CERN.
##
## INSPIRE is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) an... |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... |
import pyopencl as cl
import numpy
import numpy.linalg as la
import scipy.special as ssf
import datetime
from time import time
import test_cython_32
def test_cython_0(zz):
time1 = time()
a, b, c = test_cython_32.test_0(zz)
run_time = time() - time1
print("Execution time of Cython on float32: ", r... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import common
import connection
import m3u8
import re
import simplejson
import sys
import urllib
import ustvpaths
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
addon = xbmcaddon.Addon()
pluginHandle = int (sys.argv[1])
SITE = "pbskids"
NAME = "PBS Kids"
DESCRI... |
"""This demo program solves the incompressible Navier-Stokes equations
on an L-shaped domain using Chorin's splitting method."""
# Copyright (C) 2010-2011 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Publi... |
# Copyright 2015 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""This module defines the vtgate client interface.
"""
from vtdb import vtgate_cursor
# mapping from protocol to python class.
vtgate_client_conn_classes = dict()
... |
import os
import time
import shutil
import requests
from lxml import etree
from openpyxl import Workbook
JOBCN_DATA_DIR = '../../DataSet/jobcn/'
base_url = 'http://www.jobcn.com/search/listalljob_servlet.ujson'
user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.... |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
# -*- coding: utf-8 -*-
"""
The MIT License
Copyright (c) 2010 Olle Johansson
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,... |
import json
import logging
import os
import ssl
import time
import uuid
import yaml
import asyncio
import websockets
STATE = {
'messageId': 123,
}
def make_message(functionName, responseExpected=False,
payload=None, inResponseTo=0):
messageId = STATE['messageId']
STATE['messageId'] += ... |
"""NetCDF file reader.
This is adapted from Roberto De Almeida's Pupynere PUre PYthon NEtcdf REader.
classes changed to underscore_separated instead of CamelCase
TODO:
Add write capability.
"""
#__author__ = "Roberto De Almeida <rob@pydap.org>"
__all__ = ['netcdf_file', 'netcdf_variable']
import struct
import... |
import sys, re
import string
"""Simple script that scans all of the test suite results text fed in
through stdin and summarises the total number of failures, test
points, and test cases."""
# Read in everything
lines = sys.stdin.readlines()
# Init the running totals
failures = 0
cases = 0
tests = 0
bytes = 0
ticks =... |
import cgen as c
from sympy import Not
from devito.arch import AMDGPUX, NVIDIAX
from devito.ir import (Block, Call, Conditional, List, Prodder, ParallelIteration,
ParallelBlock, PointerCast, While, FindNodes, Transformer)
from devito.mpi.routines import IrecvCall, IsendCall
from devito.passes.ie... |
#!/usr/bin/env python2
import sys
import random
from string import join
STACK = []
LOOPS = [] # Loops are stacks too
PNT = 0
BREAK = False # Break mode
ENV = {
"[": lambda: LOOPS.append(PNT),
"]": lambda: loop(),
"drop": lambda: STACK.pop(),
"dup": lambda: push(str(STACK[-1])) if STACK != [] else panic("Tried d... |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
# Copyright 2004-2008 eXe Project, http://eXeLearning.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... |
#!/usr/bin/python
#
# simple script to recurse a subtree, find all the mp3 and queue them to
# XMMS.
#
# Please modify this script! My python is rusty at best.
#
# Travis Hume -- travis@usermail.com
# Thu Oct 24 11:06:54 2002
#
# Barak Korren - ifireball@yahoo.com
# Sat Apr 03 2004
# Some bugfixes, now preserves alp... |
'''
Created on Jul 22, 2011
@author: Rio
'''
import collections
from datetime import datetime
import itertools
from logging import getLogger
from math import floor
import os
import random
import shutil
import struct
import time
import traceback
import weakref
import zlib
import sys
from box import BoundingBox
from e... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import json
import sys
def translate(cond):
if cond == u"全": return "true"
return "false"
js_head = "function(n){"
js_body = "if(%s)return'%s';"
js_tail = "return'00000';}"
ifile = codecs.open("tmp/weighted.json", "r", encoding="utf-8")
rules = j... |
import dataset
import datetime
import os
import unicodedata
def convert_name_to_slug(name):
"""Takes a congresista name and returns its slug."""
name = name.replace(",", "").lower()
name = name.split(" ")
if len(name) > 2:
i = 0
slug = ""
while i < 3:
slug += name[... |
"""
Script to convert Matlab-generate strain files to cmiss files
To be used by data in strain_pred_20170712
In each row, each group of 15 data entries correspond to the following for a node
Principal_1
Principal_2
Principal_3
VonMises
Hydrostatic
Octahedral
PrincipalVector1 x
Princip... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser 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 Sof... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Rackspace
# Copyright (c) 2011 X.commerce, a business unit of eBay 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 t... |
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import (HttpResponse, HttpResponseRedirect)
from django.shortcuts import ... |
#!/usr/bin/python
#Filename: objvar.py
class Person:
"'Represents a person.'"
population = 0
def __init__(self, name):
''''Initializes the person's data.'''
self.name = name
print '(Initializing %s)'% self.name
#When this person is created, he/she
#adds to the pop... |
from collections import deque
import math
import numpy as np
from scipy import signal
class Channel:
def __init__(self, name, min, max, maxNum, offset=0.0):
self.name = name
self.min = min
self.max = max
self.num = 0
self.sum = 0
self.buffersum = 0
self.size = maxNum
self.buffer = deque(maxlen=maxNu... |
# -*- coding: cp1252 -*-
"""
###############################################################################
HEADER: Taxi_LongRides.py
AUTHOR: Esa Heikkinen
DATE: 26.06.2018
DOCUMENT: -
VERSION: "$Id$"
REFERENCES: -
PURPOSE:
CHANGES: "$Log$"
#######################################################... |
# Copyright (c) 2008-2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy... |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from shuup.apps import AppConfig
from shuup.apps.settings import v... |
# -*- encoding: utf-8 -*-
'''
Text Input
==========
.. versionadded:: 1.0.4
.. image:: images/textinput-mono.jpg
.. image:: images/textinput-multi.jpg
The :class:`TextInput` widget provides a box for editable plain text.
Unicode, multiline, cursor navigation, selection and clipboard features
are supported.
The :cl... |
from __future__ import absolute_import, print_function
from ..base import ModelDeletionTask, ModelRelation
class OrganizationDeletionTask(ModelDeletionTask):
def get_child_relations(self, instance):
from sentry.models import (
OrganizationMember,
Commit,
CommitAuthor,
... |
#!/usr/bin/env python
#coding: iso-8859-15
#
# Copyright (C) 2005 Gaëtan Lehmann <gaetan.lehmann@jouy.inra.fr>
#
# this file is part of uptodate
#
# 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... |
"""
This file is part of HexACO.
HexACO 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.
HexACO is distributed in t... |
import random, pickle, os, sys
import numpy as np
from clusterData import *
from scipy.cluster.vq import kmeans,vq,whiten
class KMeans:
def __init__(self, fK, tK, filename, typeDataset):
self.queryRankerList = []
self.bestKClusterGroup = []
self.queryRankerDict = {}
se... |
# Copyright 2012, Oliver Nagy <olitheolix@gmail.com>
#
# This file is part of Qtmacs.
#
# Qtmacs 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... |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import logging
from awx import __version__ as tower_version
# Prepare the AWX environment.
from awx import prepare_env, MODE
prepare_env()
from django.core.wsgi import get_wsgi_application # NOQA
"""
WSGI config for AWX project.
It exposes the WSGI callabl... |
import unittest
from rx import operators as ops
from rx.testing import TestScheduler, ReactiveTest
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = ReactiveTest.subscribed
disposed = ReactiveTest.disposed
created =... |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2011-2016, Nigel Small
#
# 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... |
################################################################################
#
# Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://launchpad.net/madanalysis5>
#
# MadAnal... |
# -*- coding: utf-8 -*-
from uuid import UUID
from x509.django.models import Certificate
from x509.exceptions import (CertificateInvalid, CertificateMissing,
HeaderMissing)
def raise_for_certificate(environ):
if 'HTTP_SSL_CLIENT_VERIFY' not in environ or \
environ['HTTP_S... |
# -*- coding: utf-8 -*-
# Copyright 2019 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 yo... |
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone i... |
# Copyright 2019 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 dilap.geometry.vec3 import vec3
from dilap.geometry.quat import quat
import dilap.geometry.tools as gtl
#import dilap.mesh.tools as dtl
import dilap.core.plotting as dtl
import matplotlib.pyplot as plt
import unittest,numpy
#python3 -m unittest discover -v ./ "*tests.py"
class test_tools(unittest.TestCase):
... |
# -*- coding: utf-8 -*-
import pandas as pd
import scrapy
from scrapy import Request
from scrapy import Selector
from scrapy import signals
from fooltrader.contract.files_contract import get_kdata_path
from fooltrader.utils.utils import index_df_with_time, to_time_str, to_float
class Sp500Spider(scrapy.Spider):
... |
#! /usr/bin/env python
# coding:utf-8
"""
This module parses zones files which include A and PTR records.
:copyright: (c) 2015 by the KUSM Admin Team
:license: MIT, see LICENSE for more details.
"""
import re
from record import ARecord, PTRRecord, RecordInfo
try:
import ipaddress
except ImportError:
import ... |
import rnftools
from .Source import Source
import snakemake
import os
class MasonIllumina(Source):
"""Class for the Mason - Illumina mode (https://www.seqan.de/projects/mason/).
Single-end reads and pair-end reads simulations are supported. For pair-end simulations,
lengths of both ends must be equal.
Args... |
# light_grid=[[0 for x in range(1000)] for x in range(1000)]
def call_summation(light_grid):
light=sum(map(sum, light_grid))
print "part one=" ,light
def grid_operation(array, switch_state, light_grid):
for i in range(array[0], array[2]+1):
for j in range(array[1], array[3]+1):
if switch_state==1... |
import numpy as np
import sklearn.linear_model
import sklearn.tree
import Simulators, Logger, Evaluators, Semibandits, Metrics
import warnings
import argparse
import pickle
import sys
class RegretExp(object):
def __init__(self, weight=None, link="linear", K=10, L=5, T=1000, dataset="synth", feat_noise=0.25, reward... |
#!/usr/bin/env python
"""
Created on Mon 2 Dec 2013
Eksempelscript som viser hvordan en sinusboelge kan animeres med
funksjonsanimasjon.
@author Benedicte Emilie Braekken
"""
from numpy import *
from matplotlib.pyplot import *
from matplotlib import animation
def wave( x, t ):
'''
Funksjonen beskriver en sin... |
"""
Linear algebra
--------------
Linear equations
................
Basic linear algebra is implemented; you can for example solve the linear
equation system::
x + 2*y = -10
3*x + 4*y = 10
using ``lu_solve``::
>>> A = matrix([[1, 2], [3, 4]])
>>> b = matrix([-10, 10])
>>> x = lu_solve(A, b)
... |
# -*- coding: utf-8; Mode: python; tab-width: 4; indent-tabs-mode:nil; -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# Copyright (C) 2013-2016 Sébastien Buchoux <sebastien.buchoux@gmail.com>
#
# This file is part of FATSLiM.
#
# FATSLiM is free software: you can redistribute it and/or modify
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.