src
stringlengths
721
1.04M
""" lo_wines.py: Simple SCIP example of linear programming. It solves the same instance as lo_wines_simple.py: maximize 15x + 18y + 30z subject to 2x + y + z <= 60 x + 2y + z <= 60 z <= 30 x,y,z >= 0 Variables correspond to the production of three types of wine bl...
# 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 http://mozilla.org/MPL/2.0/. """This is an extension to configman for Socorro. It creates a ValueSource object that is also a 'from_string_converter...
""" Simulate how Droplets will perform with Young's Model on Grid Graphs with different density Author: Yang Li Date: July 14, 2017 # randomly generate N droplets with diameter = 4.5cm within a square of length 60cm """ from AmorphousGraph import * # 'factor' value kind of means how much strength to push each ...
import os import unittest from attributes.unit_test.discoverer import get_test_discoverer from tests import get_lsloc, REPOS_PATH class CSharpTestDiscovererTestCase(unittest.TestCase): def setUp(self): self.discoverer = get_test_discoverer('C#') @unittest.skipIf(not os.path.exists(REPOS_PATH), 'setu...
# A function to evaluate Levenshtein distance. # # Licensed under the BSD 3-Clause license. def levenshtein(a, b): """ Evaluates the Levenshtein distance between two strings. """ if len(a) < len(b): a, b = b, a if len(b) == 0: # len(a) >= len(b) return len(a) a = ' ' + a b ...
# # Thierry Parmentelat - INRIA # # # just a placeholder for storing accessor-related tag checkers # this is filled by the accessors factory # # NOTE. If you ever come to manually delete a TagType that was created # by the Factory, you need to restart your python instance / web server # as the cached information then b...
import os APP_ROOT = os.path.dirname(os.path.abspath(__file__)) PARENT_DIRECTORY = os.path.normpath(APP_ROOT + os.sep + os.pardir) TIME_FORMAT = '%Y-%m-%d %H-%M-%S' # If you want to be able to validate user tokens across server restarts, you # should set SECRET_KEY with a long, randomly generated string SECRET_KEY =...
class BaseRecommender(object): """ Minimal interface to be implemented by recommenders. """ def get_similar_items(self,j,max_similar_items=30): """ Get the most similar items to a supplied item. Parameters ========== j : int Index of item for which t...
# Copyright (C) 2008 The Android Open Source Project # # 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 ...
import pandas as pd import re import ast import multiprocessing as mp from multiprocessing import cpu_count import sys def check_match(thread_df): pat = "source2_\d+_\d+" for i, row in thread_df.iterrows(): duplicate = ast.literal_eval(row.duplicate_flag) if not duplicate['exact_match']: ...
from decimal import Decimal import os from datetime import date, datetime from django.test import TestCase from django.conf import settings from corehq.util.test_utils import TestFileMixin from couchforms.datatypes import GeoPoint from couchforms.models import XFormInstance from corehq.form_processor.tests.utils impo...
# -*- encoding: utf-8 -*- try: import unittest2 as unittest except ImportError: import unittest import os import sqlite3 import tempfile from isso import config from isso.db import SQLite3 from isso.compat import iteritems class TestDBMigration(unittest.TestCase): def setUp(self): fd, self.pa...
# Copyright 2016 Capital One Services, 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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
# -*- coding:utf-8 -*- # 使用 UTF-8 import sys reload(sys) sys.setdefaultencoding("utf-8") class NameNode(object): def __init__(self, degree, optimize=3): super(NameNode, self).__init__() self.num = 0 self.degree = degree self.threshold = degree*2 self.keys = [None for _ in...
import json import unittest import responses import digitalocean from .BaseTest import BaseTest class TestDroplet(BaseTest): @responses.activate def setUp(self): super(TestDroplet, self).setUp() self.actions_url = self.base_url + "droplets/12345/actions/" data = self.load_from_file...
# -*- coding: utf-8 -*- # # drop documentation build configuration file, created by # sphinx-quickstart on Sun Feb 17 11:46:20 2013. # # 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. # # All co...
#!/usr/bin/env python2 # -*- coding: latin-1 -*- # Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U # # This file is part of Orion Context Broker. # # Orion Context Broker is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero General Public License as # published by t...
#!/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...
""" mbed CMSIS-DAP debugger Copyright (c) 2015-2017 ARM 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 ...
# -*- coding: utf-8 -*- """ Sahana Eden Incident Reporting Model @copyright: 2009-2012 (c) Sahana Software Foundation @license: MIT 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 Sof...
import threading import numpy as np from wwb_scanner.core import JSONMixin from wwb_scanner.utils.dbstore import db_store from wwb_scanner.scanner.sdrwrapper import SdrWrapper from wwb_scanner.scanner.config import ScanConfig from wwb_scanner.scanner.sample_processing import ( SampleCollection, calc_num_sampl...
#!/usr/bin/python import sys import math from laser import Polygon, Circle, Collection, Config from laser import radians, rotate_2d from render import DXF as dxf # Involute gears, see : # http://www.cartertools.com/involute.html # # def circle_intersect(v, r): # see http://mathworld.wolfram.com/Circle-LineInte...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz> # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """ Module for Latent Semantic Analysis (aka Latent Semantic Indexing) in Python. Implements scalable truncated Singular Value Decompo...
#!/usr/bin/env python import sys, os if os.path.dirname(os.path.abspath(__file__)) in sys.path: sys.path.remove(os.path.dirname(os.path.abspath(__file__))) if os.path.dirname(os.path.dirname(os.path.abspath(__file__))) not in sys.path: sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) impo...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # https://github.com/monkeymia/ # # Copyright (c) 2014, monkeymia, All rights reserved. # # 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; e...
""" Django settings for gsoc15 project. Generated by 'django-admin startproject' using Django 1.8.2. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths...
"""Augments image dataset by shifting, rotating, or adding Gaussian noise.""" import numpy from scipy.ndimage.interpolation import rotate as scipy_rotate from gewittergefahr.gg_utils import error_checking from gewittergefahr.deep_learning import deep_learning_utils as dl_utils PADDING_VALUE = 0. MIN_ABSOLUTE_ROTATION...
#!/usr/bin/env python3 import math import pandas as pa import six from SPARQLWrapper import SPARQLWrapper, JSON from tqdm import tqdm from . import * def extract_information_from_uniprot(results_dataframe): ''' Requests the SPARQL endpoint of Uniprot to retrieve (from Ensembl transcrit ID) GO terms, int...
# -*- coding: utf-8 -*- """ test where we are determining what we are grouping, or getting groups """ import pytest from pandas import (date_range, Timestamp, Index, MultiIndex, DataFrame, Series, CategoricalIndex) from pandas.util.testing import (assert_panel_equal, assert_frame_equal, ...
""" Utility funtions and classes for preparing project marking bundles for student assignments. Marco Lui <saffsd@gmail.com>, November 2012 """ import os, sys, csv, re import tokenize, textwrap, token import trace, threading import imp import contextlib from cStringIO import StringIO from pprint import pformat impor...
from flask import Flask, request, abort, render_template, make_response from flask.views import View from flask.ext.login import login_user, current_user import portality.models as models import portality.util as util from portality.core import app, login_manager from portality.view.account import blueprint as accou...
""" fillerbase Module Classes to help fill widgets with data Copyright (c) 2008-10 Christopher Perkins Original Version by Christopher Perkins 2008 Released under MIT license. """ from .configbase import ConfigBase, ConfigBaseError from .metadata import FieldsMetadata import inspect from datetime import datetime en...
import backend import utils import adjglobals import solving import libadjoint import adjlinalg if hasattr(backend, 'FunctionAssigner'): class FunctionAssigner(backend.FunctionAssigner): def __init__(self, *args, **kwargs): super(FunctionAssigner, self).__init__(*args, **kwargs) #...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Ressource.view_size' db.add_column(u'socialaggregator_ressource', 'view_size', ...
import os import subprocess import re import utils import config try: import vim except: vim = False remote_hash = {} path_hash = {} def remotes(path): if remote_hash.get(path): return remote_hash.get(path) # grab only the remotes - this is safer than using python due to global character di...
############################################################################### ## ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary forms, with or without ## modification, ...
# coding: utf-8 from django.contrib.auth.models import User from rest_framework import serializers from kpi.forms import USERNAME_REGEX from kpi.forms import USERNAME_MAX_LENGTH from kpi.forms import USERNAME_INVALID_MESSAGE class CreateUserSerializer(serializers.ModelSerializer): username = serializers.RegexFie...
from fb_scrapper import scrape_groups_pages # To use our application you can use scrape_groups_pages or use one of our predefined functions # Declare your group or page id here #group_id = "canoeandkayak" # Choose which scraping function you want to call # This function is currently not properly working and will scr...
# -*- coding: utf-8 -*- from graph_tool.all import * from Queue_Class import * from Visitor_Example_Class import * from Graph_Window_Main_Class import * from gi.repository import Gtk, Gdk, GdkPixbuf, GObject, Pango import numpy as np from numpy.random import random import sys class Graph(): g = Graph() g.se...
# -*- coding: utf-8 -*- # Copyright (C) Canux CHENG <canuxcheng@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 ...
"""Mixture of distributions/densities.""" import numpy as np from scipy.misc import logsumexp from .discrete_latent_model import DiscreteLatentModel from .dirichlet import Dirichlet class MixtureStats(object): """Sufficient statistics for :class:BayesianMixture`. Methods ------- __getitem__(key) ...
import unittest import json from mock import Mock, patch import pyeapi.eapilib class TestEapiConnection(unittest.TestCase): def test_execute_valid_response(self): response_dict = dict(jsonrpc='2.0', result=[], id=id(self)) mock_send = Mock(name='send') mock_send.return_value = json.dump...
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*- # # Copyright (C) 2012 - fossfreedom # Copyright (C) 2012 - Agustin Carrasco # # 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 Fou...
""" Django settings for bugbug project. """ import os PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS # Hosts/domain names that are valid for this site; required if DEBUG is False # See https:...
""" This file is part of the Miracle Crafter Server. Miracle Crafter Server (C) 2014 The Miracle Crafter Team (see AUTHORS) Miracle Crafter Server 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 Foundati...
# -*- coding: utf-8 -*- """ static_file Static File """ from boto.s3 import connection from boto.s3 import key from boto import exception import base64 import json from trytond.config import config from trytond.model import fields from trytond.pyson import Eval, Bool from trytond.transaction import Transacti...
# -*- coding: utf-8 -*- """Model unit tests.""" import datetime as dt import pytest from dash.user.models import User, Role from dash.catalog.models import ( Campus, Department, Subject, Course, GenEduCategory, CourseClass, ) from .factories import ( UserFactory, CampusFactory, Dep...
""" Tests for the built-in test echo server. Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net). """ import time import pytest from threading import Thread, Event import Pyro5.client import Pyro5.errors import Pyro5.utils.echoserver as echoserver from Pyro5 import config class EchoServe...
#!/usr/bin/env python3 # # Script to generate a violin plot of the distribution of flower marker points # from a collection of runs of evobee # # Usage: plot-mp-distrib.py title mpcountmpfile [mpcountmpfile2 [mpcountmpfile3 ...]] # where each mpcountmpfile is a CSV format with layout: marker point, count # # Outputs:...
#!/usr/bin/env python import os import shutil import glob import time import sys import subprocess from optparse import OptionParser, make_option SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PKG_NAME = os.path.basename(SCRIPT_DIR) TEST_PREFIX = os.environ['HOME'] PARAMETERS = None ADB_CMD = "adb" def do...
import remindor_common.datetimeutil as d valid_singular = [ "now", "1:00pm", "1:00 pm", "13:00", "13", "1300", "1pm" ] valid_repeating = [ "every hour", "every hour from 1 to 1:00pm", "every minute", "every minute from 2:00pm to 1500", "every 3 minutes", "every ...
#! /usr/bin/env python # # PyBorg MSN module # # Copyright (c) 2006 Sebastien Dailly # # # 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) an...
#from flat_game import carmunk import carmunk import numpy as np import random import csv from nn import neural_net, LossHistory import os.path import timeit NUM_INPUT = 6 GAMMA = 0.9 # Forgetting. TUNING = False # If False, just use arbitrary, pre-selected params. def train_net(model, params): filename = para...
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015 CERN. # # Invenio 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...
""" An entity tracker """ import logging from spock.plugins.base import PluginBase from spock.utils import Info, pl_announce logger = logging.getLogger('spock') class MCEntity(Info): eid = 0 status = 0 nbt = None class ClientPlayerEntity(MCEntity): metadata = None class MovementEntity(MCEntity):...
# Copyright 2018 D-Wave Systems Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'selectRadioBoxMod.ui' # # Created: Mon Mar 24 15:23:01 2014 # by: PyQt4 UI code generator 4.10.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 excep...
# =================================== # CALCULATES Ioff and Ires # Indicators described in Molecfit II # # Solene 20.09.2016 # =================================== # import numpy as np from astropy.io import fits import matplotlib.pyplot as plt # from PyAstronomy import pyasl from scipy.interpolate import interp1d from ...
# -*- coding: utf-8 -*- """ unit test for PypiUpdatesBot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :author: tell-k <ffk2005@gmail.com> :copyright: tell-k. All Rights Reserved. """ import mock import pytest import logbook class DummyMemcache(object): def __init__(self): self._data = {}...
#!/usr/bin/python # -*- coding: utf-8 -*- import os import re import sublime import sublime_plugin import webbrowser import datetime import codecs from operator import attrgetter if int(sublime.version()) < 3000: import locale _target = None _user_input = None _display = True ############...
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask import redirect, flash, g, jsonify, current_app from flask.ext.mail import Message from flask.ext.babel import gettext as _ from newsmeme import signals from newsmeme.apps.comment import comment from newsmeme.helpers import render_template from newsmeme.permis...
#!/usr/bin/env python2.6 ''' This file makes an docx (Office 2007) file from scratch, showing off most of python-docx's features. If you need to make documents from scratch, use this file as a basis for your work. Part of Python's docx module - http://github.com/mikemaccana/python-docx See LICENSE for licensing infor...
#!/usr/bin/env python import sed_vis import dcase_util import os mode = 'probability' current_path = os.path.dirname(os.path.realpath(__file__)) if mode == 'dcase2016': audio_container = dcase_util.containers.AudioContainer().load( os.path.join(current_path, 'data', 'a001.wav') ) event_lists = { ...
#!/usr/bin/env python from gnuradio import digital from gnuradio import blks2 from gnuradio import gr from gnuradio import uhd from gnuradio.gr import firdes from gnuradio.level import msk from math import pi import time, re class msk_demod_dev(gr.top_block): def __init__(self): gr.top_block.__init__(self, "MSK D...
import re import sys __all__ = ["ReceiveBuffer"] # Operations we want to support: # - find next \r\n or \r\n\r\n (\n or \n\n are also acceptable), # or wait until there is one # - read at-most-N bytes # Goals: # - on average, do this fast # - worst case, do this in O(n) where n is the number of bytes processed # P...
"""The Gaussian Process module. Author: Ilias Bilionis Date: 11/20/2012 """ __all__ = ['CovarianceFunction', 'RealCovarianceFunction', 'SECovarianceFunction', 'SeparableCovarianceFunction', 'MeanModel', 'ConstantMeanModel', 'SeparableMeanModel', 'MultioutputGauss...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi # Copyright 2014 # Original concept by James Reeves # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Lice...
''' Created on Oct 30, 2015 @author: kashefy ''' from nose.tools import assert_equal, assert_almost_equals from mock import patch import os import tempfile import shutil import numpy as np import cv2 as cv2 import read_img as r class TestReadImage: @classmethod def setup_class(self): self.dir_tmp = ...
# Copyright 2015 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...
""" For the utilities """ import contexts as ctx import numpy as np from scipy.sparse import csr_matrix, isspmatrix_csr from snpp.utils.signed_graph import symmetric_stat, \ fill_diagonal, \ make_symmetric, \ matrix2graph def test_symmetric_stat(Q1_d): c_sym, c_consis = symmetric_stat(Q1_d) asser...
#!/usr/bin/env python # Copyright (c) 2017-present, Facebook, 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 a...
import os,sys,inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) import Variance import math def testVariance(): print ("1. Testing Variance") weighting = [2,2,2,2,2,2,2,2,2,2] test1 = [['artist1', 'ar...
import os from flask import Flask, request, g from flask_sqlalchemy import SQLAlchemy from .decorators import json db = SQLAlchemy() def create_app(config_name): """ Create the usual Flask application instance.""" app = Flask(__name__) # Apply configuration cfg = os.path.join(os.getcwd(), 'config', ...
import sys import android import os import json import urllib.request print('\n'*10) print('='*30) print(' Tussor') print(' Coletor de códigos de barras') print('='*30) droid = android.Android() print('\nCelular: "{}"'.format(os.environ['QPY_USERNO'])) choice = ' ' while choice == ' ': print('') print('='*...
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
import opencortex.core as oc min_pop_size = 3 def scale_pop_size(baseline, scale): return max(min_pop_size, int(baseline*scale)) def generate(reference = "SimpleNet", scale=1, format='xml'): population_size = scale_pop_size(3,scale) nml_doc, network = oc.generate_network(r...
from __future__ import with_statement from datetime import datetime, timedelta from mock import patch from proccer.database import Job from proccer.periodic import main from proccer.t.testing import setup_module def test_periodic(): still_bad_job = Job.create(session, 'foo', 'bar', 'baz') still_bad_job.last_...
''' This is the conductor which controls everything ''' import glob import imp from protocols.servers import * from protocols.clients import * from datatypes import * class Conductor: def __init__(self): # Create dictionaries of supported modules # empty until stuff loaded into them se...
# Copyright 2015 Infoblox Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
""" PynamoDB Connection classes ~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ from .base import Connection class TableConnection(object): """ A higher level abstraction over botocore """ def __init__(self, table_name, region=None, host=None): self._hash_keyname = None self._range_keyname = None ...
#! /usr/bin/env python # Copyright (c) 2012 Felipe Gallego. All rights reserved. # # 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 lat...
# Copyright 2019 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
# -*- coding: UTF-8 -*- import os from logging.handlers import SysLogHandler SITE_ROOT = os.path.dirname(os.path.realpath(__file__+ '/../')) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db...
""" mbed SDK Copyright (c) 2011-2015 ARM 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 agreed to in writin...
from django.contrib import sitemaps from django.urls import resolve from django.conf import settings import pytest from coda_mdstore import resourcesync from coda_mdstore import views def test_index(): assert resolve('/').func == views.index def test_all_bags(): assert resolve('/bag/').func == views.all_b...
#! /usr/bin/env python3 """Returns query sequence from BLAST hits below a specified E-Value Usage: retrieve_query_sequences.py --fastqq <FASTA or FASTQ file> --b6 <B6 or M8 file> --e_value <max E-Value> --output <output file> [--fastq] Copyright: ...
#import doctest from knights_tour import Board, Position, ChessPiece, Knight, Tour #I could potentially have one function that calls all other fuctions, so I can create one board and just pass that into each test def get_weight_from_board(rows, columns, row, column): """ The first test expects to have None re...
# -*- coding: utf-8 -*- # # This file is part of submit, a sendmail replacement or supplement for # multi-user desktop systems. # # Copyright © 2008 Michael Schutte <michi@uiae.at> # # submit is available under the terms of the MIT/X license. Please see the # file COPYING for details. from submit.deliverers import * ...
# Imports from standard libraries from datetime import date, datetime, time, timedelta # Imports from Django from django.core.paginator import EmptyPage, InvalidPage, Paginator from django.contrib.sites.models import Site from django.http import Http404, HttpResponsePermanentRedirect from django.template import Reques...
import asyncio from discord.ext import commands import checks import discord class Util(): def __init__(self, bot): self.bot = bot @commands.command(name='eval', pass_context=True) @checks.is_owner() async def eval(self, ctx, *, code : str): """Evaluates code Usage: !eval <cod...
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2009 Benny Malengier # # 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) ...
#import gobject #from dbus.mainloop.glib import DBusGMainLoop import dbus import json import datetime import couchdb import time from conf import getUsernamePassword #DBusGMainLoop(set_as_default=True) #loop = gobject.MainLoop() bus = dbus.SystemBus() upower = bus.get_object("org.freedesktop.UPower","/org/freedesktop/...
#!/usr/bin/python from xml.dom.minidom import parse import xml.dom.minidom, os current_directory = os.path.dirname(os.path.abspath(__file__)) data_directory = os.path.join(current_directory, '../data') file_path = os.path.join(data_directory, 'coverages.xml') # Open XML document using minidom parser D...
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
#!/usr/bin/env python import io import sys def parseLine(line): l = line.strip().split() return int(l[0]), int(l[1]), int(l[2]) def convert(dataName, f): with open("docword." + dataName + ".txt", 'r') as doc, open("vocab." + dataName + ".txt", 'r') as voc: vocList = [] for w in voc: ...
import argparse import logging from dvc.exceptions import DvcException from . import completion from .base import CmdBaseNoRepo, append_doc_link logger = logging.getLogger(__name__) class CmdGetUrl(CmdBaseNoRepo): def run(self): from dvc.repo import Repo try: Repo.get_url(self.args...
import pygame # initialize sounds pygame.mixer.init(buffer=200) # This can be increased for better sound quality, but causes latency (incorrect tempo) pygame.mixer.set_num_channels(100) # Set variables used to represent the arrows in each cell LEFT = ((10, 37.5), (65, 10), (65, 65)) RIGHT = ((10, 10), (10, 65), (65...
""" ETLT Copyright 2016 Set Based IT Consultancy Licence MIT """ import abc import datetime class Type2ReferenceDimension(metaclass=abc.ABCMeta): """ Abstract class for type2 dimensions for which the reference data is supplied with date intervals. """ # ---------------------------------------------...
#!/usr/bin/env python # coding=utf-8 import xlrd import sys def parser(filepath, savepath, direction='row'): sheets = xlrd.open_workbook(filepath) sheet = sheets.sheet_by_index(0) with open(savepath, 'wb') as fw: if direction == 'row': total_len = sheet.nrows for i, row in ...
import discord from discord.ext import commands from .utils import checks import aiohttp import json import logging import time import os log = logging.getLogger('red.apitoolsoz') class ApitoolsOz: """Steam and SteamSpy related commands""" def __init__(self, bot): self.bot = bot ...