content stringlengths 4 20k |
|---|
#!/usr/bin/env python3
import sys
import numpy as np
import sympy as sp
from selfdrive.locationd.models.constants import ObservationKind
from rednose.helpers.ekf_sym import EKF_sym, gen_code
from rednose.helpers.sympy_helpers import euler_rotate, quat_matrix_r, quat_rotate
EARTH_GM = 3.986005e14 # m^3/s^2 (gravita... |
from testfixtures.mock import Mock, call, ANY
from .test_compare import CompareHelper
class TestCall(CompareHelper):
def test_non_root_call_not_equal(self):
self.check_raises(
call.foo().bar(),
call.baz().bar(),
'\n'
"'call.foo().bar()'\n"
'!=\n... |
# -*- coding: iso-8859-1 -*-
"""
Regulatory Database
@copyright: 2008 Johannes Berg
@license: ISC, see LICENSE for details.
"""
import codecs, math
from dbparse import DBParser, flag_definitions
Dependencies = ["time"]
def _country(macro, countries, code):
result = []
f = macro.formatter
r... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : <EMAIL>
**... |
import argparse
import sys
import os
import pickle
from testing.tests import *
import testing.results
class ParagraphHelpFormatter(argparse.HelpFormatter):
def _fill_text(self, text, width, indent):
return "\n\n".join([
super(ParagraphHelpFormatter, self)._fill_text(p, width, indent) \
... |
#coding:utf-8
import functools
from cactus.utils.internal import getargspec
from cactus.plugin import defaults
class PluginManager(object):
def __init__(self, site, loaders):
self.site = site
self.loaders = loaders
self.reload()
for plugin_method in defaults.DEFAULTS:
... |
import string
def splitinput(filename):
with open(filename) as ciphertext:
return [int(x) for x in ciphertext.read().split(",")]
def findtext(cipher):
letterlist = list(string.ascii_lowercase)
lenllist = len(letterlist)
output = ''
# top 5 common English words
common = ["the", "be", "t... |
import unittest
import os
import comm
import commands
class TestCrosswalkApptoolsFunctions(unittest.TestCase):
def test_build_release(self):
comm.setUp()
comm.create(self)
os.chdir('org.xwalk.test')
buildcmd = comm.PackTools + "crosswalk-app build release"
comm.build(self,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import hashlib
import urllib
import urllib2
import time
PASS_FILE = 'data/password.txt'
URL = 'http://hydroh.xyz/koi/db/dbquery.php'
class PHPQuery(object):
# 获取页面源码
@staticmethod
def parse_query(date, keyword, article):
# 过滤UTF8MB4预处理
... |
"""Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises, assert_rais... |
import hashlib
import itertools
import logging
import os
import re
from openerp import tools
from openerp.osv import fields,osv
from openerp import SUPERUSER_ID
_logger = logging.getLogger(__name__)
class ir_attachment(osv.osv):
"""Attachments are used to link binary files or url to any openerp document.
Ex... |
DATE_FORMAT = r'j \de N \de Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = r'j \de N \de Y à\s H:i'
YEAR_MONTH_FORMAT = r'F \de Y'
MONTH_DAY_FORMAT = r'j \de F'
SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
FIRST_DAY_OF_WEEK = 0 # Sunday
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '200... |
"""Test access control package."""
from __future__ import absolute_import, print_function
import uuid
from cds.modules.access.access_control import cern_read_factory
from flask import g
from flask_principal import RoleNeed, UserNeed
from invenio_records.api import Record
from cds.modules.access.access_control import... |
from commit import _get_service_file
import jsonschema
import subprocess
import fnmatch
import os
from fileio import dirio
from log import log
import glob
import tempfile
import stat
_action_schema = {
'type': 'object',
'properties': {
'commands': {
'description': 'commands to run',
... |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from tinycss.css21 import CSS21Parser, ParseError
class FontFaceRule(objec... |
import numpy as np
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from PyKEP import epoch, DAY2SEC, planet_ss, AU, MU_SUN, lambert_problem
from PyKEP.orbit_plots import plot_planet, plot_lambert
mpl.rcParams['legend.fontsize'] = 10
fig = plt.figure()
ax ... |
"""
EasyBuild support for software that uses the GNU installation procedure,
i.e. configure/make/make install, implemented as an easyblock.
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@autho... |
import json
import re
class Base(object):
def __init__(self, test, test_client):
self.test_client = test_client
self.test = test
self._endpoint = None
self.params = None
self.status_code = None
self.response = None
self.headers = None
self.route = No... |
"""Provide pre-made queries on top of the recorder component."""
from __future__ import annotations
from collections import defaultdict
from itertools import groupby
import logging
import time
from sqlalchemy import and_, bindparam, func
from sqlalchemy.ext import baked
from homeassistant.components import recorder
... |
import numpy as np
import scipy.ndimage as ndi
from moviepy.video.VideoClip import ImageClip
def findObjects(clip,rem_thr=500, preview=False):
"""
Returns a list of ImageClips representing each a separate object on
the screen.
rem_thr : all objects found with size < rem_Thr will be
... |
from nailgun.test.base import BaseTestCase
from volume_manager.models.node_volumes import NodeVolumes
from volume_manager.objects.volumes import VolumeObject
class TestExtension(BaseTestCase):
def test_delete_by_node_ids(self):
volumes = [
{'node_id': 1, 'volumes': 'volume_1'},
{... |
"""AtomPubClient provides CRUD ops. in line with the Atom Publishing Protocol.
"""
__author__ = '<EMAIL> (Jeff Scudder)'
import atom.http_core
class AtomPubClient(object):
host = None
auth_token = None
def __init__(self, http_client=None, host=None,
auth_token=None, source=None, **kwargs):
... |
#!/usr/bin/env python
#
# $Id: ncurses.py 66424 2008-09-13 01:22:08Z andrew.kuchling $
#
# (n)curses exerciser in Python, an interactive test for the curses
# module. Currently, only the panel demos are ported.
import curses
from curses import panel
def wGetchar(win = None):
if win is None: win = stdscr
retur... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Polygonize.py
---------------------
Date : March 2013
Copyright : (C) 2013 by Piotr Pociask
Email : ppociask at o2 dot pl
*******************************... |
# vi: sw=4 ts=4 et:
"""network.py - cMonkey network module
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.
"""
import numpy as np
import logging
import os.path
import cmonkey.util as util
import cmonkey.datamatrix as dm
import cmonkey.scoring as scoring
... |
"""Test rescan behavior of importaddress, importpubkey, importprivkey, and
importmulti RPCs with different types of keys and rescan options.
In the first part of the test, node 1 creates an address for each type of
import RPC call and node 0 sends BTC to it. Then other nodes import the
addresses, and the test makes li... |
import traceback
import unittest
import mock
from .....base import PulpServerTests
from pulp.common.plugins import distributor_constants
from pulp.devel import mock_plugins
from pulp.server import exceptions as pulp_exceptions
from pulp.server.controllers import repository as repo_controller
from pulp.server.db impor... |
import inspect, pathlib, shutil, os, runpy, urllib.parse, shlex, doctest, re, io, hashlib, base64, treelog, stringly
import docutils.nodes, docutils.parsers.rst, docutils.statemachine
import sphinx.util.logging, sphinx.util.docutils, sphinx.addnodes
import nutils.matrix, nutils.testing
import numpy
project_root = path... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.facts.collector import BaseFactCollector
class Hardware:
platform = 'Generic'
# FIXME: remove load_on_init when we can
def __init__(self, module, load_on_init=False):
self.module = m... |
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
class hr_applicant_settings(osv.TransientModel):
_name = 'hr.config.settings'
_inherit = ['hr.config.settings', 'fetchmail.config.settings']
_columns = {
'module_document': fields.boolean('Allow the automatic indexation of resum... |
"""This file contains the grpc implementation of the vtctl client.
"""
import datetime
from urlparse import urlparse
from vtdb import prefer_vtroot_imports # pylint: disable=unused-import
import grpc
import vtctl_client
from vtproto import vtctldata_pb2
from vtproto import vtctlservice_pb2
class GRPCVtctlClient... |
"""
This module contains a base type which provides list-style mutations
without specific data storage methods.
See also http://www.aryehleib.com/MutableLists.html
Author: Aryeh Leib Taurog.
"""
from django.utils import six
from django.utils.functional import total_ordering
from django.utils.six.moves import range
... |
from django.db.models.loading import get_model
from metadata.utils.date_range import in_range
from django.shortcuts import render
from django.utils import simplejson
from django.http import Http404, HttpResponse
from django.conf import settings
from schedule.utils import range as s_range
import csv
import json
# Th... |
from random import choice as fsample
sarcastic_responses = ["Yeah right","What do I look like to you?","Are you kidding me?",#UsF
"As much as you","You don't believe that yourself","When pigs fly",#UsF
"Like your grandma","You would like to know, wouldn't you?", #UsF
... |
#!/usr/bin/python
#create patch files for ShooterPlayer
#
#
#
import glob
import optparse
import os
import re
import shutil
import sys
import hashlib
import subprocess
import gzip
import shutil
def createGzipFile(inname, outname):
f_in = open(inname, 'rb')
f_out = gzip.open(outname, 'wb'... |
import math
import m5
from m5.objects import *
from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
#
class L1Cache(RubyCache):
latency = 3
#
# Note: the L2 Cache latency is not currently used
#... |
"""Settings file for the Django project used for tests."""
import os
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
PROJECT_NAME = 'project'
# Base paths.
ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT = os.path.join(ROOT, PROJECT_NAME)
# Django configuration.
DATABASES = {'default... |
import os
try:
from hashlib import sha1 as sha
except ImportError:
from sha import sha
from time import time
try:
getpid = os.getpid
except AttributeError:
def getpid():
return 1
from BitTorrent import version
def make_id():
myid = 'M' + version.split()[0].replace('.', '-')
myid = myid... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Service'
db.create_table('cabotapp_service', (
('id', self.gf('django.db.models.... |
# -*- coding: utf-8 -*-
import numpy as np
from pygsp.graphs import NNGraph # prevent circular import in Python < 3.5
class Cube(NNGraph):
r"""Hyper-cube (NN-graph).
Parameters
----------
radius : float
Edge lenght (default = 1)
nb_pts : int
Number of vertices (default = 300)
... |
#
# TreeFragments - parsing of strings to trees
#
import re
from StringIO import StringIO
from Scanning import PyrexScanner, StringSourceDescriptor
from Symtab import ModuleScope
import PyrexTypes
from Visitor import VisitorTransform
from Nodes import Node, StatListNode
from ExprNodes import NameNode
import Parsing
im... |
from collections import defaultdict
from itertools import chain
from django.utils.translation import gettext_lazy as _
from weblate.addons.base import BaseAddon
from weblate.addons.events import EVENT_POST_COMMIT
from weblate.addons.forms import GitSquashForm
from weblate.utils.errors import report_error
from weblate... |
# -*- coding: utf-8 -*-
from __future__ import print_function
# Form implementation generated from reading ui file './acq4/analysis/modules/AtlasBuilder/ctrlTemplate.ui'
#
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUt... |
r"""
Counts words in UTF8 encoded, '\n' delimited text received from the network.
Usage: structured_network_wordcount.py <hostname> <port>
<hostname> and <port> describe the TCP server that Structured Streaming
would connect to receive data.
To run this on your local machine, you need to first run a Netcat se... |
# -*- coding: utf-8 -*-
"""
hpack/hpack_compat
~~~~~~~~~~~~~~~~~~
Provides an abstraction layer over two HPACK implementations.
This module has a pure-Python greenfield HPACK implementation that can be used
on all Python platforms. However, this implementation is both slower and more
memory-hungry than could be achie... |
import platform
import os
import mock
import hypothesis as h
import hypothesis.strategies as hs
import pytest
from .. import manifest, item, sourcefile, utils
def SourceFileWithTest(path, hash, cls, *args):
s = mock.Mock(rel_path=path, hash=hash)
test = cls(s, utils.rel_path_to_url(path), *args)
s.man... |
import sys, traceback
import mal_readline
import mal_types as types
import reader, printer
from env import Env
import core
# read
def READ(str):
return reader.read_str(str)
# eval
def eval_ast(ast, env):
if types._symbol_Q(ast):
return env.get(ast)
elif types._list_Q(ast):
return types._li... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.rdf
~~~~~~~~~~~~~~~~~~~
Lexers for semantic web and RDF query languages and markup.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups... |
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class SoundCloudAccount(ProviderAccount):
def get_profile_url(self):
return self.account.extra_data.get('permalink_url')
def get_avatar_url(self):
return... |
from django.shortcuts import render, HttpResponseRedirect, Http404
from django.contrib.auth import logout, login, authenticate
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from django... |
"""This modules stubs out functions in oslo_concurrency.processutils."""
import re
from eventlet import greenthread
from oslo_concurrency import processutils
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
_fake_execute_repliers = []
_fake_execute_log = []
def fake_execute_get_log():
ret... |
"""KeyChainParser for "hint" and "normal" modes.
Module attributes:
STARTCHARS: Possible chars for starting a commandline input.
"""
import typing
import traceback
import enum
from PyQt5.QtCore import pyqtSlot, Qt, QObject
from PyQt5.QtGui import QKeySequence, QKeyEvent
from qutebrowser.browser import hints
fro... |
import os, sys
from optparse import make_option
from django.contrib.gis import gdal
from django.contrib.gis.management.base import ArgsCommand, CommandError
def layer_option(option, opt, value, parser):
"""
Callback for `make_option` for the `ogrinspect` `layer_key`
keyword option which may be an integer o... |
"""
this file contains methods common to all init-install files
"""
import sqlite3
import sys
def success(msg):
"""
Print a standardized success message
@type msg: String
@param msg: the message to print
"""
print "\033[32mSUCCESS: %s\033[0m" % msg
def warn(msg):
"""
Print a standardi... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import cgi
def main():
module = AnsibleModule(
argument_spec=dict(
subscription=dict(required=True),
token=dict(required=True, no_log=True),
... |
import optparse
def analyze(inputText):
values = {'a':0,'b':0,'c':0,'d':0,
'e':0,'f':0,'g':0,'h':0,
'i':0,'j':0,'k':0,'l':0,
'm':0,'n':0,'o':0,'p':0,
'q':0,'r':0,'s':0,'t':0,
'u':0,'v':0,'w':0,'x':0,
'y':0,'z':0}
for line in inputText:
for char in line:
for key, value in values.iteri... |
"""
#;+
#; NAME:
#; ionic_clm
#; Version 1.0
#;
#; PURPOSE:
#; Module for ionic column densities in Abs Systems
#; 28-Oct-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, division, unicode_literals
impo... |
# Design a data structure that supports all following operations in average O(1) time.
#
# insert(val): Inserts an item val to the set if not already present.
# remove(val): Removes an item val from the set if present.
# getRandom: Returns a random element from current set of elements. Each element must have the same p... |
"""
Websocket proxy that is compatible with OpenStack Nova
SPICE HTML5 consoles. Leverages websockify.py by Joel Martin
"""
import sys
from oslo_config import cfg
from nova.cmd import baseproxy
from nova import config
opts = [
cfg.StrOpt('html5proxy_host',
default='0.0.0.0',
help=... |
from __future__ import division, unicode_literals
"""
Development script to test the algorithms of a given model coordination environments
"""
__author__ = "David Waroquiers"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "2.0"
__maintainer__ = "David Waroquiers"
__email__ = "<EMAIL>"
__date__ ... |
# coding: utf8
{
'!=': '!=',
'!langcode!': 'ro',
'!langname!': 'Română',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" (actualizează) este o expresie opțională precum "câmp1=\'valoare_nouă\'". Nu puteți actualiza sau șterge rezultatele unui... |
from rope.base import pynames, evaluate, exceptions, worder
from rope.refactor.rename import Rename
class LocalToField(object):
def __init__(self, project, resource, offset):
self.project = project
self.pycore = project.pycore
self.resource = resource
self.offset = offset
def... |
import time
from datetime import datetime
from openerp.osv import fields, osv
from openerp import tools
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class account_analytic_account(osv.osv):
_name = 'account.analytic.account'
_inherit = ['mail.thread']
_description = ... |
import bisect
import re
import token
import tokenize
class ChangeCollector(object):
def __init__(self, text):
self.text = text
self.changes = []
def add_change(self, start, end, new_text=None):
if new_text is None:
new_text = self.text[start:end]
self.changes.appe... |
""" ID3 Decision Trees
contains an implementation of the ID3 decision tree algorithm
as described in Tom Mitchell's book "Machine Learning"
It relies upon the _Tree.TreeNode_ data structure (or something
with the same API) defined locally to represent the trees
"""
import numpy
from rdkit.ML.DecTree impo... |
"""Converts assert statements to their corresponding TF calls."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gast
from tensorflow.python.autograph.core import converter
from tensorflow.python.autograph.pyct import templates
class AssertTransf... |
"""
missing types & inference
"""
from functools import partial
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import NaT, Period, iNaT
from pandas._typing import ArrayLike, DtypeObj
from pandas.core.dtypes.com... |
#!/usr/bin/env python
# coding: utf-8
# originally from:
# http://www.warp1337.com/content/how-use-ctest-jenkins-xunit-or-junit-plugin
# improved by:
# Jorge Araya Navarro <<EMAIL>>
# Veni, Sancte Spiritus.
from lxml import etree
import argparse
from os.path import expanduser
from os.path im... |
# -*- coding: utf-8 -*-
from src import icons, __version__
from src.actions import HOST_URL
from src.actions.branches import BranchesWorkflowAction
from src.actions.configure import ConfigureWorkflowAction
from src.actions.help import HelpWorkflowAction
from src.actions.index import IndexWorkflowAction
from src.actions... |
from openerp.osv import fields, osv
class pos_configuration(osv.TransientModel):
_inherit = 'res.config.settings'
_name = 'pos.config.settings'
_columns = {
'module_pos_restaurant': fields.selection([
(0, "Point of sale for shops"),
(1, "Restaurant: activate table managemen... |
"""Python wrapper for the Block GRU Op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.rnn.ops import gen_gru_ops
from tensorflow.contrib.util import loader
from tensorflow.python.framework import ops
from tensorflow.python.ops im... |
from protorpc import messages
from protorpc import message_types
from app.product import messages as product
from app.customer import messages as customer
__author__ = "Marcos Salomão"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2016, Marcos Salomão"
__license__ = "Apache 2.0"
class SaleKeyMessage(messages.Mess... |
"""
============================================================
Empirical evaluation of the impact of k-means initialization
============================================================
Evaluate the ability of k-means initializations strategies to make
the algorithm convergence robust as measured by the relative stan... |
"""
Bitmap is a basic wrapper for image pixels. It includes some basic processing
tools: crop, find bounding box of a color and compute histogram of color values.
"""
import array
import base64
import cStringIO
import struct
import subprocess
from telemetry.core import util
from telemetry.core import platform
from te... |
"""
Test generate_user_config.py.
"""
import argparse
import os
import shutil
import sys
import tempfile
import test_variables
import unittest
import utils
sys.path.append(test_variables.GYP_GEN_DIR)
from generate_user_config import generate_user_config as gen_config
# Name of SkUserConfig file.
USER_CONFIG_NAME = ... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsPoint.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author... |
from __future__ import absolute_import, division, print_function
import mxnet as mx
import mxnet.ndarray as nd
import numpy
import copy
from utils import get_numpy_rng
class ReplayMemory(object):
def __init__(self, history_length, memory_size=1000000, replay_start_size=100,
state_dim=(), action_... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import re
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import ConnectionError
from ansible.module_utils.network.common.utils import to_list
from ansible.plugins.httpapi import Http... |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Rapidtube
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from cor... |
"""
Class used for defining and running Bok Choy acceptance test suite
"""
from time import sleep
from paver.easy import sh
from pavelib.utils.test.suites.suite import TestSuite
from pavelib.utils.envs import Env
from pavelib.utils.test import bokchoy_utils
from pavelib.utils.test import utils as test_utils
try:
... |
import unittest
import numpy as np
import numpy.testing as npt
import os
import shutil
from pymc3.tests import models
from pymc3.backends import base
class ModelBackendSetupTestCase(unittest.TestCase):
"""Set up a backend trace.
Provides the attributes
- test_point
- model
- strace
- draws
... |
from __future__ import with_statement, print_function
import unittest
from plumbum.colorlib.styles import ANSIStyle, Color, AttributeNotFound, ColorNotFound
from plumbum.colorlib.names import color_html, FindNearest
class TestNearestColor(unittest.TestCase):
def test_exact(self):
self.assertEqual(FindNear... |
import base64
from appengine_wrappers import urlfetch
from future import Future
class _AsyncFetchDelegate(object):
def __init__(self, rpc):
self._rpc = rpc
def Get(self):
return self._rpc.get_result()
def _MakeHeaders(username, password):
headers = { 'Cache-Control': 'max-age=0' }
if username is not... |
class Queue:
"""
A simple implementation of a queue.
"""
def __init__(self):
"""
Initializes an empty queue.
"""
self._first = None
self._last = None
self._length = 0
class Node:
"""
A single element of the linked list.
"""
... |
"""Functions for computing statistics of samples."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tenso... |
from openerp.osv import osv
from openerp.report import report_sxw
class fiche_paye_parser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(fiche_paye_parser, self).__init__(cr, uid, name, context)
self.localcontext.update({
'lang': "fr_FR",
'get_pay... |
import socket
import PDU
import time
import DULparameters
# Finite State machine action definitions
import logging
logger = logging.getLogger(__name__)
def AE_1(provider):
# Issue TRANSPORT CONNECT request primitive to local transport service
provider.RemoteClientSocket = socket.socket(
socket.AF_INE... |
""" Module with the always_seq decorator. """
from __future__ import absolute_import
from types import FunctionType
from myhdl import AlwaysError, intbv
from myhdl._util import _isGenFunc
from myhdl._Signal import _Signal, _WaiterList, _isListOfSigs
from myhdl._always import _Always, _get_sigdict
from myhdl._instanc... |
import hr_recruitment_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import os
from xml.dom.minidom import parse
import re
import numpy as np
from ...utils import _pl
def _extract(tags, filepath=None, obj=None):
"""Extract info from XML."""
if obj is not None:
fileobj = obj
elif filepath is not None:
fileobj = parse(filepath)
else:
raise Value... |
"""Interfaces implemented by data sets used in Face-layer tests."""
import abc
# cardinality is referenced from specification in this module.
from grpc.framework.common import cardinality # pylint: disable=unused-import
class Method(object):
"""An RPC method to be used in tests of RPC implementations."""
__met... |
"""Tests for learn.dataframe.transforms.example_parser."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from google.protobuf import text_format
from tensorflow.contrib.learn.python.learn.dataframe.transforms i... |
"""phone number m2m
Revision ID: 2bd538139427
Revises: a1f4cdc4aa
Create Date: 2015-07-10 17:43:05.337612
"""
# revision identifiers, used by Alembic.
revision = '2bd538139427'
down_revision = 'a1f4cdc4aa'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
###... |
import os
from datasource import datasource
from xml.dom import minidom
from xml.dom.minidom import Document
from input import inputText
class satxml(datasource):
def __init__(self, filename = "satellites.xml"):
self.filename = filename
datasource.__init__(self)
if not os.path.isfile(filename):
print "File ... |
"""Cache module for site statistics."""
import json
import pygeoip
from sqlalchemy.sql import text
from flask import current_app
from pybossa.core import db
from pybossa.cache import cache, ONE_DAY
session = db.slave_session
@cache(timeout=ONE_DAY, key_prefix="site_n_auth_users")
def n_auth_users():
"""Return n... |
import logging
import alembic
from alembic import autogenerate as autogen
from alembic import context
from alembic import op
import sqlalchemy
from sqlalchemy import schema as sa_schema
import sqlalchemy.sql.expression as expr
from sqlalchemy.sql import text
from sqlalchemy import types
from neutron.db.migration.mod... |
import os
import tempfile
from ansible.module_utils import basic
from units.compat import unittest
from ansible.module_utils._text import to_bytes
from ansible.module_utils.basic import AnsibleModule
from ansible.modules.system.known_hosts import compute_diff, sanity_check
class KnownHostsDiffTestCase(unittest.Test... |
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.memset import get_zone_id
from ansible... |
from a10sdk.common.A10BaseClass import A10BaseClass
class FileList(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param file: {"type": "string", "format": "string"}
:param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/devi... |
# -*- coding: utf-8 -*-
"""
website.vpn.sts.views
~~~~~~~~~~~~~~~~~~~~~
vpn sts views:
/vpn/sts/add
/vpn/sts/<int:id>
/vpn/sts/<int:id>/settings
"""
from flask import Blueprint, render_template
from flask import url_for, redirect
from flask import flash
from website.vpn.sts.forms ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.