text stringlengths 12 6.59M |
|---|
#!/usr/local/bin/python -t
# $Id$
# A pipe-based interface to the gnuplot plotting program.
# Written by Michael Haggerty <mhagger@blizzard.harvard.edu>.
# Inspired by and partly derived from an earlier version by Konrad
# Hinsen <hinsen@ibs.ibs.fr>.
# For information about how to use this module, see the documentat... |
# -*- coding: utf-8 -*-
import pytest
import sys
import cPickle as pickle
from test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
from aerospike.exception import *
except:
print "Please install aerospike python client."
sys.exit(1)
from aerospike import predicates as p... |
import random
import markovify
import sys, os
HERE = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(HERE, "texts/sherlock.txt")) as f:
sherlock = f.read()
def test_text_too_small():
text = u"Example phrase. This is another example sentence."
text_model = markovify.Text(text)
assert... |
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger
import requests
__author__ = 'tjoen'
# Logger: used for debug lines, like "LOGGER.debug(xyz)". These
# statements will show up in the command line when running Mycroft.
LOGGER = getLogger(__name_... |
# encoding=utf-8
from dperrors import DanmicholoParseError
from parser import *
from templateeditor import TemplateEditor
from maintext import MainText, condition_for_soup
|
import os
import py.test
from tiddlyweb.config import config
from tiddlyweb.store import Store, NoBagError, NoUserError, NoRecipeError, NoTiddlerError
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.policy import Policy
from tiddlyweb.model.recipe import Recipe
from tiddlyweb.model.tiddler import Tiddler
f... |
import SCons.Builder
import SCons.Scanner
import SCons.Util
import os
from itertools import izip
# TODO: write tests
def _ad_scanner(node, env, path):
"""Scans AsciiDoc files for include::[] directives"""
import re
fname = str(node)
if not os.path.isfile(fname):
return []
reg = re.comp... |
# -*- coding: utf-8 -*-
from hyper.http20.frame import (
Frame, DataFrame, PriorityFrame, RstStreamFrame, SettingsFrame,
PushPromiseFrame, PingFrame, GoAwayFrame, WindowUpdateFrame, HeadersFrame,
ContinuationFrame, AltSvcFrame, Origin, BlockedFrame,
)
from hyper.http20.hpack import Encoder, Decoder, encode_... |
# Copyright 2013 Hansel Dunlop
# All rights reserved
#
# Author: Hansel Dunlop - hansel@interpretthis.org
#
from datetime import datetime
import locale
from django.core.mail import EmailMultiAlternatives
from django.template import Context
from django.template.loader import get_template
from django.utils.timezone imp... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lic... |
"""Unit tests for the WaveNet that check that it can train on audio data."""
import json
import numpy as np
import sys
import tensorflow as tf
# import matplotlib.pyplot as plt
# import librosa
import random
from wavenet import (WaveNetModel, time_to_batch, batch_to_time, causal_conv,
optimizer_... |
from __future__ import print_function
import os, json
from flask import Flask, render_template, request, redirect, url_for, send_from_directory, make_response
from werkzeug import secure_filename
from app.rxparse import update_rx
UPLOAD_FOLDER = 'app/input'
OUTPUT_FOLDER = 'app/output'
ALLOWED_EXTENSIONS = set(['txt',... |
import frappe
def set_default_role(doc, method):
'''Set customer, supplier, student based on email'''
if frappe.flags.setting_role or frappe.flags.in_migrate:
return
roles = frappe.get_roles(doc.name)
contact_name = frappe.get_value('Contact', dict(email_id=doc.email))
if contact_name:
contact = frappe.get_... |
# coding: utf-8
import os, sys
sys.path.append(os.path.join(sys.path[0], '..'))
from carlo import Model, ModelException
import pytest
def test_minimal_model():
m = Model(('const', {'int': lambda: 42})).build()
assert [('const', {'int': 42})] == m.create()
m = Model(('const2', {'str': lambda: 'hello'})).bu... |
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This pr... |
import os
import sys
from methods import detect_darwin_sdk_path
def is_active():
return True
def get_name():
return "iOS"
def can_build():
if sys.platform == "darwin" or ("OSXCROSS_IOS" in os.environ):
return True
return False
def get_opts():
from SCons.Variables import BoolVariable... |
import unittest
from psqlparse import parse
from psqlparse.exceptions import PSqlParseError
from psqlparse import nodes
class SelectQueriesTest(unittest.TestCase):
def test_select_all_no_where(self):
query = "SELECT * FROM my_table"
stmt = parse(query).pop()
self.assertIsInstance(stmt, n... |
"""
pyNRC - Python ETC and Simulator for JWST NIRCam
----------------------------------------------------------------------------
pyNRC contains a number of tools for planning observations with JWST NIRCam,
such as an ETC and simple image simulator. pyNRC is instended to work for
all NIRCam observing modes including ... |
""" shrunk - Rutgers University URL Shortener
Unit tests for roles system.
"""
from pytest import raises
from shrunk.client import ShrunkClient
from shrunk.roles import *
client = ShrunkClient(host='unit_db')
mongo_client = client._mongo
init(None, mongo_client=mongo_client)
def teardown_function():
mongo_c... |
# -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2015 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... |
""" Lots of functions for drawing and plotting visiony things """
# TODO: New naming scheme
# viz_<funcname> will clear everything. The current axes and fig: clf, cla. # Will add annotations
# interact_<funcname> will clear everything and start user interactions.
# show_<funcname> will always clear the current axes, b... |
from __future__ import print_function
from os.path import dirname, abspath
from subprocess import check_output
import json
import os
import requests
DATADIR = dirname(abspath(__file__)) + "/testdata/"
DEBUG = os.environ.get('DEBUG' , 0)
PORT = os.environ.get('SHOCK_PORT' , "7445")
URL = os.environ.get('SHOCK_HOST' ,... |
import collections
import signal
import traceback
from twisted.internet import task
# These values are seconds
CANCEL_INTERVAL = 0.1
MAX_DELAY = 0.5
class HangWatcher(object):
bad_functions = collections.defaultdict(int)
hang_count = 0
def __init__(self, cancel_interval=CANCEL_INTERVAL, max_delay=MAX_D... |
# -*- coding: utf-8 -*-
"""
Helpers for graph plotting
References:
http://www.graphviz.org/content/attrs
http://www.graphviz.org/doc/info/attrs.html
Ignore:
http://www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.38.msi
pip uninstall pydot
pip uninstall pyparsing
pip install -Iv https:/... |
import grumpy
from grumpy import BBTree, gexf_installed, baktree
import Polyhedron2D
from Polyhedron2D import Polyhedron2D
|
import unittest
import tempfile
import os
from gimmemotifs.tools import __tools__, get_tool
from gimmemotifs.comparison import MotifComparer
from gimmemotifs.motif import motif_from_consensus
class TestMotifProgram(unittest.TestCase):
""" A test class for motifprograms """
def setUp(self):
self.data_d... |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyr... |
# __all__ = something
import models
import basic.distributions as distributions
from internals.states import use_eigen # TODO get rid of use_eigen
import plugins
|
import pytest
import numpy as np
import os
import sys
import tempfile
import torch
import torchvision.utils as utils
import unittest
from io import BytesIO
import torchvision.transforms.functional as F
from PIL import Image, __version__ as PILLOW_VERSION, ImageColor
from _assert_utils import assert_equal
PILLOW_VERSI... |
try:
import readline
except ImportError:
readline = False
from jedi import utils
from .helpers import unittest, cwd_at
@unittest.skipIf(not readline, "readline not found")
class TestSetupReadline(unittest.TestCase):
class NameSpace(object):
pass
def __init__(self, *args, **kwargs):
... |
# This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
"""
Classes for describing styled text:
* :class:`Single... |
bl_info = {
"name": "Sprytile Painter",
"author": "Jeiel Aranal",
"version": (0, 4, 32),
"blender": (2, 7, 7),
"description": "A utility for creating tile based low spec scenes with paint/map editor tools",
"location": "View3D > UI panel > Sprytile",
"wiki_url": "https://chemikhazi.github.io... |
import os
import subprocess as sp
import pytest
import yaml
import tempfile
import requests
import uuid
import contextlib
import tarfile
from bioconda_utils import utils
from bioconda_utils import pkg_test
from bioconda_utils import docker_utils
from bioconda_utils import cli
from bioconda_utils import build
from bioc... |
import json
import os
import re
import levlib
import glob
import fnmatch
import subprocess
# configuration
tvPath = ""
moviesPath = ""
downloadsPath = ""
processedList = False
mode = ""
#constants
bigFile = 104857600 # 100MB
# data
videoExtensions = ["mkv", "avi", "mp4", "m4v", "mov"]
subtitlesExtensions = ["srt", ... |
#!/usr/bin/env python
###
# Copyright (c) 2002, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... |
# -*- coding: utf-8 -*-
# Django settings for sandbox project.
import os, sys
from django.core.urlresolvers import reverse_lazy, reverse
import environ
# set default values and casting
env = environ.Env(DEBUG=(bool, False),
CELERY_ALWAYS_EAGER=(bool, False),
)
# Django settings f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*
from flask import Flask, render_template, send_from_directory
from flask import MySQL
from mysecret import DATABASE_USER, DATABASE_PASS, DATABASE_HOST
from werkzeug import generate_password_hash, check_password_hash
app = Flask(__name__)
@app.route('/')
def homepage():
... |
#!/usr/bin/env python
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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 req... |
#
#
import sys
import unittest
import tempfile
import os
import errno
import xattr
from xattr import NS_USER, XATTR_CREATE, XATTR_REPLACE
NAMESPACE = os.environ.get("NAMESPACE", NS_USER)
if sys.hexversion >= 0x03000000:
PY3K = True
EMPTY_NS = bytes()
else:
PY3K = False
EMPTY_NS = ''
TEST_DIR = os.e... |
"""distutils
The main package for the Python Module Distribution Utilities. Normally
used from a setup script as
from distutils.core import setup
setup (...)
"""
# Distutils version
#
# Updated automatically by the Python release process.
#
#--start constants--
__version__ = "3.4.0a0"
#--end constants--
|
# stdlib imports
import argparse
import bz2
import datetime
import io
import re
import sys
# local module imports
import machine_gui
import enigma.machine
import rotors
def _serialize_plugboard(stack):
"""Serialize a plugboard stack back into character pairings"""
pairs = []
for i in range(26):
i... |
#!/usr/bin/env python
# coding=utf-8
import codecs
import locale
import os
import signal
import sys
import time
import click
if codecs.lookup(locale.getpreferredencoding()).name == 'ascii':
os.environ['LANG'] = 'en_US.utf-8'
from dots.interpreter import AsciiDotsInterpreter
from dots.callbacks import IOCallback... |
# Copyright (c) 2013 Jesse Keating <jesse.keating@rackspace.com>
# 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/LIC... |
#!/usr/bin/env python
import sys
from twisted.internet.endpoints import TCP4ServerEndpoint
from twisted.internet import reactor
import editorFactory
def onErr(err):
print 'AVENGE MEEEEEEEEE!'
sys.exit(1)
if __name__ == "__main__":
server = editorFactory.EditorFactory()
endpoint = TCP4ServerEndpoint(reac... |
#/usr/bin/env python2
import web
import log
import ConfigParser
_log = log.TrivialLogger()
_config_file_list = ['./jim.cfg', '/etc/jim.cfg']
_config_file_parser = ConfigParser.RawConfigParser()
_config_ok = True
try:
_config_file_list = _config_file_parser.read(_config_file_list)
except:
_log.error("cannot pa... |
# Copyright (c) 2013 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#!/usr/bin/env python
# # -*- coding: utf-8 -*-
"""
title : __main__.py
description : entry point for core sifra component
usage : python sifra [OPTIONS]
-f Display this usage message
-l [LEVEL] Choose logging level DEBUG, INFO, ... |
#!/usr/bin/env python3
# Run script for CrabBot
# A mess of config args and terminal polling code
#
# See -h or read the argparse setup for argument details
import argparse
import datetime
import logging
import os
import readline # Only for better terminal input support, eg. history. Does not work on Windows, but doe... |
# Built-in modules #
# Internal modules #
# Third party modules #
import pandas, numpy
from six import StringIO
################################################################################
def r_matrix_to_dataframe(matrix):
cols = list(matrix.colnames)
rows = list(matrix.rownames)
return pandas.DataF... |
#!/usr/bin/env python
from time import sleep
from decimal import Decimal
import signal
import sys
def signal_handler(signal, frame):
# print('You pressed Ctrl+C!')
exit_progam(0)
signal.signal(signal.SIGINT, signal_handler)
# print('Press Ctrl+C')
# signal.pause()
import sys
import json
from iterto... |
from __future__ import with_statement
import errno
import six
from plumbum.path import Path, FSUser
from plumbum.lib import _setdoc
class RemotePath(Path):
"""The class implementing remote-machine paths"""
__slots__ = ["_path", "remote"]
def __init__(self, remote, *parts):
self.remote = remote
... |
from ui.stroke import Stroke
from threading import Lock
from PyQt4 import QtCore, QtGui
from dp.src.utils.log import Log
import copy
from dp.src.protocol.OperationEngine import OperationEngine
class PeerState(QtCore.QObject):
"""Stores all data concerning a peer's state
Contains:
- list of other peer... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2003-2008 Ulrich von Zadow
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# versi... |
import pymongo
import warnings
from ..utils import current_time
from datetime import date, datetime
from bson import json_util
import json
import gzip
from astropy import units as u
from astropy.utils import console
class PanMongo(object):
""" Connection to the running MongoDB instance
This is a collectio... |
import pymongo
import warnings
from ..utils import current_time
from datetime import date, datetime
from bson import json_util
import json
import gzip
from astropy import units as u
from astropy.utils import console
class PanMongo(object):
""" Connection to the running MongoDB instance
This is a collectio... |
from django.db import models
TALK_STATUS_CHOICES = (
('S', 'Submitted'),
('A', 'Approved'),
('R', 'Rejected'),
('C', 'Confirmed'),
)
class Talk(models.Model):
speaker_name = models.CharField(max_length=1000)
speaker_email = models.CharField(max_length=1000)
title = models.CharField(max_l... |
from __future__ import with_statement
import datetime
import fiscalyear
import pytest
# Fiscal calendars to test
US_FEDERAL = ('previous', 10, 1)
UK_PERSONAL = ('same', 4, 6)
class TestCheckInt(object):
@pytest.mark.parametrize('value, exception', [
('asdf', TypeError),
('-999', TypeError),
... |
import string
import scipy
from nose.tools import assert_equal
from .meta_graph import convert_to_meta_graph, convert_to_original_graph
from .enron_graph import EnronUtil
from .test_util import load_meta_graph_necessities
def get_example():
A, B, C, D, E, F, G = string.ascii_uppercase[:7]
interactions = [
... |
#!/usr/bin/python
from vm import VM
from vmhost import VMhost
def case_simple_swap():
host1 = VMhost('host1', 'x86_64', 4096)
host2 = VMhost('host2', 'x86_64', 4096)
vm1 = VM('vm1', 'x86_64', 256)
vm2 = VM('vm2', 'x86_64', 256)
stateA = {
'host1' : [ vm1 ],
'host2' : [ vm2 ],
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2011 Umeå University
#
# 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... |
# See the LICENSE file for licensing information
'''The bot itself.'''
import re
from time import sleep
from . import tubes
from . import sed
class Queue:
size = 0
data = []
head = 0
tail = 0
count = 0
def __init__(self, size):
self.size = size
self.data = [None]*size
def... |
#!/usr/bin/python
#
# python-v4l2capture
#
# This file is an example on how to capture a picture with
# python-v4l2capture.
#
# 2009, 2010 Fredrik Portstrom
#
# I, the copyright holder of this file, hereby release it into the
# public domain. This applies worldwide. In case this is not legally
# possible: I grant anyon... |
# setup_tool.py 28/05/2016 D.J.Whale
#
# A simple menu-driven setup tool for the Energenie Python library.
#
# Just be a simple menu system.
# This then means you don't have to have all this in the demo apps
# and the demo apps can just refer to object variables names
# from an assumed auto_create registry, tha... |
import os
import sys
import json
import time
import logging
try:
from functools import reduce
except ImportError:
pass
try:
import urllib.request as urllib2
except ImportError:
import urllib2
log = logging.getLogger("travis.leader")
log.addHandler(logging.StreamHandler())
log.setLevel(logging.INFO)
... |
"""
Watstock's market prediction neural network.
"""
from __future__ import print_function
import time
import os
import numpy as np
import pandas as pd
import math
import json
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers import GRU
from keras.layer... |
import bpy
import math
import mathutils
import json
import re
import os
from bpy_extras.io_utils import ExportHelper
bl_info = {
"name": "tray_rust export",
"author": "Will Usher",
"blender": (2, 7, 8),
"version": (0, 0, 10),
"location": "File > Import-Export",
"description": "Export the scene ... |
from json import load
from urllib2 import urlopen
from urllib import urlencode
from pandas import DataFrame
def query(sql, format='df'):
'''
Submit an `sql` query (string) to treasury.io and return a pandas DataFrame.
For example::
print('Operating cash balances for May 22, 2013')
print(... |
# -*- coding: utf-8 -*-
"""
treebeard.models
----------------
Django models.
:copyright: 2008-2010 by Gustavo Picon
:license: Apache License 2.0
"""
import operator
from django.db.models import Q
from django.db import models, transaction
from treebeard.exceptions import InvalidPosition, Missi... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import logging
from abc import ABCMeta
from abc import abstractmethod
import numpy as np
from scipy.special import gammaln
from six import add_metaclass
from six.moves import range
from treec... |
from rest_framework import serializers
from bluebottle.funding.base_serializers import PaymentSerializer, BaseBankAccountSerializer
from bluebottle.funding_flutterwave.models import FlutterwavePayment, FlutterwaveBankAccount
class FlutterwavePaymentSerializer(PaymentSerializer):
class Meta(PaymentSerializer.Met... |
from __future__ import print_function, division
import time
import config as ttconf
from Bio import Phylo
from Bio import AlignIO
import numpy as np
from gtr import GTR
import seq_utils
from version import tt_version as __version__
try:
from itertools import izip
except ImportError: #python3.x
izip = zip
min_... |
__version__ = (1, 5, 2, 'b1')
full_version = '.'.join(str(x) for x in __version__[0:3]) + \
''.join(__version__[3:])
release = full_version
short_version = '.'.join(str(x) for x in __version__[0:3])
|
import logging
import os
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log = logging.getLogger('watchcat')
log.setLevel(logging.DEBUG)
DIR = os.path.dirname(os.path.realpath(__file__))
# https://github.com/openstack-infra/project-config/blob/master/
# gerritbot/channels.yaml
... |
from django.conf.urls import patterns, include, url
user_match = "[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*"
urlpatterns = patterns('',
url(r'^$', 'troposphere.views.root'),
url(r'^application/emulate/(?P<username>(%s))[/]?$' % user_match, 'troposphere.views.emulate',
name='emulate-user'),
url(r'^applica... |
# No shebang line, this module is meant to be imported
#
# This file is part of PyFarm.
# Copyright (C) 2008-2012 Oliver Palmer
#
# PyFarm is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version ... |
# Copyright (c) 2017 Sony 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 by applicabl... |
from django.contrib.gis.db import models
import os
from madrona.common.utils import cachemethod
from django.conf import settings
class AppConfig(models.Model):
app = models.CharField(verbose_name="App name", max_length=35, unique=True)
desc = models.TextField(verbose_name="Description")
studyregion = model... |
# -*- coding: utf-8 -*-
import logging
from copy import copy
from django.core.exceptions import PermissionDenied
from django.template.defaultfilters import slugify
from filebrowser.base import FileObject
from filebrowser.settings import VERSIONS
from tastypie import fields
from tastypie.authorization import Authoriza... |
#!/usr/bin/python
import fileinput
import string
import sys
import os
import subprocess
def perm(l):
sz = len(l)
if sz <= 1:
return [l]
return [p[:i]+[l[0]]+p[i:] for i in xrange(sz) for p in perm(l[1:])]
def generate_permutation_list(Debug):
#indices = ['4','3','2','1']
indices = ['1','... |
import datetime
import importlib
import os
import sys
import click
import jinja2
import markdown
import yaml
from docutils.core import publish_parts
from utilkit import datetimeutil, fileutil
def include_type_exists(key):
"""
Check whether the include type (plugin) is valid/exists.
Needs a file of the fo... |
# -*- coding: utf-8 -*-
#
# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from catalogue.models import User
from django.db.models import Count
from django import forms
from django.utils.translation import ugettex... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# A min heap
# christoph durr et jill-jenn vie - 2015
# snip{
class OurHeap:
""" min heap
* heap: is the actual heap, heap[1] = index of the smallest element
* rank: inverse of heap with rank[x]=i iff heap[i]=x
* n: size of the heap
:complexity: ini... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Classes and functions to simulate an Ornstein-Uhlenbeck process for the instantaneous growth rate
See also
--------
:mod:`tunacell.simu.base` for base classes to parameterize numerical simulations
"""
from __future__ import print_function
from builtins import input #... |
from babel.dates import format_date
from babel.numbers import format_currency
from django.contrib.sites.models import Site
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import Context
from django.utils.translation import ugettext_lazy as _
from ... |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
import re
from django.conf import settings
from django.core import urlresolvers
import localeurl.settings
SUPPORTED_LOCALES = dict(settings.LANGUAGES)
LOCALES_RE = '|'.join(SUPPORTED_LOCALES)
PATH_RE = re.compile(r'^/(?P... |
#
# Copyright (C) 2016 Dr. Maha Farhat
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is d... |
# Django settings for apps project.
from os.path import abspath, dirname, basename
FN_CREDENTIALS = "settings_credentials.py"
def msg_credentials():
msg = "*** Please edit the %s file with the required settings for authentication. ***" %(FN_CREDENTIALS, )
stars = "*" * len(msg)
return "\n\n%s\n%s\n%s\n\... |
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
import os, datetime
from apps.people.models import Member
class Area(models.Model):
title = models.CharField(max_length=100)
content = models.TextField(null=True, blank=True)
class Meta:
verbose_name = "Area"
... |
# coding: utf-8
# Copyright 2009-2014 The txmongo authors. All rights reserved.
# Use of this source code is governed by the Apache License that can be
# found in the LICENSE file.
"""
Low level connection to Mongo.
This module contains the wire protocol implementation for txmongo.
The various constants from the pro... |
import django_filters
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from adhocracy4.filters import views as filter_views
from adhocracy4.filters.filters import DefaultsFilterSet
from adhocracy4.modules import views as module_views
f... |
from datetime import datetime, timedelta
import struct
fit_file_id = {
'type': 0,
'serial': 3,
'manufacturer': 1,
'time_created': 3,
'product': 2,
'number': 5}
fit_record = {
'timestamp': 253,
'lat': 0,
'lon': 1,
'dist': 5,
'time_from_course': 11,
'speed_distance': 8,
... |
import sys
import numpy as np
import pandas
BENPUF = False # set temporarily to True to generated benpuf.csv file
# BENPUF = False will generate puf.csv file without any benefits variables
def main():
"""
Contains all the logic of the puf_data/finalprep.py script.
"""
# (*) Read unprocessed input f... |
#!/usr/bin/env python
# $1 is the path to the directory to sync
# $2 is the name of the remote container to use
# If the environment variable PUSH_NO_CHECKSUM is set, then checksum
# verification is skipped
import datetime
import json
import os
import re
import sys
import time
import sys
sys.path.append('/data/src/... |
"""
io routines for sky
"""
import os
from astropy.io import fits
def write_sky(outfile,head,skyflux,skyivar,skymask,cskyflux,cskyivar,wave) :
"""
write fiberflat
"""
hdr = head
hdr['EXTNAME'] = ('SKY', 'no dimension')
fits.writeto(outfile,skyflux,header=hdr, clobber=True)
hdr['EXTNA... |
"""Plan future DESI observations.
"""
from __future__ import print_function, division
import numpy as np
import astropy.table
import astropy.units as u
import desiutil.log
import desimodel.io
import desisurvey.utils
def create(hourangles, priorities):
"""Create a new plan for the start of the survey.
Pa... |
"""
desitarget.cuts
===============
Target Selection for DECALS catalogue data derived from `the wiki`_.
A collection of helpful (static) methods to check whether an object's
flux passes a given selection criterion (*e.g.* LRG, ELG or QSO).
.. _`the Gaia data model`: https://gea.esac.esa.int/archive/documentation/GD... |
__version__ = '0.1.3-alpha'
class UbidotsLibraryError (Exception):
pass
def check_requests_version():
minimum_requests_version = '1.2.3'
try:
import requests
except:
raise UbidotsLibraryError("""requests Library is not installed, please install it
with pip install requests or better yet install ubidots... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
========
mocks.io
========
Makes mock target catalogs
"""
from __future__ import (absolute_import, division)
#
import numpy as np
import fitsio
import os, re
from . import __version__ as desitarget_version
from . import gitvers... |
# from distutils.core import setup
# setup(
# name = 'mouse_droid',
# packages = ['mouse_droid'], # this must be the same as the name above
# version = '0.1',
# description = 'mouse droid package',
# author = 'Karan Grover',
# author_email = 'krngrvr09@gmail.com',
# url = 'https://github.com/krngrvr09/Mou... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# pyAggr3g470r - A Web based news aggregator.
# Copyright (C) 2010-2014 Cédric Bonhomme - http://cedricbonhomme.org/
#
# For more information : https://bitbucket.org/cedricbonhomme/pyaggr3g470r/
#
# This program is free software: you can redistribute it and/or modify
# i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.