content
stringlengths
4
20k
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsVectorFileWriterTask. .. note:: 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 versio...
# -*- coding: utf-8 -*- import json import logging from base64 import b64decode from datetime import datetime from urlparse import parse_qs, urlparse from redash.query_runner import * from redash.utils import JSONEncoder logger = logging.getLogger(__name__) try: from oauth2client.service_account import ServiceA...
import requests from allauth.account.utils import get_next_redirect_url from allauth.socialaccount.providers.oauth2.views import (OAuth2LoginView, OAuth2CallbackView) from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter from kuma.core.u...
from unittest import TestCase from mysite.base.tests import TwillTests from mysite.missions.base import views import mysite.missions.base.view_helpers from mysite.missions.models import StepCompletion, Step from mysite.profile.models import Person from mysite.base.view_helpers import subproc_check_output from django.co...
from django.http import HttpResponse from rest_framework.renderers import JSONRenderer from rest_framework import status from rest_framework.response import Response from rest_framework.permissions import AllowAny from rest_framework.generics import RetrieveUpdateDestroyAPIView, ListCreateAPIView from rest_framework.vi...
''' run_client.py - An example client using the python socket implementation of the Google Protocol Buffers. This module is an executable script demonstrating the usage of the python socket implementation of the Google Protocol Buffers. To work correctly, the script requires a server to be running first (i.e. run_serv...
import json from django.core import exceptions, serializers from django.forms import Form from . import PostgreSQLTestCase from .models import HStoreModel try: from django.contrib.postgres import forms from django.contrib.postgres.fields import HStoreField from django.contrib.postgres.validators import K...
#Votelib module """ Votelib module by Blake Cretney This work is distributed AS IS. It is up to you to determine if it is useful and safe. In particular, NO WARRANTY is expressed or implied. I permanently give everyone the rights to use, modify, copy, distribute, re-distribute, and perform this work, and all d...
""" A guard implementation which supports HTTP header-based authentication schemes. If no I{Authorization} header is supplied, an anonymous login will be attempted by using a L{Anonymous} credentials object. If such a header is supplied and does not contain allowed credentials, or if anonymous login is denied, a 401 ...
#!/usr/bin/env python """ Usage: schema_parser.py SCHEMA [--output=ARG] Arguments: SCHEMA Kiwi RelaxNG schema file to parse Options: --output This is output file (stdout used if not present) """ import docopt from lxml import etree from collections import namedtuple import os.path import logging import sys...
from django.db.models import Q from django.utils.html import escape from librehatti.suspense.models import Staff from ajax_select import LookupChannel class StaffLookup(LookupChannel): model = Staff def get_query(self, q, request): staff = Staff.objects.all() for value in q.split(): ...
import urllib from PIL import Image, ImageTk import time def make_request(filename, style_id): import requests r = requests.post('http://turbo.deepart.io/api/post/', data={'style': style_id, 'return_url': 'http://my.return/'}, files={'input_image': ('file.jpg', open(filename, 'rb'), 'im...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import re from ansible.module_utils.facts.hardware.base import Hardware, HardwareCollector class AIXHardware(Hardware): """ AIX-specific subclass of Hardware. Defines memory and CPU facts: - memfree_mb - memtota...
#!/usr/bin/env python import os from pip.download import PipSession from pip.index import PackageFinder from pip.req import parse_requirements from setuptools import setup, find_packages root_dir = os.path.abspath(os.path.dirname(__file__)) requirements_path = os.path.join(root_dir, 'requirements', 'base.txt') sessi...
from django.conf.urls import include, url import django.contrib.auth.views from work_evid import views urlpatterns = [ url(r'^overviews/$', views.overviews, name='overviews'), url(r'^delete_work/$', views.delete_work, name='delete_work'), url(r'^work/$', views.WorkList.as_view(), name='work_list'), ur...
import mox from cinder import exception from cinder.openstack.common import log as logging from cinder import test from cinder.volume import configuration as conf from cinder.volume.drivers.san.hp_lefthand import HpSanISCSIDriver LOG = logging.getLogger(__name__) class HpSanISCSITestCase(test.TestCase): def se...
import operator from ..node import NodeVisitor from ..parser import parse class Compiler(NodeVisitor): """Compiler backend that evaluates conditional expressions to give static output""" def compile(self, tree, expr_data, data_cls_getter=None, **kwargs): """Compile a raw AST into a form with con...
#!/usr/bin/env python #coding: utf-8 import collections import re from six import PY3 from bpython.util import isolate, debug, getpreferredencoding @isolate def complete(expr, attr, locals_): if not expr: return [] try: obj = eval(expr, locals_) except Exception: return [] e...
from collections import Mapping, MutableMapping try: from threading import RLock except ImportError: # Platform-specific: No threads available class RLock: def __enter__(self): pass def __exit__(self, exc_type, exc_value, traceback): pass try: # Python 2.7+ from ...
""" ipctrace.py Write a trace of instantaneous IPC values for all cores. First argument is either a filename, or none to write to standard output. Second argument is the interval size in nanoseconds (default is 10000) """ import sys, os, sim class IpcTrace: def setup(self, args): args = dict(enumerate((args or...
# -*- coding: utf-8 -*- """ docker_registry.drivers.s3 ~~~~~~~~~~~~~~~~~~~~~~~~~~ This is a s3 based driver. """ # This fixes an issue where boto sends unicode to gevent.socket.getaddrinfo in # an eventlet causing the event pool to hang in a deadlock state. # This initiates the unicode => idna conversion outside of ...
# -*- coding: utf-8 -*- """Test for Word cloud Xmodule functional logic.""" from webob.multidict import MultiDict from xmodule.word_cloud_module import WordCloudDescriptor from . import LogicTest class WordCloudModuleTest(LogicTest): """Logic tests for Word Cloud Xmodule.""" descriptor_class = WordCloudDescr...
#!/usr/bin/python3 from docker import Client import json, requests, sys sys.path.append("/root/hubops") from config.docker_config import docker_config from sys import argv from random import randint class ContainerClass: def __init__(self): self.name = "hubops{}".format(randint(100000, 999999)) ...
# EXTRA reconstruction and matching # # Started from: # # Auto generated configuration file # using: # Revision: 1.381.2.28 # Source: /local/reps/CMSSW/CMSSW/Configuration/PyReleaseValidation/python/ConfigBuilder.py,v # with command line options: step1 --filein dbs:/Hydjet1p8_TuneDrum_Quenched_MinBias_2760GeV/HiFall...
def WebIDLTest(parser, harness): parser.parse( """ interface Foo {}; [LegacyUnenumerableNamedProperties] interface Bar : Foo { getter long(DOMString name); }; interface Baz : Bar { getter long(DOMString name); }; """); results ...
import vtk import chigger camera = vtk.vtkCamera() camera.SetViewUp(0.2603, 0.5500, 0.7936) camera.SetPosition(-12.3985, 5.2867, 0.8286) camera.SetFocalPoint(0.2326, 0.0324, 0.3278) clip = chigger.filters.PlaneClipper(normal=[1,1,1], normalized=False) reader = chigger.exodus.ExodusReader('../input/mug_blocks_out.e')...
from openerp import models, fields, api, http, _ from openerp.exceptions import except_orm import openerp import threading import logging _logger = logging.getLogger(__name__) class ClouderApplication(models.Model): """ Checks that the web create type has pricegrids """ _inherit = 'clouder.applicati...
from django.test import TransactionTestCase from django.test.runner import DiscoverRunner from mock import patch class NoDbMixin(object): def build_suite(self, *args, **kwargs): suite = super(NoDbMixin, self).build_suite(*args, **kwargs) self._needs_db = any([isinstance(test, TransactionTestCase)...
import sigrokdecode as srd # Dictionary of FUNCTION commands and their names. command = { # Scratchpad 0x4e: 'Write scratchpad', 0xbe: 'Read scratchpad', 0x48: 'Copy scratchpad', # Thermometer 0x44: 'Convert temperature', 0xb4: 'Read power mode', 0xb8: 'Recall EEPROM', 0xf5: 'PIO ac...
from settings import settings def log(*args): """ Display a message. Can be disabled with 'quiet' option """ if not settings['quiet']: print( ' '.join([str(msg) for msg in args]) ) def debug(*args): """ Display a debug message. Only when activated by 'debug' option """ ...
import warnings from django import http from django.test import TestCase from django.conf import settings from django.utils.translation import ugettext_lazy from django.utils.unittest import skipIf from django.contrib.messages import constants, utils, get_level, set_level from django.contrib.messages.api import Messag...
import htmlentitydefs import re, string, sys import mimetools, StringIO import ElementTree AUTOCLOSE = "p", "li", "tr", "th", "td", "head", "body" IGNOREEND = "img", "hr", "meta", "link", "br" if sys.version[:3] == "1.5": is_not_ascii = re.compile(r"[\x80-\xff]").search # 1.5.2 else: is_not_ascii = re.compil...
from django.template.defaultfilters import urlizetrunc from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class UrlizetruncTests(SimpleTestCase): @setup({'urlizetrunc01': '{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% en...
from django.db.models import sql from django.db.models.loading import cache from django.db.models.query import CollectedObjects from django.db.models.query_utils import CyclicDependency from django.test import TestCase from models import A, B, C, D, E, F class DeleteTests(TestCase): def clear_rel_obj_caches(self...
#!/usr/bin/python # coding=utf-8 import json import os from threading import Thread import numpy as np import pandas as pd from utils import HOME PATH = HOME + '/Dropbox/Twitter/' DATASETS_PATH = PATH + 'Data/datasets/' PROFILE_PATH = PATH + 'Data/profile/users_profile_data.csv' class Entropy(Thread): def ...
# dispatches to _socket for actual implementation from _socket import ( socket, error, herror, gaierror, timeout, has_ipv6, create_connection, getdefaulttimeout, setdefaulttimeout, getfqdn, gethostbyaddr, gethostbyname, gethostbyname_ex, gethostname, getprotobyname, g...
try: import json except ImportError: import simplejson as json from mock import patch from models import Service, List from test_api import StashboardTest class PublicServicesTest(StashboardTest): def test_get(self): response = self.get("/api/v1/services") self.assertEquals(response.stat...
#!/usr/bin/env python """ Setup ufuncs for the legendre polynomials ----------------------------------------- This example demonstrates how you can use the ufuncify utility in SymPy to create fast, customized universal functions for use with numpy arrays. An autowrapped sympy expression can be significantly faster tha...
from __future__ import unicode_literals import os import re import subprocess from collections import defaultdict from mach.mixin.process import ProcessExecutionMixin MOZ_MYCONFIG_ERROR = ''' The MOZ_MYCONFIG environment variable to define the location of mozconfigs is deprecated. If you wish to define the mozconfi...
""" VisualP300 provides a framework for running P300 experiments within pyff. """ import sys,os,random import pygame from MainloopFeedback import MainloopFeedback from lib.P300VisualElement.Textbox import Textbox from lib.P300Aux.P300Functions import wait_for_key,show_message class VisualP300(MainloopFeedback): ...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: flatpak_remote version_added: '2.6' short_description: Man...
from pymongo.errors import AutoReconnect try: from bson.son import SON except ImportError: # fall back to old location from pymongo.son import SON class MongoOps(object): """ Helper class for mongo commands we use. Wraps calls in try/except so that resizing does not break them. """ d...
import unittest class BitField(object): '''Base class for managing bitfields.''' _fields = [] def __init__(self, value=0): self._value = value def __getattr__(self, name): try: if name.isupper(): return 1 << self._fields.index(name) elif name.islower(): return self._value...
import re from rope.base import (exceptions, pynames, resourceobserver, taskhandle, pyobjects, builtins, resources) from rope.refactor import importutils class AutoImport(object): """A class for finding the module that provides a name This class maintains a cache of global names in py...
from openerp import tools from openerp.osv import fields,osv class report_lunch_order(osv.osv): _name = "report.lunch.order.line" _description = "Lunch Orders Statistics" _auto = False _rec_name = 'date' _columns = { 'date': fields.date('Date Order', readonly=True, select=True), 'ye...
""" Unit test for Linear Programming via Simplex Algorithm. """ from __future__ import division, print_function, absolute_import import numpy as np from numpy.testing import (assert_, assert_array_almost_equal, assert_allclose, assert_almost_equal, assert_raises, assert_equal, run_module_suite) from scipy.opt...
#!/usr/bin/env python """ This script is for running the Android tests on android devices from the build server. It may take as a parameter the build number (e.g. the build number from Jenkins). The build number may also be a string. The script removes all the apps whose ids contain "mapswithme", and cleans up the...
""" This module implements multioutput regression and classification. The estimators provided in this module are meta-estimators: they require a base estimator to be provided in their constructor. The meta-estimator extends single output estimators to multioutput estimators. """ # # License: BSD 3 clause import nump...
from machine import Pin from machine import RTC import time import os """ Execute it like this: python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py """ pin_map = [23, 24, 11, 12, 13, 14, 15, 16, 17, 22, 28, 10, 9, 8, 7, 6, 30, 31, 3, 0, 4, 5] test_bytes = os.urandom(1024) def test_pin_...
from openerp import tools from openerp.osv import fields,osv from .. import hr_recruitment from openerp.addons.decimal_precision import decimal_precision as dp AVAILABLE_STATES = [ ('draft','New'), ('open','Open'), ('cancel', 'Refused'), ('done', 'Hired'), ('pending','Pending') ] class hr_recruit...
from cltree import basic,symbol,constant,variable b = basic() c = constant() s = symbol() v = variable() assert isinstance(b,basic) assert not isinstance(b,symbol) assert not isinstance(b,constant) assert not isinstance(b,variable) assert isinstance(c,basic) assert isinstance(c,constant) assert not isi...
"""OAuth integration. """ from rauth import OAuth2Service import web import logging import json logger = logging.getLogger(__name__) def oauth_service(service, redirect_uri): if service == 'github': return GitHub(redirect_uri) elif service == 'google': return Google(redirect_uri) elif ser...
""" urllib3 - Thread-safe connection pooling and re-using. """ from __future__ import absolute_import import warnings from .connectionpool import ( HTTPConnectionPool, HTTPSConnectionPool, connection_from_url ) from . import exceptions from .filepost import encode_multipart_formdata from .poolmanager imp...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import shlex import os import sys URPMI_PATH = '/usr/sbin/urpmi' URPME_PATH = '/usr/sbin/urpme' def query_package(module, name): # rpm -q returns 0 if the package is install...
import tarfile import shutil import time import os.path import string import sys import traceback def retry( f, args, max_attempts=5, sleep_secs=10 ): for attempts in range( max_attempts, -1, -1 ): try: return f( *args ) except Exception, msg: utils.log( '%s failed with mes...
__all__ = ['BaseLoader', 'SafeLoader', 'Loader'] from reader import * from scanner import * from parser import * from composer import * from constructor import * from resolver import * class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): def __init__(self, stream): Reader._...
from gnuradio.filter import filter_design import sys try: from PyQt4 import Qt, QtCore, QtGui except ImportError: print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)" raise SystemExit, 1 ''' Callback example Function called when "design" button is pre...
from __future__ import unicode_literals, division, absolute_import import re from datetime import datetime, timedelta import mock import pytest from flexget.manager import Session from flexget.plugins.api_tvdb import persist, TVDBSearchResult, lookup_series, mark_expired, TVDBRequest, TVDBEpisode from flexget.plugins.i...
import os import sys import unittest import warnings from types import ModuleType from django.conf import ENVIRONMENT_VARIABLE, LazySettings, Settings, settings from django.core.exceptions import ImproperlyConfigured from django.http import HttpRequest from django.test import ( SimpleTestCase, TestCase, Transactio...
from relevance import Relevance class Processor(object): """ Base class to compute a relevance """ def compute(self, amount, compared_to, *args, **kwargs): """ Should be implemented and return a Relevance instance """ return self.__nice_equivalence(amount, compared_to) def __nice_equivale...
from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import messages from horizon import tables from horizon import workflows from openstack_dashboard import api from openstack_dashboard import policy from openstack_dashboard...
# -*- 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 'Article.translation_of' db.add_column('pressroom_article', 'translation_of', ...
default_win_size = 1000 from gnuradio import gr from gnuradio import blocks import gnuradio.gr.gr_threading as _threading import numpy #generate 1s counts array _1s_counts = [sum([1&(i>>j) for j in range(8)]) for i in range(2**8)] class input_watcher(_threading.Thread): """ Read samples from the message queu...
#-*- coding: utf-8 -*- import random import numpy as np from sklearn.model_selection import train_test_split from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Convolution2D, MaxPooling2D fro...
# coding: utf-8 from __future__ import absolute_import from google.appengine.ext import ndb from flask.ext import restful import flask from api import helpers import auth import model import util from main import api @api.resource('/api/v1/users/', endpoint='api.users') class UsersAPI(restful.Resource): @auth.a...
from __future__ import print_function from builtins import input import os import shutil from pimlico.cli.subcommands import PimlicoCLISubcommand class CleanCmd(PimlicoCLISubcommand): """ Cleans up module output directories that have got left behind. Often, when developing a pipeline incrementally, yo...
from .base import BaseTestCase from sudo.signals import grant, revoke from sudo.utils import has_sudo_privileges, grant_sudo_privileges from django.contrib.auth.models import User from django.contrib.auth.signals import user_logged_in, user_logged_out class SignalsTestCase(BaseTestCase): def test_grant(self): ...
''' This module supports commandline functionality ''' import argparse import sys import os from psiturk.version import version_number from psiturk.psiturk_org_services import ExperimentExchangeServices def process(): ''' Figure out how we were invoked ''' invoked_as = os.path.basename(sys.argv[0]) if i...
# Standard imports import unittest import datetime as pydt import logging import uuid import json # Our imports import emission.storage.decorations.place_queries as esdp import emission.core.get_database as edb class TestTripQueries(unittest.TestCase): def setUp(self): self.testUserId = uuid.uuid4() ...
import vim from ycm.client.base_request import BaseRequest, BuildRequestData, ServerError from ycm import vimsupport from ycmd.utils import ToUtf8IfNeeded def _EnsureBackwardsCompatibility( arguments ): if arguments and arguments[ 0 ] == 'GoToDefinitionElseDeclaration': arguments[ 0 ] = 'GoTo' return arguments...
"""BigMLer analyze main processing Functions to process the analyze options """ import sys import os import bigmler.processing.args as a import bigmler.utils as u from bigmler.analyze.k_fold_cv import (create_kfold_cv, create_features_analysis, ...
import glob import optparse import os import random import re import shutil import sys import pip try: from pip.exceptions import InstallationError except ImportError: print ("You are using an older version of pip. Please upgrade pip to " "0.7+ (which ships with virtualenv 1.4.7+)") sys.exit(1)...
import time import json import re def main(request, response): op = request.GET.first("op"); key = request.GET.first("reportID") if op == "take": timeout = float(request.GET.first("timeout")) t0 = time.time() while time.time() - t0 < timeout: time.sleep(0.5) ...
import functools from django.http import HttpRequest def sensitive_variables(*variables): """ Indicates which variables used in the decorated function are sensitive, so that those variables can later be treated in a special way, for example by hiding them when logging unhandled exceptions. ...
from __future__ import division, print_function, absolute_import import threading import numpy as np from ._ufuncs import _ellip_harm from ._ellip_harm_2 import _ellipsoid, _ellipsoid_norm # the functions _ellipsoid, _ellipsoid_norm use global variables, the lock # protects them if the function is called from multi...
from a10sdk.common.A10BaseClass import A10BaseClass class FileList(A10BaseClass): """This class does not support CRUD Operations please use parent. :param url: {"type": "string", "format": "string"} :param file: {"type": "string", "format": "string"} :param DeviceProxy: The device proxy for REST...
from django.utils.safestring import mark_safe from django.conf import settings def cloudbar(request): """ Django context processor that applies all cloudbar settings in response context plus a ready to use pre rendered script html tag containing valid javascript code for cloudbar to display. To u...
"""Support for the Asterisk CDR interface.""" import logging import hashlib import datetime from homeassistant.core import callback from homeassistant.components.asterisk_mbox import SIGNAL_CDR_UPDATE from homeassistant.components.asterisk_mbox import DOMAIN as ASTERISK_DOMAIN from homeassistant.components.mailbox imp...
import arnold import imath import IECore import IECoreScene import IECoreArnold import GafferSceneTest import GafferArnold class ArnoldLightTest( GafferSceneTest.SceneTestCase ) : def testUsesShaders( self ) : l = GafferArnold.ArnoldLight() l.loadShader( "point_light" ) n = l["out"].attributes( "/light" )[...
_version_ = '1.4.0' """\ Generic debug class Other modules can always define extra debug flags for local usage, as long as they make sure they append them to debug_flags Also its always a good thing to prefix local flags with something, to reduce risk of coliding flags. Nothing breaks if two flags would be identica...
"""Univention Corporate Server (UCS) access module. Provides the following functions for working with an UCS server. - ldap_search(filter, base=None, attr=None) Search the LDAP via Univention's LDAP wrapper (ULDAP) - config_registry() Return the UCR registry object - base_dn() Return the configure...
import unittest import unohelper import os from org.libreoffice.unotest import UnoInProcess import uno class CheckSidebarRegistry(unittest.TestCase): @classmethod def setUpClass(cls): cls._uno = UnoInProcess() cls._uno.setUp() cls._xDoc = cls._uno.openEmptyDoc( url = "private:factory/s...
from operator import * from Crypto.Cipher import DES3 from Crypto.Cipher import DES DES_IV = '\0\0\0\0\0\0\0\0' DES_PAD = [chr(0x80), chr(0), chr(0), chr(0), chr(0), chr(0), chr(0), chr(0)] DES_PAD_HEX = '8000000000000000' KENC = '\0\0\0\1' KMAC = '\0\0\0\2' DO87 = '870901' DO8E = '8E08' DO97 = '9701' DO99 = '990290...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'community'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.cloud...
from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from struct import * from io import BytesIO from codecs import encode import binascii try: import http.client as httplib except ImportError: import httplib try: import urllib.parse as urlparse except ImportErro...
''' Code Input ========== .. versionadded:: 1.5.0 .. image:: images/codeinput.jpg .. note:: This widget requires ``pygments`` package to run. Install it with ``pip``. The :class:`CodeInput` provides a box of editable highlighted text like the one shown in the image. It supports all the features provided by th...
import random #set up reusable variables. #value table VT = [[True,0], [True,1], [False,1], [True,0], [True,1], [True,1], [False,1], [True,0], [True,0], [False,1]] #set up starting mood. L = [[]] L[0] = [0,0,0,0,0,0,0,0,0,0,3] m = 3 e = False #start of data generation for j...
""" .. moduleauthor:: Gabriel Martin Becedillas Ruiz <<EMAIL>> """ import os from testcases import common class DocCodeTest(common.TestCase): def testTutorial1(self): with common.CopyFiles([os.path.join("testcases", "data", "orcl-2000.csv")], "."): res = common.run_sample_script("tutorial-1....
#!/usr/bin/python from bottle import run,route,app,request,response,template,default_app,Bottle,debug,abort import sys import os import subprocess import re #from flup.server.fcgi import WSGIServer #from cStringIO import StringIO #import memcache VERSION = "2.2" app = Bottle() default_app.push(app) platform = os.una...
import numpy as np from ..evoked import Evoked from ..epochs import Epochs from ..io import Raw from ..event import find_events from ..io.pick import pick_channels def _get_window(start, end): """Return window which has length as much as parameter start - end""" from scipy.signal import hann window = 1 -...
""" monkeypatching and mocking functionality. """ import os, sys import re from py.builtin import _basestring RE_IMPORT_ERROR_NAME = re.compile("^No module named (.*)$") def pytest_funcarg__monkeypatch(request): """The returned ``monkeypatch`` funcarg provides these helper methods to modify objects, dicti...
# test interactions between int, float, Decimal and Fraction import unittest import random import math import sys import operator from test.support import run_unittest from decimal import Decimal as D from fractions import Fraction as F # Constants related to the hash implementation; hash(x) is based # on the reduc...
""" This module houses the Geometry Collection objects: GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon """ from ctypes import c_int, c_uint, byref from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.geometry import GEOSGeometry from django.contrib.gis.geos.libgeos i...
#!/usr/bin/env python import sys import os import re import urllib2 import time from xml.dom.minidom import Document try: import xml.etree.ElementTree as ElementTree except ImportError: try: import cElementTree as ElementTree except ImportError: try: import elementtree.Element...
"""SDR model training with TensorFlow eager execution.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from absl import app from absl import flags from absl import logging import tensorflow.compat.v2 as tf import numpy as np from valan.touch...
""" Test function :func:`iris.fileformats.grib._load_convert.grid_definition_template_0_and_1`. """ from __future__ import (absolute_import, division, print_function) from six.moves import (filter, input, map, range, zip) # noqa # Import iris tests first so that some things can be initialised # before importing any...
import asyncio import functools import re from typing import Union, Optional, Callable, TypeVar, List, Any, Sequence import discord from discord.ext import commands from utils.config import config from utils.database import get_server_property _mention = re.compile(r'<@!?([0-9]{1,19})>') T = TypeVar('T') class Na...
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String from sqlalchemy.schema import UniqueConstraint from neutron.db.models_v2 import model_base class VlanAllocation(model_base.BASEV2): """Represents allocation state of vlan_id on physical network.""" __tablename__ = 'ovs_vlan_allocations' ...
#! /usr/bin/env python from __future__ import print_function import os width = 40 # check that python can load OpenTURNS module print('1: Python module load'.ljust(width), end=' ') try: import openturns as ot print('OK') except: print('no') # check that python can find the Viewer module # If it fails, c...
"""REST API resources.""" from __future__ import absolute_import, print_function import pytz from flask import jsonify, url_for def record_self_link(pid_value, pid_type, record, **kwargs): """Create self link to a given record. :param pid_value: pid value. :type pid_value: str :param pid_type: type...