content string |
|---|
from tkinter import *
from dataFunc import *
from analysis import *
from linRegression import gradient, intercept
class DataInspectionWindow:
def __init__(self, parent, dataset):
self.data = dataset
self.windowParent = parent
self.mainContainer = Frame(parent)
self.mainContainer.g... |
"""Application Risks Class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
import logging
class ApplicationRisks(APIClassTemplate):
"""The ApplicationRisks Object in the FMC."""
VALID_JSON_DATA = ["id", "name", "type"]
VALID_FOR_KWARGS = VALID_JSON_DATA + []
URL_SUFFIX = "/objec... |
from prismriver.plugin.common import Plugin
from prismriver.struct import Song
class ChartlyricsPlugin(Plugin):
ID = 'chartlyrics'
RANK = 3
def __init__(self, config):
super(ChartlyricsPlugin, self).__init__('Chartlyrics', config)
def search_song(self, artist, title):
link = "http://... |
import ast
import sys
PY2 = sys.version_info < (3, 0)
if PY2:
from cStringIO import StringIO as cStringIO
else:
from io import StringIO as cStringIO
# Large float and imaginary literals get turned into infinities in the AST.
# We unparse those infinities to INFSTR.
INFSTR = "1e" + repr(sys.float_info.max_10_... |
# -*- coding: utf-8 -*-
import pytest
import time
import unittest.mock
from girder import events
class EventsHelper:
def __init__(self):
self.ctr = 0
self.responses = None
def _raiseException(self, event):
raise Exception('Failure condition')
def _increment(self, event):
... |
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse, reverse_lazy
from django.views.generic.edit import FormView, UpdateView
from django.contrib import messages
from password_reset.forms import PasswordRecoveryForm
from password_reset.views import Recover
from django.c... |
from testlib_avocado.seleniumlib import SeleniumTest, clickable
import os
import sys
machine_test_dir = os.path.dirname(os.path.realpath(__file__))
if machine_test_dir not in sys.path:
sys.path.insert(1, machine_test_dir)
class TestDashboard(SeleniumTest):
"""
:avocado: enable
"""
def testDashbo... |
import math
try:
import property
except ModuleNotFoundError:
from util import property
SENTENCE_BREAK_PROPERTY = "data/ucd/auxiliary/SentenceBreakProperty.txt"
code_props = property.read(SENTENCE_BREAK_PROPERTY)
for i in range(len(code_props)):
if code_props[i] is None:
code_props[i] = 'Other'
p... |
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon HealthLake"
prefix = "healthlake"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
super().__init__(prefix, action)
class ARN(BaseARN):
def __init__(self, resource: str = "", region: str =... |
"""
Logging functions
@contact: Debian FTP Master <<EMAIL>>
@copyright: 2001, 2002, 2006 James Troup <<EMAIL>>
@license: GNU General Public License version 2 or later
"""
# 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
# th... |
import pytest
from datetime import timedelta
from django.http import Http404
from nomination import feeds
from . import factories
pytestmark = pytest.mark.django_db
class TestURLFeed:
def test_get_object(self, rf):
project = factories.ProjectFactory()
request = rf.get('/')
feed = feed... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 28 13:18:34 2016
@author: okada
"""
import unittest
import os
import sys
import test_utils
import subprocess
class TestSet(unittest.TestCase):
CURRENT = os.path.abspath(os.path.dirname(__file__) + "/../")
dataset = CURRENT + "/dataset/mutation/"
REF = CURRE... |
import logging
import multiprocessing as mp
import os
import subprocess
import tempfile
from collections import defaultdict
from gtdbtk.config.config import LOG_TASK
from gtdbtk.exceptions import GTDBTkExit
from gtdbtk.external.hmm_aligner import HmmAligner
from gtdbtk.io.marker.copy_number import CopyNumberFile
from ... |
import gtk
import gobject
import gettext
import tryton.common as common
from tryton.config import CONFIG
import tryton.rpc as rpc
_ = gettext.gettext
class DBRestore(object):
def event_show_button_restore(self, widget, event, data=None):
"""
This event method decide by rules if the restore button... |
import demistomock as demisto
from CommonServerPython import *
# Disable insecure warnings
requests.packages.urllib3.disable_warnings()
DEFAULT_OUTGOING_MAPPER = "User Profile - Salesforce (Outgoing)"
DEFAULT_INCOMING_MAPPER = "User Profile - Salesforce (Incoming)"
URI_PREFIX = '/services/data/v44.0/'
GENERATE_TOKEN... |
"""Contains the logic for `aq update service --instance`."""
from aquilon.worker.broker import BrokerCommand
from aquilon.aqdb.model import Service, ServiceInstance
class CommandUpdateServiceInstance(BrokerCommand):
requires_plenaries = True
required_parameters = ["service", "instance"]
def render(self... |
import re
from collections import OrderedDict
from operator import itemgetter
from urllib import urlencode
from django.conf import settings
from decouple import Csv, config
from product_details import ProductDetails
from bedrock.base.waffle import switch
from lib.l10n_utils.dotlang import _lazy as _
# TODO: port t... |
'''
Created on 2015年12月1日
@author: Darren
'''
global count
count=0
def solve(nums,target):
expression=[str(num) for num in nums]
if solveUtil(nums,target,expression,len(nums)):
print(expression[0])
else:
print("No result!")
def solveUtil(nums,target,expression,n):
global count
cou... |
"""
homeassistant.components.thermostat.radiotherm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for Radio Thermostat wifi-enabled home thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.radiotherm/
"""
import logging
im... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from gmail import Gmail
def main():
# Bob is sender, Alide is destination.
from_address = "<EMAIL>"
to_address = "<EMAIL>"
file_info = {"type":"pdf", "subtype":"pdf"}
a_title = u"Research: slide of today"
a_body = u'''Dear Alice.
Good afterno... |
# Online Bayesian linear regression using Kalman Filter
# Based on: https://github.com/probml/pmtk3/blob/master/demos/linregOnlineDemoKalman.m
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from numpy.linalg import inv
def kf_linreg(X, y, sigma2, mu0, Sigma0, A):
"""
Online e... |
import pytest
import requests
class Object(object):
pass
@pytest.fixture
def lasttrade_request (monkeypatch) :
def foo () :
def test_request (url, params) :
obj = Object()
obj.text = """<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yah... |
__version__ = '0.0.4'
# VIM options (place at end of file)
# vim: ts=4 sts=4 sw=4 expandtab: |
import proto # type: ignore
from google.ads.googleads.v8.resources.types import payments_account
__protobuf__ = proto.module(
package="google.ads.googleads.v8.services",
marshal="google.ads.googleads.v8",
manifest={"ListPaymentsAccountsRequest", "ListPaymentsAccountsResponse",},
)
class ListPaymentsAc... |
''' A parser for blocks written in C++ '''
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import re
import sys
import logging
logger = logging.getLogger(__name__)
def dummy_translator(the_type, default_v=None):
""" Doesn't really translate. "... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <<EMAIL>>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Support for smart import syntax for web2py applications
-------------------------------------------------------
"""
fr... |
#
# Physical units of measure
# AssertionError(s) are raised when incompatible operations are executed
#
from math import pi
class meters(float):
def __add__(self, *args):
assert isinstance(args[0], meters), \
"Incorrect units: %s %s" % (type(self), type(args[0]))
return super(meters, ... |
import sys
import matplotlib.pyplot as plt
from math import log
import argparse
import random
class Units:#This is a class of static variables
mutRate = 1.25e-8
binsize = 100
N0 = 10000
genTime = 1
firstCall = True
def __init__(self, **kwargs):
if "mutRate" in kwargs:
Units.... |
"""Flask server for Destination Unknown"""
from flask import Flask
from flask import session as sesh
from flask import redirect
from flask import request, url_for
from flask import render_template
from flask import jsonify
from uber_rides.session import Session
from uber_rides.client import UberRidesClient
from uber_... |
import gtk
from pygtkhelpers.delegates import WindowView, SlaveView
from pygtkhelpers.ui.objectlist import ObjectList, Column
from pygtkhelpers.utils import gsignal
from .dict_as_attr_proxy import DictAsAttrProxy
class ListSelectView(SlaveView):
"""
ListSelectView for selecting an item from a list.
"""
... |
"""
PlexVideo
"""
from plexapi.media import Media, Country, Director, Genre, Producer, Actor, Writer
from plexapi.exceptions import NotFound, UnknownType
from plexapi.utils import PlexPartialObject, NA
from plexapi.utils import cast, toDatetime
class Video(PlexPartialObject):
TYPE = None
def __eq__(self, oth... |
#!/usr/bin/env python
# encoding: utf-8
"""
single-number.py
Created by Shuailong on 2016-03-23.
https://leetcode.com/problems/single-number/.
"""
from operator import xor
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
re... |
import unittest
from docker_ascii_map.raster import Boundary
from docker_ascii_map.widget import *
class ModelTests(unittest.TestCase):
@staticmethod
def test_abstracts():
w = Widget()
w.render()
w.preferred_size()
def test_size(self):
size = Size(2, 3)
self.asser... |
import os, random
import nltk
import csv
import re
import pprint
from nltk import word_tokenize, WordNetLemmatizer
from nltk.corpus import stopwords
import spamham as sf
def find(text):
lemmatizer = WordNetLemmatizer()
text1=[lemmatizer.lemmatize(word.lower()) for word in word_tokenize(unicode(text, errors='ig... |
import sys
import os
import shutil
import glob
from scan_io import delete_scan_dirs
def clean_sim_dir():
print "Deleting scan dirs"
delete_scan_dirs(os.getcwd())
del_file=os.path.join(os.getcwd(),"pub")
if os.path.isdir(del_file):
print "Deleteing "+del_file
shutil.rmtree(del_file)
del_file=os.path.join(os.... |
"""An abstract class for entities."""
import asyncio
import logging
import functools as ft
from timeit import default_timer as timer
from typing import Optional, List
from homeassistant.const import (
ATTR_ASSUMED_STATE, ATTR_FRIENDLY_NAME, ATTR_HIDDEN, ATTR_ICON,
ATTR_UNIT_OF_MEASUREMENT, DEVICE_DEFAULT_NAME... |
from collections import deque
import pyfirmata
class MockupSerial(deque):
"""
A Mockup object for python's Serial. Functions as a fifo-stack. Push to
it with ``write``, read from it with ``read``.
"""
def __init__(self, port, baudrate, timeout=0.02):
self.port = port or 'somewhere'
... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
class XMPPError(Exception):
"""
A generic exception that may be raised while processing an XMPP stanza
to indicate that an error r... |
'''
Command line interface for suseapi.
'''
from __future__ import print_function
import sys
from xdg.BaseDirectory import load_config_paths
from pprint import pformat
from argparse import ArgumentParser
from ConfigParser import RawConfigParser
from suseapi.userinfo import UserInfo
from suseapi.presence import Presen... |
import proto # type: ignore
__protobuf__ = proto.module(
package='google.ads.googleads.v8.services',
marshal='google.ads.googleads.v8',
manifest={
'GetAdGroupSimulationRequest',
},
)
class GetAdGroupSimulationRequest(proto.Message):
r"""Request message for
[AdGroupSimulationService.... |
# -*- coding: utf-8 -*-
# Django settings for basic pinax project.
import os.path
import posixpath
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# tells Pinax to serve media through the staticfiles app.
SERVE_MEDIA = DEBUG
# django-compressor is turned off by default... |
"""
개발환경 : PyQt5 x64, Python 3.4.3 x64, Windows 8.1 x64
파일 : CryptoAffine.py
내용 : 아핀 사이퍼
"""
from CustomError import CustomError
from CryptoCommon import CryptoCommon
import array, random
class Affine(CryptoCommon):
def __init__(self, sourceType=False, mode='encrypt', message='', letters='', key=0, fileAccessType... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mygamesdb', '0008_auto_20160408_1334'),
]
operations = [
migrations.RenameField(
model_name='developer',
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
classification.py
---------------------
Date : July 2015
Copyright : (C) 2015 by Arnaud Morvan
Email : arnaud dot morvan at camptocamp dot com
**********... |
"""
Django settings for frontend_project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... |
import unittest
from mock import Mock
class TestInternalDownload(unittest.TestCase):
def _getTarget(self):
from tirds.download import _download
return _download
def _callFUT(self, storage_client, bucket_name, blob_name, outdir):
target = self._getTarget()
return target(storag... |
def is_wrapping_character(char):
if char == ',' or char == '.' or char == ':' or char == ';' or char == '?' or char == '!':
return True
return False
def is_newline_character(char):
if char == '\r' or char == '\n':
return True
return False
def is_spacing_character(char):
if char == ' ' or char == '\t':
retu... |
""" The settings diagnostic tab which visualizes the SANS state object. """
from ui.sans_isis.settings_diagnostic_tab import SettingsDiagnosticTab
class SettingsDiagnosticPresenter(object):
class ConcreteSettingsDiagnosticTabListener(SettingsDiagnosticTab.SettingsDiagnosticTabListener):
def __init__(self... |
from django.core.checks import Error
from inboxen.checks import DOMAIN_ERROR_MSG, domains_available_check
from inboxen.test import InboxenTestCase
from inboxen.tests import factories
class DomainCheckTestCase(InboxenTestCase):
def test_no_domain(self):
self.assertEqual(domains_available_check(None), [Err... |
from gi.repository import Gtk
from gi.repository import RB
from gi.repository import GObject
from gi.repository import GLib
from coverart_rb3compat import Menu
from coverart_external_plugins import CreateExternalPluginMenu
from coverart_entryview import CoverArtEntryView
from coverart_rb3compat import ActionGroup
from... |
import socket
import unittest
from telemetry import test
from telemetry.core import forwarders
from telemetry.core.backends.chrome import cros_interface
from telemetry.core.forwarders import cros_forwarder
from telemetry.unittest import options_for_unittests
class CrOSInterfaceTest(unittest.TestCase):
@test.Enabl... |
#!/home/arthur/.virtualenvs/ev3py27/bin/python
# a test script for basic motion model
from ev3.ev3dev import Motor
from ev3.lego import GyroSensor
import unittest
import time
class Mover():
# Moving motors
left=None;
right=None;
# Sensors
gyro=None;
# Paras
Rrio=2.15; # 60/28=2.14285
# Configs
a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
# Note: to reuse this data migration when adding a new permission
# in the future, copy the code and update these three lines:
_new_permission_codename = 'view_external_link'
_new_permission_name = 'View external link'
... |
from __future__ import unicode_literals
import json
from datetime import datetime
from maclookup import ApiClient, exceptions as maclookup_exceptions
from core.analytics import OneShotAnalytics
from core.entities import Company
class MacAddressIoApi(object):
__MODULE_GROUP__ = "MacAddress.io"
settings = {... |
import os
import unittest
import ansigenome.constants as c
import ansigenome.test_helpers as th
import ansigenome.utils as utils
class TestExport(unittest.TestCase):
"""
Integration tests for the export command.
"""
def setUp(self):
self.test_path = os.getenv("ANSIGENOME_TEST_PATH", c.TEST_PA... |
from FreeCAD import Gui
from PySide import QtCore, QtGui
import FreeCAD, FreeCADGui, Part, os, math
__dir__ = os.path.dirname(__file__)
iconPath = os.path.join( __dir__, 'Resources', 'icons' )
smEpsilon = 0.0000001
def smWarnDialog(msg):
diag = QtGui.QMessageBox(QtGui.QMessageBox.Warning, 'Error in macro MessageB... |
"""Process mail-in content from a repoze.mailin IMailStore / IPendingQueue.
'maildir_root' is the path to the folder containing the
IMailStore-enabled maildir. The actual maildir must be named 'Maildir'
within that folder.
"""
from paste.deploy import loadapp
from repoze.bfg.scripting import get_root
from repoze.maili... |
from django.db import models
from django.utils.text import slugify
from feds.settings import FEDS_SETTING_GROUPS, FEDS_SETTING_TYPES, \
FEDS_BASIC_SETTING_GROUP
from django.core.exceptions import ValidationError
from helpers.model_helpers import is_legal_json, stringify_json
"""
These classes are representations ... |
from __future__ import division
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pandas as pd
import matplotlib.pyplot as plt
import logging
from ..network import create_network
from ..utils import make_interpolater
from ..case import PSSTCase
logger = logging.getLogger(__name__)
def plot(case, ax=N... |
from CommonFunctions import find_primes_less_than
def has_property(n):
index = 0
while index < len(lst_two_squares) and lst_two_squares[index] < n:
if (n - lst_two_squares[index]) in primes:
return True
index += 1
return False
primes = set(find_primes_less_than(30000))
lst_two_... |
#!/usr/bin/env python
import os.path
programName = os.path.splitext(os.path.basename(__file__))[0]
from sys import argv,stdin,stderr,exit
from pazookle.shred import zook,Shreduler
from pazookle.ugen import UGen,PassThru
from pazookle.buffer import Delay
from pazookle.generate import SinOsc,TriO... |
from spack import *
class SofaC(MakefilePackage):
"""Standards of Fundamental Astronomy (SOFA) library for ANSI C."""
homepage = "http://www.iausofa.org/current_C.html"
url = "http://www.iausofa.org/2018_0130_C/sofa_c-20180130.tar.gz"
version('20180130', sha256='de09807198c977e1c58ea1d0c79c40bd... |
"""
Main exceptions module for nocexec
"""
class NOCExecError(Exception):
"""
The base exception class for the nocexec module. All other exceptions are
inherited from this class.
"""
pass
class SSHClientError(NOCExecError):
"""
The base exception class for SSH client
"""
pass
c... |
"""Main codrspace views"""
import requests
from datetime import datetime
from django.http import Http404
from django.shortcuts import render, redirect, get_object_or_404
from django.utils import simplejson
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth ... |
"""Submit a Spark SQL job to a cluster."""
from apitools.base.py import encoding
from googlecloudsdk.api_lib.dataproc import base_classes
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import base
@base.ReleaseTracks(base.ReleaseTrack.GA)
class SparkSql(base_classes.JobSubmitter):
""... |
from instruments.base_instrument import *
# Example: Floating GBP.LIBOR.3M + spread vs. Floating USD.LIBOR.3M with MTM resets
class MtmCrossCurrencyBasisSwap(Instrument):
@staticmethod
def CreateFromDataFrameRow(name, eval_date, row):
fcastL, fcastR, discL, discR, convL, convR, start, length ... |
import numpy as np
import cv2
from scipy import ndimage
import os.path
'''
Pts
'''
IMGSIZE = 112
LANDMARK = 68
MIRRORS = True
DATASCALE = 10
def transform(form,to):
destMean = np.mean(to, axis=0)
srcMean = np.mean(form, axis=0)
srcVec = (form - srcMean).flatten()
destVec = (to - destMean).flatten()
... |
"""Utilities to run benchmarks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import numbers
import os
import re
import sys
import time
import six
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.util import test_log... |
import re
from setuptools import setup, find_packages
import tracext.google.search as tg
setup(
name = tg.__packagename__,
version = tg.__version__,
author = tg.__author__,
author_email = tg.__email__,
description = tg.__summary__,
license = tg.__license__,
url = tg.__url__,
download_ur... |
from designate.objects import base
from designate.objects import fields
@base.DesignateRegistry.register
class Tenant(base.DesignateObject, base.DictObjectMixin):
def __init__(self, *args, **kwargs):
super(Tenant, self).__init__(*args, **kwargs)
fields = {
'id': fields.AnyField(nullable=True)... |
from supysonic import db
from supysonic.managers.folder import FolderManager
import os
import shutil
import tempfile
import unittest
from pony.orm import db_session, ObjectNotFound
class FolderManagerTestCase(unittest.TestCase):
def setUp(self):
# Create an empty sqlite database in memory
db.ini... |
from collections import defaultdict
from django.contrib.admin.views.main import ChangeList
from django.conf import settings
from django.db.models import Q
from django.http import JsonResponse
from django.http.response import HttpResponseForbidden
from django.views import View
from translation_manager.models import Tr... |
from django.test import TestCase, Client
from ..models import Mandada, User
class MandadaViewTests(TestCase):
@classmethod
def setUpTestData(cls):
user1 = User.objects.create_user('<EMAIL>')
user2 = User.objects.create_user('<EMAIL>')
Mandada.objects.bulk_create((
Mandada... |
"""
@package mi.instrument.wetlabs.ac_s.ooicore.driver
@file marine-integrations/mi/instrument/wetlabs/ac_s/ooicore/driver.py
@author Rachel Manoni
@brief Driver for the ooicore
Release notes:
initial version
"""
from _ctypes import sizeof
from collections import OrderedDict
from ctypes import BigEndianStructure, c_us... |
from nltk.corpus import PlaintextCorpusReader
import networkx as nx
from collections import Counter
from itertools import chain
from itertools import tee
import graph_utils as gutil
def pairwise(itr):
a, b = tee(itr) # two version of itr
next(b, None) # b goes ahead one step
return zip(a, b) # retur... |
"""Tools/Utilities/Generate SoundEx Codes"""
#-------------------------------------------------------------------------
#
# Gtk modules
#
#-------------------------------------------------------------------------
from gi.repository import Gtk
#------------------------------------------------------------------------
#... |
"""
Module to connect to remote hosts over a network.
Protocols supported:
- SSH
"""
import time
import subprocess
import string
import random
import fcntl
import os
import pwd
import getpass
# in milliseconds
_CONNECT_POLL_INTERVAL = 100
_EXECUTE_POLL_INTERVAL = 100
_CONNECT_ID_LENGTH = 20
_EXECUTE_ID_LENGTH = 20
... |
#-------------------------------------------------------------------------------
# Name: UpdateLayout.py
# Purpose:
#
#
# Copyright: (c) ferguson 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python
# Take courage my friend ... |
#!/apps/python-2.7/bin/python
# -*- coding: utf-8 -*-
import os
import os.path
import glob
import sys
from apiclient.discovery import build
from apiclient.errors import HttpError
import httplib2
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client import tools... |
from __future__ import print_function
import numpy as np
import pints
from . import ToyODEModel
class LotkaVolterraModel(ToyODEModel, pints.ForwardModelS1):
"""
Lotka-Volterra model of Predatory-Prey relationships [1]_.
This model describes cyclical fluctuations in the populations of two
interacting ... |
import httplib
import urllib
import json
from wskaction import Action
from wsktrigger import Trigger
from wskrule import Rule
from wskpackage import Package
from wskutil import addAuthenticatedCommand, apiBase, bold, parseQName, request, responseError
#
# 'wsk namespaces' CLI
#
class Namespace:
def getCommands(se... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# morse-code-twitter
MORSE_ALPHABET = {'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..',
'J': '.---', 'K': '-.-', 'L': '.-..',
... |
"""'Container' classes to store prediction results for easy access
"""
import pandas as pd
# Disalbe DataFrame overwriting warning
pd.options.mode.chained_assignment = None
class PredResults(object):
"""Base class to store prediction results.
Attributes
----------
results : DataFrame
DataFr... |
# coding=utf-8
__source__ = 'https://leetcode.com/problems/my-calendar-ii/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 731. My Calendar II
#
# Implement a MyCalendarTwo class to store your events.
# A new event can be added if adding the event will not cause a triple booking.
#
# Your class will have one met... |
"""Benchmark from Laurent Vaucher.
Source: https://github.com/slowfrog/hexiom : hexiom2.py, level36.txt
(Main function tweaked by Armin Rigo.)
"""
from __future__ import division, print_function
import sys, time, StringIO
##################################
class Dir(object):
def __init__(self, x, y):
se... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_parad_j_cspp
@file marine-integrations/mi/dataset/parser/test/test_parad_j_cspp.py
@author Joe Padula
@brief Test code for a parad_j_cspp data parser
"""
import os
import yaml
import numpy
from nose.plugins.attrib import attr
from mi.core.log import get... |
# -*- coding: utf-8 -*-
from nose.tools import with_setup, eq_ as eq
from common import vim, cleanup
@with_setup(setup=cleanup)
def test_receiving_events():
vim.command('call rpcnotify(%d, "test-event", 1, 2, 3)' % vim.channel_id)
event = vim.session.next_message()
eq(event[1], 'test-event')
eq(event[... |
#!/usr/bin/env python
import datetime
import os
import marshal
import sqlite3 as sql
import sys
from optparse import OptionParser
from iointegrity.iotools import BlockMD5
def main(options, args):
conn = sql.connect(options.dbfile)
c = conn.cursor()
datestr = datetime.datetime.now().isoformat()
data = ... |
# email : <EMAIL>
# modified : 2016-03-20 10:27
"""
Converst markdown to html
"""
__author__="Johann-Mattis List"
__date__="2016-03-20"
import markdown
import sys
import re
if len(sys.argv) == 1:
print("Usage: python markitdown.py infile")
f = open(sys.argv[1]).read()
st = [
(':bib:', 'http://biblio... |
import numpy as np
import theano
from theano import tensor as T
def image_from_weights(W, height_in, width_in, height_out, width_out):
"""
W: 2d ndarray
Matrix of filters flattened and stored in each column.
height_in: int
width_in: int
Each column of W is reshaped to size, (height_in, height... |
__doc__="""zenperfwmi
Gets WMI performance data and stores it in RRD files.
$Id: zenperfwmi.py,v 2.9 2010/08/12 23:19:11 egor Exp $"""
__version__ = "$Revision: 2.9 $"[11:-2]
import logging
# IMPORTANT! The import of the pysamba.twisted.reactor module should come before
# any other libraries that might possibly us... |
import os
import shutil
import sys
from .base import Command
from clickable.logger import logger
class CleanCommand(Command):
aliases = []
name = 'clean'
help = 'Clean the build directory'
def run(self, path_arg=None):
if os.path.exists(self.config.build_dir):
try:
... |
from __future__ import nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals
from .pyqtver import*
if pyqtversion == 4:
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import QLocale
from PyQt4.QtGui import QDialog, QDialogButtonBox, QFont, QHBoxLayout, QLa... |
"""Tests for App."""
import unittest
if __name__ == '__main__':
os.environ["SECRET_KEY"] = "TEST_SECRET"
unittest.main()
# [START imports]
import unittest
import datetime
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.ext import testbed
from models import... |
# -*- coding: utf-8 -*-
"""Conversion functions for BEL graphs with GraphDati.
Note that these are not exact I/O - you can't currently use them as a round trip because
the input functions expect the GraphDati format that's output by BioDati.
"""
import gzip
import json
import logging
from collections import defaultd... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import subprocess
import re
import sys, os, glob, shutil
######################################################
# Colorize 1.0
# Generates syntax to display colors in Terminal
######################################################
# Main function, accepti... |
#Created by Coconut
#Written in Python
from .Modules.Standard import *
#Parser
def parse(toks):
#print(toks)
i = 0
while(i < len(toks)):
if toks[i] == "ENDIF":
#print("Found an endif")
i += 1
#print(i)
elif toks[i] + " " + toks[i + 1][0:6] == "... |
import sys
import mock
from neutron.db import migration
from neutron.db.migration import cli
from neutron.tests import base
class TestDbMigration(base.BaseTestCase):
def test_should_run_plugin_in_list(self):
self.assertTrue(migration.should_run(['foo'], ['foo', 'bar']))
self.assertFalse(migratio... |
#!/usr/bin/python
from launchpadlib.launchpad import Launchpad
PPAOWNER = "cardapio-team" # the launchpad PPA owener. It's usually the first part of a PPA. Example: in "webupd8team/vlmc", the owner is "webupd8team".
PPA = "unstable" # the PPA to get stats for. It's the second part of a PPA. Example: in "webupd8team... |
import importlib
from django.db.models import signals
from django.db.models.fields import CharField
class Base64Field(CharField):
"""
Base64Field is useful where you need a base64 encoded value from
model's Primary Key a.k.a PK which is available on every django
application model by default. Sine `ba... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.