src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
import os
import time
MiG_DIR = "~/MiG-SSS"
G_XSCREENSAVER_COMMAND = "/usr/X11R6/bin/xscreensaver-command -watch"
G_GPIDFILE = "/tmp/mig_xsss_job.gpid"
# Returns Group ID of running job
def getRunningGPID( param_sGPIDFile ):
iGPID = -1
if ( os.path.isfile( param_sGPIDFile ) ):
input = o... |
"""
import json
class Report:
def getTitle(self):
return 'Title!'
def getDate(self):
return '2018-05-23'
def getContents(self):
return {
'title': self.getTitle(),
'date': self.getDate()
}
def formatJson(self):
return json.dumps(self.getContents... |
#!/usr/bin/python3
# -*- coding: utf-8
import argparse
from collections import Counter, defaultdict, deque
import curses
import itertools
import json
import os
import random
import socket
import sys
import threading
import time
from cashan import *
from game import *
from network import *
VERSION = '0.0.4'
# High f... |
#
# 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, software
# ... |
#!/usr/bin/python
import getopt as g
import sys
optlist, args = g.getopt(sys.argv[1:],'d:')
delim = ','
for o,a in optlist:
if o == '-d':
delim = a
max_width = [0]
with open(args[0],'r') as fh:
for line in fh:
line = line.rstrip()
fields = line.split(delim)
for idx,field in enumerate(fields):
... |
#!/usr/bin/python2
# -!- coding: utf-8 -!-
import argparse
import logging
import sys
import re
import codecs
from sklearn import cross_validation
# temporary measure while there is no package installation
sys.path.append('/media/max/Extension/Projects/Coreference/rucoref')
from anaphoralib.corpora import rueval
fro... |
# Copyright 2013 IBM Corp.
#
# 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 agree... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from nose.tools import assert_equals, assert_true, assert_false, assert_raises
from flaky import flaky
import time
import datetime
from decimal import Decimal
from amazon.api import (AmazonAPI,
CartException,
... |
# -*- coding: utf-8 -*-
from lxml import etree
from odoo import http
from odoo.http import request
from .common import SubsonicREST
class MusicSubsonicMediaAnnotation(http.Controller):
@http.route(
["/rest/star.view", "/rest/star"],
type="http",
auth="public",
csrf=False,
... |
#!/usr/bin/env/python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# webgateway/views.py - django application view handling functions
#
# Copyright (c) 2007-2015 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle,... |
#
# Copyright (C) 2006, 2013 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV 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.
#
# This program is distributed in th... |
# 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
# "License"); you may not u... |
"""
Purpose: Changes the state of the configured pin on command
"""
import sys
import time
import RPi.GPIO as GPIO
class rpiGPIOActuator:
"""Represents an actuator connected to a GPIO pin"""
def __init__(self, connection, logger, params):
"""Sets the output and changes its state when it receives a c... |
# Copyright 2020 Makani Technologies LLC
#
# 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... |
import unittest
import datetime
import uuid
import sys
import json
import sys, os, os.path
root_directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', '..', '..')
if root_directory not in sys.path:
sys.path.append(root_directory)
from applicationinsights.channel.contracts import *
from ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
"""
Test the SearchContext class
"""
from pyesgf.search import SearchConnection, not_equals
from unittest import TestCase
import os
class TestContext(TestCase):
def setUp(self):
self.test_service = 'http://esgf-index1.ceda.ac.uk/esg-search'
self.cache = os.path.join(os.path.dirname(__file__), 'u... |
from utils.settings import CAFFE_PATH, DPLOY_MODEL_FILE, \
TRAIN_MODEL_FILE, PRETRAINED, BASE_SHAPE
import sys
sys.path.append(CAFFE_PATH)
import caffe
try:
import cv2
except ImportError as E:
import cv as cv2
import numpy as np
import os
# Set the right path to your model definition file, pretrained mod... |
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
def hist_match(source, template):
"""
Adjust the pixel values of a grayscale image such that its histogram
matches that of a target image
Arguments:
-----------
source: np.ndarray
Image to transform; th... |
from flask import render_template, request
from nanobox_libcloud import app
from nanobox_libcloud.adapters import get_adapter
from nanobox_libcloud.adapters.base import AdapterBase
from nanobox_libcloud.utils import output
# Overview and usage endpoints, to explain how this meta-adapter works
@app.route('/', methods=... |
# coding: utf-8
'''
The MIT License (MIT)
Copyright (c) 2014 Andreas "Akki" Nitsch
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 ... |
import os
from django.db import models
from cms.models.pluginmodel import CMSPlugin
from .lib.choices import (
DynamicTemplateChoices,
PlaceholdersDynamicChoices,
# PageIDsDynamicChoices,
# PageAttributeDynamicChoices,
)
TEMPLATE_PATH = os.path.join("cmsplugin_embeddedpages","layouts")
GROUP_TEMPLATE_PATH = ... |
from .base import ParserBase
from ..record import Nameserver
from dateutil import parser as time_parser
import re
class WhoisBnParser(ParserBase):
@property
def status(self):
if self.available:
return 'available'
else:
return 'registered'
@property
def availabl... |
#!/usr/bin/env python
# Author: Richard Bradshaw, R.T.Bradshaw@soton.ac.uk
# Script to create 3D matplotlib plots of e.g. field vectors.
# Vectors may need rotation into reference frame, i.e multiplication
# by a rotation matrix
# Requirements: numpy, matplotlib v2.0.0b1 or later
import numpy as np
import matplotlib... |
# Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Runner for flashing with dfu-util.'''
from collections import namedtuple
import sys
import time
from west import log
from runners.core import ZephyrBinaryRunner, RunnerCaps, \
BuildConfiguration
DfuSeConfig = namedtuple('DfuSeConf... |
###### configuration start ########
job_target = 'appid_to_asin'
client_id = 'server_test'
###### configuration finish ########
###### custom function start, need to modify according to real case
def job_upsert_bulk():
conn = sqlite3.connect('./amazon_ec2.db')
c = conn.cursor()
c.execute('SELECT app_id FROM appid_... |
#!/usr/bin/python -Wall
# ================================================================
# Copyright (c) John Kerl 2007
# kerl.john.r@gmail.com
# ================================================================
from __future__ import division # 1/2 = 0.5, not 0.
from sackmat_m import *
# --------------------------... |
"""
[01/09/13] Challenge #117 [Intermediate] Sort r/DailyProgrammer!
https://www.reddit.com/r/dailyprogrammer/comments/169hkl/010913_challenge_117_intermediate_sort/
# [](#IntermediateIcon) *(Intermediate)*: Sort r/DailyProgrammer!
Some users of r/DailyProgrammer want a list of URLs ordered from our very first challe... |
# -*- coding: utf-8 -*-
"""
selected plan utility
"""
from __future__ import print_function
from __future__ import division
from builtins import str
from builtins import range
from past.utils import old_div
import shutil
import logging
import re
import os
import os.path
import sys
import string
import random... |
#!/usr/bin/env python
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("VERSION", "r") as fh:
version = fh.read().strip('\n')
setuptools.setup(
name='dicom-ecg-plot',
version=version,
description='Plot Dicom ECG Waveforms',
long_des... |
"""HTTP views handle login flow.
# GET /auth/providers
Return a list of auth providers. Example:
[
{
"name": "Local",
"id": null,
"type": "local_provider",
}
]
# POST /auth/login_flow
Create a login flow. Will return the first step of the flow.
Pass in parameter 'client_id' and 'r... |
# Author: Sari Sabban
# Email: sari.sabban@gmail.com
# URL: https://github.com/sarisabban
#
# Created By: Sari Sabban
# Created Date: 20 March 2017
import urllib
def ProtVR(x):
lis=list()
filename='HELLO C '
filename=urllib.urlopen('http://files.rcsb.org/view/'+x+'.pdb')
lis.append('<script src="/static/... |
import sys
import subprocess
import json
import re
import pandas as pd
from pandas import ExcelWriter
_id_offset_pattern = re.compile(u'id=(\d+)&offset=(\d+)')
def _decode_list(data):
rv = []
for item in data:
if isinstance(item, unicode):
item = item.encode('utf-8')
elif isinsta... |
import ConfigParser, re
try:
import cStringIO as StringIO
except ImportError:
import StringIO
class CallableConfigParser( ConfigParser.ConfigParser ):
file_cache = {}
FUNC_PATTERN = re.compile(r"\|\( ?([^ ]*) (.*)\)")
def __init__(self, funcs = {}, *args, **kwargs ):
ConfigPars... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
... |
# -*- coding: UTF-8 -*-
# Copyright 2013-2014 by Rumma & Ko Ltd.
# License: BSD, see LICENSE for more details.
"""
Turns a list of items into an endless loop.
Useful when generating demo fixtures.
>>> from lino.utils import Cycler
>>> def myfunc():
... yield "a"
... yield "b"
... yield "c"
>>> c = Cycler... |
import traceback
class LeagueTable(object):
def __init__(self, data):
"""Takes a dict converted from the JSON response by the API and wraps
the league table data within an object.
:param data: The league table data from the API's response.
:type data: dict
"""
self... |
def sample_from_list_and_split(items, n, rng):
"""Sample n examples from items using random generator rng
>>> from numpy.random import RandomState
>>> rng = RandomState(1)
>>> items = ['a', 'b', 'c', 'd', 'e', 'f']
>>> sample_from_list_and_split(items, 2, rng)
(['b', 'c'], ['a', 'd', 'e',... |
'''
/**************************************************************************
ReVal - A Simple and Effective Machine Translation Evaluation Metric Based on Recurrent Neural Networks.
Copyright (C) 2014 Rohit Gupta, University of Wolverhampton
This file is part of ReVal and is a modified version of the code distr... |
#!/usr/bin/env python
import httplib2
import datetime
import time
import os
import selenium
import json
import boto3
import requests
from dateutil.parser import parse
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.keys import Keys
from selenium.webdriver... |
#!/usr/bin/env python3
import numpy as np
import time
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Reshape
from keras.layers import Conv2D, Conv2DTranspose, UpSampling2D
from keras.layers impo... |
import sys, os, os.path, commands, re
usage = "USAGE: python create_example.py box.example"
if len(sys.argv) != 2:
raise "Expected one argument.\n" + usage
example_file = sys.argv[1]
print "Working on '%s'..." % example_file
# Default values for variables which may be changed inside example_file
in_directory = ".... |
# -*- coding: utf-8 -*-
import logging
import os.path
import wx
from wx.lib.scrolledpanel import ScrolledPanel
from outwiker.core.event import Event
logger = logging.getLogger('outwiker.gui.pasepagepanel')
class BasePagePanel(ScrolledPanel):
"""
Базовый класс для панелей представления страниц
"""
... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
# load in image and add Salt and pepper noise
moon = cv2.imread('images/moon.png', 0)
######################################################## ADD SALT & PEPPER NOISE
# salt and peppering manually (randomly assign coords as either white or black)
rows, col... |
#!/usr/bin/env python
import numpy
import scipy
from scipy import io
data_dict = scipy.io.loadmat('../data/hmsvm_data_large_integer.mat', struct_as_record=False)
parameter_list=[[data_dict]]
def structure_discrete_hmsvm_mosek (m_data_dict=data_dict):
from modshogun import RealMatrixFeatures
from modshogun impo... |
# -*- coding: utf-8 -*-
"""
test_account.py
~~~~~~~~~~~~~~~
This test suite checks the methods of the Account class of tmdbsimple.
Created by Celia Oakley on 2013-11-05
:copyright: (c) 2013-2014 by Celia Oakley.
:license: GPLv3, see LICENSE for more details.
"""
import unittest
import tmdbsimple as tmdb
from test... |
#!/usr/bin/env python
#
# Copyright (C) 2013-2020 Intel Corporation
# SPDX-License-Identifier: GPL-2.0-only
#
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 tw=100 et ai si
#
# Author: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
"""
This is a 'py.test' test for the PowerMeter module.
"""
# pylint: disable=redefined... |
#
# Common.py
#
# Author(s):
# Alessio Parma <alessio.parma@gmail.com>
#
# Copyright (c) 2012-2016 Alessio Parma <alessio.parma@gmail.com>
#
# 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... |
__all__ = ('BlockStorageTypeFactory',)
import logging
log = logging.getLogger("pyoram")
def BlockStorageTypeFactory(storage_type_name):
if storage_type_name in BlockStorageTypeFactory._registered_devices:
return BlockStorageTypeFactory.\
_registered_devices[storage_type_name]
else:
... |
# 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... |
from bs4 import BeautifulSoup
import urllib2
import httplib
import threading
class ProxyCrawler(object):
"""@Brief: Crawl proxy host&port from a proxy providing web"""
def run(self):
of = open('./data/proxy.txt' , 'w')
user_agent = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Tri... |
# -*- coding: utf-8 -*-
from challenge.grid import Grid
from challenge.rover import Rover
import unittest
class GridTestSuite(unittest.TestCase):
"""Advanced test cases."""
def test_instantion(self):
""" Test if we can instantiate a grid object """
grid = Grid(5, 5)
self.assertEqual(... |
import os
import shutil
import logging
import json
import settings
from wordpress import WPConfig
from .manager import WPPluginConfigRestore
class WPPluginConfig(WPConfig):
""" Relies on WPConfig to get wp_site and run wp-cli.
Overrides is_installed to check for the theme only
"""
WP_PLUGINS_PA... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
import mock
from nidhogg.core import NidhoggException
from nidhogg.sevenmode import SevenMode
from nidhogg.clustermode import ClusterMode
STD_NETAPP_RESULT_OK = {'netapp': {'results': {"@status": "passed"}}}
STD_NETAPP_RESULT_FAILED = {'n... |
import tensorflow as tf
import numpy as np
import math
def mvMul(m,v):
#Function for matrix vector multiplication of form Mv
#where v is rank 1 tensor and M is rank 2
return tf.squeeze(tf.matmul(m,tf.expand_dims(v,axis=1)))
def vmMul(v,m):
#Function for matrix vector multiplication of form vM
#whe... |
from sympy.core import Basic, S, sympify, Expr, Rational, Symbol
from sympy.core import Add, Mul
from sympy.core.cache import cacheit
from sympy.core.compatibility import cmp_to_key
class Order(Expr):
""" Represents the limiting behavior of some function
The order of a function characterizes the function base... |
""" This is the StorageElement class.
"""
from types import ListType
__RCSID__ = "$Id$"
# # custom duty
import re
import time
import datetime
import copy
import errno
# # from DIRAC
from DIRAC import gLogger, gConfig, siteName
from DIRAC.Core.Utilities import DErrno, DError
from DIRAC.Core.Utilities.ReturnValues impor... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... |
#!/usr/bin/env python2
"""
:copyleft: 2013 by Jens Diemer
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
import array
import functools
import itertools
import logging
import math
import struct
import time
import wave
from PyDC.utils import (
ProcessInfo,
TextLevelMeter,
average,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Open PIM Daemon
(C) 2008 by Soeren Apel <abraxa@dar-clan.de>
(C) 2008 Openmoko, Inc.
(C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
(C) 2009 Sebastian Krzyszkowiak <seba.dos1@gmail.com>
(C) 2009 Tom "TAsn" Hacohen <tom@stosb.com>
GPLv2 or later
Messages Dom... |
import os
import subprocess
import sys
SEVENZIP_EXE = os.path.join('.', '7zip', 'x64', '7za.exe')
BSDIFF_EXE = os.path.join('.', 'bsdiff', 'bsdiff.exe')
BSPATCH_EXE = os.path.join('.', 'bsdiff', 'bspatch.exe')
def bsdiff(oldFile, newFile, patchFile, silent=False):
"""Creates a binary diff between <oldFile> and <... |
import cv2
import numpy as np
img = cv2.imread('image4_with_sample.jpg',0)
img1 = cv2.medianBlur(img,5)
cv2.imwrite('image4_gray_and_blur.jpg',img1)
#circles = cv2.HoughCircles(img1,cv2.HOUGH_GRADIENT,1,20,param1=50,param2=30,minRadius=0,maxRadius=0)
circles = cv2.HoughCircles(img1, cv2.HOUGH_GRADIENT, 1.2, 100)
... |
import math
import time
t1 = time.time()
# read the trianlges into a list
f = open('pb102_triangles.txt','r')
tris= f.read().split('\n')
f.close()
def totri(tl):
triangle = []
temp = tl.split(',')
for i in range(0,3):
triangle.append([tonumber(temp[2*i]),tonumber(temp[2*i+1])])
return trian... |
"""
Project Euler Problem 70: https://projecteuler.net/problem=70
Euler's Totient function, φ(n) [sometimes called the phi function], is used to
determine the number of positive numbers less than or equal to n which are
relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than
nine and relatively ... |
from itertools import *
from math import pow
def fibonacci():
a, b = 0, 1
for i in range (10):
yield a
a, b = b, a + b
squares = [i * i for i in range (10)]
chars = 'thequickbrownfoxjumpsoverthelazydog'
def run (autoTester):
autoTester.check ('islice count', list (i... |
# Copyright (c) 2014, Duncan Booth
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and t... |
# This file is part of Merlin/Arthur.
# Merlin/Arthur is the Copyright (C)2009,2010 of Elliot Rosemarine.
# Individual portions may be copyright by individual contributors, and
# are included in this collective work with permission of the copyright
# owners.
# This program is free software; you can redistribute it an... |
#!/usr/bin/env python3
from networkx.readwrite import json_graph
from collections import OrderedDict
import hashlib
import operator
import shlex
from functools import reduce
from http.client import RemoteDisconnected
from lxml import etree
from mako import exceptions
from mako.template import Template
from munch impo... |
"""Functions related to geographic coordinates and paleo conversions."""
def get_geog(coords, age, options):
"""Parse paleo geography parameters."""
from ..elc import ages
modern = [x.strip() for x in coords.split(',')]
if '' in modern or len(modern) != 2:
msg = 'Second parameter not found in... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2016 CERN.
#
# INSPIRE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
"""
Transparent, fancy legends
==========================
Sometimes you know what your data looks like before you plot it, and
may know for instance that there won't be much data in the upper right
hand corner. Then you can safely create a legend that doesn't overlay
your data:
ax.legend(loc='upper right')
Other ... |
# Xiaokai Wang
# xiw69@pitt.edu
# CS 0008
# assignmnet #1
# ask the user to input preferred unit system/ distance driven/ gas usage
choice = input("Please enter your preferred unit system (USC/Metric): ")
dist = float(input("Please input your distance driven: "))
gas = float(input("Please input your gas usage during... |
import sublime
import sublime_plugin
MARKDOWN_LINK_SNIPPET = "[${{1:{}}}](${{2:{}}})"
class InsertMarkdownLinkCommand(sublime_plugin.TextCommand):
def decode_page(self, page_bytes, potential_encoding=None):
if potential_encoding:
try:
text = page_bytes.decode(pot... |
import sys
import subprocess
import re
files_re = re.compile(r"diff --git a/(.+?) b/.+?")
additions_re = re.compile(r"{\+(.*?)\+}")
deletions_re = re.compile(r"\[-(.*?)-\]")
word_re = re.compile(r"\S*")
def count(regex, source):
words = 0
characters = 0
for match in regex.findall(source):
for wor... |
################################################################################
# index.py
################################################################################
import html_help
import os
import sys
import time
import Zcgi
KEYS = 'description', 'start', 'end', 'sunday', 'monday', \
'tuesday', 'wedn... |
"""
This module contains code for creating the underlying database structures
and also general code to perform basic actions: add, remove, update, list
"""
import os
import goat
from settings import settings_config
from databases import database_records,database_util,database_dirfiles
from util.inputs import prompts
... |
# TeamCity Delcom USB Led Daemon
# Copyright (C) 2014 Torsten Braun
#
# 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.
#... |
#!/usr/bin/env/python
# coding=utf-8
"""
test_vivopump.py -- Test cases for vivopump
"""
import sys
sys.path.insert(0, "/var/fis_data/vivo-pump")
import unittest
from pump.vivopump import new_uri, read_csv, write_csv, vivo_query, write_update_def, \
read_csv_fp, write_csv_fp, get_vivo_ufid, get_vivo_authors,... |
import argparse
import boto.ec2
from boto.utils import get_instance_metadata, get_instance_identity
from boto.exception import AWSConnectionError
import hipchat
import os
import subprocess
import traceback
import socket
import time
# Services that should be checked for migrations.
MIGRATION_COMMANDS = {
'lms':... |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... |
import sys
from collections import OrderedDict
from typing import Any, Tuple
from django.conf import settings
from django.db import models
from django.utils import timezone
from . import fakes
from .compat import HAS_GEOS, HAS_PSYCOPG2
STRING_FIELDS = (
models.CharField,
models.TextField,
) # type: Tuple[A... |
#!/usr/bin/env python3
"""
Animated Towers of Hanoi using Tk with optional bitmap file in background.
Usage: hanoi.py [n [bitmapfile]]
n is the number of pieces to animate; default is 4, maximum 15.
The bitmap file can be any X11 bitmap file (look in /usr/include/X11/bitmaps for
samples); it is displayed ... |
#!/usr/bin/env python
from utils import *
def test_cheat_destroy_deck():
game = prepare_game()
game.player1.discard_hand()
game.player2.discard_hand()
game.player1.give(DESTROY_DECK).play(target=game.player2.hero)
assert not game.player2.deck
game.end_turn()
assert not game.player2.hand
assert game.player2.h... |
import string
import re
def isbn(isbn, strict=True):
'''Validation of an ISBN (international Standard Book Number)'''
if not strict:
isbn = isbn.upper()
if isbn[0:4] == 'ISBN':
isbn = isbn[4:]
isbn = isbn.strip().replace("-", "").replace("/", "")
if len(isbn) == 10:
... |
# Copyright 2001-2013 Python Software Foundation; All Rights Reserved
"""Function signature objects for callables
Back port of Python 3.3's function signature tools from the inspect module,
modified to be compatible with Python 2.6, 2.7 and 3.2+.
"""
from __future__ import absolute_import, division, print_function
im... |
# 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 may ... |
from ..greengraph import Greengraph
from ..map import Map
import geopy
from nose.tools import assert_equal, assert_almost_equal
import numpy.testing as np_test
from mock import Mock, patch
import requests
from matplotlib import image
import yaml
import os
import numpy as np
#@patch.object(Greengraph, 'location_sequen... |
from django.core.urlresolvers import reverse
__author__ = 'mickeypash'
from django.test import TestCase
class LandingViewTests(TestCase):
def test_home_view_status_code(self):
"""
Testing the response status codes
Status expected - 200 OK
"""
response = self.client.get(re... |
import os
from django.utils import importlib
class Migrations(list):
def __init__(self, app_name):
self._app_name = app_name
migrations_dir = self._ensure_migrations_dir(app_name)
self._load_migrations(migrations_dir)
def migrations_module(self):
return self._app_name + '.a... |
from Reconnoitre.lib.file_helper import check_directory
from Reconnoitre.lib.file_helper import load_targets
from Reconnoitre.lib.subprocess_helper import run_scan
def find_dns(target_hosts, output_directory, quiet):
check_directory(output_directory)
dns_server_list = []
results = 0
hostcount = 0
... |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from ctypes import c_uint64, c_char_p
import sys
from .utils import CxxPointer, _call_with_growing_buffer
from .frame import Frame, Topology
from .misc import ChemfilesError
# Python 2 compatibility
if sys.hexversion >= 0x... |
import unittest
from LinkedList.CH3_S6_Single_Linked_Lists import LinkedList
from LinkedList.CH3_S6_Single_Linked_Lists import Node
from LinkedList.CH3_S6_Single_Linked_Lists import ElementNotFoundException
class TestSingleLinkedList(unittest.TestCase):
def test_node(self):
node_a = Node()
node_a... |
# -*-coding:Utf-8 -*
# Copyright (c) 2011 DAVY Guillaume
# 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
# li... |
# Copyright 2012, Intel, 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 agree... |
#!/usr/bin/env python3
"""
Efficient implementation of a Bezier surface and its differential geometry.
"""
from __future__ import division
import numpy as np
################################################## CORE
class Bezier(object):
"""
Bezier manifold of dimension 2 embedded in Euclidean space of dimensi... |
#!/usr/bin/env python2
# -*- coding: utf8 -*-
# Andreas Müller, 2008
# andrmuel@ee.ethz.ch
#
# this code may be freely used under GNU GPL conditions
"""
demodulate DAB signal and ouput to constellation sink
"""
from gnuradio import gr, uhd, blocks
from gnuradio import eng_notation
from gnuradio.eng_option import eng... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import scrapy
from stackoverflow.spiders.items import StackoverflowItem
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('monitor')
logger.setLevel(logging.INFO)
fh = logging.FileHandle... |
# -*- coding: utf-8 -*-
from basemodel import *
import md5
import math
import sys
class PDuser(BaseModel):
'''model autocreate by createModel'''
table_name = 'pd_user'
#db_name = 'todo_local'
db_name = web.config.write_db_name
def _format_user(self, row):
if hasattr(row, 'u_logo'):
if not row.u_logo:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.