content stringlengths 4 20k |
|---|
#!/usr/bin/env python
"""AMI HTTP wrapper classes
Copyright (C) 2011, Digium, Inc.
Terry Wilson <<EMAIL>>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
"""
try:
# python 2 import
from urllib import urlencode
except:
# python 3 import
from urll... |
import operator
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
from django.utils.text import slugify
from django.db.models import Q
from django.shortcuts import get_object_or_404
from django.contrib.gis.geos import Point, fromstr
from django.core.exceptions import ImproperlyCon... |
"""Tests for dense Bayesian layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.bayesflow.python.ops import layers_dense_variational as prob_layers_lib
from tensorflow.contrib.bayesflow.python.ops import la... |
# system modules
import inspect
# django modules
from django.db import models
# Custom imports
from ntgame.src import nt_rules
from ntgame.src import nt_formulas
class Race(models.Model):
name = models.CharField(max_length=40,unique=True)
''' Offensive spec name. '''
offense_spec_name = models.CharFie... |
import os
import json
import logging
import urllib.request
import urllib.error
from urllib.parse import quote
class RiotAPI:
logger = logging.getLogger(__name__)
initial_rank = 'no elo'
ranks = {
initial_rank: -1,
'unranked': 0,
'bronze': 1,
'silver': 2,
'gold': 3,... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from tests.support import mock
import dnf.exceptions
import repoquery
import unittest
EXPECTED_INFO_FORMAT = """\
Name : foobar
Version : 1.0.1
Release : 1.f20
Architecture: x86_64
Size ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'APIServiceCredentials'
db.create_table(u'gmerchant_apiser... |
# -*- coding: utf-8 -*-
"""
direct PAS
Python Application Services
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?pas;upnp
The following license agreement remains valid unless any additions or
changes a... |
import unittest
if __name__ == '__main__':
from main import setup_tincan_path
setup_tincan_path()
from tincan import (
Agent,
Group,
Verb,
StatementRef,
Activity,
SubStatement,
)
class SubStatementTest(unittest.TestCase):
def test_InitAnonAgentActor(self):
substatement = ... |
from parlai.core.teachers import FbDeprecatedDialogTeacher, MultiTaskTeacher
from .build import build
import copy
import os
tasks = {}
tasks[1] = 'dialog-babi-task1-API-calls'
tasks[2] = 'dialog-babi-task2-API-refine'
tasks[3] = 'dialog-babi-task3-options'
tasks[4] = 'dialog-babi-task4-phone-address'
tasks[5] = 'dial... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para dailymotion
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# -----------------------------------------------------------... |
"""
Python 3.X compatibility tools.
While this file was originally intended for Python 2 -> 3 transition,
it is now used to create a compatibility layer between different
minor versions of Python 3.
While the active version of numpy may not support a given version of python, we
allow downstream libraries to continue ... |
from setuptools import Command
from setuptools.archive_util import unpack_archive
from distutils import log, dir_util
import os, sys, pkg_resources
class install_egg_info(Command):
"""Install an .egg-info directory for the package"""
description = "Install an .egg-info directory for the package"
user_opt... |
from pychron.pipeline.plot.models.figure_model import FigureModel
from pychron.pipeline.plot.panels.isochron_panel import InverseIsochronPanel
from pychron.pipeline.plot.panels.spectrum_panel import SpectrumPanel
class CompositeModel(FigureModel):
def _make_panels(self):
spo = self.plot_options.get_option... |
"""Facets tests."""
from __future__ import absolute_import, print_function
import pytest
from elasticsearch_dsl import Search
from elasticsearch_dsl.query import Q, Range
from flask import Flask
from invenio_rest.errors import RESTValidationError
from werkzeug.datastructures import MultiDict
from invenio_records_res... |
import stock_balance
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import ply.lex as lex
reserved = {
'\\lceil' : 'LCEIL',
'\\rceil' : 'RCEIL',
'\\lfloor' : 'LFLOOR',
'\\rfloor' : 'RFLOOR',
'\\prod' : 'BIGOP',
'\\sum' : 'BIGOP',
'\\int' : 'BIGOP',
'\\lim' : 'BIGOPD',
'\\rightarrow' : 'TO',
'\\to' : 'TO... |
import datetime
import os
import re
import time
import json
import tempfile
import subprocess
from django.test import TestCase
from django.utils import unittest
from nose.plugins.attrib import attr
from pombola.hansard.kenya_parser import KenyaParser, KenyaParserCouldNotParseTimeString
from pombola.hansard.models im... |
"""
This file contains the functions needed to run SmartHomeNG as a deamon
"""
import logging
import os
import sys
import psutil
logger = logging.getLogger(__name__)
def daemonize(pidfile,stdin='/dev/null', stdout='/dev/null', stderr=None):
"""
This method domonizes the sh.py process and redirects standard ... |
from index import InvertedIndex
from item import item_id
def test_InvertedIndex():
data = ("a,b,c,d,e,f\n"
"g,h,i,j,k,l\n"
"z,x\n"
"z,x\n"
"z,x,y\n"
"z,x,y,i\n")
index = InvertedIndex()
index.load(data)
assert(index.support({item_id("a")}) ==... |
# -*- coding: utf-8 -*-
import socket
from pynicotine.pluginsystem import BasePlugin, returncode
from pynicotine import slskmessages
def enable(plugins):
global PLUGIN
PLUGIN = Plugin(plugins)
def disable(plugins):
global PLUGIN
PLUGIN = None
class Plugin(BasePlugin):
__name__ = "Port Checker"
... |
import pytest
from template_engine import statements
from template_engine import exceptions
class TestIncludeStatement:
def setup_method(self, method):
self.path_to_template_dir = "tests/templates"
def test_simple_include_case(self):
metadata = {
"template_dir": self.path_to_temp... |
"""Test the ErrorsPlugin.
"""
import pytest
import enaml
from enaml.widgets.api import MultilineField
from exopy.testing.util import handle_dialog, get_window, show_and_close_widget
with enaml.imports():
from enaml.workbench.core.core_manifest import CoreManifest
from enaml.workbench.ui.ui_manifest import UI... |
import unittest
import random
import base_auth_test
import json
#
### Functional test for Bug Reports
#
class BugsTest(base_auth_test.BaseAuthTest):
def setUp(self):
super(BugsTest, self).setUp()
def test_get_users_with_invalid_rule(self):
self.authenticate('erica', 'pass')
json_resp = self.get('/user... |
"""Contains functions for evaluation and summarization of metrics.
The evaluation.py module contains helper functions for evaluating TensorFlow
modules using a variety of metrics and summarizing the results.
**********************
* Evaluating Metrics *
**********************
In the simplest use case, we use a model... |
import types, math, copy
# vec3
class vec3:
"""Three-dimensional vector.
This class can be used to represent points, vectors, normals
or even colors. The usual vector operations are available.
"""
def __init__(self, *args):
"""Constructor.
There are several possibi... |
def run_atom_dbs():
import os
from hipart.atomdb import run_atomdb, Options
from molmod.periodic import periodic
# atom numbers of interest
atom_numbers = [1, 6, 8]
# auxiliary function to setup an atomic database with a given radial grid
# size
def my_run_atomdb(size):
directo... |
"""Package defining the data connector for mongoDB.
The data connector (subclass of DataConnector) is described in
the file ./connector.py .
"""
from dc.mongo.connector import MongoDBConnector |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''This module allows the tonnikala templating language --
http://pypi.python.org/pypi/tonnikala/
-- to be used in the Pyramid web framework --
http://docs.pylonshq.com/
'''
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import ... |
import argparse
class ClusterRunnerArgumentParser(argparse.ArgumentParser):
"""
This is a custom argument parser that gives us more control over the parsing behavior and help documentation output.
This parser automatically splits required arguments and optional arguments into separate argument groups. Th... |
from collections import Counter
from itertools import chain
from parser import getAllWords
DEBUG = True
class TwoGramModel(object):
def __init__(self,wordlist):
if DEBUG: print("building bi-gram model.")
WBAG = set(wordlist)
self.N = len(WBAG)
def replaceLoFreq(sentence):
... |
#!/home/cameron/apps/ENV/bin/python2.7
import re
import sys
import os
import subprocess
# For python keyring, otherwise not needed
import keyring
# This defines the mapping of remote to local folders. On the left are the
# names of the remote folders. You may have to change the name on the left side
# to match your g... |
import os
import sys
import yaml
import time
import logging
import subprocess
import tempfile
import signal
from lnst.Common.Parameters import Param, StrParam, IntParam, FloatParam
from lnst.Common.Parameters import IpParam, DeviceOrIpParam
from lnst.Tests.BaseTestModule import BaseTestModule, TestModuleError
class TR... |
from FaceAlignment import FaceAlignment
import utils
import numpy as np
import os
import glob
import cv2
import ntpath
from matplotlib import pyplot as plt
ptsOutputDir = "../results/pts/"
imgOutputDir = "../results/imgs/"
MenpoDir = "../data/images/Menpo testset/semifrontal/"
imageHeightFraction = 0.46
networkFilena... |
'''
NOTES:
* Possible employ simulated annealing by decreasing mutation deviance
parameters for chromosomes over time.
DOIT:
* If a Chromosome is initialized as a copy of another, it should not require
parameters for the number of input and output neurons.
'''
import ANN
import math
from random import random, ... |
"""Implementation of a Fenchel-Young loss using perturbation techniques."""
from typing import Callable, Optional
import gin
import tensorflow.compat.v2 as tf
from perturbations import perturbations
@gin.configurable
class FenchelYoungLoss(tf.keras.losses.Loss):
"""Implementation of a Fenchel Young loss."""
d... |
import json
import logging
import unittest
from base import TestBaseBackend
from grimoire_elk.raw.supybot import SupybotOcean
from grimoire_elk.enriched.utils import REPO_LABELS
class TestSupybot(TestBaseBackend):
"""Test Supybot backend"""
connector = "supybot"
ocean_index = "test_" + connector
enr... |
from celery import shared_task
from .celery_ext import LoggingTask, ScopeBasedTask
from .utils import read_fixture
r"""
Responsible: Rustem Kamun <xepa4ep>
Configure celery in order to support verbose file logging per each task.
Implementation details:
1. Extend base task so that it allows to write logs to correspo... |
# todo: use .ENV
import argparse
import requests
from furl import furl
from bs4 import BeautifulSoup
import sys
import logging
logging.basicConfig(filename='example.log', format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
class Settings:
URL = 'http:... |
""" Test IPv4 MPLS VPN NLRI """
import unittest
from yabgp.message.attribute.nlri.ipv4_mpls_vpn import IPv4MPLSVPN
class TestIPv4MPLSVPN(unittest.TestCase):
def test_parse(self):
nlri_hex = b'\x78\x00\x01\x91\x00\x00\x00\x64\x00\x00\x00\x64\xaa\x00\x00\x00'
self.assertEqual(
[{'labe... |
"""
Computational Neurodynamics
Exercise 1
Solves the ODE dy/dt=y (exact solution: y(t)=exp(t)), by numerical
simulation using the Euler method, for two different step sizes.
(C) Murray Shanahan et al, 2015
"""
import numpy as np
import matplotlib.pyplot as plt
dt = 0.001 # Step size for exact solution
dt_sma... |
"""
Contains locking classes.
"""
import os
import re
import time
import fcntl
from threading import RLock
class LockFailed(Exception):
pass
class NotLocked(Exception):
pass
class LockFile:
"""
File based locking.
@ivar path: The absolute path to the lock file.
@type path: str
@ivar __... |
"""Organization
Revision ID: c55612fb52a
Revises: 1fce9db567a5
Create Date: 2015-01-27 02:02:42.510116
"""
# revision identifiers, used by Alembic.
revision = 'c55612fb52a'
down_revision = '1fce9db567a5'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'organization',
... |
import turtle
turtle.bgcolor("black")
t = turtle.Pen()
t.pencolor("red")
t.forward(100)
t.pencolor("orange")
t.forward(100)
t.pencolor("yellow")
t.forward(100)
t.right(90)
t.pencolor("blue")
t.forward(94)
t.pencolor("indigo")
t.forward(94)
t.pencolor("violet")
t.forward(94)
t.right(90)
t.pencolor("red")
t.forward(10... |
"""
Set of" markup" function to transform plain text into HTML for Zinnia.
Code originally provided by django.contrib.markups
"""
import warnings
from django.utils.encoding import force_text
from django.utils.encoding import force_bytes
from zinnia.settings import MARKDOWN_EXTENSIONS
from zinnia.settings import RESTR... |
import webob.exc
from nova.api.openstack.api_version_request \
import MAX_PROXY_API_SUPPORT_VERSION
from nova.api.openstack import common
from nova.api.openstack.compute.views import images as views_images
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import exception
from... |
# -*- 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 unique constraint on 'DocumentZone', fields ['document']
db.create_unique('wiki_documentzone', ['do... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
from django.http import HttpResponse
from django.views.generic import View
from ..models import Url
class WebApi(View):
CONT... |
#!/usr/bin/env python
#
# An example script entry (returns current ticker status of Kraken cryptocurrency exchange)
#
# Developer: Leo Gordon
#
from pprint import pprint
import sys
def show(i):
"""
Input: {
(all input parameters are optional)
}
Output: {
return ... |
# _*_ coding: utf-8_*_
#
# genral application route config:
# simplify the router config by dinamic load class
# by lwz7512
# @2016/05/17
import tornado.web
from foo import comm
from foo.auth import auth_email
from foo.auth import auth_phone
from foo.auth import auth_wx
from wx import wx_activity
from wx import wx_it... |
from homevent.context import Context
from modules.onewire import OWFSwindmon
res=[(2,0.5),(2.0,0.55),(2.16567,0.58863),(2.44226,0.60851),(2.86361,0.49702),(7.99997,0.99997),(8.05551,0.92410)]
def dump(c):
a,q = res.pop(0)
assert abs(a-c.avg)<0.001
assert abs(q-c.qavg)<0.001
class par(object):
def __init__(self):... |
#!/usr/bin/python
from cffi import FFI
import ctypes.util
from ipalib import errors
_ffi = FFI()
_ffi.cdef('''
typedef ... CONF;
typedef ... CONF_METHOD;
typedef ... BIO;
typedef ... ipa_STACK_OF_CONF_VALUE;
/* openssl/conf.h */
typedef struct {
char *section;
char *name;
char *value;
} CONF_VALUE;
CO... |
import os
import pandas as pd
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.externals import joblib
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinarizer
from data_pre... |
import set_and_get_params as sagp
import numpy as np
import pdb
__author__='Stephen Thomson'
def area_average(dataset, variable_name, model_params, land_ocean_all='all', level=None, axis_in='time', lat_range = None):
print('performing area average on ',variable_name, 'of type ', land_ocean_all)
if (variable... |
"""
File: Server.py
Author: Daniel Schauenberg <<EMAIL>>
Description: class for implementing a search engine web server
"""
import socket
import time
import re
import sys
import os
import InvertedIndex
from operator import itemgetter
class Webserver:
""" class for implementing a web server, serving the
inv... |
import string
import ast
from sets import Set
from math import log, ceil
from nltk.tag import pos_tag
from nltk.corpus import stopwords
# from nltk import stem
import re
# import difflib
import sys
# import os
# from datetime import datetime, timedelta
# import os.path
from apollo_lib import util
# APOLLO_HOME = os.env... |
"""Created By: Andrew Ryan DeFilippis"""
import contextlib
import re
import unittest
from io import StringIO
import context
import lambda_function
class TestLambdaFunction(unittest.TestCase):
"""Test all the Lambda Function things!
"""
def test_cwlogs_event_format(self):
"""Verify the format of... |
"""
sentry.utils.http
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import itertools
import urllib
from urlparse import urlparse
from sentry.conf import settings
from sentry.plugins.helpers import get_option
def safe_ur... |
from ordereddict import OrderedDict
from qapi import *
import sys
import os
import getopt
import errno
def type_visitor(name):
if type(name) == list:
return 'visit_type_%sList' % name[0]
else:
return 'visit_type_%s' % name
def generate_decl_enum(name, members, genlist=True):
return mcgen('... |
"""
The MIT License (MIT)
Copyright (c) 2015 Alexey Nikitin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... |
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
import pooler
import tools
from osv import fields,osv
def _code_get(self, cr, uid, context=None):
acc_type_obj = self.pool.get('account.account.type')
ids = acc_type_obj.search(cr, uid, [])
res = acc_type_obj.read(c... |
import concurrent.futures
import mock
from openstack import task_manager
from openstack.tests.unit import base
class TestException(Exception):
pass
class TaskTest(task_manager.Task):
def main(self):
raise TestException("This is a test exception")
class TaskTestGenerator(task_manager.Task):
de... |
from setuptools import setup
setup(
name='messidge',
version='1.3.1',
author='David Preece',
author_email='<EMAIL>',
url='https://20ft.nz',
license='BSD',
packages=['messidge', 'messidge.broker', 'messidge.client'],
install_requires=['pyzmq', 'libnacl', 'shortuuid', 'psutil', 'lru-dict'... |
# -*- coding: utf-8 -*-
"""Uptime report outages.
This module contains generic code for processing outages.
"""
import logging
from itertools import chain
from operator import attrgetter
import arrow
import attr
from attr.converters import optional
log = logging.getLogger(__name__)
"""Outage module logger."""
@att... |
from ..schemas import Schema, fields
from ..enums import EnumField, CountryEnum
from ..utils import FrozenMixin
class AddressSchema(Schema):
BillingName = fields.String()
BillingFirstName = fields.String()
BillingMiddleInitial = fields.String()
BillingLastName = fields.String()
BillingCompanyName ... |
import logging
import types
"""
Basic context implementation for binding variables to values
"""
logger = logging.getLogger('pyresttest.binding')
class Context(object):
""" Manages binding of variables & generators, with both variable name and generator name being strings """
variables = dict() # Maps var... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-import sys
import sys
import os
import urllib
import logging
import mimetypes
import re
from google.appengine.ext import webapp
from google.appengine.ext import blobstore
from controller.utils import template
from google.appengine.ext.webapp import util
from ... |
import logging
from odoo import api, models, fields, _
from odoo.exceptions import ValidationError
logger = logging.getLogger(__name__)
class AppBanner(models.Model):
_name = 'mobile.app.banner'
_description = 'Mobile App Banner'
_order = 'state asc, print_count asc, date_start asc'
###############... |
from a10sdk.common.A10BaseClass import A10BaseClass
class SamplingEnable(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param counters1: {"enum": ["all", "session-created", "filler2"], "type": "string", "description": "'all': all; 'session-created': Session created; 'f... |
"""
Tests for the demonstrating client usage
"""
import omero
import test.integration.library as lib
from omero.rtypes import rstring
class TestClientUsage(lib.ITest):
"""
Note: this is the only test which should use 'omero.client()'
All others should use the new_client(user=) syntax from lib.ITest... |
"""Status Adapter Template File
IMPORTANT: NOT A FUNCTIONAL ADAPTER. FUNCTIONS MUST BE IMPLEMENTED
Notes:
- Each of the functions defined below must return a json serializable
object, json_response, or valid HttpResponse object
- A json_response creates an HttpResponse object given parameters:
-... |
# coding=utf-8
"""
Start with a list of words.
Remove a letter at random. Have the user guess the correct spelling of the word.
Run in two modes- where the user must give the intended letter, or where the user
gives any letter that creates an English word. (English being any word on the list,
there is no time to type... |
{
'name': 'Recently Viewed Products',
'summary': (
'Let the users keep track of the products they saw on the ecommerce'),
'author': "MONK Software,Odoo Community Association (OCA)",
'website': "http://www.monksoftware.it",
'category': 'Website',
'version': '8.0.1.0.0',
'license': 'AG... |
from inspect import isclass
from hashlib import sha1
class PackageOrder(object):
"""Package reorderer base class."""
name = None
def __init__(self):
pass
def reorder(self, iterable, key=None):
"""Put packages into some order for consumption.
You can safely assume that the pa... |
from django.conf.urls import url, patterns
webgateway = url(r'^$', 'webgateway.views.index', name="webgateway")
"""
Returns a main prefix
"""
annotations = url(r'^annotations/(?P<objtype>[\w.]+)/(?P<objid>\d+)/$',
'webgateway.views.annotations',
name="webgateway_annotations")
"""
R... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx, time, thread, os, random, shutil, wave, audiotools, platform, subprocess
import core, lang, logo
class buildDialog(wx.Dialog):
def __init__(self, parent, *args, **kwds):
self.parent = parent
wx.Dialog.__init__(self, parent, *args, **kwds)
... |
#!/usr/bin/python3
# src/test/test_zebraFont.py
import unittest
import sys
sys.path.append('/home/mancilla/development/Zebrackets/src')
from zebrackets import *
full_cmd_1 = ['--kind', 'b',
'--style', 'b',
'--slots', '7',
'--family', 'cmb',
'--size', '10',
... |
import logging
import openerp
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
class pos_config(osv.osv):
_inherit = 'pos.config'
_columns = {
'iface_discount': fields.boolean('Order Discounts', help='Allow the cashier to give discounts on the whole... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2012 Erik Reuterborg Larsson, Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import logging
from sleekxmpp.stanza import Message
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxm... |
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import timeit
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
from solutions import ode_solutions
gamma = 4.4983169634398597e4
tsteps = 1000
t = np.linspace(0,1.5,tsteps)
M = 10
S = 10
direct_r1, direct_r2, r... |
from fractions import Fraction
from itertools import takewhile
from CommonFunctions import find_primes_less_than, gcd, phi
primes = find_primes_less_than(10000)
def resilience(x):
return Fraction(phi(x), (x-1))
limit = Fraction(15499, 94744)
if __name__ == '__main__':
found = False
mult_primes = primes... |
from django import forms
from django.db import connections
from django.utils.timezone import localtime
from django.utils.encoding import force_text
from django.utils.dateformat import DateFormat
from djforms.core.models import GenericChoice
from djtools.fields import STATE_CHOICES
from djtools.fields.localflav... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
@author: Rachid and Kimia
"""
import numpy as np
def gammatone_function(resolution, fc, center, fs=16000, n=4, b=1.019):
"""Define a single gammatone function"""
t = np.linspace(0, resolution-(center+1), resolution-center)/fs
g = np.zeros((resolution,))... |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... |
from gcp_common import BaseTest, event_data
from pytest_terraform import terraform
@terraform('pubsub_topic')
def test_pubsub_topic_query(test, pubsub_topic):
topic_name = pubsub_topic['google_pubsub_topic.test_topic.id']
session_factory = test.replay_flight_data('pubsub-topic-query')
policy = test.loa... |
import platform
import subprocess
import re
import binascii
import functools
import warnings
import textwrap
from ..backend import KeyringBackend
from ..errors import PasswordSetError
from ..errors import PasswordDeleteError
from ..util import properties
from ..py27compat import unicode_str
class SecurityCommand(uni... |
## @package gmapcatcher.mapLogging
# Logging for gmapcatcher
"""
Logging for GMapCatcher
Purpose - primary for developers to manage debug messages. Secondary - users after setting
'--logging-path=/tmp/maps.log' will catch all messages in file and can send them for checking
what went wrong in error reporting.
Usage... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""usage: blobtools bamfilter -b FILE [-i FILE] [-e FILE] [-U] [-n] [-o PREFIX] [-f FORMAT]
[-h|--help]
Options:
-h --help show this
-b, --bam FILE BAM file (sorted by name)
-i, -... |
from osv import fields, osv, expression
import time
from operator import itemgetter
from functools import partial
import tools
from tools.safe_eval import safe_eval as eval
from tools.misc import unquote as unquote
from openerp import SUPERUSER_ID
class ir_rule(osv.osv):
_name = 'ir.rule'
_order = 'name'
_... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from datetime import datetime
class RuswarpDriver(webdriver.PhantomJS):
def parse_data_value(self, value_txt):
... |
from snovault import (
AuditFailure,
audit_checker,
)
from snovault import (
UPGRADER,
)
from snovault.schema_utils import validate
from snovault.util import simple_path_ids
@audit_checker('Item', frame='object')
def audit_item_schema(value, system):
context = system['context']
registry = system['... |
"""Manage dirty ResultTime's."""
__author__ = '<EMAIL> (Stephen Lamm)'
import datetime
import logging
import random
import sys
import time
import traceback
from google.appengine.api import memcache
from google.appengine.api.labs import taskqueue
from google.appengine.ext import db
from google.appengine import runtim... |
"""distutils.core
The only module that needs to be imported to use the Distutils; provides
the 'setup' function (which is to be called from the setup script). Also
indirectly provides the Distribution and Command classes, although they are
really defined in distutils.dist and distutils.cmd.
"""
__revision__ = "$Id: ... |
import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.patches as mPatch
from matplotlib.legend_handler import HandlerLine2D
import itertools
import os
#knn function gets the dataset and calculate... |
import sys
import struct
import os
import urllib
import hashlib
from Util import *
"""
bit masks for cache address
"""
CACHE_ADDR_INIT_MASK = 0x80000000
CACHE_ADDR_INIT_OFFSET = 31
CACHE_ADDR_FILETYPE_MASK = 0x70000000
CACHE_ADDR_FILETYPE_OFFSET = 28
CACHE_ADDR_FILENUMBER_MASK = 0x0FFFFFFF
CACHE_ADDR_FILENUMBER_O... |
import os
import re
import sys
import numpy as np
import matplotlib.pyplot as plt
#import numpy as np
class DictWrapper(dict):
def __getattr__(self, name):
if name in self:
return self[name]
else:
raise AttributeError(name)
files = os.listdir("output")
algs = {}
cla... |
import os
from spack import *
def _verbs_dir():
"""Try to find the directory where the OpenFabrics verbs package is
installed. Return None if not found.
"""
try:
# Try to locate Verbs by looking for a utility in the path
ibv_devices = which("ibv_devices")
# Run it (silently) t... |
import unittest
from datetime import timedelta
from pylons import g, c
from nose.tools import assert_equal
from ming.orm import ThreadLocalORMSession
from alluratest.controller import setup_basic_test, setup_global_objects, REGISTRY
from allura import model as M
from allura.lib import helpers as h
from allura.tests i... |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '@ax1tb!(x0i488nds_8erw-y7+1!+xc96dqo3!ay3!ko6(=jlm'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'south',
'djcelery',
'django.co... |
import logging
import sys
sys.path.append("/usr/lib/archivematica/archivematicaCommon")
from dicts import ReplacementDict
LOGGER = logging.getLogger('archivematica.mcp.server')
class unitFile(object):
"""For objects representing a File"""
def __init__(self, currentPath, UUID="None", owningUnit=None):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.