src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
from __future__ import unicode_literals
import os
import re
import time
import django.core.exceptions
from datetime import datetime, timedelta
from threading import Thread
from decimal import Decimal
import paho.mqtt.subscribe as subscribe
from django.core.management.base import BaseCommand
imp... |
'''
Created on 3 mei 2012
@author: jacco
'''
import unittest
import os
from lifeshare.lib.renderers import stackdict
from lifeshare.lib.renderers.ajax_renderer import AjaxRendererFactory
from lifeshare.lib.renderers.pybars_renderer import PybarsRendererFactory
from pyramid import testing
from pyramid.threadlocal im... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from optparse import make_option
from fabric.colors import green
from django.core.management.base import BaseCommand
from magicbackup.helpers import MagicBackup
class Command(BaseCommand):
help = 'Backup a Site'
option_list = BaseCommand.opti... |
# Copyright 2019 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... |
# -*- coding: utf-8 -*-
import os
from os import path
import pandas as pd
import collections
from pickle import dump, load
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import classification_report,accuracy_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.externa... |
__author__ = 'yagel'
class UserDetails:
def __init__(self,nickname,
email,
first_name,
last_name,
id ,
password,
verQuestion,
ans):
self.id = id
self.password=password
sel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement, unicode_literals
import codecs
import decimal
from fractions import Fraction
import os
import unittest
import simfile
from simfile.timing import BeatValues
from simfile.sm import *
def get_simfile(filename, cache={}):
if not fil... |
#!/usr/bin/env python2
"""
@file connection.py
@author Bo Gao
@date 2017-07-25
@version alpha
Intersection control agent
Copyright (C) 2017 Transport Research Group, University of Southampton
Intersection Control Test Bed
"""
# if "SUMO_HOME" in os.environ:
# tools = os.path.join(os.environ["SUMO_HOME"], ... |
############################################################################
# Copyright (c) 2011-2012 Saint-Petersburg Academic University
# All Rights Reserved
# See file LICENSE for details.
############################################################################
def NG50(numlist, reference_length, percentage =... |
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
from copy import deepcopy
from nose.tools import (assert_true, assert_equal, assert_raises,
assert_not_equal)
from numpy.... |
def process(api, data):
pid = data["pid"]
stage = {
"Open Sesame": "026cd71be5149e4c645a45b4915d9917",
"Overflow 1": "0b944e114502bd1af14469dbb51b9572",
"Overflow 2": "ee876f0736c4fe1b5607b68098f4cc1c",
"Simple": "1fbb1e3943c2c6c560247ac8f9289780",
"Diary": "edcf7eb3a7d5e... |
import re
import sys
import json
import math
import time
from datetime import timedelta
from urllib.request import Request, urlopen
from urllib.parse import quote, urljoin
from typing import Optional, List
from werkzeug.urls import url_parse
from flask import current_app, g, escape, render_template, abort, url_for, re... |
# geonames tagger
#
# Copyright (c) 2015 Christian Sengstock, All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your optio... |
from operator import attrgetter
from django.core.exceptions import ImproperlyConfigured
from django.urls import re_path, include
from django.template.defaultfilters import slugify
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.utils.module_loading import au... |
"""
setup
"""
from setuptools import setup, find_packages
setup(
name = "HackerPublicRadioPublisher",
version = "0.1",
description = "Python Uploader for Hacker Public Radio",
long_description=u'''
A set of scripts to manage the creation and uploading of shows into HPR
''',
platforms = "Deb... |
r"""Block ComplyWithText for adapting the nodes to comply with the text.
Implementation design details:
Usually, most of the inconsistencies between tree tokens and the raw text are simple to solve.
However, there may be also rare cases when it is not clear how to align the tokens
(nodes in the tree) with the raw text... |
"""General functions for mathematical and numerical operations.
Functions
---------
- confidence_bands - Bin by `xx` to calculate confidence intervals in `yy`.
- confidence_intervals - Compute the values bounding desired confidence intervals.
- cumstats - Calculate a cumulative averag... |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
#!/usr/local/bin/python
# Copyright (c) Andrew Cox 2009-10
# See LICENCE for details
"""
These are common classes and functions to the whole project
"""
#Internal Modules
#Python BulitIns
import logging, ConfigParser, collections, uuid, os
from datetime import datetime, timedelta
#External Modules
from genshi.template... |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... |
##
# Copyright 2016 DECaF Project Group, University of Paderborn
# This file is part of the decaf orchestration framework
# All Rights Reserved.
#
# 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 htt... |
from collections import defaultdict
import os
import pickle
import re
import subprocess
from Bio import SeqIO
from Bio.Alphabet import IUPAC
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from django.conf import settings
import pysam
from genome_finish.contig_display_utils import Junction
from genome_fin... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... |
#!/usr/bin/env python
#####################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that th... |
# coding=utf-8
from decimal import Decimal
from django.utils.formats import localize
import datetime
from reportlab.platypus import Paragraph, Spacer
from reportlab.lib.units import inch
from reportlab.platypus import Table, TableStyle
from django.db import models, connection
from core.models import OwnedObject
from dj... |
from datetime import datetime
import io
import json
import math
from threading import Thread
from time import sleep
from unittest.mock import call
from unittest.mock import Mock
from unittest.mock import patch
import dateutil.parser
from flask import request
import numpy as np
import pytest
import ujson
from werkzeug.... |
#!/usr/bin/python2.5
# Copyright 2010 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 or ... |
import urllib.request
from bs4 import BeautifulSoup
from PIL import Image
from tkinter import Tk, Label, Button
import requests
import pprint
import secrets
import os
class RarityUnknown(Exception):
"""Raised in this program when an unhandled rarity is encountered"""
pp = pprint.PrettyPrinter(indent=4... |
#!python3
# -*- coding:utf-8 -*-
import os
import sys
import time
import ctypes
import shutil
import subprocess
IsPy3 = sys.version_info[0] >= 3
if IsPy3:
import winreg
else:
import codecs
import _winreg as winreg
BuildType = 'Release'
IsRebuild = True
Build = 'Rebuild'
Update = False
Copy = False
CleanAl... |
"""media_manager URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/{{ docs_version }}/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, na... |
import unittest
import phone_number_extract
class TestStringPhoneExtractTransform(unittest.TestCase):
def test_phoneextract(self):
transformer = phone_number_extract.StringPhoneExtractTransform()
# using the default regex - which is uni1
self.assertEqual(transformer.transform(""), "")
... |
# -*- coding: utf-8 -*-
# © 2015 Eficent Business and IT Consulting Services S.L.
# (Jordi Ballester Alomar)
#
# © 2015 Serpent Consulting Services Pvt. Ltd.
# (Sudhir Arya)
#
# © 2016 Matmoz d.o.o.
# (Matjaž Mozetič)
#
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import time
from openerp impo... |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: Mcl_Cmd_Put_Tasking.py
UPLOADS_DIR = 'Uploads'
MAX_CHUNK_SIZE = 1047552
def TaskingMain(namespace):
import mcl.imports
import mcl.target
... |
"""
WSGI config for isafonda project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... |
import select
import time
import bisect
POLLIN = 1
POLLOUT = 2
POLLERR = 8
POLLHUP = 16
class poll(object):
def __init__(self):
self.rlist = []
self.wlist = []
def register(self, f, t):
if not isinstance(f, int):
f = f.fileno()
if t & POLLIN:
insert(se... |
import json
import socket
from collections import deque
from datetime import timedelta
from logging import getLogger, INFO, WARNING
from time import sleep
from django.db import transaction
from common.utils import utcnow, to_unix, StoppableThread
from main.battle_net import BnetClient, ApiLadder
from main.client import... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proto/core/node/common/action/exception_action.proto
"""Generated protocol buffer code."""
# third party
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from operator import attrgetter
from sqlalchemy import and_, String, cast
from db.common import session_scope
from db.player import Player
from db.team import Team
from db.player_game import PlayerGame
from db.player_season import PlayerSeason
# TODO: co... |
#!/bin/python3
from argparse import ArgumentParser
from configparser import ConfigParser
from os.path import expanduser
from mailbox import MaildirMessage, Maildir
config = ConfigParser()
config_mailboxes = {}
config.read(expanduser('~/.config/email_bar.cfg'))
parser = ArgumentParser()
parser.add_argument('--on... |
# 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/.
# Future Modules:
from __future__ import annotations
# Built-in Modules:
import socket
from unittest import TestCase
f... |
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be promptly sent for a psychiatric evaluation.
Configuration parameters:
cache_ti... |
# Copyright (c) 2021 PaddlePaddle 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 appli... |
from __future__ import print_function
# Copyright 2017 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 ap... |
'''
Copyright 2011 SRI International
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, softw... |
# coding: utf-8
#
# This file is part of Progdupeupl.
#
# Progdupeupl 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.
#
# Progdu... |
from __future__ import absolute_import, print_function
import unittest
import mozunit
from mozbuild.preprocessor import Expression, Context
class TestContext(unittest.TestCase):
"""
Unit tests for the Context class
"""
def setUp(self):
self.c = Context()
self.c['FAIL'] = 'PASS'
... |
"""HTTP client functional tests against aiohttp.web server"""
import asyncio
import http.cookies
import io
import json
import pathlib
import ssl
from unittest import mock
import pytest
from multidict import MultiDict
import aiohttp
from aiohttp import hdrs, web
from aiohttp.errors import FingerprintMismatch
from aio... |
#!/usr/bin/env python3
##################################################################################
## ##
## _____ _ _ _ _ ##
## | __| |_ ___| |_| |_ ___ ___ ___ _... |
# pylint: disable=g-bad-file-header
# pylint: disable=superfluous-parens
# Copyright 2017 The Bazel 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:/... |
import json
import urllib2
mseServers=[
'1.2.3.4',
'5.6.7.8',
'9.10.11.12'
]
def getClients(server, user, password):
passwordManager = urllib2.HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None,"https://"+server+"/",user,password)
authHandler = urlli... |
#!/opt/epd/bin/python
import pyfits
import os
#import matplotlib
#matplotlib.use('Agg')
import scipy
from numpy import array, where, nan
from xml.dom import minidom
from plot_guideinfo import plot_guideflux, plot_guidepos, plot_xposwtime, plot_yposwtime, plot_fwhmwtime, plot_guidestate
def mk_guideinfo_plots(rootname... |
from copy import deepcopy
import os
ROOT = os.path.dirname(os.path.abspath(__file__)) + '/'
from astropy import log as logger
from astropy.io import fits
import numpy as np
from numpy.random import normal
from .psf import GaussianPSF, FilePSF, FunctionPSF
from .filter import Filter
from .utils.plot import MakePlots
... |
import asyncio
import ctypes
import logging
import os
import threading
import janus
from ... import BaseRunner
from .inproc import PollyInprocRunner
log = logging.getLogger()
class Runner(BaseRunner):
log_prefix = 'vendor.aws_polly-kernel'
def __init__(self, *args, **kwargs):
super().__init__(*ar... |
"""Config flow for Plex."""
import copy
import logging
from aiohttp import web_response
import plexapi.exceptions
from plexapi.gdm import GDM
from plexauth import PlexAuth
import requests.exceptions
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.http.view import HomeAs... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 13 20:13:50 2019
@author: zijiazhang
"""
import xml.etree.ElementTree as ET
def xml_to_python(path):
try:
tree = ET.parse(path)
except:
print('Error Reading Files')
return
root = tree.getroot()
graph = root... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Colors.
Create a color instance.
>>> clr = RGBColor(120, 120)
>>> clr.set(blue=30)
>>> print clr
120,120,30
"""
__all__ = ['RGBColor']
class RGBColor(object):
"""RGB color type.
rgb = RGBColor(128, 128, 128)
"""
__slots__ = ['_red', '_green'... |
# -*- coding: utf-8 -*-
# Copyright 2019 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extractors for https://fuskator.com/"""
from .common import GalleryExtrac... |
# encoding: utf-8
"""Test seya.layers.recurrent module"""
from __future__ import print_function
import unittest
import numpy as np
from keras.models import Sequential
from keras.layers.core import TimeDistributedDense
from keras.layers.convolutional import Convolution2D
from seya.layers.conv_rnn import ConvRNN, Conv... |
from pycp2k.inputsection import InputSection
class _opt_ri_basis3(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Delta_i_rel = None
self.Delta_ri = None
self.Eps_deriv = None
self.Max_iter = None
self.Num_func = None
self.Basis_size = No... |
from ..entity.definition import BackupDefinition
from ..service.client import FileRepositoryClient
from ..service.pipefactory import PipeFactory
from ..exceptions import ReadWriteException
from ..result import CommandExecutionResult
from logging import Logger
import string
import random
import subprocess
from shutil im... |
# Copyright 2013 Rackspace Hosting Inc.
# 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 re... |
from dopamine.environments import TestEnvironment
from dopamine.environments import DiscreteCartPoleEnvironment, CartPoleRenderer
from dopamine.agents import QAgent, SARSAAgent
from dopamine.experiments import Experiment
from dopamine.adapters import EpsilonGreedyExplorer, VQStateDiscretizationAdapter
from matplotlib... |
from cno.io.net import NET
from cno import getdata
class testNET(object):
@classmethod
def setup_class(klass):
# test the constrcutors
klass.net1 = NET()
klass.net2 = NET(getdata("PKN-ToyMMB.net"))
try:
n = NET("dummy")
assert False
except:
... |
#! /usr/bin/env python
"""
edit user-provided ESOM class file with new assignments in user-provided file
each line of user-provided file of new assignments should contain a data point number and a class number, separated by tabs
usage:
python edit-esom-class-file.py esom.cls new-assignments.tsv new-class-filename.cl... |
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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 versi... |
from itertools import groupby
from django.db import models
from django.db.models import Q
from django.utils import timezone
from rest_framework import generics, serializers
from opaque_keys.edx.keys import CourseKey
from analytics_data_api.v0.exceptions import CourseNotSpecifiedError
from analytics_data_api.v0.view... |
from __future__ import print_function
import NatronEngine
f1 = open('test___01-output.txt','w+')
reader = app.createNode("fr.inria.openfx.ReadOIIO")
writer = app.createNode("fr.inria.openfx.WriteOIIO")
blur = app.createNode("net.sf.cimg.CImgBlur")
reader = app.Read1
writer = app.Write1
blur = app.BlurCImg1
print(blu... |
from __future__ import print_function
import argparse
import os
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchv... |
import os, sys
import io
import Tkinter
import Image, ImageTk
from time import sleep
import cStringIO
import paho.mqtt.client as mqtt
host = "test.mosquitto.org"
#host = "localhost"
qos = 0
sensors_topic = "/rtmsg/d25638bb-17c2-46ac-b26e-ce1f67268088/sensors/"
camera_topic = sensors_topic + "camera1"
imgcnt = 0
def... |
# peri3dController_triaxialCompression.py
# script, that explains funcionality and input parameters of Peri3dController on the example of
# triaxial compression.
# Firstly, a hydrostatic preassure is applied, then a strain along z axis is increasing
# while x- and y- stress is constant
# The simulation is run on ro... |
#!/usr/bin/env python2
# *-* coding: utf-8 *-*
"Interactive Python Part 8: File Operations"
def withfor():
qbfile = open("lib/qbdata.txt","r")
for line in qbfile:
values = line.split()
print 'QB ', values[0], values[1], 'had a rating of ', values[10]
qbfile.close()
def withwhile():
in... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
# -*- coding: utf-8 -*-
# This code is part of crysp
# Copyright (C) 2013 Axel Tillequin (bdcht3@gmail.com)
# published under GPLv2 license
from crysp.padding import nopadding,pkcs7
from io import BytesIO
from crysp.bits import pack, unpack, Bits
# -------------------------------------------------------------------... |
""" Merlyn Speech Control for PC
We load in commands (& spells) generated by lmtool.py
and also language files generated by the Sphinx lmtool
http://www.speech.cs.cmu.edu/tools/lmtool-new.html
then open up a stream of words from the mic via LiveSpeech
and try to parse it into commands and possibly some parameters... |
# Copyright 2017 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... |
# coding: utf-8
import os
from mock import patch, call
import pytest
import coveralls
from coveralls.api import CoverallsException
import coveralls.cli
@patch.dict(os.environ, {'TRAVIS': 'True'}, clear=True)
@patch.object(coveralls.cli.log, 'info')
@patch.object(coveralls.Coveralls, 'wear')
def test_debug(mock_wear... |
###############################################################################
##
## Copyright 2011,2012 Tavendo GmbH
##
## 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
##
## ... |
#import Tkinter
#l = Tkinter.Label(text = "***************************See me?*************************")
#l.pack()
#l.mainloop()
#print("Howdy")
#omfg
#print("dostuff")
# http://www.ferg.org/thinking_in_tkinter/all_programs.html
from Tkinter import *
class MyApp:
def __init__(self, parent):
... |
# wget setup_frappe.py | python
import os, sys, subprocess, getpass, json, multiprocessing, shutil, platform
from distutils.spawn import find_executable
tmp_bench_repo = '/tmp/bench-v7'
def install_bench(args):
check_distribution_compatibility()
check_brew_installed()
# pre-requisites for bench repo cloning
insta... |
# coding: utf-8
# utilizar %s no lugar dos objetos que serão renderizados com str.format()
# aqui somente para title e file
body_msg = '''
<html>
<p>
Prezado Sr(a) Editor(a) do periódico <strong>%s</strong>
</p>
<p>
Como informamos anteriormente, a avaliação dos periódicos da coleção SciELO
Brasil será re... |
from django.dispatch import receiver
from django.db.models.signals import *
from farms.models import *
from irrigator_pro.settings import DEBUG
def minNone( *args ):
args = filter( lambda x: x is not None, args)
if args:
return min(args)
else:
return None
## From
## http://stackoverflow... |
import random
import time
from locust import User, TaskSet, between, constant, constant_pacing
from locust.exception import MissingWaitTimeError
from .testcases import LocustTestCase
class TestWaitTime(LocustTestCase):
def test_between(self):
class MyUser(User):
wait_time = between(3, 9)
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Mayo Clinic
# 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... |
# Licensed to the StackStorm, Inc ('StackStorm') 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 "License"); you may not use th... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import logging
import numpy as np
from utils import print
# import matplotlib.pyplot as plt
import err
#TAG:Z3_IND
# Comment out below import
#import smtSolver as smt
import concretePlant as cp
import cellmanager as CM
logger = logging... |
'''
Created on Jun 19, 2014
@author: Erik Halperin
List of Keys
_id
JobStartDate
Requirements
TransferInput
TotalSuspensions
LastJobStatus
BufferBlockSize
OrigMaxHosts
RequestMemory
WantRemoteSyscalls
LastHoldReasonCode
ExitStatus
Args
JobFinishedHookDone
JobCurrentStartDate
CompletionDate
JobLeaseDuration
Err
Remote... |
# a simple portscanner with multithreading
import socket as sk
import sys
import threading
MAX_THREADS = 50
def usage():
print "\npyScan 0.1"
print "usage: pyScan <host> [start port] [end port]"
class Scanner(threading.Thread):
def __init__(self, host, port):
threading.Thread.__init__(self)
... |
"""praw setup.py"""
import re
from codecs import open
from os import path
from setuptools import setup
PACKAGE_NAME = 'praw'
HERE = path.abspath(path.dirname(__file__))
with open(path.join(HERE, 'README.rst'), encoding='utf-8') as fp:
README = fp.read()
with open(path.join(HERE, PACKAGE_NAME, '__init__.py'),
... |
# -*- coding: utf-8 -*-
from testcase import TestCase
class TestDict(TestCase):
def test_literal0(self):
self._test("""
d = {}
puts(d.size)
""", """0
""")
def test_literal5(self):
self._test("""
d = { 42: 26 }
puts(d[42])
""", """26
""")
def test_literal10(self):
self._test("""
... |
#!/usr/bin/env python3
import os, sys
import pywind.evtframework.handlers.handler as handler
import freenet.lib.fn_utils as fn_utils
import freenet.lib.simple_qos as simple_qos
try:
import fcntl
except ImportError:
pass
class tun_base(handler.handler):
__creator_fd = None
# 要写入到tun的IP包
___ip_pac... |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright 2012 Varnish Software AS
# Copyright 2013-2014 Antoine "hashar" Musso
# Copyright 2013-2014 Wikimedia Foundation Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
import pytest
import boto3
import kfp
import os
import utils
from datetime import datetime
def pytest_addoption(parser):
parser.addoption(
"--region",
default="us-west-2",
required=False,
help="AWS region where test will run",
)
parser.addoption(
"--role-arn", requ... |
"""Basic drawing functions that only depend on plain OpenGL. These are higher
level than raw GL and similar in purpose to the GLU functions.
gl_drawing.py, Copyright (c) 2001-2014, Garth Zeglin. All rights
reserved. Licensed under the terms of the BSD 3-clause license as included in
LICENSE.
"""
from OpenGL.GL impor... |
from rohrpost.handlers import handle_ping
def test_ping(consumer):
handle_ping(consumer=consumer, request={"id": 123})
assert consumer.closed is False
assert len(consumer.data) == 1
data = consumer.data[-1]
assert data["id"] == 123
assert data["type"] == "pong"
assert "data" not in data
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Sarielsaz Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet accounts properly when there are cloned transactions with malleated scriptsigs."""
f... |
# TATL runtime lib
import json, re
from warnings import warn
try: unicode
except:
# Python 3
unicode = basestring = str
apply = lambda f, args=(), kw={}: f(*args, **kw)
# Define some of the TATL built-ins. Compiler uses __all__ to determine whether name refers to a
# built-in.
null = None
false = False
tr... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
"""
Django settings for adhesion project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... |
from .testutils import FullStackTests
from webrecorder.fullstackrunner import FullStackRunner
import os
import gevent
import websocket
import requests
import json
# ============================================================================
class TestWS(FullStackTests):
@classmethod
def setup_class(cls):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.