src
stringlengths
721
1.04M
from threading import Thread import time, traceback, random from format import BOLD, RESET, CYAN, GREEN lotto = None def _init(b): print '\t%s loaded' % __name__ def lottery(l, b, i): """!parent-command !c new !d Create a new lottery (cost: 10 points) !a [duration] [min-bet] [max-bet] ...
import nltk from nltk.corpus import stopwords class EntityExtractor (object): ''' Class used to extract Named Entities from a string ''' def __init__ (self, tweet): self.tweet = tweet self.text = tweet['text'] self.lang = tweet['lang'] self.bool = tweet['text'] and tweet['lang'].find('en') > -1 self.tok...
import sys, atexit import pickle import bluetooth as bt from cmd import Cmd from service import SerialPortService import socket banner = '''Welcome to btsdk shell. \tType 'help()' for help ''' class Shell(Cmd): prompt = 'btsdk> ' intro = "btsdk shell" def __init__(self): Cmd.__init__(self) ...
"""IoTEM URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
""" Oracle database backend for Django. Requires cx_Oracle: http://cx-oracle.sourceforge.net/ """ from __future__ import unicode_literals import datetime import decimal import os import platform import sys import warnings from django.conf import settings from django.db import utils from django.db.bac...
# -*- coding: utf-8 -*- # Copyright (C) 2016-2018 Mathew Topper # # 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...
#!/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/ # Basic string exercises # Fill in the code for the functions below. main() is already se...
import sys import glob import os import random import itertools from synthplayer.sample import Sample from typing import Dict, Optional, List class Group: def __init__(self): self.volume = 0.0 self.amp_veltrack = 0 self.ampeg_release = 0.0 self.key = 0 self.group = 0 ...
# coding=utf-8 # Copyright 2021 The Trax 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 a...
import abc import py2neo from py2neo import Graph, Node, Relationship from . import base from .. import errors, settings class GraphRepository(base.Repository, metaclass=abc.ABCMeta): _g = None connection_string = settings.effective.DATABASES['neo4j'] @property def g(self): self._g = self._g...
import requests import time try: import simplejson as json except ImportError: import json from pymongo import Connection from paleo import paleo_ingredients, excludedIngredients app_key = open('app.key').read().strip() app_id = open('app_id.key').read().strip() def mongoconn(name='bespin'): return Connec...
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
from flask import render_template, flash, url_for, request, redirect, session from flask_login import login_user, logout_user, current_user, login_required from app import app, db, gitlab, login_manager from forms import ProjectForm from models import User, Project, ROLE_USER, ROLE_ADMIN import copy import ansible.ru...
# Copyright (C) 2013-2017 Roland Lutz # # 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 distributed ...
from __future__ import absolute_import from __future__ import print_function from __future__ import division from builtins import range import warnings import unittest import sys import itertools as it import copy import time import math import logging import os.path import os import shutil import contextlib try: ...
# -*- coding: 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 Apache License, Version 2.0 (the #...
# 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 use ...
import functools import re from more_itertools import one def pluralize(**thing): name, value = one(thing.items()) if name.endswith('y') and name[-2] not in 'aeiou': name = f'{name[:-1]}ies' if value != 1 else name return f'{value} {name}' return f'{value} {name}{"s" * (value != 1)}' de...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Feb 15, 2014 @author: honghe 客户端初始化 """ import weibo import time import os # 从配置文件导入微博APP信息 config = {} execfile(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../conf.py"), config) # python 3: exec(open("example.conf").read(), config) APP_KEY ...
# -*- coding: utf-8 -*- """ Copyright © 2017 - Alexandre Machado <axmachado@gmail.com> This file is part of Simple POS Compiler. Simnple POS Compiler 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 Found...
"""Tests for linked_list.py.""" import pytest @pytest.fixture def sample_linked_list(): """Create testing linked list.""" from linked_list import LinkedList one_llist = LinkedList([1]) empty_llist = LinkedList() new_llist = LinkedList([1, 2, 3, 4, 5]) return (one_llist, empty_llist, new_llist...
############################################################################## # 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-64...
#!/usr/bin/python3 ''' Created on Aug 18, 2019 @author: johnrabsonjr ''' import os from queue import Queue import sys import time import RPi.GPIO as GPIO # @UnresolvedImport REBOOTPULSEMINIMUM = None REBOOTPULSEMAXIMUM = None SHUT_DOWN = None BOOTOK = None ATXRASPI_SOFTBTN = None FACTORYRESET = None GREEN22 = N...
# coding: utf-8 """ Onshape REST API The Onshape REST API consumed by all clients. # noqa: E501 The version of the OpenAPI document: 1.113 Contact: api-support@onshape.zendesk.com Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F401 im...
######################################################################### # # Copyright (C) 2012 OpenPlans # # 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 #...
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import webnotes from webnotes.utils import cstr, flt, cint from webnotes.model.bean import getlist from webnotes.model.code import get_obj from webn...
#!/usr/bin/env python3 """ Compute radiation trajectories through multilayer sample for use in figure that explains the Green function. """ xd = 52 yd = 10 # detector s = 3 # source located at -s T = [6, 6] # layer thickness sd = T[0] - s # distance from source to lower interface DeltaLayer = [.05, .1] # refracti...
"""A class for reading Amiga executables and object files in Hunk format""" import os import struct import StringIO from types import * from Hunk import * class HunkReader: """Load Amiga executable Hunk structures""" def __init__(self): self.hunks = [] self.error_string = None self.type = None se...
#L # Copyright SAIC # # Distributed under the OSI-approved BSD 3-Clause License. # See http://ncip.github.com/python-api/LICENSE.txt for details. #L ################################################## # file: CaBioWSQueryService_server.py # # skeleton generated by "ZSI.generate.wsdl2dispatch.ServiceModuleWriter" # ...
""" Routes Configuration File Put Routing rules here """ from system.core.router import routes """ This is where you define routes Start by defining the default controller Pylot will look for the index method in the default controller to handle the base route Pylot will also automaticall...
# -*- coding: utf-8 -*- """ /*************************************************************************** ExploreServerWidget A QGIS plugin Brazilian Army Cartographic Production Tools ------------------- begin : 2015-08-12 gi...
# /usr/bin/env python # Copyright 2013, 2014 Justis Grant Peters and Sagar Jauhari # This file is part of BCIpy. # # BCIpy 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 ...
# # 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...
def updateStateField(serviceobject,request,user,prev_state,new_state,newuser=False): if newuser: prev_state = 'd' if new_state: new_state = 'a' else: new_state = 'd' if new_state == 'd' and prev_state != 'd': serviceobject.service.disableServiceFromUse...
""" A custom manager for working with trees of objects. """ from __future__ import unicode_literals import contextlib from django.db import models, connections, router from django.db.models import F, ManyToManyField, Max, Q from django.utils.translation import ugettext as _ from mptt.exceptions import CantDisableUpda...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright INRIA # Contributors: Nicolas P. Rougier (Nicolas.Rougier@inria.fr) # # DANA is a computing framework for the simulation of distributed, # asynchronous, numerical and adaptive models...
import logging from shelver.artifact import Artifact from shelver.registry import Registry from shelver.build import Builder from .base import Provider logger = logging.getLogger('shelver.provider.test') class TestArtifact(Artifact): def __init__(self, id, **kwargs): super().__init__(**kwargs) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Licensed under GPL v2 # Copyright 2010, Aşkın Yollu <askin@askin.ws> # # 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 L...
#!/usr/bin/env python import os import sys from setuptools import setup, find_packages requires = [ "click==6.7", "PyYAML==3.12", "boto3==1.4.4", "botocore==1.5.48", "docutils==0.13.1", "jmespath==0.9.2", "mime==0.1.0", "python-dateutil==2.6.0", "s3transfer==0.1.10", "six==1.10...
# # # Copyright 2009-2015 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # the Hercules foundation (ht...
# -*- coding: utf-8 -*- """ /*************************************************************************** Batch GPS Importer A QGIS plugin Initializer of the plugin. ------------------- begin : 2017-03-18 copyright ...
try: # Python 2 from StringIO import StringIO except ImportError: # Python 3 from io import StringIO import pddl from pddl_to_prolog import Rule, PrologProgram def test_normalization(): prog = PrologProgram() prog.add_fact(pddl.Atom("at", ["foo", "bar"])) prog.add_fact(pddl.Atom("truck", [...
from __future__ import unicode_literals from collections import namedtuple from fauxquests.adapter import FauxAdapter from fauxquests.compat import mock from requests.compat import OrderedDict from requests.sessions import Session from sdict import AlphaSortedDict class FauxServer(Session): """A class that can re...
import pytz from django.views.generic import ListView from django.db.models import Q from django.contrib import messages from rest_framework import viewsets, generics from rest_framework import filters from django.conf import settings from .models import MovieRes, MovieUpdate, MovieNotify from .serializers import Movie...
""" Django settings for serverctl_prototype project. Generated by 'django-admin startproject' using Django 1.10.6. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ ""...
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages from cloudplaya import VERSION PACKAGE_NAME = 'cloudplaya' setup(name=PACKAGE_NAME, version=VERSION, ...
from django.shortcuts import render from django.utils import timezone from django.views import generic from .models import Post class IndexView(generic.ListView): template_name = "blog/post_list.html" context_object_name = "posts" def get_queryset(self): return Post.objects.filter(published_date...
"""meal_api URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-ba...
# Copyright (c) 2017, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. import sys from mixbox.binding_utils import * from . import cybox_common from . import file_object class StreamListType(GeneratedsSuper): """The StreamListType type specifies a list of NTFS alternate data ...
# Copyright 2014 PerfKitBenchmarker 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 appli...
import json from decimal import Decimal from dogecoinrpc.data import TransactionInfo from mock import patch from transient.test.integration import BaseIntegrationTest class TestAPI(BaseIntegrationTest): def test_ping(self): r = self.client.get("/ping") self.assertEqual(r.status_code, 200) ...
# ISC License # # Copyright (c) 2017, Stanford University # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE...
""" `notipyserver` - User-Notification-Framework server Provides a telegram handler function for user registration. :copyright: (c) by Michael Imfeld :license: MIT, see LICENSE for details """ import telegram from .usermanager import add_user, add_group def register(bot, update): """ Saves the telegram use...
# from https://github.com/s0undt3ch/Deluge/blob/master/deluge/ui/console/commands/update-tracker.py # update-tracker.py # # Copyright (C) 2008-2009 Ido Abramovich <ido.deluge@gmail.com> # Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com> # # Deluge is free software. # # You may redistribute it and/or modify it un...
# -*- coding: utf-8 -*- """ Push/Pull on Kafka over HTTP """ from setuptools import setup from subprocess import check_output as run from subprocess import CalledProcessError import sys import os from flasfka import __version__ # Travis uploads our releases on pypi when the tests are passing and there # is a new ta...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Functions and utilities comparing raster and vector similarities. Module can be used alone or as part of Snakemake workflow. """ import logging import rasterio import geopandas as gpd import pandas as pd import numpy as np import numpy.ma as ma from importlib.machine...
from django.conf.urls import * from django.views.generic import TemplateView from django_conference import views, autocomplete, admin_tasks urlpatterns = patterns('', # Paper submission/editing url(r'^submit_paper', views.submit_paper, name="django_conference_submit_paper"), url(r'^edit_p...
#!/usr/bin/env python import paramiko from getpass import getpass from pyclass.common import config from pyclass.common.entities import entities (device_ip, device_port, device_type) = entities.ssh_devices['rtr1'] username = entities.entities['ssh_user'] print device_ip, device_port, username class shellConnection(o...
from itertools import chain from collections import ( defaultdict, Iterable, ) from django.http import HttpResponseNotAllowed __version__ = '0.1.1' class Handler(object): """Container for views. :param decorators: (optional) list of decorators that will be applied to each endpoint. ""...
# -*- coding: utf-8 -*- """ Transfer function with derivatives :Example: >>> import numpy as np >>> f = TanSig() >>> x = np.linspace(-5,5,100) >>> y = f(x) >>> df_on_dy = f.deriv(x, y) # calc derivative >>> f.out_minmax # list output range [min, max] [-1, 1] >>> f.inp_active # li...
"""Communicates between third party services games and Lutris games""" from lutris import pga class ServiceGame: """Representation of a game from a 3rd party service""" store = NotImplemented installer_slug = NotImplemented def __init__(self): self.appid = None # External ID of the game on t...
# # Copyright (c) 2009-2015 Tom Keffer <tkeffer@gmail.com> # # See the file LICENSE.txt for your full rights. # """Package weewx, containing modules specific to the weewx runtime engine.""" import time __version__="3.2.0a1" # Holds the program launch time in unix epoch seconds: # Useful for calculating 'uptime....
# argmin_gen.py # # Takes in a single argument, the number of inputs, and generates a verilog # armin tree, using the argmin_helper. # # Copyright (c) 2016, Stephen Longfield, stephenlongfield.com # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Lic...
# Copyright (c) 2011 Gennadiy Shafranovich # Licensed under the MIT license # see LICENSE file for copying permission. import datetime, os, glob # build info BUILD_VERSION = '0.12' BUILD_DATETIME = datetime.datetime(2011, 9, 27, 7, 44, 0) # base db set up, the rest is in environment specific setting files DATABASE_E...
# Copyright (C) 2013-2018 Jean-Francois Romang (jromang@posteo.de) # Shivkumar Shivaji () # Jürgen Précour (LocutusOfPenguin@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 publi...
#Under MIT License, see LICENSE.txt import sys, math from PyQt4 import QtGui, QtCore class MainLoop(QtCore.QThread): updateField = QtCore.pyqtSignal() def __init__(self, target): super(MainLoop, self).__init__() self.target = target def run(self): run_loop = self.target em...
import sublime import sublime_plugin import os from hashlib import md5 __version__ = "1.7.2" CONFIG_NAME = "Localization.sublime-settings" LANGS = { "ZH_CN": { 'zipfile': 'ZH_CN.zip', 'syntax_md5sum': '44cd99cdd8ef6c2c60c0a89d53a40b95' }, "ZH_TW": { "zipfile": "ZH_T...
#!/usr/bin/python import subprocess import sys import os class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' @staticmethod def purple(string): return bcolors.HEADER + string + bcolors.ENDC @staticmethod def b...
#!/usr/bin/python # ---------------------------------------------------------------------------- # cocos "install" plugin # # Authr: Luis Parravicini # # License: MIT # ---------------------------------------------------------------------------- ''' "run" plugin for cocos command line tool ''' __docformat__ = 'restruc...
import datetime import hashlib import json from typing import Dict import uuid import warnings class Utility(object): @staticmethod def make_json_serializable(doc: Dict): """ Make the document JSON serializable. This is a poor man's implementation that handles dates and nothing else. ...
""" test integrating Elixir entities with plain SQLAlchemy defined classes """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import six from sqlalchemy.orm import * from sqlalchemy import * from elixir import * clas...
# -*- coding: utf-8 -*- """ This provide integration with Flask. Requires Flask>=0.9 """ import mimetypes from flask import make_response from nunja.serve import rjs class FlaskMixin(object): """ The base mixin for combining with a provider implementation. """ def serve(self, identifier): ...
#! /Users/rkrsn/anaconda/bin/python from pdb import set_trace from os import environ, getcwd from os import walk from os.path import expanduser from pdb import set_trace import sys # Update PYTHONPATH HOME = expanduser('~') axe = HOME + '/git/axe/axe/' # AXE pystat = HOME + '/git/pystats/' # PySTAT cwd = getcwd() #...
from __future__ import absolute_import from proteus.default_n import * from proteus import (StepControl, TimeIntegration, NonlinearSolvers, LinearSolvers, LinearAlgebraTools) from . import vof_p as physics from proteus.mprans import VOF...
''' Blender_Gui.py Copyright (c) 2003 - 2008 James Urquhart(j_urquhart@btinternet.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...
#!/usr/bin/env python # recordjar.py - Parse a Record-Jar into a list of dictionaries. # Copyright 2005 Lutz Horn <lutz.horn@gmx.de> # Licensed unter the same terms as Python. def parse_jar(flo): """Parse a Record-Jar from a file like object into a list of dictionaries. This method parses a file like object ...
#!/usr/bin/python # ======================================================== # Python script for PiBot-A: obstacle avoidance # Version 1.0 - by Thomas Schoch - www.retas.de # ======================================================== from __future__ import print_function #+# NUR WENN PRINT! from pololu_drv8835_rpi impor...
#!/usr/bin/python # -*- coding: UTF-8 -*- # # keyboard_names.py # # Copyright © 2013-2016 Antergos # # 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 you...
#!/usr/bin/env python ### # Copyright (c) 2002-2007 Systems in Motion # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS I...
from __future__ import division, absolute_import, print_function import collections import tempfile import sys import shutil import warnings import operator import io import itertools import functools import ctypes import os import gc from contextlib import contextmanager if sys.version_info[0] >= 3: import builti...
import espresso from espresso import Real3D d = 0.85 Nchains = 10 Mmonomers = 10 N = Nchains * Mmonomers L = pow(N/d, 1.0/3) system, integrator = espresso.standard_system.PolymerMelt(Nchains, Mmonomers,(10,10,10), dt = 0.005, temperature=1.0) print "starting warmup" org_dt = integrator.dt pot = system.getInteracti...
# -*- coding: utf-8 -*- ''' canteen meta core ~~~~~~~~~~~~~~~~~ metaclass tools and APIs. :author: Sam Gammon <sam@keen.io> :copyright: (c) Keen IO, 2013 :license: This software makes use of the MIT Open Source License. A copy of this license is included as ``LICENSE.md`` in the ...
# Copyright 2015 Huawei Technologies Co., Ltd. # 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 # # Unl...
# -*- coding: utf-8 -*- from odoo.exceptions import AccessError from odoo import api, fields, models, _ from odoo import SUPERUSER_ID from odoo.exceptions import UserError, ValidationError from odoo.http import request from odoo.addons.account.models.account_tax import TYPE_TAX_USE import logging _logger = logging.g...
#!/usr/bin/env python import json, re, csv from pprint import pprint import mysql.connector event = -9 subset = 1100 feature = 'JustBot' # JustBot, Cluster, BotLabel, Truthy # Queries #query = ("INSERT INTO UserLabel " # "(Event, Subset, UserID, Screenname, Bot, Botnet, Sample, Cluster, Cluster2, Profile, St...
#! /usr/bin/python2.7 """ Usage: python -m test.regrtest [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] If no arguments or options are provided, finds all files matching the pattern "test_*" in the Lib/test subdirectory and runs them in alphabetic...
from aol_model.ray import Ray from numpy import allclose, array import pytest from aol_model.vector_utils import normalise position = [0,0,2] wavevector_unit = [1,0,0] wavelength = 10 energy = 1 def test_setting_non_unit_vector(): with pytest.raises(ValueError): Ray(position, [1,0,0.1], wavelength, energy...
from typing import Any from pytest import mark, param from omegaconf import AnyNode, DictConfig, ListConfig, OmegaConf from tests import Group, User @mark.parametrize( "i1,i2", [ # === LISTS === # empty list param([], [], id="empty"), # simple list param(["a", 12, "15...
""" WSGI config for gazetteer project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`...
import requests import ourUtils from dbManager import Queries, get_connection # This program goes through the list of stations in the db and updates information such as # current listeners, max listeners, peak listeners, status(up or not) def worker(id_url_list, connection): cur = connection.cursor() for ...
import time import os from pykafka.test.kafka_instance import KafkaInstance, KafkaConnection def get_cluster(): """Gets a Kafka cluster for testing, using one already running is possible. An already-running cluster is determined by environment variables: BROKERS, ZOOKEEPER, KAFKA_BIN. This is used prim...
from app import db from flask.ext.security import RoleMixin from datetime import datetime # Defining the table for the many-many relationship of User and Comic bought_comics = db.Table('bought', db.Column('user_id', db.Integer, db.ForeignKey('user.id')), db.Column('com...
from django.core import mail from django.test import RequestFactory, TestCase from ...organizations.factories import OrganizationFactory from ..factories import TemplateFactory from ..forms import RequestForm class RequestFormTestCase(TestCase): def setUp(self): self.organization = OrganizationFactory()...
from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import relationship from app.database import Base class User(Base): """This is an ORM model for logging users""" __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String(50), nullable=False) ...
#------------------------------------------------------------------------------ # Copyright (c) 2013, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #-------------------------------------------------...
#=========================================================================== # This library is free software; you can redistribute it and/or # modify it under the terms of version 2.1 of the GNU Lesser General Public # License as published by the Free Software Foundation. # # This library is distributed in the hope tha...
# -*- coding: utf-8 -*- # Copyright (C) 2015-2020 by Brendt Wohlberg <brendt@ieee.org> # All rights reserved. BSD 3-clause License. # This file is part of the SPORCO package. Details of the copyright # and user license can be found in the 'LICENSE.txt' file distributed # with the package. """Classes for ADMM algorithm...
# coding=utf-8 import logging from datetime import datetime from webspider import crawlers from webspider.tasks.celery_app import celery_app from webspider.controllers import keyword_ctl, job_keyword_ctl from webspider.models import JobsCountModel logger = logging.getLogger(__name__) @celery_app.task() def crawl_la...
#!/usr/bin/env python # encoding: utf-8 # Niall Richard Murphy <niallm@gmail.com> """Test the tree (gap-production) object.""" import sys import constants import random import tree # Perhaps unittest2 is available. Try to import it, for # those cases where we are running python 2.7. try: import unittest2 as unitt...