content stringlengths 4 20k |
|---|
import subprocess
import sys
import textwrap
import portage
from portage import os
from portage import _unicode_decode
from portage.const import (BASH_BINARY, PORTAGE_BIN_PATH,
PORTAGE_PYM_PATH, USER_CONFIG_PATH)
from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import ResolverPlaygrou... |
"""
Tests for assessing the statistical significance of differences between
the AUC for ROC curves.
"""
from yard.curve import ROCCurve
from yard.mathematics import geometric
__author__ = "Tamas Nepusz"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (c) 2010, Tamas Nepusz"
__license__ = "MIT"
class SignificanceTe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Comment important tags (with 'id' and 'class' attributes)
@author Sergey Chikuyonok (<EMAIL>)
@link http://chikuyonok.ru
'''
from zencoding import zen_core as zen_coding
alias = 'c'
"Filter name alias (if not defined, ZC will use module name)"
def add_comments(node, ... |
"""DOI Badge Blueprint."""
from __future__ import absolute_import
import os
import urllib
from flask import Blueprint, abort, current_app, make_response, redirect, \
request, url_for
from invenio.base.globals import cfg
from invenio.ext.sslify import ssl_required
from invenio.modules.pidstore.models import Pers... |
# -*- coding: utf-8 -*-
"""The Volume Shadow Snapshots (VSS) file-like object implementation."""
import os
from dfvfs.file_io import file_io
from dfvfs.lib import errors
from dfvfs.lib import vshadow
from dfvfs.resolver import resolver
class VShadowFile(file_io.FileIO):
"""File input/output (IO) object using pyvs... |
"""Service calls related dependencies for LCN component."""
import pypck
import voluptuous as vol
from homeassistant.const import (
CONF_ADDRESS,
CONF_BRIGHTNESS,
CONF_STATE,
CONF_UNIT_OF_MEASUREMENT,
TIME_SECONDS,
)
import homeassistant.helpers.config_validation as cv
from .const import (
CO... |
"""Support for showing the date and the time."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_DISPLAY_OPTIONS
from homeassistant.core import callback
import homeassistant.helpers.config_validatio... |
#! /usr/bin/env python
# coding=utf-8
# Import all model parameters and spatial datasets to MongoDB
# Revised: Liang-Jun Zhu
#
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
from gridfs import *
from config import *
from find_sites import FindSites
from gen_subbasins import ImportSubbasi... |
from openerp.osv import osv
from openerp.tools.translate import _
class purchase_line_invoice(osv.osv_memory):
""" To create invoice for purchase order line"""
_name = 'purchase.order.line_invoice'
_description = 'Purchase Order Line Make Invoice'
def makeInvoices(self, cr, uid, ids, context=None):... |
# -*- coding: utf-8 -*-
import smtplib, sys
from smtplib import SMTPException
import datetime
from settings import logger
import settings as const
from email.MIMEText import MIMEText
def sendmail(alarm, body_msg, subject='EWSoDS detect low disk space !!!'):
""" Sending mail through the smtp lib. """
try:
... |
import tkinter
import Test
import Pmw
Test.initialise()
c = Pmw.SelectionDialog
kw_1 = {
'scrolledlist_labelpos': 'n',
'label_text' : 'Please select one',
'buttons' : ('OK', 'Cancel'),
'buttonbox_padx': 30,
}
tests_1 = (
(Test.num_options, (), 11),
('hull_background', '#d9d9d9'),
... |
"""
Enrollment operations for use by instructor APIs.
Does not include any access control, be sure to check access before calling.
"""
import json
import logging
from django.contrib.auth.models import User
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.mail import send_... |
from coilsnake.exceptions.common.exceptions import CoilSnakeError
from coilsnake.model.common.blocks import Block
from coilsnake.model.eb.palettes import EbPalette
from coilsnake.model.eb.sprites import SpriteGroup, SPRITE_SIZES
from coilsnake.model.eb.table import eb_table_from_offset
from coilsnake.modules.eb.EbModul... |
#!/usr/bin/python
from __future__ import division
import operator
import itertools
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
import random
from random import randint
#from numpy import *
def generate_transcripts(starts,ends,gene_name,strand,acce... |
import sys
try:
import pygtk
pygtk.require("2.0")
except:
pass
try:
import gtk
import gtk.glade
except:
sys.exit(1)
import os
import RapacheGtk.GuiUtils
from RapacheCore.Module import *
from RapacheGtk import GuiUtils
import RapacheCore.Shell
class EditGenericWindow:
def __init__(... |
import io
from lxml import etree
def debug(obj):
import pprint
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(obj)
def parse_string(s):
try:
tree = etree.parse(io.BytesIO(s.encode('utf-8')))
except:
tree = etree.parse(io.BytesIO(s))
return tree
def parse_html_string(s):
f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A Python script that uses numpy and pyper.
"""
from __future__ import division, print_function
import os
import numpy as np
import pyper
import sys
def get_R_binary(verbose=False):
# additional search paths
Rpaths = list()
# win
Rroot_win = "C:\\Prog... |
from __future__ import absolute_import
import functools
import socket
from logging import WARNING
from tornado import concurrent
from tornado.gen import with_timeout
from tornado.httpclient import HTTPRequest, HTTPError
from tornado.websocket import websocket_connect
from gremlinclient.api import _submit, _create_con... |
from datetime import datetime
from pygw.index import SpatialIndexBuilder
from pygw.query import VectorAggregationQueryBuilder
from .conftest import POINT_TYPE_ADAPTER, POINT_GEOMETRY_FIELD, POINT_TIME_FIELD, POINT_TYPE_NAME, POINT_NUMBER_FIELD
from .conftest import write_test_data
from ..base import Envelope, Interva... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.models import User
from peekaboo.base.utils import superuser_required
from peekaboo.main.models import Location
from . import forms
@superuser_required
def home(request):
context = {}
if request.method == 'POST':
... |
import requests
import taskcluster
TC_INDEX_URL = 'https://index.taskcluster.net/v1/tasks/project.releng.services.project.{}.static_analysis_bot.phabricator'
def list_tasks(env):
url = TC_INDEX_URL.format(env)
resp = requests.get(url)
resp.raise_for_status()
return list(map(lambda t: t['data'], resp.... |
from ctypes import *
from ctypes import util
iokit = cdll.LoadLibrary(util.find_library('IOKit'))
cf = cdll.LoadLibrary(util.find_library('CoreFoundation'))
cf.CFStringCreateWithCString.argtypes = [c_void_p, c_char_p, c_int32]
cf.CFStringCreateWithCString.restype = c_void_p
cf.CFStringGetCStringPtr.argtypes = [c_vo... |
"""
Copyright (c) 2016-2019 ARM Limited. All rights reserved.
SPDX-License-Identifier: Apache-2.0
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
http://www.apache.org/licenses/LICENSE-2.0
Unless... |
from __future__ import unicode_literals
import frappe, json, os
from frappe.website.website_generator import WebsiteGenerator
from frappe import _, scrub
from frappe.utils import cstr
from frappe.utils.file_manager import save_file, remove_file_by_url
from frappe.website.utils import get_comment_list
from frappe.custom... |
import logging
from navitiacommon import models
from tests_mechanism import AbstractTestFixture, dataset
from check_utils import *
from contextlib import contextmanager
from flask import appcontext_pushed, g
from jormungandr import app
import json
import logging
from nose.util import *
authorizations = {
'bob': ... |
import time
from libmich.core.element import Element, Str, Bit, Int, Layer, \
testTLV
from libmich.core.element import test as test_tlv
from libmich.formats.BMP import BMP
from libmich.formats.BGP4 import BGP4, testbuf
from libmich.formats.L3Mobile import test_regr
from libmich.asn1.test import test_def, test_per_i... |
"""
Implementation of an SSH2 "message".
"""
import struct
from paramiko import util
from paramiko.common import zero_byte, max_byte, one_byte, asbytes
from paramiko.py3compat import long, BytesIO, u, integer_types
class Message (object):
"""
An SSH2 message is a stream of bytes that encodes so... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import json
import os
import sys
import threading
import time
import urllib
from contextlib import contextmanager
from urlparse import urlparse
import httplib
from p... |
import numpy as np
from . import libsvm, liblinear
from ..base import BaseEstimator
from ..utils import safe_asanyarray
LIBSVM_IMPL = ['c_svc', 'nu_svc', 'one_class', 'epsilon_svr', 'nu_svr']
def _get_class_weight(class_weight, y):
"""Estimate class weights for unbalanced datasets."""
if class_weight == 'a... |
import hashlib, math, io, struct
from datetime import datetime, timedelta
from collections import OrderedDict
from ...util import all_subclasses
def create_reader(data_format, process_struct=lambda data: data[0]):
data_struct = struct.Struct('>' + data_format)
def reader(file, **kwargs):
data = data_... |
import os
import random
import _pickle as pickle
from agents.DiffAgentSpeculative import DiffAgentSpeculative
from agents.DiffAgent import DiffAgent
from agents.DiffAgentKnowledgeable import DiffAgentKnowledgeable
from agents.AgentKnowledgeable import AgentKnowledgeable
from agents.Experience import Experience
from ag... |
#!/usr/bin/env python
# --!-- coding: utf8 --!--
import re
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QTextCursor, QFont, QFontMetrics
from PyQt5.QtWidgets import QAction, qApp, QToolTip, QTextEdit
from manuskript.ui.editors.completer import completer
from manuskript.ui.views.MDEditView import MDEditView
fro... |
""" It is an interface for the 'MLPClassifier' training model (Multi-Layer Perceptron (MLP) Neural Network).
"""
from typing import Dict, List, Any, TypeVar
from Stats.Stats import Stats
from sklearn.neural_network import MLPClassifier
PandasDataFrame = TypeVar('DataFrame')
SklearnMLPClassifier = TypeVar('MLP... |
# -*- coding: utf-8 -*-
from hyperframe.frame import (
Frame, DataFrame, PriorityFrame, RstStreamFrame, SettingsFrame,
PushPromiseFrame, PingFrame, GoAwayFrame, WindowUpdateFrame, HeadersFrame,
ContinuationFrame, AltSvcFrame, Origin, BlockedFrame,
)
import pytest
def decode_frame(frame_data):
f, lengt... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from compendia.views import ArticleDetailView
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^api/v1/', include('api.urls')),
url(r'^users/', include("users.urls", namespace="users")),
url(r'^accounts/', inc... |
#!/usr/bin/python3
import socket
import re
import urllib
import sys
import os
import time
try:
from colorama import *
init(autoreset=True)
except:
print("É NECESSÁRIO O MODULO |COLORAMA| INSTALADO!")
sys.exit(0)
try:
import requests
except:
print("É NECESSÁRIO O MODULO |REQUESTS| INSTALADO!")... |
"""
Module implementing a starter for the system tray.
"""
from __future__ import unicode_literals
import sys
import os
from PyQt5.QtCore import QProcess, QSettings, QFileInfo
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import QSystemTrayIcon, QMenu, qApp, QDialog, QApplication
from E5Gui import E5MessageB... |
"""irc_disentanglement dataset."""
import collections
import os
from typing import List
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
_CITATION = """
@InProceedings{acl19disentangle,
author = {Jonathan K. Kummerfeld and Sai R. Gouravajhala and Joseph Peper and Vignesh Athreya a... |
'''@file dnn.py
The DNN neural network classifier'''
import seq_convertors
import tensorflow as tf
from classifier import Classifier
from layer import FFLayer
from activation import TfActivation
class DNN(Classifier):
'''This class is a graph for feedforward fully connected neural nets.'''
def __init__(self,... |
import os.path
import codecs
class NoCountryError(Exception):
"""Raised when non-supported country is queried"""
pass
class Detector:
"""Get gender by first name"""
COUNTRIES = u"""great_britain ireland usa italy malta portugal spain france
belgium luxembourg the_netherlands east... |
from unittest import TestCase
import pytest
import zmq
try:
import tornado
from tornado import gen
from zmq.eventloop import ioloop, zmqstream
except ImportError:
tornado = None
class TestZMQStream(TestCase):
def setUp(self):
if tornado is None:
pytest.skip()
self.cont... |
#!/usr/bin/env python
# Scoring program for the AutoML challenge
# Isabelle Guyon and Arthur Pesah, ChaLearn, August-November 2014
# ALL INFORMATION, SOFTWARE, DOCUMENTATION, AND DATA ARE PROVIDED "AS-IS".
# ISABELLE GUYON, CHALEARN, AND/OR OTHER ORGANIZERS OR CODE AUTHORS DISCLAIM
# ANY EXPRESSED OR IMPLIED ... |
#r# ============
#r# RLC Filter
#r# ============
#r# This example illustrates RLC Filters.
####################################################################################################
import math
import numpy as np
import matplotlib.pyplot as plt
###########################################################... |
__version__ = '1.0'
__license__ = "AGPLv3 or Proprietary (see LICENSE.txt)"
__version_info__ = (1, 0)
__author__ = 'Dan McDougall <<EMAIL>>'
__doc__ = """\
About The SSO Module
====================
sso.py is a Tornado Single Sign-On (SSO) authentication module that implements
GSSAPI authentication via python-kerberos ... |
#!/usr/bin/python
import sys, subprocess, os, ogr
def main(argv):
inputfile = argv[0]
totalpolygons = 0
# 2 get the shapefile driver
driver = ogr.GetDriverByName('ESRI Shapefile')
# 4 create a new data source and layer
fn = inputfile + '/' + inputfile + '.shp'
if os.path.exists(fn):driver.DeleteDataSource(fn... |
import numpy as np
import pandas as pd
from pyspark.sql import types as T
from . import data_path
from .utils import pandas_to_spark
# TODO: extract these from input file
CARNEGIE_YEAR = 2015 # year of release of Carnegie spreadsheet
CARNEGIE_VERSION = 13 # version number from Carnegie spreadsheet
DEFAULT_PATH = da... |
from __future__ import unicode_literals
import tempfile
import shutil
import os
from compose import config
from compose.project import Project
from compose.const import LABEL_CONFIG_HASH
from .testcases import DockerClientTestCase
class ProjectTestCase(DockerClientTestCase):
def run_up(self, cfg, **kwargs):
... |
"""Various load tests which ensure that the time for a particular process
is within a given limit.
"""
import time
from core.domain import feedback_services
from core.tests import test_utils
import feconf
class FeedbackThreadSummariesLoadTests(test_utils.GenericTestBase):
EXP_ID_1 = 'eid1'
EXPECTED_THREAD... |
import argparse
import re
import sys
from oslo_log import log
import six
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.engine import constraints
from heat.engine import resources
from heat.engine import support
LOG = log.getLogger(__name__)
class HeatCustomGuidelines(object):
_RULES... |
import deform
import colander
from pyramid.view import view_config
from dace.processinstance.core import DEFAULTMAPPING_ACTIONS_VIEWS
from pontus.default_behavior import Cancel
from pontus.form import FormView
from pontus.schema import select
from novaideo.content.processes.user_management.behaviors import (
Conf... |
import os
import numpy as np
import pandas as pd
if __name__ == '__main__':
path = "data"
aisles = pd.read_csv(os.path.join(path, "aisles.csv"), dtype={'aisle_id': np.uint8, 'aisle': 'category'})
departments = pd.read_csv(os.path.join(path, "departments.csv"),
dtype={'depart... |
"""
Handle collection of data in database with the help of SNMP
"""
import sys
from IPy import IP
from twisted.internet import defer, task
from twisted.application import internet, service
from twisted.plugin import getPlugins
from twisted.python.failure import Failure
import wiremaps.collector.equipment
from wirema... |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
"""Manage individual cells in a spreadsheet.
The Cell class is required to know its value and type, display options,
and any other features of an Excel cell. Utilities for referencing
cells using Excel's 'A1' column/row nomenclature are also p... |
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.base.payload import Payload
from pants.base.payload_field import PrimitiveField
from pants.build_graph.target import Target
class NodeTest(Target):
"""Javascript tests run via a script specified in a package.json file."""... |
# encoding: utf-8
"""
Topic: sample
Desc :
闭包
"""
__author__ = 'Xiong Neng'
def counter(start_at=0):
count = [start_at] # 使用数组是因为在内部函数内,再对这个变量赋值会报错
def incr():
# count = count + 1 # 这个就是不合法的
count[0] += 1 # 单独count赋值操作是不允许的,但是count[0]赋值是可以的。
return count[0]
ret... |
from lxml import etree
from oslo.serialization import jsonutils
import webob
from nova.api.openstack.compute.contrib import virtual_interfaces
from nova.api.openstack import wsgi
from nova import compute
from nova.compute import api as compute_api
from nova import context
from nova import exception
from nova import ne... |
#!/usr/bin/env python
# unit tests for librosa.decompose
import warnings
# Disable cache
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except:
pass
import numpy as np
import scipy.sparse
import librosa
import sklearn.decomposition
from nose.tools import raises
from test_core import srand
warnings.res... |
# coding=utf-8
"""This script will tell InaSAFE Realtime the newest shakemap available.
This script will be executed in .bash_logout script of realtime processor.
This will make the script executed after a user is pushing a shakemap.
"""
import sys
import re
import os
from datetime import datetime
from tzlocal import ... |
# -*- coding: utf-8 -*-
"""
Display status of Dropbox daemon.
Configuration parameters:
cache_timeout: refresh interval for this module (default 10)
format: display format for this module (default "Dropbox: {status}")
status_busy: text for placeholder {status} when Dropbox is busy (default None)
status... |
"""
Module containing manifolds of fixed rank matrices.
"""
from __future__ import division
import numpy as np
from pymanopt.manifolds.manifold import Manifold
from pymanopt.manifolds import Stiefel
class FixedRankEmbedded(Manifold):
"""
Note: Currently not compatible with the second order TrustRegions sol... |
import logging
import logging.handlers
RHEAFLOWLOG = '/var/log/RheaFlow'
log = logging.getLogger('RheaFlow')
log.setLevel(logging.INFO)
StdOutHandler = logging.StreamHandler()
LogFileHandler = logging.handlers.RotatingFileHandler(RHEAFLOWLOG,
maxBytes=(1048576*5),
... |
"""Convenience wrapper around Keras' MNIST and Fashion MNIST data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow.compat.v2 as tf
INPUT_SHAPE = (28, 28, 1)
NUM_CLASSES = 10
def _load_random_data(num_train_and_test... |
from lxml import etree
import webob
from nova.compute import flavors
from nova.openstack.common import jsonutils
from nova import test
from nova.tests.api.openstack import fakes
FAKE_FLAVORS = {
'flavor 1': {
"flavorid": '1',
"name": 'flavor 1',
"memory_mb": '256',
"root_gb": '10',... |
from spack import *
class Raft(CMakePackage):
"""RAFT: Reconstruct Algorithms for Tomography.
Toolbox under development at Brazilian Synchrotron Light Source."""
homepage = "https://bitbucket.org/gill_martinez/raft_aps"
url = "https://bitbucket.org/gill_martinez/raft_aps/get/1.2.3.tar.gz"
ver... |
"""
docs_mail_merge_test.py -- unit test for docs_mail_merge.py:
1. test credentials file availability
2. test whether project can connect to all 3 APIs
3. test creation (and deletion) of Google Docs file
4. test copying (and deletion) of Google Docs file
5. test getting plain text data
6. test ... |
from nova.objects import base as obj_base
from nova.objects import fields
from nova import utils
# TODO(berrange): Remove NovaObjectDictCompat
@obj_base.NovaObjectRegistry.register
class NetworkRequest(obj_base.NovaObject,
obj_base.NovaObjectDictCompat):
# Version 1.0: Initial version
# V... |
from datetime import datetime
import os
from django.conf import settings
from django.core.files.storage import default_storage
from django.views.decorators.csrf import csrf_exempt
from django.views import generic
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template ... |
__revision__ = "test/Configure/implicit-cache.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Verify that use of --implicit-cache with the Python Value Nodes
used by the Configure subsystem generate the same .sconsign file
and don't cause it to grow without limit.
This was reported as issue 2033 in t... |
import sys
import os
from setuptools import setup, find_packages
from distutils.command.sdist import sdist
from distutils.dep_util import newer
progname = 'pybtex'
from pybtex.__version__ import version
class Sdist(sdist):
def run(self):
from pybtex.database.convert import convert
bibtex_yaml = os... |
import struct
from ctypes import *
from fcntl import ioctl
# I2C C API constants (from linux kernel headers)
I2C_M_TEN = 0x0010 # this is a ten bit chip address
I2C_M_RD = 0x0001 # read data, from slave to master
I2C_M_STOP = 0x8000 # if I2C_FUNC_PROTOCOL_MANGLING
I2C_M_NOSTART = 0x4000 # if I2C_FUNC_NOSTART
I2C_M... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
postalcode = orm.QuestionDataType.objects.all().filter(js_class='wok.pollster.datatypes.PostalCode')
if not postalcode:... |
import codecs
import os
import re
import json
from . import WIKI_DIR
from collections import defaultdict
def _get_filename(slug):
return os.path.join(WIKI_DIR, '%s.md' % (slug,))
class Index(object):
def __init__(self):
self.texts, self.words = {}, set()
self.finvindex = defaultdict(set)
... |
from spack import *
class Smartdenovo(MakefilePackage):
"""SMARTdenovo is a de novo assembler for PacBio and Oxford Nanopore
(ONT) data."""
homepage = "https://github.com/ruanjue/smartdenovo"
git = "https://github.com/ruanjue/smartdenovo.git"
version('master', branch='master')
depends_... |
# tools.py
#
# Utility functions
import struct
import six
def EncodeString(str):
if len(str) > 253:
raise ValueError('Can only encode strings of <= 253 characters')
if isinstance(str, six.text_type):
return str.encode('utf-8')
else:
return str
def EncodeOctets(str):
if len(st... |
"""
transcriptstools.py module
version 2013.08.02
@author: Bing
methods and objects that store and manipulate exon and transcript information
"""
class Exon:
"""object that holds information for each exon"""
def __init__(self, line = None):
##self.correct_input = None
self.name = Non... |
"""SAX document handlers that support output generation of XML, SGML,
and XHTML.
This module provides three different groups of objects: the actual SAX
document handlers that drive the output, DTD information containers,
and syntax descriptors (of limited public use in most cases).
Output Drivers
--------------
The... |
# -*- coding : utf-8 -*-
# from __future__ import unicode_literals
import os
import re
import urllib2, urllib
import datetime
import html
from html import *
from utils import _
DEBUG=True
# print context
def header(ctx):
with HEAD as out:
if not DEBUG:
CSS(href='http://maxcdn.bootstrapcdn.... |
from __future__ import print_function
input = raw_input if hasattr(__builtins__, "raw_input") else input
import requests
import time
import uuid
import sys
import os
import socket
def get(TOKEN, endpoint):
return requests.get("https://api.digitalocean.com/v2/{}".format(endpoint),
headers={"... |
from quantum.openstack.common import cfg
core_opts = [
cfg.BoolOpt('metadata_dhcp_host_route', default=False),
]
nvp_opts = [
cfg.IntOpt('max_lp_per_bridged_ls', default=64,
help=_("Maximum number of ports of a logical switch on a "
"bridged transport zone (default 64)"))... |
team_names = {
"null": "532",
"SWA": "72",
"TSG": "2",
"GUI": "538",
"CRY": "354",
"NAN": "543",
"VFB": "10",
"ACM": "98",
"PSG": "524",
"LOR": "525",
"EIB": "278",
"AVFC": "58",
"EMP": "445",
"ESP": "80",
"WBA": "74",
"LAC": "560",
"PAL": "114",
"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
from setuptools import setup
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.search("__version__ = ['\"]([^'\"]... |
# -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import collections
import os
import platform
import re
import sys
from netrc import netrc, NetrcParseError
from ... |
"""TensorFlow-related utilities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.eager import context
from tensorflow.python.framework import composite_tensor
from tensorflow.python.framework import ops
from tensorflow.p... |
import functools
import hashlib
import hmac
from tornado import escape
from tornado.auth import OAuth2Mixin, AuthError
from tornado.concurrent import chain_future
class FacebookGraphMixin(OAuth2Mixin):
"""Facebook authentication using the new Graph API and OAuth2."""
_OAUTH_ACCESS_TOKEN_URL = "https://graph.... |
"""
Recursions are the recipe of |jedi| to conquer Python code. However, someone
must stop recursions going mad. Some settings are here to make |jedi| stop at
the right time. You can read more about them :ref:`here <settings-recursion>`.
Next to :mod:`jedi.evaluate.cache` this module also makes |jedi| not
thread-safe.... |
from ethereum import tester as t
from ethereum import utils
import sys
def test():
t.gas_price = 0
t.gas_limit = 100000000
s = t.state()
c = s.abi_contract('arbitration.se')
o = []
s.block.log_listeners.append(lambda x: o.append(c._translator.listen(x)))
x = c.mk_contract(t.a1, t.a2, [t.a3,... |
from rsqueakvm.model.pointers import W_PointersObject
from rsqueakvm.plugins.database import dbm
from rsqueakvm.error import PrimitiveFailedError
from rpython.rlib import jit
class DBType(object):
pass
NIL = DBType()
TEXT = DBType()
INTEGER = DBType()
REAL = DBType()
BLOB = DBType()
ALTER_SQL = "ALTER TABLE %s ... |
# -*- coding: utf-8 -*-
import json
import time
import logging
import requests
from .exceptions import RPCError, HttpInvalidStatusCode
from .rpc import Rpc
log = logging.getLogger(__name__)
class Http(Rpc):
""" RPC Calls
"""
def proxies(self): # pragma: no cover
proxy_url = self.get_proxy_url()... |
"""Main entry point for toolchain_build buildbots.
Passes its arguments to toolchain_build.py.
"""
import optparse
import os
import subprocess
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import pynacl.platform
import packages
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
NAC... |
"""The Request Task Agent takes request tasks created in the
TransformationDB and submits to the request management system.
The following options can be set for the RequestTaskAgent.
.. literalinclude:: ../ConfigTemplate.cfg
:start-after: ##BEGIN RequestTaskAgent
:end-before: ##END
:dedent: 2
:caption: Reques... |
import datetime
import random
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
from django.utils.hashcompat import sha_constructor
from django.utils.translation impor... |
r"""Decomposition of a netflux network into its dominant reaction pathways
.. moduleauthor:: B.Trendelkamp-Schroer <benjamin DOT trendelkamp-schroer AT fu-berlin DOT de>
"""
import warnings
import numpy as np
import scipy.sparse.csgraph as csgraph
from scipy.sparse import coo_matrix
class PathwayError(Exception):
... |
import scrapy
import MySQLdb
from bs4 import BeautifulSoup
import json
import re
import time
from math import ceil
import logging
import threading
import Queue
import ConfigParser
class TableRow( ):
"""docstring for Stock"""
def __init__(self,row):
self.row = row.encode('utf-8')
soup = BeautifulSoup... |
from .layer import Layer
import numpy as np
class local_layer(Layer):
def setup(self, ksize, c, n, stride,
pad, w_, h_, activation):
self.pad = pad * int(ksize / 2)
self.activation = activation
self.stride = stride
self.ksize = ksize
self.h_out = h_
se... |
"""Tests for ceilometer/central/manager.py
"""
import mock
from oslotest import base
from oslotest import mockpatch
from stevedore import extension
from ceilometer.agent import base as agent_base
from ceilometer.agent import manager
from ceilometer.agent import plugin_base
from ceilometer import pipeline
from ceilome... |
# -*- coding: utf-8 -*-
__doc__ = """
The manager module provides a selected classes to
handle websocket's execution.
Initially the rationale was to:
- Externalize the way the CherryPy server had been setup
as its websocket management was too tightly coupled with
the plugin implementation.
- Offer a management th... |
import sys
import wx
import lib.instructions.base.scanner as scanner
from lib.app.exceptions import InstructionSyntaxException
from lib.app.exceptions import NotFoundException
from lib.reporting.logger import Logger
from lib.reporting.logger import placeholders
from lib.guinatives.ctrlfinder import GuiExplorer
import... |
import unittest
import mock
from tests.common import get_check
class ActiveMQXMLTestCase(unittest.TestCase):
def setUp(self):
self.config = """
init_config:
instances:
- username: username
password: password
url: http://localhost:8161
"""
def test_fetch_data(self):
# not... |
#!/usr/bin/env python
########################################
# @file class.py
# @author Tushar Tiwari
# @email <EMAIL>
# @course Probabilistic Reasoning/HW4/HW4
# @prof
# @date 2015-03-07
########################################
import copy
def print_3d(item, string):
print "###############... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
import copy
from ansible.plugins.action.normal import ActionModule as _ActionModule
from ansible.utils.path import unfrackpath
from ansible.plugins import connection_loader
from ansible.module_utils.six import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.