src stringlengths 721 1.04M |
|---|
import numpy as np
# Make sure that caffe is on the python path:
caffe_root = '../caffe-master/' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
def findAccuracy(result_file, model, test_listfile, prototxt):
caffe.set_device(0)
... |
from pycp2k.inputsection import InputSection
class _each370(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... |
# stokes-netcdf to pov converter
# Copyright (C) 2006-2008 Kengo Ichiki <kichiki@users.sourceforge.net>
# $Id: stnc2pov.py,v 1.9 2008/06/03 02:57:43 kichiki Exp $
#
# 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 So... |
# -*- coding: utf-8 -*-
from .. import stream
from ..jid import Jid
from ..stanzas import Iq, ElementWrapper
from ..errors import XmppError
from ..utils import xpathFilter
"""XEP 30"""
from .. import getLogger
log = getLogger(__name__)
NS_URI_BASE = "http://jabber.org/protocol/disco"
NS_URI_INFO = "{}#info".format(N... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... |
# paperScrape.py v0.00 damiancclarke yyyy-mm-dd:2015-05-29
#---|----1----|----2----|----3----|----4----|----5----|----6----|----7----|----8
#
# Scrapes econpapers for all titles, abstracts, etc from all JPE issues. Based
# on the url http://econpapers.repec.org/article/ucpjpolec/, and screen dump... |
#! /usr/bin/env python
# -*- coding: Latin-1 -*-
# Ajouter des informations dans le fichier du club
def traduire(ch):
"convertir une ligne du fichier source en liste de données"
dn = "" # chaîne temporaire pour extraire les données
tt = [] # la liste à produire
i = 0
... |
"""
@summary: Module containing functions for API Queries
@status: beta
@license: gpl2
@copyright: Copyright (C) 2014, University of Kansas Center for Research
Lifemapper Project, lifemapper [at] ku [dot] edu,
Biodiversity Institute,
1345 Jayhawk Boulevard, Lawrence, Kansas, 66045, USA
... |
import requests
class HttpClass(object):
"""
Generate an HTTP Request. Accepts request parameters as params_dict during init.
Accepted Parameters:
HTTP URL as url - String
HTTP Method as method - String
HTTP Headers as headers - Dictionary
HTTP Basic Auth as auth - Tuple
Query String/P... |
# utils/update_checkout.py - Utility to update local checkouts --*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... |
import collections
import glob
import json
import subprocess
import tempfile
import os.path as op
import yaml
from depsolver.bundled.traitlets \
import \
HasTraits, Dict, Instance, List, Long, Unicode
from depsolver.constraints \
import \
Any, GEQ, LT
from depsolver.package \
import \
... |
"""
Stats views
"""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils import simplejson
from django.utils.trans... |
from __future__ import print_function, absolute_import, division
import itertools
import llvmlite.llvmpy.core as lc
from .cudadrv import nvvm
from numba import cgutils
def declare_atomic_cas_int32(lmod):
fname = '___numba_cas_hack'
fnty = lc.Type.function(lc.Type.int(32),
(lc.Type.pointer(lc.Type.i... |
# pyui2
# Copyright (C) 2001-2002 Sean C. Riley
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but ... |
import logging
class Singleton(object):
_instances = {}
def __new__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__new__(cls, *args, **kwargs)
return cls._instances[cls]
class Logger(Singleton):
def __init__(self):
... |
#!/usr/bin/env python
"""
Gitlab bridge for PenText: imports and updates gitlab issues into PenText
(XML) format
Copyright (C) 2016 Peter Mosmans [Radically Open Security]
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... |
## database
import psycopg2
## system libraries
import io, os
import datetime, time
import logging
## web libraries
import tornado
import tornado.auth
import tornado.escape
import tornado.gen
import tornado.httpserver
import urlparse
import threading
import functools
from tornado.ioloop import IOLoop
from tornado.web... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 18 13:07:18 2016
@author: Administrator
"""
from urllib import request
import json,re,time
time1=''
update=''
with request.urlopen('http://api.money.126.net/data/feed/1160220,money.api') as f:
data = f.read()
myjson = re.search(r'\(.*\)',data.decode('ut... |
import re, requests, sys
from .gui import *
class Checker:
def __init__(self, timeout = 10, exportFileName = None):
self.timeout = timeout
self.exportFileName = exportFileName
self.filter = []
def showStatus(self):
if self.timeout != None:
showInfo("Proxy timeout: " + str(self.timeout) + "s")
if self.e... |
#! python
# -*- coding: utf-8 -*-
from glob import glob
import re
class DeclarationInserter(object):
start = "/* PROTOTYPE_START */"
end = "/* PROTOTYPE_END */"
files = {
"include/yog/dir.h": [ "src/dir.c", ],
"include/yog/path.h": [ "src/path.c", ],
"include/yog/proce... |
"""
Parser for voc 2005 images
reads ImageSet directory and gets classes of images
than writes it to arff file
"""
import re, os
reg_rect = "\"(?P<name>.*)\" \(.*\) : \((?P<xmin>[0-9]*), (?P<ymin>[0-9]*)\) - \((?P<xmax>[0-9]*), (?P<ymax>[0-9]*)\)"
reg_filename = "filename : \"(?P<filename>.*)\""
res = {}
FILES = list... |
__author__ = 'adeksandrcernov'
from model.contact import Contact
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts,args = getopt.getopt(sys.argv[1:], "n:f:", ["number od groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f ... |
import os
import sys
import random
import matplotlib.image as mpimg
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from tqdm import tqdm, tnrange
from itertools import chain
from skimage.io import imread, imshow, concatenate_images
from skim... |
# 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: tkColorChooser.py
from tkCommonDialog import Dialog
class Chooser(Dialog):
"""Ask for a color"""
command = 'tk_chooseColor'
def _fixopt... |
class Graph:
def __init__(self, config):
self.config = config
self.vertices = list(config["jobs"].keys())
self.edges = []
self.outdegree = {}
for key, value in config["dependencies"].items():
for val in value:
self.edges.append( (key, val) )
... |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='scRNApipe',
version='0.1.0',
description='Package for analysing scRNA-seq in Transcript Tag Counting data.',
long_description=read('README.md'),
author='Stavr... |
import os
SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
DEBUG = True
THUMBNAIL_DEBUG = DEBUG # sorl.thumbnail verbose debug
ALLOWED_HOSTS = ['*']
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be a... |
#!/usr/bin/env python3
import os
import requests
import time
from collections import namedtuple
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
class TimeoutRequestsSession(requests.Session):
def __init__(self, *args, **kwargs):
self.__default_timeout = None
if 'tim... |
""" Backend that defers to another server for access control """
from .base import IAccessBackend
class RemoteAccessBackend(IAccessBackend):
"""
This backend allows you to defer all user auth and permissions to a remote
server. It requires the ``requests`` package.
"""
def __init__(self, reques... |
#Written by Jake Schultz
#TODO Add more lang support, limit number of results returned
import re
from urllib2 import Request, urlopen, URLError
import json
WORDS = ["DEFINE","WHAT DOES %S MEAN","DEFINITION", "WHAT IS [A|AN]? %S"]
PRIORITY = 1
def handle(text, mic, profile, recursive=False):
text = re.sub(r"(?i)... |
"""
Unit tests for Ontology
"""
import minus80 as m80
import locuspocus as lp
def test_init(testOnt):
try:
testOnt
return True
except NameError:
return False
def test_len(testOnt):
assert len(testOnt) == 10
def test_iter(testOnt):
for term in testOnt:
assert is... |
#! /usr/bin/env python
from openturns import *
from math import *
TESTPREAMBLE()
def printNumericalPoint(point, digits) :
oss = "["
eps = pow(0.1, digits)
for i in range(point.getDimension()) :
if i == 0 :
sep = ""
else :
sep = ","
if fabs(point[i]) < eps ... |
#!/usr/bin/env python3
import os, sys, zlib, binascii
import codecs
from Crypto.Cipher import AES
otpbin = os.path.abspath("otp.bin")
if not os.path.exists(otpbin):
print("Put the otp.bin into this directory, please!")
sys.exit(1)
keytxt = open('Keys.txt', 'a')
#Thank you Audiosurf for the initial directory cr... |
import os
import scipy.misc
import pandas as pd
from argparse import ArgumentParser
import time
from neural_style_loss import styleloss, imread
# default arguments
OUTPUT = 'output.csv'
LAYER_WEIGHT_EXP = 1
VGG_PATH = 'imagenet-vgg-verydeep-19.mat'
POOLING = 'max'
NORMALIZE = 1
VERBOSE = 1
TIMEIT = 1
def build_parse... |
#!/usr/bin/env python
# Python 3
import shlex
import subprocess
import re
import sys
import time
# read command line arguments
if len(sys.argv) < 3:
print('Usage: <program> <outputfile> <value name>')
sys.exit(1)
# Variables
PRG_NAME = sys.argv[1]
DATA_NAME = sys.argv[2]
VAL_NAME = sys.argv[3]
RUNS... |
from distutils.core import setup
setup(
name='C3Linearize',
version='0.1.0',
description='Python implementation of the C3 linearization algorithm.',
url='http://github.com/mikeboers/C3Linearize',
py_modules=['c3linearize'],
author='Mike Boers',
author_email='c3linearize@mikeboers.com'... |
#!/usr/bin/python
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
size = len(nums1) + len(nums2)
if size % 2 == 0:
return (self.getk(nums1[:], nums2[:], size/2)+
self.getk(nums1[:], nums2[:], size/2-1))/2.0
else:
return sel... |
# Copyright 2004-2015 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... |
# -*- coding: utf-8 -*-
"""
HipparchiaBuilder: compile a database of Greek and Latin texts
Copyright: E Gunderson 2016-21
License: GNU GENERAL PUBLIC LICENSE 3
(see LICENSE in the top level directory of the distribution)
"""
from string import punctuation
from typing import List
import configparser
import re
fro... |
'''=========================================================================
'
' Copyright Insight Software Consortium
'
' 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
'
' ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicab... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# couch_set_repl.py
#
# Copyright 2013 Oleh Horbachov <gorbyo@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either versio... |
# Bezier - last updated for NodeBox 1.8.3
# Author: Tom De Smedt <tomdesmedt@trapdoor.be>
# Manual: http://nodebox.net/code/index.php/Bezier
# Copyright (c) 2007 by Tom De Smedt.
# Refer to the "Use" section on http://nodebox.net/code
# Thanks to Dr. Florimond De Smedt at the Free University of Brussels for the math ro... |
# -*- coding: utf-8 -*-
from datetime import datetime
import urllib2
import re
import urllib, hashlib
import string
from itertools import imap
def none2string(value):
if value is None:
return ''
return value
def video(value):
if value is None:
return None
videos = re.findall('(htt... |
#!/usr/bin/env python
#coding=utf8
'''
Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array. Return the minimum number of patches required.
Example 1:
nums = [1, 3], n = 6
Retu... |
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import maya.cmds as cmds
kPluginNodeName = "MitsubaRoughConductorShader"
kPluginNodeClassify = "/shader/surface"
kPluginNodeId = OpenMaya.MTypeId(0x87008)
class roughconductor(OpenMayaMPx.MPxNode):
def __init__(self):
OpenM... |
# -*- coding: utf8 -*-
#
# Copyright (C) 2020 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licen... |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2013 IBM Corp
# 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... |
import unittest
from typing import List
import utils
# O(mn^2) time. O(mn) space. Prefix sum.
class Solution:
def numSubmatrixSumTarget(self, matrix: List[List[int]], target: int) -> int:
result = 0
m = len(matrix)
n = len(matrix[0])
sums = [[0] * m for _ in range(n + 1)]
... |
# -*- coding: utf-8 -*-
import io
import time
import serial
import select
class Dmr5200(object):
"""
Representation of a connection to a DMR-5200 digital multimeter.
"""
def __init__(self, port, timeout=2):
"""
Opens the serial connection to the meter.
port - The platfor... |
######################################################################
# Copyright 2016, 2017 John Rofrano. 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
#
# https://ww... |
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
class ComponentAuthenticationTest(APITestCase):
fixtures = ['users.json', 'component_data.json']
def test_noauthed_rejects(self):
url = reverse('component-detail', kwargs={
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-21 15:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('repositories', '0002_auto_20160911_1601'),
]
operations = [
migrations.AddFie... |
from django.db import models
from django.contrib import admin
from armada.capsuler.models import UserPilot, \
UserCorporation, \
UserAPIKey, \
Capsuler
class LogisticsTeam(models.Model):
name = models.CharField(max_length=200)
corporation = models.ForeignKey(UserCorporation)
creato... |
from __future__ import print_function
from pySecDec.integral_interface import IntegralLibrary
import sympy as sp
import unittest
class CheckLib(unittest.TestCase):
def setUp(self):
# load c++ library
self.lib = IntegralLibrary('../box1L_rank4/box1L_rank4_pylink.so')
self.real_parameters = [... |
#!/usr/bin/env python
from __future__ import with_statement
import webify
from webify.templates.helpers import html
# Layout template
@webify.template()
def page_layout(p, title, inside):
with p(html.html()):
with p(html.head()):
p(html.title(title))
with p(html.body()):
p.s... |
"""Common settings and globals."""
from django.utils.translation import ugettext_lazy as _
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
#BASE DIR
#BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# Absolute filesystem path to the Django projec... |
# pyeq2 is a collection of equations expressed as Python classes
#
# Copyright (C) 2012 James R. Phillips
# 2548 Vera Cruz Drive
# Birmingham, AL 35235 USA
#
# email: zunzun@zunzun.com
# web: http://zunzun.com
#
# License: BSD-style (see LICENSE.txt in main source directory)
# Version info: $Id:... |
#!/usr/bin/python/
# coding: utf-8
import time
import datetime
from luma.core.interface.serial import i2c, spi
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106
def do_nothing(obj):
pass
# rev.1 users set port=0
# substitute spi(device=0, port=0) below if using t... |
"""
Backported from `importlib <http://pypi.python.org/pypi/importlib>` library,
which itself backported from Python 3.x branch.
"""
# While not critical (and in no way guaranteed!), it would be nice to keep this
# code compatible with Python 2.3.
import sys
def _resolve_name(name, package, level):
"""Return the a... |
from discord.ext import commands
import discord
import datetime, re
import asyncio
import copy
import logging
import traceback
import sys
from collections import Counter
import config
description = """
I'm Fox, a multi-purpose and modular Discord bot.
"""
init_cogs = [
'plugins.admin.eval',
'plugins.admin.sh... |
"""
The File Upload application is designed to allow the management of files
associated with submissions. This can be used to upload new files, manage
URLs of existing files, and delete files.
"""
from collections import namedtuple
import json
import logging
from django.db import IntegrityError
from django.utils.func... |
#!/usr/bin/env python
import sys
import subprocess
import numpy as np
import astropy.io.fits as fits
def sweep_meta(release, outfits):
if (release == 'dr3'):
sweepdir = '/global/project/projectdirs/cosmo/data/legacysurvey/dr3/sweep/3.1'
if (release == 'dr4'):
sweepdir = '/global/p... |
"""Low-level database operations."""
__all__ = [
# Key-value operations.
'count',
'delete',
'get',
'get_revision',
'increment_revision',
'scan',
'scan_keys',
'set_',
# Leases.
'lease_count',
'lease_expire',
'lease_get',
'lease_scan',
'lease_scan_expirations',... |
#!/usr/bin/env python
'''@package routing
Routing engine base class.
@author Brandon Heller (brandonh@stanford.edu)
'''
from copy import copy
from random import choice
from collections import deque
import logging
lg = logging.getLogger('ripl.routing')
DEBUG = False
lg.setLevel(logging.WARNING)
if DEBUG:
lg.set... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#É adimensional?
adi = False
#É para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual é o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual é o diretório que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual é o nome do arquivo... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-21 21:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('account', '0001_initial'),
]
o... |
#!/usr/bin/python
#### Import modules
from selenium import selenium
from selenium import webdriver
import sys, time, re, string, getopt
#### Constants
default_crew = 'elotrolado'
login_url = 'https://socialclub.rockstargames.com/profile/signin'
base_crew_url = 'http://socialclub.rockstargames.com/crew'
path_gtav_bas... |
#!/usr/bin/python
# vim: set fileencoding=utf-8
import json
import datetime
import itertools
statuses = []
f = open('statuses-2014.json')
for line in f.readlines():
statuses.append(json.loads(line.strip()))
f.close()
class DataByAgency(object):
def __init__(self):
self.sncf = 0
self.ratp = 0
... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import markdown
import os
import sys
def convert_markdown(in_fn):
input_md = open(in_fn, mode="r", encoding="utf-8").read()
html = markdown.markdown(
"[TOC]\n" + input_md,
extensions = [
'pymdownx.extra',
... |
from __future__ import unicode_literals
from click.testing import CliRunner
import os.path
from pytest import raises
from textx import metamodel_from_str
from textx.cli import textx
from textx.exceptions import TextXError
from textx.generators import gen_file, get_output_filename
from textx import language, generator... |
from sqlobject import *
from sqlobject.tests.dbtest import *
########################################
## Indexes
########################################
class SOIndex1(SQLObject):
name = StringCol(length=100)
number = IntCol()
nameIndex = DatabaseIndex('name', unique=True)
nameIndex2 = DatabaseIndex... |
import sys
try:
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="cbh_dat... |
# -*- coding: utf-8 -*-
# Created: 2018-01-04T19:46:58 PST
recipes = {
9420: {'min': 0, 'max': 40, 'recipe': {19679: 10}},
9421: {'min': 75, 'max': 115, 'recipe': {13010: 1, 19683: 10}},
9422: {'min': 150, 'max': 190, 'recipe': {13006: 1, 19688: 10}},
9423: {'min': 225, 'max': 265, 'recipe': {13007: 1, 19681: 10}},... |
# LOFAR IMAGING PIPELINE
#
# make_flaggable node
# John Swinbank, 2010
# swinbank@transientsk... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free soft... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# thrum documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... |
#!/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 descendant package tracking code."""
from test_framework.test_framework import SarielsazTestFra... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import networkx as nx
import numpy as np
import random
import Lib_gen_Graph as lig
import Lib_cal_control as lcc
import classify_by_add_node as can
import classify_by_renorm.classify_by_renorm_undirected as cru
#import StructuralRenorm.package.Lib_struct_renorm as lsr
... |
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2011, 2012 Open Networking Foundation
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
# See the file LICENSE.pyloxi which should have been included in the source distribution
# Automatically generated by LOXI from ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<https://micronaet.com>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebr... |
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" A collator for Mojo Application Manifests """
import argparse
import json
import shutil
import sys
import urlparse
def ParseJSONF... |
"""
@file test_light_vcnl4000.py
"""
##
# @addtogroup soletta sensor
# @brief This is sensor test based on soletta app
# @brief test sensor vcnl4000 on Galileo/MinnowMax/Edison
##
import os
import time
from oeqa.utils.helper import shell_cmd
from oeqa.oetest import oeRuntimeTest
from EnvirSetup import EnvirSetup
from ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 28 16:53:42 2014
Copyright (C) 2014-2015 Anna Matuszyńska, Oliver Ebenhöh
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 Foundatio... |
import pymongo
import urllib2
import urllib
import cookielib
import random
import re
import string
import sys
import getopt
# init the global cookie jar
cj = cookielib.CookieJar()
# declare the variables to connect to db
connection = None
db = None
webhost = "localhost:8082"
mongostr = "mongodb://local... |
from werkzeug import security
from flask import json
import os, base64, ssl
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = security.gen_salt(32)
DEBUG = False
TESTING = False
URLLIB_REQUEST_DEBUG_LEVEL = 0
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_TRACK... |
#!/usr/bin/env python
import os, yaml, urllib2, logging, termcolor
from sh import crane
from util import randomcolor
log = logging.getLogger()
class CraneConfig(object):
def __init__(self, cranefile):
"""
CraneConfig object
"""
self.txtcolor = randomcolor()
self.cranefile... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test BVLL Encoding and Decoding
-------------------------------
"""
import string
import unittest
from bacpypes.debugging import bacpypes_debugging, ModuleLogger, btox, xtob
from bacpypes.comm import bind
from bacpypes.pdu import PDU, Address, LocalBroadcast
from b... |
import copy
import numpy as np
import tensorflow as tf
from nlp.chatbot.dataset import data_utils
class S2SModel(object):
def __init__(self,
source_vocab_size,
target_vocab_size,
buckets,
size,
dropout,
num_layers,
... |
import unittest
import numpy as np
from numpy import pi
from robot_arm import RobotArm
class TestRobotArm(unittest.TestCase):
def setUp(self):
self.lengths = (3, 2, 2,)
self.destinations = (
(5, 4, 6, 4, 5),
(0, 2, 0.5, -2, -1),
)
self.theta = (pi, pi / 2, ... |
import sys
import Adafruit_DHT
import datetime
import sqlite3
import os
import glob
import ConfigParser
import logging
# import time
# Global variable
global errorState
errorState = None
# Specify AM203 sensor on Raspberry Pi GPIO pin #4 (physical pin 7)
# Detecting Pi version / beaglebone is handled by Adafruit DH... |
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
from hpp.gepetto import Viewer
from hpp.corbaserver import Client
from hpp.corbaserver.robot import Robot as Parent
from hpp.corbaserver.rbprm.problem_solver import ProblemSolver
class Robot (Parent):
rootJointType = 'freeflyer'
packageName = 'hpp-rbprm-corba'
... |
# 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... |
import collections
def solve(case, P, Q, people):
ver, hor = {}, {}
s, n, e, w = 0, 0, 0, 0
for p in people:
x, y, d = p
if d == 'S':
if y in ver: ver[y] = (ver[y][0]+1, ver[y][1])
else: ver[y] = (1, 0)
s += 1
elif d == 'N':
if y in v... |
from PIL import Image
def parse_rgb5a3(data, width):
if ((len(data))/2) % width != 0:
raise ValueError("Invalid number of tiles for width {}".format(width))
height = (len(data))//(width * 2)
img = Image.new("RGBA", size=(width, height))
imgdata = reorder_tiles(data, (4, 4), width, 16)
pixma... |
#!/usr/bin/env python
from distutils.core import setup
for cmd in ('egg_info', 'develop'):
import sys
if cmd in sys.argv:
from setuptools import setup
version='1.7.4'
setup(
name='django-webtest',
version=version,
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
packag... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
import datetime
import logging
import csv
import six
from datetime import date
from django.apps import apps
from django.utils import timezone
logger = logging.getLogger(__name__)
ats_settings = apps.get_app_config('ats')
def get_user_rea... |
# -*- coding: utf-8 -*-
# Part of hexy. See LICENSE file for full copyright and licensing details.
import click
from ..cli import pass_hexy
from .. import Hexy
@click.command('point',
short_help='Put a single point on a grid and show grid in hexy tool')
@click.option('--xsize',
'-x',
... |
# -*- coding: utf-8 -*-
import tornado.web
import tornado.ioloop
from tornado.testing import AsyncHTTPTestCase
from tortik.page import RequestHandler
import tornado.curl_httpclient
def first_postprocessor(handler, data, callback):
callback(handler, data.replace('Hello,', 'Good'))
def second_postprocessor(handle... |
""" XVM (c) https://modxvm.com 2013-2020 """
import config
from logger import *
# PUBLIC
def getClanInfo(clanAbbrev):
global _clansInfo
if _clansInfo is None:
return None
rankWGM = None
rankWSH = None
topWGM = _clansInfo.getTopWGMClanInfo(clanAbbrev)
if topWGM is not None:
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.