src stringlengths 721 1.04M |
|---|
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
... |
# This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus
#
# MAUS 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.
# ... |
# Copyright 2021 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, ... |
#_ __
# | |/ /___ ___ _ __ ___ _ _ ®
# | ' </ -_) -_) '_ \/ -_) '_|
# |_|\_\___\___| .__/\___|_|
# |_|
#
# Keeper Commander
# Copyright 2018 Keeper Security Inc.
# Contact: ops@keepersecurity.com
#
import argparse
import collections
import re
import fnmatch
import shutil
import functools
import os
impor... |
# Copyright (C) 2015-2016 Bigstep Cloud Ltd.
#
# Author: Alexandru Sirbu <alexandru.sirbu@bigstep.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
import errno
import json
from cloudinit import log as logging
from cloudinit import sources
from cloudinit import url_helper
from cloudi... |
#!/usr/bin/python3
class TNode:
def __init__(self, children):
self.children = children
def is_leaf(self):
return self.children is None
def __repr__(self):
return repr(self.children)
class PaTrie:
def __init__(self):
self.root = None
def __contains__(self, word... |
"""
Migration script to create tables for adding explicit workflow outputs.
"""
from sqlalchemy import *
from sqlalchemy.orm import *
from migrate import *
from migrate.changeset import *
import logging
logging.basicConfig( level=logging.DEBUG )
log = logging.getLogger( __name__ )
# Need our custom types, but don't ... |
import unittest
import numpy as np
from kona.linalg.memory import KonaMemory
from dummy_solver import DummySolver
from kona.linalg.vectors.composite import ReducedKKTVector
class ReducedKKTVectorTestCase(unittest.TestCase):
def setUp(self):
solver = DummySolver(10, 0, 5)
self.km = km = KonaMemory... |
from gnr.pdf.gnrpdf import GnrPdf
from reportlab.lib.units import inch
def testPage(root):
for x in range(2):
page = root.page(x=1 * inch, y=1 * inch)
page.setFont("Helvetica", 9)
pane1 = page.pane(x_=1, y_=15)
pane2 = page.pane(x_=9, y_=9)
pane2.setFont("Helvetica", 12)
... |
#
# 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
# ... |
#Задача 10. Вариант 25
#Напишите программу "Генератор персонажей" для игры. Пользователю должно быть предоставлено 30 пунктов, которые можно распределить между четырьмя характеристиками: Сила, Здоровье, Мудрость и Ловкость. Надо сделать так, чтобы пользователь мог не только брать эти пункты из общего "пула", но и возвр... |
from django.conf import settings
from django.utils import translation
import jingo
from mock import Mock, patch
from nose.tools import eq_
import amo
import amo.tests
from mkt.translations import helpers
from mkt.translations.fields import save_signal
from mkt.translations.models import PurifiedTranslation
from mkt.t... |
#!/usr/bin/env python
klength = 8
startk = 9
endk = 25
querynum = 1000
theta = -1
patternId = '0'
import os
import sys
import time
import timeit
from optparse import OptionParser
WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../../")
read_file = WORKING_DIR + 'data/sample/read.fasta'
#read... |
import numpy as np
import matplotlib.pyplot as plt
import pdb
import os
import cPickle
import numpy as np
import shutil
from photom import photom_inspect, photom_reduce, photom_absolute, photom_relative, photom_checks, photom_optimise
homestr = os.path.expanduser( '~' )
class photom():
"""
"""
def __init_... |
# Quick and ugly script to echo something to a given IRC channel
# Alex Monk, 2014-07-22
from socket import socket, AF_INET, SOCK_STREAM
def ircecho(nick, channel, message, host = "chat.freenode.net", port = 6667):
s = socket(AF_INET, SOCK_STREAM)
s.connect((host, port))
f = s.makefile()
def readLineWithoutServe... |
"""This subpackage contains functionality for working with accounts elsewhere.
"""
from __future__ import division, print_function, unicode_literals
from collections import OrderedDict
from datetime import datetime
import hashlib
import json
import logging
from urllib import quote
from urlparse import urlparse, urlunp... |
from django.test import TestCase
from models import Contact, ContactType, ContactField
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User as DjangoUser
from anaf.core.models import Group, Perspective, ModuleSetting
def test_initial_data():
assert ContactType.objects.count() =... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
error_name = open("namefile.txt","a")
error_name.close()
list = {"jin":"123","tom":"456","jak":"789","aimi":"012"}
count = 0
status = False
while True:
user_name = input("请输入用户名:")
error_name = open("namefile.txt","r")
for name in error_name:
if user_name == name.strip():
status = True... |
import numpy as np
import as_classification.ann_models
import as_sound.features.extractFeatures as ef
import as_classification.utilities
import os
import matplotlib.pyplot as plt
# -------------------------------
# CREATE MODEL
# -------------------------------
model = as_classification.ann_models.ANN_5FCL()
model.i... |
import os
import sys
from zou.app.utils import events, api as api_utils
from flask import Blueprint
from .blueprints.assets import blueprint as assets_blueprint
from .blueprints.auth import blueprint as auth_blueprint
from .blueprints.breakdown import blueprint as breakdown_blueprint
from .blueprints.comments import... |
import json
from kolekto.printer import printer
from kolekto.commands import Command
from kolekto.helpers import get_hash
class Edit(Command):
""" Edit a movie.
"""
help = 'edit a movie'
def prepare(self):
self.add_arg('input', metavar='movie-hash-or-file')
def run(self, args, config)... |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# Parser for fxd files
# -----------------------------------------------------------------------
# $Id$
#
# Notes:
# Todo:
#
# -----------------------------------------------------------------------
# Freevo - A Home ... |
import hypothesisapi
from pycproject.readctree import CProject
import argparse
from SPARQLWrapper import SPARQLWrapper, JSON
def payload_builder(url, annotation_content, annotation_pre=None, annotation_exact=None, annotation_suffix=None):
if len(annotation_pre)>32:
annotation_pre=annotation_pre[-32:]
... |
"""Exception classes of WPS """
# Author: Jachym Cepicky
# http://les-ejk.cz
# Lince:
#
# Web Processing Service implementation
# Copyright (C) 2006 Jachym Cepicky
#
# 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
# th... |
'''
Fabric utilities for working with files.
'''
import StringIO
import contextlib
import os
import shutil
import subprocess
import uuid
from fabric.api import sudo, run, settings, hide, put, local
from fabric.contrib.files import exists
##################
# HELPER FUNCTIONS
# These functions are reusable snippets... |
from django import forms
from django.template.loader import render_to_string
__all__ = ('WYSIWYGWidget', )
class WYSIWYGWidget(forms.Textarea):
"""Custom bootstrap-wysiwyg widget."""
template_name = 'secure_input/widgets/full_wysiwyg.html'
def render(self, name, value, attrs=None):
"""Include a ... |
# Status: minor updates by Steven Watanabe to make gcc work
#
# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and ... |
from random import Random
from random import randint
import random, math
import collections
import operator
from FundingAgency import FundingAgency
from Academic import Academic
from Application import Application
class Population:
"""
A population of academic agents.
This class handles population level... |
from unittest import TestCase
from pfmisc.C_snode import C_stree
import pudb
class TestCSnode(TestCase):
def test_csnode_constructor(self):
aTree = C_stree()
bTree = C_stree()
ATree = C_stree()
aTree.cd('/')
aTree.mkcd('a')
aTree.mknode(['b', 'c'])
aTree.... |
import os
import sys
from random import randint
import numpy as np
import inspect
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from ut... |
#########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... |
from __future__ import unicode_literals
import logging
from oauthlib.common import generate_token, urldecode
from oauthlib.oauth2 import WebApplicationClient, InsecureTransportError
from oauthlib.oauth2 import TokenExpiredError, is_secure_transport
import requests
log = logging.getLogger(__name__)
class TokenUpdat... |
"""
Podi, a command-line interface for Kodi.
Copyright (C) 2015 Peter Frost <slimeypete@gmail.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 Foundation, either version 3 of the License... |
import os
import unittest
from dacets.utils import *
here = os.path.dirname(__file__)
def test_mkdir_p():
os.chdir(here)
p1 = 'test_mkdir_p'
assert os.path.isdir(p1) is False
p2 = os.path.join(p1, 'some', 'junk')
mkdir_p(p2)
assert os.path.isdir(p2) is True
os.removedirs(p2)
assert o... |
#!/usr/bin/env python2
"""Measure your perceptual threshold for tones using a staircase method"""
# GetPerceptualThreshold.py
# Created 12/16/14 by DJ based on JND_staircase_exp.py
from psychopy import core, visual, gui, data, event, sound
from psychopy.tools.filetools import fromFile, toFile
import time, numpy
# ===... |
# -*- coding: UTF-8 -*-
from behave.tag_matcher import ActiveTagMatcher, setup_active_tag_values
from behave.api.runtime_constraint import require_min_python_version
from behave import python_feature
# -----------------------------------------------------------------------------
# REQUIRE: python >= 3.4
# ----------... |
import modular4.base as mb
import modular4.mpi as mmpi
import os,sys,numpy,matplotlib,six
matplotlib.rcParams['backend.qt4'] = 'PySide'
matplotlib.rcParams['pdf.fonttype'] = 42
#matplotlib.use('Qt4Agg')
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as figure_canvas
from matplotlib.backend_bases impo... |
import urllib
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.http import Request
from scrapy.selector import HtmlXPathSelector
from scrapy import log
from w3lib.url import url_query_cleaner
from bs4 import UnicodeDammit
from os import path
from DevbitSpider.parsers.ITBanenParser import ITBanenParser
i... |
import socket
import select
import struct
class MCRconException(Exception):
pass
class MCRcon:
socket = None
def connect(self, host, port):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect((host, port))
def disconnect(self):
self.socket.close... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, re, csv
def update_pm_photodate(colorstyle):
import subprocess
update_url = 'http://dmzimage01.l3.bluefly.com:8080/photo/{0}'.format(colorstyle)
subprocess.call([
"curl",
'-d',
"sample_image=Y",
'-d',
"photographed_date=now"... |
# Copyright 2006-2013 by Peter Cock.
# Revisions copyright 2008-2009 by Michiel de Hoon.
# All rights reserved.
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Bio.SeqIO support for the "swiss" ... |
import re
import nltk.data
from nltk.stem import WordNetLemmatizer
def split_sentences(text, decorate=False):
sent_tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
sentences = sent_tokenizer.sentences_from_text(text, realign_boundaries=True)
if decorate:
sentences = [sent + ' <SE>' f... |
#!/usr/bin/env python3
# Copyright (c) 2014, Ruslan Baratov
# All rights reserved.
import argparse
import os
import stat
import subprocess
import sys
import detail.os
import detail.command
assert(sys.version_info.major == 3)
parser = argparse.ArgumentParser(description='Start windows cmd')
args = parser.parse_args... |
# -*- coding: utf-8 -*-
import 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 'UnitaMisura'
db.create_table(u'documento_unitamisura', (
(u'id', self.gf('django... |
# -*- coding: utf-8 -*-
import re
import time
from module.plugins.internal.Account import Account
from module.plugins.internal.Plugin import set_cookie
class Keep2ShareCc(Account):
__name__ = "Keep2ShareCc"
__type__ = "account"
__version__ = "0.10"
__status__ = "testing"
__description__ ... |
# This file is part of the mantidqt package
#
# Copyright (C) 2017 mantidproject
#
# 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) an... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Filename: test_input_handler.py
# Purpose: testing input_handler
# Author: Kasra Hosseini
# Email: kasra.hosseinizad@earth.ox.ac.uk
# License: GPLv3
# ----------------------------... |
from django.conf.urls import url
from . import views
app_name = 'pool'
urlpatterns = [
url(r'^transfer/(?P<pool_id>[0-9]+)/(?P<poolowner_id>[0-9]+)/(?P<poolgroup_id>[0-9]+)/(?P<groupowner_id>[0-9]+)/(?P<filter>[0-9]+)/(?P<modelstate>.*)/$', views.transfer.as_view(), name = 'transfer'),
url(r'^transfer/(?P<po... |
#!/usr/bin/env python
#summarize data in a tm3 file
import tm3
import string
import sys
import statistics
def summarizeOneFeature(tmDataList, columnName, intervals=50, outName="a.txt"):
'''takes that column, makes a histogram for each structure'''
outFile = open(outName, 'w')
columnNum = tmDataList[0].titleToC... |
import math
# Code converted from JS: http://latlong.mellifica.se/
axis = 6378137.0
flattening = 1.0 / 298.257222101
central_meridian = 15.00
lat_of_origin = 0.0
scale = 0.9996
false_northing = 0.0
false_easting = 500000.0
def grid_to_geodetic(x, y):
e2 = flattening * (2.0 - flattening)
n = flattening / (2... |
import json
import unittest
from anchore_engine.db import session_scope
from anchore_engine.subsys import identities
from anchore_engine.subsys.identities import AccountTypes, UserAccessCredentialTypes
from anchore_engine.subsys.auth.stores import basic as basic_accountstore
from yosai.core import UsernamePasswordToken... |
# 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... |
# wxClasses
# Copyright (C) 2013-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of wxClasses.
#
# wxClasses 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 Lice... |
from xd.build.core.recipe_file import *
from case import *
import unittest
import io
class tests(unittest.case.TestCase):
def test_split_no_version(self):
name, version = RecipeFile.split_name_and_version('foo')
self.assertEqual(name, 'foo')
self.assertEqual(str(version), '')
def tes... |
import math
import numpy as np
from dipy.core import wavelet
def adaptive_soft_matching(ima, fimau, fimao, sigma):
r"""Adaptive Soft Coefficient Matching
Combines two filtered 3D-images at different resolutions and the original
image. Returns the resulting combined image.
Parameters
----------
... |
# -*- coding: utf-8 -*-
from django.template import Context, Template
from django.utils.safestring import SafeData
from djangocms_helper.base_test import BaseTestCase
from tests.test_app.forms import SimpleTextForm
from tests.test_app.models import SimpleText
from djangocms_text_ckeditor.fields import HTMLFormField
... |
################################
# EvoMan FrameWork - V1.0 2016 #
# Author: Karine Miras #
# karine.smiras@gmail.com #
################################
import sys
import numpy
import struct
import binascii
import Base
from Base.SpriteConstants import *
from Base.SpriteDefinition import *
from sensors imp... |
#!/usr/bin/env python3
import glob
import os
os.system("mkdir -p _data")
os.chdir("_output")
folder_list = glob.glob("*.jnet")
# print(folder_list, len(folder_list))
# folder_list = ['T0759.jnet']
ssdata = "../_data/"
for protein in folder_list:
with open(protein) as input_data:
protein_name = protein.spli... |
# -*- coding: utf-8 -*-
from unittest.mock import patch, MagicMock
from eventkit_cloud.auth.models import OAuth
from eventkit_cloud.core.models import AttributeClass, update_all_attribute_classes_with_user, \
update_all_users_with_attribute_class, get_users_from_attribute_class, validate_user_attribute_class, \
... |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Bruno JJE
# Copyright (c) 2015 Bruno JJE
#
# License: MIT
#
"""This module exports the Checkpatch plugin class."""
from SublimeLinter.lint import Linter
class Checkpatch(Linter):
"""Provides an interface to l... |
# -*- coding: utf-8 -*-
# Copyright 2012, Nabil SEFRIOUI
#
# This file is part of Skyproc.
#
# Skyproc 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 any later ... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from .nexx import NexxIE
from ..compat import compat_urlparse
class Tele5IE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tele5\.de/(?:mediathek|tv)/(?P<id>[^?#&]+)'
_TESTS = [{
'url': 'https://www.tele5.de/mediathek/fi... |
# coding=utf-8
import unittest
"""282. Expression Add Operators
https://leetcode.com/problems/expression-add-operators/description/
Given a string that contains only digits `0-9` and a target value, return all
possibilities to add **binary** operators (not unary) `+`, `-`, or `*` between
the digits so they evaluate t... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/python
# coding: utf-8
# Copyright (C) 2010 Lucas Alvares Gomes <lucasagomes@gmail.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 Foundation; either version 2 of the License, or
# (at you... |
import matplotlib.pyplot as plt
import numpy
import random
random.seed(0)
T = 100000
N = 1000
Ne = int(N * 0.8)
Ni = N - Ne
M = int(N * 0.1)
D = 20
a = numpy.concatenate((
0.02 * numpy.ones(Ne),
0.1 * numpy.ones(Ni)
))
d = numpy.concatenate((
8 * numpy.ones(Ne),
2 * numpy.ones(Ni)
))
# generate pos... |
from ert.cwrap import BaseCClass, CWrapper
from ert.enkf import ENKF_LIB
from ert.util import Matrix
class PcaPlotVector(BaseCClass):
def __init__(self, component, principal_component_matrix, observation_principal_component_matrix):
assert isinstance(component, int)
assert isinstance(principal_co... |
#coding=utf-8
import os
import re
from six import PY2
from starterpyth.log import display, RED
from starterpyth.translation import ugettext as _
__author__ = 'flanker'
# noinspection PyUnresolvedReferences
input_ = raw_input if PY2 else input
class InvalidValue(ValueError):
def __init__(self, msg):
... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import base64
import hmac
import hashlib
import urllib
import xml.etree.cElementTree as ET
from datetime import datetime
import time
import dateutil.parser
import logging
from twisted.internet.defer import DeferredList
from ..requestqueuer import RequestQueuer
from .lib import etree_to_dict, safe_quote_tuple
LOGGER =... |
########################################################################
# $HeadURL$
########################################################################
""" ClassAd Class - a light purely Python representation of the
Condor ClassAd library.
"""
__RCSID__ = "$Id$"
class ClassAd:
def __init__( self, jdl ):... |
# 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
# not use this file except in compliance with the License. You may obtain
# a copy of t... |
"""A base class for databases to inherit from."""
class Database():
"""A base database.
Database classes are used to persist key/value pairs in a database.
"""
def __init__(self, config):
"""Create the database.
Set some basic properties from the database config such as the name
... |
"""
Courseware views functions
"""
import json
import logging
from collections import OrderedDict, namedtuple
from datetime import datetime
import bleach
import requests
import six
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Anonym... |
# 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 th... |
from model.contact import Contact
class ContactHelper:
def __init__(self, app):
self.app = app
def back_to_homepage(self):
wd = self.app.wd
if not len(wd.find_elements_by_name("Send e-Mail")) > 0:
wd.find_element_by_link_text("home").click()
def proceed_to_newuser_page... |
#-*- python -*-
import logging
# Non-stdlib imports
from pylons import c
from ming.utils import LazyProperty
from ming.orm.ormsession import ThreadLocalORMSession
# Pyforge-specific imports
import allura.tasks
from allura.lib import helpers as h
from allura import model as M
from allura.controllers.repository import... |
# (c) Copyright 2014 Brocade Communications Systems Inc.
# All Rights Reserved.
#
# Copyright 2014 OpenStack Foundation
#
# 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
#
# ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# -*- coding: utf-8 -*-
import os.path
import importlib.util
from importlib.machinery import SourceFileLoader
# 同梱プラグインの相対パッケージ名
_PLUGIN_PACKAGE = "plugins"
class PluginLoadError(Exception): pass
class Plugin:
def __init__(self, identifier, args, org, size):
# identifier はパス名もしくは同梱プラグイン名
# まず... |
"""Tests for singly-linked list."""
import pytest
def test_node_attributes():
"""Test that node object has expected attributes."""
from linked_list import Node
n = Node('test')
assert n.data == 'test' and n.next_node is None
def test_list_push():
"""Test that linked_list has node pushed to it.""... |
# System information:
# - Linux Mint 18.1 Cinnamon 64-bit
# - Python 2.7 with OpenCV 3.2.0
import numpy
import cv2
from cv2 import aruco
import pickle
import glob
# ChAruco board variables
CHARUCOBOARD_ROWCOUNT = 7
CHARUCOBOARD_COLCOUNT = 5
ARUCO_DICT = aruco.Dictionary_get(aruco.DICT_5X5_1000)
# Create constants ... |
#!/usr/bin/env python3
"""Test helper for the Mbed TLS configuration file tool
Run config.py with various parameters and write the results to files.
This is a harness to help regression testing, not a functional tester.
Sample usage:
test_config_script.py -d old
## Modify config.py and/or mbedtls_config.h #... |
from lda2vec import topics
import numpy as np
def exp_entropy(log_p):
return -np.nansum(np.exp(log_p + 1e-12) * (log_p + 1e-12))
def test_prob_words():
context = np.random.randn(3)
vocab = np.random.randn(10, 3)
lo = topics.prob_words(context, vocab, temperature=1)
hi = topics.prob_words(contex... |
"""Support for tracking people."""
from collections import OrderedDict
from itertools import chain
import logging
from typing import Optional
import uuid
import voluptuous as vol
from homeassistant.auth import EVENT_USER_REMOVED
from homeassistant.components import websocket_api
from homeassistant.components.device_t... |
__source__ = 'https://leetcode.com/problems/buddy-strings/'
# Time: O(N) where NN is the length of A and B
# Space: O(1)
#
# Description: Leetcode # 859. Buddy Strings
#
# Given two strings A and B of lowercase letters,
# return true if and only if we can swap two letters in A so that the result equals B.
#
# Example ... |
from evaluation.python_evaluator import Evaluator
from helpers.read_conll_files import ConllReader
class ExperimentRunner:
learner = None
train_file_iterator = None
kb_prefix = None
max_elements_to_read = None
def __init__(self, disambiguation=None, score_transform=None):
self.kb_prefix ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'editordialog.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Editor(object):
def setupUi(self, Editor):
Editor.setOb... |
"""run diffusion equation to determine selectivity of fluophore,
i.e current and release time series for specific molecule."""
from nanopores.tools.fields import cache
import nanopores
import dolfin
import matplotlib.pyplot as plt
from nanopores.physics.convdiff import ConvectionDiffusion
import forcefields
from eikona... |
# -------------------- #
# PMPage.py
#
# Defines the PMPage class, which is a wrapper around wx.Panel that contains a
# wx.stc.StyledTextCtrl.
# -------------------- #
# -------------------- #
# Imports
# -------------------- #
import wx
import wx.stc
import os
import pmconfig
# -------------------- #
# Class PMPage
... |
# Copyright 2014 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 boto3
class Cfg:
ec2 = None
cfg = Cfg()
class check_profile(object):
def __init__(self, f):
self.f = f
def __call__(self, *args):
if cfg.ec2 is None:
print("Please set up profile: e24 or aws")
return
self.f(*args)
def set_default_profile(par... |
# Django settings for autodata project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Insert your TEMPLATE_CONTEXT_PR... |
#
# Copyright (c) SAS Institute 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 w... |
from itertools import product
import math
from numbers import Integral, Number
from operator import add, getitem, itemgetter
import warnings
import functools
import bisect
import numpy as np
from tlz import memoize, merge, pluck, concat, accumulate
from .. import core
from .. import config
from .. import utils
from .... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
import sys
n=[10,20,30]
name = sys.argv[1]
print name
if len(sys.argv) > 2 :
n = sys.argv[2]
fig, (axchi, axbeta) = plt.subplots(1,2)
plt.subplots_adjust(bottom=0.30)
gamma0 = 7./4.
nu0 = 1.0
betac0 = 1/... |
import codecs
import os
import sys
from distutils.util import convert_path
from fnmatch import fnmatchcase
from setuptools import setup, find_packages
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
# Provided as an attribute, so you can append to these instead
# of r... |
from fabric.api import *
from fabric.contrib.files import *
from fabric.contrib.project import rsync_project
from subprocess import check_output
env.use_ssh_config = True
env.user = 'ubuntu'
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
HOME_DIR = '/home/ubuntu'
DEPLOY_PATH = '%s/cabot' % HOME_DIR
LOG_DIR =... |
"""
Test script. Run Fourier decomposition on a 2D image and see what we get.
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import misc
import BasicFunctions as bf
import Sketching as sketch
# Parameters.
IMAGE_PATH = "../../data/"
IMAGE_NAME = "lenna.png"
SIZE = (50, 50)
K = (SIZE[0]*SIZE[1]*0.7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.