content
stringlengths
4
20k
#!/usr/bin/env python import webapp import unittest class WebappTestExtractingServiceDomainsFromLinks(unittest.TestCase): #def setUp(self): # self.app = webapp.app.test_client() def test_extract_service_domain_from_link(self): status, domain = webapp.extract_service_domain_from_link('https://f...
"""Tests for confusion_matrix_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.python.framework import dtypes class ConfusionMatrixTest(tf.test.TestCase): def _testConfMatrix(self, predi...
import struct import six from boofuzz.primitives.bit_field import BitField class DWord(BitField): """The 4 byte sized bit field primitive. :type name: str, optional :param name: Name, for referencing later. Names should always be provided, but if not, a default name will be given, defaults to ...
#date created: 28th March #description: shows 4 stages in the eye tracking #process, and includes the code from the original main #calls other mehtods from their seperate scripts #Import necessary modules import matplotlib matplotlib.use("TkAgg") from matplotlib import pyplot as plt from Tkinter import * from PIL impo...
""" Models for course action state If you make changes to this model, be sure to create an appropriate migration file and check it in at the same time as your model changes. To do that, 1. Go to the edx-platform dir 2. ./manage.py cms schemamigration course_action_state --auto description_of_your_change 3. It adds th...
"""Utilities for environment interface with agent / tensorflow.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np class spaces(object): discrete = 0 box = 1 def get_space(space): if hasattr(space, 'n'): return space.n, spac...
""" The ios lldp_global fact class It is in this file the configuration is collected from the device for a given resource, parsed, and the facts tree is populated based on the configuration. """ from __future__ import absolute_import, division, print_function __metaclass__ = type from copy import deepcopy from ansib...
from weboob.tools.test import BackendTest class VicSecTest(BackendTest): MODULE = 'vicsec' def test_history(self): """ Test that at least one item was ordered in the whole history. """ b = self.backend items = (i for o in b.iter_orders() for i in b.iter_items(o)) ...
kSmiTag = 0 kSmiTagSize = 1 kSmiTagMask = (1 << kSmiTagSize) - 1 kHeapObjectTag = 1 kHeapObjectTagSize = 2 kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1 kFailureTag = 3 kFailureTagSize = 2 kFailureTagMask = (1 << kFailureTagSize) - 1 kSmiShiftSize32 = 0 kSmiValueSize32 = 31 kSmiShiftBits32 = kSmiTagSize + kS...
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy from django.core import urlresolvers from django.db import transaction from gasistafelice.rest.views.blocks.base import BlockSSDataTables, ResourceBlockAction, CREATE_PDF from gasistafelice.lib.shortcuts import render_to_xml_response, render_t...
import xmldataset import pprint # Setup Pretty Printing ppsetup = pprint.PrettyPrinter(indent=4) pp = ppsetup.pprint xml = """<?xml version="1.0"?> <catalog> <shop number="1"> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <...
import numpy as np import numpy.linalg as la class GROUSE(object): def __init__(self, n, d, U = None, eta = None): self.n = n self.d = d if U is not None: self.U = U else: self.U = np.eye(N=self.n, M=self.d) if eta is not None: self.eta0...
from django.conf.urls import url from .views import ( LocationsListView, NewLocationView, EditLocationView, LocationImportView, LocationImportStatusView, LocationTypesView, LocationFieldsView, DowngradeLocationsView, default, child_locations_for_select2, location_importer_job_poll, ...
from django.shortcuts import get_object_or_404 from basic.groups.decorators import * from basic.groups.models import * from basic.groups.forms import * from basic.tools.shortcuts import render, redirect def page_list(request, slug, template_name='groups/pages/page_list.html'): """ Returns a list of pages for...
"""oVirt Hosted Engine configuration plugin.""" import gettext import os from otopi import constants as otopicons from otopi import filetransaction from otopi import plugin from otopi import util from ovirt_host_deploy import constants as odeploycons def _(m): return gettext.dgettext(message=m, domain='ovir...
#!/usr/bin/env trial import gflags import json import mock import sys import urlparse from ct.client import log_client from ct.client import log_client_test_util as test_util from ct.client.db import database from twisted.internet import defer from twisted.internet import task from twisted.internet import reactor from...
""" ====================================================================== Compressive sensing: tomography reconstruction with L1 prior (Lasso) ====================================================================== This example shows the reconstruction of an image from a set of parallel projections, acquired along dif...
""" EasyBuild support for building and installing foofoo, implemented as an easyblock @author: Kenneth Hoste (Ghent University) """ from easybuild.easyblocks.foo import EB_foo from easybuild.framework.easyconfig import CUSTOM, MANDATORY class EB_foofoo(EB_foo): """Support for building/installing foofoo.""" ...
from __future__ import unicode_literals from django.test import TestCase from .models import Flea, House, Person, Pet, Room class UUIDPrefetchRelated(TestCase): def test_prefetch_related_from_uuid_model(self): Pet.objects.create(name='Fifi').people.add( Person.objects.create(name='Ellen'), ...
# -*- coding: utf-8 -*- class TwitterSearchException(Exception): """ This class is all about exceptions (surprise, surprise!). All exception based directly on TwitterSearch will consist of a **code** and a **message** describing the reason of the exception shortly. """ # HTTP status codes...
from gnuradio import gr, gr_unittest, filter, blocks import math def sig_source_c(samp_rate, freq, amp, N): t = map(lambda x: float(x)/samp_rate, xrange(N)) y = map(lambda x: math.cos(2.*math.pi*freq*x) + \ 1j*math.sin(2.*math.pi*freq*x), t) return y def sig_source_f(samp_rate, freq, amp, ...
import datetime import os import random import shutil import socket from ansible import constants as C from ansible.errors import AnsibleError, AnsibleOptionsError from ansible.cli import CLI from ansible.utils.display import Display from ansible.utils.vault import read_vault_file ####################################...
from config.api2_0_config import config from config.auth import * from config.settings import * from logger import Log from json import loads, dumps import pexpect import pxssh import subprocess LOG = Log(__name__) class Auth(object): """ Class to abstract python authentication functionality """ @stat...
""" PyBOMBS command: config """ from __future__ import print_function from pybombs.commands import CommandBase class AutoConfigurator(object): " Generates suitable values automatically. " def __init__(self, log): self.log = log def get_auto_config_settings(self, cfg_keys): """ Go ...
# Data file for graph isomorphism problem. A and B are adjacency matrices # of two isomorphic graphs import numpy as np from cvxpy import * import time np.random.seed(0) ANSWERS = [] TIME = 0 A = np.array(np.mat( '0 1 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1;\ 1 0 0 0 ...
import adodb,adodb_odbc,datetime try: True, False except NameError: # Maintain compatibility with Python 2.2 True, False = 1, 0 class adodb_odbc_mssql(adodb_odbc.adodb_odbc): databaseType = 'odbc_mssql' dataProvider = 'odbc' sysDate = 'convert(datetime,convert(char,GetDate(),102),102)'...
import rospy from sub8_ros_tools import wait_for_param from sub8_msgs.srv import UpdateThrusterLayout class ThrusterOut(object): alarm_name = 'thruster_out' def __init__(self): # Keep some knowledge of which thrusters we have working self.thruster_layout = wait_for_param('busses') self...
from oslo_config import cfg from jacket.tests.compute.functional.api_sample_tests import test_servers CONF = cfg.CONF CONF.import_opt('osapi_compute_extension', 'compute.api.openstack.compute.legacy_v2.extensions') class VirtualInterfacesJsonTest(test_servers.ServersSampleBase): extension_name =...
import json import cloudstorage import mc_unittest from rogerthat.bizz.friend_helper import FriendHelper from rogerthat.bizz.friends import makeFriends, ORIGIN_USER_INVITE from rogerthat.bizz.i18n import DummyTranslator from rogerthat.bizz.job.update_friends import convert_friend from rogerthat.bizz.profile import cr...
"""Decorators for Django OAuth2 Flow. Contains two decorators, ``oauth_required`` and ``oauth_enabled``. ``oauth_required`` will ensure that a user has an oauth object containing credentials associated with the request, and if not, redirect to the authorization flow. ``oauth_enabled`` will attach the oauth2 object c...
from . import six from . import Font, Fill, Format from .Utility import Utility class Style(object): _DEFAULT_FORMAT = Format.Format() _DEFAULT_FILL = Fill.Fill() _DEFAULT_FONT = Font.Font() def __init__(self, font=None, fill=None, format=None): self._font = font self._fill = fill self._format = format @pr...
import os import os.path import socket import stat from xen.util import mkdir import connection def bind(path, type = socket.SOCK_STREAM): """Create a Unix socket, and bind it to the given path. The socket is created such that only the current user may access it.""" if path[0] == '\0': # Abstract names...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} import re from ansible.module_utils.network.nxos.nxos import load_config, run_commands from ansible.module_utils.network.nxos.nxos import nxos_argument_spec, check_args from ansibl...
from vec import Vec from mat import Mat class DummyItem(object): def __init__(self): self.multiplications = [] def __getattr__(self, _): return self def __getitem__(self, _): return self def __mul__(self, v): self.multiplications.append(v) return v def __rmul__(self, v): ...
try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle from django.conf import settings from django.core import signing from django.contrib.sessions.backends.base import SessionBase class PickleSerializer(object): """ Simple wrapper around pickle to be used in si...
from spack import * class Texinfo(AutotoolsPackage): """Texinfo is the official documentation format of the GNU project. It was invented by Richard Stallman and Bob Chassell many years ago, loosely based on Brian Reid's Scribe and other formatting languages of the time. It is used by many non-GNU pro...
# This module contains abstractions for the input stream. You don't have to # looks further, there are no pretty code. # # We define two classes here. # # Mark(source, line, column) # It's just a record and its only use is producing nice error messages. # Parser does not use it for any other purposes. # # Reader(so...
import pytest import numpy as np from astropy import units as u from astropy.coordinates.distances import Distance from astropy.coordinates.builtin_frames import ICRS, FK5, Galactic, AltAz, SkyOffsetFrame from astropy.coordinates import SkyCoord, EarthLocation from astropy.time import Time from astropy.tests.helper im...
import cStringIO from yapsy.IPlugin import IPlugin from formatters import (write_in_csv_format, write_in_json_format, write_in_graphite_format, write_in_logstash_format) from utils.crawler_exceptions import (EmitterUnsupportedFormat) class IEmitt...
""" Create a user with GDPR P1 PII for manual testing. Enrolls the user in the DemoX course. Optionally takes in username, email, and course UUID arguments. """ from __future__ import unicode_literals from datetime import datetime from uuid import uuid4 from pytz import UTC from django.core.management.base import Ba...
# -*- encoding: utf-8 -*- # Yuuno - IPython + VapourSynth # Copyright (C) 2017 StuxCrystal (Roland Netzsch <<EMAIL>>) # # This program 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 3 ...
import logging import unittest import generate_builders_json class GenerateBuildersJsonTest(unittest.TestCase): def test_master_json_url(self): self.assertEqual(generate_builders_json.master_json_url('http://base'), 'http://base/json/builders') def test_builder_json_url(self): self.assertEq...
""" Visualize a data table with histograms. """ import logging import numbers import numpy as np from progressivis.table.nary import NAry from progressivis.core.slot import SlotDescriptor from progressivis.stats import Histogram1D from progressivis.table.table import BaseTable logger = logging.getLogger(__name__) ...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: from msrestazu...
#!/usr/bin/env python from arrow import Arrow from datetime import datetime import json from pkg_resources import resource_string import pytest from redicorpus import c, objects import time gram_length_list = [1, 2, 3] def test_string(): obj = objects.String('fried') assert str(obj) == 'fried' assert len...
import os import sys import glob from os.path import join, basename from numpy.distutils import log from numscons import get_scons_build_dir def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration,dot_join from numpy.distutils.command.scons import get_scons_pkg...
import unittest2 as unittest import urllib import parser import scraper known_good_indeces = [1, 2, 3, 11874, 1234] known_metadata_mappings = { 1234 : { 'url_to_lores_img': u'http://digitalmedia.fws.gov/cgi-bin/getimage.exe?CISOROOT=/natdiglib&CISOPTR=1234&DMSCALE=66.66667&DMWIDTH=700&DMHEIGHT=700&DMX=0&...
ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'version': '1.0'} from ansible.module_utils.basic import get_exception from ansible.module_utils.netcli import CommandRunner, FailedConditionsError from ansible.module_utils.network import NetworkModule, Net...
import os path = os.path.abspath(os.path.split(__file__)[0]) execfile(os.path.join(path, 'gyp_libyuv'))
import json import socket import logging from testfixtures import LogCapture from twisted.internet import defer from twisted.trial.unittest import TestCase from scrapy.utils.test import get_crawler from tests import mock from tests.spiders import FollowAllSpider, DelaySpider, SimpleSpider, \ BrokenStartRequestsSp...
import logging from django.http import HttpResponseNotFound, HttpResponseRedirect from django.views.decorators.cache import never_cache from fjord.redirector import get_redirectors logger = logging.getLogger('i.redirector') # Note: We never want to cache redirects. This allows redirectors to # capture correct met...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six import ite...
import datetime import random import sqlite3 import xmpp from archipelcore.archipelPlugin import TNArchipelPlugin from archipelcore.pubsub import TNPubSubNode from archipelcore.utils import build_error_iq # this pubsub is subscribed by all hypervisors and carries the keepalive messages # for the central agent ARCHIPE...
import json from datetime import datetime, timedelta from babel.dates import format_datetime, format_date from openerp import models, api, _, fields from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF from openerp.tools.misc import formatLang class account_journal(models.Model): _inherit = "account.journa...
{ 'name': 'Website Gengo Translator', 'category': 'Website', 'version': '1.0', 'description': """ Website Gengo Translator ======================== Translate you website in one click """, 'author': 'OpenERP SA', 'depends': [ 'website', 'base_gengo' ], 'data': [ '...
nzbget_options = ['ParRename=yes', 'RarRename=yes', 'UnpackIgnoreExt=.cbr', 'DirectRename=no'] def test_parrename(nserv, nzbget): hist = nzbget.download_nzb('parrename.nzb', unpack=True) assert hist['Status'] == 'SUCCESS/UNPACK' def test_parrename_backup(nserv, nzbget): nzb_content = nzbget.load_nzb('parrename.nzb...
from scipy import weave import numpy as np import cv2 import sys def _thinningIteration(im, iter): I, M = im, np.zeros(im.shape, np.uint8) expr = """ for (int i = 1; i < NI[0]-1; i++) { for (int j = 1; j < NI[1]-1; j++) { int p2 = I2(i-1, j); int p3 = I2(i-1, j+1); int p4 = I2(i, j+1); int p5 = I2(i+1...
"""Helper module to factorize the conditional multiprocessing import logic We use a distinct module to simplify import statements and avoid introducing circular dependencies (for instance for the assert_spawning name). """ import os import warnings # Obtain possible configuration from the environment, assuming 1 (on...
"""MNIST handwritten digits classification dataset. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.keras.python.keras.utils.data_utils import get_file def load_data(path='mnist.npz'): """Loads the MNIST da...
"This is the locale selecting middleware that will look at accept headers" from django.conf import settings from django.core.urlresolvers import (is_valid_path, get_resolver, LocaleRegexURLResolver) from django.http import HttpResponseRedirect from django.utils.cache import patch_...
"""Tests for distutils.command.config.""" import unittest import os import sys from test.test_support import run_unittest from distutils.command.config import dump_file, config from distutils.tests import support from distutils import log class ConfigTestCase(support.LoggingSilencer, support.Temp...
from flask import render_template, flash, redirect, url_for, jsonify, Response from app import app, db, models import json # District: @app.route("/district/", methods = ['GET']) def get_districts(): districts = models.district.query.all() district_dicts = [] for district in districts: di...
from openerp import api, fields, models class account_analytic_tag(models.Model): _name = 'account.analytic.tag' _description = 'Analytic Tags' name = fields.Char(string='Analytic Tag', index=True, required=True) color = fields.Integer('Color Index') class account_analytic_account(models.Model): ...
# -*- coding: utf-8 -*- from __future__ import absolute_import # vim: set ai et ts=4 sw=4: # This file is part of OpenHatch. # Copyright (C) 2014 Elana Hashman # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Fr...
from mantid.simpleapi import (CreateEmptyTableWorkspace, Fit) from mantid.api import (DataProcessorAlgorithm, AlgorithmFactory, WorkspaceProperty, ITableWorkspaceProperty) from mantid.kernel import (Direction, FloatBoundedValidator) import numpy as np import scipy.optimize class FitGaussianPeaks(DataProcessorAlgorit...
import datetime from sketchy import db def _get_date(): """Returns the current date when called""" return datetime.datetime.now() class Static(db.Model): """ Static Capture database model """ __tablename__ = 'Static' id = db.Column(db.Integer, primary_key=True) filename = db.Column(...
# Given an unsorted array of integers, find the length of the longest consecutive elements sequence. # # For example, # Given [100, 4, 200, 1, 3, 2], # The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4. # # Your algorithm should run in O(n) complexity. # A simple solution but with time co...
"""distutils.filelist Provides the FileList class, used for poking about the filesystem and building lists of files. """ import os, re import fnmatch from distutils.util import convert_path from distutils.errors import DistutilsTemplateError, DistutilsInternalError from distutils import log class FileList: """A ...
"""Tests that performance data is successfully logged.""" import datetime import dateutil import json import logging from StringIO import StringIO from django.test import TestCase from django.test.client import RequestFactory from performance.views import performance_log class PerformanceTrackingTest(TestCase): ...
#!/usr/bin/python import sys import json reload(sys) sys.setdefaultencoding("utf-8") sys.path.append('/') import cgi import cgitb cgitb.enable() from alkivi.common import logger # Define the global logger logger.Logger.instance( #min_log_level_to_mail = logger.WARNING, min_log_level_to_mail = None,...
import random import luigi import luigi.format import luigi.contrib.hdfs from luigi.contrib.spark import SparkSubmitTask class UserItemMatrix(luigi.Task): #: the size of the data being generated data_size = luigi.IntParameter() def run(self): """ Generates :py:attr:`~.UserItemMatrix.dat...
from django.contrib.admin.utils import lookup_field from django.contrib.admin.helpers import AdminForm as DjangoAdminForm from django.contrib.admin.helpers import Fieldset as DjangoFieldSet from django.contrib.admin.helpers import Fieldline as DjangoFieldLine from django.contrib.admin.helpers import AdminReadonlyField ...
import glob import os import sys import warnings import pkginfo class Installed(pkginfo.Installed): def read(self): opj = os.path.join if self.package is not None: package = self.package.__package__ if package is None: package = self.package.__name__ ...
""" Tests for the command-line scripts in the top-level I{bin/} directory. Tests for actual functionality belong elsewhere, written in a way that doesn't involve launching child processes. """ from os import devnull, getcwd, chdir from sys import executable from subprocess import PIPE, Popen from twisted.trial.unitt...
from ._astropy_init import __version__, test from pkg_resources import get_distribution, DistributionNotFound from .spectral_cube import (SpectralCube, VaryingResolutionSpectralCube) from .dask_spectral_cube import (DaskSpectralCube, DaskVaryingResolutionSpectralCube) from .stokes_spectral_cube import StokesSpectralC...
#!/usr/bin/python3 import argparse import os import sys import configuration import shouter from gitFunctions import Commiter from gitFunctions import Initializer, Differ from rtcFunctions import ImportHandler from rtcFunctions import RTCInitializer from rtcFunctions import RTCLogin from rtcFunctions import Workspace...
""" An epoll() based implementation of the twisted main loop. To install the event loop (and you should do this before any connections, listeners or connectors are added):: from twisted.internet import epollreactor epollreactor.install() """ import sys, errno from zope.interface import implements from twis...
import hashlib import math import optparse import os import re import subprocess import sys import time import urllib2 try: import json except ImportError: import simplejson as json __version__ = '1.0' EXPECTATIONS_DIR = os.path.dirname(os.path.abspath(__file__)) DEFAULT_CONFIG_FILE = os.path.join(EXPECTATIONS_...
""" per-test stdout/stderr capturing mechanism. """ from __future__ import with_statement import sys import os from tempfile import TemporaryFile import py import pytest from py.io import TextIO unicode = py.builtin.text patchsysdict = {0: 'stdin', 1: 'stdout', 2: 'stderr'} def pytest_addoption(parser): grou...
"""Performs requests to the Google Maps Elevation API.""" from googlemaps import convert def elevation(client, locations): """ Provides elevation data for locations provided on the surface of the earth, including depth locations on the ocean floor (which return negative values) :param locations:...
# It uses the following Table called Tabula Recta to find the # ciphertext. The simple intersection of the row and column # is the ciphertext. Let's say for eg. T is the Key and E is # the original Plaintext, then the intersection of T column # and E row is the ciphertext i.e. X. The plaintext and key- # length must be...
import json import os import pipes import shutil import subprocess import sys script_dir = os.path.dirname(os.path.realpath(__file__)) chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(1, os.path.join(chrome_src, 'to...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys if sys.version_info < (2, 7): pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7") from ansible.module_utils.basic import AnsibleModule try: from librar...
"""Unit tests for error_handlers.py.""" import unittest from checker import StyleProcessorConfiguration from error_handlers import DefaultStyleErrorHandler from filter import FilterConfiguration class DefaultStyleErrorHandlerTest(unittest.TestCase): """Tests the DefaultStyleErrorHandler class.""" def setU...
# coding: utf-8 from __future__ import unicode_literals, division, absolute_import, print_function import sys from .._ffi import FFIEngineError, register_ffi from .._types import str_cls from ..errors import LibraryNotFoundError try: import cffi except (ImportError): raise FFIEngineError('Error importing cf...
import datetime import logging import time from lizard_datasource import datasource from lizard_datasource import dates from lizard_datasource import models from lizard_datasource import properties logger = logging.getLogger(__name__) def _yield_drawable_datasources(ds): # This implements a breadth-first search...
from a10sdk.common.A10BaseClass import A10BaseClass class XmlSchema(A10BaseClass): """Class Description:: XML-Schema File. Class xml-schema supports CRUD Operations and inherits from `common/A10BaseClass`. This class is the `"PARENT"` class for this module.` :param uuid: {"description": "uu...
# -*- coding: utf-8 -*- from io import BytesIO from thriftpy._compat import u from thriftpy.thrift import TType, TPayload from thriftpy.utils import hexlify from thriftpy.protocol import binary as proto class TItem(TPayload): thrift_spec = { 1: (TType.I32, "id", False), 2: (TType.LIST, "phones",...
from msrest.service_client import ServiceClient from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION from .operations.features_operations import FeaturesOperations from . import models class FeatureClientConfiguration(AzureConfiguration): """Configura...
from . import Progress from .helpers import WritelnMixin class Bar(WritelnMixin, Progress): width = 32 message = '' suffix = '%(index)d/%(max)d' bar_prefix = ' |' bar_suffix = '| ' empty_fill = ' ' fill = '#' hide_cursor = True def update(self): filled_length = int(self.wi...
#!/usr/bin/env python # Cleans up SCOTS textgrids to be used with the MFA # [CENSORED: forename] # <vocallex desc=""eh"" /> # <gap reason=""inaudible"" /> # <unclear></unclear> # <falsestart>wor-</falsestart> # <trunc>wor-</trunc> # [non lexical items, non linguistic events] import os import sys import re import su...
#!/usr/bin/env python2.7 # It exports all transits colors to colors.txt file. import argparse import json import os.path if __name__ == '__main__': parser = argparse.ArgumentParser() default_colors_path = os.path.dirname(os.path.abspath(__file__)) + '/../../../data/colors.txt' parser.add_argument('in_out_f...
# coding: utf-8 import os import subprocess # ... def clean(filename): """ removes the generated files: .pyccel and .f90 filename: str name of the file to parse. """ name = filename.split('.py')[0] for ext in ["f90", "pyccel"]: f_name = name + "." + ext cmd = "rm -f " ...
import sys; from cjdnsadmin.cjdnsadmin import connectWithAdminInfo; cjdns = connectWithAdminInfo(); allRoutes = []; magicalLinkConstant = 5366870.0; def pingNode(addr, path, link): addrAtPath = addr + '@' + path; result = cjdns.RouterModule_pingNode(path, 2000); res = ''; if ('result' in result): res...
#!/usr/bin/python import numpy import ushuffle from string import maketrans from sequence.rna_tools import RNAFolder from FileFormats.FastaFile import iterFasta FOLDER = RNAFolder() def kshuffle(seq, k=2): return ushuffle.shuffle(seq, len(seq), k) def structuralFeatures(stc): hloops = [] mloops = []...
from __future__ import print_function, division from os.path import join import tempfile import shutil try: from subprocess import STDOUT, CalledProcessError from sympy.core.compatibility import check_output except ImportError: pass from sympy.core.compatibility import cStringIO as StringIO from sympy.ut...
from gnuradio import gr from gnuradio import blocks from gnuradio import filter import sys, time try: from gnuradio import analog except ImportError: sys.stderr.write("Error: Program requires gr-analog.\n") sys.exit(1) try: import scipy from scipy import fftpack except ImportError: sys.stderr....
from orphics.tools.io import Plotter import flipper.liteMap as lm from szlib.szcounts import ClusterCosmology from orphics.tools.io import dictFromSection,listFromConfig from configparser import SafeConfigParser from alhazen.halos import NFWMatchedFilterSN import numpy as np from orphics.tools.cmb import loadTheorySpe...
""" Parse arguments from command line and configuration files. """ import fnmatch import os import sys import re import logging from argparse import ArgumentParser from . import __version__ from .libs.inirama import Namespace from .lint.extensions import LINTERS #: A default checkers DEFAULT_LINTERS = 'pep8', 'pyfla...
"""The test for light device automation.""" from datetime import timedelta import pytest import homeassistant.components.automation as automation from homeassistant.components.light import DOMAIN from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON from homeassistant.helpers import device_registry from ...