src stringlengths 721 1.04M |
|---|
# Copyright 2019 The TensorNetwork Authors
#
# 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 ... |
#!/usr/bin/python
from __future__ import print_function
import inspect
from inspect import currentframe, getframeinfo
import errors
from errors import *
import os
import sys
class fileErrors:
# Initialise.
def __init__(self):
# Get general error writing and termination methods.
self.errors = errors()... |
import socket
from ..exceptions import LabelPrinterError
from ..models import Client, LabelPrinter
from .printer import Printer
class ClientPrinter(Printer):
"""Sets up the printer by selecting an instance of the
Client model for a given IP address.
Args:
* client_addr: ip_address or hostname. cl... |
#coding:utf-8
import pygame, os, random
from pygame.locals import *
# Define a posição da janela
os.environ['SDL_VIDEO_WINDOW_POS'] = "100,100"
# Inicia o PyGame
pygame.init()
# Tela de 640x480
tela = pygame.display.set_mode((1024,768))
pygame.display.set_caption("Caindo!")
# Máximo FPS do jogo
fps = 80
# Encurta... |
import logging
import re
from imgurpython import ImgurClient
import os
import sys
import urllib
from threading import Thread
try:
import Queue as queue
except ImportError:
import queue as queue
try:
import configparser
except ImportError:
import ConfigParser as configparser
logger = logging.getLogger('... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import math
from .models import Device, Product
from apps.core.models import Session
from apps.devices.models import Device
from apps.swid.models import Event
from apps.front.paging import ProducerFactory
# PA... |
from django.shortcuts import render_to_response
from equipment.models import *
"""def getalltypes():
e = EquipmentType.objects.select_related()
dict = {}
for i in e:
if str(i.equipment_class) in dict:
dict[str(i.equipment_class)].append(str(i))
else:
dict[str(i.equip... |
'''
Σηματοδότης ρυθμιζόμενος ανά ώρα και ημέρα
'''
from gpiozero import LED
from time import sleep
from datetime import datetime
# Αντιστοίχιση στοιχείων και ακίδων GPIO
red = LED(27)
orange = LED(19)
green=LED(5)
buzzer = LED(10)
# Αρχικοποίηση καταστάσεων στοιχείων
red.off()
orange.off()
green.off()
sleep(1)
# Συν... |
#!/usr/bin/env python3
import subprocess
def osascript(script):
"""
This is a bridge between Python and AppleScript using the `osascript`
comamnd line app.
"""
process = subprocess.run(['osascript', '-e', script],
stdout=subprocess.PIPE)
# Because the `subproces... |
# Copyright 2011-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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in... |
import requests
class Browser:
def __init__(self, logger, timeout):
self.logger = logger
self.timeout = timeout
def browse(self, request):
try:
r = requests.request(request.method, request.url, headers=request.headers, data=request.body, timeout=self.timeout)
r... |
#!/usr/bin/env python
# 1-example
# A simple demonstration script to find the largest prime number
# below a given limit.
#
# This file is intentionally inefficient in order to demonstrate
# various ways to time execution
#
# Usage:
# time python 1-example.py 10000
#
# Author: Allen Leis <al1075@georgetown.edu>
# C... |
# -*- coding: utf-8 -*-
from django.db import models
from django.template.defaultfilters import slugify
from django_roa import Model
class RemotePage(Model):
title = models.CharField(max_length=50, blank=True, null=True)
def __unicode__(self):
return u'%s (%s)' % (self.title, self.pk)
@staticmet... |
import logging
from ailment import Expr
from ... import AnalysesHub
from .engine_base import SimplifierAILEngine, SimplifierAILState
from .optimization_pass import OptimizationPass, OptimizationPassStage
_l = logging.getLogger(name=__name__)
class ModSimplifierAILEngine(SimplifierAILEngine):
def _ail_handle_Su... |
cp850_high = [
0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7,
0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5,
0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9,
0x00ff, 0x00d6, 0x00dc, 0x00f8, 0x00a3, 0x00d8, 0x00d7, 0x0192,
0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00... |
from cvxopt import matrix,spmatrix,sparse,uniform,normal,setseed
from cvxopt.blas import dot,dotu
from cvxopt.solvers import qp
from cvxopt.lapack import syev
import numpy as np
import math as math
from kernel import Kernel
from svdd import SVDD
from ocsvm import OCSVM
import pylab as pl
import matplotlib.pyplot as... |
# -*- coding: utf-8 -*-
import json, urllib
import tornado.web
import tornado.gen
from datetime import date, timedelta
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
import traceback
class NewNewHandler(tornado.web.RequestHandler):
def get(self):
self.write('Herald Web Service')
@tornado... |
import argparse
import codecs
import logging
import os
import sys
import time
from blessings import Terminal
import six
from verlib import NormalizedVersion
from . import utils
from .exceptions import (
GitCommandError,
JiraInteractionFailed,
JirafsError,
NotTicketFolderException
)
# Write data to ... |
"""
Serve SNMP Community names defined by regexp
++++++++++++++++++++++++++++++++++++++++++++
Receive SNMP TRAP/INFORM messages with the following options:
* SNMPv1/SNMPv2c
* with any SNMP community matching regexp '.*love.*'
* over IPv4/UDP, listening at 127.0.0.1:162
* print received data on stdout
Either of the f... |
"""
Defining various quadrature routines.
Based on the quadrature routines found in the CompEcon toolbox by
Miranda and Fackler.
References
----------
Miranda, Mario J, and Paul L Fackler. Applied Computational Economics
and Finance, MIT Press, 2002.
"""
import math
import numpy as np
import scipy.linalg as la
from ... |
from restclients.test.uwnetid.password import UwPasswordTest
from restclients.test.uwnetid.subscription import EmailForwardingTest
from restclients.test.uwnetid.subscription_60 import KerberosSubsTest
from restclients.test.uwnetid.subscription_233 import Office365EduSubsTest
from restclients.test.uwnetid.subscription i... |
# -*- coding: utf-8 -*-
from random import choice
import copy
import random
import string
import pprint
import pickle
class wordai:
"""Word AI"""
def load(self):
"""Load the file."""
try:
self.dict_file = open(self.dbfile, 'rb')
self.data_dict = pickle.load(self.dict_f... |
from helper import *
def doTest():
_ruleSet()
def _ruleSet():
ruleSet = RuleSet(' .test ', ' width:100px;height:100px; ', '/* aa */ ', None)
ok(not ruleSet.extra, 'ruleset is not extra')
equal(ruleSet.selector, '.test', 'selector is ok')
equal(ruleSet.roughSelector, ' .test ', 'roughSelect... |
#!/usr/bin/env python
#
# setup.py
# TurboHvZ
#
# Copyright (C) 2008 Ross Light
#
# 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 opt... |
#!/usr/bin/env python3
import argparse, pysam, re
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-bamin', '--bam-file-in', type=str, help='Input BAM file', required=True, default=None)
parser.add_argument('-bamout', '--bam-file-out', type=str, ... |
# coding=utf-8
# Copyright (C) 2016 Intelligent Visbility, Inc. - Richard Collins
# <richardc@intelligentvisibility.com>
import logging
import netifaces
import os
import signal
import subprocess
import sys
import time
"""
This script can be run on an Arista EOS switch to cause all SVI interfaces to
generate gratuitou... |
#!/usr/bin/env python3
""" NetworkManager event listener and calls user scripts
Listens on DBus for NetworkManager events.
When an interface is coming up or coming down, user scripts will be
called.
"""
import dbus
from dbus.mainloop.glib import DBusGMainLoop
import sys
import socket
import struct
import gi.repository... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2017 GEM Foundation
#
# OpenQuake 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 Licen... |
from datetime import timedelta, time, datetime, date
from pywind.elexon.api import B1420, B1330, B1320, FUELINST, \
DERSYSDATA, DERBMDATA, BMUNITSEARCH, \
B1610, B1630, UOU2T52W
from pywind.elexon.unit import BalancingData
from pywind.utils import StdoutForma... |
"""irc2 general utilities"""
import asyncio
import collections
import time
class IStr(str):
"""
IStr is a string which follows RFC1459 casing rules, and allows for
case-insensitive equality testing.
>>> IStr("Hello World") == "HELLO world"
True
>>> IStr("Hello[] World~") == "hello{] WORLD^"
... |
def extractMaddertranslatesCom(item):
'''
Parser for 'maddertranslates.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Form A Slaves Only Harem Guild', 'An ... |
# Python - 3.6.0
test.assert_equals(amort(7.4, 10215, 24, 20), 'num_payment 20 c 459 princ 445 int 14 balance 1809')
test.assert_equals(amort(7.9, 107090, 48, 41), 'num_payment 41 c 2609 princ 2476 int 133 balance 17794')
test.assert_equals(amort(6.8, 105097, 36, 4), 'num_payment 4 c 3235 princ 2685 int 550 balance 94... |
# vim:ts=4:sts=4:sw=4:expandtab
"""Master (central) event coordinator.
"""
import collections
import select
from _multiprocessing import Connection
from multiprocessing.connection import Listener
from satori.objects import Argument
from .api import Manager
from .client import Client, Scheduler
from .mapper import M... |
#!/usr/bin/env python
"""a taboo extension for phenny
(c)opyleft 2008-2009 Thomas Hirsch
Licence: GPL"""
import bz2, random, time, yaml, re
from operator import itemgetter
from math import floor
dico = {}
DEFINE_NONE = None
DEFINE_DEFINE = 1 #status codes for the define game
DEFINE_SELECT = 2
commonwords = []
#co... |
#!/usr/bin/env python2
#
# pyfeyner - a simple Python interface for making Feynman diagrams.
# Copyright (C) 2005-2010 Andy Buckley, Georg von Hippel
# Copyright (C) 2013 Ismo Toijala
#
# pyfeyner is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... |
################################################################################
#
# This program is part of the HPMon Zenpack for Zenoss.
# Copyright (C) 2008, 2009, 2010, 2011 Egor Puzanov.
#
# This program can be used under the GNU General Public License version 2
# You can find full information here: http://www.zen... |
"""
Support tool for changing course enrollments.
"""
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.db import transaction
from django.db.models import Q
from django.http import HttpResponseBadRequest
from django.urls import reverse
from django.utils.decorat... |
#
# Copyright 2012-2014 John Whitlock
#
# 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 writ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-16 06:34
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
... |
import os
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from numpy import arccos, cos, sin, pi
# from little_helpers.p4_tools import get_final_markings_counts
from planet4 import io, markings, region_data
meta_data_fn = Path.home() / 'Dropbox/SternchenAndMe/python_st... |
# -----------------------------------------------------------------------------
# @brief:
# modified from the code of kvfran
# @modified:
# Tingwu Wang
# -----------------------------------------------------------------------------
import multiprocessing
import init_path
import os
from util import log... |
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commercial ... |
# Copyright (C) 2013-2016 Jean-Francois Romang (jromang@posteo.de)
# Shivkumar Shivaji ()
# Jürgen Précour (LocutusOfPenguin@posteo.de)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
# ----------------------------------------------------------------------------
# Building
#
# Create source distribution:
# ./setup.py sdist
#
#
# Create binary distribution (non-univeral, python 3 only):
# ./setup.py bdist_wheel --python-tag=... |
#
# Copyright 2013 Quantopian, 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 wr... |
#
# Copyright (c) 2015, Arista Networks, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of condit... |
from numpy import *
from skimage.measure import find_contours
from scipy import misc
from scipy.ndimage.filters import gaussian_filter
from scipy.interpolate import interp1d
from ..manifolds.curves import Curve
def arclength_param(line) :
vel = line[1:, :] - line[:-1, :]
vel = sqrt(sum( vel ** 2, 1 ))
return hsta... |
from TestBase import TestBase
class TestMcApp(TestBase):
""" sollte grundlegende ablaeufe der app testen
"""
def setUp(self):
""" instantiieren; sources laden; db init. """
TestBase.setUp(self)
self.mc.scan_source_dirs_all()
self.mc.scan_sources()
self.mc.source_... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RandomPointsAlongLines.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
****... |
from django.conf.urls import re_path
from django.contrib.auth.decorators import login_required
from w0rplib.url import redir
from .feed import LatestArticleFeed
from .views import (
ArticleBanCommenterView,
ArticleDeleteCommentView,
ArticleDetailView,
ArticleEditPageView,
ArticleMonthArchiveView,
... |
#!/usr/bin/python
# -*- encoding: UTF8 -*-
# pyOscilloskop
#
# Copyright (19.2.2011) Sascha Brinkmann
#
# 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... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterVmHostRuleInfo(vim, *args, **kwargs):
'''A ClusterVmHostRuleInfo object identi... |
from django import template
register = template.Library()
@register.filter('get_form_field')
def get_form_field(form, field):
return form[field]
@register.inclusion_tag('form_as_fieldset.html')
def form_as_fieldset_fields(form, fieldsets=None):
"""
Render the form as a fieldset form.
Example usage ... |
# Django settings for ecommerce project.
from os.path import dirname, abspath, join
PROJECT_ROOT = dirname(dirname(dirname(abspath(__file__))))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.... |
"""Provide the Redditor class."""
from json import dumps
from typing import Any, Dict, Generator, List, Optional, TypeVar, Union
from ...const import API_PATH
from ...util.cache import cachedproperty
from ..listing.mixins import RedditorListingMixin
from ..util import stream_generator
from .base import RedditBase
from... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def ClusterPowerOnVmResult(vim, *args, **kwargs):
'''PowerOnVmResult is the base class of... |
from __future__ import division
import numpy as np
import multiprocessing as mp
import math
NUM_WORKERS = None
def set_NUM_WORKERS(nworkers):
global NUM_WORKERS
if nworkers == None:
try:
NUM_WORKERS = mp.cpu_count()
except NotImplementedError:
NUM_WORKERS = 4
else: ... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... |
#coding:utf8
'''
Created on 2010-9-15
@author: chenggong
'''
import urllib2
import re
import socket
DEBUG = 0
'''
工具类
'''
class Tools():
#log函数
@staticmethod
def writelog(level,info,notify=False):
if DEBUG == 0:
try:
print "["+level+"]"+info.decode('UTF-8').encode('... |
# --*-- coding: utf-8 --*--
import sys
import traceback
import logging
import psycopg2
import psycopg2.extras
from datetime import datetime
from managers.manager import Manager
from services.cursor import Cursor
from orm.common import *
from tools.translations import trlocal as _
_logger = logging.getLogger('listener.... |
import unittest
from spark_parser.spark import GenericParser
from spark_parser import PYTHON3
if PYTHON3:
from io import StringIO
else:
from StringIO import StringIO
class Rules(GenericParser):
"""Testing duplicate rules"""
def p_rules(self, args):
"""
x ::= TOKEN
x ::= TOKEN
... |
from enum import Enum
class Colors(Enum):
Pink = (255,96,96)
Magenta = (255,0,192)
Orange = (255,64,0)
Yellow = (255,255,0)
Green = (0,255,0)
Turquoise = (0,255,255)
Blue = (0,0,255)
Purple = (96,0,255)
color_list = [x for x in Colors]
quad_teams_banned = {
Colors.Pink : [Colors.M... |
"""
Integration tests for stem.descriptor.server_descriptor.
"""
from __future__ import with_statement
import datetime
import os
import unittest
import stem.control
import stem.descriptor.server_descriptor
import stem.exit_policy
import stem.version
import test.integ.descriptor
import test.runner
class TestServerDe... |
#!/usr/bin/env python
# This example demonstrates the use of fields and use of
# vtkProgrammableDataObjectSource. It creates fields the hard way (as
# compared to reading a vtk field file), but shows you how to
# interface to your own raw data.
import os
import re
import vtk
from vtk.util.misc import vtkGet... |
"""
vUSBf: A KVM/QEMU based USB-fuzzing framework.
Copyright (C) 2015 Sergej Schumilo, OpenSource Security Ralf Spenneberg
This file is part of vUSBf.
See the file LICENSE for copying permission.
"""
from usbscapy import *
def print_descriptor(descriptor):
if descriptor == None:
return
... |
import re
import requests
import os
import functools
import json
try:
from functools import lru_cache
except ImportError:
from backports.functools_lru_cache import lru_cache
GRITS_URL = os.environ.get("GRITS_URL", "https://grits.eha.io")
def clean(s):
return re.sub(r"\s+", " ", s).strip()
def clean_di... |
#!/usr/bin/env python
import base64
import errno
import httplib
import json
import socket
import sys
import time
def do(method, connection, headers, path, body=None):
connection.request(method, path, headers=headers, body=json.dumps(body))
resp = connection.getresponse()
content = resp.read()
if resp... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
[TestAction.create_mini_vm, 'vm1', 'cluster=cluster2'],
[TestAction.create_vm_backup, 'vm1', 'vm1-backup1'],
[Te... |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... |
from __future__ import absolute_import, print_function
import os
import sys
import requests
import json
import numpy as np
import time
import logging
cur_dir = os.path.dirname(os.path.abspath(__file__))
import torch
import torch.utils.data as data
from torch import nn, optim
from torch.autograd import Variable
import... |
"""
The MIT License (MIT)
Copyright (c) 2016 Luca Ucciero
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, ... |
#!/usr/bin/python
# script that adds a VM who requests an IP address using the dhcpd to local hosts file
import sys
import subprocess
import string
import time
debug_file="/var/log/add_hosts.log"
def debug(message):
message = time.strftime("%d %b %Y %H:%M:%S") + " " + message
print message
fd = open(debug_file, "... |
from xml.dom.minidom import parse
import xml.dom.minidom
import sys
import csv
#uni_file=open(sys.argv[1],'r')
#non_uni_file=uni_file.decode("utf8")
dom_tree=parse(sys.argv[1])
collect=dom_tree.documentElement
output_data=[[],[],[],[],[],[],[],[]]
out_filename=((sys.argv[1].split("/")[-1]).split(".")[0])+".csv"
out_fi... |
import visa
import numpy as np
import time
from stlab.devices.instrument import instrument
class Cryocon_44C(instrument):
def __init__(self,addr='TCPIP::192.168.1.5::5000::SOCKET',reset=True,verb=True,**kwargs):
#RST reboots the instrument. Avoid... Also needs special read_termination = '\r\n'
if ... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
from operator import itemgetter
from pprint import pprint
import logging
import numpy as np
from django.core.management.base import BaseCommand
from core.models import Collective
log = logging.getLogger("datascope")
class Command(BaseCommand):
"""
Base command for Community centered commands
"""
... |
import requests
from CommonServerPython import *
''' GLOBAL PARAMS '''
API_KEY = demisto.params()['api_key']
SERVER = (
demisto.params()['server'][:-1]
if (demisto.params()['server'] and demisto.params()['server'].endswith('/'))
else demisto.params()['server']
)
SERVER += '/rest/'
USE_SSL = not demisto.par... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('MAIL_USE... |
#!/usr/bin/python
#------------------------------------------------------------------------------
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
length = len(strs)
result = ""
charsleft = True
i... |
# Copyright 2014-2015 Canonical Limited.
#
# This file is part of charm-helpers.
#
# charm-helpers is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3 as
# published by the Free Software Foundation.
#
# charm-helpers is distributed in the hope ... |
import pickle
import numpy as np
import numpy.testing as npt
import pytest
from pytest import raises as assert_raises
from scipy.integrate import IntegrationWarning
from scipy import stats
from scipy.special import betainc
from. common_tests import (check_normalization, check_moment, check_mean_expect,
... |
# Copyright 2012 OpenStack Foundation
#
# 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... |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import sqlite3 as db
import sys
import os
import pycurl
import StringIO
import re
import urllib
import json
from random import shuffle
PROFILE = 'default'
argc = len(sys.argv)
if argc < 3 or argc > 4:
sys.stderr.write('Usage: %s /path/to/dir count_of_songs [PROFILE]\n'... |
# Copyright 2013-2017 DataStax, 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 writi... |
# 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/.
from marionette_driver.errors import JavascriptException
from marionette_harness import MarionetteTestCase, WindowManag... |
from resources.lib import tor
class TorFeeds:
def __init__(self):
self.feeds = []
self.time = 0
def add_feeds(self, feeds):
'''
Add an array of feeds
'''
self.feeds = feeds
def add_feed(self, feed):
torFeed = TorFeed(feed)
se... |
"""Python utilities required by Keras."""
from __future__ import absolute_import
import numpy as np
import time
import sys
import six
import marshal
import types as python_types
def get_from_module(identifier, module_params, module_name,
instantiate=False, kwargs=None):
"""Retrieves a class ... |
# -*- coding: utf-8 -*-
# !/usr/bin/python
import os
import rrdtool
import threading
import time
import fetchrrd
import updaterrd
rrd_db_base_path = os.path.dirname(
os.path.dirname(os.path.dirname(__file__))) + '/render/static/rrd/'
task_dick = {}
ipaddr_list = []
bools = True
def create_rrd(ip):
if ip == ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'SourceRegion', fields ['region_string', 'documen... |
#! /usr/bin/env python
#
# quick and dirty processing of the MD All Sky images
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from scipy.misc import imsave
import numpy as np
import aplpy
import argparse as ap
import os.path
import logging
import time
def d(ff,box=[]):... |
#!/usr/bin/python
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from django import template
register = template.Library()
@register.simple_tag
def get_model_fields(object_to_query):
return dict(
(field.name, field.value_to_string(object_to_query)) for field in object_to_query._... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © 2016, Continuum Analytics, Inc. All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------------------------------------------------------... |
import hashlib
import requests
# Servers
DEFAULT_SERVER = "powdertoy.co.uk"
DEFAULT_STATIC_SERVER = "static.powdertoy.co.uk"
# Check for version updates
UPDATE_VERSION_STABLE = "Stable"
UPDATE_VERSION_BETA = "Beta"
UPDATE_VERSION_SNAPSHOT = "Snapshot"
# User elevations
USER_ELEVATION_NONE = ""
USER_ELEVATION_MOD = "... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Canonical
#
# Authors:
# Didier Roche
# Tin Tvrtković
#
# 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; version 3.
#
# This program is distributed ... |
from . import xpath_lexer
from . import xpath_parser
from .error import err_add
from .util import prefix_to_module, search_data_node, data_node_up
from .syntax import re_identifier
core_functions = {
'last': ([], 'number'),
'position': ([], 'number'),
'count': (['node-set'], 'number'),
'id': (['object'... |
import json
import logging
from couchdbkit import ResourceNotFound
from django.utils.encoding import force_unicode
from django_countries.countries import COUNTRIES
from phonenumbers import COUNTRY_CODE_TO_REGION_CODE
from django.utils.translation import ugettext_lazy as _
from corehq.apps.accounting.utils import fmt_do... |
# 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/.
"""
Define the Separator Flow component.
"""
from scr.logic.components.component import Component as Cmp
from scr.logic.... |
from gwlfe.AFOS.nonGrazingAnimals.Losses.NGLostBarnNSum import NGLostBarnNSum
def NAWMSP_2(NYrs, NGPctManApp, GrazingAnimal_0, NumAnimals, AvgAnimalWt, AnimalDailyN, NGBarnNRate,
Prec, DaysMonth, AWMSNgPct, NgAWMSCoeffN, RunContPct, RunConCoeffN, n41d, n85j):
ng_lost_barn_n_sum = NGLostBarnNSum(NYrs,... |
# -*- coding: utf-8 -*-
# Copyright (c) 2007-2010 Stas Zykiewicz <stas.zytkiewicz@schoolsplay.org>
#
# SPDataManager.py
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License
# as published by the Free Software Foundation. A... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.