content
stringlengths
4
20k
import logging from logging.handlers import SysLogHandler, SYSLOG_UDP_PORT import os import signal import sys import types import warnings from flags import flags DEFAULT_TTY_LEVEL = logging.INFO ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s" TTY_FORMAT = "%(levelname)s %(name)s: %(messa...
from __future__ import print_function # System libraries import argparse import sys import os.path from smh import listdb_load, rng_init, SMHDiscoverer, rng_init import re import codecs import json from sklearn.metrics.pairwise import pairwise_distances from collections import Counter if __name__ == "__main__": ...
import re import datetime from django.db.models import Q from nav.models.manage import Netbox, Cam, Arp, GwPortPrefix from nav.models.manage import SwPortVlan, Interface, Prefix MacRE = re.compile(r'^([a-fA-F0-9]{2}[:|\-]?){6}$') def search(data): exact_results = data.get('exact_results', False) hide_po...
{ 'name': 'Initial Setup Tools', 'version': '1.0', 'category': 'Hidden', 'complexity': "easy", 'description': """ This module helps to configure the system at the installation of a new database. ================================================================================ Shows you a list of app...
""" Copyright (c) 2021 The Orbit Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. """ from absl import app from core.orbit_e2e import E2ETestSuite, E2ETestCase from test_cases.connection_window import FilterAndSelectFirstProcess, ConnectTo...
"""psycopg extensions to the DBAPI-2.0 This module holds all the extensions to the DBAPI-2.0 provided by psycopg. - `connection` -- the new-type inheritable connection class - `cursor` -- the new-type inheritable cursor class - `lobject` -- the new-type inheritable large object class - `adapt()` -- exposes the PEP-24...
""" MLlib utilities for linear algebra. For dense vectors, MLlib uses the NumPy C{array} type, so you can simply pass NumPy arrays around. For sparse vectors, users can construct a L{SparseVector} object from MLlib or pass SciPy C{scipy.sparse} column vectors if SciPy is available in their environment. """ from numpy ...
from __future__ import absolute_import import requests from sentry.utils import json from sentry.http import safe_urlopen from .utils import get_basic_auth, remove_trailing_slashes, add_query_params ACCESS_TOKEN_NAME = "Sentry" DEFAULT_SENTRY_SOURCE = "sentry" API_URL = "https://api.sessionstack.com" PLAYER_URL = ...
import os from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta import numpy as np import sys from gdalconst import * import gdal # ============= local library imports =========================== def write_raster(array, geotransform, output_path, output_filename, dimensions, projecti...
# TARGET LANGUAGE DEPENDENT CODE. # Binary plus follows a complete expression. Complete # expressions always end with one of the following # tokens. On the other hand, unary plus never follows # these tokens. Distinguishing unary plus from binary # plus disambiguates the grammar and allows us to use # implicit multipl...
#!/usr/bin/env python # for python 2 / 3 compatibility from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals try : range = xrange except NameError : pass try : import ConfigParser as configparser except Import...
"""engine.SCons.Variables.PackageVariable This file defines the option type for SCons implementing 'package activation'. To be used whenever a 'package' may be enabled/disabled and the package path may be specified. Usage example: Examples: x11=no (disables X11 support) x11=yes (will search for the...
from c7n_azure.actions.base import AzureBaseAction from c7n_azure.provider import resources from c7n_azure.resources.arm import ArmResourceManager from azure.mgmt.resource.resources.models import GenericResource from c7n.utils import type_schema @resources.register('api-management') class ApiManagement(ArmResourceMa...
""" openvpn integration script """ import unittest import os import sys import test.context # pylint: disable=unused-import import mock import duo_openvpn from duo_openvpn_mozilla import DuoOpenVPN # pylint: disable=unused-import if sys.version_info.major >= 3: from io import StringIO # pragma: no cover else: ...
import sys from tempfile import NamedTemporaryFile from testtools import TestCase from subunit.filters import find_stream class TestFindStream(TestCase): def test_no_argv(self): self.assertEqual('foo', find_stream('foo', [])) def test_opens_file(self): f = NamedTemporaryFile() f.wr...
from flask import Flask from flask import render_template import sys app = Flask(__name__) # definitions are from the NCRIS 2015-16 Annual Business Plan # https://web.archive.org/web/20160227234208/https://nectar.org.au/wp-content/uploads/2015/12/NeCTAR-NCRIS-2015-16-Annual-Business-Plan-v05.pdf wp_dic = { 1: '...
from django.core.exceptions import ValidationError from django.forms import ModelForm from elasticsearch.client import ClusterClient from elasticsearch.exceptions import ConnectionError from cabot.metricsapp.api import create_es_client from cabot.metricsapp.models import ElasticsearchSource, ElasticsearchStatusCheck fr...
#!/usr/bin/env python # -*- coding: utf-8 -*- import collections import fontforge from io import open import sys # ignore warning # import warnings # warnings.filterwarnings("ignore") from PyQt5.QtCore import Qt from PyQt5.QtGui import QIntValidator from PyQt5.QtWidgets import (QFileDialog, QDialog, QPushButton, ...
""" General plotting recipes. """ from __future__ import (absolute_import, division, print_function, unicode_literals) from astroML.density_estimation import knuth_bin_width, bayesian_blocks from mpl_toolkits.axes_grid1 import make_axes_locatable from PyQt4.QtGui import QApplication, QWidge...
#!/usr/bin/env python from runtest import TestBase class TestCase(TestBase): def __init__(self): TestBase.__init__(self, 'exp-mixed', result=""" # DURATION TID FUNCTION [18276] | main() { 0.371 ms [18276] | mixed_add(-1, 0.200000) = -0.800000; 0.118 ms [18276] | mixed_sub(0x40...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ gateway tests - Image Wrapper Copyright 2009-2013 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt pytest fixtures used as defined in conftest.py: - gatewaywrapper - author_testimg_bad - author_t...
""" Interfaces to card stores. """ from zope.interface import Interface class IChannel(Interface): pass class IInMemoryChannel(IChannel): pass class IRedisChannel(IChannel): pass class ICardStore(Interface): """ An interface for publishing and subscribing to channels of cards. """ ...
import unittest import weakref import capnp from tests.fixtures import Fixture class DynamicsTest(Fixture): def setUp(self): self.loader = capnp.SchemaLoader() self.loader.open() self.loader.load_bytes(self.compile('test-1.capnp')) self.struct_schema = \ self.loader...
from datadog import DogStatsd from zope.interface import implementer from warehouse.metrics.interfaces import IMetricsService class _NullTimingDecoratorContextManager: def __call__(self, fn): return fn def __enter__(self): return self def __exit__(self, *args): pass @implement...
from .base import * INSTALLED_APPS += ( 'debug_toolbar', 'cache_panel', 'template_timings_panel', ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': project_directory('dev.sqlite'), } } CACHES = { 'default': { 'BACKEND': 'django.core.cache.bac...
import logging import posixfile import random import sys import threading import unittest from nose.tools import assert_false, assert_true, assert_equals, assert_raises, assert_not_equals from hadoop import pseudo_hdfs4 from hadoop.fs.exceptions import WebHdfsException from hadoop.fs.hadoopfs import Hdfs LOG = loggi...
import operator from typing import Any, Dict, List from django.http import HttpRequest, HttpResponse from zerver.decorator import REQ, api_key_only_webhook_view, has_request_variables from zerver.lib.response import json_success from zerver.lib.webhooks.common import check_send_webhook_message from zerver.models impo...
#!/usr/bin/python2.4 import os import signal from eagle import * unit_map = {1: "B", 1024: "KB", 1024 ** 2: "MB", 1024 ** 3: "GB"} def units(number): base = 1024 multiplier = 1 n = number while n >= base: n /= base multiplier *= base unit = unit_map.get(multiplier) if unit: ...
#!/usr/bin/env python import sys,re, json, urllib, os from urlparse import urlparse, urljoin import mechanize import lxml.html from subprocess import Popen, PIPE, STDOUT import logging # # Mechanize (which uses BeautifulSoup, I think) doesn't like our HTML, so we # need the nuclear options of cleaning it up with "tid...
# Pinout pour le GPS / RPi: # 1 2 # 3 4 # 5 6 # 7 8 # 9 10 # # Vcc sur pin 1 (3.3V) # Gnd sur pin 9 (Gnd) # Rxd sur pin 8 (Txd) # Txd sur pin 10 (Rxd) import serial import sqlite3 as lite import sys import gammu import time import os import datetime def insereDB(test): con = lite.connect('sputnik.db') cur = con.cu...
#!/usr/bin/env nemesis """ This script generates a plot showing slip or fault tractions. """ # The code requires the numpy, h5py, and matplotlib packages. import numpy import h5py import matplotlib.pyplot as pyplot # ---------------------------------------------------------------------- import sys plot = sys.argv[1]...
"""Test class for Virtwho Configure API :Requirement: Virt-whoConfigurePlugin :CaseAutomation: Automated :CaseLevel: Acceptance :CaseComponent: Virt-whoConfigurePlugin :Assignee: kuhuang :TestType: Functional :CaseImportance: High :Upstream: No """ import pytest from fauxfactory import gen_string from nailgun i...
"""Tests for custom SQLAlchemy types via Ironic DB.""" from oslo.db import exception as db_exc from ironic.common import utils as ironic_utils import ironic.db.sqlalchemy.api as sa_api from ironic.db.sqlalchemy import models from ironic.tests.db import base class SqlAlchemyCustomTypesTestCase(base.DbTestCase): ...
import re from django import forms import jdatetime from django.core import validators, exceptions from django.utils.translation import ugettext as _ from .widgets import jDateInput, jDateTimeInput from django.forms.utils import from_current_timezone, to_current_timezone class jDateField(forms.Field): widget = j...
import operator as ops import numpy as np import pytest import taichi as ti from taichi import allclose binary_func_table = [ (ops.add, ) * 2, (ops.sub, ) * 2, (ops.mul, ) * 2, (ops.truediv, ) * 2, (ops.floordiv, ) * 2, (ops.mod, ) * 2, (ops.pow, ) * 2, (ops.and_, ) * 2, (ops.or_,...
import datetime from pebbles.tests.base import db, BaseTestCase from pebbles.models import User, Group, Blueprint, BlueprintTemplate, Plugin, Instance, NamespacedKeyValue class ModelsTestCase(BaseTestCase): def setUp(self): db.create_all() u = User("<EMAIL>", "user", is_admin=False, email_id="<EMA...
from tempest.lib.common.utils import data_utils from tempest.lib import decorators from tempest.lib import exceptions as lib_exc from ironic_tempest_plugin.tests.api.admin import base class TestPorts(base.BaseBaremetalTest): """Tests for ports.""" def setUp(self): super(TestPorts, self).setUp() ...
"""Supports checking WebKit style in png files.""" from blinkpy.common import read_checksum_from_png from blinkpy.common.system.system_host import SystemHost class PNGChecker(object): categories = set(['image/png']) def __init__(self, file_path, handle_style_error, host=None): self._file_path = fil...
""" Perform template migration operations. Migrate output formats and output templates found in ``CFG_BIBFORMAT_OUTPUTS_PATH`` and ``CFG_BIBFORMAT_TEMPLATES_PATH`` respectively. It creates backup of each output format with name ``<FORMAT>_legacy.bfo`` and generates new Jinja2 templates in ``CFG_BIBFORMAT_JINJA_TEMPLAT...
""" definition of the plugin API and implementations of some base classes that include common functions """ from abc import ABCMeta, abstractmethod, abstractproperty from supremm.statistics import calculate_stats from supremm.subsample import TimeseriesAccumulator from supremm.errors import ProcessingError import ...
# coding: utf-8 try: from hashlib import md5 except ImportError: from md5 import new as md5 import re from django.db.models.sql.datastructures import EmptyResultSet from django.core.paginator import EmptyPage from django.core.paginator import Paginator from django.contrib.auth.models import Group, User from dj...
from flask import session from indico.core.db import db from indico.modules.events.logs import EventLogKind, EventLogRealm from indico.modules.events.tracks import logger from indico.modules.events.tracks.models.groups import TrackGroup from indico.modules.events.tracks.models.tracks import Track from indico.modules.e...
import pytest import ibis from pandas.util import testing as tm pa = pytest.importorskip('pyarrow') import pyarrow.parquet as pq # noqa: E402 from ibis.file.parquet import ParquetClient, ParquetTable # noqa: E402 from ibis.file.client import ( FileDatabase, execute_and_reset as execute) # noqa: E402 @pytest....
# -*- coding: utf-8 -*- """ MVC Web Application Framework with Tornado, Python 2 and 3 To install the package run: pip install dp-tornado Run ----- $ pip install virtualenv $ virtualenv ./venv $ . ./venv/bin/activate $ pip install dp-tornado $ dp4p init --path app """ import sys import o...
import binascii from scapy.layers.inet import Raw from netfilterqueue import NetfilterQueue from winreg_constants import * # --------------------------------------------------------------------- # WINREG GENERIC PACKAGES CLASS # --------------------------------------------------------------------- class WinregPkt(obje...
#!/usr/bin/env python """ Python wrapper for kopano-stats --session """ import argparse, textwrap, fnmatch, datetime import xml.etree.cElementTree as ElementTree import subprocess # Import Brandt Common Utilities import sys, os sys.path.append( os.path.realpath( os.path.join( os.path.dirname(__file__), "/opt/brandt/co...
#!/usr/bin/env python3 import datetime import os import sys import time def get_globals(): globals1 = {} globals1["g_test_import"] = g_test_import return globals1 def do_init(): print("def do_init():") sys.stdout.flush() sys.stderr.write("stderr do_init\n") global aliases global confr...
# native import time import socket # external from pytribe import EyeTribe # # # # # # CONSTANTS DEBUG = False MLIP = 'localhost' MLPORT = 5666 # # # # # # INIT CONNECTION # start socket connection print("Starting new socket connection (ip=%s, port=%d)." % (MLIP, MLPORT)) sock = socket.soc...
import unittest from unittest import mock from mantidqt.utils.qt.testing import start_qapplication from mantidqt.utils.qt.testing.qt_widget_finder import QtWidgetFinder from mantidqt.widgets.codeeditor.multifileinterpreter import MultiPythonFileInterpreter MANTID_API_IMPORT = "from mantid.simpleapi import *\n" PERMIS...
""" ERP analysis EEG submodule. """ from .eeg_data import eeg_select_electrodes from .eeg_data import eeg_to_df from .eeg_data import eeg_to_all_evokeds import numpy as np import pandas as pd import mne # ============================================================================== # ============================...
""" Helper functions for providing integer seeds. """ import hashlib import operator import os # Python 2 compatibility: make int.from_bytes available. from builtins import int def seed_from_system_entropy(bits): """ Create a new integer seed from whatever entropy we can find. Parameters ----------...
import boto import boto.s3.connection access_key = 'put your access key here!' secret_key = 'put your secret key here!' def get_buckets(access_key, secret_key): conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key, host = 'objects.dreamhost.com', ...
""" This example shows how LSMGenGeo generates Cylinder with given parameters. Be sure LSMGenGeo library is installed. The result is: 2 files: "cyl.geo" is the geometry file which can be imported into YADE with ymport.gengeoFile() function "cyl.vtk" is the VTK-filed which can be opened by any VTK-based software...
'''OpenGL extension EXT.stencil_wrap This module customises the behaviour of the OpenGL.raw.GL.EXT.stencil_wrap to provide a more Python-friendly API Overview (from the spec) Various algorithms use the stencil buffer to "count" the number of surfaces that a ray passes through. As the ray passes into an object,...
"""Does general configuration parsing; used by other classes for their configuration.""" from __future__ import print_function import os #import sys import warnings try: from configparser import ConfigParser except ImportError: from ConfigParser import SafeConfigParser as ConfigParser from neat.six_util impo...
# -*- coding: utf-8 -*- """ Created on Mon Apr 29 15:05:42 2013 This handles the actual interactions with Open SSL. @author: Brian Visel <<EMAIL>> """ from datetime import datetime from tempfile import NamedTemporaryFile from subprocess import Popen, PIPE from exception import OpenSSLError, ConfigurationError clas...
#!/usr/bin/env python from __future__ import print_function from common import * import subprocess import string import glob from ctypes import windll # From stackoverflow def getAvailableDrives(): drives = [] bitmask = windll.kernel32.GetLogicalDrives() for letter in string.ascii_uppercase: ...
from . import AWSHelperFn, AWSObject, AWSProperty, Ref from .validators import boolean, integer from . import cloudformation EC2_INSTANCE_LAUNCH = "autoscaling:EC2_INSTANCE_LAUNCH" EC2_INSTANCE_LAUNCH_ERROR = "autoscaling:EC2_INSTANCE_LAUNCH_ERROR" EC2_INSTANCE_TERMINATE = "autoscaling:EC2_INSTANCE_TERMINATE" EC2_INS...
# -*- coding: utf-8 -*- """Blogger to puput command module""" import requests import lxml.html import lxml.etree as ET from optparse import make_option from django.contrib.auth import get_user_model from six.moves import input from django.utils.text import Truncator from django.core.files import File from django.util...
from business.army.roll import Roll from business.dice.face import Face class CounterManeuverRoll(Roll): @property def is_active_maneuver(self): return True @property def is_active_player(self): return False @property def is_counter(self): return True @pr...
import sys from setuptools import setup from setuptools import find_packages version = '0.2.0.dev0' install_requires = [ 'letsencrypt=={0}'.format(version), 'letsencrypt-apache=={0}'.format(version), 'docker-py', 'zope.interface', ] if sys.version_info < (2, 7): install_requires.append('mock<1....
#!/usr/bin/env python # Part of tikplay import os.path import tempfile from nose.tools import * from youtube_dl import DownloadError from tikplay.provider.retrievers.youtube import YouTubeRetriever class TestYouTubeRetriever(object): def __init__(self): self.tmpdir = tempfile.TemporaryDirectory() ...
from django.test import TestCase from django.conf import settings from utils import TestSettingsManager from models import * from django.contrib.auth.models import User, Permission, Group from guardian.shortcuts import assign_perm mgr = TestSettingsManager() INSTALLED_APPS = list(settings.INSTALLED_APPS) INSTALLED_AP...
import sys from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path import joiner install_requires = [ 'Pillow>=3.3.0' ] # Conditional dependencies: # sdist if 'bdist_wheel' not in sys.argv: try: # noinspection PyUnresolvedReferences ...
# -*- coding: utf-8 -*- import unittest from dijkstra import dijkstra from sqrt import sqrt from binary_search import binary_search from lcs import lcs from lis import lis from permutation import perm from well_formed_brackets import brackets from power_set import power_set from quicksort import quicksort from merges...
"""Miscellaneous network utility code.""" from __future__ import absolute_import, division, print_function, with_statement import errno import os import socket import ssl import stat from tornado.concurrent import dummy_executor, run_on_executor from tornado.ioloop import IOLoop from tornado.platform.auto import set...
#!/usr/bin/env python import logging import sqlite3 import time from datetime import datetime from scipy.constants import convert_temperature as ct import nest logging.basicConfig() logger = logging.getLogger("HomeLogger") logger.setLevel(logging.DEBUG) SBF_DB = "/home/rw247/smadata/SBFspot.db" CLIENT_ID = '1bd5b3d...
''' gpipe/patch_translations.py - ====================================================== :Author: Andreas Heger :Release: $Id$ :Date: |today| :Tags: Python Purpose ------- .. todo:: describe purpose of the script. Usage ----- Example:: python gpipe/patch_translations.py --help Type:: python gpipe/...
""" This module contains the class(es) which process user profile data and generates exercise routines 1) determine what exercises are available based on equipment 2) set user history 3) callers select generation routine and feed it that information 4) the routine generators generate lists of exercises meeting require...
import os import tempfile import zipfile import tarfile import shutil import unittest from azure.cli.core.extension import DevExtension try: from azure.cli.core.extension.tests.latest import ExtensionTypeTestMixin, get_test_data_file except ImportError: from . import ExtensionTypeTestMixin, get_test_data_file ...
import pmtc_tm import pmti_tm import copy # ---------------------------------------------------------------- s = pmtc_tm.from_cycles([[1,2,3],[4,5]], 6) print(s) s = pmtc_tm.from_cycle([1,2,3], 6) print(s) s = pmti_tm.from_cycles([[1,2,3],[4,5]], 6) print(s) s = pmti_tm.from_cycle([1,2,3], 6) print(s) # ------------...
# coding=utf-8 """InaSAFE Disaster risk tool by Australian Aid - Parameter definition for Ash Raster Impact on People Contact : <EMAIL> .. 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 Founda...
# Standard imports import logging import numpy as np # Our imports import emission.analysis.intake.segmentation.section_segmentation as eaiss import emission.core.wrapper.motionactivity as ecwm import emission.core.wrapper.location as ecwl class SmoothedHighConfidenceMotion(eaiss.SectionSegmentationMethod): """ ...
## Python packages from scipy.linalg import inv import numpy as np def function_optim(pi_0, alpha,mu, sigma, recovery_rate, vect, val, maturity_list,rating_list, spread_list, AAA_AA): """ Method : function_optim Function : compute the square of the difference between the market spread...
import re import logging from urlparse import urlparse from sqlalchemy import types, Column, Table, ForeignKey from sqlalchemy import orm from sqlalchemy.ext.declarative import declarative_base from rdflib.namespace import Namespace, RDF, XSD, SKOS, RDFS from rdflib import Graph from ckan.lib.base import config from...
import gui import wx from utility import OnEraseBackground import subprocess import qrcode from PIL import Image import os from config import identifier ## inherit panel_three from gui class Panel3(gui.panel_three): def __init__(self, parent): gui.panel_three.__init__(self, parent) sel...
from apidoc.object.source_raw import Type as ObjectType from apidoc.factory.source.element import Element as ElementFactory from apidoc.factory.source.object import Object as ObjectFactory from apidoc.lib.util.decorator import add_property @add_property("object_factory", ObjectFactory) class Type(ElementFactory): ...
import os import Sparse import numpy as np class Datasource(object): """ Loads images from files on the server """ @staticmethod def load_tile(t_query): """load a single tile (image) Arguments ----------- t_query: :class:`TileQuery` With file path and image ...
import os import re import shutil from fabric.api import settings, run, local def cleanup_local(path, count, prefix): """ Returns paths to be removed such that only the latest set of backups remain, limited by count. So if count is 5 any backup path older than the latest 5 will be included in the resulting...
import numpy as np from sklearn.datasets import load_boston from sklearn.utils import shuffle, resample class Node(object): """ Base class for nodes in the network. Arguments: `inbound_nodes`: A list of nodes with edges into this node. """ def __init__(self, inbound_nodes=[]): "...
"""The nut component.""" from homeassistant.components.sensor import ( DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_POWER, DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_VOLTAGE, ) from homeassistant.const import ( ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_VOLT_AMPERE, FREQUENCY_HERTZ, ...
from odoo import api, fields, models class PosConfig(models.Model): _inherit = 'pos.config' iface_discount = fields.Boolean(string='Order Discounts', help='Allow the cashier to give discounts on the whole order.') discount_pc = fields.Float(string='Discount Percentage', help='The default discount percent...
"""ResNet specific operations. Defines the default ResNet generator and discriminator blocks and some helper operations such as unpooling. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import math from compare_gan.architectures import abstract_arch ...
'implementation of the "statics" command' import andbug.command, andbug.options @andbug.command.action('<class-path>') def statics(ctxt, cpath): 'lists the methods of a class' cpath = andbug.options.parse_cpath(cpath) for c in ctxt.sess.classes(cpath): andbug.screed.section("Static Fields, %s" % c...
import os from conans import ConanFile, tools class C99ToC89(ConanFile): name = "c99-to-c89" version = "1.0.3" license = "Apache License 2.0, https://github.com/libav/c99-to-c89/blob/master/LICENSE" url = "https://github.com/libav/c99-to-c89" settings = {"os": ["Windows"]} def getIntoFolder(self, url, label...
from unittest import skipIf from django.contrib.gis.gdal import GDALRaster from django.test import TestCase from django.test.utils import override_settings from django.utils.encoding import iri_to_uri from raster.formulas import RasterAlgebraParser from .raster_testcase import RasterTestCase class RasterAlgebraPars...
""" myhdl package initialization. This module provides the following myhdl objects: Simulation -- simulation class StopStimulation -- exception that stops a simulation now -- function that returns the current time Signal -- factory function to model hardware signals SignalType -- Signal base class ConcatSignal -- fac...
"""Tests for normalization layers. ## References: [1] Hanie Sedghi, Vineet Gupta, Philip M. Long. The Singular Values of Convolutional Layers. In _International Conference on Learning Representations_, 2019. """ from absl.testing import parameterized import numpy as np import tensorflow as tf from official....
import requests import nltk from nltk.corpus import stopwords from nltk.collocations import * import urllib import urlparse from multiprocessing import Lock, Process, Queue, current_process def unicode_escape(unistr): """ Tidys up unicode entities into HTML friendly entities Takes a unicode string as an a...
""" Exception definitions for attila. """ __author__ = 'Aaron Hosford' __all__ = [ 'AttilaException', 'ConfigurationError', 'InvalidConfigurationError', 'ConfigSectionNotFoundError', 'ConfigParameterNotFoundError', 'ObjectNotConfiguredError', 'ObjectNotReconfigurableError', 'NoConfigur...
import biom import pandas as pd import collections def overlap_methods(): return ('error_on_overlapping_sample', 'error_on_overlapping_feature', 'sum') def _get_overlapping(tables, axis): ids = collections.Counter() for table in tables: ids.update(table.ids(axis=axis)) return {e ...
"""Class for running DCJ test executables.""" import os from os import path # First item in the array is default. _OUTPUT_MODES = ['tagged', 'all', 'files'] class Run(object): """A class for running DCJ test executables. """ def __init__(self, config): self._command_executor = lambda x: None self._co...
import hashlib import json import os import pwd import subprocess import sys def debug_message(debug_active, debug_message): if debug_active: print debug_message # check if user is root, exit if normal user def check_root(): usrinfo = pwd.getpwuid(os.getuid()) if not usrinfo.pw_name == "root": ...
from prometheus_client import Counter, Histogram from django_prometheus.utils import Time, TimeSince, PowersOf import django if django.VERSION >= (1, 10, 0): from django.utils.deprecation import MiddlewareMixin else: MiddlewareMixin = object requests_total = Counter( 'django_http_requests_before_middlewar...
import os from cStringIO import StringIO from traits.api import provides # ============= standard library imports ======================== import ctypes from numpy import zeros, uint8, uint32 import Image as pil # ============= local library imports ========================== from pychron.image.i_camera import ICamer...
from os.path import join from django.http import Http404, HttpResponse from django.shortcuts import redirect from django.template import RequestContext, TemplateDoesNotExist from django.template.loader import get_template from .forms import form_class_factory from .parser import parse from .util import render_node ...
#!/usr/bin/env python """ Imports a keyring into the database """ # Copyright (C) 2007 Anthony Towns <<EMAIL>> # Copyright (C) 2009 Mark Hymers <<EMAIL>> # 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 ...
"""@graph_util tests.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.framework.python.framework import graph_util from tensorflow.core.framework import graph_pb2 from tensorflow.core.framework import node_def_pb2 from tensorflow.c...
""" Mock Facebook for Python. Sufficient for the tests in this project. """ _ACCESS_TOKEN = '123456789abcdef' * 5 PROFILE = { 'email' : '<EMAIL>', 'first_name' : 'John', 'middle_name' : 'Middle', 'last_name' : 'Doe', 'name' : 'John Doe', 'gender' : 'male', ...
# GIF Video Recording on Face Detection Example # # Note: You will need an SD card to run this example. # # You can use your OpenMV Cam to record gif files. You can either feed the # recorder object RGB565 frames or Grayscale frames. Use photo editing software # like GIMP to compress and optimize the Gif before uploadi...