src stringlengths 721 1.04M |
|---|
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template import RequestContext, loader
from django.contrib import auth
from django.core.context_processors import csrf
from django.con... |
def extractHeyitsmehyupperstranslationsCom(item):
'''
Parser for 'heyitsmehyupperstranslations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if item['tags'] == ['Uncategorized']:
titlemap = [
('TIA... |
from __future__ import absolute_import
import os
import re
import numpy as np
import tensorflow as tf
from six.moves import range, reduce
stop_words=set(["a","an","the"])
def load_candidates(data_dir, task_id):
assert task_id > 0 and task_id < 7
candidates=[]
candidates_f=None
candid_dic={}
if t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND ... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
compat_urlparse,
)
class UstreamIE(InfoExtractor):
_VALID_URL = r'https?://www\.ustream\.tv/(?P<type>recorded|embed|embed/recorded)/(?P<videoID>\d+)'
IE_NAME = 'ustream'
_TEST = {
'url':... |
class Operation:
def __init__(self, *stations):
self.stations = stations
def __call__(self, params=None, **dependencies):
options = dict(params=(params or {}), **dependencies)
success = True
for station in self.stations:
if (success and station.runs_... |
from django.core.management import call_command
from ... import models
from ...fields import get_one_to_many_fields, get_self_reference_fields
from ._base import DumperBaseCommand
class Command(DumperBaseCommand):
help = 'Load data'
def handle(self, **options):
self.verbosity = options['verbosity']
... |
from django.utils import simplejson as json
from django.conf import settings
from django.contrib.auth.models import User
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
from django.views.generic.list import ListView
from fr... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. 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 th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import requests
import math
from flask import Flask, request
app = Flask(__name__)
API_KEY = 'ebc2ccbd44d15f282010c6f3514c5c02'
API_URL = 'http://api.openweathermap.org/data/2.5/weather?'
API_QUERY = 'lat={lat}&lon={lon}&appid={api}'
# SAMPLE R... |
#!python
# This file was obtained from:
# http://peak.telecommunity.com/dist/ez_setup.py
# on 2011/1/21.
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup... |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
import envvars
from phonedusk.app import create_app
from phonedusk.user.models import User
from phonedusk.settings import DevConfig, Pro... |
"""
ESSArch is an open source archiving and digital preservation system
ESSArch
Copyright (C) 2005-2019 ES Solutions AB
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... |
###############################################################################
# $Id$
#
# Project: Sub1 project of IRRI
# Purpose: State Quality Assessment extraction from MODIS09A (500m)
# Author: Yann Chemin, <yann.chemin@gmail.com>
#
##############################################################################... |
"""
glutenfree
"""
from setuptools import find_packages, setup
dependencies = ['click']
setup(
name='glutenfree',
version='0.1.0',
url='https://github.com/yochem/glutenfree',
license='MIT',
author='Yochem van Rosmalen',
author_email='yochem@icloud.com',
description='glutenfree',
long_d... |
__author__ = 'Fabian'
import unittest
broken_mods = {"5dim mod", "Air Filtering", "canInsert"}
class TestRemoteAPI(unittest.TestCase):
indextestfields = ["title", "contact", "name", "homepage", "author"]
def test_index(self):
from FactorioManager import remoteapi
index = remoteapi.ModIndex
... |
"""
For handling permission and verification requests
"""
import json
import datetime
from lib.model import User, Organization, MiniOrganization, IdeaMeta, Project
#Checks if someone is an owner of an organization they are trying to modify
def is_owner(org_id, user_id):
my_org = Organization.objects.get(unique=or... |
# coding: utf-8
from sqlalchemy import Column, Integer, SmallInteger, text, ForeignKey
from sqlalchemy.orm import relationship
from Houdini.Data import Base
metadata = Base.metadata
class Stamp(Base):
__tablename__ = 'stamp'
PenguinID = Column(ForeignKey(u'penguin.ID', ondelete=u'CASCADE', onupdate=u'CASCAD... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-12 07:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tests', '0004_user_is_dead'),
]
operations = [
... |
#!/usr/bin/python
from __future__ import print_function
import os
import sys
import subprocess
import re
import importlib
from cli.utils import Utils
def print_help_opt(opt, desc):
print(" {} {}".format(opt.ljust(13), desc))
def roger_help(root, commands):
print("usage: roger [-h] [-v] command [arg...]\n... |
# aircraft_map: maintains a list of aircraft "seen" by an ADSB
# receiver.
import math
import time
DEFAULT_PURGE_TIME = 120 # Forget planes not heard from in this many seconds
DEFAULT_PURGE_INTERVAL = 1 # How often to purge stale aircraft
EARTH_RADIUS = 6371000 # Earth's radius in meters
class Aircraft(object):
... |
# -*- coding: utf-8 -*-
#
# Imports
import torch
from .Transformer import Transformer
# Transform text to character vectors
class Character(Transformer):
"""
Transform text to character vectors
"""
# Constructor
def __init__(self, uppercase=False, gram_to_ix=None, start_ix=0, fixed_length=-1):
... |
#!/usr/bin/env python3
if __name__ == '__main__':
import pytest
import sys
sys.exit(pytest.main([__file__] + sys.argv[1:]))
import subprocess
import pytest
import platform
import sys
from distutils.version import LooseVersion
from util import (wait_for_mount, umount, cleanup, base_cmdline,
... |
#/usr/bin/env python
# coding: utf
import math
import pygame
import random
import itertools
SIZE = 640, 480
def intn(*arg):
return map(int,arg)
def Init(sz):
'''Turn PyGame on'''
global screen, screenrect
pygame.init()
screen = pygame.display.set_mode(sz)
screenrect = screen.get_rect()
clas... |
# coding: utf-8
from collections import OrderedDict
from captcha.fields import CaptchaField, CaptchaTextInput
from django import forms
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import (
PasswordResetForm,
UserChangeForm,
UserCreationForm,... |
#
# 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... |
import pygame
import random
import time
import math
from common import SpriteCounter, BaseSprite
max_mass = 2500
screen_size = (800, 600)
def draw_star(points, size, point_length=0.5):
polygon = []
for n in range(points*2):
if n % 2 == 0:
x = math.sin(2*math.pi*n/points/2)*size/2 + size/... |
##
# .driver.dbapi20 - DB-API 2.0 Implementation
##
"""
DB-API 2.0 conforming interface using postgresql.driver.
"""
threadsafety = 1
paramstyle = 'pyformat'
apilevel = '2.0'
from operator import itemgetter
from functools import partial
import datetime
import time
import re
from .. import clientparameters as pg_param... |
#####################################################################
#
# Copyright 2015 SpinVFX
#
# 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... |
# -*- coding: utf-8 -*-
#/usr/bin/python2
'''
By kyubyong park. kbpark.linguist@gmail.com.
https://www.github.com/kyubyong/tacotron
'''
import numpy as np
import librosa
from hyperparams import Hyperparams as hp
import glob
import re
import os
import csv
import codecs
def load_vocab():
vocab = "E abcdefghijklmn... |
# 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 t... |
'''
Created on 23.2.2014
@author: tace (samuli.silvius@gmail.com)
'''
import sys
import os
import argparse
from os import rename
SCRIPT_NAME = os.path.basename(__file__)
def convert_file_names(files, originalName, newName):
print "\n>>>> Convert file names\n"
for fname in files:
if fname.find(origin... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch, ANY
from mock_api.models import AccessLog
@patch("requests.request")
class AccessLogAdminTest(TestCase):
fixtures = ("test_api.json", "test_access_logs.js... |
import logging
import time
from baseservice import BaseService, handler, register
LOBBY_CHAT_ID = 0
class ChatService(BaseService):
# TODO: Add FIFO policy to the dict to limit the msg in memory
def __init__(self):
BaseService.__init__(self, 'ChatService')
# init
self.chat_room_lis... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP - Account balance reporting engine
# Copyright (C) 2009 Pexego Sistemas Informáticos. All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it... |
import ast
import imp
import limitexec as le
import os
import pkg_resources
import pwd
import random
import resource
import sys
import time
import traceback
from rgkit.settings import settings
def load_map():
map_filename = pkg_resources.resource_filename(
'rgkit', 'maps/default.py')
map_data = ast.l... |
#
# 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
# ... |
"""This module implements the WordSub class, modelled after a recipe
in "Python Cookbook" (Recipe 3.14, "Replacing Multiple Patterns in a
Single Pass" by Xavier Defrang).
Usage:
Use this class like a dictionary to add before/after pairs:
> subber = TextSub()
> subber["before"] = "after"
> subber["b... |
"""This is part of the Mouse Tracks Python application.
Source: https://github.com/Peter92/MouseTracks
"""
from __future__ import absolute_import
import sys
from multiprocessing import freeze_support
from mousetracks.config.settings import CONFIG, CONFIG_PATH
from mousetracks.track import track
from mousetracks.util... |
# -*- coding: utf-8 -*-
#
from .common import *
class FrameTest(TestCase):
def test_context_init(self):
context = Context()
self.assertTrue(context.frame is None)
self.assertEqual(context.frames, [])
def test_single_expression(self):
root = tree_1plus2mul3()
context ... |
import weakref
from abc import ABCMeta, abstractmethod
from datetime import datetime
import six
from corehq.util.pagination import PaginationEventHandler, TooManyRetries
class BulkProcessingFailed(Exception):
pass
DOCS_SKIPPED_WARNING = """
WARNING {} documents were not processed due to concurrent mod... |
import numpy as np
import pytest
from foyer import Forcefield, forcefields
from foyer.exceptions import MissingForceError, MissingParametersError
from foyer.forcefield import get_available_forcefield_loaders
from foyer.tests.base_test import BaseTest
from foyer.tests.utils import get_fn
@pytest.mark.skipif(
cond... |
'''
Created on Aug 19, 2012
@author: eric
'''
from databundles.sourcesupport.uscensus import UsCensusBundle
class Us2010CensusBundle(UsCensusBundle):
'''
Bundle code for US 2000 Census, Summary File 1
'''
def __init__(self,directory=None):
self.super_ = super(Us2010CensusBundle, self)
... |
#-----------------------------------------------------------------------------
# Name: wx.lib.plot.py
# Purpose: Line, Bar and Scatter Graphs
#
# Author: Gordon Williams
#
# Created: 2003/11/03
# RCS-ID: $Id: plot.py,v 1.13 2005/05/09 19:59:34 RD Exp $
# Copyright: (c) 2002
# Licence: Use... |
"""
Context managers for use with the ``with`` statement.
.. note:: If you are using multiple directly nested ``with`` statements, it can
be convenient to use multiple context expressions in one single with
statement. Instead of writing::
with cd('/path/to/app'):
with prefix('workon myvenv... |
from diffcalc.gdasupport.scannable.diffractometer import DiffractometerScannableGroup
from diffcalc.gdasupport.scannable.hkl import Hkl
from diffcalc.gdasupport.scannable.hkloffset import HklOffset
from diffcalc.gdasupport.scannable.simulation import SimulatedCrystalCounter
from diffcalc.gdasupport.scannable.wavelength... |
"""A test timing plugin for nose
Usage: ./manage.py test --with-timing --timing-file=/path/to/timing.csv
"""
import csv
import sys
import time
from nose.plugins import Plugin
from corehq.tests.noseplugins.uniformresult import uniform_description
class TimingPlugin(Plugin):
"""A plugin to measure times of testin... |
import os
import sys
from sys import argv, exit
from scipy.sparse.csgraph import dijkstra
import CPUtimer
from data1 import instance_iteratorL, print_solution
def solve(instance_path):
timer = CPUtimer.CPUTimer()
for instance in instance_iteratorL(instance_path):
verticeInicial = 1
instance_n... |
from gpaw import GPAW, restart
from ase.structure import molecule
from gpaw.test import equal
Eini0 = -17.6122060535
Iini0 = 12
esolvers = ['cg', 'rmm-diis', 'dav']
E0 = {'cg': -17.612151335507559,
'rmm-diis': -17.612184220369553,
'dav': -17.612043641621657}
I0 = {'cg': 6, 'rmm-diis': 7, 'dav': 8... |
# -*- coding: UTF-8 -*-
"""
The WDmodel package is designed to infer the SED of DA white dwarfs given
spectra and photometry. This main module wraps all the other modules, and their
classes and methods to implement the alogrithm.
"""
from __future__ import absolute_import
from __future__ import print_function
from __f... |
# coding: utf-8
from __future__ import unicode_literals
from .utils import default_words, default_verbs
from .Stemmer import Stemmer
from .WordTokenizer import WordTokenizer
class Lemmatizer(object):
"""
>>> lemmatizer = Lemmatizer()
>>> lemmatizer.lemmatize('کتابها')
'کتاب'
>>> lemmatizer.lemmatize('آتشفشان')... |
from importlib import import_module
from django.conf import settings
from django.utils import six
from bs4 import BeautifulSoup
class MarkupPipeline(object):
"""
Small framework for extending parser
"""
def extend_markdown(self, md):
for extension in settings.MISAGO_MARKUP_EXTENSIONS:
... |
"""cpassdb - Client Protocol Classes"""
__author__ = "Brian Wiborg <baccenfutter@c-base.org>"
__license__ = "GNU/GPLv2"
import os
import sys
import json
import base64
import commands
from twisted.internet import reactor
from twisted.protocols.basic import LineReceiver
class ClientProtocol(LineReceiver):
"""Abstr... |
import re
from setuptools import Command
from setuptools import find_packages
from setuptools import setup
import subprocess
try:
# Python 2 backwards compat
from __builtin__ import raw_input as input
except ImportError:
pass
def read_module_contents():
with open('version.py') as app_init:
ret... |
#-*-coding:utf-8-*-
"""
@package pgit.tests.cmd.test_submodule
@brief tests for pgit.cmd.submodule
@author Sebastian Thiel
@copyright [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl.html)
"""
__all__ = []
from bcmd import InputError
from ..lib import with_application
from pgit.tests.lib import ... |
import sys, select, time, socket, traceback
class SEND:
def __init__( self, sock, timeout ):
self.fileno = sock.fileno()
self.expire = time.time() + timeout
def __str__( self ):
return 'SEND(%i,%s)' % ( self.fileno, time.strftime( '%H:%M:%S', time.localtime( self.expire ) ) )
class RECV:
def ... |
#!/usr/bin/python3
"""
In a given 2D binary array A, there are two islands. (An island is a
4-directionally connected group of 1s not connected to any other 1s.)
Now, we may change 0s to 1s so as to connect the two islands together to form 1
island.
Return the smallest number of 0s that must be flipped. (It is guar... |
import ibis.expr.operations as ops
import ibis.expr.schema as sch
from ibis.backends.base import Database
class AlchemyDatabaseSchema(Database):
def __init__(self, name, database):
"""
Parameters
----------
name : str
database : AlchemyDatabase
"""
self.nam... |
import numpy as np
from itertools import islice
nan = np.nan
def window(seq, n=2):
"Returns a sliding window (of width n) over data from the iterable"
" s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... "
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield... |
import os
import time
import math
import errno
import marshal
import collections
import idiokit
from idiokit import timer, xmlcore
from idiokit.xmpp.jid import JID
from abusehelper.core import bot, events, taskfarm, services
from vsroom.common import eventdb
NS = "vsr#historian"
try:
import json
JSONDecodeEr... |
"""Contains the CourseInfo object"""
import datetime
import collections
import csv
import os
import shutil
import sys
#import git
import subprocess
import tempfile
import gitlab
from colorama import Fore, Style, init # Back,
init()
from glt.MyClasses.Student import Student
from glt.MyClasses.StudentCollection import ... |
"""Contains the abstract interface for sending commands back to a vehicle
interface.
"""
import numbers
import time
import threading
import binascii
try:
from queue import Queue
from queue import Empty
except ImportError:
# Python 3
from queue import Queue
from queue import Empty
class ResponseRec... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pwnpwnpwn import *
from pwn import *
import time
#host = "10.211.55.6"
#port = 8888
host = "128.199.247.60"
port = 10001
r = remote(host,port)
def alloca(size,data):
r.recvuntil("5. Run away")
r.sendline("1")
r.recvuntil("?")
r.sendline(str(size))
... |
'''
AlexNet implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
AlexNet Paper (http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
Author: Aymeric Damien
Project: https://gi... |
# -*- 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 'FeedListFeed'
db.create_table(u'feedlists_feedlistfeed', ... |
import os
from behave import given, when, then
from test.behave_utils.utils import (
stop_database,
run_command,
stop_primary,
query_sql,
wait_for_unblocked_transactions,
)
from test.behave.mgmt_utils.steps.mirrors_mgmt_utils import (add_three_mirrors)
def assert_successful_command(context):
... |
import logging
import time
from autotest.client import utils
from autotest.client.shared import error
from virttest import utils_netperf, utils_net, env_process, utils_misc
from virttest import data_dir, utils_test
# This decorator makes the test function aware of context strings
@error.context_aware
def run(test, pa... |
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.core.context_processors import csrf
from models import MdlUser
from events.models import TrainingAttendance
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_req... |
from virtual_machine import VirtualMachine, BIN_OPS, VirtualMachineError
from frame import Frame
from block import Block
from unittest.mock import MagicMock, patch
import pytest
class TestVirtualMachine:
def setup_method(self):
self.vm = VirtualMachine()
self.frame = MagicMock()
self.frame... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Lorenzo Battistini <lorenzo.battistini@agilebg.com>
# © 2017-2019 Didotech srl (www.didotech.com)
#
# This program is free software: you can redistribute it and/or modify
# it under ... |
"""
Memory usage of Python < 3.3 grows between some function calls, randomly,
whereas it should stay stable. The final memory usage should be close to the
initial memory usage.
Example with Python 2.6:
Initial memory:
VmRSS: 3176 kB
After call #1:
VmRSS: 4996 kB
After call #2... |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 opti... |
"""
Django settings for core project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... |
#!/usr/bin/python
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v2.1
# For more information, see the COPYING file in the top CxxTest directory.
#... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
import pandas as pd
import urllib2
from pprint import pprint
from matplotlib import pyplot as plt
from bs4 import BeautifulSoup
from hashlib import md5
import sys
sys.path.append('/Users/BenJohnson/projects/what-is-this/wit/')
from wit import *
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_column... |
#
# James Laska <jlaska@redhat.com>
#
# Copyright 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be useful... |
import logging, traceback
from time import sleep
from datetime import datetime, timedelta
import threading
from irc.bot import SingleServerIRCBot
class IrcBot(SingleServerIRCBot):
"""The module of the bot responsible for the Twitch (IRC) chat.
Listen to all pub messages and forward to the command... |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
#
# 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... |
##
# Copyright: Copyright (c) MOSEK ApS, Denmark. All rights reserved.
#
# File: sdo1.py
#
# Purpose:
# Solves the mixed semidefinite and conic quadratic optimization problem
#
# [2, 1, 0]
# minimize Tr [1, 2, 1] * X + x0
# [0, 1, 2]
#
# [1, 0, 0]... |
"""Decorators used when building a package of planterbox features to define
steps and hooks
Also some private functions used by those decorators.
"""
from functools import partial
import logging
import re
from six import (
string_types,
)
log = logging.getLogger('planterbox')
EXAMPLE_TO_FORMAT = re.compile(r'... |
# -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from hyde.model import Config, Expando
from fswrap import File, Folder
def test_expando_one_level():
d = {"a": 123, "b": "abc"}
x = Expando(d)
assert x.a == d['a']
assert x.b == d['b']
def test_expando_two_levels():
d = {... |
import unittest, datetime
import numpy as np
from engine.BackTest import MonteCarloModel, MonteCarloEngine, Simulation
import matplotlib.pyplot as plt
from matplotlib.dates import date2num, DateFormatter, DayLocator
from pandas import DataFrame
from numpy.random import standard_normal
from numpy import array, zeros, ... |
import os
import sys
import bpy
import importlib
from bpy.app.handlers import persistent
import arm.utils
import arm.props as props
import arm.make as make
import arm.make_state as state
import arm.api
@persistent
def on_depsgraph_update_post(self):
if state.proc_build != None:
return
# Recache
if... |
# coding=utf-8
# Copyright 2017 F5 Networks 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 ag... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2015 CERN.
#
# INSPIRE is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... |
import sys
sys.path.insert(0, "..")
import time
import logging
from opcua import Client
from opcua import ua
class SubHandler(object):
"""
Client to subscription. It will receive events from server
"""
def datachange_notification(self, node, val, data):
print("Python: New data change event"... |
"""Generic interface for least-squares minimization."""
from __future__ import division, print_function, absolute_import
from warnings import warn
import numpy as np
from numpy.linalg import norm
from scipy.sparse import issparse, csr_matrix
from scipy.sparse.linalg import LinearOperator
from scipy.optimize import _... |
"""
Usage instructions:
- If you are installing: `python setup.py install`
- If you are developing: `python setup.py sdist --format=zip bdist_wheel --universal bdist_wininst && twine check dist/*`
"""
import keyboard
from setuptools import setup
setup(
name='keyboard',
version=keyboard.version,
author='Bo... |
## 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
"""
Fields: basic data structures that make up parts of packets.
"""
import struct,copy,socket
from .config import conf
... |
import os
from sqlite3 import IntegrityError
from .friend_interest_manager import FriendInterestManager
from .friend_manager import FriendManager
from .friend_social_network_manager import FriendSocialNetworkManager
from .interest_manager import InterestManager
from .profile_photo_manager import ProfilePhotoManager
fr... |
# (c) Nelen & Schuurmans, see LICENSE.rst.
from ThreeDiToolbox.tool_commands.custom_command_base import CustomCommandBase
from ThreeDiToolbox.tool_commands.import_sufhyd.import_sufhyd_dialog import (
ImportSufhydDialogWidget,
)
from ThreeDiToolbox.tool_commands.import_sufhyd.import_sufhyd_main import Importer
from... |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
'''
Created on 10.03.2015
@author: micha
'''
import logging
import serial
import time
import MySQLdb as mdb
from util import formatData, description, sensor
# the main procedure
logging.basicConfig(format='%(asctime)s\t%(levelname)s\t%(message)s', level=logging.INFO... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 19:30:22 2015
@author: alex_
"""
# General Imports
import matplotlib as mpl
mpl.use('TkAgg') # Force mpl backend not to use qt. Else we have a conflict.
import numpy as np
#import pickle
import time
from datetime import datetime
#from collections import namedtuple
imp... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... |
# coding=utf-8
import subprocess
from imapclient import IMAPClient
HOST = 'mail.netzone.ch'
USERNAME = 'christian@wengert.ch'
PASSWORD = subprocess.check_output(["/usr/local/bin/pass", "mail/christian@wengert.ch"])
PASSWORD = PASSWORD.split()[0].decode('utf8')
KEYMAPPING = {}
ssl = True
class Signature():
pa... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module provides tools for finding local peaks in an astronomical
image.
"""
import warnings
from astropy.table import Table
import numpy as np
from ..utils.exceptions import NoDetectionsWarning
__all__ = ['find_peaks']
def find_peaks(data, t... |
from typing import Pattern
from collatex import *
from xml.dom import pulldom
import string
import re
import json
import glob
regexWhitespace = re.compile(r'\s+')
regexNonWhitespace = re.compile(r'\S+')
regexEmptyTag = re.compile(r'/>$')
regexBlankLine = re.compile(r'\n{2,}')
regexLeadingBlankLine = re.compile(r'^\n'... |
# Wuja - Google Calendar (tm) notifications for the GNOME desktop.
#
# Copyright (C) 2006 Devan Goodwin <dgoodwin@dangerouslyinc.com>
# Copyright (C) 2006 James Bowes <jbowes@dangerouslyinc.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.