content string |
|---|
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.db.models.sql.constants import JOIN_TYPE, LHS_ALIAS, LHS_JOIN_COL, \
TABLE_NAME, RHS_JOIN_COL
from django.utils.tree import Node
from djangotoolbox.fields import ListField
from .lookups import StandardLookup
OR = 'OR'
#... |
class Details(dict):
"""
A dict object that contains name/value pairs which provide
more detailed information about the status of the system
or the instance.
"""
def startElement(self, name, attrs, connection):
return None
def endElement(self, name, value, connection):
if n... |
from copy import deepcopy
from importlib import import_module
import pytest
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.remote.command import Command
from selenium.webdriver.remote.webdriver import WebDriver
def test_converts_oss_capabilities_to_w3c(mocker):
mock = mocker.patch('s... |
from nupic.support.enum import Enum
# TODO: This file contains duplicates of 'InferenceElement', 'InferenceType',
# and 'ModelResult' copied from nupic.frameworks.opf
# Will want to change this in the future!
class InferenceElement(Enum(
prediction="prediction",
encodings="encodings",
... |
"""Tests for the create_fake_certs management command. """
from django.test import TestCase
from django.core.management.base import CommandError
from nose.plugins.attrib import attr
from opaque_keys.edx.locator import CourseLocator
from student.tests.factories import UserFactory
from certificates.management.commands i... |
"""This module contains helper functions for correcting typos in user queries.
"""
from collections import defaultdict
from heapq import heappush, heapreplace
from whoosh import analysis, fields, highlight, query, scoring
from whoosh.automata import fst
from whoosh.compat import xrange, string_type
from whoosh.suppor... |
"""OpenSSL/M2Crypto RSA implementation."""
from .cryptomath import *
from .rsakey import *
from .python_rsakey import Python_RSAKey
#copied from M2Crypto.util.py, so when we load the local copy of m2
#we can still use it
def password_callback(v, prompt1='Enter private key passphrase:',
pro... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServerProject.
.. 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.
"""... |
import l10n_be_hr_payroll
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'configuredialog.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##########... |
"""Astroid hooks for the Python 2 standard library.
Currently help understanding of :
* hashlib.md5 and hashlib.sha1
"""
from astroid import MANAGER, AsStringRegexpPredicate, UseInferenceDefault, inference_tip
from astroid import nodes
from astroid.builder import AstroidBuilder
MODULE_TRANSFORMS = {}
# module spe... |
"""
Module for abstract serializer/unserializer base classes.
"""
from StringIO import StringIO
from django.db import models
from django.utils.encoding import smart_str, smart_unicode
from django.utils import datetime_safe
class SerializationError(Exception):
"""Something bad happened during serialization."""
... |
#!/usr/bin/env python
from setuptools import setup, find_packages
from distutils.util import convert_path
import codecs
# Load version information
main_ns = {}
ver_path = convert_path('xmlrunner/version.py')
with codecs.open(ver_path, 'rb', 'utf8') as ver_file:
exec(ver_file.read(), main_ns)
install_requires = [... |
import os
import pull_queue_snippets
TEST_PROJECT_ID = os.getenv('GCLOUD_PROJECT')
TEST_LOCATION = os.getenv('TEST_QUEUE_LOCATION', 'us-central1')
TEST_QUEUE_NAME = os.getenv('TEST_QUEUE_NAME', 'my-pull-queue')
def test_create_task():
result = pull_queue_snippets.create_task(
TEST_PROJECT_ID, TEST_QUEUE... |
"""
Stub implementation of an HTTP service.
"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import urlparse
import threading
import json
from functools import wraps
from lazy import lazy
from logging import getLogger
LOGGER = getLogger(__name__)
def require_params(method, *required_keys):
"""
... |
import os
from os.path import exists
from os.path import isdir
from os.path import join
import platform
import re
def GetSuitePaths(test_root):
def IsSuite(path):
return isdir(path) and exists(join(path, 'testcfg.py'))
return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ]
# Reads a file... |
""" Python 'hex_codec' Codec - 2-digit hex content transfer encoding
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
Written by Marc-Andre Lemburg (<EMAIL>).
"""
import codecs, binascii
### Codec APIs
def hex_enc... |
"""Provides methods needed by installation script for OpenStack development
virtual environments.
Since this script is used to bootstrap a virtualenv from the system's Python
environment, it should be kept strictly compatible with Python 2.6.
Synced in from openstack-common
"""
from __future__ import print_function
... |
import numpy as np
# import pandas as pd
import theano
import theano.tensor as T
import layers
import cc_layers
import custom
import load_data
import realtime_augmentation as ra
import time
import csv
import os
import cPickle as pickle
from datetime import datetime, timedelta
# import matplotlib.pyplot as plt
# plt.i... |
import datetime, json, csv
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User, Group, Permission
from tagging.models import Tag, TaggedItem
from laws.models import Vote, VoteAction, Bill, La... |
"""
======================================
Gradient Boosting Out-of-Bag estimates
======================================
Out-of-bag (OOB) estimates can be a useful heuristic to estimate
the "optimal" number of boosting iterations.
OOB estimates are almost identical to cross-validation estimates but
they can be compute... |
class AwsErrorCode(object):
'''AWS common error code'''
AccessDenied = 'AccessDenied'
InsufficientPrivileges = 'InsufficientPrivileges'
InvalidClientTokenId = 'InvalidClientTokenId'
InvalidParameterCombination = 'InvalidParameterCombination'
InvalidParameterValue = 'InvalidParameterValue'
In... |
from calvin.actor.actor import Actor, ActionResult, condition, guard, manage
class Alternate3(Actor):
"""
Alternating between three streams of tokens
Inputs:
token_1 : first token stream
token_2 : second token stream
token_3 : third token stream
Outputs:
token : resulting tok... |
import pytest
import aiohttp
from aiohttp import web
from aiohttp.client import _RequestContextManager
from collections.abc import Coroutine
@pytest.mark.run_loop
async def test_await(create_server, loop):
async def handler(request):
return web.HTTPOk()
app, url = await create_server()
app.rout... |
from p2pool.bitcoin import data as bitcoin_data
from p2pool.util import bases
def reads_nothing(f):
return '', f
def protoPUSH(length):
return lambda f: bitcoin_data.read(f, length)
def protoPUSHDATA(size_len):
def _(f):
length_str, f = bitcoin_data.read(f, size_len)
length = bases.string_t... |
from spack import *
class Libelf(AutotoolsPackage):
"""libelf lets you read, modify or create ELF object files in an
architecture-independent way. The library takes care of size
and endian issues, e.g. you can process a file for SPARC
processors on an Intel-based system."""
homepage = "h... |
"""Suite Files: Classes representing files
Level 1, version 1
Generated from /System/Library/CoreServices/Finder.app
AETE/AEUT resource version 0/144, language 0, script 0
"""
import aetools
import MacOS
_code = 'fndr'
class Files_Events:
pass
class alias_file(aetools.ComponentItem):
"""alias file - An a... |
import os
import subprocess
# Flags from YCM's default config.
flags = [
'-DUSE_CLANG_COMPLETER',
'-std=c++11',
'-x',
'c++',
]
def PathExists(*args):
return os.path.exists(os.path.join(*args))
def FindChromeSrcFromFilename(filename):
"""Searches for the root of the Chromium checkout.
Simply checks parent d... |
import numpy as np
from bokeh.palettes import Spectral6
def process_data():
from bokeh.sampledata.gapminder import fertility, life_expectancy, population, regions
# Make the column names ints not strings for handling
columns = list(fertility.columns)
years = list(range(int(columns[0]), int(columns[-... |
from flask.ext.wtf import Form
from wtforms import TextField, BooleanField, PasswordField, TextAreaField, SelectField
from wtforms.validators import Required, Length, email, url, Optional
import os
class RegisterForm(Form):
username = TextField('username', validators = [Required(), Length(min = 4, max = 50)])
passwo... |
from __future__ import unicode_literals
import re
import six
from django.core.exceptions import ValidationError
# Patterns from
# http://www.vero.fi/fi-FI/Syventavat_veroohjeet/Arvonlisaverotus/Kansainvalinen_kauppa/EUmaiden_arvonlisaverotunnisteet(14426)
PATTERNS = {
"AT": {
"country": "Austria",
... |
from datetime import datetime, timedelta
from six.moves.urllib.request import Request
from airflow import DAG
from airflow.operators.python import PythonOperator
from airflow.providers.jenkins.hooks.jenkins import JenkinsHook
from airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperato... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ogr2ogrclipextent.py
---------------------
Date : November 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... |
import sys
from . import constants
from .charsetprober import CharSetProber
class MultiByteCharSetProber(CharSetProber):
def __init__(self):
CharSetProber.__init__(self)
self._mDistributionAnalyzer = None
self._mCodingSM = None
self._mLastChar = [0, 0]
def reset(self):
... |
"""
Verifies file copies with a trailing slash in the destination directory.
"""
import TestGyp
test = TestGyp.TestGyp()
test.run_gyp('copies-slash.gyp', chdir='src')
test.relocate('src', 'relocate/src')
test.build('copies-slash.gyp', chdir='relocate/src')
test.built_file_must_match('copies-out-slash/directory/file3... |
# this can be used to upgrade disassemblies that aren't too annotated.
# won't do very well on the current zelda disasm.
import os
import sys
def GetPrefixLine(l, a):
for s in a:
if s[0:len(l)] == l:
return s
return ""
def GetComment(l):
comment_start = l.find("//")
if comment_start < 0:
comm... |
"""trunk_port
Revision ID: 16c8803e1cf
Revises: 544673ac99ab
Create Date: 2014-09-01 18:06:15.722787
"""
# revision identifiers, used by Alembic.
revision = '16c8803e1cf'
down_revision = '42f49dd148cd'
from alembic import op
import sqlalchemy as sa
def upgrade(active_plugins=None, options=None):
op.create_tab... |
from openerp.osv import osv
class procurement_order(osv.osv):
_inherit = "procurement.order"
def run(self, cr, uid, ids, autocommit=False, context=None):
context = dict(context or {}, procurement_autorun_defer=True)
res = super(procurement_order, self).run(cr, uid, ids, autocommit=autocommit, ... |
# -*- coding: utf-8 -*-
"""
Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
This file is part of Orion Context Broker.
Orion Context Broker is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation,... |
from sympy import symbols, oo, Sum, harmonic, Add, S, binomial, factorial
from sympy.series.limitseq import limit_seq
from sympy.series.limitseq import difference_delta as dd
from sympy.utilities.pytest import raises, XFAIL
n, m, k = symbols('n m k', integer=True)
def test_difference_delta():
e = n*(n + 1)
e... |
from __future__ import absolute_import
# Base Exceptions
class HTTPError(Exception):
"Base exception used by this module."
pass
class HTTPWarning(Warning):
"Base warning used by this module."
pass
class PoolError(HTTPError):
"Base exception for errors caused within a pool."
def __init__(se... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from . impor... |
"""
Tests that filenames that contain colons are handled correctly.
(This is important for absolute paths on Windows.)
"""
import os
import sys
import TestGyp
# TODO: Make colons in filenames work with make, if required.
test = TestGyp.TestGyp(formats=['!make', '!android'])
CHDIR = 'colon'
source_name = 'colon/a:b.c... |
from django.conf import settings
from django.http import HttpResponse
from django.db.models import Model
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import authenticate
from django.shortcuts import redirect
from django.template import TemplateDoesNotExist, RequestContext, loader
... |
#!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
from numpy.testing import *
from numpy.distutils.misc_util import appendpath, minrelpath, gpaths, rel_path
from os.path import join, sep, dirname
ajoin = lambda *paths: join(*((sep,)+paths))
class TestAppendpath(Test... |
"""Main module for admin redirect.
To use, add this to app.yaml:
builtins:
- admin_redirect: on
"""
import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
GOOGLE_SUFFIX = '.google.com'
CONSOLE_SUFFIX = '/dashboard?app_id='
APPENGINE_URL = 'https://appengine.google... |
#!/usr/bin/env python
"""
setup.py file for helium-client-python
"""
from setuptools import setup, find_packages
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext
import codecs
import versioneer
def get_ext_modules():
local_inc = 'helium_client/helium-client'
local... |
# -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
# nose, nothing here to test
__test__ = False
number_r... |
import importlib.util
import inspect
import json
import logging
import os
import sys
THREAD_CERT_DIR = './tests/scripts/thread-cert'
sys.path.append(THREAD_CERT_DIR)
import thread_cert
from pktverify.packet_verifier import PacketVerifier
logging.basicConfig(level=logging.INFO,
format='File "%(pat... |
{
'name': 'Repairs Management',
'version': '1.0',
'category': 'Manufacturing',
'description': """
The aim is to have a complete module to manage all products repairs.
====================================================================
The following topics should be covered by this module:
------------... |
from openelex.base.transform import Transform, registry
from openelex.models import RawResult
class FixVanBurenTransform(Transform):
"""
s/VanBuren/Van Buren in RawResults from the source file
20001107__ia__general__state_senate__county.csv
"""
name = 'fix_van_buren'
def __call__(self):
... |
from flask import Flask
from werkzeug.utils import import_string
class NoBlueprintException(Exception):
pass
class NoRouteModuleException(Exception):
pass
def _get_imported_stuff_by_path(path):
module_name, object_name = path.rsplit('.', 1)
module = import_string(module_name)
return module, o... |
import textwrap
from colorama import Fore, Back, Style
import colorama
colorama.init()
class Console(object):
"""
A simple way to print in a console terminal in color. Instead of using
simply the print statement you can use special methods to indicate
warnings, errors, ok and regular messages.
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# Confused? This video should help:
#
# http://bit.ly/about_assert... |
from openerp import tools
from openerp.osv import fields, osv
from openerp.addons.decimal_precision import decimal_precision as dp
class hr_expense_report(osv.osv):
_name = "hr.expense.report"
_description = "Expenses Statistics"
_auto = False
_rec_name = 'date'
_columns = {
'date': field... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.vultr import... |
import pytest
import numpy as np
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import Gaussian2DKernel
from astropy.nddata import NDData
def test_basic_nddata():
arr = np.zeros((11, 11))
arr[5, 5] = 1
ndd = NDData(arr)
test_kernel = Gaussian2DKernel(... |
from ansible import utils, errors
import os
import codecs
import csv
class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def read_csv(self, filename, key, delimiter, dflt=None, col=1):
try:
f = codecs.open(filename, 'r', encoding='utf-8'... |
from kubernetes_py.models.v1.LoadBalancerIngress import LoadBalancerIngress
from kubernetes_py.utils import is_valid_list
class LoadBalancerStatus(object):
"""
http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_loadbalancerstatus
"""
def __init__(self, model=None):
super(LoadBalancer... |
from openerp.osv import fields, osv
class res_company(osv.Model):
_name = "res.company"
_inherit = "res.company"
_columns = {
"gengo_private_key": fields.text("Gengo Private Key"),
"gengo_public_key": fields.text("Gengo Public Key"),
"gengo_comment": fields.text("Comments"... |
import numpy as np
import iir_filter
import pi_filter
class demodulator:
'General purpose demodulator that supports BPSK, QPSK and OQPSK'
def __init__(self, modulation_type, samples_per_symbol):
""" Create the classical Costas loop carrier recovery object """
# store the pa... |
import os
import sys
import getopt
import shutil
import string
# Globals
quiet = 0
test = 0
comments = 0
sysfsprefix = "/sys/devices/system/rttest/rttest"
statusfile = "/status"
commandfile = "/command"
# Command opcodes
cmd_opcodes = {
"schedother" : "1",
"schedfifo" : "2",
"lock" : "3",... |
"""Visual Studio project reader/writer."""
import gyp.common
import gyp.easy_xml as easy_xml
#------------------------------------------------------------------------------
class Tool(object):
"""Visual Studio tool."""
def __init__(self, name, attrs=None):
"""Initializes the tool.
Args:
name: To... |
#!/usr/bin/env python3
import sys
blocks = []
#
# blocks is an array of paths under which we want to block by
# default.
#
# blocks[0] = ['path' = '/sys', 'children' = [A,B] ]
# blocks[1] = ['path' = '/proc/sys', 'children' = [ E ] ]
# A = [ 'path' = 'fs', children = [C] ]
# C = [ 'path' = 'cgroup', children = [... |
"""
The PortStatCollector collects metrics about ports listed in config file.
##### Dependencies
* psutil
"""
from collections import defaultdict
import diamond.collector
try:
import psutil
except ImportError:
psutil = None
def get_port_stats(port):
"""
Iterate over connections and count states f... |
"""
Helper methods for credit card processing modules.
These methods should be shared among all processor implementations,
but should NOT be imported by modules outside this package.
"""
from django.conf import settings
from microsite_configuration import microsite
def get_processor_config():
"""
Return a dic... |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import sys
import vim
from powerline.bindings.vim import vim_get_func, vim_getoption, environ, current_tabpage, get_vim_encoding
from powerline.renderer import Renderer
from powerline.colorscheme import... |
"""Self-test suite for Crypto.Cipher.DES3"""
__revision__ = "$Id$"
from common import dict # For compatibility with Python 2.1 and 2.2
from Crypto.Util.py3compat import *
from binascii import hexlify
# This is a list of (plaintext, ciphertext, key, description) tuples.
SP800_20_A1_KEY = '01' * 24
SP800_20_A2_PT ... |
from MenuList import MenuList
from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
from enigma import eListboxPythonMultiContent, gFont
from Tools.LoadPixmap import LoadPixmap
def PluginEntryComponent(plugin, width... |
from pybuilder.core import use_bldsup
from pybuilder.core import use_plugin
from pybuilder.core import init
from pybuilder.core import task
from pybuilder.core import Author
from pybuilder.utils import assert_can_execute
import glob
import os
import shutil
use_plugin("python.core")
use_plugin("python.flake8")
us... |
"""
Traffic lights problem in Google CP Solver.
CSPLib problem 16
http://www.cs.st-andrews.ac.uk/~ianm/CSPLib/prob/prob016/index.html
'''
Specification:
Consider a four way traffic junction with eight traffic lights. Four of the
traffic
lights are for the vehicles and can be represented by the variabl... |
"""
"""
import os.path
import git
REPO_ROOT = os.path.abspath(os.path.dirname(__file__))
DATA_DIR = os.path.join(REPO_ROOT, 'data')
CURRENT_EXECUTION_VERSION = 16
NEW_AND_MODIFIED = '.'
REMOVED = '-A'
COMMIT_MSG='-m "Automated commit {index}. Running through."'.format(index=CURRENT_EXECUTION_VERSION)
VERSION_TAG = 'v1... |
import gzip
import http.server
import os
import sys
import pickle
import eris.fill3 as fill3
import eris.tools as tools
USAGE = """Usage:
eris-webserver <directory>
Example:
eris-webserver my_project
"""
def make_page(body_html, title):
return (f"<html><head><title>{title}</title></head><body><style>body ... |
__version__ = "0.2"
from PIL import Image, ImageFile, ImagePalette, _binary
i8 = _binary.i8
i16 = _binary.i16le
i32 = _binary.i32le
o8 = _binary.o8
#
# decoder
def _accept(prefix):
return len(prefix) >= 6 and i16(prefix[4:6]) in [0xAF11, 0xAF12]
##
# Image plugin for the FLI/FLC animation format. Use the <b... |
"""Integration tests for the defacl command."""
from __future__ import absolute_import
import re
from gslib.cs_api_map import ApiSelector
import gslib.tests.testcase as case
from gslib.tests.testcase.integration_testcase import SkipForS3
from gslib.tests.util import ObjectToURI as suri
PUBLIC_READ_JSON_ACL_TEXT = '... |
"""
Runs small tests.
"""
import imp
import os
import sys
import unittest
import TestGyp
test = TestGyp.TestGyp()
# Add pylib to the import path (so tests can import their dependencies).
# This is consistant with the path.append done in the top file "gyp".
sys.path.append(os.path.join(test._cwd, 'pylib'))
# Add n... |
#!/usr/bin/env python
"""
Subscribe to a feed or a datastream that is visible to the supplied Cosm user API key
To use this script you must create a text file containing your API key
and pass it to this script using the --keyfile argument as follows:
Subscribe for updates to a particular feed:
$ simple_subscribe.py ... |
# -*- coding: utf-8 -*-
"""
werkzeug.exceptions
~~~~~~~~~~~~~~~~~~~
This module implements a number of Python exceptions you can raise from
within your views to trigger a standard non-200 response.
Usage Example
-------------
::
from werkzeug.wrappers import BaseRequest
... |
from .utilities import bytes_to_le16
from .registers import CORE_REGISTER_NAMES
from .helpers import SRType
class Operand(object):
def format(self, formatter):
raise NotImplemented()
class RegisterOperand(Operand):
def __init__(self, reg, wback=False):
self._reg = reg
self._wback = wba... |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.parser import HeaderParser
from email.errors import HeaderParseError
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django.utils.encoding import force_bytes
try:
import docuti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python implementation of Huffman Coding
This script test the implementation software of Huffman Coding at \'main.py\'.
"""
__author__ = 'Ismael Taboada'
__version__= '1.0'
from collections import defaultdict
import csv
import os.path
import time
from huffman import... |
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
def expected(ini, res, ini_x, res_x):
lo2 = 0.5 * (res_x - ini_x)
alpha = (ini - res) / 4.0 / lo2**3
beta = -3.0 * alpha * lo2**2
data = [ini_x + i*(res_x - ini_x)/100 for i in range(100)]
data = [(x, alpha * (x - ini_x - lo2)*... |
import re
from PyQt5.QtCore import QUrl
from picard import PICARD_VERSION_STR
from picard.config import get_config
from picard.const import (
ACOUSTID_HOST,
ACOUSTID_KEY,
ACOUSTID_PORT,
CAA_HOST,
CAA_PORT,
)
from picard.webservice import (
CLIENT_STRING,
DEFAULT_RESPONSE_PARSER_TYPE,
r... |
#!/usr/bin/python
"""Tests for run_containers."""
import unittest
import yaml
from container_agent import run_containers
class RunContainersTest(unittest.TestCase):
def testKnownVersion(self):
yaml_code = """
version: v1beta1
"""
run_containers.CheckVersion(yaml.load(yaml_code))
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
try:
import pan.xapi
HAS_LIB = True
except ImportError:
HAS_LIB = False
def get_serial(xapi, module):
xapi.... |
"""A parser for SGML, using the derived class as a static DTD."""
# XXX This only supports those SGML features used by HTML.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tag... |
'''High-level interfaces to the Linux inotify subsystem.
The inotify subsystem provides an efficient mechanism for file status
monitoring and change notification.
The watcher class hides the low-level details of the inotify
interface, and provides a Pythonic wrapper around it. It generates
events that provide somewh... |
import json
import logging
import os
import random
import re
import tempfile
import threading
from desktop.redaction.engine import RedactionEngine, \
RedactionPolicy, \
RedactionRule, \
parse_redaction_policy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods for working with cecog
Copyright 2010 University of Dundee, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import re
import sys
from omero.cli import BaseControl, CLI
import omero
import omero.consta... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptDialog.py
---------------------
Date : December 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*******... |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from django.contrib.gis.db.models.sql.compiler import * # noqa
class SubQueryGeoSQLCompiler(GeoSQLCompiler):
def __init__(self, *args, **kwargs):
super(SubQueryGeoSQLCompiler, self).__init__(*args, **kwargs)
self.is_... |
"""
This class transforms an eXe node into a page on a single page website
"""
import logging
import re
from cgi import escape
from urllib import quote
from exe.webui.blockfactory import g_blockFactory
from exe.engine.error import Error
from exe.engine.path imp... |
from health_icd10 import * |
import server
import appuifw
import e32
import chm_filebrowser
import os
import e32dbm
CONF_FILE = u"E:\\Data\\chompy\\chompy.cfg"
INIT_FILE = u"E:\\Data\\chompy\\online.html"
LOCAL_FILE = u"E:\\Data\\chompy\\offline.html"
SEPARATOR = u"/"
INIT_HTML = u"""<html>
<body>
<script type="text/javascript">
l... |
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
import sh
import sys
from setproctitle import setproctitle
import signal
import Queue
import traceback
def run_job(sema, child_q, manager_q, provider, **settings):
aquired = False
setproctitle("tunasync-{}".format(provider.name))
def before_quit(*args):
... |
"""
Microsoft Cabinet (CAB) archive.
Author: Victor Stinner, Robert Xiao
Creation date: 31 january 2007
- Microsoft Cabinet SDK
http://msdn2.microsoft.com/en-us/library/ms974336.aspx
"""
from __future__ import absolute_import
from hachoir_py2.parser import Parser
from hachoir_py2.field import (FieldSet, Enum,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrays in the Ruby Koans
#
from runner.koan import *
class AboutLists(Koan):
def test_creating_lists(self):
empty_list = list()
self.assertEqual(list, type(empty_list))
self.assertEqual(0, len(empty_list))
def test_list... |
# python imports
import math
# 3rd party imports
import pyglet.clock
import pyglet.graphics
import pyglet.window
from pyglet.gl import * # noqa
from pyglet.window import key, mouse
from pycraft.util import sectorize, cube_vertices, normalize
from pycraft.objects.block import get_block
from pycraft.configuration impo... |
import os
import unittest
import git_config
def fixture(*paths):
"""Return a path relative to test/fixtures.
"""
return os.path.join(os.path.dirname(__file__), 'fixtures', *paths)
class GitConfigUnitTest(unittest.TestCase):
"""Tests the GitConfig class.
"""
def setUp(self):
"""Create a GitConfig obje... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.