src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Range) on 2019-05-07.
# 2019, SMART Health IT.
from . import element
class Range(element.Element):
""" Set of values bounded by low and high.
A set of ordered Quantities defi... |
# Copyright 2012-2015 MongoDB, 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 to in writin... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from setuptools import setup
url = "https://github.com/jic-dtool/dtool-create"
version = "0.23.4"
readme = open('README.rst').read()
setup(
name="dtool-create",
packages=["dtool_create"],
package_data={"dtool_create": ["templates/*"]},
version=version,
description="Dtool plugin for creating datase... |
import sys
import json
from BNGtoLatLong import OSGB36toWGS84
def convert(filename):
"""Converts co-ordinates in the given file to lat/long from the BNG system"""
if filename[-5:] != ".json":
print "Not valid input file"
sys.exit(1)
input_file = open(filename, "rb")
data = json.load(in... |
# -*- coding: utf-8 -*-
'''
Created on Jan 30, 2015
Modified on Jan 30, 2015
@author: rainier.madruga@gmail.com
A simple Python Program to scrape the ESPN FC website for content.
'''
'''
Version Number of Script
'''
version = '0.01.a'
# Import Libraries needed for Scraping the various web pages
from bs4 import Beautif... |
from __future__ import division
import cPickle as pickle
import yaml
import os
from sportvu import data
import numpy as np
import yaml
from utils import (pictorialize_team, pictorialize_fast,
make_3teams_11players, make_reference, scale_last_dim)
game_dir = data.constant.game_dir
class ExtractorExcep... |
#!/usr/bin/env python
"""
@package ion.agents.data.test.test_external_dataset_agent_slocum
@file ion/agents/data/test/test_external_dataset_agent_slocum.py
@author Christopher Mueller
@brief
"""
# Import pyon first for monkey patching.
from pyon.public import log, IonObject
from pyon.ion.resource import PRED, RT
from... |
import mxnet as mx
import logging
# data & preprocessing
data = mx.symbol.Variable('data')
# 1st conv
conv1 = mx.symbol.Convolution(data=data, kernel=(5, 5), num_filter=20)
pool1 = mx.symbol.Pooling(data=conv1, pool_type="max",
kernel=(2, 2), stride=(2, 2))
# 2nd conv
conv2 = mx.symbol.Convo... |
# 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 ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2011 Aldo Cortesi
# Copyright (c) 2010 Philip Kranz
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2011 Paul Colomiets
# Copyright (c) 2011-2012 roger
# Copyright (c) 2011-2012, 2014 Tycho Andersen
# Copyright (c) 2012 Dustin Lacewell
# Copyright (c) 2012 Laurie Clark-... |
# -*- coding: utf-8 -*-
SECRET_KEY = 'psst'
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
ROOT_URLCONF = 'allauth.urls'
TEMPLATE_CONTEXT_PROCESSORS = (... |
# This might no have any use anymore, as the HDU objects is the new thing.
# Possibly changed it a bit to a time converter instead of getter I suppose.
def hdu_get_time(hdu, time_format='bmjd'):
"""
Will be used as a key function for the list.sort() or sorted() functions.
Example,
hdus.sort(key=h... |
from django.shortcuts import render
from django.conf import settings
from common.views import AbsSegmentSelection
#from common.views import AbsTargetSelection
from common.views import AbsTargetSelectionTable
# from common.alignment_SITE_NAME import Alignment
Alignment = getattr(__import__('common.alignment_' + setting... |
import numpy as np
import rllab.misc.logger as logger
from rllab.misc import special2 as special
class SimpleReplayPool(object):
def __init__(
self,
max_pool_size,
observation_dim,
action_dim,
replacement_policy='stochastic',
replacement_p... |
# -*- coding: UTF-8 -*-
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ---------
# Contributed by Erik van Blokland and Jonathan Hoefler
#
# FILIBUSTERb
#
# MIT License
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ---------
"""
living
- - - - ... |
# -*- coding: utf-8 -*-
import jieba
import jieba.analyse
from entity import *
import sys
sys.path.append('../code')
import cPickle as pickle
from sentiment_lstm import predict_arr
faqtable = {}
iptable = {}
records = []
knodes = []
querys = []
def load_knowledge_dict():
# 从知识图谱中生成倒排索引,保存成词典
# 暂时简单粗暴从已有的词典载入
... |
#!/usr/bin/env python
import time
import sys
import threading
import subprocess
import shlex
from pcaspy import Driver, SimpleServer
prefix = 'MTEST:'
pvdb = {
'COMMAND' : {
'type' : 'char',
'count': 128,
'asyn' : True
},
'OUTPUT' : {
'type' : 'char',
'count': 500... |
# -*- coding: utf-8 -*-
#
# 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
#... |
"""
Implements the objectworld MDP described in Levine et al. 2011.
Matthew Alger, 2015
matthew.alger@anu.edu.au
"""
import math
from itertools import product
import numpy as np
import numpy.random as rn
from .gridworld import Gridworld
class OWObject(object):
"""
Object in objectworld.
... |
"""
Salamander ALM
Copyright (c) 2016 Djuro Drljaca
This Python module 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 Python module ... |
#-------------------------------------------------------------------------------
# Name: led7.py
# Purpose: Use SAA1064 LED Driver to control FortiTo's Buzz-Led7
# Author: Anasol Pena-Rios
# Created: 22/01/2013
# Copyright: (c) FortiTo 2013
# Version: 1.0
#-------------------------------... |
'''version1 seed words algorithm'''
'''------------
input: a IR corpus, a expanding corpus(the candidate wordlist), a seed wordlist
output: a expanded seed wordlist
--------------'''
import math
file = open('D:/uw course/capstone/mypersonality/IRtest2.txt')#IR corpus
file1 = open('D:/uw course/capstone/mypersonality/E... |
#! /usr/bin/env python
from alexandra import Alexandra
from json import dumps
from maze import make_maze
from sys import argv
H_WIDTH = 80
H_HEIGHT = 3
V_WIDTH = 3
V_HEIGHT = 80
COLOUR = [0, 50, 200]
CELL_WIDTH = 80
def init(alex):
alex.pubsub.publish('wall_horizontal/wall_horizontal.json',
... |
"""
A Path element is a way of drawing arbitrary shapes that can be
overlayed on top of other elements.
Subclasses of Path are designed to generate certain common shapes
quickly and condeniently. For instance, the Box path is often useful
for marking areas of a raster image.
Contours is also a subclass of Path but in... |
from django.http import *
from forms import UploadForm
from django import template
from django.template.loader import get_template
from django.template import Context, RequestContext
from django.utils.decorators import method_decorator
from django.shortcuts import render_to_response
from django.contrib.auth import auth... |
from typing import Literal
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def translate_message(
key: str, message: str, mode: Literal["encrypt", "decrypt"]
) -> str:
"""
>>> translate_message("QWERTYUIOPASDFGHJKLZXCVBNM","Hello World","encrypt")
'Pcssi Bidsm'
"""
chars_a = LETTERS if mode == "decryp... |
#
# Copyright (c) 2015 University of Dundee.
#
# 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.
#
# This program ... |
import os
import uuid
import tempfile
temp_dir = tempfile.TemporaryDirectory()
class Job(object):
def __init__(self, disc, rip_config, hb_config, fixes):
if not isinstance(disc, Disc):
raise ValueError()
if not isinstance(rip_config, RipConfig):
raise ValueError()
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This script perform a simple shear experiment with lubrication law.
# It shows the use of
# - Lubrication law
# - PDFEngine
# - VTK Lubrication recorder
from yade import pack,ymport,export,geom,bodiesHandling, plot
import math
import pylab
#from yade import qt
import numpy ... |
import struct
import pytest
from aiokafka.record import util
varint_data = [
(b"\x00", 0),
(b"\x01", -1),
(b"\x02", 1),
(b"\x7E", 63),
(b"\x7F", -64),
(b"\x80\x01", 64),
(b"\x81\x01", -65),
(b"\xFE\x7F", 8191),
(b"\xFF\x7F", -8192),
(b"\x80\x80\x01", 8192),
(b"\x81\x80\x01"... |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
## ##
## Copyright 2010-2012, Neil Wallace <neil@openmolar.com> ##
## ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3.dev20161004124613 on 2016-10-10 12:42
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('api', '0003_recordtag'),
]
operations = [
mig... |
#!/usr/bin/env python
'''
Created on Dec 6, 2013
:author: jzupka
'''
import os
import sys
import select
import time
import stat
import gc
import logging
import traceback
import subprocess
import string
import random
import shutil
import signal
import remote_interface
import messenger as ms
from .. import data_dir
... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006, 2008 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... |
# -*- coding: utf-8 -*-
from re import sub
from jinja2 import Markup
from dataviva.translations.dictionary import dictionary
from dataviva.utils.num_format import num_format
from dataviva.utils.title_case import title_case
from decimal import *
from flask import g
import locale
from flask.ext.babel import gettext
''... |
# Copyright 2013 Red Hat, 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 program is distributed in the ... |
# -*- coding: utf-8 -*-
# Copyright 2008, 2010, 2014, 2015 Richard Dymond (rjdymond@gmail.com)
#
# This file is part of Pyskool.
#
# Pyskool 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 ... |
import unittest
import os, os.path, random
from whoosh import fields, index, writing
class TestWriting(unittest.TestCase):
def make_dir(self, name):
if not os.path.exists(name):
os.mkdir(name)
def destroy_dir(self, name):
try:
os.rmdir("testindex")
except... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, cstr, flt
from frappe import _
from erpnext.setup.utils import get_exchange_rate
from frappe.website.websit... |
# -*- coding: utf-8 -*-
# ***************************
# PCSIB DM3 2015
# Nom: Dizier Charles
# ****************************
import random
equi_num_object = {
1: "pierre",
2: "papier",
3: "ciseaux",
4: "lezard",
5: "spock"
}
winner_dict = {
"papier, ciseaux": False,
"ciseaux, papier": True... |
import sys
import chaos.publisher
if 'threading' in sys.modules:
del sys.modules['threading']
from nose.tools import assert_false, eq_
from chaos import models
from chaos.utils import send_disruption_to_navitia
from mock import MagicMock
def test_disruption_with_draft_status_isnnot_send():
'''
Tests that ... |
import settings
import pandas as pd
import numpy as np
import os
from datetime import datetime
from datetime import timedelta
import predictor.predictor_classifier as cls
import predictor.predictor_statistic as stat
import random
import nltk
class Stock:
def __init__(self, subject):
input_file = settings... |
from uuid import UUID
from django.core.validators import slug_re
from dispatch.theme.exceptions import InvalidZone, InvalidWidget
def is_valid_slug(slug):
"""Uses Django's slug regex to test if id is valid"""
return slug_re.match(slug)
def has_valid_id(o):
return hasattr(o, 'id') and o.id and is_valid_s... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
import matplotlib.pyplot as plt
import numpy as np
import math
from scipy.optimize import curve_fit
def linear(x, a, b):
return a * x + b
def quadratic(x, a, b, c):
return a * x**2 + b * x + c
def exponential(x, a, b, c):
return a * x**b + c
fig = plt.figure(num=None, figsize=(12, 8), dpi=300, facecolor='k', ... |
from Plugins.Plugin import PluginDescriptor
from Screens.PluginBrowser import *
from Screens.Ipkg import Ipkg
from Components.SelectionList import SelectionList
from Screens.NetworkSetup import *
from enigma import *
from Screens.Standby import *
from Screens.MessageBox import MessageBox
from Components.ActionMap impor... |
#%% libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%% gradient descent linear regression function
def grad_descent(dataset, features, predictor, learn_rate, max_iters = 10000):
def initialize_model(dataset, features, predictor):
constant_array = np.ones(shape = (len(d... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import __builtin__, sys, os
from calibre import config_dir
class PathResolver(ob... |
# compiler definition for irix/MIPSpro cc compiler
# based on suncc.py from waf
import os, optparse
import Utils, Options, Configure
import ccroot, ar
from Configure import conftest
from compiler_cc import c_compiler
c_compiler['irix'] = ['gcc', 'irixcc']
@conftest
def find_irixcc(conf):
v = conf.env
cc = ... |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
#
# 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 vers... |
#
# Just a class to wrap the functions to do with SDL and fint management.
# This is NOT a pigo font, but is used by that kind of font in generation
#
from SDL import SDL_Color, SDL_CreateRGBSurface, SDL_SWSURFACE, SDL_Rect, SDL_SetAlpha, SDL_SRCALPHA, SDL_FillRect, SDL_MapRGBA, SDL_BlitSurface
from SDL.ttf import TTF... |
#!/usr/bin/python
import os
import csv
from collections import Counter
from operator import itemgetter
from prettytable import PrettyTable
# XXX: Place your "Outlook CSV" formatted file of connections from
# http://www.linkedin.com/people/export-settings at the following
# location: resources/ch03-linkedin/my_connec... |
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copy... |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Gary Burton
#
# 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 ... |
# -*- coding: utf-8 -*-
"""Main module for DOLFIN"""
# Copyright (C) 2017 Chris N. Richardson and Garth N. Wells
#
# Distributed under the terms of the GNU Lesser Public License (LGPL),
# either version 3 of the License, or (at your option) any later
# version.
import types
import ffc
import ufl
import dolfin.cpp as ... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Hardware Customer Display module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can ... |
# coding: utf-8
"""
dis モジュールについてのサンプルです。
"""
import dis
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import hr
# noinspection SpellCheckingInspection
class Sample(SampleBase):
def exec(self):
##############################################
# dis モジュールは、python... |
# Copyright 2012 Google 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 by applicable law or a... |
import json
from typing import Any
import pytest
from pydantic import BaseModel, ConfigError, NoneBytes, NoneStr, Required, ValidationError, constr
from pydantic.exceptions import pretty_errors
def test_success():
# same as below but defined here so class definition occurs inside the test
class Model(BaseMo... |
# -*- coding: utf-8 -*-
# from framesplit import trajectory
# too slow using this module
import matplotlib.pyplot as plt
dirName = r"F:\simulations\asphaltenes\na-mont\TMBO-oil\water\373-continue/"
xyzName = 'all.xyz'
hetero = 'O' # 'oh' 'N' 'sp' 'O' 'Np' 'sp'
with open(dirName + xyzName, 'r') as f... |
"""
Dummy nodes for bee.segments.antenna in the GUI
"""
class push_antenna(object):
metaguiparams = {"type": "type"}
def __new__(cls, type):
antennas = dict(
)
outputs = dict(
outp=("push", type),
)
params = dict(
)
class push_antenna(objec... |
"""empty message
Revision ID: 3255e6bed08
Revises: 46ae0d2b68d
Create Date: 2015-12-31 22:35:01.740168
"""
# revision identifiers, used by Alembic.
revision = '3255e6bed08'
down_revision = '46ae0d2b68d'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
###... |
# Django settings for test_project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 't... |
#!/usr/local/bin/ python
from ctypes import *
from ctypes.util import find_library
import sys
import os
# For unix the prefix 'lib' is not considered.
if find_library('svm'):
libsvm = CDLL(find_library('svm'))
elif find_library('libsvm'):
libsvm = CDLL(find_library('libsvm'))
else:
if sys.platform == 'win32':
li... |
# Copyright 2012 the Melange 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 applicable law or agreed to in wr... |
import lcm
import drc
import atlas
import bot_core
import time
import numpy as np
import py_drake_utils as ut
from bdi_step.footsteps import decode_footstep_plan, decode_deprecated_footstep_plan, encode_footstep_plan, FootGoal
from bdi_step.plotting import draw_swing
from bdi_step.utils import Behavior, gl, now_utime
... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
from task_board.api import urls as api_urls
fro... |
from random import randint
import pandas as pd
def read_rating_history_dump():
rating_df = pd.read_csv('GoogleChartsFlask/data/rating_history.csv')
data = list()
for index, row in rating_df.iterrows():
data.append((row[0], row[1], row[2]))
return data
def read_daily_rating_dump():
ratin... |
# -*- coding: UTF-8 -*-
"""
Lastship Add-on (C) 2017
Credits to Placenta and Covenant; our thanks go to their creators
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 vers... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Däsh Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.test_framework import BiblePayTestFramework
from test_framework.util import... |
"""
* Copyright 2008 Google Inc.
* Copyright 2011 Bob Hampton
*
* 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 l... |
# django imports
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
# lfs imports
from lfs.catalog.models import Product
from lfs.order.models import Order
class Topseller(models.Model):
"""Selected products are in any case among topsellers.
"""
product = model... |
import array
import os
from disco.voice.playable import (AbstractOpus, BasePlayable, BufferedIO,
OpusEncoder, YoutubeDLInput)
from disco.voice.queue import PlayableQueue
from gevent.fileobject import FileObjectThread
class YoutubeDLFInput(YoutubeDLInput):
def read(self, sz):
... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
"""Utilities for test modules"""
import os, unittest, doctest
from django.core.serializers import deserialize
from django.db.models import get_apps
from django.test.simple import get_tests
from django.core import management
try:
set
except:
from sets import Set as set
def load_fixture(path, file_type='json')... |
#! /usr/bin/python
import sys
import getopt
import time
import os.path
from subprocess import call
verbosity = int(0)
evaluateonly = False
dictionaryOutputFile = ''
corpusOutputFile = ''
evaluationOutputFile = ''
vocabularyInputFile = ''
countOutputDirectory = './counts'
order = 1
nrInputFiles = int(0)
nrTrainIn... |
#!/usr/bin/env python
"""OpenCV feature detectors with ros CompressedImage Topics in python.
This example subscribes to a ros topic containing sensor_msgs
CompressedImage. It converts the CompressedImage into a numpy.ndarray,
then detects and marks features in that image. It finally displays
and publishes the new i... |
"""
Notebook management module.
"""
import os
from PyQt4.QtCore import Qt, QDir, QFile, QSettings, QSize
from PyQt4.QtGui import (QAbstractItemDelegate, QAbstractItemView, QColor, QDialog, QDialogButtonBox, QFileDialog, QFont, QGridLayout, QLabel, QLineEdit, QListWidget, QListWidgetItem, QPen, QPushButton, QStyle)
i... |
# ~*~ coding: utf-8 ~*~
from django.http import HttpResponse
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
from django.views import View
from django.views.generic.edit import UpdateView
from common.utils import get_logger, ssh_key_gen
from common.permissions import (
Perm... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
#!/usr/bin/env python
#encode=utf-8
#vim: tabstop=4 shiftwidth=4 softtabstop=4
#Created on 2013-6-7
#Copyright 2013 nuoqingyun xuqifeng
import sys
import time
import os
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir, os.pardir))
if os.path... |
#!/usr/bin/env python2
"""SSH into a running appliance and install VMware VDDK.
"""
import argparse
import sys
from urlparse import urlparse
from utils.appliance import IPAppliance
from utils.conf import env
def log(message):
print "[VDDK-INSTALL] {}".format(message)
def main():
parser = argparse.Argument... |
from django.shortcuts import render
from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse_lazy
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required
from edamame import base, utils, generic
from . import models
class SiteViews(base.... |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 Haltu Oy, http://haltu.fi
#
# 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 withou... |
import pygtk
import gtk
import pango
import cairo
import pangocairo
import logging
import math
import utility
from amirconfig import config
class PrintReport:
def __init__(self, content, cols_width, heading=None):
# self.lines_per_page = 24
self.cell_margin = 4
self.line = 2 #the thin... |
from alembic.testing.fixtures import TestBase
from alembic.testing import eq_, ne_, assert_raises_message
from alembic.testing.env import clear_staging_env, staging_env, \
_get_staging_directory, _no_sql_testing_config, env_file_fixture, \
script_file_fixture, _testing_config, _sqlite_testing_config, \
thre... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... |
import math
import scipy.signal
import numpy
from scipy.optimize import leastsq
import numpy as N
def lorenz(x,gamma,offs):
return gamma/(numpy.pi*((x-offs)**2+gamma**2))
def gauss(x,sigma,offs):
return 1/(sigma*numpy.sqrt(2*numpy.pi))*numpy.exp(-0.5*((x-offs)/sigma)**2)
def voigt(p,x):
return nu... |
## @package xbmc
# Various classes and functions to interact with XBMC.
#
"""
Various classes and functions to interact with Kodi.
"""
from builtins import str
from builtins import object
import os
import xbmcgui as _xbmcgui
_loglevel = 1
_settings = {'external_filemanaging': 'true'}
_filename = 'dummy.l... |
import argparse
import datetime
import re
import logging
from uuid import uuid4
from streamlink.plugin import Plugin, PluginError, PluginArguments, PluginArgument
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
log = logging.getLogger(__name__)
STREAM_WEIGHTS = {
"low": 240,
... |
"""createdb
Revision ID: 42026ba5bc27
Revises:
Create Date: 2017-06-22 20:07:58.548427
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '42026ba5bc27'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('entity_type'... |
"""Provides class and element handling functionality.
(c) by nobisoft 2016-
"""
# Imports
## Standard
import sys
import copy
import re
import codecs
import logging
## Contributed
## nobi
## Project
#from .MediaOrganization import MediaOrganization
# Package Variables
Logger = logging.getLogger... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import akvo.rsr.fields
def unique_organisation_names(apps, schema_editor):
"""Make sure that the organisation.name and organisation.long_name are unique."""
Organisation = apps.get_model('rsr', 'Organisation')
org_double_name = {}
org... |
from functools import lru_cache
class Solution:
def numDistinct(self, s: str, t: str) -> int:
@lru_cache(maxsize=None)
def helper(i, j):
M, N = len(s), len(t)
if i == M or j == N or M-i < N-j:
return int(j == N)
# if i of s and j of s... |
"""
Counting sort is applicable when each input is known to belong to a particular
set, S, of possibilities. The algorithm runs in O(|S| + n) time and O(|S|)
memory where n is the length of the input. It works by creating an integer array
of size |S| and using the ith bin to count the occurrences of the ith member of
S... |
import subprocess
import os
from django.core.validators import URLValidator
from nightmare_pdf.settings import pdf_settings
from django.http import (
HttpResponse,
Http404
)
from django.core.files.base import ContentFile
from .models import PdfDoc
from .utils import get_random_filename
validate_url = URLValidator(s... |
# !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2018-07-28 17:26:41
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-11-19 22:56:31
from __future__ import absolute_import, division, print_function
import abc
import os
imp... |
# Copyright 2021 The Magenta 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 applicable law or agreed to in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.