src stringlengths 721 1.04M |
|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
#!/usr/bin/env python
#signif reference to http://pastebin.com/k87sfiEf
import sys
import math
import signal
import time
import os
import math, random
import numpy as np
from numpy import linalg
from PIL import Image
#interface stuff
from PyQt4 import QtCore, QtGui, QtOpenGL
import pyqtgraph as pg
#comms stuff
i... |
# -*- coding: utf-8 -*-
#
# 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.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensi... |
#!/usr/bin/python
import tweepy
import ConfigParser
import sys, os
config = ConfigParser.SafeConfigParser()
config.read(os.path.join(sys.path[0], 'config'))
auth = tweepy.OAuthHandler(config.get('auth','consumer_key'), config.get('auth','consumer_secret'))
auth.set_access_token(config.get('auth','access_token'), con... |
# 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 with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... |
import argparse
import collections
import copy
import json
from auth import load_session
from constants import GET_POSTS_URL_BASE, CREATE_POST_URL_BASE, POST_LIMIT, POST_ATTRS_TO_FILTER, SUPPORTED_POST_IMPORT_TYPES, DEFAULT_SESSION_FILE
def export_posts(session, api_key, blog_name, export_notes=False, export_reblogs... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Copyright (c) 2014-2019 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test behavior of headers messages to announce bl... |
# sybase/pyodbc.py
# Copyright (C) 2005-2018 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: sybase+pyodbc
:name: PyODBC
:dbapi: pyodbc
:connectstr... |
# copyright 2003-2010 Sylvain Thenault, all rights reserved.
# contact mailto:thenault@gmail.com
#
# This file is part of logilab-astng.
#
# logilab-astng 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,... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 BigML
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
'''OpenGL extension VERSION.GL_1_3
This module customises the behaviour of the
OpenGL.raw.GL.VERSION.GL_1_3 to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/VERSION/GL_1_3.txt
'''
from OpenGL import platform, constants, constant,... |
import sys
import pargraph as par
import copy
import schedule as sched
import profiler as pro
import time
import multiprocessing
import itertools
import random
import threading
""" Usage: call with <filename> <pragma_xml_file> <executable_name> <profiling_interations> True/False (for output) """
if __name__ == "__... |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... |
from nose.tools import ok_
from rest_framework.generics import GenericAPIView
from django.contrib.auth.models import AnonymousUser
from amo.tests import TestCase
from mkt.access.middleware import ACLMiddleware
from mkt.carriers import CARRIER_MAP as CARRIERS
from mkt.feed.constants import FEED_TYPE_SHELF
from mkt.fee... |
#! /usr/bin/python
"""Xmlgame: does xmlstuff
jsgame: does js stuff
App: gets clipboard and runs UI
Right now everythign depends on the UI being up and running. This won't always be the case, and isn't necessary.
"""
import Tkinter
import os
import re
from Tkconstants import *
import sys
import json
from xml.dom imp... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 18:15:40 2016
@author: Radu
"""
import struct
from neuron import h
def get_net_params(tempdata_address):
text_file_location = tempdata_address + "cell_params"
result = []
text_file = open(text_file_location, 'rb')
value = text_file.read(8)
while ... |
"""Locators for Spring '19"""
npsp_lex_locators={
'breadcrumb': "//li[contains(@class, 'slds-breadcrumb__item')]/span[text()='{}']",
'breadcrumb-link':"//a[@title='{}' and contains(@class,'BreadCrumbItem')]",
'placeholder': "//*[contains(@placeholder,'{}')]",
'app_launcher':{
'select-option':'/... |
from pyalgs.data_structures.commons.stack import Stack
from pyalgs.data_structures.graphs.graph import DirectedEdgeWeightedGraph, Digraph
class DirectedCycle(object):
marked = None
onStack = None
cycle = None
edgeTo = None
def __init__(self, G):
if isinstance(G, DirectedEdgeWeightedGraph... |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 smurail
#
# 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 your optio... |
import mediacloud
import yaml
import base_meta
import csv
from byline_gender import BylineGender
import time
import sys
def extract_metadata(extractor, url=None, file_name=None, stories_id=None, import_full_text=False):
extractor.make_soup(url=url,file_name=file_name,stories_id=stories_id,import_full_text=import_... |
import webapp2
import jinja2
import os
from twilio import twiml
from twilio.rest import TwilioRestClient
from twilio.util import RequestValidator
from google.appengine.ext import ndb
import logging
import json
from private import account_sid, auth_token
from common import make_template
class Call(ndb.Model):
"""Mo... |
"""Model for wavenet. Defines ops in tensorflow sense"""
import numpy as np
import tensorflow as tf
MIN_DIL = 2
MAX_DIL = 4096
def _dilated_convolution(X, filters, dilation, name):
"""Helper function to carry out dilated convolution
Parameters
==========
X : tf.Tensor of shape(batch, width, height, ... |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... |
#
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
#
# Mapnik 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 Li... |
from django.http import HttpResponse
from django.shortcuts import render
from sapl.crud.base import CrudAux, Crud
from sapl.lexml.OAIServer import OAIServerFactory, get_config
from sapl.rules import RP_DETAIL, RP_LIST
from .models import LexmlProvedor, LexmlPublicador
LexmlPublicadorCrud = CrudAux.build(LexmlPublica... |
# 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 -*-
# Copyright (c) 2005 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Parse a CORBA IDL file and retrieve modules, interfaces, methods and
attributes.
Parse enough of a CORBA IDL file to recognize module, interface and method
definitions and to find out the superclasses of an interfac... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 ... |
import numpy as np
from typing import Optional, Union
from ray.rllib.models.action_dist import ActionDistribution
from ray.rllib.utils.annotations import override
from ray.rllib.utils.exploration.gaussian_noise import GaussianNoise
from ray.rllib.utils.framework import try_import_tf, try_import_torch, \
get_variab... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: deleteline.py
import os
import sys
reload(sys)
#sys.setdefaultencoding('utf8')
def ChangeLineInFile(infile,isOverwrite):
isOverwrite = isOverwrite.upper()
_dir = os.path.dirname(infile)
oldbasename = os.path.basename(infile)
newbasename = ol... |
#!/usr/bin/env python
import sys
import pprint
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.transport import THttpClient
from thrift.protocol import TBinaryProtocol
import RegistryProxy
#from RegistryProxy import *
from ttypes import *
class C... |
""" Django settings for django_blog project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... |
#!/usr/bin/env python
"""axis_mux
Generates an AXI Stream mux with the specified number of ports
Usage: axis_mux [OPTION]...
-?, --help display this help and exit
-p, --ports specify number of ports
-n, --name specify module name
-o, --output specify output file name
"""
import io
import sys
imp... |
from __future__ import with_statement
import sys
import logging
import warnings
import django
from django.conf import settings
try:
from django.conf.urls import patterns, url
except ImportError: # Django < 1.4
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotEx... |
import gc
import os
import init_database
import pytest
import update_statistic
import update_variety_data
from common_helper_process import execute_shell_command_get_return_code
from helperFunctions.fileSystem import get_src_dir
@pytest.mark.parametrize('script, expected_str', [
('start_fact.py', 'FACT Starter'... |
'''
Train PredNet on INGV sequences.
'''
import os
import numpy as np
np.random.seed(123)
from six.moves import cPickle
from keras import backend as K
from keras.models import Model
from keras.layers import Input, Dense, Flatten
from keras.layers import LSTM
from keras.layers import TimeDistributed
from keras.callbac... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 标准库
import argparse
import urllib
import time
import datetime
import sys
import re
import ConfigParser
import random
import smtplib
from email.mime.text import MIMEText
# 第三方库
import requests
from huzhifeng import dumpObj, hasKeys
# Set default encoding to utf-8
reload... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012-2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... |
# Copyright (C) 2018 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.web.common.urlsindex import UrlsIndex
class AdminUrls(U... |
from cfg import read_grammar_rules, WCFG
from rule import Rule
from symbol import is_terminal, is_nonterminal, make_symbol
from collections import defaultdict
from item import Item
from agenda import Agenda
def cky_axioms(cfg, sentence):
"""
Axioms for CKY.
Inference rule:
--------------------... |
# Copyright (c) 2012 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 sys
_no_value = object()
def Collect(futures):
'''Creates a Future which returns a list of results from each Future in
|futures|.
'''
r... |
# -*- coding: utf-8 -*-
'''
The MIT License (MIT)
Copyright (c) 2017 Wolfgang Almeida <wolfgang.almeida@yahoo.com>
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, i... |
# -*- coding: utf-8 -*-
"""Copyright (C) 2013 COLDWELL AG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is dist... |
#!/usr/bin/env python
import sys, os, shutil, time, platform
from subprocess import Popen, PIPE
from distutils.core import setup, Extension, Command
from distutils import log
from distutils.dir_util import remove_tree
# -----------------------------------------------------------------------------
# Bootstrap
if sys.v... |
#!/usr/bin/env python
# encoding: utf-8
import sys
import logging
import datetime
from modularodm import Q
from dateutil.relativedelta import relativedelta
from scripts import utils as scripts_utils
from website.app import init_app
from website.oauth.models import ExternalAccount
from website.addons.base.exceptions ... |
#!/usr/bin/env python
from runtest import TestBase
import subprocess as sp
TDIR='xxx'
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork', """
uftrace file header: magic = 4674726163652100
uftrace file header: version = 4
uftrace file header: header size = 40
uftr... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 Acysos S.L. (http://acysos.com) All Rights Reserved.
# Ignacio Ibeas <ignacio@acysos.com>
# $Id$
#
# This program i... |
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from multiprocessing import cpu_count
from os.path import join, basename
from os import listdir, walk
import sh
# This recipe builds libtorrent with Python bindings
# It depends on Boost.Build and the source of several Boost libraries pr... |
"""`main` is the top level module for your Flask application."""
# Imports
from os.path import dirname, join
from datetime import date
from flask import Flask
import jinja2
# Constants
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(join(dirname(__file__), 'templates')),
extensions=['ji... |
#!/usr/bin/env python
import atexit
import curses
import datetime
import json
import os
import random
import re
import subprocess
import sys
import tempfile
import termios
import time
import tty
VERSION = '0.0.7'
git_dir = os.path.abspath(
os.path.join(
os.path.dirname(
os.path.abspath(__file... |
# Copyright 2016 Capital One Services, 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... |
#!/usr/bin/python
import os
import sys
import subprocess
devices = ['STM32F030x6']
template = """set(ENV{{PATH}} {gcc_dir})
set(GCC_ARM_DIRECTORY {gcc_dir})
add_definitions(-D{device})
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
set(C... |
#
# Licensed under the GNU General Public License Version 3
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This p... |
import visa
import numpy as np
from stlab.devices.instrument import instrument
import time
class keithley6430(instrument):
def __init__(self,addr = "TCPIP::192.168.1.212::1470::SOCKET", reset = True, verb=True, read_termination='\r\n'):
#Needs \r\n line termination
super().__init__(addr,reset... |
from __future__ import absolute_import
import base64
import logging
from django.conf import settings
from github import UnknownObjectException
from wtl.wtgithub.github import WtGithub
from wtl.wtgithub.models import Repository
from wtl.wtlib.models import Project, Library, LibraryVersion, Language
from wtl.wtparser.p... |
from django.contrib import admin
from bejmy.accounts.models import Account
from bejmy.transactions.models import Transaction
from bejmy.transactions.admin import TransactionAdminBase
class TransactionAdmin(TransactionAdminBase, admin.TabularInline):
model = Transaction
fk_name = 'source'
def has_change_... |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import unittest
this_dir = os.path.realpath(os.path.dirname(__file__))
sys.path.append(os.path.realpath(os.path.join(os.pardir, os.pardir)))
from geodata.i18n.languages import init_languages, get_country_langu... |
#!/usr/bin/env python3
# Copyright (C) 2015 Commerce Technologies, 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 b... |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 <Kyle Francis> <guitarman_usa@yahoo.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free... |
from pyprofibus.compat import *
import time
PARITY_EVEN = "E"
PARITY_ODD = "O"
STOPBITS_ONE = 1
STOPBITS_TWO = 2
class SerialException(Exception):
pass
class Serial(object):
def __init__(self):
self.__isMicropython = isMicropython
self.port = "/dev/ttyS0"
self.__portNum = None
self.baudrate = 9600
self.b... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... |
# -*- 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... |
# -*- coding: utf-8 -*-
"""
blohg.tests.rst_parser.directives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module with tests for the custom blohg reStructuredText directives.
:copyright: (c) 2010-2013 by Rafael Goncalves Martins
:license: GPL-2, see LICENSE for more details.
"""
import mock
import unittest
... |
import sys
from glob import glob
import pycodestyle as pycodestyle
from urlwatch.jobs import UrlJob, JobBase, ShellJob
from urlwatch.storage import UrlsYaml, UrlsTxt
from nose.tools import raises, with_setup
import tempfile
import os
import imp
from lib.urlwatch import storage
from lib.urlwatch.config import BaseCo... |
# coding: utf-8
import os
import sys
from mock import patch
import pytest
from decouple import Config, RepositoryEnv, UndefinedValueError
# Useful for very coarse version differentiation.
PY3 = sys.version_info[0] == 3
if PY3:
from io import StringIO
else:
from StringIO import StringIO
ENVFILE = '''
KeyTru... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module loads YAML configuration, presents UI to user and allows him to
set and save values to another YAML file.
"""
import sys
import os
import curses
import curses.textpad
import textwrap
import re
from editor import Editor
try:
import yaml
except ImportEr... |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 Google Inc.
# 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 copyri... |
import os
import subprocess
from collections import defaultdict
from datetime import datetime
import csv
from csv import DictReader
import math
from glob import glob
# Data locations
loc_train = "../data/train.csv"
loc_test = "../data/test.csv"
loc_labels = "../data/trainLabels.csv"
loc_best = "test.pred2... |
#!/usr/bin/python
#
# Copyright 2013 Jesse Peterson
#
# 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... |
from sys import getsizeof
import collections
import pickle
# import timeit
from sys import getsizeof
import time
import csv
import io
output = io.StringIO()
with open('../dictionary_Nikon_Snippet_Surroundings.pickle', 'rb') as f:
d = (pickle.load(f))
with open('/Users/sasa/Dropbox/1-Uni/CMPUT 692/Project/Code... |
#pythran export whetstone(int)
#runas whetstone(2*10**2)
#bench whetstone(1500)
"""
/*
* C Converted Whetstone Double Precision Benchmark
* Version 1.2 22 March 1998
*
* (c) Copyright 1998 Painter Engineering, Inc.
* All Rights Reserved.
*
* Permission is granted to use, duplicate, and... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Calculate the pitch needed to maintain contact between the front wheel and
ground.
"""
from sympy import simplify, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import msprint
from mpmath import findroot
from sympy.utilit... |
# ------------------------------------------------------------------- #
# Functions of genAndRun routine
# ------------------------------------------------------------------- #
# :: scaledUSDB
# Creates scaed USDB input files for each nuclide
#
# :: createNorm
# Creates normal file input for Bigstick, 1 for each n... |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="font", parent_name="streamtube.legendgrouptitle", **kwargs
):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_n... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui
import os
import qrcode
import electrum_rby
from electrum_rby import bmp
from electrum_rby.i18n import _
class QRCodeWidget(QWidget):
def __init__(self, data = None, fixedSize=False):
QWidget.... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from extras import VSM, read_and_map
from representation import VeryStupidCBOWMapper, CharMapper
import sys, numpy as np,os
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix
from sklearn.metrics import precision_recall_fscore_sup... |
from datetime import datetime, timezone, timedelta
from ..scheduler import Scheduler
def saveReply(replyToSave, replyDataStrategy):
validationResult = validateReply(replyToSave)
if validationResult is not None:
return {"result": "error",
"value": validationResult}
saveResult = rep... |
# coding=utf-8
import math
import arcpy
from operator import itemgetter
def fuzzyVisibility(dist, b1, beta, h):
b2 = h / ( 2 * math.tan(beta/2))
if dist < b1:
return 1
else:
return 1/(1 + math.pow((dist-b1)/b2, 2))
def isHorizon(points, i, ANG,limit_angle):
if i < len(points)-2:
... |
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.distributed.ClockDelta import *
from KnockKnockJokes import *
from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM
import DistributedAnimatedProp
from ... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
SECRET_KEY = 'not needed'
ROOT_URLCONF = 'wagtail.tests.urls'
STATIC_URL = '/static/'
STATIC_ROOT = 'static/'
COMPRESS_ENABLED = False
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.A... |
import angr
import os
print "loading true"
b = angr.Project('/bin/true')
print '0x%x' % b.entry
print 'start at 0x%x, ending at 0x%x' % (b.loader.min_addr(), b.loader.max_addr())
print 'file name %s' % b.filename
print 'this is the CLE Loader object'
print b.loader
print 'this is a dictionary of the objects that are... |
# Copyright 2015 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... |
# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
from datetime import (
datetime,
timedelta,
)
import re
import urllib
from BeautifulSoup import BeautifulSoup
from lazr.lifecycle.event impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'KMOL'
SITENAME = '2016Fall 課程網誌 (虎尾科大MDE)'
# 不要用文章所在目錄作為類別
USE_FOLDER_AS_CATEGORY = False
#PATH = 'content'
#OUTPUT_PATH = 'output'
TIMEZONE = 'Asia/Taipei'
DEFAULT_LANG = 'en'
# Feed generation is u... |
# Fernando Pascual Sesma. Abril de 2016
#!/usr/bin/python3
from gi.repository import GLib
import time
import datetime
import os
import sys
import dbus
import dbus.glib
OBJ_PATH = '/ril_0'
INTERFACE = 'org.ofono.NetworkRegistration'
SERVICE = 'org.ofono'
LOG = open('/home/nemo/fermatic/log.txt','a')
CellIds = [line.rstr... |
# -*- coding: utf-8 -*-
import pytest
import pytest_asyncio.plugin # noqa
from asyncio import Future, wait_for
try:
from asyncio.exceptions import TimeoutError
except ImportError:
from concurrent.futures import TimeoutError
from mock import Mock
from twisted.internet.defer import succeed
from pyee import... |
from flask_wtf import Form
from werkzeug import secure_filename
from flask_wtf.file import FileField, FileRequired, FileAllowed
from wtforms import FloatField, IntegerField, TextField, StringField, TextAreaField
from wtforms.validators import Required, Optional
from core.database.models import Question, Essay
from flas... |
from collections import OrderedDict
from django.utils import timezone
from edc_registration.models import RegisteredSubject
from edc_base.utils import convert_from_camel
from edc_constants.constants import YES, POS, NEG, IND, NEVER, UNKNOWN, DWTA, OTHER
from edc_dashboard.subject import RegisteredSubjectDashboard
fro... |
import config as cfg
import random
import speedrun
from datetime import datetime
from seconds import seconds_to_time
def post_tweet(api, lb, cat, p, t):
player_name = p
twitter_handle = speedrun.get_twitter_handle(p)
if twitter_handle is None:
return
if not twitter_handle == '':
player... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
# coding=utf-8
import math
import i18n
_ = i18n.language.gettext
CHORUS_INDENTIFIER = '{CHORUS}'
ORDER_INDENTIFIER = '{ORDER}'
COMMENT_INDENTIFIER = '//'
class Music():
chorus = ''
chorus_chords = ''
verse = []
verse_chords = []
has_chorus = False
verses_before_chorus = 0
start_with_... |
from gpiozero import Button
class RotaryEncoder:
"""
Decode mechanical rotary encoder pulses.
The following example will print a Rotary Encoder change direction
from gpiozero import RotaryEncoder
def change(value):
if value == 1:
print("clockwise")... |
<<<<<<< HEAD
<<<<<<< HEAD
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
__doc__ = """
gyptest.py -- test runner for GYP tests.
"""
import os
import optparse
import subprocess
import sys... |
# -*- coding: utf-8 -*-
# Build configuration file.
# 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.
# All configuration values have a default; values that are commented out
# serve to show the ... |
from flask import Flask, render_template
from bokeh.charts import Bar
from bokeh.embed import components
from bokeh.util.string import encode_utf8
from bokeh.plotting import figure
import pandas as pd
app = Flask(__name__)
@app.route('/')
def test():
kws = ["one", "two", "cat", "dog"]
count = [23, 45, 11, 87]... |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToSibling, NavigateToAttribute
from widgetastic.widget import View, Text, NoSuchElementException
from widgetastic_patternfly import BreadCrumb, Button, Dropdown
from cfme.base.ui import BaseLoggedInPage
from cfme.common import TagPageView, Taggable
from... |
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
# 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 n... |
import re
from pprint import pprint
from mongo import MongoManager
from datetime import datetime, timedelta
class GenderClassifier(object):
cached_names_database = {}
@classmethod
def getNamesDatabase(cls, **kwargs):
max_age = kwargs.get('max_age', timedelta(seconds=0))
if not max_age or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.