src stringlengths 721 1.04M |
|---|
#
# Disk initialization module.
#
# Copyright (C) 2018 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, or (at your option) any later version.
# This program is distribu... |
#!/usr/bin/python
import serial
import time
import random
import sys
s = None
num_leds = 93
play_time = 0.0
def flush_input():
s.flushInput()
def wait_for_ack():
while s.inWaiting() <= 0:
pass ... |
# coding: utf-8
"""
* 支付宝接口公用函数 python版本
* 详细:该类是请求、通知返回两个文件所调用的公用函数核心处理文件
* 版本:1.0
* 日期:2012-07-19(官方)本接口写于2017年新春
* 说明:
"""
import json
import sys
import types
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA
from base64 import b64encode,b64decode
from urllib... |
from django.test import TestCase
from weather.models import *
# Create your tests here.
class TestWeather(TestCase):
def setUp(self):
from weather.api_config import query_by_areaid
self.city = CityInfo(areaid='101010100',
nameen='beijing', namecn='北京',
... |
new_year = 2014
input_file = '../csv/popgdp2014.csv'
import sys
sys.path.append('../../www-srv/src')
from maplex.maplexmodel import MaplexModel
mm = MaplexModel()
import csv
with open(input_file, 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
sql = ""
for row in ... |
# Copyright (c) 2012 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
# list of conditions and ... |
# -*- coding: utf-8 -*-
#
# The contents of this file are automatically written by
# tools/generate_schema_wrapper.py. Do not modify directly.
from . import core
from altair.utils import use_signature
from altair.utils.schemapi import Undefined
class MarkMethodMixin(object):
"""A mixin class that defines mark met... |
import time
from selenium.common.exceptions import (
StaleElementReferenceException,
TimeoutException)
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
TIMEOUT_IN_S = 30
DEFAULT_IMPLICIT_WAIT_... |
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from . import util
from inferlib import jwlib
MODULE_NAME = __name__
MODULE_DESCRIPTION = '''Run analysis of code b... |
"""
Functions used for formating header file.
"""
def remove_duplicates(seq):
"""
Removes duplicates from a list.
This is the fastest solution, source:
http://www.peterbe.com/plog/uniqifiers-benchmark
Input arguments:
seq -- list from which we are removing duplicates
Output:
... |
#
# Copyright (C) 2013 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, or (at your option) any later version.
# This program is distributed in the hope that it will be... |
#!/usr/bin/env python
# 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 or ... |
from flask.app import Flask
from webassets.test import TempEnvironmentHelper as BaseTempEnvironmentHelper
from flask_assets import Environment
try:
from flask import Blueprint
Module = None
except ImportError:
# Blueprints only available starting with 0.7,
# fall back to old Modules otherwise.
Blue... |
'''
@author: Edwin Simpson
'''
import sys, logging
import numpy as np
from copy import deepcopy
from scipy.sparse import coo_matrix, csr_matrix
from scipy.special import psi, gammaln
from ibccdata import DataHandler
from scipy.optimize import fmin, fmin_cobyla
from scipy.stats import gamma
class IBCC(object):
# Print ... |
#------------------------------------------------------------------------------
#
# Copyright (c) 2009, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of NSUChat, the Not So Unsafe Chat.
#
# Copyright (©) 2014 Marcel Ribeiro Dantas
#
# <mribeirodantas at fedoraproject.org>
#
# NSUChat is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# publi... |
import logging
import simplejson as json # simplejson supports Decimal serialization
from django.contrib import admin
from django.template.defaultfilters import truncatechars, truncatewords
from django.utils.safestring import mark_safe
from .models import SearchQuery
logger = logging.getLogger(__name__)
def pprin... |
# Copyright 2012 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... |
"""
The I_wedge measure, as proposed by Griffith et al.
"""
from __future__ import division
from .pid import BasePID
from .. import Distribution
from ..algorithms import insert_meet
from ..multivariate import coinformation
class PID_GK(BasePID):
"""
The Griffith et al partial information decomposition.
... |
__author__ = 'tbri'
from openerp import fields, models, api, _
import logging
_logger = logging.getLogger(__name__)
class request_relevant_suppliers(models.TransientModel):
_name = "requisition_suppliers"
_description = "Purchase Requisition Suppliers"
def _get_active_id(self):
return self.env.co... |
#!/usr/bin/env python
# (C) Copyright 2017 Inova Development 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
#
# ... |
# Copyright 2018 TVB-HPC contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under... |
"""802.1x implementation for FAUCET."""
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under t... |
# Copyright (c) 2016 b<>com
#
# 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, softw... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Starts a Pelix framework and installs the Spell Checker bundles
"""
# Pelix framework module and utility methods
import pelix.framework
from pelix.utilities import use_service
# Standard library
import logging
def main():
"""
Starts a Pelix framework and... |
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable-msg=W0402,W0231,W0141,R0903,C0321,W0701,R0904,C0103
# pylint: disable-msg=W0201,W0102,R0913,W0622,E1101,C0111,C0121,R0901
# DAV client library
#
# Copyright (C) 1998-2000 Guido van Rossum. All Rights Reserved.
# Written by Greg Stein. Given to Guido. Lice... |
import xconfig
class ConfigBase(xconfig.Config):
def set_default(self):
# proxy
self.set_var("PROXY_ENABLE", 0)
self.set_var("PROXY_TYPE", "HTTP")
self.set_var("PROXY_HOST", "")
self.set_var("PROXY_PORT", 0)
self.set_var("PROXY_USER", "")
self.set_var("PROX... |
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
data = pd.read_csv(os.path.join(os.path.dirname(__file__), 'benchmarks.csv')).sort_values('mean')
def grouped_barplot(df, cat, subcat, val, err, subcats=None, **kwargs):
# based on https://stackoverflow.com/a/42033734
categori... |
from quex.engine.analyzer.commands.core import CommandList, \
IfPreContextSetPositionAndGoto
def get_CommandList(TheAccepter, TheTerminalRouter):
"""If there is no stored acceptance involved, then one can directly
conclude from the pre-contexts to the acceptan... |
# -*- coding: utf-8 -*-
# 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 agr... |
"""
Search Engine
by Vincent Jeanselme
and Matthieu Clin
vincent.jeanselme@gmail.com
"""
import re
from collections import Counter
from IndexManip.AbstractIndexManip import abstractIndexReader, abstractIndexWriter
import Utils.WordProcessing as wp
class textIndexReader(abstractIndexReader):
"""
Reads texts inde... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.12.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\xc5\xf8\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x01\xdb\x... |
# Copyright 2008-2018 Luc Saffre
# License: BSD (see file COPYING for details)
"""Adds functionality for managing notification messages.
See :doc:`/specs/notify`.
"""
from lino.api import ad, _
try:
import redis
except:
redis = False
class Plugin(ad.Plugin):
"See :class:`lino.core.plugin.Plugin`."
... |
from flask import current_app
from flask import request
from functools import wraps
from werkzeug import LocalProxy
from werkzeug.exceptions import Forbidden
class Allows(object):
def __init__(self, app=None, identity_loader=None,
throws=Forbidden, on_fail=None):
self._identity_loader = ... |
import asyncio
import logging
from duniterpy.documents import BlockUID
from mirage import Node, User
async def example(lp):
node = await Node.start(4444, "testnet", "12356", "123456", lp)
alice = User.create("testnet", "alice", "alicesalt", "alicepassword", BlockUID.empty())
bob = User.create("testnet", "b... |
"""Main application module."""
import glob
import importlib
import itertools
import os
from functools import lru_cache
from celery import Celery
from flask import Flask
from flask_click_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from raven.contrib.flask import Sentry
from sqlalchemy import MetaData... |
import os
from flask import Flask, render_template, request
import luigi
from luigi.contrib.gcs import GCSTarget, GCSClient
import subprocess
from merge_video import MergeVideoAndAudio
app = Flask(__name__)
@app.route('/')
def hello_world():
target = os.environ.get('TARGET', 'World')
return 'Hello {}!\n'.fo... |
import time, ev3dev
def run_for(motor, power=75, ever=None, seconds=None, degrees=None):
""" Run motor for specified amount of seconds, degrees, or forever
Examples:
run_for(motor, ever=True)
run_for(motor, seconds=0.5)
run_for(motor, degrees=270, power=100)
Power is specified in percents in ... |
from __future__ import unicode_literals
from ckeditor.fields import RichTextField
from filer.fields.image import FilerImageField
from cms.models import CMSPlugin, PlaceholderField
from django.utils.translation import ugettext_lazy as _
from django.db import models
class Project(models.Model):
name = models.Char... |
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
from .digitalbitbox import DigitalBitboxPlugin
from electrum.i18n import _
from electrum.plugins import hook
from electrum.wallet import Standard_Wallet
class Plugin(DigitalBitboxPlugin, QtPluginBase):
icon_unpaired = ":icons/digitalbitbox_unpaired.png"
... |
# Copyright (C) 2012-2015 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or dist... |
import unittest
from datetime import datetime
from uploads.models import Document
from uploads.DocketXML import DocketXML
from uploads import DocumentManager
#TODO: This doesn't test the entirety of documentmanager
class TestDocumentManager(unittest.TestCase):
def setUp(self):
self.doc_xml = DocketXML('ny... |
import re
from collections import defaultdict
import pkg_resources
import sqlalchemy as sa
from sqlalchemy import Column, exc, inspect, schema
from sqlalchemy.dialects.postgresql.base import PGCompiler, PGDDLCompiler
from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2
from sqlalchemy.engine import r... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# compareColors.py
#
# Copyright 2013 Greg Green <greg@greg-UX31A>
#
# 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 ... |
from __future__ import absolute_import
import pickle
import sys
from .py2mass import set_2mass_path, fetch_2mass_xsc_box, fetch_2mass_psc_box, __version__
def main():
show_help = False
if len(sys.argv) == 1 or "help" in sys.argv:
show_help = True
else:
if sys.argv[1] == 'psc':
... |
#! /usr/bin/env python
# ==========================================================================
# Perform SRCLIX model fitting of COMPTEL observations
#
# Copyright (C) 2021 Juergen Knoedlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... |
#!/usr/bin/python
# Copyright 2016 Vegard Knutsen Lillevoll
#
# Follow this project at https://github.com/vegardli/PyBitica.txt
#
# 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 ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# <pep8-80 compliant>
# .. todo:: global config? But then I wouldn't need this script. ;)
# .. todo:: GUI for name selection? list of previously used name+mail pairs? -> could use pick module...
import re
import sys
import argparse
import textwrap
import subprocess
def... |
# -*- 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):
# Changing field 'Feed.feed_url'
db.alter_column(u'feedzilla_feed', 'feed_url', self.gf('django.db.models.f... |
'''
Created on 9 mai 2014
@author: Francois Belletti
'''
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from surrogate.Markov_model import Markov_model
from HMM_algos import Proba_computer
initial = [0.1, 0.1, 0.1]
A = [[0.3, 0.5, 0.3], [0.3, 0.3, 0.5], [0.5, 0.3, 0.3]]
alphabet = ... |
# encoding: 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 field 'HaikuModel.full_text'
db.add_column('django_haikus_haikumodel', 'full_text', self.gf('djan... |
import json
from urllib.parse import quote_plus
from typing import Union
import discord
from discord.ext import commands
from utils import aiohttp_wrap as aw
from utils import dict_manip as dm
from utils.user_funcs import PGDB
class OSRS(commands.Cog):
def __init__(self, bot):
self.bot = bot
sel... |
"""
Conditions for sending alert emails for HAProxy Monitor
A condition is a callable that takes a ProxyStats object and
returns an error string or None for success
"""
from datetime import datetime
__copyright__ = '2013, Room 77, Inc.'
__author__ = 'Kyle Konrad <kyle@room77.com>'
def more_than_n_down(n):
"""
A... |
import os
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
# Classes that can undo reading data from
# a given type of data source.
class Unreader(object):
def __init__(self):
self.buf = StringIO()
def chunk(self):
raise NotImplementedError()... |
import os
import re
import shutil
import json
import time
import sys
import sqlite3
import gevent.event
from Db import Db
from Debug import Debug
from Config import config
from util import helper
from Plugin import PluginManager
@PluginManager.acceptPlugins
class SiteStorage(object):
def __init__(self, site, al... |
# An actor that includes a SampleCollection, to process
# multiple samples possibly having multiple replicates each.
import os.path
from Actor import Actor
from Logger import Logger
# Main class
class MultiSampleActor(Actor):
sc = None # SampleCollection
libpath = "/apps/dibig_tools/1.0/lib... |
import os
import requests
import zipfile
import click
import io
import airpy
import simplejson as json
from airpy import utils
def install_metadata(name):
directory = airpy.data_directory + '/' + name
metadata_response = requests.get('https://pypi.python.org/pypi/'+ name + '/json')
if metadata_response.status_cod... |
#!/bin/sh
''''[ -z $LOG ] && export LOG=/dev/stdout # '''
''''which python2 >/dev/null && exec python2 -u "$0" "$@" >> $LOG 2>&1 # '''
''''which python >/dev/null && exec python -u "$0" "$@" >> $LOG 2>&1 # '''
# Copyright (C) 2014-2015 Nginx, Inc.
# Copyright (C) 2018 LinuxServer.io
import sys, os, signal, base64, ... |
# Copyright (c) 2010 John Reese
# Licensed under the MIT license
import os
from os import path
from fnmatch import fnmatch
import filecmp
import hashlib
from platform import system
import tempfile
from combine import Config, Manifest, Package, File
from combine.hash import sha1
from combine.formats import extension... |
#=======================================================================
__version__ = '''0.0.01'''
__sub_version__ = '''20070108034250'''
__copyright__ = '''(c) Alex A. Naanou 2003'''
#-----------------------------------------------------------------------
import pli.pattern.mixin.mapping as mapping
#-----------... |
#!/usr/bin/env python
# base_connector.py
#
"""
Copyright (c) 2017 World Wide Technology, Inc.
All rights reserved.
author: Joel W. King, World Wide Technology
Revision history:
- 16 February 2017 | 1.0 | Initial release
"""
import json
class BaseConnector(object):
""" This mimics ... |
#!/usr/bin/env python
# encoding=utf8
# The gevent test client
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import gevent
from gevent import monkey
monkey.patch_all()
from haigha.connections.rabbit_connection import RabbitConnection
from haigha.message import Message
class Client(object):
"""The RPC Cl... |
import chainer.functions as F
import chainer.links as L
from chainer import Variable
from chainer.links import caffe
from chainer import computational_graph as c
from deel.tensor import *
from deel.network import *
import chainer.serializers as cs
import copy
from deel.deel import *
import chainer
import json
import o... |
# encoding: UTF-8
# 默认空值
EMPTY_STRING = ''
EMPTY_LIST = []
EMPTY_DICT = {}
EMPTY_UNICODE = u''
EMPTY_INT = 0
EMPTY_FLOAT = 0.0
# 方向常量
DIRECTION_NONE = u'无方向'
DIRECTION_LONG = u'多'
DIRECTION_SHORT = u'空'
DIRECTION_UNKNOWN = u'未知'
DIRECTION_NET = u'净'
DIRECTION_SELL = u'卖出' # IB接口
# 开平常量
OFFSET_NONE = u'无开平'
OFFS... |
# Licensed under The MIT License.
# For full copyright and license information, please see the LICENSE.txt.
import os
os.environ["CONF_DIR"] = os.path.join(
os.path.dirname(os.path.realpath(__file__))
, ".."
, ".."
, "etc"
)
from cvidone import settings
from cvidone.model.user import User
from cvidone.model... |
from Service import Service
from Graph import Graph, Node
# The maximum number of texts or images for each user.
# This is to prevent the server from over-loading.
MAX_DOC_NUM_PER_USER = 30 # non-negative inetegr
# Train or load the query classifier.
# If you set it to 'load', it is assumed that
# models are already ... |
#!/usr/bin/python3
# Halide tutorial lesson 12.
# This lesson demonstrates how to use Halide to run code on a GPU.
# This lesson can be built by invoking the command:
# make tutorial_lesson_12_using_the_gpu
# in a shell with the current directory at the top of the halide source tree.
# Otherwise, see the platform... |
from sfepy.base.testing import TestCommon
##
# 16.07.2007, c
class Test( TestCommon ):
##
# 16.07.2007, c
def from_conf( conf, options ):
return Test( conf = conf, options = options )
from_conf = staticmethod( from_conf )
##
# c: 16.07.2007, r: 08.07.2008
def test_parse_equations(... |
# The contents of this file are 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, softw... |
"""scons.Node.Alias
Alias nodes.
This creates a hash of global Aliases (dummy targets).
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associat... |
# -*- 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):
# Deleting field 'SiteConfig.navi_link_color'
db.delete_column(u'public_project_siteconfig', 'navi_link_colo... |
import interleaving as il
from interleaving import TeamRanking
import json
from .test_methods import TestMethods
class TestTeamDraft(TestMethods):
def test_interleave(self):
self.interleave(il.TeamDraft, [[1, 2], [2, 3]], 2, [(1, 2), (2, 1)])
self.interleave(il.TeamDraft, [[1, 2], [2, 3]], 3, [(1,... |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... |
'''
Created on Dec 11, 2011
@author: robertsj
'''
from evaluator import Evaluator
import numpy as np
import os
class Laban(Evaluator):
""" Uses the LABAN-PEL code to evaluate loading patterns.
"""
# Public Interface
def __init__(self, rank=0) :
""" Constructor
Parameter... |
import os
from sqlite3 import connect
import codecs
import math
from datetime import datetime, timedelta
from dateutil.parser import parse
from glob import glob
class Report(object):
def __init__(self, filename=None):
if filename:
with codecs.open(filename, "r", "utf-8") as f:
... |
# Copyright 2018 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... |
import math
def test(dials_data):
from dxtbx.model.experiment_list import ExperimentList, ExperimentListFactory
exlist = ExperimentListFactory.from_json_file(
dials_data("centroid_test_data").join("fake_long_experiments.json").strpath
)
assert len(exlist) == 1
experiment = exlist[0]
... |
import numpy as np
import pyterpol
def load_observations(f):
"""
:param f: file
:return:
"""
# load the observations
flist = np.loadtxt(f, usecols=[0], unpack=True, dtype=str)
hjd = np.loadtxt(f, usecols=[1], unpack=True).tolist()
hjd[0] = None
# create list of observations
ob... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
#
##################################################################################
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ... |
from multiprocessing import Queue
import multiprocessing, os, pickle, select, socket, sys, time, rsa, traceback
from common.safeprint import safeprint
from common.bounty import *
global ext_port
global ext_ip
global port
global myPriv
global myPub
global propQueue
ext_port = -1
ext_ip = ""
port = 44565
myPub, myPriv =... |
from rspecs.parser_base import ParserBase
from rspecs.commons_se import SELink
from rspecs.commons_tn import Node, Interface
import core
logger = core.log.getLogger("utility-rspec")
class SERMv3RequestParser(ParserBase):
def __init__(self, from_file=None, from_string=None):
super(SERMv3RequestParser, sel... |
"""Numeric derivative of data coming from a source sensor over time."""
from decimal import Decimal, DecimalException
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
CONF_SOURCE,
... |
"""Utilities to override default configurations."""
from collections import defaultdict as _defaultdict
from typing import Iterable as _Iterable
def _plant_trie(strings: _Iterable[str]) -> dict:
"""Create a Trie out of a list of words and return an atomic regex pattern.
The corresponding Regex should match... |
"""Functions for manipulating Shapely geometry objects
References:
- http://toblerity.org/shapely/manual.html
"""
from collections import Iterable
from functools import reduce
from itertools import chain
from typing import Callable
import numpy as np
import shapely.geometry as geometry
import skimage.draw
from sh... |
# -*- coding: utf-8 -*-
from django import forms
from django.core.exceptions import ImproperlyConfigured
from django.db.models import fields
from wagtail.wagtailcore.fields import StreamField
from django.utils import six
from wagtail_modeltranslation import settings as mt_settings
from wagtail_modeltranslation.utils i... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
"""
Deploy this project in dev/stage/production.
Requires commander_ which is installed on the systems that need it.
.. _commander: https://github.com/oremj/commander
This script is supposed to work in Python 2.6.
The only outside dependency is `virtualenv-2.7`.
"""
import os
import sys
sys.path.append(os.path.dir... |
#!/usr/bin/env python2
'''
Tool to manage building of various useful things, such as libc, libc++, native optimizer, as well as fetch and build ports like zlib and sdl2
'''
import os, sys
import tools.shared as shared
if len(sys.argv) < 2 or sys.argv[1] in ['-v', '-help', '--help', '-?', '?']:
print '''
Emscripten... |
'''This is a simple class for interfacing an Adafruit serial LCD with a pyboard.'''
import pyb
#define our LCD commands
LCD_COMMAND = 0xFE
DISPLAY_ON = 0x42
DISPLAY_OFF = 0x46
SET_BRIGHTNESS = 0x99
SET_SAVE_BRIGHTNESS = 0x98
SET_CONTRAST = 0x50... |
# Time: put: O(1)
# retrieve: O(n + dlogd), n is the size of the total logs
# , d is the size of the found logs
# Space: O(n)
class LogSystem(object):
def __init__(self):
self.__logs = []
self.__granularity = {'Year': 4, 'Month': 7, 'Day': 10, \
... |
#!/usr/bin/env python
#
##############################
# CDMI shell version: 0.1.0 #
##############################
#
# Copyright 2012 Mezeo Software
#
# 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... |
import glob
import pandas as pd
import numpy as np
df1 = pd.read_csv("repeats_hg19.csv")
RRBS_files = glob.glob("RRBS*")
df_dict = {group : df for group, df in df1.groupby(by="chr")}
# In[11]:
from numpy import nan
def between_range(row, group_dict):
# get sub dataframe from dictionary, if key not found ret... |
#!/usr/bin/env python
# vim: set expandtab sw=4 ts=4:
'''
Generates a trend (graph) from the buildtimes in buildtimes.xml
Usage : generate_trend.py -h --mode=native,keen
Copyright (C) 2014 Dieter Adriaenssens <ruleant@users.sourceforge.net>
This file is part of buildtime-trend
<https://github.com/ruleant/buildtime-t... |
import os
import utils
import config
import traceback
import logging.config
from luna import LunaExcepion
logging.config.fileConfig("logging.conf")
logger = logging.getLogger()
if __name__ == '__main__':
try:
logger.info("------ start ------")
utils.lock()
from keras.applications.vgg16... |
# Copyright (c) 2016 Tencent Inc.
# All rights reserved.
#
# Author: Li Wenting <wentingli@tencent.com>
# Date: June 2, 2016
"""
This module defines sh_test target which executes a shell script.
"""
import os
import blade
import build_rules
import console
from blade_util import var_to_list
from blade_util import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.