content stringlengths 4 20k |
|---|
import random
import sys
from string import atoi
def powerball(n):
p1 = random.randint(1,35)
p2 = random.randint(36,52)
p3 = random.randint(53,60)
p4 = random.randint(61,65)
p5 = random.randint(66,69)
p = random.randint(1,26)
x = ([p1,p2,p3,p4,p5],10)
#print p1,p2,p3,p4,p5,p
p1 = random.randint(36,69)
p2 = r... |
"""Resource escaping supplementary help."""
from googlecloudsdk.calliope import base
# NOTE: If the name of this topic is modified, please make sure to update all
# references to it in error messages and other help messages as there are no
# tests to catch such changes.
class Escaping(base.Command):
"""List/dictio... |
from threading import Thread
from gi.repository import GObject
def thread(function):
"""
threads.thread is a method decorator that makes sure that the decorated
function is executed in a threading.Thread.
No parameters are required.
Usage example:
class GUI:
@threads.thread
def this_will_be_exec... |
from dtest import Tester
from tools import insert_c1c2, query_c1c2, no_vnodes, new_node
from assertions import assert_almost_equal
import os, sys, time
from ccmlib.cluster import Cluster
from cassandra import ConsistencyLevel
@no_vnodes()
class TestTopology(Tester):
def movement_test(self):
cluster = sel... |
"""
py2app/py2exe build script for Freedom Flies.
Will automatically ensure that all build prerequisites are available
via ez_setup
Usage (Mac OS X):
python setup.py py2app
Usage (Windows):
python setup.py py2exe
"""
#import ez_setup
#ez_setup.use_setuptools()
import sys
from setuptools import setup... |
from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import Qt, pyqtSignal
from PyQt4.QtGui import QColor
from maptool import MapTool
class MoveTool(MapTool):
def __init__(self, canvas, layers):
MapTool.__init__(self, canvas, layers)
self.band = None
self.feature = None
self.startcoord = None
d... |
import os.path
import sys
from autotweet import __version__ as version
try:
from setuptools import find_packages, setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import find_packages, setup
def readme():
try:
with open(os.path.join(os.path.di... |
import os
from fretwork import log
from fofix.core.Language import _
from fofix.core import Config
from fofix.core import Theme
def _getModPath(engine):
return engine.resource.fileName("mods")
def init(engine):
# define configuration keys for all available mods
for m in getAvailableMods(engine):
... |
import re
translation_dict = {'\\Sigma':'Σ',
'\\Delta':'Δ',
'\\Pi':'Π',
'\\mu':'μ',
'\\nu':'ν',
}
def parse_mathmode(string):
# find brackets
reg_brackets = re.compile('{[^}]*}')
in_br... |
# pylint: disable-msg=W0611, W0612, W0511,R0201
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
from __future__ import division, absolute_import, print_function
import num... |
#!/usr/bin/env python3
from sympy import *
from mpmath import *
from matplotlib.pyplot import *
#init_printing() # make things prettier when we print stuff for debugging.
# ************************************************************************** #
# Self-Inductance L of copper coil with hollow copper cylinder ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Folds the contents of multiple JSON files into one JSON file. Intended as a
convenience for importing Google Photos albums to Flickr, because Google Photos
albums seem to occasionally be split into two folders, each with JSON metadata
that may or may not be the same.
... |
from .voc_parser import VOCParser
from .data_utils import get_class_names
from .data_utils import merge_two_dictionaries
class DataManager(object):
def __init__(self, dataset_name='VOC2007', split='train',
class_names='all', with_difficult_objects=True,
dataset_path='../datasets/... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... |
import boto.pyami.installers
import os
import os.path
import stat
import boto
import random
from pwd import getpwnam
class Installer(boto.pyami.installers.Installer):
"""
Base Installer class for Ubuntu-based AMI's
"""
def add_cron(self, name, command, minute="*", hour="*", mday="*", month="*", wday="*... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChan... |
#! /usr/bin/python
"""
alarm.py
By Paul Malmsten, 2010
<EMAIL>
This module will communicate with a remote XBee device in order to
implement a simple alarm clock with bed occupancy detection.
"""
import serial
from xbee import XBee
class DataSource(object):
"""
Represents a source from which alarm times may... |
from unittest import mock
from mistralclient.api.v2 import event_triggers
from mistralclient.commands.v2 import event_triggers as event_triggers_cmd
from mistralclient.tests.unit import base
TRIGGER_DICT = {
'id': '456',
'name': 'my_trigger',
'workflow_id': '123e4567-e89b-12d3-a456-426655440000',
'wo... |
from __future__ import absolute_import
from rest_framework import serializers
from rest_framework.response import Response
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.models import Environment, Env... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Vincent Ollivier <<EMAIL>>
This file is part of OpenNMS Configuration Tools.
OpenNMS Configuration Tools 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 vers... |
#! /usr/bin/env python
import multiprocessing
import os
import logging
import logging.config
import shutil
import subprocess
import sys
import time
def find_output_path(argv):
for i, arg in enumerate(argv):
if arg == "-o": return argv[i+1]
return None
def repl_output_path(argv, path):
_argv = argv[:]
fo... |
import os
import re
import sqlite3 as lite
import time
import calendar
from datetime import datetime
import arrow
import discord
from discord.ext import commands
from lib import customconverter as cconv
import parsedatetime
QUOTES_REGEX = '(["].{0,1000}["])'
def chunks(l, n):
"""Yield successive n-sized chunks ... |
from sympy import symbols
from sympy.physics.mechanics import Point, ReferenceFrame, Dyadic, RigidBody
from sympy.physics.mechanics import dynamicsymbols, outer, inertia
from sympy.physics.mechanics import inertia_of_point_mass
def test_rigidbody():
m, m2, v1, v2, v3, omega = symbols('m m2 v1 v2 v3 omega')
A ... |
from os.path import join, dirname
with open(join(dirname(__file__), 'scrapyd/VERSION')) as f:
version = f.read().strip()
setup_args = {
'name': 'scrapyd',
'version': version,
'url': 'https://github.com/scrapy/scrapyd',
'description': 'A service for running Scrapy spiders, with an HTTP API',
'l... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
from twitter.common.collections import OrderedSet
from pants.base.build_environment import get_buildroot
from pants.base.build_manual import manual
from pa... |
'''GenoMEL-Bionimbus Protected Data Cloud SLURM runner'''
import argparse
import utils.workflow
def is_nat(pos):
'''Checks that a value is a natural number.'''
if int(pos) > 0:
return int(pos)
raise argparse.ArgumentTypeError('{} must be positive, non-zero'.format(pos))
def get_args():
'''Loa... |
# -*- coding: utf-8 -*-
from statsmodels.compat.python import StringIO
import numpy as np
from statsmodels.stats.anova import anova_lm
from statsmodels.formula.api import ols
from pandas import read_table
kidney_table = StringIO("""Days Duration Weight ID
0.0 1 1 1
2.0 1 1 ... |
"""Support for MySensors binary sensors."""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES,
DOMAIN,
BinarySensorDevice,
)
from homeassistant.const import STATE_ON
SENSORS = {
"S_DOOR": "door",
"S_MOTION": "motion",
"S_SMOKE": "... |
# encoding: utf-8
from unittest import TestCase, main as unittest_run
from data_tools.classification.algorithms.knn import KNearestNeighbour
from data_tools.classification.datastructures.training_data import TrainingData
class KNNClassificationAlgorithmTests(TestCase):
""" Tests suite for base ClassificationAlgo... |
from __future__ import absolute_import, division, print_function
import pytest
from cryptography.exceptions import _Reasons
from cryptography.hazmat.backends.interfaces import HMACBackend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.twofactor import InvalidToken
from cryptogra... |
"""
"""
from msml.frontend import App
from msml.model.alphabet import Slot
from msml.sorts import conversion
__author__ = 'Alexander Weigl <<EMAIL>>'
__date__ = "2014-09-27"
import jinja2
TEMPLATE = """
from msml.factory.base import WorkflowBuilderBase, create_object_element, TaskDummyResult
from msml.factory imp... |
from alife.agents.agent import Agent
from nupic.bindings.algorithms import SpatialPooler as SP
from nupic.encoders.utility import SimpleUtilityEncoder as UtilEncoder
from nupic.algorithms.CLAClassifier import CLAClassifier as Clas
import numpy
def evalFn(l):
return sum(l)
class SpatialPoolerAgent(Agent):
""" ag... |
from __future__ import print_function
import sys
try:
import unittest2 as unittest
except:
import unittest
import uuid
import platform
import moose
class TestVec(unittest.TestCase):
"""Test pymoose basics"""
def testCreate(self):
em = moose.vec('/test', 10, 0, 'Neutral')
self.assertEqu... |
import logging
import traceback
from django.db.models.sql import EmptyResultSet
from django.utils import timezone
from silk.collector import DataCollector
from silk.config import SilkyConfig
Logger = logging.getLogger('silk.sql')
def _should_wrap(sql_query):
if not DataCollector().request:
return False... |
from openerp.osv import osv, fields
class account_voucher(osv.Model):
"""
Add the voucher's type as a selection criterium for
default values by setting change_default to True.
Now you can use appropriate defaults
for e.g. write off settings per voucher type.
"""
_inherit = 'account.vouche... |
"""
Copyright 2013 AKSW Research Group http://aksw.org
This file is part of LODStats.
LODStats 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 License, or
(at your option) any later versi... |
import sys
import time
import dis
import traceback
from browser import doc
from javascript import JSObject
# set height of container to 66% of screen
_height = doc.documentElement.clientHeight
_s = doc['container']
_s.style.height = '%spx' % int(_height*0.66)
has_ace = True
try:
editor=JSObject(ace).edit("editor... |
import platform
kDeltaPrefix="D-"
class ChartServerData:
def __init__(self,serverName,serverArray):
self.serverName = serverName
self.serverArray = serverArray
class ChartData:
def __init__(self):
self.headers = None
self.serverArray = []
class ChartHTML:
... |
#!/usr/bin/env python
# coding=utf-8
import MySQLdb, sys
from collections import OrderedDict
class MysqlPython(object):
"""
Python Class for connecting with MySQL server and accelerate development project using MySQL
Extremely easy to learn and use, friendly construction.
"""
__instance ... |
"""test the inspection registry system."""
from sqlalchemy.testing import eq_, assert_raises_message, is_
from sqlalchemy import exc, util
from sqlalchemy import inspect
from test.orm import _fixtures
from sqlalchemy.orm import class_mapper, synonym, Session, aliased
from sqlalchemy.orm.attributes import instance_stat... |
import numpy as np
from .widget import Widget
from ...visuals import AxisVisual
class AxisWidget(Widget):
"""Widget containing an axis
Parameters
----------
orientation : str
Orientation of the axis, 'left' or 'bottom'.
**kwargs : dict
Keyword arguments to pass to AxisVisual.
... |
"""Blend modes."""
import math
from operator import itemgetter
SUPPORTED = frozenset(
[
'normal', 'multiply', 'darken', 'lighten', 'color-burn', 'color-dodge', 'screen',
'overlay', 'hard-light', 'exclusion', 'difference', 'soft-light',
'hue', 'saturation', 'luminosity', 'color'
]
)
NON... |
import unittest
from datetime import datetime
from mock import Mock, patch
from rasterio.io import DatasetReader
from rasterio.coords import BoundingBox
from affine import Affine
from thinkhazard.models import HazardLevel, HazardSet, HazardType, Layer, Region
from thinkhazard.processing.completing import Completer
fr... |
"""
Shaft path.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.creation import lineation
from fabmetheus_utiliti... |
import re
import random
import base64
from scrapy import log
class RandomProxy(object):
def __init__(self, settings):
self.proxy_list = settings.get('PROXY_LIST')
fin = open(self.proxy_list)
self.proxies = {}
for line in fin.readlines():
parts = re.match('(\w+://)(\w+:\... |
"""
File Name: data_mining.py
Developer: Justin A. Shores
Date Last Modified: Fri Oct 24 16:45:01 PDT 2014
Description: In this project, we want to do some preliminary data mining to the prices of some
company’s stock. So that we can speak in specifics, let’s look at Google. Your program
will calculate the monthly ave... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import fnmatch
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
... |
import sys
import six
from django.template.loader import render_to_string
from django.template import TemplateSyntaxError # noqa
from django.utils.datastructures import SortedDict
from horizon import exceptions
from horizon.utils import html
SEPARATOR = "__"
CSS_TAB_GROUP_CLASSES = ["nav", "nav-tabs", "ajax-tabs"]... |
"""
Crazy Egg template tags and filters.
"""
from __future__ import absolute_import
import re
from django.template import Library, Node, TemplateSyntaxError
from analytical.utils import is_internal_ip, disable_html, get_required_setting
ACCOUNT_NUMBER_RE = re.compile(r'^\d+$')
SETUP_CODE = """<script type="text/j... |
from extra_views import ModelFormSetView
from django.forms import Textarea, TextInput
from django.db.models import Q
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic.list import ListView
from django.views.generic import TemplateView... |
"""
"django-reporting" is a pluggable application to connect Django to Geraldo.
You must register a Report class, relating it to a model class inside a Django
application and use the template tags to take advantage on its power.
"""
VERSION = (0, 1, 'incomplete')
def get_version():
return '%d.%d-%s'%VERSION
__a... |
# -*- encoding: utf-8 -*-
"""
Usage::
arf-report [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
delete Delete an ARF Report
download Download bzi... |
import time
import math
class Section:
def __init__(self, header: str='', output: str='', data={}) -> None:
'''Generiec progress bar section interface.'''
self.header = header
self.output = output
self.data = data
self.width = 0
def update(self):
'''Custom logi... |
import logging
import unittest
import docker
import requests.exceptions
import tempfile
import shutil
from utils.dockerutils import (
exec_dockerps,
exec_docker_history,
exec_dockerinspect,
_get_docker_server_version,
_fix_version,
get_docker_container_rootfs_path
)
# Tests con... |
"""
Middleware (filters) for Indivo
Pre-processes paramaters that are passed to Indivo views,
replacing id strings with their corresponding Django models,
including records, accounts, carenets, etc...
This is helpful to view functions, accesscontrol, and auditing.
"""
from django.http import Http404
from indivo imp... |
__author__ = "Yaroslav Halchenko"
__copyright__ = "Copyright (c) 2013 Yaroslav Halchenko"
__license__ = "GPL"
import logging
import os
import re
import sys
import time
import unittest
from StringIO import StringIO
from ..server.mytime import MyTime
from ..helpers import getLogger
logSys = getLogger(__name__)
CONFIG... |
"""Distinct VTEC"""
import calendar
import numpy as np
from pandas.io.sql import read_sql
import seaborn as sns
import pyiem.nws.vtec as vtec
from pyiem import reference
from pyiem.plot import figure_axes
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFound
PDICT = {
"w... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pyexpect.replwrap will not work with unicode_literals
#from __future__ import unicode_literals
import copy
import os
import psutil
import random
import re
import shutil
import signal
import subprocess
import ... |
"""Support for IKEA Tradfri switches."""
from homeassistant.components.switch import SwitchEntity
from .base_class import TradfriBaseDevice
from .const import CONF_GATEWAY_ID, DEVICES, DOMAIN, KEY_API
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load Tradfri switches based on a config ... |
import datetime
import re
import sys
import uuid
import bson
sys.path[0:0] = [""] # noqa
from mongo_connector.doc_managers.formatters import (
DefaultDocumentFormatter,
DocumentFlattener,
)
from tests import unittest
class TestFormatters(unittest.TestCase):
@classmethod
def setUpClass(cls):
... |
# -*- coding: utf-8 -*-
#### Script for Liwc vocabulary evaluation
####
#### There will be used three dictionaries:
####
#### LIWC for Portuguese (Subject of the evaluation)
#### OpinionLexicon
#### SentiLex
####
#### Two experiments are conducted
#### Vocabulary Agreeement
#### Score eachieved by... |
from openpyxl import Workbook
import datetime
from pyDEA.core.models.peel_the_onion import peel_the_onion_method
from pyDEA.core.data_processing.write_data_to_xls import XLSWriter
from pyDEA.core.data_processing.parameters import Parameters, parse_parameters_from_file
from pyDEA.core.models.multiplier_model_decorators... |
"""Support for QNAP NAS Sensors."""
from datetime import timedelta
import logging
from qnapstats import QNAPStats
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_NAME,
CONF_HOST,
CONF_MONITORED_CONDITIONS,
CONF_P... |
import logging
import urllib
import feedparser
from flexget import plugin, validator
from flexget.entry import Entry
from flexget.event import event
from flexget.plugins.api_tvrage import lookup_series
__author__ = 'deksan'
log = logging.getLogger('newznab')
class Newznab(object):
"""
Newznab search plugi... |
from core.himesis import Himesis
import uuid
class HSon2Man(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule Son2Man.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HSon2Man, self).... |
#!/usr/bin/env python
'''This starts an SSH tunnel to a given host. If the SSH process ever dies then
this script will detect that and restart it. I use this under Cygwin to keep
open encrypted tunnels to port 25 (SMTP), port 143 (IMAP4), and port 110
(POP3). I set my mail client to talk to localhost and I keep this s... |
from __future__ import unicode_literals
from future.builtins import str
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.db import connection
from django.http import HttpResponse
from django.utils.unittest import skipUnless
from django.shortcuts import res... |
"""Module that defines a transport for RPC connections.
A transport can send to and receive messages from some endpoint.
"""
from ganeti.errors import LuxiError
class ProtocolError(LuxiError):
"""Denotes an error in the LUXI protocol."""
class ConnectionClosedError(ProtocolError):
"""Connection closed error.... |
#!/usr/bin/env python
#
# $Id: setup.py 54355 2007-03-13 20:25:50Z thomas.heller $
#
#
"""ctypes is a Python package to create and manipulate C data types in
Python, and to call functions in dynamic link libraries/shared
dlls. It allows wrapping these libraries in pure Python.
"""
LIBFFI_SOURCES='source/libffi'
__ve... |
#!/usr/bin/env python
# scapy.contrib.description = VLAN Trunking Protocol (VTP)
# scapy.contrib.status = loads
"""
VTP Scapy Extension
~~~~~~~~~~~~~~~~~~~~~
:version: 2009-02-15
:copyright: 2009 by Jochen Bartl
:e-mail: <EMAIL> / <EMAIL>
:license: GPL v2
This program is free ... |
#!/usr/bin/python
""" Tests for blaze """
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import shlex
import time
from subprocess import Popen
import pandas as pd
import blaze as bl
import odo
USER = os.getenv('USER')
HOSTNAME = os.uname()[1]
... |
"""distutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution)."""
import os
import sys
from glob import glob
from warnings import warn
from distutils.core import Command
from distutils import dir_util
from distutils import file_util
from distutils import archive_util
from distuti... |
import socket
import time
import sys
import os
from .command import Command, Commands
from .protocol import BaseIPCProtocol
__author__ = 'salvia'
def check_pid(pid):
""" Check For the existence of a unix pid. """
try:
os.kill(pid, 0)
except OSError:
return False
else:
return Tr... |
#
# -*- coding: utf-8 -*-
#
import logging
import traceback
from twisted.internet.task import deferLater
from twisted.internet.defer import inlineCallbacks, returnValue, Deferred
from twisted.internet import reactor, protocol
from twisted.protocols.memcache import MemCacheProtocol, DEFAULT_PORT
from django.conf imp... |
from itertools import islice
from test import get_user_session, cassette
from test.resources.documents import create_group_document, delete_all_group_documents
def test_should_iterate_through_documents():
session = get_user_session()
delete_all_group_documents()
with cassette('fixtures/resources/trash/i... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 30 20:56:07 2015
@author: agiovann
"""
#%% add CalBlitz folder to python directory
path_to_CalBlitz_folder='/home/ubuntu/SOFTWARE/CalBlitz'
path_to_CalBlitz_folder='C:/Users/agiovann/Documents/SOFTWARE/CalBlitz/CalBlitz'
import sys
sys.path
sys.path.append(path_to_CalBlit... |
"""Classes to handle image files
Collection of classes to handle image upload/download to/from Image service
(like Glance image storage and retrieval service) from/to ESX/ESXi server.
"""
import httplib
import urllib
import urllib2
import six.moves.urllib.parse as urlparse
from nova.openstack.common import log as ... |
"""Fibre Channel Driver for DataCore SANsymphony storage array."""
from oslo_log import log as logging
from cinder import exception as cinder_exception
from cinder.i18n import _
from cinder import interface
from cinder import utils as cinder_utils
from cinder.volume.drivers.datacore import driver
from cinder.volume.d... |
"""
Tests for dit.multivariate.interaction_information.
"""
from __future__ import division
import pytest
from dit import Distribution as D
from dit.multivariate import interaction_information, coinformation
from dit.example_dists import Xor
@pytest.mark.parametrize('i', range(2, 6))
def test_ii1(i):
""" Test ... |
import abc
import os
from StringIO import StringIO
from docx import Document
from docx.shared import Inches
from docx.enum.section import WD_ORIENT
class DOCXReport(object):
def __init__(self, root_path, context):
self.root_path = root_path
self.context = context
def build_report(self):
... |
#!/usr/bin/env python
""" Mission 5-CORAL SURVEY
Set map border, size and origin
Set quadrants of interest
Do zigzag scouting to respective quadrants (perpetual)
If shape identified or duration timeout
Shape identified->set global parameter for gui
continue to next quadrant
If both shapes identified or to... |
from guardian.models import GroupObjectPermission
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.signals import post_save, pre_save, post_delete, pre_delete
from django... |
#Main for the Big Data Team Data Driven Dreamers
#Rosario, Alejandro, Wendy and Bishwo
#Using Seaborn to make the graphs from the data usage
#%matlibplot
import numpy as np
import seaborn as sns
import pandas as pd
#ScatterPlot Property Value vs noise complaints per unit
sns.set_style("whitegrid")
compData = pd.r... |
from ..common.ConfigGroup import ConfigGroup
from .CGLetter import CGLetter
class CGLetterWizard (ConfigGroup):
def __init__(self):
self.cp_LetterType = int()
self.cp_BusinessLetter = CGLetter()
self.cp_PrivateOfficialLetter = CGLetter()
self.cp_PrivateLetter = CGLetter() |
# -*- coding: utf-8 -*-
"""Here is a very basic handling of accounts.
If you have your own account handling, don't worry,
just switch off account handling in
settings.WIKI_ACCOUNT_HANDLING = False
and remember to set
settings.WIKI_SIGNUP_URL = '/your/signup/url'
SETTINGS.LOGIN_URL
SETTINGS.LOGOUT_URL
"""
from djang... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import datetime
import mock
import pytz
import six
from django.core import mail
from django.utils import timezone
from exam import fixture
from mock import Mock
from sentry.digests.notifications import build_digest, event_to_record
from se... |
# encoding: utf-8
"""
ipreach.py
Created by Evelio Vila on 2016-11-26. <EMAIL>
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from __future__ import division
from struct import unpack
from ipaddress import ip_address
from exabgp.protocol.ip import IP
... |
import WebIDL
def WebIDLTest(parser, harness):
testData = [("::TestAttr%s::b", "b", "Byte%s", False),
("::TestAttr%s::rb", "rb", "Byte%s", True),
("::TestAttr%s::o", "o", "Octet%s", False),
("::TestAttr%s::ro", "ro", "Octet%s", True),
("::TestAttr%s::... |
import collections
import logging
import os
import pkgutil
from django.utils import importlib
import six
from horizon.utils import file_discovery as fd
def import_submodules(module):
"""Import all submodules and make them available in a dict."""
submodules = {}
for loader, name, ispkg in pkgutil.iter_mo... |
from contextlib import contextmanager
import unittest
from flexmock import flexmock, flexmock_teardown
from hamcrest import assert_that, equal_to, is_, instance_of
import mock
from tests.adapters.switches.juniper_test import an_ok_response, is_xml, a_configuration
from netman.adapters.switches import juniper
from net... |
'''
QUESTION:
This function returns a list of tuples.
The ith tuple contains the ith element from each of the argument sequences or iterables.
If the argument sequences are of unequal lengths,
then the returned list is truncated to the length of the shortest argument sequence.
>>> print zip([1,2,3,4,5,6],'Hac... |
""" This is a MINIMAL implementation of an MVC using Cherrypy
"""
import cherrypy
class MVC_Cherry(object):
"""Main class for MVC-Cherry application.
"""
# Controller
# In this simple example the function name maps to the
# path_specification on http://127.0.0.1:8080/Fibopage?fidx=[INTEGER]
... |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os
import shutil
import mimetypes
import nbformat
from tornado import web
from .filecheckpoints import FileCheckpoints
from .fi... |
__author__ = 'quentin'
#import futures
import concurrent.futures as futures
import concurrent
import urllib.request, urllib.error, urllib.parse
import time
import logging
import json
start = time.time()
def scan_one_device(ip, timeout=2.5, port=9000, page="id"):
"""
:param url: the url to parse
:param... |
import mock
from odoo.addons.connector_carepoint.unit import import_synchronizer
from .common import SetUpCarepointBase
model = 'odoo.addons.connector_carepoint.unit.import_synchronizer'
class TestDirectBatchImporter(SetUpCarepointBase):
def setUp(self):
super(TestDirectBatchImporter, self).setUp()
... |
import twitter
import os
import re
import time
import calendar
from collections import defaultdict
from sys import exit
hour = time.gmtime().tm_hour
if hour % 3 != 0:
exit()
tweet_type = (hour // 3) % 4
re_score_zh = re.compile(r'^在樂曲(?P<song>.+)中取得(?P<grade>\w+) Grade。分數 (?P<score>\d{7}) \#Dynamix$')
re_score_ja... |
"""Tests for tensorflow.ops.math_ops.matrix_inverse."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
from absl.testing import parameterized
import numpy as np
from tensorflow.compiler.tests import xla_test
from tensorflow.python.ops im... |
__author__ = 'skaper'
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
import os
version = 1.0
class Data(QtCore.QThread):
#arrayImg = QtCore.pyqtSignal(QtCore.QImage)#np.ndarray)
def __init__(self, sock):
QtCore.QThread.__init__(self)
self.sock = sock
def __del__(self):
sel... |
# -*- coding: utf-8
import os
import sys
import jwt
import time
import random
import ipaddress
from netaddr import IPNetwork, IPAddress
from commons.settings import DOMAIN, NODE_NETWORK, REGISTRY_IP_WHITELIST, LAIN_ADMIN_NAME
from ipaddress import IPv4Address
from log import logger
PRV_FILE = "conf/server.key"
PUB_F... |
import gdb
import re
import itertools
class EigenMatrixPrinter:
"Print Eigen Matrix or Array of some kind"
def __init__(self, variety, val):
"Extract all the necessary information"
# Save the variety (presumably "Matrix" or "Array") for later usage
self.variety = variety
# The gdb extension does not supp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.