src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
# Python Standard Library Imports
import time
# Local files
import ProBotConstantsFile
# Initialization of classes from local files
Pconst = ProBotConstantsFile.Constants()
# PID functions
class PIDControllersClass():
# Build a constructor
def __init__(self):
self.error = 0
... |
"""
RNN Audio Generation Model
Three-tier model, Quantized input
For more info:
$ python three_tier.py -h
How-to-run example:
sampleRNN$ pwd
/u/mehris/sampleRNN
sampleRNN$ \
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python -u \
models/three_tier/three_tier.py --exp AXIS1 --seq_len 512 --big_frame_size 8 ... |
"""
Module that enables the use of neural networks with NowTrade.
"""
import cPickle
import numpy as np
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets.supervised import SupervisedDataSet
from pybrain.supervised.trainers.backprop import BackpropTrainer
from nowtrade import logger
# Networks
FEED... |
# Django settings for dev project.
import os
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
ADMIN_EXPORTERS = (
'djadmin_export.exporters.xlsx.XLSXExporter',
)
DATABASES = {
'default': ... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2018 Samuel Riches
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... |
from flask import render_template, Blueprint, request, redirect, url_for, flash, abort, jsonify
from sqlalchemy.exc import IntegrityError
from flask_login import login_user, current_user, login_required, logout_user
from threading import Thread
from itsdangerous import URLSafeTimedSerializer
from datetime import dateti... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2013)
#
# This file is part of GWSumm.
#
# GWSumm 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) ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
desitarget.randoms
==================
Monte Carlo Legacy Surveys imaging at the pixel level to model the imaging footprint
"""
import os
import numpy as np
import astropy.io.fits as fits
from astropy.wcs import WCS
from time im... |
# Copyright 2013 Cloudbase Solutions Srl
#
# 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 l... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-18 00:19
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('newsfeed', '0001_initial'),
]
operations... |
# -*- coding: utf-8 -*-
__author__ = 'luckydonald'
from luckydonaldUtils.logger import logging # pip install luckydonald-utils
logger = logging.getLogger(__name__)
from PIL import Image
import sys
from luckydonaldUtils.images.color import most_frequent_color
def average_colour(image):
colour_tuple = [None, None... |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
import pytest
from datetime import datetime
import numpy as np
import pandas as pd
from pandas import Index, Series
from pandas.core.index import MultiIndex, RangeIndex
from pandas.compat import lrange, range, zip
from pandas.util.testing import assert_series_equal,... |
'''
Classe per la lettura della tastiera collegata via usb
'''
import threading
import os, sys
from evdev import InputDevice, list_devices, categorize, ecodes
sys.path.insert(0, '../common')
from atomicwrite import AtomicWrite
class HandlerKeyboards(object):
def __init__(self, usbdevice):
'''
Come... |
from svc_monitor.config_db import *
from os.path import dirname, exists, join
import logging
import yaml
try:
from custom_attributes.haproxy_validator \
import validate_custom_attributes as get_valid_attrs
except ImportError:
custom_attr_dict = {}
def get_valid_attrs(custom_attr_dict, section, cust... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# coding=utf-8
from django import forms
from popular_proposal.models import (PopularProposal
)
from elections.models import Area, QuestionCategory, Election
from django.conf import settings
from formtools.wizard.views import SessionWizardView
from medianaranja2.proposals_getter impo... |
# -*- coding: utf-8 -*-
"""
LibraryContent: The XBlock used to include blocks from a library in a course.
"""
import json
import logging
import random
from copy import copy
from gettext import ngettext
from pkg_resources import resource_string
import six
from capa.responsetypes import registry
from lazy import lazy... |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from rest_framework.authtoken.views import obtain_auth_token
from .views import LibraryView, songfile, LayoutView
from .api import api_root, s... |
"""
WSGI config for aggregator project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... |
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser, UserManager
from django.contrib.postgres import fields as pgfields
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import gettext, gettext_lazy as _
from model_utils i... |
from cgi import parse_header
import json
from django.http import HttpResponse
from django.core.handlers.wsgi import ISO_8859_1
from django.core.serializers.json import DjangoJSONEncoder
from django.views.generic import View
RPC_MARKER = '_rpc'
class RPCMixin(object):
'''Mix in to a standard View to provide RP... |
#
# Copy right YMSys, 2015,2016 Zhaoming Yin
#
# @brief This script performs data analytics
# 1) it can list:
# name, numV, numE, numCC, avgDiam, varDiam, avgCluCoeff, varCluCoeff
# 2) it can draw distribution of
# clique, truss
#
#
# MODIFIED (MM/DD/YY)
... |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.shortcuts import get_object_or_404
from generic.models import GenericModel, GenericStateModel, FalseFK, GenericGroupsModel, GenericStateRootValidable, GenericGroupsModerab... |
from AccessControl.SecurityInfo import ClassSecurityInfo
from bika.wine import bikaMessageFactory as _
from bika.wine.config import PROJECTNAME
from bika.wine.interfaces import IWineTypes
from bika.lims import bikaMessageFactory as _b
from bika.lims.browser.bika_listing import BikaListingView
from plone.app.content.bro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger('sbinmanager')
class SBinManager(object):
def __init__(self):
self.pipeline_desc = ""
self.check_for_compat = True
def add_sbin(self, element):
if self.check_for_compat and element.type.find("sourc... |
import sys
from ctypes import *
import numpy as np
nnetlib = np.ctypeslib.load_library('libnnet', '../lib/')
class NNet:
def __init__(self, cfg_path):
init = nnetlib.NNet_init
self.nnet = init(cfg_path)
if self.nnet == 0:
sys.exit(-1)
c_size = c_int()
size = nn... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for field formatters.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
... |
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from dja... |
from string import letters
from random import choice, random
target = list("METHINKS IT IS LIKE A WEASEL")
charset = letters + ' '
parent = [choice(charset) for _ in range(len(target))]
minmutaterate = .09
C = range(100)
perfectfitness = float(len(target))
def fitness(trial):
'Sum of matching chars by positio... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium',
'gclient',
'gsutil',
'path',
'properties',
'python',
'step',
]
def GenSteps(api):
tarball_name = api.properties.get('ta... |
from datetime import date
from TimeSeriesFunctions import GetDatesAndValuesByDateRange
def ConvertFuturesHashToCurvesHash(FUTURES,CURVES,minDate=date(1900,1,1),maxDate=date(2099,12,31)):
for code in FUTURES.keys():
for year in FUTURES[code].keys():
for month in FUTURES[code][year].keys():
... |
# -*- coding: UTF-8 -*-
#!/usr/bin/env python
from __future__ import unicode_literals
#-------------------------------------------------------------------------------
# Name : Word Joiner
# Purpose : Generate a Word file compiling all word files present in folder
# and subfolders according to a prefix filt... |
__author__ = 'Xplore'
# Cyberaom brute force Script
import urllib
import time
import datetime
import urllib2
import sys
import xml.dom.minidom as XML
'''
#CountDown And Credits
def countdown(num):
for i in xrange(num,0,-1):
time.sleep(1)
sys.stdout.write(str(i%10)+'\r')
sys.stdout.flush()
'... |
#:coding=utf-8:
from django.test import TestCase as DjangoTestCase
from django.utils import unittest
from jsonfield.tests.jsonfield_test_app.models import *
from jsonfield.fields import JSONField
class JSONFieldTest(DjangoTestCase):
def test_json_field(self):
obj = JSONFieldTestModel(json='''{
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2013, Cameron White
#
# PyGithub 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
# S... |
from brew_data.data_miner.brew_target.utils import clean
class Yeast:
def __init__(self, data):
self.name = data[0]
self.type = data[1]
self.form = data[2]
self.lab = data[3]
self.min_temp = data[4]
self.max_temp = data[5]
self.flocculation = data[6]
... |
import pytest
import yaml
from latest.core import Grammar, contextify
from latest.exceptions import PyExprSyntaxError, ContextError
@pytest.fixture(scope='module')
def grammar():
return Grammar()
@pytest.fixture(scope='module')
def context(data_file):
with open(data_file, 'r') as f:
data = yaml.loa... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import collections
import getpass
import tempfile
from six import StringIO
from llnl.util.filesystem import tou... |
# Utility to send JSON RPC messages
# Avoid the requests module to reduce installation hassles
import urllib
import urllib2
import json
import sys
verbose = False
def dorpc(port,meth,params):
url = 'http://127.0.0.1:%d/api' % (port)
id = '12345'
data = '{ "jsonrpc": "2.0", "method": "'+meth+'", "params": '+params... |
from pwn import *
def talk(send, until, no_newline=False):
if until:
str = r.recvuntil(until)
print str + send
if no_newline:
r.send(send)
else:
r.sendline(send)
else:
str = r.recv()
print str + send
if no_newline:
r.send(send)
else:
r.sendline(send)
r = remote('localhost', 8020)
# Logi... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from time import sleep
from datetime import datetime
import json
import logging
import uuid
import pandas as pd
import sqlalchemy
from sqlalchemy.pool import NullPool
fr... |
"""
remind.py
Allows users to add reminders for various tasks.
Created By:
- Pangea <https://github.com/PangeaCake>
- Luke Rogers <https://github.com/lukeroge>
License:
GPL v3
"""
from datetime import datetime
import time
import asyncio
from sqlalchemy import Table, Column, String, DateTime, PrimaryKey... |
"""Starts the main interface. To be called with 'python interface'
from the root folder. After importing it, the interface will be
started start"""
import logging
import logging.handlers
import Queue
import socket
import sys
from autobahn.twisted.websocket import WebSocketClientProtocol, \
... |
import importlib
import os
class EnvSettings:
def __init__(self):
pytracking_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
self.results_path = '{}/tracking_results/'.format(pytracking_path)
self.network_path = '{}/networks/'.format(pytracking_path)
self.dat... |
#-*- coding:utf-8 -*-
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Agent(models.Model):
LISTE_CONTRAT = (
('CDI', 'CDI'),
('CDD', 'CDD'),
('PRE', 'Prestataire'),
('INT', 'Intérime'),
)
nom = mode... |
import signal
import asyncio
import traceback
import socket
import os
import sys
import multiprocessing
import faulthandler
import uvloop
from japronto.router import Router, RouteNotFoundException
from japronto.protocol.cprotocol import Protocol
from japronto.protocol.creaper import Reaper
signames = {
int(v): ... |
import unittest
import mock
from pyrax.cloudcdn import CloudCDNClient
from pyrax.cloudcdn import CloudCDNFlavor
from pyrax.cloudcdn import CloudCDNFlavorManager
from pyrax.cloudcdn import CloudCDNService
from pyrax.cloudcdn import CloudCDNServiceManager
class CloudCDNTest(unittest.TestCase):
@mock.patch("pyrax.... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
# -*- 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... |
#
# This file is part of the CCP1 Graphical User Interface (ccp1gui)
#
# (C) 2002-2005 CCLRC Daresbury Laboratory
#
# 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 ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
_author_ = "Lars van der Voorden"
_version_ = "1.0"
_date_ = "03/02/2015" #dd/mm/yyyy
import urllib2 #urllib2 for downloading measurement table
from HTMLParser import HTMLParser ... |
"""An example of a very simple space, the space rn.
Including some benchmarks with an optimized version.
"""
import numpy as np
import odl
from odl.space.base_tensors import TensorSpace, Tensor
from odl.util.testutils import Timer
class SimpleRn(TensorSpace):
"""The real space R^n, non-optimized implmentation."... |
# 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 ... |
# Find the sum of all the positive integers which
# cannot be written as the sum of two abundant numbers.
#
# Facts:
# All integers greater than 28123 can be
# written as the sum of two abundant numbers.
# Abundant number = sum of proper divisors of n exceed n.
#
# Find all abundant numbers up to and including ... |
# 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 u... |
from __future__ import absolute_import
__all__ = ['DocSection', 'Endpoint', 'StatsMixin']
import logging
from datetime import datetime, timedelta
from django.utils.http import urlquote
from django.views.decorators.csrf import csrf_exempt
from enum import Enum
from pytz import utc
from rest_framework.authentication i... |
# -*- coding: utf-8 -*-
#
# Test links:
# http://czshare.com/5278880/random.bin
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from module.utils import parseFileSize
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
__version__ = "... |
import database
from datetime import *
import error
from bson.objectid import ObjectId
db = database.db
def flatten ( l ):
out = []
if isinstance(l, (list, tuple)):
for item in l:
out.extend(flatten(item))
elif isinstance(l, (dict)):
for dictkey in l.keys():
out.extend(flatten(l[dictkey]))
elif isinstan... |
# Copyright 2013 by Zheng Ruan (zruan1991@gmail.com).
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Code for Codon Alphabet.
CodonAlphabet class is inherited from Alphabet... |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from statsmodels.stats.weightstats import ttost_paired
data = pd.read_csv(open('combined_data.csv'))
for t in data.index:
if int(data.loc[t, 'Baseline']) == 0:
data.loc[t, 'STF Baseline'] = data.loc[t, 'Succesfully Tracked Features 0... |
class sprite:
# Sprite class, to make it easier to manipulate afterwards
spriteCount = 0
def __init__ (self,pattern,colors,ored,x,y):
self.pattern=pattern #binary pattern of the sprite
self.colors=colors #colors of the sprite
self.ored = ored #does this sprite c... |
import pytest
from conway.grid import Cell
from conway.grid import Point as P
from conway.grid.cell_set import Grid
from . import GameRulesTestMixin
T = Cell.ALIVE
F = Cell.DEAD
class TestGrid(GameRulesTestMixin):
GRID_CLS = Grid
def test_init_with_width_and_height(self):
grid = Grid(width=3, heig... |
#!/usr/bin/env python
'''
The MIT License (MIT)
Copyright (c) <2014> <Mathias Lesche>
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
... |
# -*- coding: utf-8 -*-
"""Grading Open Service Interface Definitions
grading version 3.0.0
The Grading OSID defines a service to apply grades or ratings.
Grade Systems
The grade system sessions provide the means to retrievs and manage
``GradeSystem`` definitions. A ``GradeSystem`` is a fixed set of
``Grades`` . ``G... |
import numpy as np
import theano
import theano.tensor as T
class HiddenLayer(object):
def __init__(self, input, num_in, number_of_nodes, activation):
self.num_in = num_in
self.number_of_nodes = number_of_nodes
self.weights = self.init_weights(activation)
self.output = activation(T... |
#!/usr/bin/env python
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from future.utils import string_types, text_type, native_str
import unittest
import pickle
import re
import types
from fileseq.utils import *
from files... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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, this
# l... |
# Copyright (C) 2010 INRIA - EDF R&D
# Authors: Damien Garaud
#
# This file is part of the PuppetMaster project. It provides facilities to
# deal with computations over a Linux network.
#
# This script is free; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by ... |
"""setenrichment_test.py - unit tests for set enrichment module
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.
"""
import unittest
import cmonkey.set_enrichment as se
class DiscreteEnrichmentSetTest(unittest.TestCase): # pylint: disable-msg=R0904
""... |
#
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE 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 3 of the License, or
# (at your... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-29 12:44
from __future__ import unicode_literals
import django.contrib.postgres.indexes
import django.contrib.postgres.search
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = T... |
"""
Compare the clustering methods in scikits.learn to see which ones are fastest
and most accurate
"""
import time
import numpy
import sklearn.cluster as cluster
from apgl.data.Standardiser import Standardiser
import scipy.cluster.vq as vq
numExamples = 10000
numFeatures = 500
X = numpy.random.rand(numExamples,... |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
from pbxproj.pbxsections import *
class ProjectGroups:
"""
This class provides separation of concerns, this class contains all methods related to groups manipulations.
This class should not be instantiated on its own
"""
def __init__(self):
raise EnvironmentError('This class cannot be ins... |
"""Representation of keypresses."""
import curses
from curses import ascii
from curses.ascii import isprint
class Key:
"""Class representing a combination of key presses.
Attributes:
keys: Dictionary that maps key names to codes.
"""
keys = {k[4:]: eval('curses.'+k) for k in dir(curses) if ... |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import importlib
from bliss.common.tango import DeviceProxy
from bliss.config import settings
from .bpm import Bpm
from .roi import Roi, Ro... |
from java import awt
from java.awt import image
from javax import swing
from geoscript import geom, proj, style
from org.geotools.geometry.jts import ReferencedEnvelope
from org.geotools.map import DefaultMapContext, DefaultMapLayer
from org.geotools.renderer.lite import StreamingRenderer
from org.geotools.swing impor... |
import os
import sys
import click
from sqlalchemy import create_engine
from sqlalchemy.sql import text
from sqlalchemy.exc import SQLAlchemyError
from kamcli.cli import pass_context
from kamcli.ioutils import ioutils_dbres_print
from kamcli.ioutils import ioutils_formats_list
from kamcli.dbutils import dbutils_exec_sql... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#author: Michael Ruster
def process(inputFile, outputFile):
''' Reads a block log CSV, cleans the comment, reorders the output and
writes it to disk according to outputFile. Please be aware that, if
writing permissions are given for outputFile, it will blindly over... |
from http.server import BaseHTTPRequestHandler, HTTPServer
import threading, pickle, re, subprocess
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
f_type_map = {'.html': 'text/html', '.css': 'text/css', '.ico': 'image/x-icon', '.jpg': 'image/jpeg', '.png': 'image/png', '.gif': 'image/gif', ... |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
#
# 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... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
import time
import sys
import os
import configloader
import importloader
from speedtest import speedtest
from shadowsocks import common, shell
class Speedtest(object):
def __init__(self):
import threading
self.event = threading.Event()
... |
"""Test run delta feature."""
# pylint: disable=too-many-arguments
# pylint: disable=protected-access,too-many-public-methods,invalid-name
from __future__ import absolute_import
from rotest.core.runner import run
from rotest.core.models.run_data import RunData
from rotest.core.models.case_data import TestOutcome
from r... |
#!/usr/bin/env python
"""
Artificial Intelligence for Humans
Volume 3: Deep Learning and Neural Networks
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2015 by Jeff Heaton
Licensed under the Apache License, V... |
"""
Simulated pipeline run
"""
import logging
import os
import astropy.units as u
import click
from astropy.coordinates import Angle, SkyCoord
import fastimgproto.casa.simulation as casa_sim
from fastimgproto.pipeline.skymodel import get_spiral_source_test_pattern
from fastimgproto.skymodel.helpers import SkyRegion, ... |
#!/usr/bin/env python
from os.path import dirname, join
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
curdir = dirname(__file__)
packages = [
"pymoodstocks",
]
setup(
name="pymoodstocks",
version="0.1",
description="Kivy/Python wrapper on the Moodstoc... |
# Copyright 2016 PerfKitBenchmarker 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 appli... |
""" Diffs the config against the currently running CloudFormation stacks
Sometimes small changes can have big impacts. Run "stacker diff" before
"stacker build" to detect bad things(tm) from happening in advance!
"""
from .base import BaseCommand
from ...actions import diff
class Diff(BaseCommand):
name = "dif... |
from urllib.parse import quote_plus
NETWORKS = {
'twitter': {
'name': 'Twitter',
'icon': 'fa-twitter',
'url': 'https://twitter.com/{user}',
'share': 'https://twitter.com/share?url={url}&text={title}',
},
'linkedin': {
'name': 'LinkedIn',
'icon': 'fa-linkedin... |
from jinja2 import Environment, FileSystemLoader
import os
from datetime import datetime
import git, renderer, utils, settings
import web, logging
import cPickle as pickle
from cache import cache
logger = logging.getLogger(__name__)
def render_template(template_name, **context):
extensions = context.pop('extens... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SwmmAlgorithm.py
---------------------
Date : December 2013
Copyright : (C) 2013 by Vincent Mora
Email : vincent dot mora dot mtl at gmail dot com
******... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
new_default = orm.Extension._meta.get_field_by_name('icon')[0].default
for ... |
#!/usr/bin/env python
"""
Calculates the density of air baed upon the Ideal Gas Law and the Magnus Equation
"""
import argparse
import numpy as np
from scipy.io import netcdf
import math
import os
def calculate_density(pressure, temperature, relative_humidity):
Rl = 287.058 # R for luft (dry air), ... |
from subprocess import Popen, PIPE
import os.path
import os
import xml.etree.ElementTree as ET
PEOS_COMMAND = './peos/os/kernel/peos'
class PEOSException(Exception):
pass
def create(path_to_model_file):
if not os.path.isfile(path_to_model_file):
raise IOError("File does not exist")
proc = Pop... |
#!/usr/bin/env python3
# encoding: utf-8
import MySQLdb
import random
import hashlib
import string
db = MySQLdb.connect(host=input('host:'),
user=input('user:'),
passwd=input('password:'),
db=input('db:'))
db.autocommit(True)
cur = db.cursor()
cur.exec... |
"""
VATSIM Status Proxy
Copyright (C) 2017 - 2019 Pedro Rodrigues <prodrigues1990@gmail.com>
This file is part of VATSIM Status Proxy.
VATSIM Status Proxy 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,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.