src stringlengths 721 1.04M |
|---|
from datetime import datetime, timezone
import freezegun
import pytest
from ideascube.configuration import get_config, reset_config, set_config
from ideascube.configuration.exceptions import (
InvalidConfigurationValueError,
NoSuchConfigurationKeyError,
NoSuchConfigurationNamespaceError,
)
from ideascube... |
import sys
sys.path.append('../../')
from lib.cilok import urlEncode16,tokenuri,setTTL,keyuri
from lib.sampeu import getWMTS
from apps.models import calendar
from apps.templates import batik
class Controller(object):
def home(self,uridt='null'):
provinsi = 'ntb'
provloc = '117.231158, -8.240186'
mapzoom = '9'
... |
"""
Here are the functions which actually prepare the data and render the pages.
Most of the functions here are very similar since tree.io is, more or less, following
the CRUD (Create, Retrieve, Update, Delete) pattern.
The only thing special are the MassForms, which are quite common in tree.io and I only
adapted the c... |
# -*- coding: utf-8 -*-
# Copyright (c) 2007 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog showing UML like diagrams.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import pyqtSlot, Qt, QFileInfo
from PyQt5.QtWidgets import QAction, QToolBar, QGraphicsScene
fr... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009-2011 Gary Burton
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... |
# Copyright (c) 2014-2015 by Ron Frederick <ronf@timeheart.net>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-v10.html
#
#... |
import textwrap
import curses
import logging
from wordz import keys
logger = logging.getLogger('single_select')
class SingleSelect(object):
check = '\u2713'
def __init__(self, content, current=0, default=0, padding=0, lineno=False):
self.content = content
self.current = current
self.... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... |
from django.contrib.admin import ModelAdmin
from django.conf import settings
from . import VERSION
def default_config():
return {
'VERSION': VERSION,
# configurable
'ADMIN_NAME': 'Django Suit',
'HEADER_DATE_FORMAT': 'l, jS F Y',
'HEADER_TIME_FORMAT': 'H:i',
# form... |
from __future__ import absolute_import
import os
import warnings
import tempfile
from collections import OrderedDict
def deprecation_handler(source, filename, kwargs):
if 'local_fn' in kwargs:
warnings.warn(
'Please use the argument "source" instead of "local_fn"',
DeprecationWarni... |
# 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 u... |
# -*- coding: utf-8 -*-
"""
blohg.tests.app
~~~~~~~~~~~~~~~
Module with tests for blohg's flask application and the integration of the
modules.
:copyright: (c) 2010-2013 by Rafael Goncalves Martins
:license: GPL-2, see LICENSE for more details.
"""
import codecs
import os
import unittest
fro... |
from os.path import expanduser, abspath, exists, join
import re
from wolphin.exceptions import InvalidWolphinConfiguration
class Configuration(object):
"""Configuration for any Wolphin project"""
DEFAULT_REGION = 'us-west-1'
DEFAULT_AMI_ID = 'ami-87712ac2'
DEFAULT_INSTANCE_TYPE = 't1.micro'
DEFA... |
import numpy as np
from scipy import signal
from golem import DataSet
from golem.nodes import BaseNode
from psychic.utils import get_samplerate
class Filter(BaseNode):
def __init__(self, filt_design_func):
'''
Forward-backward filtering node. filt_design_func is a function that takes
the sample rate as a... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright 2019 kubeflow.org.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
"""lykops URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExtendLines.py
--------------------
Date : October 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
******************... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
import os
from collections import OrderedDict
from nmt import train
from char_biscale import *
layers = {'ff': ('param_init_fflayer', 'fflayer'),
'fff': ('param_init_ffflayer', 'ffflayer'),
'gru': ('param_init_gru', 'gru_layer'),
'biscale_decoder': ('param_init_biscale_decoder',
... |
from django.core.management.base import NoArgsCommand
from musicdb.classical.models import *
class Command(NoArgsCommand):
def handle_noargs(self, **options):
work_pairs = (
('felix-mendelssohn', ('string-quartet-in-e-flat', 'string-quartet-in-e-flat-1')),
('ludvig-van-beethoven',... |
#--------------------------------------------------
# Revision = $Rev: 13 $
# Date = $Date: 2011-07-31 00:39:24 +0200 (Sun, 31 Jul 2011) $
# Author = $Author: stefan $
#--------------------------------------------------
from pluginInterfaces import PluginFit, Parameter,leastsqFit
import numpy as np
class PluginFit... |
from PyQt4 import QtCore, QtGui
from PySide import QtCore, QtGui
from centralwidget import CentralWidget
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import logging
import time
import traceback
from collections import defaultdict
import dateutil
from dateutil.relativedelta import relativedelta
from odoo import _, api, fields, models, SUPERUSER_ID
fro... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
"""Convert a DECam official linearity FITS table into LSST linearizers
"""
import argparse
import sys
import os.path
from itertools import izip
import numpy as np
import astropy.io.fits as fits
from lsst.ip.isr import LinearizeLook... |
import SocketServer
import subprocess
import sys
from threading import Thread
import time
import sqlite3
dbcon = sqlite3.connect("./Compile/dbfile.sqlite", check_same_thread = False)
dbcon.isolation_level = None
dbcur = dbcon.cursor()
dbcon.row_factory = sqlite3.Row
dbcon.text_factory = str
HOST = '176.53.113.223'
PO... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 30 19:52:46 2014
@author: dan
"""
from getMultiCurVals import getMultiCurVals
from readCurVectorInput import readCurVectorInput
from readValue import readValue
from copy import deepcopy
def ... |
# vim: set et sw=3 tw=0 fo=awqorc ft=python:
#
# Astxx, the Asterisk C++ API and Utility Library.
# Copyright (C) 2005, 2006 Matthew A. Nicholson
# Copyright (C) 2006 Tim Blechmann
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License v... |
#!/usr/bin/python
from collections import deque
from pylimitbook.tick import Bid, Ask, Trade
from pylimitbook.tree import Tree
from builtins import input
from six.moves import cStringIO as StringIO
def parse_csv(columns, line):
"""
Parse a CSV line that has ',' as a separator.
Columns is a list of the co... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-22 23:34
from __future__ import unicode_literals
import datetime
import django.core.validators
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('board', '... |
import py
import sys, os
from rpython.rtyper.lltypesystem.module.ll_os_path import Implementation as impl
from rpython.rtyper.test.test_llinterp import interpret
from rpython.tool.udir import udir
def test_exists():
filename = impl.to_rstr(str(py.path.local(__file__)))
assert impl.ll_os_path_exists(filename... |
import struct
import unittest
import json
from manticore.platforms import evm
from manticore.core import state
from manticore.core.smtlib import Operators, ConstraintSet
import os
class EVMTest_EXP(unittest.TestCase):
_multiprocess_can_split_ = True
maxDiff = None
def _execute(self, new_vm):
last... |
#!/usr/bin/python3
# Copyright (C) 2006 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a full list
# of copyright holders.
#
# Prof. C Pain
# Applied Modelling and Computation Group
# Department of Earth Science and Engineering
# Imperial Colleg... |
import logging
import time
from datetime import datetime, timedelta
from core import Feed
from core.config.config import yeti_config
from core.entities import Exploit, Entity
from core.errors import ObservableValidationError
from core.indicators import Yara, Indicator
from core.observables import Hash, Hostname, Url, ... |
import re
from pyparsing import Word, Literal, alphanums
def check_line_width(self, line):
max_length = self.max_line_length
current_length = len(line)
if current_length > max_length:
self.add_error(label="LINE_WIDTH", data={'length': current_length})
def check_missing_rme(self, lines):
functi... |
# -*- coding: utf-8 -*-
"""Mapping classes.
"""
from __future__ import absolute_import
import sys
from collections import namedtuple
import six
try:
unicode
except NameError:
unicode = str
keyval = namedtuple('keyval', 'key val')
def xmlrepr(v, toplevel=False):
"Return ``v`` as xml tag-soup."
if top... |
###############################################################################
## fs.py
## 9te [angband.ornl.gov]
## Wed Jan 12 10:37:50 2011
###############################################################################
## Copyright (C) 2008 Oak Ridge National Laboratory, UT-Battelle, LLC.
##------------------------... |
#!/usr/bin/env python
'''
pyMMA - A Python pyOpt interface to MMA.
Copyright (c) 2008-2014 by pyOpt Developers
All rights reserved.
Revision: 1.4 $Date: 21/06/2010 21:00$
Tested on:
---------
Linux with g77
Linux with gfortran
Linux with pathf95
Win32 with g77
Mac with g95
Developers:
-----------
- Mr. Andrew La... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Run Regression Test Suite
This module calls down into individual test cases via subprocess. It will
... |
import urllib2, urllib
from proj.settings import *
API_SSL_SERVER="https://www.google.com/recaptcha/api"
API_SERVER="http://www.google.com/recaptcha/api"
VERIFY_SERVER="www.google.com"
class RecaptchaResponse(object):
def __init__(self, is_valid, error_code=None):
self.is_valid = is_valid
self.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017, AGB & GC
# Full license can be found in License.md
# ----------------------------------------------------------------------------
"""Routines to convert from different file timekeeping methods to datetime
"""
import datetime as dt
import numpy as np
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
import argparse
import json
import os
import shutil
import sys
import time
from main import config
###############################################################################
# Options
###################################################... |
"""
The :mod:`sklearn.kernel_approximation` module implements several
approximate kernel feature maps base on Fourier transforms.
"""
# Author: Andreas Mueller <amueller@ais.uni-bonn.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import svd
from .base im... |
"""
Core functionality of the Tribler.
Author(s): Arno Bakker
"""
import logging
from threading import RLock
logger = logging.getLogger(__name__)
def warnIfDispersyThread(func):
"""
We'd rather not be on the Dispersy thread, but if we are lets continue and
hope for the best. This was introduced after th... |
import urllib2
import json
from plenary.models import Deputy, Party
LIMIT = 200
def party_json_to_model(j):
v= {}
v['dieren_id'] = j['id']
v['name'] = j['name']
return v
def sync_parties():
url = "http://www.dierentheater.be/api/v1/party/?format=json&limit=%d" % (LIMIT)
data = urllib2.urlop... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import os
from django.core.management.base import BaseCommand
from optparse import make_option
from py3compat import... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import ld as LD
import dd as DD
from hidespines import *
import sys
''' compares difference between Sn and moment equations as cell width --> 0 '''
if (len(sys.argv) > 1):
outfile = sys.argv[1]
else:
outfile = None
def getDiff(sol... |
import sys, logging, os
from Config import config
import gevent
from util import SslPatch
class CryptConnectionManager:
def __init__(self):
# OpenSSL params
if sys.platform.startswith("win"):
self.openssl_bin = "src\\lib\\opensslVerify\\openssl.exe"
else:
self.openssl_bin = "openssl"
self.openssl_env ... |
"""Fasta Tools
"""
def write_fasta_sequence(sequence_data, file_output, write_mode='a'):
"""Add sequences to a file, in Fasta Format.
Parameters
----------
sequence_data : str
Sequence to add to the fasta file. if only the sequence is provided,
assume the header is not relevant and a rando... |
#!/usr/bin/env python
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 ... |
import requests
import ujson
import sseclient
import pprint
import pandas as pd
from pypaques import constants
from pypaques import exceptions
import pypaques.logging
MAX_ATTEMPTS = constants.DEFAULT_MAX_ATTEMPTS
logger = pypaques.logging.get_logger(__name__)
class ClientSession(object):
def __in... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
from dynamic_graph.sot.dynamic_pinocchio.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
# Move left wrist
reach(robot, 'left-wrist', 0.25, 0, 0.1)
# Push tasks
# Operational po... |
# -*- coding: utf-8 -*-
import pytest
from olympia.amo.tests import user_factory
from olympia.users.utils import (
UnsubscribeCode, system_addon_submission_allowed)
def test_email_unsubscribe_code_parse():
email = u'nobody@mozîlla.org'
token, hash_ = UnsubscribeCode.create(email)
r_email = Unsubscri... |
#!/usr/bin/env python
import smurff.matrix_io as mio
import urllib.request
import scipy.io as sio
import os
from hashlib import sha256
import smurff
urls = [
(
"http://homes.esat.kuleuven.be/~jsimm/chembl-IC50-346targets.mm",
"10c3e1f989a7a415a585a175ed59eeaa33eff66272d47580374f26342cd... |
from __future__ import absolute_import
"""M2Crypto wrapper for OpenSSL DH API.
Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved."""
from M2Crypto import BIO, m2, util
from M2Crypto.util import genparam_callback
if util.py27plus:
from typing import AnyStr, Callable # noqa
class DHError(Exception):
... |
# -*- coding: utf-8 -*-
import 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 'Mentorship'
db.create_table('tracker_mentorship', (
('id', self.gf('django.db.mo... |
"""
Deploy this project in stage/production.
Requires commander_ which is installed on the systems that need it.
.. _commander: https://github.com/oremj/commander
"""
import os
import requests
import sys
from commander.deploy import hostgroups, task
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
impor... |
'module data provides class Data(object)'
from pprint import pformat
class Data(object):
"represents arbitrary data; provides functionality for displaying itself"\
" properly"
def __init__(self, *args, **kwargs):
if args:
self.args = args
for key, value in kwargs.items():
... |
import os
import sys
import unittest
class ConfigTest(unittest.TestCase):
config_dir = 'configs'
config_files = {
"yaml": "config.yaml",
"ini": "config.ini",
"py": "config.py",
"json": "config.json",
}
conf_output = {
"Diffbot": {
"debug": True,
"apikey": "000001000011... |
#!/usr/bin/env python
import fcntl
import os
import os.path
import sys
import time
'''
This is an example of how to make sure only a single python process is
running of a specific kind...
References:
- http://stackoverflow.com/questions/220525/ensure-a-single-instance-of-an-application-in-linux
'''
do_fork = False
... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import csc_matrix
head = np.random.randint(low=0,high=10,size=20)
tail = np.random.randint(low=0,high=10,size=20)
row = np.arange(20)
data = np.ones(20)
a = csc_matrix((data, (row,head)),shape=(20,10)).toarray()
b = csc_matrix((data, (row,tail)),sha... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import itertools
import numpy as np
import pytest
from numcodecs.zlib import Zlib
from numcodecs.tests.common import (check_encode_decode, check_config, check_repr,
check_backwards_compatibil... |
# -*- coding: utf-8 -*-
import os
import sys
# env
sys.path.append('/usr/lib/python2.7/dist-packages/')
sys.path.append('/usr/lib/python2.7/')
sys.path.append('/usr/local/lib/python2.7/dist-packages/')
sys.path.append('/data2/django_1.11/')
sys.path.append('/data2/django_projects/')
sys.path.append('/data2/django_thir... |
# Copyright 2018 Google LLC.
#
# 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 following disclaimer.
#
#... |
"""Australian-specific Form helpers."""
from __future__ import unicode_literals
import re
from django.forms import ValidationError
from django.forms.fields import CharField, RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from localflavor.compa... |
# create a mapping of state to abbreviation
states = {
'Oregon': 'OR',
'Florida': 'FL',
'California': 'CA',
'New York': 'NY',
'Michigan': 'MI'
}
# create a basic set of states and some cities in them
cities = {
'CA': 'San Francisco',
'MI': 'Detroit',
'FL': 'Jacksonville'
}
# add some m... |
import re
import datetime
from pyspark.sql import Row
month_map = {'Jan': 1, 'Feb': 2, 'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7,
'Aug':8, 'Sep': 9, 'Oct':10, 'Nov': 11, 'Dec': 12}
def parse_apache_time(s):
""" Convert Apache time format into a Python datetime object
Args:
s (str): date and tim... |
#-*- coding: ISO-8859-1 -*-
# pysqlite2/test/hooks.py: tests for various SQLite-specific hooks
#
# Copyright (C) 2006-2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for... |
#!/usr/bin/env python
"""
python davserver
Copyright (C) 1999 Christian Scholz (ruebe@aachen.heimat.de)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version... |
from django.db import models, migrations
from django.utils.translation import ugettext_noop as _
from django.urls import reverse
from ..utils import create_detail_actions, create_detail_navigation
def install(apps, schema_editor):
# Models.
User = apps.get_model('core.User')
Group = apps.get_model('core.... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import warnings
import os
import torch
from fairseq import metrics, search, tokenizer, utils
from fairseq.data import data_utils, FairseqDat... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from alibb import pooled
import time
class TestPipeline(object):
def process_item(self, item, spider):
return item
... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import os
import re
import json
import time
import datetime
import dateparser
import pkg_resources
import shutil
import smtplib
im... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import copy, sys
from PyQt5.Qt import Qt, QListWidgetItem, QIcon
from calibre.gui2.preferences import ConfigWidgetBase, t... |
"""
Copyright (C) 2017 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... |
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# Copyright (c) 2017-2018, NVIDIA CORPORATION. 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 a... |
'''
Simple module to aid in command-line debugging of notification related issues.
'''
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.core.mail import EmailMessage
from timetracker.overtime.models import PendingApproval, Tbluser
def send_approval_digest... |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... |
# -*- encoding: utf-8 -*-
import glob
import logging
import unittest
import nssct.backend.mock
import nssct.controller
import nssct.engine
import nssct.log
import nssct.plugins.detect
import nssct.report
class CheckHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
self.formatter = nss... |
import html
from enum import Enum
import click
import requests
from bs4 import BeautifulSoup
import agent
import network
import ui
class StatusCode(Enum):
"""An Enum represented the type of result of database searches"""
NO_RESULTS = 0
USER_CANCELLED = 1
def display_entry_details(entry):
"""Displa... |
# Copyright 2016 F5 Networks 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 writ... |
from OccGrid import OccGrid
from geo import Point,Line
class ObstacleList(object):
def __init__(self, occgrid):
self.occgrid = occgrid
self.yMax = occgrid.yMax
self.yMin = self.yMax * -1
self.xMax = occgrid.xMax
self.xMin = self.xMax * -1
... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... |
#!/usr/bin/env python3
# This sample demonstrates how to send a parameter in the body of a request.
# For a list of the endpoints that you can use along with the parameters that
# they accept you can view the REST API interactive help page on your
# deployment at https://<hostname>/api_doc
# You can also retrieve a li... |
from e6b import E6B
import unittest
class TimeSpeedDistance(unittest.TestCase):
'''Test time, speed and distance calculations'''
def setUp(self):
self.e6b = E6B()
def test_time(self):
'''Test time calculations'''
time = self.e6b.time(1, 60)
self.assertEqual(60, time)
... |
#!/usr/bin/env python
from __future__ import unicode_literals
import os
import sys
from os.path import abspath, dirname, join as pjoin
import django
from django.conf import settings
def runtests(verbosity=1, interactive=True, failfast=True, settings_module='settings.default'):
here = abspath(dirname(__file__))
... |
'''
Created on Apr 20, 2014
@author: sergio
'''
import psycopg2
import neo.core
from .. import dbutils
class BlockDB(neo.core.Block):
'''
classdocs
'''
def __init__(self, id_project = None, id_individual = None, name = None,
description = None, file_origin = None,
... |
#!/usr/bin/env python
# GrovePi LED blink test for the Grove LED Socket (http://www.seeedstudio.com/wiki/Grove_-_LED_Socket_Kit)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? Ask on ... |
# -*- coding: utf-8 -*-
import numpy as np
from numpy.random import RandomState
from fakespikes.util import to_spikes
from fakespikes.rates import constant
class Spikes(object):
"""Simulates statistical models of neural spiking
Params
------
n : int
Number of neurons
t : float
Sim... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Numerical Methods of Partial Differential Equations.
Provides integration methods and other utility functions such as the RA & RAW
time filters for numerical integration of PDEs.
"""
import numpy as np
def RA_filter(phi, epsilon=0.1):
"""Robert-Asselin-Williams ti... |
from . import _meta
from collections import deque
__version__ = _meta.version
__version_info__ = _meta.version_info
class Bucket(object):
"""
Encloses a function that produces results from
an item of an iterator, accumulating any results
in a deque.
"""
def __init__(self, func):
self... |
#!/usr/bin/env python
# Copyright 2012 Josef Assad
#
# This file is part of Stock Data Cacher.
#
# Stock Data Cacher 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 y... |
# -*- coding: utf-8 -*-
"""Search a regular expression pattern in one or more files"""
from __future__ import print_function
import argparse
import collections
import fileinput
import os
import re
import sys
def main(args):
global _stash
ap = argparse.ArgumentParser()
ap.add_argument('pattern', help='th... |
# Copyright 2006, 2007, 2008, 2009 Brailcom, o.p.s.
#
# Author: Tomas Cerha <cerha@brailcom.org>
#
# This library 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 ... |
from __future__ import print_function, division
import sys, os
sys.path.append(os.path.abspath("."))
from utils.lib import *
from algorithms.serial.algorithm import Algorithm
from where import Node, sqrt
__author__ = 'panzer'
def default_settings():
"""
Default Settings for NSGA 3
:return: default settings
""... |
from acceptanceutils import surjection
import string
import random
one = ([1], 1)
two = ([1, 2], 2)
three = ([1, 2, 3], 3)
three_none = (three[0], None)
three_item_group = (one, two, three, three_none)
ten_item_group = ([0]*10, 1)
so = surjection.surjective_options
class TestSurjectiveOptions(object):
three_lis... |
# molden.py -- Molden format
# Implements the Molden file format, specification can be found here:
# http://www.cmbi.ru.nl/molden/molden_format.html
#
# Copyright (c) 2016 Steven Vancoillie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... |
import ipaddress
from flask_restful import Resource, reqparse, abort, inputs, fields, marshal
from flask_login import login_required
from twisted.internet.defer import inlineCallbacks, returnValue
from crochet import wait_for, TimeoutError
from floranet.models.gateway import Gateway
from floranet.log import log
# Cr... |
'''Label
=====
.. image:: images/label.png
:align: right
The :class:`Label` widget is for rendering text. It supports ascii and unicode
strings::
# hello world text
l = Label(text='Hello world')
# unicode text; can only display glyphs that are available in the font
l = Label(text=u'Hello world '... |
# This program is public domain
# Author: Paul Kienzle
"""
Surround variation reflectometry
The surround variation reflectometry package consists of three interacting
pieces: simulation, phase reconstruction and phase inversion. Before the
experiment starts, you should provide an expected profile to the simulator.
Th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.