src stringlengths 721 1.04M |
|---|
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2021 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from flask import session
from sqlalchemy.orm.attributes import flag_modified... |
#
# qc.py - Quantum Computing Library for Python
#
# by Pius Fischer, February 13-20, 2016
#
# Various functions for mathematically simulating the quantum circuit model of computation.
#
# Example 1 - Superdense coding (sending two classical bits a1 and a2 from Alice to Bob via
# ... |
# -*- coding: utf-8 -*-
from datetime import date, datetime, timedelta
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
class MaintenanceStage(models.Model):
""" Model for case stages. Th... |
"""Supporting definitions for the Python regression tests."""
if __name__ != 'test.support':
raise ImportError('support must be imported from the test package')
import contextlib
import errno
import socket
import sys
import os
import os.path
import shutil
import warnings
import unittest
__all__ = ["Error", "Test... |
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.tasks.metadata_etl import MetadataSingleEntityTransformTask
from cumulusci.utils.xml.metadata_tree import MetadataElement
class AddPermissionSetPermissions(MetadataSingleEntityTransformTask):
entity = "PermissionSet"
task_options = {
... |
# Copyright 2019 The Magenta 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 law or agreed to in ... |
import emoji
import pallete
import node
import gvInput
class ActionsProcessor():
""" Class containing neccessary methods for putting actions scheduled by blivet into graph"""
def __init__(self, actions_list, node_list, edge_list, path_to_pallete):
self.actions = actions_list
self.node_list = no... |
def bubble_sort(input_list):
input_list_length = len(input_list)
for passed in range(input_list_length-1):
for index in range(input_list_length-1):
if (input_list[index] > input_list[index+1]):
input_list[index], input_list[index+1] = input_list[index+1], input_list[index]
# print input_lis... |
from rest_framework import serializers
from . import models
from clients import serializers as client_serializers
from users import serializers as user_serializers
class WorkTypeSerializer(serializers.ModelSerializer):
name = serializers.CharField(read_only=True)
class Meta:
model = models.WorkType... |
from argparse import ArgumentParser
from pathlib import Path
import requests
# arguments
# -d paypal_general_errors.html -p https://developer.paypal.com/docs/classic/api/errors/general/
def download_html(url):
print("Downloading webpage from {0}".format(url))
page = requests.get(url)
return page.text
... |
import csv
import os
import re
def translate(file, path):
csv_file = open(file, 'r')
csv_reader = csv.reader(csv_file, delimiter=',')
locales = [
{'identifier' : 'fr', 'column' : 3},
{'identifier' : 'en', 'column' : 5}
]
for aLocale in locales:
if not os.path.e... |
from oldman.resource.resource import ClientResource
from oldman.store.selector import DataStoreSelector
from oldman.model.manager import ClientModelManager
DEFAULT_MODEL_NAME = "Default_Client"
class ClientResourceManager:
"""
TODO: describe
"""
def __init__(self, data_stores, schema_graph=None, at... |
import json
import logging
import time
from abc import ABCMeta, abstractmethod
from collections import Counter
import pytest
from gtd.persist import LazyMapping, EagerMapping, TableMapping, ORM, ORMColumn, FileSequence, FileSerializer, SimpleORM, \
ShardedSequence, CustomSerializer, LazyIterator, BatchIterator, Si... |
#!/usr/bin/env python2
from SettingsWidgets import *
import gi
gi.require_version('AccountsService', '1.0')
from gi.repository import AccountsService, GLib
try:
import PAM
except:
import pam as PAM
import pexpect
import time
from random import randint
import shutil
import PIL
import os
import subprocess
class... |
import logging
import threading
import time
from radosgw_agent import client
log = logging.getLogger(__name__)
class LockBroken(Exception):
pass
class LockRenewFailed(LockBroken):
pass
class LockExpired(LockBroken):
pass
class Lock(threading.Thread):
"""A lock on a shard log that automatically ref... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
# -*- coding: utf-8 -*-
# pylint: disable=star-args, too-many-arguments, fixme
""" This module contains classes for handling DIDL-Lite metadata.
This is the XML schema used by Sonos for carrying metadata representing many
items such as tracks, playlists, composers, albums etc.
"""
# It tries to follow the class h... |
from pwn import *
from time import sleep
def wait_menu():
p.recvuntil('---> ')
def show_my_info():
wait_menu()
p.sendline('1')
def transfer(bank, amount):
wait_menu()
p.sendline('2')
wait_menu()
p.sendline(str(bank))
wait_menu()
p.sendline(str(amount))
def deposit(bank, amou... |
#!/usr/bin/env python2
# encoding: utf-8
'''
FooCoCo, a (SoftStep) Foot Controller Controller.
Copyright 2014, Matthieu Amiguet
This file is part of FooCoCo.
FooCoCo 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 Foundat... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Martin Hawlisch, Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
#
# 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 Soft... |
from datetime import datetime
from django.conf import settings
from django.db.models import Case, IntegerField, Q, Value, When
from django.shortcuts import get_object_or_404, render
from django.views.generic import ListView, TemplateView
from .models import DataQuality
class LeagueTable(ListView):
model = DataQua... |
import os
import unittest
from django.core import mail
from django.test import TestCase
from django.test.utils import override_settings
from django_mailjet import MailjetAPIError
MAILJET_TEST_API_KEY = os.getenv('MAILJET_TEST_API_KEY')
MAILJET_TEST_API_SECRET = os.getenv('MAILJET_TEST_API_SECRET')
@unittest.skipU... |
import unittest
from ctypes import POINTER
from comtypes.automation import IDispatch
from comtypes.client import CreateObject
from comtypes import GUID
##from test import test_support
##from comtypes.unittests import support
try:
GUID.from_progid("MSScriptControl.ScriptControl")
except WindowsError:
# doesn't... |
# Copyright 2008-2013 Alex Zvoleff
#
# This file is part of the chitwanabm agent-based model.
#
# chitwanabm 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... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-01-04 19:35
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('djreceive', '0018_auto_20170104_1418')... |
"""Module containing implementation of monolithic FSI boundary conditions"""
__author__ = "Gabriel Balaban"
__copyright__ = "Copyright (C) 2010 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from dolfin import *
class FSIBC(object):
"""
Boundary Conditi... |
'''Create 1D and 2D profiles to be used in BOUT++ simulations'''
import numpy as np
from scipy import interpolate
from boututils import file_import, DataFile
from boutanalysis import grid
def csv_import(path, column, skip_header=1):
'''Import a 1D profile from a CSV file.
Parameters:
path -- string, p... |
# Copyright (c) 2013,Vienna University of Technology,
# Department of Geodesy and Geoinformation
# 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... |
# script to identify circles where both mates map over the junction
import pysam
import os
import argparse
import pybedtools
import tempfile
parser = argparse.ArgumentParser(description='Extracts mate information and identify singe and double breakpoint fragments')
# input
parser.add_argument('bamfolder', metavar = ... |
# -*- coding: utf-8 -*-
"""Tests for the replace script and ReplaceRobot class."""
#
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id$'
#
import os
from pywikibot import fixes
from scripts import replace
from tests import _d... |
'''
Example of a spike generator (only outputs spikes)
In this example spikes are generated and sent through UDP packages. At the end of the simulation a raster plot of the
spikes is created.
'''
from brian import *
import numpy
from brian_multiprocess_udp import BrianConnectUDP
number_of_neurons_total = 60
numbe... |
import pytest
import numpy as np
from sklearn.neighbors import KDTree
from umap import UMAP
import scanpy as sc
from scanpy import settings
from scanpy._compat import pkg_version
X = np.array(
[
[1.0, 2.5, 3.0, 5.0, 8.7],
[4.2, 7.0, 9.0, 11.0, 7.0],
[5.1, 2.0, 9.0, 4.0, 9.0],
[7.... |
#
# 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 us... |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... |
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> #¸ß½×º¯Êý
>>> x=abs(-10)
>>> x
10
>>> f=abs
>>> f
<built-in function abs>
>>> f(-9)
9
>>> #´«È뺯Êý
>>> #¼ÈÈ»±äÁ¿¿ÉÒÔÖ¸Ïòº¯Êý£¬º¯ÊýµÄ²ÎÊýÄܽÓÊÕ±äÁ¿£¬ÄÇôÒ... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostNetworkTrafficShapingPolicy(vim, *args, **kwargs):
'''This data object type descr... |
#
# Copyright 2014 Thomas Rabaix <thomas.rabaix@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
# Parsec Cloud (https://parsec.cloud) Copyright (c) AGPLv3 2016-2021 Scille SAS
import re
from typing import Optional, Tuple, List, Dict, Any
from random import randint, shuffle
from parsec.crypto import VerifyKey, PublicKey, PrivateKey, SecretKey
from parsec.serde import fields, post_load
from parsec.api.protocol im... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 10:06:20 2015
@author: jpk
ToDo: automate the subsystems check. A query that checks all the subsystems in
case things change in the future should prevent issues with the pis chart
colours
"""
import sys
import os
import pandas as pd
import pandas.io.sql as psql
impor... |
import unittest
from transducer._util import empty_iter
from transducer.eager import transduce
from transducer.infrastructure import Transducer
from transducer.reducers import expecting_single, appending, conjoining, adding, sending, completing
from transducer.sinks import CollectingSink, SingularSink
from transducer.t... |
"""UAT test file for Adventurer's Codex player tools inventory module."""
import time
from conftest import DEFAULT_WAIT_TIME
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC # noqa
from selenium.webdriver.suppor... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
@script : model.py
@created : 2012-11-04 01:48:15.090
@changed : 2012-11-08 10:26:47.237
@creator : mkpy.py --version 0.0.27
@author : Igor A.Vetrov <qprostu@gmail.com>
@about : model of TODO application
"""
from __future__ import print_function
from argparse import... |
# Copyright (c) 2017, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
import asyncio
import logging
import os
import signal
import sys
import time
from functools import partial
class ServerBase(object):
'''Base class serve... |
'''
File: midiExample
Author: Jeff Kinne
Contents: basic example showing how to play midi sounds using pygame.
Requires: this example was run in Python 2.7 with pygame 1.9.2 installed.
Sources: I took the pygame.examples.midi file and extracted out only
what is needed to play a few notes.... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eithe... |
__all__ = [
'BoundedSemaphore',
'UnlimitedSemaphore',
'Timeout',
]
import threading
import time
# NOTE: This module is Python 2 compatible.
class Timeout(Exception):
pass
# Because Python 2 semaphore does not support timeout...
class BoundedSemaphore(object):
def __init__(self, value):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to reply to Telegram messages. This is built on the API wrapper, see
# echobot2.py to see the same example built on the telegram.ext bot framework.
# This program is dedicated to the public domain under the CC0 license.
import logging
import telegram
from tel... |
#Filename: hTestLimit.py
#Author: Matt Strader
#
#This script opens a list of observed photon phases,
import numpy as np
import tables
import numexpr
import matplotlib.pyplot as plt
import multiprocessing
import functools
import time
from kuiper.kuiper import kuiper,kuiper_FPP
from kuiper.htest import h_test,h_fp... |
from typing import Union
from types import ModuleType
import mxnet as mx
from rl_coach.architectures.embedder_parameters import InputEmbedderParameters
from rl_coach.architectures.mxnet_components.embedders.embedder import InputEmbedder
nd_sym_type = Union[mx.nd.NDArray, mx.sym.Symbol]
class TensorEmbedder(InputEmb... |
"""DHCPv4 address release process"""
# pylint: disable=invalid-name,line-too-long
import pytest
import srv_control
import srv_msg
import misc
@pytest.mark.v4
@pytest.mark.relay
@pytest.mark.release
def test_v4_relay_release_success():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '192... |
import sys
def setup(words):
new_words = []
for word in words:
new_words.append(word.lower())
words = new_words
# This could have been done easier with list comprehensions.
# words = [word.lower() for word in words]
wordset = set()
wordcount = dict()
for word in words:
prev_size = len(wordset)
wordset.ad... |
"""
Trading rules for futures system
"""
from syscore.dateutils import ROOT_BDAYS_INYEAR
import pandas as pd
from sysquant.estimators.vol import robust_vol_calc
def ewmac(price, vol, Lfast, Lslow):
"""
Calculate the ewmac trading rule forecast, given a price and EWMA speeds Lfast, Lslow and vol_lookback
... |
from math import factorial
import numpy as np
import pandas as pd
# take the number 3, want to get all permutations of 1,2,3.
# (1,2,3), (1,3,2), (3,1,2), (3,2,1), (2,1,3), (2,3,1)
# or for 4, all permutations of 1,2,3,4
# by using recursion
def swapper(x,y):
return y,x
def permutor(x, depth):
# will be list... |
# 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 applica... |
import re
class Schmeckles:
def __init__(self, bot):
self.bot = bot
self.p = re.compile('([^\n\.\,\r\d-]{0,30})(-?[\d|,]{0,300}\.{0,1}\d{1,300} schmeckle[\w]{0,80})([^\n\.\,\r\d-]{0,30})', re.IGNORECASE)
async def schmeckle2usd(self, schmeckle):
"""1 Schmeckle = $148 USD
https... |
def settings(dictionary):
with open('data/settings.json') as data_file:
settingsjsonold = json.load(data_file)
settingsjsonnew = {}
answerwrong = True
while answerwrong:
settingsanswer = input('Run Settingsprogramm? (yes/no/exit)')
if settingsanswer == "exit":
sys.exi... |
""" Heading Alignment Controllers """
from numpy import sin, cos, arcsin, arccos, sqrt, pi, radians
import numpy as np
from scipy.optimize import minimize_scalar
from scipy.integrate import trapz
from MPC import constant
from functools import partial
def desiredHeading(lon_current, lat_current, lon_target,... |
# -*- coding: utf-8 -*-
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
from openerp import api, fields, models
import openerp.addons.decimal_precision as dp
_STATES = [
('draft', 'Draft'),
('to_approve', 'To be approved'),
... |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... |
from django.conf.urls import patterns, url
from slagui import views
from slagui import rest
urlpatterns = patterns(
'',
# eg: /$slaroot/
#url(r'^$', views.index, name='index'),
#url(r'^(?P<is_provider>provider/)?agreements[/]$',
# views.agreements_summary, name='agreements_summary'),
url(
... |
from django.conf import settings
from rest_framework import serializers
class TranslationModelSerializer(serializers.ModelSerializer):
"""
This serializer excludes by default translation specific fields.
When using the serializer you need to set a `Meta.translation_fields` attribute.
"""
def __ini... |
#!/usr/bin/env python
#
# Copyright (C) 2011 Roberto A. Martinez Perez
#
# This file is part of data-is-fun.
#
# data-is-fun 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 t... |
import uuid
try:
from django_mongoengine import Document
except ImportError:
from mongoengine import Document
from mongoengine import StringField, UUIDField, BooleanField
from mongoengine import EmbeddedDocument
from django.conf import settings
from crits.core.crits_mongoengine import CritsBaseAttributes
from crit... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def PerfMetricSeriesCSV(vim, *args, **kwargs):
'''This data object type represents a Perf... |
#
# backout.py - TortoiseHg's dialog for backing out changeset
#
# Copyright (C) 2008 Steve Borho <steve@borho.org>
# Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>
#
import os
import sys
import gtk
import pango
from dialog import *
from hgcmd import CmdDialog
import histselect
class BackoutDialog(gtk.Window):
"... |
# Copyright 2016 Cloudbase Solutions Srl
# 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 r... |
# 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
# distributed under the Li... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import datetime
import time
from datetime import date
from database_connection import Connection
import tushare as ts
import warnings
warnings.simplefilter(action = "ignore", category = FutureWarning)
class datafetch:
def __init__(self):
self.conn = Connection("loc... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
#!/usr/bin/env python
"""
Copyright 2010-2019 University Of Southern California
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 appli... |
# -*- encoding:utf-8 -*-
import jieba.analyse
from os import path
from scipy.misc import imread
import matplotlib as mpl
mpl.use('TkAgg')
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
list_test = [1,2,3,4,5]
for i in list_test:
print(i)
if __name__ == "__main__":... |
import collections
import json
from logging import getLogger
from ckan.lib.helpers import url_for
from ckan.common import config
from ckanext.package_converter.model.metadata_format import MetadataFormats
from ckanext.package_converter.model.scheming_converter import Datacite43SchemingConverter
from xmltodict import u... |
def get_sprite_details():
"""
Tells the game engine how to slice up your spritesheet.
Each slice of your spritesheet should be an object that looks like this:
{
"image rect": {
"x": <x offset in pixels, relative to left edge>,
"y": <y offset in pi... |
from sqlalchemy import create_engine
from sqlalchemy_utils.functions import create_database, database_exists
from docker import Client
from docker.utils import create_host_config
class Database():
def __init__(self, name='testdb'):
db_port = 5432
proxy_port = 5432
self.db_name = 'db' #... |
# -*- coding: utf-8 -*-
# Copyright 2013 The Distro Tracker Developers
# See the COPYRIGHT file at the top-level directory of this distribution and
# at http://deb.li/DTAuthors
#
# This file is part of Distro Tracker. It is subject to the license terms
# in the LICENSE file found in the top-level directory of this
# d... |
from pypot.primitive import LoopPrimitive
class FaceTracking(LoopPrimitive):
def __init__(self, robot, freq, face_detector):
LoopPrimitive.__init__(self, robot, freq)
self.face_detector = face_detector
self.dx, self.dy = 60, 50
self._tracked_face = None
def setup(self):
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Inventory', '0014_auto_20151227_1250'),
]
operations = [
migrations.CreateModel(
name='OrderHistoryModel',
... |
from pytelemetry import Pytelemetry
import queue
import pytest
import unittest.mock as mock
class transportMock:
def __init__(self):
self.queue = queue.Queue()
def read(self, maxbytes=1):
data = []
amount = 0
while amount < maxbytes and not self.queue.empty():
c = s... |
#!/usr/bin/env python
r"""
See help text for details.
"""
import sys
save_dir_path = sys.path.pop(0)
modules = ['gen_arg', 'gen_print', 'gen_valid', 'event_notification']
for module in modules:
exec("from " + module + " import *")
sys.path.insert(0, save_dir_path)
parser = argparse.ArgumentParser(
usage='... |
# Copyright 2017 The Armada 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 law or agreed to in w... |
from brink import fields, models
import pytest
class DummyModel(models.Model):
title = fields.CharField()
def test_field_treat():
field = fields.Field()
assert field.validate("val") == "val"
def test_field_validate_required():
field = fields.Field(required=True)
with pytest.raises(fields.Fiel... |
#!/usr/bin/env python
#
# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sin_source_f(samp_rate, freq, amp, N):
t = [float(x) / samp_rate f... |
#!/usr/bin/env python
"""Check config file syntax."""
try:
import configparser
except ImportError:
import ConfigParser as configparser
import re
import sys
try:
import configobj
except ImportError:
configobj = None
def check_configobj(filename):
"""Check file using configobj.
Return list ... |
import datetime
import re
from django.conf import settings
from django.contrib.auth.models import Group
from django.core import mail
from django.test import TestCase
from opaque_keys.edx.keys import CourseKey
from testfixtures import LogCapture, StringComparison
from course_discovery.apps.core.tests.factories import ... |
### IMPORTS
from flask_appbuilder import Model
from flask_appbuilder.models.mixins import AuditMixin
from sqlalchemy import Table, ForeignKey, Column, Integer, String, Enum, Float, Text
from sqlalchemy.orm import relationship
#from sqlalchemy import UniqueConstraint
from . import consts
from . import utils
### C... |
# -*- coding: utf-8 -*-
from .database import db
class Token(db.Model):
__tablename__ = 'token'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
token = db.Column(db.String(255), nullable=False)
code = db.Column(db.String(255), nullable=False, unique=True)
secret = db.Column(db.S... |
import numpy as np
from ray.rllib.evaluation import SampleBatch
from ray.rllib.utils.filter import MeanStdFilter
class _MockWorker:
def __init__(self, sample_count=10):
self._weights = np.array([-10, -10, -10, -10])
self._grad = np.array([1, 1, 1, 1])
self._sample_count = sample_count
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import csv
import os
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from scuole.states.models import State
from ...models import SchoolYear
from ...schemas.tapr.mapping import MAPPING... |
#!/usr/bin/env python
#
# Copyright 2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
... |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... |
# create files
# WORKING/transactions-subset2-train.pickle
# WORKING/transactions-subset2-test.pickle
#
# The test data consists of a 10% random sample of all the data.
#
# Unlike the R version, the data are not stratified by sale month.
# import built-ins and libraries
import numpy as np
import pandas as pd
import pd... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
checkurl.py reads from standard input a text file that contains URLs; it performs an HTTP
GET to test the URL and it writes the result to standard output.
input line format: URL_|_record_id_|_resource_type
output line format: HTTP/1.1_|_return_code_|_respons... |
from ElasticsearchConnection import Resource
from uuid import uuid4
class ElasticsearchIndex:
@staticmethod
def create(index_name, settings):
es = Resource().connect()
index = es.indices.create(index=index_name, ignore=400, body=settings)
return index
@staticmethod
def delet... |
import numpy as np
from numba import cuda, float32, float64, int32
from numba.cuda.testing import unittest, CUDATestCase
class TestCudaIDiv(CUDATestCase):
def test_inplace_div(self):
@cuda.jit(argtypes=[float32[:, :], int32, int32])
def div(grid, l_x, l_y):
for x in range(l_x):
... |
__author__ = 'chris'
import logging
import tables
from scipy import signal
import numpy as np
def PCA_filter(self, rec_h5_obj, probe):
"""
Filtering based on
doi:10.1016/S0165-0270(01)00516-7
"""
data = self.run_group.data
D_all_clean = rec_h5_obj.create_carray(self.run_group,... |
"""Tests for the CombinedForm utilitiy class."""
import datetime
import unittest
import unittest.mock
import django.db.models
import django.forms
import django.test
import django.utils.timezone
import combinedform
class CombinedFormTest(unittest.TestCase):
"""Tests for the CombinedForm utility class."""
de... |
##############################################################################
#
# 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 ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-25 01:44
from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
class Migration(migrations.Migration):
... |
# -*- coding: utf-8 -*-
from django.core.management import setup_environ
import forms.form_models.bfsql as bfsql
import forms.form_models.bform as bforms
from forms.form_models.bfbdb import *
bf = bforms.BerkeleyForm()
bf.baseFont='palatino'
bf.theme=('demos',)
"""
Don't just write documents, create an information ... |
import bpy
import gpu
from gpu_extras.batch import batch_for_shader
from ...rfb_utils import transform_utils
from ...rman_constants import RMAN_AREA_LIGHT_TYPES
from .barn_light_filter_draw_helper import BarnLightFilterDrawHelper
from mathutils import Vector, Matrix
import mathutils
import math
_DRAW_HANDLER_ = None
_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.