src stringlengths 721 1.04M |
|---|
"""private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from mkt.settings import (CACHE_PREFIX, ES_INDEXES,
KNOWN_PROXIES, LOGGING, HOSTNAME)
from .. import splitstrip
import private_base as private
ALLOWED_HOSTS = ['.a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Picture',
fields=[
('id', models.AutoField(prim... |
#!/usr/bin/env python
'''
Use Pexpect to change the logging buffer size(logging buffered <size>).
Verify this change by examining the output of 'show run'.
'''
import pexpect
import time
from getpass import getpass
def login(ssh_conn):
'''
Handle sending password
'''
password = getpass()
ssh_conn.... |
""""""
from flask import Flask, current_app
from flask_login import current_user
from abilian.core.models import attachment as attachments
from abilian.services.security import READ, WRITE, security
from abilian.web import url_for
from .forms import AttachmentForm
from .views import UPLOAD_BUTTON
from .views import ... |
# 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 agreed to in writing, ... |
# coding: utf-8
from __future__ import unicode_literals, division
from custodian.custodian import ErrorHandler
import re
from custodian.utils import backup
from pymatgen.io.feff.sets import FEFFDictSet
from custodian.feff.interpreter import FeffModder
import logging
""" This module implements specific error handler f... |
from . import db
from .config import AppConfig
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from sqlalchemy import desc
from itsdangerous import Serializer, BadSignature
class Location(db.Model):
id = db.Column(db.Integer... |
# Copyright 2008 Dan Collins
#
#
# This 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.
#
# And is distributed in the hope that it will... |
# Copyright (c) 2014 Dark Secret Software 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 agree... |
#
# GdbLib - A Gdb python library.
# Copyright (C) 2012 Fernando Castillo
#
# This program 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 3 of the License, or
# (at your option) any la... |
from django.core.management.base import BaseCommand
from filer.models import File, Folder
from filer import settings as filer_settings
from django.utils import timezone
from datetime import timedelta
class Command(BaseCommand):
help = "Hard-deletes old files and folders from filer trash."
def handle(self, *... |
# Nikita Akimov
# interplanety@interplanety.org
#
# GitHub
# https://github.com/Korchy/BIS
import json
import os
import tempfile
import bpy
import zipfile
from shutil import copyfile
from .WebRequests import WebRequest, WebAuthVars
from .bis_items import BISItems
from .addon import Addon
from .file_manager import F... |
"""LEGO Power Functions RC v1.20 - Single Output Mode"""
import power_functions.rc_protocol as pf_rc
# Mode Bits
MODE = ["PWM", # Mode = PWM
"CSTID"] # Mode = Clear/Set/Toggle/Inc/Dec
OUTPUT = ["RED", # Output A
"BLU"] # Output B
# Data if Mode = PWM
PWM = ["FLT", # Float
"FWD_1", ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... |
import hashlib
import json
import sys
import traceback
from datetime import datetime, timedelta
from functools import wraps
import newrelic.agent
import waffle
from constance import config
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.db.mo... |
from rest_framework import serializers
from .models import ThreadedComments
class ReplySerializer(serializers.ModelSerializer):
username = serializers.ReadOnlyField(source="user.username")
title = serializers.ReadOnlyField(source="user.userprofile.title")
avatar_url = serializers.ReadOnlyField(source="us... |
# -*- 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):
def forwards(self, orm):
# Adding model 'CommitFileChange'
db.create_table(
'sentry_com... |
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content Analysis Toolkit #
# ... |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import wx
import wx.html as html
import wx.grid as wxgrid
import wx.lib.floatbar as wxfb
import webbrowser
try:
import uibase as ui
import iodata as io
from _const_ import *
from util import isempty
except:
import nanchi.ui... |
# Copyright 2014 Nokia Siemens Networks Oyj
#
# 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... |
from django import forms
from django.utils import timezone
from ..groups.models import Group
from .models import Event
class EventForm(forms.ModelForm):
def __init__(self, *args, all_groups=False, **kwargs):
super().__init__(*args, **kwargs)
if not all_groups:
self.fields["groups"].qu... |
"""
Synfirechain-like example
"""
#!/usr/bin/python
import os
import spynnaker.pyNN as p
import spynnaker_external_devices_plugin.pyNN as q
import numpy, pylab
p.setup(timestep=1.0, min_delay = 1.0, max_delay = 144.0)
nNeurons = 3 # number of neurons in each population
max_delay = 50
cell_params_lif = {'cm' ... |
import logging
import os
import shutil
import subprocess
"""
If echo $EDITOR is None, these will be tried in order.
"""
FALLBACK_EDITORS = ['vim', 'vi']
class SpawnError(ValueError):
"""
Raised when there is a problem with calling an external programme.
"""
pass
class Spawner:
"""
Holds methods for runnin... |
import os
import sys
from boto.pyami.config import Config
from fabric.colors import red
# Load the configuration file
if os.path.exists('config.ini'):
boto_config = Config()
boto_config.load_credential_file('config.ini')
if boto_config.items('Credentials'):
AWS_ID = boto_config.get('Credentials', '... |
from django.views.generic.simple import direct_to_template
from django.views.generic.list_detail import object_detail
from django.contrib.sites.models import Site
from django.shortcuts import get_object_or_404
from django.contrib import messages
from models import EnableOpening, Opening, Candidate
from forms import Ap... |
#!/usr/bin/env python
import bootstrap
from multiprocessing import Process, Pipe
import unittest
import time
import unittest
from nark import *
class MessengerTests(unittest.TestCase):
def test_can_create_instances(self):
a, lm, rm = self.setup()
a.not_null(lm, "Failed to create local messenger")
... |
# 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 ... |
import torch.nn as nn
from torch.autograd import Variable
class RNNModel(nn.Module):
"""Container module with an encoder, a recurrent module, and a decoder."""
def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, tie_weights=False):
super(RNNModel, self).__init__()
self.drop ... |
"""
Copyright (c) 2014, Austin R. Benson, David F. Gleich,
Purdue University, and Stanford University.
All rights reserved.
This file is part of MRNMF and is under the BSD 2-Clause License,
which can be found at http://opensource.org/licenses/BSD-2-Clause
Copyright (c) 2015, Mariano Tepper,
Duke ... |
# This file is part of eddylicious
# (c) Timofey Mukha
# The code is released under the GNU GPL Version 3 licence.
# See LICENCE.txt and the Legal section in the User Guide for more information
"""Functions for generating inflow velocity fields by
interpolation of data (from a precursor).
"""
from __future__ import p... |
#@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... |
# coding=utf-8
"""
Utilities for file management.
"""
# ------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# ----------------------------------------------------------------... |
# Copyright 2016 Mirantis, 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 ... |
import unittest
from esd import ESDParser
class TestESDParserFunctions(unittest.TestCase):
def test_WinBlueParse(self):
esd = ESDParser()
esd.setEsdName('9600.17053.winblue_refresh.140923-1144_x86fre_client_professional_en-us-ir4_cpra_x86frer_en-us_esd.esd')
esd.parse()
se... |
"""
Support for Ecobee.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/ecobee/
"""
import logging
import os
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import ... |
# Under MIT License, see LICENSE.txt
from RULEngine.Game.Player import Player
from RULEngine.Util.constant import PLAYER_PER_TEAM
from RULEngine.Util.team_color_service import TeamColor
class Team():
def __init__(self, team_color, type="friend"):
self.players = {}
for player_id in range(PLAYER_PER... |
# Copyright (C) 2014 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... |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... |
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db import models
from domain import Permissions
from wqm.models import WqmAuthority
from locations.models import LocationType
##############################... |
import urllib,urllib2,re,cookielib,sys,os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
from t0mm0.common.addon import Addon
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
addon = Addon('plugin.video.movie25', sys.argv)
art = main.a... |
from eventlet_raft.client import RaftClient
server_address_list = [
('127.0.0.1', 4000),
('127.0.0.1', 4001),
('127.0.0.1', 4002),
('127.0.0.1', 4003),
('127.0.0.1', 4004),
]
def write_log(log, data, msg):
log.write("{0}: {1}\n".format(
msg,
str(data),
))
client = RaftCl... |
# Copyright 2015 OpenStack Foundation
# 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 requ... |
# TODO: Determine which tests are valid for GLSAR, and under what conditions
# TODO: Fix issue with constant and GLS
# TODO: GLS: add options Iterative GLS, for iterative fgls if sigma is None
# TODO: GLS: default if sigma is none should be two-step GLS
# TODO: Check nesting when performing model based tests, lr, wald,... |
from glob import glob
import sys
import os
from subprocess import Popen
import numpy
#params = 'build_ext -inplace -IC:\clones\cubature\cubature ' + ' '.join(sys.argv[1:])
params = 'build_ext --inplace -I%s' % numpy.get_include() + ' '.join(sys.argv[1:]) + ' clean'
cwd = os.getcwd()
if os.name == 'nt':
use_sdk =... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-09 18:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0016_auto_20170106_2126'),
]
operations = [
migrations.AddFiel... |
import plotly
from plotly.graph_objs import Scatter, Layout, Bar, Figure
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import plotly.graph_objs as go
'''
class VisualizationStrategy:
def __init__(self):
pass
# Homemade enumeration
Plot, CSV, ASCII = range(3)
'''
import random
c... |
# -*- coding: utf-8 -*-
#Documentation
#This 'model' adds new fields to 'product.template'.
#'product.template' is the main Product model.
from odoo import tools
from odoo import models, fields, api
class RoyaltiesReport(models.Model):
#_inherit = ['sale.report', 'sale.order']
_inherit = 's... |
"""
@Author: Kiran Gurajala & Alex Lee
@Project: Project Automail
@Version: 1.0
"""
# required imports
import sys
# Append Path
sys.path.append('../lib/')
import serial
import platform
import struct
class Arduino():
# serial object initialized to null
serial = None
# Returns connected Arduino serial port
def ge... |
# Copyright 2010 Matt Chaput. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... |
import unittest
import utils
# O(mn) time. O(mn) space. DP.
class Solution:
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
m = len(grid)
n = len(grid[0])
# dp[i][j]: the minimal sum of path to reach (i, j)
dp = [[0] * n ... |
import numpy as np
import pandas as pd
from pandas.core.dtypes.common import (
is_scalar,
is_numeric_dtype,
is_decimal,
is_datetime_or_timedelta_dtype,
is_number,
_ensure_object)
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass
from pandas.core.dtypes.cast import maybe_downcast_to... |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... |
# Copyright (c) 2015 Ian C. Good
#
# 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, publish, distrib... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Big Switch Networks, 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/lice... |
from functools import wraps
import time
from django.http import Http404, HttpResponseBadRequest
from .models import ApiKey
from .utils import get_signature, get_settings_param, \
SERVER_TIME_STAMP_KEY, SERVER_API_SIGNATURE_KEY, SERVER_API_KEY
def signed_req_required(view_func):
def check_signature(request, ... |
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
from popupcad.geometry.vertex import ShapeVertex
import numpy
import qt.QtCore as qc
import qt.QtGui as qg
from dev_tools.enum import enum
import popupcad
class ShapeInvalid... |
#!/usr/bin/env python
class Solution:
# @param board, a list of lists of 1 length string
# @param word, a string
# @return a boolean
def exist(self, board, word):
def valid(board, mark, i, j, dir, c):
i1 = i
j1 = j
if dir == 0:
i1 += 1
... |
"""
MSM Network Plot
================
"""
from msmbuilder.example_datasets import FsPeptide
from msmbuilder.featurizer import DihedralFeaturizer
from msmbuilder.decomposition import tICA
from msmbuilder.cluster import MiniBatchKMeans
from msmbuilder.msm import MarkovStateModel
import numpy as np
import msmexplorer as... |
# -*- coding: utf8 -*-
"""
Asynchronous Advantage Actor Critic (A3C)
Most of the work is done in `a3c_worker.py`.
Based on:
- Pseudo code from Asynchronous Methods for Deep Reinforcement Learning
- Tensorflow code from https://github.com/yao62995/A3C/blob/master/A3C_atari.py and
https://github.com/openai/universe-st... |
import asyncio
import discord
from discord.ext import commands, tasks
from .exceptions import APIError, APIKeyError
class WorldsyncMixin:
@commands.guild_only()
@commands.has_permissions(manage_guild=True)
@commands.group(case_insensitive=True)
async def worldsync(self, ctx):
"""Role managem... |
"""
Parse and transform a simplified query syntax into
MongoDB queries.
"""
__author__ = "Dan Gunter"
## Imports
# Standard library
import copy
from numbers import Number
import re
class BadExpression(Exception):
"""Raised by `query()` if the input is not understood.
"""
def __init__(self, expr, details=... |
#!/usr/bin/env python2
from gi.repository import Gtk, Gdk, GLib
from SettingsWidgets import *
class Module:
comment = _("Control mouse and touchpad settings")
name = "mouse"
category = "hardware"
def __init__(self, content_box):
keywords = _("mouse, touchpad, synaptic, double-click")
... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import stat
from catapult_base import cloud_storage
from catapult_base.dependency_manager import exceptions
class CloudStorageInf... |
import unittest
from chain_of import *
#Las pruebas del chain of responsability, como lo que devuelve al final es un print y no un return, lo que me da es un None por eso se compara con un None para que pase,
#se que no esta bien, pero se que si pasaria la prueba si supiera implementar el unittest para prints con el m... |
# Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. 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
#
# ... |
#!/usr/bin/env python
# corestats.py (COREy STATS)
# Copyright (c) 2006-2007, Corey Goldberg (corey@goldb.org)
# updated on 2010-09 by GrosBedo
#
# statistical calculation class
# for processing numeric sequences
#
# license: GNU LGPL
#
# This library is free software; you can redistribute it and/or
# mod... |
import collections
import fastzbarlight
import itertools
import logging
from multiprocessing import pool
import numpy as np
import time
import threading
# import psutil
import sys
from collections import namedtuple
from gym.utils import reraise
import re
from universe import error, pyprofile, spaces
# TODO: prefix th... |
#!/usr/bin/env python
# coding: utf-8
import pytest
import os
import warnings
from pandas import DataFrame, Series
from pandas.compat import zip, iteritems
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.api import is_list_like
import pandas.util.testing as tm
from pandas.util.testing impor... |
import uuid
import re
from flask import Flask, redirect, render_template, g, abort, request, make_response
from flask_ink.ink import Ink
from flask_caching import Cache
from .settings import SETTINGS, CACHE_SETTINGS
from .repository import LocalRepository
from .parsers import BlogParser
from .pagination import BlogPa... |
__author__ = 'jmoran'
from Asteroids import Object, Bullet
import math
from Asteroids.Colors import *
class Ship(Object):
radius = 20
def __init__(self, window, game):
Object.__init__(self, window, game)
self.point = (self.wWidth / 2, self.wHeight / 2)
self.start_point = self.point
... |
# -*- coding: utf-8 -*-
from bda.plone.cart import CartItemDataProviderBase
from bda.plone.cart import CartItemPreviewAdapterBase
from bda.plone.cart.interfaces import ICartItemStock
from bda.plone.orders.interfaces import IBuyable
from bda.plone.orders.interfaces import ITrading
from bda.plone.shipping.interfaces impo... |
# -*- coding: utf-8 -*-
#
# HAIL-CAESAR documentation build configuration file, created by
# sphinx-quickstart on Sun Jul 16 10:54:36 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... |
"""
FitPanel class contains fields allowing to fit models and data
:note: For Fit to be performed the user should check at least one parameter
on fit Panel window.
"""
import wx
import wx.lib.newevent
from wx.aui import AuiNotebook as Notebook
import datetime
from bumps.gui.convergence_view import Convergence... |
# -*- coding: utf-8 -*-
'''文件说明:极简日志系统-桌面版
作者信息:yangshaoshun
版本自述:v1.3
更新:添加了滚动条,解决了内容超过显示框不自动跟随的问题
待解决问题1:因为 idle 编码问题,mac下无法输入中文 (windows下可以运行,tk版本为8.5 python为2.7.1)
待解决问题2:不止输入一行字符,使用 txt 输入一段文字,甚至可以输入 md 格式,下面展示转换后的内容
代办事项:书写 readme.md
代办事项2:docopt 的使用
'''
#全局引用
from Tkinter import *
from ttk import *
from sys impo... |
# Copyright 2017 The Forseti Security 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 ap... |
from builtins import str
from pySparkUtils.utils import change
import pytest
pytestmark = pytest.mark.usefixtures("eng")
def test_ip_wait(eng):
with pytest.raises(RuntimeError) as ex:
_ = change(sc=eng, master='local[2]', fail_on_timeout=True, wait='ips', min_ips=10, timeout=4)
assert 'Time out' in st... |
# Copyright (c) 2001 Autonomous Zone Industries
# This file is licensed under the
# GNU Lesser General Public License v2.1.
# See the file COPYING or visit http://www.gnu.org/ for details.
__revision__ = "$Id: CommHints.py,v 1.2 2002/12/02 19:58:44 myers_carpenter Exp $"
### standard modules
import types
# T... |
#!/usr/bin/python3
import os, sqlite3, json, time
# Got some great tips from:
# http://www.pythoncentral.io/introduction-to-sqlite-in-python/
# Class to manage all database operations
class Database:
# Create a new database connection _
def __init__(self, dbfile, dbstruct, ignore='locals'):
self.msg =... |
#!/usr/bin/env python
import sys
fn = sys.argv[1] #input file with temporal hierarchies
#format input file
#[Hierarchies]
#1>2>t1
#3>4>t2
#[UA0]
#u1 2 4 3 > t1
#u2 2 4 3 > t1
#u9 4 2 > t5
#rs 1 > t1 # for initial enabled roles
#rs 2 > t1
#[Rules]
#can_assign
#can_revoke
on = sys.argv[2] #output file with no hier... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# p6spy documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 7 22:33:59 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... |
import numpy as np
from astropy.io import fits
import os
# TODO: rewrite this to have multiple components generated here.
# Having a bundle of test filaments would be very nice.
def make_test_cube(shape=(30,9,9), outfile='test.fits',
sigma=None, seed=0, writeSN=False ):
"""
Generate... |
"""
signals are sent for each event Stripe sends to the app
Stripe docs for Webhooks: https://stripe.com/docs/webhooks
"""
from django.dispatch import Signal
webhook_processing_error = Signal(providing_args=["data", "exception"])
# A signal for each Event type. See https://stripe.com/docs/api/events/types
WEBHOOK_S... |
"""Url patterns for data render app."""
from django.conf.urls import url
from pychart_datarender.views import (
GalleryView,
DataDetailView,
RenderDetailView,
DataLibraryView,
EditDataView,
EditRenderView,
AddDataView,
AddRenderView,
retrieve_data,
render_data,
save_render,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# movie_converter.py
"""
Convert from shitty amira format to clean format
Copyright David Hoffman, 2019
"""
import cv2
import glob
import dask
import os
new_ext = "_conv.mpg"
def update_path(path):
return path.replace(".mpg", new_ext)
@dask.delayed
def convert_fi... |
#
# See the notes for the other physics sample
#
from pyfrc.physics import drivetrains
class PhysicsEngine(object):
'''
Simulates a 4-wheel robot using Tank Drive joystick control
'''
def __init__(self, physics_controller):
'''
:param physics_controller: `pyfrc.physics.core.P... |
# 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 ... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This script is executed on taskcluster as a "decision task". It will schedule
# individual tasks for taking screenshot... |
import uuid
from django.db import models
from django.contrib.auth.models import User
#from taggit.managers import TaggableManager
from core.models import TimestampedModel, UUIDModel
QUIZ_TYPES = (
(1, 'SHORT_ANSWER'),
(2, 'MCQ'),
)
class Quiz(TimestampedModel, UUIDModel):
question_input = models.Text... |
import os
import sys
from cli import CLI
from log import LOG
from core import SimpleVirtuosoMigrate
from virtuoso import Virtuoso
from config import Config
class Main(object):
""" Call all execution modules """
def __init__(self, config):
if not Main._valid_version():
print "You need to ... |
#!/usr/bin/env python
import vtk
import numpy as np
from vmtk import vmtkscripts
import argparse
import itertools
import os
# clip boxes along the surface
# calculate basis from vector
# Tom Duff, James Burgess, Per Christensen, Christophe Hery, Andrew Kensler, Max Liani, and Ryusuke Villemin, Building an Orthonorma... |
# -*- coding: utf-8 -*-
"""
pidSim2.py
A simulation of a vision control to steering PID loop accounting for communication and
processing latency and variation; demonstrates the impact of variation
to successful control.
THIS VERSION models the control as a 1st order input (velocity)
and then integrates once to get po... |
#
# Monitor a URL continuously, providing
# reports on its availability in a log file
# and as a web page.
#
import json
import logging
import sys
from twisted.internet import task
from twisted.internet import reactor
from twisted.web import server, resource
import urllib2
config = {}
log = logging.getLogger(__name_... |
from unittest import TestCase
from Crypto.PublicKey import RSA
from lib.xecrypt import XeCryptBnQw_SwapLeBe, XeCryptBnDw_SwapLeBe, XeCryptBnQw, XeCryptBnQw_toInt, XeCryptBnQwNeMod
from lib.xecrypt_rsa import XeCrypt_RSA
from lib.xecrypt import XeCryptRotSum, RotSumCtx
from lib.xecrypt import XeCryptRotSumSha
class ... |
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, 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 ... |
# -*- coding: utf-8 -*-
import arrow
from .arrow import ArrowUtil
from .data_handler import DataHandler
class State(object):
FLOW = "flow"
MEMORY = "memory"
ACTION = "action"
SLEEP = "sleep"
REST = "rest"
def __init__(self):
self.data_handler = DataHandler()
self.fname = "s... |
# defunct partion finder functions
def configure_PF(alignment_file, user_tree = '', branchlengths = 'linked', models='GTR+G', criteria = 'aicc', partition = '', search = 'kmeans'):
# Create a partition_finder.cfg file
cfg = open('partition_finder.cfg', 'w')
cfg.write("# ALIGNMENT FILE #\n")
cfg.write(... |
import sys
from collections import defaultdict
import time
import vim
try:
from .common import shared as G
from .common import msg
except (ImportError, ValueError):
import common.shared as G
from common import msg
timeouts = defaultdict(list)
top_timeout_id = 0
cancelled_timeouts = set()
calling_tim... |
"""
Operators
"""
from errors import InvalidArgumentsForOperator, MatlabetteRuntimeError
import numpy
class Operators(object):
@staticmethod
def add(lhs, rhs):
if isinstance(lhs, float):
if isinstance(rhs, float):
return lhs + rhs
if isinstance(rhs, list):
... |
import mock
import simplejson as json
from sqlalchemy import select
from auslib.blobs.base import createBlob
from auslib.global_state import dbo
from auslib.test.admin.views.base import ViewTest
class TestReleasesAPI_JSON(ViewTest):
def testGetRelease(self):
ret = self._get("/releases/b")
self.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.