content string |
|---|
# -*- coding: utf-8 -*-
import re
import httplib as http
import pymongo
from modularodm.exceptions import ValidationValueError
from framework.exceptions import HTTPError
# MongoDB forbids field names that begin with "$" or contain ".". These
# utilities map to and from Mongo field names.
mongo_map = {
'.': '__... |
#!/usr/bin/env python
import argparse
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import itertools
from utils.treebank import StanfordSentiment
import utils.glove as glove
from q3_sgd import load_saved_params, sgd
# We will use sklearn here because it will run faster t... |
"""Table-driven test for encode_proto op.
It tests that encode_proto is a lossless inverse of decode_proto
(for the specified fields).
"""
# Python3 readiness boilerplate
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized... |
from collections import defaultdict
import itertools
import sys
from bs4.element import (
CharsetMetaAttributeValue,
ContentMetaAttributeValue,
whitespace_re
)
__all__ = [
'HTMLTreeBuilder',
'SAXTreeBuilder',
'TreeBuilder',
'TreeBuilderRegistry',
]
# Some useful features for a Tree... |
from wtforms.utils import WebobInputWrapper
from wtforms import i18n
class DefaultMeta(object):
"""
This is the default Meta class which defines all the default values and
therefore also the 'API' of the class Meta interface.
"""
# -- Basic form primitives
def bind_field(self, form, unbound_... |
"""
=========================================
SGD: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a linear Support Vector Machines classifier
trained using SGD.
"""
print(__doc__)
import numpy as n... |
"""
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils import simpl... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from ansible.plugins.terminal import TerminalBase
from ansible.errors import AnsibleConnectionFailure
class TerminalModule(TerminalBase):
terminal_prompts_re = [
re.compile(r"[\r\n]?[\w+\-\.:\/... |
"""
Safe version of tarfile.extractall which does not extract any files that would
be, or symlink to a file that is, outside of the directory extracted in.
Adapted from:
http://stackoverflow.com/questions/10060069/safely-extract-zip-or-tar-using-python
"""
from os.path import abspath, realpath, dirname, join as joinpa... |
import time
import logging
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
class Retry(object):
""" Retry configuration.
Each retry attempt will create a new Re... |
"""Strptime-related classes and functions.
CLASSES:
LocaleTime -- Discovers and stores locale-specific time information
TimeRE -- Creates regexes for pattern matching a string of text containing
time information
FUNCTIONS:
_getlang -- Figure out what language is being used for the locale
... |
"""Import this module for easy access to TLS Lite objects.
The TLS Lite API consists of classes, functions, and variables spread
throughout this package. Instead of importing them individually with::
from tlslite.TLSConnection import TLSConnection
from tlslite.HandshakeSettings import HandshakeSettings
f... |
# nodegraph.py - nodegraphs
# CorpusDB2 - Corpus-based processing for audio.
"""
Graph of Nodes.
Nodes encapsulate audio processsing.
1:M relationship to source file (optional).
1:1 relationship to (potential) DataCollections.
"""
__version__ = '1.0'
__author__ = 'Thomas Stoll'
__copyright__... |
"""
Testing of admin inline formsets.
"""
from __future__ import unicode_literals
import random
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@pyt... |
# -*- coding: utf8 -*-
"""Post backend tests.
:license: AGPL v3, see LICENSE for more details
:copyright: 2014-2021 Joe Doherty
"""
from pjuu.auth.backend import create_account, activate
from pjuu.lib.parser import (parse_hashtags, parse_links, parse_mentions,
parse_post)
from tests im... |
from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_opts = 'GIST_GEOMETRY_OPS'
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation ... |
#DEFINE_TYPE_CODE#py
#sDEFINE_TYPE_CODE#py
# -*- coding: utf-8 -*-
import platform
import os
def main():
if int(platform.python_version_tuple()[0]) < 3:
fullPathFile = raw_input("File's path :")
else:
fullPathFile = input("File's path :")
pathFileNoExt = fullPathFile.split('.')[0]
nameFileNoExt = p... |
import getpass
class cli_impl:
ui_type = "cli_impl"
def prompt_credentials(self, service):
print "Please enter you your Credentials for %s: "%service
username = raw_input("Username: ")
password = getpass.getpass("Password: ")
return (True, username, password)
def prompt_fi... |
import sys
from pyasn1.compat.octets import null
from pysnmp.entity.rfc3413 import config
from pysnmp.proto.proxy import rfc2576
from pysnmp.proto.api import v2c
from pysnmp.proto import error
from pysnmp import nextid
from pysnmp import debug
getNextHandle = nextid.Integer(0x7fffffff)
class NotificationOriginator:
... |
from datetime import datetime
from dateutil import relativedelta
from odoo import api, fields, models, _
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
class Location(models.Model):
_name = "stock.location"
_description = "Inventory Locations"
_parent_name = "location_id"
_parent_store = True
... |
from binascii import hexlify
class HashAlgo:
"""A generic class for an abstract cryptographic hash algorithm.
:undocumented: block_size
"""
#: The size of the resulting hash in bytes.
digest_size = None
#: The internal block size of the hash algorithm in bytes.
block_size = None
... |
from __future__ import unicode_literals
import base64
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_unquote,
compat_urlparse,
)
class InfoQIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?infoq\.com/(?:[^/]+/)+(?P<id>[^/]+)'
_TESTS = [{
'url': 'http://www.... |
#!/usr/bin/env python
import os, sys, math, random
from collections import defaultdict
if sys.version_info[0] >= 3:
xrange = range
def exit_with_help(argv):
print("""\
Usage: {0} [options] dataset subset_size [output1] [output2]
This script randomly selects a subset of the dataset.
options:
-s method : method of... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""tests decoration handling functions that are used by checks"""
from translate.filters import prefilters
def test_removekdecomments():
assert prefilters.removekdecomments(u"Some sṱring") == u"Some sṱring"
assert prefilters.removekdecomments(u"_: Commenṱ\\n\nSo... |
version = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'version': {
'type': 'object',
'properties': {
'id': {'type': 'string'},
'links': {
'type': 'array',
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
class InterpreterCacheTestMixin(object):
"""A mixin to allow tests to use the "real" interpreter cache.
This is so each test doesn't waste huge amount... |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls import url, include
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSeria... |
import cv2
import matplotlib.pyplot as plt
import numpy as np
from numpy.lib.stride_tricks import as_strided
import nn
from settings import COVER_PERCENT
IMG_WIDTH = 1025
IMG_HEIGHT = 523
IMG_LAYERS = 3
SUB_IMG_WIDTH = 48
SUB_IMG_HEIGHT = 48
SUB_IMG_LAYERS = 3
WIDTH = 2
HEIGHT = 1
LAYERS = 0
XMIN = 0
YMIN = 1
XMAX ... |
# Python test set -- part 3, built-in operations.
print '3. Operations'
print 'XXX Mostly not yet implemented'
print '3.1 Dictionary lookups succeed even if __cmp__() raises an exception'
class BadDictKey:
already_printed_raising_error = 0
def __hash__(self):
return hash(self.__class__)
def _... |
import os
import mxnet as mx
import numpy as np
import pickle as pkl
def _np_reduce(dat, axis, keepdims, numpy_reduce_func):
if isinstance(axis, int):
axis = [axis]
else:
axis = list(axis) if axis is not None else range(len(dat.shape))
ret = dat
for i in reversed(sorted(axis)):
... |
from distutils.core import setup
import os
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared import version
# Mostly needed when called one level up
if os.path.isdir('client'):
client_dir = 'client'
else:
client_dir = '.'
autotest_dir = os.path.join(... |
"""
This moduel provides a class :class:`MockTarget`, an implementation of :py:class:`~luigi.target.Target`.
:class:`MockTarget` contains all data in-memory.
The main purpose is unit testing workflows without writing to disk.
"""
import multiprocessing
from io import BytesIO
import sys
import warnings
from luigi imp... |
import re
import sys
from optparse import OptionParser
import httplib
import urllib
import cgi
try:
import json
except ImportError:
import simplejson as json
namePattern = re.compile(r' \([0-9]+\)')
def clean(str):
return quoteHtml(re.sub(namePattern, "", str))
def formatComponents(str):
str = re.sub(namePa... |
import json
import logging
import re
from django.conf import settings
from django.core.urlresolvers import reverse
logger = logging.getLogger(__name__)
LEAK_RE = re.compile(r'\d+ bytes leaked \((.+)\)$')
CRASH_RE = re.compile(r'.+ application crashed \[@ (.+)\]$')
MOZHARNESS_RE = re.compile(
r'^\d+:\d+:\d+[ ]+(... |
import unittest
from kmatch import KmatchTestMixin
class MixinTestUsingMixin(KmatchTestMixin, unittest.TestCase):
def test_matches(self):
"""
Test .assertMatches() using the mixin on a true match
"""
self.assertKmatches(['<=', 'f', 0], {'f': -1})
def test_matches_raises_erro... |
class FakeWebHDFSHook:
def __init__(self, conn_id):
self.conn_id = conn_id
def get_conn(self):
return self.conn_id
def check_for_path(self, hdfs_path):
return hdfs_path
class FakeSnakeBiteClientException(Exception):
pass
class FakeSnakeBiteClient:
def __init__(self):
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
try:
from msrestazure.azure_exceptions import CloudError
except ImportError:
# This... |
import base_report
from openerp.osv import osv
class cdr(base_report.base_report):
def __init__(self, cr, uid, name, context):
super(cdr, self).__init__(cr, uid, name, context)
def set_context(self, objects, data, ids):
super(cdr, self).set_context(objects, data, ids)
self._load('cdr... |
"""check for new / old style related problems
"""
import sys
import astroid
from pylint.interfaces import IAstroidChecker, INFERENCE, INFERENCE_FAILURE, HIGH
from pylint.checkers import BaseChecker
from pylint.checkers.utils import (
check_messages,
node_frame_class,
has_known_bases
)
MSGS = {
'E1001... |
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
from ansible.module_utils.aws.core import AnsibleAWSModule
from ansible.module_utils.ec2 import compare_policies, AWSRetry
import json
try:
from botocore.exceptions import BotoCoreError, ClientError
e... |
import constants, sys
from latin1prober import Latin1Prober # windows-1252
from mbcsgroupprober import MBCSGroupProber # multi-byte character sets
from sbcsgroupprober import SBCSGroupProber # single-byte character sets
from escprober import EscCharSetProber # ISO-2122, etc.
import re
MINIMUM_THRESHOLD = 0.20
ePureAsc... |
import unittest
if __name__ == '__main__':
unittest.main() |
from webkitpy.common.checkout.changelog import ChangeLog
from webkitpy.common.config import urls
from webkitpy.tool.grammar import join_with_separators
from webkitpy.tool.steps.abstractstep import AbstractStep
class PrepareChangeLogForRevert(AbstractStep):
@classmethod
def _message_for_revert(cls, revision_li... |
from caldavclientlibrary.client.clientsession import CalDAVSession
from caldavclientlibrary.client.principal import principalCache
class CalDAVAccount(object):
def __init__(self, server, port=None, ssl=False, user="", pswd="", principal=None, root=None, logging=False):
self.session = CalDAVSession(server,... |
"""Tests for summary ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class SummaryOpsTest(tf.test.TestCase):
def _AsSummary(self, s):
summ = tf.Summary()
summ.ParseFromString(s)
return summ
def testScalarSum... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import ansible.module_utils.urls
from ansible.module_utils.basic import AnsibleModule
import... |
"""Macintosh-specific module for conversion between pathnames and URLs.
Do not import directly; use urllib instead."""
import urllib
import os
__all__ = ["url2pathname","pathname2url"]
def url2pathname(pathname):
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not r... |
import sys, os, platform, shutil
import http, http.client, http.server
import subprocess, time, threading
import json
import bpy
from netrender.utils import *
import netrender.model
import netrender.repath
import netrender.baking
import netrender.thumbnail as thumbnail
BLENDER_PATH = sys.argv[0]
CANCEL_POLL_SPEED =... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, timedelta
import re
import types
from unittest import TestCase
from django.core.exceptions import ValidationError
from django.core.validators import (
BaseValidator, EmailValidator, MaxLengthValidator, MaxValueValidator... |
"""
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.pr... |
from openerp import tools
from openerp.osv import osv
from openerp import addons
class AccountWizard_cd(osv.osv_memory):
_inherit='wizard.multi.charts.accounts'
_defaults = {
'code_digits' : 0,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""SWF Event Types
Possible Decider Events:
http://boto3.readthedocs.org/en/latest/reference/services/swf.html#SWF.Client.poll_for_decision_task
WorkflowExecutionStarted
WorkflowExecutionCancelRequested
WorkflowExecutionCompleted
CompleteWorkflowExecutionFailed
WorkflowExecutionFailed
FailWorkflowExecutionFailed
Work... |
from tempest.api.compute import base
from tempest import config
CONF = config.CONF
class NetworksTest(base.BaseComputeAdminTest):
_api_version = 2
"""
Tests Nova Networks API that usually requires admin privileges.
API docs:
http://developer.openstack.org/api-ref-compute-v2-ext.html#ext-os-netwo... |
from sympy import (
adjoint, conjugate, DiracDelta, Heaviside, nan, pi, sign, sqrt,
symbols, transpose, Symbol, Piecewise, I, S, Eq
)
from sympy.utilities.pytest import raises
from sympy.core.function import ArgumentIndexError
x, y = symbols('x y')
def test_DiracDelta():
assert DiracDelta(1) == 0
a... |
def main(request, response):
response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin") )
response.headers.set("Access-Control-Expose-Headers", "X-Request-Method")
if request.method == 'OPTIONS':
response.headers.set("Access-Control-Allow-Methods", "GET, CHICKEN, HEAD, POST,... |
"""
The PyQt4 GUI classes for the bgvdata package.
"""
from __future__ import print_function, division
import logging
from os.path import splitext
try:
from PyQt4.QtGui import QMainWindow, QDockWidget
from PyQt4 import QtCore
except ImportError:
from PyQt5.QtWidgets import QMainWindow, QDockWidget
fr... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 09:18:14 2012
Author: Josef Perktold
"""
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal
from statsmodels.stats.inter_rater import (fleiss_kappa, cohens_kappa,
to_table, aggregate_raters)
cla... |
"""
Tests of ModelAdmin system checks logic.
"""
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Album(models.Model):
title = models.CharFie... |
from __future__ import division
import StringIO
import json
import random
import sys
from twisted.internet import defer
import p2pool
from p2pool.bitcoin import data as bitcoin_data, getwork
from p2pool.util import expiring_dict, jsonrpc, pack, variable
class _Provider(object):
def __init__(self, parent, long_p... |
# -*- coding: utf-8 -*-
# Automatic provisioning of GCE Images.
import os
import libcloud.common.google
from nixops.util import attr_property
from nixops.gce_common import ResourceDefinition, ResourceState
class GCEImageDefinition(ResourceDefinition):
"""Definition of a GCE Image"""
@classmethod
def g... |
import common
import db
import model
import report
import wsgi_server
import server
#.apidoc title: RPC Services
""" Classes of this module implement the network protocols that the
OpenERP server uses to communicate with remote clients.
Some classes are mostly utilities, whose API need not be visible to
... |
import pytest
import unittest
boto3 = pytest.importorskip("boto3")
botocore = pytest.importorskip("botocore")
import ansible.modules.cloud.amazon.kinesis_stream as kinesis_stream
aws_region = 'us-west-2'
class AnsibleKinesisStreamFunctions(unittest.TestCase):
def test_convert_to_lower(self):
example =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import re
import sys
import os
import glob
from . import helper
from .mockable_test_result import MockableTestResult
from runner import path_to_enlightenment
from libs.colorama import init, Fore, Style
init() # init colorama
class Sensei(MockableTestResu... |
"""Example code to do group convolution."""
import numpy as np
import tvm
from tvm import te
from tvm import autotvm
from tvm.autotvm.task.space import FallbackConfigEntity
from tvm import topi
import tvm.topi.testing
from tvm.contrib.pickle_memoize import memoize
from tvm.topi.util import get_const_tuple
from common... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
import mock
from pants.binaries.binary_util import BinaryUtil
from pants.net.http.fetcher import Fetcher
from pants.util.contextutil import tempo... |
"""
Dutch-language mappings for language-dependent features of Docutils.
"""
__docformat__ = 'reStructuredText'
labels = {
# fixed: language-dependent
'author': 'Auteur',
'authors': 'Auteurs',
'organization': 'Organisatie',
'address': 'Adres',
'contact': 'Contact',
'version':... |
"""
raven.contrib.bottle.utils
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
from raven.utils.compat import _urlparse
from raven.utils.wsgi import get_header... |
"""Suite Microsoft Internet Explorer Suite: Events defined by Internet Explorer
Level 1, version 1
Generated from /Applications/Internet Explorer.app
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'MSIE'
class Microsoft_Internet_Explorer_Events:
def GetSource(self,... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
from traceback import format_exc
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.digit... |
from os import path as os_path
from Components.config import config, ConfigSubsection, ConfigSlider, ConfigSelection, ConfigBoolean, ConfigNothing, NoSave
# The "VideoEnhancement" is the interface to /proc/stb/vmpeg/0.
class VideoEnhancement:
firstRun = True
def __init__(self):
self.last_modes_preferred = [ ]
... |
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
import nltk
from itertools import cycle
nltk.download('punkt')
from nltk import sent_tokenize
anselmSOUP=""
idx = -1
cha_array=[]
suburl = []
verse = []
... |
##!/usr/bin/python
import numpy as np
import pylab as plt
data = np.genfromtxt(fname='t100/wf.dat')
data1 = np.genfromtxt(fname='t300/wf.dat')
data2 = np.genfromtxt(fname='t500/wf.dat')
data3 = np.genfromtxt(fname='t600/wf.dat')
data00 = np.genfromtxt('../spo_1d/t100')
data01 = np.genfromtxt('../spo_1d/t300')
data02 ... |
import json
import optparse
import os
import sys
import webgl_conformance_expectations
from telemetry import benchmark as benchmark_module
from telemetry.core import util
from telemetry.page import page_set
from telemetry.page import page as page_module
from telemetry.page import page_test
conformance_path = os.pat... |
import os
import sys
import json
from datetime import datetime
import time
import math
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import pylab as pl
import pickle
######
### Configurations
######
UUID_FILE = 'finland_ids.csv'
#DATA_FOLDER = 'VTT_week/'
DATA_FOLDER = 'data_year/'
DATA_EXT = ... |
{
"name": "MRP byproduct Operations",
"version": "1.0",
"description": """
This module allows to add the operation on BoM where the secondary products
will be produced.
""",
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
'web... |
"""This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT A... |
"""
Django settings for {{ project_name }} project.
Generated by 'django-admin startproject' using Django {{ django_version }}.
For more information on this file, see
https://docs.djangoproject.com/en/{{ docs_version }}/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.c... |
import datetime
import string
import logging
from enum import Enum
from typing import Tuple, Set, Optional, Sequence, Iterator, Iterable, TYPE_CHECKING
from colorful.fields import RGBColorField
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
... |
from __future__ import absolute_import, division, unicode_literals
import os
import sys
import unittest
import warnings
from difflib import unified_diff
try:
unittest.TestCase.assertEqual
except AttributeError:
unittest.TestCase.assertEqual = unittest.TestCase.assertEquals
from .support import get_data_files... |
from openerp.osv import fields, osv
class calendar_contacts(osv.osv):
_name = 'calendar.contacts'
_columns = {
'user_id': fields.many2one('res.users','Me'),
'partner_id': fields.many2one('res.partner','Employee',required=True, domain=[]),
'active':fields.boolean('active'),
... |
"""This module handles the JSON de/serialization of the core classes.
This is needed for both long term storage (e.g., loading/storing traces to local
files) and for short term data exchange (AJAX with the HTML UI).
The rationale of these serializers is to store data in an efficient (i.e. avoid
to store redundant inf... |
"""distutils.command.check
Implements the Distutils 'check' command.
"""
__revision__ = "$Id$"
from distutils.core import Command
from distutils.dist import PKG_INFO_ENCODING
from distutils.errors import DistutilsSetupError
try:
# docutils is installed
from docutils.utils import Reporter
from docutils.pa... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
from webkitpy.layout_tests.port import driver
import time
import shutil
class BrowserTestDriver(driver.Driver):
"""Object for running print preview test(s) using browser_tests."""
def __init__(self, port, worker_number, pixel_tests, no_timeout=False):
"""Invokes the constructor of driver.Driver."""
... |
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from typing import Text
from typing import Iterable, Optional, Sequence
from zerver.lib.actions import do_events_register
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from... |
from google.appengine.ext import webapp
from model.queuestatus import QueueStatus
class GC(webapp.RequestHandler):
def get(self):
statuses = QueueStatus.all().order("-date")
seen_queues = set()
for status in statuses:
if status.active_patch_id or status.active_bug_id:
... |
#!/usr/bin/env python
# This script outputs a Swift source with randomly-generated type definitions,
# which can be used for ABI or layout algorithm fuzzing.
# TODO: generate types with generics, existentials, compositions
from __future__ import print_function
import random
import sys
maxDepth = 5
maxMembers = 5
t... |
"""Tests for image.extract_glimpse()."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import image_ops
from ten... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Interpolate RPNSTD rec to latlon points
"""
import sys
import optparse
import numpy as np
from scipy import interpolate
import rpnpy.librmn.all as rmn
if __name__ == "__main__":
inttypelist = {
'n' : rmn.EZ_INTERP_NEAREST,
'l' : rmn.EZ_INTERP_L... |
"""Factory functions for symmetric cryptography."""
import os
import Python_AES
import Python_RC4
import cryptomath
tripleDESPresent = False
if cryptomath.m2cryptoLoaded:
import OpenSSL_AES
import OpenSSL_RC4
import OpenSSL_TripleDES
tripleDESPresent = True
if cryptomath.cryptlibpyLoaded:
impo... |
"""
Dialog that allows user to specify a new config file section name.
Used to get new highlight theme and keybinding set names.
"""
from Tkinter import *
import tkMessageBox
class GetCfgSectionNameDialog(Toplevel):
def __init__(self,parent,title,message,usedNames):
"""
message - string, informatio... |
from openerp.tests import common
class TestResetUserAccessRight(common.TransactionCase):
def setUp(self):
super(TestResetUserAccessRight, self).setUp()
self.user_obj = self.env['res.users']
def test_reset_demo_user_access_right(self):
# I get the demo user
demo_user = self.en... |
"""
Make sure we generate a manifest file when linking binaries, including
handling AdditionalManifestFiles.
"""
import TestGyp
import sys
if sys.platform == 'win32':
import pywintypes
import win32api
import winerror
RT_MANIFEST = 24
class LoadLibrary(object):
"""Context manager for loading and relea... |
'''
Collection of validators for parameters coming to pkgdb URLs.
'''
#
#pylint Explanations
#
# :E1101: SQLAlchemy monkey patches database fields into the mapper classes so
# we have to disable this when accessing an attribute of a mapped class.
# Validators also have a message() method which FormEncode adds in ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# multipermute.py - permutations of a multiset
# Erik Garrison <<EMAIL>> 2010
"""
This module encodes functions to generate the permutations of a multiset
following this algorithm:
Algorithm 1
Visits the permutations of multiset E. The permutations are stored
in a singly-lin... |
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.network import base
class PortsClient(base.BaseNetworkClient):
def create_port(self, **kwargs):
"""Creates a port on a network.
For a full list of available parameters, please refer to the official
API reference:
... |
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import floating_ips as schema
from tempest.common import service_client
class FloatingIPPoolsClient(service_client.ServiceClient):
def list_floating_ip_pools(self, params=N... |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
test_utils = local_import("test_utils")
yahoo_layer = dict(
name = "Test Yahoo Layer",
description = "Test Yahoo",
enabled = True,
created_on = datetime.datetime.now(),
modified_on = datetime.datetime.now(),
satellite_enabled = True... |
from datetime import datetime
import dateutil
from django.core.cache import cache
from django.core.urlresolvers import reverse
from corehq.apps.casegroups.models import CommCareCaseGroup
from corehq.apps.groups.models import Group
from corehq.apps.reports import util
from corehq.apps.reports.dispatcher import ProjectRe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.