src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... |
from collections import namedtuple, OrderedDict
from django.conf import settings
from django.http import Http404
from django.template.response import TemplateResponse
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.shortcuts import get_object_or_404
from ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012-2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache Lic... |
""" reports.py
This file contains report definitions. A report definition is some kind
callable that should output data in whatever format. Once defined, it
should be added to the ALL_REPORTS dictionary, where the key is the
public name used to reference the report, like from the CLI.
Example definition:
def... |
import random
import pygame
BLACK = (0, 0, 0)
class Stars():
def __init__(self, background, width, height, max_stars):
self.background = background
self.width = width
self.height = height
self.total_stars = max_stars
self.positions = self.generate_positions()
def gene... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# mongo-conduction documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in t... |
# -*- coding: utf-8 -*-
"""
* Copyright (C) 2009, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
*
* Omikron 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... |
# Matthew Ryan Dillon
# github.com/thermokarst
#
# --- Day 20: Infinite Elves and Infinite Houses ---
#
# To keep the Elves busy, Santa has them deliver some presents by hand,
# door-to-door. He sends them down a street with infinite houses numbered
# sequentially: 1, 2, 3, 4, 5, and so on.
#
# Each Elf is assigned a n... |
# -*- coding: utf8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import AbstractUser
from django.db import models
from datetime import datetime
from utils.common_utils import *
# Create your models here.
class UserProfile(AbstractUser):
nickname = models.CharField(max_length=60, ve... |
"""
This module implements the XmlRpcRequest class which is a more convenient class
(that Request) to generate xml-rpc requests.
See documentation in docs/topics/request-response.rst
"""
import xmlrpclib
from ants.http.request import Request
from ants.utils.python import get_func_args
DUMPS_ARGS = get_func_args(xml... |
import time
import pytest
from aeon.measurement import Measurement
from aeon.errors import InvalidMeasurementState
def test_cant_start_measurement_twice():
m = Measurement("name", "group")
m.start()
with pytest.raises(InvalidMeasurementState):
m.start()
def test_cant_stop_measurement_before_star... |
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import processor
from datetime import datetime
def parse( url ):
r = requests.get( url )
if r.status_code == 404:
return processor.create_dictionary('', url, r.status_code, [u''], [u''], u'', u'', u'', u'', [u''], [u''])
r.encoding = 'UTF-8'... |
import numpy as np
import os.path as op
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_true, assert_false, assert_equal, assert_raises
import mne
from mne import io, Epochs, read_events, pick_types, create_info, EpochsArray
from mne.utils import _TempDir, run_test... |
import inspect
import warnings
import functools
import numpy as _np
import scipy as _sp
import time as _time
import copy
from collections import OrderedDict
from docrep import DocstringProcessor
class Docorator(DocstringProcessor):
__instance__ = None
def __new__(cls, *args, **kwargs):
if Docorator.... |
from flask import render_template, redirect, request, url_for, flash
from flask_login import login_user, logout_user, login_required, current_user
from . import auth
from .. import db
from ..models import User
from ..email import send_email
from .forms import LoginForm, RegistrationForm, ChangePasswordForm,\
Passwo... |
import config
import shutil
import jinja2
import markdown2 as markdown
import os.path
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name, TextLexer
import re
import yaml
POST_HEADER_SEP_RE = re.compile('^---$', re.MULTILINE)
DATE_FORMAT = '%Y-%m... |
# coding: utf8
import zeit.content.article.edit.browser.testing
class HTMLConvertTest(
zeit.content.article.edit.browser.testing.EditorTestCase):
def setUp(self):
super(HTMLConvertTest, self).setUp()
self.add_article()
def convert(self):
self.eval(
"window.zeit.co... |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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, modify,... |
import operator
from django.db.models.base import ModelBase
from enumfields import EnumField
from cvsslib.mixin import cvss_mixin_data, utils_mixin
from cvsslib.base_enum import NotDefined
class KeyedEnumField(EnumField):
"""
An enum field that stores the names of the values as strings, rather than the val... |
"""
Make label comparisons with Bensby et al. (2014).
"""
import numpy as np
import matplotlib.pyplot as plt
try:
bensby
except NameError: # Do you know who I am?
from rave_io import get_cannon_dr1, get_literature_bensby
rave_cannon_dr1 = get_cannon_dr1()
#OK = (data["SNRK"] > 10) * (data["R_CHI... |
import socket
from gabbletest import (
exec_test, elem, elem_iq, sync_stream, make_presence, send_error_reply,
make_result_iq, sync_stream)
from servicetest import (
EventPattern, call_async, assertEquals, assertLength,
assertDoesNotContain)
from caps_helper import send_disco_reply
from bytestream imp... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... |
# -*- coding: utf-8 -*-
#
# mrubook documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 3 14:17:42 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... |
# -*- coding: utf-8 -*-
'''
Creado por Pablo Castro
28/03/17
Objetivo:
Automatizar todo el proceso de simulacion desde el terminal de linux.
Funciona para CAEBAT 1.0
Como usarlo:
1- Se situa el script en la carpeta 'examples'.
2- Se crea una carpeta llamada 'Mis simulaciones' en el escritorio.
3- Se ejecuta... |
# Copyright (c) 2013-2014 Rackspace, 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 ... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Lithomop3d by Charles A. Williams
# Copyright (c) 2003-2005 Rensselaer Polytechnic Institute
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated... |
import sys
import pygame as pg
from states.splash_state import SplashScreen
from states.map_state import Map
from states.gameplay_state import GamePlay
from states.level_start_state import LevelOpening
from states.gameover_state import GameOver
class Game(object):
def __init__(self, screen, states, start_state):
... |
# Copyright (c) 2017-present, Facebook, 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... |
"""
Classes and functions used to visualize data for thermo scientific analyzers
"""
from pandas import Series, DataFrame
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import dates as d
import os
import math
import glob
import matplotlib
import warnings
i... |
"""
Computes the Lyman-alpha forest auto-correlation estimator.
The work is split between MPI nodes based on the first QSO in each possible pair.
Partial data is gathered and the correlation estimator file is saved after processing each sub-chunk.
"""
import cProfile
import itertools
import numpy as np
fro... |
# coding=utf-8
# Copyright (c) 2001-2016, 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 ope... |
#!/usr/bin/python
# coding: utf8
import os
from codecs import open
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def find_version(*file_paths):
# Open in Latin-1 so that we avoid encoding errors.
# Use codecs.open for Python 2 compatibility
here ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import codecs
import os
import os.path
import pytest
import stat
import subprocess
import sys
if sys.version_info.major == 2:
from StringIO import StringIO
else:
from io import StringIO
import x2y.options
import x2y.x2y
clas... |
import pytest
from mcwriter.exceptions import MissingFieldError, CleaningError
from mcwriter.cleaning import clean_and_validate_tags_data, _clean_tags_options
def test_cleaning_tags_minimal_example():
data = {
'name': 'My custom tag',
'list_id': 'abc01234',
'type': 'text',
}
expect... |
import numpy as np
import os
# APOGEE-APOKASC overlap
inputf = "/home/annaho/TheCannon/examples/example_apokasc/apokasc_DR12_overlap.npz"
apogee_apokasc = np.load(inputf)['arr_0']
# APOGEE-LAMOST overlap
inputf = "/home/annaho/TheCannon/examples/example_DR12/Data"
apogee_lamost = np.array(os.listdir(inputf))
# APO... |
# Copyright 2015 Isotoma Limited
#
# 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... |
from random import random, randint
import math
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
weightdomain = [(0, 20)] * 4
def wineprice(rating, age):
peak_age = rating - 50
price = float(rating) / 2
if age > peak_age:
price = price * (5 - (age - peak_age))
else... |
""" Abstractions for handling resources via Amazon Web Services (AWS) API
The intention of these utilities is to allow other infrastructure to
interact with AWS without having to understand AWS APIs. Additionally,
this module provides helper functions for the most common queries required
to manipulate and test a DC/OS... |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... |
import apgl
import numpy
import unittest
import numpy.testing as nptst
import scipy.sparse
from apgl.generator import ErdosRenyiGenerator
from wallhack.viroscopy.model.HIVGraph import HIVGraph
from wallhack.viroscopy.model.HIVVertices import HIVVertices
from wallhack.viroscopy.model.HIVGraphMetrics2 import HIVGraph... |
# -*- coding: UTF-8 -*-
from time import sleep
import logging
import serial
import sys
import binascii
from log import MainLogger
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = dict((value, key) for key, value in enums.iteritems())
enums['reverse_m... |
#!/usr/bin/env python
'''
File name: main_make_movie.py
Author: Guillaume Viejo
Date created: 09/10/2017
Python Version: 3.5.2
To make shank mapping
'''
import numpy as np
import pandas as pd
# from matplotlib.pyplot import plot,show,draw
import scipy.io
from functions import *
from pylab import *
from skle... |
import time
from pyzabbix import ZabbixAPI
from settings import ZabbixAPI_URL, ZabbixAPI_USER, ZabbixAPI_PASSWD
def getZabbixHistory(key, hostname, lastminutes):
zapi = ZabbixAPI(ZabbixAPI_URL, timeout=5)
zapi.login(ZabbixAPI_USER, ZabbixAPI_PASSWD)
hosts = zapi.host.get(filter={"host": hostname})
if... |
from . import *
class TestTimes(TestCase):
example_points = [float(x) for x in [-1, 0, 1, 2**32 - 1, 2**32 + 1]]
def test_cast_to_from_int(self):
x = Time(2.0)
y = float(x)
self.assertEqual(2.0, y)
def test_time_comparisons(self):
for x, y in itertools.permutations(self.... |
import numpy as np
from Analise.IAnalisador import IAnalisador
from Analise.entidades.formulario import Formulario
from Analise.entidades.variavel import Variavel
from Analise.entidades.questao import Questao
from Analise.entidades.relatorioResultado import RelatorioResultado
from Analise.entidades.constructo import C... |
import logging
log = logging.getLogger(__name__)
import requests
import requests.exceptions
import botologist.plugin
def _get_qlr_data(nick):
url = "http://www.qlranks.com/api.aspx"
response = requests.get(url, {"nick": nick}, timeout=4)
return response.json()["players"][0]
def _get_qlr_elo(nick, mod... |
import warnings
from django.forms import models as model_forms
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
from django.views.generic.base import TemplateResponseMixin, ContextMixin, View
from django.views.generic.deta... |
from devilry.apps.core.models import Assignment
from devilry.devilry_account.models import PeriodPermissionGroup
from devilry.devilry_admin.cradminextensions import devilry_crmenu_admin
from devilry.devilry_admin.views.assignment import overview
from devilry.devilry_admin.views.assignment.examiners import add_groups_to... |
import os.path as op
import shutil
from sfepy.base.base import *
from sfepy.homogenization.coefficients import Coefficients
from sfepy.homogenization.coefs_base import MiniAppBase
from sfepy.homogenization.engine import HomogenizationEngine
from sfepy.applications import SimpleApp
class Volume(MiniAppBase):
def ... |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 l... |
import xadmin
from models import *
class MenstruacaoAdmin(object):
list_display = Menstruacao._meta.get_all_field_names()
class AntecedenteAdmin(object):
list_display = Antecedente._meta.get_all_field_names()
class OutroAdmin(object):
list_display = Outro._meta.get_all_field_names()
class AtividadeA... |
# Copyright (c) 2020 PaddlePaddle 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 app... |
# coding: utf-8
# Raytheon BBN Technologies 2016
# Contributiors: Graham Rowlands
#
# This file contains the parameter descriptions
from qtpy.QtGui import *
from qtpy.QtCore import *
from qtpy.QtWidgets import *
import os
class Parameter(QGraphicsEllipseItem):
"""docstring for Parameter"""
def __init__(self,... |
import json
# Descarga esta librería con el comando 'pip install json2html'
from json2html import *
class Usuario(object):
#si ya tenemos definidos nuestros atributos no es necesario pedir con **args
def __init__(self, nombre,edad,direccion):
self.nombre = nombre
self.edad = edad
self.d... |
#!/usr/bin/env python3
# coding: utf-8
"""
These objects are going to filter the input data and only keep the interesting
attributes. Convert of capacity units may be occur to stay more consistent
between arrays.
"""
import abc
from collections import OrderedDict
class VMAXFilter(object, metaclass=abc.ABCMeta):
... |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'my_cache_table',
'TIMEOUT': 500000,
}
... |
# Author: Idan Gutman
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2013, 2014, 2015, 2016, 2019 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR 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 Soft... |
# encoding: utf8
from PySide.QtCore import Qt, QThread
from PySide.QtGui import QWidget, QApplication
import sys
from librtmp import RTMP, RTMPError
from res import (Ui_VideoWidget)
class StreamThread(QThread):
def __init__(self):
QThread.__init__(self)
def run(self):
try:
rtmp =... |
#
# Landau-Zener-Stuckelberg interferometry: steady state of repeated
# Landau-Zener like avoided-level crossing, as a function of driving amplitude
# and bias.
#
# Note: In order to get this example to work properly in the demos window,
# we have had to pass many more variables to parfor than is typically
# necessary.... |
import CatalogItem
from CatalogAccessoryItemGlobals import *
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from toontown.toon import ToonDNA
import random, types
from direct.showbase import PythonUtil
from direct.gui.DirectGui import *
from pandac.PandaModules import *
class C... |
import random
import sys
import numpy as np
SAMPLE_NUM = 10000
# For sparse data, it means how many non-zero features in one sample.
# The total possible feature num depends on your tag interval below.
FEATURE_NUM = 20
TAG_INTERVAL = (2019120799, 2019121299)
VALUE_INTERVAL = (0, 10000)
# SAVE_FILE_NAME = DATA_TYPE... |
#!/usr/bin/python3 -u
# using -u here to make stdin unbuffered
# This file is part of gen.sh.
#
# gen.sh 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) ... |
from datetime import datetime
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote
from google.appengine.ext import ndb
from google.appengine.api import memcache
from google.appengine.api import taskqueue
from models import BooleanMessage
from models import C... |
#!/usr/bin/python3
#Artifical load profile generator v1.1, generation of artificial load profiles to benchmark demand side management approaches
#Copyright (C) 2018 Gerwin Hoogsteen
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public Lic... |
#!/usr/bin/env python
import vtk
def main():
sphereSource1 = vtk.vtkSphereSource()
sphereSource1.Update()
delaunay1 = vtk.vtkDelaunay3D()
delaunay1.SetInputConnection(sphereSource1.GetOutputPort())
delaunay1.Update()
sphereSource2 = vtk.vtkSphereSource()
sphereSource2.SetCenter(5... |
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2014 vvovo.com
# Very way to victory.
# Let the dream set sail.
import time
from lib.query import Query
class FollowModel(Query):
def __init__(self, db):
self.db = db
self.table_name = "follow"
super(FollowModel, self).__init__()
def ... |
import subprocess
from functools import partial
from typing import Callable
from mozlog import get_default_logger
from wptserve.utils import isomorphic_decode
logger = None
def vcs(bin_name: str) -> Callable[..., None]:
def inner(command, *args, **kwargs):
global logger
if logger is None:
... |
import unittest
import colander
from webob.multidict import MultiDict
from webtest import TestApp
from pyramid import testing
from pyramid.httpexceptions import (
HTTPNotFound,
HTTPFound
)
from sqlalchemy import (
create_engine,
Column,
Integer,
String,
Table,
ForeignKey,
)
from sqlalch... |
"""
Economic utility functions
===============================================================================
Overview
-------------------------------------------------------------------------------
Functions in this module
-------------------------------------------------------------------------------
"""
from ... |
import os
import shutil
import git
from rosie.plugins import CreateGitBranch
from test.test_base import (
GitRepoTestCase,
JenkinsJobMock
)
class CreateGitBranchTest(GitRepoTestCase):
def setUp(self):
self.repo_dir = os.path.join(os.getcwd(), 'test/tmp')
self.jenkins_job = JenkinsJobMock... |
#! /usr/bin/env python
"""
Parse PER data from trace files.
Revision Info
=============
* $LastChangedBy: mandke $
* $LastChangedDate: 2011-10-19 15:19:51 -0500 (Wed, 19 Oct 2011) $
* $LastChangedRevision: 5216 $
:author: Ketan Mandke <kmandke@mail.utexas.edu>
:copyright:
Copyright 2009-2011 The University of ... |
#!/usr/bin/env python
# test.py module
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Thi Thuy-Duc Dao (daodt1@bfh.ch), Sven Osterwalder (ostes2@bfh.ch)
#
# 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... |
# Copyright 2011 Kalamazoo College Computer Science Club
# <kzoo-cs-board@googlegroups.com>
# This file is part of LitHub.
#
# LitHub 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 v... |
def _try_composite(a, d, n, s):
if pow(a, d, n) == 1:
return False
for i in range(s):
if pow(a, 2**i * d, n) == n-1:
return False
return True # n is definitely composite
def is_prime(n, _precision_for_huge_n=16):
if n in _known_primes or n in (0, 1):
return True
... |
#!/usr/bin/env python
# Very humble calculator, written as "Web Desktop Application"
__author__ = "Miki Tebeka <miki@mikitebeka.com>"
from __future__ import division
from math import *
from operator import isNumberType
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from u... |
from optparse import make_option
import os
from django.core.management.base import BaseCommand, CommandError
from nornir_imageregistration import core
from nornir_imageregistration.spatial import *
import nornir_djangomodel.import_xml as import_xml
from nornir_shared.argparse_helpers import NumberList
from nornir_we... |
"""
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see:
http... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2017 Samuele Carcagno <sam.carcagno@gmail.com>
# This file is part of pysoundanalyser
# pysoundanalyser 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 Foundatio... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 15:43:55 2015
@author: Ben
"""
import clearplot.plot_functions as pf
import matplotlib.pyplot
import os
import numpy as np
#Load global response
data_dir = os.path.join(os.path.dirname(pf.__file__), os.pardir, 'doc', \
'source', 'data')
path = os.path.join(data_di... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import plot, show, xticks, xlabel, ylabel, legend, yscale, title, savefig, rcParams, figure, hist, text, bar, subplots
import Image
def variance_f(sigma):
x=[1.0/sigma.shape[0]]*sigma.shape[0]
return 1.0/((np.matrix(x)*sigma*np.matrix(x)... |
# COPYRIGHT (C) 2020-2021 Nicotine+ Team
# COPYRIGHT (C) 2009 Daelstorm <daelstorm@gmail.com>
# COPYRIGHT (C) 2008 Quinox <quinox@users.sf.net>
#
# GNU GENERAL PUBLIC LICENSE
# Version 3, 29 June 2007
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pub... |
# coding: utf-8
"""
MIT License
Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49)
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 limit... |
# Copyright (C) 2010-2017 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... |
import pytz
from . import helpers
import dateutil.parser
from datetime import datetime, date
class Model(object):
_accessors = {}
_default_type = "anything"
def __init__(self, **kwargs):
self._dynamic_accessors = []
if kwargs:
self.__class__.mass_assign(self, kwargs)
@clas... |
from intern.remote.boss import BossRemote
from intern.resource.boss.resource import *
import numpy as np
from requests import HTTPError
rmt = BossRemote('neurodata.cfg')
xmax = 8
ymax = 4
zmax = 5
tmax = 10
COLL_NAME = 'gray'
EXP_NAME = 'timeseries_test'
CHAN_NAME = 'Ch1'
COORD_FRAME = COLL_NAME + '_' + EXP_NAME
c... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... |
"""
File: teststudent.py
Unit test suite for the Student class.
"""
from student import Student
import unittest
class TestStudent(unittest.TestCase):
"""Defines a unit test suite for the Student class."""
def setUp(self):
"""Sets up the test fixture. Scores are 1-5."""
self._student = Student... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
from future.utils import iteritems
from collections import defaultdict
from copy import deepcopy
from itertools import product
import re
from sqlal... |
# -*- coding: utf-8 -*-
# Dioptas - GUI program for fast processing of 2D X-ray diffraction data
# Principal author: Clemens Prescher (clemens.prescher@gmail.com)
# Copyright (C) 2014-2019 GSECARS, University of Chicago, USA
# Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany
... |
#!usr/bin/env python
#encoding: utf-8
import config as cfg
import os,sys
from multiprocessing import Pool
from time import time,clock
from subprocess import call,PIPE,Popen
from externals.simple_oss import SimpleOss
__author__="luzhijun"
OSS_HOST = os.environ.get('ALI_DIKU_OSS_HOST')
oss_clnt = SimpleOss(OSS_HOST, cf... |
from pprint import pprint
from traceback import format_exc
from time import strftime
from tastypie.constants import ALL
from tastypie.resources import ModelResource
from tastypie.authorization import Authorization
from tastypie.authentication import ApiKeyAuthentication
from django.contrib.auth.models import User
from... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from hipster_api import fields
class FiledJsonTestCase(TestCase):
def get_value(self, obj):
obj.to_python()
obj.to_rules(None)
return obj.value
def test_field(self):
obj = fields.JsonField(default={})
self.asse... |
from j25.web import Controller
import inspect
import logging
import pkgutil
import traceback
logger = logging.getLogger("ControllerLoader")
class AutoControllerLoader(object):
@classmethod
def load(cls, app_name, router, dispatcher, package_or_packages):
if not isinstance(package_or_packages, list):
... |
'''
Created on 2014-03-19
some useful functions to make map and surface plots that take advantage of variable meta data
@author: Andre R. Erler, GPL v3
'''
# external imports
import matplotlib.pylab as pyl
import matplotlib as mpl
#from mpl_toolkits.axes_grid1 import ImageGrid
linewidth = .75
mpl.rc('li... |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import absolute_import, division, print_function
import os
import six
import pytest
from foreman.client import Foreman, Resource, requests
from .mocks import SessionMock
URL = 'foreman.example.com'
class HasConflictingMethods(Exception):
def __init__(se... |
# coding: utf-8
import copy
import sys
import json
from datetime import timedelta
from django.utils import timezone
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models import Q, Max
from django.utils.translation import ugettext_lazy as _
from... |
from GEMEditor.rw.units import add_unit_definitions
from lxml.etree import Element
from GEMEditor.rw import *
class TestAddUnitsDefinition:
def test_node_addition(self):
root = Element("root")
add_unit_definitions(root)
list_of_unitdefinitions_node = root.find(sbml3_listOfUnitDefinitions... |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2006 Lukáš Lalinský
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.