content string |
|---|
#!/usr/bin/env python
import vtk
def main():
colors = vtk.vtkNamedColors()
# Create a circle
polygonSource = vtk.vtkRegularPolygonSource()
# Comment this line to generate a disk instead of a circle.
polygonSource.GeneratePolygonOff()
polygonSource.SetNumberOfSides(50)
polygonSource.SetRad... |
#!/usr/bin/python
# Produces a contour plot for g^(2) (z0, z1, x1).
# Takes z0 and filling fraction as arguments.
from __future__ import division
import matplotlib, scipy.ndimage, os.path
#matplotlib.use('Agg')
from pylab import *
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.widgets import Sli... |
import time
class PID(object):
""" Simple PID control.
This class implements a simplistic PID control algorithm. When first
instantiated all the gain variables are set to zero, so calling
the method gen_out will just return zero.
"""
# pylint: disable=E0202
# (pylint 0.... |
"""
Django settings for oktan project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
imp... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The freesurfer module provides basic functions for interfacing with
freesurfer tools.
Currently these tools are supported:
* Dicom2Nifti: using mri_convert
* Resample: using mri_convert
Exam... |
"""
Test case module for zahlen.ds.tree.segment_tree
:copyright: (c) 2014 by Subhajit Ghosh.
:license: MIT, see LICENSE for more details.
"""
from zahlen.ds.tree.segment_tree import SegmentTree
import unittest
class TestCreateSegmentTree(unittest.TestCase):
"""Test cases to test the creation of a s... |
from invenio.legacy.dbquery import run_sql
depends_on = [u'base_2014_11_17_new_subtype_proposal']
def info():
"""Information about the upgrade."""
return "New subtypes addition: delivarable and milestone."
def do_upgrade():
"""Implement your upgrades here."""
# deliverable addition
run_sql(
... |
#!/usr/local/sci/bin/python
#*****************************
#
# All humidity variables
#
#
#************************************************************************
# SVN Info
#$Rev:: 107 $: Revision of last commit
#$Author:: rdunn ... |
from ac_qv_api import ACQVModel, plot_iv, predict_qs
import pinn.parser as parser
import pinn.preproc as preproc
import pinn.exporter as exporter
import pinn.deembed as deembed
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
data_arrays = deembed.dee... |
import os.path
import datetime
# Django
from django.conf import settings
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
from ... |
from anillo.utils.structures import CaseInsensitiveDict
from anillo.utils.common import merge_dicts
class Response(dict):
body = None
status = None
headers = {}
def __init__(self, body=None, status=None, headers=None, **kwargs):
super().__init__({
"body": body if body is not None ... |
"""This module defines a basic set of 3D cameras that can be controlled
by a GUI."""
from . import so3
from . import se3
from . import vectorops
basis_vectors = {'x':[1.0,0.0,0.0],
'-x':[-1.0,0.0,0.0],
'y':[0.0,1.0,0.0],
'-y':[0.0,-1.0,0.0],
'z':[0.0... |
import tkinter as tk
from typing import Union, Callable, List
import dndice as d
import lib.components as gui
import lib.hpLib as hp
import lib.resourceLib as res
import resourceModule as resMod
class HitPointDisplay(gui.Section):
def __init__(self, container, handler: hp.HP, **kwargs):
super().__init__... |
'''
Created on Jul 19, 2015
'''
'''IMPORTS'''
from constants import *
from goal_node_lib import *
from HTMLParser import HTMLParser
import os
import sys
import re
from visualizer_node_lib import *
from vis_graphs_lib import *
from operator import add
from matplotlib import pyplot
'''CONST'''
sys.... |
# -*- coding: utf-8 -*-
from flask import g, request
from datetime import datetime
import binascii
import sqlite3
import settings
import base64
import os
def _get_current_time():
''' A small helper function to get current time in Y-m-d H:M:S '''
return datetime.now().strftime('%Y-%m-%d %H:%M:%S')
def _get_db(... |
"""Handles configuration options for the tests.
The tests are capable of running in other contexts, such as in a VM or against
a real deployment. Using this configuration ensures we can run them in other
environments if we choose to.
"""
from collections import Mapping
from datetime import datetime
import json
impor... |
from socket import gaierror
from decimal import Decimal
from . import BaseDevice
from ..exc import SNMPTimeout
DOCS_DOWNSTR_TREE = (1, 3, 6, 1, 2, 1, 10, 127, 1, 1, 1, 1)
DOCS_UPSTR_TREE = (1, 3, 6, 1, 2, 1, 10, 127, 1, 1, 2, 1)
def t_startswith(tupa, tupb):
if tupa < tupb:
return False
if tupa[:l... |
import os
from azure_devtools.scenario_tests import GeneralNameReplacer, patch_time_sleep_api, RequestUrlNormalizer
from devtools_testutils.azure_testcase import AzureTestCase
import pytest
from recording_processors import RecordingRedactor
PLAYBACK_CLIENT_ID = "client-id"
class RecordedTestCase(AzureTestCase):
... |
{
'name': '台灣會計科目表 - Accounting',
'version': '1.0',
'category': 'Localization/Account Charts',
'author': '',
'maintainer':'',
'website':'',
'description': """
添加科目類型\會計科目表模板
============================================================
""",
'depends': ['base','account'],
'demo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, print_function
import pickle
import pytest
from poker.card import Card, Rank, Suit
def test_only_cards_with_same_rank_are_equal():
assert Card('Ah') == Card('Ah')
assert Card('K♠') == Card('K♠')
assert Card('Ah') ... |
from __future__ import unicode_literals
from __future__ import print_function
import os.path
import unittest
from fs.opener import open_fs
from moya.context import Context
from moya.archive import Archive
from moya.console import Console
from moya.tags import context, config
BF_HELLO = """
++++++++[>++++[>++>+++>+++... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.application.base_application import BaseApplication
from niftynet.engine.application_factory import \
ApplicationNetFactory, InitializerFactory, OptimiserFactory
from niftynet.io.image_reader impor... |
from openerp.osv import fields, osv
class ple_3_21 (osv.Model):
_name = "l10n_pe.ple_3_21"
_inherit = "l10n_pe.ple"
_columns= {
'lines_ids': fields.one2many ('l10n_pe.ple_line_3_21', 'ple_3_21_id', 'Lines', readonly=True, states={'draft':[('readonly',False)],}),
}
def action_reload (self,... |
def read_pcl_data(scan_files, min_max_depth=(0.1, 30), num_lines=-1):
pcl_data = {}
for scan_file in scan_files:
f = open(scan_file, "r")
# read all lines or only a certain number of lines
lines = []
if num_lines == -1:
lines = f.readlines()
else:
... |
#!/usr/bin/env python3
from sympy import *
from mpmath import *
from matplotlib.pyplot import *
#init_printing() # make things prettier when we print stuff for debugging.
# ************************************************************************** #
# Magnetic Flow, copper coil with hollow copper cylinder insert... |
# -*- coding: utf-8 -*-
#
from django.conf import settings
from rest_framework import serializers
from common.utils import get_request_ip
from users.serializers_v2 import ServiceAccountSerializer
from ..models import Terminal
__all__ = ['TerminalSerializer', 'TerminalRegistrationSerializer']
class TerminalSerializ... |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
contracts = Table('contracts', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('description', String(length=140)),
Column('start_date', Date),
Col... |
from __future__ import print_function
import logging
import os
import re
import sys
import time
from keystoneauth1.identity import v3
from keystoneauth1 import session
from keystoneclient.v3 import client
import requests
from six.moves.configparser import SafeConfigParser
logging.basicConfig(stream=sys.stdout, leve... |
import unittest
from brown.core import brown
from brown.core.bar_line import BarLine
from brown.core.flowable import Flowable
from brown.core.staff import Staff
from brown.utils.point import Point
from brown.utils.units import Mm
class TestBarLine(unittest.TestCase):
def setUp(self):
brown.setup()
... |
from datetime import timedelta
from odoo import fields
from odoo.tests import common, tagged
@tagged('post_install', '-at_install')
class TestSaleExpectedDate(common.TransactionCase):
def test_sale_order_expected_date(self):
""" Test expected date and effective date of Sales Orders """
Product = ... |
class Signal:
def __init__(self):
self.subscribers = []
def connect(self, callback, ignore_repeats=True):
if not ignore_repeats and callback in self.subscribers:
return
self.subscribers.append(callback)
def disconnect(self, callback):
self.subscribers.remove(cal... |
import pytest
import json
from inspect import signature
from unittest.mock import PropertyMock, Mock
import floto.api
@pytest.fixture
def activity_task():
return {'activityId': 'my_activity_id',
'activityType': {'name': 'my_activity_type', 'version': 'v1', 'domain': 'd'},
'startedEventId':... |
import logging
import pika
import sys
if sys.version[0] == '2':
import Queue as queue
else:
import queue as queue
from .. import rabbitutils
import esgfpid.defaults as defaults
from esgfpid.utils import loginfo, logdebug, logtrace, logerror, logwarn, log_every_x_times
LOGGER = logging.getLogger(__name__)
LOGGE... |
from data_analysis import ReadWrite, Stats, Analyze
import numpy as np
import os, csv, sys
import itertools
from debug_function import Logger
from sklearn.linear_model import LogisticRegression
import matplotlib.pyplot as plt
from __init__ import learnDir, figDir
class Learn:
def __init__(self, includefile='', direct... |
# -*- coding: utf-8 -*-
from unittest.mock import MagicMock, Mock
import pytest
from gridsync.gui.status import StatusPanel
@pytest.fixture()
def fake_tahoe():
t = Mock()
t.name = "TestGrid"
t.shares_happy = 3
return t
def test_status_panel_hide_tor_button(fake_tahoe):
# gateway = MagicMock()... |
__author__ = 'chris'
import json
import os
from txrestapi.resource import APIResource
from txrestapi.methods import GET, POST, DELETE
from twisted.web import server
from twisted.web.resource import NoResource
from twisted.web import http
from twisted.internet import defer, reactor
from binascii import unhexlify
from co... |
import logging
import time
import unittest2
import mitogen.core
import mitogen.parent
import mitogen.master
import testlib
import plain_old_module
class CrazyType(object):
pass
def function_that_adds_numbers(x, y):
return x + y
def function_that_fails(s=''):
raise plain_old_module.MyError('exceptio... |
"""Store global configuration information"""
import os
import socket
# The current version of duplicity
version = "$version"
# Prefix for all files (appended before type-specific prefixes)
file_prefix = ""
# Prefix for manifest files only
file_prefix_manifest = ""
# Prefix for archive files only
file_prefix_archi... |
# coding: utf-8
import sublime
import sublime_plugin
import os
import re
import functools
st_version = int(sublime.version())
if st_version > 3000:
from JoomlaPack.lib import *
from JoomlaPack.lib.extensions import Plugin, Package
else:
from lib import *
from lib.extensions import Plugin, Package
cl... |
from django.db import models
# Create your models here.
class ESAuth(models.Model):
# ACTION_CHOICES = (
# (0, 'all'),
# (1, '_mapping'),
# (2, '_alias'),
# (3, '_search'),
# (4, '_msearch'),
# (5, '_delete'),
# )
METHOD_CHOICES = (
(0, 'GET'),
... |
"""Browse and retrieve builds from a chrome build repository."""
# Standard imports
import cStringIO as StringIO
import datetime
import httplib
import optparse
import os
import posixpath
import re
import shutil
import socket
import sys
import urllib2
import urlparse
import zipfile
# Local imports
import log_helper
... |
import numpy as np
from src.rrt.rrt_star_bid import RRTStarBidirectional
from src.search_space.search_space import SearchSpace
from src.utilities.plotting import Plot
X_dimensions = np.array([(0, 100), (0, 100)]) # dimensions of Search Space
# obstacles
Obstacles = np.array([(20, 20, 40, 40), (20, 60, 40, 80), (60, ... |
import numpy as np
class DataSet(object):
def __init__(self, images, labels):
assert images.shape[0] == labels.shape[0], ('images.shape: %s labels.shape: %s' % (images.shape, labels.shape))
self._num_examples = images.shape[0]
self._images = images
self._labels = labels
sel... |
import re
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class RegistrationForm(forms.Form):
username = forms.RegexField(regex=r'^\w+$', widget=forms.TextInput(attrs=dict(required=True, max_length=30)), label=_("Username"), error_mess... |
import logging
import tempfile
from cloudify_rest_client.exceptions import CloudifyClientError
from manager_rest.test.security.security_test_base import SecurityTestBase
class TestSecurityAuditLog(SecurityTestBase):
def create_configuration(self):
test_config = super(TestSecurityAuditLog, self).create_... |
#!/usr/bin/env python2
"""
This file is part of xmpp-vala.
Foobar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
F... |
import re
class Compound:
""" Represents the sum formula of a compound without any structural
informations
Attributes:
name (str): Given name of the compound
formula (str): String repressentation of the sum formula
listofelements (dict): A dictionary containing the information ... |
import smtplib
import lnt.server.reporting.runs
def emailReport(result, session, run, baseurl, email_config, to,
was_added=True):
import email.mime.multipart
import email.mime.text
subject, report, html_report = _getReport(result, session, run, baseurl,
... |
import unittest
from napalm_nxos import nxos
from napalm_base.test.base import TestConfigNetworkDriver
class TestConfigNXOSDriver(unittest.TestCase, TestConfigNetworkDriver):
@classmethod
def setUpClass(cls):
hostname = '127.0.0.1'
username = 'vagrant'
password = 'vagrant'
cl... |
'''
A logistic regression learning algorithm example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
# Import MINST data
import input_data
mnist = inpu... |
"""myproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... |
import mock
import six
from heat.common import exception
from heat.common import template_format
from heat.engine.clients.os import neutron
from heat.engine.clients.os import nova
from heat.engine.clients.os import sahara
from heat.engine.resources.openstack.sahara import templates as st
from heat.engine import schedu... |
#@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... |
import collections
import numpy
from cupy import internal
def reshape(a, newshape):
"""Returns an array with new shape and same elements.
It tries to return a view if possible, otherwise returns a copy.
This function currently does not support ``order`` option.
Args:
a (cupy.ndarray): Arr... |
"""Helper functions for testing XML-RPC services."""
__metaclass__ = type
__all__ = [
'fault_catcher',
'get_alternative_email',
'mailman',
'new_list_for_team',
'new_team',
]
import xmlrpclib
from zope.component import getUtility
from lp.registry.enums import TeamMembershipPolicy
from lp.reg... |
from __future__ import (absolute_import, print_function, unicode_literals)
import conveyor.enum
JobType = conveyor.enum.enum(
'JobType', 'PRINT_JOB', 'PRINT_TO_FILE_JOB', 'SLICE_JOB')
class JobInfo(object):
'''This is the JSON-serializable portion of a `Job`.'''
def __init__(
self, type_, ... |
from Indenter import Indenter
from Stationery import Stationery
from pyre.parsing.locators.Traceable import Traceable
class Mill(Stationery, Indenter, Traceable):
def weave(self, document=None):
self.begin()
if document:
self._renderDocument(document)
self.end()
ret... |
import copy
import logging
import os
import socket
import requests
import six
from six.moves.urllib import parse
from heatclient import exc
from heatclient.openstack.common import jsonutils
from heatclient.openstack.common import strutils
LOG = logging.getLogger(__name__)
if not LOG.handlers:
LOG.addHandler(logg... |
import os
import numpy as np
import pytest
import torch
from spotlight.cross_validation import random_train_test_split
from spotlight.datasets import movielens
from spotlight.evaluation import mrr_score
from spotlight.factorization.implicit import ImplicitFactorizationModel
from spotlight.factorization.representation... |
from collections import defaultdict
from sqlalchemy.orm import joinedload
from sqlalchemy import and_, or_
from uber.config import c
from uber.decorators import all_renderable, log_pageview
from uber.models import ArbitraryCharge, Attendee, Group, MPointsForCash, ReceiptItem, Sale
from uber.server import redirect_sit... |
import pytest
from semantic_release import ci_checks
from semantic_release.errors import CiVerificationError
def test_circle_should_pass_if_branch_is_master_and_no_pr(monkeypatch):
monkeypatch.setenv("CIRCLE_BRANCH", "master")
monkeypatch.setenv("CI_PULL_REQUEST", "")
assert ci_checks.circle("master")
... |
"""
Script for plotting output from benchmarking script.
"""
from matplotlib import pyplot as plt
import matplotlib
import sys
import numpy as np
def str_to_microsec(str_1, str_2):
"""
Change the 2 provided numbers into a number of microseconds.
Examples inputs:
"100", "us"
"2.76", "ms"
... |
# Code based on LPTHW:
# http://learnpythonthehardway.org/book/ex46.html
from scripts.docs.script_list import scripts_to_hooks
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_console_scripts(script_to_hook_dict):
return [f"{script}={hook}" for script, hook ... |
#!/usr/bin/env python2.7
#import pylab
#from pylab import *
#import matplotlib
#matplotlib.use('Agg')
#import matplotlib.pyplot as plt
import numpy as np
import operator
def quartCircle(precision):
unit = float(1) / float(precision)
x = [unit * i for i in range(precision + 1)]
y = [np.sqrt(1 - (unit * i)... |
# -*- coding: utf-8 -*-
from google.appengine.ext import db
from ragendja.dbutils import KeyListProperty
from django import forms
from django.utils.safestring import mark_safe
from django.conf import settings
from TitledStringListProperty import TitledStringListProperty
from django.utils.translation import ugettext_laz... |
import logging
import os
import sqlite3
import asyncio
import dashi.config
import dashi.git
import dashi.jenkins
LOGGER = logging.getLogger(__name__)
def connection():
return sqlite3.connect('dashi.db')
@asyncio.coroutine
def load():
config = dashi.config.parse()
if os.path.exists('dashi.db'):
... |
import sys, os, re, optparse
#--- Main function ---#
if __name__ == '__main__':
p = optparse.OptionParser(usage="%prog [options] <map>", version="development")
p.add_option("--plugin-dir", dest="plugin_dir", default=None, \
help="specify additional plug-in directory")
(options, args) = p.parse_args... |
from datetime import datetime, timedelta
import decimal
import pytest
import uuid
from pyignite.api.key_value import cache_get, cache_put
from pyignite.datatypes import *
@pytest.mark.parametrize(
'value, value_hint',
[
# integers
(42, None),
(42, ByteObject),
(42, ShortObject... |
#!/usr/bin/env python3
from ..lazy import KroneckerProductLazyTensor, lazify
from .index_kernel import IndexKernel
from .kernel import Kernel
class MultitaskKernel(Kernel):
r"""
Kernel supporting Kronecker style multitask Gaussian processes (where every data point is evaluated at every
task) using :class... |
# -*- coding: utf-8 -*-
"""
Unit tests for the da.check.schema.bulk_data_catalog module.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2... |
'''
Python wrapper for HLSL compiler (fxc.exe)
NOTE: this module contains Windows specific code and should
only be imported when running on Windows.
'''
import subprocess, platform, os, sys
import genutil as util
if sys.version_info[0] < 3:
import _winreg as winreg
else:
import winreg
#-----------------------... |
import sys
from nose import with_setup
from nose.tools import assert_equals, raises
from wigiki.config import ConfigReader
from wigiki.exceptions import *
if sys.version_info >= (3,):
from io import StringIO
else:
from StringIO import StringIO
class TestReaderMinimal():
"""Test reader with a minimal c... |
import logging
from enum import Enum
logger = logging.getLogger(__name__)
class MediaFormat(Enum):
TV = 1
MOVIE = 2
SPECIAL = 3
OVA = 4
ONA = 5
OTHER = 9
def __sub__(self, other):
return self.value - other.value
@staticmethod
def map(value):
if value == 'TV':
... |
import sublime, sublime_plugin, re;
class SetBufferNameCommand(sublime_plugin.WindowCommand):
def run(self):
view = self.window.active_view();
settings = sublime.load_settings("SetBufferName.sublime-settings");
self.bauto = settings.get("auto_prefix", False);
self.prefix = settings.get("prefix", "-- [%s] %c"... |
__copyright__ = "Copyright 2012, Locaweb IDC"
import re
__all__ = ["RE_SH_VERSION", "RE_SH_ARP", "RE_SH_MODULE", "RE_SH_INTERFACE_STATUS",
"RE_SH_INTERFACE_STATUS_WIDE", "RE_SH_LLDP_NEIGHBORS"]
# show version RE (escape ALL spaces -- re.VERBOSE)
RE_SH_VERSION = re.compile(r"""
... |
"""
Tests for `tty`.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tty.html
"""
# from helpers import check, check_version, run
from helpers import check_version, run
def test_version():
"""Check that we're using Boreutil's implementation."""
assert check_version("tty")
def test_missing_args(... |
#!/usr/bin/env python
import sys
from markov import Markov
from generator import PasswordGenerator
from trainer import MarkovTrainer
ui_data = {'progress_cb':None}
def print_usage():
print """
Usage: {0} [OPTIONS] [LENGTH]
Options:
--dont-mangle
Doesn't mangle the password at all (equ... |
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... |
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
class MyCache(BaseCache):
assoc = 2
block_size = 64
hit_latency = 2
response_latency = 2
mshrs = 10
tgts_per_mshr = 5
class MyL1Cache(MyCache):
is_top_level = True
cpu = InOrderCPU(cpu_id=0)
cpu.addTwoLevelCacheHier... |
import unittest
from unittest.mock import Mock, patch
from airflow.models import Connection
from airflow.providers.jira.hooks.jira import JiraHook
from airflow.utils import db
jira_client_mock = Mock(
name="jira_client"
)
class TestJiraHook(unittest.TestCase):
def setUp(self):
db.merge_conn(
... |
import os
import shutil
import unittest
from grimoire.storage import Storage
TEST_ROOT_PATH = '/tmp/grimoire_test_storage/'
def touch(path, times=None):
"""A Python implementation of the touch command."""
with open(path, 'a'):
os.utime(path, times)
class StorageTest(unittest.TestCase):
"""Unit... |
"""
Main interface module
"""
import functools
import threading
import time
from .exceptions import DuplicateMetricError, InvalidMetricError
from . import histogram, simple_metrics, meter, py3comp
REGISTRY = {}
TAGS = {}
LOCK = threading.Lock()
def new_metric(name, class_, *args, **kwargs):
"""Create a new me... |
#!/usr/local/bin/python
import string
import re
import sys
#GTF format:
# 0: seqname - name of the chromosome or scaffold; chromosome names can be given with or without the 'chr' prefix.
# 1: source - name of the program that generated this feature, or the data source (database or project name)
# 2: feature - feature... |
import os, time
class Command:
commandline_options = []
help = "Add a new rule"
def __init__(self):
if (len(commandline_options!=2)):
raise Exception("Internal error: each command must supply 2 command line options")
def __call__(self, option, opt_str, value, parser,... |
"""
Scheduler base class that all Schedulers should inherit from
"""
import abc
from oslo_log import log as logging
from oslo_utils import importutils
import six
from stevedore import driver
import nova.conf
from nova.i18n import _, _LW
from nova import objects
from nova import servicegroup
CONF = nova.conf.CONF
L... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BrokenLink',
fields=[
('id', models.AutoField(v... |
from __future__ import division
__author__ = 'Hua Wei'
import pandas as pd
import numpy as np
import psycopg2
import pandas.io.sql as sql
from datetime import datetime
from sklearn.linear_model import LogisticRegression
from sklearn import cross_validation
from sklearn import metrics
from datetime import datetime
from ... |
from .rman_ui_base import _RManPanelHeader, CollectionPanel
from bl_ui.properties_particle import ParticleButtonsPanel
import bpy
from bpy.types import Panel
class PARTICLE_PT_renderman_particle(ParticleButtonsPanel, Panel, _RManPanelHeader):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_contex... |
import copy
import mock
from conveyor import context
from conveyor import exception
from conveyor.heat import heat
from conveyor.resource.driver import stacks
from conveyor.resource import resource
from conveyor.tests import test
fake_stack_dict = {
"disable_rollback": True,
"description": "A recorded server"... |
import wx
from cairis.core.armid import *
import WidgetFactory
import cairis.core.MySQLDatabaseProxy
__author__ = 'Shamal Faily'
class ConcernAssociationDialog(wx.Dialog):
def __init__(self,parent,dp,envName,source='',sourceMultiplicity='',link='',target='',targetMultiplicity=''):
wx.Dialog.__init__(self,parent... |
"""Match human readable color names to sRBG values (and vice versa).
`tint` was created to solve the problem of normalizing color strings of
various languages and systems to a well defined set of color names. In order
to do that, `tint` establishes a registry for color names and corresponding
sRGB values. `tint` ships... |
from rest_framework.exceptions import MethodNotAllowed
from rest_framework.permissions import SAFE_METHODS, BasePermission
from olympia.amo import permissions
from olympia.access import acl
# Most of these classes come from zamboni, check out
# https://github.com/mozilla/zamboni/blob/master/mkt/api/permissions.py fo... |
"This package gets the LD flags used to set the version of kubernetes."
import json
import subprocess
import sys
K8S_PACKAGE = 'k8s.io/kubernetes/'
X_ARG_BASE = '-X k8s.io/minikube/vendor/k8s.io/kubernetes/pkg/version.'
def get_rev():
return 'gitCommit=%s' % get_from_godep('Rev')
def get_version():
return 'gi... |
import subprocess
import logging
import threading
import select
import pty
import os
import signal
class ContainerAlreadyExists(Exception):
pass
class ContainerAlreadyRunning(Exception):
pass
class ContainerNotExists(Exception):
pass
class lxc():
def __init__(self):
logging.debug("")
... |
#!/usr/bin/env python
"""Provide code devoted to uploading data to Synapse."""
# Imports
from logzero import logger as log
from pathlib import Path
import datetime as dt
import glob
from collections import deque
import networkx as nx
import synapseclient as synapse
from click.utils import echo
from munch import Mu... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import inspect
import frappe
from erpnext.hooks import regional_overrides
__version__ = '9.0.0'
def get_default_company(user=None):
'''Get default company for user'''
from frappe.defaults import get_user_default_as_list
if not user:
user = frappe.s... |
import logging
from operator import itemgetter
from django import template
from django import http
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.sh... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsPoint.
.. 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 version.
"""
__author... |
#!/usr/bin/python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.uic import *
from blur.Stone import *
from blur.Classes import *
from blur.Classesui import *
from blur.absubmit import Submitter
import pumpThread as pt
import sys
import os
import time
import maya.cmds as cmds
import maya.mel
dialog =... |
from heat.common import exception
from heat.common import template_format
from heat.engine import resource
from heat.engine import scheduler
from heat.tests.common import HeatTestCase
from heat.tests import utils
from .fake_docker_client import FakeDockerClient # noqa
from ..resources import docker_container # noqa
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.