content stringlengths 4 20k |
|---|
# -*- coding=utf -*-
import unittest
from sqlalchemy import create_engine, MetaData, Table, Integer, String, Column
from cubes import *
from cubes.errors import *
from ...common import CubesTestCaseBase
from json import dumps
def printable(obj):
return dumps(obj, indent=4)
class AggregatesTestCase(CubesTestCaseB... |
#
# test.py : Functions used for testing the modules
#
# Part of the Python Cryptography Toolkit
#
# Distribute and use freely; there are no restrictions on further
# dissemination and usage except those imposed by the laws of your
# country of residence. This software is provided "as is" without
# warranty of fitn... |
from __future__ import unicode_literals
import sys
from importlib import import_module
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import no_style
from django.core.management.sql import... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import re
from ansible.module_utils.six import iteritems
SIZE_RANGES = {
'Y': 1 << 80,
'Z': 1 << 70,
'E': 1 << 60,
'P': 1 << 50,
'T': 1 << 40,
'G': 1 << 30,
'M': 1 << 20,
'K': 1 << 10,
'B': 1,
}
... |
"""Break sentence ops."""
import abc
from tensorflow.python.ops.ragged import ragged_tensor
from tensorflow.python.util import deprecation
from tensorflow.python.framework import load_library
from tensorflow.python.platform import resource_loader
gen_sentence_breaking_ops = load_library.load_op_library(resource_loader... |
import tempfile
from telemetry.core.platform import profiler
class NetLogProfiler(profiler.Profiler):
_NET_LOG_ARG = '--log-net-log='
@classmethod
def name(cls):
return 'netlog'
@classmethod
def is_supported(cls, browser_type):
return not browser_type.startswith('cros')
@classmethod
def Cust... |
# Este codigo es una implementacion que se realiza con las librerias de vision por computador
# disponibles bajo python para el control de robots Recoge Bolas.
#
# Realizado por: Estudiantes de la universidad del valle.
# Heberth Alexander Ardila Cuellar / <EMAIL> / 3128204694 / uavlabs.org
# Jaime Andres Ortiz Aranda ... |
#!/usr/bin/python
import sys, math
import rosbag
#topics that will remain in output bags
allowed_topics = ["/center_camera/image_color/compressed", "/center_camera/image_color",
"/vehicle/gps/fix"]
def getDigitCount(number):
"""How many digits will have the highest numbered file? e.g. if there will be 25
resul... |
from defcon import Glyph, Image, registerRepresentationFactory
from defconAppKit.representationFactories.nsBezierPathFactory import NSBezierPathFactory
from defconAppKit.representationFactories.glyphCellFactory import GlyphCellFactory
from defconAppKit.representationFactories.glyphCellDetailFactory import GlyphCellDeta... |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any, Generator, Iterable, Tuple
import os
import pty
import sys
import errno
def run_parallel(job, data, threads=6):
# type: (Any, Iterable[Any], int) -> Generator[Tuple[int, Any], None, None]
pids = {} # type: Dic... |
#!/usr/bin/env python
# This will create golden files in a directory passed to it.
# A Test calls this internally to create the golden files
# So it can process them (so we don't have to checkin the files).
# Ensure msgpack-python and cbor are installed first, using:
# pip install --user msgpack-python
# pip inst... |
from __future__ import absolute_import, unicode_literals
from django.forms.models import inlineformset_factory
from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
from .models import Poet, Poem, School, Parent, Child
class DeletionTests(TestCase):
def test_deletion(self):
... |
from volatility import debug
from volatility.renderers.basic import Renderer
__author__ = "gleeda"
try:
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.cell import get_column_letter
from openpyxl.styles import Color, Fill, Style, PatternFill, Border, ... |
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def cloud_identity(module, state, identity):
instance = dict(
authenticated=identity.authenticated,
credentials=identity._creds_file
)
changed = False
instance.update(rax_to_dict(identity))
instan... |
from fs.mountfs import MountFS
from fs.memoryfs import MemoryFS
import unittest
class TestMountFS(unittest.TestCase):
def test_auto_close(self):
"""Test MountFS auto close is working"""
multi_fs = MountFS()
m1 = MemoryFS()
m2 = MemoryFS()
multi_fs.mount('/m1', m1)
... |
import os
import json
import time
import subprocess
DEBUG = os.environ.get('DEBUG', 'false')
CONFORMANCE_YAML = ("tests/kubernetes_conformance/resources/k8s_ymls/"
"sonobuoy-conformance.yaml")
class KubectlClient(object):
def __init__(self):
self._kube_config_path = None
self... |
import networkx as nx
import numpy as np
import pickle as pkl
import pandas as pd
import tables as tb
import sys
from itertools import combinations
class SourcePairSearcher(object):
"""
SourcePairSearcher
Identifies isolates for which a source pair search will be performed.
"""
def __init__(self, handle, isol... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This file is part of the prometeo project.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option... |
import sublime, sublime_plugin
from functools import partial
class DetectIndentationCommand(sublime_plugin.TextCommand):
"""Examines the contents of the buffer to determine the indentation
settings."""
def run(self, edit, show_message = True, threshold = 10):
sample = self.view.substr(sublime.Regi... |
import rope.base.evaluate
from rope.base import change, pyobjects, exceptions, pynames, worder, codeanalyze
from rope.refactor import sourceutils, importutils, functionutils, suites
def create_generate(kind, project, resource, offset):
"""A factory for creating `Generate` objects
`kind` can be 'variable', 'f... |
from spack import *
class Jsoncpp(CMakePackage):
"""JsonCpp is a C++ library that allows manipulating JSON values,
including serialization and deserialization to and from strings.
It can also preserve existing comment in unserialization/serialization
steps, making it a convenient format to store user ... |
# content of conftest.py
import pytest
def pytest_collect_file(parent, path):
if path.ext == ".yml" and path.basename.startswith("test"):
return YamlFile(path, parent)
class YamlFile(pytest.File):
def collect(self):
import yaml # we need a yaml parser, e.g. PyYAML
raw = yaml.safe_load... |
"""This file is deprecated. Use tensorflow.python.training.session_run_hook."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.training import session_run_hook
# pylint: disable=invalid-name
SessionRunHook = session_run_hook.Session... |
#!/usr/bin/env python
# encoding: utf-8
## ==============================================
## GOAL : Format code, Update headers
## ==============================================
import argparse
import logging
import os
import re
import sys
import datetime
import subprocess
## ========================================... |
"""This module allows creating a Basic Modeling Interface (BMI) model from
and automatically assembled PySB model. The BMI model can be instantiated
within a simulation workflow system where it is simulated together
with other models."""
import os
import copy
import numpy
import pickle
import textwrap
from lxml import... |
"""
Tests to ensure only the report files we want are returned as part of run_quality.
"""
import unittest
from mock import patch
import pavelib.quality
class TestGetReportFiles(unittest.TestCase):
"""
Ensure only the report files we want are returned as part of run_quality.
"""
@patch('os.walk')
... |
import matplotlib.pyplot as plt
class Plot:
def save(self, destination_filename="plotted.png", width=10, height=10, local_dpi=100):
fig = plt.gcf()
fig.set_size_inches(width, height)
plt.savefig(destination_filename, dpi=local_dpi)
def plot(self, xlist, ylist, marker_style='circle', def_color="r", def_alpha=... |
import numpy as np
from numpy.testing import assert_array_almost_equal
from dipy.align import floating
from dipy.align import crosscorr as cc
def test_cc_factors_2d():
r"""
Compares the output of the optimized function to compute the cross-
correlation factors against a direct (not optimized, but less err... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)
# Ralf Habacker, 2006 (rh)
# Yinon Ehrlich, 2009
# Michael Kuhn, 2009
import os, sys
import Configure, Options, Utils
import ccroot, ar
from Configure import conftest
@conftest
def find_xlcxx(conf):
cxx = conf.find_program(['xlc++_r', 'xlc++'], var='C... |
"""Provides the code to load PRAW's configuration file `praw.ini`."""
from __future__ import print_function, unicode_literals
import os
import sys
from six.moves import configparser
def _load_configuration():
"""Attempt to load settings from various praw.ini files."""
config = configparser.RawConfigParser(... |
from horizon.test import helpers as test
from horizon import views
from django import forms
from django.test import client
from django.utils.translation import ugettext_lazy as _
from django.views import generic
FAKENAME = "FakeName"
class ViewData(object):
template_name = 'fake'
def get_context_data(self... |
import os
import sys
import re
import urlparse
import urllib
import urllib2
import locale
import threading
import time
import socket
import xbmc
import xbmcgui
from core import config
from core import logger
from core import downloadtools
# Download a file and start playing while downloading
def download_and_play(ur... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, transaction
from django.core.exceptions import ValidationError
from django.contrib.contenttypes.fields import GenericForeignKey
from django.utils.six import python_2_unicode_compatible
from django.utils.translation import ug... |
import click
import getpass
from imgtool import keys
from imgtool import image
from imgtool.version import decode_version
def gen_rsa2048(keyfile, passwd):
keys.RSA2048.generate().export_private(path=keyfile, passwd=passwd)
def gen_ecdsa_p256(keyfile, passwd):
keys.ECDSA256P1.generate().export_private(keyfi... |
import wx.lib.pubsub as ps
# mode.py
# to be instanced inside Controller (control.py)
# IMPORTANT: When adding a new state, remember o insert it into LEVEL
# dictionary
# RULE:
# default is the only level 0
# states controlled somehow by taskmenu are level 1
# states controlled by toolbar are level 2
#LEVEL = {S... |
"""Utilities for scanning source files to determine code authorship.
"""
import itertools
def ForwardSlashesToOsPathSeps(input_api, path):
"""Converts forward slashes ('/') in the input path to OS-specific
path separators. Used when the paths come from outside and are using
UNIX path separators. Only works for ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.facts.network.base import NetworkCollector
from ansible.module_utils.facts.network.generic_bsd import GenericBsdIfconfigNetwork
class DragonFlyNetwork(GenericBsdIfconfigNetwork):
"""
This is the ... |
from __future__ import unicode_literals
import sys
import inspect
from collections import Mapping
from future.utils import PY3, exec_
if PY3:
import builtins
def apply(f, *args, **kw):
return f(*args, **kw)
from past.builtins import str as oldstr
def chr(i):
"""
Return a by... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
"""Tests for the printkey plugin."""
from rekall import testlib
class TestRegDump(testlib.HashChecker):
"""Test dumping of registry hives."""
PARAMETERS = dict(commandline="regdump --dump_dir %(tempdir)s")
class TestHiveDump(testlib.SimpleTestCase):
PARAMETERS = dict(
commandline="hivedump --hi... |
# coding=utf-8
from rest_framework import serializers
from account.models import User
from .models import Announcement
class CreateAnnouncementSerializer(serializers.Serializer):
title = serializers.CharField(max_length=50)
content = serializers.CharField(max_length=10000)
is_global = serializers.Boolean... |
from six import StringIO
from greplin import scales
from greplin.scales import formats, util
from bottle import abort, request, response, run, Bottle
import functools
def bottlestats(server_name, path=''):
"""Renders a GET request, by showing this nodes stats and children."""
path = path.lstrip('/')
part... |
# -*- coding: utf-8 -*-
"""
Identifying function names in a script
======================================
This demonstrates how Sphinx-Gallery identifies function names to figure out
which functions are called in the script and to which module do they belong.
"""
# Code source: Óscar Nájera
# License: BSD 3 clause
i... |
{
"name" : "OHADA - Accounting",
"version" : "1.0",
"author" : "Baamtu Senegal",
"category" : "Localization/Account Charts",
"description": """This module implements the accounting chart for OHADA area.
It allows any company or association to manage its financial accounting.
Countries that u... |
from __future__ import print_function
# $example on$
from pyspark.ml.feature import StandardScaler
# $example off$
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession\
.builder\
.appName("StandardScalerExample")\
.getOrCreate()
# $example on$
dataF... |
import json
import datetime
import decimal
from twisted.internet import defer
from scrapy.http import Request, Response
from scrapy.item import BaseItem
class ScrapyJSONEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, o):
if isinstance(o, datetime.... |
import colander
from pyramid import testing
from pytest import mark
from pytest import fixture
from pytest import raises
class TestProposalSheet:
@fixture
def meta(self):
from .burgerhaushalt import proposal_meta
return proposal_meta
def test_create(self, meta, context):
from zop... |
config = {
"interfaces": {
"google.datastore.v1.Datastore": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": [],
},
"retry_params": {
"default": {
"initial_retry_de... |
"""
channels.py
Contains class and implementation of a TwitchTV channel.
"""
class Channel(object):
def __init__(self, channel_data):
if channel_data is None:
raise AssertionError('received empty channel_data')
self._channel_data = channel_data
self.display_name = str(self... |
from __future__ import absolute_import, division, print_function, unicode_literals
import delv
import delv.archive
import sys
USAGE = '''Usage: ./delvpack.py src dest
Packs or unpacks Delver archives. If dest is an existing directory,
it will unpack src into it. Otherwise, it writes a new Delver Archive
at dest. sr... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ProjectSheetQuestionAnswer.selected_choices_id'
db.add_co... |
from sklearn.preprocessing import StandardScaler
import functools
import operator
def make_preprocessor(td, column_summary):
# it's important to scale consistently on all preprocessing based on
# consistent scaling, so we do it once and keep ahold of it for all future
# scaling.
stdsc = StandardScaler... |
""" :mod: GFAL2_SRM2Storage
=================
.. module: python
:synopsis: SRM2 module based on the GFAL2_StorageBase class.
"""
from types import StringType, ListType
# from DIRAC
from DIRAC.Resources.Storage.GFAL2_StorageBase import GFAL2_StorageBase
from DIRAC import gLogger, gConfig, S_OK, S_ERROR
fro... |
"""ParenMatch -- An IDLE extension for parenthesis matching.
When you hit a right paren, the cursor should move briefly to the left
paren. Paren here is used generically; the matching applies to
parentheses, square brackets, and curly braces.
"""
from idlelib.HyperParser import HyperParser
from idlelib.configHandler... |
import _yaml, yaml
import types, pprint
yaml.PyBaseLoader = yaml.BaseLoader
yaml.PySafeLoader = yaml.SafeLoader
yaml.PyLoader = yaml.Loader
yaml.PyBaseDumper = yaml.BaseDumper
yaml.PySafeDumper = yaml.SafeDumper
yaml.PyDumper = yaml.Dumper
old_scan = yaml.scan
def new_scan(stream, Loader=yaml.CLoader):
return old... |
from amsn2.views import StringView, MenuItemView
from PyQt4 import Qt
from PyQt4 import QtCore
from PyQt4 import QtGui
def create_menu_items_from_view(menu, items):
# TODO: images & radio groups, for now only basic representation
for item in items:
if item.type is MenuItemView.COMMAND:
it ... |
# -*- coding: utf-8 -*-
"""
File to apply the trained ConvNet model to a number of images.
It will use the ConvNet to locate cat faces in the images and mark them.
It is expected that each image contains exactly one cat (i.e. a face will be
extracted out of each image, even if there is no cat).
If an image contains mul... |
"""
Switchvox common methods
"""
import urllib2
try:
import json
except ImportError:
import simplejson as json
def switchvox_request(username, password, json_req, hostname):
url = "https://%s" % hostname
#create a password manager
passManager = urllib2.HTTPPasswordMgrWithDefaultRealm()
passM... |
#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.INFO)
_log = logging.getLogger('Example Kinships')
import numpy as np
from numpy import dot, array, zeros, setdiff1d
from numpy.linalg import norm
from numpy.random import shuffle
from scipy.io.matlab import loadmat
from scipy.sparse import lil_ma... |
""" ReportEngineClient
"""
import traceback,logging,os,re
import requests,json,StringIO
import jprops
import datetime,pytz
HEADERS = {'Content-Type':'application/json','accept':'application/json'}
TEST_STATUSES = ['Passed', 'Failed', 'Skipped', 'Running', 'NoStatus']
LOG_LEVELS=['ALL','DEBUG', 'INFO', 'WARNING', 'ERRO... |
"""Easier access to ID3 tags.
EasyID3 is a wrapper around mutagen.id3.ID3 to make ID3 tags appear
more like Vorbis or APEv2 tags.
"""
import mutagen.id3
from mutagen import Metadata
from mutagen._util import DictMixin, dict_match
from mutagen.id3 import ID3, error, delete, ID3FileType
__all__ = ['EasyID3', 'Open',... |
from ctypes import byref, c_int
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import raster as capi
from django.contrib.gis.shortcuts import numpy
from django.utils import six
from django.utils.encoding import force_tex... |
#! /usr/bin/env python
# Variant of "which".
# On stderr, near and total misses are reported.
# '-l<flags>' argument adds ls -l<flags> of each file found.
import sys
if sys.path[0] in (".", ""): del sys.path[0]
import sys, os
from stat import *
def msg(str):
sys.stderr.write(str + '\n')
def main():
pathlis... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_u... |
"""
ApacheHTTPD Support
"""
import logging
import re
from newrelic_plugin_agent.plugins import base
LOGGER = logging.getLogger(__name__)
PATTERN = re.compile(r'^([\w\s{1}]+):\s([\d\.{1}]+)', re.M)
class ApacheHTTPD(base.HTTPStatsPlugin):
DEFAULT_QUERY = 'auto'
GUID = 'com.meetme.newrelic_apache_httpd_age... |
from __future__ import print_function
import warnings
import sys
import os
import pybindgen.settings
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
from pybindgen.module import MultiSectionFactory
import ns3modulegen_core_customizations
import logging
pybindgen.settings.wrapper_regi... |
from PyQt5.QtCore import QT_VERSION_STR, Qt
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QHBoxLayout, QPushButton, QSizePolicy
from sdbcore.logger import Logger
from sdbcore.version import Version
from sdbgui.pixmap import Pixmap
from sdbgui.popupwidget import PopupWidget
class PopupAboutWidget(PopupWidget):
... |
import inspect
import os
from importlib import import_module
from django.apps import apps
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.admindocs import utils
from django.contrib.admindocs.utils import (
... |
"""
WSGI config for example project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... |
"""The Beta distribution class."""
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.framework import dtypes
from tensorflow.python.framework import ops
from tensor... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot checks if any IP in a list may be an open proxy
The list must be a plain text file where each row is a single IP address
"""
#
# (C) User:Mensis Mirabilis, 2019
# (C) User:Huji, 2020
#
# Distributed under the terms of the CC-BY-SA license.
#
from __future__ import... |
import sys
import time
from twisted.trial import unittest
from rtpmidi.protocols.rtp.packets import RTCPPacket
from rtpmidi.protocols.rtp.packets import RTCPCompound
from rtpmidi.protocols.rtp.packets import ext_32_out_of_64
from rtpmidi.protocols.rtp.packets import unformat_from_32
from rtpmidi.protocols.rtp.packets ... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tests.test_views import AuthViewsTestCase
from django.contrib.auth.tests.utils import skipIfCustomUser
@skipIfCustomUser
class LoginRequiredTestCase(AuthViewsTestCase):
"""
Tests the login_requi... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
from tensorflow.compiler.mlir.tensorflow.tests.tf_saved_model import common_v1
# Verify that the tf.versions attribute exists. It is difficult to enforce
# contents, since the... |
from plugins.Plugin import Plugin
class Structural_WayOneNode(Plugin):
def init(self, logger):
Plugin.init(self, logger)
self.errors[12401] = { "item": 1240, "level": 2, "tag": ["geom", "fix:chair"], "desc": T_(u"Way with one node") }
def way(self, data, tags, nds):
if len(nds) == 1:... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
# pylint: disable=fixme, missing-docstring
from subprocess import call, check_output
class IpTablesError(Exception):
def __init__(self, msg, cmd, exit_code, output):
super(IpTablesError, self).__init__(msg)
self.msg =... |
## @package paint_emcal
# paint_emcal creates the canvas and pad where the histogram output of calib_emcal can be displayed in as individual channels of the emcal and dcal in their correct real eta and phi position.
#!/usr/bin/env python
if __name__ != '__main__':
import math, array, ROOT
## Sets up ROOT
def se... |
#!/usr/bin/env python
import sys
import random
units = [
"Hz",
"kHz",
"MHz",
"GHz",
"THz",
]
randrange = (lambda min, max: random.randrange(min, max+1))
def format_frequencies(string):
times = string.count("%d")
fmt = ()
for x in range(times):
fmt += (randrange(0, 9),)
... |
# -*- coding: utf-8 -*-
import unittest
from pychord import QualityManager, Chord, note_to_chord
class TestQuality(unittest.TestCase):
def setUp(self):
self.quality_manager = QualityManager()
def test_eq(self):
q1 = self.quality_manager.get_quality("m7-5")
q2 = self.quality_manager.... |
# -*- coding: utf-8 -*-
"""Generic Unit tests for the GDAL provider.
.. 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 os
from fabric.api import *
from fabric.contrib import files
from dukeclient.fabric.utils import get_role, get_conf, get_project_path
from dukeclient.fabric.tasks import *
LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
env.roledefs.update({
'example': ['<EMAIL>:2022'],
})
env.site = {
'domai... |
"""Model pruning implementation in tensorflow."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import
from tensorflow.contrib.model_pruning.python.layers.layers import masked_conv2d
from tensorflow.contrib.model_pruning.python.la... |
"""Writes dependency ordered list of native libraries.
The list excludes any Android system libraries, as those are not bundled with
the APK.
This list of libraries is used for several steps of building an APK.
In the component build, the --input-libraries only needs to be the top-level
library (i.e. libcontent_shell... |
"""
================================
Nearest Neighbors Classification
================================
Sample usage of Nearest Neighbors classification.
It will plot the decision boundaries for each class.
"""
print __doc__
import numpy as np
import pylab as pl
from matplotlib.colors import ListedColormap
from sklear... |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
LOG = logging.getLogger(__name__)
class AddInterface(forms.SelfHandlingForm):... |
from datetime import datetime
from zope.component import getSiteManager
from repoze.bfg.traversal import model_path
from repoze.folder.interfaces import IObjectWillBeAddedEvent
from repoze.lemonade.content import create_content
from karl.content.interfaces import ICalendar
from karl.content.interfaces import ICalend... |
"""The Keras API.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.keras.python.keras import activations
from tensorflow.contrib.keras.python.keras import applications
from tensorflow.contrib.keras.python.keras import backend
from ... |
'''OpenGL extension AMD.conservative_depth
This module customises the behaviour of the
OpenGL.raw.GL.AMD.conservative_depth to provide a more
Python-friendly API
Overview (from the spec)
There is a common optimization for hardware accelerated implementation of
OpenGL which relies on an early depth test to be ru... |
from libcloud.container.types import Provider
from libcloud.common.providers import get_driver as _get_provider_driver
from libcloud.common.providers import set_driver as _set_provider_driver
DRIVERS = {
Provider.DUMMY:
('libcloud.container.drivers.dummy', 'DummyContainerDriver'),
Provider.DOCKER:
('li... |
#!/usr/bin/python3
# email: <EMAIL>
# commands
# testing
#self.setcmd("dev.haut.local", "temp", "temp.py", "")
#self.setcmd("dev.haut.local", "temp2", "temperaturex.py", "5 5")
#self.setcmd("dev.haut.local", "dev-cool", "cool.py", "")
#self.setcmd("dev.haut.local", "dev-cool2", "cool2.py", "aaa")
# real
self.setc... |
import argparse
import os
import subprocess
import sys
BOTS = {
'--arm32': 'v8_arm32_perf_try',
'--linux32': 'v8_linux32_perf_try',
'--linux64': 'v8_linux64_perf_try',
'--linux64_atom': 'v8_linux64_atom_perf_try',
'--linux64_haswell': 'v8_linux64_haswell_perf_try',
'--nexus5': 'v8_nexus5_perf_try',
'--ne... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import os
PACKAGE_STATE_MAP = dict(
present="--install",
absent="--remove"
)
def parse_plugin_repo(string):
elements = string.split("/")
# We first consider the... |
"""Wrapper around git command-line tools."""
from __future__ import absolute_import, print_function
from lib.util import (
CommonConfig,
run_command,
)
class Git(object):
"""Wrapper around git command-line tools."""
def __init__(self, args):
"""
:type args: CommonConfig
"""
... |
from __future__ import print_function, unicode_literals
from socket import error as socket_error
import base64
import json
import os
import os.path as path
import re
import shutil
import sys
import StringIO
import tarfile
import zipfile
import urllib2
from mach.decorators import (
CommandArgument,
CommandProv... |
"""This module tests the Uploader class."""
import os
import tempfile
from default import Test
from pybossa.uploader.local import LocalUploader
from mock import patch
from werkzeug.datastructures import FileStorage
from nose.tools import assert_raises
class TestLocalUploader(Test):
"""Test PyBossa Uploader modul... |
#! /usr/bin/env python
# Released to the public domain, by Tim Peters, 03 October 2000.
# -B option added by Georg Brandl, 2006.
"""reindent [-d][-r][-v] [ path ... ]
-d (--dryrun) Dry run. Analyze, but don't make any changes to files.
-r (--recurse) Recurse. Search for all .py files in subdirectories too.
-B (--... |
#!/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... |
import importlib
import os
import sys
from django.apps import apps
from django.utils import datetime_safe, six
from django.utils.six.moves import input
from .loader import MIGRATIONS_MODULE_NAME
class MigrationQuestioner(object):
"""
Gives the autodetector responses to questions it might have.
This base... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page import Page
from twilio.rest.accounts.v1.credential.aws import AwsL... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import xmlrpclib
webfaction = xmlrpclib.ServerProxy('https://api.webfaction.com/')
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.