src stringlengths 721 1.04M |
|---|
import os
import re
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_chameleon',
... |
import unittest
from dag import DfsNode
from headers_dag import HeadersDag
from topological_sorter import TopologicalSorter
from recursive_filter import RecursiveFilter
#
# OptionsMock
#
class OptionsMock:
def __init__( self ):
self.watch_header = ""
#
# TestRecursiveFilter
#
class TestRecursiveFilter( u... |
"""
The full pipeline for generating simulated population reads for unit testing.
Usage: python sim_pipeline.py [config file]
"""
import subprocess
import os
import logging
import sys
import ConfigParser
import hyphy.hyphy_handler as hyphy_handler
import fasttree.fasttree_handler as fasttree_handler
import config.set... |
# Copyright (c) 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 required by applicab... |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
import subprocess
import unittest
import transaction
from zope.component import getUtility
from lp.registry.interfaces.person import IPersonSet
from lp.reg... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Swiss Postfinance File Delivery Services module for Odoo
# Copyright (C) 2014 Compassion CH
# @author: Nicolas Tran
#
# This program is free software: you can redistribute it and/or modify
# ... |
# Curdling - Concurrent package manager for Python
#
# Copyright (C) 2014 Lincoln Clarete <lincoln@clarete.li>
#
# 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,... |
# coding=utf-8
import sys
import codecs
from functools import wraps
from StringIO import StringIO
from contextlib import contextmanager
from jig.exc import ForcedExit
# Message types
INFO = u'info'
WARN = u'warn'
STOP = u'stop'
def strip_paint(payload):
"""
Removes any console specific color characters.
... |
#!/usr/bin/env python
# Copyright (C) 2010 Oliver Mader <b52@reaktor42.de>
#
# 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
# t... |
#!/usr/bin/python
# example launch script for DisplayCluster, executed by startdisplaycluster
# this should work for most cases, but can be modified for a particular
# installation if necessary
import os
import xml.etree.ElementTree as ET
import subprocess
import shlex
# get environment variable for the base Display... |
from lampost.gameops.action import ActionError
from lampost.di.resource import Injected, module_inject
from lampmud.mud.action import mud_action
sm = Injected('session_manager')
module_inject(__name__)
@mud_action('emote', target_class='cmd_str')
def emote(source, target):
source.broadcast(raw="{}{} {}".format('... |
#!/usr/bin/env python
from mpsse import *
from time import sleep
class SPIFlash(object):
WCMD = "\x02" # Standard SPI flash write command (0x02)
RCMD = "\x03" # Standard SPI flash read command (0x03)
WECMD = "\x06" # Standard SPI flash write enable command (0x06)
CECMD = "\xc7" # Standard SPI flash chip eras... |
import socket
import select
import sys
sock_list = []
def chat_server():
global sock_list
buff_size = 1024
s = socket.socket()
s.bind(('127.0.0.1', 9000))
s.listen(5)
print('Server started on port 9000')
conn, addr = s.accept()
sock_list.append(conn)
while True:
... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
clean_html,
dict_get,
ExtractorError,
int_or_none,
parse_duration,
unified_strdate,
)
class XHamsterIE(InfoExtractor):
_VALID_URL = r'''(?x)
... |
#!/usr/bin/env python
#
# Copyright (C) 2015 Narf Industries <info@narfindustries.com>
#
# 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
# th... |
#==============================================================================
# example09.py
# Create initial conditions for pure N-body simulation inside the python
# script, and then run the simulation to completion while plotting results.
#===========================================================================... |
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
#
# IMPORTANT - WHILST THIS MODULE IS USED BY SEVERAL OTHER PLUGINS
# THE MASTER AND MOST UP-TO-DATE IS FOUND IN THE COVERART BROWSER
# PLUGIN - https://github.com/fossfreedom/coverart-browser
# PLEASE SUBMIT CHANGES BACK TO HELP EXPAND THIS AP... |
# coding: utf8
# engine.py
# 5/3/2014 jichi
# The logic in this file must be consistent with that in vnragent.dll.
if __name__ == '__main__': # DEBUG
import sys
sys.path.append("..")
import os
from glob import glob
from sakurakit.skdebug import dprint
from sakurakit.skfileio import escapeglob
class Engine:
def... |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... |
# 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/.
from itertools import chain
from django.core.cache import caches
from django.test.utils import override_settings
from ... |
# -------------------------------------------------------------------------------------------------------------
## Import Statements
# -------------------------------------------------------------------------------------------------------------
from __future__ import print_function
import sys
from .utils import get_b... |
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#... |
#!/usr/bin/python3
from gi.types import GObjectMeta
from gi.repository import GLib
from gi.repository import GObject
from gi.repository import Gom
# Need a metaclass until we get something like _gclass_init_
# https://bugzilla.gnome.org/show_bug.cgi?id=701843
class ItemResourceMeta(GObjectMeta):
def __init_... |
# file = Lab2.py
# programmer = Keith Murphy
# date created = 1-15-2014
# last mod = 1-25-2014
#
# input_list:
# width_1, length_1, width_2, length_2
# output_list:
# rectangle_1_area, rectangle_2_area, average_area_of_rectangles
#
# Variables
# Declare real width_1
# Declare real length... |
import re
import numpy as np
import tensorflow as tf
class discriminator(object):
def __init__(self):
self.name = 'keydis'
def __call__(self, input_data, reuse=False):
with tf.variable_scope(self.name) as self.ds:
if reuse:
self.ds.reuse_variables()
nf_l... |
import numpy as np
import tensorflow as tf
from a_nice_mc.objectives.expression import Expression
from a_nice_mc.utils.logger import create_logger
logger = create_logger(__name__)
class MixtureOfGaussians(Expression):
def __init__(self, name='mog2', display=True):
super(MixtureOfGaussians, self).__init__... |
import numpy as np
import copy
import itertools
from moha.system.basis import SlaterDeterminant,NElectronBasisSet
class Configuration(object):
"""
"""
def __init__(self):
"""
"""
pass
@classmethod
def truncated(cls,hfwavefunction,excitation_level):
"""
excit... |
# Pygame Template
# Use this to start a new Pygame project
# KidsCanCode 2015
import pygame
import random
# define some colors (R, G, B)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
FUCHSIA = (255, 0, 255)
GRAY = (128, 128, 128)
LIME = (0, 128, 0)
MAROON = (128, 0, 0)
NAVYBLU... |
import os
#this checks whether the file exists and if not creates it
if os.path.isfile("hex_tweaks.txt"):
file = open("hex_tweaks.txt", "r+")
size = len(file.read())
file.seek(0)
else:
file = open("hex_tweaks.txt", "w")
size = 0
#because duplicate offsets would be annoying
def get_offsets(file):
offset_list = [... |
# This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... |
# Copyright (c) Ralph Meijer.
# See LICENSE for details.
"""
Tests for L{wokkel.iwokkel}
"""
from __future__ import division, absolute_import
from twisted.trial import unittest
class DeprecationTest(unittest.TestCase):
"""
Deprecation test for L{wokkel.subprotocols}.
"""
def lookForDeprecationWarni... |
import pytest
from sunpy.time import parse_time
from sunpy.time.timerange import TimeRange
from sunpy.net.vso import VSOClient
from sunpy.net.vso.attrs import Time, Instrument, Source, Level
from sunpy.net.dataretriever.client import QueryResponse
import sunpy.net.dataretriever.sources.eve as eve
from sunpy.net.fido_f... |
from Products.CMFCore.utils import getToolByName
def validateSubmit(obj, event):
if not event.transition or \
event.transition.id not in ['submit']:
return
containedItems = obj.listFolderContents()
if len(containedItems) < 1:
from Products.CMFCore.utils import getToolByName
... |
# Copyright 2014 Huawei Technologies Co. Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
#!/usr/bin/env python
"""
utility file for various git functions
"""
__author__ = 'edelman@room77.com (Nicholas Edelman)'
__copyright__ = 'Copyright 2013 Room77, Inc.'
import os
import subprocess
from pylib.base.exec_utils import ExecUtils
from pylib.base.term_color import TermColor
class Error(Exception):
def _... |
from __future__ import division, print_function, absolute_import
import pytest
from numpy.testing import assert_array_equal
from scipy._lib._numpy_compat import suppress_warnings
import scipy.ndimage as ndi
import os
try:
from PIL import Image
pil_missing = False
except ImportError:
pil_missing = True
... |
import urllib, urllib2,re,string,sys,os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
from t0mm0.common.addon import Addon
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon(addon_id, sys.argv)
art = main.art
error_logo = art+'/bigx.png'
BASEURL... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import json
import logging
import os
import pkgutil
from collections import deque
from functools import wraps
from flask import Flask, request
from flask_cors import CORS
from ... |
import asyncio
import json
import random
import string
import sys
from aiohttp import request
from chilero.web.test import WebTestCase
from .application import Application
TEST_DB_SUFFIX = 'test_{}{}{}'.format(
sys.version_info.major,
sys.version_info.minor,
sys.version_info.micro,
)
cl... |
"""
Django settings for find-my-place project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build... |
from __future__ import absolute_import
from logging import getLogger
import rethinkdb as r
from future.builtins import range
from future.moves.queue import Queue
logger = getLogger("RethinkPool")
class ConnectionResource(object):
def __init__(self, queue, conn, **kwds):
self._queue = queue
if ... |
import datetime
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
import boto
from boto.s3.key import Key
from gas.models import GasProfile
from numpy import array
from perftools.models import JSONStore
def convert_to_movie():
comman... |
# -*- coding: utf-8 -*-
#
# (DC)² - DataCenter Deployment Control
# Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephan Adig <sh@sourcecode.de>
# 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; eit... |
import re
from . import base
from .decorators import *
import tuned.logs
from subprocess import *
from tuned.utils.commands import commands
import tuned.consts as consts
import errno
import os
log = tuned.logs.get()
DEPRECATED_SYSCTL_OPTIONS = [ "base_reachable_time", "retrans_time" ]
SYSCTL_CONFIG_DIRS = [ "/run/sys... |
import sys
import base64
import json
import subprocess
import traceback
from functools import wraps
try:
import ssl
except ImportError:
ssl = False
PY2 = sys.version_info < (3, 0)
try:
import __builtin__
str_instances = (str, __builtin__.basestring)
except Exception:
str_instances = (str, )
try... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Malcolm Ramsay <malramsay64@gmail.com>
#
# Distributed under terms of the MIT license.
"""Testing the dynamics module."""
import numpy as np
import quaternion
from hypothesis import HealthCheck, assume, given, settings
from hypothesi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Lemiere Yves
# Juillet 2017
def main():
debug = True
if debug:
print("*************************")
print("* Welcome in boucle_for *")
print("*************************\n")
# Ceci est une liste de chaines de caractères:
my... |
def tabStr(length):
s = ""
for i in xrange(length):
s += "\t"
return s
class Node:
"""
Class representing a node of SCRDR tree
"""
def __init__(self, condition, conclusion, father = None, exceptChild = None, elseChild = None, cornerstoneCases = [], depth = 0):
"""
r... |
import logging
from django.conf import settings
from djconnectwise.utils import RequestSettings
import re
import requests
from retrying import retry
class ConnectWiseAPIError(Exception):
"""Raise this, not request exceptions."""
pass
class ConnectWiseRecordNotFoundError(ConnectWiseAPIError):
"""The rec... |
import numpy as np
import pylab as plt
from matplotlib import rc
rc('font', family='Consolas')
t1=np.linspace(0,0.2, 1000000)
odpowiedzimpulsowa=np.exp(-187.786*t1)*(293.255*np.cos(4804.76*t1)-6.43723*np.sin(4804.76*t1))
plt.title(u"Odpowiedź impulsowa\nexp(-187.786t)*(293.255cos(4804.76t)-6.43723sin(4804.76t))")
xsca... |
__author__ = 'kflores'
"""
Model that defines the class structure of the database.
"""
from app import db
ROLE_USER = 0
ROLE_ADMIN = 1
class Node(db.Model):
"""class representation of one networked sensor kit hooked into ethernet. Instatiation requires the name, ip address, and location of the "node", but all ... |
MSG_COLORS = {
0: (100, 255, 100),
1: (100, 100, 100),
2: (200, 200, 200),
3: (200, 0, 0)}
UI_COLOR = (100, 100, 100)
SECONDARY_UI_COLOR = (165, 42, 42)
class UI(object):
global MSG_COLORS
global UI_COLOR
def __init__(self):
self.view_field = ''
self.colors = {}
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-18 20:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('user', '0002_auto_20161215_0806'),
... |
# -*- coding: utf-8 -*-
"""
我们经常遇到的问题是给你两个数,要你求最大公约数和最小公倍数。
今天我们反其道而行之,给你两个数a和b,计算出它们分别是哪两个数的最大公约数和最小公倍数。
输出这两个数,小的在前,大的在后,以空格隔开。若有多组解,输出它们之和最小的那组。
注:所给数据都有解,不用考虑无解的情况。
a = gcd(x,y)
b = lcm(x,y) = x*y/gcd(x,y) = x*y/a
-> x*y = a*b
"""
import math
def find_x_y(a,b):
product = a*b
match_num = []
for i in ... |
from flask import Flask, jsonify, render_template, request
import json
import os
import tempfile
app = Flask(__name__)
from git_subprocess import Repository
repo_path = '/tmp/test/'
# Set up a git repository for a storage backend
repo = Repository(repo_path or tempfile.mkdtemp())
repo.init()
# Homepage - just rend... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Code inspired from Docker and modified to fit our needs
#
# 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... |
import csv
import json
import os
import shutil
import sys
import zipfile
from io import StringIO
from django.core.management import call_command
from django.test import TestCase, tag
from data_refinery_common.models import (
SurveyJob,
ProcessorJob,
OriginalFile,
ProcessorJobOriginalFileAssociation,
... |
from panda3d.core import *
from panda3d.direct import *
import CatalogItem
from toontown.toonbase import ToontownGlobals
from otp.otpbase import OTPLocalizer
from toontown.toonbase import TTLocalizer
bannedPhrases = [11009]
class CatalogChatItem(CatalogItem.CatalogItem):
def makeNewItem(self, customIndex):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
GAZE
Turnkey Open Media Center
__ .-.
.-"` .`'. /\\|
_(\-/)_" , . ,\ /\\\/ =o O=
{(=o^O=)} . ./, |/\\\/
`-.(Y).-` , | , |\.-`
/~/,_/~~~\,__.-` =O o=
////~ // ~... |
import logging
import json
from webob import Response
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller import dpset
# from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.of... |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# 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... |
import sys
import numpy as np
import importlib
import lasagne as nn
import theano
from theano import tensor as T
import os
import glob
import data
import utils
if not (2 <= len(sys.argv) <= 3):
sys.exit("Usage: python predict.py <metadata_path> [subset=test]")
sym_y = T.imatrix('target_output')
sym_x = T.tensor3... |
# -*- coding: utf-8 -*-
from flask.ext.restful import fields
from blatt.api.fields import (RelatedResource, Geolocation, InstanceURL,
ForeignKeyField)
from blatt.api.restful import BlattResource
from blatt.persistence import session, Publication, Article, Journalist, Media
class Article... |
import sys
from {{ project_name }}.settings.default import *
# Custom Project Structure:
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
APPS_DIR = os.path.join(BASE_DIR, 'apps')
sys.path.insert(0, BASE_DIR)
sys.path.insert(1, APPS_DIR)
sys.path.insert(2, os.path.join(BASE_DIR, 'libs'))
# Production Configs (o... |
# 327-count-of-range-sum.py
class Solution(object):
def countRangeSum(self, nums, lower, upper):
"""
:type nums: List[int]
:type lower: int
:type upper: int
:rtype: int
"""
# Start: inclusive
# End: exclusive
def iter(start, end):
... |
# Copyright (c) 2006 The Regents of The University of Michigan
# 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 list ... |
#!/usr/bin/env python
# generator.py
# simple C++ generator, originally targetted for Spidermonkey bindings
#
# Copyright (c) 2011 - Zynga Inc.
from clang import cindex
import sys
import pdb
import ConfigParser
import yaml
import re
import os
import inspect
from Cheetah.Template import Template
type_m... |
import json
import time
import re
from collections import OrderedDict
from doajtest.helpers import DoajTestCase
from portality import models
from portality.upgrade import do_upgrade
from portality.lib.paths import rel2abs
def operation(journal):
j = models.Journal.pull(journal.id)
bj = j.bibjson()
bj.titl... |
# Copyright 2011 OpenStack Foundation
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# procfile documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 23 19:51:57 2015.
#
# 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
# a... |
# -*- coding: utf-8 -*-
ENCODINGS = ['utf8', 'gbk']
def decode_statement(statement, encodings):
# if isinstance(statement, unicode):
# return statement
for encoding in encodings:
try:
return statement.decode(encoding)
except UnicodeDecodeError:
pass... |
# Copyright 2015 The Offline Content Packager 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 requi... |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... |
# Under MIT License, see LICENSE.txt
from Controller.DrawingObject.BaseDrawingObject import BaseDrawingObject
from Controller.QtToolBox import QtToolBox
from Model.DataObject.DrawingData.DrawTextDataIn import DrawTextDataIn
__author__ = 'RoboCupULaval'
class TextDrawing(BaseDrawingObject):
def __init__(self, da... |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 NOEL-BARON Léo
# 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
# li... |
#License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt
sql = webnotes.conn.sql
from webnotes import _, msgprint
import datetime
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
... |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# This file is part of solus-sc
#
# Copyright © 2017-2018 Ikey Doherty <ikey@solus-project.com>
#
# 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 Founda... |
#
# SPDX-License-Identifier: MIT
#
import os
import sys
basepath = os.path.abspath(os.path.dirname(__file__) + '/../../../../../')
lib_path = basepath + '/scripts/lib'
sys.path = sys.path + [lib_path]
from resulttool.report import ResultsTextReport
from resulttool import regression as regression
from resulttool import... |
#!/usr/bin/env python
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... |
import SimulationManager
import math
import random
import Vehicule
def proba_poisson(k, freq, temps_obs):
#Calcul du lambda correspondant
l = freq * temps_obs
p = math.e ** (-l)
for i in range(0, k):
p *= l/k
k = k-1
return p
def var_poisson(freq, temps_obs):
proba_cumulee = r... |
from functools import partial
from os import environ
from typing import Optional
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.http import HttpRequest
class DomainGetter:
__slots__ = ['domain']
def __init__(self, domain: Optional[str]):
sel... |
__author__ = "piotrhol"
__copyright__ = "PNSC (@@check)"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
import sys
if __name__ == "__main__":
# Add main project directory and ro manager directories at start of python path
sys.path.insert(0, "../..")
sys.path.insert(0, "..")
#interna... |
"""
Unit tests for pserv package.
"""
from __future__ import absolute_import, print_function
import os
import csv
import unittest
from collections import OrderedDict
from warnings import filterwarnings
import ConfigParser
import numpy as np
import astropy.io.fits as fits
import desc.pserv
filterwarnings('ignore')
def... |
#***************************************************************************
#* *
#* Copyright (c) 2009, 2010 *
#* Xiaolong Cheng <lainegates@163.com> *
#* ... |
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid 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
#... |
#!/usr/bin/env python
"""
This returns an automated web browser to use for automated testing. It also
includes some utility functions.
https://www.seleniumhq.org/
http://selenium-python.readthedocs.io/
"""
import time
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCa... |
# Copyright 2017-2021 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
# -*- 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/stable/config
# -- Path setup ------------------------------------------------------------... |
#!/usr/bin/env python3
##########################################################################
# USAGE: import general
# DESCRIPTION: Functions for common tasks (e.g. opening files with
# exception handling built in)
# Created by Jennifer M Shelton
##############################################################... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import connection
class Migration(SchemaMigration):
TABLES_MAPPING = {
'cmsplugin_peopleplugin': 'aldryn_people_peopleplugin',
}
REVERSE_TABLES_MAPPING = dict((v, k) for k, v in TA... |
class type:
def __init__(self,name,size,ctypename,gotypename='default'):
self.name = name
self.size = size
self.ctypename = ctypename
if gotypename=='default':
self.gotypename = name
else:
self.gotypename = gotypename
def cgen(self,v):
print self.name,'%s;'%v.name
def gogen(self,v):
print v.nam... |
# -*- coding: utf-8 -*-
"""
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
"""
import socket
from django.contrib.messages import constants as message_constants
from .common import * # noqa
# DEBUG
# -----------------------------------... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Bruno Cauet
#
# 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 r... |
import mock
import time
from fureon import db_operations, config, site_controls
from fureon.models import stream_playlist, song
from tests import testing_utils
class TestMainStreamControls(testing_utils.TestingWithDBBaseClass):
@mock.patch('fureon.utils.stream_player.StreamPlayer.update')
def test_load_song_... |
from numpy import array, rot90, fliplr, array_equal
from checkerboardpuzzle_stone import Rotation
def generate_rotated_nparrays(nparray):
"""generate rotated and mirrored versions of given nparray."""
r1 = rot90(nparray)
r2 = rot90(r1)
r3 = rot90(r2)
f1 = fliplr(nparray)
f2 = fliplr(r1)
f3 ... |
import re
import numpy as np
input_string = """
Example Sky AirTemp Humidity Wind Water Forecast EnjoySport
1 Sunny Warm Normal Strong Warm Same Yes
2 Sunny Warm High Strong Warm Same Yes
3 Rainy Cold High Strong Warm Change No
4 Sunny Warm High Strong Cool Change... |
import bpy
import os
import glob
import bpy.utils.previews
# custom icons dictionary
_icon_collection = {}
def custom_icon(name):
load_custom_icons() # load in case they custom icons not already loaded
custom_icons = _icon_collection["main"]
default = lambda: None # for no icon with given name will r... |
# coding=utf-8
from __future__ import unicode_literals
from .base import BasePipe
from ...conf.exceptions import ImproperlyConfigured
from ...node import empty
from ...plugins import plugins
from ...plugins.exceptions import UnknownPlugin
class PluginPipe(BasePipe):
def render_response(self, response):
... |
"""
A set of helpers that automate personal data removal. Used in the admin
interface, typically after a GDPR request for removal.
"""
import abc
from collections import defaultdict
DELETED_STR = "<DELETED>"
class BaseCheck(metaclass=abc.ABCMeta):
def __init__(self, person):
self.person = person
d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.