src
stringlengths
721
1.04M
import logging from django.core.management.base import BaseCommand, CommandError from world.initialization import initialize_world, AlreadyInitializedException from world.models.geography import World class Command(BaseCommand): help = 'Initializes the specified world' def add_arguments(self, parser): ...
""".""" import os from unittest import mock from django import test from django.core import management from django.conf import settings class FixtureDir: """Helper class to construct fixture paths.""" def __init__(self, rel_path='', base_dir=None): """Class constructor. params: rel_...
#!/usr/bin/env python """A model of the state of the perms actor. It contains instance variables that are KeyVariables or sets of KeyVariables. All are directly associated with status keywords. History: 2003-12-10 ROwen 2003-12-17 ROwen Moved KeyVarFactory to RO.KeyVariable. 2004-05-18 ROwen Eliminated unused t...
GENOMES_DIR = '/home/cmb-panasas2/skchoudh/genomes' OUT_DIR = '/staging/as/skchoudh/rna/September_2017_Shalgi_et_al_Cell_2013' SRC_DIR = '/home/cmb-panasas2/skchoudh/github_projects/clip_seq_pipeline/scripts' RAWDATA_DIR = '/home/cmb-06/as/skchoudh/dna/September_2017_Shalgi_et_al_Cell_2013/sra_single_end_mouse' GENOME_...
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 ...
# -*- coding: utf-8 -*- """ *************************************************************************** doPctRgb.py --------------------- Date : June 2010 Copyright : (C) 2010 by Giuseppe Sucameli Email : brush dot tyler at gmail dot com *******************...
import PyTango import socket import MotorController class IcePapController(MotorController.MotorController): MaxDevice = 6 def __init__(self,inst,props): print "PYTHON -> IcePapController ctor for instance",inst MotorController.MotorController.__init__(self,inst,props) self.nb_call = ...
# Copyright (c) 2015 Uber Technologies, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publ...
# -*- coding: utf-8 -*- from gettext import gettext as _ NAME = _('Bolivia') STATES = [ (_('Pando'), 254, 136, 124, 0), (_('Beni'), 253, 283, 292, 0), (_('La Paz'), 252, 124, 431, 0), (_('Oruro'), 251, 146, 609, 0), (_('Potosí'), 250, 204, 745, 0), (_('Cochabamba'), 249, 279, 503, 0), (_(...
from __future__ import print_function from __future__ import absolute_import from __future__ import division try: basestring except NameError: basestring = str from System.Drawing.Color import FromArgb from Rhino.Geometry import Point3d from compas.utilities import color_to_rgb from compas_rhino.conduits.bas...
from helper import unittest, PillowTestCase from PIL import GimpGradientFile class TestImage(PillowTestCase): def test_linear_pos_le_middle(self): # Arrange middle = 0.5 pos = 0.25 # Act ret = GimpGradientFile.linear(middle, pos) # Assert self.assertEqua...
# # Copyright 2008-2014 Universidad Complutense de Madrid # # This file is part of Numina # # Numina 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 l...
# -*- coding: utf-8 -*- # # CppExpat documentation build configuration file, created by # sphinx-quickstart on Mon Jul 13 19:00:49 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
# Sebastian Raschka, 2016 """ source: http://adventofcode.com/2016/day/8 DESCRIPTION You come across a door implementing what you can only assume is an implementation of two-factor authentication after a long game of requirements telephone. To get past the door, you first swipe a keycard (no problem; there was one ...
from bs4 import BeautifulSoup import urllib.request import urllib.parse import requests # urllib.request import re import json # 找到单个job的link #url = "http://ssl.gongyi.qq.com/m/201799/realtime.html?et=rtfx&gt=rtfx&ADTAG=rtfx" #url = "http://ssl.gongyi.qq.com/m/201799/realtime.html?tp=2&o=1" # 初始页 #page = urllib.reque...
# # Example: Calculate the correlation function for a cavity that is coupled to # a qubit. # from qutip import * from pylab import * import time import warnings warnings.simplefilter("error", np.ComplexWarning) def calc_correlation(E, kappa, gamma, g, wc, w0, wl, N, tlist): # # returns the two-time correlati...
import astropy.cosmology as co aa=co.Planck15 import astropy.io.fits as fits import astropy.units as u from astropy.coordinates import angles #import AngularSeparation from astropy import coordinates as coord import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as p import numpy as n import os import sys ...
import os import sys import getopt def result_data(filename): handle = open(filename) data = handle.readlines() handle.close() return data def remove_and_insert(data): i = 0 for line in data: line = line.replace("[", "") line = line.replace("]", "") line = line.replace(...
# Copyright 2014 - Samuel de Sousa (felixjr.org) # # 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 agr...
"""PaCal, the probabilistic calculator.""" from __future__ import print_function from . import params import numpy as _np from pylab import show _np.seterr(all="ignore") from .utils import Inf from .distr import DiscreteDistr from .distr import exp, log, atan, min, max, sqrt, sign, sin, cos, tan, tanh, sigmoid f...
import simplejson as json import numpy as np def parsetime(aa): if aa is None: return None return float( aa.split()[0] ) def main(filenames): if len(filenames)==0: return yield "<html>" yield """<head><style>table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { text-ali...
# # This source file is part of the EdgeDB open source project. # # Copyright 2008-present MagicStack Inc. and the EdgeDB 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...
# coding: utf-8 """ Qc API Qc API # noqa: E501 The version of the OpenAPI document: 3.0.0 Contact: cloudsupport@telestream.net Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from telestream_cloud_qc.configuration import Configuration class...
from pkg_resources import require require("macholib") import os import sys from macholib.util import has_filename_filter, in_system_path def not_stdlib_filter(module, prefix=None): """ Return False if the module is located in the standard library """ if prefix is None: prefix = sys.prefix ...
# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your ...
from flask import Blueprint from flask.ext.sqlalchemy import SQLAlchemy from flask.ext import admin from flask.ext.admin.contrib import sqla from flask.ext.admin import Admin, BaseView, expose from flask.ext.admin.base import MenuLink from flask.ext.admin.babel import gettext, ngettext, lazy_gettext from flask.ext.admi...
"""Main entry point for distributed next-gen sequencing pipelines. Handles running the full pipeline based on instructions """ from __future__ import print_function from collections import defaultdict import copy import os import sys import resource import tempfile import toolz as tz from bcbio import log, heterogen...
# # Copyright 2010 Intuit, Inc. # # Licensed under the Eclipse Public License, Version 1.0 (the "License"); # you may not use this file except in compliance with the License. Please # see the License for the specific language governing permissions and # limitations. You may obtain a copy of the License at # # http:/...
#!/usr/bin/python #Algoriths Project Part 1a #Omar Kadry #CMSC 441 #Dr. Marron #IMPLEMENTATION NOTES #Python's built in pow function uses Binary Exponentiation and reducing modulo n to compute modular #exponentiation. This is the same algorithm as MODULAR-EXPONENTIATION(a,b,n) as used in the text #For large number mutl...
# -*- coding: utf-8 -*- from cms.forms.utils import get_site_choices, get_page_choices from cms.models import Page, PageUser, Placeholder from cms.plugin_pool import plugin_pool from cms.utils import get_language_from_request, cms_static_url from django.conf import settings from django.contrib.sites.models import Site ...
#!/usr/bin/env python3 import rospy from lg_msg_defs.msg import AdhocMedias from lg_media import DirectorMediaBridge from interactivespaces_msgs.msg import GenericMessage from lg_common.helpers import handle_initial_state from lg_common.helpers import run_with_influx_exception_handler DEFAULT_VIEWPORT = 'center' MEDI...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org) """ This is a simple Python GTK+3 TreeView CellRenderText snippet. See: http://python-gtk-3-tutorial.readthedocs.org/en/latest/cellrenderers.html#cellrenderertext """ from gi.repository import Gtk as gtk from gi...
""" Production Configurations - Use Amazon's S3 for storing static files and uploaded media - Use mailgun to send emails - Use Redis for cache """ from boto.s3.connection import OrdinaryCallingFormat from .base import * # noqa # SECRET CONFIGURATION # -------------------------------------------------------------...
# Copyright 2016 Measurement Lab # # 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 writi...
#!/usr/bin/env python # encoding: utf-8 ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu), # Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu) # # ...
""" RESTx: Sane, simple and effective data publishing and integration. Copyright (C) 2010 MuleSoft Inc. http://www.mulesoft.com 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...
""" Plotting vectors ================ Plotting vectors is handled by :meth:`pygmt.Figure.plot`. """ # sphinx_gallery_thumbnail_number = 6 import numpy as np import pygmt ######################################################################################## # Plot Cartesian Vectors # ---------------------- # # Crea...
# ---------------------------------------------------------------------------- # Name: pln.py (Planning.py) # Purpose: This module contains variables for the construction # of a planning dataset. This module is to be used in # conjunction with create-Base-DataSet/main.py. #...
#!/usr/bin/env python import cmdproc import mydbus # https://developer.pidgin.im/wiki/DbusHowto # provide asynchronous import dbus import re import gobject import argparse from dbus.mainloop.glib import DBusGMainLoop import logging import subprocess import notify from multiprocessing import Process, Lock, Array, Val...
#!/usr/bin/env python # setup # Setup script for gtcal # # Author: Benjamin Bengfort <bb830@georgetown.edu> # Created: Thu Mar 27 16:46:11 2014 -0400 # # Copyright (C) 2014 Georgetown University # For license information, see LICENSE.txt # # ID: setup.py [] bb830@georgetown.edu $ """ Setup script for gtcal """ ###...
class Solution: def longestPalindrome(self, s): """ :type s: str :rtype: str """ n = len(s) maxLen, maxStart = 0, 0 for i in range(n): l, left, right = 1, i - 1, i + 1 while left >= 0 and right < n and s[left] == s[right]: ...
from django.db.backends.creation import BaseDatabaseCreation class DatabaseCreation(BaseDatabaseCreation): ''' Overloaded bits of the database creation code ''' data_types = { 'AutoField': 'int IDENTITY (1, 1)', 'BooleanField': 'bit', 'CharField': ...
from __future__ import absolute_import, print_function, division from theano.gof.type import Type from theano.gof.graph import Variable, Apply, Constant from theano.gof.op import Op from theano.gof.opt import * # noqa from theano.gof.fg import FunctionGraph from theano.gof.toolbox import * # noqa from theano import...
""" [7/18/2014] Challenge #171 [Hard] Intergalatic Bitstream https://www.reddit.com/r/dailyprogrammer/comments/2b21mp/7182014_challenge_171_hard_intergalatic_bitstream/ #Description: Keeping with our "Bit" theme this week. We will look into the future. It is 2114. We have colonized the Galaxy. To communicate we send ...
wampAddress = 'ws://172.17.3.139:8181/ws' wampRealm = 's4t' #from threading import Thread from autobahn.twisted.wamp import ApplicationRunner from autobahn.twisted.wamp import ApplicationSession from twisted.internet.defer import inlineCallbacks #import per test from twisted.internet.defer import DeferredQueue from...
from Parameter import Parameter class Command: def __init__(self, commandTag): protoTag = commandTag.find("proto") # First we need to extract the return type. returnTag = protoTag.find("ptype") if returnTag is None: self.returnType = protoTag.text.str...
#----------------------------------------------------- def clearUnwantedNodes(model): from abaqusConstants import ON ## FOR EACH PART: CLEAR UNWANTED NODES AND DELETE SHELL SECTIONS for myPart in model.parts.values(): ## clean node list (remove nodes not in the zMin plane) #1/ find zMin... ...
from app import app import os from flask import render_template from flask import Flask, redirect, url_for, request, send_from_directory from flask import json import sys import sys import csv curfilePath = os.path.abspath(__file__) curDir = os.path.abspath(os.path.join(curfilePath, os.pardir)) parDir = os.path.abspa...
# -*- 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): # Changing field 'Monster.damage_reduction_condition' db.alter_column('srd20_monster', 'damage_reduction_co...
import glob import json from data_gen import segmentation def iter_segment(doc): text = doc['text'] for segment in doc['metadata']: yield segment['lang'], text[segment['begin']:segment['end']] def iter_sentences(doc): for lang, segment in iter_segment(doc): for st in segmentation.by_sent...
#!/usr/bin/env python ## WARNING: This file is generated #!/usr/bin/env python """Create a "virtual" Python installation """ import sys import os import optparse import shutil import logging import distutils.sysconfig try: import subprocess except ImportError, e: if sys.version_info <= (2, 3): print 'E...
import numpy as np import pytest from tomato.converter import Converter def test_hz_to_cent_negative_hz_track(): # GIVEN hz_track = np.array([-50]) ref_freq = np.float(25.0) # WHEN; THEN with pytest.raises(ValueError): Converter.hz_to_cent(hz_track, ref_freq) def test_hz_to_cent_negati...
# @Author: Vegard S. <BioVegas> # @Date: 17-Nov-2016 # @Email: vegard.stuerzinger@gmail.com # @Project: BiSci # @Filename: SIZExWEIGHT.py # @Last modified by: BioVegas # @Last modified time: 17-Nov-2016 # @Copyright: Open Source import numpy as np from Tkinter import * #saving entry fields filename="SIZExWEIGHT....
import argparse import matplotlib.pyplot as plt import numpy as np import pandas as pd import pprint import scipy.stats import seaborn as sns import sklearn.cluster import sklearn.mixture def create_gmm(n_clusters): return sklearn.mixture.GaussianMixture(n_components=n_clusters) def create_kmeans(n_clusters): r...
# Configuration file for ipython. c = get_config() #------------------------------------------------------------------------------ # InteractiveShellApp configuration #------------------------------------------------------------------------------ # A Mixin for applications that start InteractiveShell instances. # # ...
from durable.lang import * import datetime def unix_time(dt): epoch = datetime.datetime.utcfromtimestamp(0) delta = dt - epoch return delta.total_seconds() def unix_time_millis(dt): return unix_time(dt) * 1000.0 with statechart('miss_manners'): with state('ready'): @to('start') @...
class MwClientError(RuntimeError): pass class MediaWikiVersionError(MwClientError): pass class APIDisabledError(MwClientError): pass class MaximumRetriesExceeded(MwClientError): pass class APIError(MwClientError): def __init__(self, code, info, kwargs): self.code = code self...
# -*- coding: utf-8 -*- # # PySPED - Python libraries to deal with Brazil's SPED Project # # Copyright (C) 2010-2012 # Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Library General Public Lic...
#!//bin/env python #coding:utf-8 import os import sys import string import time import datetime import MySQLdb import cx_Oracle import logging import logging.config logging.config.fileConfig("etc/logger.ini") logger = logging.getLogger("oracle") path='./include' sys.path.insert(0,path) import functions as func import c...
# # createtorrentdialog.py # # Copyright (C) 2008 Andrew Resch <andrewresch@gmail.com> # # Deluge is free software. # # You may 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...
# Copyright 2015 VPAC # # This file is part of Karaage. # # Karaage is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Karaage is dist...
from bitforge.unit import Unit class TestUnit: def test_btc_accessors(self): u = Unit(btc = 1.2) assert u.btc == 1.2 assert u.mbtc == 1200 assert u.bits == 1200000 assert u.satoshis == 120000000 def test_btc_conversion(self): u = Unit(btc = 1.3) assert...
import sys import termios import atexit from select import select class KBHit(object): def __init__(self): '''Creates a KBHit object that you can call to do various keyboard things. ''' # Save the terminal settings self.fd = sys.stdin.fileno() self.new_term = termios.tcgetattr(self.fd) self.old_term = te...
""" [7/9/2014] Challenge #170 [Intermediate] Rummy Checker https://www.reddit.com/r/dailyprogrammer/comments/2a9u0a/792014_challenge_170_intermediate_rummy_checker/ # [](#IntermediateIcon) _(Intermediate)_: Rummy Checker [Rummy](http://en.wikipedia.org/wiki/Rummy) is another very common card game. This time, the aim ...
# file eulxml/xmlmap/core.py # # Copyright 2010,2011 Emory University Libraries # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.contenttypes.models import ContentType class Cart(models.Model): creation_date = models.DateTimeField(verbose_name=_('creation date')) checked_out = models.BooleanField(default=False, verbose_name=_('check...
import argparse parser = argparse.ArgumentParser() parser.add_argument("--interactive", action="store_true") args = parser.parse_args() import openravepy import trajoptpy import json env = openravepy.Environment() env.StopSimulation() env.Load('test.xml') trajoptpy.SetInteractive(args.interactive) # pause every itera...
#! /usr/bin/env python #/*------------------------------------------------------------------------- #Coco.py -- the Compiler Driver #Compiler Generator Coco/R, #Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz #extended by M. Loeberbauer & A. Woess, Univ. of Linz #ported from Java to Python by Ronald...
# # Copyright (C) 2006-2008, 2013 Red Hat, Inc. # Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.com> # # 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, o...
import re import datetime from django import http from django.shortcuts import render from django.contrib.sites.models import RequestSite from django.core.urlresolvers import reverse from django.conf import settings from django import forms from ratelimit.decorators import ratelimit from waffle.decorators import waff...
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Author: enen92 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This p...
# -*- coding: utf-8 -*- # Copyright 2017 OpenSynergy Indonesia # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, api class ResPartner(models.Model): _inherit = "res.partner" @api.multi def button_toggle_customer(self): for partner in self: pa...
# -*- coding: utf-8 -*- import json from flask import Flask, Blueprint, current_app, jsonify, url_for, redirect, request, Response from cerberus import Validator from database import mongo from flask.ext.restful import Api, Resource from bson.json_util import loads, dumps from encoders.json_encoder import JSONEncoder ...
# -*- coding: utf-8 -*- # Copyright (c) 2010-2016, MIT Probabilistic Computing 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/LICENS...
#!/usr/bin/python __author__ = 'mm' import json import os print "Start Generate Templates Hook" cookie_dir = '{{cookiecutter.app_name}}' project_base = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) json_file = os.path.join(project_base, 'cookiecutter.json') base_templates = os.path.join(project_base...
# 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 License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
"""Lists the running pyFoam-Processes""" from PyFoam.Applications.PyFoamApplication import PyFoamApplication from PyFoam import configuration as config from PyFoam.ThirdParty.six import print_,iteritems from PyFoam.Infrastructure.ZeroConf import getServerList from PyFoam.Infrastructure.ServerBase import getServerProxy...
# Imports import os import six from bvp.utils.blender import add_group, grab_only, apply_material from .constraint import ObConstraint, CamConstraint from .mapped_class import MappedClass from .object import Object # Should be moved, along with test below #from .Camera import Camera #from .Scene import Scene #from .Sk...
# # Copyright 2017 Google 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 agreed to in writing...
# -*- coding: utf-8 -*- # from __future__ import print_function import datetime import numpy as np from .context import ExecutionContext, set_current_security, set_current_date, symbol from .utils import getsourcelines, FormulaException, get_int_date def suppress_numpy_warn(func): def wrapper(*args, **kwargs):...
#! /usr/bin/python import numpy as np import getelec_mod as gt from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import matplotlib as mb font = 30 # mb.rcParams["font.family"] = "Serif" mb.rcParams["font.size"] = font mb.rcParams["axes.labelsize"] = font mb.rcParams["xtick.labelsize"] = font mb....
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # http://doc.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals class OnesixnineSpiderMiddleware(object): # Not all methods need to be defined. If a method is not defined, # scrap...
import RPi.GPIO as GPIO import time #sequence for a1, b2, a2, b1 phase_seq=[[1,1,0,0],[0,1,1,0],[0,0,1,1],[1,0,0,1]]; #full step sequence. maximum torque #phase_seq=[[1,0,0,0],[1,1,0,0],[0,1,0,0],[0,1,1,0],[0,0,1,0],[0,0,1,1],[0,0,0,1],[1,0,0,1]] #half-step sequence. double resolution. But the torque of the stepper mo...
import csv import os import time from scipy import misc import keras.callbacks as cb import keras.utils.np_utils as np_utils from keras.models import Sequential from keras.layers.convolutional import Convolution2D from keras.layers.core import Dense, Dropout, Activation, Flatten from keras.layers import MaxPooling2D,...
# This program is public domain """ File extension registry. This provides routines for opening files based on extension, and registers the built-in file extensions. """ import os.path class ExtensionRegistry(object): """ Associate a file loader with an extension. Note that there may be multiple loaders...
# Copyright (c) 2013 Mirantis 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 agreed to in writi...
# Copyright (c) 2012 - Oscar Campos <oscar.campos@member.fsf.org> # See LICENSE for more details """ Tests for pinky.scripts.output This code is taken straight from https://github.com/PyMamba/mamba-framework """ from twisted.trial import unittest from pinky.scripts.output import codes, _styles, style_to_ansi_code ...
import networkx as nx import math class Maze: def __init__(self): self.g = nx.MultiGraph() self.newNodeUid = 0 self.startNode = None self.finishNode = None self.distTol = 75 # Distance tolerance to consider two nodes to be the same self.farAway = 10000 # A long dist...
"""Test functionalities of OptGPSampler.""" from typing import TYPE_CHECKING import numpy as np import pytest from cobra.sampling import OptGPSampler if TYPE_CHECKING: from cobra import Model from cobra.sampling import ACHRSampler @pytest.fixture(scope="function") def optgp(model: "Model") -> OptGPSample...
# Copyright (c) Mathias Kaerlev 2012. # This file is part of Anaconda. # Anaconda is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # ...
#!/usr/bin/env python def print_if_apptuit_standard_metric(metric, mapping, timestamp, value, tags=None, tags_str=None): if metric not in list(mapping["metrics"].keys()): return new_metric_name = mapping["metrics"][metric]["standard_name"] new_metric_tags_str = "" if tags is not None or tags_st...
import os import sys from spec import Spec, trap, eq_, skip, ok_ from invoke import run from invoke._version import __version__ from invoke.platform import WINDOWS def _output_eq(cmd, expected): return eq_(run(cmd, hide=True).stdout, expected) class Main(Spec): def setup(self): # Enter integration...
from sympy.combinatorics.partitions import (Partition, IntegerPartition, RGS_enum, RGS_unrank, RGS_rank, random_integer_partition) from sympy.utilities.pytest import raises from sympy.utilities.iterables import default_sort_key, par...
#! /usr/bin/env python # # Copyright (C) 2006 Thomas Adamcik, Stein Magnus Jodal # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 # as published by the Free Software Foundation. # # This program is distributed in the hope that it w...
import numpy as np import os import random import pickle class MimicDataLoader(object): def __init__(self, data_folder, batch_size=1, max_sequence=10, max_iter=None, split = 0.75, train_keep=1): super(MimicDataLoader, self).__init__() self.data_folder = data_folder self.batch_size = batch...
from src import app from flask import request, render_template, json, Response, abort, redirect from models import User, Tweet, Link, UserLink import urllib import base64 from google.appengine.api import urlfetch, taskqueue, mail import datetime import math from flask.ext.jsontools import jsonapi import urlparse import...
""" PartedL - command ``parted -l`` =============================== This module provides processing for the ``parted`` command. The output is parsed by the ``PartedL`` class. Attributes are provided for each field for the disk, and a list of ``Partition`` class objects, one for each partition in the output. Typical...
import pypeira.pypeira as pype if __name__ == "__main__": # Create instance of IRA (not necessary but much more convenient for now) ira = pype.IRA() path = "./data" # Read files. The read() function will walk from the given dir and find all files satisfying # the given criteria. Set 'walk' to Fal...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2018 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 'sta...
from FunctorApplicativeMonad import Functor, Applicative, Monad from abc import ABCMeta, abstractmethod class ParseResult(Functor, Applicative, Monad, metaclass=ABCMeta): @abstractmethod def fmap(self, fn) -> 'ParseResult': return NotImplemented @abstractmethod def apply(self, something: 'Par...