content stringlengths 4 20k |
|---|
# $Id: mod_pres.py 2078 2008-06-27 21:12:12Z nanang $
import time
import imp
import sys
import inc_const as const
from inc_cfg import *
# Load configuration
cfg_file = imp.load_source("cfg_file", ARGS[1])
# Test body function
def test_func(t):
u1 = t.process[0]
uri1 = cfg_file.test_param.inst_params[0].uri
acc1 =... |
import sys
import os
from importlib import import_module
from scrapy.utils.spider import iter_spider_classes
from scrapy.command import ScrapyCommand
from scrapy.exceptions import UsageError
from scrapy.utils.conf import arglist_to_dict
def _import_file(filepath):
abspath = os.path.abspath(filepath)
dirname, ... |
# -*- coding: utf-8 -*-
"""
celery.loaders.base
~~~~~~~~~~~~~~~~~~~
Loader base class.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import importlib
import os
import re
import traceback
import warnings
from any... |
class CQL3HelpTopics(object):
def get_help_topics(self):
return [t[5:] for t in dir(self) if t.startswith('help_')]
def get_help_topic(self, topic):
return getattr(self, 'help_' + topic.lower())()
def help_types(self):
return 'types'
def help_timestamp(self):
return 'u... |
# protoc plugin to map from FileDescriptorProtos to a tools.type_whisperer.Types
# proto. This is the type information for a single .proto, consumed by
# typedb_gen.py.
from tools.api_proto_plugin import plugin
from tools.api_proto_plugin import visitor
from tools.type_whisperer.types_pb2 import Types
from udpa.annot... |
#! /usr/bin/python3
import glob
import os
import subprocess
import sys
from bs4 import BeautifulSoup
JEKYLL_HEADER = """---
layout: help
title: Meld - Help
---
"""
SCSS_HEADER = """
#help-content {
border-left: solid 1px #e0e0df;
border-right: solid 1px #e0e0df;
background-color: #ffffff;
}
#help-content di... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.lookup import LookupBase
class LookupModule(LookupBase):
def run(self, terms, **kwargs):
return self._flatten(terms) |
microcode = '''
def macroop JMP_I
{
# Make the default data size of jumps 64 bits in 64 bit mode
.adjust_env oszIn64Override
rdip t1
limm t2, imm
wrip t1, t2
};
def macroop JMP_R
{
# Make the default data size of jumps 64 bits in 64 bit mode
.adjust_env oszIn64Override
wripi reg, 0
};... |
"""Utilities for working with multiple processes, including both forking
the server into multiple processes and managing subprocesses.
"""
from __future__ import absolute_import, division, print_function
import errno
import os
import signal
import subprocess
import sys
import time
from binascii import hexlify
from ... |
"""
Brazilian Portuguese-language mappings for language-dependent features of
reStructuredText.
"""
__docformat__ = 'reStructuredText'
directives = {
# language-dependent: fixed
'aten\u00E7\u00E3o': 'attention',
'cuidado': 'caution',
'code (translation required)': 'code',
'perigo': 'dan... |
import os
from PyQt4 import QtCore
from PyQt4.QtCore import QAbstractListModel, QModelIndex, pyqtSlot
from softwarecenter.db.database import StoreDatabase, Application
from softwarecenter.db.pkginfo import get_pkg_info
from softwarecenter.db.categories import CategoriesParser
from softwarecenter.paths import XAPIAN_B... |
from projexui.widgets.xtoolbutton import XToolButton
from projexui import resources
from xqt import QtCore, QtGui
class XOverlayWidget(QtGui.QWidget):
finished = QtCore.Signal(int)
def __init__(self, parent=None):
super(XOverlayWidget, self).__init__(parent)
# define custom properties
... |
import numpy as np
import copy
from pybullet_utils.logger import Logger
import inspect as inspect
from pybullet_envs.deep_mimic.env.env import Env
import pybullet_utils.math_util as MathUtil
class ReplayBuffer(object):
TERMINATE_KEY = 'terminate'
PATH_START_KEY = 'path_start'
PATH_END_KEY = 'path_end'
def __... |
import numpy as np
import pycuda.driver as cuda
import pycuda.autoinit
import tensorrt as trt
import os, sys
sys.path.insert(0, os.getcwd())
from code.common import logging
from PIL import Image
class SSDResNet34EntropyCalibrator(trt.IInt8EntropyCalibrator2):
def __init__(self, data_dir, cache_file, batch_size, ... |
import os
import shutil
import tempfile
from unittest import TestCase
from packstack.installer.validators import *
from ..test_base import PackstackTestCaseMixin
class ValidatorsTestCase(PackstackTestCaseMixin, TestCase):
def setUp(self):
# Creating a temp directory that can be used by tests
self... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from jinja2.runtime import Context
from units.compat import unittest
from units.compat.mock import patch
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleUndefinedVariable
from ansible.module_uti... |
# -*- coding: utf-8 -*-
r"""
werkzeug.contrib.iterio
~~~~~~~~~~~~~~~~~~~~~~~
This module implements a :class:`IterIO` that converts an iterator into
a stream object and the other way round. Converting streams into
iterators requires the `greenlet`_ module.
To convert an iterator into a stream... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
VMware Inventory Script
=======================
Retrieve information about virtual machines from a vCenter server or
standalone ESX host. When `group_by=false` (in the INI file), host systems
are also returned in addition to VMs.
This script will attempt to read conf... |
import cv2
import re
import os
from opendm import get_image_size
from opendm import location
from opendm.gcp import GCPFile
from pyproj import CRS
import xmltodict as x2d
from six import string_types
from opendm import log
from opendm import io
from opendm import system
from opendm import context
from opendm.progress... |
"""Unit test for cmake.py."""
import unittest2 as unittest
from cmake import CMakeChecker
class CMakeCheckerTest(unittest.TestCase):
"""Tests CMakeChecker class."""
def test_init(self):
"""Test __init__() method."""
def _mock_handle_style_error(self):
pass
checker = CM... |
#!/usr/bin/env python
#
# Description: Binary convert on hexascii printables contained within a stream
# believed to represent an executable file.
'''
Copyright 2016 Carnegie Mellon University
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with ... |
import os
from LukeClient.Cpu import Cpu
from LukeClient.Disks import Disks
from LukeClient.Nics import Nics
from LukeClient.PollingStatus import PollingStatus
from LukeClient.Ram import Ram
from LukeClient.Server import Server
from requests import post
os.system("dhclient eth0")
server = Server(cpu=Cpu(), ram=Ram(),... |
import collections
import os
import yaml
try:
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
_ = Provider.GCE
except ImportError:
print("failed=True " + \
"msg='libcloud with GCE support (0.13.3+) required for this module'")
sys.exit(1)
def a... |
# -*- coding: utf-8 -*-
# Web2py plugin to manage/save/load config items.
# Items saved as single 'group' with 'item's can be loaded into single python dictionary with keys 'item's.
db.define_table('plugin_config_grp',
Field('grp', length=16),
Field('user_settings', 'boolean'),
Field('txt_label', length=9... |
import json
import os
import tempfile
import main
class FlickrCached(object):
'''
Helper methods to cache objects
'''
id = None
cache_path = ''
data = {}
cached = True
# Template generation
slug = ''
url = ''
generated_path = ''
def __init__(self, cache_id):
self.id = cache_id
# Setu... |
"""Fixer for execfile.
This converts usages of the execfile function into calls to the built-in
exec() function.
"""
from .. import fixer_base
from ..fixer_util import (Comma, Name, Call, LParen, RParen, Dot, Node,
ArgList, String, syms)
class FixExecfile(fixer_base.BaseFix):
BM_compat... |
"""
Django settings for infinitebrain project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, .... |
"""PythonHeaderParserHandler for mod_pywebsocket.
Apache HTTP Server and mod_python must be configured such that this
function is called to handle WebSocket request.
"""
import logging
from mod_python import apache
from mod_pywebsocket import common
from mod_pywebsocket import dispatch
from mod_pywebsocket import ... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from weblate.trans.models.subproject import SubProject
PRIORITY_CHOICES = (
(60, _('Very high')),
(80, _('High')),
(100, _('Medium')),
(120, _('Low')),
(140, _('Very low')),
)
class Source(models.Model):
che... |
import StringIO
from volatility.renderers.basic import Renderer
try:
import ujson as json
except ImportError:
import json
__author__ = 'mike'
class HTMLRenderer(Renderer):
def __init__(self):
pass
def render(self, outfd, data):
"""Renders the treegrid to HTML"""
column_title... |
"""
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 LibcxxOptionalDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@ad... |
data = (
'[?]', # 0x00
'', # 0x01
'', # 0x02
'', # 0x03
'', # 0x04
'', # 0x05
'', # 0x06
'', # 0x07
'', # 0x08
'', # 0x09
'', # 0x0a
'', # 0x0b
'', # 0x0c
'', # 0x0d
'', # 0x0e
'', # 0x0f
'', # 0x10
'', # 0x11
'', # 0x12
'', # 0x13
'', # 0x14
'', # 0x15
... |
"""HTML pretty-printing for Python source code."""
__version__ = '$Revision: 1.8 $'[11:-2]
from twisted.python import htmlizer, usage
from twisted import copyright
import os, sys
header = '''<html><head>
<title>%(title)s</title>
<meta name=\"Generator\" content="%(generator)s" />
%(alternate)s
%(stylesheet)s
</head... |
# -*- coding: utf-8 -*-
import re
import urlparse
from module.plugins.internal.ReCaptcha import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class Keep2ShareCc(SimpleHoster):
__name__ = "Keep2ShareCc"
__type__ = "hoster"
__version__ = "0.23"
__patter... |
import re
import os
try:
import gconf
except ImportError:
from gnome import gconf
class Settings(object):
def __init__(self, defaults, changedCb):
self._defaults = defaults
self._changedCb = changedCb
self._overrides = {}
def get(self, key, **kwargs):
return None
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.core.tasks.task import TaskBase
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
class JvmToolTaskMixin(JvmToolMixin, TaskBase... |
# -*- coding: latin1 -*-
################################################################################################
#
#
import snap, datetime, sys, time, json, os, os.path, shutil, time, random, math
import numpy as np
from math import*
from scipy.stats.stats import pearsonr
reload(sys)
sys.setdefaultencod... |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import numpy as np
import Constants as gv
def PutInBox(x):
'''
Implement periodic boundary conditions along the x-axis.
Ri: np.array[x, y] - position of a single atom
L: Float - global variable indicating the width of the periodic cell
returns: np.a... |
"""
Verifies build of an executable with C++ define specified by a gyp define, and
the use of the environment during regeneration when the gyp file changes.
"""
import os
import TestGyp
# Regenerating build files when a gyp file changes is currently only supported
# by the make and Android generators.
test = TestGyp.... |
"""The tests the History component."""
# pylint: disable=protected-access,too-many-public-methods
from datetime import timedelta
import unittest
from unittest.mock import patch, sentinel
import homeassistant.core as ha
import homeassistant.util.dt as dt_util
from homeassistant.components import history, recorder
from... |
from __future__ import unicode_literals
import contextlib
import sys
from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
ENVIRONMENT_DIR = 'node_env'
class NodeEnv(helpers.Environment):
@property
def env_prefix(self):
return ". '{{prefix}}{0}/bin/activate' &&... |
"""
Facilities for helping test code which interacts with Python's module system
to load code.
"""
from __future__ import division, absolute_import
import sys
from twisted.python.filepath import FilePath
class TwistedModulesMixin:
"""
A mixin for C{twisted.trial.unittest.SynchronousTestCase} providing usef... |
""" Demonstration of how to register event callbacks using an adaptation
of the color_scatter example from the bokeh gallery
"""
import numpy as np
from bokeh.io import show, output_file
from bokeh.plotting import figure
from bokeh import events
from bokeh.models import CustomJS, Div, Button
from bokeh.layouts import c... |
from __future__ import unicode_literals
from math import ceil
from django.db import IntegrityError, connection, models
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from django.utils.six.moves import range
from .models import... |
import unittest
from test_views import *
from test_store import *
from test_auth import *
from test_admin import *
def suite():
suite = unittest.TestSuite()
for name in ['test_auth', 'test_store', 'test_views', 'test_admin']:
mod = __import__('%s.%s' % (__name__, name), {}, {}, ['suite'])
suit... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
from ansible.plugins.terminal import TerminalBase
from ansible.errors import AnsibleConnectionFailure
class TerminalModule(TerminalBase):
terminal_stdout_re = [
re.compile(br"[\r\n]?(?:\([^\)]+\)){,5}(?:>|... |
import asyncio
from . import unpack
from .log import logger
class Connection(object):
def __init__(self, host, port, events, encoding, ssl):
self.events = events
self._connected = False
self.host, self.port = host, port
self.reader, self.writer = None, None
self.encoding = ... |
import cadquery as cq
core_rad = 45.0 / 2.0
# Objects to make the basic shape of the guide
guide_core = (cq.Workplane("XY")
.circle(core_rad)
.extrude(3.0))
guide_fan = (cq.Workplane("XY")
.moveTo(0.0, -10.0)
.hLine(core_rad + 15)
.threePointArc((... |
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,2,0.75],[traindat,testdat,3,0.75]]
def kernel_ssk_string_modular (fm_train_dna=traindat, fm_test_dna=testdat, maxlen=1, decay=1):
... |
from requests import get
from random import choice
from ..helpers import arguments
from ..helpers.orm import Issues
from ..helpers.command import Command
from ..helpers.web import create_issue
@Command(['issue', 'bug'], ['source', 'db', 'config', 'type', 'is_admin', 'nick'])
def cmd(send, msg, args):
"""Files a g... |
"""
Test the partitions and partitions service
"""
import django.test
from mock import patch
from nose.plugins.attrib import attr
from courseware.tests.test_masquerade import StaffMasqueradeTestCase
from student.tests.factories import UserFactory
from xmodule.partitions.partitions import Group, UserPartition, UserPar... |
"""
Django settings for example project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
# The GDAL C library, OGR exception, and the Field object
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import OGRException, OGRIndexError
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
# ctypes function pro... |
import espressomd
import numpy as np
import unittest as ut
class Integrate(ut.TestCase):
"""
Tests integration of Newton's equations for a particle with and without
external forces and with time step changes on the way.
"""
def test(self):
system = espressomd.System(box_l=[10.0, 10.0, 1... |
"""
.. dialect:: mssql+mxodbc
:name: mxODBC
:dbapi: mxodbc
:connectstring: mssql+mxodbc://<username>:<password>@<dsnname>
:url: http://www.egenix.com/
Execution Modes
---------------
mxODBC features two styles of statement execution, using the
``cursor.execute()`` and ``cursor.executedirect()`` method... |
import base64
import ctypes
import ctypes.util
import struct
import sys
if sys.platform == "win32":
openssl_lib_path = "libeay32.dll"
else:
openssl_lib_path = ctypes.util.find_library("ssl")
openssl = ctypes.CDLL(openssl_lib_path)
clib = ctypes.CDLL(ctypes.util.find_library("c"))
class RSA(ctypes.Structure)... |
from __future__ import absolute_import
import os, signal, subprocess, sys
import re
import platform
import tempfile
import lit.ShUtil as ShUtil
import lit.Test as Test
import lit.util
from lit.util import to_bytes, to_string
class InternalShellError(Exception):
def __init__(self, command, message):
self.c... |
"""Tests for unified pooling functionality in tensorflow.ops.nn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tens... |
"""
ID-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
import time
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.ut... |
import os
from zipfile import ZipFile
from django import http
from django.views import generic
from django.urls import reverse
from django.shortcuts import redirect
from editor.models import Extension, ExtensionAccess
from editor import forms
from editor.views.generic import AuthorRequiredMixin, CanViewMixin
from edi... |
import logging
from django.contrib.auth.models import User
from nose.plugins.attrib import attr
from nose.tools import assert_equal, assert_true, assert_not_equal
from hadoop import cluster, pseudo_hdfs4
from hadoop.conf import HDFS_CLUSTERS, MR_CLUSTERS, YARN_CLUSTERS
from desktop.lib.django_test_util import make_l... |
from JumpScale import j
import random
import sys
import string
class IDGenerator:
"""
generic provider of id's
lives at j.data.idgenerator
"""
def __init__(self):
self.__jslocation__ = "j.data.idgenerator"
self.cryptogen = random.SystemRandom()
def generateRandomInt(self, fro... |
from shinken_test import *
class TestStarInGroups(ShinkenTest):
def setUp(self):
self.setup_with_file('etc/shinken_star_in_hostgroups.cfg')
# If we reach a good start, we are ok :)
# the bug was that an * hostgroup expand get all host_name != ''
# without looking at register 0 or not
def ... |
import os
import os.path
import sys
from xml.dom import minidom
from xml.parsers.expat import ExpatError
ROOT_ADMIN = 'r'
user_to_func = {
ROOT_ADMIN: 'populateForApi',
}
user_to_cns = {
ROOT_ADMIN: 'allCommandNames',
}
dirname_to_user = {
'apis': ROOT_ADMIN,
}
dirname_to_dirname = {
... |
"""Inception-ResNet V2 model for Keras.
# Reference
- [Inception-v4, Inception-ResNet and the Impact of
Residual Connections on Learning](https://arxiv.org/abs/1602.07261)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.py... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import sys
import paramiko
import time
import argparse
import socket
import array
import json
import time
import re
try:
from ansible.module_utils import cnos
HAS_LIB = T... |
import pipes
from oslo_concurrency import processutils
from oslo_log import log
from oslo_utils import excutils
import six
from six.moves import http_cookiejar
from six.moves.urllib import error as url_error # pylint: disable=E0611
from six.moves.urllib import request as url_request # pylint: disable=E0611
from man... |
from optparse import OptionParser
import os
import math,re
from time import gmtime, strftime
import pysam
import pickle
import subprocess
import gzip
'''
Author:Oana Ursu
Modified by Irene Kaplow
'''
def main():
parser=OptionParser()
parser.add_option('--fasta_1m',dest='fa_1m',help='Fasta file 1 maternal m... |
import sys
import unittest
import os
import tempfile
import numpy as NP
from numpy.random.mtrand import uniform
from numpy.testing import assert_array_equal, assert_array_almost_equal
import netCDF4p as netCDF4
# test variable creation.
FILE_NAME = tempfile.mktemp(".nc")
VAR_DOUBLE_NAME="dummy_var"
VAR_SHORT_NAME='du... |
from tempest_lib import exceptions as lib_exc
import testtools
from tempest.api.compute import base
from tempest import config
from tempest import test
CONF = config.CONF
class SecurityGroupDefaultRulesTest(base.BaseV2ComputeAdminTest):
@classmethod
# TODO(GMann): Once Bug# 1311500 is fixed, these test can... |
def table_exists(cr, table):
""" Check whether a certain table or view exists """
cr.execute(
'SELECT count(relname) FROM pg_class WHERE relname = %s',
(table,))
return cr.fetchone()[0] == 1
def migrate(cr, version):
"""
Migration script for semantic changes in account_banking_paym... |
''' Provide a request handler that returns a page displaying a document.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, uni... |
from msrest.pipeline import ClientRawResponse
import uuid
from .. import models
class ApiVersionDefaultOperations(object):
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.conf... |
#! /usr/bin/python
"""
Symmetric secret sharing.
"""
import hashlib, struct, os, subprocess
def choose(n, k, start=0):
if k:
for i in xrange(start, n):
for remaining in choose(n, k-1, i+1):
yield [i] + remaining
else: yield []
def hashalg(s):
for i in xrange(2):
s = hashlib.sha512(s).digest()
return s... |
from .__version__ import __version__
__all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE',
'SUBMISSION_FILE', 'COMMENT_EDIT_FILE']
AGENT = """\
desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\
""".format(__version__)
SUMMARY = """
Reddit Terminal Viewer is... |
"""W3C Document Object Model implementation for Python.
The Python mapping of the Document Object Model is documented in the
Python Library Reference in the section on the xml.dom package.
This package contains the following modules:
minidom -- A simple implementation of the Level 1 DOM with namespace
sup... |
from openerp.osv import fields, osv
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
_columns = {
'property_product_pricelist': fields.property(
'product.pricelist',
type='many2one',
relation='product.pricelist',
domain=[(... |
"""
DataSource is a wrapper for the OGR Data Source object, which provides
an interface for reading vector geometry data from many different file
formats (including ESRI shapefiles).
When instantiating a DataSource object, use the filename of a
GDAL-supported data source. For example, a SHP file or a
TIGER/Line... |
from unittest import TestCase
from phi.flow import *
from phi.physics._boundaries import Domain, STICKY
def step(particles, domain, dt, accessible):
velocity = particles >> domain.staggered_grid()
div_free_velocity, _, occupied = \
flip.make_incompressible(velocity + dt * math.tensor([0, -9.81]), dom... |
"""
This file contains Python code illustrating the creation and manipulation of
vtkTable objects.
"""
from vtk import *
#------------------------------------------------------------------------------
# Some Helper Functions
#------------------------------------------------------------------------------
def add_row_... |
from django.http import HttpResponse, QueryDict, HttpResponseServerError, HttpResponseRedirect
from django.core import serializers
from django.shortcuts import get_object_or_404
from django.core.urlresolvers import reverse
try:
from urlparse import parse_qsl
except ImportError:
from cgi import parse_qsl # Pyth... |
"""
pyturb
isa.py tests
M Rodriguez
"""
from pyturb.isentropic_gas import IsentropicGas
import numpy as np
isentropic = IsentropicGas(selected_cp_air_model='ideal', selected_gamma_air_model='aaa')
isentropic = IsentropicGas(selected_cp_air_model='ideal', selected_gamma_air_model='ideal')
print('...........')
isentro... |
"""
程序功能说明:
1.计算gene表达量
2.randCheck_gene
3.randCheck_mRNA
程序设计思路:
利用gffutils和HTSeq包进行统计
"""
import re, os, sys, logging, time, datetime
from optparse import OptionParser, OptionGroup
reload(sys)
sys.setdefaultencoding('utf-8')
import subprocess
import threading
import gffutils
import HTSeq
import numpy
import multi... |
import os, sys
from fsui.qt import QUrl, QLibraryInfo
from fsui.qt import QMainWindow, QWidget, Qt
from PyQt5.QtQuick import QQuickView
# to make sure cxFreeze includes it
import PyQt5.QtNetwork
import PyQt5.QtQml
from fsbc.application import app
class GameCenterView(QQuickView):
def __init__(self, parent=None):... |
import gobject
import gtk
import ns.core
import ns.network
import ns.visualizer
from visualizer.base import InformationWindow
from visualizer.higcontainer import HIGContainer
from kiwi.ui.objectlist import ObjectList, Column
class ShowLastPackets(InformationWindow):
class PacketList(gtk.ScrolledWindow):
... |
import dictutil
class NummedObj(object):
"""
This is useful for nicer debug printouts. Instead of objects of the same class being
distinguished from one another by their memory address, they each get a unique number, which
can be read as "the first object of this class", "the second object of this cla... |
import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .client import UntappdOAuth2Client
from .provider import UntappdProvide... |
from ..broker import Broker
class SpmDevicesDefaultGridBroker(Broker):
controller = "spm_devices_default_grids"
def index(self, **kwargs):
"""Lists the available spm devices default grids. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to... |
from django.utils import timezone
from django.db import models
from django.db import connection
from django.conf import settings
from utils import skill_names
class Skills(models.Model):
overall_exp = models.FloatField(default=0)
overall = models.IntegerField(default=1)
attack_exp = models.FloatField(de... |
"""
This module provides access to the Unix password database.
Password database entries are reported as 7-tuples containing the
following items from the password database (see `<pwd.h>'), in order:
pw_name, pw_passwd, pw_uid, pw_gid, pw_gecos, pw_dir, pw_shell. The
uid and gid items are integers, all others are stri... |
"""
Invenio DB dumper.
"""
import os
import re
import time
from invenio.config import CFG_LOGDIR, CFG_PATH_MYSQL, CFG_PATH_GZIP
from invenio.dbquery import CFG_DATABASE_HOST, \
CFG_DATABASE_USER, \
CFG_DATABASE_PASS, \
CFG_DATABASE_NA... |
from keystone.common import wsgi
from keystone.contrib.ec2 import controllers
class Ec2Extension(wsgi.ExtensionRouter):
def add_routes(self, mapper):
ec2_controller = controllers.Ec2Controller()
# validation
mapper.connect(
'/ec2tokens',
controller=ec2_controller,
... |
"""Simulate network characteristics directly in Python.
Allows running replay without dummynet.
"""
import logging
import platformsettings
import re
import time
TIMER = platformsettings.timer
class ProxyShaperError(Exception):
"""Module catch-all error."""
pass
class BandwidthValueError(ProxyShaperError):
... |
#!/usr/bin/env python
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 337600
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = set([
"130.211.129.106", "178.63.107.226",
"83.81.1... |
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
forms.py - Definitions of newforms-based forms for creating and maintaining
tickets.
"""
try:
from StringIO import StringIO
except ImportError:
from io... |
from unittest.mock import MagicMock
import falcon
import pytest
from falcon_jwt_checker.falcon_jwt_checker import JwtChecker
class TestJwtChecker:
def test_rejects_unsupported_algorithm(self):
with pytest.raises(RuntimeError):
JwtChecker(algorithm='super_algo')
def test_raises_401_when... |
"""Support for IQVIA sensors."""
from statistics import mean
import numpy as np
from homeassistant.const import ATTR_STATE
from homeassistant.core import callback
from . import IQVIAEntity
from .const import (
DATA_COORDINATOR,
DOMAIN,
SENSORS,
TYPE_ALLERGY_FORECAST,
TYPE_ALLERGY_INDEX,
TYPE_... |
# By Sawyer, Griffin, and Rahil
# Custom hashing function for Olin College Discrete Math 2015
import sys
import math
import bitstring
from bitstring import BitArray, BitStream, ConstBitStream
from Crypto.Hash import MD5
from random import randint
import numpy
import matplotlib.pyplot as plt
def padBits(input, bitSize... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
provider:
description:
- B(Deprecated)
- "Starting with Ansible 2.5 we recommend using C(connection: network_cli)."
- For more information please see the L(Network Guide, ../network/ge... |
import mock
from rally.plugins.openstack.scenarios.swift import utils
from tests.unit import test
SWIFT_UTILS = "rally.plugins.openstack.scenarios.swift.utils"
class SwiftScenarioTestCase(test.ScenarioTestCase):
def test__list_containers(self):
headers_dict = mock.MagicMock()
containers_list = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.