src stringlengths 721 1.04M |
|---|
import os
from hazelcast.proxy.ringbuffer import OVERFLOW_POLICY_FAIL, MAX_BATCH_SIZE
from tests.base import SingleMemberTestCase
from tests.util import random_string
CAPACITY = 10
class RingBufferTest(SingleMemberTestCase):
@classmethod
def configure_cluster(cls):
return open(os.path.join(os.path.d... |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Special Pythagorean triplet".
The problem is: There exists exactly one Pythagorean triplet for which
a + b + c = 1000. Find the product abc.
"""
from __future__ import division
import math
def main():
"""Special Pythagorean triplet"""
#... |
# This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from copy import copy
from .attribute import Attribute,... |
# coding=utf-8
__author__ = 'stefano'
import logging
from optparse import make_option
import csv
from bilanci import utils
from django.conf import settings
from django.core.management import BaseCommand
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from bilanci.models import Voce
clas... |
#!/usr/bin/python
import curses, curses.textpad, curses.ascii
import math, os, sys, fcntl, struct, termios, array, time
import logging
logging.basicConfig(filename='menu01.log',level=logging.DEBUG)
__doc__="""\
The program presents a series of menus that we're going to use for testing.
1. Enter new person
2. Update ... |
"""
Wrapper for Python Weibull functions
"""
import numpy as np
def cumulative_hazard(t, a, b):
""" Cumulative hazard
:param t: Value
:param a: Alpha
:param b: Beta
:return: `np.power(t / a, b)`
"""
t = np.double(t)
return np.power(t / a, b)
def hazard(t, a, b):
t = np.double(t)... |
from __future__ import division
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softw... |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
from __future__ import unicode_literals
import argparse
import os
import io
import itertools
import csv
import shutil
from django.core.management.base import BaseCommand
from django.core.management import settings
from odm2admin.models import Dataloggerfiles
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "templat... |
#!/usr/bin/env python3
import sys
from random import randint
import os
try:
import networkx as nx
except:
print("gPrint#-1#" + "netwrokx not installed for " + sys.executable)
sys.stdout.flush()
try:
import igraph as ig
except:
print("gPrint#-1#" + "igraph not installed for " + ... |
#This file is part of numword. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
'''
numword for EN_GB
'''
from .numword_en import NumWordEN
class NumWordENGB(NumWordEN):
'''
NumWord EN_GB
'''
def currency(self, val, longval=True):
... |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... |
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: pack.py
# Date: Sat Jun 06 16:35:44 2015 +0800
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from collections import defaultdict
class EventPacker(object):
""" Only record and pack result in a time interval"""
def __init__(self):
self.key_cnt = defaul... |
from functools import total_ordering
@total_ordering
class Version():
"""Organization Class for comparable Version System
Version integer uses decimal shift:
2 digits major version, 2 digits minor version, 2 digits micro version
170100 -> 17.1.0
"""
def __init__(self, in... |
from flask import request
from server.common import Resource
from server.resources import SearchRecords
from server.resources import ReadRecord
from server.resources import ValidateRecord
from server.resources import Routing
class OBS_Create(Resource):
def post(self):
'''Create interaction'''
retu... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 law o... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
"""
This file contains classes and functionto interact with qcow images servers
"""
import copy
import logging
import os
import paramiko
from common import PromotionError
class QcowConnectionClient(object):
"""
Proxy class for client connection
"""
_log = logging.getLogger("promoter")
def __ini... |
# Copyright 2015-2019 Yelp Inc.
# 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 law or agreed to in writing,... |
import subprocess
import sys
from os.path import dirname, join
prj_path = dirname(sys.argv[0])
if len(sys.argv) == 1 or sys.argv[1] != 'no-rebuild':
subprocess.check_call(['vagrant', 'powershell', '-c', 'cmd.exe', '-c',
r'C:\vagrant\build.cmd'])
sys.path.append(join(prj_path, r'src\tools... |
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.shortcuts import get_object_or_404
from member.factories import ClientFactory, MemberFactory
from member.models import Client, Member, Route, Address, Contact, EMAIL, HOME
import os
import csv
from sys import... |
# -*- coding: utf-8 -*-
#
# buildertest documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 12 17:11:03 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
# Copyright (c) 2008-2021 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Covered Software is provided under this License on an "as is"
#... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Benjamin Kiessling
#
# 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 ipywidgets import widgets, Layout
continuous_update = True
layout = Layout(width='50%', justify_content ='space-between', align_content='space-around')
ρ_L_button = widgets.FloatSlider(
min=800.0,
max=1200.0,
value=1000.0,
step=0.5,
continuous_update=continuous_update,
... |
#!/usr/bin/env python
# Copyright (C) 2016 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Th... |
from datetime import datetime
from django.utils import timezone
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, HttpResponseRedirect
from django.urls import reverse
import pronostix.models as models
import pronostix.forms... |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015-2019 OpenCraft <contact@opencraft.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Fre... |
"""
DESCRIPTION
-----------
For each directory provided on the command line the
headers all of the FITS files in that directory are modified
to add information like LST, apparent object position, and more.
See the full documentation for a list of the specific keywords
that are modified.
Header patching
^^^^^^^^^^^^^^... |
import tensorflow as tf
import numpy as np
import os
import time
import datetime
import data_helper
import word2vec_helpers
from URLCNN import URLCNN
import csv
# Parameters
# ==================================================
# Data Parameters
tf.flags.DEFINE_string("input_text_file", "../data/data2.csv", "Test text ... |
#!/usr/bin/env python
#
# Arun Venkatraman (arunvenk@cs.cmu.edu)
# December 2016
#
# If we are not running from the build directory, then add lib to path from
# build assuming we are running from the python folder
import os
full_path = os.path.realpath(__file__)
if full_path.count("src/python") > 0:
import sys
... |
from PyQt4 import QtGui
from PyQt4 import QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as _FigureCanvas
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT as _NavigationToolbar
import matplotlib as _mpl
import numpy as _np
from .Rectangle import Rectangle
import pdb
import tra... |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... |
"""Simulated environment for functional script testing."""
from contextlib import contextmanager
from importlib import import_module
from io import StringIO
import sys
from unittest.mock import patch
from aiohttp.test_utils import AioHTTPTestCase
import pyatv
from pyatv.const import Protocol
from tests import fake_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 on 2016-06-23.
# 2016, SMART Health IT.
import io
import json
import os
import unittest
from . import provenance
from .fhirdate import FHIRDate
class ProvenanceTests(unittest.TestCase):
def instantiate_from(self, filename):
... |
from __future__ import (absolute_import, division, print_function)
import numpy as np
import pyproj
import math
try:
from inspect import cleandoc as dedent
except ImportError:
# Deprecated as of version 3.1. Not quite the same
# as textwrap.dedent.
from matplotlib.cbook import dedent
__version__ = '1.... |
import os
import numpy as np
import pandas as pd
import unittest
from datetime import datetime
from bom_data_parser import read_hrs_csv
class HRSTest(unittest.TestCase):
def setUp(self):
self.test_cdo_file = os.path.join(os.path.dirname(__file__), 'data', 'HRS', '410730_daily_ts.csv')
def test_hrs(se... |
from __future__ import absolute_import
import socket
import idiokit
from idiokit import dns
from . import utils, transformation
def _parse_ip(string, families=(socket.AF_INET, socket.AF_INET6)):
for family in families:
try:
return socket.inet_ntop(family, socket.inet_pton(family, string))
... |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.sparse import csr_matrix, isspmatrix, isspmatrix_csc, isspmatrix_csr
from ._tools import csgraph_to_dense, csgraph_from_dense,\
csgraph_masked_from_dense, csgraph_from_masked
DTYPE = np.float64
def validate_... |
#!/usr/bin/env python
# -*- coding: utf-8; mode: python; -*-
"""Module providing abstract interface class for XGBoost sense calssification.
Attributes:
XGBoostBaseSenser (class):
abstract class defining interface for explicit and implicit classifier
"""
########################################################... |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2010 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... |
# repo.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import logging
import os
import re
import warnings
from git.cmd import (
Git,
handle_process_o... |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
VectorGeoreferencer
A QGIS plugin
Deforms vector to adapt them despite heavy and irregular deformations
-------------------
begin ... |
import xml.etree.ElementTree as ET
import sqlite3
conn = sqlite3.connect('trackdb.sqlite')
cur = conn.cursor()
# Make some fresh tables using executescript()
cur.executescript('''
DROP TABLE IF EXISTS Artist;
DROP TABLE IF EXISTS Album;
DROP TABLE IF EXISTS Track;
DROP TABLE IF EXISTS Genre;
CREATE TABLE Artist (
... |
from django.views.generic import DetailView, CreateView
from django.utils import timezone
from django.http import HttpResponse
import simplejson
from app.utils import model_serializer
from app.myblog.models import Article
class ArticleDetailView(DetailView):
model = Article
queryset = Article.objects
slu... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from pybb.models import create_or_check_slug
def fill_slugs(apps, schema_editor):
Category = apps.get_model("pybb", "Category")
Forum = apps.get_model("pybb", "Forum")
Topic = apps.get_model("pybb", "... |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
"""Generate python dictionaries catalog from textual translation description.
This program converts a textual Uniforum-style message catalog (.po file) into
a python dictionary
Based on msgfmt.py by Martin v. Löwis <loewis@informatik.hu-berlin.de>
"""
import sys... |
# -*- coding: utf-8 -*-
#
# (c) Copyright 2001-2011 Hewlett-Packard Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... |
from collections import defaultdict
from json import JSONEncoder
import logging
import hashlib
class Node(object):
APPENDIX = u'appendix'
INTERP = u'interp'
REGTEXT = u'regtext'
SUBPART = u'subpart'
EMPTYPART = u'emptypart'
INTERP_MARK = 'Interp'
def __init__(self, text='', children=[],... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
from os.path import dirname, abspath, join
import pytest
from PyQt5.QtWidgets import QApplication, QGroupBox, QTimeEdit, \
QDateTimeEdit
from _clockalarm.UI.SimpleAlertEditWidget import SimpleAlertEditWidget
from _clockalarm.utils import importExportUtils
@pytest.fixture
def init_paths(scope="module"):
impo... |
#!/usr/bin/env python
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
import datetime
import json
import os
import sys
from PyQt5 import QtCore
from PyQt5.QtCore import Qt, QTime... |
#! /usr/bin/env python
#################################################
# Tool used for the inventory of ec2 instances
#
# Author: Alejandro Inestal Garcia
#################################################
import sys
from datetime import datetime, timedelta, date
from boto import boto
from boto import ec2
from boto.e... |
from urllib.parse import urlencode
from django.http import Http404
from django.core.urlresolvers import reverse
from directory_api_client.client import api_client
from directory_constants import choices
from core.helpers import CompanyParser
INDUSTRY_CHOICES = dict(choices.INDUSTRIES)
def pair_sector_values_with_... |
import os
import cv2
import numpy as np
import utils
def argsProcessor():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--dataPath", help="DataPath")
parser.add_argument("-o", "--outputFiles", help="outputFiles", default="bar")
return parser.parse_args()
args = a... |
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.core.validators import RegexValidator
from . import managers
class Profile(mode... |
#!/usr/bin/env python
#Copyright (C) 2013 by Glenn Hickey
#
#Released under the MIT license, see LICENSE.txt
import sys
import os
import argparse
import copy
from pybedtools import BedTool, Interval
"""
Filter out bed intervals that have a given name. Print result to stdout
"""
def main(argv=None):
if argv is... |
# -*- coding: UTF-8 -*-
from past.builtins import basestring
import json, datetime
from .common import Formatter, Events, Position, ContextButton, Options3d, ResetZoomButton, DataGrouping, \
Labels, Marker, Point, PlotBands, States, Tooltip, Title, Zones, Levels, Shadow, \
JSfunction, ColorObject, CSSObject, S... |
class Rectangle:
def __init__(self, w, h):
self.width = w
self.height = h
def area(self):
return self.width * self.height
def perimeter(self):
return (2 * self.width) + (2 * self.height)
def position(self, x, y):
self.x = x
self.y = y
def __str__(self):
return str(self.width) + " x " + str(self.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import UserList
import logging
logger = logging.getLogger(__name__)
class CycleList(UserList):
"""
一个无限循环输出元素的可迭代对象,如果是on-fly模式
(主要指for循环中的删除动作)推荐使用 `remove_item` 方法
"""
def __init__(self, data):
super().__init... |
from kali import Kali
import util
class Game():
def __init__(self, nodes):
self.__kali = None
self.__nodes = nodes
# Variables & funcions exposed to scripts
self.__vars = {
# Functions
'askchoice': self.__askchoice,
'next': self.__next... |
import tty, sys
import curses, datetime, locale
from decimal import Decimal
from electrum.util import format_satoshis, set_verbosity
from electrum.util import StoreDict
from electrum.bitcoin import is_valid, COIN, TYPE_ADDRESS
from electrum import Wallet, WalletStorage
_ = lambda x:x
class ElectrumGui:
def __... |
#!/usr/bin/env python
# -*- coding: utf_8 -*-
"""
Modbus TestKit: Implementation of Modbus protocol in python
(C)2009 - Luc Jean - luc.jean@gmail.com
(C)2009 - Apidev - http://www.apidev.fr
This is distributed under GNU LGPL license, see license.txt
"""
import sys
import modbus_tk
import modbus_tk... |
#!/usr/bin/env python
from __future__ import print_function
# Example for RC timing reading for Raspberry Pi
# Must be used with GPIO 0.3.1a or later - earlier verions
# are not fast enough!
import argparse
import time
import sys
import atexit
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
g_RCpin = None
def R... |
# configobj.py
# A config file reader/writer that supports nested sections in config files.
# Copyright (C) 2005-2014:
# (name) : (email)
# Michael Foord: fuzzyman AT voidspace DOT org DOT uk
# Nicola Larosa: nico AT tekNico DOT net
# Rob Dennis: rdennis AT gmail DOT com
# Eli Courtwright: eli AT courtwright DOT org
#... |
# local Django
from basePage import *
from pom.locators.authenticationPageLocators import *
from pom.locators.homePageLocators import *
from pom.pageUrls import PageUrls
class AuthenticationPage(BasePage):
url = PageUrls.authentication_page
homepage = PageUrls.homepage
server_url = ''
def __init__(s... |
import random
import kazoo
from kazoo.client import KazooClient
from kazoo.handlers.eventlet import SequentialEventletHandler
from kazoo.retry import KazooRetry
from kazoo.recipe.watchers import ChildrenWatch
from oslo_serialization import jsonutils
_handler = SequentialEventletHandler()
_retry = KazooRetry(max_tries=... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from subprocess import *
import os
import re
import sys
import shutil
INSTALL_ROOT = '/usr/local/wine'
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
DEPOSROOT = os.path.join(PROJECT_ROOT, 'depos')
SRCROOT = os.path.join(PROJECT_ROOT, 'src')
P... |
# Form implementation generated from reading ui file 'frmlexeme.ui'
#
# Created: Mon Dec 23 20:49:55 2002
# by: The PyQt User Interface Compiler (pyuic)
#
# WARNING! All changes made in this file will be lost!
import sys
from qt import *
class frmlexeme(QDialog):
def __init__(self,parent = None,name = None... |
"""Handle the frontend for Home Assistant."""
import os
from . import version, mdi_version
from blumate.components import api
from blumate.components.http import BluMateView
DOMAIN = 'frontend'
DEPENDENCIES = ['api']
def setup(hass, config):
"""Setup serving the frontend."""
hass.wsgi.register_view(IndexVie... |
#!/usr/bin/env python
#_*_encoding:utf-8_*_
# encoding:utf-8
import socket, os, subprocess, sys
import time,select,threading
import rsa,base64
import l_command
PRIVATE = os.getcwd()+"/private.pem"
def exchengx_text(text):
Result_Text = []
for i in range(len(text)):
Result_Text.append(''.join(text[i]))
... |
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
# This file is a part of datanommer, a message sink for fedmsg.
# Copyright (C) 2014, Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your... |
import urllib,urllib2,re,sys,httplib
#import xbmcplugin,xbmcgui,xbmcaddon,urlresolver
import cookielib,os,string,cookielib,StringIO
import os,time,base64,logging
from datetime import datetime
from utils import *
try:
import json
except ImportError:
import simplejson as json
#testing in shell
#TEST 1
# pyth... |
#!/usr/bin/python
from Crypto.PublicKey import RSA
from Crypto import Random
import socket,threading,subprocess,os,base64,xml.dom.minidom
import config,PBS,Response,Request,ServerJob as Job
JOBS={}
EOM="\n\n###"
def startServer():
port=int(config.port)
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
... |
# Problem: Maximum Depth of Binary Tree
# Difficulty: Easy
# Category: Tree
# Leetcode 104: https://leetcode.com/problems/maximum-depth-of-binary-tree/#/description
# Description:
"""
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to... |
from boxbranding import getMachineBrand, getMachineName
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
from enigma import eTimer, eEnv
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.config import config, ConfigText, ConfigPassword, KEY_LEFT, KEY... |
# -*- coding: utf-8 -*-
"""
Django settings for SmartHome project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_l... |
#!python
# Script to run gcc preprocessor on files whose name ends in "Def.h"
# or echo the file contents otherwise
# File name is only argument
import os, sys
# Routine to recursively read include
def parseInclude(lline):
fname = lline.split()[1].replace('"','')
infil = os.getenv("OBIT")+"include/"+fname
... |
#!/usr/bin/env python
''' glaze.py - Complex glazing model (goes with glaze1.cal and glaze2.cal)
Drop-in replacement for the original csh script by Greg Ward.
2016 - Georg Mischler
Funding for the original development generously provided by Visarc, Inc.
(http://www.visarc.com)
The general assumption is that one sur... |
from django.db import models
from django.contrib.auth.models import User, Group
# Create your models here.
class File(models.Model):
title = models.CharField(max_length=50)
publisher = models.ForeignKey(User)
timeStamp = models.DateTimeField(auto_now=True)
content = models.BinaryField()
encrypted = models.Boole... |
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from multisecret.MultiSecretRoyAdhikari import Dealer
import multisecret.MultiSecretCommon as common
""" Declare basic params used to initialize Dealer in test cases """
# large prime from NIST P-256 ellipt... |
"""Analyze results.
Use the saved model output to calculate AUC and other metrics.
"""
import collections
import cPickle as pickle
import gflags as flags
import gzip
import logging
import numpy as np
import os
import pandas as pd
from sklearn import metrics
from statsmodels.stats import proportion
import sys
flags.D... |
#! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2011 Patrick Crews
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwar... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 7 16:19:11 2017
@author: psamtik071
"""
from workflow.data import trip_data
import os
for year in xrange(2017,2018):
for month in xrange(1,13):
basepath = 'tripdata/'
to_filename = '{}{:02}-citibike-tripdata.csv'.format(year... |
from __future__ import print_function
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import sys
import time
import numpy as np
import DeepLearningStack
from DeepLearningStack import FeedForwardNet
#create a deep network defined in AlexNet.xml
if __name__=="__mai... |
# Copyright (c) 2010-2014 openpyxl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distr... |
#
# Jinja2 (http://jinja.pocoo.org) based template renderer.
#
# Author: Satoru SATOH <ssato redhat.com>
# License: MIT
#
# pylint: disable=unused-argument
"""Template rendering module for jinja2-based template config files.
"""
from __future__ import absolute_import
import logging
import os
import anyconfig.compat
... |
# -*- coding: UTF-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_FOREIGN_KEY_CHECKS = False
SQLALCHEMY_RECORD_QUERIES = True
FLASK... |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python2.7/dist-packages/PyKDE4/kdeui.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
class KStartupInfoData(): # s... |
'''
.. py:module:: reasoning
:platform: Unix
Reasoning object for the tweets.
'''
import logging
import traceback
logger = logging.getLogger('tweets.default')
class Reasoning():
'''Reasoning for the tweets.
Class is used to hold information about the tweet's construction, and contains
few u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware Inc.
#
# 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 ... |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems Inc.
# 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.o... |
XXXXXXXXX XXXXX
XXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX X... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Set of fuctions/classes for ip administration
Author: Andrey Scopenco andrey@scopenco.net
'''
import sys
sys.path.insert(0, '/usr/local/hagent/lib')
import logging
from cli import Output
from hagent_db import add_record, del_record, update_record, \
get_record_attr... |
"""Parse human data into JSON"""
import string
def parse_file(filename="../data/RAW.txt"):
"""Parse human readable file into JSON."""
entries = []
with open(filename) as f_in:
next_line = f_in.readline()
data = {}
state = "section"
while next_line:
if state == "... |
import threading
import sys
import socket
import Constant as const
import Function as func
import Package as pack
from threading import *
import TextFunc as tfunc
import SocketFunc as sfunc
import Upload as upl
import PartFunc as pfunc
import Download as dnl
mutex = Lock()
class DaemonDownload(Thread):
def __init_... |
from apps.decorators import on_command
from apps.slackutils import cat_token, isNumber, get_nickname
from time import localtime, strftime
import os
import re
import json
import time
import urllib
import random
CACHE_DEFAULT_URL = './apps/quiz_cache/'
CACHE_CATEGORY_URL = './apps/quiz_cache/category/'
def get_random_q... |
import numpy as N
class ParameterSet:
"""
From
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
Alex Martelli
"""
def __init__(self, **kwds):
self.__dict__.update(kwds)
def MASSEY(**parameter_set):
e=Experiment()
for key in parameter_set.keys():
e.set_desc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.