src stringlengths 721 1.04M |
|---|
#! /usr/bin/env python26
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
#
# Copyright (c) 2009 University of Washington
#
# 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 Fre... |
import ftplib
import os
import time
from urllib.parse import unquote, urlparse
from loguru import logger
from flexget import plugin
from flexget.event import event
from flexget.utils.pathscrub import pathscrub
from flexget.utils.template import RenderError
logger = logger.bind(name='ftp')
class OutputFtp:
"""
... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright JLaloux
#
# 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, eithe... |
import re
from collections import Counter
def preprocess(text):
# Replace punctuation with tokens so we can use them in our model
text = text.lower()
text = text.replace(".", " <PERIOD> ")
text = text.replace(",", " <COMMA> ")
text = text.replace('"', " <QUOTATION_MARK> ")
text = text.replace... |
from sympy import sqrt, exp, prod, Rational
from sympy.core.compatibility import range
from sympy.physics.quantum import Dagger, Commutator, qapply
from sympy.physics.quantum.boson import BosonOp
from sympy.physics.quantum.boson import (
BosonFockKet, BosonFockBra, BosonCoherentKet, BosonCoherentBra)
def test_bos... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... |
# The MIT License (MIT)
# Copyright (c) 2016 Massachusetts Institute of Technology
#
# Authors: Cody Rude, Guillaume Rongier
# This software has been created in projects supported by the US National
# Science Foundation and NASA (PI: Pankratius)
#
# Permission is hereby granted, free of charge, to any person obtaining ... |
# coding=utf-8
"""DockWidget test.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = ... |
# Python test set -- built-in functions
import test.support, unittest
from test.support import fcmp, TESTFN, unlink, run_unittest, \
run_with_locale
from operator import neg
import sys, warnings, random, collections, io, fractions
warnings.filterwarnings("ignore", "hex../oct.. of negati... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... |
from kivy.app import App
from kivy.event import EventDispatcher
from kivy.properties import StringProperty, NumericProperty, ObjectProperty
class CursorInterface(EventDispatcher):
filename = StringProperty(None, allownone=True)
repo_key = NumericProperty(None, allownone=True)
pos = NumericProperty(None, a... |
import pytest
from mock import Mock
from spinner.scripts import wiring_validator
from spinner.topology import Direction
@pytest.fixture
def bc(monkeypatch):
# Mock out all parts which talk to the outside world...
bc = Mock()
monkeypatch.setattr(wiring_validator, "BMPController", Mock(return_value=bc))
return b... |
# storecmds.py
# Store the requested commands and arguments
# until given the go-ahead to run them.
# The TECO commands we want are -
# Files - Read, write, save, close.
# Lines - Move between lines, within lines. Go to a line.
# Move "x" lines up or down. Move "x" bytes back or forward.
# Editing - I... |
#coding: utf-8
'''
This script reads a Q-A txt-file and generates JSON output.
USAGE:
Save your Q-A file
FORMAT:
Chapter 1 - cakes. The whole line is a part of the chapter title.
Q: Question that we wonder about?
A: Answer telling us what we want to know?
Q: Empty ... |
# -*- coding: utf-8 -*-
#
# Main routing table for GN2
from __future__ import absolute_import, division, print_function
import traceback # for error page
import os # for error gifs
import random # for random error gif
import datetime # for errors
import time # for errors
import sys
import csv
import x... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains a contains the high-level functions to read a
VOTable file.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...extern import six
# STDLIB
import io
import os
i... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 by the Free Software Foundation, Inc.
#
# This file is part of HyperKitty.
#
# HyperKitty 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 t... |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2015 Trustcode - www.trustcode.com.br #
# ... |
"""Conversion tool from SQD to FIF
RawKIT class is adapted from Denis Engemann et al.'s mne_bti2fiff.py
"""
# Author: Teon Brooks <teon@nyu.edu>
#
# License: BSD (3-clause)
import os
from os import SEEK_CUR
from struct import unpack
import time
import numpy as np
from scipy import linalg
from ..pick import pick_t... |
# -*- coding: utf-8 -*-
##__author__ =='liam'
# python3.52
import re,time,random
import requests
import tkinter as tk
from tkinter import filedialog
import xlsxwriter as wx
from lxml import etree
USER_AGENTS = [
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.5... |
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils import check_X_y, check_array
from timbl import TimblClassifier
import scipy as sp
import numpy as np
class skTiMBL(BaseEstimator, ClassifierMixin):
def __init__(self, prefix='timbl', algorithm=4, dist_metric=None,
k=1, no... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import os
#from utils import filters
AUTHOR = u'Kivan Polimis'
SITENAME = u'Kivan Polimis'
# SITESUBTITLE = u'my personal musings and attempts to apply \
# and share some programming tips'
INDEX_SAVE_AS = 'pages/home.html'
PATH = ... |
# 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
# d... |
__author__ = 'maartenbreddels'
matplotlib = """import pylab
import numpy as np
import os
import json
import sys
name = "{name}" if len(sys.argv) == 1 else sys.argv[1]
filename_grid = name + "_grid.npy"
filename_grid_vector = name + "_grid_vector.npy"
filename_grid_selection = name + "_grid_selection.npy"
filename_m... |
#! /usr/bin/env python
# -*- coding: UTF8 -*-
# Este arquivo é parte do programa Activlets
# Copyright 2013-2015 Carlo Oliveira <carlo@nce.ufrj.br>,
# `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__.
#
# Activlets é um software livre; você pode redistribuí-lo e/ou
# modificá-lo dentro dos termos da ... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
from socketserver import ThreadingTCPServer, StreamRequestHandler
import json
from threading import Thread
import logging
import queue
import traceback
logger = logging.getLogger('Tester')
Timeout = 120
Port = 11800
class RPCServer(ThreadingTCPServer):
def __init__(self, server_address, RequestHandlerClass, b... |
# Copyright 2014 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 by applicable law or agr... |
from south.db import db
from django.db import models
from image_filer.models import *
class Migration:
def forwards(self, orm):
# Adding model 'ImageFilerTeaser'
db.create_table('cmsplugin_imagefilerteaser', (
('cmsplugin_ptr', orm['image_filer.imagefilerteaser:cmsplugin_... |
"""mBuild conversion utilities."""
import numpy as np
def RB_to_OPLS(c0, c1, c2, c3, c4, c5):
"""Convert Ryckaert-Bellemans type dihedrals to OPLS type.
Parameters
----------
c0, c1, c2, c3, c4, c5 : Ryckaert-Belleman coefficients (in kcal/mol)
Returns
-------
opls_coeffs : np.array, sha... |
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import re
import logging
from collections import OrderedDict
import uuid
import functools
import json
import binascii
import calendar
import datetime
import hashlib
import ite... |
# Simple script to generate pkg-config (.pc) file
# for gsettings-desktop-schemas
import os
import sys
import argparse
from replace import replace_multi
from pc_base import BasePCItems
def main(argv):
base_pc = BasePCItems()
fc_parser = argparse.ArgumentParser(description='Setup basic .pc file info')
fc_... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
# intron ops
# Copyright (C) 2015 Harold Pimentel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is ... |
import pytest
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from twosampyle.permtest import PermTest
# ask Stefan: should I create data in each test or create some here and then use it in test?
# also ask about naming convention
def test_DiffMeansForSameDataShouldBeZero():
data = pd.DataF... |
"""Serializers for the Name App Models.
This module leverages the Django Rest Framework's Serializer
components to build JSON representations of the models defined
in this app.
These JSON representations are designed to be backwards compatible
with the API documented in previous versions.
For documentation regarding... |
# -*- coding: utf-8 -*-
"""
Library to manage everything about date and time.
"""
__version__ = "1.0.2"
__author__ = "Sorawee Porncharoenwase"
import datetime
import time
def wrapMonth(m):
"""Convert zero-based month number to zero-based month number."""
m -= 1
if m < 0:
m += 12
if m >= 12:
... |
#!/usr/bin/python
#
# 1. Create a folder daca2-addons in your HOME folder
# 2. Put cppcheck-O2 in daca2-addons. It should be built with all optimisations.
# 3. Optional: Put a file called "suppressions.txt" in the daca2-addons folder.
# 4. Optional: tweak FTPSERVER and FTPPATH in this script below.
# 5. Run the daca2-a... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
"""
Reads in current year's Arctic sea ice extent from Sea Ice Index 3 (NSIDC)
Website : ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/north/daily/data/
Author : Zachary M. Labe
Date : 5 September 2016
"""
### Import modules
import numpy as np
import urllib.request
import urllib as UL
import datetime
impor... |
import unittest
import os
import sys
import time
import gc
from threading import Thread
from yara import Rules
import yara
from yara.libyara_wrapper import yr_malloc_count
from yara.libyara_wrapper import yr_free_count
RULES_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'rules')
class TestRulesMemo... |
# -*- coding: utf-8 -*-
import unittest, os
from ..edfreader import *
class TestEDFBaseReader(unittest.TestCase):
def test_synthetic_content(self):
'''
Test EDF reader using artifical EDF dataset. Note that this is not an
EDF+ dataset and as such does not contain annotations. Annotations decoding
is ... |
# -*- coding: utf-8 -*-
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Javi Manzano', 'javi.manzano.oller@gmail.com'),
)
MANAGERS = ADMINS
ALLOWED_HOSTS = ['176.58.120.22', 'fuzzingtheweb.com']
TIME_ZONE = 'Europe/London'
USE_TZ = True
LANGUAGE_CODE = 'en-gb'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
MEDIA... |
# coding=utf-8
import os
from django.test import TestCase
from django.db import models
from django.core import exceptions
from ckeditor.models import XHTMLField
from ckeditor.models import XMLField
from ckeditor.models import HTML5Field
from ckeditor.models import HTML5FragmentField
from ckeditor.widgets import CKEd... |
# -*- coding: utf-8 -*-
from lxml import etree, objectify
import base64
import re
import os
from datetime import datetime
import dateutil.parser
import xmlformatter
## Codis OCSUM - F1
# Codi periode
codigoPeriodo_to_P = {
1:'P1', 03:'P2',10:'P1',21:'P1',22:'P2',31:'P1',32:'P2',33:'P3',41:'P1',
42:'P... |
# Copyright (C) 2015-2016 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# a... |
import json
import unittest
import responses
import digitalocean
from .BaseTest import BaseTest
class TestLoadBalancer(BaseTest):
def setUp(self):
super(TestLoadBalancer, self).setUp()
self.lb_id = '4de7ac8b-495b-4884-9a69-1050c6793cd6'
self.vpc_uuid = "c33931f2-a26a-4e61-b85c-4e95a2ec43... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2010 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... |
#!/usr/bin/env python
# GETcolors by John Herndon
import argparse
import sys
from PIL import Image
version = '1.0.0'
def verbose(verbosity, message):
if verbosity:
print message
output_header = '''\
______ _______ _______ _______ _____ _____ ______ _______
| ____ |______ | | ... |
from sqlalchemy import (
BigInteger,
Binary,
Column,
DateTime,
Integer,
Numeric,
String,
)
from sqlalchemy.dialects.postgresql import JSON, TIMESTAMP
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
Base = declarative_base()
class OsmBase(Base):
... |
#from dask.distributed import Client
import xarray as xr
import numpy as np
import pandas as pd
import importlib
import ELMlib
importlib.reload(ELMlib)
#client = Client(n_workers=2, threads_per_worker=2, memory_limit='1GB')
#client
#ds = xr.open_dataset('../Data/14C_spinup_holger_fire.2x2_small.nc')
from netCDF4 imp... |
# TmServer - TissueMAPS server application.
# Copyright (C) 2016 Markus D. Herrmann, University of Zurich and Robin Hafen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version... |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.encoding... |
__author__ = 'Amin'
import sys
import math
# Test 1 -
# Provided Input: Abcde fghij klmno pqrs tuv wxyz
# Expected Output: true
# Test 2 -
# Provided Input: this sentence does not have what it should
# Expected Output: false
# Test 3 -
# Provided Input: Portez ce vieux whisky au juge blond qui fume
# Expected Output... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
"""
WSGI config for arsoft.web.filewatch project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level v... |
# https://projecteuler.net/problem=50
import math
def get_prime_list(n):
"""
Returns a list of primes < n
Function taken from:
http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n/3035188#3035188
"""
sieve = [True] * n
for i in xrange(3,int(... |
"""Verifies that instance_links are being retrieved properly from LINKS. Verifies that app_data.json.j2
contains the instance link information"""
from unittest import mock
from foremast.app import SpinnakerApp
@mock.patch('foremast.app.spinnaker_app.LINKS', new={'example1': 'https://example1.com'})
def test_default_i... |
import sublime, sublime_plugin
import re
from collections import namedtuple
BracketPosition = namedtuple("BracketPosition", "position opener")
BracketResult = namedtuple("BracketResult", "success start end")
# House keeping for the async beast
activeChecks = 0
dismissedChecks = 0
# scopeNames is used to... |
from setuptools import setup, find_packages
version = '0.1.0'
LONG_DESCRIPTION = open("README.rst").read()
setup(
name='django-easy-profiles',
version=version,
description="django-easy-profiles",
long_description=LONG_DESCRIPTION,
classifiers=[
"Development Status :: 2 - Pre-Alpha",
... |
# -*- coding: utf-8 -*-
# flake8: noqa
# pylint: skip-file
"""Python 2/3 compatibility
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
Borrowed from
https://github.com/mitsuhiko/flask/blob/master/flask/_compat.py
""... |
# Licensed to the StackStorm, Inc ('StackStorm') 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"); you may not use th... |
# encoding=utf8
import datetime
from distutils.version import StrictVersion
import hashlib
import os.path
import shutil
import socket
import sys
import time
import random
import seesaw
from seesaw.config import NumberConfigValue
from seesaw.externalprocess import ExternalProcess
from seesaw.item import ItemInterpolati... |
import pandas as pd
#import urllib2 # python2
import urllib.request as urllib2
# import StringIO # python2
from io import StringIO
import gzip
import sys
def getGeneAssociation(URL_or_file):
"""
This function collects GO annotation from http://geneontology.org/page/download-annotations.
:param URL_or_fil... |
# 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 distributed in the hope that it will be useful,
# bu... |
#!/usr/bin/python
# Reads from mysql database into a local sqlite database.
import mysql.connector
import sqlite3
import re
# Create Tables.
target = sqlite3.connect('data.db')
tc = target.cursor()
tc.execute('CREATE TABLE components (entity_id, component_id, component_type)')
tc.execute('CREATE TABLE reactions (r... |
# encoding: utf-8
from __future__ import unicode_literals
from bson import ObjectId as OID
from collections import MutableMapping
from datetime import datetime, timedelta
from .base import Field
from ....schema import Attribute
from ....schema.compat import unicode
class ObjectId(Field):
__foreign__ = 'objectId'
... |
# -*- coding: utf-8 -*-
"""The application's model objects"""
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
#from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
# Global session manager: DBSession() returns the Thread-l... |
from __future__ import print_function
import six
import logging
from .error import TweepError
from .api import API
import requests
from requests_oauthlib import OAuth1Session, OAuth1
from requests.auth import AuthBase
from six.moves.urllib.parse import parse_qs
WARNING_MESSAGE = """Warning! Due to a Twitter API bug,... |
"""Unit tests for the Paver asset tasks."""
import os
from unittest import TestCase
import ddt
from mock import patch
from paver.easy import call_task, path
from watchdog.observers import Observer
from pavelib.assets import COLLECTSTATIC_LOG_DIR_ARG, collect_assets
from ..utils.envs import Env
from .utils import Pa... |
# -*- coding: utf-8 -*-
from pprint import pprint
import yaml
import praw
import pymongo
import utils
HOT_LIMIT = 10
OLD_CONTENT = pymongo.MongoClient()['telegraph_digest']['content']
def normalization_coef(data):
return 1 / (sum(data) / len(data))
def was_before(url):
doc = {
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 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
f... |
from PyQt5 import QtWidgets
from PyQt5 import QtCore
import os
import glob
from .chart import Chart
def read_file(path):
with open(path, 'r') as fh:
return fh.read().strip()
class NetworkUsageProvider(object):
delay = 1
def __init__(self, main_window):
self.network_enabled = False
... |
from __future__ import absolute_import
import responses
from sentry.utils.compat.mock import patch
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from sentry.integrations.issues import IssueSyncMixin
from sentry.models import Integration
from sentry.testutils import API... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @Daddy_Blamo wrote this file. As long as you retain this notice you
# can do whatever you want wi... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import base64
import json
import pytest
from django.contrib.auth import get_user_model
from django.urls import NoReverseMatch, reverse
from model_bakery import baker
from apps.lecturers.models import Lecturer, ... |
import logging
import json
import requests
import time
from collections import namedtuple
try:
from urllib.parse import urlparse as parse_url
except ImportError:
from urlparse import urlparse as parse_url
from .exceptions import (
SocketIOError, ConnectionError, TimeoutError, PacketError)
from .symmetries ... |
"""Evaluation for eye.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
import eye_model
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('eval_dir', ... |
#MODULO RESERVACIONES - BASE DE DATOS
import os
import sys
import sqlite3
import moduloinicio
import moduloreservaciones
def nombre():
letras = [' ','A','B','C','D','E','F','G','H','I','J','K','L','M','N','Ñ','O','P','Q','R','S','T','U','V','W','X','Y','Z','a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
from django.conf import settings
config = settings.CSV2_CONFIG
from django.shortcuts import render, get_object_or_404, redirect
from django.views.decorators.csrf import requires_csrf_token
from django.http import HttpResponse
from django.core.exceptions import PermissionDenied
from cloudscheduler.lib.fw_config import... |
# -*- coding: utf-8 -*-
'''
Created on 23/10/2015
@author: david
'''
import logging
import math
import time
import imu6050_defs as reg
from sensors.I2CSensor import I2CSensor
from sensors.vector import Vector
from copy import deepcopy
from flight.stabilization.state import SensorState
try:
import smbus
ex... |
"""
Unit tests for the Citadel application
"""
from citadel.fields import SecretField
from citadel.types import Secret
from django.core.exceptions import ValidationError
from django.test import TestCase
class EncryptionTestCase(TestCase):
def simulate_db_load(self, secret):
sf = SecretField()
# s... |
"""Numpydoc-style docstring parsing.
.. seealso:: https://numpydoc.readthedocs.io/en/latest/format.html
"""
import inspect
import itertools
import re
import typing as T
from .common import (
Docstring,
DocstringDeprecated,
DocstringMeta,
DocstringParam,
DocstringRaises,
DocstringReturns,
... |
import os
import re
from collections import defaultdict
from operator import itemgetter
import logging
import pandas
from scipy.interpolate import InterpolatedUnivariateSpline as spline
from george import kernels
import matplotlib.pyplot as plt
import numpy as np
import george
import emcee
import StarData
import Spect... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
#
# Copyright (c) 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any late... |
#!/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");... |
#_________________________________________________________________________
import fileinput
from contextlib import contextmanager
@contextmanager
def line_bind(line, *ctors, splitter=lambda l: l.split(' '), do=None):
'''
Split `line` argument producing an iterable of mapped elements, in the sense of `ctors`.... |
from setuptools import setup
version = '0.5.dev0'
long_description = '\n\n'.join([
open('README.rst').read(),
open('TODO.rst').read(),
open('CREDITS.rst').read(),
open('CHANGES.rst').read(),
])
install_requires = [
'Django',
'django-extensions',
'django-nose',
'lizard-ui',
'pk... |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Thu Apr 11 15:07:58 2013 by generateDS.py version 2.9a.
#
import sys
from mixbox.binding_utils import *
from stix.bindings import register_extension
im... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
frappe.translate
~~~~~~~~~~~~~~~~
Translation tools for frappe
"""
import frappe, os, re, codecs, json
from frappe.utils.jinja import render_include
from frappe.utils im... |
import logging
import sys
import unittest
from apgl.io.CsvGraphReader import CsvGraphReader
from apgl.util.PathDefaults import PathDefaults
import numpy
class CsvGraphReaderTest(unittest.TestCase):
def setUp(self):
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
def testReadFromFile(self)... |
#!/usr/bin/python
# *****************************************************************************
#
# Copyright (c) 2016, EPAM SYSTEMS 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
#
#... |
"""
Unit tests for third_party_auth SAML auth providers
"""
import mock
from third_party_auth.tests.testutil import SAMLTestCase
from third_party_auth.saml import EdXSAMLIdentityProvider, get_saml_idp_class
from third_party_auth.tests.data.saml_identity_provider_mock_data import mock_conf, mock_attributes,\
expec... |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
"""
atlas.backup_operations
~~~~
Commands that run on servers to create, restore, and remove backups.
Instance methods:
Delete - Local - Remove backup files.
"""
import logging
import os
from datetime import datetime
from time import time
from atlas import utilities
from atlas.config import (ENVI... |
# vim:fileencoding=utf-8
import requests
import json
from .oauth import BaseOAuth2
from ..exceptions import AuthFailed
from ..utils import handle_http_errors
class LineOAuth2(BaseOAuth2):
name = 'line'
AUTHORIZATION_URL = 'https://access.line.me/dialog/oauth/weblogin'
ACCESS_TOKEN_URL = 'https://api.line... |
# 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
# distribu... |
import os
import jinja2
import webapp2
"""
For Unit testing:
https://cloud.google.com/appengine/docs/python/tools/handlertesting
"""
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
def prep_template... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.