content string |
|---|
import pygame, os, sys
from pygame.locals import *
from mail import New_Mail
from primitives import *
__img_cache = dict()
__snd_cache = dict()
__snd_disabled = False
if not pygame.mixer or not pygame.mixer.get_init():
__snd__disabled = True
DATA_DIR = os.path.abspath(os.path.join(
os.path.dirname(... |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Unit tests for ParamsBruterThread
"""
import s... |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... |
#!/usr/bin/env python
from peacock.Input.ExecutableInfo import ExecutableInfo
from peacock.Input.InputTree import InputTree
import os
from peacock.utils import Testing
from PyQt5 import QtWidgets
class Tests(Testing.PeacockTester):
qapp = QtWidgets.QApplication([])
def setUp(self):
super(Tests, self).... |
"""
A helper class for proxy objects to remote APIs.
For more information about rpc API version numbers, see:
rpc/dispatcher.py
"""
from quantum.openstack.common import rpc
class RpcProxy(object):
"""A helper class for rpc clients.
This class is a wrapper around the RPC client API. It allows you to
... |
"""Code for html rendering
"""
import sys
# Import the html parser code, maintaing compatibility with older versions of python
from html.parser import HTMLParser
import re
import pygame
from pygame.locals import *
from pgu import gui
_amap = {'left':-1, 'right':1, 'center':0, None:None, '':None, }
_vamap = {'top'... |
#!/usr/bin/env python3
"""Utilities for managing Dockerfiles"""
import argparse
import json
import logging
from os import environ
import re
from collections import namedtuple
from collections.abc import Mapping
from contextlib import contextmanager
from os.path import join
from subprocess import PIPE, CalledProcessErr... |
import argparse
from iou_tracker import track_iou
from viou_tracker import track_viou
from util import load_mot, save_to_csv
def main(args):
formats = ['motchallenge', 'visdrone']
assert args.format in formats, "format '{}' unknown supported formats are: {}".format(args.format, formats)
with_classes = F... |
import uuid
import threading
from kazoo.test import KazooTestCase
class ZooKeeperClientTests(KazooTestCase):
@property
def zk(self):
return self.client.zk
def test_create_get_set(self):
self.client.connect()
self.client.ensure_path("/")
nodepath = self.namespace + "/" + ... |
import os
import re
import sys
import time
from ..utils import (
encodeFilename,
timeconvert,
format_bytes,
)
class FileDownloader(object):
"""File Downloader class.
File downloader objects are the ones responsible of downloading the
actual video file and writing it to disk.
File downlo... |
'''
@author: David W.H. Swenson
This file consists of the logic functions to combine two sets defined as
ranges of numbers. The functions are such that "and" is the intersection of
two sets, "or" is the union of two sets, and "sub" means that A - B is the
relative complement of B in A (usually denoted A \ B).
The set... |
import deepchem as dc
import numpy as np
import os
def test_numpy_dataset_get_shape():
"""Test that get_shape works for numpy datasets."""
num_datapoints = 100
num_features = 10
num_tasks = 10
# Generate data
X = np.random.rand(num_datapoints, num_features)
y = np.random.randint(2, size=(num_datapoints,... |
#!/usr/bin/env python2
import datetime
import os
import time
import shutil
import sys
import core
from subprocess import Popen
from core import logger, nzbToMediaDB
from core.nzbToMediaUtil import convert_to_ascii, CharReplace, plex_update
from core.nzbToMediaUserScript import external_script
def processTorrent(input... |
"""Test result object"""
#import os
#import io
import sys
#import traceback
#from . import util
#from functools import wraps
__unittest = True
def failfast(method):
#@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'failfast', False):
self.stop()
return method(self, ... |
import blinker
__all__ = [
"before_create_table",
"object_deleted",
"object_loaded",
"object_modified",
"object_saved",
"model_bound",
"model_created",
"model_validated",
]
# Isolate to avoid collisions with other modules.
# Don't expose the namespace.
__signals = blinker.Namespace()
... |
import sys
def application(env, start_response):
status = '200 OK'
output = 'test fail\n'
try:
assert(env['wsgi.input'].__class__.__name__ == 'mp_request')
assert(env['wsgi.errors'] == sys.stderr)
assert(env['wsgi.version'] == (1,0))
assert(env['wsgi.multithread'] in (True, False))
... |
"""
trionyx.views.ajax
~~~~~~~~~~~~~~~~~~
:copyright: 2019 by Maikel Martens
:license: GPLv3
"""
import logging
from typing import ClassVar, Any
from django.http import JsonResponse
from django.http.request import HttpRequest
from django.views.generic import View
logger = logging.getLogger(__name__)
class JsendVie... |
'''
===========================================================
Expanding a string into subfields prepended with ^ markers
===========================================================
>>> a = 'Start^xX part^yY part^zEnd'
>>> expand(a)
[('_', 'Start'), ('x', 'X part'), ('y', 'Y part'), ('z', 'End')]
>>> ... |
import json
from bokeh.client import push_session
from bokeh.driving import repeat
from bokeh.io import curdoc
from bokeh.models import GeoJSONDataSource
from bokeh.plotting import figure
from bokeh.sampledata.sample_geojson import geojson as original
updated = json.dumps({
'type': 'FeatureCollection',
'featu... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from pytest import raises
from aspen import Response
from aspen.http.request import Request
from aspen.http.mapping import Mapping
from aspen.http.request import Line, M... |
import arcpy
import os
import sys
import traceback
import TestUtilities
try:
print "Testing ArcPy"
arcpy.AddMessage("ArcPy works")
# WORKAROUND: delete scratch db (having problems with scratch read-only "scheme lock" errors
# print "Deleting Scratch Workspace (Workaround)"
# TestUtilities... |
from mutagen.mp4 import MP4, MP4Cover
from picard import config, log
from picard.coverart.image import TagCoverArtImage, CoverArtImageError
from picard.file import File
from picard.metadata import Metadata
from picard.util import encode_filename
class MP4File(File):
EXTENSIONS = [".m4a", ".m4b", ".m4p", ".m4v", "... |
class EvaluationWorkView():
'''The EvaluationWorkView class simulates a database work view interface
but reduces the information taken from the database by an article under-test
this allows cross-fold validation without rebuilding the database continously
'''
'''constructor
@param wor... |
import sys, string
import Config
class Parents( ) :
"""Tools for calculating the parents for a term"""
def __init__( self, db, cursor ) :
self.db = db
self.cursor = cursor
def fetchParentPath( self, termID, path, pathSet, allBranches = True ) :
"""Recursively fetch parents until a full pat... |
"""
Support for Dialogflow webhook.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dialogflow/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import intent,... |
import os
import re
import sys
from time import sleep
from OSEncryptionState import *
class UnmountOldrootState(OSEncryptionState):
def __init__(self, context):
super(UnmountOldrootState, self).__init__('UnmountOldrootState', context)
def should_enter(self):
self.context.logger.log("Verifying... |
import re
import base64
import os
try:
import urllib.request as urlProc
except:
import urllib as urlProc
if __name__ == '__main__':
qrIter = re.finditer(b"'(media/qr/\\d+.png)'", urlProc.urlopen('https://www.shadowsocks.net/get').read())
ssUrls = set()
for qr in qrIter:
qrUrl = b'http://zxi... |
from nose.plugins.skip import SkipTest
try:
from testfixtures.components import TestComponents
except ImportError: # pragma: no cover
raise SkipTest('zope.component is not available')
from mock import Mock, call
from testfixtures import Replacer, compare
from testfixtures.compat import PY3
from unittest impo... |
import vectorops, so2, so3, se3
import math
class GeodesicSpace:
"""A class representing a geodesic space. A geodesic is equipped with a
a geodesic (interpolation via the interpolate(a,b,u) method), a natural
arc length distance metric (distance(a,b) method), an intrinsic dimension
(intrinsicDimension... |
import django_filters
from .models import Article
from django.db import models
class ArticleFilter(django_filters.FilterSet):
search = django_filters.MethodFilter(action='search_filter')
class Meta:
model = Article
fields = {
'created_date': ['lt', 'gt'],
'flag'... |
from openerp import _, api, exceptions, fields, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
payment_slip_ids = fields.One2many(comodel_name='l10n_ch.payment_slip',
inverse_name='move_line_id',
string... |
# -*- coding: utf-8 -*-
from django.core import mail
from nose.tools import eq_
from kitsune.sumo.tests import post
from kitsune.sumo.urlresolvers import reverse
from kitsune.users.tests import add_permission, UserFactory
from kitsune.products.tests import ProductFactory
from kitsune.wiki.config import (
SIGNIFIC... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2012-2015 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... |
from cmoc import ConDetail, Prepare
import MySQLdb
from json import load
from os import path, makedirs
with open("/var/rc24/File-Maker/Channels/Check_Mii_Out_Channel/config.json", "r") as f:
config = load(f)
db = MySQLdb.connect(
"localhost", config["dbuser"], config["dbpass"], "rc24_cmoc", charset="utf8mb4"
... |
from __future__ import print_function
import sys # for sys.exc_info
__author__ = 'Tempesta Technologies, Inc.'
__copyright__ = 'Copyright (C) 2017 Tempesta Technologies, Inc.'
__license__ = 'GPL2'
class Error(Exception):
"""Base exception class for unrecoverable framework errors.
Python unittest treats Asser... |
<<<<<<< HEAD
<<<<<<< HEAD
import unittest
from test import support
# For scope testing.
g = "Global variable"
class DictComprehensionTest(unittest.TestCase):
def test_basics(self):
expected = {0: 10, 1: 11, 2: 12, 3: 13, 4: 14, 5: 15, 6: 16, 7: 17,
8: 18, 9: 19}
actual = {k:... |
"""
Generate Rock Salt lattice
@author: Chris Scott
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import numpy as np
from ..system.lattice import Lattice
from . import lattice_gen_utils
from six.moves import range
################################################... |
"""
This script supports bulk additions and removals of DNS resource
records from a file.
The input file can have two different formats:
Format one for deletions. Each line is a new entry. The first column
is the zonefile, the second column is the DNS domainname (ownername)
to be removed. The first record that is own... |
import sys
import os
_TOP_PATH = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..'))
class Link(object):
def __init__(self, dst_path, src_path):
self.dst_path = dst_path
self.src_path = src_path
def Update(self):
full_src_path = os.path.join(_TOP_PATH, self.src_path)
full_dst_path... |
"""Python file with invalid syntax, used by scripts/linters/
python_linter_test. This file is not using print() which is not allowed.
"""
from __future__ import absolute_import # pylint: disable=import-only-modules
from __future__ import unicode_literals # pylint: disable=import-only-modules
import python_utils
c... |
from __future__ import (absolute_import, division, print_function, )
from future.standard_library import install_aliases
install_aliases() # noqa: E402
import logging
import pandas as pd
from activitysim.core import simulate
from activitysim.core import tracing
from activitysim.core import pipeline
from activitysim... |
"""Thin wrapper around trezor/keepkey libraries."""
import binascii
import collections
import logging
import semver
log = logging.getLogger(__name__)
ClientWrapper = collections.namedtuple(
'ClientWrapper',
['connection', 'identity_type', 'device_name', 'call_exception'])
# pylint: disable=too-many-argumen... |
from django.db.models.signals import post_save, pre_delete, post_delete
from pages.models import Page, slugify
from tags.models import Tag
from links import extract_internal_links, extract_included_pagenames, extract_included_tags
from .models import Link, IncludedPage, IncludedTagList
def record_page_links(page):
... |
from PIL import Image as PImage
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.views.decorators.csrf import ensure_csrf_cookie
from django.http import HttpResponse
from django.http impor... |
import sahara.plugins.mapr.base.base_cluster_context as bc
import sahara.plugins.mapr.services.yarn.yarn as yarn
class Context(bc.BaseClusterContext):
def __init__(self, cluster, version_handler, added=None, removed=None):
super(Context, self).__init__(cluster, version_handler, added, removed)
sel... |
"""
Superuser in Sentry works differently than the native Django implementation.
In Sentry a user must achieve the following to be treated as a superuser:
- ``User.is_superuser`` must be True
- If configured, the user must be accessing Sentry from a privileged IP (``SUPERUSER_ALLOWED_IPS``)
- The user must have a val... |
from django.db import connection
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.conf import settings
from django.template import RequestContext
from django.contrib.auth.models import User
from django.core.cache import cache
from geonode.maps.views import default_map_co... |
try:
import bz2
except ImportError:
bz2 = None
try:
import zlib
except ImportError:
zlib = None
try:
import cPickle as pickle
except ImportError:
import pickle
import sys
from peewee import BlobField
from peewee import buffer_type
PY2 = sys.version_info[0] == 2
class CompressedField(BlobFie... |
"""Contains code for loading and preprocessing image data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
def normalize_image(image):
"""Rescale from range [0, 255] to [-1, 1]."""
return (tf.to_float(ima... |
#$Id: simPIRDetect.py,v 1.2 2005/07/19 17:47:46 phoebusc Exp $
# First, run in a separate window:
# build/pc/main.exe -b=1 -gui 5 # assuming 5 nodes in your file
# Then, run like this at TestPIRDetectNoReg directory:
# java net.tinyos.sim.SimDriver -nosf -script "simPIRDetect.py" -scriptargs "filename simLogName"
#... |
import os
import shutil
import tkFileDialog
import tkMessageBox
from Tkinter import *
from PIL import Image, ImageTk
from maskgen import tool_set, ImageWrapper
from maskgen.ui.ui_tools import ScrollableListbox
import PyPDF2
from maskgen.tool_set import fileType
class FormSelector(Toplevel):
def __init__(self, for... |
import ide
abjad_ide = ide.AbjadIDE(test=True)
def test_AbjadIDE_go_to_builds_directory_01():
"""
From segment directory.
"""
abjad_ide("red gg 02 bb q")
transcript = abjad_ide.io.transcript
assert transcript.titles == [
"Abjad IDE : scores",
"Red Score (2017)",
"Red ... |
import pytest
import functools
from io import BytesIO
from datetime import date, time
from azure.core.exceptions import ClientAuthenticationError, ServiceRequestError, HttpResponseError
from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer._generated.models import AnalyzeOperationResult
fro... |
from gramps.gen.plug import Gramplet
from gramps.gui.widgets.styledtexteditor import StyledTextEditor
from gramps.gui.widgets import SimpleButton
from gramps.gen.lib import StyledText, Note, NoteType
from gramps.gen.filters import GenericFilterFactory, rules
from gramps.gen.utils.db import navigation_label
from gramps.... |
"""Test Z-Wave (central) Scenes."""
from .common import MQTTMessage, setup_ozw
from tests.common import async_capture_events
async def test_scenes(hass, generic_data, sent_messages):
"""Test setting up config entry."""
receive_message = await setup_ozw(hass, fixture=generic_data)
events = async_capture_... |
# Banshee-1 support added by Andrew Stormont <<EMAIL>>
# I've tried to keep compatability for Banshee < 1, it should work fine.
# Saved playlists should also be remebered, this all needs testing though.
# FIXME: This doesn't handle folders and never did, should it?
import os
import gobject
import logging
log = loggin... |
"""Lexical similarity metrics."""
from __future__ import division
from collections import Counter, defaultdict
def _key(one, two):
return ' '.join(sorted([one, two]))
class Jaccard(object):
"""An implementation of the Jaccard similarity metric, as described
in (Tumuluru et al., 2012), section 3.5."""
... |
#!/usr/bin/env python2.7
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--nepoch',type=int,default=20)
parser.add_argument('--version',type=str,default='4')
parser.add_argument('--trunc',type=int,default=7)
parser.add_argument('--limit',type=int,default=100)
parser.add_argument('--a... |
# The file is for editing an HTML document.
# Its user interface is "Htmleditorui.py"
from PyQt4.QtGui import *
from html_and_doc_handler import Htmleditorui
class Maindailog(QMainWindow, Htmleditorui.Ui_MainWindow):
def __init__(self,parent,content=""):
QDialog.__init__(self,parent)
self.setupUi(... |
from factory.django import DjangoModelFactory
from biz.djangoapps.gx_org_group.models import Group, Right
from biz.djangoapps.gx_org_group.builders import OrgTsv
class GroupFactory(DjangoModelFactory):
class Meta(object):
model = Group
class RightFactory(DjangoModelFactory):
class Meta(object):
... |
#!/usr/bin/python
import json
import ipdb
import httplib
import urllib
import sys
import pickle
import time
import gpxpy
import gpxpy.gpx
import glob
import logging
import os
from datetime import datetime
from optparse import OptionParser
batch_size = 1000
sleep_between_batches = 30
sleep_on_errors = 30
cache_file_nam... |
from __future__ import print_function
import traceback
import sys
import getopt
from itertools import chain
from random import sample
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Connect, ClientHelloGenerator, \
ClientKeyExchangeGenerator, ChangeCipherSpecGenerator, \
FinishedGene... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.python import * # pylint: disable=redefined-builtin
# pylint: enable=wildcard-import
from tensorflow.python.util.lazy_loader import LazyLoader
contrib = LazyL... |
import logging
import os
import time
import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from implicit.datasets import _download
log = logging.getLogger("implicit")
URL = "https://github.com/benfred/recommender_data/releases/download/v1.0/sketchfab.hdf5"
def get_sketchfab():
"""Ret... |
"""API tests.
"""
import io
import os
from pathlib import Path
import pytest
import rarfile
#
# test start
#
def test_not_rar():
with pytest.raises(rarfile.NotRarFile):
rarfile.RarFile("rarfile.py", "r")
with pytest.raises(rarfile.NotRarFile):
with open("rarfile.py", "rb") as f:
... |
try:
from setuptools import setup, Extension
except:
from distutils.core import setup, Extension
import glob
import sys
import os
import subprocess
if 'SRC_DIR' in os.environ:
sys.path = glob.glob(os.path.join(os.environ['SRC_DIR'], 'sip', 'sipdest_install')) + sys.path
import sipdistutils
import pkg_res... |
#!/usr/bin/env python
# Built-in
import sys
import os
# Generic
import matplotlib.pyplot as plt
plt.switch_backend('Qt5Agg')
plt.ioff()
# tofu
# test if in a tofu git repo
_HERE = os.path.abspath(os.path.dirname(__file__))
_TOFUPATH = os.path.dirname(os.path.dirname(_HERE))
istofugit = False
if '.git' in os.listdi... |
"""Interfaces view module for prngmgr."""
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import (
HttpResponseNotAllowed,
HttpResponseNotFound,
HttpResponseRedirect,
)
from prngmgr import forms, models
@login_required
def interface... |
import time
import logging
class Cache(object):
def __init__(self, backend='', ttl=300):
self.store = {}
self.expirations = {}
self.ttl = ttl
self.garbageInterval = 60 # how many operations between garbage collection
self.opCount = 0 # count of operations for garbage coll... |
# Django settings for cryptochat project.
import os
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgr... |
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_true, assert_raises
from mne.connectivity import spectral_connectivity
from mne.connectivity.spectral import _CohEst
from mne import SourceEstimate
from mne.utils import run_tests_if_main, slow_test
f... |
import numpy as np
from orbital_elements.meeMl0.gve import GVE
__author__ = "Nathan I. Budd"
__email__ = "<EMAIL>"
__copyright__ = "Copyright 2017, LASR Lab"
__license__ = "MIT"
__version__ = "0.1"
__status__ = "Production"
__date__ = "18 Apr 2017"
class TimeThrust(object):
"""Time-dependent LVLH acceleration as... |
# The following tests are purposely limited to the exposed interface by iorw.py
import os.path
import pytest
import boto3
import moto
from moto import mock_s3
from ..s3 import Bucket, Prefix, Key, S3
@pytest.fixture
def bucket_no_service():
"""Returns a bucket instance with no services"""
return Bucket('my... |
# coding=utf-8
import unittest
"""617. Merge Two Binary Trees
https://leetcode.com/problems/merge-two-binary-trees/description/
Given two binary trees and imagine that when you put one of them to cover the
other, some nodes of the two trees are overlapped while the others are not.
You need to merge them into a new b... |
import json
import urllib
try:
import boto
import boto.iam
import boto.ec2
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
def boto_exception(err):
'''generic error message handler'''
if hasattr(err, 'error_message'):
error = err.error_message
elif hasattr(err, 'message'):
... |
import logging
import luigi
import sciluigi as sl
import math
from subprocess import call
import requests
import time
# ------------------------------------------------------------------------
# Init logging
# ------------------------------------------------------------------------
log = logging.getLogger('sciluigi-i... |
__author__ = 'GHajba'
import argparse
import mdxml
from wordpress_xmlrpc import Client
from wordpress_xmlrpc import WordPressPost
from wordpress_xmlrpc.methods import posts, taxonomies
from os.path import expanduser
from xml2md import xml2md
from file_utils import write_line_at_beginning, read_file_lines, get_folder_n... |
from .list_crossover import ListCrossover
from copy import copy
class ListOrderCrossover(ListCrossover):
"""
Partially Mapped Cross-over (PMX) algorithm
Designed for lists of unique items for which order is important.
:param probability: Probability
:param random: Random
"""
def __init__... |
from datatypes import system_of_record_request_validator
from systemofrecord import configure_logging
from systemofrecord.repository import blockchain_object_repository, chain_repo
from systemofrecord.services import chain_queue_producer
class SystemOfRecordIngestor(object):
def __init__(self):
self.logg... |
import pyelliptic
from pyelliptic import arithmetic as a, OpenSSL
def makeCryptor(privkey):
private_key = a.changebase(privkey, 16, 256, minlen=32)
public_key = pointMult(private_key)
privkey_bin = '\x02\xca\x00\x20' + private_key
pubkey_bin = '\x02\xca\x00\x20' + public_key[1:-32] + '\x00\x20' + public... |
from builtins import object
import numpy as np
import math
import pandas as pd
from neon.data.dataiterator import ArrayIterator
from neon.backends import gen_backend
from neon.initializers import GlorotUniform
from neon.layers import GeneralizedCost, LSTM, Affine, RecurrentLast
from neon.models import Model
from neon.o... |
"""
Plotter for matrix plots that are used in machine learning
and data mining. It plots all 2-D projections of dataset and
can be used for both classification and regression problems.
There is a facility to save plot into a file if it is too large.
"""
import numpy as np
import matplotlib.pyplot as plt
def mplot(dat... |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='selectiveHearing',
version='0.1',
description='A simple, nagios-centric notification system using zeromq with cl... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from collections import namedtuple
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
from pants.backend.jvm.subsystems.zinc_language_mixin import Z... |
"""Main routines for interacting with an Apple TV."""
import asyncio
import datetime # noqa
from ipaddress import IPv4Address
import logging
from typing import Dict, List
import aiohttp
from pyatv import conf, exceptions, interface
from pyatv.airplay import setup as airplay_setup
from pyatv.airplay.pairing import A... |
"""
Platform for the MAX! Cube LAN Gateway.
For more details about this component, please refer to the documentation
https://home-assistant.io/components/maxcube/
"""
from socket import timeout
import logging
import time
from threading import Lock
from homeassistant.components.discovery import load_platform
from hom... |
'''
Facilitates the restart of the pipeline.
EVLA_pipe_restore.py needs to be run before hand
'''
pipeline_scripts = ['startup', 'import', 'msinfo', 'fake_flagall',
'calprep', 'priorcals', 'testBPdcals',
'flag_baddeformatters', 'flag_baddeformattersphase',
'... |
from gi.repository import Gdk, GLib
from gettext import gettext as _
from lollypop.thirdparty.GioNotify import GioNotify
from lollypop.define import Lp, ArtSize, Type
from lollypop.utils import is_gnome
class NotificationManager:
"""
Freedesktop notification support
"""
def __init__(self):
... |
import logging
from mpl_toolkits.mplot3d import *
import matplotlib.pyplot as plt
import numpy as np
from random import random, seed
from matplotlib import cm
class Plotter:
logging.basicConfig(filename='adaline.log', level=logging.DEBUG)
def plot3d(self, inputs, targets, title, weights, threshold):
... |
"""HTML utilities suitable for global use."""
from __future__ import unicode_literals
import re
from django.utils.encoding import force_text, force_str
from django.utils.functional import allow_lazy
from django.utils.safestring import SafeData, mark_safe
from django.utils import six
from django.utils.six.moves.urlli... |
"""Installs some sample data. Here we have a handful of postal codes for
a few US/Canadian cities. Then, 100 Person records are installed, each
with a randomly selected postal code.
"""
import random
from .environment import Base
from .environment import Session
from .model import Address
from .model import City
... |
from AppKit import NSBezierPath
def roundedRectBezierPath(rect, radius,
roundUpperLeft=True, roundUpperRight=True, roundLowerLeft=True, roundLowerRight=True,
closeTop=True, closeBottom=True, closeLeft=True, closeRight=True):
(rectLeft, rectBottom), (rectWidth, rectHeight) = rect
rectTop = rec... |
from yowsup.stacks import YowStack
from .layer import SendLayer
from yowsup.layers import YowLayerEvent
from yowsup.layers.auth import YowCryptLayer, YowAuthenticationProtocolLayer, AuthError
from yowsup.layers.coder import YowCoderLayer
from yowsup.layers.network ... |
#!/usr/bin/env python3
import os
import sys
import time
import importlib.util as imu
import testlib
# Loads a python module from a path, giving it a particular name.
def __load_mod_from_file(path, name):
spec = imu.spec_from_file_location(name, path)
mod = imu.module_from_spec(spec)
spec.loader.exec_modu... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abstractproperty
import six
from pants.engine.addressable import Exactly
from pants.util.meta import AbstractClass
from pants.util.objects import dat... |
#
# The class for the Blue Gene's memory-alignment transformation module
#
import sys
import codegen, module.module, parser
#-----------------------------------------
class Align(module.module.Module):
'''Memory-alignment transformation module'''
def __init__(self, perf_params, module_body_code, annot_body_... |
import logging
import logging.config
import os
import sys
import time
import argparse
from signal import SIGTERM
class UnixDaemon:
"""A generic unix daemon. This class needs to be inherited and the run method overwritten to
create a specific deamon.
Example (my_daemon.py)
Run with: python my_dae... |
import os
import data
from utils import assert_403
def test_userapp_document_handling(IndivoClient):
PRD = 'prd'
try:
admin_client = IndivoClient(data.machine_app_email, data.machine_app_secret)
record_id = admin_client.create_record(data=data.demographics).response[PRD]['Record'][0]
admin_client.set... |
import sys, os
import json, bson
class LiveDict(dict):
def __init__(self, file, *args, **kwargs):
self.filename = file
if os.path.exists(file):
with open(self.filename, "r", encoding=sys.getdefaultencoding()) as f:
self.update(eval(f.read()))
else:
self.clear()
self.update(*args, **kwargs)
def... |
"""Groups for the Google Monitoring API."""
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import object
import collections
import fnmatch
import pandas
import google.datalab
from . import _utils
class Groups(object):
"""Represents a list of Stackdriver groups for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.