src stringlengths 721 1.04M |
|---|
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import faker
from .models import User, Address, Base
from datatables import DataTable, DataColumn
class TestDataTables:
def setup_method(self, method):
engine = create_engine('sqlite://', echo=True)
Base.metadata.create_... |
# -*- 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):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Copyright (c) 2014, Marcus Breese
# 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 the... |
'''
This file contains tests that test the new user registration system.
'''
from os.path import abspath, dirname
import sys
project_dir = abspath(dirname(dirname(__file__)))
sys.path.insert(0, project_dir)
from django.core.urlresolvers import resolve
from django.test import TestCase
from django.test.client import Cl... |
import sys
import os
import binascii
import zipfile
import argparse
def createZipFile(fileToArchive):
path = fileToArchive + '.zip'
with zipfile.ZipFile(path, mode='w') as myZip:
myZip.write(fileToArchive, arcname=fileToArchive.split('/')[-1])
def stats(fileToAnalyze):
return os.stat(fileToA... |
import requests
import json
import pprint
tests = ['duckduckgo-owned-server_yahoo_net', 'duckduckgo_com', 'ec2_ap-northeast-1_amazonaws_com', 'ec2_ap-northeast-2_amazonaws_com', 'ec2_ap-south-1_amazonaws_com', 'ec2_ap-southeast-2_amazonaws_com', 'ec2_ap-southeast-1_amazonaws_com', 'ec2_eu-central-1_amazonaws_com', 'ec... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# ... |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... |
###############################################################################
##
## Copyright 2012 Tavendo GmbH
##
## 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... |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2017 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
#
# io_fits.py -- Module wrapper for loading FITS files.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
There are two possible choices for a python FITS file reading package
compatible with Ginga: astropy/pyfits and fitsio. Both are based on
the CFIT... |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
import os
##############################################################################
# ... |
"""Provides classes for handling API requests."""
import logging
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.core.cache import cache
from dateutil import parser
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models i... |
#!/usr/bin/env python
# Copyright 2013 Evan Vitero
# This file is part of chatlogsync.
# chatlogsync is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
import functools
import hashlib
import os
import time
from collections import namedtuple
from azure.mgmt.servicebus import ServiceBusManagementClient
from azure.mgmt.servicebus.models import SBQueue, SBSubscription, AccessRights
from azure_devtools.scenario_tests.exceptions import AzureTestError
from devtools_testut... |
import fftoolbox as fftb
import logging, sys
#logger = logging.getLogger(__name__)
#lf = '%(levelname)s: %(funcName)s at %(filename)s +%(lineno)s\n%(message)s\n'
#logging.basicConfig(level=logging.DEBUG, format=lf)
#logging.basicConfig(filename='./log', filemode='w', level=logging.DEBUG, format=lf)
molecule_name = s... |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2018 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Tris Wilson
#
# 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 Softw... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2019 CERN.
#
# INSPIRE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... |
#
# Copyright (C) 2012, 2015, 2016, 2019
# Smithsonian Astrophysical Observatory
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... |
from __future__ import unicode_literals
from .filesmanager import FilesManager
from .payrollmanager import PayrollManager
from .manager import Manager
class Xero(object):
"""An ORM-like interface to the Xero API"""
OBJECT_LIST = (
"Attachments",
"Accounts",
"BankTransactions",
... |
'''Representation of a random variable used in stochastic collocation'''
__copyright__ = 'Copyright (C) 2011 Aravind Alwan'
__license__ = '''
This file is part of UnyQuE.
UnyQuE 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 Softw... |
#!/usr/bin/env python
#
# Copyright 2016 Google 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
#
# Unless requir... |
# Version: 0.15+dev
"""The Versioneer - like a rocketeer, but for versions.
The Versioneer
==============
* like a rocketeer, but for versions!
* https://github.com/warner/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, and pypy
* [![Latest Version]
(https... |
# -*- coding: utf-8 -*-
import urwid
class FancyListBox(urwid.LineBox):
def get_listbox(self, items):
class _FancyListBox(urwid.ListBox):
def keypress(_self, size, key):
key = super(_FancyListBox, _self).keypress(size, key)
self.update_corners(_self.ends_visibl... |
import itertools
import unittest
from compiler import ast, parse
# pylint: disable=no-member
class TestAST(unittest.TestCase):
def test_node_init(self):
self.assertRaises(
NotImplementedError,
ast.Node
)
def test_eq(self):
foocon = ast.Constructor("foo", [])... |
import datetime
from unittest import mock
import pytest
from openapi_core.extensions.models.models import Model
from openapi_core.spec.paths import SpecPath
from openapi_core.unmarshalling.schemas.exceptions import (
FormatterNotFoundError,
)
from openapi_core.unmarshalling.schemas.exceptions import InvalidSchema... |
import toothpick
from toothpick import exceptions
from toothpick import hooks
from toothpick.test import TestResource
from nose.tools import *
hooks.register_hook('side_effect')
hooks.register_hook('too_many_yields')
hooks.register_hook('not_enough_yields')
hooks.register_hook('mixin')
class HookMixin(object):
... |
# Copyright 2015-2020 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyri... |
from bokeh.io import show
from bokeh.layouts import gridplot
from bokeh.plotting import figure
x_range = ['a', 'b', 'c', 'd']
y_values = [1., 2., 3., 4.]
y_errors = [.1, .2, .3, .4]
err_xs = []
err_ys = []
for x, y, yerr in zip(x_range, y_values, y_errors):
err_xs.append((x, x))
err_ys.append((y - yerr, y + ... |
#!/usr/local/bin/python -tt
# -*- coding: utf-8 -*-
import os, sys, random
#supply input as raw_input if running Python 3 or higher
if sys.version_info >= (3,0):
raw_input = input
def parse(structure, part, phonemes):
#grab a random phoneme from the relevant category and return it
#structure can be O, N, or C, pas... |
"""
A command-line based frontend for interacting with myweb.
"""
from myweb.backend import config, db, query, utils
import argparse
import os
import re
import sys
import tempfile
HELP = """myweb-cli - A command-line interface to myweb.
Usage:
myweb-cli <command> <args>
Commands:
search QUERY
Search... |
class Rule(object):
'''
classdocs
'''
def __init__(self, A, alpha=[], order=[], paramConst=[], prob=0.1, pid=False):
'''
Constructor
'''
self._A=A #this item is either of type Sigma or NT
self._alpha=alpha #this is a list of NTs and Sigmas
... |
from __future__ import print_function
from __future__ import division
from past.utils import old_div
from useful import match_resol
import numpy
import sys
# Hacked to use numpy and avoid import * commands
# FM
Float = numpy.float
less = numpy.less
def function(z, m, nt):
"""HDFN prior for the main six types of ... |
getObject = {
'id': 100,
'hostname': 'vs-test1',
'domain': 'test.sftlyr.ws',
'fullyQualifiedDomainName': 'vs-test1.test.sftlyr.ws',
'status': {'keyName': 'ACTIVE', 'name': 'Active'},
'billingItem': {
'id': 6327,
'nextInvoiceTotalRecurringAmount': 1.54,
'children': [
... |
r"""
A palindrome_ is a word, phrase, number or sequence of characters which reads
the same backward as forward. Examples for words are *radar*, *level*, and
*racecar*. Write a function that checks whether a :class:`strings <str>` is a
palindrome or not.
.. autofunction:: is_palindrome_string
Start by downloading the... |
from django.test import TestCase
# Create your tests here.
import datetime
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from resume.forms import WorkExperienceTranslationForm
from testings.factory import Factory
class WorkExperienceTranslationFormTest(TestCase):
def ... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import argparse
import warnings
import numpy as np
import scipy.stats as stats
from scipy.special import gammaln
from scipy import optimize
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import csv as csv... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'He Tao'
'''
This script is used to fetch the picture of bing's mainpage.
Author: He Tao, hetao@mail.com
Date: December 13, 2014
'''
import http.client
import re
from datetime import date
def get_bing_pic():
conn = http.client.HTTP... |
#!/usr/bin/python3.2
import pymongo
from datetime import datetime
import json
from os import listdir, remove
from os.path import isdir, isfile, join
from pymongo import MongoClient
import pprint
class ExchangeError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
re... |
#!/usr/bin/python
import os, requests, time, json, argparse
API = "https://api.digitalocean.com/v2/droplets"
DROPLET_NAME = "ol-tester"
HEADERS = {
"Authorization": "Bearer "+os.environ['TOKEN'],
"Content-Type": "application/json"
}
def post(args):
r = requests.post(API, data=args, headers=HEADERS)
re... |
#!/usr/bin/env python
""" Assignment 1, Exercise 3, INF1340, Fall, 2015. Troubleshooting Car Issues.
This module contains one function diagnose_car(). It is an expert system to
interactive diagnose car issues.
"""
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__... |
#!/usr/bin/python
#
# Copyright 2016 Pinterest, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from django.contrib import admin
from tinyblog.models import Post, EmailSubscriber
from tinymce.widgets import TinyMCE
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'slug', 'created', 'emailed', )
list_filter = ('emailed', )
date_hierarchy = 'created'
search_fields = ('title', 'text', )
... |
import os
import numpy as np
from scipy.optimize import curve_fit
from matplotlib import pyplot as plt
def plotmosaic(vis='', sourceid='', figfile='', coord='relative', skipsource=-1,
doplot=True, help=False, sciencespws=False, vm='', debug=False,
intent='OBSERVE_TARGET#ON_SOURCE'):
... |
# oracle/base.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: oracle
:name: Oracle
Oracle version 8 through current (11g ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import pytest
from mock import Mock
from crabpy.gateway.exception import (
GatewayRuntimeException,
GatewayResourceNotFoundException
)
from crabpy.gateway.crab import (
Gewest, Provincie,
Gemeente, Deelgemeente, Taal,
Bewe... |
#!/usr/bin/python
import fileinput
import os
class CalendarManager:
def __init__(self, calendar_name, dry_run, include_descriptions):
self.calendar_name = calendar_name
self.dry_run = dry_run
self.include_descriptions = include_descriptions
def clear_calendar(self):
command =... |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2016 Kozea
#
# This library is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version... |
# Copyright (C) 2012 Alexander Jones
#
# This file is part of Manitae.
#
# Manitae is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... |
#!/usr/bin/env python
"""
Test of the sessions plugin
Copyright 2009 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import unittest, os, subprocess, StringIO, exceptions
import Ice
import Glacier2
import omero
import omero_ext.uuid as uuid # see tick... |
from dtrange.calendar import day_of_year, day_of_year_date, date_plus_days, ordinal
from datetime import datetime
import unittest
class TestCalendar(unittest.TestCase):
def test_day_of_year(self):
dt = datetime(2000, 2, 1)
doy = day_of_year(dt, 'julian')
expect = 32
self.assertEqua... |
import datetime
import calendar
import re
def validate_email(email, email_regex_csv):
regex_list = [e.strip() for e in email_regex_csv.split(',')]
for user_regex in regex_list:
## Only * is allowed in user email regex
match_regex = re.escape(user_regex)
match_regex = "^%s$" % match_reg... |
# -*- coding: utf-8 -*-
from zerver.lib.actions import get_realm, do_add_realm_filter
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import RealmFilter
class RealmFilterTest(ZulipTestCase):
def test_list(self) -> None:
email = self.example_email('iago')
self.login(email)
... |
# -*- coding: utf-8 -*-
"""Replace userid of principals with uuid
Revision ID: 4e206c5ddabd
Revises: 83d3ede06c
Create Date: 2017-06-28 18:17:08.664550
"""
from alembic import op
from sqlalchemy.sql import column, table
from sqlalchemy_utils import UUIDType
import sqlalchemy as sa
from progressbar import ProgressBar... |
from model.model_group import Group
import random
class GroupHelper:
def __init__(self, app):
self.app = app
def select_group_by_index(self, index):
wd = self.app.wd
wd.find_elements_by_name("selected[]")[index].click()
def select_group_by_id(self, id):
wd = self.app.wd
... |
#!/usr/bin/env python
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2017 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of python-quilt for details.
import os.path
import six
from helpers import QuiltTe... |
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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, t... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Sets up various automatic gyp environment variables. These are used by
gyp_chromium and landmines.py which run at different stages of runhooks. To
make s... |
import unittest
import os
import yaml
from medleydb import multitrack
from medleydb import AUDIO_PATH
from medleydb import MIXING_COEFFICIENTS
class TestMultitrack(unittest.TestCase):
def setUp(self):
self.mtrack = multitrack.MultiTrack("NightPanther_Fire")
self.mtrack2 = multitrack.MultiTrack("Ph... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-02-09 19:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Authenticat... |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any la... |
"""
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distri... |
from django.contrib import messages
from django.dispatch import receiver
from django.http import HttpResponseForbidden
from allauth.account.signals import user_logged_in
from allauth.exceptions import ImmediateHttpResponse
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter, get_adapter
from allauth.... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015 CERN.
#
# INSPIRE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any... |
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from django.views import generic
from .models import Target
from .forms import TargetForm
import utils
# Create your views here.
#class IndexView(generic.ListView):
# template_name = 'search/index.html... |
import os.path as op
from nose.tools import assert_true, assert_raises
import warnings
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_allclose,
assert_equal)
import copy as cp
import mne
from mne.datasets import testing
from mne import pick_types
from mne.i... |
#!/usr/bin/env python3
# coding: utf-8
import os
import glob
import sfml as sf
class Animation:
"""
An animated texture.
"""
def __init__(self, frames, interval=0):
"""
:param frames: Iterable of sf.Texture objects
:param interval: Time between two frames (default: 0.0s)
"""
self.frames = frames
s... |
# -*- coding: utf-8 -*-
# Author : Satish Palaniappan
__author__ = "Satish Palaniappan"
'''
Copyright 2015 Satish Palaniappan
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.o... |
import sched
import threading
import time
from PyQt5 import QtCore
from PyQt5 import QtWidgets
import bwb.model
ID_NOT_SET = -1
BUTTON_WIDTH_IT = 28
class PracticeCompositeWidget(QtWidgets.QWidget):
time_of_day_state_changed_signal = QtCore.pyqtSignal()
def __init__(self):
super().__init__()
... |
#!/usr/bin/python2
"""
Copyright 2016 Iakov Kirilenko
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... |
'''Tests for the cli interface'''
from __future__ import absolute_import
import unittest
import sys
from nose.tools import assert_equals
from hashit.cli.cli import cli_main
from hashit.cli.cli_status import CliStatus
# pylint: disable=missing-docstring
# pylint: disable=invalid-name
# pylint: disable=no-self-use
# p... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from models.InputPlugin import InputPlugin
from oauth2client.client import OAuth2WebServerFlow, AccessTokenCredentials
from googleapiclient.discovery import build
import logging
import os
import urllib
import httplib2
import dateutil.parser
from PyQt4.QtGui import QWizard, QWiz... |
####################################################################################################
#
# MonitorServer - A Server Monitoring Application
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
#!/usr/bin/env python
# Mandelbrot calculate using GPU, Serial numpy and faster numpy
# Use to show the speed difference between CPU and GPU calculations
# ian@ianozsvald.com July 2010
# Based on vegaseat's TKinter/numpy example code from 2006
# http://www.daniweb.com/code/snippet216851.html#
# with minor changes to ... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Plugin import Fail, encode
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookie, set_cookies
class MultiHoster(SimpleHoster):
__name__ = "MultiHoster"
__type__ = "hoster"
__version... |
from tests.utils import remove_file
from photomanager.lib.pmconst import PMDBNAME
from photomanager.commands.index import CommandIndex
from photomanager.commands.update import CommandUpdate
from photomanager.db.dbutils import get_db_session, close_db_session
from photomanager.db.models import ImageMeta
cmd_inx_test_ro... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import six
import json
import warnings
try:
from cchardet import detect
except ImportError:
from chardet import detect
import requests
from co... |
#!/usr/bin/env python
'''
Identify the location of a missing word in a sentence
using a POS-tag n-gram model. Computes gap likelihood
as:
P(gap) = P(a, *, b) / P(a, b)
'''
import sys, argparse, pickle
from collections import defaultdict
import numpy as np
from scipy.misc import logsumexp
from util import window, tok... |
#!/usr/bin/python
#
# Copyright 2014 Google 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
#
# Unless required b... |
import sys, os, itertools, inspect, logging, math
import numpy as np
from uncertainties import ufloat
from uncertainties.umath import fsum
from decimal import Decimal
mass_titles = [ 'pi0', 'LMR', 'omphi', 'IMR' ]
eRanges = np.array([ Decimal(str(e)) for e in [ 0, 0.4, 0.75, 1.1, 3. ] ])
def getWorkDirs():
"""get in... |
# -*- coding: utf-8 -*-
"""
wakatime.queue
~~~~~~~~~~~~~~
Queue for offline time logging.
http://wakatime.com
:copyright: (c) 2014 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
import logging
import os
import traceback
from time import sleep
try:
import sqlite3
HAS_S... |
# This function is triggered by API Gateway as an authorizer. It uses the HTTP
# basic auth Authorization header to permit access to API Gateway methods by
# returning a policy document when the credentials match those defined as stack
# parameters.
import os
import base64
def lambda_handler(event, context):
hea... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
import sys
import wave
def wav_to_c(wav_filename, code_filename, array_name):
with wave.open(wav_filename, 'r') as wav_file, \
open(code_filename, 'w') as code_file:
length = wav_file.getnframes()
if wav_file.getnchannels()... |
"""Automated testing of GATT functionality using unittest.mock."""
import sys
import unittest
from unittest.mock import MagicMock
from unittest.mock import patch
import tests.obj_data
from bluezero import constants
adapter_props = tests.obj_data.full_ubits
def mock_get(iface, prop):
if iface == 'org.bluez.Device... |
"""Unit test for Treadmill ZK apptrace module.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import time
import sqlite3
import mock
import kazoo
import kazoo.client
from treadmill.apptrace impo... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, 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 progra... |
from vms import models
from django.contrib.auth.models import User
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.contrib.admin.widgets import AdminSplitDateTime
from django.utils.translation import ugettext_lazy as _
from datetimewidget.widgets import DateTimeWidget, Date... |
#!/usr/bin/env python
"""\
C version: Dmitri Laikov
F77 version: Christoph van Wuellen, http://www.ccl.net
Python version: Richard P. Muller, 2002.
This subroutine is part of a set of subroutines that generate
Lebedev grids [1-6] for integration on a sphere. The original
C-code [1] was kindly provided by Dr. Dm... |
import seedlib
import string
import json
from mnemonic import Mnemonic
from binascii import hexlify, unhexlify
import bitcoin
# class Granary():
# pass
class Seed():
def __init__(self):
self._bin_seed = None
self._fingerprint = None
self._bip32_xpriv = None
def __no... |
#
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2020 The Matrix.org Foundation C.I.C.
#
# 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
#
#... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HPos_ChildSchool_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HPos_ChildSchool_ConnectedLHS.
"""
... |
from django.conf.urls.defaults import *
from django.views.static import serve
from W4W.models import school, inschrijving,steunpunt
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
info_dict_list_scholen = {
'queryset': scho... |
#
# Copyright (c) 2017 Intel Corporation
#
# 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... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Authors: Boris Timokhin, Alexey Samoukin, Dmitry Zhuravlev-Nevsky.
#
# Copyright InfoSreda LLC.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... |
#!/usr/bin/env python
import math
"""
Bytes-to-human / human-to-bytes converter.
Based on: http://goo.gl/kTQMs
Working with Python 2.x and 3.x.
Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
"""
# see: http://goo.gl/kTQMs
SYMBOLS = {
'customary' : ('B', 'KB', 'MB', 'GB', 'TB', 'PB', ... |
from __future__ import division
import numpy as np
import scipy.stats as stats
from numpy import newaxis as na
np.seterr(invalid='raise')
import operator
import copy
from scipy.special import digamma, gammaln
from ..basic.abstractions import GibbsSampling
from ..basic.distributions import GammaCompoundDirichlet, Mult... |
# -*- coding: utf-8 -*-
__author__ = 'Nop Phoomthaisong (aka @MaYaSeVeN)'
__version__ = 'reverseIP version 1.0 ( http://mayaseven.com )'
import urllib
import urllib2
import json
import re
import sys
import optparse
import socket
def main():
print "\n" + __version__
usage = "Usage: python " + sys.argv[
... |
"""
Primitive UI elements.
"""
import gta_native
from gta import Font
from gta.ui import Item, Point, Color
__all__ = ('Rectangle', 'Label')
class Rectangle(Item):
def draw(self, offset=Point.Zero, **settings):
# TODO: Remove logging
from gta import utils
logger = utils.get_logger('gta.R... |
# Copyright 2016 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.