src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
from functools import lru_cache
from itertools import repeat
from math import ceil, floor
from typing import (
Any, Callable, Dict, Generator, List, Optional, Sequence, Set, Tuple
)
from kitty.bo... |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2010-2011 OpenStack, 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/lice... |
#!/usr/bin/env python
from jinja2 import Environment, FileSystemLoader
import json
import os
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_PATH = os.path.abspath(os.path.join(THIS_DIR, '../nbawebstats/requests.json'))
RST_PATH = os.path.abspath(os.path.join(THIS_DIR, 'requests.rst'))
def format_internal... |
# Copyright (c) 2015 Davide Gessa
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from pycoin.networks import *
from pycoin.key import Key
from pycoin.key.BIP32Node import BIP32Node
from pycoin import encoding
from pycoin.ecdsa im... |
# This file is part of formunculous.
#
# formunculous is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# formu... |
# Copyright (C) 2016 Pier Carlo Chiodi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed... |
## Copyright(c) 2009 William Waites <wwaites_at_gmail.com>
##
## 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, co... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 your option) any later version.
#
# This program is distrib... |
# -*- coding: utf-8 -*-
# native imports
import os
import re
import sys
import copy
import time
import pickle
import random
from threading import Thread, RLock
from multiprocessing import Queue
# external imports
# Twitter package: https://pypi.python.org/pypi/twitter
# Homepage of Twitter package: http://mike.verdon... |
#
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the... |
#!/usr/bin/env python
import os,sys
from os.path import join,abspath,split
import inspect
from collections import OrderedDict as odict
import numpy as np
from numpy.lib.recfunctions import stack_arrays
import fitsio
import ugali.utils.projector
from ugali.utils.projector import gal2cel, cel2gal
import ugali.utils.idl... |
# coding:utf-8
#!/usr/bin/env python
import smtplib,datetime,sys
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
username = sys.argv[1]
passwd = sys.argv[2]
_user = "oa@eycode.com"
_pwd = "密码"
_to_list = ["%s@eycode.com"%userna... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
# ingredient type model
class Ing_Type(models.Model):
name = models.CharField(max_length=10)
def __str__(self):
return self.name
# ingredient model
class Ingredient(models.Model):
name... |
import os
import sys
import glob
import json
from collections import defaultdict
from utils import UnicodeReader, slugify, count_pages, combine_pdfs, parser
import addresscleaner
from click2mail import Click2MailBatch
parser.add_argument("directory", help="Path to downloaded mail batch")
def fix_lines(address):
... |
import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
@pytest.fixture
def driver(request):
wd = webdriver.Chrome() # Optional argument, if not specified wi... |
from cadnano.cnproxy import UndoCommand
class RemoveAllStrandsCommand(UndoCommand):
"""
1. Remove all strands. Emits strandRemovedSignal for each.
2. Remove all oligos.
"""
def __init__(self, part):
super(RemoveAllStrandsCommand, self).__init__("remove all strands")
self._part = pa... |
# coding: utf-8
# © 2016 David BEAL @ Akretion <david.beal@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from openerp import _, api, models
from openerp.exceptions import Warning as UserError
_logger = logging.getLogger(__name__)
class StockTransferDetails(models... |
import unittest
from mpf.core.rgba_color import RGBAColor
from mpf.core.rgb_color import RGBColor, RGBColorCorrectionProfile
class TestRGBColor(unittest.TestCase):
def test_default_color(self):
"""Test the default color."""
color = RGBColor()
self.assertEqual((0, 0, 0), color.rgb)
... |
import numpy as np
import matplotlib
import matplotlib.image as image
import matplotlib.pyplot as plt
from matplotlib.cbook import get_sample_data
from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, AnnotationBbox
#matplotlib.use('QT4Agg')
from combined_env import CombinedEnvironment, HierarchicallyC... |
from __future__ import absolute_import
from myhdl.test.conftest import bug
from myhdl import Signal, uintba, instance, delay, conversion, \
ConcatSignal, TristateSignal, sfixba, always_comb, StopSimulation, \
toVHDL, toVerilog
def bench_SliceSignal():
s = Signal(uintba(0, 8))
a, b, c = s(7), s(5), s(0... |
# -*- coding:utf-8 -*-
'''Created on 2014-8-7 @author: Administrator '''
import web
import Model
import json
from Urls import wiki_Urls
from common.common import (response,logged,upload)
def islogged(func):
def _call(*args,**kwargs):
try:
if logged():
result = func(... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
import re
from io import BytesIO, open
from collections import OrderedDict
import locale
import platform
import pytest
import numpy as np
from ....extern import six # noqa
from ....extern.six.moves impor... |
# This file is part of Silver.
#
# Silver is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Silver is distributed in the hope that ... |
import pytest
import pandas
def test_matplotlib_backend_error():
msg = ('matplotlib is required for plotting when the default backend '
'"matplotlib" is selected.')
try:
import matplotlib # noqa
except ImportError:
with pytest.raises(ImportError, match=msg):
pandas... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Alexandre Flament
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the L... |
import os
import pytest
from model_mommy import mommy
@pytest.mark.parametrize('value', (
'',
'/',
'/test/test2',
'/test/test2/',
))
def test_strip_trailing_slash(value):
from leaf.page import strip_trailing_slash
assert not strip_trailing_slash(value).endswith('/')
@pytest.mark.parametrize... |
# -*- coding: UTF-8 -*-
from django.http import HttpResponse, HttpResponseRedirect
from datetime import datetime, date
from apps.seguridad.decorators import login_required, credential_required
from apps.seguridad.models import Usuario, Perfil
from apps.titulos.models.NormativaJurisdiccional import NormativaJurisdiccio... |
''' Copyright (c) 2008, Kent S Johnson
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 2.1 of the License, or (at your option) any later version.
This libra... |
# -*- coding: utf-8 -*-
"""Test the sample image selection."""
import os
from flask_editablesite.app import create_app
from flask_editablesite.settings import TestConfig
from flask_editablesite.editable.sample_images import (
placeholder_or_random_sample_image,)
def test_placeholder_when_no_sample_images_conf... |
"""Unit tests for the commute module."""
import unittest
from bob_emploi.frontend.api import geo_pb2
from bob_emploi.frontend.server.test import base_test
from bob_emploi.frontend.server.test import scoring_test
class CommuteScoringModelTestCase(scoring_test.ScoringModelTestBase):
"""Unit test for the "Commute"... |
from datetime import datetime
from django.contrib.auth.models import BaseUserManager as DjangoBaseUserManager
from django.utils import timezone
class UserManager(DjangoBaseUserManager):
"""
Default manager for the User model.
"""
###################################
# Required Django manager meth... |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... |
# Automatically fetches menus for today, grades predefined cafes and based on
# additional information (weather, cafe of choice yesterday) gives recommendations
# where to go for lunch.
# If there are problems with encoding set Python encoding correctly by executing:
# set PYTHONIOENCODING=utf-8
from chief_lunch_offic... |
# coding=utf-8
#
# Copyright © 2011 Intel Corporation
#
# 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, me... |
# Copyright (c) 2015 Faculty of Engineering of the University of Porto
#
# 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,... |
# -*- coding: utf-8 -*-
# Copyright: David Snopek <dsnopek@gmail.com>
# License: GNU Affero GPL, version 3 or later; http://www.gnu.org/copyleft/agpl-3.0.html
#
# Sync decks to BiblioBird.com instead of AnkiWeb.
#
# This allows BiblioBird users to access a special "bibliobird" deck, which
# contains flashcards for all ... |
# Copyright (C) 2013-2016 Jean-Francois Romang (jromang@posteo.de)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... |
# -*- coding: utf-8 -*-
from .parsers.parser import CsvMapParser
from .models.fields.base import ListField
from .models.fields import ModelDescriptor
class ConvertResult(object):
def __init__(self, map_result, models = None):
self.__map_result = map_result
self.__models = models
@property
... |
#!/usr/bin/env python3.5
# This is a combination of ShutdownRebootButton.py and VolumeRotaryControl.py. It is handy for those who use a rotary switch.
# Author: Axel Berndt
from RPi import GPIO
from time import sleep, time
from subprocess import call
import alsaaudio
GPIOpinButton = 27 # Button is on GPI... |
"""
This is the general interface to load data, either we want to
load the data from internet through panda or load local data through
QSTK for tests.
@author Alice Wang
"""
import pandas.io.data as web
from load_local_data import load_local_data_from_yahoo
def load_stock_close_price(start_date, end_date, ls_symbols,... |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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
#
# Un... |
import os
from string import Template
from xml.sax.saxutils import escape
from dbbot import Logger
class HtmlWriter(object):
template_path = os.path.abspath(__file__ + '../../../templates')
# escape() only takes care of &, < and >
additional_html_escapes = {
'"': """,
"'": "'"
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'face_recognition_models>=0.3.0',
'Click>=6.0',
'dlib>=19.7',
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.db import models, migrations
def reconvert_tests(apps, schema_editor):
pass
def convert_tests(apps, schema_editor):
# convert PregnancyTest to UrineTest.pregnancy_test
... |
from vsg.rules import align_tokens_in_region_between_tokens_when_between_tokens_unless_between_tokens
from vsg import token
lAlign = []
lAlign.append(token.full_type_declaration.identifier)
lAlign.append(token.incomplete_type_declaration.identifier)
lAlign.append(token.file_declaration.identifier)
lAlign.append(toke... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# 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 Apach... |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Library General Public Lic... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# layout.py
#
# Copyright 2020 notna <notna@apparat.org>
#
# This file is part of peng3d.
#
# peng3d 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, ei... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base import serialize
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response... |
"""
SpiderManager is the class which locates and manages all website-specific
spiders
"""
from zope.interface import implements
from ants import signals
from ants.utils.interfaces import ISpiderManager
from ants.utils.misc import walk_modules
from ants.utils.spider import iter_spider_classes
class SpiderManager(obj... |
# -*- coding: utf-8 -*-
"""
This test file tests the lib.token methods.
The lib.token depends on the DB model and lib.user and
all lib.tokenclasses
This tests the token functions on an interface level
We start with simple database functions:
getTokens4UserOrSerial
gettokensoftype
getToken....
"""
from .base import ... |
#!/usr/bin/env python
import os, sys
import ctypes
import tables
import numpy as np
import numpy.random as npr
libfastann = ctypes.CDLL('libfastann.so')
try:
libfastcluster = ctypes.CDLL('libfastcluster.so')
except OSError, e:
libfastcluster = ctypes.CDLL('./libfastcluster.so')
def get_suffix(dtype):
re... |
from kona.linalg.matrices.common import IdentityMatrix
from kona.linalg.matrices.hessian import ReducedKKTMatrix
class NestedKKTPreconditioner(ReducedKKTMatrix):
"""
This object preconditions the KKT system by doing approximate solutions
of the 2nd order adjoints using the PDE preconditioner.
The appr... |
#!/usr/bin/env python3
# This source file is part of Obozrenie
# Copyright 2015 Artem Vorotnikov
# For more information, see https://github.com/obozrenie/obozrenie
# Obozrenie is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by th... |
# Copyright 2014 IBM Corp.
#
# 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 t... |
from . import ast
from .stringescape import escapeString as escape
class MethodDef(object):
def __init__(self, class_, flags, name, desc, retType, paramDecls, body):
self.flagstr = flags + ' ' if flags else ''
self.retType, self.paramDecls = retType, paramDecls
self.body = body
self... |
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.osv import expression
class AccountMove(models.Model):
_inherit = 'account.move'
date_range_fy_id = fields.Many2one(
comodel_name='date.range', string="Fiscal... |
from django.test import TestCase
from django.test import RequestFactory
from django.test import Client
from indicators.models import Indicator, IndicatorType, Objective, DisaggregationType, ReportingFrequency, CollectedData
from activitydb.models import Program, Sector
from django.contrib.auth.models import User
clas... |
# Copyright (C) 2010 Google Inc. 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 f... |
#coding: utf-8
import requests
import os.path
import pickle
def get_binary_dataset():
# 0-1 dataset
dataset = requests.get('https://archive.ics.uci.edu/ml/machine-learning-databases/spect/SPECT.train').text
dataset = map(lambda row: row.split(','), dataset.split('\n'))
titles = dataset[0]
dataset =... |
#
# 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... |
from edxclassify.feature_spec import FEATURE_COLUMNS
from edxclassify.classifiers.word_lists import *
from edxclassify.data_cleaners.dc_util import compress_likert
import re
import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
def to_int(value, aux=None):
if value == '':
return 0
return i... |
from setuptools import setup, find_packages
import os
package_root = os.path.dirname(__file__)
about = {}
with open("xtrabackup/__about__.py") as fp:
exec(fp.read(), about)
# Error-handling here is to allow package to be built w/o README.rst included
try:
long_description = open(os.path.join(package_root, 'R... |
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame
from pygame.constants import *
from breakout.game.GameEngine import GameEngine
_FRAMES_PER_SECOND = 60
_MOUSE_VISIBLE = True
_CANVAS_WIDTH = 250
_CANVAS_HEIGHT = 300
_DEFAULT_SCREEN_WIDTH = 500
_DEFAULT_SCREEN_HEIGHT = 600
class GameController(object)... |
attribvocab={"*":["twasks","id","name","class","classes","event","events","contains",'contains'+textvocab['oc']],\
"link":["media","rel","rev","type","href","hreflang","charset"],\
"style":["type"],\
"script":["src","type"],\
"a":["href"],\
"form":["action","method","enctype","accept","onsubmit","onreset","ac... |
# Copyright 2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
#! /usr/bin/env python
from openturns import *
from math import *
TESTPREAMBLE()
RandomGenerator().SetSeed(0)
try :
coll1 = DistributionCollection(0)
coll1.add(Normal(1.0, 2.5))
coll1.add(Gamma(1.5, 3.0))
pointLow = NumericalPoint(0)
pointLow.add(coll1[0].computeQuantile(0.25)[0])
pointLow.ad... |
# -*- coding: utf8 -*-
"""Creates the MongoDB indexes. This can be run each time the app is deployed
it will have no effect on indexes which are already there.
:license: AGPL v3, see LICENSE for more details
:copyright: 2014-2021 Joe Doherty
"""
# 3rd party imports
import pymongo
# Pjuu imports
from pjuu import mon... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
import os
import sys
from django.conf import settings
from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# SQLite doesn't actually support most of these types, but it "does the right
# thing" given more verbose field definitions, so leave them as i... |
#!/usr/bin/python
#
# PyIRCBot
# Copyright (C) Pierre Jaury 2011 <pierre@jaury.eu>
#
# PyIRCBot 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... |
"""Tests for migrate script."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from multiprocessing import Process
import os
import shutil
import tempfile
import time
import unittest
from filetracker.client import Client, FiletrackerError
from filetracker... |
import tornado.web
import tornado.escape
import logging
import base64
try:
from urllib.parse import unquote, quote, urlsplit
except ImportError:
from urllib import quote
from urlparse import unquote, urlsplit
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longe... |
# Copyright 2012-2014 Brian May
#
# This file is part of python-tldap.
#
# python-tldap is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" crawl data
"""
import pandas as pd
import re
import math
def crawlHTML(lXall):
"""
crawling raw data
"""
print("Crawling html data...")
basedir='../stumbled_upon/raw_content/'
#phtml = re.compile("</[^>]*?>")
phtml = re.comp... |
import pytest
from test.integration.conftest import new_config
from pnc_cli import buildconfigurationsets
from pnc_cli import utils
from test import testutils
from pnc_cli.swagger_client.apis.buildconfigurationsets_api import BuildconfigurationsetsApi
import pnc_cli.user_config as uc
__author__ = 'thauser'
@pytest... |
# -*- coding: utf-8 -*-
#
# callee documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 14 11:24:04 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
##Module that converts the Xml response to dictionary
from lxml import etree
import re
def dictlist(node):
res = {}
node_tag = re.findall(r'}(\w*)', node.tag)
node_tag = node_tag[0]
res[node_tag] = []
xmltodict(node, res[node_tag])
reply = {}
reply[node_tag] = res[node_tag]
return repl... |
# 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 https://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
from distutils.spawn import find_executable
from distutils.vers... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_optaa_ac_mmp_cds
@file marine-integrations/mi/dataset/parser/test/test_optaa_ac_mmp_cds.py
@author Mark Worden
@brief Test code for a optaa_ac_mmp_cds data parser
"""
import os
import numpy
import yaml
import copy
from nose.plugins.attrib import attr
fr... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# Infinite push
""" store draft commits in the cloud
Configs::
[infinitepush]
# Server-side and client-side option. Pattern of the infinitepus... |
# -*- coding: utf-8 -*-
"""
Unit tests for the OBSolve class.
Thomas Ogden <t@ogden.eu>
"""
import os
import unittest
import numpy as np
from maxwellbloch import ob_solve, t_funcs
# Absolute path of tests/json directory, so that tests can be called from
# different directories.
JSON_DIR = os.path.abspath(os.path... |
import random
import matplotlib
import matplotlib.pyplot as plt
from Neurons.NeuralNetwork import NeuralNetwork
from Utils.utilities import generate_network, get_seeds
matplotlib.style.use('ggplot')
def two_scales(ax1, x, data1, data2, c1, c2):
ax2 = ax1.twinx()
ax1.plot(x, data1, color=c1)
ax1.set_xl... |
# Copyright (c) 2014 Cospan Design
# This file is part of Nysa (wiki.cospandesign.com/index.php?title=Nysa).
#
# Nysa 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
# any ... |
"""`BVT24`"""
import numpy as np
from .base import ProsthesisSystem
from .electrodes import DiskElectrode
from .electrode_arrays import ElectrodeArray
class BVT24(ProsthesisSystem):
"""24-channel suprachoroidal retinal prosthesis
This class creates a 24-channel suprachoroidal retinal prosthesis
[Layton2... |
import itertools
from SystemPanic.Core.draw_util import draw_text, draw_sprite
from SystemPanic.Core.sprite_state import do_sprites_collide
def draw_ingame(game_surface, game_state):
# Add the background
game_surface.blit(
game_state["active_config"]["background"],
[0, 0]
)
# Add the... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... |
import xml.etree.ElementTree as ET
import xml.dom.minidom as MD
from src.hydratk.extensions.yoda.testresults.handlers.xjunit.testsuite import TestSuite
from .testCase import TestCase
from .utils import forceUnicode, cleanIllegalXmlChars
class TestReport(object):
class XmlDecodingFailure(Exception):
pas... |
# Copyright 2018 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
import os
import time
import bsddb3 as bsddb
'''
Retrieve records with a given data
- Assume that database is closed before calling ret_DATA();
- Writes (append) the result to the file 'answers'.
For now I assume that indexfile = btree, further tests are necessary.
Tested under DB_SIZE = 10
'''
DB_FILE = "/tmp/yish... |
from __future__ import absolute_import
from typing import Any, List, Dict, Optional, Text
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse, HttpRequest
from django.shortcuts import redirect
from django.utils import translation
from... |
# test_turingmachine.py - tests for turingmachine.py
#
# Copyright 2014 Jeffrey Finkelstein.
#
# This file is part of turingmachine.
#
# turingmachine 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 ver... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2016 sadikovi
#
# 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... |
from copy import copy
import numpy as np
from ..base import Model, CollectionMixin, ParamMixin
from ..feed import Feed
class SiameseNetwork(Model, CollectionMixin):
def __init__(self, siamese_layers, loss):
self.layers = siamese_layers
self.loss = loss
# Create second array of layers
... |
from __future__ import absolute_import
import responses
from six.moves.urllib.parse import urlparse, urlencode, parse_qs
from sentry.integrations.vsts import VstsIntegrationProvider
from sentry.testutils import IntegrationTestCase
class VstsIntegrationTestCase(IntegrationTestCase):
provider = VstsIntegrationPr... |
#! /usr/bin/env python
###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2007
# Chair of Communication Networks (ComNets)
... |
"""
byceps.util.framework.flash
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Flash message utilities
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import namedtuple
from flask import flash
FlashMessage = namedtuple('FlashMessage',
['text'... |
#!/usr/bin/env python
import axreader
import common
import groundComms
import time
import logging
if __name__ == "__main__":
LOG_IN_PATH = "/home/spex/axlisten.log"
LOG_DATA_PATH = "/home/spex/habip_data.log"
LOG_CMDACK_PATH = "/home/spex/habip_ack.log"
AX_INTERFACES = ["sm0"]
AX_SOURCES = ["W2RI... |
import os
from setuptools import setup
# Set external files
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
with open(os.path.join(os.path.dirname(__file__), 'requirements.txt')) as f:
required = f.read().splitlines()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
from itertools import chain
from glob import glob
import cookielaw
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.