content stringlengths 4 20k |
|---|
"""fuse_gtest_files.py v0.2.0
Fuses Google Test source code into a .h file and a .cc file.
SYNOPSIS
fuse_gtest_files.py [GTEST_ROOT_DIR] OUTPUT_DIR
Scans GTEST_ROOT_DIR for Google Test source code, and generates
two files: OUTPUT_DIR/gtest/gtest.h and OUTPUT_DIR/gtest/gtest-all.cc.
Then yo... |
from src.common.utils import run_cmd, debugger, BYTES_IN_GIGABYTE
from src.common.errors import UNMOUNT_ERROR, FORMAT_ERROR, EJECT_ERROR
class disk_error(Exception):
pass
def get_disks_list():
'''
This method is used by the BurnerGUI when the user clicks the ComboBox.
It grabs all disk ids and then... |
#!/usr/bin/env python3
import os
import json
import sys
from io import open
from shutil import rmtree
from collections import OrderedDict
if len(sys.argv) == 1 or not sys.argv[1]:
raise SystemExit('Build dir missing.')
def mkdirs(path):
try:
os.makedirs(path)
finally:
return os.path.exis... |
""" Peripheral On Demand global define
"""
import periphondemand
#global
POD_CONFIG="~/.podrc"
POD_PATH = periphondemand.__path__[0]
PLATFORMPATH = "/platforms"
BUSPATH = "/busses/"
TEMPLATESPATH = "/templates"
TOOLCHAINPATH = "/toolchains"
SIMULATIONPATH = "/simulation"
SYNTHESISPATH = "/synthesis"
DRIVERSPATH = "/... |
import os
from setuptools.command import easy_install
from pbr.hooks import base
from pbr import options
from pbr import packaging
class CommandsConfig(base.BaseConfig):
section = 'global'
def __init__(self, config):
super(CommandsConfig, self).__init__(config)
self.commands = self.config.... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './pyqtgraph/imageview/ImageViewTemplate.ui'
#
# by: PyQt5 UI code generator 5.0.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
... |
from psa_functions_numeric import *
from psa_functions_symbolic import *
SourceI = 1e25
SigmaXSource = 1e-1
SigmaYSource = 1e-2
SigmaYPSource = 10**-4
SigmaXPSource = 3e-5
GammaSource = 0
SigmaSLambda = 1e-3
bMonoX = 1
bMonoY = 1
CoefMonoX = 1
CoefMonoY = 1
CoefAtten = 1
# distances
z0 = 32000
z1 = 3000
ListDistance ... |
from config import *
import subprocess
from subprocess import Popen, PIPE, STDOUT
if DISPLAY_MUSCOD:
d=" -X "
else:
d=" "
#cmd = "ssh"+d+"iwaki 'cd "+MUSCOD_DIR+" ; source /local/pfernbac/config.sh ; muscod_release "+DAT_NAME+" ; killall pgxwin_server '"
#cmd = "ssh -X iwaki 'cd /local/pfernbac/muscod/walk/uc-dua... |
# coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
HEADRequest,
ExtractorError,
int_or_none,
)
class TFOIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tfo\.org/(?:en|fr)/(?:[^/]+/){2}(?P<id>\d+)'
_TEST = {
'ur... |
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def cloud_load_balancer(module, state, name, meta, algorithm, port, protocol,
vip_type, timeout, wait, wait_timeout, vip_id):
if int(timeout) < 30:
module.fail_json(msg='"timeout" must be greater t... |
from Queue import Queue
from threading import Thread, Lock, Event
from ncclient.xml_ import *
from ncclient.capabilities import Capabilities
from errors import TransportError
import logging
logger = logging.getLogger('ncclient.transport.session')
class Session(Thread):
"Base class for use by transport protocol... |
import pytest
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.by import By
class TestRenderedWebElement(object):
@pytest.mark.xfail_marionette(
reason='https://github.com/w3c/webdriver/issues/417')
def testShouldPickUpStyleOfAnElement(self, driver, pages):
... |
from .features import RegexMatches, Stopwords
name = "turkish"
try:
from nltk.corpus import stopwords as nltk_stopwords
stopwords = set(nltk_stopwords.words('turkish'))
except LookupError:
raise ImportError("Could not load stopwords for {0}. ".format(__name__) +
"You may need to inst... |
from constants import eStart, eError, eItsMe
# BIG5
BIG5_cls = ( \
1,1,1,1,1,1,1,1, # 00 - 07 #allow 0x00 as legal value
1,1,1,1,1,1,0,0, # 08 - 0f
1,1,1,1,1,1,1,1, # 10 - 17
1,1,1,0,1,1,1,1, # 18 - 1f
1,1,1,1,1,1,1,1, # 20 - 27
1,1,1,1,1,1,1,1, # 28 - 2f
1,1,1,1,1,1,1,1, # 30 - ... |
"""Poll statistics from the server."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import argparse
import grpc
from grpc_channelz.v1 import channelz_pb2
from grpc_channelz.v1 import channelz_pb2_grpc
def run(addr):
with grpc.insecur... |
# coding: utf-8
import flask
import auth
import model
import util
from main import app
instagram_config = dict(
access_token_method='POST',
access_token_url='https://api.instagram.com/oauth/access_token',
authorize_url='https://instagram.com/oauth/authorize/',
base_url='https://api.instagram.com/v1',
cons... |
class _GetchUnix:
def __init__(self):
import tty, sys
def __call__(self):
import sys, tty, termios
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
finally:
... |
"""Initialize models module."""
from .address import *
from .institution import *
from .user import *
from .event import *
from .invite import *
from .invite_institution import *
from .invite_institution_children import *
from .invite_institution_parent import *
from .invite_user import *
from .invite_user_adm import *... |
"""Simple logging storage backend.
"""
from ceilometer.openstack.common import log
from ceilometer.storage import base
LOG = log.getLogger(__name__)
class LogStorage(base.StorageEngine):
"""Log the data
"""
def get_connection(self, conf):
"""Return a Connection instance based on the configurati... |
from gnuradio import gr, gr_unittest, blocks
import os
from threading import Timer
class test_udp_sink_source(gr_unittest.TestCase):
def setUp(self):
os.environ['GR_CONF_CONTROLPORT_ON'] = 'False'
self.tb_snd = gr.top_block()
self.tb_rcv = gr.top_block()
def tearDown(self):
s... |
import re
import volatility.obj as obj
import volatility.plugins.filescan as filescan
import volatility.win32.modules as modules
import volatility.win32.tasks as tasks
import volatility.utils as utils
import volatility.plugins.malware.malfind as malfind
#----------------------------------------------------------------... |
"""
This config file extends the test environment configuration
so that we can run the lettuce acceptance tests.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .test import *
from .sauce import *
# You ... |
from collections import defaultdict
# 3rd party
from boto.s3.connection import S3Connection
import simplejson as json
# project
from checks import AgentCheck
from config import _is_affirmative
def multidict(ordered_pairs):
"""Convert duplicate keys values to lists."""
# read all values into lists
d = de... |
""" sysbench_test_execution:
code related to the execution of sysbench test cases
We are provided access to a testManager with
sysbench-specific testCases.
"""
# imports
import os
import re
import sys
import subprocess
import commands
import lib.test_mgmt.test_execution as test_execution
class ... |
"""Command for to list all of a project's service accounts."""
from apitools.base.py import list_pager
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.command_lib.iam import base_classes
from googlecloudsdk.command_lib.iam import iam_util
from googlecloudsdk... |
from functools import wraps
from operator import attrgetter
from django.db import connections, transaction, IntegrityError
from django.db.models import signals, sql
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.utils.datastructures import SortedDict
class ProtectedError(IntegrityErro... |
import py, pytest
from _pytest.mark import MarkGenerator as Mark
class TestMark:
def test_markinfo_repr(self):
from _pytest.mark import MarkInfo
m = MarkInfo("hello", (1,2), {})
repr(m)
def test_pytest_exists_in_namespace_all(self):
assert 'mark' in py.test.__all__
asse... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from accounts.views import (ProfileEditView, ProfileView, UserSearchView,
TimtecUserViewSet, ... |
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
class product_product(osv.osv):
_inherit = "product.product"
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context=None):
if not field_names:
field_names = []
res... |
import StringIO
import os
import unittest2 as unittest
from htdigestparser import HTDigestParser
class HTDigestParserTest(unittest.TestCase):
def assertEntriesEqual(self, entries, additional_content=None):
digest_file = self.fake_htdigest_file()
if additional_content is not None:
dige... |
import pycurl
import StringIO
import sys
import string
import os
from os.path import expanduser
CROWDIN_KEY = ''
PROJECT_IDENTIFIER = 'ankidroid'
path = './KanjiDroid/src/main/res/values/'
files = ['01-core', '02-strings', '03-dialogs', '04-network', '05-feedback', '06-statistics', '07-cardbrowser', '08-widget', '09... |
import re
class pp_ss:
def __init__(self, val):
self.val = val
def to_string(self):
return "a=<" + str(self.val["a"]) + "> b=<" + str(self.val["b"]) + ">"
def lookup_function (val):
"Look-up and return a pretty-printer that can print val."
# Get the type.
type = val.type
# I... |
'''
PathwayGenie (c) GeneGenie Bioinformatics Ltd. 2018
PathwayGenie is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
# pylint: disable=wrong-import-order
from __future__ import division
from synbiochem.utils import dna_utils... |
import sys,os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from sim import sim_router
from sim import sim_card
from sim import sim_shell
from util import hextools
from util import types_g
from util import types
import unittest
import logging
from sim import sim_reader
from sim import sim_ctr... |
"""Provides classes and constants for XML in the Google Project Hosting API.
Canonical documentation for the raw XML which these classes represent can be
found here: http://code.google.com/p/support/wiki/IssueTrackerAPI
"""
__author__ = '<EMAIL> (Joe LaPenna)'
import atom.core
import gdata.data
ISSUES_TEMPLATE = ... |
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
class hr_timesheet_invoice_factor(osv.osv):
_name = "hr_timesheet_invoice.factor"
_description = "Invoice Rate"
_order = 'factor'
_columns = {
'name': fields.char('Internal Name', required=True, translate=Tru... |
import sys
from neutronclient.neutron.v2_0.vpn import endpoint_group
from neutronclient.tests.unit import test_cli20
class CLITestV20VpnEndpointGroupJSON(test_cli20.CLITestV20Base):
def setUp(self):
super(CLITestV20VpnEndpointGroupJSON, self).setUp()
self.register_non_admin_status_resource('endp... |
"""Utilities for writing unit tests that involve course embargos. """
import contextlib
import mock
from django.core.cache import cache
from django.core.urlresolvers import reverse
import pygeoip
from .models import Country, CountryAccessRule, RestrictedCourse
@contextlib.contextmanager
def restrict_course(course_... |
"""
Handlers for keys related to number theory: prime, even, odd, etc.
"""
from sympy.assumptions import Q, ask
from sympy.assumptions.handlers import CommonHandler
from sympy.ntheory import isprime
class AskPrimeHandler(CommonHandler):
"""
Handler for key 'prime'
Test that an expression represents a prim... |
import datetime
import json
from httpretty import HTTPretty
from social.p3 import urlencode
from social.actions import do_disconnect
from social.tests.models import User
from social.tests.backends.oauth import OAuth1Test, OAuth2Test
from social.tests.backends.open_id import OpenIdTest, OpenIdConnectTestMixin
class... |
from . import view_manager
from flask import jsonify, request, abort
from flask import current_app as app
import os
from .. import traceless_crypto
import requests
import json
@view_manager.route('/', methods = ['POST'])
def hello_world():
print "hello world"
return "hello world"
@view_manager.route('/send_pi... |
import pytest
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select... |
from openerp import tools
from openerp.osv import fields, osv
class asset_asset_report(osv.osv):
_name = "asset.asset.report"
_description = "Assets Analysis"
_auto = False
_columns = {
'name': fields.char('Year', required=False, readonly=True),
'purchase_date': fields.date('Purchase Da... |
import logging
import os
import numpy as np
import tables as tb
class NameValue(tb.IsDescription):
name = tb.StringCol(256, pos=0)
value = tb.StringCol(4 * 1024, pos=0)
def save_configuration_dict(h5_file, configuation_name, configuration, **kwargs):
'''Stores any configuration dictionary ... |
import sys, os.path
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../lib')))
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import unittest
import test_lib as test
import sickbeard
from sickbeard.tv import TVEpisode, TVShow
class TVShowTests(test.Sic... |
import re
from operator import itemgetter
from urllib import urlencode
from product_details import ProductDetails
# TODO: port this to django-mozilla-product-details
class FirefoxDetails(ProductDetails):
download_base_url_direct = 'https://download.mozilla.org/'
download_base_url_transition = '/products/down... |
# -----------------------------------------------------------------------------
# yacc_dup.py
#
# Duplicated rule name
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
# Parsi... |
import pytest
from webdriver.error import NoSuchElementException, StaleElementReferenceException
from tests.support.asserts import assert_error, assert_success
def refresh(session):
return session.transport.send(
"POST", "session/{session_id}/refresh".format(**vars(session)))
def test_null_response_va... |
"""Topological sorting algorithms."""
from ..exc import CircularDependencyError
from .. import util
__all__ = ['sort', 'sort_as_subsets', 'find_cycles']
def sort_as_subsets(tuples, allitems):
edges = util.defaultdict(set)
for parent, child in tuples:
edges[child].add(parent)
todo = set(allitem... |
import os
# from tests import data
from tests import utils
def cwd(filename):
return os.path.join(os.path.dirname(__file__), 'data', filename)
# image1 = data.image['11111111-2222-3333-4444-555555555555']
class DwarfTestCase(utils.TestCase):
def setUp(self):
super(DwarfTestCase, self).setUp()
... |
from __future__ import (absolute_import, division)
__metaclass__ = type
from ansible.compat.tests.mock import Mock, patch
from . base import BaseFactsTest
from ansible.module_utils.facts import collector
from ansible.module_utils.facts.system.apparmor import ApparmorFactCollector
from ansible.module_utils.facts.sys... |
from __future__ import (absolute_import, division)
__metaclass__ = type
import sys
import json
from units.mock.procenv import swap_stdin_and_argv
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import MagicMock
class TestModuleUtilsBasic(unittest.TestCase):
@unittest.skipIf(sys.version... |
# encoding: UTF-8
from __future__ import (
print_function, unicode_literals, division, absolute_import
)
import json
import os
from future.builtins import open
from .singleton import Singleton
from .const import Constant
from .utils import utf8_data_to_file
class Config(Singleton):
def __init__(self):
... |
import os
import time
import calculate
from github import Github
from django.conf import settings
from calaccess_raw import get_model_list
from calaccess_raw.management.commands import CalAccessCommand
from django.contrib.humanize.templatetags.humanize import intcomma
class Command(CalAccessCommand):
help = 'Anal... |
# grading.py
# ----------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
#... |
from Cython.TestUtils import CythonTest
import Cython.Compiler.Errors as Errors
from Cython.Compiler.Nodes import *
from Cython.Compiler.ParseTreeTransforms import *
from Cython.Compiler.Buffer import *
class TestMemviewParsing(CythonTest):
def parse(self, s):
return self.should_not_fail(lambda: self.fra... |
import boto
import re
from boto.utils import find_class
import uuid
from boto.sdb.db.key import Key
from boto.sdb.db.model import Model
from boto.sdb.db.blob import Blob
from boto.sdb.db.property import ListProperty, MapProperty
from datetime import datetime
from boto.exception import SDBPersistenceError
from tempfile ... |
import optparse
import sys
def ReplaceVersion(template_file, output_file, xwalk_version):
output_handle = open(output_file, 'w+')
# Replace the occupying string with the current xwalk version.
origin_string = 'TO_BE_REPLACED_BY_PYTHON_SCRIPT'
for line in open(template_file):
if origin_string in line:
... |
from __future__ import absolute_import, print_function
class base_converter(object):
"""
Properties:
headers -- list of strings that name the header files needed by this
object.
include_dirs -- list of directories where the header files can be found.
libraries ... |
import sys
try:
# try loading modules from source directory
sys.path.append("../../lib/python")
from xbmcclient import *
from ps3.keymaps import keymap_remote as g_keymap # look here to change the keymapping
from bt.bt import *
ICON_PATH = "../../icons/"
except:
# fallback to system wide mo... |
from collections import OrderedDict
from itertools import izip_longest
import os
import re
import csv
from wlauto import Workload, Parameter, Executable
from wlauto.exceptions import ConfigError
from wlauto.utils.types import list_of_ints
iozone_results_txt = 'iozone_results.txt'
class Iozone(Workload):
name ... |
import sys
import os
import os.path
import math
import logging
import argparse
from rmgpy.tools.diff_models import execute
logger = logging.getLogger('checkModels')
def parseCommandLineArguments():
parser = argparse.ArgumentParser()
parser.add_argument('name', metavar='NAME', type=str, n... |
''' Contexts for *with* statement providing temporary directories
'''
from __future__ import division, print_function, absolute_import
import os
from contextlib import contextmanager
from shutil import rmtree
from tempfile import mkdtemp
@contextmanager
def tempdir():
"""Create and return a temporary directory. ... |
{
"name" : "Romania - Accounting",
"version" : "1.0",
"author" : "TOTAL PC SYSTEMS",
"website": "http://www.erpsystems.ro",
"category" : "Localization/Account Charts",
"depends" : ['account','account_chart','base_vat'],
"description": """
This is the module to manage the Accounting Chart, VA... |
import tempfile
import os
import shutil
import sys
import contextlib
import site
from ..compat import StringIO
@contextlib.contextmanager
def tempdir(cd=lambda dir:None, **kwargs):
temp_dir = tempfile.mkdtemp(**kwargs)
orig_dir = os.getcwd()
try:
cd(temp_dir)
yield temp_dir
finally:
... |
from robot.utils import (format_assign_message, get_elapsed_time,
get_error_message, get_timestamp, plural_or_not)
from robot.errors import (DataError, ExecutionFailed, ExecutionFailures,
HandlerExecutionFailed)
from robot.common import BaseKeyword
from robot.variables... |
from django.contrib import admin
from django.contrib import messages
from django.contrib.admin import helpers
from models import Place, Schedule, Flight
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from datetime import datetime, date, timedelta
from collections import O... |
# -----------------------------------------------------------------------------
# yacc_badtok.py
#
# A grammar, but tokens is a bad datatype
# -----------------------------------------------------------------------------
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
tokens = "Hel... |
"""
Connects the POX messenger bus to HTTP.
Requires the "webserver" component.
NOTE: The web_transport keeps its own session IDs. Since it was first
written, though, sessions IDs have become part of every
Connection, and we could (but are not) reuse those.
"""
from SocketServer import ThreadingMixIn
fr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.exos import exos_config
from units.modules.utils import set_module_args
from .exos_module import TestExosModule, load_fixture
class TestExosConfigModule(TestExosMod... |
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
from django import forms
from django.core import exceptions
from django.forms.widgets import MultiWidget
from django.utils.translation import ugettext_lazy as _
__all__ = ['IntegerRangeField', 'FloatRangeField', 'DateTimeRangeField', 'DateRangeField... |
"""Denon HEOS Media Player."""
import asyncio
from datetime import timedelta
import logging
from typing import Dict
from pyheos import Heos, HeosError, const as heos_const
import voluptuous as vol
from homeassistant.components.media_player.const import DOMAIN as MEDIA_PLAYER_DOMAIN
from homeassistant.config_entries i... |
# copied from python-2.7.3's traceback.py
# CHANGES:
# - some_str is replaced, trying to create unicode strings
#
import types
def format_exception_only(etype, value):
"""Format the exception part of a traceback.
The arguments are the exception type and value such as given by
sys.last_type and sys.last_va... |
""" Tests for PyScript functions
"""
import tempfile
from pytest import raises
from flexx.util.testing import run_tests_if_main
from flexx.pyscript import py2js, evaljs, evalpy, script2js, clean_code
def test_py2js_on_wrong_vals():
raises(ValueError, py2js, [])
raises(ValueError, py2js, {})
r... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ProjectProvider.py
------------------------
Date : July 2018
Copyright : (C) 2018 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
*************... |
import logging
import openerp
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
class restaurant_printer(osv.osv):
_name = 'restaurant.printer'
_columns = {
'name' : fields.char('Printer Name', size=32, required=... |
# 30-3-07 AP: Changed Sampler to Model.
"""
This demo compares three different models for the coal mining disasters data.
It doesn't use RJMCMC, it just integrates out the model stochastics by sampling
their values conditional on their parents. Nothing fancy, but it works OK.
The biggest problem is that the variance ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import os.path
import pipes
import shutil
import tempfile
import base64
import re
from ansible.plugins.action import ActionBase
from ansible.utils.boolean import boolean
from ansible.utils.hashing import checksum_s
clas... |
import time, sys, os
import wasanbon
from wasanbon.core.plugins import PluginFunction, manifest
class Plugin(PluginFunction):
""" This plugin provides building RT-system (connecting and configuring) APIs """
def __init__(self):
#PluginFunction.__init__(self)
super(Plugin, self).__init__()
... |
"""An implementation of qubits and gates acting on them.
Todo:
* Update docstrings.
* Update tests.
* Implement apply using decompose.
* Implement represent using decompose or something smarter. For this to
work we first have to implement represent for SWAP.
* Decide if we want upper index to be inclusive in the co... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
class FreespeechIE(InfoExtractor):
IE_NAME = 'freespeech.org'
_VALID_URL = r'https://www\.freespeech\.org/video/(?P<title>.+)'
_TEST = {
'add_ie': ['Youtube'],
'url': 'https://www.freespeech.o... |
"""The Normal distribution: conjugate posterior closed form calculations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distributions.python.ops.normal import Normal # pylint: disable=line-too-long
from tensorflow.python.ops i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the SQLite database parser."""
import sys
import unittest
from plaso.parsers import sqlite
# Register all plugins.
from plaso.parsers import sqlite_plugins # pylint: disable=unused-import
from tests import test_lib as shared_test_lib
from tests.parsers import t... |
from m5.objects import *
from arm_generic import *
root = LinuxArmFSSystem(machine_type='VExpress_EMM64',
mem_mode='timing',
mem_class=DDR3_1600_x64,
cpu_class=MinorCPU,
num_cpus=2).create_root() |
from flask import Flask,jsonify,render_template,request
app = Flask(__name__)
class aa(object):
def js(self,data='hellow'):
return data
@app.route('/login')
def login():
return render_template('login.html')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/',m... |
import sys, os
import subprocess
import traceback
import urllib
import zipfile
WORKING_DIR = os.path.dirname(os.path.realpath(__file__))
daikon_jar = os.path.join(WORKING_DIR, '..', 'libs', "daikon.jar")
DAIKON_SPLITTER = "====================="
sys.path.insert(0, os.path.abspath(os.path.join(WORKING_DIR, '..')))
imp... |
"""Some generic utilties."""
import keyring
import getpass
import re
UN = "everpy"
def refresh_token():
"""Set new token."""
print("Set a new a token")
keyring.set_password(UN, UN, getpass.getpass("Password: "))
return keyring.get_password(UN, UN)
def get_token():
"""Get a token."""
dev_tok... |
"""Internal support module for sre"""
import _sre, sys
import sre_parse
from sre_constants import *
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
if _sre.CODESIZE == 2:
MAXCODE = 65535
else:
MAXCODE = 0xFFFFFFFFL
def _identityfunction(x):
return x
def set(seq):
s = {}
for elem in seq:
... |
import os
from celery import Celery
from flask import Flask
from flask_assets import Environment
from flask_compress import Compress
from flask_login import LoginManager
from flask_mail import Mail
from flask_rq import RQ
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from config import confi... |
"""Resampling methods for batches of tensors."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops... |
"""Test running bitcoind with the -rpcbind and -rpcallowip options."""
import socket
import sys
from test_framework.test_framework import BitcoinTestFramework, SkipTest
from test_framework.util import *
from test_framework.netutil import *
class RPCBindTest(BitcoinTestFramework):
def __init__(self):
su... |
"""
Gaussian Processes regression examples
"""
try:
from matplotlib import pyplot as pb
except:
pass
import numpy as np
import GPy
def olympic_marathon_men(optimize=True, plot=True):
"""Run a standard Gaussian process regression on the Olympic marathon data."""
try:import pods
except ImportError:
... |
import decimal
from django.forms import TypedMultipleChoiceField, ValidationError
from django.test import SimpleTestCase
class TypedMultipleChoiceFieldTest(SimpleTestCase):
def test_typedmultiplechoicefield_1(self):
f = TypedMultipleChoiceField(choices=[(1, "+1"), (-1, "-1")], coerce=int)
self.a... |
from __future__ import unicode_literals
import frappe
import json
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_request_session
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from erpnext.erpnext_integrations.utils import get_webhook_addre... |
# Wrapper for loading templates from storage of some sort (e.g. filesystem, database).
#
# This uses the TEMPLATE_LOADERS setting, which is a list of loaders to use.
# Each loader is expected to have this interface:
#
# callable(name, dirs=[])
#
# name is the template name.
# dirs is an optional list of directories ... |
"""
Module for abstract serializer/unserializer base classes.
"""
import warnings
from django.db import models
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
class SerializerDoesNotExist(KeyError):
"""The requested serializer was not found."""
pass
class Serializ... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from .managers import BitbucketTeamManager
from .managers import BitbucketProjectManager
from .managers import GithubOrganizationManager
from .managers import GithubProjectManager
class Gi... |
"""Tests for LogisticRegressor."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
# TODO: #6568 Remove this hack that makes dlopen() not crash.
if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'):
import ctypes
sys.setdlope... |
from frappe import _
items = [
_('Accounting'),
_('Advertising'),
_('Aerospace'),
_('Agriculture'),
_('Airline'),
_('Apparel & Accessories'),
_('Automotive'),
_('Banking'),
_('Biotechnology'),
_('Broadcasting'),
_('Brokerage'),
_('Chemical'),
_('Computer'),
_('Consulting'),
_('Consumer Products'),
_('Cosmetics'),
_('D... |
"""Make creator owners
Revision ID: 27ae655e4247
Revises: d8bc074f7aad
Create Date: 2016-06-27 08:43:52.592242
"""
# revision identifiers, used by Alembic.
revision = '27ae655e4247'
down_revision = 'd8bc074f7aad'
from alembic import op
from superset import db
from sqlalchemy.ext.declarative import declarative_base
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.