src stringlengths 721 1.04M |
|---|
# -*- coding: utf8 -*-
from __future__ import unicode_literals
from pyramid.config import Configurator
from pyramid.compat import (
ascii_native_,
string_types
)
import json
from webtest import TestApp
import unittest
from .fixtures.data import (
trees
)
def skosmain(global_config, **settings):
... |
from galaxy_analysis.plot.plot_styles import *
import matplotlib.pyplot as plt
import glob
import deepdish as dd
import yt
from galaxy_analysis.utilities import utilities
import numpy as np
from matplotlib.ticker import NullFormatter
from galaxy_analysis.particle_analysis.abundances import single_MDF
#
from galaxy_anal... |
import numbers
from collections import OrderedDict, namedtuple
from .compatibility import my_basestring
from .exceptions import JSONConfigException
_undefined = object()
class JSONConfigQueryError(JSONConfigException):
"""
The base class of every exceptions thrown by this library during config queries.
... |
"""A set of helper functions for TensorFlow."""
from typing import Callable, Iterable, List, Optional, Tuple, Union
import numpy as np
import tensorflow as tf
from neuralmonkey.logging import debug, debug_enabled
# pylint: disable=invalid-name
ShapeSpec = List[int]
# pylint: enable=invalid-name
def _get_current_exp... |
from knuth_bendix import knuthBendix, RewriteRuleset, shortLex
def vdRule(n, m, k=2):
"""Create initial ruleset for von Dyck group with inverse elements
https://en.wikipedia.org/wiki/Triangle_group#von_Dyck_groups
"""
return RewriteRuleset({
tuple('aA'): (),
tuple('Aa'): (),
tup... |
"""Standardize a list of addresses using the USPS API.
Multi-threaded, since the API response time is slow.
Get an API key at https://registration.shippingapis.com.
"""
from __future__ import print_function
import threading
import sys
import pandas as pd
from tqdm import tqdm
from collections import deque
from pyusp... |
import os, re, shutil, subprocess, datetime, socket
ba = '/groups/sciserv/flyolympiad/vnc_align/toolkit/JBA/brainaligner'
cmtkdir = '/usr/local/cmtk/bin/'
fiji = '/usr/local/Fiji/ImageJ-linux64'
Rawconv = '~/script/raw2nrrdCrop.ijm'
Nrrdconv = '~/script/nrrd2rawUncrop.ijm'
Tfile = '~/template/flyVNCtemp... |
#!/usr/bin/env python
"""
concatenate the input fits files to one output.
Useful to merge the output of several runs (f.e. hillas.fits from pipeline.py)
Usage:
digicam-concatenate <OUTPUT> <INPUTS>...
Options:
-h --help Show this screen.
"""
from astropy.table import Table, vstack
from docopt i... |
from flask import Flask, g
from flask_mail import Mail
from urllib.parse import urlparse
from redis import Redis
from redis.sentinel import Sentinel
app = Flask(__name__)
import websmash.default_settings
app.config.from_object(websmash.default_settings)
app.config.from_envvar('WEBSMASH_CONFIG', silent=True)
mail = Ma... |
from random import SystemRandom
from string import ascii_letters, digits
from os.path import exists, join, basename
from tarfile import open as taropen
from qiita_db.sql_connection import TRN
from qiita_db.artifact import Artifact
from qiita_db.util import (insert_filepaths, convert_to_id, get_mountpoint,
... |
import re
from django.core.urlresolvers import reverse
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
from guardian.shortcuts import assign, get_objects_for_user
from taggit.managers import TaggableManager
from projects.models import Pr... |
import numpy as np
from openpyxl import load_workbook
from scipy.optimize import fsolve
workingDirectory = "C:/Users/Matt/Desktop/abs to conc/1. Abs to Conc (for Matt)"
def padConcatenate(matrices,shapes):
largestAxis = np.max(shapes)
for matrix in matrices:
if len(matrix) != largestAxis:
... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
__all__ = ['Interface', 'main']
import os
import datetime
from .exceptions import *
from .labbook import LabBook
class Interface(object):
def __init__(self):
pass
def create(self, args):
path = os.path.abspath(args.path)
try:
la... |
import collections
import logging
import logging.handlers
import urlparse
class InMemoryStore(object):
def __init__(self, url):
qa = urlparse.parse_qs(url.query)
max_length = int(qa.get('max_length', ['100'])[0])
print 'Configuring in-memory store with {settings}'.format(settings={"max_l... |
#Python Problem 3
#mode.py
#Introduction to Bioinformatics Assignment 2
#Purpose:Calculating the mode of a dataset
#Your Name: Michael Thomas
#Date: 10/12/15
#will contain all the data of a list including some unwanted carriage return symbols
tempList = []
#will contain the data as floats after it is stripped and the ... |
class BaseGroup(object):
"""
A collection of tests and other groups.
Groups are stored as a tree. They know of their children and parent.
"""
def __init__(self, subject=None, children=None, parent=None):
# An identifier for this group
self.subject = subject
# This gro... |
import sys
rune_Path = "./src/main/java/xilef11/mc/runesofwizardry_classics/runes/Rune"
lang_file = "src/main/resources/assets/runesofwizardry_classics/lang/en_US.lang"
runes_file = "src/main/java/xilef11/mc/runesofwizardry_classics/ModRunes.java"
shortName = sys.argv[1]
locName = sys.argv[2]
clas = open(rune_Path+sho... |
# Copyright 2015 Chelsio Communications 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
#
# Unle... |
import os
import numpy as np
from Bio import Phylo
from collections import defaultdict
from sf_coreTree_json import Metadata
from sf_miscellaneous import write_pickle
class PresenceAbsenceAssociation(object):
"""docstring for Association"""
def __init__(self, tree, meta_info):
super(PresenceAbsenceAsso... |
#!/usr/bin/python
'''
natlas
network.py
Michael Laforest
mjlaforest@gmail.com
Copyright (C) 2015-2018 Michael Laforest
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as publishe... |
#!/usr/bin/python3
from .Camoco import Camoco
from .RefGen import RefGen
from .Locus import Locus
from .Term import Term
from pandas import DataFrame
from scipy.stats import hypergeom
from itertools import chain
from functools import lru_cache
from collections import OrderedDict
import sys
import copy
import numpy
i... |
#! /usr/bin/env python3
# Playground for exploring the Walk Score API. For now, just wrap the
# API calls with Python methods.
# Copyright (c) 2014 Peter Hornyack
from util.pjh_utils import *
from apis.walkscore import WalkScore
import argparse
import re
import sys
###################################################... |
# Copyright (C) 2013 Eliot Berriot <contact@eliotberriot.com>
#
# This file is part of savior.
#
# Savior 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) ... |
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
... |
# -*- coding: utf-8 -*-
# * Copyright (C) 2012-2013 Croissance Commune
# * Authors:
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
# * Pettier Gabriel;
# * TJEBBES Gaston <g.t@majerti.fr>
#
# This file is part of Autonomie : Progiciel de gestion de CAE.
#
# Autonomie is... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.contrib.sitemaps import GenericSitemap
from django.conf.urls import include, url
from wagtail.core import urls as wagtail_urls
from wagtail.admin i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for Tango on Android databases event formatter."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import tango_android
from tests.formatters import test_lib
class TangoAndroidContactFormatterTest(test_lib.EventFormatterTestCase)... |
# -*- coding: utf-8 -*-
from mfr import FileHandler, get_file_extension
try: # requires pygments
from mfr_code_pygments.render import render_html
renderers = {
'html': render_html,
}
except ImportError:
renderers = {}
EXTENSIONS = [
'.rb',
'.c',
'.cs',
'.ahk',
'.rs',
... |
# -*- coding: utf-8 -*-
import dectate
import morepath
from morepath.converter import Converter
from morepath.error import (
DirectiveReportError, ConfigError, LinkError, TrajectError)
from morepath.compat import text_type
from webtest import TestApp as Client
import pytest
def test_simple_path_one_step():
... |
# This file is part of the Waymarked Trails Map Project
# Copyright (C) 2015 Sarah Hoffmann
#
# This 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 any later version.
#
#... |
"""
twitter nlp
~~~~~~~~~~~
Serves the web application and sends tweets and tweet data using Server Side Events (SSE)
"""
import json
import os
import time
import redis
from flask import Flask, request, Response, render_template
from gevent import monkey, sleep, socket
from gevent.pywsgi import WSGIServer
import h... |
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.preprocessing import sequence
from keras.models import Model
from keras.layers import Dense, Activation, Embedding, GlobalMaxPooling1D,Convolution1D, Input,LSTM,merge
from keras.datasets import imdb
max_fe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# readitbetter 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 this
... |
# Copyright (C) 2014, 2015, 2016 SICS Swedish ICT AB
#
# Main author: Tomas Olsson <tol@sics.se>
#
# License: BSD 3 clause
from numpy import array,r_, ndarray
from pyisc import AnomalyDetector, DataObject
from pyisc import P_PoissonOnesided, P_Poisson
from visisc import _EventDataModel, \
EventHierarchyElement, \... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
import io
import os
import re
import sys
__LXML_VERSION = None
def version():
global __LXML_VERSION
if __LXML_VERSION is None:
with open(os.path.join(get_base_dir(), 'src', 'lxml', '__init__.py')) as f:
__LXML_VERSION = re.search(r'__version__\s*=\s*"([^"]+)"', f.read(250)).group(1)
... |
import os
import gzip
from pkg_resources import resource_filename
import pandas as pd
from datetime import datetime
class Update(object):
def __init__(self, system_id, run_id, query_id, document_id, sentence_id,
update_datetime, confidence):
self.system_id = system_id
self.run_id =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""New CSS Tokenizer (a generator)
"""
__all__ = ['Tokenizer', 'CSSProductions']
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
from cssproductions import *
from helper import normalize
import itertools
import re
_TOKENIZER_CACHE = {}
class Tokeni... |
"""A setuptools based setup module.
PoTrans
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.... |
import threading
from functools import partial
from time import sleep
from ipywidgets import register
from traitlets import Bool, Dict, Float, Instance, Unicode
from aipython.cspProblem import CSP
from ... import __version__
from ..stepdomwidget import ReturnableThread, StepDOMWidget
from .cspjsonbridge import (csp_... |
import os
import pandas as pd
import numpy as np
import sqlite3
import requests
import time
def fix_location(lid, new_address):
pd.set_option('display.mpl_style', 'default')
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
DATABASE1 = os.path.join(PROJECT_ROOT, 'dbs', 'licensees.db')
... |
class SeamlessInvalidValueError(ValueError):
def __str__(self):
s = type(self).__name__
if len(self.args):
s += ":" + " ".join([str(a) for a in self.args])
return s
class SeamlessUndefinedError(ValueError):
def __str__(self):
s = type(self).__name__
if len(s... |
"""
The classes inside :mod:`pamqp.commands` allow for the automatic marshaling
and unmarshaling of AMQP method frames and
:class:`Basic.Properties <pamqp.commands.Basic.Properties>`. In addition the
command classes contain information that designates if they are synchronous
commands and if so, what the expected respon... |
import sys
import tempfile
import json
from collections import defaultdict, OrderedDict
from subprocess import Popen, PIPE
from itertools import product, count, izip, chain, cycle
MINUTE = 60
HOUR = 60 * MINUTE
DAY = 24 * HOUR
MONTH = 30 * DAY
MAX_WINDOW = MONTH + 2 * DAY
#
# States
#
class State(object):
def... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.tests.helper import pytest
import numpy as np
import os
from ..spectrum import *
import matplotlib.pyplot as plt
from ...tests.helpers import *
class TestSpectrumPlotting:
def test_plotbasic(self):
"""
Make sure that basic spectrum ... |
"""
Unit tests for the ISO 10126 padding algorithm
"""
from pypad import iso_10126
from pypad.exceptions import InvalidBlockSize, InvalidMessage
import pytest
def test_iso_10126_sample():
"""Testing the ISO 10126 implementation with some generic test data"""
original = b"Testing"
expected = b"Testing", b... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... |
import ctypes
from functools import lru_cache
from shutil import rmtree
import os
from subprocess import call, DEVNULL
import sys
from tempfile import gettempdir
import time
from . import BaseSystem
user = ctypes.windll.user32
class System(BaseSystem):
@property
def browser_path(self):
dirs = ['Pro... |
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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... |
#! /usr/bin/env python
# coding:utf-8
from __future__ import division
from chartype import *
from nose.tools import raises
def hiragana2katakana_test():
ch = Chartype()
for i, j in [("あ", "ア"), ("い", "イ"), ("う", "ウ")]:
assert ch.hiragana2katakana(i) == j
def katakana2hiragana_test():
ch = Chart... |
# Copyright 2015 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... |
import settings
from lib.view_utils import render_response, render_string, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import user_passes_test
from adwords.models import *
def adword_page(request, group):
page = "landing"
return render_response(reque... |
# 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 ... |
import six
import unittest
import time
from graflux.query_engine import QueryEngine
from influxdb import InfluxDBClient
import influxdb.exceptions
class QueryEngineTest(unittest.TestCase):
def setUp(self):
self.db = 'graflux_test'
self.config = {
'influxdb': {
'host'... |
# coding: utf-8
# Django settings for xp project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME'... |
from urllib.error import URLError, HTTPError
from xml.dom import minidom
from dns import resolver
import urllib.request
import logging
def parse_thunderbird_autoconfig(xml_autoconfig):
mx_servers = []
dom_tree = minidom.parseString(xml_autoconfig)
c_nodes = dom_tree.childNodes
for i in c_nodes[0].ge... |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... |
#!/usr/bin/env python
# encoding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu),
# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu)
#
... |
# Copyright 2016 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... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
#!/usr/bin/python
# Libraries
import paho.mqtt.client as paho
import psutil
import pywapi
import signal
import sys
import time
import dweepy
import random
import plotly.plotly as py
import pyupm_i2clcd as lcd
import pyupm_grove as grove
from threading import Thread
from flask import Flask
from flask_restful import A... |
"""
Used for development to create WorldMap-related links from a layer name
"""
from __future__ import print_function
import logging
import re
import requests
from django.conf import settings
LOGGER = logging.getLogger(__name__)
GEONODE_PREFIX = 'geonode:'
class LayerLink(object):
"""Holds name, link, descriptio... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
from collections import deque
import json
import logging
import os
from time import time
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado.iostream import StreamClosedError
from tornado.... |
# -*- Mode:Python -*-
##########################################################################
# #
# This file is part of AVANGO. #
# ... |
import os
import unittest
import django_functest
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.template import Context, Template
from django.test import TestCase, override_settings
from django.urls import reverse
from wiki.models import URLPath
SUPERUSER1_USERNAME = 'admin'
SUPER... |
"""
DIRAC API Class
All DIRAC functionality is exposed through the DIRAC API and this
serves as a source of documentation for the project via EpyDoc.
The DIRAC API provides the following functionality:
- A transparent and secure way for users
to submit jobs to the Grid, monitor them and
re... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Tests for version comparison field
DESCRIPTION
@copyright: 2014 by Alessandro Pasotti - ItOpen (http://www.itopen.it) <apasotti@gmail.com>
@license: GNU GPL, see COPYING for details.
"""
import re
VERSION_RE = r'(^|(?<=\.))0+(?!\.)|\.#+'
TEST_CAS... |
#!/usr/bin/python3
"""Post-process a GC roots dump.
"""
import getopt
import os
import re
import sys
import script_utils as u
# Input and output file (if not specified, defaults to stdin/stdout)
flag_infile = None
flag_outfile = None
# Binary to analyze
flag_module = None
#............................................ |
#! /usr/bin/env python3
import config
config.import_libs()
import unittest
import websocket
import json
import time
import uuid
from gws import assureIsClosed, assureNotClosed, registerGateway, ZMQConnection
class TestSensorData(unittest.TestCase):
def setUp(self):
self.zmq = ZMQConnection(config.gws_zmq_endpoin... |
from PyQt4 import QtGui,QtCore
import os
#from PyQt4.QtWidgets import QFileDialog
class MyWindow(QtGui.QWidget):
def __init__(self):
super(MyWindow,self).__init__()
self.myButton = QtGui.QPushButton(self)
self.myButton.setObjectName("myButton")
self.myButton.setText("Test... |
#!/usr/bin/env python
import messagebird
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--accessKey', help='access key for MessageBird API', type=str, required=True)
parser.add_argument('--callID', help='identifier for the call', type=str, required=True)
parser.add_argument('--legID', help='id... |
# Copyright 2010 the Melange 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
#! /usr/bin/env python3
from collections import defaultdict
from itertools import combinations, permutations, count
from math import sqrt
description = '''
Anagramic squares
Problem 98
By replacing each of the letters in the word CARE with 1, 2, 9, and 6 respectively, we form a square number: 1296 = 362. What is rema... |
"""Merges results of manual processing into a single CSV. Requires 3 CSVs: original, "movables" and positions."""
import sys
import csv
from itertools import groupby
POSITION_COLS = ('Регіон', 'Структура', 'Посада') # Copy only these columns from the positions doc
GROUP_NUM_NAME = 'Номер групи'
def read_file(filen... |
import unittest
from openhomedevice.didl_lite import generate_string, parse, parse_duration, parse_int
class DidlLiteTests(unittest.TestCase):
def test_int_parsing(self):
self.assertEqual(parse_duration("42"), 42)
self.assertEqual(parse_duration("42.5"), 42)
self.assertIsNone(parse_int("f... |
#!/usr/bin/env python
import math
import numpy as np
#----------------------------------------------------------------------
#converts angles in degrees to radians
#----------------------------------------------------------------------
def deg_to_rad(angle):
return angle*math.pi/180.0
#---------------------------... |
# Create your views here.
from django.shortcuts import render_to_response
from django import forms
from django import http
from minesweeper.classes.create_board import CreateBoard
from minesweeper.classes.board import Board
from pymongo import Connection, DESCENDING, ASCENDING
import cPickle
import json
import datet... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# file: main.py
from copy import deepcopy
class TAG(object):
""" Simple html tag generator """
def __init__(self, *args, **kw):
self._name = self.__class__.__name__.lower()
self._attributes = dict([k.lower(), str(w)] for k, w in kw.iteritems())
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
__author__ = 'Andreas Bader'
__version__ = "1.00"
import logging
import logging.config
import argparse
from fabric.api import *
import os
import time
import Util
import subprocess
import threading
import Vm
import ConfigParser
import datetime
import re
import platform
p... |
#!/usr/bin/env python3
#****************************************************************************#
# Project: Smart Jump #
# Author: Alfonso Bilbao Velez <alfon.linux@gmail.com> #
# Developed: Hackatinho Mobilidade Sostible ... |
import logging
import random
import gym
import numpy as np
from gym import wrappers
from six.moves import range
np.random.seed(9999)
logger = logging.getLogger()
logger.setLevel(logging.INFO)
"""
References:
Sutton, Barto (2017). Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA.
"""
class DQN... |
import time
from mrq.queue import Queue
import pytest
@pytest.mark.parametrize(["p_max_latency", "p_min_observed_latency", "p_max_observed_latency"], [
[1, 0.021, 1],
[0.01, -1, 0.02]
])
def test_job_max_latency(worker, p_max_latency, p_min_observed_latency, p_max_observed_latency):
worker.start(flags=" ... |
from django.core.management import BaseCommand
from ...models import Request, Notification, Event
from ...emails import RequestNotificationEmail
from django.utils.timezone import now
class Command(BaseCommand):
help = "Command to create and send notification to remind user about the request."
email = RequestN... |
#
# Scoring functions
#
# This file is part of PINTS.
# Copyright (c) 2017-2018, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
from __future__ import absolute_import, division
from __future__ import print_function, unicode_literals
import pin... |
"""
PPO: Proximal Policy Optimization
serial version
"""
import sys
sys.path.append('../envs')
import chtrain as gym
import numpy as np
from policy import Policy
from value_function import NNValueFunction
import scipy.signal
from utils import Logger, Scaler
from datetime import datetime
import argparse
import signal
... |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
"""
MoinMoin wiki project -> Google Project Hosting converter
Full of evil antipatterns, incl. Exception exceptions.
@copyright: 2007,2010 MoinMoin:AlexanderSchremmer
@license: GNU GPL, see COPYING for details.
"""
import sys
import re
import urllib2
f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This is a CGI handler for Apache
Requires apache+[mod_cgi or mod_cgid].
In httpd.conf put somet... |
import os
import re
import tempfile
import traceback
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
from django.core import signing
from django.core.excepti... |
# okay, time to test this out here
# in a simple python script
import numpy as np
import random
def rejection_sample(fn, envelope_fn, squeeze_fn, N):
samples = []
num_accepted = 0
num_rejected = 0
for i in xrange(N):
position = sample(envelope_fn) # sample a position from the envelope function
height_multipli... |
# Author: Roberto Cavada <roboogle@gmail.com>
#
# Copyright (C) 2006-2015 by Roberto Cavada
#
# gtkmvc3 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 2 of the License, or (at yo... |
#
# MBSolget P1 Telegram Catch
# DSMR 4
#
version = "v1.00"
import sys
import os
import stat
import serial
import datetime
import locale
###############################################################################################################
# Main program
####################################################... |
import xml.etree.ElementTree as ET
from ntpath import basename # determine name of a file
from optparse import OptionParser
def filename(file):
'''
Return just the name of a file without the path and file format
'''
file = basename(file)
return file.split('.')[0]
def countPept... |
#!/usr/bin/env python
"""
An example of implementing multinomial logistic (softmax) regression with a single layer of
perceptrons using Tensorflow
Ouput: Confidence prediction (as an array) of which class an observation in the class belongs to
"""
import time
import tensorflow as tf
from tensorflow.examples.tutoria... |
'''plot event info'''
import base
import datetime
import numpy as np
import matplotlib
if not base.Globs["iswin"]:
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from logger import *
def eventplot(tin, y, sta, lta, ratio, trigs,
dt, t0, tsta, tlta, trig, detrig, desense,
... |
#!/usr/bin/python
from bottle import run,route,app,request,response,template,default_app,Bottle,debug,abort
import sys
import os
import platform
import subprocess
import re
#from flup.server.fcgi import WSGIServer
#from cStringIO import StringIO
#import memcache
app = Bottle()
default_app.push(app)
VERSION = "2.2"
p... |
#!/usr/bin/env python3
# partwriter.py - Automated part writing for four-part harmony
# Copyright (C) 2015 Souvik Banerjee
#
# 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... |
"""
A Windows and ANSII coloring library.
"""
from sys import stdout
__ALL__ = ['out', 'outln']
VERSION = (1, 0, 0)
try:
# Colors text in console mode application (win32).
# Uses ctypes and Win32 methods SetConsoleTextAttribute and
# GetConsoleScreenBufferInfo.
#
# source: https://www.burgaud.com... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# 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 file.
#
# All configurati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.