src
stringlengths
721
1.04M
# Write a function # def mergeSorted(a, b) # that merges two sorted lists, producing a new sorted list. Keep an index into each list, # indicating how much of it has been processed already. Each time, append the small- # est unprocessed element from either list, then advance the index. For example, if a is # 1 ...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
from flask import Blueprint, flash, redirect, render_template, url_for from flask_babel import lazy_gettext as _ from flask_login import current_user from app import db from app.decorators import require_role from app.forms import init_form from app.forms.contact import ContactForm from app.models.contact import Conta...
from datetime import timedelta import mock from unittest import TestCase import warnings from featureforge.experimentation.stats_manager import StatsManager DEPRECATION_MSG = ( 'Init arguments will change. ' 'Take a look to http://feature-forge.readthedocs.io/en/latest/experimentation.html' '#exploring-th...
# Copyright 2018 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...
#!/usr/bin/env python import unittest import ossie.utils.testing import os from omniORB import any class ComponentTests(ossie.utils.testing.ScaComponentTestCase): """Test for all component implementations in AudioSource""" def testScaBasicBehavior(self): ###############################################...
import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker from mpl_toolkits.axes_grid.parasite_axes import SubplotHost from mpl_toolkits.axes_grid1 import host_subplot import mpl_toolkits.axisartist as AA def plot(srv_app, srv_lwip, cli_app, cli_lwip): #srv_app = {0:[],1:[],2:[]} #srv_...
""" Principal Component Analysis """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis A. Engemann <d.engemann@fz-juelich.de> # # License: BSD 3 clause from math import log, sqrt import warnin...
""" This code generates frames from CSV values that can be stiched together using FFMPEG to animate pedestrian data. This version produces an animation at 4x speed. """ print "Importing..." # Please ensure the following dependencies are installed before use: import pylab import numpy as np import itertools impo...
from __future__ import unicode_literals, division, print_function import json import math import pytz import random import resource import six import sys import time import uuid from collections import defaultdict from datetime import timedelta from django.conf import settings from django.contrib.auth.models import U...
import unittest import re from nose.tools import eq_, ok_ from django.test.client import RequestFactory from django.core.cache import cache from fancy_cache.memory import find_urls from . import views class TestViews(unittest.TestCase): def setUp(self): self.factory = RequestFactory() def tearDown(...
#!/usr/bin/python # -*- coding: utf-8 -*- import pygobstoneslang.common.utils as utils import pygobstoneslang.common.i18n as i18n from pygobstoneslang.common.tools import tools import pygobstoneslang.lang as lang from pygobstoneslang.lang.gbs_api import GobstonesRun import logging import os import traceback def setup_...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # hb_balancer # High performance load balancer between Helbreath World Servers. # # Copyright (C) 2012 Michał Papierski <michal@papierski.net> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public Lic...
from bs4 import BeautifulSoup import requests import json from collections import OrderedDict # TODO: Add OAuth2 so api can maximize rate limit of 30 requests per min # for individual repo fetching using github search API. class GhShowcaseAPI(object): """""" def __init__(self,): pass def get...
# -*- coding: utf-8 -*- # # align.py - align commander module # # Copyright (C) 2010 - Jesse van den Kieboom # # 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 Licens...
""" Unit Test of Workflow Modules """ import unittest import itertools import os import copy import shutil from mock import MagicMock as Mock from DIRAC import gLogger class ModulesTestCase( unittest.TestCase ): """ Base class for the Modules test cases """ def setUp( self ): gLogger.setLevel( 'ERROR' ) ...
#encoding: utf8 import pdb import numpy as np import matplotlib.pyplot as plt from data_loader import load_data from cv_common import one_std_error_rule, gen_CV_samples_by_K_folds ''' 在特征之间有一定线性相关度时(协方差不为0),一个大的特征参数有可能会增加而另一些变为负数或趋于0 这导致方差很大 L1通过收缩参数,减小了相关特征的影响,部分特征的参数项可以为0 f(x) = seta * x J(X;seta) = 1/2n*(f(X...
#!/usr/bin/env python import codecs from setuptools import setup, find_packages url='http://github.com/mila/django-noticebox/tree/master' try: long_description = codecs.open('README.rst', "r", "utf-8").read() except IOError: long_description = "See %s" % url setup( name='django-noticebox', version...
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Abstract base classes for the SearchIO object model.""" import sys # Add path to Bio sy...
# coding: utf-8 # license: GPLv3 """Модуль визуализации. Нигде, кроме этого модуля, не используются экранные координаты объектов. Функции, создающие гaрафические объекты и перемещающие их на экране, принимают физические координаты """ header_font = "Arial-16" """Шрифт в заголовке""" window_width = 800 """Ширина окна...
from tuned import exports import tuned.logs import tuned.exceptions from tuned.exceptions import TunedException import threading import tuned.consts as consts from tuned.utils.commands import commands __all__ = ["Controller"] log = tuned.logs.get() class TimerStore(object): def __init__(self): self._timers = dict...
from routines import cspline_transform, cspline_sample4d, slice_time from transform import Affine, apply_affine, BRAIN_RADIUS_MM import numpy as np from scipy import optimize DEFAULT_SPEEDUP = 4 DEFAULT_OPTIMIZER = 'powell' DEFAULT_WITHIN_LOOPS = 2 DEFAULT_BETWEEN_LOOPS = 5 def grid_coords(xyz, affine, fro...
''' Created on 4 Jul 2016 @author: wnm24546 ''' import glob, os, re, sys import h5py import numpy as np ############################################ ## EDIT LINES BELOW HERE ################### ############################################ #Give the directory path the files are and... (all values between ' or ") wor...
import time import random import hashlib from social.utils import setting_name from social.store import OpenIdStore class BaseTemplateStrategy(object): def __init__(self, strategy): self.strategy = strategy def render(self, tpl=None, html=None, context=None): if not tpl and not html: ...
import sys newDelimiter="###GREPSILON###" def usage(): print "USAGE:" print sys.argv[0],"<delim>","<match>","--new-delimiter <new delimiter>","<filename>" print " " print "This script looks for <match> in blocks surrounded by beginning of file, <delim> and EOF" print "Tip: this...
import hashlib import hmac import io import os import re from binascii import b2a_base64, a2b_base64 from .. import ecdsa from ..serialize.bitcoin_streamer import stream_bc_string from ..ecdsa import ellipticcurve, numbertheory from ..networks import address_prefix_for_netcode, network_name_for_netcode from ..encodi...
# -*- coding: utf-8 -*- from openerp import fields, models, api class product_catalog_report(models.Model): _inherit = 'product.product_catalog_report' category_type = fields.Selection( [('public_category', 'Public Category'), ('accounting_category', 'Accounting Category')], 'Categor...
"""Module containing a preprocessor that removes the outputs from code cells""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os try: from queue import Empty # Py 3 except ImportError: from Queue import Empty # Py 2 from IPython.utils.traitlets...
from flask import Flask, render_template, request, redirect from sql import select # Create Flask app app = Flask(__name__) # API Blueprint from api import api app.register_blueprint(api, url_prefix="/api") # Load Index page @app.route("/") def index(): return render_template("index.html") # ...
import sc, random, contextlib, wave, os, math import shlex, subprocess, signal import NRTOSCParser3 import numpy as np import scipy.signal # generator class for weighted random numbers # # Pass in one or the other: # - weights: custom weights array # - size: size of "standard" weights array that algo should make on ...
from datetime import date from django.conf import settings from kitsune.kbadge.tests import BadgeFactory from kitsune.questions.badges import QUESTIONS_BADGES from kitsune.questions.tests import AnswerFactory from kitsune.sumo.tests import TestCase from kitsune.users.tests import UserFactory class TestQuestionsBadg...
import operator import os import pprint import random import signal import time import uuid import logging import pytest import psutil from collections import defaultdict, namedtuple from multiprocessing import Process, Queue from queue import Empty, Full from cassandra import ConsistencyLevel, WriteTimeout from cass...
from pybrain.rl.agents.logging import LoggingAgent from pybrain.rl.agents.learning import LearningAgent from scipy import where from random import choice class BejeweledAgent(LearningAgent): def getAction(self): # get best action for every state observation # overlay all action values for every st...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import random import numpy as np import os import sys import time import unittest import ray import ray.test.test_utils class ActorAPI(unittest.TestCase): def tearDown(self): ...
# # # # # compare tasmin, tas, tasmax in a timeseries of GeoTiff files # # # # def transform_from_latlon( lat, lon ): ''' simple way to make an affine transform from lats and lons coords ''' from affine import Affine lat = np.asarray( lat ) lon = np.asarray(lon) trans = Affine.translation(lon[0], lat[0]) scale ...
from vsvbp.container import Item, Bin, Instance from vsvbp.solver import is_feasible, optimize import unittest class OptimizationTestCase(unittest.TestCase): def setUp(self): self.items = [Item([0,4,3]), Item([1,1,3]), Item([5,2,1]), Item([3,1,7])] self.bins = [Bin([5,5,8]), Bin([8,5,9]), Bin([3,3...
# Copyright (c) 2010 Witchspace <witchspace81@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
import pytest from ..connectors.dummy import Dummy from ..worker import Worker from ..broker import Broker from .fixtures import Adder, FakeAdder, AbstractAdder class TestWorker(object): @property def connector(self): return Dummy() @property def broker(self): return Broker(self.con...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from glob import glob from subprocess import check_output, CalledProcessError def get_usb_devices(): """ Lista dispositivos USB conectados :return: """ sdb_devices = map(os.path.realpath, glob('/sys/block/sd*')) usb_devices = (dev for de...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
import unittest import uuid from fate_arch.session import computing_session as session from federatedml.feature.homo_onehot.homo_ohe_arbiter import HomoOneHotArbiter class TestOHE_alignment(unittest.TestCase): def setUp(self): self.job_id = str(uuid.uuid1()) session.init(self.job_id) def tes...
__all__ = ["Profiler"] from collections import defaultdict import cProfile import datetime import errno import functools import os import time from werkzeug.contrib.profiler import ProfilerMiddleware def profile(category, *profiler_args, **profiler_kwargs): """ Decorate a function to run a profiler on the e...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Smewt - A smart collection manager # Copyright (c) 2010 Nicolas Wack <wackou@smewt.com> # # Smewt 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 versio...
from collections import namedtuple Button = namedtuple("Button", ["name", "winVal", "mask"]) buttons = [ Button(name="psxLeft", winVal=0x25, mask=1), # Arrow Left Button(name="psxDown", winVal=0x28, mask=2), # Arrow Down Button(name="psxRight", winVal=0x27, mask=4), # Arrow Right ...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import os import tempfile from devil.utils import cmd_helper from pylib import constants from pylib.results import json_results class JavaTestR...
#!/usr/local/bin/python # # BitKeeper hook script. # # svn_buildbot.py was used as a base for this file, if you find any bugs or # errors please email me. # # Amar Takhar <amar@ntp.org> ''' /path/to/bk_buildbot.py --repository "$REPOS" --revision "$REV" --branch \ "<branch>" --bbserver localhost --bbport 9989 ''' im...
#coding=UTF-8 from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext from pyspark.sql.types import * from datetime import date, datetime, timedelta import sys, re, os st = datetime.now() conf = SparkConf().setAppName('PROC_O_LNA_XDXT_CUSTOMER_INFO').setMaster(sys.argv[2]) sc = SparkContext(conf = co...
# coding: utf-8 # # Language Translation # In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset of English and French sentences that can translate new sentences from English to French. # ## Get the Data # Since...
#!/usr/bin/python """ Copyright (c) 2014 High-Performance Computing and GIS (HPCGIS) Laboratory. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. Authors and contributors: Eric Shook (eshook@kent.edu) """ import os import datetime import time import...
#!/usr/bin/python # Copyright (c) 2017 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', 'status': ['pre...
from .agent import do_request from .base import BaseSource from .types import Types class RoundTables(BaseSource): def __init__(self): super(RoundTables, self).__init__() self._start_urls = [ 'https://api.zhihu.com/roundtables?excerpt_len=75' ] def _parse(self, json_objs...
import numpy as np import pandas as pd # from matplotlib.pyplot import plot,show,draw import scipy.io from functions import * import _pickle as cPickle import time import os, sys import ipyparallel import neuroseries as nts data_directory = '/mnt/DataGuillaume/MergedData/' datasets = np.loadtxt(data_directory+'datas...
from unittest import mock from django.test import RequestFactory, TestCase from django.test.utils import override_settings from django.urls.exceptions import NoReverseMatch from wagtail.contrib.routable_page.templatetags.wagtailroutablepage_tags import routablepageurl from wagtail.core.models import Page, Site from w...
import os import sys import imp import types class Finder: def __init__(self, ext): self.ext = ext def find_module(self, fullname, path): for dirname in sys.path: filename = os.path.join(dirname, *(fullname.split('.'))) + self.ext if os.path.exists(filename): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Define the classes and methods to work with sections. """ import numpy as np class BeamSection(object): """Defines a beam section Parameters ---------- name: str name of the section material: Material instance material of the sect...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2006 José de Paula Eufrásio Junior (jose.junior@gmail.com) AND # Yves Junqueira (yves.junqueira@gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public Lic...
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2014 The Plaso Project Authors. # Please see the AUTHORS file for details on individual 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 L...
#!/usr/bin/env python # (c) 2015, Hewlett-Packard Development Company, L.P. # # This module 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 ver...
#!/usr/bin/env python import numpy as np import naima from astropy import units as u from astropy.io import ascii ## Read data data=ascii.read('CrabNebula_HESS_2006.dat') ## Set initial parameters p0=np.array((474,2.34,np.log10(80.),)) labels=['norm','index','log10(cutoff)'] ## Model definition ph_energy = u.Qua...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/Users/lee/backups/code/iblah_py/ui/ui_profile_dialog.ui' # # Created: Fri May 6 21:47:58 2011 # by: PyQt4 UI code generator 4.8.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fro...
# Copyright (c) 2011 OpenStack Foundation # # 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 ...
from __future__ import absolute_import import click from manuel.manuel import Manuel @click.group() def manuel(): pass @manuel.command() @click.argument('config_file') @click.option('--index/--no-index', default=False) @click.option('--recreate/--no-recreate', default=True) @click.option('--debug/--no-debug', d...
import simplejson as json from django.core import serializers from django.http import HttpResponse, Http404 from django.shortcuts import get_object_or_404 from django.contrib.contenttypes.models import ContentType from django.utils.html import strip_tags from models import Entry from forms import EntryForm ...
# -*- 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): # Deleting field 'Distributor.email_main' db.delete_column('alibrary_distributor', 'email_main') # ...
import random import uuid from datetime import date, datetime, timedelta import pytest from app import db from app.dao import fact_processing_time_dao from app.dao.email_branding_dao import dao_create_email_branding from app.dao.inbound_sms_dao import dao_create_inbound_sms from app.dao.invited_org_user_dao import sa...
# -*- coding: utf-8 -*- import os import uuid import datetime from google.appengine.ext import webapp from google.appengine.api import users from google.appengine.ext import db from google.appengine.api import mail from google.appengine.ext.webapp import template from django.utils import simplejson as json from goog...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as 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 'Despesa.valor' db.alter_column('financeiro_despesa', '...
#!/usr/bin/env python2 from __future__ import print_function from collections import namedtuple Node = namedtuple('Node', ['color', 'left', 'right', 'low', 'high', 'key']) def mid(node): return (node.high + node.low) / 2.0 def makeRed(node): return Node('red', node.left, node.right, node.low, node.high, node...
#!/usr/bin/env python """test_nba Tests for `nba` module. """ from sportsstats import nba import unittest class TestNba(unittest.TestCase): def setUp(self): from datetime import datetime april_9 = datetime(2016, 4, 9) self.nba_stats = nba.Stats(april_9, april_9) self.expected_qu...
"""Core classes and exceptions for Simple-Salesforce""" # has to be defined prior to login import DEFAULT_API_VERSION = '29.0' import requests import json try: from urlparse import urlparse except ImportError: # Python 3+ from urllib.parse import urlparse from simple_salesforce.login import SalesforceL...
""" YumConf - file ``/etc/yum.conf`` ================================ This module provides parsing for the ``/etc/yum.conf`` file. The ``YumConf`` class parses the information in the file ``/etc/yum.conf``. See the ``IniConfigFile`` class for more information on attributes and methods. Sample input data looks like:: ...
""" Cisco_IOS_XR_man_xml_ttyagent_oper This module contains a collection of YANG definitions for Cisco IOS\-XR man\-xml\-ttyagent package operational data. This module contains definitions for the following management objects\: netconf\: NETCONF operational information xr\-xml\: xr xml Copyright (c) 2013\-2016 ...
''' Takes in a list of values from the database and creates a facesheet. ''' import os from docx import Document from docx.enum.text import WD_ALIGN_PARAGRAPH def assemble_address(street, apartment, city, state, zip_code): address = street.title() if apartment: address += f' APT: {apartment.title()}'...
 """ ----------------------------------------------------------------------------- This source file is part of OSTIS (Open Semantic Technology for Intelligent Systems) For the latest info, see http://www.ostis.net Copyright (c) 2010 OSTIS OSTIS is free software: you can redistribute it and/or modify it under the ter...
__author__ = 'Viktor Kerkez <alefnula@gmail.com>' __contact__ = 'alefnula@gmail.com' __date__ = '20 April 2010' __copyright__ = 'Copyright (c) 2010 Viktor Kerkez' import logging from django import forms from django.conf import settings from google.appengine.api import mail # perart imports from perart impor...
# -*- coding: utf-8 -*- from kivy.uix.screenmanager import Screen #from kivy.lang import Builder from models.senhas import Senha, Collection from kivy.uix.button import Button from kivy.uix.gridlayout import GridLayout from telas.utilities import Confirma, JanelaSettings import sys class JanelaCollect (Screen): ...
#!/usr/bin/python # -*- coding: utf-8 -*- ############################################################################## # # Pedro Arroyo M <parroyo@mallconnection.com> # Copyright (C) 2015 Mall Connection(<http://www.mallconnection.org>). # # This program is free software: you can redistribute it and/or modify #...
# -*- coding: utf-8 -*- # # diffoscope: in-depth comparison of files, archives, and directories # # Copyright © 2018 Chris Lamb <lamby@debian.org> # # diffoscope 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,...
from Module import AbstractModule class Module(AbstractModule): def __init__(self): AbstractModule.__init__(self) def run( self, network, in_data, out_attributes, user_options, num_cores, out_filename): from genomicode import filelib from genomicode import SimpleVariant...
''' xfilesharing XBMC Plugin Copyright (C) 2013-2014 ddurdle 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 ver...
from __future__ import absolute_import __author__ = 'noe' def load_2well_discrete(): from .double_well_discrete import DoubleWell_Discrete_Data return DoubleWell_Discrete_Data() def get_bpti_test_data(): """ Returns a dictionary containing C-alpha coordinates of a truncated BTBI trajectory. Notes...
#!/usr/bin/env python3 import pickle import math import numpy as np import re import sys model_file = sys.argv[1] trim_trailing_zeros = re.compile('0+p') def small_hex(f): hf = float(f).hex() return trim_trailing_zeros.sub('p', hf) def process_column(v, pad): """ process and pad """ return [small_...
# -*- coding: utf-8 -*- ''' Performance Testing Requirements: pip install pyahocorasick ''' import random import string import time from py_aho_corasick import py_aho_corasick import ahocorasick rand_str = lambda n: ''.join([random.choice(string.ascii_lowercase) for i in range(n)]) if __name__ == '__main__': ...
from pyparsing import * import re ParserElement.enablePackrat() from .tree import Node, Operator import pdb def rparser(): expr = Forward() lparen = Literal("(").suppress() rparen = Literal(")").suppress() double = Word(nums + ".").setParseAction(lambda t:float(t[0])) integer = pyparsing_common.signed_int...
# Version: 0.15+dev """The Versioneer - like a rocketeer, but for versions. The Versioneer ============== * like a rocketeer, but for versions! * https://github.com/warner/python-versioneer * Brian Warner * License: Public Domain * Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, and pypy * [![Latest Version] (https...
# -*- 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 (t...
#!/usr/bin/env python ''' Test harness for validating MrMangler binary Checks itanium manglings generated by MrMangler matches the counterpart demangling from c++filt. ''' import argparse import os import subprocess import sys def run_mangler(func_signature, exe): ''' Runs MrMangler executable Args: ...
import os from tempfile import mktemp from numpy import * from libtiff import TIFF def test_write_read(): for itype in [uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, complex64, complex128]: image = array([[1, 2, 3], [4, 5,...
from setuptools import setup from setuptools import find_packages from distutils.extension import Extension try: from Cython.Build import cythonize except ImportError: def cythonize(extensions): return extensions sources = ['rocksdb/_rocksdb.cpp'] else: sources = ['rocksdb/_rocksdb.pyx'] mod1 = Extens...
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2017-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser 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 S...
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 import datetime from random import randint import urllib2 from django.core.cache import cache from django.test import Client from mock import patch, MagicMock from rapidsms.contrib.locations.models import Location, LocationType from survey.investigator_configs import COUNTRY_...
import numpy as np # from numpy.random import randint my_list = [1,2,3,4,5,6] new_list = [[1,2,3], [4,5,6], [7,8,9]] # 1D array print('Casting a premade list into a 1D numpy array') print(np.array(my_list)) # 2D array, note the extra brackets being displayed print('\nCasting a list of lists into a 2D numpy array') ...
from ase import Atoms from ase.units import Bohr from gpaw import GPAW from gpaw.tddft import TDDFT, photoabsorption_spectrum, \ LinearAbsorbingBoundary, P4AbsorbingBoundary, PML from gpaw.test import equal import os # Sodium dimer, Na2 d = 1.5 atoms = Atoms(symbols='Na2', positions=[( 0, 0, d), ...
# -*- coding: utf-8 -*- import re from core import httptools from core import scrapertools from core import servertools from core.item import Item from platformcode import logger host = 'http://www.xn--hentaienespaol-1nb.net/' headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Fi...
"""Bump version and create Github release This script should be run locally, not on a build server. """ import argparse import contextlib import os import re import subprocess import sys import git import github import changelog ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) def main(): b...
import numpy as np def spatial_rate_map(x, y, t, spike_train, binsize=0.01, box_xlen=1, box_ylen=1, mask_unvisited=True, convolve=True, return_bins=False, smoothing=0.02): """Divide a 2D space in bins of size binsize**2, count the number of spikes in each bin and divi...
# # # Copyright (C) 2010, 2011, 2012, 2013 Google Inc. # # 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 progr...
# xml.etree test for cElementTree from test import support from test.support import bigmemtest, _2G import unittest cET = support.import_module('xml.etree.cElementTree') # cElementTree specific tests def sanity(): r""" Import sanity. >>> from xml.etree import cElementTree Issue #6697. >>> e ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def main(argv): from sc_logic import check_semi_connectedness graphs = [] if len(argv) < 2: print('k = 2') k = 2 print('Graph 1:') print('n = 3') n = 3 print('m = 2') m = 2 g = [[0 for i in ran...
# -*- coding: utf-8 -*- __author__ = 'isparks' import enum class DataType(enum.Enum): """ODM Data Types""" Text = 'text' Integer = 'integer' Float = 'float' Date = 'date' DateTime = 'datetime' Time = 'time' String = 'string' # Used only by codelists class QueryStatusType(enum.Enum)...