src stringlengths 721 1.04M |
|---|
"""Accounts API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class AccountsAPI(BaseCanvasAPI):
"""Accounts API Version 1.0."""
def ... |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Julien Veyssier
#
# This file is part of weboob.
#
# weboob 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 yo... |
# Copyright (C) 2013-2015 Samuel Damashek, Peter Foley, James Forcier, Srijay Kasturi, Reed Koser, Christopher Reffett, and Fox Wilson
#
# 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 ve... |
from . import base
from grow.common import utils
from protorpc import messages
import logging
import os
import re
if utils.is_appengine():
sass = None # Unavailable on Google App Engine.
else:
import sass
SUFFIXES = frozenset(['sass', 'scss'])
SUFFIX_PATTERN = re.compile('[.](' + '|'.join(map(re.escape, SUFF... |
# -*- coding: utf-8 -*-
import qiniu.config
import logging
from qiniu import Auth, put_data, etag, urlsafe_base64_encode
#需要填写你的 Access Key 和 Secret Key
access_key = 'btZDjv_qjI4O1P5-KKeaZXBGLJcM-AZfigN8HjQf'
secret_key = 'j2Sgq1Pz-1O90OoFSKr24Xa80mVWqzpqbo-byiN5'
#要上传的空间
bucket_name = 'ihome'
def storage(data):
... |
# Copyright 2020, The TensorFlow Federated 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 o... |
# Copyright 2017 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... |
"""An implementation of Spatial GRU Layer."""
import typing
import tensorflow as tf
from keras import backend as K
from keras.engine import Layer
from keras.layers import Permute
from keras.layers import Reshape
from keras import activations
from keras import initializers
class SpatialGRU(Layer):
"""
Spatial ... |
from setuptools import setup
setup(
name='simian',
version='2.0.0',
packages=('simian',),
url='https://github.com/themattrix/python-simian',
license='MIT',
author='Matthew Tardiff',
author_email='mattrix@gmail.com',
install_requires=('mock', 'contextlib2'),
tests_require=('nose', 'f... |
"""
Utility module standardized on ElementTree 2.6 to minimize dependencies
in python 2.4 systems.
Often operations on XML files suggest making a backup copy first is a
prudent measure. However, it's easy to loose track of these temporary
files and they can quickly leave a mess behind. The TempXM... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... |
"""Sensor for checking the battery level of Roomba."""
import logging
from homeassistant.components.vacuum import STATE_DOCKED
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.icon import icon_for_battery_level
from .const import BLID, DOMAIN, ROOMBA_SESSION
from .irobot_bas... |
#-
# Copyright (c) 2012 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... |
import glob
import logging
import os
import pathlib
import stat
import subprocess
import pytest
__maintainer__ = 'gpaul'
__contact__ = 'dcos-security@mesosphere.io'
@pytest.mark.supportedwindows
def test_verify_units():
"""Test that all systemd units are valid."""
def _check_units(path):
"""Verify a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('loja', '0009_auto_20161117_2110'),
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
... |
from flask import Flask, render_template, request, redirect, url_for
app = Flask(__name__)
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Restaurant, MenuItem
engine = create_engine('sqlite:///restaurantmenu.db')
Base.metadata.bind = engine
DBSession = s... |
import re
from vint.ast.node_type import NodeType
from vint.linting.level import Level
from vint.linting.policy.abstract_policy import AbstractPolicy
from vint.linting.policy_registry import register_policy
@register_policy
class ProhibitEncodingOptionAfterScriptEncoding(AbstractPolicy):
def __init__(self):
... |
# This file is part of project Sverchok. It's copyrighted by the contributors
# recorded in the version control history of the file, available from
# its original location https://github.com/nortikin/sverchok/commit/master
#
# SPDX-License-Identifier: GPL3
# License-Filename: LICENSE
from __future__ import annotation... |
import gzip
import json
import sys
import os
import io
import copy
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatches
import math
'''
name_dict = {0:"DeleteElemFromSingleton", 1:"DeleteKeyFromSingleton", 2:"DeleteSingletonFromArray", \
3:"DeleteElemFrom... |
"""Assignment 1."""
from assignment_1_eval import pairs
vowels = ['a', 'e', 'i', 'o', 'u']
es_sounds = ['ch', 's', 'z']
no_change = [
'economics', 'mathematics', 'statistics', 'luggage',
'baggage', 'furniture', 'information', 'gymnastics', 'news']
always_singular = ['fish', 'barracks', 'deer',... |
import components
def ConvertedAclFwTest ():
"""ACL firewall test"""
ctx = components.Context (['a', 'b', 'c', 'd', 'fw'],\
['ip_a', 'ip_b', 'ip_c', 'ip_d', 'ip_f'])
net = components.Network (ctx)
a = components.EndHost(ctx.a, net, ctx)
b = components.EndHost(ctx.b, ne... |
# -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... |
from copy import deepcopy
def test_get_item(data):
"test the different ways that an item can be referenced"
#key based lookup
spi = data['spi']
#attribute based
cfg0 = spi.cfg0
print(f'cfg: {cfg0}')
field = spi.cfg0['bf0']
field = spi.cfg0.bf0.bf
#field = spi.bf0
print(field)
... |
# -*- coding: utf-8 -*-
from django import http
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.shortcuts import render_to_... |
# 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 w... |
import getpass
import pkg_resources
from trac.admin import IAdminPanelProvider
from trac.core import *
from trac.config import Option, BoolOption
from trac.perm import IPermissionRequestor
from trac.util.translation import _
from trac.web.chrome import ITemplateProvider
from trac.web.chrome import add_notice, add_warn... |
import os
import pytest
try:
import attic.repository
import attic.key
import attic.helpers
except ImportError:
attic = None
from ..upgrader import AtticRepositoryUpgrader, AtticKeyfileKey
from ..helpers import get_keys_dir
from ..key import KeyfileKey
from ..archiver import UMASK_DEFAULT
from ..repos... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# File: pyvle.py
# Author: The VLE Development Team.
# Brief: Python wrapper of VLE
#
# VLE Environment - the multimodeling and simulation environment
# This file is a part of the VLE environment (http://vle-project.org)
# Copyright (C) 2003 - 2017 The VLE Development ... |
#
# Copyright European Organization for Nuclear Research (CERN)
# All rights reserved
#
# Author: Vasilis.Vlachoudis@cern.ch
# Date: 15-May-2004
from __future__ import generators
from __future__ import absolute_import
__author__ = "Vasilis Vlachoudis"
__email__ = "Vasilis.Vlachoudis@cern.ch"
import random
from ma... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 GNS3 Technologies 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 3 of the License, or
# (at your option) any later version.
... |
""" JobStateUpdateHandler is the implementation of the Job State updating
service in the DISET framework
The following methods are available in the Service interface
setJobStatus()
"""
from __future__ import absolute_import
import six
from six.moves import range
__RCSID__ = "$Id$"
import time
from DI... |
#!/usr/bin/env python3
import time
from helpers import *
def test_keyinsert(syncdbs, syncdata):
""" Merge drivers, delete on one while linking to a car on the other, should undelete driver and maintain car """
syncx, mergex = syncdbs
testid = '00000000-0000-0000-0000-000000000042'
testcid = '0000000... |
import unittest
from mock import patch, Mock
from StringIO import StringIO
from collections import namedtuple
from iceit.backends import S3Backend, S3ResponseError, GlacierBackend
class TestS3Backend(unittest.TestCase):
"""
Tests for the S3 backend
"""
def test_init_valid(self):
"""
Te... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
import datetime
import itertools
from abc import abstractmethod
from singer import record_counter, Counter, Schema, write_schema, write_record
from singer.metrics import Metric, Tag
import tap_mailchimp.logger as logger
from .client import Status
from .utils import clean_links, fix_blank_date_time_format, tap_start_dat... |
from ..symbol import Symbol
from ...address_translator import AT
class ELFSymbol(Symbol):
"""
Represents a symbol for the ELF format.
:ivar str elftype: The type of this symbol as an ELF enum string
:ivar str binding: The binding of this symbol as an ELF enum string
:ivar section: ... |
# Maked by Mr. Have fun! Version 0.2
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
#NPC
TALLOTH = 7141
#ITEMS
ONYX_BEAST_EYE = 1081
TAINT_STONE = 1082
SUCCUBUS_BLOOD ... |
# Copyright 2014 DreamHost, LLC
#
# Author: DreamHost, 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 applicabl... |
from ereuse_devicehub.resources.account.settings import unregistered_user, unregistered_user_doc
from ereuse_devicehub.resources.event.device.settings import EventWithDevices, \
EventSubSettingsMultipleDevices, materialized_components
class Allocate(EventWithDevices):
to = {
'type': ['objectid', 'dict... |
"""
This script reads one of the .dat files generated by the fractal generator,
iterates over each point in the complex grid and assigns each complex point a
color based on a color_function and a color_palette.
"""
from PIL import Image
import sys
sys.path.append('../color_functions/')
from color_func import ColorFunc... |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.optimization.optimizer import BlackBoxOptimizer, TopologyOptimizer
from pybrain.optimization.hillclimber import HillClimber
from pybrain.structure.evolvables.maskedparameters import MaskedParameters
class MemeticSearch(HillClimber, TopologyOptimizer):
""" Inte... |
"""
Code to sum characteristics of events split by either time or speed and write
out the results to a table.
Author: Rachel H White rachel.white@cantab.net
Created: Oct 2016
Example use:
python CalculateLand_vs_SeaAverages.py --Data TRMM --Version Standard \
--anstartyr 1998 --anendyr 2014 \
--tbound1 0 1 2 5 --tbou... |
# MediaCMN - Tools to create a consistent music library.
# Copyright (C) 2009 Konstantin Weitz
#
# 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 op... |
#
# Copyright (c) SAS Institute 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 w... |
"""Ocrlab forms."""
from django import forms
from django.template.defaultfilters import filesizeformat
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from ocrlab.models import Preset
# Add to your settings file
CONTENT_TYPES = ['image', 'video']
# 2.5MB - 2621440
# 5MB - 524... |
import logging
import time
from django.contrib.auth.models import User
from django.db import transaction
from django.utils.translation import ugettext as _
from student.models import CourseEnrollment
from biz.djangoapps.ga_contract_operation.models import ContractTaskHistory, StudentUnregisterTaskTarget
... |
#!/usr/bin/env python
"""Chainer example: train a multi-layer perceptron on MNIST
This is a minimal example to write a feed-forward net. It requires scikit-learn
to load MNIST dataset.
"""
import argparse
import numpy as np
import six
import chainer
from chainer import computational_graph as c
from chainer import c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from subprocess import PIPE, Popen
import platform
import os
import sys
import re
import zlib
from socket import socket
from socket import AF_INET, SOCK_STREAM, SHUT_RDWR
from socket import SOL_SOCKET, SO_REUSEADDR
localhost = '127.0.0.1'
allhosts = '0.0.0.0'
i... |
# Copyright 2017 The Oppia 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 applicable ... |
"""This version uses a traditional event-driven version,
using continuation passing style. Each method call is passed
a completion callback and an error callback
"""
from statistics import median
import json
import asyncio
import random
import time
import hbmqtt.client
from collections import deque
from antevents.base... |
"""
This file is for aggregation records from Rating,Agg tables to Agg and TotalRate table
"""
import logging
from datetime import datetime, timedelta
from django_ratings.models import Rating, Agg, TotalRate
logger = logging.getLogger('django_ratings')
# aggregate ratings older than 2 years by year
DELTA_TIME_YEAR ... |
from __future__ import print_function
from __future__ import division
__author__ = """Alex "O." Holcombe""" ## double-quotes will be silently removed, single quotes will be left, eg, O'Connor
import numpy as np
import itertools #to calculate all subsets
from copy import deepcopy
from math import atan, pi, cos, sin, sqr... |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... |
from __future__ import absolute_import
try:
import configparser
except:
import ConfigParser as configparser
class _NotSet(object):
pass
class ConfigException(Exception):
pass
class Config:
def __init__(self, conffile):
self.conffile = conffile
self.conf = configparser.ConfigP... |
# Copyright (c) 2008 Agostino Russo
#
# Written by Agostino Russo <agostino.russo@gmail.com>
#
# This file is part of Wubi the Win32 Ubuntu Installer.
#
# Wubi is free software; you can redistribute it and/or modify
# it under 5the terms of the GNU Lesser General Public License as
# published by the Free Software Found... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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 os
import re
import random
import hashlib
import hmac
from string import letters
import mimetypes
import webapp2
import jinja2
from google.appengine.ext import db
import webbrowser
from urllib2 import urlopen
import requests
from bs4 import BeautifulSoup
import json
import html5lib
template_dir = os.path.join(os... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
# -*- coding: utf8 -*-
# This file is a part of OpenVPN-UAM
#
# Copyright (c) 2015 Thomas PAJON, Pierre GINDRAUD
#
# 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, includ... |
# -*- coding: utf-8 -*-
"""
Various loaders.
"""
from __future__ import absolute_import
import fnmatch
import pkg_resources
from logging import getLogger
from glob import iglob
from os.path import exists
from os.path import join
from os.path import relpath
from os.path import sep
from os import walk
logger = getLog... |
from . import polygon2d
def render_svg(obj, filename):
polygons = polygon2d.polygon(obj)
with open(filename, "w") as fp:
box = obj.bounding_box()
box_size = box.size()
fp.write('<svg xmlns="http://www.w3.org/2000/svg" ')
fp.write('width="{}mm" height="{}mm" '.format(box_size.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import latin_noun
import latin_pronoun
import latin_adj
import latin_conj
import latin_prep
import latin_verb_reg
import latin_verb_irreg
import util
class LatinDic:
dic = {}
auto_macron_mode = False
def flatten(text):
return text.replace(u'ā',u'a').replac... |
# -*- coding: utf-8 -*-
# Copyright 2017 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 require... |
#!/usr/bin/env python
"""
cpuinfo
Copyright 2002 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) license. See LICENSE.txt that came with
this distribution for specifics.
NO WARRANTY IS EXP... |
import bpy
import json
import os
import glob
import platform
import zipfile
import re
import subprocess
import webbrowser
import numpy as np
import arm.lib.armpack
import arm.make_state as state
import arm.log as log
class NumpyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.ndarra... |
import os
from kokekunster.settings import BASE_DIR
# Settings for development environment
DEBUG = True
ALLOWED_HOSTS = ['*']
# "Secret" cryptographic key, only used during local development
SECRET_KEY = 'fc4_hb-wi32l^c&qpx6!m)o*xd(4ga$13(ese#pfj#pjxnmt0p'
# Database
# https://docs.djangoproject.com/en/1.8/ref... |
from __future__ import unicode_literals
import requests
from django.db import models
class SlackWebhook(models.Model):
url = models.URLField()
username = models.CharField(max_length=255, null=True, blank=True)
icon_emoji = models.CharField(max_length=255, null=True, blank=True)
channel = models.CharF... |
#!/usr/bin/env python
import inkex
import os
import gettext
_ = gettext.gettext
from simplestyle import *
#styles
ArmatureTitleStyle = { 'font-family' : 'arial', 'font-size' : '24pt' } #'text-align' : 'center', 'text-anchor' : 'middle',
ArmatureSubTitleStyle = { 'font-family' : 'arial', 'font-size' : '18pt','font-sty... |
import pytest
import zmq
from mdbase import constants
from mdbase.broker import MajorDomoBroker
from mdbase.worker import MajorDomoWorker
@pytest.fixture
def broker_url():
return "tcp://localhost:6666"
class TestMajorDomoWorker():
def test_instantiate(self, broker_url):
"""Test instantiating worker ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from collections import OrderedDict
from django.forms import widgets
from cmsplugin_cascade import app_settings
from cmsplugin_cascade.plugin_base import CascadePluginBase
from cmsplugin_cascade.utils import compute_aspect_ratio, get_image... |
import os
import glob
import sysconfig
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('requirements.txt') as f:
requirements = f.read().splitlines()
with open('nmrpy/version.py') as f:
exec(f.read())
# data files for tests
data_path = 'test_data'... |
#!/usr/bin/python
import io
import picamera
import datetime
import MySQLdb as mdb
import sys
import serial
from PIL import Image
import os
import time
import subprocess
from cStringIO import StringIO
id_card = []
mylist = []
param1 = "/dev/ttyUSB0"
param2 = "9600"
ard = serial.Serial(param1, param2, timeout=.1)
a=55
st... |
from __future__ import print_function
import sys, argparse, selenium, contextlib, os, json, traceback
from datetime import datetime as DateTime
from datetime import timedelta as TimeDelta
from selenium.webdriver import Remote as WebDriverRemote
from selenium.webdriver.support.ui import WebDriverWait
class Selenibench... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# 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
#... |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
"""Tests pleaseTurnOver, pageBreakBefore, frameBreakBefore, keepWithNext...
"""
__version__='''$Id$'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import sys
import unitte... |
import math
import torch
from torch.nn.parameter import Parameter
from .module import Module
class Linear(Module):
r"""Applies a linear transformation to the incoming data: :math:`y = Ax + b`
Args:
in_features: size of each input sample
out_features: size of each output sample
bias:... |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 (a... |
# coding=utf-8
"""
You are on an infinite grid of squares, sort of like New York City.
Walk in any direction, N, S, E, W. At intersections, pick a route at random, but not doubling back.
On average how long will it take to get back to the starting point?
How often does it fail to return to the starting point after x... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.models import Device, Variable
from pyscada.visa.models import VISAVariable, VISADevice, VISADeviceHandler, ExtendedVISAVariable, ExtendedVISADevice
from django.dispatch import receiver
from django.db.models.signals import post_save
import ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
libreoffice = [
{'name':'common',
'mainpackage':True,
'shortdesc':'Installs LibreOffice',
'description':'',
'side-by-side':['german', 'english', 'gnome', 'kde'],
'packages'... |
# -*- coding: utf-8 -*-
from ..utils import set_local_roles
from datetime import datetime
from docpool.base.content.documentpool import APPLICATIONS_KEY
from docpool.config import _
from docpool.config.general.elan import connectTypesAndCategories
from docpool.config.local.base import CONTENT_AREA
from docpool.config.u... |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
from common_helper_files import get_binary_from_file
from hashlib import sha256
import os
import time
import logging
import magic
import sys
def generate_uid(file_path):
file_data = get_binary_from_file(file_path)
if file_data == b'' or type(file_data) is not bytes:
return "0_0"
file_hash = sha256... |
import unittest
from collections import namedtuple
from pywps import Process, Service, LiteralInput, ComplexInput, BoundingBoxInput
from pywps import LiteralOutput, ComplexOutput, BoundingBoxOutput
from pywps import E, WPS, OWS, OGCTYPE, Format, NAMESPACES, OGCUNIT
from pywps.inout.literaltypes import LITERAL_DATA_TYPE... |
from tests.modules.ffi.base import BaseFFITest
from topaz.modules.ffi.type import type_names, aliases
from rpython.rlib import clibffi
import sys
if sys.platform == 'darwin':
ext = 'dylib'
libm = 'libm.' + ext
libc = 'libc.' + ext
else:
libm = 'libm.so'
libc = 'libc.so.6'
substitutions = {}
code... |
# -*- coding: utf-8 -*-
import datetime
import gevent
import psutil
import logging
from gevent import monkey
from psutil import (
AccessDenied,
NoSuchProcess,
)
from koenig import koenig_thrift
from koenig.models import RuntimeProfile
from koenig.utils import (
profile_,
serialize,
datetime2utc... |
import tensorflow as tf
import tensorflow.contrib.layers as cl
from gridconv_v3 import gridconv2d
from deformconv import deformconv2d
from utils import log_weights
# # # # # # # # # CIFAR # # # # # # # # #
# The network is built based on 'NCHW'.
def normal_cnn_cifar(name, reuse=False):
@log_weights
d... |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2015 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... |
#
# Cassandra Cluster Management lib
#
import os
import platform
import re
import shutil
import socket
import stat
import subprocess
import sys
from six import print_
import time
import yaml
import fnmatch
BIN_DIR= "bin"
CASSANDRA_CONF_DIR= "conf"
DSE_CASSANDRA_CONF_DIR="resources/cassandra/conf"
OPSCENTER_CONF_DIR= ... |
# coding=utf-8
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright 2014 International Business Machines Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance ... |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
import os
##############################################################################
# ... |
import unittest
import transaction
import datetime
from pyramid import testing
from .models import DBSession, Log
from www.views import *
def _initTestingDB():
from sqlalchemy import create_engine
from www.models import (
DBSession,
Log,
Base
)
engine = create_engine('sqlit... |
import random
from django.contrib.auth.decorators import user_passes_test
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.db.models.aggregates import Count
from django.http.response import JsonResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404
fro... |
# coding: utf8
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
import models
class SSUserAdmin(admin.StackedInline):
model = models.SSUser
fk_name = 'user'
class UserAdmin(BaseUser... |
from __future__ import division
def ratioSelection(data = [],n=0,M=0):
for i in range(n):
if M < data[i][1]:
data[i][2] = M/data[i][1]
break
else:
data[i][2] = 1
M = M - data[i][1]
return data
def calculateProfit(data,n):
profit = 0.0
for i in range(n):
profit = profit + data[i][0]*data[i][2]
... |
"""
Class of n-link arm in 3D
Author: Takayuki Murooka (takayuki5168)
"""
import numpy as np
import math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
class Link:
def __init__(self, dh_params):
self.dh_params_ = dh_params
def transformation_matrix(self):
theta = self... |
"""
omdb
----
Python wrapper for OMDbAPI.com.
Documentation: https://github.com/dgilland/omdb.py
"""
from setuptools import setup
setup(
name='omdb',
version='0.1.1',
description='Python wrapper for OMDb API: http://www.omdbapi.com/',
long_description=__doc__,
author='Derrick Gilland',
autho... |
import os
import sys
import string
from SCons.Script import *
BuildOptions = {}
Projects = []
Rtt_Root = ''
Env = None
def _get_filetype(fn):
if fn.rfind('.c') != -1 or fn.rfind('.C') != -1 or fn.rfind('.cpp') != -1:
return 1
# assimble file type
if fn.rfind('.s') != -1 or fn.rfind... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
José F. R. Fonseca
See Attached License file
Controls the access to the disk. Defines the class DIskAccessControl,
an object to control the disk files. Multithread-writes the files
'''
import ast
import os
import time
from linecache import getline
from threading impor... |
# From http://gbeced.github.io/pyalgotrade/docs/v0.17/html/bitstamp_example.html
# Accessed 06/25/16 @ 1046Z
from pyalgotrade.bitstamp import barfeed
from pyalgotrade.bitstamp import broker
from pyalgotrade import strategy
from pyalgotrade.technical import ma
from pyalgotrade.technical import cross
class Strategy(st... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.