src stringlengths 721 1.04M |
|---|
'''
Compatibility module for Python 2.7 and > 3.3
=============================================
'''
# pylint: disable=invalid-name
__all__ = ('PY2', 'string_types', 'queue', 'iterkeys',
'itervalues', 'iteritems', 'xrange')
import sys
try:
import queue
except ImportError:
import Queue as queue
#: T... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Trading As Brands
# Copyright (C) 2015 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... |
#!/usr/bin/env python3
# vim: fileencoding=utf-8
import os
import re
from base64 import standard_b64decode as b64decode
from os.path import dirname, isfile, expanduser
from configparser import ConfigParser
from urllib.request import urlopen
HOST_PAT = re.compile(r'^[\w-]+(\.[\w-]+)+$')
PORT_PAT = re.compile(r':\d+$')... |
#!/usr/bin/env python
# Author: Derek Green
PKG = 'pocketsphinx'
#import roslib; roslib.load_manifest(PKG)
import rospy
import re
import os
from std_msgs.msg import String
from subprocess import Popen, PIPE
class SpeechText():
def __init__(self):
self.pub = rospy.Publisher('speech_text', String)
... |
#! /usr/bin/env python
import os
import private.preliminaries as prelim
import private.metadata as metadata
import private.messages as messages
from private.getexternalsdirectives import SystemDirective
def get_externals(externals_file,
external_dir = '@DEFAULTVALUE@',
... |
# -*- coding: utf-8; -*-
# Copyright (C) 2015 - 2019 Lionel Ott
#
# 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 option) any later version.
#
# T... |
#!/usr/bin/env vpython
#
# [VPYTHON:BEGIN]
# wheel: <
# name: "infra/python/wheels/google-auth-py2_py3"
# version: "version:1.2.1"
# >
#
# wheel: <
# name: "infra/python/wheels/pyasn1-py2_py3"
# version: "version:0.4.5"
# >
#
# wheel: <
# name: "infra/python/wheels/pyasn1_modules-py2_py3"
# version: "versio... |
# -*- coding: utf-8 -*-
import contextlib
from distutils import ccompiler
from distutils.errors import *
import os
import sys
import types
def _has_function(self, funcname, includes=None, include_dirs=None,
libraries=None, library_dirs=None):
"""Return a boolean indicating whether funcname is su... |
from ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector
from Components.ActionMap import ActionMap, HelpableActionMap
from Components.ActionMap import NumberActionMap
from Components.Harddisk import harddiskmanager
from Components.Input import Input
from Components.Label import Label
from... |
# Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... |
"""Preprocess the Phoenix Bird model
The model is available for download from
https://sketchfab.com/models/844ba0cf144a413ea92c779f18912042
The Python Imaging Library is required
pip install pillow
"""
from __future__ import print_function
import json
import os
import zipfile
from PIL import Image
from ut... |
import scrapy
from scrapy import log
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from rcbi.items import Part
import urllib
import urlparse
MANUFACTURERS = ["Gemfan"]
CORRECT = {"HQ Prop": "HQProp"}
MANUFACTURERS.extend(CORRECT.keys())
QUANTITY = {}
STOCK_STATE_MAP = {"... |
# SecuML
# Copyright (C) 2017 ANSSI
#
# SecuML 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.
#
# SecuML is distributed in the hope t... |
#!/usr/bin/python
import numpy as np
import pickle
import os
from model import Model
def get_input():
"""
Ask user for inputs about event: Title, Main Topic, Distance to Location.
Checks for correct types and value ranges. If not correct, restarts asking 5 times.
:return: Tuple(Str, Int, Int) => "Tit... |
# Copyright (c) 2017 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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 version.
#
# Ansible is distributed... |
import json
from gi.repository import Gtk
from sunflower.widgets.settings_page import SettingsPage
class Column:
NAME = 0
DESCRIPTION = 1
TYPE = 2
ICON = 3
CONFIG = 4
class ToolbarOptions(SettingsPage):
"""Toolbar options extension class"""
def __init__(self, parent, application):
SettingsPage.__init__(se... |
# -*- coding: utf-8 -*-
'''
Syndic module to declare a new Diacamma appli
@author: Laurent GAY
@organization: sd-libre.fr
@contact: info@sd-libre.fr
@copyright: 2015 sd-libre.fr
@license: This file is part of Lucterios.
Lucterios is free software: you can redistribute it and/or modify
it under the terms of the GNU Ge... |
#!/usr/bin/env python3
""" Estimator 1.0
The estimator helps you find those hard estimations they ask you.
Just call the script, it will ask you a brief feature descrition,
then it will show you the estimation.
Press CTRL-C when you're done.
"""
import sys
from random import randrange
fib_n = [1, 1,... |
import functools
class memoized(object):
"""Decorator that caches a function's return value each time it is called.
If called later with the same arguments, the cached value is returned, and
not re-evaluated.
"""
def __init__(self, func):
self.func = func
self.cache = {}
def ... |
#!/usr/bin/env python
from scheduler.job import *
from scheduler.fcfs import *
from scheduler.sjf import *
from scheduler.srjf import *
from scheduler.priority import *
from scheduler.preemptive_priority import *
from scheduler.round_robin import *
from PyQt4 import QtCore, QtGui
from random import randint
import cop... |
"""
Test that lldb persistent variables works correctly.
"""
import lldb
from lldbsuite.test.lldbtest import *
class PersistentVariablesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_persistent_variables(self):
"""Test that lldb persistent variables works correctly."""
... |
from collections import OrderedDict
import six
from conans.errors import ConanException
from conans.model.ref import ConanFileReference
from conans.util.env_reader import get_env
class Requirement(object):
""" A reference to a package plus some attributes of how to
depend on that package
"""
def __i... |
__author__ = "Mats Larsen"
__copyright__ = "Mats Larsen2014"
__credits__ = ["Morten Lind"]
__license__ = "GPL"
__maintainer__ = "Mats Larsen"
__email__ = "matsla@{ntnu.no}"
__status__ = "Development"
#--------------------------------------------------------------------
#File: logging.py
#Module Description
"""
This mod... |
############################################################################
# Copyright(c) Open Law Library. All rights reserved. #
# See ThirdPartyNotices.txt in the project root for additional notices. #
# #
# Licensed u... |
# -*- coding: utf-8 -*-
# Project pxchar
import sys
import os.path
from PIL import Image
# バージョンは一文字で表す
VERSION = '0';
# color辞書(とりあえず決め打ち)
# 外出ししたい
COLORS = {
# pxchar制御文字
"??": (255, 255, 255), # 不明な文字
"<" : (0, 0, 0), # 終端文字
">" : (69,90,100), # ファイル改行
"%" : (255,235,59),
#... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# Copyright (C) 2006-2009, TUBITAK/UEKAE
#
# 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) ... |
import json
import pyowm
from . import azimuth
# openweathermap API key
# please use you own api key!
API_KEY = '3ede2418f1124401efcd68e5ae3bddcb'
town = 'Norilsk'
area = 'ru'
owm = pyowm.OWM(API_KEY)
observation = owm.weather_at_place('{0},{1}'.format(town, area))
w = observation.get_weather()
# print(w)
class G... |
#!/usr/bin/env python
import os
import sys
import math
import xml.etree.ElementTree as et
def parse_results(filename):
tree = et.parse(filename)
root = tree.getroot()
skipped = []
current_class = ""
i = 1
assert i - 1 == len(skipped)
for el in root.findall("testcase"):
cn = el.at... |
# Copyright 2018 Google 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 in writing, s... |
import os
DEBUG = True
SECRET_KEY = 'zhayYxXXUPuNh09ZDsNGLcDRIWywVUC6XCH1sZI2'
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', '')
SECURITY_REGISTERABLE = True
SECURITY_SEND_REGISTER_EMAIL = False
SECURITY_SEND_PASSWORD_CHANGE_EMAIL = True
SECURITY_SEND_PASSWOR... |
# MIT License
#
# Copyright (c) 2020 Yu Zhang
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... |
import numpy as np
import pytest
from pandas.core.dtypes.base import registry as ea_registry
from pandas.core.dtypes.dtypes import DatetimeTZDtype, IntervalDtype, PeriodDtype
from pandas import (
Categorical,
DataFrame,
Index,
Interval,
NaT,
Period,
PeriodIndex,
Series,
Timestamp,
... |
# -*- encoding: latin1 -*-
#FRESHMAN BERRIES
#Cliente
#Version: 8.1
#Author: NEETI
import socket
def enviar( mensagem ):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
servidor=('neetiproj.tagus.ist.utl.pt', 4000)
sock.connect( servidor )
mensagens = []
try:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
*booru general file.
For now, there's working Gelbooru downloader for loli content,
but soon I'll add danbooru, etc.
"""
import loli_spam
import os
import datetime
import urllib.request
import http.cookiejar
import xml.etree.ElementTree as eltree
import json
#lol... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
import aiohttp
import inspect
import io
import discord
from discord.ext import commands
import settings
def setting(name, default):
return getattr(settings, name, default)
def pretty_list(names, bold=True, conjunction='and', empty=''):
names = list(names)
if not names:
return empty
if bold:... |
import re
import os
import logging
from autotest.client import utils
from autotest.client import lv_utils
from autotest.client.shared import error
from virttest import libvirt_storage
from virttest import utils_test
from virttest import virsh
from virttest.utils_test import libvirt
from provider import libvirt_versi... |
# coding=utf-8
#
# Copyright 2014 Rustici Software
#
# 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 respuired by applic... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An example IRC log bot - logs a channel's events to a file.
If someone says the bot's name in the channel followed by a ':',
e.g.
<foo> logbot: hello!
the bot will reply:
<logbot> foo: I am a log bot
Run this script with two arguments, t... |
import json
import argparse
import sys
import zmq
import datetime
from Sundberg.Logger import *
from subprocess import call
def get_command_line_arguments( ):
parser = argparse.ArgumentParser(description='Speak-aloud espeak client')
parser.add_argument("configfile", help = "Set configuration file to be used")... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
from sanji.core import Sanji
from sanji.connection.mqtt import Mqtt
REQ_RESOURCE = "/network/cellulars"
class View(Sanji):
# This function will be executed after registered.
def run(self):
print "Go Test 1"
res = self.publish.g... |
from __future__ import absolute_import, division, print_function
import time
import logging
from .record import Record
log = logging.getLogger(__name__)
class Worker(object):
def __init__(self, log, backend, stats_every=50):
self.log = log
self.backend = backend
self.stats_every = stat... |
# -*- coding: utf-8 -*-
import sys
import gevent.wsgi
import gevent.monkey
from werkzeug.contrib import profiler
from flask_script import Command
class ProfileServer(Command):
"""
Run the server with profiling tools
"""
def __init__(self, host='localhost', port=9000, **options):
self.por... |
class ParameterSet:
"""
From
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
Alex Martelli
"""
def __init__(self, **kwds):
self.__dict__.update(kwds)
def cyclops(timesignal, r_phase, accumulation_object):
"""
This is CYCLOPS phase cycling.
Receiver phase must ... |
r"""
>>> from django.conf import settings
>>> from tokyo_sessions.tyrant import SessionStore as TokyoSession
>>> tokyo_session = TokyoSession()
>>> tokyo_session.modified
False
>>> tokyo_session.get('cat')
>>> tokyo_session['cat'] = "dog"
>>> tokyo_session.modified
True
>>> tokyo_session.pop('cat')
'dog'
>>> tokyo_ses... |
from word2vec_generate_snapshot_model.sentence_iterators import SnapshotSentenceIterator
from .setup_test_word2vec import TestWord2vec
class TestSnapshotSentenceIterator(TestWord2vec):
def test_snapshot_sentence_iterator(self):
"""Ensure that all of the sentences get returned"""
sentence_iterato... |
import os
from fab_deploy2 import functions
from fab_deploy2.tasks import ContextTask
from fabric.api import run, sudo, settings
from fabric.contrib.files import exists
from fabric.context_managers import cd
class HiRedisSetup(ContextTask):
"""
Setup hiredis
"""
context_name = 'hiredis'
default_... |
# 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 option) any later version.
#
# This program is distributed in the hope that it will be useful
# but... |
import argparse
import os
import re
import sys
if __name__ == "__main__":
if sys.version_info < (3, 0):
print("This script requires version 3+ of python. Please try running it with command 'python3' instead")
exit(8)
parser = argparse.ArgumentParser(
description="Quick Mailer"
)
... |
# Generated by Django 2.0.6 on 2018-10-20 23:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import permission_utils.model_mixins
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL... |
import os
import logging
import time
import threading
from wx.lib.pubsub import pub
from API.pubsub import send_message
from API.directoryscanner import find_runs_in_directory
toMonitor = True
TIMEBETWEENMONITOR = 120
class DirectoryMonitorTopics(object):
"""Topics for monitoring directories for new runs."""
... |
from django.conf.urls import patterns, include
from django.views.generic.base import TemplateView
from product.urls import urlpatterns as productpatterns
from satchmo_store import shop
from satchmo_store.shop.views.sitemaps import sitemaps
from signals_ahoy.signals import collect_urls
urlpatterns = shop.get_satchmo_se... |
from PIL import Image
import numpy as np
# 이미지 데이터를 Averages Hash로 변환 함수 선언
def average_hash(fname, size = 16): #average_hash(파일이름, 사이즈)
img = Image.open(fname) # 이미지 데이터 열기
img = img.convert('L') # 그레이스케일로 변환
#'1'지정하게 되면 이진화 그밖에 "RGB", "RGBA", "CMYAK" 모드 지정가능
i... |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2018-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... |
import os
import random
import datetime
from django.db import models
from django.conf import settings
from django.utils.http import int_to_base36
from django.utils.hashcompat import sha_constructor
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.core.mail ... |
#!/usr/bin/env python
import web
import time
import hashlib
sha2 = hashlib.sha256()
# db = web.database(dbn='postgres', db='scrapieweb', user='postgres', pw='fuddruckers')
# def uservalidate(username):
# usernum = db.query("SELECT COUNT(*) FROM auth WHERE username=$uid", vars="username")
# return usernum[0]
urls... |
import itertools, re, urllib2
DEBUG = False
def set_debug(debug):
global DEBUG
DEBUG = debug
def debug_print(s):
if DEBUG:
print(' DEBUG ' + s)
def del_empty_values(d):
for key in d.keys():
if d[key] == '' or d[key] == None:
del d[key]
return d
def req_key(req):
key = req.get_full_url()
key += str(re... |
import dimerizer.forcefield.basic_parsing_tools as parser
import basic_func as basic
def collect_tags(fname, atomlist):
"""
Collect the dimerized atomtypes.
fname is a topology filename, atomlist is
the list of atom INDICES (0 to N-1)
Returns:
tuple with two elements:
1) a list of tags w... |
"""
Cache for storing and retrieving data in a pod.
Supports arbitrary data based on a cache key.
The contents of the cache should be raw and not internationalized as it will
be shared between locales.
"""
import re
FILE_OBJECT_CACHE = 'objectcache.json'
FILE_OBJECT_SUB_CACHE = 'objectcache.{}.json'
class Object... |
# -*- coding: utf-8 -*-
import system_tests
class PrettyPrintXmp(metaclass=system_tests.CaseMeta):
url = "http://dev.exiv2.org/issues/540"
filename = "$data_path/exiv2-bug540.jpg"
commands = ["$exiv2 -u -px $filename"]
stdout = ["""Xmp.dc.creator XmpSeq 1 Ian Bri... |
#
#
# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This progr... |
import os
import shutil
import pytest
try:
sqlalchemy = pytest.importorskip("sqlalchemy")
except ImportError:
sqlalchemy = None
from great_expectations.data_context.util import file_relative_path
from great_expectations.datasource import LegacyDatasource
from great_expectations.datasource.batch_kwargs_genera... |
# Author: Peter Norvig
# taken from: http://norvig.com/spell-correct.html
import re, collections
def words(text):
return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
model[f] += 1
return model
try:
with open('big.tx... |
'''
Custom theano class to access page links.
'''
import numpy as np
import theano
from theano import gof
from theano import tensor
import time
import parameters as prm
import utils
class Link(theano.Op):
__props__ = ()
def __init__(self, wiki, wikipre, vocab):
self.wiki = wiki
self.wikipre =... |
'''@file train_lm.py
this file will do the asr training'''
import os
import shutil
from functools import partial
import tensorflow as tf
from six.moves import configparser
from nabu.distributed import create_server
from nabu.processing import batchdispenser, text_reader, target_coder
from nabu.neuralnetworks.classifie... |
# coding=utf-8
# Copyright 2019 Google 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 ... |
import unittest
from idsearch.func_iter import FuncIter
class TestSearchDB(unittest.TestCase):
def test_basic(self):
my_iter = (i for i in range(5))
fiter = FuncIter(my_iter)
self.assertEqual(list(fiter), [0,1,2,3,4])
def test_map(self):
my_iter = (i for i in range(5))
... |
from __future__ import absolute_import, unicode_literals
import datetime
import six
from django import forms
from django.db.models.fields import BLANK_CHOICE_DASH
from django.template.loader import render_to_string
from django.utils.encoding import force_text
from django.utils.dateparse import parse_date, parse_time,... |
# Generated by Django 2.0.8 on 2018-09-25 15:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("product", "0071_attributechoicevalue_value")]
operations = [
migrations.RenameModel(old_name="ProductAttribute", new_name="Attribute"),
migrations.Rename... |
# -*- coding: utf-8 -*-
import unittest
from pychord import Chord, ChordProgression
class TestChordProgressionCreations(unittest.TestCase):
def test_none(self):
cp = ChordProgression()
self.assertEqual(cp.chords, [])
def test_one_chord(self):
c = Chord("C")
cp = ChordProgre... |
import discord
from discord.ext import commands
import pickle
import asyncio
from urllib.request import urlopen
from bot import nonAsyncRun, printToDiscord, checkOp, safeEval, getShelfSlot, doUrlopen, getToken
import atexit
import random
import markovify
import wolframalpha
import threading
import xmltodict
... |
import os
import os.path as op
from bento.utils.utils \
import \
subst_vars
from bento.installed_package_description \
import \
BuildManifest, build_manifest_meta_from_pkg
from bento._config \
import \
BUILD_MANIFEST_PATH
from bento.commands.core \
import \
Option
from... |
'''
paper.data.move
purpose | move files
author | Immanuel Washington
Functions
---------
exist_check | checks to see if files to be moved all exist in database
set_move_table | updates database with moved file status
move_files | parses list of files then moves them
'''
from __future__ import print_function
import ... |
# -*- coding: Latin-1 -*-
"""Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always ... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.appearance.cam16` module.
"""
import numpy as np
import unittest
from itertools import permutations
from colour.appearance import (VIEWING_CONDITIONS_CAM16,
InductionFactors_CAM16, CAM_Specifi... |
import logging
import random
import curses
import queue
from .minesweeper.minefield import MineField
from .minesweeper.contents import Contents
class Conveyor(object):
"""
Abstract class Conveyor describes the basic contract for communicating about games of Minesweeper.
"""
def get_state(self):
... |
# Copyright (c) 2011, Daniel Crosta
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-03-17
Last_modify: 2016-03-17
******************************************
'''
'''
Given a linked list,
return the node where... |
#
# (C) Copyright 2003-2010 Jacek Konieczny <jajcus@jajcus.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be u... |
_panda = False
try:
import pygame
from pygame import locals
except:
_panda = True
import logging
log = logging.getLogger("R.Surface")
def scaleImage(surface, width, height):
""" Return surface scaled to fit width and height. """
#log.debug("scaled image %s" % repr(surface))
return pygame.tr... |
resize_possible = True
try:
# TRY USING OpenCV AS RESIZER
#raise ImportError #debugging
import cv2
import numpy as np
def resizer (pic, newsize):
lx, ly = int(newsize[0]), int(newsize[1])
if lx > pic.shape[1] or ly > pic.shape[0]:
# For upsizing use linear for good quali... |
"""
VMware vRealize Client implementation and supporting objects.
Copyright (c) 2017, Lior P. Abitbol <liorabitbol@gmail.com>
"""
import logging
import requests
from .config import URL_GET_WORKFLOW_BY_ID
from .utils import format_url, is_json
from .workflows import Workflow
class Client:
def __i... |
# -*- coding: utf-8 -*-
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2013 Task Coach developers <developers@taskcoach.org>
Task Coach 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 vers... |
import numpy as np
import pytest
from psi.token.primitives import Cos2EnvelopeFactory, ToneFactory
@pytest.fixture()
def tb1(queued_epoch_output):
tone = ToneFactory(fs=queued_epoch_output.fs, level=0, frequency=100,
calibration=queued_epoch_output.calibration)
envelope = Cos2EnvelopeF... |
# The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"basis,
#... |
"""
Copyright (c) 2013 Breakaway Consulting Pty. Ltd.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publ... |
# Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
# This source code is licensed under both the GPLv2 (found in the
# COPYING file in the root directory) and Apache 2.0 License
# (found in the LICENSE.Apache file in the root directory).
from advisor.db_log_parser import DatabaseLogs, Log, NO_COL_FA... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
import numpy as np
from dis... |
# -*- coding: utf-8 -*-
import sys, os, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.append(parent_dir)
from django.test import SimpleTestCase
from django.template import RequestContext, TemplateDoesNotExist, Context... |
import os
import unittest
from parameterized import parameterized
from integration_tests.dataproc_test_case import DataprocTestCase
class OozieTestCase(DataprocTestCase):
COMPONENT = 'oozie'
INIT_ACTIONS = ['oozie/oozie.sh']
TEST_SCRIPT_FILE_NAME = 'validate.sh'
def verify_instance(self, name):
... |
# Copyright 2014 Michael Rice <michael@michaelrice.org>
#
# 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 a... |
from scipy import *
from scipy.special import sph_jn, sph_yn
# The following is an entirely computationally inefficient draft, intended for basic orientation.
def jl(l,z):
"""Wrapper for sph_jn (discards the unnecessary data)"""
return sph_jn(n, z)[0][l]
def yl(l,z):
"""Wrapper for sph_yn (discards the u... |
#
# Copyright (C) 2016 Joachim Bauch <mail@joachim-bauch.de>
#
# 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 later version.
#
... |
__all__ = ['Image', 'imread', 'imread_collection', 'imsave', 'imshow', 'show',
'push', 'pop']
from skimage.io._plugins import call as call_plugin
from skimage.color import rgb2grey
import numpy as np
try:
import cStringIO as StringIO
except ImportError:
import StringIO
# Shared image queue
_image... |
__author__ = 'Darktel'
def translit(Mystring):
"""
String (Rus) -> String (Eng)
"""
RusString = 'а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ы,ь,ъ,э,ю,я,*, ,'
EngString = "a,b,v,g,d,e,yo,zh,z,i,j,k,l,m,n,o,p,r,s,t,u,f,h,c,ch,sh,xh,y,',`,q,ju,ya,*,-,"
RusChar = RusString.split(','... |
#
# Leon Adams
#
# Python Module for running a hopfield network to relocate the memory from a perturbed image.
# The raw data set is represented in png image format. This code takes the three color channels (rgb)
# Converts to a single channel gray scaled image and then transforms the output to a [-1,1] vector
# for u... |
"""Implements all of the functions that compute the geographic
scores using geodatabase."""
from nyc3dcars import Photo, Detection, Elevation, \
PlanetOsmLine, Roadbed, GeoidHeight
from sqlalchemy import func
import sys
from collections import namedtuple
import numpy
import math
import logging
import pygeo
i... |
import syslog
from datetime import datetime
import time
import re
import sys
import threading
import happybase
import struct
import hashlib
import base64
sys.path.append('/usr/local/lib/cif-protocol/pb-python/gen-py')
import msg_pb2
import feed_pb2
import control_pb2
import RFC5070_IODEF_v1_pb2
import MAEC_v2_pb2
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.