content stringlengths 4 20k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os
import sys
py3 = sys.version_info.major == 3
def warn(msg):
print('[powerline-bash] ', msg)
if py3:
def unicode(x):
return x
class Powerline:
symbols = {
'compatible': {
... |
from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl
from openpyxl.compat import basestring, unicode
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Alias,
Typed,
Integer,
Set,
MinMax,
)
from openpyxl.descriptors.excel import Perce... |
# -*- coding: utf-8 -*-
import tictactoe_functions
import random
# skapar ett spelplan med storleken size
# och tecknet sign
def createGamePlan(size, sign):
gPlan = []
row = [sign]*size
for i in range(size):
#THIS! Här hade skapren glömt definerar att listan skulle kopieras inte reffirera!
gPlan.append(ro... |
import os
import re
import shutil
import sys
if sys.version_info[:2] < (2, 6):
sys.exit('virtualenv requires Python 2.6 or higher.')
try:
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Argu... |
#!/usr/bin/env python
"""
Script to generate test coverage reports.
Usage:
$ bin/coverage_report.py
This will create a directory covhtml with the coverage reports.To restrict the analysis
to a directory, you just need to pass its name as
argument. For example:
$ bin/coverage_report.py sympy/logic
runs only the te... |
import threading, tensorflow as tf, random, collections, math
from six.moves import xrange
class BaseFeeder(threading.Thread):
"""
Thread data feeder.
You should never use this class directly,
instead, write a child class that overwrites
read_by_key,
pre_process_batch,
split_str... |
from bottle import route, request, response, static_file
import logging
import sys
import os
import simplejson as json
import traceback
from ReadWriteLock import ReadWriteLock
from threading import Thread
from Queue import Queue
from time import time
import urllib
import urllib2
from instagramclient import clientI... |
arf_blend_in_0 = 0x00000001
arf_blend_in_1 = 0x00000002
arf_blend_in_2 = 0x00000003
arf_blend_in_3 = 0x00000004
arf_blend_in_4 = 0x00000005
arf_blend_in_5 = 0x00000006
arf_blend_in_6 = 0x00000007
arf_blend_in_7 ... |
"""Import metadata from various files into I2B2 DB"""
from datetime import datetime, timedelta, time
from textwrap import dedent
from airflow import DAG
from airflow_scan_folder.operators.scan_folder_operator import ScanFlatFolderOperator
from airflow_scan_folder.operators.common import default_extract_context
from ai... |
import urlparse, urllib
__all__ = ['Query', 'URL']
class Query(object):
""" Parses passed query string with urlparse.parse_qs and provides
mapping methods for updating query parameters.
Interpolates query with urllib.urlencode.
"""
def __init__(self, query=''):
self._params = urlparse.p... |
import networkx as nx
import sys
def retrieve_skeleton_graph():
""" This function reads a 2-lines file with the node names on line 1 and each 2-node tuple for and edge on line 2.
From this data, a NetworkX Graph object is created, and returned.
Input file format:
Nodes: node1,node2,node3
Edges: node1,no... |
import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random
import sim, main
from util import *
from dungeon import makeFloor, Room, TemplateRoom
import dungeon
template = \
"""
#############################
# #
# o . & o... |
import os
import shutil
import logging
import pytest
from thug.ThugAPI.ThugAPI import ThugAPI
from thug.ThugAPI.OpaqueFilter import OpaqueFilter
log = logging.getLogger("Thug")
class TestThugAPI:
thug_api = ThugAPI()
cwd_path = os.path.dirname(os.path.realpath(__file__))
samples_path = os.path.joi... |
from datetime import datetime, timedelta
from pytz import timezone
from osv import fields, osv
import logging
_logger = logging.getLogger(__name__)
class payroll_register_run(osv.osv_memory):
_name = 'hr.payroll.register.run'
_description = 'Pay Slip Creation'
_columns = {
'department_ids': fie... |
import sys
import logging
from colorama import Fore, init, Style
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import time
import nmap
from socket import AF_INET, AF_INET6, inet_ntop
from ctypes import *
import ctypes, ctypes.util
#c-lib load
libc = ctypes.cdll.LoadLibrary(ctypes.u... |
#import datetime
import json
from gevent import monkey
from pytest import yield_fixture
from inbox.models.message import Message
from inbox.models.thread import Thread
from inbox.search.adaptor import NamespaceSearchEngine
from inbox.search.util import index_namespaces, index_messages, index_threads
from inbox.search... |
import jsonref, argparse
from importlib import util
from logs import logDecorator as lD
from lib.testLib import simpleLib as sL
from lib.argParsers import addAllParsers as aP
config = jsonref.load(open('../config/config.json'))
logBase = config['logging']['logBase']
logLevel = config['loggin... |
#!/usr/bin/env python
import os
import sys
from setuptools import find_packages # @UnresolvedImport
from distutils.core import setup
# Generate the package data
package_name = 'pype9'
package_dir = os.path.join(os.path.dirname(__file__), package_name)
package_data = []
prefix_len = len(package_dir) + 1
for path, dir... |
"""
DMesgLineList - command ``dmesg``
=================================
DMesgLineList is a simple parser that is based on the ``LogFileOutput``
parser class.
It provides one additional helper method not included in ``LogFileOutput``:
* ``has_startswith`` - does the log contain any line that starts with the
given s... |
from __future__ import unicode_literals
import unittest
from mock import patch
from unotifier import UNotifier, notifiers
class UNotifierTests(unittest.TestCase):
def test_linux(self):
with patch('platform.system', return_value='Linux'):
notifier = UNotifier()
assert isinstanc... |
from datetime import timedelta
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.fields import BooleanField, StringField, TextAreaField
from wtforms.validators import DataRequired, ValidationError
from indico.core.db import db
from indico.modules.events.sessions.fields import SessionBlockPersonL... |
#-*- coding: utf-8 -*-
import os
import pandas as pd
import config
import pandas
import re
import math
from modules.valuations.valuation import Valuation
# 현금흐름할인법
# -FCF 증가율 : 과거 증가율을 토대로 하되 평균보다 조금 보수적으로 설정 (평균증가율에서 10% 할인)
# 1단계 예측에서 잉여현금흐름 성장율을 단계적으로 할인 적용
# -영구가치 증가율(g) 고려사항 - GDP성장율(美 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from io import open
import sys
import os
import collections
import fontforge
# ignore warning
# import warnings
# warnings.filterwarnings("ignore")
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QIntValidator
from PyQt5.QtWidgets import (QFileDialog, QDialog, QPushB... |
# NOTICE!!! This is copied from https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
def primesbelow(N):
# http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
#""" Input N>=6, Returns a list of primes, 2 <= p < N """
... |
from demos import *
import sys
sys.dont_write_bytecode = True
class Thing(object):
id = -1
def __init__(i, **fields):
i.override(fields)
i.newId()
def newId(i):
i._id = Thing.id = Thing.id + 1
def also(i, **d):
return i.override(d)
def override(i, d):
i.__dict__.update(d)
retur... |
"""API Tests for the errata management feature"""
# For ease of use hc refers to host-collection throughout this document
from robottelo.common.decorators import stubbed
from robottelo.test import APITestCase
class ErrataTestCase(APITestCase):
"""API Tests for the errata management feature"""
@stubbed()
... |
from scapy.all import *
from veripy import util
from veripy.assertions import *
from veripy.models import ComplianceTestCase
class NonZeroICMPv6CodeTestCase(ComplianceTestCase):
"""
Non-zero ICMPv6 Code
Verifies that a node properly process a Packet Too Big message with a
non-zero ICMPv6 Code fie... |
import unittest
import os
import commands
import urllib2
import json
import sys
sys.path.append("../")
import comm
class TestCrosswalkApptoolsFunctions(unittest.TestCase):
def test_build_debug(self):
comm.setUp()
comm.create(self)
os.chdir('org.xwalk.test')
buildcmd = comm.PackToo... |
from . import sale_shop |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mantis_actionables', '0021_auto_20150309_1037'),
]
operations = [
migrations.RemoveField(
model_name='importinfo... |
from django.conf.urls import patterns, url
from barista.restaurants.views import EligibleRestaurantsListView, ResultView
urlpatterns = patterns('',
url(r'^', EligibleRestaurantsListView.as_view(), name='daily_restaurants'),
url(r'^results/$', ResultView.as_view(), name="results"),
... |
import os
from hashlib import sha256
from sqlalchemy import Column, Integer, String
from inbox.config import config
from inbox.log import get_logger
log = get_logger()
STORE_MSG_ON_S3 = config.get('STORE_MESSAGES_ON_S3', None)
# Enable by defining these in your config
# "STORE_MESSAGES_ON_S3" : false,
# "AWS_ACCESS_... |
import nose.tools as ntools
import random
import unittest
from smqtk.representation import DataSet
__author__ = "<EMAIL>"
class DummyDataSet (DataSet):
@classmethod
def is_usable(cls):
return True
def __init__(self):
super(DummyDataSet, self).__init__()
self.stuff = [1, 2, 3, ... |
"""
Deployment for Bedrock in production.
Requires commander (https://github.com/oremj/commander) which is installed on
the systems that need it.
"""
import random
import re
import time
import urllib
import urllib2
from os.path import dirname
from commander.deploy import commands, task, hostgroups
import commander_s... |
#!/usr/local/sci/bin/python
# ipython
# %pdb (the debugger)
# %run Convert_cfnc_AUG2014.py
# this should leave everything interactive
#***************************************
# 22 August 2014 KMW - v1
# Converts a netCDF file to a cf (pp) compliant netCDF
#
#***********************************************************... |
import os
import traceback
import weka.core.jvm as jvm
import wekaexamples.helper as helper
from weka.core.capabilities import Capability
from weka.classifiers import Classifier
from weka.core.converters import Loader
from weka.core.capabilities import Capabilities
def main():
"""
Just runs some example code.... |
import os
import sys
from spec import eq_, skip, Spec, ok_, trap, raises
from mock import patch, Mock
from invoke.cli import parse
from invoke.context import Context
from invoke.runner import run
from invoke.parser import Parser
from invoke.collection import Collection
from invoke.tasks import task
from invoke.except... |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from pants.engine.legacy.options_parsing import OptionsParseRequest, parse_options
from pants.init.options_initializer import BuildConfigInitializer
from pants.option.options_bootstrapper import OptionsBootstrapper
from... |
"""This example creates a creative field associated with a given advertiser. To
get an advertiser ID, run get_advertisers.py.
Tags: creativefield.saveCreativeField
"""
__author__ = '<EMAIL> (Joseph DiLallo)'
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
# Import appropriate classes f... |
import bpy
from mathutils import Matrix, Vector
from bpy.props import IntProperty, FloatProperty, EnumProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, zip_long_repeat
from sverchok.utils.sv_bmesh_utils import pydata_from_bmesh, bmesh_from_pydata, truncate_ver... |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class StdVectorDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setU... |
#! /usr/bin/python
""" This file generates a c file from a list of cpp prototypes. """
import os, sys
skip_objects = ['fft', 'pvoc', 'filter', 'filterbank', 'resampler']
cpp_output = [l.strip() for l in os.popen('cpp -DAUBIO_UNSTABLE=1 -I../../build/src ../../src/aubio.h').readlines()]
cpp_output = filter(lambda y... |
"""
Dense Linear Algebra functions (solve, inverse, etc).
"""
from .library import *
from .array import *
def lu(A):
"""
LU decomposition.
Parameters
----------
A: af.Array
A 2 dimensional arrayfire array.
Returns
-------
(L,U,P): tuple of af.Arrays
- L - Lower tria... |
from __future__ import (absolute_import, division, print_function)
import numpy as np
import shapely.geometry as sgeom
import shapely.wkt
import cartopy.crs as ccrs
class TestBoundary(object):
def test_no_polygon_boundary_reversal(self):
# Check that polygons preserve their clockwise or counter-clockwi... |
from config import *
import sys, json
from dbmodels import Course, AltDesc, GenEd, Section
from coursedata import get_course_data, get_section_data
def main():
update = False
for arg in sys.argv:
if arg == '-u':
update = True
if not update:
try:
course_data_file = o... |
#!/usr/bin/env python
#
#This script tries to reconstruct the private keys using the moduli and factors in keys.out.
#
#Dependencies: python-dev libgmp3-dev libmpfr-dev libmpc-dev python-ldns python-gmpy2
#Usage: dnskey.py OUTDIR
#
#Input: OUTDIR is the folder that contains the keys.out file
#Output: DS-record, privat... |
from .. import utils
from .. import file
from .. import document
from itertools import izip_longest as zip_longest
class InvalidDocumentError(Exception):
"""Raised if attempting to write an invalid document."""
pass
def write_seperators(out):
for i in xrange(0, 4):
out.write(u'\n')
def format_v... |
#!/usr/bin/env python
# coding: utf-8
import scrypt
password = 'abc123uj'
from base64 import b64encode, b64decode
import sys, os
import marionette_tg.conf
password = marionette_tg.conf.get("crypt.scrypt")
home = marionette_tg.conf.get("crypt.clienthomedir")
clientkey = marionette_tg.conf.get("crypt.clientkey")
serverk... |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
class FlatpageViewTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
... |
{
"name" : "Romania - Accounting",
"author" : "Fekete Mihai (Forest and Biomass Services Romania)",
"website": "http://www.forbiom.eu",
'category': 'Localization',
"depends" : [
'account',
'base_vat',
],
"description": """
This is the module to manage the Accounting Chart, VA... |
import os, sys
import magic
import time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from env import *
from style4 import *
class cp_conf(QDialog):
def __init__(self):
super(cp_conf, self).__init__()
self.size = len(conf_res)
self.ind = 0
self.file_size = ["", ""]
... |
import argparse
from collections import defaultdict
import pandas as pd
from typing import List, Tuple
from datetime import timedelta
from data.constants import *
from data.utils import *
class HistoricalData:
"""Class that holds historical data of a file.
This class contains lists of historical file level d... |
""" An example simulation for a Hawk-Dove game using two-population discrete time replicator dynamics.
"""
## This is hackery to make this run from where it is. Do not do this.
import os
import sys
path = os.path.realpath(__file__)
sys.path.insert(0, os.path.abspath(os.sep.join([path, "..", "..", "src"])))
## End ha... |
#!/usr/bin/env python3
"""SSH into a running appliance and configure security.
Configures security on appliance(s) according to this document:
https://access.redhat.com/articles/1124753
Works for single appliance and distributed appliance configurations.
In distributed configurations, provide the hostname of the repl... |
from setup import *
from pyglet_gui.manager import Manager
from pyglet_gui.buttons import Button
from pyglet_gui.scrollable import Scrollable
from pyglet_gui.containers import VerticalContainer
from pyglet_gui.theme import Theme
theme = Theme({"font": "Lucida Grande",
"font_size": 12,
"t... |
import time
from portage import os
from portage.versions import catpkgsplit, catsplit, pkgcmp, best
from portage.dep import Atom
from portage.localization import _
from portage._sets.base import PackageSet
from portage._sets import SetConfigError, get_boolean
import portage
__all__ = ["CategorySet", "DowngradeSet",
... |
{
'name': 'Employee Directory',
'version': '1.1',
'author': 'OpenERP SA',
'category': 'Human Resources',
'sequence': 21,
'website': 'https://www.odoo.com',
'summary': 'Jobs, Departments, Employees Details',
'description': """
Human Resources Management
==========================
This ap... |
import os
import os.path
import re
import Image
import shutil
from image import PageImageRef
from util import *
class PDFToPPM(object):
def __init__(self, config):
object.__init__(self)
self.pdf_fn = config.input_fn
self.tmpd = '%s/pdftoppm' % (config.tmp_dir,)
makedirs(self.tmpd)
... |
import signal
#============================================================
# usage example
#
# sr_report -b broker
#============================================================
try :
from sr_consumer import *
from sr_instances import *
except :
from sarra.sr_consumer im... |
import unittest
from grid.mesh import Mesh
from transit.transit_matrix import TransitMatrix
from datetime import datetime
import os
import linecache
class TestData(unittest.TestCase):
#def test_buoy_lookup(self):
#from data.preprocess_data import build_buoy_lookup
#data_file = '/home/hans-werner/... |
#!/usr/bin/env python
"""Application controller for unafold 3.2, hybrid_ss_min application, package
Rest fo unafold package might be added at a later time
"""
from cogent.app.util import CommandLineApplication,\
CommandLineAppResult, ResultPath
from cogent.app.parameters import Parameter, FlagParameter, ValuedPa... |
"""Tests for additional symbolic Theano functions."""
import unittest
import numpy as np
import theano
import theano.tensor as T
import optimus.functions as F
class FunctionTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_max_not_index(self):
i... |
# -*-coding:Utf-8 -*
from time import localtime
def getTime():
return localtime()
def getDay(day):
return{
0:"Lundi",
1:"Mardi",
2:"Mercredi",
3:"Jeudi",
4:"Vendredi",
5:"Samedi",
6:"Dimanche"
}[day]
def getMonth(mois):
return{
1:"janvier",
2:"février",
3:"mars",
4:"avril",
5:"mai",
6:"juin",
7:'j... |
import sys
from sentiment_scorer import SentimentScorer
class VectorDataBuilder:
def __init__(self, sentiment_file):
self.__scores = SentimentScorer(sentiment_file).scores()
self.__writer = open("review_features.csv", "wb")
def get_vectors(self, sample_file):
sample_file = open(sampl... |
import os
import redis
import imgix
import json
import gzip
from bs4 import BeautifulSoup
from urllib.request import (
Request,
urlopen,
)
import re
import sentry_sdk
import logging
USER_AGENT = "Ada Preview Bot"
IMAGE_LINK_MAX_WIDTH = 768
redis_url = os.getenv("REDIS_URL", "redis://localhost:6379")
redis = r... |
"""Provide functionality to interact with the vlc telnet interface."""
import logging
import voluptuous as vol
from python_telnet_vlc import VLCTelnet, ConnectionError as ConnErr
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.cons... |
idle_pending=[]
def handler_idle(type, source, parameters):
idle_iq = xmpp.Iq('get')
id='idle'+str(random.randrange(1000, 9999))
globals()['idle_pending'].append(id)
idle_iq.setID(id)
idle_iq.addChild('query', {}, [], 'jabber:iq:last');
if parameters:
param = parameters.strip()
idle_iq.setTo(param)
else:
p... |
from unittest import TestCase
from tornado.httputil import HTTPServerRequest
import mock
from six import assertCountEqual
from thr.redis2http.limits import Limits, Limit
from thr.redis2http.limits import add_max_limit
from thr.redis2http.counter import set_counter, del_counter
from thr.redis2http.counter import condi... |
'''
setup config for Flask helloworld app
'''
import sys
import os
from setuptools import setup
from setuptools.command.test import test as TestCommand
install_requires = [
'flask==1.0.0'
]
test_requires = [
'pytest>=2.8.0',
'pytest-xdist',
'pytest-cov',
'pytest-mock',
'pytest-pylint',
... |
"""Schema migration helpers."""
import logging
from .util import session_scope
_LOGGER = logging.getLogger(__name__)
def migrate_schema(instance):
"""Check if the schema needs to be upgraded."""
from .models import SchemaChanges, SCHEMA_VERSION
with session_scope(session=instance.get_session()) as sess... |
#!/usr/bin/python
"""
Poker Server
============
This is a simple poker server written in Flask that will be used to
play simple poker games like Texas Hold'Em or Blackjack with easy
endpoints for bots to connect to. I hope to use it with ACM to allow
others to adapt it to create AI competition... |
"""Tests for util.config_util"""
import os
import tempfile
import unittest
from ample import constants
from ample.util import config_util, version
from ample.ensembler.constants import SPICKER_RMSD, SPICKER_TM
__author__ = "Adam Simpkin & Felix Simkovic"
class Test(unittest.TestCase):
MAX_DIFF = None
@cla... |
"""
A remote procedure call (rpc) abstraction.
For some wrappers that add message versioning to rpc, see:
rpc.dispatcher
rpc.proxy
"""
import inspect
from oslo.config import cfg
from openstack.common.gettextutils import _ # noqa
from openstack.common import importutils
from openstack.common import local
fr... |
#!/usr/bin/python
"""
@file route2poly.py
@author Jakob Erdmann
@date 2012-11-15
@version $Id: route2poly.py 13106 2012-12-02 13:44:57Z behrisch $
From a sumo network and a route file, this script generates a polygon (polyline) for every route
which can be loaded with sumo-gui for visualization
SUMO, Simulatio... |
from django.http import HttpResponse
import prometheus_client
from maasserver.prometheus.middleware import PrometheusRequestMetricsMiddleware
from maasserver.testing.factory import factory
from maastesting.testcase import MAASTestCase
from provisioningserver.prometheus.metrics import METRICS_DEFINITIONS
from provision... |
from random import randint, uniform
from mxcubeqt.utils.qt_import import Qt, QColor, QPalette
from mxcubecore.BaseHardwareObjects import HardwareObjectState
__credits__ = ["MXCuBE collaboration"]
__license__ = "LGPLv3+"
# Basic core colors
BLUE = QColor(Qt.blue)
WHITE = QColor(Qt.white)
BLACK = QColor(Qt.black)
GRAY... |
from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_test_case import NegativeAlertTestCase
from alert_test_suite import AlertTestSuite
class TestGuardDutyProbe(AlertTestSuite):
alert_filename = "guard_duty_probe"
alert_classname = "AlertGuardDutyProbe"
# This event is the defau... |
import json
import os
from functools import lru_cache
import requests
import requests.exceptions
from django.conf import settings
from django_jinja import library
@lru_cache()
def get_localization_data(locale):
"""
Read the frontend string catalog for the specified locale, parse
it as JSON, and return th... |
from optparse import OptionParser
import sys
import os
import codecs
from pyinstrument import Profiler
from pyinstrument.profiler import SignalUnavailableError
# Python 3 compatibility. Mostly borrowed from SymPy
PY3 = sys.version_info[0] > 2
if PY3:
import builtins
exec_ = getattr(builtins, "exec")
else:
... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import TestCase, run_module_suite, \
assert_array_almost_equal, assert_almost_equal, \
assert_allclose
from scipy.signal import cont2discrete as c2d
from scipy.sig... |
import os
class X64Arch(object):
name = 'x64'
eclipseArch = 'x86_64'
jreArch = 'x64'
def __eq__(self, other):
return self.name == other.name
def __repr__(self):
return self.name
class X86Arch(object):
name = 'x86'
eclipseArch = 'x86'
jreArch = 'i586'
def __eq__(self, other):
return ... |
"""
==============================================
Denoise images using Non-Local Means (NLMEANS)
==============================================
Using the non-local means filter [Coupe08]_ and [Coupe11]_ and you can denoise
3D or 4D images and boost the SNR of your datasets. You can also decide between
modeling the n... |
import os
from django.db import models
from django.db.models import Q
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import PermissionDenied
# from geoposition.fields import GeopositionField
from core.models import PlCoreBase,PlCoreBaseManager,PlCoreBaseDeletionManager,ModelL... |
"""
Deals with the context variables of a Pyro call.
Pyro - Python Remote Objects. Copyright by Irmen de Jong (<EMAIL>).
"""
import threading
from . import errors
class _CallContext(threading.local):
"""call context thread local"""
def __init__(self):
# per-thread initialization
self.client... |
import re
def getPyClass(name):
name = name[4:] # remove Wt::
return "Py%s" % name
def defineTemplateTypes(classlist):
# collect all overloads
ol = []
for c in classlist:
if c.constructor: ol += c.constructor.ol
for m in c.methods.values():
ol += m.ol
# collect all types
alltypes = []
for o in ol:
... |
"""
.. A feature structure class, to encapsulate the SemSpec.
.. moduleauthor:: Luca Gilardi <<EMAIL>>
"""
from nluas.utils import update, Struct
from json.encoder import JSONEncoder
from collections import namedtuple
# import pprint
FeatureDesc = namedtuple('FeatureDesc', ['parent', 'role', 'type', 'index', 'types... |
"""Script to test TF-TensorRT integration."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.tensorrt.test import tf_trt_integration_test_base as trt_test
from tensorflow.python.framework import constant_op
from ... |
import json
def rad2deg(theta):
if theta > 2 * 3.14159265358:
return rad2deg(theta - 2 * 3.14159265358)
if theta < 0.0:
return rad2deg(theta + 2 * 3.14159265358)
return theta * 180 / 3.14159265358
def deg2rad(theta):
if theta > 360.0:
return deg2rad(theta - 360)
if theta ... |
"""
Implementation of a standard financial plot visualization using Chaco
renderers and scales.
In the main price plot area, mouse wheel zooms and mouse drag pans (if
the plot is not at the edge of the time series data). In the bottom
overview plot area, right-click-drag selects a range of times to display
on the top... |
from jsonrpc import ServiceProxy
import sys
import string
import getpass
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
e... |
import logging
from copy import deepcopy
from pyramid.httpexceptions import HTTPOk
from pyramid.security import NO_PERMISSION_REQUIRED
from pyramid.view import view_config
from magpie import __meta__
from magpie.api import exception as ax
from magpie.api import schemas as s
from magpie.db import get_database_revision... |
"""
Basic configuration support shared in different development utility scripts.
"""
import os.path
import sys
# Must not use the six Python 2/3 compatibility package from here as this
# module gets used from the script for setting up basic development
# environments, and that script needs to be runnable even before... |
"""Helpers for lp.codehosting.codeimport tests."""
__metaclass__ = type
__all__ = [
'instrument_method', 'InstrumentedMethodObserver']
def instrument_method(observer, obj, name):
"""Wrap the named method of obj in an InstrumentedMethod object.
The InstrumentedMethod object will send events to the provi... |
from BaseField import *
from BooleanOption import *
class CommandBase:
CommandName = None
def __init__(self):
pass
def __options__(self):
pass
def execute(self, handler = None):
return True |
from django.apps import apps
from django.core.management.base import BaseCommand
from thumbnails import images
from thumbnails.backends import metadata, storage
class Command(BaseCommand):
"""
Delete all thumbnails from a field. For example:
python manage.py delete_thumbnails --model='accounts.Profile' -... |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... |
"""
Session service
===============
This service provides an API and a basic cookie based storage. The
storage is exchangable, though.
"""
__author__ = u"Andr\xe9 Malo"
__docformat__ = "restructuredtext en"
from wtf import services as _services
from wtf import util as _util
class StorageInterface(object):
"""
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Edgar Arturo Haas Pacheco
# @Date: 2015-10-05 4:08:24
from __future__ import absolute_import
from time import sleep
from datetime import datetime
from celery import task
# import RPi.GPIO as GPIO
# def setup():
# GPIO.setmode(GPIO.BOARD)
# GPIO.set... |
import logging
from pylons import tmpl_context
from sqlalchemy import orm
from mediadrop.lib.auth import has_permission
from mediadrop.lib.base import BaseController
from mediadrop.lib.decorators import autocommit, expose, observable, validate
from mediadrop.lib.helpers import redirect, url_for
from mediadrop.lib.sto... |
""" coupled_rainfire.py
This driver evaluates rainfall and fire time series looking for an overlap
which could signify the potential for a large erosion event.
This code runs the fire and rainfall generators for 100 years baed on
input values in the default input file 'fireraininput.txt'.
This simulation pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.