text stringlengths 12 6.59M |
|---|
# coding: utf-8
import bisect
from collections import defaultdict, deque
import json
import math
import os
import time
import unittest
import uuid
import zlib
import redis
QUIT = False
pipe = inv = item = buyer = seller = inventory = None
# 代码清单 6-1
# <start id="_1314_14473_8380"/>
def add_update_contact(conn, use... |
import logging
import copy
import ibmsecurity.utilities.tools
logger = logging.getLogger(__name__)
uri = "/isam/cluster/v2"
requires_modules = None
requires_version = None
def get(isamAppliance, check_mode=False, force=False):
"""
Retrieve the current cluster configuration
"""
return isamAppliance.i... |
from itertools import combinations
__author__ = "\n".join(['Ben Edwards (bedwards@cs.unm.edu)',
'Huston Hedinger (h@graphalchemist.com)',
'Dan Schult (dschult@colgate.edu)'])
__all__ = ['dispersion']
def dispersion(G, u=None, v=None, normalized=True, alpha=1.0, b=0.0,... |
from __future__ import print_function, unicode_literals
from email.utils import formatdate
from multiprocessing.dummy import Pool as ThreadPool
from time import time
from django.conf import settings
from django.core.cache import cache
from django.core.management import BaseCommand, CommandError
import babis
import b... |
"""Base models."""
import os
from django.db import models
from django.utils.text import slugify
from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator
from django.core.urlresolvers import reverse
from jinja2 import Template
from jinja2.runtime import Context
from django.conf ... |
"""
Django settings for yapdns project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... |
from __future__ import division
# pylint: disable-msg=W0402
import re
import string
import sys
import tempfile
import warnings
import os
import subprocess
import locale
import traceback
from datetime import datetime
from functools import wraps
from contextlib import contextmanager
from numpy.random import randn, ran... |
# Copyright 2019 Omar Castiñeira, Comunitea Servicios Tecnológicos S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models, exceptions, _, api
import re
class ProductProduct(models.Model):
_inherit = "product.product"
tariff = fields.Float('Tariff', related="pro... |
import re
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats.kde import gaussian_kde
import chainplot.core.style as plot_style
# NOTES
# Need to think about how flexible vs just personal use/convenience?
# For some level of flexibility it'll make more sense just to start from scratch w/ graphics ... |
"""
Allow Panflute to be run as a command line executable
to be used as a Pandoc filter or used in Pandoctools
shell scripts as Pandoc filter with arguments.
Exports ``main`` and ``panfl``.
"""
import os
import os.path as p
import sys
import click
import re
from .io import load, dump
from .tools import debug
from .u... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import re
import six
import requests
from chandl import util
from chandl.model.posts import Posts
from chandl.model.post import Post
logger = logging.getLogger(__name__)
@six.python_2_unicode_compatible
class Thread:
"""
Repres... |
import os.path
from astropy.utils import data
from astroplan import download_IERS_A
def download_all_files():
download_IERS_A()
for i in range(4214, 4219):
fn = 'index-{}.fits'.format(i)
data_folder = "/var/panoptes/astrometry/data"
dest = "{}/{}".format(data_folder, fn)
if n... |
import copy
from django.apps import apps
from django.conf import settings
from ..sessions import session_for_reply_channel
from .base import Client
class HttpClient(Client):
"""
Channel http/ws client abstraction that provides easy methods for testing full live cycle of message in channels
with determi... |
import logging
import asyncio
from collections import OrderedDict
from .utils import parse_agi_result
log = logging.getLogger(__name__)
class Request:
def __init__(self, app, headers, reader, writer, encoding='utf-8'):
self.app = app
self.headers = headers
self.reader = reader
sel... |
import asyncio
import base64
import binascii
import collections
import functools
import hashlib
import itertools
import logging
import random
import sys
import time
import types
import uuid
import aioredis
import msgpack
from channels.exceptions import ChannelFull
from channels.layers import BaseChannelLayer
logger ... |
#----------------------------------------------------------------------
# Copyright (c) 2011-2013 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... |
"""This defines classes for working with geometry file formats"""
########################################################################
# #
# This script was written by Thomas Heavey in 2017. #
# theavey@bu.edu thomas... |
#! /usr/bin/env python
# Copyright Arvid Norberg 2008. Use, modification and distribution is
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import os, sys, time, os
stat = open(sys.argv[1])
line = stat.readline()
while no... |
"""Tests for the Compass images functions.
Not all of Compass is implemented, and the arrangement of Compass functions
doesn't exactly match the arrangement in the original documentation.
Regardless, this is a good starting place:
http://compass-style.org/reference/compass/helpers/
Some functions appear to be undocu... |
#!/usr/bin/env python3
import sys
size = 4
cur = []
def main(args):
"""Checks for proper argument structure, then calls the translate function"""
global size
if not args and len(args) != 3:
usage()
sys.exit(2)
try:
size = int(args[1])
with open(args[2], "rb") as fd:
translate(fd)
except IOError as e:... |
#!/usr/local/bin/python3
# Author : Cameron Prybol
# email : cameron.prybol@gmail.com
# date : 2014.07.17
# description: creates bucketed counts for mpileup counts to allow for graphing in R
import sys
count = 5000 # size of buckets
slide_size = count // 5
in_file = ''
out_file = ''
if (len(sys.argv) == 2):
in_fil... |
# -*- coding: utf-8 -*-
r"""
>>> floatformat(7.7)
u'7.7'
>>> floatformat(7.0)
u'7'
>>> floatformat(0.7)
u'0.7'
>>> floatformat(0.07)
u'0.1'
>>> floatformat(0.007)
u'0.0'
>>> floatformat(0.0)
u'0'
>>> floatformat(7.7,3)
u'7.700'
>>> floatformat(6.000000,3)
u'6.000'
>>> floatformat(6.200000, 3)
u'6.200'
>>> floatformat(... |
from django.contrib.localflavor.be.forms import (BEPostalCodeField,
BEPhoneNumberField, BERegionSelect, BEProvinceSelect)
from utils import LocalFlavorTestCase
class BELocalFlavorTests(LocalFlavorTestCase):
def test_BEPostalCodeField(self):
error_format = [u'Enter a valid postal code in the range and... |
#!/usr/bin/env python
__version__ = 20130603.1021
import os
import sys
import time
import gzip
import re
import subprocess
import datetime
import random
import traceback
import distutils.spawn
from optparse import OptionParser
try:
import simplejson as json
except ImportError:
import json
parent = os.path.dirnam... |
import os, filecmp
from sys import argv
codes = {200:'success',404:'file not found',400:'error',408:'timeout'}
def compile(file,lang):
if lang == 'java':
class_file = file[:-4]+"class"
elif lang == 'c':
class_file = file[:-2]
elif lang=='cpp':
class_file = file[:-4]
if (os.path... |
#!/usr/bin/env python3
# -- coding: utf-8 --
import logging
import requests
import time
import configparser
import os,sys
from bs4 import BeautifulSoup
try:
import http.client as http_client
except ImportError:
# Python 2
import httplib as http_client
cfg = configparser.ConfigParser()
dirname=os.path.dir... |
# This file is part of allegedb, an object relational mapper for versioned graphs.
# Copyright (C) Zachary Spector. public@zacharyspector.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundat... |
import logging
log = logging.getLogger(__name__)
from modules.decorators import view, query, event_handler, memoize_query
#from an_evt.models import StudentBookAccesses
from django.contrib.auth.models import User
from collections import Counter
import json
from django.conf import settings
import logging
from django.ut... |
#
# Copyright (c) 2004 Specifix, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/li... |
#######################################################################
#
# Dumper Implementations
#
#######################################################################
from __future__ import with_statement
movableTypes = set([
"QBrush", "QBitArray", "QByteArray", "QCustomTypeInfo", "QChar", "QDate",
"QD... |
#!/usr/bin/env python
import pytest
import SanskritLexicalAnalyzer
import sanskritmark
from base.SanskritBase import SanskritObject,SLP1,DEVANAGARI
import logging
import re
logger = logging.getLogger(__name__)
logging.basicConfig(filename='uohd.log', filemode='w', level=logging.INFO)
@pytest.fixture(scope="module")
... |
# -*- coding: utf-8 -*-
from pytest import raises
import sqlalchemy as sa
from sqlalchemy_i18n import Translatable, translation_base, UnknownLocaleError
from sqlalchemy_i18n.manager import BaseTranslationMixin
from tests import DeclarativeTestCase, ClassicTestCase, ClassicBase
class Suite(object):
def test_curre... |
from mock import patch
import pytest
from arctic.scripts import arctic_init_library as mil
from ...util import run_as_main
from arctic.scripts.arctic_init_library import Arctic as ar
def test_init_library():
# Create the user agains the current mongo database
with patch('pymongo.MongoClient') as MongoClien... |
class NCounter(object):
"""
INTERNAL USE. EVALUATION PURPOSE ONLY
This is a callback factory whose callbacks register a tick in this class.
If these callbacks are executed times times, then callback is called.
callback will be called after the handler generated by call.
Example us... |
import discord
from discord.ext import commands
from .utils.dataIO import dataIO
from .utils import checks
from __main__ import send_cmd_help
import os
from .utils.chat_formatting import *
class GamingAccount:
"""The GamingAccount Cog"""
def __init__(self, bot):
self.bot = bot
self.profile = "... |
# Copyright (c) Yuta Saito, Yusuke Narita, and ZOZO Technologies, Inc. All rights reserved.
# Licensed under the Apache 2.0 License.
"""Off-Policy Estimators."""
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import Dict, Optional
import numpy as np
from ..utils import estimate... |
# Copyright 2019-2021 Foreseeti AB <https://foreseeti.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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import time
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from djet.assertions import InstanceAssertionsMixin
from djet.files import create_inmemory_file
from mock import MagicMock,... |
# -*- coding: utf-8 -*-
'''
This script is a test for cluster creation via GUI end to end
@author: Ioannis Stenos, Nick Vrionis
'''
from selenium import webdriver
import sys, os
from os.path import join, dirname, abspath
sys.path.append(join(dirname(abspath(__file__)), '../../orka-0.1.1/orka'))
sys.path.append(join(di... |
#!/usr/bin/env python3
import os
import sys
import logging
import argparse
import platform
import subprocess
import glob
import hashlib
os.environ["PYTHONUNBUFFERED"] = "y"
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_too... |
# Copyright (c) 2015 The New Mexico Consortium
#
# {{{NMC-LICENSE
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notic... |
"""
Random walker segmentation algorithm
from *Random walks for image segmentation*, Leo Grady, IEEE Trans
Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83.
Installing pyamg and using the 'cg_mg' mode of random_walker improves
significantly the performance.
"""
import warnings
import numpy as np
from scipy import ... |
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
urlpatterns = []
DJANGO_SETTINGS_MODULE = 'shop_categories.test_utils.cli' # this module
ROOT_URLCONF = DJANGO_SETTINGS_MODULE
def configure(**extra):
from django.conf import settings
os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_M... |
#!/usr/bin/env python
import rospy
import random
from math import *
from sensor_msgs.msg import NavSatFix, Imu
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseWithCovarianceStamped, PointStamped, TransformStamped
from std_msgs.msg import Float64
import tf
import sys
class NoisyVicon:
def __init... |
#!/usr/bin/env python
# Copyright 2008 Nokia Siemens Networks Oyj
#
# 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... |
#! /usr/bin/env python
# coding:utf-8
###############################################################################
#
# The Cling Interpreter
#
# Cling Packaging Tool (CPT)
#
# tools/packaging/cpt.py: Python script to launch Cling Packaging Tool (CPT)
#
# Documentation: tools/packaging/READ... |
#! /usr/bin/env python
import sys
import os
import time
import calendar
up_time_quanta = 500
f = open(sys.argv[1])
announce_histogram = {}
node_uptime_histogram = {}
counter = 0;
# maps search_id to a list of events. Each event is a dict containing:
# t: timestamp
# d: distance (from target)
# o: outstanding se... |
from distutils.core import setup
setup(
name='pyblock',
version='1.0',
author='James Spencer',
url='http://github.com/jsspencer/pyblock',
packages=['pyblock',],
license='Modified BSD license',
description='Reblocking analysis tools for correlated data',
#long_description=open('README.tx... |
import os
import warnings
import GeminiQuery
import tool_de_novo_mutations as de_novo_tool
import tool_autosomal_recessive as recessive_tool
import tool_autosomal_dominant as dominant_tool
# based upon bottle example here:
# https://bitbucket.org/timtan/bottlepy-in-real-case
# -- determine where I launch python and ... |
"""
Docstrings for generated ufuncs
The syntax is designed to look like the function add_newdoc is being
called from numpy.lib, but in this file add_newdoc puts the docstrings
in a dictionary. This dictionary is used in
numpy/core/code_generators/generate_umath.py to generate the docstrings
for the ufuncs in numpy.co... |
from ddapp import lcmUtils
from ddapp import objectmodel as om
from ddapp import visualization as vis
from ddapp.utime import getUtime
from ddapp import transformUtils
from ddapp.debugVis import DebugData
from ddapp import ioUtils
from ddapp import robotstate
from ddapp import applogic as app
from ddapp import vtkAll a... |
from ddapp import vtkAll as vtk
from ddapp import vtkNumpy as vnp
from ddapp.shallowCopy import shallowCopy
import numpy as np
def encodePolyData(polyData):
'''Given a vtkPolyData, returns a numpy int8 array that contains
the serialization of the data. This array can be passed to the
decodePolyData functi... |
"""
Add very large RV errors for stars with no known RVs.
Convert to cartesian.
"""
import numpy as np
import sys
sys.path.insert(0, '..')
from chronostar import tabletool
from astropy.table import Table
datafile = '../data/ScoCen_box_result.fits'
d = tabletool.read(datafile)
# Set missing radial velocities (nan) to... |
#!/usr/bin/env python
# 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 wr... |
#!/usr/bin/env python
import rospy
from sar_opal_msgs.msg import OpalCommand
import argparse
import json
# Opal sender uses ROS to send messages via a rosbridge_server
# websocket connection to a SAR Opal tablet.
def opal_sender():
# parse python arguments
parser = argparse.ArgumentParser(
forma... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 o... |
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.db.models import Q, F, ExpressionWrapper, IntegerField, Count
from django.db.models import CharField, Value as V
from django.db.models.functions import Concat
from django.db.models.fields import NullBooleanFiel... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import argparse
import stat
import random
import sys
import re
import tempfile
import shutil
import subprocess
import glob
import json
import pickle
import functools
import signal
import time
import multipr... |
"""
Pattern generators for audio signals.
$Id$
"""
__version__='$Revision$'
# CEBALERT: you need to build pyaudiolab to use this file.
# (Not tested it on Windows or OS X.)
try:
import pyaudiolab
except ImportError:
print "Warning: pyaudiolab must be built to use audio.py"
import numpy
from topo.base.p... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import base64
import sys
TEMPLATE = """\
#cloud-config
packages:
- bzr
runcmd:
# Setup environment
- export HOME=/home/ubuntu
- export BUILD_ID=output
- export CHROOT_ROOT=/home/ubuntu/build-$BUILD_ID/chroot-autobuild
# Setup build chroot
-... |
"""
Commands that were in the Makefile for running various tests. Roughly
converted to a Python script so we can run on all platforms. Work in
progress.
Buildbot shows how to run the tests, but here are some examples:
unit:
./topographica -p 'targets=["unit"]' topo/tests/runtests.py
default set:
./topographica topo/... |
#!/usr/bin/env python
import requests
import time
import datetime
import argparse
from configobj import ConfigObj
from ripe.atlas.cousteau import (
Ping,
AtlasSource,
AtlasCreateRequest
)
config = ConfigObj("maera.conf")
# set current time:
now = datetime.datetime.now()
parser = argparse.ArgumentParser(d... |
"""
TopoConsole class file.
$Id$
"""
from Tkinter import Frame, Toplevel, StringVar, X, BOTTOM, TOP, \
LEFT, RIGHT, YES, BOTH, Label
import Pmw, re, os, sys, code, traceback, __main__
import tkFileDialog
from basicplotpanel import BasicPlotPanel
from unitweightspanel import UnitWeightsPanel
from projectionpanel i... |
# Copyright 2017 Capital One Services, 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... |
#versa.pipeline.link_materialize_actions
import itertools
from amara3 import iri
from versa import I, VERSA_BASEIRI, ORIGIN, RELATIONSHIP, TARGET, ATTRIBUTES, VTYPE_REL
from versa import util
from versa.util import simple_lookup
from . import context, materialize_entity, create_resource, is_pipeline_action
__all__... |
#!/usr/bin/env python
"""Generate fixtures."""
import os
import json
import math as m
import numpy as np
from scipy import special
# Get the file path:
FILE = os.path.realpath( __file__ )
# Extract the directory in which this file resides:
DIR = os.path.dirname( file )
def gen( x, name ):
"""Generate fixture ... |
from datetime import datetime, timedelta
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.template.defaultfilters import date as dj_date, slugify
from django.utils.safestring import mark_safe
from ... |
"""
MachineCom handles communication with GCode based printers trough (USB) serial ports.
For actual printing of objects this module is used from Cura.serialCommunication and ran in a separate process.
"""
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
import os
import gl... |
#
# Cython Top Level
#
import os, sys, re, codecs
if sys.version_info[:2] < (2, 3):
sys.stderr.write("Sorry, Cython requires Python 2.3 or later\n")
sys.exit(1)
try:
set
except NameError:
# Python 2.3
from sets import Set as set
from time import time
import Code
import Errors
import Parsing
imp... |
#
# Cython Top Level
#
import os, sys, re, codecs
if sys.version_info[:2] < (2, 3):
sys.stderr.write("Sorry, Cython requires Python 2.3 or later\n")
sys.exit(1)
try:
set
except NameError:
# Python 2.3
from sets import Set as set
from time import time
import Code
import Errors
import Parsing
imp... |
#
# Cython Top Level
#
from __future__ import absolute_import
import os
import re
import sys
import io
if sys.version_info[:2] < (2, 6) or (3, 0) <= sys.version_info[:2] < (3, 2):
sys.stderr.write("Sorry, Cython requires Python 2.6+ or 3.2+, found %d.%d\n" % tuple(sys.version_info[:2]))
sys.exit(1)
try:
... |
#!/usr/bin/python
# Reddit pics downloader
import threading
from requests import get
from json import loads
from os.path import exists
from os import mkdir
from time import sleep
import re
import sys
global open_files, OPEN_FILE_LIMIT
OPEN_FILE_LIMIT = 100
open_files = 0
class UsageError(Exception):
pass
cla... |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it unde... |
"""
typeclasses/fsunscg.py
File to hold the menu for the fading suns cg system.
Nodes have a labeling scheme:
menunode_x
Where X is:
start - first node
lifepath - First node in the lifepath CG
custom - First node in the custom CG
lpnX# - This indicates LifePath node step # in archetype X (IE: lpn2 is... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vim
import os
import sys
import time
import operator
import itertools
import threading
import multiprocessing
from functools import partial
from functools import wraps
from .instance import LfInstance
from .cli import LfCli
from .utils import *
from .fuzzyMatch impo... |
from __future__ import print_function
# Standard library imports
from collections import namedtuple
import sys
import time
import uuid
# System library imports
from pygments.lexers import PythonLexer
from IPython.external import qt
from IPython.external.qt import QtCore, QtGui
# Local imports
from IPython.core.input... |
# -*- coding: utf-8 -*-
u"""API's for jupyterhublogin sim
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkconfig, pkio
from pykern.pkcollections import... |
"""
This software was developed by the University of Tennessee as part of the
Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
project funded by the US National Science Foundation.
See the license text in license.txt
copyright 2008, University of Tennessee
"""
import numpy
import mat... |
import random
from pydub import AudioSegment
from pydub.playback import play
import glob
import operator
import naming
import filezart
import copy
import math
from filezart import instrument
#from multiprocessing import Pool
import threading
def notenames():
return ("C", "Db", "D", "Eb", "E", "F", "G... |
# Copyleft (c) 2016 Cocobug All Rights Reserved.
# coding=utf-8
import os,sys,tree_parser
import re
import traceback
class WebPage(object):
"A webpage object, with some variables and all localisations"
def __init__(self,path):
self.path=path
self.name=os.path.split(path)[-1]
self.vari... |
# -*- coding: utf-8 -*-
"""
==============================================================================
Graphene structure generators (:mod:`sknano.generators._graphene_generator`)
==============================================================================
.. currentmodule:: sknano.generators._graphene_generator... |
# -*- encoding: utf-8 -*-
#
# Authors: Vojtech CIMA <cima@zhaw.ch>
# Bruno GRAZIOLI <gaea@zhaw.ch>
# Sean MURPHY <murp@zhaw.ch>
#
# 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 ... |
author = 'Anton Bobrov<bobrov@vl.ru>/Fabien Devaux<fdev31@gmail.com>'
name = 'Python flakes/pylint'
desc = 'Basic python linter'
langs = ['python']
import gtk
import pango
import os.path
import weakref
flakes_warnings = weakref.WeakKeyDictionary()
def editor_opened(editor):
editor.connect('file-saved', on_file_s... |
# Copyright (c) 2010-2012 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
""" Branching Strategies to Traverse a Tree """
from sympy.rules.util import new, is_leaf, children
from strat_pure import notempty
from itertools import product
def top_down(brule):
""" Apply a rule down a tree running it on the top nodes first """
def top_down_rl(expr):
brl = notempty(brule)
... |
#!/usr/bin/env python
"""
Modified May-2017, Rana X Adhikari
"""
from __future__ import division
import time, sys, signal
import argparse
#import threading
import pyaudio
import numpy as np
from scipy.signal import welch
# Jamie Synapse dependencies
import zmq
import pickle
import logging
from .. import const
# ... |
"""Interface and definitions for foreign exchange rate readers.
"""
import six
from interface import implements, Interface
class FXRateReader(Interface):
def get_rates(self, field, quote, bases, dates):
"""
Get rates to convert ``bases`` into ``quote``.
Parameters
----------
... |
__version__ = '0.22.12'
from timeseries import \
Hours, Minutes, Seconds, Milliseconds, Microseconds, Picoseconds, \
SR11025, SR22050, SR44100, SR48000, SR96000, HalfLapped, Stride, \
TimeSlice, VariableRateTimeSeries, VariableRateTimeSeriesFeature, \
SampleRate, AudioSamples, TimeDimension, audio_samp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import re
from datetime import datetime, time, timedelta
from dateutil import parser
from db import create_or_update_db_item
from db.common import session_scope
from db.game import Game
from db.team_game import TeamGame
from utils import remove_null_string... |
import logging
from django.test import Client
from django.conf import settings
from django.urls import reverse
from django.db import IntegrityError
from rest_framework.parsers import JSONParser
from io import BytesIO
import json
from ambulance.models import Call, Patient, AmbulanceCall, CallStatus, CallPriority, \
... |
import time
from django.test import TestCase
from django.contrib.auth.models import User
from django.conf import settings
from rest_framework.renderers import JSONRenderer
from ambulances.models import Profile, Ambulance, \
AmbulanceStatus, AmbulanceCapability, \
AmbulancePermission, HospitalPermission, \
... |
"""
The Bookalope module contains a simple object model to make Bookalope's REST API
more accessible. See http://bookalope.net/
"""
import base64
import json
import re
import datetime
import requests
import babel
def _is_token(token_s):
"""
Given a string, returns True if the string contains a Bookalope token... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.utils import timezone
from django.utils.safestring import SafeText
from andablog import models
class TestEntryModel(TestCase):
"""
Author Note: We don't do much, if any testing, surrounding the Entry author attribute.... |
""" lightCurve.py
This purpose of this program is to produce a light curve with error bars.
Language: Python 3
Tanner Leighton
Written for CIERA Summer Internship, Northwestern University.
6/28/17
"""
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
def ... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from mock import Mock
from collections import Sequence
from socorro.cron.crontabber_app import CronTabber
from socorro... |
from __future__ import division
from math import ceil
from itertools import combinations
from operator import mul
# Sum of multiples of 3 or 5 under 1000, simplified:
# print (3 * 333 * 334 / 2) + (5 * 199 * 200 / 2) - (15 * 66 * 67 / 2)
def getSumOfMultiple(num, limit):
return int((ceil(limit / num) - 1) ... |
from django import forms
from oscar.apps.payment import forms as payment_forms
from oscar.apps.order.models import BillingAddress
class BillingAddressForm(payment_forms.BillingAddressForm):
"""
Extended version of the core billing address form that adds a field so
customers can choose to re-use their shi... |
#!/usr/bin/env python
#
# Copyright 2006 Google Inc. All Rights Reserved.
"""Calculates Javascript dependencies without requiring Google3.
It iterates over a number of search paths and builds a dependency tree. With
the inputs provided, it walks the dependency tree and outputs all the files
required for compilation... |
import time
from aquests.athreads import socket_map
from aquests.athreads import trigger
from rs4.cbutil import tuple_cb
from aquests.client.asynconnect import AsynSSLConnect, AsynConnect
from aquests.dbapi.dbconnect import DBConnect
import threading
from aquests.protocols.http import request as http_request
from aques... |
#
# Trick to deal with RST pages and sphinx incompatibility. set to false when building docs
#
from ConfigParser import SafeConfigParser
from cloudmesh.config.cm_config import cm_config, cm_config_server
from cloudmesh.util.keys import get_fingerprint
from cloudmesh.provisioner.provisioner import *
from cloudmesh.user... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.