src stringlengths 721 1.04M |
|---|
def is_whitespace(c):
if c == " " or c == "\t" or c == "\n":
return True
return False
def compress_whitespace(s):
"""
Remove extraneous whitespace from the string, that being all whitespace at the beginning
and end of the string and anything beyond a single space within the string.
"""... |
# Copyright (C) 2010-2013 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2009 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# 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
#
# ... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#########
#Copyright (C) 2014 Mark Spurgeon <theduck.dev@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 version 3 of the Li... |
import logging
import random
from datetime import datetime
import bson
import modularodm.exceptions
import pytz
from django.contrib.contenttypes.fields import (GenericForeignKey,
GenericRelation)
from django.contrib.contenttypes.models import ContentType
from django.con... |
'''
apkg
~~~~
A package manager for Agda.
'''
# ----------------------------------------------------------------------------
import click
import logging
import click_log as clog
from operator import attrgetter, itemgetter
from pony.orm import db_session, select
from natsort ... |
# Copyright 2012 NEC Corporation
#
# 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 ag... |
#!/usr/bin/python
import sys, getopt
import subprocess
import random
import os, shutil
usageString='loadOut.py -r <target root directory> -n <hostname>'
def placefile( filename, targetdir ):
command='cp '+filename+' '+targetdir
subprocess.call(command, shell=True)
hostcolors=['red','blue','green','yellow','... |
#!/usr/bin/env python
#
# Seccomp Library test program
#
# Copyright (c) 2013 Red Hat <pmoore@redhat.com>
# Author: Paul Moore <pmoore@redhat.com>
#
#
# 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 t... |
#!/usr/bin/env python
# Test domain vcpu pin with flag VIR_DOMAIN_AFFECT_CONFIG, check
# domain config xml with vcpupin configuration.
import re
from xml.dom import minidom
import libvirt
from libvirt import libvirtError
from src import sharedmod
from utils import utils
required_params = ('guestname', 'vcpu', 'cpul... |
# -*- coding: utf-8 -*-
"""
SnapSearch.detector
~~~~~~~~~~~~~~~~~~~
:copyright: 2014 by `SnapSearch <https://snapsearch.io/>`_
:license: MIT, see LICENSE for more details.
:author: `LIU Yu <liuyu@opencps.net>`_
:date: 2014/03/08
"""
# future import should come first
from __future__ import wi... |
# Glumol - An adventure game creator
# Copyright (C) 1998-2008 Sylvain Baubeau & Alexis Contour
# This file is part of Glumol.
# Glumol 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 th... |
"""
# Copyright (C) 2013-2016 Stray <stray411@hotmail.com>
#
# 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 2.1 of the License, or (at your option) any later version.
#
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
########################################
##
# @author: Amyth
# @email: mail@amythsingh.com
# @website: www.techstricks.com
# @created_date: 01-03-2017
# @last_modify: Wed May 3 15:58:37 2017
##
########################################
import datet... |
## begin license ##
#
# "Seecr Test" provides test tools.
#
# Copyright (C) 2005-2009 Seek You Too (CQ2) http://www.cq2.nl
# Copyright (C) 2012, 2019-2021 Seecr (Seek You Too B.V.) https://seecr.nl
#
# This file is part of "Seecr Test"
#
# "Seecr Test" is free software; you can redistribute it and/or modify
# it under ... |
import Image
import time
import fkabcd
import pyfits
from numpy import *
from pylab import *
from matplotlib.widgets import Slider, Button, RadioButtons
dz = 0.50/10
champ_in = Image.open("anneaux_large_ellipse2.gif")
intensiteArchive = zeros([512,512,512])
champ_in_fld = zeros([1024,1024], complex)
tampon = list(ch... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# === This file is part of RateItSeven ===
#
# Copyright 2015, Rémi Benoit <r3m1.benoit@gmail.com>
# Copyright 2015, Paolo de Vathaire <paolo.devathaire@gmail.com>
#
# RateItSeven is free software: you can redistribute it and/or modify
# it under the terms of the... |
import unittest
import numpy as np
import numpy.testing as npt
import scipy.stats as estad
from tikon.ecs.aprioris import APrioriDens, APrioriDist
from tikon.ecs.dists import DistAnalítica
class PruebaAprioris(unittest.TestCase):
@staticmethod
def test_apriori_dens():
apr = APrioriDens((0, 1), 0.9)
... |
from rest_framework.test import APIRequestFactory
from django.contrib.auth.models import User
from rest_framework.test import APITestCase, APIClient, force_authenticate
from unittest import skip
from django.urls import reverse
from rest_framework import status
from models.Author import Author
import json
class UserVie... |
from xbmcswift2 import Plugin, xbmcgui
from resources.lib import thisweekscraper
PLUGIN_URL = 'plugin://plugin.video.youtube/?action=play_video&videoid'
SITE_URL = 'https://www.youtube.com/user/ThisWeekIn'
plugin = Plugin()
@plugin.route('/')
def main_menu():
items = [
{
'label': plugin.get... |
# -*- coding: utf-8 -*-
# transformations.py
# Copyright (c) 2006-2015, Christoph Gohlke
# Copyright (c) 2006-2015, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... |
import os
import logging
import time
import datetime
from concurrent_tree_crawler.common.file_helper import lenient_makedir
from concurrent_tree_crawler.common.logger import Logger
from concurrent_tree_crawler.common.activity_schedule import AlwaysActiveSchedule
from concurrent_tree_crawler.crawlers_manager import Cra... |
#
# 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 us... |
from .macro import *
from . import utils
import bpy, os, shutil, platform
from bpy.props import *
import time
class ExportGameProject(bpy.types.Operator):
bl_idname = "wm.export_game_project"
bl_label = "Export Game Project"
platform = EnumProperty(
name="Platform",
items=(('WIN32', "Windows-32", "Windows 3... |
# Copyright 2015 Adafruit Industries.
# Author: Tony DiCola
# License: GNU GPLv2, see LICENSE.txt
class DirectoryReader(object):
def __init__(self, config):
"""Create an instance of a file reader that just reads a single
directory on disk.
"""
self._load_config(config)
def _loa... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.18
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
#!/usr/bin/env python
import pytest
import netmiko
import time
from DEVICE_CREDS import *
def setup_module(module):
module.EXPECTED_RESPONSES = {
'base_prompt' : 'pynet-rtr1',
'interface_ip' : '10.220.88.20'
}
show_ver_command = 'show version'
module.basic_command = 'show ip i... |
"""
Stolen from: http://tomcoote.co.uk/code-bank/django-email-munger/
"""
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
import re
register = template.Library()
@register.filter
@string... |
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
# Copyright 2014 Donald Stufft
#
# 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, so... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id: wmts.py 33793 2016-03-26 13:02:07Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: WMTS driver test suite.
# Author: Even Rouault, even dot rouault at spatialys.com
#
##########... |
import tensorflow as tf
import netfactory as nf
import numpy as np
class model_zoo:
def __init__(self, inputs, dropout, is_training, model_ticket):
self.model_ticket = model_ticket
self.inputs = inputs
self.dropout = dropout
self.is_training = is_training
... |
# do this in the shell
# virtualenv/bin/pip install scapy
# sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH virtualenv/bin/scapy
# You also can do this from within scapy:
# execfile("polua-classifier-test.py")
# The rest is in the scapy CLI
import vpp_papi
v = vpp_papi
v.connect("pytest")
def cli(cmd):
print("Running " + c... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... |
"""
Copyright (c) 2017, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Jan 29, 2018
@author: jrm
"""
from atom.api import Typed, set_default
from enamlnative.widgets.bottom_sheet_dialog import ProxyBottomSheetDialog
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Refrescador automatico de clines
#Creado por Dagger - https://github.com/gavazquez
import ReloadCam_Main, ReloadCam_Helper
def GetVersion():
return 3
#Filename must start with Server, classname and argument must be the same!
class Kacsat(ReloadCam_Main.Server):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
name='pyrax-c... |
#!/usr/bin/env python
import sqlalchemy
from sqlalchemy import Column, ForeignKey, Integer, String, Float
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
""" ****** New Class ****** """
class Servidor(Base):
"""docstring for Servid... |
from flask import Flask
from flask import render_template, request
from utils import Base,engine
from sqlalchemy.orm import scoped_session, sessionmaker
from models import Stock, StockDetail
from flask_bootstrap import Bootstrap
from flask import Blueprint
from flask_paginate import Pagination,get_page_args
from sqlalc... |
# -*- coding: utf-8 -*-
###############################################################################
import logging
from urllib import urlencode
from ntpath import dirname
from datetime import datetime
import xbmcgui
import artwork
from utils import tryEncode, tryDecode, settings, window, kodiSQL, \
CatchExc... |
from __future__ import print_function, unicode_literals
import os
import re
import sys
from builtins import str
from threading import Event, Thread
import paho.mqtt.client as mqtt
import ttfw_idf
from tiny_test_fw import DUT
event_client_connected = Event()
event_stop_client = Event()
event_client_received_correct =... |
import pytest
import logging
@pytest.fixture()
def chosen(priority):
_chosen = priority.allocated().values()[0].id()
logging.info("CHOSEN: {chosen}".format(chosen=_chosen))
return _chosen
def test_no_tags(chosen):
# some servers with tags, single server without tags -> expect the one with no tags to... |
# -*- coding: utf8 -*-
from django.db import models
from django.contrib.auth.models import User
class UserData(models.Model):
user = models.ForeignKey(User, verbose_name='пользователь')
availability = models.BooleanField('доступность')
one_on_one = models.BooleanField('1 - 1')
location = models.CharFi... |
# -*- coding: utf-8 -*-
# envelop - Environment variables manager
#
# Copyright (c) 2013 Yipit, Inc <coders@yipit.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 version 3 of the ... |
# 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 logging
import os
import unittest
from abc import ABCMeta
from typing import List, Optional, Tuple, Union
import docker
from hgicommon.docker.client import create_client
from hgicommon.helpers import create_random_string
from hgicommon.testing import create_tests, TestUsingObject, ObjectTypeUsedInTest
from tes... |
from django.conf import settings
from muparse.models import MuninNodes
import requests
from django.core.exceptions import ImproperlyConfigured
def get_all_nodes():
MNODES = []
for node in settings.MUNIN_NODES:
if isinstance(node, tuple):
MNODES.append(node)
else:
raise ... |
from __future__ import print_function
# import the main and action components
from maincomponent import maincomponent
from action1 import action1component
from action2 import action2component
from action3 import action3component
#import manager components
from action3components import animationmanager
from action3com... |
"""
Django settings for universaldatalogger project.
Generated by 'django-admin startproject' using Django 1.11.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
""... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
RealCentroidDialog
A QGIS plugin
Create internal point for a polygon layer
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
... |
# 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 ... |
from django.conf.urls import url
from . import views
urlpatterns=[
url(r'^$', views.test, name='test'),
url(r'^test/$', views.test, name='test'),
url(r'^login/$', views.login, name='login'),
url(r'^index/$', views.index, name='index'),
url(r'^block-add/$', views.block_add, name='block_add'),
url(r'^block-a... |
#!/usr/bin/env python
"""
Ask a manual question using human strings by referencing the name of a two sensors sensor.
Supply 3 parameters for the second sensor, one of which is not a valid parameter (and will be ignored).
Supply one option to the second sensor.
Supply two question filters that limit the rows returned... |
# what sublist is extracted by default lower/upper indexes?
question_type = 'input_output'
source_language = 'python'
hotspot_declarations = [
['$x0','int'],['$x1','int'],['$x2','int'],['$x3','int'],['$x4','int'],
['$y0','int'],['$y1','int'],['$y2','int'],
]
group_list = [
['list_slices_defaultUL_io_forwa... |
# Copyright 2016 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... |
#!/usr/bin/python
#coding=utf-8
import xml.dom.minidom
def get_tagname():
doc = xml.dom.minidom.parseString(input_xml_string)
class msg_parse:
def __init__(self,msg):
self.doc = xml.dom.minidom.parseString(msg)
def _getData(self,tagName):
nodes=self.doc.getElementsByTagName(tagName)
... |
#!/usr/bin/env python3
from datetime import date
from mathmodeling import misc, google, wikipedia
from scipy.interpolate import interp1d
from scipy.integrate import quad as integ
from sys import argv, stdout
import subprocess, os, os.path
def search_data(row):
return (float(row[0]), float(row[1]))
def article_data(... |
from opendc.models.path import Path
from opendc.models.simulation import Simulation
from opendc.util import exceptions
from opendc.util.rest import Response
def GET(request):
"""Get this Simulation's Paths."""
# Make sure required parameters are there
try:
request.check_required_parameters(
... |
# 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 ... |
# Functional tests for hsync
#
# Call out to the script, no running main() directly.
# Copyright (c) 2015, Andre Lucas
# 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 s... |
from ConfigParser import SafeConfigParser
from unittest import TestCase
import logging
import mock
import os
import shutil
import unittest
import okaara
import pymongo
from pulp.bindings.bindings import Bindings
from pulp.bindings.server import PulpConnection
from pulp.client.extensions.core import PulpCli, ClientCont... |
import numpy as np
ITERATION_LIMIT = 1000
# initialize the matrix
A = np.array([[10., -1., 2., 0.],
[-1., 11., -1., 3.],
[2., -1., 10., -1.],
[0., 3., -1., 8.]])
A2 = np.array(
[[ 77., -23., -32., 0., 0.],
[-23., 53., 0., 0., -18.],
[-32.,... |
#!/usr/bin/env python2.7
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--nepoch',type=int,default=20)
parser.add_argument('--version',type=int,default=4)
parser.add_argument('--trunc',type=int,default=7)
parser.add_argument('--limit',type=int,default=100)
parser.add_argument('--adv... |
#!/bin/python
#
# Hacking together tutorials from deeplearning.net to make
# a MLP model
import numpy
import theano
import theano.tensor as T
import sklearn.cross_validation
class LogisticRegression(object):
"""Multi-class Logistic Regression Class
The logistic regression is fully described by a weight matri... |
"""Upgrades router to use newer template"""
from baseCmd import *
from baseResponse import *
class upgradeRouterTemplateCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""upgrades all routers owned by the specified account"""
self.account = None
self.ty... |
import matplotlib.pyplot as plt
import numpy as np
def plot_show():
"""
Shows the current plot
"""
plt.show()
def plot_connectivity_matrix(CIJ, title="", plot_figure=None):
"""
Plots a scatter matrix
"""
plot = plt.figure(plot_figure).add_subplot(1, 1, 1)
plt.title(title)
x... |
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def ... |
from __future__ import absolute_import
import six
import pytest
from celery import Task
from collections import namedtuple
from django.core.urlresolvers import reverse
from sentry.utils.compat.mock import patch
from requests.exceptions import Timeout
from sentry.constants import SentryAppStatus
from sentry.models im... |
def pow(a: int, b: int) -> int:
power: int = 1
for i in range(b):
power = power * a
return power
def check(memos: Dict[(Tuple[(int, int, int, int)], int)], i: int, s: int, c: int, k: int) -> int:
if (s == 0):
return 0
elif ((i, s, c, k) not in memos):
memos[(i, s, c, k)]: in... |
#!/usr/bin/env python
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 09/07/2016'
import argparse
import os
import urllib2
import re
import codecs
from threading import Thread
from HTMLParser import HTMLParser
DOMAIN = "songmeanings.com/"
ARTIST_PATH = 'artist/view/songs/'
def start_new_thread(task, arg):
... |
from functools import partial
import re
from .exceptions import ServiceNotAvailable
services = {}
def register(cls):
if issubclass(cls, BaseService):
key = getattr(cls, 'registry_key', None)
if not key:
key = ' '.join(re.findall('[A-Z][^A-Z]*', cls.__name__))
services[key] = cl... |
# encoding: utf-8
'''
2D surface embedded in 3D
-------------------------
'''
from __future__ import absolute_import
import importlib
import os
import numpy as np
from medianshape.simplicial import pointgen3d, mesh, utils
from medianshape.simplicial.meshgen import meshgen2d
import matplotlib.pyplot as plt
from mpl_t... |
# 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... |
#!/usr/bin/env python3
from google.cloud import bigquery
def print_query_results(client,
station_name,
min_duration=0,
max_duration=84000):
print("{} between {} and {}".format(
station_name, min_duration, max_duration))
query = "... |
# -*- coding: utf-8 -*-
"""
eve.render
~~~~~~~~~~
Implements proper, automated rendering for Eve responses.
:copyright: (c) 2017 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import re
import time
import datetime
import simplejson as json
from werkzeug import utils
from fun... |
import os
import re
import nzbtomedia
from nzbtomedia import logger
from nzbtomedia.nzbToMediaUtil import listMediaFiles
reverse_list = [r"\.\d{2}e\d{2}s\.", r"\.[pi]0801\.", r"\.p027\.", r"\.[pi]675\.", r"\.[pi]084\.", r"\.p063\.", r"\b[45]62[xh]\.", r"\.yarulb\.", r"\.vtd[hp]\.",
r"\.ld[.-]?bew\.", ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Written in place of AboutBlocks in the Ruby Koans
#
# Note: Both blocks and generators use a yield keyword, but they behave
# a lot differently
#
from runner.koan import *
class AboutGenerators(Koan):
def test_generating_values_on_the_fly(self):
result =... |
#!/usr/bin/env python
#*-* coding:utf-8 *-*
# signature.py © 2012 Zac Sturgeon and Nathan Lex
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your opti... |
'''
- login and get token
- process 2FA if 2FA is setup for this account
- if the user is a regular customer then get a list of transactions for this user
- if the user is a partner_admin then get a list of transactions for the first user from the list of users this partner admin has access to
'''
import requests
impo... |
'''
Created on Aug 5, 2013
@author: Voss
'''
import sys
sys.path.append('../python2')
import unittest
import logging
import lambda_2
import numpy as np
class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
logging.basicConfig(filename="./test_log.log",
... |
# flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Employee.is_manager'
db.add_column('payslip_employee', 'is_manager',
... |
from django import template
# from django.contrib.admin.util import lookup_field
# from django.core.exceptions import ObjectDoesNotExist
# from django.core.urlresolvers import NoReverseMatch, reverse
# from django.db.models import ForeignKey
# from django.template.defaulttags import NowNode
# from django.utils.safestri... |
import numpy as np
import cv2
import yaml
import Image
import tensorflow as tf
# const variable
img_size = 227
rootdir = '/home/huligang/data/myVoc/'
image_path = rootdir + 'JPEGImages/%s.jpg'
anno_path = rootdir + 'Annotations/%s.yml'
train_list = rootdir + 'ImageSets/Main/trainval.txt'
test_list = rootdir + 'ImageS... |
# coding=utf-8
# Copyright 2021 DeepMind Technologies 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 applic... |
import numpy as np
import matplotlib.pyplot as plt
import loudness as ln
def plotResponse(freqPoints, dataPoints,
freqsInterp, responseInterp,
ylim=(-40, 10), title = ""):
if np.any(dataPoints):
plt.semilogx(freqPoints, dataPoints, 'o')
plt.semilogx(freqsInterp, resp... |
# Copyright 2016: Mirantis 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 required b... |
'''
@author: xiaowing
@license: MIT License
'''
import io, sys, shutil, getopt, time, random, queue, urllib.parse, pdb, threading
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf8') # Change the default encode of stdout.
import requests
import psycopg2
from datetime import date, datet... |
from oauth.oauth import OAuthError
from django.conf import settings
from django.http import (
HttpResponse, HttpResponseBadRequest, HttpResponseRedirect, HttpResponseForbidden)
from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers... |
from collections import OrderedDict
from purl import URL
from sqlalchemy.orm import joinedload, contains_eager
from clld.web.util.multiselect import MultiSelect
from clld.db.meta import DBSession
from clld.db.models.common import Language, Unit, Value, ValueSet
from clld.web.util.htmllib import HTML
from clld.web.uti... |
from __future__ import absolute_import
import json
import os
import weakref
from PyQt5.QtCore import QDataStream, QIODevice, QObject, Qt, pyqtSignal
from PyQt5.QtGui import QPainter
from PyQt5.QtWidgets import QDialog, QGridLayout, QShortcut, QSizePolicy, \
QWidget, QStyleOption, QStyle
from qmxgraph import cons... |
# Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any la... |
# coding: utf-8
# general imports
import itertools, os, re
from time import gmtime, strftime
# django imports
from django.shortcuts import render_to_response, HttpResponse
from django.template import RequestContext as Context
from django.http import HttpResponseRedirect
from django.contrib.admin.views.decorators impo... |
"""Basic checks for entity map storage."""
from tests.common import flush_store
from tests.components.homekit_controller.common import (
FakeService,
setup_test_component,
setup_platform,
)
from homeassistant import config_entries
from homeassistant.components.homekit_controller import async_remove_entry
f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# poshsplice 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
# ... |
import polib
import os
from django.db import models
from django.template.defaultfilters import capfirst as cf
from django.utils.translation import ugettext_lazy as _
from .settings import get_settings
class TranslationEntry(models.Model):
created = models.DateTimeField(auto_now_add=True, verbose_name=_(u"admin-... |
#!/usr/bin/env python2.7
from common_methods import exit_script, display_usage, exit_error
import sys, os
import config
import config_gen
def generate_confs():
"""
For each section generate config files if TEMPLATE_CONFIG is present into OUTPUT_CONFIG
Exception for HOSTAPD as it may have many variables which is not ... |
'''
@author: Antorweep Chakravorty
'''
import googlemaps
import rapidjson as json
import pickle
import pprint
from datetime import datetime
from vertex import vertex
from edge import edge
class GoogleMapsAPI(object):
def __init__(self, username, password, app_id, app_token):
self.username = username
... |
#!/usr/bin/env python
"""
tests loading a UGRID file with projected coords
This is also a very complete UGRID dataset, with data on nodes, edges, etc...
this test uses a data file auto-downloaded from ORR:
http://gnome.orr.noaa.gov/py_gnome_testdata/
Questions about this data;
there is a node_z variable:
dou... |
# Copyright 2012 Tsutomu Uchino
#
# 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 ... |
import cPickle as pickle;
import numpy as np;
import theano;
import theano.tensor as T;
import matplotlib.pyplot as plt;
import telauges.utils as utils;
from telauges.hidden_layer import AutoEncoder;
n_epochs=100;
training_portion=1;
batch_size=100;
rng=np.random.RandomState(23455);
Xtr, Ytr, Xte, Yte=utils.load_CI... |
"""
Django settings for pybbm_private_messages project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.