src stringlengths 721 1.04M |
|---|
#!/bin/true
#
# build.py - part of autospec
# Copyright (C) 2015 Intel Corporation
#
# 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 la... |
"""
==============
Edge operators
==============
Edge operators are used in image processing within edge detection algorithms.
They are discrete differentiation operators, computing an approximation of the
gradient of the image intensity function.
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage.d... |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
import re,time,itertools,os,random,socket
from fields import StrField,ConditionalField,Emph
from config import conf
from ... |
import pandas as pd
import logging
from progressivis import SlotDescriptor
from progressivis.utils.errors import (ProgressiveError,
ProgressiveStopIteration)
from ..table.module import TableModule
from ..table.table import Table
from ..table.dshape import (dshape_from_dataframe,
... |
#!/usr/bin/env python
# coding=utf-8
def explain(desc):
d = {'$gt':' > ',
'$lt':' < ',
'$gte':' >= ',
'$lte':' <= ',
'$ne':' <> ',
'$in':' in ',
'$nin':' not in ',
'$or':' or ',
'$and':' and ',
'':' and ',
'$regex': ' like ',
'... |
import requests
import time
import os
import sqlite3
def init_make_request():
global conn
global last_hour
global last_minute
global queries_for_last_minute
global queries_for_last_hour
last_hour = time.clock()
last_minute = time.clock()
queries_for_last_minute = 0
queries_for_... |
import json
from datetime import datetime
import pytz
from tzlocal import get_localzone
def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, datetime):
# save in UTC
serial = obj.astimezone(pytz.utc).strftime(ComicInfo.ISO_FORMAT)
... |
import numpy as np
class EntityMention(object):
"""A mention of an entity (span of text) in a document
Args:
doc_id: a unique identifier for the document
text: a single string of text corresponding to the document
char_start: the integer offset of the first character in the entity
... |
import json, datetime, os
from .sqlparser import parse
def Date(year, month, day):
raise NotImplementedError()
def Timestamp(hour, minute, second):
raise NotImplementedError()
def Timestamp(year, month, day, hour, minute, second):
raise NotImplementedError()
def DateFromTicks(ticks):
raise NotI... |
import hashlib
import os
from . import ModelMixin
from . import db
from utils import timestamp
from utils import log
from utils import sh1hexdigest
class MessageCopy(db.Model, ModelMixin):
__tablename__ = 'messageCopys'
Cid = db.Column(db.Integer, primary_key=True) # 转发编号
# Ccontent = db.Column(db.Str... |
import datetime
import logging
import re
import webapp2
from google.appengine.ext import ndb
from google.appengine.api import urlfetch
import bs4
class Node(ndb.Model):
parent = ndb.KeyProperty('Node', indexed=False)
title = ndb.StringProperty(indexed=False)
url = ndb.TextProperty(indexed=False)
use... |
import os
import sys
import vstruct.qt as vs_qt
import envi.expression as e_expr
import envi.qt.config as e_q_config
import vqt.main as vq_main
import vqt.colors as vq_colors
import vqt.qpython as vq_python
import vqt.application as vq_app
import vivisect.cli as viv_cli
import vivisect.base as viv_base
import vivise... |
import cdms2
import cdutil
import numpy
import numpy.ma
import vcs
import os
import sys
import por_template_2x3_landscape as por_lanscape_2x3
x = por_lanscape_2x3.x
iso=x.createisofill('new1', 'ASD')
iso.levels = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
#([1, 5, 10, 15, 20, 25, 35, 45, 55, 60, 65, 70, 80])
#is... |
#!/usr/bin/env python
"""
Coordinate Transforms
This will hold a number of different functions that can be used for coordinate transforms.
Created on Sat Nov 1 19:09:47 2014
@author: John Swoboda
"""
from __future__ import division,absolute_import
import numpy as np
def sphereical2Cartisian(spherecoords):
... |
# -*- coding: utf-8 -*-
class Node(object):
"""
basic node, saves X and Y coordinates on some grid and determine if
it is walkable.
"""
def __init__(self, x=0, y=0, walkable=True, see_through=True):
# Coordinates
self.x = x
self.y = y
# Whether this node can be walke... |
import random
import time
from FaustBot.Communication import Connection
from FaustBot.Modules.PrivMsgObserverPrototype import PrivMsgObserverPrototype
jokes = [['Was ist orange und geht über die Berge?'
,'Eine Wanderine.']
,['Was ist orange und schaut durchs Schlüsselloch?'
,'Eine Spannderine.']
,['Was ist violett und... |
#!/usr/bin/python
import argparse
import os
import logging
import subprocess
import re
from jinja2 import Template
logging.basicConfig(level=logging.DEBUG)
IGNORED = [
r"^\./\.git",
r"^\./packages",
r".+\.py",
r"^./vendors/fonts",
r"^./index-template.html"
]
def get_all_script_paths(build=False):
if buil... |
# Copyright 2015 Cloudbase Solutions SRL
#
# 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... |
from abc import ABC, abstractmethod, abstractstaticmethod
import requests
from bs4 import BeautifulSoup
class AbstractNovel(ABC):
"""
abstract novel class
Attributes:
url: The novel url
single_thread: A bool represent whether use single thread grab novel information
volume_name: ... |
from django.contrib import auth
from django.contrib.auth.models import AnonymousUser, User
from panya.utils import modify_class
def _user_has_field_perm(user, perm, obj, field):
anon = user.is_anonymous()
for backend in auth.get_backends():
if not anon or backend.supports_anonymous_user:
i... |
"""
There are three types of functions implemented in SymPy:
1) defined functions (in the sense that they can be evaluated) like
exp or sin; they have a name and a body:
f = exp
2) undefined function which have a name but no body. Undefined
functions can be defined using a Function cla... |
# encoding: utf8
#
# Copyright © Burak Arslan <burak at arskom dot com dot tr>,
# Arskom Ltd. http://www.arskom.com.tr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistr... |
import socket
from machine import Pin
led_pin = Pin(5, Pin.OUT)
CONTENT = """\
HTTP/1.0 200 OK
Content-Type: text/html
<html>
<head>
</head>
<body>
<p>Hello #%d from MicroPython!</p>
<a href="/toggle">Click here to toggle LED hooked to pin 5</a>
</body>
</html>
"""
def main():
s = socket.socket()... |
#!/usr/bin/env python
# -------------------------------------------------------------------
# File Name : create_dataset_events.py
# Creation Date : 05-12-2016
# Last Modified : Fri Jan 6 15:04:54 2017
# Author: Thibaut Perol <tperol@g.harvard.edu>
# -------------------------------------------------------------------
... |
import os
import sys
import inspect
import logging
import logging.config
from singleton import singleton
@singleton
class loggingex():
def __init__(self, conf_path):
error = 0
while True:
try:
logging.config.fileConfig(conf_path)
except IOError as e:
... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... |
# Copyright 2011 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... |
import unittest
import uuid
import json
from bitmovin import Bitmovin, Response, Stream, StreamInput, EncodingOutput, ACLEntry, Encoding, \
FMP4Muxing, MuxingStream, PlayReadyDRM, SelectionMode, ACLPermission, PlayReadyDRMAdditionalInformation
from bitmovin.errors import BitmovinApiError, InvalidTypeError
from test... |
import ConfigParser
import optparse
import logging
import sys
import os
import multiprocessing
from multiprocessing import Pool
from Lightcurve import Lightcurve, AsciiLightcurve, FITSLC, HDFLC
from Detrend import DetrendFunc, COSDetrend, EPDDetrend, FocusDetrend, PolyDetrend
def lc_parse(infile, name, default=None,... |
"""
This page is in the table of contents.
The multiply plugin will take a single object and create an array of objects. It is used when you want to print single object multiple times in a single pass.
You can also position any object using this plugin by setting the center X and center Y to the desired coordinates (... |
"""HTTP Client for asyncio."""
import asyncio
import base64
import hashlib
import os
import sys
import traceback
import warnings
import http.cookies
import urllib.parse
import aiohttp
from .client_reqrep import ClientRequest, ClientResponse
from .errors import WSServerHandshakeError
from .multidict import MultiDictPr... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserBadge'
db.create_table(u'people_userbadge', (
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-24 22:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('repo', '0001_initial'),
]
operations = [
m... |
#
# Advene: Annotate Digital Videos, Exchange on the NEt
# Copyright (C) 2008-2017 Olivier Aubert <contact@olivieraubert.net>
#
# Advene 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 ... |
# -*- coding: utf-8 -*-
# Copyright 2015-2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from odoo.addons.connector_carepoint.models import phone
from ...unit.backend_adapter import CarepointCRUDAdapter
from ..common import SetUpCarepointBase
class EndTestExcepti... |
from __future__ import (absolute_import, division, print_function)
from PyQt5 import QtCore, QtWidgets
import sys
import numpy as np
from layer import Layer, MSLD
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import... |
# Copyright 2019 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.
from base_generator import Color, Modes, BaseGenerator
class CSSStyleGenerator(BaseGenerator):
'''Generator for CSS Variables'''
def Render(self):... |
#! /usr/bin/python3
from urllib.request import *
import os
import pprint
"""
===============================================================
Project Name: Advanced Feed
Autor: Fabian Geiselhart
Erstelldatum: 13.7.15
Zuletzt Bearbeitet: 21.7.15
Typ: Python 3 RSS Feed Klasse
D... |
#
# Tobii controller for PsychoPy
#
# author: Hiroyuki Sogo
# Distributed under the terms of the GNU General Public License v3 (GPLv3).
#
from psychopy.experiment.components import BaseComponent, Param
from os import path
thisFolder = path.abspath(path.dirname(__file__))#the absolute path to the folder containing th... |
import matplotlib.pyplot as plt
#
# plotting
#
def plot_elevation(ds, ax=None):
if ax is None:
ax = plt.gca()
ds['hs'].plot(ax=ax,label="surface")
ds['hb'].plot(ax=ax,label="bottom")
# add horizontal line to indicate sea level
ax.hlines(0, ds.x[0], ds.x[-1], linestyle='dashed', color='blac... |
from typing import Dict
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.dataset import Dataset
from neuralmonkey.decorators import tensor
from neuralmonkey.model.feedable import FeedDict
from neuralmonkey.model.parameterized import InitializerSpecs
from neuralmonkey.model.model_pa... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils
organizers = {
2491303902, # http://www.eventbrite.com/o/itcamp-2491303902
6873285549, # http://www.eventbrite.com/o/sponge-media-lab-6873285549
3001324227, # http://www.eventbrite.com/o/labview-student-ambassador-upb-3001324227
2300226659, # http://w... |
import os
import time as tm
import sys
# Handles the creation of condor files for a given set of directories
# -----------------------------------------------------------------------------
def createCondorFile(dataDir,outDir,time):
# Condor submission file name convention: run-day-time.condor
with open('/home/... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run tests for the `vmmad.util` module.
"""
# Copyright (C) 2011, 2012 ETH Zurich and University of Zurich. All rights reserved.
#
# Authors:
# Riccardo Murri <riccardo.murri@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not ... |
# Copyright 2018-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... |
#coding=utf-8
'''
Created on 2015-12-30
@author: lamter
'''
# from gevent import monkey
# monkey.patch_all()
import time
import unittest
import json
import socket
from lib.woodmoo import *
import conf_server
import conf_debug
from request import BaseRequest
''' 建立 redisco 的链接 '''
class TestSocket(unittest.TestC... |
#!/usr/bin/python
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2010 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more inf... |
""" Handles main processor operations.
WriteFileToFlash()
LoadBuffer()
WritePage()
EraseFlash()
SetBootFlash()
Reset()
Not sure what all are doing but tests have worked.
"""
import ArduinoFlashSerial, ArduinoFlashHardValues
import ctypes, time, os
def WriteFileToFlash(SerialPort, Log, File, IsNativePort):
... |
#
# 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... |
import weechat
w = weechat
import re
import htmllib
import os
import urllib
import urllib2
SCRIPT_NAME = "grimmly"
SCRIPT_AUTHOR = "oholiab <oholiab@grimmwa.re>"
SCRIPT_VERSION = "1.1"
SCRIPT_LICENSE = "MIT"
SCRIPT_DESC = "Create short urls in private grimmly URL shortener"
settings = {
"ignore_prefix"... |
# pragma: no cover
"""
Implement basic assertions to be used in assertion action
"""
def eq(value, other):
"""Equal"""
return value == other
def ne(value, other):
"""Not equal"""
return value != other
def gt(value, other):
"""Greater than"""
return value > other
def lt(value, other):
... |
from modules.lidskjalvloggingtools import loginfo
import telnetlib
import time
WAIT = 5
class SwitchHandler():
def __init__(self, u, p, e):
self.loginpasswords = [p]
self.loginusername = u
self.loginenable = e
self.logintries = 5
self.telnettimeout = 10
def get_swit... |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
__version__ = '$Id: ttfonts.py 3959 2012-09-27 14:39:39Z robin $'
__doc__="""TrueType font support
This defines classes to represent TrueType fonts. They know how to calculate
their own width and how to write themselves into PDF files. T... |
# -*- coding: utf-8 -*-
#
# Inflector REST documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 18 10:48:43 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file... |
#!/usr/bin/python
# M.E.Farmer 2013
# demo for tween library
# showing integration with PyGame
# moves text from random points using various tweens
# changes from random color to random color using the same tween
# Mouse click rotates through tweens and ESC closes demo
import sys
import pygame
import random
import twee... |
"""
Device tracker platform that adds support for OwnTracks over MQTT.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks/
"""
import asyncio
import base64
import json
import logging
from collections import defaultdict
import volupt... |
#!/usr/bin/env python
#
# Copyright 2016 Google 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
#
# Unless requir... |
"""
>>> test_typeof()
"""
import numba
from numba import *
def make_base(compiler):
@compiler
class Base(object):
value1 = double
value2 = int_
@void(int_, double)
def __init__(self, value1, value2):
self.value1 = value1
self.value2 = value2
retur... |
# Copyright (C) 2016 William Hicks
#
# This file is part of Writing3D.
#
# Writing3D 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 file is part of Merlin.
# Merlin is the Copyright (C)2008,2009,2010 of Robin K. Hansen, Elliot Rosemarine, Andreas Jacobsen.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; ... |
"""
=====================
Gradients and Spheres
=====================
This example shows how you can create gradient tables and sphere objects using
dipy_.
Usually, as we saw in :ref:`example_quick_start`, you load your b-values and
b-vectors from disk and then you can create your own gradient table. But
this time le... |
"""Tests for the Entity Registry."""
from unittest.mock import patch
import pytest
from homeassistant import config_entries
from homeassistant.const import EVENT_HOMEASSISTANT_START, STATE_UNAVAILABLE
from homeassistant.core import CoreState, callback, valid_entity_id
from homeassistant.exceptions import MaxLengthExc... |
# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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 ap... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from lxml import etree
import traceback
import os
import unittest
import pytz
import werkzeug
import werkzeug.routing
import werkzeug.utils
import odoo
from odoo import api, models, registry
from odoo im... |
# RUN: %{python} %s
#
# END.
import os.path
import platform
import unittest
import lit.discovery
import lit.LitConfig
import lit.Test as Test
from lit.TestRunner import ParserKind, IntegratedTestKeywordParser, \
parseIntegratedTestScript
class TestIntegratedTestKeywordParser(unittest.Tes... |
#!/usr/bin/env python
import os,sys
import cut_image
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-c","--center",
metavar="X,Y",
type=str,
default="0,0",
help="Center offset in percentage")
parser.add_option("-r","--ratio",
metavar="X:Y",
t... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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/LICE... |
#
# A higher level module for using sockets (or Windows named pipes)
#
# multiprocessing/connection.py
#
# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt
#
__all__ = [ 'Client', 'Listener', 'Pipe' ]
import os
import sys
import socket
import errno
import time
import tempfile
import itertools
import _multiproc... |
#written using Python 2.7.8
cipher_library = [{"A": "A", "B": "B", "C": "C", "D": "D", "E": "E", "F": "F", "G": "G", "H": "H", "I": "I", "J": "J", "K": "K", "L": "L", "M": "M", "N": "N", "O": "O", "P": "P", "Q": "Q", "R": "R", "S": "S", "T": "T", "U": "U", "V": "V", "W": "W", "X": "X", "Y": "Y", "Z": "Z"},
... |
__author__ = "Matthijs van der Deijl"
__date__ = "$Dec 09, 2009 00:00:01 AM$"
"""
Naam: postgresdb.py
Omschrijving: Generieke functies voor databasegebruik binnen BAG Extract+
Auteur: Milo van der Linden, Just van den Broecke, Matthijs van der Deijl (originele versie)
Versie: 1.0
... |
# coding=utf-8
# Author: Frank Fenton
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill 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
# ... |
# Django settings for django_attachmentstore project.
import os
ROOT = lambda * x: os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), *x))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
SERVER_EMAIL = "root@localhost"
EMAIL_S... |
#!/usr/bin/env python2
'''
pmx485.py
Copyright (C) 2019 2020 Phillip A Carter
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.... |
# Copyright (c) 2016, NVIDIA CORPORATION. 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 of conditions a... |
from __future__ import division
import numpy as np
from scipy.interpolate import interp1d
def _import_emis_file(rcp):
if rcp in ['rcp3pd', 'rcp26']:
from ..RCPs.rcp26 import Emissions as rcp_emis
elif rcp=='rcp45':
from ..RCPs.rcp45 import Emissions as rcp_emis
elif rcp in ['rcp6', 'rcp60... |
from elasticsearch_dsl import Date, InnerDoc, Keyword, Nested, Text
from ESSArch_Core.agents.models import Agent
from ESSArch_Core.search.documents import DocumentBase
from ESSArch_Core.tags.documents import autocomplete_analyzer
class AgentNameDocument(InnerDoc):
main = Text()
part = Text()
description ... |
# -*- 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... |
import configparser
import logging
import os
import shutil
import traceback
from . import settings
class CustomFormatter(logging.Formatter):
FORMATS = {logging.DEBUG: 'DEBUG: %(module)s: %(lineno)d: %(message)s',
logging.INFO: '%(message)s',
logging.WARNING: 'UWAGA! %(message)s',
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-08 04:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('doctor_subscriptions', '0001_initial'),
... |
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
"""
template instantiation parser
This module implements all functionality necessary to parse C++ template
instantia... |
import unittest
from models import *
from utils.handle_transcript import TranscriptionParser, OmekaXML, om
from test_data import TRANSCRIPTIONS
OMEKA_COLLECTION = "test_omeka_collection.xml"
# User, Transcription, Joke, Picture
class TestUserClass(unittest.TestCase):
def setUp(self):
self.TP = Transcription... |
from pygsl import bspline, multifit, rng
import pygsl._numobj as numx
N = 200
ncoeffs = 8
nbreak = ncoeffs - 2
bspline = bspline.bspline
def run():
r = rng.rng()
bw = bspline(4, nbreak)
# Data to be fitted
x = 15. / (N-1) * numx.arange(N)
y = numx.cos(x) * numx.exp(0.1 * x)
sigma = .1
... |
#!/usr/bin/env python3
import sys
import os
from os import listdir
from os.path import isfile, join
import semantic_version
import generate
import re
import logging
logger = logging.getLogger(__name__)
def _get_semantic_version(policy_filename):
logger.debug("getting semantic version from filename is %s:" % polic... |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.makeatoon.ClothesGUI
from toontown.toon import ToonDNA
from direct.fsm import StateData
from direct.gui.DirectGui import *
from MakeAToonGlobals import *
from toontown.toonbase import TTLocalizer
from direct.directnotify import DirectNotifyGlobal... |
"""Tests for legendre module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.legendre as leg
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
TestCase, assert_almost_equal, assert_raises,
assert_equal, assert_, run_module_suite)
L0 = np.array... |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... |
# Python test set -- part 6, built-in types
from test.support import run_unittest, run_with_locale, impl_detail
import unittest
import sys
import locale
class TypesTests(unittest.TestCase):
def test_truth_values(self):
if None: self.fail('None is true instead of false')
if 0: self.fail('0 is true... |
"""This module contains all functionality on the level of a single audio file.
"""
from __future__ import print_function
from audiorename.meta import Meta, dict_diff
from phrydy.utils import as_string
from tmep import Functions
from tmep import Template
import errno
import os
import phrydy
import re
import shutil
cl... |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Red... |
from cvxopt import matrix,spmatrix,sparse
from cvxopt.blas import dot,dotu
from cvxopt.solvers import qp
import numpy as np
from kernel import Kernel
class OCSVM:
"""One-class support vector machine
'Estimating the support of a high-dimensional distribution.',
Sch\"{o}lkopf, B and Platt, J C and Shawe-Taylor, ... |
import numpy as np
import networkx as nx
from collections import defaultdict
from scipy.sparse import csr_matrix, csc_matrix, triu
def sparse_to_networkx(G):
nnz = G.nonzero()
_G = nx.Graph()
_G.add_edges_from(zip(nnz[0], nnz[1]))
return _G
def compute_growth_rate(G, n_repeat=10):
"""
Compute... |
#!/usr/bin/env python3
#
# A PyMol extension script to test extrusion of a hub from a single module's
# n-term
#
def main():
"""main"""
raise RuntimeError('This module should not be executed as a script')
if __name__ =='__main__':
main()
in_pymol = False
try:
import pymol
in_py... |
from django.conf.urls import patterns, url
from django.conf import settings
from main import views
urlpatterns = patterns(
'',
url(r'^$', views.home_page, name='home'),
url(r'^login/$', views.loginPage, name='loginPage'),
url(r'^register/$', views.register, name='register'),
url(r"^home/$", views.h... |
from tests.test_helper import *
class TestVisaCheckout(unittest.TestCase):
def test_create_from_nonce(self):
customer = Customer.create().customer
result = PaymentMethod.create({
"customer_id": customer.id,
"payment_method_nonce": Nonces.VisaCheckoutVisa
})
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 15:35:39 2013
@author: Alison Kirkby
plots edi files (res/phase vs period) for all edis in a directory and saves out as png files
"""
import os
import mtpy.imaging.plotresponse as mtpr
from tests import EDI_DATA_DIR, EDI_DATA_DIR2
from tests.imaging import ImageTestC... |
#
# GADANN - GPU Accelerated Deep Artificial Neural Network
#
# Copyright (C) 2014 Daniel Pineo (daniel@pineo.net)
#
# 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 restricti... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import pytest
import numpy as np
from ...autocorr import integrated_time, AutocorrError
__all__ = ["test_nd", "test_too_short"]
def get_chain(seed=1234, ndim=3, N=100000):
np.random.seed(seed)
a = 0.9
x = np.empty((N, ndim))
x[... |
#! /usr/bin/env python3
# Chapter 13 Practice Brute-Force PDF Password Breaker
# USAGE: Change the pdfFile varible below and run the script to try 44,000 English words
# from the dictionary.txt file to decrypt the encrypted PDF.
import PyPDF2
pdfFile = open('bruteForce.pdf', 'rb') #Change this file name an... |
# 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 agreed to in writing, ... |
# ===============================================================================
# Copyright 2013 Jake Ross
#
# 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/licens... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.