src stringlengths 721 1.04M |
|---|
import pdb
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from apps.user_management.models import Profile
# TODO test: sudo_listed_in_main, test failed roadmap creation (incorrect form)
def common_setup(... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HP1_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HP1_ConnectedLHS.
"""
# Flag this ins... |
import struct
from StringIO import StringIO
#The crypt_mnt_ftr structure - see /system/vold/cryptfs.h
CRYPT_MNT_FTR = [('magic' , 'I'),
('major_version' , 'H'),
('minor_version' , 'H'),
('ftr_size' , 'I'),
('flags' , 'I'),
... |
"""Sensitive variant calling using VarDict.
Defaults to using the faster, equally sensitive Java port:
https://github.com/AstraZeneca-NGS/VarDictJava
if 'vardict' or 'vardict-java' is specified in the configuration. To use the
VarDict perl version:
https://github.com/AstraZeneca-NGS/VarDict
specify 'vardict-perl'.... |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
str = type('')
import os
import sys
from textwrap import dedent
from itertools import cycle
from operator import attrgetter
from collections import namedtuple
from ..exc import PinUnknownPi, PinMultiplePins, Pi... |
"""
ISPAQ Business Logic for Orientation Check Metrics.
:copyright:
Mazama Science
:license:
GNU Lesser General Public License, Version 3
(http://www.gnu.org/copyleft/lesser.html)
"""
from __future__ import (absolute_import, division, print_function)
import numpy as np
import pandas as pd
from .concierg... |
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------------------------------------------------... |
#!bin/python
# TSV to Dublin Core/McMaster Repository conversion tool
# Matt McCollow <mccollo@mcmaster.ca>, 2011
# Nick Ruest <ruestn@mcmaster.ca>, 2011
from DublinCore import DublinCore
import csv
from sys import argv
from xml.dom.minidom import Document
from os.path import basename
DC_NS = 'http://purl.org/dc/ele... |
# coding=utf-8
from codecs import open as codecs_open
from itertools import chain, takewhile
from time import time
from re import match as re_match
from brat_widget.common import ProtocolError
from brat_widget.messager import Messager
# String used to catenate texts of discontinuous annotations in reference text
DISC... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from mock import patch
import os
import logging
from django.conf import settings
from django.utils.hashcompat import md5_constructor
from transifex.txcommon.tests import base
from transifex.resources.formats.compilation import \
NormalDecoratorBuilde... |
from couchpotato import get_session
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import ss
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.plugins.scanner.main import ... |
# -*- coding: utf-8 -*-
#
# pygit2 documentation build configuration file, created by
# sphinx-quickstart on Sun Jan 6 09:55:26 2013.
#
# 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 ... |
# Number-to-binary game
# Copyright (C) 2013 Jonathan Humphreys
# 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.
# Thi... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Tom van Steijn, Royal HaskoningDHV
from xsboringen.borehole import Borehole, Segment, Vertical
from xsboringen.cpt import CPT
from xsboringen import utils
from collections import defaultdict, namedtuple
from pathlib import Path
import textwrap
import logging
import os
... |
"""
Example usage
-------------
Generate Newton-Cotes quadrature rules::
>>> distribution = chaospy.Uniform(0, 1)
>>> for order in range(5):
... abscissas, weights = chaospy.generate_quadrature(
... order, distribution, rule="newton_cotes")
... print(order, abscissas.round(3), wei... |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2011 - 2014 by Wilbert Berendsen
#
# 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
... |
"""
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.
Example:
Given 1->2->3->4->5->N... |
"""
Swisscows (Web, Images)
@website https://swisscows.ch
@provide-api no
@using-api no
@results HTML (using search portal)
@stable no (HTML can change)
@parse url, title, content
"""
from json import loads
from urllib import urlencode, unquote
import re
from lxml.html import fromstring
... |
class PyType:
NEW_METHOD = "__new__"
INIT_METHOD = "__init__"
DEL_METHOD = "__del__"
REPR_METHOD = "__repr__"
STR_METHOD = "__str__"
BYTES_METHOD = "__bytes__"
FORMAT_METHOD = "__format__"
LT_METHOD = "__lt__"
LE_METHOD = "__le__"
EQ_METHOD = "__eq__"
NE_METHOD = "__ne__"
... |
#!/usr/bin/env python
"""
A CLI tool to list long running Rackspace Cloud servers.
Dependencies:
This script uses several 3rd party Python modules. You should install
them in a virtualenv with the following command:
.. code:: shell
$ pip install eventlet humanize iso8601 requests tabulate
Note:
... |
# -*- coding: utf-8 -*-
import re
import json
import os
from pyload.core.network.request_factory import get_url
import xml.etree.ElementTree as etree
import pycurl
from ..base.downloader import BaseDownloader
# Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/)
class ZDF(BaseDownloader):
__name__... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010--2012 Peter Dinges <pdinges@acm.org>
#
# 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 la... |
'''
Copyright 2014 Travel Modelling Group, Department of Civil Engineering, University of Toronto
This file is part of the TMG Toolbox.
The TMG Toolbox 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 Fou... |
from unittest import TestCase
from mangrove_libs import common
from mangrove_libs.interface import Interface
from storage.mysql import Database
import re
class InterfaceTestCase(TestCase):
@classmethod
def setUpClass(self):
config = common.getConfig("mangrove-crawler-config.json.test", "default_collection")
self... |
import random, time
currPlayerHitToken = True
currOpponentHitToken = True
class GenerateMonster():
def __init__(self, name, health, gold, weapon, ac):
self.name = name
self.health = health
self.gold = gold
self.weapon = weapon
self.ac = ac
def checkMissPlayer(defender):
"... |
import os,sys
from os.path import join
import ctools
from ctoolsAnalysis.config import get_config,get_default_config
from ctoolsAnalysis.LikeFit import CTA_ctools_analyser
from Common_Functions import *
Astropy = True
try :
import Coordinates.CoordHandler as CH
import Coordinates.CoordUtilities as CU
from ... |
import pytest
pytestmark = pytest.mark.slow
version_file_content = """
major = 1
minor = 0
patch = 0
"""
config_file_content = """
__config_version__ = 1
GLOBALS = {
'serializer': {
'semver': {
'search': 'Next Release',
'replace': '{{major}}.{{minor}}.{{patch}}'
}
},
... |
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Canonical Ltd.
# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
# Copyright (C) 2012 Yahoo! Inc.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
# Author: Joshua Harlow <harlowja@yaho... |
#!/usr/bin/env python
"""
A lightweight python-based FITS viewer.
The controls should be self-explatory. If they are not, press ctrl+h for a
stop-gap and submit an issue. Controls ought to be obvious, help me make them.
This is a program for looking at images, not for doing analysis.
TODO:
Doesn't quite display corr... |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... |
import subprocess
import os
import utfutil
import sys
# Make sure repy.py works when invoked with options in a various
# order (to test that adding getopt worked.)
def main():
args = [sys.executable, 'repy.py',
'--simple',
'--logfile', 'log.log',
'restrictions.loose',
... |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
import asyncio
import time
from gpiozero import DigitalOutputDevice
from .message import TimedMessage
from .symbol_mapping import SYMBOL
class SevenSegmentDisplayMessageData:
def __init__(self, display, message):
self._data = []
self._length = 0
self._display_window_size = display.windo... |
import logging
import urllib
from collections import defaultdict
from lxml import html
from django.conf import settings
from django.core.context_processors import csrf
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User, Anonymo... |
import discord
from os import path, makedirs, remove
import STATICS
ROLE_NAME = "Supporter"
perm = 2
description = "Mute members on guild in chat"
def get_mutes(server):
if not path.isdir("SAVES/" + server.id):
makedirs("SAVES/" + server.id)
if path.isfile("SAVES/" + server.id + "/mutes"):
... |
from django.test import TestCase
from django.core.urlresolvers import reverse
from djangojsonmodel.convert import jsmodels
from djangojsonmodel.contrib.human.mappings import shortnames
from djangojsonmodel.contrib.human.urls import drf
from .urls import urlpatterns
from .urls_api import router
from pprint import ppr... |
from keras.models import Sequential, load_model
from keras.layers import *
from qlearning4k.games import Snake
from keras.optimizers import *
from qlearning4k import Agent
from lib import kerasimo
grid_size = 10
nb_frames = 4
nb_actions = 5
snake = Snake(grid_size)
model = load_model('models/snake.hdf5')
#model = Se... |
from __future__ import absolute_import
import traceback
import os, errno
import shutil
from .signal import interrupt_protect
class FileSystemAdapter(object):
def __init__(self, path, **kwargs):
# expand ~ or we'll end up creating a /~ directory
# abspath doesn't do this for us
self.path = ... |
"""
GPU utilities.
"""
from functools import wraps
from math import ceil
# Load everything we need in this module from PyCUDA (but don't autoinit until
# requested).
try:
from pycuda.tools import DeviceData
except ImportError:
_pycuda_available = False
else:
_pycuda_available = True
# Is this thing on?
... |
from djangosanetesting import cases
from django.contrib.auth.models import User,Permission
from django.contrib.contenttypes.models import ContentType
import denorm
from denorm import denorms
import models
class TestSkip(cases.DestructiveDatabaseTestCase):
"""
Tests for the skip feature.
"""
def ... |
"""
It is easily proved that no equilateral triangle exists with integral length
sides and integral area. However, the almost equilateral triangle 5-5-6 has an
area of 12 square units.
We shall define an almost equilateral triangle to be a triangle for which two
sides are equal and the third differs by no more than on... |
# -*- coding: utf-8 -*-
import argparse
import pdb
import traceback
from collections import deque
from re import findall
from typing import Dict, List, Tuple
from intcode import Intcode
from point import Point
from rect import Rectangle
def extract_ints(line: str) -> List[int]:
return [int(x) for x in findall(r... |
# -*- coding: utf-8 -*-
"""Sequence-to-sequence model module
Copyright (c) 2017 Takaaki Hori (thori@merl.com)
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
"""
import six
import chainer
import chainer.functions as F
from chainer import cuda
import numpy as... |
import os
import subprocess
import xmlrpc.server as rpc
import time
import sys
import multiprocessing as mp
try:
import pydivert
except ImportError:
pass
class LinuxDelayHandler:
@staticmethod
def get_interface_name():
""" Get the first interface name that is not the localhost. """
ne... |
## This file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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... |
from ftw import logchecker, testrunner
import pytest
import random
class LoggerTestObj(logchecker.LogChecker):
def __init__(self):
self.do_nothing = False
def generate_random_logs(self):
if self.do_nothing:
return []
else:
return [str(self.start) + ' rule-id-' ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
import hashlib
class Dweet(models.Model):
content = models.CharField(max_length=140)
user = models.ForeignKey(User)
creation_date = models.DateTimeField(auto_now=True, ... |
# Copyright 2013 IBM Corp.
# 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 agr... |
import tensorflow as tf
import numpy as np
class TextCNN(object):
"""
A CNN for text classification.
Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer.
"""
def __init__(
self, sequence_length, num_classes, vocab_size,
embedding_size, filter_sizes, ... |
from unittest import TestCase
from structures.stack import *
class TestStack(TestCase):
def test_push(self):
stack = Stack()
for i in range(10):
stack.push(i)
for i in range(9, -1, -1):
self.assertEqual(stack.pop(), i)
def test_pop(self):
stack = Stack(... |
# coding: utf-8
from sqlalchemy import Column, DateTime, ForeignKey, Integer, Numeric, String, Table, Text
from sqlalchemy.orm import relationship
from sqlalchemy.schema import FetchedValue
from flask_sqlalchemy import SQLAlchemy
from iSoft import db
class FaAppVersion(db.Model):
__tablename__ = 'fa_app_version'
... |
##
# Copyright (c) 2005-2017 Apple 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 l... |
# encoding: utf-8
# module gtk.gdk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/pynotify/_pynotify.so
# by generator 1.135
# no doc
# imports
from exceptions import Warning
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
import pango as __pango
import pangocairo as __p... |
from sppy.spapi_cffi import SophiaApi
from sppy.spapi_cffi_cdef import sophia_api_cdefs
from sppy.spapi_cffi_codecs import *
sp = SophiaApi( '../../sophia/sophia1.2.2/libsophia.so.1.2.2',sophia_api_cdefs['1.2.2'] )
codec_u32 = U32(sp.ffi)
dbname = 'test'
env = sp.env()
print "get env object",env.cd
typ = sp.type(en... |
from ..adapters.postgres import Postgre, PostgreNew
from .base import SQLRepresenter, JSONRepresenter
from . import representers, before_type, for_type
from ..helpers.serializers import serializers
@representers.register_for(Postgre)
class PostgreRepresenter(SQLRepresenter, JSONRepresenter):
def _make_geoextra(se... |
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Copyright (C)2017 William H. Majoros (martiandna@gmail.com).
#==============================... |
# 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 compliance with the License. You may obtain
# a ... |
#!/usr/bin/env python3
# ====================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# ====================================
"""Urllib2 HttpClient."""
import httplib
import socket
import time
import traceback
import urllib2
from httpclient import *
from workerexception import *
P... |
'''
NAME
NetCDF with Python
PURPOSE
To demonstrate how to read and write data with NetCDF files using
a NetCDF file from the NCEP/NCAR Reanalysis.
Plotting using Matplotlib and Basemap is also shown.
PROGRAMMER(S)
Chris Slocum
REVISION HISTORY
20140320 -- Initial version created and posted onlin... |
# import_export_batches/controllers_ballotpedia.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import create_batch_from_json_wrapper, BATCH_HEADER_MAP_BALLOT_ITEMS_TO_BALLOTPEDIA_BALLOT_ITEMS, \
BATCH_HEADER_MAP_CANDIDATES_TO_BALLOTPEDIA_CANDIDATES, BATCH_HEADER_MAP_CONTEST_OFFICES_T... |
# -*- coding: utf-8 -*-
import csv
import sys
from sunshine import (
CONVENTION_HEADERS,
build_qualification,
build_address,
build_rpps,
clean_text,
build_eta,
build_name,
build_origin
)
from utils import str2date
def build_programme(row):
nature = " ".join((row["conv_manifestatio... |
#!/usr/bin/env python
#author: Peter Thorpe September 2016. The James Hutton Insitute,Dundee,UK.
#Title:
#script to get the gene columns only from GFF"
#imports
import os
import sys
from sys import stdin,argv
import sys
import datetime
from optparse import OptionParser
##############################################... |
from django.http import Http404
from django.contrib.auth.decorators import login_required
from django.db.models import F
from adlt.common.helpers import ajax
import adlt.core.models as core_models
@ajax.request('GET')
def agent_list(request): # pylint: disable=unused-argument
return [
{
'pk'... |
"""
Django settings for blpass 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, ...)
imp... |
import requests,re,time,xbmcaddon
import resolveurl as urlresolver
from ..common import clean_title, clean_search,send_log,error_log
from ..scraper import Scraper
dev_log = xbmcaddon.Addon('script.module.universalscrapers').getSetting("dev_log")
User_Agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTM... |
# -*- coding: UTF-8
""" Message plugins container service implementation
Classes
=======
Environment -- Message plugin environment
Service -- Message plugins container service
Wrapper -- Message plugin environment wrapper
Output -- Output wrapper
Attributes
==========
PLUGIN_TYPES ... |
import os, sys, re, shutil, tarfile, subprocess
j = os.path.join
class Cd(object):
"""
Cd is a context manager that allows
you to temporary change the working directory.
with Cd(dir) as cd:
...
"""
def __init__(self, directory):
self._dir = directory
def orig(self):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2013, IOhannes m zmölnig, IEM
# This file is part of WILMix
#
# 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 th... |
import unittest
from unittest.mock import patch, MagicMock
import os
from listenbrainz import stats
from listenbrainz import bigquery
from listenbrainz.stats.exceptions import NoCredentialsVariableException, NoCredentialsFileException
from listenbrainz import config
bigquery_responses = {
"done": {
"jobRe... |
from _pydevd_bundle.pydevd_constants import ForkSafeLock, get_global_debugger, IS_PY2
import os
import sys
from contextlib import contextmanager
class IORedirector:
'''
This class works to wrap a stream (stdout/stderr) with an additional redirect.
'''
def __init__(self, original, new_redir... |
"""Tests for the catalog serializers"""
import pytest
from cms.models import ProgramFaculty
from cms.factories import ProgramPageFactory
from courses.catalog_serializers import CatalogProgramSerializer
from courses.factories import (
CourseFactory,
CourseRunFactory,
ProgramFactory,
)
@pytest.mark.django_... |
import functools
import os
import threading
import unittest
import numpy
import pytest
import cupy
from cupy import cuda
from cupy.cuda import runtime
from cupy.random import _generator
from cupy import testing
from cupy.testing import _attr
from cupy.testing import _condition
from cupy.testing import _hypothesis
fr... |
import logging
import os
import re
import asyncio
from collections import OrderedDict
from PyQt5.QtCore import QObject, QCoreApplication, QUrl, pyqtSignal, pyqtSlot
from PyQt5.QtQml import QQmlApplicationEngine
from PyQt5.QtGui import QGuiApplication, QIcon
from PyQt5.QtQuick import QQuickItem
import settings
import f... |
"""Level editor module."""
from enum import Enum, unique
import sdl2
import numpy
import itertools
import OpenGL.GL as GL
import typingdefense.vector as vector
import typingdefense.glutils as glutils
import typingdefense.util as util
import typingdefense.enemy as enemy
import typingdefense.text as text
import typingdef... |
# -*- coding: utf-8 -*-
import os.path
import shlex
import sys
import unittest
import pycodestyle
from testsuite.support import ROOT_DIR, PseudoFile
E11 = os.path.join(ROOT_DIR, 'testsuite', 'E11.py')
class DummyChecker(object):
def __init__(self, tree, filename):
pass
def run(self):
if Fal... |
# Copyright 2009-2010 by Ka-Ping Yee
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
'''
This module contains database routines that may be accessed with or without using a web framework.
'''
###TODO: need to put the project and the app on the python path so these imports work (a copy of settings.py is in the current directory for now)
#I think all we realy need to do is make sure the settings modul... |
# Copyright 2019 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, ... |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... |
'''
Test suite for histogram.axis class.
'''
__author__ = "Juan PALACIOS juan.palacios@nikhef.nl"
from nose import tools as nt
from pyhistuples.pyhistogram.histogram import Axis
def test_instantiate_axis() :
ax = Axis(100, -50, 50, "My first axis")
nt.assert_true(ax is not None)
def test_axis_parameters()... |
# -*- coding: utf-8 -*-
import os
from base64 import standard_b64decode
from functools import wraps
from urllib.parse import unquote
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
import flask
from flask.json import jsonify
from p... |
# -*- coding: utf-8 -*-
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase,client
from django.core.urlresolvers import reverse,resolve
from django.conf im... |
#!/usr/bin/env python3
import pytest
from providers.sendgrid import SendGridProvider
from send_error import SendError
import init_test_objects
def test_sendgrid_send_positive():
"""Straightforward sendgrid send test. Will fail if an error is raised by the provider."""
sendgrid_provider = SendGridProvider(ini... |
"""
Nonlinearities
"""
# sigmoid
from theano.tensor.nnet import sigmoid
# softmax (row-wise)
from theano.tensor.nnet import softmax
# tanh
from theano.tensor import tanh
# rectify
def rectify(x):
# The following is faster than T.maximum(0, x),
# and it works with nonsymbolic inputs as well.
# Thanks to... |
import os.path
import datetime
import traceback
from random import shuffle
from itertools import islice
from collections import deque
from urllib.error import URLError
from youtube_dl.utils import ExtractorError, DownloadError, UnsupportedError
from .utils import get_header
from .lib.event_emitter import EventEmitte... |
import cPickle as pickle
import copy
import time
import itertools
import numpy
from etl import ETLUtils
from evaluation import precision_in_top_n
from recommenders.context.baseline.simple_user_baseline_calculator import \
SimpleUserBaselineCalculator
from recommenders.context.baseline.user_baseline_calculator impor... |
"""
Created on Mon Jun 15 15:42:23 2020
@author: sturdzal
"""
#@title Imports
from shapely.geometry import LineString, MultiLineString, MultiPoint, Point
from shapely.ops import cascaded_union
from scipy.special import comb
from itertools import product
import scipy.stats as stats
import matplotlib.pyplot ... |
# Copyright (c) 2014 Rackspace
#
# 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,... |
#!/usr/bin/env python
import argparse
import base64
import re
import sys
import time
import pexpect
class StdioStream(object):
def pull(self):
return sys.stdin.read()
def push(self, data):
return sys.stdout.write(data)
class LocalStream(object):
def __init__(self, spec):
self.sp... |
# EVE-Central.com Contribtastic
# Copyright (C) 2005-2012 StackFoundry LLC
#
# 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 opti... |
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.utils import timezone
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.core.files.ba... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import codecs
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding='utf-8').read()
version = '0.3.2.dev0'
setup(
name='nodev.specs',
version=version,
... |
#!/usr/bin/env python
"""
This file is part of open-ihm.
open-ihm 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.
open-ihm is di... |
#!/usr/bin/env python
import unittest
from py2030.components.omxvideo import OmxVideo
from py2030.event_manager import EventManager
class TestOmxVideo(unittest.TestCase):
def test_init(self):
omxvideo = OmxVideo()
self.assertEqual(omxvideo.player, None)
self.assertIsNone(omxvideo.event_man... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Wrapper to trim and correct sequence data.
"""
import os
import os.path as op
import sys
import logging
from jcvi.formats.base import BaseFile, write_file, must_open
from jcvi.formats.fastq import guessoffset
from jcvi.utils.cbook import depends, human_size
from jcvi... |
# -*- coding: utf-8 -*-
"""Definition of modules for collecting data from GRR Hunts."""
import os
import tempfile
import zipfile
import yaml
from grr_response_proto import flows_pb2 as grr_flows
from dftimewolf.lib.collectors import grr_base
from dftimewolf.lib.containers import containers
from dftimewolf.lib.module... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.